Skip to content

Commit b807b25

Browse files
committed
Do not require parentheses for hooks
1 parent a5c9798 commit b807b25

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

src/main/gen/io/runescript/plugin/lang/parser/RsParser.java

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -659,38 +659,28 @@ private static boolean GosubExpression_2(PsiBuilder b, int l) {
659659
}
660660

661661
/* ********************************************************** */
662-
// NameLiteral (ArgumentList HookTransmitList?)?
662+
// NameLiteral ArgumentList? HookTransmitList?
663663
public static boolean HookFragment(PsiBuilder b, int l) {
664664
if (!recursion_guard_(b, l, "HookFragment")) return false;
665665
boolean r;
666666
Marker m = enter_section_(b, l, _NONE_, HOOK_FRAGMENT, "<hook fragment>");
667667
r = NameLiteral(b, l + 1);
668668
r = r && HookFragment_1(b, l + 1);
669+
r = r && HookFragment_2(b, l + 1);
669670
exit_section_(b, l, m, r, false, null);
670671
return r;
671672
}
672673

673-
// (ArgumentList HookTransmitList?)?
674+
// ArgumentList?
674675
private static boolean HookFragment_1(PsiBuilder b, int l) {
675676
if (!recursion_guard_(b, l, "HookFragment_1")) return false;
676-
HookFragment_1_0(b, l + 1);
677+
ArgumentList(b, l + 1);
677678
return true;
678679
}
679680

680-
// ArgumentList HookTransmitList?
681-
private static boolean HookFragment_1_0(PsiBuilder b, int l) {
682-
if (!recursion_guard_(b, l, "HookFragment_1_0")) return false;
683-
boolean r;
684-
Marker m = enter_section_(b);
685-
r = ArgumentList(b, l + 1);
686-
r = r && HookFragment_1_0_1(b, l + 1);
687-
exit_section_(b, m, null, r);
688-
return r;
689-
}
690-
691681
// HookTransmitList?
692-
private static boolean HookFragment_1_0_1(PsiBuilder b, int l) {
693-
if (!recursion_guard_(b, l, "HookFragment_1_0_1")) return false;
682+
private static boolean HookFragment_2(PsiBuilder b, int l) {
683+
if (!recursion_guard_(b, l, "HookFragment_2")) return false;
694684
HookTransmitList(b, l + 1);
695685
return true;
696686
}

src/main/grammars/RuneScript.bnf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ HookRoot ::= HookFragment {
287287
extraRoot=true
288288
}
289289

290-
HookFragment ::= NameLiteral (ArgumentList HookTransmitList?)? {
290+
HookFragment ::= NameLiteral ArgumentList? HookTransmitList? {
291291
mixin="io.runescript.plugin.lang.psi.mixin.RsHookFragmentMixin"
292292
implements="io.runescript.plugin.lang.psi.RsNamedElement"
293293
}

0 commit comments

Comments
 (0)