All of the main test suite works

This commit is contained in:
Dan Hirsch 2014-01-10 22:30:57 +01:00
parent 6a35872470
commit 753120f27e
6 changed files with 169 additions and 130 deletions

View file

@ -19,7 +19,7 @@
token {
parser token("95\xa2");
test "95\xa2" --> "95\xa2";
test "95\xa2" --> fail;
test "95\xa3" --> fail;
}
ch {
@ -87,7 +87,7 @@ uint8 {
}
int_range {
parser int_range(uint8(), 0x3, 0x10);
parser int_range(uint8(), 0x3, 0xa);
test <05> --> u0x05;
test <0b> --> fail;
}
@ -299,17 +299,17 @@ rightrec {
test "aa" --> ['a',['a']];
test "aaa" --> ['a',['a',['a']]];
}
ambiguous {
subparser $d = ch('d');
subparser $p = ch('+');
subparser $e = choice(sequence($e, $p, $e), $d);
# TODO: implement action/h_act_flatten
parser $e;
test "d" --> 'd';
test "d+d" --> ['d','+','d'];
test "d+d+d" --> [['d','+','d'],'+','d'];
}
## Only for GLR
#ambiguous {
# subparser $d = ch('d');
# subparser $p = ch('+');
# subparser $e = choice(sequence($e, $p, $e), $d);
# # TODO: implement action/h_act_flatten
# parser $e;
#
# test "d" --> 'd';
# test "d+d" --> ['d','+','d'];
# test "d+d+d" --> [['d','+','d'],'+','d'];
#}

View file

@ -96,7 +96,8 @@ pp_parser(num(Num)) --> !,
"-0x", {RNum is -Num}; "0x", {RNum = Num} ),
pp_hexnum_guts(RNum).
pp_parser(char(C)) --> !,
"'", pp_char_guts(C), "'", !.
pp_parser(num(C)).
%"'", pp_char_guts(C), "'", !.
pp_parser(ref(Name)) -->
{atom_codes(Name,CName)},
@ -198,7 +199,7 @@ pp_parse_result(char(C)) --> !,
pp_parse_result(seq(Args)) --> !,
"[", pp_result_seq(Args), "]".
pp_parse_result(none) --> !,
"null".
"nil".
pp_parse_result(uint(V)) --> !,
pp_parser(num(V)).
pp_parse_result(sint(V)) --> !,