Skip to content

Commit

Permalink
Fix speculative parse loop detection (#1167)
Browse files Browse the repository at this point in the history
Bugs fixed:
- Fix issue where speculative parsing loop detection didn't work correctly
  • Loading branch information
degory committed Apr 11, 2024
1 parent ba97fc5 commit aad0c3a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
]
},
"ghul.compiler": {
"version": "0.8.37",
"version": "0.8.38",
"commands": [
"ghul-compiler"
]
Expand Down
8 changes: 3 additions & 5 deletions src/lexical/token_lookahead.ghul
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,11 @@ namespace Lexical is
count = count + 1;
fi

if count > 0 then
debug_always("possible speculative parsing loop backtracking from {from} to {to} ({_recent_backtracks}) from {System.Diagnostics.StackTrace().to_string().replace_line_endings(" ")}");
elif
count > 1
then
if count > 1 then
debug_always("speculative parsing loop backtracking from {from} to {to} ({_recent_backtracks}) from {System.Diagnostics.StackTrace().to_string().replace_line_endings(" ")}");
throw new System.Exception("speculative parsing loop backtracking from {from} to {to} ({_recent_backtracks})");
elif count > 0 then
debug_always("possible speculative parsing loop backtracking from {from} to {to} ({_recent_backtracks}) from {System.Diagnostics.StackTrace().to_string().replace_line_endings(" ")}");
fi

let from_to = (from, to);
Expand Down

0 comments on commit aad0c3a

Please sign in to comment.