grammatica-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Grammatica-users] ^ in regular expressions (C#)


From: Oliver Bock
Subject: [Grammatica-users] ^ in regular expressions (C#)
Date: Wed, 23 Sep 2009 16:56:56 +1000
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]