summaryrefslogtreecommitdiffstats
path: root/Source/cmFortranParser.y
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-05 15:22:30 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-08 13:40:02 (GMT)
commit1619fb46a88accd1e6864f0c9de27ae2fd46541a (patch)
tree3ef06b414a3f0a5cf1d7c42bcd44147145958027 /Source/cmFortranParser.y
parentf506489d1ed222761f9ce752144a458290020e55 (diff)
downloadCMake-1619fb46a88accd1e6864f0c9de27ae2fd46541a.zip
CMake-1619fb46a88accd1e6864f0c9de27ae2fd46541a.tar.gz
CMake-1619fb46a88accd1e6864f0c9de27ae2fd46541a.tar.bz2
cmFortranParser: Simplify grammar by skipping unknown statements
Our Fortran grammar is a bare minimum to extract dependencies. Other statement syntax can be ignored, so simply skip to the end of unrecognized statements. This allows some of our existing productions to be dropped.
Diffstat (limited to 'Source/cmFortranParser.y')
-rw-r--r--Source/cmFortranParser.y15
1 files changed, 2 insertions, 13 deletions
diff --git a/Source/cmFortranParser.y b/Source/cmFortranParser.y
index f8d461e..686d2f4 100644
--- a/Source/cmFortranParser.y
+++ b/Source/cmFortranParser.y
@@ -102,14 +102,7 @@ static bool cmFortranParserIsKeyword(const char* word,
code: /* empty */ | code stmt;
-stmt: keyword_stmt | assignment_stmt;
-
-assignment_stmt:
- WORD ASSIGNMENT_OP other EOSTMT {
- free($1);
- }
-
-keyword_stmt:
+stmt:
WORD EOSTMT {
if (cmFortranParserIsKeyword($1, "interface")) {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
@@ -212,12 +205,8 @@ keyword_stmt:
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleEndif(parser);
}
-| WORD GARBAGE other EOSTMT {
- free($1);
- }
-| GARBAGE other EOSTMT
| EOSTMT
-| error
+| error EOSTMT /* tolerate unknown statements until their end */
;