Skip to content

Commit 0e6eae3

Browse files
committed
Fix parsing trailing tabs in .sym file format
1 parent 72d35a3 commit 0e6eae3

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- Fix type checking for expression lists.
2121
- Fix type checking when there is a type error.
2222
- Fix type checking for varbit game variables.
23+
- Fix parsing trailing tabs in .sym file format.
2324

2425
## [1.2.0] - 2023-08-18
2526

src/main/gen/io/runescript/plugin/symbollang/parser/RsSymParser.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static boolean File(PsiBuilder b, int l) {
6161
}
6262

6363
/* ********************************************************** */
64-
// Field '\t' Field ('\t' Field)* '\n'
64+
// Field '\t' Field ('\t' Field)* '\t'* '\n'
6565
public static boolean Symbol(PsiBuilder b, int l) {
6666
if (!recursion_guard_(b, l, "Symbol")) return false;
6767
if (!nextTokenIs(b, STRING)) return false;
@@ -71,6 +71,7 @@ public static boolean Symbol(PsiBuilder b, int l) {
7171
r = r && consumeToken(b, TAB);
7272
r = r && Field(b, l + 1);
7373
r = r && Symbol_3(b, l + 1);
74+
r = r && Symbol_4(b, l + 1);
7475
r = r && consumeToken(b, NEW_LINE);
7576
exit_section_(b, m, SYMBOL, r);
7677
return r;
@@ -98,4 +99,15 @@ private static boolean Symbol_3_0(PsiBuilder b, int l) {
9899
return r;
99100
}
100101

102+
// '\t'*
103+
private static boolean Symbol_4(PsiBuilder b, int l) {
104+
if (!recursion_guard_(b, l, "Symbol_4")) return false;
105+
while (true) {
106+
int c = current_position_(b);
107+
if (!consumeToken(b, TAB)) break;
108+
if (!empty_element_parsed_guard_(b, "Symbol_4", c)) break;
109+
}
110+
return true;
111+
}
112+
101113
}

src/main/grammars/Symbol.bnf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}
2323

2424
File ::= Symbol*
25-
Symbol ::= Field '\t' Field ('\t' Field)* '\n' {
25+
Symbol ::= Field '\t' Field ('\t' Field)* '\t'* '\n' {
2626
mixin="io.runescript.plugin.symbollang.psi.mixin.RsSymSymbolMixin"
2727
stubClass="io.runescript.plugin.symbollang.psi.stub.RsSymSymbolStub"
2828
elementTypeFactory="io.runescript.plugin.symbollang.psi.stub.RsSymStubElementFactory.create"

0 commit comments

Comments
 (0)