Commit graph

136 commits

Author SHA1 Message Date
Peter Klausler
a4a355940c [flang] Merge pull request flang-compiler/f18#20 from ThePortlandGroup/pmk-traits
Trait-based parse tree traversal.

Original-commit: flang-compiler/f18@0f8a4aaf07
Reviewed-on: https://github.com/flang-compiler/f18/pull/20
2018-02-28 14:59:03 -08:00
peter klausler
aa3aad34ea [flang] Follow own new style rule about returns and elses.
Original-commit: flang-compiler/f18@665fdf72d1
Reviewed-on: https://github.com/flang-compiler/f18/pull/20
2018-02-28 14:55:45 -08:00
peter klausler
65ed9e1dae [flang] Run clang-format.
Original-commit: flang-compiler/f18@cd52d99f21
Reviewed-on: https://github.com/flang-compiler/f18/pull/20
Tree-same-pre-rewrite: false
2018-02-28 14:53:04 -08:00
peter klausler
601e0acdeb [flang] Improvements suggested by Tim.
Original-commit: flang-compiler/f18@c3d2e3e745
Reviewed-on: https://github.com/flang-compiler/f18/pull/20
Tree-same-pre-rewrite: false
2018-02-28 14:51:45 -08:00
peter klausler
07a028098f [flang] Trait-based parse tree traversal.
Add a CLASS_TRAIT macro to idioms.h to define template metaprogramming
based on definable traits of user-defined classes.  Tweak the boilerplate
macros in parse-tree.h to add traits to the empty, wrapper, union, and
tuple classes in the parse tree.  Replace the macros in parse-tree-visitor.h
with trait-driven templates.

Original-commit: flang-compiler/f18@02400146fb
Reviewed-on: https://github.com/flang-compiler/f18/pull/20
Tree-same-pre-rewrite: false
2018-02-28 13:24:01 -08:00
Tim Keith
848bf57051 [flang] Merge pull request flang-compiler/f18#18 from ThePortlandGroup/tsk1
Use macros to reduce boilerplate.

Original-commit: flang-compiler/f18@b9f25364a8
Reviewed-on: https://github.com/flang-compiler/f18/pull/18
2018-02-27 16:52:29 -08:00
Tim Keith
de65ddbae0 [flang] Use macros to reduce boilerplate.
The common cases of wrapper, tuple, and union classes can be further
reduced by using macros to define the Walk functions.

Original-commit: flang-compiler/f18@29e02c4886
Reviewed-on: https://github.com/flang-compiler/f18/pull/18
2018-02-27 16:52:29 -08:00
Peter Klausler
c986245a85 [flang] Merge pull request flang-compiler/f18#19 from ThePortlandGroup/pmk-fix-master
Fix some bugs that I noticed while running regression tests.

Original-commit: flang-compiler/f18@0d6c927f8f
Reviewed-on: https://github.com/flang-compiler/f18/pull/19
2018-02-27 16:35:08 -08:00
peter klausler
48f7c6f0fd [flang] Fix test: do not allow & as continuation marker in fixed form if in a character literal.
Original-commit: flang-compiler/f18@26c07eb2e5
Reviewed-on: https://github.com/flang-compiler/f18/pull/19
2018-02-27 16:33:10 -08:00
peter klausler
f4a85288db [flang] Fix some bugs that I noticed while running regression tests.
Add characters.h to consolidate all per-character functions
and reduce dependence on <cctype>.
Add omitted DIRECT= and UNFORMATTED= specifiers to INQUIRE statement.
Add Interval<>, rebase ProvenanceRange upon it, rebase CharPointerWithLength
and rename it ContiguousChars.
Reformat C++.

Original-commit: flang-compiler/f18@78c73c62ba
Reviewed-on: https://github.com/flang-compiler/f18/pull/19
Tree-same-pre-rewrite: false
2018-02-27 15:55:10 -08:00
Peter Klausler
089796d643 [flang] Merge pull request flang-compiler/f18#16 from ThePortlandGroup/pmk-minor
Preserve some minor changes...

