[antlr-interest] Illegal escape sequence in C#
Gavin Lambert
antlr at mirality.co.nz
Wed Jul 30 14:15:26 PDT 2008
At 07:27 31/07/2008, rkevinburton at charter.net wrote:
> else if (lt.Type == EOL || (lt.Type == MultiLineComment &&
>Regex.IsMatch(lt.Text, "/.*\r\n|\r|\n")))
> {
> // We found our EOL: promote the token to on channel,
position
>the input on it and reset the rule start.
> lt.Channel = Token.DEFAULT_CHANNEL;
> input.Seek(lt.TokenIndex);
> if (rule != null)
> {
> rule.start = lt;
> }
> break;
> }
Generally in action code you should be using ANTLR's automatic
substitution attributes. So use '$rule.start', not
'rule.start'. Then the codegen will automatically convert it to
use the Start property -- and handle cases where the local
variable isn't called 'rule' any more.
(Maybe ANTLR should encourage this better by doing what it did in
v2 -- adding a unique numeric suffix to each variable [and also
munging members like 'type' in the lexer]. That way it'll
basically force people to use the $ syntax, which will help
insulate them against changes in the codegen...)
More information about the antlr-interest
mailing list