The fix is more comlex because whatever form the action descriptor takes
must be parsed later on in the code. Could you create an issue for this
in the Github repository? I am hot on the trail of other, I hope very
promising, improvements, and I want to put this lower on the priority
queue. The github issue will help ensure I do not forget, and allow you
and others to track it.
-- jeffrey
On 01/10/2014 08:04 AM, Ruslan Shvedov wrote:
On Fri, Jan 10, 2014 at 5:59 PM, Jeffrey Kegler
<[email protected]
<mailto:[email protected]>> wrote:
The behavior described seems tol be as documented. "Discarding"
is of lexemes, and does not happen inside lexemes. That is, the
lexemes form a series of tokens, some of which are discarded. But
discarding does not happen "within" the lexeme.
If you are discarding space, but also want a lexeme to contain
spaces, you have to arrange for that in some other way. One is
what you suggest: "Change "~" to "::=". Another is to change the
separator of <result item descriptor list> to include the spacing
around a comma.
This was a quick answer -- let me know if I've missed the point.
Nope, thanks, the answer is quite to the point.
What happended was I tried to write /[start, length, values]/ with
spaces in a SLIF grammar and its creation failed.
This patch to metag.bnf, per your suggestion, would allow spaces
-<array descriptor> ~ '[' <result item descriptor list> ']'
-<result item descriptor list> ~ <result item descriptor>* separator
=> [,]
+<array descriptor> ::= '[' <result item descriptor list> ']'
+<result item descriptor list> ::= <result item descriptor>* separator
=> [,]
<result item descriptor> ~ 'start' | 'length' | 'value' | 'values'
-- jeffey
ruslan
On 01/10/2014 07:05 AM, Ruslan Shvedov wrote:
String '[ start, length, values ]' can't be parsed with the
grammar below, as more fully described in the attached script,
unless <result item descriptor list> is changed to G1 rule.
<array descriptor> ::= '[' <result item descriptor list> ']'
# the test passes (whitespaces are discarded) if the below line
becomes a G1 (s/~/::=/) rule
<result item descriptor list> ~ <result item descriptor>*
separator => [,]
<result item descriptor> ~ 'start' | 'length' | 'value' | 'values'
:discard ~ whitespace
whitespace ~ [\s]+
The following exception is thrown:
Error in SLIF parse: No lexemes accepted at line 1, column 10
Lexer "L0" rejected 1 lexeme(s)
Rejected lexeme #1: <result item descriptor list>;
value="length,"; length = 7
* String before error: [ start,\s
* The error was at line 1, column 10, and at character 0x006c
'l', ...
* here: length, values ]
--
You received this message because you are subscribed to the
Google Groups "marpa parser" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google
Groups "marpa parser" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected]
<mailto:marpa-parser%[email protected]>.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google
Groups "marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "marpa
parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.