Original-commit: flang-compiler/f18@7b3e4908bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/16
2018-02-26 16:00:43 -08:00
peter klausler
03aecfc336 [flang] Preserve some minor changes that accumulated as I was implementing
an unparsing feature.

Enum classes in parse tree node class types are now defined with
a macro so that the names of the enumerations can be captured for
formatting purposes.

Add a TODO comment.

Rebase to new master with parse tree traversal code.

Original-commit: flang-compiler/f18@d6bfcfd526
Reviewed-on: https://github.com/flang-compiler/f18/pull/16
2018-02-26 15:31:46 -08:00
Tim Keith
c36ac6b185 [flang] Merge pull request flang-compiler/f18#17 from ThePortlandGroup/tsk1
Fix classes with variant and other fields

Original-commit: flang-compiler/f18@1c2f9e8e8a
Reviewed-on: https://github.com/flang-compiler/f18/pull/17
2018-02-26 15:12:10 -08:00
Tim Keith
66c9a69a61 [flang] Fix classes with variant and other fields
Fortran::FormatItem and UseStmt have both normal fields and a variant
named 'u'. The Walk calls for the normal fields were missing.
These were the only two classes I found where this occurs.

Original-commit: flang-compiler/f18@23b8695a74
Reviewed-on: https://github.com/flang-compiler/f18/pull/17
2018-02-26 15:07:24 -08:00
Tim Keith
c2c6e28cec [flang] Merge pull request flang-compiler/f18#15 from ThePortlandGroup/tsk1
First implementation of a parse tree visitor

Original-commit: flang-compiler/f18@b9a9d249f3
Reviewed-on: https://github.com/flang-compiler/f18/pull/15
2018-02-26 14:52:27 -08:00
Tim Keith
2af29bc1e2 [flang] Add Unparse function.
Unparse takes a parse tree and converts it back to Fortran.
class UnparseVisitor implements a parse tree visitor that emits
the appropriate Fortran source for each node that it visits.
It is only partially implemented so far.

Change f18 to dump the parse tree using Unparse.

Original-commit: flang-compiler/f18@e80c13ec88
Reviewed-on: https://github.com/flang-compiler/f18/pull/15
2018-02-26 14:52:27 -08:00
Tim Keith
0406170acb [flang] Reorder the Walk functions.
Group the Walk functions that call WalkTupleClass, WalkUnionClass,
WalkWrapperClass all together, after the ones that don't follow a
simple pattern like that.

Fix the name of the include guard macro.

Original-commit: flang-compiler/f18@711613a4ad
Reviewed-on: https://github.com/flang-compiler/f18/pull/15
Tree-same-pre-rewrite: false
2018-02-26 14:52:27 -08:00
Tim Keith
686529a59a [flang] Add some missing Walk functions.
The classes in parse-tree.h that used WRAPPER_CLASS_BOILERPLATE were
accidentally omitted.

Also remove the anonymous namespace around utilities like
WalkWrapperClass as they can be useful outside this file too.

Original-commit: flang-compiler/f18@d47c505441
Reviewed-on: https://github.com/flang-compiler/f18/pull/15
Tree-same-pre-rewrite: false
2018-02-26 14:52:27 -08:00
Tim Keith
2ca306abe1 [flang] Rename "visit" to "Walk" to avoid conflict with std::visit.
The thing called on each parse tree node during the walk is still
referred to as a visitor.

Change "pre" to "Pre" and "post" to "Post" to follow the naming
conventions.

Original-commit: flang-compiler/f18@a6ea1296b1
Reviewed-on: https://github.com/flang-compiler/f18/pull/15
Tree-same-pre-rewrite: false
2018-02-26 14:52:27 -08:00
Tim Keith
a9c3093b2e [flang] Add helpers for wrapper/tuple/variant classes.
Add VisitWrapperClass, VisitTupleClass, and VisitVariantClass to
simplify the common cases in the parse tree. ForEachInTuple is used to
implement VisitTupleClass.

Original-commit: flang-compiler/f18@c6ae2b833b
Reviewed-on: https://github.com/flang-compiler/f18/pull/15
Tree-same-pre-rewrite: false
2018-02-26 14:52:27 -08:00
Tim Keith
9f07a4a3d8 [flang] First implementation of a parse tree visitor
Original-commit: flang-compiler/f18@0b441831f4
Reviewed-on: https://github.com/flang-compiler/f18/pull/15
Tree-same-pre-rewrite: false
2018-02-26 14:52:27 -08:00
Stephane Chauveau
ad68e77db2 [flang] Merge pull request flang-compiler/f18#13 from ThePortlandGroup/sch1
Add simple recursive CMake directory structure

Original-commit: flang-compiler/f18@c20c4a34ff
Reviewed-on: https://github.com/flang-compiler/f18/pull/13
2018-02-22 11:24:53 +01:00
Stephane Chauveau
78f3c745ea [flang] Add missing include config file skeleton
Original-commit: flang-compiler/f18@beb71e4e4b
Reviewed-on: https://github.com/flang-compiler/f18/pull/13
2018-02-19 14:44:54 +01:00
Stephane Chauveau
8f6f23fc54 [flang] Add simple recursive CMake directory structure
Original-commit: flang-compiler/f18@a021b2ca76
Reviewed-on: https://github.com/flang-compiler/f18/pull/13
Tree-same-pre-rewrite: false
2018-02-19 14:28:12 +01:00
klausler
6ca3ca3c6e [flang] Merge pull request flang-compiler/f18#14 from ThePortlandGroup/pmk-msg
Put localization markers on the string literals used for messages.

Original-commit: flang-compiler/f18@93089c2bc6
Reviewed-on: https://github.com/flang-compiler/f18/pull/14
2018-02-21 13:45:47 -08:00
peter klausler
c3a2d82d3e [flang] Support localizable formatted messages.
Original-commit: flang-compiler/f18@e974321494
Reviewed-on: https://github.com/flang-compiler/f18/pull/14
2018-02-21 12:12:52 -08:00
peter klausler
2bfdbb87b7 [flang] Fix bug with "expected ..." messages in token strings.
Original-commit: flang-compiler/f18@9cc84ba6fb
Reviewed-on: https://github.com/flang-compiler/f18/pull/14
Tree-same-pre-rewrite: false
2018-02-20 10:35:04 -08:00
peter klausler
3b544af6da [flang] Use "..."_en_US for messages.
Original-commit: flang-compiler/f18@fffa881576
Reviewed-on: https://github.com/flang-compiler/f18/pull/14
Tree-same-pre-rewrite: false
2018-02-20 09:57:30 -08:00
peter klausler
206db251b7 [flang] Convert all messages to MessageTexts ("..."_msg).
Original-commit: flang-compiler/f18@33357f3657
Reviewed-on: https://github.com/flang-compiler/f18/pull/14
Tree-same-pre-rewrite: false
2018-02-16 16:57:40 -08:00
peter klausler
5e83ea521c [flang] Define MessageText and "..."_msg.
Original-commit: flang-compiler/f18@6e9e16431c
Reviewed-on: https://github.com/flang-compiler/f18/pull/14
Tree-same-pre-rewrite: false
2018-02-16 15:47:30 -08:00
klausler
4a6e4002e1 [flang] Merge pull request flang-compiler/f18#12 from ThePortlandGroup/pmk1
Update the header file guards in lib/parser to reflect the introducti…

