A couple of rules and recursion overflow - help appreciated [message #1767159] |
Sun, 02 July 2017 17:40 |
David Black Messages: 33 Registered: June 2017 |
Member |
|
|
Hi,
I am a newbie to Xtext and keeping scratching my head over the following problem.
My grammar is this simple:
MyGrammar:
source+=(IDENTIFIER | TYPE)*
;
terminal TYPE:
IDENTIFIER |
(IDENTIFIER '<' TYPE '>')
;
And the part defining the IDENTIFIER is this (it's not complicated, just long because of the characters specification involved):
terminal fragment DECIMAL_DIGIT:
INT
;
terminal fragment IDENTIFIER_HEAD:
('a'..'z') | ('A'..'Z') |
'_' |
'\u00A8' | '\u00AA' | '\u00AD' | '\u00AF' | ('\u00B2'..'\u00B5') | ('\u00B7'..'\u00BA') |
('\u00BC'..'\u00BE') | ('\u00C0'..'\u00D6') | ('\u00D8'..'\u00F6') | ('\u00F8'..'\u00FF') |
('\u0100'..'\u02FF') | ('\u0370'..'\u167F') | ('\u1681'..'\u180D') | ('\u180F'..'\u1DBF') |
('\u1E00'..'\u1FFF') |
('\u200B'..'\u200D') | ('\u202A'..'\u202E') | ('\u203F'..'\u2040') | '\u2054' | ('\u2060'..'\u206F') |
('\u2070'..'\u20CF') | ('\u2100'..'\u218F') | ('\u2460'..'\u24FF') | ('\u2776'..'\u2793') |
('\u2C00'..'\u2DFF') | ('\u2E80'..'\u2FFF') |
('\u3004'..'\u3007') | ('\u3021'..'\u302F') | ('\u3031'..'\u303F') | ('\u3040'..'\uD7FF') |
('\uF900'..'\uFD3D') | ('\uFD40'..'\uFDCF') | ('\uFDF0'..'\uFE1F') | ('\uFE30'..'\uFE44') |
('\uFE47'..'\uFFFD')
;
terminal IDENTIFIER:
(IDENTIFIER_HEAD IDENTIFIER_CHARACTERS*) |
('`'(IDENTIFIER_HEAD IDENTIFIER_CHARACTERS*)'`') |
IMPLICIT_PARAMETER_NAME
;
terminal fragment IDENTIFIER_CHARACTER:
DECIMAL_DIGIT |
('\u0300'..'\u036F') | ('\u1DC0'..'\u1DFF') | ('\u20D0'..'\u20FF') | ('\uFE20'..'\uFE2F') |
IDENTIFIER_HEAD
;
terminal fragment IDENTIFIER_CHARACTERS:
IDENTIFIER_CHARACTER+
;
The error I am getting is this one:
error(206): ../org.instrumenteddreams.swift.s2.xtext/src-gen/org/instrumenteddreams/parser/antlr/internal/InternalSwiftJ.g:1:8:
Alternative 3: after matching input such as
'\u3021'..'\u302F''\u0300'..'\u036F''\u1DC0'..'\u1DFF''<'
{'\u3021'..'\u302F', '\uFE00'..'\uFE0F'}'\u0300'..'\u036F''\u1DC0'..'\u1DFF''<'
{'\u3021'..'\u302F', '\uFE00'..'\uFE0F'}'\u0300'..'\u036F''\u1DC0'..'\u1DFF''<'
{'\u3021'..'\u302F', '\uFE00'..'\uFE0F'}'\u0300'..'\u036F''\u1DC0'..'\u1DFF''<'
{'\u3021'..'\u302F', '\uFE00'..'\uFE0F'}'\u0300'..'\u036F'<EOT>
decision cannot predict what comes next due to recursion overflow to RULE_TYPE from RULE_TYPE
Every hint or suggestion will be appreciated.
[Updated on: Mon, 03 July 2017 21:22] Report message to a moderator
|
|
|
|
|
Re: A couple of rules and recursion overflow - help appreciated [message #1767234 is a reply to message #1767190] |
Mon, 03 July 2017 22:23 |
David Black Messages: 33 Registered: June 2017 |
Member |
|
|
Well, it's one of those situations in which after rolling back all the changes and buiding the whole thing bit by bit, it looks I am not able to reproduce that error anymore. At least in that scenario.
It's a pity. I'd like to come up with a smart solution to guide and shape young generations of XText fighters to come, but it's not the case.
Cheers
|
|
|
Powered by
FUDForum. Page generated in 0.02508 seconds