diff build-aux/common.mk @ 19809:a941a65c7cb8

handle bison syntax changes in TeX parser * oct-tex-parser.in.yy: Rename from oct-tex-parser.yy. Substitute %API_PREFIX_DECL%. * build-aux/common.mk (subst-bison-api-decls): New macro. * libinterp/parse-tree/module.mk (oct-parse.yy): Use it. * libinterp/corefcn/module.mk (oct-tex-parser.yy): New rule. * libinterp/Makefile.am: Ensure that oct-tex-parser.yy is built early. Search for tests in generated .yy file, not .in.yy file. * oct-tex-lexer.in.ll: Define YYSTPE if needed.
author John W. Eaton <jwe@octave.org>
date Thu, 19 Feb 2015 18:05:07 -0500
parents 9f6ee9cb749c
children 4f6ae6b94abe
line wrap: on
line diff
--- a/build-aux/common.mk	Thu Feb 19 17:33:59 2015 -0500
+++ b/build-aux/common.mk	Thu Feb 19 18:05:07 2015 -0500
@@ -729,6 +729,38 @@
 $(simple_move_if_change_rule)
 endef
 
+define subst-bison-api-decls
+  case "$(BISON_API_PREFIX_DECL_STYLE)" in \
+    *api*) \
+      case "$(BISON_API_PREFIX_DECL_STYLE)" in \
+       *brace*) \
+         api_prefix_decl='%define api.prefix {$(1)}'; ;; \
+       *) \
+         api_prefix_decl='%define api.prefix "$(1)"'; ;; \
+       esac; \
+      ;; \
+    *name*) \
+      case "$(BISON_API_PREFIX_DECL_STYLE)" in \
+        *brace*) \
+          api_prefix_decl='%name-prefix {$(1)}'; ;; \
+        *) \
+          api_prefix_decl='%name-prefix="$(1)"'; ;; \
+      esac; \
+    ;; \
+  esac; \
+  case "$(BISON_PUSH_PULL_DECL_STYLE)" in \
+    *quote*) quote='"' ;; \
+    *) quote="" ;; \
+  esac; \
+  case "$(BISON_PUSH_PULL_DECL_STYLE)" in \
+    *dash*) push_pull_decl="%define api.push-pull $${quote}both$${quote}"; ;; \
+    *underscore*) push_pull_decl="%define api.push_pull $${quote}both$${quote}"; ;; \
+  esac; \
+  $(SED) -e "s/%PUSH_PULL_DECL%/$$push_pull_decl/" \
+         -e "s/%API_PREFIX_DECL%/$$api_prefix_decl/" $< > $@-t
+  mv $@-t $@
+endef
+
 define test-file-commands
 ( echo "## DO NOT EDIT!  Generated automatically from $(<F) by Make."; $(GREP) '^%!' $< ) > $@-t
 mv $@-t $@