Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bc: runtime error eats too much input #292

Merged
merged 1 commit into from
Nov 14, 2023

Commits on Oct 14, 2023

  1. bc: runtime error eats too much input

    * In interactive bc, calling an undefined function does not cause a fatal error but an error is printed
    * YYERROR() is called in this situation, but it seems to break something
    * It appears that input tokens past the end of current statement are eaten by YYERROR
    * I observed this:
    
    ME> x = hey(1) + 2
    BC> No function hey() has been defined
    ME> x
    ME> x
    BC> 0
    ME> quit
    
    * After the error bc ignores the first time I type x (but when I ask again it politely answers)
    * Replacing YYERROR with "last INSTR" causes bc to jump past the final instruction in the current statement
    * Instructions in the subsequent statement are not destroyed
    * With this patch, the statement after the error is executed as I expect (this matches GNU bc)
    
    ME> x = 5
    BC> 5
    ME> y = heh(6) + 7
    BC> No function heh() has been defined
    ME> x
    BC> 5
    ME> y
    BC> 0
    ME> quit
    mknos authored Oct 14, 2023
    Configuration menu
    Copy the full SHA
    6cf6f82 View commit details
    Browse the repository at this point in the history