[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Grammatica-users] AW: Grammatica-users Digest, Vol 55, Issue 2
From: |
Schilha, Matthias |
Subject: |
[Grammatica-users] AW: Grammatica-users Digest, Vol 55, Issue 2 |
Date: |
Fri, 25 Mar 2011 08:48:07 +0100 |
Hi Per,
Thank you for your response.
I simplified my expression to this now to accept: a='b' :
%header%
GRAMMARTYPE = "LL"
%tokens%
EQ = "="
SINGLE_QUOTE = "'"
IDENTIFIER = <<[a-z]>>
%productions%
Expression = IDENTIFIER EQ SINGLE_QUOTE IDENTIFIER SINGLE_QUOTE;
It doesn't work. What the expression accept is: a=b
Have you got another idea. Thanks in advanced.
Matthias
-----Ursprüngliche Nachricht-----
Von: address@hidden [mailto:address@hidden Im Auftrag von address@hidden
Gesendet: Donnerstag, 24. März 2011 17:01
An: address@hidden
Betreff: Grammatica-users Digest, Vol 55, Issue 2
Send Grammatica-users mailing list submissions to
address@hidden
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.nongnu.org/mailman/listinfo/grammatica-users
or, via email, send a message with subject or body 'help' to
address@hidden
You can reach the person managing the list at
address@hidden
When replying, please edit your Subject line so it is more specific than "Re:
Contents of Grammatica-users digest..."
Today's Topics:
1. Re: Grammar with single-quoted stings (Per Cederberg)
----------------------------------------------------------------------
Message: 1
Date: Wed, 23 Mar 2011 18:52:58 +0100
From: Per Cederberg <address@hidden>
Subject: Re: [Grammatica-users] Grammar with single-quoted stings
To: "address@hidden" <address@hidden>
Message-ID:
<address@hidden>
Content-Type: text/plain; charset=UTF-8
Your regex for whitespace seems to include an accidental extra char at the end.
Cheers,
/Per
On Wednesday, March 23, 2011, Schilha, Matthias <address@hidden> wrote:
> Hi,
>
> i want to write a grammar to accept strings like this: a = 'b'
>
> To do that, I write this grammar:
>
> %header%
>
> GRAMMARTYPE = "LL"
>
> %tokens%
>
> EQ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
> Â Â = "="
>
> S_QUOTE Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â = "'"
>
> NUMBER Â Â Â Â Â Â Â Â Â Â Â = <<[0-9]+>> IDENTIFIER Â Â
>        = <<'[A-Za-z§][A-Za-z0-9_§]*>> WHITESPACE  Â
> Â Â Â Â Â Â Â = <<[ \t\n\r]+'>> %ignore%
>
>
> %productions%
>
>
> Expression = IDENTIFIER AtomComparisonTail;
>
> AtomComparisonTail = Comparison Atom
> Â Â Â Â Â Â Â Â | Comparison "'" Atom "'";
>
> Comparison = "=";
>
> Atom = NUMBER
> Â Â | IDENTIFIER;
>
>
> But it doesn't work. I get the message: unexpected character ''', on
> line: 1 column: 3
>
> In this way I changed my grammar to
>
> %header%
>
> GRAMMARTYPE = "LL"
>
> %tokens%
>
> EQ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
> Â Â = "="
>
> S_QUOTE Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â = "'"
>
> QUOTED_STRING Â Â Â Â Â Â Â Â = <<('[^']*')>> NUMBER Â Â Â Â
> Â Â Â Â Â Â Â = <<[0-9]+>> IDENTIFIER Â Â Â Â Â Â Â Â Â
> = <<'[A-Za-z§][A-Za-z0-9_§]*>> WHITESPACE         Â
> = <<[ \t\n\r]+'>> %ignore%
>
>
> %productions%
>
>
> Expression = IDENTIFIER AtomComparisonTail;
>
> AtomComparisonTail = Comparison Atom
> Â Â Â Â Â Â Â Â | Comparison QUOTED_STRING Atom QUOTED_STRING;
>
> Comparison = "=";
>
> Atom = NUMBER
> Â Â | IDENTIFIER;
>
> But it is still not working.
>
> Have someone another idea to solve this problem.
>
> Thank you very much.
> Matthias
>
> _______________________________________________
> Grammatica-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/grammatica-users
>
------------------------------
_______________________________________________
Grammatica-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/grammatica-users
End of Grammatica-users Digest, Vol 55, Issue 2
***********************************************
- [Grammatica-users] AW: Grammatica-users Digest, Vol 55, Issue 2,
Schilha, Matthias <=