Commit graph

78 commits

Author SHA1 Message Date
peter klausler
f100d8b192 [flang] Issue 98, better error recovery for specification-part
Original-commit: flang-compiler/f18@0b0812a82b
Reviewed-on: https://github.com/flang-compiler/f18/pull/103
2018-06-14 10:17:54 -07:00
peter klausler
efed300483 [flang] Allow tab in fixed form compiler directives. Reformat C++.
Original-commit: flang-compiler/f18@59ba17cb24
Reviewed-on: https://github.com/flang-compiler/f18/pull/102
2018-06-14 09:35:38 -07:00
Hongyon Suauthai
ed465b9918 [flang] Remove unintended change.
Original-commit: flang-compiler/f18@a545cd5de4
Reviewed-on: https://github.com/flang-compiler/f18/pull/96
Tree-same-pre-rewrite: false
2018-06-01 11:54:43 -07:00
Hongyon Suauthai
db9bfab89d [flang] add more clauses, declarative directives, standalone directives, and directives enclosing do loop.
Original-commit: flang-compiler/f18@483a54b0c8
Reviewed-on: https://github.com/flang-compiler/f18/pull/96
Tree-same-pre-rewrite: false
2018-05-31 07:38:15 -07:00
peter klausler
adcfd4a0f5 [flang] clang-format
Original-commit: flang-compiler/f18@acb149dc7c
Reviewed-on: https://github.com/flang-compiler/f18/pull/90
2018-05-16 10:00:14 -07:00
peter klausler
7e2d19d5da [flang] Fine tuning of space recognition.
Original-commit: flang-compiler/f18@622befa9ca
Reviewed-on: https://github.com/flang-compiler/f18/pull/90
Tree-same-pre-rewrite: false
2018-05-16 09:59:43 -07:00
peter klausler
454f909cbc [flang] Fix tokenization of signed-int-literal-constant, allow internal space.
Original-commit: flang-compiler/f18@afa6425b48
Reviewed-on: https://github.com/flang-compiler/f18/pull/90
Tree-same-pre-rewrite: false
2018-05-16 09:59:41 -07:00
Hongyon Suauthai
afac6ff43d [flang] Modified directive names and clauses to reflect in OpenMP Spec.
Original-commit: flang-compiler/f18@c2f756f478
Reviewed-on: https://github.com/flang-compiler/f18/pull/91
2018-05-16 09:49:35 -07:00
Hongyon Suauthai
6f7b4fa691 [flang] Add OpenMP parallel directives and private/firstprivate clauses to parser.
Original-commit: flang-compiler/f18@ea8abe45cc
Reviewed-on: https://github.com/flang-compiler/f18/pull/91
Tree-same-pre-rewrite: false
2018-05-16 07:28:54 -07:00
peter klausler
f9941a20b7 [flang] Fix preprocessor tokenization of .NE. style operators.
Original-commit: flang-compiler/f18@ab547b89e8
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:10 -07:00
peter klausler
45b6e41494 [flang] Ignore spaces in FORMAT specifications, even in free form.
Original-commit: flang-compiler/f18@3f65d35b1c
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:09 -07:00
peter klausler
82294af9c9 [flang] Fix two cosubscript parsing problems with lookahead.
Original-commit: flang-compiler/f18@b490c60fb0
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:08 -07:00
peter klausler
d9ff8df5db [flang] Allow $ and @ in defined operator names.
Original-commit: flang-compiler/f18@3cf7533a3b
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:03 -07:00
Tim Keith
7f66c0ae72 [flang] Normalize namespace definitions.
Replace `namespace Fortran { namespace parser { ... } }` with
`namespace Fortran::parser { ... }` and similarly for semantics.

Original-commit: flang-compiler/f18@838c9539b2
Reviewed-on: https://github.com/flang-compiler/f18/pull/77
Tree-same-pre-rewrite: false
2018-05-02 13:52:36 -07:00
Tim Keith
18cee3e8e6 [flang] Add copyright notices.
For source files (C++, Fortran, CMake) add copyright and license.
For documentation files add just copyright.

