Skip to content

Commit 64498c0

Browse files
committed
fix compile and import statement bugs
1 parent b3f0ac9 commit 64498c0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ast.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ export namespace syxparser {
142142

143143
if (t.type === TokenType.Comma && at().type !== TokenType.Identifier) throw new CompilerError(t.range, 'Expected identifier after comma.');
144144
else if (t.type === TokenType.Comma && statement.formats.length === 0) throw new CompilerError(t.range, 'Can\'t start with comma.');
145+
else if (t.type === TokenType.Comma) {}
145146
else if (t.type === TokenType.Identifier) statement.formats.push(t.value);
146-
else throw new CompilerError(t.range, 'Unexpected token.');
147+
else throw new CompilerError(t.range, `Expected comma or identifier but found ${t.type}.`);
147148
}
148149
tokens.shift(); // skip CloseParen
149150

@@ -169,6 +170,7 @@ export namespace syxparser {
169170

170171
if (t.type === TokenType.Comma && at().type !== TokenType.Identifier) throw new CompilerError(t.range, 'Expected identifier after comma.');
171172
else if (t.type === TokenType.Comma && statement.formats.length === 0) throw new CompilerError(t.range, 'Can\'t start with comma.');
173+
else if (t.type === TokenType.Comma) {}
172174
else if (t.type === TokenType.Identifier) statement.formats.push(t.value);
173175
else throw new CompilerError(t.range, 'Unexpected token.');
174176
}

0 commit comments

Comments
 (0)