-
Notifications
You must be signed in to change notification settings - Fork 78
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
Built-in NUMBER can't return INT type #97
Comments
Thank you for your analysis! The problem is/was, that a FLOAT also pares an INT. With the parser we employ we have an issue here. We discussed the problem and introduced a STRICTFLOAT (which does not match an INT) as workaround. A number is now an INT or a STRICTFLOAT. The original FLOAT rule remains unchanged (but is not a NUMBER any more). We adapted the docu to make the changes clear. (Details: see #98) With the current master your test works (a unittest was added: https://github.com/igordejanovic/textX/blob/master/tests/functional/regressions/test_issue97.py). Does this change solve your problem sketched above? |
That's awesome, guys! I could close this issue, but current state of docs is confusing for me. And there are two images that should be updated to keep everything in sync: |
Thank you for your in-depth review! This really helps getting the things right. Maybe you could have a look at #100 to see if the changes described there are clear to you. I greatly appreciate any further hints... |
Everything is working now, thanks guys! |
Textx version:
Python version:
Minimal example:
Expected results:
Actual Results:
Problem:
As example shows,
NUMBER
built-in rule returns alwaysfloat
value. AsNUMBER
built-in rule is not documented, and not discouraged in source code, there is not obstacle to use it.It matches
FLOAT
first, thenINT
as it's definition stands.Any proper
INT
can be parsed as correctFLOAT
number, so by usingNUMBER
withFLOAT | INT
order, we end up withFLOAT
result, which is not expected.Proper order and mention in docs about
NUMBER
would be nice.The text was updated successfully, but these errors were encountered: