toolcraft 0.0.81 → 0.0.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -225,18 +225,30 @@ Available token classes:
225
225
  - `.tc-token-type`
226
226
  - `.tc-token-variable`
227
227
 
228
- The initial no-dependency highlighters cover these fence labels:
228
+ The no-dependency highlighters cover these fence labels:
229
229
 
230
230
  - ECMAScript and TypeScript: `js`, `javascript`, `mjs`, `cjs`, `es6`, `jsx`, `ts`, `typescript`, `mts`, `cts`, `tsx`
231
231
  - Data: `json`, `jsonc`, `jsonl`, `yaml`, `yml`
232
- - CSS: `css`
233
-
234
- These language labels are recognized but intentionally render as plain escaped code until a tokenizer exists:
235
-
236
- - Styles and markup: `scss`, `sass`, `less`, `postcss`, `html`, `xml`, `svg`, `md`, `markdown`
237
- - Shell, Python, SQL, and line-oriented formats: `sh`, `bash`, `shell`, `shellscript`, `zsh`, `fish`, `py`, `python`, `sql`, `ddl`, `dml`, `diff`, `patch`, `dockerfile`, `docker`, `ini`, `properties`, `toml`
238
- - Explicit plain text: `text`, `txt`, `plain`, `plaintext`
239
- - Other known languages: `rb`, `ruby`, `go`, `golang`, `java`, `c`, `cpp`, `c++`, `cc`, `cxx`, `cs`, `csharp`, `c#`, `rs`, `rust`, `php`
232
+ - CSS and style dialects: `css`, `scss`, `sass`, `less`, `postcss`
233
+ - Shell: `sh`, `bash`, `shell`, `shellscript`, `zsh`, `fish`
234
+ - Python: `py`, `python`
235
+ - SQL: `sql`, `ddl`, `dml`
236
+ - Markup and Markdown: `html`, `xml`, `svg`, `md`, `markdown`
237
+ - Line-oriented formats: `diff`, `patch`, `dockerfile`, `docker`
238
+ - Config formats: `ini`, `properties`, `toml`
239
+ - Ruby: `rb`, `ruby`
240
+ - Go and JVM languages: `go`, `golang`, `java`, `kt`, `kotlin`, `kts`, `scala`, `sc`, `groovy`, `gvy`, `gy`, `gsp`, `gradle`
241
+ - Swift and Dart: `swift`, `dart`
242
+ - C-family: `c`, `cpp`, `c++`, `cc`, `cxx`, `cs`, `csharp`, `c#`, `objc`, `objectivec`, `objective-c`, `m`, `mm`
243
+ - Rust: `rs`, `rust`
244
+ - PHP: `php`
245
+ - Scripting and functional languages: `lua`, `pl`, `perl`, `pm`, `r`, `rscript`, `ps1`, `powershell`, `pwsh`, `ex`, `exs`, `elixir`, `erl`, `erlang`, `hrl`, `hs`, `haskell`, `clj`, `cljs`, `cljc`, `clojure`, `fs`, `fsi`, `fsx`, `fsharp`, `vb`, `vbnet`
246
+ - Schema and infrastructure formats: `graphql`, `gql`, `proto`, `protobuf`, `hcl`, `tf`, `terraform`, `nginx`, `nginxconf`, `makefile`, `mk`, `cmake`, `env`, `dotenv`
247
+ - Component formats: `vue`, `svelte`
248
+
249
+ These language labels intentionally render as plain escaped code:
250
+
251
+ - Plain text: `text`, `txt`, `plain`, `plaintext`
240
252
 
241
253
  Unknown fence labels also render as plain escaped code. Code text is always escaped in HTML output, even when `allowRawHtml: true` is enabled.
242
254
 
@@ -1,3 +1,4 @@
1
+ const cStyleBlockComments = [{ start: "/*", end: "*/" }];
1
2
  const codeLanguages = [
2
3
  {
3
4
  id: "javascript",
@@ -36,11 +37,37 @@ const codeLanguages = [
36
37
  { id: "ruby", aliases: ["rb", "ruby"], family: "lexical", spec: "ruby" },
37
38
  { id: "go", aliases: ["go", "golang"], family: "lexical", spec: "go" },
38
39
  { id: "java", aliases: ["java"], family: "lexical", spec: "java" },
40
+ { id: "kotlin", aliases: ["kt", "kotlin", "kts"], family: "lexical", spec: "kotlin" },
41
+ { id: "swift", aliases: ["swift"], family: "lexical", spec: "swift" },
42
+ { id: "dart", aliases: ["dart"], family: "lexical", spec: "dart" },
43
+ { id: "scala", aliases: ["scala", "sc"], family: "lexical", spec: "scala" },
44
+ { id: "groovy", aliases: ["groovy", "gvy", "gy", "gsp"], family: "lexical", spec: "groovy" },
39
45
  { id: "c", aliases: ["c"], family: "lexical", spec: "c" },
40
46
  { id: "cpp", aliases: ["cpp", "c++", "cc", "cxx"], family: "lexical", spec: "cpp" },
41
47
  { id: "csharp", aliases: ["cs", "csharp", "c#"], family: "lexical", spec: "csharp" },
48
+ { id: "objective-c", aliases: ["objc", "objectivec", "objective-c", "m", "mm"], family: "lexical", spec: "objectivec" },
42
49
  { id: "rust", aliases: ["rs", "rust"], family: "lexical", spec: "rust" },
43
- { id: "php", aliases: ["php"], family: "lexical", spec: "php" }
50
+ { id: "php", aliases: ["php"], family: "lexical", spec: "php" },
51
+ { id: "lua", aliases: ["lua"], family: "lexical", spec: "lua" },
52
+ { id: "perl", aliases: ["pl", "perl", "pm"], family: "lexical", spec: "perl" },
53
+ { id: "r", aliases: ["r", "rscript"], family: "lexical", spec: "r" },
54
+ { id: "powershell", aliases: ["ps1", "powershell", "pwsh"], family: "lexical", spec: "powershell" },
55
+ { id: "elixir", aliases: ["ex", "exs", "elixir"], family: "lexical", spec: "elixir" },
56
+ { id: "erlang", aliases: ["erl", "erlang", "hrl"], family: "lexical", spec: "erlang" },
57
+ { id: "haskell", aliases: ["hs", "haskell"], family: "lexical", spec: "haskell" },
58
+ { id: "clojure", aliases: ["clj", "cljs", "cljc", "clojure"], family: "lexical", spec: "clojure" },
59
+ { id: "fsharp", aliases: ["fs", "fsi", "fsx", "fsharp"], family: "lexical", spec: "fsharp" },
60
+ { id: "vb", aliases: ["vb", "vbnet"], family: "lexical", spec: "vb" },
61
+ { id: "graphql", aliases: ["graphql", "gql"], family: "lexical", spec: "graphql" },
62
+ { id: "protobuf", aliases: ["proto", "protobuf"], family: "lexical", spec: "protobuf" },
63
+ { id: "hcl", aliases: ["hcl", "tf", "terraform"], family: "lexical", spec: "hcl" },
64
+ { id: "nginx", aliases: ["nginx", "nginxconf"], family: "lexical", spec: "nginx" },
65
+ { id: "makefile", aliases: ["makefile", "mk"], family: "lexical", spec: "makefile" },
66
+ { id: "cmake", aliases: ["cmake"], family: "lexical", spec: "cmake" },
67
+ { id: "gradle", aliases: ["gradle"], family: "lexical", spec: "groovy" },
68
+ { id: "env", aliases: ["env", "dotenv"], family: "data", spec: "ini" },
69
+ { id: "vue", aliases: ["vue"], family: "markup", spec: "html" },
70
+ { id: "svelte", aliases: ["svelte"], family: "markup", spec: "html" }
44
71
  ];
45
72
  const languageByAlias = new Map();
46
73
  for (const language of codeLanguages) {
@@ -217,6 +244,16 @@ const javaKeywords = new Set(["abstract", "assert", "break", "case", "catch", "c
217
244
  const javaTypes = new Set(["Boolean", "Byte", "Character", "Double", "Float", "Integer", "Long", "Object", "Optional", "Short", "String", "Void", "boolean", "byte", "char", "double", "float", "int", "long", "short", "void"]);
218
245
  const javaBooleans = new Set(["true", "false"]);
219
246
  const javaNulls = new Set(["null"]);
247
+ const kotlinKeywords = new Set(["as", "break", "by", "catch", "class", "companion", "constructor", "continue", "data", "do", "else", "enum", "expect", "finally", "for", "fun", "if", "import", "in", "interface", "internal", "is", "object", "out", "override", "package", "private", "protected", "public", "return", "sealed", "suspend", "throw", "try", "typealias", "val", "var", "when", "where", "while"]);
248
+ const kotlinTypes = new Set(["Any", "Boolean", "Byte", "Char", "Double", "Float", "Int", "List", "Long", "Map", "Nothing", "Set", "Short", "String", "Unit"]);
249
+ const swiftKeywords = new Set(["actor", "as", "associatedtype", "async", "await", "break", "case", "catch", "class", "continue", "defer", "deinit", "do", "else", "enum", "extension", "fallthrough", "for", "func", "guard", "if", "import", "in", "init", "inout", "let", "nil", "operator", "private", "protocol", "public", "repeat", "return", "self", "Self", "static", "struct", "subscript", "super", "switch", "throw", "throws", "try", "typealias", "var", "where", "while"]);
250
+ const swiftTypes = new Set(["Any", "Array", "Bool", "Character", "Dictionary", "Double", "Float", "Int", "Optional", "Result", "Set", "String", "UInt", "Void"]);
251
+ const dartKeywords = new Set(["abstract", "as", "assert", "async", "await", "base", "break", "case", "catch", "class", "const", "continue", "covariant", "default", "deferred", "do", "else", "enum", "export", "extends", "extension", "external", "factory", "false", "final", "finally", "for", "function", "get", "hide", "if", "implements", "import", "in", "interface", "is", "late", "library", "mixin", "new", "null", "on", "operator", "part", "required", "return", "sealed", "set", "show", "static", "super", "switch", "sync", "this", "throw", "true", "try", "typedef", "var", "void", "when", "while", "with", "yield"]);
252
+ const dartTypes = new Set(["BigInt", "bool", "DateTime", "double", "Duration", "dynamic", "Future", "int", "Iterable", "List", "Map", "Never", "num", "Object", "Pattern", "Record", "Set", "Stream", "String", "Symbol", "Uri", "void"]);
253
+ const scalaKeywords = new Set(["abstract", "case", "catch", "class", "def", "do", "else", "enum", "export", "extends", "false", "final", "finally", "for", "forSome", "given", "if", "implicit", "import", "lazy", "macro", "match", "new", "null", "object", "override", "package", "private", "protected", "return", "sealed", "super", "then", "this", "throw", "trait", "true", "try", "type", "val", "var", "while", "with", "yield"]);
254
+ const scalaTypes = new Set(["Any", "Boolean", "Byte", "Char", "Double", "Either", "Float", "Int", "List", "Long", "Map", "None", "Option", "Seq", "Set", "Short", "Some", "String", "Unit"]);
255
+ const groovyKeywords = new Set(["abstract", "as", "assert", "break", "case", "catch", "class", "const", "continue", "def", "default", "do", "else", "enum", "extends", "false", "final", "finally", "for", "goto", "if", "implements", "import", "in", "instanceof", "interface", "new", "null", "package", "private", "protected", "public", "return", "static", "super", "switch", "this", "throw", "throws", "trait", "true", "try", "var", "void", "while"]);
256
+ const groovyTypes = new Set(["BigDecimal", "Boolean", "Closure", "Date", "Integer", "List", "Map", "Object", "String", "boolean", "def", "int", "long", "void"]);
220
257
  const cKeywords = new Set(["auto", "break", "case", "const", "continue", "default", "do", "else", "enum", "extern", "for", "goto", "if", "inline", "register", "restrict", "return", "sizeof", "static", "struct", "switch", "typedef", "union", "volatile", "while"]);
221
258
  const cTypes = new Set(["bool", "char", "double", "float", "int", "int16_t", "int32_t", "int64_t", "int8_t", "long", "short", "size_t", "uint16_t", "uint32_t", "uint64_t", "uint8_t", "void"]);
222
259
  const cppKeywords = new Set([...cKeywords, "alignas", "alignof", "and", "bitand", "bitor", "catch", "class", "concept", "constexpr", "consteval", "constinit", "decltype", "delete", "explicit", "export", "friend", "mutable", "namespace", "new", "noexcept", "not", "operator", "or", "private", "protected", "public", "requires", "template", "this", "throw", "try", "typename", "using", "virtual", "xor"]);
@@ -225,12 +262,30 @@ const cppBooleans = new Set(["true", "false"]);
225
262
  const cppNulls = new Set(["nullptr", "NULL"]);
226
263
  const csharpKeywords = new Set(["abstract", "as", "base", "break", "case", "catch", "checked", "class", "const", "continue", "default", "delegate", "do", "else", "enum", "event", "explicit", "extern", "finally", "fixed", "for", "foreach", "if", "implicit", "in", "interface", "internal", "is", "lock", "namespace", "new", "operator", "out", "override", "params", "private", "protected", "public", "readonly", "record", "ref", "return", "sealed", "sizeof", "stackalloc", "static", "struct", "switch", "this", "throw", "try", "typeof", "unchecked", "unsafe", "using", "virtual", "void", "volatile", "while"]);
227
264
  const csharpTypes = new Set(["bool", "byte", "char", "decimal", "double", "dynamic", "float", "int", "long", "nint", "nuint", "object", "sbyte", "short", "string", "uint", "ulong", "ushort", "var"]);
265
+ const objectiveCKeywords = new Set([...cKeywords, "@autoreleasepool", "@catch", "@class", "@dynamic", "@end", "@finally", "@implementation", "@import", "@interface", "@optional", "@package", "@private", "@property", "@protected", "@protocol", "@public", "@selector", "@synthesize", "@throw", "@try", "YES", "NO", "nil", "self", "super"]);
266
+ const objectiveCTypes = new Set([...cTypes, "BOOL", "Class", "CGFloat", "NSInteger", "NSObject", "NSString", "NSUInteger", "SEL", "id"]);
228
267
  const rustKeywords = new Set(["as", "async", "await", "box", "break", "const", "continue", "crate", "dyn", "else", "enum", "extern", "false", "fn", "for", "if", "impl", "in", "let", "loop", "match", "mod", "move", "mut", "pub", "ref", "return", "self", "Self", "static", "struct", "super", "trait", "true", "type", "unsafe", "use", "where", "while"]);
229
268
  const rustTypes = new Set(["Box", "Option", "Result", "Some", "String", "Vec", "bool", "char", "f32", "f64", "i128", "i16", "i32", "i64", "i8", "isize", "str", "u128", "u16", "u32", "u64", "u8", "usize"]);
230
269
  const rustBooleans = new Set(["true", "false"]);
231
270
  const rustNulls = new Set(["None"]);
232
271
  const phpKeywords = new Set(["abstract", "and", "array", "as", "break", "callable", "case", "catch", "class", "clone", "const", "continue", "declare", "default", "do", "echo", "else", "elseif", "empty", "enddeclare", "endfor", "endforeach", "endif", "endswitch", "endwhile", "enum", "extends", "final", "finally", "fn", "for", "foreach", "function", "global", "if", "implements", "include", "instanceof", "interface", "isset", "match", "namespace", "new", "or", "private", "protected", "public", "readonly", "require", "return", "static", "switch", "throw", "trait", "try", "use", "var", "while", "xor", "yield"]);
233
272
  const phpTypes = new Set(["array", "bool", "callable", "false", "float", "int", "iterable", "mixed", "never", "null", "object", "self", "static", "string", "true", "void"]);
273
+ const luaKeywords = new Set(["and", "break", "do", "else", "elseif", "end", "false", "for", "function", "goto", "if", "in", "local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while"]);
274
+ const perlKeywords = new Set(["continue", "do", "else", "elsif", "for", "foreach", "given", "if", "last", "local", "my", "next", "our", "package", "redo", "require", "return", "state", "sub", "unless", "until", "use", "when", "while"]);
275
+ const rKeywords = new Set(["break", "else", "FALSE", "for", "function", "if", "Inf", "in", "NA", "NaN", "next", "NULL", "repeat", "return", "TRUE", "while"]);
276
+ const powershellKeywords = new Set(["begin", "break", "catch", "class", "continue", "data", "default", "do", "dynamicparam", "else", "elseif", "end", "enum", "exit", "filter", "finally", "for", "foreach", "from", "function", "if", "in", "param", "process", "return", "switch", "throw", "trap", "try", "until", "using", "var", "while"]);
277
+ const elixirKeywords = new Set(["after", "alias", "and", "case", "catch", "cond", "def", "defdelegate", "defexception", "defimpl", "defmacro", "defmodule", "defp", "defprotocol", "defstruct", "do", "else", "end", "false", "fn", "for", "if", "import", "in", "nil", "not", "or", "quote", "raise", "receive", "require", "rescue", "super", "throw", "true", "try", "unless", "unquote", "use", "when", "with"]);
278
+ const erlangKeywords = new Set(["after", "and", "andalso", "band", "begin", "bnot", "bor", "bsl", "bsr", "bxor", "case", "catch", "cond", "div", "end", "fun", "if", "let", "not", "of", "or", "orelse", "receive", "rem", "try", "when", "xor"]);
279
+ const haskellKeywords = new Set(["as", "case", "class", "data", "default", "deriving", "do", "else", "family", "forall", "foreign", "hiding", "if", "import", "in", "infix", "infixl", "infixr", "instance", "let", "module", "newtype", "of", "qualified", "then", "type", "where"]);
280
+ const clojureKeywords = new Set(["def", "defmacro", "defmethod", "defmulti", "defn", "defonce", "do", "doseq", "false", "fn", "for", "if", "let", "loop", "nil", "ns", "quote", "recur", "require", "true", "try", "when"]);
281
+ const fsharpKeywords = new Set(["abstract", "and", "as", "assert", "base", "begin", "class", "default", "delegate", "do", "done", "downcast", "downto", "elif", "else", "end", "exception", "extern", "false", "finally", "for", "fun", "function", "global", "if", "in", "inherit", "inline", "interface", "internal", "lazy", "let", "match", "member", "module", "mutable", "namespace", "new", "null", "of", "open", "or", "override", "private", "public", "rec", "return", "static", "struct", "then", "to", "true", "try", "type", "upcast", "use", "val", "void", "when", "while", "with", "yield"]);
282
+ const vbKeywords = new Set(["AddHandler", "And", "As", "Boolean", "ByRef", "Byte", "ByVal", "Call", "Case", "Catch", "Class", "Const", "Continue", "Date", "Decimal", "Dim", "Do", "Double", "Each", "Else", "ElseIf", "End", "Enum", "Erase", "Error", "Event", "Exit", "False", "Finally", "For", "Friend", "Function", "Get", "Global", "GoTo", "Handles", "If", "Implements", "Imports", "In", "Inherits", "Integer", "Interface", "Is", "Let", "Lib", "Like", "Long", "Loop", "Me", "Mod", "Module", "MustInherit", "MustOverride", "MyBase", "Namespace", "New", "Next", "Not", "Nothing", "Object", "Of", "On", "Option", "Or", "Overloads", "Overrides", "ParamArray", "Partial", "Private", "Property", "Protected", "Public", "RaiseEvent", "ReadOnly", "ReDim", "REM", "RemoveHandler", "Resume", "Return", "Select", "Set", "Shadows", "Shared", "Short", "Single", "Static", "Step", "Stop", "String", "Structure", "Sub", "SyncLock", "Then", "Throw", "To", "True", "Try", "Using", "Variant", "Wend", "When", "While", "With", "WithEvents", "WriteOnly"]);
283
+ const graphqlKeywords = new Set(["directive", "enum", "extend", "false", "fragment", "implements", "input", "interface", "mutation", "null", "on", "query", "repeatable", "scalar", "schema", "subscription", "true", "type", "union"]);
284
+ const protobufKeywords = new Set(["bool", "bytes", "double", "enum", "false", "fixed32", "fixed64", "float", "import", "int32", "int64", "map", "message", "oneof", "optional", "package", "proto2", "proto3", "public", "repeated", "reserved", "returns", "rpc", "service", "sfixed32", "sfixed64", "sint32", "sint64", "stream", "string", "syntax", "to", "true", "uint32", "uint64"]);
285
+ const hclKeywords = new Set(["and", "bool", "data", "dynamic", "false", "for", "if", "in", "locals", "module", "null", "number", "or", "output", "provider", "resource", "string", "terraform", "true", "variable"]);
286
+ const nginxKeywords = new Set(["access_log", "add_header", "deny", "error_log", "events", "fastcgi_pass", "gzip", "http", "include", "index", "listen", "location", "log_format", "proxy_pass", "return", "rewrite", "root", "server", "server_name", "try_files", "upstream"]);
287
+ const makefileKeywords = new Set(["define", "else", "endef", "endif", "export", "ifneq", "ifeq", "ifdef", "ifndef", "include", "override", "private", "sinclude", "undefine", "unexport", "vpath"]);
288
+ const cmakeKeywords = new Set(["add_compile_definitions", "add_custom_command", "add_custom_target", "add_executable", "add_library", "cmake_minimum_required", "else", "elseif", "endforeach", "endif", "endfunction", "endmacro", "find_package", "foreach", "function", "if", "include", "macro", "message", "option", "project", "return", "set", "target_compile_features", "target_include_directories", "target_link_libraries"]);
234
289
  const lexicalSpecs = {
235
290
  javascript: {
236
291
  keywords: jsKeywords,
@@ -238,7 +293,7 @@ const lexicalSpecs = {
238
293
  booleans: new Set(["true", "false"]),
239
294
  nulls: new Set(["null"]),
240
295
  lineComments: ["//"],
241
- blockComments: true,
296
+ blockComments: cStyleBlockComments,
242
297
  stringQuotes: ['"', "'"],
243
298
  templateQuotes: true,
244
299
  decorators: true
@@ -250,7 +305,7 @@ const lexicalSpecs = {
250
305
  booleans: new Set(["true", "false"]),
251
306
  nulls: new Set(["null"]),
252
307
  lineComments: ["//"],
253
- blockComments: true,
308
+ blockComments: cStyleBlockComments,
254
309
  stringQuotes: ['"', "'"],
255
310
  templateQuotes: true,
256
311
  decorators: true
@@ -278,7 +333,7 @@ const lexicalSpecs = {
278
333
  booleans: new Set(["true", "false"]),
279
334
  nulls: new Set(["null"]),
280
335
  lineComments: ["--"],
281
- blockComments: true,
336
+ blockComments: cStyleBlockComments,
282
337
  stringQuotes: ['"', "'"],
283
338
  caseInsensitive: true
284
339
  },
@@ -295,7 +350,7 @@ const lexicalSpecs = {
295
350
  booleans: goBooleans,
296
351
  nulls: goNulls,
297
352
  lineComments: ["//"],
298
- blockComments: true,
353
+ blockComments: cStyleBlockComments,
299
354
  stringQuotes: ['"', "'", "`"]
300
355
  },
301
356
  java: {
@@ -304,7 +359,58 @@ const lexicalSpecs = {
304
359
  booleans: javaBooleans,
305
360
  nulls: javaNulls,
306
361
  lineComments: ["//"],
307
- blockComments: true,
362
+ blockComments: cStyleBlockComments,
363
+ stringQuotes: ['"', "'"],
364
+ decorators: true
365
+ },
366
+ kotlin: {
367
+ keywords: kotlinKeywords,
368
+ types: kotlinTypes,
369
+ booleans: javaBooleans,
370
+ nulls: javaNulls,
371
+ lineComments: ["//"],
372
+ blockComments: cStyleBlockComments,
373
+ stringQuotes: ['"', "'"],
374
+ templateQuotes: true,
375
+ decorators: true
376
+ },
377
+ swift: {
378
+ keywords: swiftKeywords,
379
+ types: swiftTypes,
380
+ booleans: cppBooleans,
381
+ nulls: new Set(["nil"]),
382
+ lineComments: ["//"],
383
+ blockComments: cStyleBlockComments,
384
+ stringQuotes: ['"', "'"],
385
+ decorators: true
386
+ },
387
+ dart: {
388
+ keywords: dartKeywords,
389
+ types: dartTypes,
390
+ booleans: javaBooleans,
391
+ nulls: javaNulls,
392
+ lineComments: ["//"],
393
+ blockComments: cStyleBlockComments,
394
+ stringQuotes: ['"', "'"],
395
+ decorators: true
396
+ },
397
+ scala: {
398
+ keywords: scalaKeywords,
399
+ types: scalaTypes,
400
+ booleans: javaBooleans,
401
+ nulls: javaNulls,
402
+ lineComments: ["//"],
403
+ blockComments: cStyleBlockComments,
404
+ stringQuotes: ['"', "'"],
405
+ decorators: true
406
+ },
407
+ groovy: {
408
+ keywords: groovyKeywords,
409
+ types: groovyTypes,
410
+ booleans: javaBooleans,
411
+ nulls: javaNulls,
412
+ lineComments: ["//"],
413
+ blockComments: cStyleBlockComments,
308
414
  stringQuotes: ['"', "'"],
309
415
  decorators: true
310
416
  },
@@ -314,7 +420,7 @@ const lexicalSpecs = {
314
420
  booleans: cppBooleans,
315
421
  nulls: cppNulls,
316
422
  lineComments: ["//"],
317
- blockComments: true,
423
+ blockComments: cStyleBlockComments,
318
424
  stringQuotes: ['"', "'"]
319
425
  },
320
426
  cpp: {
@@ -323,7 +429,7 @@ const lexicalSpecs = {
323
429
  booleans: cppBooleans,
324
430
  nulls: cppNulls,
325
431
  lineComments: ["//"],
326
- blockComments: true,
432
+ blockComments: cStyleBlockComments,
327
433
  stringQuotes: ['"', "'"]
328
434
  },
329
435
  csharp: {
@@ -332,7 +438,17 @@ const lexicalSpecs = {
332
438
  booleans: cppBooleans,
333
439
  nulls: javaNulls,
334
440
  lineComments: ["//"],
335
- blockComments: true,
441
+ blockComments: cStyleBlockComments,
442
+ stringQuotes: ['"', "'"],
443
+ decorators: true
444
+ },
445
+ objectivec: {
446
+ keywords: objectiveCKeywords,
447
+ types: objectiveCTypes,
448
+ booleans: new Set(["YES", "NO", "true", "false"]),
449
+ nulls: new Set(["nil", "NULL", "nullptr"]),
450
+ lineComments: ["//"],
451
+ blockComments: cStyleBlockComments,
336
452
  stringQuotes: ['"', "'"],
337
453
  decorators: true
338
454
  },
@@ -342,7 +458,7 @@ const lexicalSpecs = {
342
458
  booleans: rustBooleans,
343
459
  nulls: rustNulls,
344
460
  lineComments: ["//"],
345
- blockComments: true,
461
+ blockComments: cStyleBlockComments,
346
462
  stringQuotes: ['"', "'"],
347
463
  rustAttributes: true
348
464
  },
@@ -352,9 +468,135 @@ const lexicalSpecs = {
352
468
  booleans: new Set(["true", "false"]),
353
469
  nulls: new Set(["null"]),
354
470
  lineComments: ["//", "#"],
355
- blockComments: true,
471
+ blockComments: cStyleBlockComments,
472
+ stringQuotes: ['"', "'"],
473
+ variablePrefix: "$"
474
+ },
475
+ lua: {
476
+ keywords: luaKeywords,
477
+ booleans: new Set(["true", "false"]),
478
+ nulls: new Set(["nil"]),
479
+ lineComments: ["--"],
480
+ stringQuotes: ['"', "'"]
481
+ },
482
+ perl: {
483
+ keywords: perlKeywords,
484
+ booleans: new Set(["true", "false"]),
485
+ nulls: new Set(["undef"]),
486
+ lineComments: ["#"],
356
487
  stringQuotes: ['"', "'"],
357
488
  variablePrefix: "$"
489
+ },
490
+ r: {
491
+ keywords: rKeywords,
492
+ booleans: new Set(["TRUE", "FALSE", "T", "F"]),
493
+ nulls: new Set(["NULL", "NA", "NaN"]),
494
+ lineComments: ["#"],
495
+ stringQuotes: ['"', "'"]
496
+ },
497
+ powershell: {
498
+ keywords: powershellKeywords,
499
+ booleans: new Set(["$true", "$false", "true", "false"]),
500
+ nulls: new Set(["$null", "null"]),
501
+ commands: new Set(["Get-ChildItem", "Get-Content", "Invoke-Run", "Join-Path", "New-Item", "Remove-Item", "Set-Content", "Test-Path", "Write-Host", "Write-Output"]),
502
+ lineComments: ["#"],
503
+ blockComments: [{ start: "<#", end: "#>" }],
504
+ stringQuotes: ['"', "'"],
505
+ variablePrefix: "$",
506
+ flags: true
507
+ },
508
+ elixir: {
509
+ keywords: elixirKeywords,
510
+ booleans: new Set(["true", "false"]),
511
+ nulls: new Set(["nil"]),
512
+ lineComments: ["#"],
513
+ stringQuotes: ['"', "'"]
514
+ },
515
+ erlang: {
516
+ keywords: erlangKeywords,
517
+ booleans: new Set(["true", "false"]),
518
+ lineComments: ["%"],
519
+ stringQuotes: ['"', "'"]
520
+ },
521
+ haskell: {
522
+ keywords: haskellKeywords,
523
+ types: new Set(["Bool", "Char", "Double", "Either", "False", "Float", "IO", "Int", "Integer", "Maybe", "Nothing", "String", "True"]),
524
+ booleans: new Set(["True", "False"]),
525
+ nulls: new Set(["Nothing"]),
526
+ lineComments: ["--"],
527
+ blockComments: [{ start: "{-", end: "-}" }],
528
+ stringQuotes: ['"', "'"]
529
+ },
530
+ clojure: {
531
+ keywords: clojureKeywords,
532
+ booleans: new Set(["true", "false"]),
533
+ nulls: new Set(["nil"]),
534
+ lineComments: [";"],
535
+ stringQuotes: ['"']
536
+ },
537
+ fsharp: {
538
+ keywords: fsharpKeywords,
539
+ types: new Set(["Async", "bool", "decimal", "float", "int", "list", "Map", "option", "Result", "seq", "string", "unit"]),
540
+ booleans: new Set(["true", "false"]),
541
+ nulls: new Set(["null", "None"]),
542
+ lineComments: ["//"],
543
+ blockComments: [{ start: "(*", end: "*)" }],
544
+ stringQuotes: ['"', "'"],
545
+ decorators: true
546
+ },
547
+ vb: {
548
+ keywords: vbKeywords,
549
+ types: new Set(["Boolean", "Byte", "Date", "Decimal", "Double", "Integer", "Long", "Object", "Short", "Single", "String"]),
550
+ booleans: new Set(["True", "False"]),
551
+ nulls: new Set(["Nothing", "Null"]),
552
+ lineComments: ["'"],
553
+ stringQuotes: ['"'],
554
+ caseInsensitive: true
555
+ },
556
+ graphql: {
557
+ keywords: graphqlKeywords,
558
+ booleans: javaBooleans,
559
+ nulls: javaNulls,
560
+ lineComments: ["#"],
561
+ stringQuotes: ['"']
562
+ },
563
+ protobuf: {
564
+ keywords: protobufKeywords,
565
+ types: new Set(["Any", "Duration", "Timestamp"]),
566
+ booleans: javaBooleans,
567
+ nulls: javaNulls,
568
+ lineComments: ["//"],
569
+ blockComments: cStyleBlockComments,
570
+ stringQuotes: ['"', "'"]
571
+ },
572
+ hcl: {
573
+ keywords: hclKeywords,
574
+ booleans: javaBooleans,
575
+ nulls: javaNulls,
576
+ lineComments: ["#", "//"],
577
+ blockComments: cStyleBlockComments,
578
+ stringQuotes: ['"', "'"]
579
+ },
580
+ nginx: {
581
+ keywords: nginxKeywords,
582
+ lineComments: ["#"],
583
+ stringQuotes: ['"', "'"]
584
+ },
585
+ makefile: {
586
+ keywords: makefileKeywords,
587
+ commands: shellCommands,
588
+ lineComments: ["#"],
589
+ stringQuotes: ['"', "'"],
590
+ variablePrefix: "$",
591
+ flags: true
592
+ },
593
+ cmake: {
594
+ keywords: cmakeKeywords,
595
+ booleans: new Set(["ON", "OFF", "TRUE", "FALSE"]),
596
+ nulls: new Set(["NOTFOUND"]),
597
+ lineComments: ["#"],
598
+ stringQuotes: ['"', "'"],
599
+ caseInsensitive: true
358
600
  }
359
601
  };
360
602
  const tokenizers = {
@@ -406,7 +648,7 @@ function tokenizeLexical(source, language) {
406
648
  index = lineCommentEnd;
407
649
  continue;
408
650
  }
409
- const blockCommentEnd = spec.blockComments === true ? readBlockComment(source, index) : index;
651
+ const blockCommentEnd = readAnyBlockComment(source, index, spec.blockComments ?? []);
410
652
  if (blockCommentEnd > index) {
411
653
  emitter.push("comment", index, blockCommentEnd);
412
654
  index = blockCommentEnd;
@@ -424,9 +666,19 @@ function tokenizeLexical(source, language) {
424
666
  }
425
667
  if (spec.variablePrefix === "$" && char === "$" && isIdentifierStart(source[index + 1] ?? "")) {
426
668
  index = readIdentifier(source, index + 1);
427
- emitter.push("variable", start, index);
669
+ const variableKind = classifyLexicalWord(source.slice(start, index), spec);
670
+ emitter.push(variableKind === "plain" ? "variable" : variableKind, start, index);
428
671
  continue;
429
672
  }
673
+ const commandEnd = readCommandIdentifier(source, index);
674
+ if (commandEnd > index) {
675
+ const commandKind = classifyLexicalWord(source.slice(start, commandEnd), spec);
676
+ if (commandKind === "command") {
677
+ emitter.push("command", start, commandEnd);
678
+ index = commandEnd;
679
+ continue;
680
+ }
681
+ }
430
682
  if (spec.flags === true && char === "-" && isFlagStart(source[index + 1] ?? "")) {
431
683
  index = readFlag(source, index + 1);
432
684
  emitter.push("flag", start, index);
@@ -487,7 +739,7 @@ function tokenizeJsonLike(source, allowComments) {
487
739
  index = lineCommentEnd;
488
740
  continue;
489
741
  }
490
- const blockCommentEnd = readBlockComment(source, index);
742
+ const blockCommentEnd = readAnyBlockComment(source, index, cStyleBlockComments);
491
743
  if (blockCommentEnd > index) {
492
744
  emitter.push("comment", index, blockCommentEnd);
493
745
  index = blockCommentEnd;
@@ -582,7 +834,7 @@ function tokenizeStyle(source) {
582
834
  emitter.pushPlain(start, index);
583
835
  continue;
584
836
  }
585
- const blockCommentEnd = readBlockComment(source, index);
837
+ const blockCommentEnd = readAnyBlockComment(source, index, cStyleBlockComments);
586
838
  if (blockCommentEnd > index) {
587
839
  emitter.push("comment", index, blockCommentEnd);
588
840
  index = blockCommentEnd;
@@ -883,6 +1135,16 @@ function readIdentifier(source, index) {
883
1135
  }
884
1136
  return index;
885
1137
  }
1138
+ function readCommandIdentifier(source, index) {
1139
+ if (!isIdentifierStart(source[index] ?? "")) {
1140
+ return index;
1141
+ }
1142
+ index += 1;
1143
+ while (index < source.length && (isIdentifierPart(source[index]) || source[index] === "-")) {
1144
+ index += 1;
1145
+ }
1146
+ return index;
1147
+ }
886
1148
  function readCssName(source, index) {
887
1149
  if (!isCssNameStart(source[index] ?? "")) {
888
1150
  return index;
@@ -967,14 +1229,18 @@ function readAnyLineComment(source, index, markers) {
967
1229
  }
968
1230
  return index;
969
1231
  }
970
- function readBlockComment(source, index) {
971
- if (!source.startsWith("/*", index)) {
972
- return index;
1232
+ function readAnyBlockComment(source, index, delimiters) {
1233
+ for (const delimiter of delimiters) {
1234
+ if (source.startsWith(delimiter.start, index)) {
1235
+ return readDelimitedBlock(source, index + delimiter.start.length, delimiter.end);
1236
+ }
973
1237
  }
974
- index += 2;
1238
+ return index;
1239
+ }
1240
+ function readDelimitedBlock(source, index, endMarker) {
975
1241
  while (index < source.length) {
976
- if (source.startsWith("*/", index)) {
977
- return index + 2;
1242
+ if (source.startsWith(endMarker, index)) {
1243
+ return index + endMarker.length;
978
1244
  }
979
1245
  index += 1;
980
1246
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft",
3
- "version": "0.0.81",
3
+ "version": "0.0.83",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -51,7 +51,7 @@
51
51
  "postpack": "node ../../scripts/manage-bundled-workspace-deps.mjs cleanup . toolcraft-design @poe-code/frontmatter @poe-code/agent-mcp-config @poe-code/agent-human-in-loop @poe-code/task-list @poe-code/agent-defs @poe-code/config-mutations @poe-code/process-runner tiny-mcp-client mcp-oauth auth-store"
52
52
  },
53
53
  "dependencies": {
54
- "toolcraft-schema": "0.0.81",
54
+ "toolcraft-schema": "0.0.83",
55
55
  "commander": "^13.1.0",
56
56
  "fast-string-width": "^3.0.2",
57
57
  "fast-wrap-ansi": "^0.2.0",