Home » Modeling » TMF (Xtext) » TemplateProposal leads to endless loop
TemplateProposal leads to endless loop [message #1780195] |
Thu, 18 January 2018 09:18  |
Eclipse User |
|
|
|
Hi everybody,
today I stumbled across a really strange problem. Everytime I try to use CodeCompletion via ctrl+space in a certain place the AntlrProposalConflictHelper hangs in an endless loop in the equalTokenSequence(TokenSource first, TokenSource second) method.
My DSL grammar is this:
Method: 'method' name=ID fireAndForget?=FireAndForget? '(' methodArguments+=MethodArgument? (',' methodArguments+=MethodArgument)* ')';
FireAndForget: '[fireAndForget]';
MethodArgument: InArgument | OutArgument | InOutArgument;
InArgument: direction='in' type=PATH name=ID;
OutArgument: direction='out' type=PATH name=ID;
InOutArgument: direction='inout' type=PATH name=ID;
terminal fragment DIGIT: '0'..'9';
terminal fragment LOWERCASE_LETTER: 'a'..'z';
terminal fragment UPPERCASE_LETTER: 'A'..'Z';
terminal ID: (LOWERCASE_LETTER|UPPERCASE_LETTER|'_') (LOWERCASE_LETTER|UPPERCASE_LETTER|DIGIT|'_')*;
terminal PATH: ('/' ID)+;
But when I now type: "method MyMethod ()" with the cursor between the brackets and trying to use CodeCompletion via ctrl+space the application hangs.
This is what the data in the equalTokenSequence(TokenSource first, TokenSource second) looks like when it happens:
first data [$, {, i, n, }, , $, {, t, y, p, e, }, , $, {, n, a, m, e, }]
token [@-1,0:-1='',<9>,1:0]
text
second data [(, $, {, i, n, }, , $, {, t, y, p, e, }, , $, {, n, a, m, e, }]
token [@-1,1:0='',<9>,1:1]
text
The method reads in the next token in a while loop but the next token is always the same like written above.
Any idea what the problem could be? Is there something wrong with my grammar?
Greetings
Tobias
|
|
| | | | | | | |
Re: TemplateProposal leads to endless loop [message #1780494 is a reply to message #1780288] |
Tue, 23 January 2018 06:10  |
Eclipse User |
|
|
|
Ok we resolved the issue. The problem was a terminal rule for an ipv6 address.
Our terminals were defined like this:
terminal fragment DIGIT:
'0'..'9'
;
terminal fragment LOWERCASE_LETTER:
'a'..'z'
;
terminal fragment UPPERCASE_LETTER:
'A'..'Z'
;
terminal ANY:
'ANY'
;
terminal VERSION_ID returns ecore::EString:
'v' (DIGIT | ANY) ('.' (DIGIT | ANY))?
;
terminal ID:
(LOWERCASE_LETTER|UPPERCASE_LETTER|'_') (LOWERCASE_LETTER|UPPERCASE_LETTER|DIGIT|'_')*
;
terminal BIG_INT returns ecore::EBigInteger:
(DIGIT)+
;
terminal BIG_DECIMAL returns ecore::EBigDecimal:
BIG_INT ('.' BIG_INT)?
;
terminal IP_V4:
BIG_INT ('.' BIG_INT)*
;
terminal fragment IP6_RANGE:
(DIGIT|'a'..'f'|'A'..'F')
;
terminal IP_V6:
(IP6_RANGE | ':' | '.')*
;
terminal ASR_PATH:
('/' ID)+
;
terminal ASR_NAMESPACE:
ID ('::' ID)*
;
terminal ML_COMMENT:
'/*' -> '*/'
;
terminal SL_COMMENT:
'//' !('\n'|'\r')* ('\r'? '\n')?
;
terminal WS:
(' '|'\t'|'\r'|'\n')+
;
There where no complaints by Antlr when generating the language. I know in the mean time that this is not the right way for defining terminals and we switched the specific terminal rules to data type rules.
Thanks for the help.
Best regards
Tobias
|
|
|
Goto Forum:
Current Time: Wed Jul 23 17:05:59 EDT 2025
Powered by FUDForum. Page generated in 0.09260 seconds
|