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

RegexToken broken with latest js backend #51

Closed
InfectedBytes opened this issue Apr 17, 2022 · 0 comments
Closed

RegexToken broken with latest js backend #51

InfectedBytes opened this issue Apr 17, 2022 · 0 comments

Comments

@InfectedBytes
Copy link
Contributor

Using the latest Kotlin version (1.60.20) better-parse doesn't work with js backend.
Using the example BooleanGrammar parsing always results in exception:

kotlin_com_github_h0tk3y_betterParse_better_parse.js?6388:1744 Uncaught TypeError: Cannot read properties of undefined (reading 'source')
    at preprocessRegex$outlinedJsCode$ (kotlin_com_github_h0tk3y_betterParse_better_parse.js?6388:1744:1)
    at preprocessRegex (kotlin_com_github_h0tk3y_betterParse_better_parse.js?6388:1691:1)
    at RegexToken_init_$Init$ (kotlin_com_github_h0tk3y_betterParse_better_parse.js?6388:1705:1)
    at RegexToken_init_$Create$ (kotlin_com_github_h0tk3y_betterParse_better_parse.js?6388:1709:1)
    at regexToken (kotlin_com_github_h0tk3y_betterParse_better_parse.js?6388:908:1)
    at regexToken$default (kotlin_com_github_h0tk3y_betterParse_better_parse.js?6388:913:1)
    at new BooleanGrammar (CharacterCompanion.js?f640:512:1)
    at BooleanGrammar_getInstance (CharacterCompanion.js?f640:683:1)

Problem is caused by the inline js code of preprocessRegex.
It tries to access _nativePattern/nativePattern_0 of Kotlin js Regex class, but they are undefined.
Changing it to nativePattern_1 solves the issue

InfectedBytes added a commit to InfectedBytes/better-parse that referenced this issue Apr 17, 2022
@h0tk3y h0tk3y closed this as completed in 1204f8a Apr 18, 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

No branches or pull requests

1 participant