-
Notifications
You must be signed in to change notification settings - Fork 134
Description
I have a rule in my plugin
private index_or_call_expr ::= simple_reference (index_access | func_call)+
left func_call ::= func_args | ':' simple_reference func_args
left index_access ::= ...
When I run it in debug mode I get an error that: Another not done marker added after this one. Must be done before this.
When I change the quantifier to *
I don't see this error.
The only difference I see in the generated parser is that with +
we marker
call that wraps the rest of the calls
private static boolean index_or_call_expr_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "index_or_call_expr_1")) return false;
boolean r;
//==========================
Marker m = enter_section_(b);
r = index_or_call_expr_1_0(b, l + 1);
//==========================
while (r) {
int c = current_position_(b);
if (!index_or_call_expr_1_0(b, l + 1)) break;
if (!empty_element_parsed_guard_(b, "index_or_call_expr_1", c)) break;
}
exit_section_(b, m, null, r);
return r;
}
The call stack is:
at com.intellij.lang.parser.GeneratedParserUtilBase.exit_section_(GeneratedParserUtilBase.java:480)
at com.github.aleksandrsl.intellijluau.parser.LuauParser.func_call(LuauParser.java:879)
at com.github.aleksandrsl.intellijluau.parser.LuauParser.index_or_call_expr_1_0(LuauParser.java:1495)
at com.github.aleksandrsl.intellijluau.parser.LuauParser.index_or_call_expr_1(LuauParser.java:1483)
at com.github.aleksandrsl.intellijluau.parser.LuauParser.index_or_call_expr(LuauParser.java:1470)
So basically
- We enter the section
- Parse the first
index_or_call_expr_1_0
it parses as true - Try parsing the second
index_or_call_expr_1_0
inside the loop it parses as false calls exit and fails
If I comment the marker inside index_or_call_expr_1
everything works fine, so I guess the func_call
calling the exit
being left
tries to close marker
that is before the marker
open in index_or_call_expr_1
To sum up:
left
+ +
- errors
left
+ *
- works fine
+
- works fine
The question is it expected behaviour or I just shouldn't write this and use left only with *
?
I'm on "2022.3.2.2" version of GrammarKit