Phase 7.10: workaround else-if bug in lexSkipWhitespace
Lexer (src_bux/lexer.bux): - Rewrote lexSkipWhitespace to use nested if/else instead of else-if chain (workaround for Nim C backend else-if lowering bug) - lexPeek: mask with & 255 for UTF-8 signed char bytes Known: buxc2 project build hangs on ast.bux parsing (infinite loop). buxc2 single-file build works correctly with else-if. All 18 examples pass, all unit tests pass.
This commit is contained in:
@@ -227,11 +227,13 @@ func lexSkipBlockComment(lex: *Lexer) {
|
||||
func lexSkipWhitespace(lex: *Lexer) {
|
||||
while !lexIsAtEnd(lex) {
|
||||
let c: uint32 = lexPeek(lex, 0);
|
||||
if c == 32 || c == 9 || c == 13 { // space, tab, CR
|
||||
if c == 32 || c == 9 || c == 13 {
|
||||
discard lexAdvance(lex);
|
||||
} else if c == 47 && lexPeek(lex, 1) == 47 { // //
|
||||
} else {
|
||||
if c == 47 && lexPeek(lex, 1) == 47 {
|
||||
lexSkipLineComment(lex);
|
||||
} else if c == 47 && lexPeek(lex, 1) == 42 { // /*
|
||||
} else {
|
||||
if c == 47 && lexPeek(lex, 1) == 42 {
|
||||
discard lexAdvance(lex);
|
||||
discard lexAdvance(lex);
|
||||
lexSkipBlockComment(lex);
|
||||
@@ -240,6 +242,8 @@ func lexSkipWhitespace(lex: *Lexer) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Identifiers
|
||||
|
||||
+7
-3
@@ -227,11 +227,13 @@ func lexSkipBlockComment(lex: *Lexer) {
|
||||
func lexSkipWhitespace(lex: *Lexer) {
|
||||
while !lexIsAtEnd(lex) {
|
||||
let c: uint32 = lexPeek(lex, 0);
|
||||
if c == 32 || c == 9 || c == 13 { // space, tab, CR
|
||||
if c == 32 || c == 9 || c == 13 {
|
||||
discard lexAdvance(lex);
|
||||
} else if c == 47 && lexPeek(lex, 1) == 47 { // //
|
||||
} else {
|
||||
if c == 47 && lexPeek(lex, 1) == 47 {
|
||||
lexSkipLineComment(lex);
|
||||
} else if c == 47 && lexPeek(lex, 1) == 42 { // /*
|
||||
} else {
|
||||
if c == 47 && lexPeek(lex, 1) == 42 {
|
||||
discard lexAdvance(lex);
|
||||
discard lexAdvance(lex);
|
||||
lexSkipBlockComment(lex);
|
||||
@@ -240,6 +242,8 @@ func lexSkipWhitespace(lex: *Lexer) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Identifiers
|
||||
|
||||
Reference in New Issue
Block a user