Fixed syntac for syntax

This commit is contained in:
Dmitry Boulytchev 2020-04-12 03:00:24 +03:00
parent 690825f540
commit 4386e6cfd0
4 changed files with 8 additions and 8 deletions

View file

@ -828,7 +828,7 @@ module Expr =
| Some `Rep -> Call (Var "rep" , [s])
| Some `Rep0 -> Call (Var "rep0", [s])
};
syntaxPrimary[infix]: l:$ p:LIDENT args:(-"(" !(Util.list0)[parse infix Val] -")")* {
syntaxPrimary[infix]: l:$ p:LIDENT args:(-"[" !(Util.list0)[parse infix Val] -"]")* {
Loc.attach p l#coord;
List.fold_left (fun acc args -> Call (acc, args)) (Var p) args
}

View file

@ -1 +1 @@
let version = "Version 1.00, 7748144a8, Fri Apr 10 03:15:18 2020 +0300"
let version = "Version 1.00, 690825f54, Sat Apr 11 21:09:51 2020 +0300"

View file

@ -1,6 +1,6 @@
local sq = syntax (e1=token ("a") e2=token ("b") {Seq (e1, e2)}),
al = syntax (e=(token ("a") | token ("b")) {Alt (e)}),
rp = syntax (e=token ("a")* {Rep (e)});
local sq = syntax (e1=token ["a"] e2=token ["b"] {Seq (e1, e2)}),
al = syntax (e=(token ["a"] | token ["b"]) {Alt (e)}),
rp = syntax (e=token ["a"]* {Rep (e)});
printf ("%s\n", parseString (syntax (p=sq eof {p}), "ab").string);
printf ("%s\n", parseString (syntax (p=al eof {p}), "a").string);

View file

@ -1,6 +1,6 @@
local sq = syntax (e1=token ("a") e2=token ("b") {Seq (e1, e2)}),
al = syntax (e=(token ("a") | token ("b")) {Alt (e)}),
rp = syntax (e=token ("a")* {Rep (e)});
local sq = syntax (e1=token ["a"] e2=token ["b"] {Seq (e1, e2)}),
al = syntax (e=(token ["a"] | token ["b"]) {Alt (e)}),
rp = syntax (e=token ["a"]* {Rep (e)});
printf ("%s\n", parseString (syntax (sq -eof), "ab").string);
printf ("%s\n", parseString (syntax (al -eof), "a").string);