[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Grammatica-users] regular expression problem in tokens
From: |
Wieger Wesselink |
Subject: |
Re: [Grammatica-users] regular expression problem in tokens |
Date: |
Mon, 18 May 2009 06:09:03 +0100 |
I found a workaround for the problem. Using '[\d]+(-[\d]+)+'
instead of '\d+(-\d+)+' makes it accept '1-23'.
BTW, it took me about an hour to port a grammar to Grammatica
and start using it, whereas I struggled for half a day with
ANTLR and still didn't get it right because of the many peculiar
undocumented behaviors in their implementation. So thanks and
keep up the good work!
Wieger
> ----- Original Message -----
> From: "Wieger Wesselink" <address@hidden>
> To: address@hidden
> Subject: [Grammatica-users] regular expression problem in tokens
> Date: Sun, 17 May 2009 23:54:12 +0100
>
>
> Hi,
>
> when I put the regular expression '\d+(-\d+)+' in a token I would
> expect that the string '1-23' is accepted. However, I get the following
> error:
>
> Parse tree from 1.pdn:
> Error: in 1.pdn: line 1:
> unexpected character '1'
>
> 1-23
> ^
>
> I have verified on http://www.fileformat.info/tool/regex.htm that
> the string '1-23' matches with '\d+(-\d+)+'.
>
> Is this a bug in Grammatica, or am I doing something wrong? For the
> full grammar see below.
>
> Best regards,
>
> Wieger
>
> -----------------------------
>
> %header%
>
> GRAMMARTYPE = "LL"
>
> %tokens%
>
> NUMBERS = <<\d+(-\d+)+>>
> WHITESPACE = <<[ \t\n\r]+>> %ignore%
>
> %productions%
>
> Start = NUMBERS ;
>
>
>
> --
> _______________________________________________
> Surf the Web in a faster, safer and easier way:
> Download Opera 9 at http://www.opera.com
>
> Powered by Outblaze
>
>
> _______________________________________________
> Grammatica-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/grammatica-users
>
--
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 9 at http://www.opera.com
Powered by Outblaze