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

Chevrotain error: Unable to use "first char" lexer optimizations #77

Closed
bankyadam opened this issue Aug 27, 2020 · 4 comments
Closed

Chevrotain error: Unable to use "first char" lexer optimizations #77

bankyadam opened this issue Aug 27, 2020 · 4 comments

Comments

@bankyadam
Copy link

	Failed parsing: < /('''|""")[\n\s\S]+\1|(?:((?<![\\])['"])((?:.(?!(?<![\\])\2))*.?)\2)/ >
	Using the regexp-to-ast library version: 0.5.0
	Please open an issue at: https://github.com/bd82/regexp-to-ast/issues

To help to understand the regexp, here are my test strings that this expression accepts:

"string"

"string with ' in it"

"string \"quoted\" inside"

'string'

'string with " in it'

'string \'quoted\' inside'

'''multi
line
string'''

'''can contain (') in it'''

'''can contain (") in it'''

"""can contain (") in it"""

"""can contain (') in it"""
@bd82
Copy link
Owner

bd82 commented Sep 5, 2020

Hello @bankyadam and thanks for reporting this.

I am currently investigating deprecating the regexp-to-ast package and replacing its usage in Chevrotain
with another regexp parser.

This means this issue will have a low priority as it may become redundant.

What this means for the Chevrotain Parser is that some performance optimizations will not take effect for your lexer. You may be able to work-around this by specifying additional metadata on your Token object.
See: https://sap.github.io/chevrotain/docs/guide/performance.html#ensuring-lexer-optimizations

@masukomi
Copy link

this is still a problem in 2024... :/

      	Failed parsing: < /((?<!\\)'''(.|\n)*?(?<!\\)''')|((?<!\\)"""(.|\n)*?(?<!\\)""")|((?<!\\)".*?(?<!\\)")|((?<!\\)'.*?(?<!\\)')/y >
      	Using the regexp-to-ast library version: 0.5.0
      	Please open an issue at: https://github.com/bd82/regexp-to-ast/issues

@bd82
Copy link
Owner

bd82 commented Jan 16, 2024

Hello @masukomi

This library was moved to https://github.com/Chevrotain/chevrotain/tree/master/packages/regexp-to-ast
This repo is no longer active...

The error message you are printing shows you are using an old version of Chevrotain.
You should try to reproduce the issue with the newest version of the library and/or chevrotain.
If it does reproduce you should then attempt to a minimal regexp pattern which causes the issue.
It likely indicates an unsupported reg-exp syntax feature...

@bd82 bd82 closed this as completed Jan 16, 2024
@bd82
Copy link
Owner

bd82 commented Jan 16, 2024

If the issue still reproduces open an issue at https://github.com/Chevrotain/chevrotain/issues

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

3 participants