1 // ***************** 2 // *** IMPORTANT *** 3 // ***************** 4 // 5 // 1. This file is only used when gn arg skia_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 = ([1-9][0-9]*|0[0-7]*|0[xX][0-9a-fA-F]+)[uU]? 14 BAD_OCTAL = (0[0-9]+)[uU]? 15 TRUE_LITERAL = "true" 16 FALSE_LITERAL = "false" 17 IF = "if" 18 ELSE = "else" 19 FOR = "for" 20 WHILE = "while" 21 DO = "do" 22 SWITCH = "switch" 23 CASE = "case" 24 DEFAULT = "default" 25 BREAK = "break" 26 CONTINUE = "continue" 27 DISCARD = "discard" 28 RETURN = "return" 29 IN = "in" 30 OUT = "out" 31 INOUT = "inout" 32 UNIFORM = "uniform" 33 CONST = "const" 34 FLAT = "flat" 35 NOPERSPECTIVE = "noperspective" 36 INLINE = "inline" 37 NOINLINE = "noinline" 38 PURE = "$pure" 39 READONLY = "readonly" 40 WRITEONLY = "writeonly" 41 BUFFER = "buffer" 42 STRUCT = "struct" 43 LAYOUT = "layout" 44 HIGHP = "highp" 45 MEDIUMP = "mediump" 46 LOWP = "lowp" 47 ES3 = "$es3" 48 EXPORT = "$export" 49 WORKGROUP = "workgroup" 50 PIXELLOCAL = "pixel_local" 51 RESERVED = atomic|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]|dmat[234]|dmat[234]x[234]|fvec[234]|(iimage|image|isampler|itexture|uimage|usampler|utexture)(1D|2D|3D|1DArray|2DArray|2DRect|2DMS|2DMSArray|Buffer|Cube|CubeArray)|(sampler|texture)(1D|1DArray|2DArray|2DMS|2DMSArray|3D|Buffer|Cube|CubeArray)|sampler(1DArrayShadow|1DShadow|2DArrayShadow|2DShadow|2DRectShadow|3DRect|CubeArrayShadow|CubeShadow|Shadow)|[iu]subpassInput(MS)?|sizeof|cast|namespace|using|gl_[0-9a-zA-Z_]* 52 PRIVATE_IDENTIFIER = $[0-9a-zA-Z_]* 53 IDENTIFIER = [a-zA-Z_][0-9a-zA-Z_]* 54 DIRECTIVE = #[a-zA-Z_][0-9a-zA-Z_]* 55 LPAREN = "(" 56 RPAREN = ")" 57 LBRACE = "{" 58 RBRACE = "}" 59 LBRACKET = "[" 60 RBRACKET = "]" 61 DOT = "." 62 COMMA = "," 63 PLUSPLUS = "++" 64 MINUSMINUS = "--" 65 PLUS = "+" 66 MINUS = "-" 67 STAR = "*" 68 SLASH = "/" 69 PERCENT = "%" 70 SHL = "<<" 71 SHR = ">>" 72 BITWISEOR = "|" 73 BITWISEXOR = "^" 74 BITWISEAND = "&" 75 BITWISENOT = "~" 76 LOGICALOR = "||" 77 LOGICALXOR = "^^" 78 LOGICALAND = "&&" 79 LOGICALNOT = "!" 80 QUESTION = "?" 81 COLON = ":" 82 EQ = "=" 83 EQEQ = "==" 84 NEQ = "!=" 85 GT = ">" 86 LT = "<" 87 GTEQ = ">=" 88 LTEQ = "<=" 89 PLUSEQ = "+=" 90 MINUSEQ = "-=" 91 STAREQ = "*=" 92 SLASHEQ = "/=" 93 PERCENTEQ = "%=" 94 SHLEQ = "<<=" 95 SHREQ = ">>=" 96 BITWISEOREQ = "|=" 97 BITWISEXOREQ = "^=" 98 BITWISEANDEQ = "&=" 99 SEMICOLON = ";" 100 WHITESPACE = \s+ 101 LINE_COMMENT = //.* 102 BLOCK_COMMENT = /\*([^*]|\*[^/])*\*/ 103 INVALID = . 104