* Add new types and fix capitalization in CodeMirror grammar * Add syntax highlighting for types
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { styleTags, tags as t } from '@lezer/highlight'
|
|
|
|
export const kclHighlight = styleTags({
|
|
'import export': t.moduleKeyword,
|
|
ImportItemAs: t.definitionKeyword,
|
|
ImportFrom: t.moduleKeyword,
|
|
'fn var let const': t.definitionKeyword,
|
|
'if else': t.controlKeyword,
|
|
return: t.controlKeyword,
|
|
'true false': t.bool,
|
|
nil: t.null,
|
|
'AddOp MultOp ExpOp': t.arithmeticOperator,
|
|
BangOp: t.logicOperator,
|
|
CompOp: t.compareOperator,
|
|
LogicOp: t.logicOperator,
|
|
'Equals Arrow': t.definitionOperator,
|
|
PipeOperator: t.controlOperator,
|
|
String: t.string,
|
|
Number: t.number,
|
|
LineComment: t.lineComment,
|
|
BlockComment: t.blockComment,
|
|
Shebang: t.meta,
|
|
AnnotationName: t.annotation,
|
|
PipeSubstitution: t.atom,
|
|
VariableDefinition: t.definition(t.variableName),
|
|
VariableName: t.variableName,
|
|
PropertyName: t.propertyName,
|
|
'AnnotationProperty/PropertyName': t.definition(t.propertyName),
|
|
'ObjectProperty/PropertyName': t.definition(t.propertyName),
|
|
'LabeledArgument/ArgumentLabel': t.definition(t.propertyName),
|
|
TagDeclarator: t.tagName,
|
|
PrimitiveType: t.typeName,
|
|
'( )': t.paren,
|
|
'{ }': t.brace,
|
|
'[ ]': t.bracket,
|
|
', . : ? ..': t.punctuation,
|
|
})
|