I'm trying to put together a grammar for cmd batch files, and I'm stumbling on the precedence issue with my keywords. If I just list out the keywords, then those keywords will be detected in innappropriate places (http://www.scootersoftware.com/vbull...ead.php?t=3773). So I tried to create a catch-all rule (type String) to be my lowest priority rule, but I can't use the typical identifier rule because there are so many legal characters. Consider the following:
The first line should be a label. On the second line, I want the set, the =, and the %~n2 to be a keyword, operator, and identifier respectively. On the third line, I want the call, the :sub, and the rest to be a keyword, label, and string respectively.
my catch-all is currently the Basic, regex
This works for lines 2 and 3, but it's determining :foo to be a String instead of a label. Label is defined as a Basic, Regex
If I put a space after the :foo, it recognizes it as a label. Does BC think String matches more characters because it matches the ^ and $ as well? I'm at a loss.
I am really struggling with this grammar, having spent a couple of hours on it now. It seems like the "List" primitive isn't powerful enough, and the "most characters" thing (http://www.scootersoftware.com/vbull...ead.php?t=3376) was not at all obvious (and not in the help for the grammar tab.)
Code:
:foo set F=%~n2 call :sub /Oo..\call\1.0-3_4*
my catch-all is currently the Basic, regex
Code:
[^ %=()]+
Code:
:(\w|_)+
I am really struggling with this grammar, having spent a couple of hours on it now. It seems like the "List" primitive isn't powerful enough, and the "most characters" thing (http://www.scootersoftware.com/vbull...ead.php?t=3376) was not at all obvious (and not in the help for the grammar tab.)
Comment