* Move CodeMirror LRLanguage to new file This separates the base language support from the LSP and color picker. * Move the base CodeMirror KCL support to a local package * Start CodeMirror grammar tests * Exclude vitest config in tsconfig * Add KCL path to tsconfig * Remove stray import * Drop extension from import * Use __filename for commonjs compat * Check exec return before access * Build ES and CJS to dist * Format * Exclude all.test.ts from codespell This is to work around "fileTests" imported from Lezer. Future codespell versions look like they'll allow the code to be annotated, which would be nicer. --------- Co-authored-by: Matt Mundell <matt@mundell.me>
61 lines
923 B
Plaintext
61 lines
923 B
Plaintext
# Booleans
|
|
|
|
true
|
|
false
|
|
|
|
==>
|
|
|
|
Program(ExpressionStatement(true), ExpressionStatement(false))
|
|
|
|
# Identifiers
|
|
|
|
one
|
|
_Two_Three
|
|
Four5
|
|
|
|
==>
|
|
|
|
Program(ExpressionStatement(VariableName),
|
|
ExpressionStatement(VariableName),
|
|
ExpressionStatement(VariableName))
|
|
|
|
# Strings
|
|
|
|
"hello"
|
|
'hi'
|
|
"one\"\\two"
|
|
'3\'\\four\x'
|
|
|
|
==>
|
|
|
|
Program(ExpressionStatement(String),
|
|
ExpressionStatement(String),
|
|
ExpressionStatement(String),
|
|
ExpressionStatement(String))
|
|
|
|
# VariableDeclaration
|
|
|
|
let a = 'abc'
|
|
export const x = 0.2
|
|
|
|
==>
|
|
|
|
Program(VariableDeclaration(let, VariableDefinition, Equals, String),
|
|
VariableDeclaration(export, const, VariableDefinition, Equals, Number))
|
|
|
|
# IfExpression
|
|
|
|
if x { 1 } else { $tag }
|
|
|
|
==>
|
|
|
|
Program(ExpressionStatement(IfExpression(if, VariableName, Body(ExpressionStatement(Number)), else, Body(ExpressionStatement(TagDeclarator)))))
|
|
|
|
# Shebang
|
|
|
|
#!anything
|
|
|
|
==>
|
|
|
|
Program(Shebang)
|