fix(selfhost/parser): skip newlines inside multi-import brace blocks
parserParseImportDecl now skips tkNewLine tokens inside {..} blocks,
matching the bootstrap parser behavior. This fixes parsing of imports
with names on separate lines, e.g.:
import Std::String::{
String_Eq,
String_Len
};
Previously the parser failed because it expected tkIdent immediately
after { but encountered tkNewLine instead.
This commit is contained in:
@@ -1925,6 +1925,12 @@ func parserParseImportDecl(p: *Parser, isPublic: bool) -> *Decl {
|
||||
discard parserAdvance(p); // {
|
||||
var names: String = "";
|
||||
while !parserCheck(p, tkRBrace) && parserPeek(p, 0) != tkEndOfFile {
|
||||
while parserCheck(p, tkNewLine) {
|
||||
discard parserAdvance(p);
|
||||
}
|
||||
if parserCheck(p, tkRBrace) || parserPeek(p, 0) == tkEndOfFile {
|
||||
break;
|
||||
}
|
||||
let n: LexToken = parserExpect(p, tkIdent, "expected import name");
|
||||
names = String_Concat(names, n.text);
|
||||
names = String_Concat(names, ",");
|
||||
|
||||
Reference in New Issue
Block a user