summaryrefslogtreecommitdiffstats
path: root/Source/cmFortranParser.y
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-11-02 20:29:52 (GMT)
committerBrad King <brad.king@kitware.com>2015-11-02 20:29:52 (GMT)
commitba819f49df33b546072a5928de3253770c4716b9 (patch)
treeb281ef543d802a53a9c7a438947003a997401b8d /Source/cmFortranParser.y
parent7748a02c3f7d028af13d4fc2c83e7181d11397e9 (diff)
downloadCMake-ba819f49df33b546072a5928de3253770c4716b9.zip
CMake-ba819f49df33b546072a5928de3253770c4716b9.tar.gz
CMake-ba819f49df33b546072a5928de3253770c4716b9.tar.bz2
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.
Diffstat (limited to 'Source/cmFortranParser.y')
-rw-r--r--Source/cmFortranParser.y10
1 files changed, 9 insertions, 1 deletions
diff --git a/Source/cmFortranParser.y b/Source/cmFortranParser.y
index 996bef6..83f441a 100644
--- a/Source/cmFortranParser.y
+++ b/Source/cmFortranParser.y
@@ -1,7 +1,7 @@
%{
/*============================================================================
CMake - Cross Platform Makefile Generator
- Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+ Copyright 2000-2015 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
@@ -85,6 +85,7 @@ static bool cmFortranParserIsKeyword(const char* word,
/*-------------------------------------------------------------------------*/
/* Tokens */
%token EOSTMT ASSIGNMENT_OP GARBAGE
+%token CPP_LINE_DIRECTIVE
%token CPP_INCLUDE F90PPR_INCLUDE COCO_INCLUDE
%token F90PPR_DEFINE CPP_DEFINE F90PPR_UNDEF CPP_UNDEF
%token CPP_IFDEF CPP_IFNDEF CPP_IF CPP_ELSE CPP_ELIF CPP_ENDIF
@@ -185,6 +186,13 @@ keyword_stmt:
free($1);
free($2);
}
+| CPP_LINE_DIRECTIVE STRING other EOSTMT
+ {
+ cmFortranParser* parser =
+ cmFortran_yyget_extra(yyscanner);
+ cmFortranParser_RuleLineDirective(parser, $2);
+ free($2);
+ }
| CPP_INCLUDE_ANGLE other EOSTMT
{
cmFortranParser* parser =