grammatica-users
[Top][All Lists]
Advanced

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

Re: [Grammatica-users] Regex Issue


From: Per Cederberg
Subject: Re: [Grammatica-users] Regex Issue
Date: Fri, 24 Apr 2015 09:39:25 +0200

The error message tries its best to explain what happens:

[1328:1] unexpected token "{{{" <CODE_BEGIN>, expected <CODE_TEXT>

That is, the grammar contains a token named "CODE_BEGIN" (not shown in your example) that is matching instead of CODE_TEXT (which was expected). Try removing that token (if not needed elsewhere).

Cheers,

/Per

On Fri, Apr 24, 2015 at 4:56 AM, Alex Jeannopoulos <address@hidden> wrote:
Here is a snippet of a grammar I am trying to setup. I am looking to match the following text

PROTO CLIENT EVENT ActiveConversationsList       32 PAYLOAD[JSON(conversations):data] PAYLOAD_DESCRIPTION ""
EVENT_DESCRIPTION "List of ActiveConversations, each ActiveConversation contains conv_id, conv_name, group_id, start_indx, last_indx, uids_involved"
CATEGORY "" CODE (java)
{{{

java example
aaa
aaa
aa

}}}

Here is portion of the grammar I have come up with. 
%tokens%
IDENTIFIER_STRING   = <<[a-zA-Z][a-zA-Z0-9-_]*>>
PAREN_OPEN              = "("
PAREN_CLOSE            = ")"
CODE                            = "CODE"
CODE_TEXT                 = <<(^\{\{\{\n).*(^\}\}\}\n)>>

%productions%
CODE_LANG                = "(" IDENTIFIER_STRING ")";
CODE_DEFINITION     = CODE (CODE_LANG)? CODE_TEXT;

EventDefinition   = SERVER_TYPE
                    CODE_TYPE
                    EVENT_TYPE
                    IDENTIFIER_STRING DEC_NUMBER
                    VERSION_TAG?
                    PAYLOAD
                    PAYLOAD_DESCRIPTION_INFO
                    EVENT_DESCRIPTION_INFO
                    CATEGORY_INFO
                    ACTIVE_STATE?
                    CODE_DEFINITION?
                    ;

[ValidateProtocol] {{{
[ValidateProtocol] [1328:1] unexpected token "{{{" <CODE_BEGIN>, expected <CODE_TEXT>, on line 1328 column: 1
[ValidateProtocol] Error parsing protocol file

As long as I have the CODE_DEFINITION tag in the definition I have errors. What am I missing, 

thanks in advance

_______________________________________________
Grammatica-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/grammatica-users



reply via email to

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