discord / SimpleAST

Extensible Android library for both parsing text into Abstract Syntax Trees and rendering those trees as rich text.
Other
371 stars 32 forks source link

code: fix JavaScript rules #34

Closed VoltrexKeyva closed 3 years ago

VoltrexKeyva commented 3 years ago

• Made a few improvements to the pattern rules. • Removed unused DOTALL additions. • Made it so you can escape specific characters in the regex and generic rule patterns so they don't screw up the highlighting, such as escaping a backslash (\) in the regex declaration. • Empty regexes is not highlighted any longer since they're invalid. • Now the regex rule pattern only accepts the d, g, i, m, s, u and y flags. • The function pattern rule now should match function declarations without a keyword prefix. • Implemented a new pattern rule node that matches arrow functions. • Renamed the JavaScript test file from JavaScriptRuleTest to JavaScriptRulesTest for consistency, fixed function rule node tests and added tests for the arrow function rule node.