jsinger67 / parol

LL(k) and LALR(1) parser generator for Rust

Home Page:https://jsinger67.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error accessing lookahead token from token stream!

jsinger67 opened this issue · comments

https://github.com/ryo33/parol_sandbox/tree/d562d4ef567b8b0d91c39f0544e8537c953d4417
This code emits the following error with cargo test

Diagnostic {
  message: "Error accessing lookahead token from token stream!",
  code: "parol_runtime::parser::syntax_error",
  help: "Syntax error in input prevents prediction of next production",
  labels: "[LabeledSpan {
    label: Some(\"Error location\"),
    span: SourceSpan { offset: SourceOffset(0), length: SourceOffset(0) }
  }]"
}

I'm trying to understand what happens, but it's a little harder.

Originally posted by @ryo33 in #36

If there are no terminals assigned to a scanner state, the resulting scanner can't deliver any valid tokens.
This should be detected during the analysis phase.

Fixed with d9ad08e and finally 3a6936c