Source file tokens.ml

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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
open Base

type whitespace_control = Trim | White [@@deriving show]

type block_token =
  | StatementStart of whitespace_control
  | StatementEnd of whitespace_control
  | ExpressionStart of whitespace_control
  | ExpressionEnd of whitespace_control
  | LiquidStart
  | RawText of string
[@@deriving show]

type operator = Eq | Gte | Gt | Lte | Lt | Ne | Contains [@@deriving show]

type lex_value =
  | LexBool of bool
  | LexString of string
  | LexNumber of float
  | LexId of string list
  | LexRange of int * int
  | LexNil
  | LexBlank
[@@deriving show]

type lex_combiner = LexAnd | LexOr [@@deriving show]

type lex_token =
  | If
  | EndIf
  | Unless
  | EndUnless
  | Case
  | EndCase
  | LexFor
  | LexEndFor
  | Capture
  | EndCapture
  | Paginate
  | EndPaginate
  | TableRow
  | EndTableRow
  | Raw
  | EndRaw
  | ElseIf
  | Else
  | When
  | LexForm
  | LexStyle
  | LexEndForm
  | LexEndStyle
  | LexInclude
  | LexRender
  | LexLayout
  | LexSection
  | LexBreak
  | LexContinue
  | Cycle
  | In
  | By
  | LexWith
  | LexAs
  | Assign
  | Increment
  | Decrement
  | Pipe
  | Colon
  | Equals
  | Comma
  | LexNone
  | Space
  | Newline
  | Operator of operator
  | LexText of string
  | LexCombiner of lex_combiner
  | LexValue of lex_value
  | LexExpression of lex_token list
  | EOS
[@@deriving show]