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

floats aren't parsed correctly. #75

Closed
SeanTAllen opened this issue Dec 23, 2011 · 6 comments
Closed

floats aren't parsed correctly. #75

SeanTAllen opened this issue Dec 23, 2011 · 6 comments

Comments

@SeanTAllen
Copy link
Contributor

Sees

1.1 + 1 = 2.1.

as

1 + 1 = 2.

@brweber2
Copy link
Contributor

In the parser the definition of digits does not allow for non-integers?

DIGITS: ('+'|'-') ? ('0'..'9')+;

Some additional tests for things like 1 + 2.3 might be interesting, but I looked at all the usages of DIGITS and I don't see anywhere in the parser that allows for decimals at all. I'm pretty new to the parser however, so I could be missing something obvious...

@jamesladd
Copy link
Member

You are right. The grammars parsing of floats is not correct.
We had a version that was ok with floats but it got lost with one of the many re-writes.
I'll look for it.

@robdaemon
Copy link
Contributor

The decimal is what makes the floats tricky because the . is also the statement terminator. I tried fixing this once but I'm not very good with antlr.

@jamesladd
Copy link
Member

I kind of remember that a lex rule wont cut it and we need a parser rule.
Which can swallow up the period when the thing following a period is a
digit.

Guess Ill be reading that ANTLR book a.s.a.p

On Sat, Dec 24, 2011 at 3:40 PM, Robert Roland <
reply@reply.github.com

wrote:

The decimal is what makes the floats tricky because the . is also the
statement terminator. I tried fixing this once but I'm not very good with
antlr.


Reply to this email directly or view it on GitHub:

#75 (comment)

@SeanTAllen
Copy link
Contributor Author

Ditto.

I broke more than I fixed, I had floats working but I introduced lots of other issues.

I also need time to read the ANTLR book.

@SeanTAllen
Copy link
Contributor Author

fixed with new compiler.

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

4 participants