Commit graph

236 commits

Author SHA1 Message Date
peter klausler
0ca0524142 [flang] Document support for CONVERT= extension.
Original-commit: flang-compiler/f18@a4674f0743
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
2018-04-09 15:39:39 -07:00
peter klausler
590afc60da [flang] Add length check so that memcmp() on source does not go past the end of input and make valgrind complain.
Original-commit: flang-compiler/f18@475e9db035
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
Tree-same-pre-rewrite: false
2018-04-09 15:08:38 -07:00
peter klausler
8e7c0089a4 [flang] Fix unparsing of renamed operators in USE statements.
Original-commit: flang-compiler/f18@4152b604e3
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
Tree-same-pre-rewrite: false
2018-04-09 14:52:15 -07:00
peter klausler
bdd93dd995 [flang] Always put parens on unparsed ENTRY statement in case there is a suffix.
Original-commit: flang-compiler/f18@d0d1a5789b
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
Tree-same-pre-rewrite: false
2018-04-09 13:52:06 -07:00
peter klausler
26b5f57876 [flang] Fix unparsing of pointer-decls with deferred shape.
Original-commit: flang-compiler/f18@3c7c7eced5
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
Tree-same-pre-rewrite: false
2018-04-09 13:50:50 -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
217e7ffed3 [flang] Remove a needless std::move() call, and be more careful about line continuation.
Original-commit: flang-compiler/f18@e26421513f
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
3509503e18 [flang] Remove some needless std::move() calls for readability.
Original-commit: flang-compiler/f18@88aadf45dc
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
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
334f47bc76 [flang] Handle pp-directives amid continuations correctly, and fix a Hollerith ambiguity.
Original-commit: flang-compiler/f18@dcd7820a97
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
Tree-same-pre-rewrite: false
2018-04-09 13:49:26 -07:00
peter klausler
a4904e663b [flang] Adjust TODO messages to reflect deliberate behavior.
Original-commit: flang-compiler/f18@9636998ee4
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
Tree-same-pre-rewrite: false
2018-04-09 13:49:26 -07:00
peter klausler
dbd691838b [flang] Fix naming: list_type -> listType
Original-commit: flang-compiler/f18@9bf6adc41c
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
Tree-same-pre-rewrite: false
2018-04-09 13:49:26 -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
c52e5792db [flang] Crash more gracefully when files include themselves.
Original-commit: flang-compiler/f18@6da9ec4228
Reviewed-on: https://github.com/flang-compiler/f18/pull/48
Tree-same-pre-rewrite: false
2018-04-09 13:49:23 -07:00
peter klausler
8ea4a0a060 [flang] Avoid most uses of Boolean-valued Pre() callbacks in unparse.cc.
Original-commit: flang-compiler/f18@f4ea2f94f3
Reviewed-on: https://github.com/flang-compiler/f18/pull/43
2018-04-09 13:47:39 -07:00
Tim Keith
ced6d642e0 [flang] Address review comments.
Make map_type private -- it is not part of the API.

Add cbegin() and cend().

Original-commit: flang-compiler/f18@1ad699dbfd
Reviewed-on: https://github.com/flang-compiler/f18/pull/46
2018-04-09 11:53:20 -07:00
Tim Keith
75e4108d55 [flang] Change API of Scope to match std::map
The Scope can be thought of as (among other things) a mapping of Name to
Symbol. This change reflects that by changing the API to match std::map.

Original-commit: flang-compiler/f18@37f6ad73cc
Reviewed-on: https://github.com/flang-compiler/f18/pull/46
Tree-same-pre-rewrite: false
2018-04-09 10:07:36 -07:00
Steve Scalpone
11465b26fd [flang] Add snippet about trigraphs
Original-commit: flang-compiler/f18@551f2ccd06
Reviewed-on: https://github.com/flang-compiler/f18/pull/45
2018-04-08 21:31:49 -07:00
Tim Keith
0083eb5259 [flang] Address review comments.
Maintain stack of ImplicitRules in parallel with the scope stack.
I doesn't have to live as long as the scopes.

Allow for '_', '$', and '@' in ImplicitRules if they come through from
the parser.

Original-commit: flang-compiler/f18@b70e9fc956
Reviewed-on: https://github.com/flang-compiler/f18/pull/41
2018-04-06 14:09:49 -07:00
Tim Keith
807886fb81 [flang] Address code review comments.
Original-commit: flang-compiler/f18@b0dd895905
Reviewed-on: https://github.com/flang-compiler/f18/pull/41
Tree-same-pre-rewrite: false
2018-04-06 14:09:49 -07:00
Tim Keith
da414d7c3f [flang] Collect implicit type rules and report related errors.
ImplicitRules maintains a mapping of initial character of an identifier
to its implicit type.

ImplicitRulesVisitor visits the ImplicitStmt and related parse tree
nodes and updates the rules.

Emit errors messages in these cases:
- implicit type specified more than once for a letter
- IMPLICIT statement and IMPLICIT NONE in same scope
- IMPLICIT statement and IMPLICIT NONE(TYPE) in same scope
- more than one IMPLICIT NONE in a scope
- IMPLICIT statement with empty range of letters
- IMPLICIT NONE statement after PARAMETER statement
- TYPE or EXTERNAL repeated in an IMPLICIT NONE statement

Also start emitting error messages through the parser::Messages
interface. An instance of Messages is created from the cooked source and
saved in the MessageHandler class. It tracks the source location of the
current statement and provides a way to emit messages associated with
that statement.

Original-commit: flang-compiler/f18@e12fea9850
Reviewed-on: https://github.com/flang-compiler/f18/pull/41
Tree-same-pre-rewrite: false
2018-04-06 14:09:49 -07:00
peter klausler
216999318b [flang] Address review comments.
Original-commit: flang-compiler/f18@66ecc10722
Reviewed-on: https://github.com/flang-compiler/f18/pull/42
2018-04-06 10:34:59 -07:00
peter klausler
91b324ee71 [flang] Generalize semantics/attr.h into enum-set.h, implementing it atop std::bitset.
Original-commit: flang-compiler/f18@d827c8bcc3
Reviewed-on: https://github.com/flang-compiler/f18/pull/42
Tree-same-pre-rewrite: false
2018-04-05 16:49:48 -07:00
peter klausler
8fcc1aaf8c [flang] Improvements to memory-mapped source files.
Original-commit: flang-compiler/f18@67066468e5
Reviewed-on: https://github.com/flang-compiler/f18/pull/42
Tree-same-pre-rewrite: false
2018-04-05 14:39:55 -07:00
peter klausler
2f2a8451cf [flang] Avoid having too many file descriptors open or using mmap() for small files.
Original-commit: flang-compiler/f18@750483a1be
Reviewed-on: https://github.com/flang-compiler/f18/pull/42
Tree-same-pre-rewrite: false
2018-04-05 13:06:36 -07:00
peter klausler
d8dfa408b5 [flang] Correct order of steps in idealized preprocessor description.
Original-commit: flang-compiler/f18@3107999501
Reviewed-on: https://github.com/flang-compiler/f18/pull/42
Tree-same-pre-rewrite: false
2018-04-04 14:32:17 -07:00
peter klausler
ff7d3c7126 [flang] Do not allow "-" to denote standard input on INCLUDE/#include.
Original-commit: flang-compiler/f18@f645036a16
Reviewed-on: https://github.com/flang-compiler/f18/pull/42
Tree-same-pre-rewrite: false
2018-04-04 08:06:15 -07:00
peter klausler
eec3705f58 [flang] Fix __VA_ARGS__, was broken due to typo.
Original-commit: flang-compiler/f18@ba90b1fc27
Reviewed-on: https://github.com/flang-compiler/f18/pull/42
Tree-same-pre-rewrite: false
2018-04-03 15:50:25 -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
41d9cfd728 [flang] Address review comments (thanks!).
Original-commit: flang-compiler/f18@1e61fbaeae
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
2018-04-03 10:29:04 -07:00
peter klausler
eab946db74 [flang] Add documentation.
Original-commit: flang-compiler/f18@4114c9e695
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
2018-04-02 17:00:28 -07:00
peter klausler
b493458e00 [flang] More clean-up in token-parsers.h.
Original-commit: flang-compiler/f18@3202134542
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
2018-04-02 16:44:34 -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
peter klausler
af22e07f71 [flang] Revamp messaging. Add ""_err_en_US to denote fatal error messages.
Original-commit: flang-compiler/f18@7ddc807a1b
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
2018-04-02 15:51:04 -07:00
peter klausler
bb273e9ecb [flang] Fix debug-parser.h after recent merge.
Original-commit: flang-compiler/f18@97b6df606c
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
2018-04-02 11:52:53 -07:00
peter klausler
0fb7dca452 [flang] Fix indentation bug in unparsed output that I introduced in last merge.
Original-commit: flang-compiler/f18@aa0ba5acac
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
2018-04-02 11:05:07 -07:00
peter klausler
6ec5f8fa2c [flang] Work around clang-format issue by using "auto" where type is obvious.
Original-commit: flang-compiler/f18@7499bccaa9
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
2018-04-02 11:01:31 -07:00
Tim Keith
dcc4dd8627 [flang] Fix bug parsing "implicit none(type)"
"implicit none(type)" was being recognized as "implicit none(external)".

