selfhost: fix parser infinite loop + lexer token limit
- Parser_Parse: add beforePos safeguard to skip unrecognized tokens instead of looping forever when parserParseDecl returns null - Lexer: increase maxTokens 4096 -> 32768; add explicit break on limit - CLI: null-check ReadFile result before String_Eq - Nim CLI: add -O2 to cc invocation for faster self-hosted builds
This commit is contained in:
+2
-2
@@ -106,7 +106,7 @@ func Cli_Compile(source: String, sourceName: String) -> String {
|
||||
|
||||
func Cli_Build(srcPath: String, outPath: String) -> int {
|
||||
let source: String = ReadFile(srcPath);
|
||||
if String_Eq(source, "") || !FileExists(srcPath) {
|
||||
if source == null as String || String_Eq(source, "") || !FileExists(srcPath) {
|
||||
Print("Error: cannot read source file: ");
|
||||
PrintLine(srcPath);
|
||||
return 1;
|
||||
@@ -142,7 +142,7 @@ func Cli_Check(srcPath: String) -> int {
|
||||
Print("Check: ");
|
||||
PrintLine(srcPath);
|
||||
let source: String = ReadFile(srcPath);
|
||||
if String_Eq(source, "") {
|
||||
if source == null as String || String_Eq(source, "") {
|
||||
PrintLine("Error: cannot read source file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user