summaryrefslogtreecommitdiffstats
path: root/Source/cmFortranLexer.in.l
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-05 19:54:51 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-08 13:40:02 (GMT)
commit695f0d0d3a2db22d2ee3a426df8a1ec502cd471b (patch)
tree430d7aafdf9c1f28ffed28d0ed569d842f51695f /Source/cmFortranLexer.in.l
parent1619fb46a88accd1e6864f0c9de27ae2fd46541a (diff)
downloadCMake-695f0d0d3a2db22d2ee3a426df8a1ec502cd471b.zip
CMake-695f0d0d3a2db22d2ee3a426df8a1ec502cd471b.tar.gz
CMake-695f0d0d3a2db22d2ee3a426df8a1ec502cd471b.tar.bz2
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.
Diffstat (limited to 'Source/cmFortranLexer.in.l')
-rw-r--r--Source/cmFortranLexer.in.l6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/cmFortranLexer.in.l b/Source/cmFortranLexer.in.l
index aa879e8..6870f7c 100644
--- a/Source/cmFortranLexer.in.l
+++ b/Source/cmFortranLexer.in.l
@@ -151,6 +151,12 @@ $[ \t]*endif { return F90PPR_ENDIF; }
=|=> { return ASSIGNMENT_OP; }
+[Ee][Nn][Dd] { return END; }
+[Ii][Nn][Cc][Ll][Uu][Dd][Ee] { return INCLUDE; }
+[Ii][Nn][Tt][Ee][Rr][Ff][Aa][Cc][Ee] { return INTERFACE; }
+[Mm][Oo][Dd][Uu][Ll][Ee] { return MODULE; }
+[Uu][Ss][Ee] { return USE; }
+
[a-zA-Z_][a-zA-Z_0-9]* {
yylvalp->string = strdup(yytext);
return WORD;