aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/lex/sksl.lex
blob: ada5e248deba0cbddf6ffba698ccee2afd94cc2a (plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
FLOAT_LITERAL  = [0-9]*\.[0-9]+([eE][+-]?[0-9]+)?|[0-9]+\.[0-9]*([eE][+-]?[0-9]+)?|[0-9]+([eE][+-]?[0-9]+)
INT_LITERAL    = [0-9]+|0x[0-9a-fA-F]+
TRUE_LITERAL   = "true"
FALSE_LITERAL  = "false"
IF             = "if"
STATIC_IF      = "@if"
ELSE           = "else"
FOR            = "for"
WHILE          = "while"
DO             = "do"
SWITCH         = "switch"
STATIC_SWITCH  = "@switch"
CASE           = "case"
DEFAULT        = "default"
BREAK          = "break"
CONTINUE       = "continue"
DISCARD        = "discard"
RETURN         = "return"
IN             = "in"
OUT            = "out"
INOUT          = "inout"
UNIFORM        = "uniform"
CONST          = "const"
LOWP           = "lowp"
MEDIUMP        = "mediump"
HIGHP          = "highp"
FLAT           = "flat"
NOPERSPECTIVE  = "noperspective"
READONLY       = "readonly"
WRITEONLY      = "writeonly"
COHERENT       = "coherent"
VOLATILE       = "volatile"
RESTRICT       = "restrict"
BUFFER         = "buffer"
HASSIDEEFFECTS = "sk_has_side_effects"
STRUCT         = "struct"
LAYOUT         = "layout"
PRECISION      = "precision"
IDENTIFIER     = [a-zA-Z_$]([0-9]|[a-zA-Z_$])*
DIRECTIVE      = #[a-zA-Z_$]([0-9]|[a-zA-Z_$])*
SECTION        = @[a-zA-Z_$]([0-9]|[a-zA-Z_$])*
LPAREN         = "("
RPAREN         = ")"
LBRACE         = "{"
RBRACE         = "}"
LBRACKET       = "["
RBRACKET       = "]"
DOT            = "."
COMMA          = ","
PLUSPLUS       = "++"
MINUSMINUS     = "--"
PLUS           = "+"
MINUS          = "-"
STAR           = "*"
SLASH          = "/"
PERCENT        = "%"
SHL            = "<<"
SHR            = ">>"
BITWISEOR      = "|"
BITWISEXOR     = "^"
BITWISEAND     = "&"
BITWISENOT     = "~"
LOGICALOR      = "||"
LOGICALXOR     = "^^"
LOGICALAND     = "&&"
LOGICALNOT     = "!"
QUESTION       = "?"
COLON          = ":"
EQ             = "="
EQEQ           = "=="
NEQ            = "!="
GT             = ">"
LT             = "<"
GTEQ           = ">="
LTEQ           = "<="
PLUSEQ         = "+="
MINUSEQ        = "-="
STAREQ         = "*="
SLASHEQ        = "/="
PERCENTEQ      = "%="
SHLEQ          = "<<="
SHREQ          = ">>="
BITWISEOREQ    = "|="
BITWISEXOREQ   = "^="
BITWISEANDEQ   = "&="
LOGICALOREQ    = "||="
LOGICALXOREQ   = "^^="
LOGICALANDEQ   = "&&="
SEMICOLON      = ";"
ARROW          = "->"
COLONCOLON     = "::"
WHITESPACE     = \s+
LINE_COMMENT   = //.*
BLOCK_COMMENT  = /\*([^*]|\*[^/])*\*/
INVALID        = .