diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-02-16 20:26:36 (GMT) |
---|---|---|
committer | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-02-16 20:26:36 (GMT) |
commit | 1728b9c076a34ef017f10499e5b637d025b2afd8 (patch) | |
tree | 1d161d456ff02e0976ca089b550c28172c26fcc2 /Source/cmDependsJavaParser.y | |
parent | fe75e140d617dd2d8401a85c718d03a6466a8bd9 (diff) | |
download | CMake-1728b9c076a34ef017f10499e5b637d025b2afd8.zip CMake-1728b9c076a34ef017f10499e5b637d025b2afd8.tar.gz CMake-1728b9c076a34ef017f10499e5b637d025b2afd8.tar.bz2 |
cmDependsJavaParser: 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/cmDependsJavaParser.y')
-rw-r--r-- | Source/cmDependsJavaParser.y | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/Source/cmDependsJavaParser.y b/Source/cmDependsJavaParser.y index 91ee7c8..ea7ca0f 100644 --- a/Source/cmDependsJavaParser.y +++ b/Source/cmDependsJavaParser.y @@ -10,18 +10,10 @@ Run bison like this: bison --yacc --name-prefix=cmDependsJava_yy --defines=cmDependsJavaParserTokens.h -ocmDependsJavaParser.cxx cmDependsJavaParser.y Modify cmDependsJavaParser.cxx: - - remove TABs - - remove use of the 'register' storage class specifier - - add __HP_aCC to the #if test for yyerrorlab warning suppression + - "#if 0" out yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] */ -/* Configure the parser to use a lexer object. */ -#define YYPARSE_PARAM yyscanner -#define YYLEX_PARAM yyscanner -#define YYERROR_VERBOSE 1 -#define cmDependsJava_yyerror(x) \ - cmDependsJavaError(yyscanner, x) #define yyGetParser (cmDependsJava_yyget_extra(yyscanner)) /*-------------------------------------------------------------------------*/ @@ -32,10 +24,9 @@ Modify cmDependsJavaParser.cxx: /* Forward declare the lexer entry point. */ YY_DECL; -/* Internal utility functions. */ -static void cmDependsJavaError(yyscan_t yyscanner, const char* message); +/* Helper function to forward error callback from parser. */ +static void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message); -#define YYDEBUG 1 #define YYMAXDEPTH 1000000 @@ -50,7 +41,13 @@ static void cmDependsJavaError(yyscan_t yyscanner, const char* message); %} /* 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 { @@ -3205,7 +3202,7 @@ Name jp_DOT jp_NEW /* End of grammar */ /*--------------------------------------------------------------------------*/ -void cmDependsJavaError(yyscan_t yyscanner, const char* message) +void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message) { yyGetParser->Error(message); } |