summaryrefslogtreecommitdiff
path: root/debian/patches/0003-Use-flex-and-bison-options-instead-of-defines.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/0003-Use-flex-and-bison-options-instead-of-defines.patch')
-rw-r--r--debian/patches/0003-Use-flex-and-bison-options-instead-of-defines.patch100
1 files changed, 100 insertions, 0 deletions
diff --git a/debian/patches/0003-Use-flex-and-bison-options-instead-of-defines.patch b/debian/patches/0003-Use-flex-and-bison-options-instead-of-defines.patch
new file mode 100644
index 0000000..bce0ce1
--- /dev/null
+++ b/debian/patches/0003-Use-flex-and-bison-options-instead-of-defines.patch
@@ -0,0 +1,100 @@
+From 456d1a0aa3699833d6db381d3ceec51e48451c17 Mon Sep 17 00:00:00 2001
+From: Alex Merry <dev@randomguy3.me.uk>
+Date: Fri, 2 Aug 2013 20:38:45 +0100
+Subject: [PATCH 3/4] Use flex and bison options instead of #defines
+
+Defining YY_EXTRA_TYPE is not the "proper" way to set that type (a
+%option should be used instead), and defining YYLEX_PARAM will no longer
+work with bison 3 (%lex-param is the correct thing to use).
+---
+ tikzit/src/common/TikzGraphAssembler+Parser.h | 3 ---
+ tikzit/src/common/TikzGraphAssembler.m | 3 +--
+ tikzit/src/common/tikzlexer.lm | 1 +
+ tikzit/src/common/tikzparser.ym | 10 +++++-----
+ 4 files changed, 7 insertions(+), 10 deletions(-)
+
+diff --git a/tikzit/src/common/TikzGraphAssembler+Parser.h b/tikzit/src/common/TikzGraphAssembler+Parser.h
+index 55fa901..c9391a9 100644
+--- a/tikzit/src/common/TikzGraphAssembler+Parser.h
++++ b/tikzit/src/common/TikzGraphAssembler+Parser.h
+@@ -31,9 +31,6 @@
+ /** Get a previously-stored node by name */
+ - (Node*) nodeWithName:(NSString*)name;
+ - (void) reportError:(const char *)message atLocation:(YYLTYPE*)yylloc;
+-- (void*) scanner;
+ @end
+
+-#define YY_EXTRA_TYPE TikzGraphAssembler *
+-
+ // vi:ft=objc:noet:ts=4:sts=4:sw=4
+diff --git a/tikzit/src/common/TikzGraphAssembler.m b/tikzit/src/common/TikzGraphAssembler.m
+index 2dd8d50..60b96ee 100644
+--- a/tikzit/src/common/TikzGraphAssembler.m
++++ b/tikzit/src/common/TikzGraphAssembler.m
+@@ -58,7 +58,7 @@
+
+ tikzStr = [t UTF8String];
+ yy_scan_string(tikzStr, scanner);
+- int result = yyparse(self);
++ int result = yyparse(scanner);
+ tikzStr = NULL;
+
+ [pool drain];
+@@ -278,7 +278,6 @@
+ free (context);
+ }
+ }
+-- (void*) scanner { return scanner; }
+ @end
+
+ // vi:ft=objc:ts=4:noet:sts=4:sw=4
+diff --git a/tikzit/src/common/tikzlexer.lm b/tikzit/src/common/tikzlexer.lm
+index a0e5968..fe7ab0d 100644
+--- a/tikzit/src/common/tikzlexer.lm
++++ b/tikzit/src/common/tikzlexer.lm
+@@ -34,6 +34,7 @@
+ %option yylineno
+ %option noyywrap
+ %option header-file="common/tikzlexer.h"
++%option extra-type="TikzGraphAssembler *"
+
+ %s props
+ %s xcoord
+diff --git a/tikzit/src/common/tikzparser.ym b/tikzit/src/common/tikzparser.ym
+index 98d25e4..6eea833 100644
+--- a/tikzit/src/common/tikzparser.ym
++++ b/tikzit/src/common/tikzparser.ym
+@@ -38,7 +38,8 @@ struct noderef {
+ %defines "common/tikzparser.h"
+ %pure-parser
+ %locations
+-%parse-param {TikzGraphAssembler *assembler}
++%lex-param {void *scanner}
++%parse-param {void *scanner}
+ %error-verbose
+
+ %union {
+@@ -47,8 +48,7 @@ struct noderef {
+ GraphElementProperty *prop;
+ GraphElementData *data;
+ Node *node;
+- struct noderef noderef;
+-};
++ struct noderef noderef; };
+
+ %{
+ #import "TikzGraphAssembler+Parser.h"
+@@ -56,8 +56,8 @@ struct noderef {
+ #import "GraphElementProperty.h"
+ #import "Node.h"
+ #import "tikzlexer.h"
+-#define YYLEX_PARAM [assembler scanner]
+-void yyerror(YYLTYPE *yylloc, TikzGraphAssembler *assembler, const char *str) {
++#define assembler yyget_extra(scanner)
++void yyerror(YYLTYPE *yylloc, void *scanner, const char *str) {
+ [assembler reportError:str atLocation:yylloc];
+ }
+ %}
+--
+2.11.0
+