*/
/* }}} */
-%{
+@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
} 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
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
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