mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
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.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
/* A Bison parser, made by GNU Bison 1.875d. */
|
||||
/* A Bison parser, made by GNU Bison 3.0.4. */
|
||||
|
||||
/* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984,
|
||||
1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -14,126 +15,142 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* As a special exception, when this file is copied by Bison into a
|
||||
Bison output file, you may use that output file without restriction.
|
||||
This special exception was added by the Free Software Foundation
|
||||
in version 1.24 of Bison. */
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
under terms of your choice, so long as that work isn't itself a
|
||||
parser generator using the skeleton or a modified version thereof
|
||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
the parser skeleton itself, you may (at your option) remove this
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
/* Tokens. */
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
#ifndef YY_CMDEPENDSJAVA_YY_CMDEPENDSJAVAPARSERTOKENS_H_INCLUDED
|
||||
# define YY_CMDEPENDSJAVA_YY_CMDEPENDSJAVAPARSERTOKENS_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 0
|
||||
#endif
|
||||
#if YYDEBUG
|
||||
extern int cmDependsJava_yydebug;
|
||||
#endif
|
||||
|
||||
/* Token type. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
jp_ABSTRACT = 258,
|
||||
jp_ASSERT = 259,
|
||||
jp_BOOLEAN_TYPE = 260,
|
||||
jp_BREAK = 261,
|
||||
jp_BYTE_TYPE = 262,
|
||||
jp_CASE = 263,
|
||||
jp_CATCH = 264,
|
||||
jp_CHAR_TYPE = 265,
|
||||
jp_CLASS = 266,
|
||||
jp_CONTINUE = 267,
|
||||
jp_DEFAULT = 268,
|
||||
jp_DO = 269,
|
||||
jp_DOUBLE_TYPE = 270,
|
||||
jp_ELSE = 271,
|
||||
jp_EXTENDS = 272,
|
||||
jp_FINAL = 273,
|
||||
jp_FINALLY = 274,
|
||||
jp_FLOAT_TYPE = 275,
|
||||
jp_FOR = 276,
|
||||
jp_IF = 277,
|
||||
jp_IMPLEMENTS = 278,
|
||||
jp_IMPORT = 279,
|
||||
jp_INSTANCEOF = 280,
|
||||
jp_INT_TYPE = 281,
|
||||
jp_INTERFACE = 282,
|
||||
jp_LONG_TYPE = 283,
|
||||
jp_NATIVE = 284,
|
||||
jp_NEW = 285,
|
||||
jp_PACKAGE = 286,
|
||||
jp_PRIVATE = 287,
|
||||
jp_PROTECTED = 288,
|
||||
jp_PUBLIC = 289,
|
||||
jp_RETURN = 290,
|
||||
jp_SHORT_TYPE = 291,
|
||||
jp_STATIC = 292,
|
||||
jp_STRICTFP = 293,
|
||||
jp_SUPER = 294,
|
||||
jp_SWITCH = 295,
|
||||
jp_SYNCHRONIZED = 296,
|
||||
jp_THIS = 297,
|
||||
jp_THROW = 298,
|
||||
jp_THROWS = 299,
|
||||
jp_TRANSIENT = 300,
|
||||
jp_TRY = 301,
|
||||
jp_VOID = 302,
|
||||
jp_VOLATILE = 303,
|
||||
jp_WHILE = 304,
|
||||
jp_BOOLEANLITERAL = 305,
|
||||
jp_CHARACTERLITERAL = 306,
|
||||
jp_DECIMALINTEGERLITERAL = 307,
|
||||
jp_FLOATINGPOINTLITERAL = 308,
|
||||
jp_HEXINTEGERLITERAL = 309,
|
||||
jp_NULLLITERAL = 310,
|
||||
jp_STRINGLITERAL = 311,
|
||||
jp_NAME = 312,
|
||||
jp_AND = 313,
|
||||
jp_ANDAND = 314,
|
||||
jp_ANDEQUALS = 315,
|
||||
jp_BRACKETEND = 316,
|
||||
jp_BRACKETSTART = 317,
|
||||
jp_CARROT = 318,
|
||||
jp_CARROTEQUALS = 319,
|
||||
jp_COLON = 320,
|
||||
jp_COMMA = 321,
|
||||
jp_CURLYEND = 322,
|
||||
jp_CURLYSTART = 323,
|
||||
jp_DIVIDE = 324,
|
||||
jp_DIVIDEEQUALS = 325,
|
||||
jp_DOLLAR = 326,
|
||||
jp_DOT = 327,
|
||||
jp_EQUALS = 328,
|
||||
jp_EQUALSEQUALS = 329,
|
||||
jp_EXCLAMATION = 330,
|
||||
jp_EXCLAMATIONEQUALS = 331,
|
||||
jp_GREATER = 332,
|
||||
jp_GTEQUALS = 333,
|
||||
jp_GTGT = 334,
|
||||
jp_GTGTEQUALS = 335,
|
||||
jp_GTGTGT = 336,
|
||||
jp_GTGTGTEQUALS = 337,
|
||||
jp_LESLESEQUALS = 338,
|
||||
jp_LESSTHAN = 339,
|
||||
jp_LTEQUALS = 340,
|
||||
jp_LTLT = 341,
|
||||
jp_MINUS = 342,
|
||||
jp_MINUSEQUALS = 343,
|
||||
jp_MINUSMINUS = 344,
|
||||
jp_PAREEND = 345,
|
||||
jp_PARESTART = 346,
|
||||
jp_PERCENT = 347,
|
||||
jp_PERCENTEQUALS = 348,
|
||||
jp_PIPE = 349,
|
||||
jp_PIPEEQUALS = 350,
|
||||
jp_PIPEPIPE = 351,
|
||||
jp_PLUS = 352,
|
||||
jp_PLUSEQUALS = 353,
|
||||
jp_PLUSPLUS = 354,
|
||||
jp_QUESTION = 355,
|
||||
jp_SEMICOL = 356,
|
||||
jp_TILDE = 357,
|
||||
jp_TIMES = 358,
|
||||
jp_TIMESEQUALS = 359,
|
||||
jp_ERROR = 360
|
||||
};
|
||||
enum yytokentype
|
||||
{
|
||||
jp_ABSTRACT = 258,
|
||||
jp_ASSERT = 259,
|
||||
jp_BOOLEAN_TYPE = 260,
|
||||
jp_BREAK = 261,
|
||||
jp_BYTE_TYPE = 262,
|
||||
jp_CASE = 263,
|
||||
jp_CATCH = 264,
|
||||
jp_CHAR_TYPE = 265,
|
||||
jp_CLASS = 266,
|
||||
jp_CONTINUE = 267,
|
||||
jp_DEFAULT = 268,
|
||||
jp_DO = 269,
|
||||
jp_DOUBLE_TYPE = 270,
|
||||
jp_ELSE = 271,
|
||||
jp_EXTENDS = 272,
|
||||
jp_FINAL = 273,
|
||||
jp_FINALLY = 274,
|
||||
jp_FLOAT_TYPE = 275,
|
||||
jp_FOR = 276,
|
||||
jp_IF = 277,
|
||||
jp_IMPLEMENTS = 278,
|
||||
jp_IMPORT = 279,
|
||||
jp_INSTANCEOF = 280,
|
||||
jp_INT_TYPE = 281,
|
||||
jp_INTERFACE = 282,
|
||||
jp_LONG_TYPE = 283,
|
||||
jp_NATIVE = 284,
|
||||
jp_NEW = 285,
|
||||
jp_PACKAGE = 286,
|
||||
jp_PRIVATE = 287,
|
||||
jp_PROTECTED = 288,
|
||||
jp_PUBLIC = 289,
|
||||
jp_RETURN = 290,
|
||||
jp_SHORT_TYPE = 291,
|
||||
jp_STATIC = 292,
|
||||
jp_STRICTFP = 293,
|
||||
jp_SUPER = 294,
|
||||
jp_SWITCH = 295,
|
||||
jp_SYNCHRONIZED = 296,
|
||||
jp_THIS = 297,
|
||||
jp_THROW = 298,
|
||||
jp_THROWS = 299,
|
||||
jp_TRANSIENT = 300,
|
||||
jp_TRY = 301,
|
||||
jp_VOID = 302,
|
||||
jp_VOLATILE = 303,
|
||||
jp_WHILE = 304,
|
||||
jp_BOOLEANLITERAL = 305,
|
||||
jp_CHARACTERLITERAL = 306,
|
||||
jp_DECIMALINTEGERLITERAL = 307,
|
||||
jp_FLOATINGPOINTLITERAL = 308,
|
||||
jp_HEXINTEGERLITERAL = 309,
|
||||
jp_NULLLITERAL = 310,
|
||||
jp_STRINGLITERAL = 311,
|
||||
jp_NAME = 312,
|
||||
jp_AND = 313,
|
||||
jp_ANDAND = 314,
|
||||
jp_ANDEQUALS = 315,
|
||||
jp_BRACKETEND = 316,
|
||||
jp_BRACKETSTART = 317,
|
||||
jp_CARROT = 318,
|
||||
jp_CARROTEQUALS = 319,
|
||||
jp_COLON = 320,
|
||||
jp_COMMA = 321,
|
||||
jp_CURLYEND = 322,
|
||||
jp_CURLYSTART = 323,
|
||||
jp_DIVIDE = 324,
|
||||
jp_DIVIDEEQUALS = 325,
|
||||
jp_DOLLAR = 326,
|
||||
jp_DOT = 327,
|
||||
jp_EQUALS = 328,
|
||||
jp_EQUALSEQUALS = 329,
|
||||
jp_EXCLAMATION = 330,
|
||||
jp_EXCLAMATIONEQUALS = 331,
|
||||
jp_GREATER = 332,
|
||||
jp_GTEQUALS = 333,
|
||||
jp_GTGT = 334,
|
||||
jp_GTGTEQUALS = 335,
|
||||
jp_GTGTGT = 336,
|
||||
jp_GTGTGTEQUALS = 337,
|
||||
jp_LESLESEQUALS = 338,
|
||||
jp_LESSTHAN = 339,
|
||||
jp_LTEQUALS = 340,
|
||||
jp_LTLT = 341,
|
||||
jp_MINUS = 342,
|
||||
jp_MINUSEQUALS = 343,
|
||||
jp_MINUSMINUS = 344,
|
||||
jp_PAREEND = 345,
|
||||
jp_PARESTART = 346,
|
||||
jp_PERCENT = 347,
|
||||
jp_PERCENTEQUALS = 348,
|
||||
jp_PIPE = 349,
|
||||
jp_PIPEEQUALS = 350,
|
||||
jp_PIPEPIPE = 351,
|
||||
jp_PLUS = 352,
|
||||
jp_PLUSEQUALS = 353,
|
||||
jp_PLUSPLUS = 354,
|
||||
jp_QUESTION = 355,
|
||||
jp_SEMICOL = 356,
|
||||
jp_TILDE = 357,
|
||||
jp_TIMES = 358,
|
||||
jp_TIMESEQUALS = 359,
|
||||
jp_ERROR = 360
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define jp_ABSTRACT 258
|
||||
#define jp_ASSERT 259
|
||||
#define jp_BOOLEAN_TYPE 260
|
||||
@@ -238,17 +255,10 @@
|
||||
#define jp_TIMESEQUALS 359
|
||||
#define jp_ERROR 360
|
||||
|
||||
/* Value type. */
|
||||
|
||||
|
||||
|
||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||
typedef int YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
int cmDependsJava_yyparse (yyscan_t yyscanner);
|
||||
|
||||
#endif /* !YY_CMDEPENDSJAVA_YY_CMDEPENDSJAVAPARSERTOKENS_H_INCLUDED */
|
||||
|
||||
Reference in New Issue
Block a user