^ in regular expressions (C#)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

^ in regular expressions (C#)

Oliver Bock
I am using Grammatica 1.5 (2009-03-07) to generate a C# parser.  If I
use ^ in regular expressions then the expression fail to match, although
no error is produced.  I see that bug #3597 claims to have fixed this,
but perhaps the fix only works with Java parsers.

I can get around this by changing my tokens from (for example):

WHITESPACE = <<\s+>> %ignore%
COMMAND = <<^COMMAND>

to

COMMAND = <<[\r\n]COMMAND>>   // must be before EOL
WHITESPACE = <<[ \t]+>> %ignore%
EOL = <<[\r\n]>> %ignore%

and also:

- adding a newline to the beginning of my script before parsing, and
- hacking the reporting of the line number in errors

so I am not stuck, it's just ugly.


  Oliver


_______________________________________________
Grammatica-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/grammatica-users