Skip to content

character set => move logic into parser #12

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

Merged
merged 7 commits into from
Jan 25, 2021
Merged

Conversation

ColinEberhardt
Copy link
Owner

No description provided.

export class CharacterSetMatcher extends Matcher {
constructor(public set: string, public negated: bool) {
constructor(public matchers: Matcher[], public negated: bool) {
Copy link
Owner Author

Choose a reason for hiding this comment

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

@MaxGraey - I've hit a funny error here, wondering if you might know the root cause?

  RuntimeError: unreachable
        at assembly/nfa/matcher/Matcher#matches@virtual (wasm-function[240]:1)
        at assembly/nfa/matcher/CharacterSetMatcher#matches~anonymous|0 (wasm-function[241]:19)
        at ~lib/array/Array<assembly/nfa/matcher/Matcher>#some (wasm-function[242]:85)
        at assembly/nfa/matcher/CharacterSetMatcher#matches (wasm-function[244]:21)
        at assembly/nfa/nfa/MatcherState<assembly/nfa/matcher/CharacterSetMatcher>#matches (wasm-function[245]:8)
        at assembly/nfa/nfa/State#matches@virtual (wasm-function[250]:58)
        at assembly/regexp/recursiveBacktrackingSearch (wasm-function[184]:121)
        at assembly/regexp/recursiveBacktrackingSearch@varargs (wasm-function[185]:56)
        at assembly/regexp/RegExp#exec (wasm-function[192]:307)

works just fine in TS/JS

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, hard to tell. Need minimal repro

Copy link
Contributor

@MaxGraey MaxGraey Jan 25, 2021

Choose a reason for hiding this comment

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

I tried reproduce this issue in minimal example but can't:
playground

Copy link
Owner Author

Choose a reason for hiding this comment

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

Unfortunately I think finding a minimal reproduction could be a challenge. I tried a similar approach, but couldn't reproduce.

What I have found is that adding the following block of code, executed before the RegExp is created, removes the error:

1592687#diff-f350832f4859b9724e3ef59f756d2d201226fd81fd797207367fc269581115adR171-R179

Copy link
Owner Author

Choose a reason for hiding this comment

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

I've raised an issue here AssemblyScript/assemblyscript#1635

@ColinEberhardt ColinEberhardt merged commit 4f48499 into main Jan 25, 2021
@github-actions
Copy link

github-actions bot commented Feb 4, 2021

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants