summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGard Spreemann <gspreemann@gmail.com>2017-01-24 00:48:08 +0100
committerGard Spreemann <gspreemann@gmail.com>2017-01-24 00:48:08 +0100
commitdeafe5fa739761b075bfd1fe11eac69e0a773a60 (patch)
tree776d21a5f0a5edb5d7b9e66d7e26c08f48384841
parent568eede438bf2677b9a509572bbedb94455bafff (diff)
fix-bison-decls.patch
-rw-r--r--debian/patches/fix-bison-decls.patch269
-rw-r--r--debian/patches/series1
2 files changed, 270 insertions, 0 deletions
diff --git a/debian/patches/fix-bison-decls.patch b/debian/patches/fix-bison-decls.patch
new file mode 100644
index 0000000..c9cba05
--- /dev/null
+++ b/debian/patches/fix-bison-decls.patch
@@ -0,0 +1,269 @@
+Cherry pick four upstream commits to fix bison declarations.
+
+From 84df4540333450f9520c58b847bf5c5a54435321 Mon Sep 17 00:00:00 2001
+From: Alex Merry <dev@randomguy3.me.uk>
+Date: Mon, 29 Jul 2013 16:11:59 +0100
+Subject: [PATCH 1/4] Allow empty square brackets for properties list
+
+---
+ tikzit/src/common/tikzparser.ym | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tikzit/src/common/tikzparser.ym b/tikzit/src/common/tikzparser.ym
+index 794b06d..5c49ed9 100644
+--- a/tikzit/src/common/tikzparser.ym
++++ b/tikzit/src/common/tikzparser.ym
+@@ -123,7 +123,9 @@ tikzcmd: node | edge | boundingbox | ignore;
+ ignore: "\\begin{pgfonlayer}" DELIMITEDSTRING | "\\end{pgfonlayer}";
+
+ optproperties:
+- "[" properties "]"
++ "[" "]"
++ { $$ = nil; }
++ | "[" properties "]"
+ { $$ = $2; }
+ | { $$ = nil; };
+ properties: property extraproperties
+--
+2.11.0
+
+
+From 8de27c4c7c9a42a8224e3dfc865b25b184ce1399 Mon Sep 17 00:00:00 2001
+From: Alex Merry <dev@randomguy3.me.uk>
+Date: Mon, 29 Jul 2013 16:12:32 +0100
+Subject: [PATCH 2/4] Do not reverse the order of the properties when parsing
+
+---
+ tikzit/src/common/tikzparser.ym | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/tikzit/src/common/tikzparser.ym b/tikzit/src/common/tikzparser.ym
+index 5c49ed9..98d25e4 100644
+--- a/tikzit/src/common/tikzparser.ym
++++ b/tikzit/src/common/tikzparser.ym
+@@ -128,16 +128,16 @@ optproperties:
+ | "[" properties "]"
+ { $$ = $2; }
+ | { $$ = nil; };
+-properties: property extraproperties
++properties: extraproperties property
+ {
+- [$2 addObject:$1];
+- $$ = $2;
++ [$1 addObject:$2];
++ $$ = $1;
+ };
+ extraproperties:
+- "," property extraproperties
++ extraproperties property ","
+ {
+- [$3 addObject:$2];
+- $$ = $3;
++ [$1 addObject:$2];
++ $$ = $1;
+ }
+ | { $$ = [GraphElementData data]; };
+ property:
+--
+2.11.0
+
+
+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
+
+
+From 279644fb0b99dfb07ceaf713ca610e043131c6f4 Mon Sep 17 00:00:00 2001
+From: Alex Merry <dev@randomguy3.me.uk>
+Date: Fri, 2 Aug 2013 21:24:08 +0100
+Subject: [PATCH 4/4] Tidy up and document bison decls in tikzparser.ym
+
+---
+ tikzit/src/common/tikzparser.ym | 48 ++++++++++++++++++++++++++++-------------
+ 1 file changed, 33 insertions(+), 15 deletions(-)
+
+diff --git a/tikzit/src/common/tikzparser.ym b/tikzit/src/common/tikzparser.ym
+index 6eea833..9901f79 100644
+--- a/tikzit/src/common/tikzparser.ym
++++ b/tikzit/src/common/tikzparser.ym
+@@ -18,11 +18,25 @@
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+-
+-#import "Edge.h"
+-
+ %}
+
++%error-verbose
++/* enable maintaining locations for better error messages */
++%locations
++/* the name of the header file */
++%defines "common/tikzparser.h"
++/* make it re-entrant (no global variables) */
++%pure-parser
++/* We use a pure (re-entrant) lexer. This means yylex
++ will take a void* (opaque) type to maintain its state */
++%lex-param {void *scanner}
++/* Since this parser is also pure, yyparse needs to take
++ that lexer state as an argument */
++%parse-param {void *scanner}
++
++/* things required to use the parser (will go in the header);
++ in particular, declarations/imports for types in the %union
++ must go here */
+ %code requires {
+ #import <Foundation/Foundation.h>
+ @class TikzGraphAssembler;
+@@ -35,36 +49,40 @@ struct noderef {
+ };
+ }
+
+-%defines "common/tikzparser.h"
+-%pure-parser
+-%locations
+-%lex-param {void *scanner}
+-%parse-param {void *scanner}
+-%error-verbose
+-
++/* possible data types for semantic values */
+ %union {
+ NSPoint pt;
+ NSString *nsstr;
+ GraphElementProperty *prop;
+ GraphElementData *data;
+ Node *node;
+- struct noderef noderef; };
++ struct noderef noderef;
++}
+
+-%{
+-#import "TikzGraphAssembler+Parser.h"
++%code {
+ #import "GraphElementData.h"
+ #import "GraphElementProperty.h"
+ #import "Node.h"
++#import "Edge.h"
++
+ #import "tikzlexer.h"
++#import "TikzGraphAssembler+Parser.h"
++/* the assembler (used by this parser) is stored in the lexer
++ state as "extra" data */
+ #define assembler yyget_extra(scanner)
++
++/* pass errors off to the assembler */
+ void yyerror(YYLTYPE *yylloc, void *scanner, const char *str) {
+ [assembler reportError:str atLocation:yylloc];
+ }
+-%}
++}
+
++/* yyloc is set up with first_column = last_column = 1 by default;
++ however, it makes more sense to think of us being "before the
++ start of the line" before we parse anything */
+ %initial-action {
+ yylloc.first_column = yylloc.last_column = 0;
+-};
++}
+
+
+ %token BEGIN_TIKZPICTURE_CMD "\\begin{tikzpicture}"
+--
+2.11.0
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..151d227
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+fix-bison-decls.patch