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

feat(code): Add syntax highlighting for JavaScript #27

Merged
merged 52 commits into from Mar 23, 2021
Merged

feat(code): Add syntax highlighting for JavaScript #27

merged 52 commits into from Mar 23, 2021

Conversation

VoltrexKeyva
Copy link
Contributor

Added JavaScript syntax highlighting, if any changes needs to be done let me know.

Added JavaScript syntax highlighting support.
Added JavaScript to the list of code rules.
Fixed a small mistake.
Added `Math` object.
Added tests for the JavaScript code rule.
Small change.
Added JavaScript codeblock sample (`$` escaped).
Added keywords:
1- `NaN`
2- `Infinity`
Now the function keyword doesn't need to be followed by a space.
Now the regex matches all JavaScript object properties.
Added missing patterns of RegExp of generics.
Added tests for the patterns of regex and generic.
Added missing constructors, objects and functions and optimized some patterns.
The `pre` matcher for function node is nullable, fixed and now it also matches generator functions.
Fixed a really small typo.
The pattern for the function declaration also matches the braces.
Fixed RegExp flags not being optional, a small issue that is.
Remove a `:`, renamed `DOT_MATCH_ALL` to `DOT_MATCHES_ALL`, changed declaration of `name` variable to `var` instead of `val` and as the logical NOT operator doesn't work in kotlin, used the comparison operator to check if the variable is null (`!name` → `name == null`).
Escaped template expressions inside raw strings using pair of template expressions, 5head.
Just a small fix for the sample.
Replace raw strings with regular strings.
Added back some of the raw strings.
Fixed some syntax errors caused by regular strings.
@VoltrexKeyva VoltrexKeyva marked this pull request as draft January 24, 2021 04:38
Fixed the function and the field patterns.
Requiring the function definition `pre` fixes some stuff.
Fixed the keywords test by removing some stuff.
@VoltrexKeyva VoltrexKeyva changed the title Add JavaScript syntax highlighting support feat(code): Add syntax highlighting for JavaScript Jan 26, 2021
Added the JavaScript codeblock to the codeblocks val, this is the last commit.
Previous commit was supposed to be the last commit, but as there was some missing built-ins, i decided to add them as well, now this is the last commit.
Oops, forgot these.
Removed non-existent keywords and added 2 missing built-ins.
Interfaces doesn't exist in JavaScript, they're in TypeScript.
Sneaky built-ins i've forgot to add.
@VoltrexKeyva
Copy link
Contributor Author

Done 👍

Copy link
Contributor

@lytefast lytefast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried my best, but my javascript is rusty (and TBH not 100% on the syntax, I learned a few things in this PR lol)

1- Reduced line columns to 100 or less.
2- Added more examples to the function node.
3- Renamed the internal method from `createJavaScriptRules()` to `createCodeRules()`.
Added core keywords of JavaScript to the sample.
Missed a comparison to the modulus value.
Removed the last extra line.
Use `createCodeRules()` instead of `createJavaScriptCodeRules()`.
Removed an extra line.
Added all forms of the function node regex to it's corresponding test and added tests for object property node.
Added the keyword `else` to the JavaScript sample for the sake of core keywords.
Now the variable, function and object property regex also matches the `$` in the variable name and now variable and function names can't start with a number as JavaScript doesn't allow that.
This should be all of the built-ins according to the global object of JavaScript itself.
Fixed all node regex patterns.
@VoltrexKeyva
Copy link
Contributor Author

👍

Copy link
Contributor

@lytefast lytefast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks for the PR!

Copy link

@CyberFlameGO CyberFlameGO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SynysterZV
Copy link

plz merge. need this

@lytefast lytefast merged commit 0d34682 into discord:master Mar 23, 2021
@lytefast
Copy link
Contributor

Sorry I assumed this was mergable, forgot that Travis is busted on latest API.

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

Successfully merging this pull request may close these issues.

None yet

6 participants