summaryrefslogtreecommitdiffstats
path: root/Source/cmFortranParser.y
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-07-22 19:08:43 (GMT)
committerBrad King <brad.king@kitware.com>2015-07-27 13:45:36 (GMT)
commitecca8fd90806158dd61f769bd7882e7ee73f3f48 (patch)
tree452a4dcd3ea36d52ab8c61e44a00935be63397a9 /Source/cmFortranParser.y
parenteebe732bb61bb69f50edae9b7fb171266b216752 (diff)
downloadCMake-ecca8fd90806158dd61f769bd7882e7ee73f3f48.zip
CMake-ecca8fd90806158dd61f769bd7882e7ee73f3f48.tar.gz
CMake-ecca8fd90806158dd61f769bd7882e7ee73f3f48.tar.bz2
cmFortranParser: Port to bison 3
Use %-directives to specify the scanner/lexer arguments and update the yyerror signature. Reduce the list of post-bison modifications needed.
Diffstat (limited to 'Source/cmFortranParser.y')
-rw-r--r--Source/cmFortranParser.y23
1 files changed, 10 insertions, 13 deletions
diff --git a/Source/cmFortranParser.y b/Source/cmFortranParser.y
index 31c268d..996bef6 100644
--- a/Source/cmFortranParser.y
+++ b/Source/cmFortranParser.y
@@ -32,9 +32,7 @@ Run bison like this:
cmFortranParser.y
Modify cmFortranParser.cxx:
- - remove TABs
- - remove use of the 'register' storage class specifier
- - Remove the yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"]
+ - "#if 0" out yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"]
*/
/*-------------------------------------------------------------------------*/
@@ -44,18 +42,11 @@ Modify cmFortranParser.cxx:
#include <cmsys/String.h>
-/* Configure the parser to use a lexer object. */
-#define YYPARSE_PARAM yyscanner
-#define YYLEX_PARAM yyscanner
-#define YYERROR_VERBOSE 1
-#define cmFortran_yyerror(x) \
- cmFortranError(yyscanner, x)
-
/* Forward declare the lexer entry point. */
YY_DECL;
-/* Helper function to forward error callback. */
-static void cmFortranError(yyscan_t yyscanner, const char* message)
+/* Helper function to forward error callback from parser. */
+static void cmFortran_yyerror(yyscan_t yyscanner, const char* message)
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_Error(parser, message);
@@ -79,7 +70,13 @@ static bool cmFortranParserIsKeyword(const char* word,
%}
/* Generate a reentrant parser object. */
-%pure-parser
+%define api.pure
+
+/* Configure the parser to use a lexer object. */
+%lex-param {yyscan_t yyscanner}
+%parse-param {yyscan_t yyscanner}
+
+%define parse.error verbose
%union {
char* string;