Skip to content

[BUG] Parser isn't treating linefeed as whitespace #13

Open
@tommythorn

Description

@tommythorn

Very useful project, looking forward to the continuation.

Describe the bug
I managed to hit this when running under emacs' shell mode. Interestingly it doesn't happen in a terminal.

To Reproduce
Steps to reproduce the behavior

On a Linux box,

  1. run emacs,
  2. M-x shell (that's Meta-x or alternative ESC and x, followed by shell return)
  3. cargo run --bin repl --features interpreter (the feature isn't relevant)
$ cargo run --bin repl --features interpreter
   Compiling calculator v0.0.0 (/home/tommy/projects/Rust/create-your-own-lang-with-rust/calculator)
    Finished dev [unoptimized + debuginfo] target(s) in 2.92s
     Running `target/debug/repl`
Calculator prompt. Expressions are line evaluated.
>> 1+2
Compiling the source: 1+2

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { variant: ParsingError { positives: [EOI\
, Operator], negatives: [] }, location: Pos(3), line_col: Pos((1, 4)), path: None, line: "1+2␊", continued_line: None }\
', /home/tommy/projects/Rust/create-your-own-lang-with-rust/calculator/src/lib.rs:20:52
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behavior
The behavior described in the documentation (or as it works outside of shell-mode)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions