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

Discussion: support Regular Expressions in lexers #225

Open
iahung3 opened this issue Mar 29, 2024 · 3 comments
Open

Discussion: support Regular Expressions in lexers #225

iahung3 opened this issue Mar 29, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@iahung3
Copy link

iahung3 commented Mar 29, 2024

You have agreed to add support for Regular Expressions in search in #147. This is about Regular Expressions in lexers. It's currently not supported. If support is added, the pros is Lite XL lexers could be ported more easily. The cons is lexers will become more complex.

@SpartanJ SpartanJ self-assigned this Mar 29, 2024
@SpartanJ SpartanJ added the enhancement New feature or request label Mar 29, 2024
@SpartanJ
Copy link
Owner

Yes, this is going to be implemented too and it will support the Lite-XL language definitions.

@iahung3
Copy link
Author

iahung3 commented Apr 3, 2024

Yes, this is going to be implemented too and it will support the Lite-XL language definitions.

I found most Lite XL lexers don't use regex. Are there performance issues with regex in lexers? If there are, I don't think it's the fault of regex. It's the poor quality of the syntax highlighting engine. It could be regex caused the lexers to be too complex, so they avoided it intentionally.

@SpartanJ
Copy link
Owner

SpartanJ commented Apr 3, 2024

 I found most Lite XL lexers don't use regex. Are there performance issues with regex in lexers?

They usually are slower and much slower, but they give you some flexibility, so it's something that you'll try to avoid unless there's no other alternative. That's why I skipped regex to begin with, I found I thinks only 2 o 3 languages using them and it was easy to replace the regex in favor of lua patterns for those cases.

 If there are, I don't think it's the fault of regex. It's the poor quality of the syntax highlighting engine. It could be regex caused the lexers to be too complex, so they avoided it intentionally.

It will be a mixture, if you have a lexer based on pattern-matching, the regex engine performance is the most important aspect affecting the final performance. The quality and complexity of the particular pattern will be also important, but it's really hard to measure the performance of each pattern, and each regex engine has each own strong and cons with different kinds of patterns. In order to be able to develop fast patterns you'll need to know very well your regex engine. Anyway, this applies for the lua patterns too, complexity of the pattern affects the highlighting performance. Currently highlighting is REALLY fast on ecode and I plan to keep it that way, that's why I try to be very conscious about any change on the highlighter.

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

No branches or pull requests

2 participants