Commit Graph

5 Commits

Author SHA1 Message Date
Brad King b5ac8b8aa7 Fortran: Add support for submodule syntax in dependency scanning
Fortran 2008 [1] adds support for a new syntax related to modules:

    submodule ( ParentModule ) SubModule
    submodule ( ParentModule : SubModule ) NestedSubModule

Both of these mean that the current source file requires the module
`ParentModule` to be available if it is not provided in the current
file.  Teach our Fortran dependency scanner to parse this syntax to
extract this relationship.  For now simply tolerate the nested submodule
case and extract only the dependency it expresses on the main module.
Further work will be needed to extract dependencies among nested
submodules.

[1] http://fortranwiki.org/fortran/show/Fortran+2008

Closes: #16234
2016-09-20 09:18:47 -04:00
Brad King 695f0d0d3a cmFortranParser: Parse keywords as lexical tokens
Teach the lexer to match and return specific Fortran keywords as tokens.
Update the parser to use these instead of always using a WORD token and
then checking the text.  This avoids extra string comparisons and will
allow more grammar productions to be unambiguously added later for
additional Fortran statements.
2016-09-08 09:40:02 -04:00
Brad King f70c71c5a9 cmFortranLexer: Update to flex 2.6
Revise the documented modifications we need to make to the
flex-generated source file according to the needs of the new version.
Also drop the duplicate copyright notice block from the generated file.
2016-09-06 15:52:40 -04:00
Brad King ba819f49df cmFortranParser: Parse #line directives
Teach the lexer to extract the #line directive prefix and line number as
a new token type.  Teach the parser to recognize this token followed by
a string as the file name (plus possibly other content).  Report the
named file as included by the source file.
2015-11-02 15:29:52 -05:00
Kitware Robot 98b9645bce Rename Fortran parser infrastructure to drop "Depends" prefix
The parser can be re-used outside cmDependsFortran or the cmDepends
class hierarchy so drop the "Depends" from its name:

 rename 's/DependsFortran([A-Za-z0-9_])/Fortran$1/' Source/*.*
 sed -i 's/DependsFortran\([A-Za-z0-9_]\)/Fortran\1/g' Source/*.*
 sed -i 's/FortranInternals/DependsFortranInternals/g' Source/*.*

Also manually fix Source/CMakeLists.txt source file ordering.
2015-07-27 09:45:35 -04:00