Skip to content

Commit

Permalink
I hate the Bison 2.3/2.4 split.
Browse files Browse the repository at this point in the history
  • Loading branch information
saurik committed Nov 26, 2009
1 parent a60c3ff commit b64dd93
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
22 changes: 13 additions & 9 deletions Cycript.yy.in
Expand Up @@ -37,13 +37,15 @@
*/
/* }}} */

%{
@if Bison23 %{

@if Bison24 %code top {
#define cyscanner driver.scanner_
#define YYSTACKEXPANDABLE 1
#define yyerrok (yyerrstatus_ = 0)
%}
@if Bison24 }

%{
@if Bison24 %code requires {
#include "Parser.hpp"

@begin ObjectiveC
Expand Down Expand Up @@ -112,22 +114,24 @@ typedef struct {
} YYSTYPE;

#define YYSTYPE YYSTYPE
@if Bison24 }

%}

%{
@if Bison24 %code provides {
int cylex(YYSTYPE *, cy::location *, void *);
%}
@if Bison24 }

@if Bison23 %}

%name-prefix="cy"

%skeleton "lalr1.cc"
%locations
@if Bison23 %skeleton "lalr1.cc"
@if Bison24 %language "C++"

%initial-action {
@$.begin.filename = @$.end.filename = &driver.filename_;
};

%locations
%defines

//%glr-parser
Expand Down
9 changes: 8 additions & 1 deletion Filter.sh
Expand Up @@ -3,7 +3,14 @@
filters=("$@")

while IFS= read -r line; do
if [[ ${line} = @begin* ]]; then
if [[ ${line} = @if* ]]; then
line=${line#@if }
for name in "${filters[@]}"; do
if [[ ${line} = ${name}' '* ]]; then
echo "${line#${name} }"
fi
done
elif [[ ${line} = @begin* ]]; then
set ${line}; shift
filter=
for name in "${filters[@]}"; do
Expand Down
2 changes: 2 additions & 0 deletions makefile
Expand Up @@ -64,6 +64,8 @@ flags += -I. -Iinclude -I$(shell apr-1-config --includedir)

all += $(lib)cycript.$(dll)

filters += $(shell bison <(echo '%code{}%%_:') -o/dev/null 2>/dev/null && echo Bison24 || echo Bison23)

ifdef arch
deb := $(shell grep ^Package: control.in | cut -d ' ' -f 2-)_$(shell grep ^Version: control.in | cut -d ' ' -f 2 | sed -e 's/\#/$(svn)/')_$(arch).deb

Expand Down

0 comments on commit b64dd93

Please sign in to comment.