teknologi-umum / flourite

Automatically detects a programing language from a given string
MIT License
38 stars 13 forks source link

Optimize the usage of regular expressions #47

Open aldy505 opened 3 years ago

aldy505 commented 3 years ago

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

Take this as an example: https://github.com/teknologi-umum/flourite/blob/32bc6b7bbac2a2cc49fe42ac8412feec7f7500fc/src/languages/clojure.ts#L4-L7

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.

vijaykrishna536 commented 3 years ago

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

aldy505 commented 3 years ago

@vijaykrishna536 yes go ahead