Open ksudol opened 9 years ago
actions are only executed after entire token is matched. i know this action placement is misleading but...
@parrt Actually this use case was intended to be enabled by #408 and #469 (ANTLR 4.2.1). You can see warning 132 (LEXER_ACTION_PLACEMENT_ISSUE) was deprecated at the same time. The current test for position-dependent lexer actions is in ActionPlacement.stg.
In the case of token: "aaaX", getText() returns: "aaa" (according to action placement)
But if I'm trying to parse the following string: "abX aaaX" getText() returns: [ab] // ok [aa] // token is cut off (if the first token found is shorter)
@sharwell Are you saying there is a bug in the updates we made to enable this?
@parrt I'm just saying that I too would expect the output that @ksudol expected in the original post
Ah. seems to me that we simply added an error message that actions can only appear on the right side. Hmm...ok.
Hello, I have the following grammar file for ANTLR4.5.1:
and java file:
Function getText() returns: [aaa] // ok [abX] // wrong, 'X' should be matched after calling the function getText() [aaa] // ok