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

Fix problem with decimals with no leading 0 (#525) #526

Merged
merged 2 commits into from
Feb 16, 2021

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Feb 16, 2021

This PR adds a patternPrecedence property to context items that allows individual tokens to be prioritized in the pattern list. It then uses that to put the . operator pattern after the number pattern, so that decimal numbers with no leading zero will be identified first, and then if . is not used as a decimal, it will be recognized as a dot product.

Without the patch, Compute(".123") produces an error about a missing operand for . but with the patch, it should produce .123 as expected. Also

Context("Vector");
TEXT(Compute("<1,2> . <3,4>"));

should produce an output of 11.

Resolves issue #525.

dpvc added 2 commits February 16, 2021 13:59
…ual tokens to be prioritized in the pattern list, and use that to put the dot product pattern after the number pattern. Resolves issue openwebwork#525.
Copy link
Member

@drgrice1 drgrice1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the problem
Thanks.

@mgage mgage merged commit 1ed89f8 into openwebwork:develop Feb 16, 2021
@dpvc dpvc deleted the fix-decimal branch April 19, 2021 14:19
drgrice1 added a commit to drgrice1/pg that referenced this pull request Jun 1, 2023
The only thing the override did was call the `update` method to force
patterns to be updated.  This is no longer needed since uddate is now
always called by the SUPER method when tokens are added.  This was
changed in openwebwork#518 and openwebwork#526.
drgrice1 added a commit to drgrice1/pg that referenced this pull request Jun 7, 2023
The only thing the override did was call the `update` method to force
patterns to be updated.  This is no longer needed since uddate is now
always called by the SUPER method when tokens are added.  This was
changed in openwebwork#518 and openwebwork#526.
drgrice1 added a commit to drgrice1/pg that referenced this pull request Jun 8, 2023
The only thing the override did was call the `update` method to force
patterns to be updated.  This is no longer needed since uddate is now
always called by the SUPER method when tokens are added.  This was
changed in openwebwork#518 and openwebwork#526.
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

Successfully merging this pull request may close these issues.

3 participants