https://svn.lrde.epita.fr/svn/xrm/trunk
Index: ChangeLog
from SIGOURE Benoit <sigoure.benoit(a)lrde.epita.fr>
Add -a|--allow-amb option for parse-prism/parse-xrm.
This can be useful for debugging.
* src/tools/parse-xrm.str: Add -a|--allow-amb option.
* src/tools/parse-prism.str: Ditto.
* src/tools/parser-common.str: Ditto.
parse-prism.str | 1 +
parse-xrm.str | 1 +
parser-common.str | 25 ++++++++++++++++++++++---
3 files changed, 24 insertions(+), 3 deletions(-)
Index: src/tools/parse-xrm.str
--- src/tools/parse-xrm.str (revision 51)
+++ src/tools/parse-xrm.str (working copy)
@@ -22,6 +22,7 @@
+ preserve-comments-option
+ preserve-positions-option
+ pp-aterm-option
+ + allow-amb-option
strategies
Index: src/tools/parse-prism.str
--- src/tools/parse-prism.str (revision 51)
+++ src/tools/parse-prism.str (working copy)
@@ -22,6 +22,7 @@
+ preserve-comments-option
+ preserve-positions-option
+ pp-aterm-option
+ + allow-amb-option
strategies
Index: src/tools/parser-common.str
--- src/tools/parser-common.str (revision 51)
+++ src/tools/parser-common.str (working copy)
@@ -8,13 +8,15 @@
** -fi: heuristic: injection count
** -fe: heuristic: eagerness
** -2: use AsFix2 output format
- ** -A: ambiguities are treated as errors
** -p <file>: parse table to use
** -s <symbol>: start symbol to use
+ ** Additionnaly pass-amb might add this option:
+ ** -A: ambiguities are treated as errors
*/
xtc-sglr-no-heuristics(tbl, sort) =
- xtc-transform(!"sglr", !["-fi", "-fe", "-2A",
"-p", <tbl; xtc-find> (),
- "-s", <sort> () | <pass-v-verbose>
()])
+ xtc-transform(!"sglr", !["-fi", "-fe", "-2",
"-p", <tbl; xtc-find> (),
+ "-s", <sort>(), <pass-amb>()
+ | <pass-v-verbose>()])
strategies
@@ -48,6 +50,7 @@
<get-config> "preserve-positions" => "yes"
strategies
+
pp-aterm-option =
Option("-A" + "--pp-aterm"
, <set-pp-aterm> "yes"
@@ -60,6 +63,22 @@
must-pp-aterm =
<get-config> "pp-aterm" => "yes"
+strategies
+
+ allow-amb-option =
+ Option("-a" + "--allow-amb"
+ , <set-allow-amb> "yes"
+ , !HelpString("-a | --allow-amb", "Allow ambiguities")
+ )
+
+ set-allow-amb =
+ <set-config> ("allow-amb", <id>)
+
+ must-allow-amb =
+ <get-config> "allow-amb" => "yes"
+
+ pass-amb = if must-allow-amb then !"" else !"-A" end
+
/**
* Documentation
*/