Original-commit: flang-compiler/f18@38381aed83
Reviewed-on: https://github.com/flang-compiler/f18/pull/74
2018-05-01 12:50:34 -07:00
peter klausler
8fa4baa5e8 [flang] Use first() more.
Original-commit: flang-compiler/f18@a2f2fdf869
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-25 14:16:15 -07:00
peter klausler
6a0acd8505 [flang] Implement first(...) as attempt at a faster set of alternatives.
Original-commit: flang-compiler/f18@9f6a26cee6
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-25 14:16:15 -07:00
peter klausler
66c98ee4ca [flang] Resolve an old TODO by flattening a std::optional<std::optional<>>.
Original-commit: flang-compiler/f18@05f47831fc
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-25 14:16:14 -07:00
peter klausler
69e3842d60 [flang] Resolve old TODO about needless Indirection<>.
Original-commit: flang-compiler/f18@5f289209c4
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-25 14:16:12 -07:00
peter klausler
2a61c691e8 [flang] Reformat.
Original-commit: flang-compiler/f18@047de95439
Reviewed-on: https://github.com/flang-compiler/f18/pull/69
Tree-same-pre-rewrite: false
2018-04-24 15:26:50 -07:00
peter klausler
29a6c1a83c [flang] Allow construct<T>("TOKEN"_tok)" with unvalued parser argument.
Original-commit: flang-compiler/f18@19d2a4a849
Reviewed-on: https://github.com/flang-compiler/f18/pull/69
Tree-same-pre-rewrite: false
2018-04-24 15:02:41 -07:00
peter klausler
817163f9f5 [flang] Add constructIf<>(); complete pass over grammar.
Original-commit: flang-compiler/f18@4d5b4055bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/69
Tree-same-pre-rewrite: false
2018-04-24 12:41:34 -07:00
peter klausler
fb1397ba57 [flang] Adjust productions in grammar.h so that construct<> invocations span what they cover (more to come)
Original-commit: flang-compiler/f18@ba5c2368d1
Reviewed-on: https://github.com/flang-compiler/f18/pull/69
Tree-same-pre-rewrite: false
2018-04-24 12:41:33 -07:00
peter klausler
925cadcddc [flang] Remove needless empty braces from construct<>() calls.
Original-commit: flang-compiler/f18@f9c4a27034
Reviewed-on: https://github.com/flang-compiler/f18/pull/68
2018-04-23 16:53:16 -07:00
peter klausler
d2306759fc [flang] Finish moving user state action parsers into user-state.{h,cc}.
Original-commit: flang-compiler/f18@79c8a4cefe
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:27 -07:00
peter klausler
4412cb03c4 [flang] More clean-up.
Original-commit: flang-compiler/f18@96dda92286
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:26 -07:00
peter klausler
8800ae5e08 [flang] Begin moving UserState action parsers into user-state.{h,cc}.
Original-commit: flang-compiler/f18@5c31402146
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:25 -07:00
peter klausler
8c110e0af1 [flang] Fix header file name.
Original-commit: flang-compiler/f18@8abfeaed45
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:24 -07:00
peter klausler
48704ef940 [flang] Move Parser<> to its own header.
Original-commit: flang-compiler/f18@c43e8ba138
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:23 -07:00
peter klausler
c387b6d4e4 [flang] Use references for ParseState arguments to parsers. Other minor clean-up.
Original-commit: flang-compiler/f18@5b18b799e7
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:23 -07:00
peter klausler
56b09e08eb [flang] Parser instrumentation and fail-fast experiment begun.
Original-commit: flang-compiler/f18@ab46163d6e
Reviewed-on: https://github.com/flang-compiler/f18/pull/62
Tree-same-pre-rewrite: false
2018-04-19 15:46:02 -07:00
peter klausler
2c06be3fb8 [flang] First cut at parser instrumentation with pass/fail counters.
Original-commit: flang-compiler/f18@21ed700afa
Reviewed-on: https://github.com/flang-compiler/f18/pull/62
Tree-same-pre-rewrite: false
2018-04-19 13:58:02 -07:00
Tim Keith
1c291436f5 [flang] Implement parse tree rewriting.
Add parse-tree-mutator.h like parse-tree-visitor.h except that the Walk
functions take non-const references to parse tree nodes so the Pre and
Post methods of the mutator that are passed around can make changes to
the parse tree.

Change ExecutionPart to be a class that wraps a list so that it can be
identified during parse tree walking.

Add Symbol* field to parser::Name for the result of symbol resolution.
In parse tree dumper, dump symbol when it is there instead of just name.

Add RewriteParseTree to walk the parse tree, fill in resolved symbols in
Name nodes, and make necessary changes to the structure. Currently that
consists of rewriting statement functions as array assignments when
appropriate.

In ResolveNames, call RewriteParseTree if the resolution was successful.
Recognize a statement function that comes after a mis-identified
statement function and report an error. resolve08.f90 tests this case.

Add -fdebug-dump-symbols to dump the scope tree and symbols in each scope.
This is implemented by DumpSymbols in resolve-names.cc. Add an optional
symbol to scopes that correspond to symbols (e.g. subprograms). Remove
debug output from ResolveNamesVisitor as this option can be used instead.

