[antlr-interest] Tokens and ~()
Cid Dennis
cid at kynetx.com
Wed Jul 28 14:04:13 PDT 2010
I have a rule that should find all characters between / and /:
regex :
'/' (r=~('/'))+ '/'
;
The problem is later in my grammar file I have something that looks like:
fragment operator
: o=('.pick'|'.length'|'.as'|'.head'|'.tail'|'.sort'
|'.filter'|'.map'|'.uc'|'.lc' |'.split' | '.join' | '.query'
| '.has' | '.union' | '.difference' | '.intersection' | '.unique' | '.once'
| '.duplicates') '(' (e=expr (',' e1=expr )*)? ')'
;
When I parse a file that has this in it.
prune = mdata.replace(/(?s)(.*v.directedBy..)(\w+\s+\w+)(<\/a.*)/,"$2");
I get mismatched character 'r' expecting 'f'. This seems to be because I have '.difference'. What I do not understand is why this that happening. I would expect the ~('/') to say give me everything except "/" but it gets stuff on other tokens defined in the grammar.
Can someone shed some light on what I am doing wrong. This is my first grammar with ANTLR and am confused.
------------------------------------------
Cid Dennis
ph : 303 915 9381
em: cid at kynetx.com
More information about the antlr-interest
mailing list