diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-01-17 20:30:59 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-01-17 20:30:59 -0800 |
| commit | 33665fe9935b0fb9d09f03d92e122e2c9be46508 (patch) | |
| tree | f0ba4d1ddef1acb4975d07539c35ad58e7cf161e /grammars/javascript.bp | |
| parent | 9736ace9a78bb954a8ca4e29696bb3c24489586d (diff) | |
Added Javscript and simplified python imports
Diffstat (limited to 'grammars/javascript.bp')
| -rw-r--r-- | grammars/javascript.bp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/grammars/javascript.bp b/grammars/javascript.bp new file mode 100644 index 0000000..49322c2 --- /dev/null +++ b/grammars/javascript.bp @@ -0,0 +1,24 @@ +# Syntax definition for some Javascript-specific patterns +# +# NOTE: this is *NOT* intended to be a complete definition of the language's +# syntax! Providing a full language grammar is overkill, because the intended +# use case is finding/replacing string patterns. This task does not require a +# full parse tree, and having one makes the task considerably more complicated. +# See the accompanying README.md for more info. + +comment: "//" .. $ / "/*" .. "*/" % \n +string: `"..`" % (`\.) / `'..`' % (`\.) / `/ .. `/ % (`\.) +keyword: |( + "abstract" / "arguments" / "await" / "boolean" / "break" / "byte" / "case" / + "catch" / "char" / "class" / "const" / "continue" / "debugger" / "default" / + "delete" / "do" / "double" / "else" / "enum" / "eval" / "export" / "extends" / + "false" / "final" / "finally" / "float" / "for" / "function" / "goto" / "if" / + "implements" / "import" / "in" / "instanceof" / "int" / "interface" / "let" / + "long" / "native" / "new" / "null" / "package" / "private" / "protected" / + "public" / "return" / "short" / "static" / "super" / "switch" / "synchronized" / + "this" / "throw" / "throws" / "transient" / "true" / "try" / "typeof" / "var" / + "void" / "volatile" / "while" / "with" / "yield" +)| +function-def: |"function"| __ [id__] parens / (id / parens) __ "=>" +function: function-def __ braces +import: |"import"| ..(`; / $) % braces |
