From: Jay Freeman (saurik) Date: Mon, 2 Nov 2015 12:34:08 +0000 (-0800) Subject: Upgrade to Bison 3.0.4 (Apple is never upgrading). X-Git-Tag: v0.9.504~25 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/6ce9ac92241f16964b2a253800058c04bd21f14f?ds=sidebyside;hp=9d54db954d59dedacc6a9b12fdff5e8f048b2bfc Upgrade to Bison 3.0.4 (Apple is never upgrading). --- diff --git a/Cycript.yy.in b/Cycript.yy.in index b2f5629..17be078 100644 --- a/Cycript.yy.in +++ b/Cycript.yy.in @@ -19,15 +19,12 @@ **/ /* }}} */ -@if Bison23 %{ - -@if Bison24 %code top { +%code top { #define cyscanner driver.scanner_ #define YYSTACKEXPANDABLE 1 -@if Bison23 #define yyerrok (yyerrstatus_ = 0) -@if Bison24 } +} -@if Bison24 %code requires { +%code requires { #include "Driver.hpp" #include "Parser.hpp" #define CYNew new($pool) @@ -110,23 +107,15 @@ typedef struct { } YYSTYPE; #define YYSTYPE YYSTYPE +} -@if Bison24 %code provides { +%code provides { int cylex(YYSTYPE *, cy::location *, void *); -@if Bison24 } - -@if Bison23 %} -@if Bison23 %union { -@if Bison23 } -@if Bison23 %{ - -@if Bison24 } -@if Bison23 %} +} -%name-prefix="cy" +%name-prefix "cy" -@if Bison23 %skeleton "lalr1.cc" -@if Bison24 %language "C++" +%language "C++" %initial-action { @$.begin.filename = @$.end.filename = &driver.filename_; @@ -444,7 +433,7 @@ int cylex(YYSTYPE *, cy::location *, void *); %type NullLiteral %type ObjectLiteral %type Parenthetical -%type ParentheticalOpt +//%type ParentheticalOpt %type PostfixExpression %type PrimaryExpression %type Program @@ -587,16 +576,16 @@ LexSetRegExp ; LexNoBrace - : { if (yychar == yyempty_) driver.no_.OpenBrace = true; else if (yychar == token::OpenBrace || yychar == token::OpenBrace_) yychar = token::OpenBrace__; } + : { if (yyla.empty()) driver.no_.OpenBrace = true; else if (yyla.type == yytranslate_(token::OpenBrace) || yyla.type == yytranslate_(token::OpenBrace_)) yyla.type = yytranslate_(token::OpenBrace__); } ; LexNoFunction - : { if (yychar == yyempty_) driver.no_.Function = true; else if (yychar == token::Function) yychar = token::Function_; } + : { if (yyla.empty()) driver.no_.Function = true; else if (yyla.type == yytranslate_(token::Function)) yyla.type = yytranslate_(token::Function_); } ; LexNoAtImplementation : @begin ObjectiveC - { if (yychar == yyempty_) driver.no_.AtImplementation = true; else if (yychar == token::AtImplementation) yychar = token::AtImplementation_; } + { if (yyla.empty()) driver.no_.AtImplementation = true; else if (yyla.type == yytranslate_(token::AtImplementation)) yyla.type = yytranslate_(token::AtImplementation_); } @end ; @@ -760,12 +749,12 @@ BooleanLiteral /* 7.9 Automatic Semicolon Insertion {{{ */ StrictSemi - : { driver.Warning(yylloc, "warning, automatic semi-colon insertion required"); } + : { driver.Warning(@$, "warning, automatic semi-colon insertion required"); } ; Terminator : ";" - | error { if (yychar != yyeof_ && yychar != token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi + | error { if (yyla.type_get() != yyeof_ && yyla.type != token::CloseBrace && !yyla.value.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi ; TerminatorOpt @@ -779,10 +768,10 @@ Parenthetical : "(" LexPushInOff Expression ")" LexPopIn { $$ = $3; } ; -ParentheticalOpt +/*ParentheticalOpt : Parenthetical { $$ = $1; } | { $$ = NULL; } - ; + ;*/ Variable : Identifier { $$ = CYNew CYVariable($1); } diff --git a/Makefile.am b/Makefile.am index c3679bc..4c76c6d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,7 +39,7 @@ libcycript_la_LIBADD = $(LTLIBFFI) $(LTLIBGCC) -ldl libcycript_la_SOURCES = ConvertUTF.c Decode.cpp Driver.cpp Highlight.cpp Library.cpp Network.cpp Output.cpp Parser.cpp Replace.cpp libcycript_la_SOURCES += Cycript.tab.cc lex.cy.cpp -filters = $(CY_FILTERS) +filters = if CY_CONSOLE bin_PROGRAMS = cycript diff --git a/Makefile.in b/Makefile.in index d69ea23..d2c82b8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -387,7 +387,6 @@ CYGPATH_W = @CYGPATH_W@ CY_ARCH = @CY_ARCH@ CY_ATTACH_GROUP = @CY_ATTACH_GROUP@ CY_EXECUTE = @CY_EXECUTE@ -CY_FILTERS = @CY_FILTERS@ CY_JAVA = @CY_JAVA@ CY_MACH = @CY_MACH@ CY_OBJECTIVEC = @CY_OBJECTIVEC@ @@ -544,8 +543,7 @@ libcycript_la_SOURCES = ConvertUTF.c Decode.cpp Driver.cpp \ Highlight.cpp Library.cpp Network.cpp Output.cpp Parser.cpp \ Replace.cpp Cycript.tab.cc lex.cy.cpp $(am__append_1) \ $(am__append_7) $(am__append_10) $(am__append_12) -filters = $(CY_FILTERS) $(am__append_4) $(am__append_6) \ - $(am__append_9) +filters = $(am__append_4) $(am__append_6) $(am__append_9) @CY_CONSOLE_TRUE@cycript_SOURCES = Console.cpp Display.cpp \ @CY_CONSOLE_TRUE@ $(am__append_13) @CY_CONSOLE_TRUE@cycript_LDADD = libcycript.la $(LTLIBREADLINE) $(LTLIBTERMCAP) $(LTLIBGCC) -ldl diff --git a/configure b/configure index 84b3407..776e954 100755 --- a/configure +++ b/configure @@ -674,7 +674,6 @@ WEBKIT_LIBS WEBKIT_CFLAGS CY_EXECUTE CY_ARCH -CY_FILTERS GNUTAR GPERF FLEX @@ -16881,8 +16880,8 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bison >= 2.3" >&5 -$as_echo_n "checking for bison >= 2.3... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bison >= 3.0" >&5 +$as_echo_n "checking for bison >= 3.0... " >&6; } if test -z "$BISON"; then ac_path_BISON_found=false # Loop through the user's path and test for each of PROGNAME-LIST @@ -16960,7 +16959,7 @@ else } ' as_arg_v1=$version -as_arg_v2=2.3 +as_arg_v2=3.0 awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null case $? in #( 1) : @@ -16998,7 +16997,7 @@ $as_echo "$BISON" >&6; } else if true; then : - as_fn_error $? "You need bison 2.3 or greater" "$LINENO" 5 + as_fn_error $? "You need bison 3.0 or greater" "$LINENO" 5 else @@ -17227,66 +17226,6 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking bison for %code{}" >&5 -$as_echo_n "checking bison for %code{}... " >&6; } -echo '%code{}%%_:' >conftest.y -if $BISON conftest.y -o/dev/null 2>/dev/null; then - - for element in Bison24; do - haveit= - for x in $CY_FILTERS; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - CY_FILTERS="${CY_FILTERS}${CY_FILTERS:+ }$element" - fi - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - - for element in Bison23; do - haveit= - for x in $CY_FILTERS; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - CY_FILTERS="${CY_FILTERS}${CY_FILTERS:+ }$element" - fi - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - -rm -f conftest.y - - diff --git a/configure.ac b/configure.ac index f890dd4..c69008e 100644 --- a/configure.ac +++ b/configure.ac @@ -73,7 +73,7 @@ AC_DEFUN([CY_CHECK_PROGS_VERSION], [ ]) dnl }}} CY_CHECK_PROGS_VERSION([BISON], [bison], [GNU Project parser generator (yacc replacement)], - [-V | $SED -e '1 s/^bison (GNU Bison) \(.*\)$/\1/p;d'], [2.3]) + [-V | $SED -e '1 s/^bison (GNU Bison) \(.*\)$/\1/p;d'], [3.0]) CY_CHECK_PROGS_VERSION([FLEX], [flex], [the fast lexical analyser generator], [--version | $SED -e '1 s/^@<:@^0-9.@:>@* \(@<:@0-9.@:>@*\).*$/\1/p;d'], [2.5.33]) CY_CHECK_PROGS_VERSION([GPERF], [gperf], [perfect hash function generator], @@ -81,19 +81,6 @@ CY_CHECK_PROGS_VERSION([GPERF], [gperf], [perfect hash function generator], CY_CHECK_PROGS_VERSION([GNUTAR], [tar gtar gnutar], [a very sticky lump of files], [--version | $SED -e '1 s/^tar (GNU tar) \(.*\)$/\1/p;d'], [1.19]) -AC_MSG_CHECKING([bison for %code{}]) -echo '%code{}%%_:' >conftest.y -if $BISON conftest.y -o/dev/null 2>/dev/null; then - AC_LIB_APPENDTOVAR([CY_FILTERS], [Bison24]) - AC_MSG_RESULT([yes]) -else - AC_LIB_APPENDTOVAR([CY_FILTERS], [Bison23]) - AC_MSG_RESULT([no]) -fi - -rm -f conftest.y -AC_SUBST([CY_FILTERS]) - dnl CY_TRY {{{ AC_DEFUN([CY_SUCCESS], [cy_good=1]) AC_DEFUN([CY_FAILURE], [cy_good=0])