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

Error parsing #57

Open
WebFreak001 opened this issue Oct 30, 2016 · 1 comment
Open

Error parsing #57

WebFreak001 opened this issue Oct 30, 2016 · 1 comment

Comments

@WebFreak001
Copy link
Member

I just quickly wanted to find the smallest file in a directory with this code:

D> size_t minSize = size_t.max; string minName = "invalid"; foreach (file; dirEntries(getcwd, SpanMode.breadth)) {
 | if (file.isFile && file.size < minSize) {
 | minSize = file.size;
 | minName = cast(string) file;
 | }
 | } writefln("%s with %s bytes", minName, minSize);

It didn't even try to run that code and just said "Error parsing", however it is valid D code because running it using rdmd --eval worked

@MartinNowak
Copy link
Collaborator

It doesn't support multi statement evaluation atm.
A REPL needs to perform some transformations to support declaring variables, thus we first need to classify the input into expression (returned from function), statement (evaluated in function), declaration (evaluated at module level). That parsing is done using libdparse and still has some gotchas atm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants