Subject: | Error when two empty rules are in a row |
Date: | Thu, 1 Dec 2011 16:25:22 +0100 |
To: | bug-Marpa-XS [...] rt.cpan.org |
From: | Tomáš Jirotka <tomas.jirotka [...] gooddata.com> |
Hi,
I have written a small grammar for a language not very different from SQL. I enclose the source code in attachment. There are several optional clauses as can be seen from the figure:
CREATE METRIC id_metric AS SELECT number (BY|empty) (FOR|empty) (WHERE (TRUE|FALSE)|empty) (WITH PF|empty)
Here, 'empty' states for the empty string, other lower case words are variables, upper case are keywords. On line 41, there is a rule 'TypeDef' -> 4 tokens, but the token 'AS' is evaluated as a part of MetricSelect rule. This is the real output
$VAR1 = [
\[
'Create',
'Metric',
'm',
[
'As',
'Select',
[
1
],
undef,
[
'Where',
[
'True'
]
],
undef
]
]
];
while I would expect
$VAR1 = [
\[
[
'Create',
[
'Metric',
'm',
'As',
[
'Select',
[
1
],
undef,
undef,
[
'Where',
[
'True'
]
],
undef
]
]
]
]
];
You may try it. It is important to note that in Marpa::PP this works properly, only XS's output is wrong. Probably, the problem is in two optional keywords before WHERE.
Versions:
This is perl, v5.10.1 (*) built for i386-linux-thread-multi
XS 0.024000
PP 0.012000
Thank you for producing this nice and useful package!
Tomas
Tomáš Jirotka
Software Engineer
GoodData
Sokolovská 192/79, 186 00, Prague 8
Office: +420 226 219 421
E-mail: tomas.jirotka@gooddata.com
Web: www.gooddata.com
Hi,
I have written a small grammar for a language not very different from SQL. I enclose the source code in attachment. There are several optional clauses as can be seen from the figure:
CREATE METRIC id_metric AS SELECT number (BY|empty) (FOR|empty) (WHERE (TRUE|FALSE)|empty) (WITH PF|empty)
Here, 'empty' states for the empty string, other lower case words are variables, upper case are keywords. On line 41, there is a rule 'TypeDef' -> 4 tokens, but the token 'AS' is evaluated as a part of MetricSelect rule. This is the real output
$VAR1 = [
\[
'Create',
'Metric',
'm',
[
'As',
'Select',
[
1
],
undef,
[
'Where',
[
'True'
]
],
undef
]
]
];
while I would expect
$VAR1 = [
\[
[
'Create',
[
'Metric',
'm',
'As',
[
'Select',
[
1
],
undef,
undef,
[
'Where',
[
'True'
]
],
undef
]
]
]
]
];
You may try it. It is important to note that in Marpa::PP this works properly, only XS's output is wrong. Probably, the problem is in two optional keywords before WHERE.
Versions:
This is perl, v5.10.1 (*) built for i386-linux-thread-multi
XS 0.024000
PP 0.012000
Thank you for producing this nice and useful package!
Tomas
Message body is not shown because sender requested not to inline it.
Tomáš Jirotka
Software Engineer
GoodData
Sokolovská 192/79, 186 00, Prague 8