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 #197 by only lexing numeric literals in multiplicity expressions. #202

Merged
merged 1 commit into from
Jan 23, 2022

Conversation

andreasabel
Copy link
Member

Fix #197 by only lexing numeric literals in multiplicity expressions.

In issue #141, multiplicity annotations in regexes where extended to the general, multi-digit case {nnn,mmm}. However, lexing numeric literals broke parsing of regexes like:

   32|64
   [01-89]

The solution here is to only lex numeric literals in a special lexerstate called multiplicity which is entered by the parser when parsing multiplicity braces {nnn,mmm}.

This restores alex' handling of digits as characters in the non-multiplicity situations.

@andreasabel
Copy link
Member Author

Why is the new testcase failing with error make: *** No rule to make target 'issue_197.n.run', needed by 'all'. ? https://github.com/simonmar/alex/runs/4914643015?check_suite_focus=true#step:22:122

@andreasabel
Copy link
Member Author

@Ericson2314 , could you please review this solution attempt?

Copy link
Collaborator

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

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

Code/idea looks good, any idea for CI failures?

@andreasabel
Copy link
Member Author

andreasabel commented Jan 23, 2022

... any idea for CI failures?

I am clueless. It also happened on your PR #200: https://github.com/simonmar/alex/runs/4911840593?check_suite_focus=true#step:22:132

Locally, on my machine, it works fine.

If I locally delete tests/issue_197.x. I get the same errors as the CI. So, it is almost as if this file is not present when CI is run. How is that possible? It is clearly included in the commit.

@Ericson2314
Copy link
Collaborator

Ericson2314 commented Jan 23, 2022

I am having even finding the error in the CI log, you might be ahead of me there?

@andreasabel
Copy link
Member Author

I am having even finding the error in the CI log, you might be ahead of me there?

Does clicking the links I pasted not work?

@Ericson2314
Copy link
Collaborator

Ericson2314 commented Jan 23, 2022

OK sorry that does work, and while Control-F does poorly, github's log search for 197 works too so I can find it in both PRs. All good now.

@Ericson2314
Copy link
Collaborator

I found the bug: test file needs to be listed in cabal file to go in sdist. Will push fix in a second.

…ssions.

In issue haskell#141, multiplicity annotations in regexes where extended to
the general, multi-digit case {nnn,mmm}.  However, lexing numeric
literals broke parsing of regexes like:

   32|64
   [01-89]

The solution here is to only lex numeric literals in a special lexer
state called `multiplicity` which is entered by the parser when
parsing multiplicity braces {nnn,mmm}.

This restores alex' handling of digits as characters in the
non-multiplicity situations.
@Ericson2314 Ericson2314 force-pushed the fixing-197-lexer-states branch from ad70394 to 0007350 Compare January 23, 2022 22:44
Copy link
Member Author

@andreasabel andreasabel left a comment

Choose a reason for hiding this comment

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

Something we miss in alex's testsuite is failing tests, like .x files that should not parse. I am thinking of a variant of #141 a{1 3} that we would almost have accepted.

@@ -97,6 +97,7 @@ extra-source-files:
tests/issue_71.x
tests/issue_119.x
tests/issue_141.x
tests/issue_197.x
Copy link
Member Author

Choose a reason for hiding this comment

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

Excellent! Would not have thought of this!

@Ericson2314 Ericson2314 merged commit e907ecb into haskell:master Jan 23, 2022
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.

alex 3.2.7 fails to parse definitions which can pass alex 3.2.6
2 participants