diff options
| author | Elizabeth Hunt <me@liz.coffee> | 2026-01-04 23:37:57 -0800 |
|---|---|---|
| committer | Elizabeth Hunt <me@liz.coffee> | 2026-01-04 23:39:56 -0800 |
| commit | f2aec5ca1434ff4dc43c51b47faa8347e1ebf3e2 (patch) | |
| tree | 087b028bf56f008823d5f135888ac0252fa8fc66 /src/highlight.ts | |
| parent | 1f5d5ae9de3c87be7faf60b0a0f028e7b7c3507e (diff) | |
| download | codemirror-lang-tabloid-f2aec5ca1434ff4dc43c51b47faa8347e1ebf3e2.tar.gz codemirror-lang-tabloid-f2aec5ca1434ff4dc43c51b47faa8347e1ebf3e2.zip | |
Better impl
Diffstat (limited to 'src/highlight.ts')
| -rw-r--r-- | src/highlight.ts | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/highlight.ts b/src/highlight.ts new file mode 100644 index 0000000..7835929 --- /dev/null +++ b/src/highlight.ts @@ -0,0 +1,61 @@ +import { styleTags, tags as t } from "@lezer/highlight"; + +export const highlighting = styleTags({ + // Comments + Comment: t.lineComment, + + // Literals + NumberLiteral: t.number, + StringLiteral: t.string, + BooleanLiteral: t.bool, + + // Identifiers + Identifier: t.variableName, + "FunctionDecl/Identifier": t.function(t.definition(t.variableName)), + "FunctionCall/Identifier": t.function(t.variableName), + "ArgumentList/Identifier": t.variableName, + + // Keywords - Definitions (use controlKeyword for better color) + discoverHowTo: t.controlKeyword, + expertsClaim: t.keyword, + toBe: t.operator, + with: t.keyword, + of: t.keyword, + + // Keywords - Control flow + whatIf: t.controlKeyword, + liesBang: t.controlKeyword, + shockingDevelopment: t.controlKeyword, + + // Keywords - I/O + youWontWantToMiss: t.keyword, + latestNewsOn: t.keyword, + + // Keywords - Block delimiters + rumorHasIt: t.brace, + endOfStory: t.brace, + + // Keywords - Program structure + pleaseLikeAndSubscribe: t.moduleKeyword, + + // Operators - Comparison + isActually: t.compareOperator, + beats: t.compareOperator, + smallerThan: t.compareOperator, + + // Operators - Logical + and: t.logicOperator, + or: t.logicOperator, + + // Operators - Arithmetic + plus: t.arithmeticOperator, + minus: t.arithmeticOperator, + times: t.arithmeticOperator, + dividedBy: t.arithmeticOperator, + modulo: t.arithmeticOperator, + + // Punctuation + "(": t.paren, + ")": t.paren, + ",": t.separator, +}); |