Original-commit: flang-compiler/f18@9cd3372265
Reviewed-on: https://github.com/flang-compiler/f18/pull/60
Tree-same-pre-rewrite: false
2018-04-18 15:06:35 -07:00
peter klausler
bdc1577188 [flang] reformat
Original-commit: flang-compiler/f18@4a4648facd
Reviewed-on: https://github.com/flang-compiler/f18/pull/59
Tree-same-pre-rewrite: false
2018-04-17 16:58:16 -07:00
peter klausler
2db73970bd [flang] fix misrecogition of actual argument "a==b" as keyword "a=" and value "=b"
Original-commit: flang-compiler/f18@52b1837419
Reviewed-on: https://github.com/flang-compiler/f18/pull/57
2018-04-16 15:41:37 -07:00
peter klausler
058fa829fb [flang] fix misrecognition of a bounds-spec-list or bound-remapping-list in a pointer-assignment-stmt
Original-commit: flang-compiler/f18@32148441f5
Reviewed-on: https://github.com/flang-compiler/f18/pull/56
2018-04-16 13:37:54 -07:00
peter klausler
2884b2ebbd [flang] Use DataRef as a better name for the data-ref production. Use DataRef instead of Variable for LHS of pointer assignment.
Original-commit: flang-compiler/f18@ed5aeb8e3c
Reviewed-on: https://github.com/flang-compiler/f18/pull/56
Tree-same-pre-rewrite: false
2018-04-16 13:37:54 -07:00
peter klausler
0f418c7c8d [flang] Simplify proc-component-ref and variable parsing, do not try to support function calls via components of function results.
Original-commit: flang-compiler/f18@05886ddb80
Reviewed-on: https://github.com/flang-compiler/f18/pull/56
Tree-same-pre-rewrite: false
2018-04-16 13:37:53 -07:00
peter klausler
4fc6a4505f [flang] Repair negative scale factors in formats.
Original-commit: flang-compiler/f18@0e90d2db3a
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
Tree-same-pre-rewrite: false
2018-04-09 13:49:28 -07:00
peter klausler
070d908223 [flang] Tweak recent disambiguations after more testing.
Original-commit: flang-compiler/f18@82fb9838b9
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
Tree-same-pre-rewrite: false
2018-04-09 13:49:28 -07:00
peter klausler
ca696230bc [flang] Better solution in grammar for a data statement value parse.
Original-commit: flang-compiler/f18@05b437506a
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
Tree-same-pre-rewrite: false
2018-04-09 13:49:27 -07:00
peter klausler
3274977aa5 [flang] Rearrange alternatives in data statement values to put longer parse earlier.
Original-commit: flang-compiler/f18@867cefaafb
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
Tree-same-pre-rewrite: false
2018-04-09 13:49:25 -07:00
peter klausler
de180f4ed0 [flang] Prevent misrecognition of a digit string that is the kind parameter of a character literal from being misrecognized as an integer literal.
Original-commit: flang-compiler/f18@bd7ed0b162
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
Tree-same-pre-rewrite: false
2018-04-09 13:49:25 -07:00
peter klausler
efc6c480fb [flang] Parse unlimited format item -- needed to adjust its precedence in grammar.
Original-commit: flang-compiler/f18@318bebe485
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
Tree-same-pre-rewrite: false
2018-04-09 13:49:25 -07:00
peter klausler
52b0de7b2a [flang] Parser mistakenly attempted error recovery in specification part when it saw END statement with label.
Original-commit: flang-compiler/f18@69b8ad8380
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
Tree-same-pre-rewrite: false
2018-04-09 13:49:24 -07:00
peter klausler
70895d3da0 [flang] Fix two errors in the grammar (array constructors with type but no values did not consume the ::, and ERR= was omitted from CLOSE(). Add CONVERT= extension to OPEN().
Original-commit: flang-compiler/f18@e3e584f060
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
Tree-same-pre-rewrite: false
2018-04-09 13:49:24 -07:00
peter klausler
382edf056b [flang] Resolve some TODOs in the grammar.
Original-commit: flang-compiler/f18@6ef9e2388b
Reviewed-on: https://github.com/flang-compiler/f18/pull/39
2018-04-03 14:14:39 -07:00
peter klausler
828cff6dbb [flang] Error recovery for specification part.
Original-commit: flang-compiler/f18@187075c7a0
Reviewed-on: https://github.com/flang-compiler/f18/pull/39
Tree-same-pre-rewrite: false
2018-04-03 13:02:40 -07:00
peter klausler
10907c73db [flang] Debugging and a TODO.
Original-commit: flang-compiler/f18@4fab40bc37
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
2018-04-02 16:33:10 -07:00
peter klausler
1e1ea723c5 [flang] Better error recovery, some debugging.
Original-commit: flang-compiler/f18@b7509f0e5b
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
2018-04-02 16:06:18 -07:00