grammatica-users
[Top][All Lists]
Advanced

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

[Grammatica-users] Multiline String & repeated terms


From: Alex Jeannopoulos
Subject: [Grammatica-users] Multiline String & repeated terms
Date: Sun, 26 Apr 2015 02:45:35 -0400

I am working through 2 issues, that I would like some advise on. Attached is a grammar and protocol files. Within the message are highlights of the grammar.

1. I am attempting to have a repeated term "CODE_DEFINITION", I am getting the following error when the CODE term is repeated.

[29:1] unexpected token "CODE", expected <EOF>, on line 29 column: 1


2. In my regex for a MULTILINE string a double quoted value breaks the parsing. Any thoughts how I can better support a python like multi line string, without escaping quotes within the """ block?

Thanks in advance.

CODE_LANG = PAREN_OPEN IDENTIFIER_STRING PAREN_CLOSE;

CODE_DEFINITION = CODE CODE_LANG? 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*
;


MULTILINE_STRING                        = <<(^""")([^*]|\*+[^*/])*("""$)>>
QUOTED_STRING = <<"([^"]|"")*+">>
TEXT              = QUOTED_STRING | MULTILINE_STRING;



Attachment: test.grammar
Description: Binary data

Attachment: test.proto
Description: Binary data


reply via email to

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