From 87d475c5e0426d1b74f3670c88d251153b4a2355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Hinderer?= Date: Thu, 3 Jan 2019 17:36:44 +0100 Subject: [PATCH] Makefile.menhir enhancement This commit factorizes the way the menhir flags for unused tokens is defined. It also brings the comments explaining why tokens are unused above the definition of the unused_tokens variable. --- Makefile.menhir | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Makefile.menhir b/Makefile.menhir index 31a24c49f..c2068d235 100644 --- a/Makefile.menhir +++ b/Makefile.menhir @@ -46,12 +46,7 @@ MENHIR ?= menhir -## Menhir compilation flags - -MENHIRFLAGS := --explain --dump --ocamlc "$(CAMLC) $(COMPFLAGS)" --infer \ - --lalr --strict --table -lg 1 -la 1 \ - --unused-token COMMENT --unused-token DOCSTRING --unused-token EOL\ - --unused-token GREATERRBRACKET --fixed-exception +## Unused tokens # tokens COMMENT, DOCSTRING and EOL are produced by special lexer # modes used by other consumers than the parser. @@ -60,6 +55,13 @@ MENHIRFLAGS := --explain --dump --ocamlc "$(CAMLC) $(COMPFLAGS)" --infer \ # (which is used in polymorphic variant), but is not currently used by # the grammar. +unused_tokens := COMMENT DOCSTRING EOL GREATERRBRACKET + +## Menhir compilation flags + +MENHIRFLAGS := --explain --dump --ocamlc "$(CAMLC) $(COMPFLAGS)" --infer \ + --lalr --strict --table -lg 1 -la 1 \ + $(addprefix --unused-token ,$(unused_tokens)) --fixed-exception ## promote-menhir