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
Conversation
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.
The pattern for the function declaration also matches the braces.
simpleast-core/src/main/java/com/discord/simpleast/code/JavaScript.kt
Outdated
Show resolved
Hide resolved
Fixed RegExp flags not being optional, a small issue that is.
simpleast-core/src/main/java/com/discord/simpleast/code/JavaScript.kt
Outdated
Show resolved
Hide resolved
simpleast-core/src/main/java/com/discord/simpleast/code/JavaScript.kt
Outdated
Show resolved
Hide resolved
simpleast-core/src/main/java/com/discord/simpleast/code/JavaScript.kt
Outdated
Show resolved
Hide resolved
simpleast-core/src/main/java/com/discord/simpleast/code/JavaScript.kt
Outdated
Show resolved
Hide resolved
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.
Fixed the function and the field patterns.
Requiring the function definition `pre` fixes some stuff.
Fixed the keywords test by removing some stuff.
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.
Done 👍 |
There was a problem hiding this 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)
simpleast-core/src/main/java/com/discord/simpleast/code/CodeRules.kt
Outdated
Show resolved
Hide resolved
simpleast-core/src/main/java/com/discord/simpleast/code/JavaScript.kt
Outdated
Show resolved
Hide resolved
simpleast-core/src/main/java/com/discord/simpleast/code/JavaScript.kt
Outdated
Show resolved
Hide resolved
simpleast-core/src/main/java/com/discord/simpleast/code/JavaScript.kt
Outdated
Show resolved
Hide resolved
simpleast-core/src/test/java/com/discord/simpleast/code/JavaScriptRuleTest.kt
Show resolved
Hide resolved
simpleast-core/src/test/java/com/discord/simpleast/code/JavaScriptRuleTest.kt
Show resolved
Hide resolved
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.
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.
👍 |
There was a problem hiding this 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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
plz merge. need this |
Sorry I assumed this was mergable, forgot that Travis is busted on latest API. |
Added JavaScript syntax highlighting, if any changes needs to be done let me know.