• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // *****************
2 // *** IMPORTANT ***
3 // *****************
4 //
5 // 1. This file is only used when gn arg sksl_lex is set to true. It is used to regenerate the
6 //    SkSLLexer.h and SkSLLexer.cpp files.
7 // 2. Since token IDs are used to identify operators and baked into the .dehydrated.sksl files,
8 //    after modifying this file it is likely everything will break until you update the dehydrated
9 //    binaries. If things break after updating the lexer, set REHYDRATE in SkSLCompiler.cpp to 0,
10 //    rebuild, and then set it back to 1.
11 
12 FLOAT_LITERAL  = [0-9]*\.[0-9]+([eE][+-]?[0-9]+)?|[0-9]+\.[0-9]*([eE][+-]?[0-9]+)?|[0-9]+([eE][+-]?[0-9]+)
13 INT_LITERAL    = [0-9]+|0[xX][0-9a-fA-F]+
14 TRUE_LITERAL   = "true"
15 FALSE_LITERAL  = "false"
16 IF             = "if"
17 STATIC_IF      = "@if"
18 ELSE           = "else"
19 FOR            = "for"
20 WHILE          = "while"
21 DO             = "do"
22 SWITCH         = "switch"
23 STATIC_SWITCH  = "@switch"
24 CASE           = "case"
25 DEFAULT        = "default"
26 BREAK          = "break"
27 CONTINUE       = "continue"
28 DISCARD        = "discard"
29 RETURN         = "return"
30 IN             = "in"
31 OUT            = "out"
32 INOUT          = "inout"
33 UNIFORM        = "uniform"
34 CONST          = "const"
35 FLAT           = "flat"
36 NOPERSPECTIVE  = "noperspective"
37 INLINE         = "inline"
38 NOINLINE       = "noinline"
39 HASSIDEEFFECTS = "sk_has_side_effects"
40 STRUCT         = "struct"
41 LAYOUT         = "layout"
42 HIGHP          = "highp"
43 MEDIUMP        = "mediump"
44 LOWP           = "lowp"
45 ES3            = "$es3"
46 RESERVED       = attribute|varying|precision|invariant|asm|class|union|enum|typedef|template|this|packed|goto|volatile|public|static|extern|external|interface|long|double|fixed|unsigned|superp|input|output|hvec[234]|dvec[234]|fvec[234]|sampler[12]DShadow|sampler3DRect|sampler2DRectShadow|samplerCube|sizeof|cast|namespace|using|gl_[0-9a-zA-Z_$]*
47 IDENTIFIER     = [a-zA-Z_$][0-9a-zA-Z_$]*
48 DIRECTIVE      = #[a-zA-Z_$][0-9a-zA-Z_$]*
49 LPAREN         = "("
50 RPAREN         = ")"
51 LBRACE         = "{"
52 RBRACE         = "}"
53 LBRACKET       = "["
54 RBRACKET       = "]"
55 DOT            = "."
56 COMMA          = ","
57 PLUSPLUS       = "++"
58 MINUSMINUS     = "--"
59 PLUS           = "+"
60 MINUS          = "-"
61 STAR           = "*"
62 SLASH          = "/"
63 PERCENT        = "%"
64 SHL            = "<<"
65 SHR            = ">>"
66 BITWISEOR      = "|"
67 BITWISEXOR     = "^"
68 BITWISEAND     = "&"
69 BITWISENOT     = "~"
70 LOGICALOR      = "||"
71 LOGICALXOR     = "^^"
72 LOGICALAND     = "&&"
73 LOGICALNOT     = "!"
74 QUESTION       = "?"
75 COLON          = ":"
76 EQ             = "="
77 EQEQ           = "=="
78 NEQ            = "!="
79 GT             = ">"
80 LT             = "<"
81 GTEQ           = ">="
82 LTEQ           = "<="
83 PLUSEQ         = "+="
84 MINUSEQ        = "-="
85 STAREQ         = "*="
86 SLASHEQ        = "/="
87 PERCENTEQ      = "%="
88 SHLEQ          = "<<="
89 SHREQ          = ">>="
90 BITWISEOREQ    = "|="
91 BITWISEXOREQ   = "^="
92 BITWISEANDEQ   = "&="
93 SEMICOLON      = ";"
94 ARROW          = "->"
95 WHITESPACE     = \s+
96 LINE_COMMENT   = //.*
97 BLOCK_COMMENT  = /\*([^*]|\*[^/])*\*/
98 INVALID        = .
99