aboutsummaryrefslogtreecommitdiff
path: root/src/highlight.ts
blob: 7835929e8983db2202b5419e76cae2b6309083e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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,
});