Original-commit: flang-compiler/f18@0cc8867836
Reviewed-on: https://github.com/flang-compiler/f18/pull/36
2018-04-02 10:49:22 -07:00
Tim Keith
fc89541e96 [flang] Respond to review comments.
Original-commit: flang-compiler/f18@d2497a6485
Reviewed-on: https://github.com/flang-compiler/f18/pull/36
Tree-same-pre-rewrite: false
2018-04-02 10:49:22 -07:00
Tim Keith
86726d8ee4 [flang] Continue work on name resolution
Enhance DeclTypeSpecVisitor to find derived-type-specs, including with
type parameter values.

Change DerivedTypeSpec so it only needs the name of the derived type,
not the definition, as that isn't necessarily known when we encounter
it.

Fix how memory is managed in DeclTypeSpec: Intrinsic type specs aren't a
problem -- they are one of a few types that live throughout the program.
Derived type specs are dynamically allocated and the memory is owned by
the DeclTypeSpec -- it allocates it when a DeclTypeSpec for a derived
type is created and deletes it when it is destroyed. Pass around
references to TypeSpecs rather than pointers as they can never be null.

In AttrsVisitor, DeclTypeSpecVisitor, ResolveNamesVisitor: make most
functions out-of-line to clean up the class declaration.

In AttrsVisitor, use preprocessor to simplify the simple case of
encountering a parse-tree class causing an attribute to be set.
Handle all such attributes.

Remove old testing code from type.cc.

Remove some of the declarations for IntExpr and IntConst -- they are
only placeholder classes anyway. Don't distinguish kind and length
parameter values.

Original-commit: flang-compiler/f18@e172b51212
Reviewed-on: https://github.com/flang-compiler/f18/pull/36
Tree-same-pre-rewrite: false
2018-04-02 10:49:22 -07:00
peter klausler
2b79b0bc67 [flang] Elide a useless local variable that used to be a formal argument.
Original-commit: flang-compiler/f18@419b5d07ee
Reviewed-on: https://github.com/flang-compiler/f18/pull/37
2018-03-30 17:03:02 -07:00
peter klausler
d5a084c43a [flang] Debugging after testing. Take care of a TODO in the prescanner.
Original-commit: flang-compiler/f18@4c8181e106
Reviewed-on: https://github.com/flang-compiler/f18/pull/37
Tree-same-pre-rewrite: false
2018-03-30 16:21:12 -07:00
peter klausler
4e354d85ae [flang] Debugging, and resolve another TODO in unparse.cc.
Original-commit: flang-compiler/f18@edeb283cd5
Reviewed-on: https://github.com/flang-compiler/f18/pull/37
Tree-same-pre-rewrite: false
2018-03-30 15:23:37 -07:00