-
Notifications
You must be signed in to change notification settings - Fork 32
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
Cannot register unit #51
Comments
Debugging I get this error: |
I have reason to believe this is the rule giving issues:
This is proven by the fact that if I change the parslet root to be |
I think it might be an issue with parslet |
This is was I found: Consider that the following rule is not a leaf of the parsing tree so if I pick wrong i'm done, considered the OR "|" sign: for details kschiess/parslet#181):
atom can match any measurement_unit (atoms) - OR - a prefix and any metric measurement unit. atoms right now are:
prefix are:
This is the outcome: mma: is an atom, match ok this is because the rule matches the first "m" of "mm" as it was an atom (meter), not a prefix (milli) and since it cannot come back it throw me exception later on. I tried also to flip the 2 parts of the rule as follows:
it this case: m: since it has no prefix, go to second part of the rule and matches |
Solved by doing the following:
Let me know what you think! |
Hmm, I see. Thanks for investigating. This sounds like the same issue described in #26. Do all the tests pass with your proposed solution? My guess is that the |
The 2 methods absent and present are not consuming. Sent from my Motorola XT1585 using FastHub |
Ok, cool. I think this would be good to bring in. Can you open a PR with these changes, but make sure that the |
Sure absolutely. I'm glad you find the fix worth it. Sent from my Motorola XT1585 using FastHub |
I'm trying to register a unit called 'mma'.
Once i do:
I get:
=> #<Unitwise::Atom names=["xxx"], primary_code="mma", secondary_code="MMA", symbol="XXX", scale=#<Unitwise::Scale value=1 unit=m>, classification=nil, property="xxx", metric=false, special=false, arbitrary=false, dim="L">
but when I do this:
I get:
Unitwise::ExpressionError: Could not evaluate 'mma'.
Same thing by using the secondary_code:
Unitwise::ExpressionError: Could not evaluate 'MMA'.
The text was updated successfully, but these errors were encountered: