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

Optimize the usage of regular expressions #47

Open
aldy505 opened this issue Oct 5, 2021 · 2 comments
Open

Optimize the usage of regular expressions #47

aldy505 opened this issue Oct 5, 2021 · 2 comments
Labels
difficulty: easy enhancement New feature or request

Comments

@aldy505
Copy link
Member

aldy505 commented Oct 5, 2021

Some regular expressions that are currently on the /src/language directory are somewhat inefficient.

Take this as an example:

{ pattern: /^(\s+)?\(ns(\s+)(.*)(\))?$/, type: 'meta.module' },
{ pattern: /^(\s+)?\(print(ln)?(\s+)(.*)(\))$/, type: 'keyword.print' },
{ pattern: /^(\s+)?\((de)?fn(-)?(\s+)(.*)(\))?$/, type: 'keyword.function' },
{ pattern: /^(\s+)?\((let|def)(\s+)(.*)(\))?$/, type: 'keyword.variable' },

That pattern might be optimized to /^\s*\(ns(\s+)(.*)(\))?$/ to minimize the steps needed to achieve the same result.

I believe there are more patterns like that, that can be optimized.

@aldy505 aldy505 added enhancement New feature or request good first issue Good for newcomers hacktoberfest labels Oct 5, 2021
@vijaykrishna536
Copy link

Hi @aldy505
Would love to take the opportunity to work on this
Thank you

@aldy505
Copy link
Member Author

aldy505 commented Nov 1, 2021

@vijaykrishna536 yes go ahead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: easy enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

2 participants