mirror of
https://github.com/apple/pkl.git
synced 2026-03-29 21:31:51 +02:00
Fix newline checks in parser (#1328)
This commit is contained in:
committed by
Jen Basch
parent
5516cdb210
commit
c63b8d3965
@@ -1811,11 +1811,13 @@ public class Parser {
|
||||
private FullToken forceNext() {
|
||||
var tk = lexer.next();
|
||||
precededBySemicolon = false;
|
||||
var newLines = lexer.newLinesBetween;
|
||||
while (tk.isAffix()) {
|
||||
precededBySemicolon = precededBySemicolon || tk == Token.SEMICOLON;
|
||||
tk = lexer.next();
|
||||
newLines += lexer.newLinesBetween;
|
||||
}
|
||||
return new FullToken(tk, lexer.span(), lexer.newLinesBetween);
|
||||
return new FullToken(tk, lexer.span(), newLines);
|
||||
}
|
||||
|
||||
// Like next, but don't ignore comments
|
||||
|
||||
@@ -93,6 +93,7 @@ class ParserComparisonTest {
|
||||
"stringError1.pkl",
|
||||
"annotationIsNotExpression2.pkl",
|
||||
"amendsRequiresParens.pkl",
|
||||
"errors/binopDifferentLine.pkl",
|
||||
"errors/parser18.pkl",
|
||||
"errors/nested1.pkl",
|
||||
"errors/invalidCharacterEscape.pkl",
|
||||
|
||||
Reference in New Issue
Block a user