Original-commit: flang-compiler/f18@5ad8f67f4a
Reviewed-on: https://github.com/flang-compiler/f18/pull/12
2018-02-16 11:49:47 -08:00
peter klausler
dd9923bf45 [flang] Update the header file guards in lib/parser to reflect the introduction of the parser namespace.
Original-commit: flang-compiler/f18@a11bb88396
Reviewed-on: https://github.com/flang-compiler/f18/pull/12
2018-02-16 11:42:17 -08:00
klausler
1d09d20b3a [flang] Merge pull request flang-compiler/f18#11 from ThePortlandGroup/pmk1
Remove old character "cooking" parser combinators

Original-commit: flang-compiler/f18@def973c39c
Reviewed-on: https://github.com/flang-compiler/f18/pull/11
2018-02-16 11:03:54 -08:00
peter klausler
a60d201dc9 [flang] Reformatting and some comment clean-up.
Original-commit: flang-compiler/f18@cedd3d82cf
Reviewed-on: https://github.com/flang-compiler/f18/pull/11
2018-02-16 10:58:17 -08:00
peter klausler
7af9dd8736 [flang] Remove old character "cooking" parser combinators that handled Fortran
comments, continuations, &c. that have become obsolete with the use
of the new C++-coded prescanner module.  Clean out members from
ParseState that were used only by cookedNextChar and its sub-parsers.

Original-commit: flang-compiler/f18@41717531e5
Reviewed-on: https://github.com/flang-compiler/f18/pull/11
Tree-same-pre-rewrite: false
2018-02-16 10:41:16 -08:00
klausler
3185562e19 [flang] Merge pull request flang-compiler/f18#10 from ThePortlandGroup/pmk2
Remove a temporary #include <iostream> and auto-detect -Mfixed

Original-commit: flang-compiler/f18@93ecf8d908
Reviewed-on: https://github.com/flang-compiler/f18/pull/10
2018-02-16 09:25:44 -08:00
peter klausler
fcb6b2a558 [flang] Remove a temporary #include <iostream> and auto-detect -Mfixed from a .f suffix.
Original-commit: flang-compiler/f18@962c7ed0ef
Reviewed-on: https://github.com/flang-compiler/f18/pull/10
2018-02-15 17:12:50 -08:00
klausler
62f7ea930a [flang] Merge pull request flang-compiler/f18#9 from ThePortlandGroup/pmk1
Implement source provenance tracking and file inclusion.

Original-commit: flang-compiler/f18@1eb7d6028c
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
2018-02-15 15:58:44 -08:00
peter klausler
e9332c7256 [flang] Fix a couple bugs noticed while resolving merge.
Original-commit: flang-compiler/f18@dbb32c60a6
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
2018-02-15 15:58:44 -08:00
peter klausler
6595462268 [flang] Complete merge of provenance feature.
Original-commit: flang-compiler/f18@646f68be61
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
92cbf0e968 [flang] Markdown tweaks in documentation.
Original-commit: flang-compiler/f18@044148ead2
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
59bb0866c3 [flang] Spruce up formatting of error message output.
Original-commit: flang-compiler/f18@0750985bdf
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
edbec459fb [flang] Complete provenance tracking through macro calls.
Original-commit: flang-compiler/f18@8c05a6543b
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
67d916f8ba [flang] More precise source locations on error messages. Anticipate module file scanning.
Original-commit: flang-compiler/f18@f4faadd389
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
3bdf65c3fd [flang] Remove #includes that were used for debugging.
Original-commit: flang-compiler/f18@828ee8c2f0
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
050abcafc4 [flang] Support #include directive.
Original-commit: flang-compiler/f18@909622d9b7
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
10a36336df [flang] Implement a directory search path for INCLUDE lines.
Original-commit: flang-compiler/f18@62129e5600
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
fe04c3a02f [flang] Implement Fortran INCLUDE lines.
Original-commit: flang-compiler/f18@d01af89506
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
783d5626fb [flang] Minor refactoring: extract TokenSequence into its own module.
Original-commit: flang-compiler/f18@1b17b4a069
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
5b61beaa12 [flang] Preparatory work for file inclusion.
Original-commit: flang-compiler/f18@1cbbd4a357
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00