Closed GreasySlug closed 2 years ago
self.cfg.input = Input::File(self.input().read());
This code is not correct. The input of Input::File
is a file path. input.read()
returns source code.
Input
has two responsibilities: setting the input and the reader. We may modify it to a better API.I made a mistake in assigning the source code where I should have assigned the path.
Describe the bug
I am currently working on #29 and implementing the
exec()
in parse.rs.Unintended errors occur when running the parser with REPL and file input.
REPL will cause an infinite loop.
I checked and found that cfg::Input changed from REPL to Str in this assignment.
https://github.com/erg-lang/erg/blob/9783813ae08d872c6e2932f37bf74a41932f6ceb/compiler/erg_parser/parse.rs#L201-L206
It is not caused by the code I am implementing, but it processes strangely.The instance in the trait.rs is converted fromPEPL
toPipe
at the following locationA file input(example/add.er or else) will result in an error with a trailing:
insertedReproducible code
Infinite loop occurs.
OS Windows 10