From 61a0d17de8fc012d71a2ec4a3b1143da44a26366 Mon Sep 17 00:00:00 2001 From: Jesse Portnoy Date: Wed, 2 Aug 2023 18:41:03 +0100 Subject: [PATCH] - Add synlinks from sh->bash and js(x)->javascript - Improve JS lexer --- syntax_files/bash.yaml | 1 + syntax_files/dpkg.yaml | 2 +- syntax_files/javascript.yaml | 7 +++++-- syntax_files/js.yaml | 1 + syntax_files/jsx.yaml | 1 + 5 files changed, 9 insertions(+), 3 deletions(-) create mode 120000 syntax_files/bash.yaml create mode 120000 syntax_files/js.yaml create mode 120000 syntax_files/jsx.yaml diff --git a/syntax_files/bash.yaml b/syntax_files/bash.yaml new file mode 120000 index 0000000..3bc4250 --- /dev/null +++ b/syntax_files/bash.yaml @@ -0,0 +1 @@ +sh.yaml \ No newline at end of file diff --git a/syntax_files/dpkg.yaml b/syntax_files/dpkg.yaml index 1c2acbb..3a0f6dd 100644 --- a/syntax_files/dpkg.yaml +++ b/syntax_files/dpkg.yaml @@ -2,7 +2,7 @@ filetype: dpkg detect: filename: "\\.dpkg$" - header: "(^[Desired=|+].*)" + header: "(^(Desired=).*)" rules: - constant.number: "(^[D|+].*)" diff --git a/syntax_files/javascript.yaml b/syntax_files/javascript.yaml index 5a3fee2..0072ce2 100644 --- a/syntax_files/javascript.yaml +++ b/syntax_files/javascript.yaml @@ -2,19 +2,22 @@ filetype: javascript detect: filename: "\\.js$" + header: "^(import|require|const|)" + - type: "(<(/)?[a-zA-Z:]+[[:space:]]+)" - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b" - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?" - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?" - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]" - statement: "\\b(break|case|catch|continue|default|delete|do|else|finally)\\b" - statement: "\\b(for|function|get|if|in|instanceof|new|return|set|switch)\\b" - - statement: "\\b(switch|this|throw|try|typeof|var|void|while|with)\\b" + - statement: "\\b(switch|this|throw|try|typeof|var|void|while|with|const|let)\\b" - constant: "\\b(null|undefined|NaN)\\b" - constant: "\\b(true|false)\\b" - type: "\\b(Array|Boolean|Date|Enumerator|Error|Function|Math)\\b" - - type: "\\b(Number|Object|RegExp|String)\\b" + - type: "\\b(Number|Object|RegExp|String|require|import)\\b" - statement: "[-+/*=<>!~%?:&|]" - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*" - constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]" diff --git a/syntax_files/js.yaml b/syntax_files/js.yaml new file mode 120000 index 0000000..dabee93 --- /dev/null +++ b/syntax_files/js.yaml @@ -0,0 +1 @@ +javascript.yaml \ No newline at end of file diff --git a/syntax_files/jsx.yaml b/syntax_files/jsx.yaml new file mode 120000 index 0000000..dabee93 --- /dev/null +++ b/syntax_files/jsx.yaml @@ -0,0 +1 @@ +javascript.yaml \ No newline at end of file