-
Notifications
You must be signed in to change notification settings - Fork 65
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
Problems getting Grammar to Parse input from file #146
Comments
My guess is it cant find :eoi on LastLine rule and thus never ends, but why is this? And how do I fix it? |
Right now, it seems that it finds an empty line at the very end. Your input I guess that readText or File.byLine consumes the end of file char? Could Or maybe your editor automatically add an end of line char for the very |
Im using Vim, so I dont think it's appending anything weird. Adding the '\n' char didnt work, but got me thinking to look at the raw bytes of the input.
That extra '10' on the end is a Line Feed char, if I cut this char off, it works, so this issue can close I guess. Might be good to document however? I'm sure it's been found out before... Thanks! |
I'm not following the D forums, due to lack of time, but did you ask on |
Good idea, will ask now. Would be good to find out why it is doing it and if theres a way of making it not do it. The documentation doesn't point to anything obvious. Thread here: |
Hmm, and I see that Vim adds a newline at the end of a file. What if you just use:
Does that work? (Sorry, I don't have access to a D compiler right now, else I'd test it myself) |
Sorry, only getting to this now. Yeah, it does indeed. |
You're welcome! |
My grammar will parse from a string defined inside D, however if I try to read the string in from a file, it falls over.
My Grammar is this:
And the D code that works is:
However, if I read the exact same string from a file using readText (or File.byLine), it dies with the error message:
Any ideas what I'm doing wrong?
The text was updated successfully, but these errors were encountered: