Apologies in advance for not cutting my grammar down to isolate the error,
but I'm having a problem understanding an error when I try to modify the
following grammar:
:default ::= action => [name,values]
lexeme default = latm => 1
:start ::= line
line ::= name_group sep parmgroup sep sigil sep comment
name_group ::= tag | tag whitespace names
sep ::= whitespace
sep ::=
whitespace ~ [\s]+
tag ::= tag_name
tag_name ~ <plain tag> | <annotation tag>
<plain tag> ~ [\w]+
<annotation tag> ~ '[' <plain tag> ']'
names ~ name+
name ~ [\w]+
parmgroup ::= paren_group | bracket_group | string
parmgroup ::=
paren_group ::= '(' parm_list ')'
bracket_group ::= '[' parm_list ']'
parm_list ::= parm* separator => <comma>
parm ::= words | words '=' string
words ~ name+
sigil ::= ':' | '::' | ':*' | '{' | '[' | '<' | '('
| sigil template_spec
sigil ::=
template_spec ::= '?' <up_to_comment>
<up_to_comment> ~ [^#]
<comma> ~ [,]
string ::= sqstr || dqstr # Strings stolen from
MarpaX::Demo::JSONParser
sqstr ~ sq <sq contents> sq
dqstr ~ dq <dq contents> dq
sq ~ [']
dq ~ ["]
<sq contents> ~ <sq char>*
<dq contents> ~ <dq char>*
<sq char> ~ [^'\\] | '\' <any char>
<dq char> ~ [^"\\] | '\' <any char>
<any char> ~ [\d\D]
comment ::= hash_comment # No comment, or comment consisting of
a hash followed by everything else in the string.
comment ::=
hash_comment ~ '#' anything
anything ~ <any char>*
The above grammar works fine on my test string, but when I make "names" a
::=-rule instead of a ~-rule, like this:
names ::= name
I get the following error:
A lexeme in G1 is not a lexeme in any of the lexers: name
OK, so 'name' is clearly still a lexeme in a lexer if I understand the
terminology correctly. What am I missing? I get a similar error if I try
to use "separator => whitespace" - except now it can't find whitespace.
Clearly I am entirely barking up the wrong tree here.
--
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/d/optout.