From 7feefff1daafdab3d23a5a52606af224b9698cf0 Mon Sep 17 00:00:00 2001 From: Adelino Ngomacha Date: Tue, 28 Oct 2025 13:28:52 +0200 Subject: [PATCH 1/2] chore: fix lint issues --- .../src/grammars/bash.ts | 80 +++---- .../ts-syntax-highlighter/src/grammars/bnf.ts | 2 +- .../ts-syntax-highlighter/src/grammars/c.ts | 86 ++++---- .../ts-syntax-highlighter/src/grammars/cmd.ts | 14 +- .../ts-syntax-highlighter/src/grammars/cpp.ts | 154 +++++++------- .../src/grammars/csharp.ts | 186 ++++++++-------- .../src/grammars/dart.ts | 48 ++++- .../src/grammars/diff.ts | 18 +- .../src/grammars/dockerfile.ts | 42 ++-- .../ts-syntax-highlighter/src/grammars/go.ts | 132 ++++++------ .../src/grammars/graphql.ts | 23 +- .../ts-syntax-highlighter/src/grammars/idl.ts | 48 ++--- .../src/grammars/index.ts | 6 +- .../src/grammars/java.ts | 4 +- .../src/grammars/json5.ts | 14 +- .../src/grammars/jsonc.ts | 6 +- .../src/grammars/kotlin.ts | 56 +++-- .../src/grammars/latex.ts | 2 +- .../ts-syntax-highlighter/src/grammars/log.ts | 2 +- .../ts-syntax-highlighter/src/grammars/lua.ts | 29 ++- .../src/grammars/makefile.ts | 12 +- .../src/grammars/markdown.ts | 52 ++--- .../src/grammars/nginx.ts | 2 +- .../ts-syntax-highlighter/src/grammars/php.ts | 26 +-- .../src/grammars/powershell.ts | 36 +++- .../src/grammars/protobuf.ts | 18 +- .../src/grammars/python.ts | 100 ++++----- .../ts-syntax-highlighter/src/grammars/r.ts | 22 +- .../src/grammars/regexp.ts | 6 +- .../src/grammars/ruby.ts | 6 +- .../src/grammars/rust.ts | 118 +++++------ .../src/grammars/scss.ts | 12 +- .../src/grammars/solidity.ts | 36 +++- .../ts-syntax-highlighter/src/grammars/sql.ts | 198 +++++++++--------- .../src/grammars/swift.ts | 46 +++- .../src/grammars/terraform.ts | 20 +- .../src/grammars/toml.ts | 8 +- .../ts-syntax-highlighter/src/grammars/xml.ts | 4 +- .../src/grammars/yaml.ts | 54 ++--- .../ts-syntax-highlighter/src/tokenizer.ts | 6 +- .../ts-syntax-highlighter/test/abnf.test.ts | 3 +- .../ts-syntax-highlighter/test/bash.test.ts | 4 +- .../ts-syntax-highlighter/test/bnf.test.ts | 3 +- packages/ts-syntax-highlighter/test/c.test.ts | 4 +- .../ts-syntax-highlighter/test/cmd.test.ts | 4 +- .../ts-syntax-highlighter/test/cpp.test.ts | 4 +- .../ts-syntax-highlighter/test/csharp.test.ts | 4 +- .../ts-syntax-highlighter/test/csv.test.ts | 3 +- .../ts-syntax-highlighter/test/dart.test.ts | 3 +- .../ts-syntax-highlighter/test/diff.test.ts | 4 +- .../test/dockerfile.test.ts | 4 +- .../ts-syntax-highlighter/test/go.test.ts | 4 +- .../test/graphql.test.ts | 3 +- .../ts-syntax-highlighter/test/idl.test.ts | 4 +- .../ts-syntax-highlighter/test/java.test.ts | 4 +- .../ts-syntax-highlighter/test/json5.test.ts | 4 +- .../ts-syntax-highlighter/test/jsonc.test.ts | 4 +- .../ts-syntax-highlighter/test/kotlin.test.ts | 4 +- .../ts-syntax-highlighter/test/latex.test.ts | 4 +- .../ts-syntax-highlighter/test/log.test.ts | 3 +- .../ts-syntax-highlighter/test/lua.test.ts | 3 +- .../test/makefile.test.ts | 3 +- .../test/markdown.test.ts | 4 +- .../ts-syntax-highlighter/test/nginx.test.ts | 3 +- .../ts-syntax-highlighter/test/php.test.ts | 4 +- .../test/powershell.test.ts | 4 +- .../test/protobuf.test.ts | 3 +- .../ts-syntax-highlighter/test/python.test.ts | 4 +- packages/ts-syntax-highlighter/test/r.test.ts | 3 +- .../ts-syntax-highlighter/test/regexp.test.ts | 3 +- .../ts-syntax-highlighter/test/ruby.test.ts | 4 +- .../ts-syntax-highlighter/test/rust.test.ts | 4 +- .../ts-syntax-highlighter/test/scss.test.ts | 4 +- .../test/solidity.test.ts | 3 +- .../ts-syntax-highlighter/test/sql.test.ts | 4 +- .../ts-syntax-highlighter/test/swift.test.ts | 3 +- .../test/terraform.test.ts | 3 +- .../ts-syntax-highlighter/test/text.test.ts | 3 +- .../ts-syntax-highlighter/test/toml.test.ts | 4 +- .../ts-syntax-highlighter/test/vue.test.ts | 3 +- .../ts-syntax-highlighter/test/xml.test.ts | 4 +- .../ts-syntax-highlighter/test/yaml.test.ts | 4 +- 82 files changed, 1030 insertions(+), 855 deletions(-) diff --git a/packages/ts-syntax-highlighter/src/grammars/bash.ts b/packages/ts-syntax-highlighter/src/grammars/bash.ts index cf7479f..38373ec 100644 --- a/packages/ts-syntax-highlighter/src/grammars/bash.ts +++ b/packages/ts-syntax-highlighter/src/grammars/bash.ts @@ -5,47 +5,47 @@ export const bashGrammar: Grammar = { scopeName: 'source.bash', keywords: { // Control flow - 'if': 'keyword.control.bash', - 'then': 'keyword.control.bash', - 'else': 'keyword.control.bash', - 'elif': 'keyword.control.bash', - 'fi': 'keyword.control.bash', - 'case': 'keyword.control.bash', - 'esac': 'keyword.control.bash', - 'for': 'keyword.control.bash', - 'while': 'keyword.control.bash', - 'until': 'keyword.control.bash', - 'do': 'keyword.control.bash', - 'done': 'keyword.control.bash', - 'in': 'keyword.control.bash', - 'select': 'keyword.control.bash', + if: 'keyword.control.bash', + then: 'keyword.control.bash', + else: 'keyword.control.bash', + elif: 'keyword.control.bash', + fi: 'keyword.control.bash', + case: 'keyword.control.bash', + esac: 'keyword.control.bash', + for: 'keyword.control.bash', + while: 'keyword.control.bash', + until: 'keyword.control.bash', + do: 'keyword.control.bash', + done: 'keyword.control.bash', + in: 'keyword.control.bash', + select: 'keyword.control.bash', // Keywords - 'function': 'storage.type.function.bash', - 'declare': 'storage.type.bash', - 'local': 'storage.type.bash', - 'export': 'storage.type.bash', - 'readonly': 'storage.type.bash', - 'typeset': 'storage.type.bash', + function: 'storage.type.function.bash', + declare: 'storage.type.bash', + local: 'storage.type.bash', + export: 'storage.type.bash', + readonly: 'storage.type.bash', + typeset: 'storage.type.bash', // Built-in commands - 'echo': 'support.function.builtin.bash', - 'printf': 'support.function.builtin.bash', - 'read': 'support.function.builtin.bash', - 'cd': 'support.function.builtin.bash', - 'pwd': 'support.function.builtin.bash', - 'exit': 'support.function.builtin.bash', - 'return': 'support.function.builtin.bash', - 'source': 'support.function.builtin.bash', - 'test': 'support.function.builtin.bash', - 'eval': 'support.function.builtin.bash', - 'exec': 'support.function.builtin.bash', - 'shift': 'support.function.builtin.bash', - 'set': 'support.function.builtin.bash', - 'unset': 'support.function.builtin.bash', - 'alias': 'support.function.builtin.bash', - 'unalias': 'support.function.builtin.bash', + echo: 'support.function.builtin.bash', + printf: 'support.function.builtin.bash', + read: 'support.function.builtin.bash', + cd: 'support.function.builtin.bash', + pwd: 'support.function.builtin.bash', + exit: 'support.function.builtin.bash', + return: 'support.function.builtin.bash', + source: 'support.function.builtin.bash', + test: 'support.function.builtin.bash', + eval: 'support.function.builtin.bash', + exec: 'support.function.builtin.bash', + shift: 'support.function.builtin.bash', + set: 'support.function.builtin.bash', + unset: 'support.function.builtin.bash', + alias: 'support.function.builtin.bash', + unalias: 'support.function.builtin.bash', // Constants - 'true': 'constant.language.bash', - 'false': 'constant.language.bash', + true: 'constant.language.bash', + false: 'constant.language.bash', }, patterns: [ { include: '#strings' }, @@ -91,8 +91,8 @@ export const bashGrammar: Grammar = { }, { name: 'string.quoted.single.bash', - begin: "'", - end: "'", + begin: '\'', + end: '\'', }, { name: 'string.unquoted.heredoc.bash', diff --git a/packages/ts-syntax-highlighter/src/grammars/bnf.ts b/packages/ts-syntax-highlighter/src/grammars/bnf.ts index 8049af7..da55233 100644 --- a/packages/ts-syntax-highlighter/src/grammars/bnf.ts +++ b/packages/ts-syntax-highlighter/src/grammars/bnf.ts @@ -8,6 +8,6 @@ export const bnfGrammar: Grammar = { repository: { rules: { patterns: [{ name: 'keyword.operator.bnf', match: '::=' }] }, nonterminals: { patterns: [{ name: 'entity.name.type.bnf', match: '<[^>]+>' }] }, - terminals: { patterns: [{ name: 'string.quoted.double.bnf', begin: '"', end: '"' }, { name: 'string.quoted.single.bnf', begin: "'", end: "'" }] }, + terminals: { patterns: [{ name: 'string.quoted.double.bnf', begin: '"', end: '"' }, { name: 'string.quoted.single.bnf', begin: '\'', end: '\'' }] }, }, } diff --git a/packages/ts-syntax-highlighter/src/grammars/c.ts b/packages/ts-syntax-highlighter/src/grammars/c.ts index 65d294b..1d93b21 100644 --- a/packages/ts-syntax-highlighter/src/grammars/c.ts +++ b/packages/ts-syntax-highlighter/src/grammars/c.ts @@ -5,47 +5,47 @@ export const cGrammar: Grammar = { scopeName: 'source.c', keywords: { // Control flow - 'if': 'keyword.control.c', - 'else': 'keyword.control.c', - 'for': 'keyword.control.c', - 'while': 'keyword.control.c', - 'do': 'keyword.control.c', - 'switch': 'keyword.control.c', - 'case': 'keyword.control.c', - 'default': 'keyword.control.c', - 'break': 'keyword.control.c', - 'continue': 'keyword.control.c', - 'return': 'keyword.control.c', - 'goto': 'keyword.control.c', + if: 'keyword.control.c', + else: 'keyword.control.c', + for: 'keyword.control.c', + while: 'keyword.control.c', + do: 'keyword.control.c', + switch: 'keyword.control.c', + case: 'keyword.control.c', + default: 'keyword.control.c', + break: 'keyword.control.c', + continue: 'keyword.control.c', + return: 'keyword.control.c', + goto: 'keyword.control.c', // Types - 'void': 'storage.type.c', - 'char': 'storage.type.c', - 'short': 'storage.type.c', - 'int': 'storage.type.c', - 'long': 'storage.type.c', - 'float': 'storage.type.c', - 'double': 'storage.type.c', - 'signed': 'storage.type.c', - 'unsigned': 'storage.type.c', - 'struct': 'storage.type.c', - 'union': 'storage.type.c', - 'enum': 'storage.type.c', - 'typedef': 'storage.type.c', + void: 'storage.type.c', + char: 'storage.type.c', + short: 'storage.type.c', + int: 'storage.type.c', + long: 'storage.type.c', + float: 'storage.type.c', + double: 'storage.type.c', + signed: 'storage.type.c', + unsigned: 'storage.type.c', + struct: 'storage.type.c', + union: 'storage.type.c', + enum: 'storage.type.c', + typedef: 'storage.type.c', // Modifiers - 'const': 'storage.modifier.c', - 'static': 'storage.modifier.c', - 'extern': 'storage.modifier.c', - 'register': 'storage.modifier.c', - 'volatile': 'storage.modifier.c', - 'inline': 'storage.modifier.c', - 'restrict': 'storage.modifier.c', - '_Atomic': 'storage.modifier.c', + const: 'storage.modifier.c', + static: 'storage.modifier.c', + extern: 'storage.modifier.c', + register: 'storage.modifier.c', + volatile: 'storage.modifier.c', + inline: 'storage.modifier.c', + restrict: 'storage.modifier.c', + _Atomic: 'storage.modifier.c', // Operators - 'sizeof': 'keyword.operator.sizeof.c', + sizeof: 'keyword.operator.sizeof.c', // Standard library types - 'size_t': 'support.type.c', - 'FILE': 'support.type.c', - 'NULL': 'constant.language.c', + size_t: 'support.type.c', + FILE: 'support.type.c', + NULL: 'constant.language.c', }, patterns: [ { include: '#preprocessor' }, @@ -63,22 +63,22 @@ export const cGrammar: Grammar = { name: 'meta.preprocessor.include.c', match: '^\\s*#\\s*include\\s+(<[^>]+>|"[^"]+")', captures: { - '1': { name: 'string.quoted.other.lt-gt.include.c' }, + 1: { name: 'string.quoted.other.lt-gt.include.c' }, }, }, { name: 'meta.preprocessor.macro.c', match: '^\\s*#\\s*(define|undef)\\s+([a-zA-Z_][a-zA-Z0-9_]*)', captures: { - '1': { name: 'keyword.control.directive.c' }, - '2': { name: 'entity.name.function.preprocessor.c' }, + 1: { name: 'keyword.control.directive.c' }, + 2: { name: 'entity.name.function.preprocessor.c' }, }, }, { name: 'meta.preprocessor.c', match: '^\\s*#\\s*(if|ifdef|ifndef|elif|else|endif|pragma|error|warning|line)\\b', captures: { - '1': { name: 'keyword.control.directive.c' }, + 1: { name: 'keyword.control.directive.c' }, }, }, ], @@ -111,8 +111,8 @@ export const cGrammar: Grammar = { }, { name: 'string.quoted.single.c', - begin: "'", - end: "'", + begin: '\'', + end: '\'', patterns: [ { name: 'constant.character.escape.c', diff --git a/packages/ts-syntax-highlighter/src/grammars/cmd.ts b/packages/ts-syntax-highlighter/src/grammars/cmd.ts index 4db5de2..04d10a7 100644 --- a/packages/ts-syntax-highlighter/src/grammars/cmd.ts +++ b/packages/ts-syntax-highlighter/src/grammars/cmd.ts @@ -4,9 +4,17 @@ export const cmdGrammar: Grammar = { name: 'Batch', scopeName: 'source.cmd', keywords: { - 'if': 'keyword.control.cmd', 'else': 'keyword.control.cmd', 'for': 'keyword.control.cmd', 'do': 'keyword.control.cmd', - 'goto': 'keyword.control.cmd', 'call': 'keyword.control.cmd', 'exit': 'keyword.control.cmd', 'echo': 'support.function.cmd', - 'set': 'support.function.cmd', 'setlocal': 'support.function.cmd', 'endlocal': 'support.function.cmd', + if: 'keyword.control.cmd', + else: 'keyword.control.cmd', + for: 'keyword.control.cmd', + do: 'keyword.control.cmd', + goto: 'keyword.control.cmd', + call: 'keyword.control.cmd', + exit: 'keyword.control.cmd', + echo: 'support.function.cmd', + set: 'support.function.cmd', + setlocal: 'support.function.cmd', + endlocal: 'support.function.cmd', }, patterns: [{ include: '#comments' }, { include: '#variables' }, { include: '#labels' }, { include: '#keywords' }], repository: { diff --git a/packages/ts-syntax-highlighter/src/grammars/cpp.ts b/packages/ts-syntax-highlighter/src/grammars/cpp.ts index f97f583..9783675 100644 --- a/packages/ts-syntax-highlighter/src/grammars/cpp.ts +++ b/packages/ts-syntax-highlighter/src/grammars/cpp.ts @@ -5,82 +5,82 @@ export const cppGrammar: Grammar = { scopeName: 'source.cpp', keywords: { // Control flow - 'if': 'keyword.control.cpp', - 'else': 'keyword.control.cpp', - 'for': 'keyword.control.cpp', - 'while': 'keyword.control.cpp', - 'do': 'keyword.control.cpp', - 'switch': 'keyword.control.cpp', - 'case': 'keyword.control.cpp', - 'default': 'keyword.control.cpp', - 'break': 'keyword.control.cpp', - 'continue': 'keyword.control.cpp', - 'return': 'keyword.control.cpp', - 'goto': 'keyword.control.cpp', - 'try': 'keyword.control.cpp', - 'catch': 'keyword.control.cpp', - 'throw': 'keyword.control.cpp', + if: 'keyword.control.cpp', + else: 'keyword.control.cpp', + for: 'keyword.control.cpp', + while: 'keyword.control.cpp', + do: 'keyword.control.cpp', + switch: 'keyword.control.cpp', + case: 'keyword.control.cpp', + default: 'keyword.control.cpp', + break: 'keyword.control.cpp', + continue: 'keyword.control.cpp', + return: 'keyword.control.cpp', + goto: 'keyword.control.cpp', + try: 'keyword.control.cpp', + catch: 'keyword.control.cpp', + throw: 'keyword.control.cpp', // Types - 'void': 'storage.type.cpp', - 'bool': 'storage.type.cpp', - 'char': 'storage.type.cpp', - 'short': 'storage.type.cpp', - 'int': 'storage.type.cpp', - 'long': 'storage.type.cpp', - 'float': 'storage.type.cpp', - 'double': 'storage.type.cpp', - 'signed': 'storage.type.cpp', - 'unsigned': 'storage.type.cpp', - 'struct': 'storage.type.cpp', - 'union': 'storage.type.cpp', - 'enum': 'storage.type.cpp', - 'class': 'storage.type.cpp', - 'typedef': 'storage.type.cpp', - 'typename': 'storage.type.cpp', - 'auto': 'storage.type.cpp', - 'decltype': 'storage.type.cpp', + void: 'storage.type.cpp', + bool: 'storage.type.cpp', + char: 'storage.type.cpp', + short: 'storage.type.cpp', + int: 'storage.type.cpp', + long: 'storage.type.cpp', + float: 'storage.type.cpp', + double: 'storage.type.cpp', + signed: 'storage.type.cpp', + unsigned: 'storage.type.cpp', + struct: 'storage.type.cpp', + union: 'storage.type.cpp', + enum: 'storage.type.cpp', + class: 'storage.type.cpp', + typedef: 'storage.type.cpp', + typename: 'storage.type.cpp', + auto: 'storage.type.cpp', + decltype: 'storage.type.cpp', // Modifiers - 'const': 'storage.modifier.cpp', - 'static': 'storage.modifier.cpp', - 'extern': 'storage.modifier.cpp', - 'register': 'storage.modifier.cpp', - 'volatile': 'storage.modifier.cpp', - 'inline': 'storage.modifier.cpp', - 'virtual': 'storage.modifier.cpp', - 'explicit': 'storage.modifier.cpp', - 'friend': 'storage.modifier.cpp', - 'mutable': 'storage.modifier.cpp', - 'constexpr': 'storage.modifier.cpp', - 'consteval': 'storage.modifier.cpp', - 'constinit': 'storage.modifier.cpp', + const: 'storage.modifier.cpp', + static: 'storage.modifier.cpp', + extern: 'storage.modifier.cpp', + register: 'storage.modifier.cpp', + volatile: 'storage.modifier.cpp', + inline: 'storage.modifier.cpp', + virtual: 'storage.modifier.cpp', + explicit: 'storage.modifier.cpp', + friend: 'storage.modifier.cpp', + mutable: 'storage.modifier.cpp', + constexpr: 'storage.modifier.cpp', + consteval: 'storage.modifier.cpp', + constinit: 'storage.modifier.cpp', // Access - 'public': 'storage.modifier.access.cpp', - 'private': 'storage.modifier.access.cpp', - 'protected': 'storage.modifier.access.cpp', + public: 'storage.modifier.access.cpp', + private: 'storage.modifier.access.cpp', + protected: 'storage.modifier.access.cpp', // Operators - 'new': 'keyword.operator.new.cpp', - 'delete': 'keyword.operator.delete.cpp', - 'sizeof': 'keyword.operator.sizeof.cpp', - 'alignof': 'keyword.operator.alignof.cpp', - 'typeid': 'keyword.operator.typeid.cpp', - 'static_cast': 'keyword.operator.cast.cpp', - 'dynamic_cast': 'keyword.operator.cast.cpp', - 'const_cast': 'keyword.operator.cast.cpp', - 'reinterpret_cast': 'keyword.operator.cast.cpp', + new: 'keyword.operator.new.cpp', + delete: 'keyword.operator.delete.cpp', + sizeof: 'keyword.operator.sizeof.cpp', + alignof: 'keyword.operator.alignof.cpp', + typeid: 'keyword.operator.typeid.cpp', + static_cast: 'keyword.operator.cast.cpp', + dynamic_cast: 'keyword.operator.cast.cpp', + const_cast: 'keyword.operator.cast.cpp', + reinterpret_cast: 'keyword.operator.cast.cpp', // Other - 'namespace': 'keyword.other.namespace.cpp', - 'using': 'keyword.other.using.cpp', - 'template': 'keyword.other.template.cpp', - 'this': 'variable.language.cpp', - 'nullptr': 'constant.language.cpp', - 'true': 'constant.language.cpp', - 'false': 'constant.language.cpp', - 'operator': 'keyword.operator.cpp', - 'concept': 'keyword.other.concept.cpp', - 'requires': 'keyword.other.requires.cpp', - 'co_await': 'keyword.control.cpp', - 'co_return': 'keyword.control.cpp', - 'co_yield': 'keyword.control.cpp', + namespace: 'keyword.other.namespace.cpp', + using: 'keyword.other.using.cpp', + template: 'keyword.other.template.cpp', + this: 'variable.language.cpp', + nullptr: 'constant.language.cpp', + true: 'constant.language.cpp', + false: 'constant.language.cpp', + operator: 'keyword.operator.cpp', + concept: 'keyword.other.concept.cpp', + requires: 'keyword.other.requires.cpp', + co_await: 'keyword.control.cpp', + co_return: 'keyword.control.cpp', + co_yield: 'keyword.control.cpp', }, patterns: [ { include: '#preprocessor' }, @@ -98,22 +98,22 @@ export const cppGrammar: Grammar = { name: 'meta.preprocessor.include.cpp', match: '^\\s*#\\s*include\\s+(<[^>]+>|"[^"]+")', captures: { - '1': { name: 'string.quoted.other.lt-gt.include.cpp' }, + 1: { name: 'string.quoted.other.lt-gt.include.cpp' }, }, }, { name: 'meta.preprocessor.macro.cpp', match: '^\\s*#\\s*(define|undef)\\s+([a-zA-Z_][a-zA-Z0-9_]*)', captures: { - '1': { name: 'keyword.control.directive.cpp' }, - '2': { name: 'entity.name.function.preprocessor.cpp' }, + 1: { name: 'keyword.control.directive.cpp' }, + 2: { name: 'entity.name.function.preprocessor.cpp' }, }, }, { name: 'meta.preprocessor.cpp', match: '^\\s*#\\s*(if|ifdef|ifndef|elif|else|endif|pragma|error|warning|line)\\b', captures: { - '1': { name: 'keyword.control.directive.cpp' }, + 1: { name: 'keyword.control.directive.cpp' }, }, }, ], @@ -151,8 +151,8 @@ export const cppGrammar: Grammar = { }, { name: 'string.quoted.single.cpp', - begin: "'", - end: "'", + begin: '\'', + end: '\'', patterns: [ { name: 'constant.character.escape.cpp', diff --git a/packages/ts-syntax-highlighter/src/grammars/csharp.ts b/packages/ts-syntax-highlighter/src/grammars/csharp.ts index a390613..9ccd48f 100644 --- a/packages/ts-syntax-highlighter/src/grammars/csharp.ts +++ b/packages/ts-syntax-highlighter/src/grammars/csharp.ts @@ -5,100 +5,100 @@ export const csharpGrammar: Grammar = { scopeName: 'source.cs', keywords: { // Control flow - 'if': 'keyword.control.cs', - 'else': 'keyword.control.cs', - 'for': 'keyword.control.cs', - 'foreach': 'keyword.control.cs', - 'while': 'keyword.control.cs', - 'do': 'keyword.control.cs', - 'switch': 'keyword.control.cs', - 'case': 'keyword.control.cs', - 'default': 'keyword.control.cs', - 'break': 'keyword.control.cs', - 'continue': 'keyword.control.cs', - 'return': 'keyword.control.cs', - 'goto': 'keyword.control.cs', - 'try': 'keyword.control.cs', - 'catch': 'keyword.control.cs', - 'finally': 'keyword.control.cs', - 'throw': 'keyword.control.cs', - 'yield': 'keyword.control.cs', - 'await': 'keyword.control.cs', + if: 'keyword.control.cs', + else: 'keyword.control.cs', + for: 'keyword.control.cs', + foreach: 'keyword.control.cs', + while: 'keyword.control.cs', + do: 'keyword.control.cs', + switch: 'keyword.control.cs', + case: 'keyword.control.cs', + default: 'keyword.control.cs', + break: 'keyword.control.cs', + continue: 'keyword.control.cs', + return: 'keyword.control.cs', + goto: 'keyword.control.cs', + try: 'keyword.control.cs', + catch: 'keyword.control.cs', + finally: 'keyword.control.cs', + throw: 'keyword.control.cs', + yield: 'keyword.control.cs', + await: 'keyword.control.cs', // Types - 'class': 'keyword.other.class.cs', - 'struct': 'keyword.other.struct.cs', - 'interface': 'keyword.other.interface.cs', - 'enum': 'keyword.other.enum.cs', - 'delegate': 'keyword.other.delegate.cs', - 'record': 'keyword.other.record.cs', - 'void': 'keyword.type.cs', - 'bool': 'keyword.type.cs', - 'byte': 'keyword.type.cs', - 'sbyte': 'keyword.type.cs', - 'char': 'keyword.type.cs', - 'decimal': 'keyword.type.cs', - 'double': 'keyword.type.cs', - 'float': 'keyword.type.cs', - 'int': 'keyword.type.cs', - 'uint': 'keyword.type.cs', - 'long': 'keyword.type.cs', - 'ulong': 'keyword.type.cs', - 'short': 'keyword.type.cs', - 'ushort': 'keyword.type.cs', - 'object': 'keyword.type.cs', - 'string': 'keyword.type.cs', - 'var': 'keyword.type.cs', - 'dynamic': 'keyword.type.cs', + class: 'keyword.other.class.cs', + struct: 'keyword.other.struct.cs', + interface: 'keyword.other.interface.cs', + enum: 'keyword.other.enum.cs', + delegate: 'keyword.other.delegate.cs', + record: 'keyword.other.record.cs', + void: 'keyword.type.cs', + bool: 'keyword.type.cs', + byte: 'keyword.type.cs', + sbyte: 'keyword.type.cs', + char: 'keyword.type.cs', + decimal: 'keyword.type.cs', + double: 'keyword.type.cs', + float: 'keyword.type.cs', + int: 'keyword.type.cs', + uint: 'keyword.type.cs', + long: 'keyword.type.cs', + ulong: 'keyword.type.cs', + short: 'keyword.type.cs', + ushort: 'keyword.type.cs', + object: 'keyword.type.cs', + string: 'keyword.type.cs', + var: 'keyword.type.cs', + dynamic: 'keyword.type.cs', // Modifiers - 'public': 'storage.modifier.cs', - 'private': 'storage.modifier.cs', - 'protected': 'storage.modifier.cs', - 'internal': 'storage.modifier.cs', - 'static': 'storage.modifier.cs', - 'readonly': 'storage.modifier.cs', - 'const': 'storage.modifier.cs', - 'virtual': 'storage.modifier.cs', - 'override': 'storage.modifier.cs', - 'abstract': 'storage.modifier.cs', - 'sealed': 'storage.modifier.cs', - 'partial': 'storage.modifier.cs', - 'async': 'storage.modifier.cs', - 'extern': 'storage.modifier.cs', - 'volatile': 'storage.modifier.cs', + public: 'storage.modifier.cs', + private: 'storage.modifier.cs', + protected: 'storage.modifier.cs', + internal: 'storage.modifier.cs', + static: 'storage.modifier.cs', + readonly: 'storage.modifier.cs', + const: 'storage.modifier.cs', + virtual: 'storage.modifier.cs', + override: 'storage.modifier.cs', + abstract: 'storage.modifier.cs', + sealed: 'storage.modifier.cs', + partial: 'storage.modifier.cs', + async: 'storage.modifier.cs', + extern: 'storage.modifier.cs', + volatile: 'storage.modifier.cs', // Other keywords - 'namespace': 'keyword.other.namespace.cs', - 'using': 'keyword.other.using.cs', - 'new': 'keyword.operator.new.cs', - 'this': 'variable.language.cs', - 'base': 'variable.language.cs', - 'true': 'constant.language.cs', - 'false': 'constant.language.cs', - 'null': 'constant.language.cs', - 'typeof': 'keyword.operator.cs', - 'sizeof': 'keyword.operator.cs', - 'is': 'keyword.operator.cs', - 'as': 'keyword.operator.cs', - 'in': 'keyword.operator.cs', - 'out': 'keyword.operator.cs', - 'ref': 'keyword.operator.cs', - 'params': 'keyword.other.cs', - 'operator': 'keyword.other.cs', - 'implicit': 'keyword.other.cs', - 'explicit': 'keyword.other.cs', - 'get': 'keyword.other.cs', - 'set': 'keyword.other.cs', - 'value': 'keyword.other.cs', - 'add': 'keyword.other.cs', - 'remove': 'keyword.other.cs', - 'event': 'keyword.other.cs', - 'lock': 'keyword.control.cs', - 'checked': 'keyword.control.cs', - 'unchecked': 'keyword.control.cs', - 'unsafe': 'keyword.other.cs', - 'fixed': 'keyword.other.cs', - 'stackalloc': 'keyword.operator.cs', - 'nameof': 'keyword.operator.cs', - 'when': 'keyword.control.cs', + namespace: 'keyword.other.namespace.cs', + using: 'keyword.other.using.cs', + new: 'keyword.operator.new.cs', + this: 'variable.language.cs', + base: 'variable.language.cs', + true: 'constant.language.cs', + false: 'constant.language.cs', + null: 'constant.language.cs', + typeof: 'keyword.operator.cs', + sizeof: 'keyword.operator.cs', + is: 'keyword.operator.cs', + as: 'keyword.operator.cs', + in: 'keyword.operator.cs', + out: 'keyword.operator.cs', + ref: 'keyword.operator.cs', + params: 'keyword.other.cs', + operator: 'keyword.other.cs', + implicit: 'keyword.other.cs', + explicit: 'keyword.other.cs', + get: 'keyword.other.cs', + set: 'keyword.other.cs', + value: 'keyword.other.cs', + add: 'keyword.other.cs', + remove: 'keyword.other.cs', + event: 'keyword.other.cs', + lock: 'keyword.control.cs', + checked: 'keyword.control.cs', + unchecked: 'keyword.control.cs', + unsafe: 'keyword.other.cs', + fixed: 'keyword.other.cs', + stackalloc: 'keyword.operator.cs', + nameof: 'keyword.operator.cs', + when: 'keyword.control.cs', }, patterns: [ { include: '#comments' }, @@ -173,8 +173,8 @@ export const csharpGrammar: Grammar = { }, { name: 'string.quoted.single.cs', - begin: "'", - end: "'", + begin: '\'', + end: '\'', patterns: [ { name: 'constant.character.escape.cs', diff --git a/packages/ts-syntax-highlighter/src/grammars/dart.ts b/packages/ts-syntax-highlighter/src/grammars/dart.ts index ddc5560..2fc2fb7 100644 --- a/packages/ts-syntax-highlighter/src/grammars/dart.ts +++ b/packages/ts-syntax-highlighter/src/grammars/dart.ts @@ -4,21 +4,47 @@ export const dartGrammar: Grammar = { name: 'Dart', scopeName: 'source.dart', keywords: { - 'import': 'keyword.other.dart', 'library': 'keyword.other.dart', 'part': 'keyword.other.dart', 'class': 'keyword.other.dart', - 'enum': 'keyword.other.dart', 'extends': 'keyword.other.dart', 'implements': 'keyword.other.dart', 'with': 'keyword.other.dart', - 'mixin': 'keyword.other.dart', 'if': 'keyword.control.dart', 'else': 'keyword.control.dart', 'for': 'keyword.control.dart', - 'while': 'keyword.control.dart', 'do': 'keyword.control.dart', 'switch': 'keyword.control.dart', 'case': 'keyword.control.dart', - 'default': 'keyword.control.dart', 'break': 'keyword.control.dart', 'continue': 'keyword.control.dart', 'return': 'keyword.control.dart', - 'try': 'keyword.control.dart', 'catch': 'keyword.control.dart', 'finally': 'keyword.control.dart', 'throw': 'keyword.control.dart', - 'var': 'storage.type.dart', 'final': 'storage.type.dart', 'const': 'storage.type.dart', 'late': 'storage.modifier.dart', - 'static': 'storage.modifier.dart', 'async': 'storage.modifier.dart', 'await': 'keyword.control.dart', - 'true': 'constant.language.dart', 'false': 'constant.language.dart', 'null': 'constant.language.dart', - 'this': 'variable.language.dart', 'super': 'variable.language.dart', + import: 'keyword.other.dart', + library: 'keyword.other.dart', + part: 'keyword.other.dart', + class: 'keyword.other.dart', + enum: 'keyword.other.dart', + extends: 'keyword.other.dart', + implements: 'keyword.other.dart', + with: 'keyword.other.dart', + mixin: 'keyword.other.dart', + if: 'keyword.control.dart', + else: 'keyword.control.dart', + for: 'keyword.control.dart', + while: 'keyword.control.dart', + do: 'keyword.control.dart', + switch: 'keyword.control.dart', + case: 'keyword.control.dart', + default: 'keyword.control.dart', + break: 'keyword.control.dart', + continue: 'keyword.control.dart', + return: 'keyword.control.dart', + try: 'keyword.control.dart', + catch: 'keyword.control.dart', + finally: 'keyword.control.dart', + throw: 'keyword.control.dart', + var: 'storage.type.dart', + final: 'storage.type.dart', + const: 'storage.type.dart', + late: 'storage.modifier.dart', + static: 'storage.modifier.dart', + async: 'storage.modifier.dart', + await: 'keyword.control.dart', + true: 'constant.language.dart', + false: 'constant.language.dart', + null: 'constant.language.dart', + this: 'variable.language.dart', + super: 'variable.language.dart', }, patterns: [{ include: '#comments' }, { include: '#strings' }, { include: '#keywords' }, { include: '#numbers' }], repository: { comments: { patterns: [{ name: 'comment.line.double-slash.dart', match: '\\/\\/.*$' }, { name: 'comment.block.dart', begin: '\\/\\*', end: '\\*\\/' }] }, - strings: { patterns: [{ name: 'string.quoted.triple.dart', begin: '"""', end: '"""' }, { name: 'string.quoted.double.dart', begin: '"', end: '"', patterns: [{ name: 'constant.character.escape.dart', match: '\\\\.' }, { name: 'variable.other.dart', match: '\\$[a-zA-Z_][a-zA-Z0-9_]*' }, { name: 'meta.embedded.line.dart', begin: '\\$\\{', end: '\\}' }] }, { name: 'string.quoted.single.dart', begin: "'", end: "'" }] }, + strings: { patterns: [{ name: 'string.quoted.triple.dart', begin: '"""', end: '"""' }, { name: 'string.quoted.double.dart', begin: '"', end: '"', patterns: [{ name: 'constant.character.escape.dart', match: '\\\\.' }, { name: 'variable.other.dart', match: '\\$[a-zA-Z_][a-zA-Z0-9_]*' }, { name: 'meta.embedded.line.dart', begin: '\\$\\{', end: '\\}' }] }, { name: 'string.quoted.single.dart', begin: '\'', end: '\'' }] }, keywords: { patterns: [{ name: 'keyword.control.dart', match: '\\b(if|else|for|while|do|switch|case|default|break|continue|return|try|catch|finally|throw|await)\\b' }, { name: 'keyword.other.dart', match: '\\b(import|library|part|class|enum|extends|implements|with|mixin)\\b' }, { name: 'storage.type.dart', match: '\\b(var|final|const)\\b' }, { name: 'constant.language.dart', match: '\\b(true|false|null)\\b' }] }, numbers: { patterns: [{ name: 'constant.numeric.dart', match: '\\b\\d+\\.?\\d*\\b' }] }, }, diff --git a/packages/ts-syntax-highlighter/src/grammars/diff.ts b/packages/ts-syntax-highlighter/src/grammars/diff.ts index c2b24e2..80a02b1 100644 --- a/packages/ts-syntax-highlighter/src/grammars/diff.ts +++ b/packages/ts-syntax-highlighter/src/grammars/diff.ts @@ -19,16 +19,16 @@ export const diffGrammar: Grammar = { name: 'meta.diff.header.from-file', match: '^(---\\s+)(.*)$', captures: { - '1': { name: 'punctuation.definition.from-file.diff' }, - '2': { name: 'meta.diff.header.from-path' }, + 1: { name: 'punctuation.definition.from-file.diff' }, + 2: { name: 'meta.diff.header.from-path' }, }, }, { name: 'meta.diff.header.to-file', match: '^(\\+\\+\\+\\s+)(.*)$', captures: { - '1': { name: 'punctuation.definition.to-file.diff' }, - '2': { name: 'meta.diff.header.to-path' }, + 1: { name: 'punctuation.definition.to-file.diff' }, + 2: { name: 'meta.diff.header.to-path' }, }, }, { @@ -43,10 +43,10 @@ export const diffGrammar: Grammar = { name: 'meta.diff.range.unified', match: '^(@@)\\s+(-\\d+,\\d+\\s+\\+\\d+,\\d+)\\s+(@@)(.*)$', captures: { - '1': { name: 'punctuation.definition.range.diff' }, - '2': { name: 'meta.diff.range.context' }, - '3': { name: 'punctuation.definition.range.diff' }, - '4': { name: 'entity.name.function.diff' }, + 1: { name: 'punctuation.definition.range.diff' }, + 2: { name: 'meta.diff.range.context' }, + 3: { name: 'punctuation.definition.range.diff' }, + 4: { name: 'entity.name.function.diff' }, }, }, ], @@ -75,7 +75,7 @@ export const diffGrammar: Grammar = { }, ], }, - metadata: { + 'metadata': { patterns: [ { name: 'meta.diff.index', diff --git a/packages/ts-syntax-highlighter/src/grammars/dockerfile.ts b/packages/ts-syntax-highlighter/src/grammars/dockerfile.ts index 60f43e4..533bfab 100644 --- a/packages/ts-syntax-highlighter/src/grammars/dockerfile.ts +++ b/packages/ts-syntax-highlighter/src/grammars/dockerfile.ts @@ -4,25 +4,25 @@ export const dockerfileGrammar: Grammar = { name: 'Dockerfile', scopeName: 'source.dockerfile', keywords: { - 'FROM': 'keyword.control.dockerfile', - 'RUN': 'keyword.control.dockerfile', - 'CMD': 'keyword.control.dockerfile', - 'LABEL': 'keyword.control.dockerfile', - 'EXPOSE': 'keyword.control.dockerfile', - 'ENV': 'keyword.control.dockerfile', - 'ADD': 'keyword.control.dockerfile', - 'COPY': 'keyword.control.dockerfile', - 'ENTRYPOINT': 'keyword.control.dockerfile', - 'VOLUME': 'keyword.control.dockerfile', - 'USER': 'keyword.control.dockerfile', - 'WORKDIR': 'keyword.control.dockerfile', - 'ARG': 'keyword.control.dockerfile', - 'ONBUILD': 'keyword.control.dockerfile', - 'STOPSIGNAL': 'keyword.control.dockerfile', - 'HEALTHCHECK': 'keyword.control.dockerfile', - 'SHELL': 'keyword.control.dockerfile', - 'MAINTAINER': 'keyword.control.dockerfile', - 'AS': 'keyword.other.dockerfile', + FROM: 'keyword.control.dockerfile', + RUN: 'keyword.control.dockerfile', + CMD: 'keyword.control.dockerfile', + LABEL: 'keyword.control.dockerfile', + EXPOSE: 'keyword.control.dockerfile', + ENV: 'keyword.control.dockerfile', + ADD: 'keyword.control.dockerfile', + COPY: 'keyword.control.dockerfile', + ENTRYPOINT: 'keyword.control.dockerfile', + VOLUME: 'keyword.control.dockerfile', + USER: 'keyword.control.dockerfile', + WORKDIR: 'keyword.control.dockerfile', + ARG: 'keyword.control.dockerfile', + ONBUILD: 'keyword.control.dockerfile', + STOPSIGNAL: 'keyword.control.dockerfile', + HEALTHCHECK: 'keyword.control.dockerfile', + SHELL: 'keyword.control.dockerfile', + MAINTAINER: 'keyword.control.dockerfile', + AS: 'keyword.other.dockerfile', }, patterns: [ { include: '#comments' }, @@ -66,8 +66,8 @@ export const dockerfileGrammar: Grammar = { }, { name: 'string.quoted.single.dockerfile', - begin: "'", - end: "'", + begin: '\'', + end: '\'', patterns: [ { name: 'constant.character.escape.dockerfile', diff --git a/packages/ts-syntax-highlighter/src/grammars/go.ts b/packages/ts-syntax-highlighter/src/grammars/go.ts index af2afaf..9f237ca 100644 --- a/packages/ts-syntax-highlighter/src/grammars/go.ts +++ b/packages/ts-syntax-highlighter/src/grammars/go.ts @@ -4,70 +4,70 @@ export const goGrammar: Grammar = { name: 'Go', scopeName: 'source.go', keywords: { - 'break': 'keyword.control.go', - 'case': 'keyword.control.go', - 'chan': 'keyword.control.go', - 'const': 'keyword.control.go', - 'continue': 'keyword.control.go', - 'default': 'keyword.control.go', - 'defer': 'keyword.control.go', - 'else': 'keyword.control.go', - 'fallthrough': 'keyword.control.go', - 'for': 'keyword.control.go', - 'func': 'keyword.control.go', - 'go': 'keyword.control.go', - 'goto': 'keyword.control.go', - 'if': 'keyword.control.go', - 'import': 'keyword.control.go', - 'interface': 'keyword.control.go', - 'map': 'keyword.control.go', - 'package': 'keyword.control.go', - 'range': 'keyword.control.go', - 'return': 'keyword.control.go', - 'select': 'keyword.control.go', - 'struct': 'keyword.control.go', - 'switch': 'keyword.control.go', - 'type': 'keyword.control.go', - 'var': 'keyword.control.go', - 'bool': 'storage.type.go', - 'byte': 'storage.type.go', - 'complex64': 'storage.type.go', - 'complex128': 'storage.type.go', - 'error': 'storage.type.go', - 'float32': 'storage.type.go', - 'float64': 'storage.type.go', - 'int': 'storage.type.go', - 'int8': 'storage.type.go', - 'int16': 'storage.type.go', - 'int32': 'storage.type.go', - 'int64': 'storage.type.go', - 'rune': 'storage.type.go', - 'string': 'storage.type.go', - 'uint': 'storage.type.go', - 'uint8': 'storage.type.go', - 'uint16': 'storage.type.go', - 'uint32': 'storage.type.go', - 'uint64': 'storage.type.go', - 'uintptr': 'storage.type.go', - 'true': 'constant.language.go', - 'false': 'constant.language.go', - 'nil': 'constant.language.go', - 'iota': 'constant.language.go', - 'append': 'support.function.builtin.go', - 'cap': 'support.function.builtin.go', - 'close': 'support.function.builtin.go', - 'complex': 'support.function.builtin.go', - 'copy': 'support.function.builtin.go', - 'delete': 'support.function.builtin.go', - 'imag': 'support.function.builtin.go', - 'len': 'support.function.builtin.go', - 'make': 'support.function.builtin.go', - 'new': 'support.function.builtin.go', - 'panic': 'support.function.builtin.go', - 'print': 'support.function.builtin.go', - 'println': 'support.function.builtin.go', - 'real': 'support.function.builtin.go', - 'recover': 'support.function.builtin.go', + break: 'keyword.control.go', + case: 'keyword.control.go', + chan: 'keyword.control.go', + const: 'keyword.control.go', + continue: 'keyword.control.go', + default: 'keyword.control.go', + defer: 'keyword.control.go', + else: 'keyword.control.go', + fallthrough: 'keyword.control.go', + for: 'keyword.control.go', + func: 'keyword.control.go', + go: 'keyword.control.go', + goto: 'keyword.control.go', + if: 'keyword.control.go', + import: 'keyword.control.go', + interface: 'keyword.control.go', + map: 'keyword.control.go', + package: 'keyword.control.go', + range: 'keyword.control.go', + return: 'keyword.control.go', + select: 'keyword.control.go', + struct: 'keyword.control.go', + switch: 'keyword.control.go', + type: 'keyword.control.go', + var: 'keyword.control.go', + bool: 'storage.type.go', + byte: 'storage.type.go', + complex64: 'storage.type.go', + complex128: 'storage.type.go', + error: 'storage.type.go', + float32: 'storage.type.go', + float64: 'storage.type.go', + int: 'storage.type.go', + int8: 'storage.type.go', + int16: 'storage.type.go', + int32: 'storage.type.go', + int64: 'storage.type.go', + rune: 'storage.type.go', + string: 'storage.type.go', + uint: 'storage.type.go', + uint8: 'storage.type.go', + uint16: 'storage.type.go', + uint32: 'storage.type.go', + uint64: 'storage.type.go', + uintptr: 'storage.type.go', + true: 'constant.language.go', + false: 'constant.language.go', + nil: 'constant.language.go', + iota: 'constant.language.go', + append: 'support.function.builtin.go', + cap: 'support.function.builtin.go', + close: 'support.function.builtin.go', + complex: 'support.function.builtin.go', + copy: 'support.function.builtin.go', + delete: 'support.function.builtin.go', + imag: 'support.function.builtin.go', + len: 'support.function.builtin.go', + make: 'support.function.builtin.go', + new: 'support.function.builtin.go', + panic: 'support.function.builtin.go', + print: 'support.function.builtin.go', + println: 'support.function.builtin.go', + real: 'support.function.builtin.go', + recover: 'support.function.builtin.go', }, patterns: [ { include: '#comments' }, @@ -111,8 +111,8 @@ export const goGrammar: Grammar = { }, { name: 'string.quoted.single.go', - begin: "'", - end: "'", + begin: '\'', + end: '\'', patterns: [ { name: 'constant.character.escape.go', diff --git a/packages/ts-syntax-highlighter/src/grammars/graphql.ts b/packages/ts-syntax-highlighter/src/grammars/graphql.ts index 8f68826..976a7ec 100644 --- a/packages/ts-syntax-highlighter/src/grammars/graphql.ts +++ b/packages/ts-syntax-highlighter/src/grammars/graphql.ts @@ -4,12 +4,23 @@ export const graphqlGrammar: Grammar = { name: 'GraphQL', scopeName: 'source.graphql', keywords: { - 'query': 'keyword.operation.graphql', 'mutation': 'keyword.operation.graphql', 'subscription': 'keyword.operation.graphql', - 'fragment': 'keyword.operation.graphql', 'type': 'keyword.type.graphql', 'interface': 'keyword.type.graphql', - 'union': 'keyword.type.graphql', 'enum': 'keyword.type.graphql', 'input': 'keyword.type.graphql', - 'scalar': 'keyword.type.graphql', 'schema': 'keyword.type.graphql', 'extend': 'keyword.type.graphql', - 'implements': 'keyword.type.graphql', 'on': 'keyword.other.graphql', - 'true': 'constant.language.graphql', 'false': 'constant.language.graphql', 'null': 'constant.language.graphql', + query: 'keyword.operation.graphql', + mutation: 'keyword.operation.graphql', + subscription: 'keyword.operation.graphql', + fragment: 'keyword.operation.graphql', + type: 'keyword.type.graphql', + interface: 'keyword.type.graphql', + union: 'keyword.type.graphql', + enum: 'keyword.type.graphql', + input: 'keyword.type.graphql', + scalar: 'keyword.type.graphql', + schema: 'keyword.type.graphql', + extend: 'keyword.type.graphql', + implements: 'keyword.type.graphql', + on: 'keyword.other.graphql', + true: 'constant.language.graphql', + false: 'constant.language.graphql', + null: 'constant.language.graphql', }, patterns: [{ include: '#comments' }, { include: '#strings' }, { include: '#keywords' }, { include: '#directives' }], repository: { diff --git a/packages/ts-syntax-highlighter/src/grammars/idl.ts b/packages/ts-syntax-highlighter/src/grammars/idl.ts index f562ce6..e8c4964 100644 --- a/packages/ts-syntax-highlighter/src/grammars/idl.ts +++ b/packages/ts-syntax-highlighter/src/grammars/idl.ts @@ -4,30 +4,30 @@ export const idlGrammar: Grammar = { name: 'IDL', scopeName: 'source.idl', keywords: { - 'interface': 'keyword.other.idl', - 'module': 'keyword.other.idl', - 'struct': 'keyword.other.idl', - 'union': 'keyword.other.idl', - 'enum': 'keyword.other.idl', - 'typedef': 'keyword.other.idl', - 'exception': 'keyword.other.idl', - 'readonly': 'storage.modifier.idl', - 'attribute': 'storage.modifier.idl', - 'const': 'storage.modifier.idl', - 'in': 'keyword.other.idl', - 'out': 'keyword.other.idl', - 'inout': 'keyword.other.idl', - 'void': 'storage.type.idl', - 'boolean': 'storage.type.idl', - 'byte': 'storage.type.idl', - 'short': 'storage.type.idl', - 'long': 'storage.type.idl', - 'float': 'storage.type.idl', - 'double': 'storage.type.idl', - 'char': 'storage.type.idl', - 'string': 'storage.type.idl', - 'TRUE': 'constant.language.idl', - 'FALSE': 'constant.language.idl', + interface: 'keyword.other.idl', + module: 'keyword.other.idl', + struct: 'keyword.other.idl', + union: 'keyword.other.idl', + enum: 'keyword.other.idl', + typedef: 'keyword.other.idl', + exception: 'keyword.other.idl', + readonly: 'storage.modifier.idl', + attribute: 'storage.modifier.idl', + const: 'storage.modifier.idl', + in: 'keyword.other.idl', + out: 'keyword.other.idl', + inout: 'keyword.other.idl', + void: 'storage.type.idl', + boolean: 'storage.type.idl', + byte: 'storage.type.idl', + short: 'storage.type.idl', + long: 'storage.type.idl', + float: 'storage.type.idl', + double: 'storage.type.idl', + char: 'storage.type.idl', + string: 'storage.type.idl', + TRUE: 'constant.language.idl', + FALSE: 'constant.language.idl', }, patterns: [ { include: '#comments' }, diff --git a/packages/ts-syntax-highlighter/src/grammars/index.ts b/packages/ts-syntax-highlighter/src/grammars/index.ts index b829572..3a851e9 100644 --- a/packages/ts-syntax-highlighter/src/grammars/index.ts +++ b/packages/ts-syntax-highlighter/src/grammars/index.ts @@ -17,8 +17,8 @@ import { htmlGrammar } from './html' import { idlGrammar } from './idl' import { javaGrammar } from './java' import { javascriptGrammar } from './javascript' -import { json5Grammar } from './json5' import { jsonGrammar } from './json' +import { json5Grammar } from './json5' import { jsoncGrammar } from './jsonc' import { kotlinGrammar } from './kotlin' import { latexGrammar } from './latex' @@ -410,6 +410,7 @@ export * from './cmd' export * from './cpp' export * from './csharp' export * from './css' +export * from './css' export * from './csv' export * from './dart' export * from './diff' @@ -417,11 +418,10 @@ export * from './dockerfile' export * from './go' export * from './graphql' export * from './html' +export * from './html' export * from './idl' export * from './java' export * from './javascript' -export * from './css' -export * from './html' export * from './javascript' export * from './json' export * from './json5' diff --git a/packages/ts-syntax-highlighter/src/grammars/java.ts b/packages/ts-syntax-highlighter/src/grammars/java.ts index ce5882b..0fbebf9 100644 --- a/packages/ts-syntax-highlighter/src/grammars/java.ts +++ b/packages/ts-syntax-highlighter/src/grammars/java.ts @@ -133,8 +133,8 @@ export const javaGrammar: Grammar = { }, { name: 'string.quoted.single.java', - begin: "'", - end: "'", + begin: '\'', + end: '\'', patterns: [ { name: 'constant.character.escape.java', diff --git a/packages/ts-syntax-highlighter/src/grammars/json5.ts b/packages/ts-syntax-highlighter/src/grammars/json5.ts index 6a36a73..f6b35d3 100644 --- a/packages/ts-syntax-highlighter/src/grammars/json5.ts +++ b/packages/ts-syntax-highlighter/src/grammars/json5.ts @@ -4,11 +4,11 @@ export const json5Grammar: Grammar = { name: 'JSON5', scopeName: 'source.json5', keywords: { - 'true': 'constant.language.json5', - 'false': 'constant.language.json5', - 'null': 'constant.language.json5', - 'Infinity': 'constant.language.json5', - 'NaN': 'constant.language.json5', + true: 'constant.language.json5', + false: 'constant.language.json5', + null: 'constant.language.json5', + Infinity: 'constant.language.json5', + NaN: 'constant.language.json5', }, patterns: [ { include: '#comments' }, @@ -26,7 +26,7 @@ export const json5Grammar: Grammar = { }, strings: { patterns: [ - { name: 'string.quoted.single.json5', begin: "'", end: "'", patterns: [{ name: 'constant.character.escape.json5', match: '\\\\.' }] }, + { name: 'string.quoted.single.json5', begin: '\'', end: '\'', patterns: [{ name: 'constant.character.escape.json5', match: '\\\\.' }] }, { name: 'string.quoted.double.json5', begin: '"', end: '"', patterns: [{ name: 'constant.character.escape.json5', match: '\\\\.' }] }, ], }, @@ -44,7 +44,7 @@ export const json5Grammar: Grammar = { patterns: [ { name: 'support.type.property-name.json5', match: '\\b[a-zA-Z_$][a-zA-Z0-9_$]*\\s*(?=:)' }, { name: 'support.type.property-name.json5', begin: '"', end: '"(?=\\s*:)' }, - { name: 'support.type.property-name.json5', begin: "'", end: "'(?=\\s*:)" }, + { name: 'support.type.property-name.json5', begin: '\'', end: '\'(?=\\s*:)' }, ], }, }, diff --git a/packages/ts-syntax-highlighter/src/grammars/jsonc.ts b/packages/ts-syntax-highlighter/src/grammars/jsonc.ts index 7661152..e950f9b 100644 --- a/packages/ts-syntax-highlighter/src/grammars/jsonc.ts +++ b/packages/ts-syntax-highlighter/src/grammars/jsonc.ts @@ -4,9 +4,9 @@ export const jsoncGrammar: Grammar = { name: 'JSONC', scopeName: 'source.jsonc', keywords: { - 'true': 'constant.language.json', - 'false': 'constant.language.json', - 'null': 'constant.language.json', + true: 'constant.language.json', + false: 'constant.language.json', + null: 'constant.language.json', }, patterns: [ { include: '#comments' }, diff --git a/packages/ts-syntax-highlighter/src/grammars/kotlin.ts b/packages/ts-syntax-highlighter/src/grammars/kotlin.ts index 6f5a1d9..20fa229 100644 --- a/packages/ts-syntax-highlighter/src/grammars/kotlin.ts +++ b/packages/ts-syntax-highlighter/src/grammars/kotlin.ts @@ -4,20 +4,52 @@ export const kotlinGrammar: Grammar = { name: 'Kotlin', scopeName: 'source.kotlin', keywords: { - 'package': 'keyword.other.kotlin', 'import': 'keyword.other.kotlin', 'class': 'keyword.other.kotlin', 'interface': 'keyword.other.kotlin', - 'object': 'keyword.other.kotlin', 'data': 'keyword.other.kotlin', 'sealed': 'keyword.other.kotlin', 'enum': 'keyword.other.kotlin', - 'fun': 'keyword.other.kotlin', 'val': 'keyword.other.kotlin', 'var': 'keyword.other.kotlin', 'if': 'keyword.control.kotlin', - 'else': 'keyword.control.kotlin', 'when': 'keyword.control.kotlin', 'for': 'keyword.control.kotlin', 'while': 'keyword.control.kotlin', - 'do': 'keyword.control.kotlin', 'return': 'keyword.control.kotlin', 'break': 'keyword.control.kotlin', 'continue': 'keyword.control.kotlin', - 'throw': 'keyword.control.kotlin', 'try': 'keyword.control.kotlin', 'catch': 'keyword.control.kotlin', 'finally': 'keyword.control.kotlin', - 'public': 'storage.modifier.kotlin', 'private': 'storage.modifier.kotlin', 'protected': 'storage.modifier.kotlin', - 'internal': 'storage.modifier.kotlin', 'open': 'storage.modifier.kotlin', 'abstract': 'storage.modifier.kotlin', - 'override': 'storage.modifier.kotlin', 'suspend': 'storage.modifier.kotlin', 'inline': 'storage.modifier.kotlin', - 'true': 'constant.language.kotlin', 'false': 'constant.language.kotlin', 'null': 'constant.language.kotlin', - 'this': 'variable.language.kotlin', 'super': 'variable.language.kotlin', 'it': 'variable.language.kotlin', + package: 'keyword.other.kotlin', + import: 'keyword.other.kotlin', + class: 'keyword.other.kotlin', + interface: 'keyword.other.kotlin', + object: 'keyword.other.kotlin', + data: 'keyword.other.kotlin', + sealed: 'keyword.other.kotlin', + enum: 'keyword.other.kotlin', + fun: 'keyword.other.kotlin', + val: 'keyword.other.kotlin', + var: 'keyword.other.kotlin', + if: 'keyword.control.kotlin', + else: 'keyword.control.kotlin', + when: 'keyword.control.kotlin', + for: 'keyword.control.kotlin', + while: 'keyword.control.kotlin', + do: 'keyword.control.kotlin', + return: 'keyword.control.kotlin', + break: 'keyword.control.kotlin', + continue: 'keyword.control.kotlin', + throw: 'keyword.control.kotlin', + try: 'keyword.control.kotlin', + catch: 'keyword.control.kotlin', + finally: 'keyword.control.kotlin', + public: 'storage.modifier.kotlin', + private: 'storage.modifier.kotlin', + protected: 'storage.modifier.kotlin', + internal: 'storage.modifier.kotlin', + open: 'storage.modifier.kotlin', + abstract: 'storage.modifier.kotlin', + override: 'storage.modifier.kotlin', + suspend: 'storage.modifier.kotlin', + inline: 'storage.modifier.kotlin', + true: 'constant.language.kotlin', + false: 'constant.language.kotlin', + null: 'constant.language.kotlin', + this: 'variable.language.kotlin', + super: 'variable.language.kotlin', + it: 'variable.language.kotlin', }, patterns: [ - { include: '#comments' }, { include: '#strings' }, { include: '#keywords' }, { include: '#numbers' }, { include: '#functions' }, + { include: '#comments' }, + { include: '#strings' }, + { include: '#keywords' }, + { include: '#numbers' }, + { include: '#functions' }, ], repository: { comments: { diff --git a/packages/ts-syntax-highlighter/src/grammars/latex.ts b/packages/ts-syntax-highlighter/src/grammars/latex.ts index b2602fa..f4b9077 100644 --- a/packages/ts-syntax-highlighter/src/grammars/latex.ts +++ b/packages/ts-syntax-highlighter/src/grammars/latex.ts @@ -8,7 +8,7 @@ export const latexGrammar: Grammar = { repository: { comments: { patterns: [{ name: 'comment.line.percentage.latex', match: '%.*$' }] }, commands: { patterns: [{ name: 'support.function.latex', match: '\\\\[a-zA-Z]+' }] }, - environments: { patterns: [{ name: 'meta.environment.latex', begin: '\\\\begin\\{([a-zA-Z]+)\\}', beginCaptures: { '0': { name: 'support.function.latex' }, '1': { name: 'variable.parameter.latex' } }, end: '\\\\end\\{\\1\\}', endCaptures: { '0': { name: 'support.function.latex' } } }] }, + environments: { patterns: [{ name: 'meta.environment.latex', begin: '\\\\begin\\{([a-zA-Z]+)\\}', beginCaptures: { 0: { name: 'support.function.latex' }, 1: { name: 'variable.parameter.latex' } }, end: '\\\\end\\{\\1\\}', endCaptures: { 0: { name: 'support.function.latex' } } }] }, math: { patterns: [{ name: 'string.other.math.latex', begin: '\\$\\$', end: '\\$\\$' }, { name: 'string.other.math.latex', begin: '\\$', end: '\\$' }] }, }, } diff --git a/packages/ts-syntax-highlighter/src/grammars/log.ts b/packages/ts-syntax-highlighter/src/grammars/log.ts index d4b77f3..10009c6 100644 --- a/packages/ts-syntax-highlighter/src/grammars/log.ts +++ b/packages/ts-syntax-highlighter/src/grammars/log.ts @@ -7,7 +7,7 @@ export const logGrammar: Grammar = { patterns: [{ include: '#log-levels' }, { include: '#timestamps' }, { include: '#ip-addresses' }], repository: { 'log-levels': { patterns: [{ name: 'markup.error.log', match: '\\b(ERROR|FATAL|CRITICAL)\\b' }, { name: 'markup.warning.log', match: '\\b(WARN|WARNING)\\b' }, { name: 'markup.info.log', match: '\\b(INFO|NOTICE)\\b' }, { name: 'markup.debug.log', match: '\\b(DEBUG|TRACE)\\b' }] }, - timestamps: { patterns: [{ name: 'constant.numeric.timestamp.log', match: '\\d{4}-\\d{2}-\\d{2}[T ]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?' }] }, + 'timestamps': { patterns: [{ name: 'constant.numeric.timestamp.log', match: '\\d{4}-\\d{2}-\\d{2}[T ]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?' }] }, 'ip-addresses': { patterns: [{ name: 'constant.numeric.ip.log', match: '\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b' }] }, }, } diff --git a/packages/ts-syntax-highlighter/src/grammars/lua.ts b/packages/ts-syntax-highlighter/src/grammars/lua.ts index 7b38125..58f1bef 100644 --- a/packages/ts-syntax-highlighter/src/grammars/lua.ts +++ b/packages/ts-syntax-highlighter/src/grammars/lua.ts @@ -4,17 +4,32 @@ export const luaGrammar: Grammar = { name: 'Lua', scopeName: 'source.lua', keywords: { - 'and': 'keyword.operator.lua', 'break': 'keyword.control.lua', 'do': 'keyword.control.lua', 'else': 'keyword.control.lua', - 'elseif': 'keyword.control.lua', 'end': 'keyword.control.lua', 'false': 'constant.language.lua', 'for': 'keyword.control.lua', - 'function': 'keyword.control.lua', 'if': 'keyword.control.lua', 'in': 'keyword.control.lua', 'local': 'storage.modifier.lua', - 'nil': 'constant.language.lua', 'not': 'keyword.operator.lua', 'or': 'keyword.operator.lua', 'repeat': 'keyword.control.lua', - 'return': 'keyword.control.lua', 'then': 'keyword.control.lua', 'true': 'constant.language.lua', 'until': 'keyword.control.lua', - 'while': 'keyword.control.lua', + and: 'keyword.operator.lua', + break: 'keyword.control.lua', + do: 'keyword.control.lua', + else: 'keyword.control.lua', + elseif: 'keyword.control.lua', + end: 'keyword.control.lua', + false: 'constant.language.lua', + for: 'keyword.control.lua', + function: 'keyword.control.lua', + if: 'keyword.control.lua', + in: 'keyword.control.lua', + local: 'storage.modifier.lua', + nil: 'constant.language.lua', + not: 'keyword.operator.lua', + or: 'keyword.operator.lua', + repeat: 'keyword.control.lua', + return: 'keyword.control.lua', + then: 'keyword.control.lua', + true: 'constant.language.lua', + until: 'keyword.control.lua', + while: 'keyword.control.lua', }, patterns: [{ include: '#comments' }, { include: '#strings' }, { include: '#keywords' }, { include: '#numbers' }], repository: { comments: { patterns: [{ name: 'comment.block.lua', begin: '--\\[\\[', end: '\\]\\]' }, { name: 'comment.line.double-dash.lua', match: '--.*$' }] }, - strings: { patterns: [{ name: 'string.quoted.other.multiline.lua', begin: '\\[\\[', end: '\\]\\]' }, { name: 'string.quoted.double.lua', begin: '"', end: '"', patterns: [{ name: 'constant.character.escape.lua', match: '\\\\.' }] }, { name: 'string.quoted.single.lua', begin: "'", end: "'", patterns: [{ name: 'constant.character.escape.lua', match: '\\\\.' }] }] }, + strings: { patterns: [{ name: 'string.quoted.other.multiline.lua', begin: '\\[\\[', end: '\\]\\]' }, { name: 'string.quoted.double.lua', begin: '"', end: '"', patterns: [{ name: 'constant.character.escape.lua', match: '\\\\.' }] }, { name: 'string.quoted.single.lua', begin: '\'', end: '\'', patterns: [{ name: 'constant.character.escape.lua', match: '\\\\.' }] }] }, keywords: { patterns: [{ name: 'keyword.control.lua', match: '\\b(break|do|else|elseif|end|for|function|if|in|repeat|return|then|until|while)\\b' }, { name: 'constant.language.lua', match: '\\b(true|false|nil)\\b' }, { name: 'storage.modifier.lua', match: '\\b(local)\\b' }] }, numbers: { patterns: [{ name: 'constant.numeric.lua', match: '\\b(?:0[xX][0-9a-fA-F]+|\\d+\\.?\\d*(?:[eE][+-]?\\d+)?)\\b' }] }, }, diff --git a/packages/ts-syntax-highlighter/src/grammars/makefile.ts b/packages/ts-syntax-highlighter/src/grammars/makefile.ts index d79c0d6..78609ee 100644 --- a/packages/ts-syntax-highlighter/src/grammars/makefile.ts +++ b/packages/ts-syntax-highlighter/src/grammars/makefile.ts @@ -4,9 +4,15 @@ export const makefileGrammar: Grammar = { name: 'Makefile', scopeName: 'source.makefile', keywords: { - 'ifeq': 'keyword.control.makefile', 'ifneq': 'keyword.control.makefile', 'ifdef': 'keyword.control.makefile', - 'ifndef': 'keyword.control.makefile', 'else': 'keyword.control.makefile', 'endif': 'keyword.control.makefile', - 'include': 'keyword.control.makefile', 'define': 'keyword.control.makefile', 'endef': 'keyword.control.makefile', + ifeq: 'keyword.control.makefile', + ifneq: 'keyword.control.makefile', + ifdef: 'keyword.control.makefile', + ifndef: 'keyword.control.makefile', + else: 'keyword.control.makefile', + endif: 'keyword.control.makefile', + include: 'keyword.control.makefile', + define: 'keyword.control.makefile', + endef: 'keyword.control.makefile', }, patterns: [{ include: '#comments' }, { include: '#targets' }, { include: '#variables' }, { include: '#directives' }], repository: { diff --git a/packages/ts-syntax-highlighter/src/grammars/markdown.ts b/packages/ts-syntax-highlighter/src/grammars/markdown.ts index fc69705..4b395ed 100644 --- a/packages/ts-syntax-highlighter/src/grammars/markdown.ts +++ b/packages/ts-syntax-highlighter/src/grammars/markdown.ts @@ -19,14 +19,14 @@ export const markdownGrammar: Grammar = { { include: '#table' }, ], repository: { - heading: { + 'heading': { patterns: [ { name: 'markup.heading.markdown', match: '^(#{1,6})\\s+(.+)$', captures: { - '1': { name: 'markup.heading.marker.markdown' }, - '2': { name: 'markup.heading.content.markdown' }, + 1: { name: 'markup.heading.marker.markdown' }, + 2: { name: 'markup.heading.content.markdown' }, }, }, { @@ -42,7 +42,7 @@ export const markdownGrammar: Grammar = { begin: '^```([a-zA-Z0-9]*)', end: '^```', captures: { - '1': { name: 'entity.name.function.markdown' }, + 1: { name: 'entity.name.function.markdown' }, }, contentName: 'markup.raw.code.markdown', }, @@ -60,98 +60,98 @@ export const markdownGrammar: Grammar = { }, ], }, - bold: { + 'bold': { patterns: [ { name: 'markup.bold.markdown', match: '(\\*\\*|__)(?=\\S)(.+?[*_]*)(?<=\\S)\\1', captures: { - '1': { name: 'punctuation.definition.bold.markdown' }, - '2': { name: 'markup.bold.content.markdown' }, + 1: { name: 'punctuation.definition.bold.markdown' }, + 2: { name: 'markup.bold.content.markdown' }, }, }, ], }, - italic: { + 'italic': { patterns: [ { name: 'markup.italic.markdown', match: '(\\*|_)(?=\\S)(.+?)(?<=\\S)\\1', captures: { - '1': { name: 'punctuation.definition.italic.markdown' }, - '2': { name: 'markup.italic.content.markdown' }, + 1: { name: 'punctuation.definition.italic.markdown' }, + 2: { name: 'markup.italic.content.markdown' }, }, }, ], }, - strikethrough: { + 'strikethrough': { patterns: [ { name: 'markup.strikethrough.markdown', match: '~~(.+?)~~', captures: { - '1': { name: 'markup.strikethrough.content.markdown' }, + 1: { name: 'markup.strikethrough.content.markdown' }, }, }, ], }, - link: { + 'link': { patterns: [ { name: 'meta.link.inline.markdown', match: '\\[([^\\]]+)\\]\\(([^)]+)\\)', captures: { - '1': { name: 'string.other.link.title.markdown' }, - '2': { name: 'markup.underline.link.markdown' }, + 1: { name: 'string.other.link.title.markdown' }, + 2: { name: 'markup.underline.link.markdown' }, }, }, { name: 'meta.link.reference.markdown', match: '\\[([^\\]]+)\\]\\[([^\\]]+)\\]', captures: { - '1': { name: 'string.other.link.title.markdown' }, - '2': { name: 'constant.other.reference.link.markdown' }, + 1: { name: 'string.other.link.title.markdown' }, + 2: { name: 'constant.other.reference.link.markdown' }, }, }, ], }, - image: { + 'image': { patterns: [ { name: 'meta.image.inline.markdown', match: '!\\[([^\\]]*)\\]\\(([^)]+)\\)', captures: { - '1': { name: 'string.other.link.description.markdown' }, - '2': { name: 'markup.underline.link.image.markdown' }, + 1: { name: 'string.other.link.description.markdown' }, + 2: { name: 'markup.underline.link.image.markdown' }, }, }, ], }, - list: { + 'list': { patterns: [ { name: 'markup.list.unnumbered.markdown', match: '^\\s*([-*+])\\s+', captures: { - '1': { name: 'punctuation.definition.list.markdown' }, + 1: { name: 'punctuation.definition.list.markdown' }, }, }, { name: 'markup.list.numbered.markdown', match: '^\\s*(\\d+\\.)\\s+', captures: { - '1': { name: 'punctuation.definition.list.markdown' }, + 1: { name: 'punctuation.definition.list.markdown' }, }, }, ], }, - blockquote: { + 'blockquote': { patterns: [ { name: 'markup.quote.markdown', match: '^\\s*>\\s*(.*)$', captures: { - '1': { name: 'markup.quote.content.markdown' }, + 1: { name: 'markup.quote.content.markdown' }, }, }, ], @@ -164,7 +164,7 @@ export const markdownGrammar: Grammar = { }, ], }, - table: { + 'table': { patterns: [ { name: 'markup.table.markdown', diff --git a/packages/ts-syntax-highlighter/src/grammars/nginx.ts b/packages/ts-syntax-highlighter/src/grammars/nginx.ts index 80d0321..6a9b0b5 100644 --- a/packages/ts-syntax-highlighter/src/grammars/nginx.ts +++ b/packages/ts-syntax-highlighter/src/grammars/nginx.ts @@ -10,6 +10,6 @@ export const nginxGrammar: Grammar = { directives: { patterns: [{ name: 'keyword.other.directive.nginx', match: '\\b(server|location|listen|root|index|proxy_pass|return|rewrite|try_files|add_header|set|if|access_log|error_log)\\b' }] }, blocks: { patterns: [{ name: 'entity.name.section.nginx', match: '\\b(http|server|location|upstream|events)\\b' }] }, variables: { patterns: [{ name: 'variable.other.nginx', match: '\\$[a-zA-Z_][a-zA-Z0-9_]*' }] }, - strings: { patterns: [{ name: 'string.quoted.double.nginx', begin: '"', end: '"' }, { name: 'string.quoted.single.nginx', begin: "'", end: "'" }] }, + strings: { patterns: [{ name: 'string.quoted.double.nginx', begin: '"', end: '"' }, { name: 'string.quoted.single.nginx', begin: '\'', end: '\'' }] }, }, } diff --git a/packages/ts-syntax-highlighter/src/grammars/php.ts b/packages/ts-syntax-highlighter/src/grammars/php.ts index 3ed093a..7d6f2bf 100644 --- a/packages/ts-syntax-highlighter/src/grammars/php.ts +++ b/packages/ts-syntax-highlighter/src/grammars/php.ts @@ -101,11 +101,11 @@ export const phpGrammar: Grammar = { name: 'meta.embedded.block.php', begin: '<\\?(?:php|=)?', beginCaptures: { - '0': { name: 'punctuation.section.embedded.begin.php' }, + 0: { name: 'punctuation.section.embedded.begin.php' }, }, end: '\\?>', endCaptures: { - '0': { name: 'punctuation.section.embedded.end.php' }, + 0: { name: 'punctuation.section.embedded.end.php' }, }, patterns: [ { include: '#comments' }, @@ -120,7 +120,7 @@ export const phpGrammar: Grammar = { }, ], }, - comments: { + 'comments': { patterns: [ { name: 'comment.line.double-slash.php', @@ -137,7 +137,7 @@ export const phpGrammar: Grammar = { }, ], }, - strings: { + 'strings': { patterns: [ { name: 'string.quoted.double.php', @@ -164,18 +164,18 @@ export const phpGrammar: Grammar = { }, { name: 'string.quoted.single.php', - begin: "'", - end: "'", + begin: '\'', + end: '\'', patterns: [ { name: 'constant.character.escape.php', - match: "\\\\['\\\\]", + match: '\\\\[\'\\\\]', }, ], }, ], }, - heredoc: { + 'heredoc': { patterns: [ { name: 'string.unquoted.heredoc.php', @@ -190,7 +190,7 @@ export const phpGrammar: Grammar = { }, ], }, - keywords: { + 'keywords': { patterns: [ { name: 'keyword.control.php', @@ -218,7 +218,7 @@ export const phpGrammar: Grammar = { }, ], }, - variables: { + 'variables': { patterns: [ { name: 'variable.language.php', @@ -230,7 +230,7 @@ export const phpGrammar: Grammar = { }, ], }, - functions: { + 'functions': { patterns: [ { name: 'entity.name.function.php', @@ -238,7 +238,7 @@ export const phpGrammar: Grammar = { }, ], }, - numbers: { + 'numbers': { patterns: [ { name: 'constant.numeric.php', @@ -246,7 +246,7 @@ export const phpGrammar: Grammar = { }, ], }, - operators: { + 'operators': { patterns: [ { name: 'keyword.operator.php', diff --git a/packages/ts-syntax-highlighter/src/grammars/powershell.ts b/packages/ts-syntax-highlighter/src/grammars/powershell.ts index a46c01a..0769f93 100644 --- a/packages/ts-syntax-highlighter/src/grammars/powershell.ts +++ b/packages/ts-syntax-highlighter/src/grammars/powershell.ts @@ -4,20 +4,36 @@ export const powershellGrammar: Grammar = { name: 'PowerShell', scopeName: 'source.powershell', keywords: { - 'if': 'keyword.control.powershell', 'else': 'keyword.control.powershell', 'elseif': 'keyword.control.powershell', - 'switch': 'keyword.control.powershell', 'for': 'keyword.control.powershell', 'foreach': 'keyword.control.powershell', - 'while': 'keyword.control.powershell', 'do': 'keyword.control.powershell', 'until': 'keyword.control.powershell', - 'break': 'keyword.control.powershell', 'continue': 'keyword.control.powershell', 'return': 'keyword.control.powershell', - 'function': 'storage.type.powershell', 'filter': 'storage.type.powershell', 'param': 'storage.type.powershell', - 'begin': 'keyword.control.powershell', 'process': 'keyword.control.powershell', 'end': 'keyword.control.powershell', - 'try': 'keyword.control.powershell', 'catch': 'keyword.control.powershell', 'finally': 'keyword.control.powershell', - 'throw': 'keyword.control.powershell', '$true': 'constant.language.powershell', '$false': 'constant.language.powershell', - '$null': 'constant.language.powershell', + if: 'keyword.control.powershell', + else: 'keyword.control.powershell', + elseif: 'keyword.control.powershell', + switch: 'keyword.control.powershell', + for: 'keyword.control.powershell', + foreach: 'keyword.control.powershell', + while: 'keyword.control.powershell', + do: 'keyword.control.powershell', + until: 'keyword.control.powershell', + break: 'keyword.control.powershell', + continue: 'keyword.control.powershell', + return: 'keyword.control.powershell', + function: 'storage.type.powershell', + filter: 'storage.type.powershell', + param: 'storage.type.powershell', + begin: 'keyword.control.powershell', + process: 'keyword.control.powershell', + end: 'keyword.control.powershell', + try: 'keyword.control.powershell', + catch: 'keyword.control.powershell', + finally: 'keyword.control.powershell', + throw: 'keyword.control.powershell', + $true: 'constant.language.powershell', + $false: 'constant.language.powershell', + $null: 'constant.language.powershell', }, patterns: [{ include: '#comments' }, { include: '#strings' }, { include: '#variables' }, { include: '#keywords' }, { include: '#cmdlets' }], repository: { comments: { patterns: [{ name: 'comment.line.number-sign.powershell', match: '#.*$' }, { name: 'comment.block.powershell', begin: '<#', end: '#>' }] }, - strings: { patterns: [{ name: 'string.quoted.double.powershell', begin: '"', end: '"', patterns: [{ name: 'variable.other.powershell', match: '\\$[a-zA-Z_][a-zA-Z0-9_]*' }] }, { name: 'string.quoted.single.powershell', begin: "'", end: "'" }] }, + strings: { patterns: [{ name: 'string.quoted.double.powershell', begin: '"', end: '"', patterns: [{ name: 'variable.other.powershell', match: '\\$[a-zA-Z_][a-zA-Z0-9_]*' }] }, { name: 'string.quoted.single.powershell', begin: '\'', end: '\'' }] }, variables: { patterns: [{ name: 'variable.other.powershell', match: '\\$[a-zA-Z_][a-zA-Z0-9_]*' }] }, keywords: { patterns: [{ name: 'keyword.control.powershell', match: '\\b(if|else|elseif|switch|for|foreach|while|do|until|break|continue|return|begin|process|end|try|catch|finally|throw)\\b' }, { name: 'storage.type.powershell', match: '\\b(function|filter|param)\\b' }, { name: 'constant.language.powershell', match: '\\$(?:true|false|null)\\b' }] }, cmdlets: { patterns: [{ name: 'support.function.powershell', match: '\\b[A-Z][a-z]+-[A-Z][a-z]+[a-zA-Z]*\\b' }] }, diff --git a/packages/ts-syntax-highlighter/src/grammars/protobuf.ts b/packages/ts-syntax-highlighter/src/grammars/protobuf.ts index 8ef1541..c6a7179 100644 --- a/packages/ts-syntax-highlighter/src/grammars/protobuf.ts +++ b/packages/ts-syntax-highlighter/src/grammars/protobuf.ts @@ -4,10 +4,20 @@ export const protobufGrammar: Grammar = { name: 'Protocol Buffers', scopeName: 'source.proto', keywords: { - 'syntax': 'keyword.other.proto', 'package': 'keyword.other.proto', 'import': 'keyword.other.proto', 'option': 'keyword.other.proto', - 'message': 'keyword.other.proto', 'enum': 'keyword.other.proto', 'service': 'keyword.other.proto', 'rpc': 'keyword.other.proto', - 'returns': 'keyword.other.proto', 'repeated': 'storage.modifier.proto', 'optional': 'storage.modifier.proto', - 'required': 'storage.modifier.proto', 'true': 'constant.language.proto', 'false': 'constant.language.proto', + syntax: 'keyword.other.proto', + package: 'keyword.other.proto', + import: 'keyword.other.proto', + option: 'keyword.other.proto', + message: 'keyword.other.proto', + enum: 'keyword.other.proto', + service: 'keyword.other.proto', + rpc: 'keyword.other.proto', + returns: 'keyword.other.proto', + repeated: 'storage.modifier.proto', + optional: 'storage.modifier.proto', + required: 'storage.modifier.proto', + true: 'constant.language.proto', + false: 'constant.language.proto', }, patterns: [{ include: '#comments' }, { include: '#strings' }, { include: '#keywords' }, { include: '#numbers' }], repository: { diff --git a/packages/ts-syntax-highlighter/src/grammars/python.ts b/packages/ts-syntax-highlighter/src/grammars/python.ts index 323556d..04eb3dc 100644 --- a/packages/ts-syntax-highlighter/src/grammars/python.ts +++ b/packages/ts-syntax-highlighter/src/grammars/python.ts @@ -5,57 +5,57 @@ export const pythonGrammar: Grammar = { scopeName: 'source.python', keywords: { // Control flow - 'if': 'keyword.control.python', - 'elif': 'keyword.control.python', - 'else': 'keyword.control.python', - 'for': 'keyword.control.python', - 'while': 'keyword.control.python', - 'break': 'keyword.control.python', - 'continue': 'keyword.control.python', - 'return': 'keyword.control.python', - 'yield': 'keyword.control.python', - 'try': 'keyword.control.python', - 'except': 'keyword.control.python', - 'finally': 'keyword.control.python', - 'raise': 'keyword.control.python', - 'with': 'keyword.control.python', - 'as': 'keyword.control.python', - 'pass': 'keyword.control.python', - 'match': 'keyword.control.python', - 'case': 'keyword.control.python', + if: 'keyword.control.python', + elif: 'keyword.control.python', + else: 'keyword.control.python', + for: 'keyword.control.python', + while: 'keyword.control.python', + break: 'keyword.control.python', + continue: 'keyword.control.python', + return: 'keyword.control.python', + yield: 'keyword.control.python', + try: 'keyword.control.python', + except: 'keyword.control.python', + finally: 'keyword.control.python', + raise: 'keyword.control.python', + with: 'keyword.control.python', + as: 'keyword.control.python', + pass: 'keyword.control.python', + match: 'keyword.control.python', + case: 'keyword.control.python', // Storage - 'def': 'storage.type.function.python', - 'class': 'storage.type.class.python', - 'lambda': 'storage.type.function.python', - 'async': 'storage.modifier.async.python', - 'await': 'keyword.control.python', + def: 'storage.type.function.python', + class: 'storage.type.class.python', + lambda: 'storage.type.function.python', + async: 'storage.modifier.async.python', + await: 'keyword.control.python', // Operators - 'and': 'keyword.operator.logical.python', - 'or': 'keyword.operator.logical.python', - 'not': 'keyword.operator.logical.python', - 'in': 'keyword.operator.python', - 'is': 'keyword.operator.python', + and: 'keyword.operator.logical.python', + or: 'keyword.operator.logical.python', + not: 'keyword.operator.logical.python', + in: 'keyword.operator.python', + is: 'keyword.operator.python', // Import - 'import': 'keyword.control.import.python', - 'from': 'keyword.control.import.python', + import: 'keyword.control.import.python', + from: 'keyword.control.import.python', // Constants - 'True': 'constant.language.python', - 'False': 'constant.language.python', - 'None': 'constant.language.python', - 'self': 'variable.language.python', - 'cls': 'variable.language.python', + True: 'constant.language.python', + False: 'constant.language.python', + None: 'constant.language.python', + self: 'variable.language.python', + cls: 'variable.language.python', // Built-ins - 'print': 'support.function.builtin.python', - 'len': 'support.function.builtin.python', - 'range': 'support.function.builtin.python', - 'str': 'support.function.builtin.python', - 'int': 'support.function.builtin.python', - 'float': 'support.function.builtin.python', - 'list': 'support.function.builtin.python', - 'dict': 'support.function.builtin.python', - 'tuple': 'support.function.builtin.python', - 'set': 'support.function.builtin.python', - 'bool': 'support.function.builtin.python', + print: 'support.function.builtin.python', + len: 'support.function.builtin.python', + range: 'support.function.builtin.python', + str: 'support.function.builtin.python', + int: 'support.function.builtin.python', + float: 'support.function.builtin.python', + list: 'support.function.builtin.python', + dict: 'support.function.builtin.python', + tuple: 'support.function.builtin.python', + set: 'support.function.builtin.python', + bool: 'support.function.builtin.python', }, patterns: [ { include: '#comments' }, @@ -84,8 +84,8 @@ export const pythonGrammar: Grammar = { }, { name: 'string.quoted.docstring.python', - begin: "'''", - end: "'''", + begin: '\'\'\'', + end: '\'\'\'', }, { name: 'string.quoted.double.python', @@ -116,8 +116,8 @@ export const pythonGrammar: Grammar = { }, { name: 'string.quoted.single.python', - begin: "'", - end: "'", + begin: '\'', + end: '\'', patterns: [ { name: 'constant.character.escape.python', diff --git a/packages/ts-syntax-highlighter/src/grammars/r.ts b/packages/ts-syntax-highlighter/src/grammars/r.ts index b7cc654..65aec0a 100644 --- a/packages/ts-syntax-highlighter/src/grammars/r.ts +++ b/packages/ts-syntax-highlighter/src/grammars/r.ts @@ -4,15 +4,27 @@ export const rGrammar: Grammar = { name: 'R', scopeName: 'source.r', keywords: { - 'if': 'keyword.control.r', 'else': 'keyword.control.r', 'for': 'keyword.control.r', 'while': 'keyword.control.r', - 'repeat': 'keyword.control.r', 'break': 'keyword.control.r', 'next': 'keyword.control.r', 'return': 'keyword.control.r', - 'function': 'storage.type.r', 'in': 'keyword.operator.r', 'TRUE': 'constant.language.r', 'FALSE': 'constant.language.r', - 'NULL': 'constant.language.r', 'NA': 'constant.language.r', 'NaN': 'constant.language.r', 'Inf': 'constant.language.r', + if: 'keyword.control.r', + else: 'keyword.control.r', + for: 'keyword.control.r', + while: 'keyword.control.r', + repeat: 'keyword.control.r', + break: 'keyword.control.r', + next: 'keyword.control.r', + return: 'keyword.control.r', + function: 'storage.type.r', + in: 'keyword.operator.r', + TRUE: 'constant.language.r', + FALSE: 'constant.language.r', + NULL: 'constant.language.r', + NA: 'constant.language.r', + NaN: 'constant.language.r', + Inf: 'constant.language.r', }, patterns: [{ include: '#comments' }, { include: '#strings' }, { include: '#keywords' }, { include: '#numbers' }, { include: '#operators' }], repository: { comments: { patterns: [{ name: 'comment.line.number-sign.r', match: '#.*$' }] }, - strings: { patterns: [{ name: 'string.quoted.double.r', begin: '"', end: '"', patterns: [{ name: 'constant.character.escape.r', match: '\\\\.' }] }, { name: 'string.quoted.single.r', begin: "'", end: "'", patterns: [{ name: 'constant.character.escape.r', match: '\\\\.' }] }] }, + strings: { patterns: [{ name: 'string.quoted.double.r', begin: '"', end: '"', patterns: [{ name: 'constant.character.escape.r', match: '\\\\.' }] }, { name: 'string.quoted.single.r', begin: '\'', end: '\'', patterns: [{ name: 'constant.character.escape.r', match: '\\\\.' }] }] }, keywords: { patterns: [{ name: 'keyword.control.r', match: '\\b(if|else|for|while|repeat|break|next|return|in)\\b' }, { name: 'storage.type.r', match: '\\b(function)\\b' }, { name: 'constant.language.r', match: '\\b(TRUE|FALSE|NULL|NA|NaN|Inf)\\b' }] }, numbers: { patterns: [{ name: 'constant.numeric.r', match: '\\b\\d+\\.?\\d*(?:[eE][+-]?\\d+)?[iL]?\\b' }] }, operators: { patterns: [{ name: 'keyword.operator.r', match: '(<-|<<-|->|->>|==|!=|<=|>=|<|>|&&|\\|\\||!|&|\\||%[a-zA-Z]+%|\\+|\\-|\\*|/|\\^|%%|%/%|::|:::)' }] }, diff --git a/packages/ts-syntax-highlighter/src/grammars/regexp.ts b/packages/ts-syntax-highlighter/src/grammars/regexp.ts index 078b45f..3b355fc 100644 --- a/packages/ts-syntax-highlighter/src/grammars/regexp.ts +++ b/packages/ts-syntax-highlighter/src/grammars/regexp.ts @@ -7,8 +7,8 @@ export const regexpGrammar: Grammar = { patterns: [{ include: '#character-class' }, { include: '#groups' }, { include: '#quantifiers' }, { include: '#anchors' }], repository: { 'character-class': { patterns: [{ name: 'constant.character.character-class.regexp', begin: '\\[', end: '\\]', patterns: [{ name: 'constant.character.escape.regexp', match: '\\\\.' }] }] }, - groups: { patterns: [{ name: 'meta.group.regexp', begin: '\\(', end: '\\)', patterns: [{ include: '$self' }] }] }, - quantifiers: { patterns: [{ name: 'keyword.operator.quantifier.regexp', match: '[*+?]|\\{\\d+(,\\d*)?\\}' }] }, - anchors: { patterns: [{ name: 'keyword.operator.anchor.regexp', match: '\\^|\\$' }] }, + 'groups': { patterns: [{ name: 'meta.group.regexp', begin: '\\(', end: '\\)', patterns: [{ include: '$self' }] }] }, + 'quantifiers': { patterns: [{ name: 'keyword.operator.quantifier.regexp', match: '[*+?]|\\{\\d+(,\\d*)?\\}' }] }, + 'anchors': { patterns: [{ name: 'keyword.operator.anchor.regexp', match: '\\^|\\$' }] }, }, } diff --git a/packages/ts-syntax-highlighter/src/grammars/ruby.ts b/packages/ts-syntax-highlighter/src/grammars/ruby.ts index cd36c9f..4ddd065 100644 --- a/packages/ts-syntax-highlighter/src/grammars/ruby.ts +++ b/packages/ts-syntax-highlighter/src/grammars/ruby.ts @@ -102,12 +102,12 @@ export const rubyGrammar: Grammar = { }, { name: 'string.quoted.single.ruby', - begin: "'", - end: "'", + begin: '\'', + end: '\'', patterns: [ { name: 'constant.character.escape.ruby', - match: "\\\\['\\\\]", + match: '\\\\[\'\\\\]', }, ], }, diff --git a/packages/ts-syntax-highlighter/src/grammars/rust.ts b/packages/ts-syntax-highlighter/src/grammars/rust.ts index 76e27c7..fbf1f97 100644 --- a/packages/ts-syntax-highlighter/src/grammars/rust.ts +++ b/packages/ts-syntax-highlighter/src/grammars/rust.ts @@ -5,67 +5,67 @@ export const rustGrammar: Grammar = { scopeName: 'source.rust', keywords: { // Control flow - 'if': 'keyword.control.rust', - 'else': 'keyword.control.rust', - 'for': 'keyword.control.rust', - 'while': 'keyword.control.rust', - 'loop': 'keyword.control.rust', - 'match': 'keyword.control.rust', - 'return': 'keyword.control.rust', - 'break': 'keyword.control.rust', - 'continue': 'keyword.control.rust', - 'yield': 'keyword.control.rust', + if: 'keyword.control.rust', + else: 'keyword.control.rust', + for: 'keyword.control.rust', + while: 'keyword.control.rust', + loop: 'keyword.control.rust', + match: 'keyword.control.rust', + return: 'keyword.control.rust', + break: 'keyword.control.rust', + continue: 'keyword.control.rust', + yield: 'keyword.control.rust', // Declaration - 'fn': 'keyword.other.fn.rust', - 'let': 'keyword.other.rust', - 'struct': 'keyword.other.rust', - 'enum': 'keyword.other.rust', - 'trait': 'keyword.other.rust', - 'impl': 'keyword.other.rust', - 'type': 'keyword.other.rust', - 'mod': 'keyword.other.rust', - 'use': 'keyword.other.rust', - 'const': 'keyword.other.rust', - 'static': 'keyword.other.rust', + fn: 'keyword.other.fn.rust', + let: 'keyword.other.rust', + struct: 'keyword.other.rust', + enum: 'keyword.other.rust', + trait: 'keyword.other.rust', + impl: 'keyword.other.rust', + type: 'keyword.other.rust', + mod: 'keyword.other.rust', + use: 'keyword.other.rust', + const: 'keyword.other.rust', + static: 'keyword.other.rust', // Modifiers - 'pub': 'storage.modifier.rust', - 'mut': 'storage.modifier.rust', - 'ref': 'storage.modifier.rust', - 'unsafe': 'storage.modifier.rust', - 'async': 'storage.modifier.rust', - 'await': 'keyword.control.rust', - 'move': 'storage.modifier.rust', + pub: 'storage.modifier.rust', + mut: 'storage.modifier.rust', + ref: 'storage.modifier.rust', + unsafe: 'storage.modifier.rust', + async: 'storage.modifier.rust', + await: 'keyword.control.rust', + move: 'storage.modifier.rust', // Types - 'i8': 'storage.type.rust', - 'i16': 'storage.type.rust', - 'i32': 'storage.type.rust', - 'i64': 'storage.type.rust', - 'i128': 'storage.type.rust', - 'isize': 'storage.type.rust', - 'u8': 'storage.type.rust', - 'u16': 'storage.type.rust', - 'u32': 'storage.type.rust', - 'u64': 'storage.type.rust', - 'u128': 'storage.type.rust', - 'usize': 'storage.type.rust', - 'f32': 'storage.type.rust', - 'f64': 'storage.type.rust', - 'bool': 'storage.type.rust', - 'char': 'storage.type.rust', - 'str': 'storage.type.rust', - 'Self': 'storage.type.rust', + i8: 'storage.type.rust', + i16: 'storage.type.rust', + i32: 'storage.type.rust', + i64: 'storage.type.rust', + i128: 'storage.type.rust', + isize: 'storage.type.rust', + u8: 'storage.type.rust', + u16: 'storage.type.rust', + u32: 'storage.type.rust', + u64: 'storage.type.rust', + u128: 'storage.type.rust', + usize: 'storage.type.rust', + f32: 'storage.type.rust', + f64: 'storage.type.rust', + bool: 'storage.type.rust', + char: 'storage.type.rust', + str: 'storage.type.rust', + Self: 'storage.type.rust', // Constants - 'true': 'constant.language.rust', - 'false': 'constant.language.rust', - 'self': 'variable.language.rust', - 'super': 'variable.language.rust', - 'crate': 'variable.language.rust', + true: 'constant.language.rust', + false: 'constant.language.rust', + self: 'variable.language.rust', + super: 'variable.language.rust', + crate: 'variable.language.rust', // Other - 'where': 'keyword.other.rust', - 'as': 'keyword.other.rust', - 'in': 'keyword.other.rust', - 'extern': 'keyword.other.rust', - 'dyn': 'keyword.other.rust', + where: 'keyword.other.rust', + as: 'keyword.other.rust', + in: 'keyword.other.rust', + extern: 'keyword.other.rust', + dyn: 'keyword.other.rust', }, patterns: [ { include: '#comments' }, @@ -136,8 +136,8 @@ export const rustGrammar: Grammar = { }, { name: 'string.quoted.single.rust', - begin: "'", - end: "'", + begin: '\'', + end: '\'', patterns: [ { name: 'constant.character.escape.rust', @@ -151,7 +151,7 @@ export const rustGrammar: Grammar = { patterns: [ { name: 'entity.name.lifetime.rust', - match: "'[a-zA-Z_][a-zA-Z0-9_]*\\b", + match: '\'[a-zA-Z_][a-zA-Z0-9_]*\\b', }, ], }, diff --git a/packages/ts-syntax-highlighter/src/grammars/scss.ts b/packages/ts-syntax-highlighter/src/grammars/scss.ts index 3bf2d38..f075aa4 100644 --- a/packages/ts-syntax-highlighter/src/grammars/scss.ts +++ b/packages/ts-syntax-highlighter/src/grammars/scss.ts @@ -29,7 +29,7 @@ export const scssGrammar: Grammar = { { include: '#properties' }, ], repository: { - comments: { + 'comments': { patterns: [ { name: 'comment.line.double-slash.scss', match: '\\/\\/.*$' }, { name: 'comment.block.scss', begin: '\\/\\*', end: '\\*\\/' }, @@ -40,25 +40,25 @@ export const scssGrammar: Grammar = { { name: 'keyword.control.at-rule.scss', match: '@[a-z-]+' }, ], }, - variables: { + 'variables': { patterns: [ { name: 'variable.scss', match: '\\$[a-zA-Z_-][a-zA-Z0-9_-]*' }, ], }, - strings: { + 'strings': { patterns: [ { name: 'string.quoted.double.scss', begin: '"', end: '"' }, - { name: 'string.quoted.single.scss', begin: "'", end: "'" }, + { name: 'string.quoted.single.scss', begin: '\'', end: '\'' }, ], }, - selectors: { + 'selectors': { patterns: [ { name: 'entity.name.tag.scss', match: '\\b[a-z][a-z0-9-]*\\b' }, { name: 'entity.other.attribute-name.class.scss', match: '\\.[a-zA-Z_-][a-zA-Z0-9_-]*' }, { name: 'entity.other.attribute-name.id.scss', match: '#[a-zA-Z_-][a-zA-Z0-9_-]*' }, ], }, - properties: { + 'properties': { patterns: [ { name: 'support.type.property-name.scss', match: '\\b[a-z-]+(?=\\s*:)' }, ], diff --git a/packages/ts-syntax-highlighter/src/grammars/solidity.ts b/packages/ts-syntax-highlighter/src/grammars/solidity.ts index 0f24e40..5d0c7bd 100644 --- a/packages/ts-syntax-highlighter/src/grammars/solidity.ts +++ b/packages/ts-syntax-highlighter/src/grammars/solidity.ts @@ -4,15 +4,33 @@ export const solidityGrammar: Grammar = { name: 'Solidity', scopeName: 'source.solidity', keywords: { - 'pragma': 'keyword.other.solidity', 'import': 'keyword.other.solidity', 'contract': 'keyword.other.solidity', - 'interface': 'keyword.other.solidity', 'library': 'keyword.other.solidity', 'function': 'keyword.other.solidity', - 'modifier': 'keyword.other.solidity', 'event': 'keyword.other.solidity', 'struct': 'keyword.other.solidity', - 'enum': 'keyword.other.solidity', 'if': 'keyword.control.solidity', 'else': 'keyword.control.solidity', - 'for': 'keyword.control.solidity', 'while': 'keyword.control.solidity', 'do': 'keyword.control.solidity', - 'return': 'keyword.control.solidity', 'break': 'keyword.control.solidity', 'continue': 'keyword.control.solidity', - 'public': 'storage.modifier.solidity', 'private': 'storage.modifier.solidity', 'internal': 'storage.modifier.solidity', - 'external': 'storage.modifier.solidity', 'pure': 'storage.modifier.solidity', 'view': 'storage.modifier.solidity', - 'payable': 'storage.modifier.solidity', 'true': 'constant.language.solidity', 'false': 'constant.language.solidity', + pragma: 'keyword.other.solidity', + import: 'keyword.other.solidity', + contract: 'keyword.other.solidity', + interface: 'keyword.other.solidity', + library: 'keyword.other.solidity', + function: 'keyword.other.solidity', + modifier: 'keyword.other.solidity', + event: 'keyword.other.solidity', + struct: 'keyword.other.solidity', + enum: 'keyword.other.solidity', + if: 'keyword.control.solidity', + else: 'keyword.control.solidity', + for: 'keyword.control.solidity', + while: 'keyword.control.solidity', + do: 'keyword.control.solidity', + return: 'keyword.control.solidity', + break: 'keyword.control.solidity', + continue: 'keyword.control.solidity', + public: 'storage.modifier.solidity', + private: 'storage.modifier.solidity', + internal: 'storage.modifier.solidity', + external: 'storage.modifier.solidity', + pure: 'storage.modifier.solidity', + view: 'storage.modifier.solidity', + payable: 'storage.modifier.solidity', + true: 'constant.language.solidity', + false: 'constant.language.solidity', }, patterns: [{ include: '#comments' }, { include: '#strings' }, { include: '#keywords' }, { include: '#numbers' }], repository: { diff --git a/packages/ts-syntax-highlighter/src/grammars/sql.ts b/packages/ts-syntax-highlighter/src/grammars/sql.ts index 55bad3f..4bec643 100644 --- a/packages/ts-syntax-highlighter/src/grammars/sql.ts +++ b/packages/ts-syntax-highlighter/src/grammars/sql.ts @@ -5,109 +5,109 @@ export const sqlGrammar: Grammar = { scopeName: 'source.sql', keywords: { // DML - 'SELECT': 'keyword.other.dml.sql', - 'INSERT': 'keyword.other.dml.sql', - 'UPDATE': 'keyword.other.dml.sql', - 'DELETE': 'keyword.other.dml.sql', - 'MERGE': 'keyword.other.dml.sql', + SELECT: 'keyword.other.dml.sql', + INSERT: 'keyword.other.dml.sql', + UPDATE: 'keyword.other.dml.sql', + DELETE: 'keyword.other.dml.sql', + MERGE: 'keyword.other.dml.sql', // DDL - 'CREATE': 'keyword.other.ddl.sql', - 'ALTER': 'keyword.other.ddl.sql', - 'DROP': 'keyword.other.ddl.sql', - 'TRUNCATE': 'keyword.other.ddl.sql', - 'RENAME': 'keyword.other.ddl.sql', + CREATE: 'keyword.other.ddl.sql', + ALTER: 'keyword.other.ddl.sql', + DROP: 'keyword.other.ddl.sql', + TRUNCATE: 'keyword.other.ddl.sql', + RENAME: 'keyword.other.ddl.sql', // Clauses - 'FROM': 'keyword.other.sql', - 'WHERE': 'keyword.other.sql', - 'JOIN': 'keyword.other.sql', - 'INNER': 'keyword.other.sql', - 'LEFT': 'keyword.other.sql', - 'RIGHT': 'keyword.other.sql', - 'FULL': 'keyword.other.sql', - 'OUTER': 'keyword.other.sql', - 'CROSS': 'keyword.other.sql', - 'ON': 'keyword.other.sql', - 'USING': 'keyword.other.sql', - 'GROUP': 'keyword.other.sql', - 'BY': 'keyword.other.sql', - 'HAVING': 'keyword.other.sql', - 'ORDER': 'keyword.other.sql', - 'ASC': 'keyword.other.sql', - 'DESC': 'keyword.other.sql', - 'LIMIT': 'keyword.other.sql', - 'OFFSET': 'keyword.other.sql', - 'FETCH': 'keyword.other.sql', - 'DISTINCT': 'keyword.other.sql', - 'ALL': 'keyword.other.sql', - 'AS': 'keyword.other.sql', - 'INTO': 'keyword.other.sql', - 'VALUES': 'keyword.other.sql', - 'SET': 'keyword.other.sql', + FROM: 'keyword.other.sql', + WHERE: 'keyword.other.sql', + JOIN: 'keyword.other.sql', + INNER: 'keyword.other.sql', + LEFT: 'keyword.other.sql', + RIGHT: 'keyword.other.sql', + FULL: 'keyword.other.sql', + OUTER: 'keyword.other.sql', + CROSS: 'keyword.other.sql', + ON: 'keyword.other.sql', + USING: 'keyword.other.sql', + GROUP: 'keyword.other.sql', + BY: 'keyword.other.sql', + HAVING: 'keyword.other.sql', + ORDER: 'keyword.other.sql', + ASC: 'keyword.other.sql', + DESC: 'keyword.other.sql', + LIMIT: 'keyword.other.sql', + OFFSET: 'keyword.other.sql', + FETCH: 'keyword.other.sql', + DISTINCT: 'keyword.other.sql', + ALL: 'keyword.other.sql', + AS: 'keyword.other.sql', + INTO: 'keyword.other.sql', + VALUES: 'keyword.other.sql', + SET: 'keyword.other.sql', // Logical - 'AND': 'keyword.operator.logical.sql', - 'OR': 'keyword.operator.logical.sql', - 'NOT': 'keyword.operator.logical.sql', - 'IN': 'keyword.operator.logical.sql', - 'BETWEEN': 'keyword.operator.logical.sql', - 'LIKE': 'keyword.operator.logical.sql', - 'IS': 'keyword.operator.logical.sql', - 'NULL': 'constant.language.sql', - 'TRUE': 'constant.language.sql', - 'FALSE': 'constant.language.sql', + AND: 'keyword.operator.logical.sql', + OR: 'keyword.operator.logical.sql', + NOT: 'keyword.operator.logical.sql', + IN: 'keyword.operator.logical.sql', + BETWEEN: 'keyword.operator.logical.sql', + LIKE: 'keyword.operator.logical.sql', + IS: 'keyword.operator.logical.sql', + NULL: 'constant.language.sql', + TRUE: 'constant.language.sql', + FALSE: 'constant.language.sql', // Aggregate - 'COUNT': 'support.function.aggregate.sql', - 'SUM': 'support.function.aggregate.sql', - 'AVG': 'support.function.aggregate.sql', - 'MIN': 'support.function.aggregate.sql', - 'MAX': 'support.function.aggregate.sql', + COUNT: 'support.function.aggregate.sql', + SUM: 'support.function.aggregate.sql', + AVG: 'support.function.aggregate.sql', + MIN: 'support.function.aggregate.sql', + MAX: 'support.function.aggregate.sql', // Types - 'INT': 'storage.type.sql', - 'INTEGER': 'storage.type.sql', - 'BIGINT': 'storage.type.sql', - 'SMALLINT': 'storage.type.sql', - 'TINYINT': 'storage.type.sql', - 'DECIMAL': 'storage.type.sql', - 'NUMERIC': 'storage.type.sql', - 'FLOAT': 'storage.type.sql', - 'REAL': 'storage.type.sql', - 'DOUBLE': 'storage.type.sql', - 'VARCHAR': 'storage.type.sql', - 'CHAR': 'storage.type.sql', - 'TEXT': 'storage.type.sql', - 'DATE': 'storage.type.sql', - 'TIME': 'storage.type.sql', - 'TIMESTAMP': 'storage.type.sql', - 'DATETIME': 'storage.type.sql', - 'BOOLEAN': 'storage.type.sql', - 'BOOL': 'storage.type.sql', - 'BLOB': 'storage.type.sql', + INT: 'storage.type.sql', + INTEGER: 'storage.type.sql', + BIGINT: 'storage.type.sql', + SMALLINT: 'storage.type.sql', + TINYINT: 'storage.type.sql', + DECIMAL: 'storage.type.sql', + NUMERIC: 'storage.type.sql', + FLOAT: 'storage.type.sql', + REAL: 'storage.type.sql', + DOUBLE: 'storage.type.sql', + VARCHAR: 'storage.type.sql', + CHAR: 'storage.type.sql', + TEXT: 'storage.type.sql', + DATE: 'storage.type.sql', + TIME: 'storage.type.sql', + TIMESTAMP: 'storage.type.sql', + DATETIME: 'storage.type.sql', + BOOLEAN: 'storage.type.sql', + BOOL: 'storage.type.sql', + BLOB: 'storage.type.sql', // Constraints - 'PRIMARY': 'keyword.other.sql', - 'KEY': 'keyword.other.sql', - 'FOREIGN': 'keyword.other.sql', - 'REFERENCES': 'keyword.other.sql', - 'UNIQUE': 'keyword.other.sql', - 'CHECK': 'keyword.other.sql', - 'DEFAULT': 'keyword.other.sql', - 'AUTO_INCREMENT': 'keyword.other.sql', + PRIMARY: 'keyword.other.sql', + KEY: 'keyword.other.sql', + FOREIGN: 'keyword.other.sql', + REFERENCES: 'keyword.other.sql', + UNIQUE: 'keyword.other.sql', + CHECK: 'keyword.other.sql', + DEFAULT: 'keyword.other.sql', + AUTO_INCREMENT: 'keyword.other.sql', // Other - 'TABLE': 'keyword.other.sql', - 'VIEW': 'keyword.other.sql', - 'INDEX': 'keyword.other.sql', - 'DATABASE': 'keyword.other.sql', - 'SCHEMA': 'keyword.other.sql', - 'IF': 'keyword.control.sql', - 'EXISTS': 'keyword.other.sql', - 'CASCADE': 'keyword.other.sql', - 'CONSTRAINT': 'keyword.other.sql', - 'UNION': 'keyword.other.sql', - 'INTERSECT': 'keyword.other.sql', - 'EXCEPT': 'keyword.other.sql', - 'CASE': 'keyword.control.sql', - 'WHEN': 'keyword.control.sql', - 'THEN': 'keyword.control.sql', - 'ELSE': 'keyword.control.sql', - 'END': 'keyword.control.sql', + TABLE: 'keyword.other.sql', + VIEW: 'keyword.other.sql', + INDEX: 'keyword.other.sql', + DATABASE: 'keyword.other.sql', + SCHEMA: 'keyword.other.sql', + IF: 'keyword.control.sql', + EXISTS: 'keyword.other.sql', + CASCADE: 'keyword.other.sql', + CONSTRAINT: 'keyword.other.sql', + UNION: 'keyword.other.sql', + INTERSECT: 'keyword.other.sql', + EXCEPT: 'keyword.other.sql', + CASE: 'keyword.control.sql', + WHEN: 'keyword.control.sql', + THEN: 'keyword.control.sql', + ELSE: 'keyword.control.sql', + END: 'keyword.control.sql', }, patterns: [ { include: '#comments' }, @@ -138,12 +138,12 @@ export const sqlGrammar: Grammar = { patterns: [ { name: 'string.quoted.single.sql', - begin: "'", - end: "'", + begin: '\'', + end: '\'', patterns: [ { name: 'constant.character.escape.sql', - match: "''", + match: '\'\'', }, ], }, diff --git a/packages/ts-syntax-highlighter/src/grammars/swift.ts b/packages/ts-syntax-highlighter/src/grammars/swift.ts index ac94d7a..67d28c1 100644 --- a/packages/ts-syntax-highlighter/src/grammars/swift.ts +++ b/packages/ts-syntax-highlighter/src/grammars/swift.ts @@ -4,16 +4,42 @@ export const swiftGrammar: Grammar = { name: 'Swift', scopeName: 'source.swift', keywords: { - 'import': 'keyword.other.swift', 'class': 'keyword.other.swift', 'struct': 'keyword.other.swift', 'enum': 'keyword.other.swift', - 'protocol': 'keyword.other.swift', 'extension': 'keyword.other.swift', 'func': 'keyword.other.swift', 'var': 'keyword.other.swift', - 'let': 'keyword.other.swift', 'if': 'keyword.control.swift', 'else': 'keyword.control.swift', 'guard': 'keyword.control.swift', - 'for': 'keyword.control.swift', 'while': 'keyword.control.swift', 'repeat': 'keyword.control.swift', 'switch': 'keyword.control.swift', - 'case': 'keyword.control.swift', 'default': 'keyword.control.swift', 'return': 'keyword.control.swift', 'break': 'keyword.control.swift', - 'continue': 'keyword.control.swift', 'fallthrough': 'keyword.control.swift', 'defer': 'keyword.control.swift', 'in': 'keyword.control.swift', - 'public': 'storage.modifier.swift', 'private': 'storage.modifier.swift', 'fileprivate': 'storage.modifier.swift', - 'internal': 'storage.modifier.swift', 'open': 'storage.modifier.swift', 'static': 'storage.modifier.swift', 'final': 'storage.modifier.swift', - 'true': 'constant.language.swift', 'false': 'constant.language.swift', 'nil': 'constant.language.swift', - 'self': 'variable.language.swift', 'Self': 'variable.language.swift', + import: 'keyword.other.swift', + class: 'keyword.other.swift', + struct: 'keyword.other.swift', + enum: 'keyword.other.swift', + protocol: 'keyword.other.swift', + extension: 'keyword.other.swift', + func: 'keyword.other.swift', + var: 'keyword.other.swift', + let: 'keyword.other.swift', + if: 'keyword.control.swift', + else: 'keyword.control.swift', + guard: 'keyword.control.swift', + for: 'keyword.control.swift', + while: 'keyword.control.swift', + repeat: 'keyword.control.swift', + switch: 'keyword.control.swift', + case: 'keyword.control.swift', + default: 'keyword.control.swift', + return: 'keyword.control.swift', + break: 'keyword.control.swift', + continue: 'keyword.control.swift', + fallthrough: 'keyword.control.swift', + defer: 'keyword.control.swift', + in: 'keyword.control.swift', + public: 'storage.modifier.swift', + private: 'storage.modifier.swift', + fileprivate: 'storage.modifier.swift', + internal: 'storage.modifier.swift', + open: 'storage.modifier.swift', + static: 'storage.modifier.swift', + final: 'storage.modifier.swift', + true: 'constant.language.swift', + false: 'constant.language.swift', + nil: 'constant.language.swift', + self: 'variable.language.swift', + Self: 'variable.language.swift', }, patterns: [{ include: '#comments' }, { include: '#strings' }, { include: '#keywords' }, { include: '#numbers' }], repository: { diff --git a/packages/ts-syntax-highlighter/src/grammars/terraform.ts b/packages/ts-syntax-highlighter/src/grammars/terraform.ts index e069c03..cb801a7 100644 --- a/packages/ts-syntax-highlighter/src/grammars/terraform.ts +++ b/packages/ts-syntax-highlighter/src/grammars/terraform.ts @@ -4,11 +4,21 @@ export const terraformGrammar: Grammar = { name: 'Terraform', scopeName: 'source.terraform', keywords: { - 'resource': 'keyword.other.terraform', 'data': 'keyword.other.terraform', 'variable': 'keyword.other.terraform', - 'output': 'keyword.other.terraform', 'locals': 'keyword.other.terraform', 'module': 'keyword.other.terraform', - 'provider': 'keyword.other.terraform', 'terraform': 'keyword.other.terraform', 'for': 'keyword.control.terraform', - 'if': 'keyword.control.terraform', 'else': 'keyword.control.terraform', 'in': 'keyword.control.terraform', - 'true': 'constant.language.terraform', 'false': 'constant.language.terraform', 'null': 'constant.language.terraform', + resource: 'keyword.other.terraform', + data: 'keyword.other.terraform', + variable: 'keyword.other.terraform', + output: 'keyword.other.terraform', + locals: 'keyword.other.terraform', + module: 'keyword.other.terraform', + provider: 'keyword.other.terraform', + terraform: 'keyword.other.terraform', + for: 'keyword.control.terraform', + if: 'keyword.control.terraform', + else: 'keyword.control.terraform', + in: 'keyword.control.terraform', + true: 'constant.language.terraform', + false: 'constant.language.terraform', + null: 'constant.language.terraform', }, patterns: [{ include: '#comments' }, { include: '#strings' }, { include: '#keywords' }, { include: '#blocks' }], repository: { diff --git a/packages/ts-syntax-highlighter/src/grammars/toml.ts b/packages/ts-syntax-highlighter/src/grammars/toml.ts index 2cc9dc9..9e4b3a3 100644 --- a/packages/ts-syntax-highlighter/src/grammars/toml.ts +++ b/packages/ts-syntax-highlighter/src/grammars/toml.ts @@ -4,8 +4,8 @@ export const tomlGrammar: Grammar = { name: 'TOML', scopeName: 'source.toml', keywords: { - 'true': 'constant.language.toml', - 'false': 'constant.language.toml', + true: 'constant.language.toml', + false: 'constant.language.toml', }, patterns: [ { include: '#comments' }, @@ -35,9 +35,9 @@ export const tomlGrammar: Grammar = { strings: { patterns: [ { name: 'string.quoted.triple.toml', begin: '"""', end: '"""' }, - { name: 'string.quoted.triple.toml', begin: "'''", end: "'''" }, + { name: 'string.quoted.triple.toml', begin: '\'\'\'', end: '\'\'\'' }, { name: 'string.quoted.double.toml', begin: '"', end: '"', patterns: [{ name: 'constant.character.escape.toml', match: '\\\\.' }] }, - { name: 'string.quoted.single.toml', begin: "'", end: "'" }, + { name: 'string.quoted.single.toml', begin: '\'', end: '\'' }, ], }, numbers: { diff --git a/packages/ts-syntax-highlighter/src/grammars/xml.ts b/packages/ts-syntax-highlighter/src/grammars/xml.ts index d8b1697..b3425f6 100644 --- a/packages/ts-syntax-highlighter/src/grammars/xml.ts +++ b/packages/ts-syntax-highlighter/src/grammars/xml.ts @@ -7,8 +7,8 @@ export const xmlGrammar: Grammar = { patterns: [{ include: '#comments' }, { include: '#tags' }, { include: '#cdata' }], repository: { comments: { patterns: [{ name: 'comment.block.xml', begin: '' }] }, - tags: { patterns: [{ name: 'meta.tag.xml', begin: '', patterns: [{ name: 'entity.other.attribute-name.xml', match: '[a-zA-Z_:][a-zA-Z0-9_:.-]*(?==)' }, { include: '#strings' }] }] }, - strings: { patterns: [{ name: 'string.quoted.double.xml', begin: '"', end: '"' }, { name: 'string.quoted.single.xml', begin: "'", end: "'" }] }, + tags: { patterns: [{ name: 'meta.tag.xml', begin: '', patterns: [{ name: 'entity.other.attribute-name.xml', match: '[a-zA-Z_:][a-zA-Z0-9_:.-]*(?==)' }, { include: '#strings' }] }] }, + strings: { patterns: [{ name: 'string.quoted.double.xml', begin: '"', end: '"' }, { name: 'string.quoted.single.xml', begin: '\'', end: '\'' }] }, cdata: { patterns: [{ name: 'string.unquoted.cdata.xml', begin: '' }] }, }, } diff --git a/packages/ts-syntax-highlighter/src/grammars/yaml.ts b/packages/ts-syntax-highlighter/src/grammars/yaml.ts index 42f84c5..1beac82 100644 --- a/packages/ts-syntax-highlighter/src/grammars/yaml.ts +++ b/packages/ts-syntax-highlighter/src/grammars/yaml.ts @@ -4,21 +4,21 @@ export const yamlGrammar: Grammar = { name: 'YAML', scopeName: 'source.yaml', keywords: { - 'true': 'constant.language.boolean.yaml', - 'false': 'constant.language.boolean.yaml', - 'null': 'constant.language.null.yaml', - 'True': 'constant.language.boolean.yaml', - 'False': 'constant.language.boolean.yaml', - 'TRUE': 'constant.language.boolean.yaml', - 'FALSE': 'constant.language.boolean.yaml', - 'yes': 'constant.language.boolean.yaml', - 'no': 'constant.language.boolean.yaml', - 'Yes': 'constant.language.boolean.yaml', - 'No': 'constant.language.boolean.yaml', - 'YES': 'constant.language.boolean.yaml', - 'NO': 'constant.language.boolean.yaml', - 'on': 'constant.language.boolean.yaml', - 'off': 'constant.language.boolean.yaml', + true: 'constant.language.boolean.yaml', + false: 'constant.language.boolean.yaml', + null: 'constant.language.null.yaml', + True: 'constant.language.boolean.yaml', + False: 'constant.language.boolean.yaml', + TRUE: 'constant.language.boolean.yaml', + FALSE: 'constant.language.boolean.yaml', + yes: 'constant.language.boolean.yaml', + no: 'constant.language.boolean.yaml', + Yes: 'constant.language.boolean.yaml', + No: 'constant.language.boolean.yaml', + YES: 'constant.language.boolean.yaml', + NO: 'constant.language.boolean.yaml', + on: 'constant.language.boolean.yaml', + off: 'constant.language.boolean.yaml', }, patterns: [ { include: '#comments' }, @@ -31,7 +31,7 @@ export const yamlGrammar: Grammar = { { include: '#tags' }, ], repository: { - comments: { + 'comments': { patterns: [ { name: 'comment.line.number-sign.yaml', @@ -51,25 +51,25 @@ export const yamlGrammar: Grammar = { }, ], }, - keys: { + 'keys': { patterns: [ { name: 'meta.key.yaml', match: '([a-zA-Z0-9_-]+)\\s*:', captures: { - '1': { name: 'entity.name.tag.yaml' }, + 1: { name: 'entity.name.tag.yaml' }, }, }, { name: 'string.quoted.yaml', match: '(["\'])([a-zA-Z0-9_-]+)\\1\\s*:', captures: { - '2': { name: 'entity.name.tag.yaml' }, + 2: { name: 'entity.name.tag.yaml' }, }, }, ], }, - strings: { + 'strings': { patterns: [ { name: 'string.quoted.double.yaml', @@ -84,12 +84,12 @@ export const yamlGrammar: Grammar = { }, { name: 'string.quoted.single.yaml', - begin: "'", - end: "'", + begin: '\'', + end: '\'', patterns: [ { name: 'constant.character.escape.yaml', - match: "''", + match: '\'\'', }, ], }, @@ -99,7 +99,7 @@ export const yamlGrammar: Grammar = { }, ], }, - numbers: { + 'numbers': { patterns: [ { name: 'constant.numeric.yaml', @@ -107,7 +107,7 @@ export const yamlGrammar: Grammar = { }, ], }, - constants: { + 'constants': { patterns: [ { name: 'constant.language.yaml', @@ -115,7 +115,7 @@ export const yamlGrammar: Grammar = { }, ], }, - anchors: { + 'anchors': { patterns: [ { name: 'entity.name.type.anchor.yaml', @@ -127,7 +127,7 @@ export const yamlGrammar: Grammar = { }, ], }, - tags: { + 'tags': { patterns: [ { name: 'storage.type.tag.yaml', diff --git a/packages/ts-syntax-highlighter/src/tokenizer.ts b/packages/ts-syntax-highlighter/src/tokenizer.ts index e2516b6..6d18a84 100644 --- a/packages/ts-syntax-highlighter/src/tokenizer.ts +++ b/packages/ts-syntax-highlighter/src/tokenizer.ts @@ -689,7 +689,8 @@ export class Tokenizer { // Process each capture group for (let i = 0; i < match.length; i++) { const captured = match[i] - if (captured === undefined) continue + if (captured === undefined) + continue const captureKey = i.toString() const capture = captures[captureKey] @@ -701,7 +702,8 @@ export class Tokenizer { // Find where this capture starts in the full match const captureStart = match[0].indexOf(captured, currentOffset) - if (captureStart === -1) continue + if (captureStart === -1) + continue // Add any text before this capture as a plain token if (captureStart > currentOffset) { diff --git a/packages/ts-syntax-highlighter/test/abnf.test.ts b/packages/ts-syntax-highlighter/test/abnf.test.ts index 8be1581..3d7cca7 100644 --- a/packages/ts-syntax-highlighter/test/abnf.test.ts +++ b/packages/ts-syntax-highlighter/test/abnf.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { abnfGrammar } from '../src/grammars/abnf' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('ABNF Grammar', () => { const tokenizer = new Tokenizer(abnfGrammar) diff --git a/packages/ts-syntax-highlighter/test/bash.test.ts b/packages/ts-syntax-highlighter/test/bash.test.ts index 9386c8d..12c3e51 100644 --- a/packages/ts-syntax-highlighter/test/bash.test.ts +++ b/packages/ts-syntax-highlighter/test/bash.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { bashGrammar } from '../src/grammars/bash' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Bash Grammar', () => { const tokenizer = new Tokenizer(bashGrammar) diff --git a/packages/ts-syntax-highlighter/test/bnf.test.ts b/packages/ts-syntax-highlighter/test/bnf.test.ts index 1a4b5d5..9771c04 100644 --- a/packages/ts-syntax-highlighter/test/bnf.test.ts +++ b/packages/ts-syntax-highlighter/test/bnf.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { bnfGrammar } from '../src/grammars/bnf' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('BNF Grammar', () => { const tokenizer = new Tokenizer(bnfGrammar) diff --git a/packages/ts-syntax-highlighter/test/c.test.ts b/packages/ts-syntax-highlighter/test/c.test.ts index cb5f294..3ac8024 100644 --- a/packages/ts-syntax-highlighter/test/c.test.ts +++ b/packages/ts-syntax-highlighter/test/c.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { cGrammar } from '../src/grammars/c' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('C Grammar', () => { const tokenizer = new Tokenizer(cGrammar) diff --git a/packages/ts-syntax-highlighter/test/cmd.test.ts b/packages/ts-syntax-highlighter/test/cmd.test.ts index cd68127..edd3aaf 100644 --- a/packages/ts-syntax-highlighter/test/cmd.test.ts +++ b/packages/ts-syntax-highlighter/test/cmd.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { cmdGrammar } from '../src/grammars/cmd' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('CMD Grammar', () => { const tokenizer = new Tokenizer(cmdGrammar) diff --git a/packages/ts-syntax-highlighter/test/cpp.test.ts b/packages/ts-syntax-highlighter/test/cpp.test.ts index ce694c3..44fb109 100644 --- a/packages/ts-syntax-highlighter/test/cpp.test.ts +++ b/packages/ts-syntax-highlighter/test/cpp.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { cppGrammar } from '../src/grammars/cpp' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('C++ Grammar', () => { const tokenizer = new Tokenizer(cppGrammar) diff --git a/packages/ts-syntax-highlighter/test/csharp.test.ts b/packages/ts-syntax-highlighter/test/csharp.test.ts index 2bfd87a..b03e99c 100644 --- a/packages/ts-syntax-highlighter/test/csharp.test.ts +++ b/packages/ts-syntax-highlighter/test/csharp.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { csharpGrammar } from '../src/grammars/csharp' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('C# Grammar', () => { const tokenizer = new Tokenizer(csharpGrammar) diff --git a/packages/ts-syntax-highlighter/test/csv.test.ts b/packages/ts-syntax-highlighter/test/csv.test.ts index fd61cfa..707e543 100644 --- a/packages/ts-syntax-highlighter/test/csv.test.ts +++ b/packages/ts-syntax-highlighter/test/csv.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { csvGrammar } from '../src/grammars/csv' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('CSV Grammar', () => { const tokenizer = new Tokenizer(csvGrammar) diff --git a/packages/ts-syntax-highlighter/test/dart.test.ts b/packages/ts-syntax-highlighter/test/dart.test.ts index df99f64..51fcea1 100644 --- a/packages/ts-syntax-highlighter/test/dart.test.ts +++ b/packages/ts-syntax-highlighter/test/dart.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { dartGrammar } from '../src/grammars/dart' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Dart Grammar', () => { const tokenizer = new Tokenizer(dartGrammar) diff --git a/packages/ts-syntax-highlighter/test/diff.test.ts b/packages/ts-syntax-highlighter/test/diff.test.ts index 72630e4..68ab93d 100644 --- a/packages/ts-syntax-highlighter/test/diff.test.ts +++ b/packages/ts-syntax-highlighter/test/diff.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { diffGrammar } from '../src/grammars/diff' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Diff Grammar', () => { const tokenizer = new Tokenizer(diffGrammar) diff --git a/packages/ts-syntax-highlighter/test/dockerfile.test.ts b/packages/ts-syntax-highlighter/test/dockerfile.test.ts index f133397..30a5009 100644 --- a/packages/ts-syntax-highlighter/test/dockerfile.test.ts +++ b/packages/ts-syntax-highlighter/test/dockerfile.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { dockerfileGrammar } from '../src/grammars/dockerfile' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Dockerfile Grammar', () => { const tokenizer = new Tokenizer(dockerfileGrammar) diff --git a/packages/ts-syntax-highlighter/test/go.test.ts b/packages/ts-syntax-highlighter/test/go.test.ts index c79f7a8..e37190f 100644 --- a/packages/ts-syntax-highlighter/test/go.test.ts +++ b/packages/ts-syntax-highlighter/test/go.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { goGrammar } from '../src/grammars/go' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Go Grammar', () => { const tokenizer = new Tokenizer(goGrammar) diff --git a/packages/ts-syntax-highlighter/test/graphql.test.ts b/packages/ts-syntax-highlighter/test/graphql.test.ts index 5065740..e38d8e2 100644 --- a/packages/ts-syntax-highlighter/test/graphql.test.ts +++ b/packages/ts-syntax-highlighter/test/graphql.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { graphqlGrammar } from '../src/grammars/graphql' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('GraphQL Grammar', () => { const tokenizer = new Tokenizer(graphqlGrammar) diff --git a/packages/ts-syntax-highlighter/test/idl.test.ts b/packages/ts-syntax-highlighter/test/idl.test.ts index 54c88ce..127bcdf 100644 --- a/packages/ts-syntax-highlighter/test/idl.test.ts +++ b/packages/ts-syntax-highlighter/test/idl.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { idlGrammar } from '../src/grammars/idl' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('IDL Grammar', () => { const tokenizer = new Tokenizer(idlGrammar) diff --git a/packages/ts-syntax-highlighter/test/java.test.ts b/packages/ts-syntax-highlighter/test/java.test.ts index ccfb53b..05c13c3 100644 --- a/packages/ts-syntax-highlighter/test/java.test.ts +++ b/packages/ts-syntax-highlighter/test/java.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { javaGrammar } from '../src/grammars/java' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Java Grammar', () => { const tokenizer = new Tokenizer(javaGrammar) diff --git a/packages/ts-syntax-highlighter/test/json5.test.ts b/packages/ts-syntax-highlighter/test/json5.test.ts index 60f0000..c289599 100644 --- a/packages/ts-syntax-highlighter/test/json5.test.ts +++ b/packages/ts-syntax-highlighter/test/json5.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { json5Grammar } from '../src/grammars/json5' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('JSON5 Grammar', () => { const tokenizer = new Tokenizer(json5Grammar) diff --git a/packages/ts-syntax-highlighter/test/jsonc.test.ts b/packages/ts-syntax-highlighter/test/jsonc.test.ts index 2e7db9a..118df2a 100644 --- a/packages/ts-syntax-highlighter/test/jsonc.test.ts +++ b/packages/ts-syntax-highlighter/test/jsonc.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { jsoncGrammar } from '../src/grammars/jsonc' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('JSONC Grammar', () => { const tokenizer = new Tokenizer(jsoncGrammar) diff --git a/packages/ts-syntax-highlighter/test/kotlin.test.ts b/packages/ts-syntax-highlighter/test/kotlin.test.ts index 5e8abc7..695b94d 100644 --- a/packages/ts-syntax-highlighter/test/kotlin.test.ts +++ b/packages/ts-syntax-highlighter/test/kotlin.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { kotlinGrammar } from '../src/grammars/kotlin' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Kotlin Grammar', () => { const tokenizer = new Tokenizer(kotlinGrammar) diff --git a/packages/ts-syntax-highlighter/test/latex.test.ts b/packages/ts-syntax-highlighter/test/latex.test.ts index 6705e1f..eef0d75 100644 --- a/packages/ts-syntax-highlighter/test/latex.test.ts +++ b/packages/ts-syntax-highlighter/test/latex.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { latexGrammar } from '../src/grammars/latex' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('LaTeX Grammar', () => { const tokenizer = new Tokenizer(latexGrammar) diff --git a/packages/ts-syntax-highlighter/test/log.test.ts b/packages/ts-syntax-highlighter/test/log.test.ts index e9800fa..b96ac51 100644 --- a/packages/ts-syntax-highlighter/test/log.test.ts +++ b/packages/ts-syntax-highlighter/test/log.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { logGrammar } from '../src/grammars/log' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Log Grammar', () => { const tokenizer = new Tokenizer(logGrammar) diff --git a/packages/ts-syntax-highlighter/test/lua.test.ts b/packages/ts-syntax-highlighter/test/lua.test.ts index eaca5dd..2913e5d 100644 --- a/packages/ts-syntax-highlighter/test/lua.test.ts +++ b/packages/ts-syntax-highlighter/test/lua.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { luaGrammar } from '../src/grammars/lua' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Lua Grammar', () => { const tokenizer = new Tokenizer(luaGrammar) diff --git a/packages/ts-syntax-highlighter/test/makefile.test.ts b/packages/ts-syntax-highlighter/test/makefile.test.ts index 78f8a81..7b13173 100644 --- a/packages/ts-syntax-highlighter/test/makefile.test.ts +++ b/packages/ts-syntax-highlighter/test/makefile.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { makefileGrammar } from '../src/grammars/makefile' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Makefile Grammar', () => { const tokenizer = new Tokenizer(makefileGrammar) diff --git a/packages/ts-syntax-highlighter/test/markdown.test.ts b/packages/ts-syntax-highlighter/test/markdown.test.ts index 836b4ea..ced0366 100644 --- a/packages/ts-syntax-highlighter/test/markdown.test.ts +++ b/packages/ts-syntax-highlighter/test/markdown.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { markdownGrammar } from '../src/grammars/markdown' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Markdown Grammar', () => { const tokenizer = new Tokenizer(markdownGrammar) diff --git a/packages/ts-syntax-highlighter/test/nginx.test.ts b/packages/ts-syntax-highlighter/test/nginx.test.ts index bcbc419..5aca9ec 100644 --- a/packages/ts-syntax-highlighter/test/nginx.test.ts +++ b/packages/ts-syntax-highlighter/test/nginx.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { nginxGrammar } from '../src/grammars/nginx' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Nginx Grammar', () => { const tokenizer = new Tokenizer(nginxGrammar) diff --git a/packages/ts-syntax-highlighter/test/php.test.ts b/packages/ts-syntax-highlighter/test/php.test.ts index 7634e85..3fbe8a6 100644 --- a/packages/ts-syntax-highlighter/test/php.test.ts +++ b/packages/ts-syntax-highlighter/test/php.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { phpGrammar } from '../src/grammars/php' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('PHP Grammar', () => { const tokenizer = new Tokenizer(phpGrammar) diff --git a/packages/ts-syntax-highlighter/test/powershell.test.ts b/packages/ts-syntax-highlighter/test/powershell.test.ts index b85d076..33b345a 100644 --- a/packages/ts-syntax-highlighter/test/powershell.test.ts +++ b/packages/ts-syntax-highlighter/test/powershell.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { powershellGrammar } from '../src/grammars/powershell' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('PowerShell Grammar', () => { const tokenizer = new Tokenizer(powershellGrammar) diff --git a/packages/ts-syntax-highlighter/test/protobuf.test.ts b/packages/ts-syntax-highlighter/test/protobuf.test.ts index 03c3248..0672910 100644 --- a/packages/ts-syntax-highlighter/test/protobuf.test.ts +++ b/packages/ts-syntax-highlighter/test/protobuf.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { protobufGrammar } from '../src/grammars/protobuf' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Protobuf Grammar', () => { const tokenizer = new Tokenizer(protobufGrammar) diff --git a/packages/ts-syntax-highlighter/test/python.test.ts b/packages/ts-syntax-highlighter/test/python.test.ts index 29749f1..d8d53b9 100644 --- a/packages/ts-syntax-highlighter/test/python.test.ts +++ b/packages/ts-syntax-highlighter/test/python.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { pythonGrammar } from '../src/grammars/python' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Python Grammar', () => { const tokenizer = new Tokenizer(pythonGrammar) diff --git a/packages/ts-syntax-highlighter/test/r.test.ts b/packages/ts-syntax-highlighter/test/r.test.ts index 3394c86..39a8164 100644 --- a/packages/ts-syntax-highlighter/test/r.test.ts +++ b/packages/ts-syntax-highlighter/test/r.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { rGrammar } from '../src/grammars/r' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('R Grammar', () => { const tokenizer = new Tokenizer(rGrammar) diff --git a/packages/ts-syntax-highlighter/test/regexp.test.ts b/packages/ts-syntax-highlighter/test/regexp.test.ts index 25712fa..633e3b2 100644 --- a/packages/ts-syntax-highlighter/test/regexp.test.ts +++ b/packages/ts-syntax-highlighter/test/regexp.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { regexpGrammar } from '../src/grammars/regexp' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('RegExp Grammar', () => { const tokenizer = new Tokenizer(regexpGrammar) diff --git a/packages/ts-syntax-highlighter/test/ruby.test.ts b/packages/ts-syntax-highlighter/test/ruby.test.ts index 71ceb4a..9e24db9 100644 --- a/packages/ts-syntax-highlighter/test/ruby.test.ts +++ b/packages/ts-syntax-highlighter/test/ruby.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { rubyGrammar } from '../src/grammars/ruby' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Ruby Grammar', () => { const tokenizer = new Tokenizer(rubyGrammar) diff --git a/packages/ts-syntax-highlighter/test/rust.test.ts b/packages/ts-syntax-highlighter/test/rust.test.ts index c0722e8..59f0acd 100644 --- a/packages/ts-syntax-highlighter/test/rust.test.ts +++ b/packages/ts-syntax-highlighter/test/rust.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { rustGrammar } from '../src/grammars/rust' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Rust Grammar', () => { const tokenizer = new Tokenizer(rustGrammar) diff --git a/packages/ts-syntax-highlighter/test/scss.test.ts b/packages/ts-syntax-highlighter/test/scss.test.ts index 3125047..cad9d1b 100644 --- a/packages/ts-syntax-highlighter/test/scss.test.ts +++ b/packages/ts-syntax-highlighter/test/scss.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { scssGrammar } from '../src/grammars/scss' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('SCSS Grammar', () => { const tokenizer = new Tokenizer(scssGrammar) diff --git a/packages/ts-syntax-highlighter/test/solidity.test.ts b/packages/ts-syntax-highlighter/test/solidity.test.ts index c8ae7f6..f8295b9 100644 --- a/packages/ts-syntax-highlighter/test/solidity.test.ts +++ b/packages/ts-syntax-highlighter/test/solidity.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { solidityGrammar } from '../src/grammars/solidity' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Solidity Grammar', () => { const tokenizer = new Tokenizer(solidityGrammar) diff --git a/packages/ts-syntax-highlighter/test/sql.test.ts b/packages/ts-syntax-highlighter/test/sql.test.ts index 3cc0fbf..46b941f 100644 --- a/packages/ts-syntax-highlighter/test/sql.test.ts +++ b/packages/ts-syntax-highlighter/test/sql.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { sqlGrammar } from '../src/grammars/sql' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('SQL Grammar', () => { const tokenizer = new Tokenizer(sqlGrammar) diff --git a/packages/ts-syntax-highlighter/test/swift.test.ts b/packages/ts-syntax-highlighter/test/swift.test.ts index 0afb018..05443e4 100644 --- a/packages/ts-syntax-highlighter/test/swift.test.ts +++ b/packages/ts-syntax-highlighter/test/swift.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { swiftGrammar } from '../src/grammars/swift' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Swift Grammar', () => { const tokenizer = new Tokenizer(swiftGrammar) diff --git a/packages/ts-syntax-highlighter/test/terraform.test.ts b/packages/ts-syntax-highlighter/test/terraform.test.ts index 8dccafa..95cc84b 100644 --- a/packages/ts-syntax-highlighter/test/terraform.test.ts +++ b/packages/ts-syntax-highlighter/test/terraform.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { terraformGrammar } from '../src/grammars/terraform' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Terraform Grammar', () => { const tokenizer = new Tokenizer(terraformGrammar) diff --git a/packages/ts-syntax-highlighter/test/text.test.ts b/packages/ts-syntax-highlighter/test/text.test.ts index c36ac4d..41c7ffb 100644 --- a/packages/ts-syntax-highlighter/test/text.test.ts +++ b/packages/ts-syntax-highlighter/test/text.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { textGrammar } from '../src/grammars/text' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Text Grammar', () => { const tokenizer = new Tokenizer(textGrammar) diff --git a/packages/ts-syntax-highlighter/test/toml.test.ts b/packages/ts-syntax-highlighter/test/toml.test.ts index e48d75d..391307f 100644 --- a/packages/ts-syntax-highlighter/test/toml.test.ts +++ b/packages/ts-syntax-highlighter/test/toml.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { tomlGrammar } from '../src/grammars/toml' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('TOML Grammar', () => { const tokenizer = new Tokenizer(tomlGrammar) diff --git a/packages/ts-syntax-highlighter/test/vue.test.ts b/packages/ts-syntax-highlighter/test/vue.test.ts index 3f2759e..6ef1b74 100644 --- a/packages/ts-syntax-highlighter/test/vue.test.ts +++ b/packages/ts-syntax-highlighter/test/vue.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { vueGrammar } from '../src/grammars/vue' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('Vue Grammar', () => { const tokenizer = new Tokenizer(vueGrammar) diff --git a/packages/ts-syntax-highlighter/test/xml.test.ts b/packages/ts-syntax-highlighter/test/xml.test.ts index 66018fc..c15a538 100644 --- a/packages/ts-syntax-highlighter/test/xml.test.ts +++ b/packages/ts-syntax-highlighter/test/xml.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { xmlGrammar } from '../src/grammars/xml' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('XML Grammar', () => { const tokenizer = new Tokenizer(xmlGrammar) diff --git a/packages/ts-syntax-highlighter/test/yaml.test.ts b/packages/ts-syntax-highlighter/test/yaml.test.ts index 3b16dc9..dd2e40a 100644 --- a/packages/ts-syntax-highlighter/test/yaml.test.ts +++ b/packages/ts-syntax-highlighter/test/yaml.test.ts @@ -1,7 +1,7 @@ +import type { Token, TokenLine } from '../src/types' import { describe, expect, it } from 'bun:test' -import { Tokenizer } from '../src/tokenizer' import { yamlGrammar } from '../src/grammars/yaml' -import type { Token, TokenLine } from '../src/types' +import { Tokenizer } from '../src/tokenizer' describe('YAML Grammar', () => { const tokenizer = new Tokenizer(yamlGrammar) From 12a9a9bf27340024a18c0d5fa94d0e3b0cac0259 Mon Sep 17 00:00:00 2001 From: Adelino Ngomacha Date: Tue, 28 Oct 2025 13:29:02 +0200 Subject: [PATCH 2/2] chore: release v0.2.1 --- CHANGELOG.md | 21 +++++++++++++++++++++ package.json | 2 +- packages/benchmarks/package.json | 2 +- packages/ts-syntax-highlighter/package.json | 2 +- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85e248e..d1e05ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,24 @@ +[Compare changes](https://github.com/stacksjs/ts-syntax-highlighter/compare/v0.2.0...v0.2.1) + +### ๐Ÿงน Chores + +- release v0.2.1 ([d72676a](https://github.com/stacksjs/ts-syntax-highlighter/commit/d72676a)) +- fix lint issues ([7feefff](https://github.com/stacksjs/ts-syntax-highlighter/commit/7feefff)) + +### Contributors + +- Adelino Ngomacha + +[Compare changes](https://github.com/stacksjs/ts-syntax-highlighter/compare/v0.2.0...HEAD) + +### ๐Ÿงน Chores + +- fix lint issues ([7feefff](https://github.com/stacksjs/ts-syntax-highlighter/commit/7feefff)) + +### Contributors + +- Adelino Ngomacha + [Compare changes](https://github.com/stacksjs/ts-syntax-highlighter/compare/v0.1.0...v0.2.0) ### ๐Ÿš€ Features diff --git a/package.json b/package.json index 4324a88..ddf472f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ts-syntax-highlighter", "type": "module", - "version": "0.2.0", + "version": "0.2.1", "description": "Like our `ts-starter`, but optimized for monorepos.", "author": "Chris Breuer ", "license": "MIT", diff --git a/packages/benchmarks/package.json b/packages/benchmarks/package.json index 53d28c1..8efa032 100644 --- a/packages/benchmarks/package.json +++ b/packages/benchmarks/package.json @@ -1,7 +1,7 @@ { "name": "benchmarks", "type": "module", - "version": "0.2.0", + "version": "0.2.1", "private": true, "description": "Benchmarks for ts-syntax-highlighter", "scripts": { diff --git a/packages/ts-syntax-highlighter/package.json b/packages/ts-syntax-highlighter/package.json index ff7bfbb..d11bebc 100644 --- a/packages/ts-syntax-highlighter/package.json +++ b/packages/ts-syntax-highlighter/package.json @@ -1,7 +1,7 @@ { "name": "ts-syntax-highlighter", "type": "module", - "version": "0.2.0", + "version": "0.2.1", "description": "Performant & minimal syntax highlighter.", "author": "Chris Breuer ", "license": "MIT",