1 // 2 // Copyright (c) 2025 Huawei Device Co., Ltd. 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 15 // ***************** 16 // *** IMPORTANT *** 17 // ***************** 18 // 19 // 1. This file is only used when gn arg sksl_lex is set to true. It is used to regenerate the 20 // SkSLLexer.h and SkSLLexer.cpp files. 21 // 2. Since token IDs are used to identify operators and baked into the .dehydrated.sksl files, 22 // after modifying this file it is likely everything will break until you update the dehydrated 23 // binaries. If things break after updating the lexer, set REHYDRATE in SkSLCompiler.cpp to 0, 24 // rebuild, and then set it back to 1. 25 26 FLOAT_LITERAL = [0-9]*\.[0-9]+([eE][+-]?[0-9]+)?|[0-9]+\.[0-9]*([eE][+-]?[0-9]+)?|[0-9]+([eE][+-]?[0-9]+) 27 INT_LITERAL = [0-9]+|0[xX][0-9a-fA-F]+ 28 TRUE_LITERAL = "true" 29 FALSE_LITERAL = "false" 30 IF = "if" 31 STATIC_IF = "@if" 32 ELSE = "else" 33 FOR = "for" 34 WHILE = "while" 35 DO = "do" 36 SWITCH = "switch" 37 STATIC_SWITCH = "@switch" 38 CASE = "case" 39 DEFAULT = "default" 40 BREAK = "break" 41 CONTINUE = "continue" 42 DISCARD = "discard" 43 RETURN = "return" 44 IN = "in" 45 OUT = "out" 46 INOUT = "inout" 47 UNIFORM = "uniform" 48 CONST = "const" 49 FLAT = "flat" 50 NOPERSPECTIVE = "noperspective" 51 INLINE = "inline" 52 NOINLINE = "noinline" 53 HASSIDEEFFECTS = "sk_has_side_effects" 54 READONLY = "readonly" 55 WRITEONLY = "writeonly" 56 BUFFER = "buffer" 57 STRUCT = "struct" 58 LAYOUT = "layout" 59 HIGHP = "highp" 60 MEDIUMP = "mediump" 61 LOWP = "lowp" 62 ES3 = "$es3" 63 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_$]* 64 IDENTIFIER = [a-zA-Z_$][0-9a-zA-Z_$]* 65 DIRECTIVE = #[a-zA-Z_$][0-9a-zA-Z_$]* 66 LPAREN = "(" 67 RPAREN = ")" 68 LBRACE = "{" 69 RBRACE = "}" 70 LBRACKET = "[" 71 RBRACKET = "]" 72 DOT = "." 73 COMMA = "," 74 PLUSPLUS = "++" 75 MINUSMINUS = "--" 76 PLUS = "+" 77 MINUS = "-" 78 STAR = "*" 79 SLASH = "/" 80 PERCENT = "%" 81 SHL = "<<" 82 SHR = ">>" 83 BITWISEOR = "|" 84 BITWISEXOR = "^" 85 BITWISEAND = "&" 86 BITWISENOT = "~" 87 LOGICALOR = "||" 88 LOGICALXOR = "^^" 89 LOGICALAND = "&&" 90 LOGICALNOT = "!" 91 QUESTION = "?" 92 COLON = ":" 93 EQ = "=" 94 EQEQ = "==" 95 NEQ = "!=" 96 GT = ">" 97 LT = "<" 98 GTEQ = ">=" 99 LTEQ = "<=" 100 PLUSEQ = "+=" 101 MINUSEQ = "-=" 102 STAREQ = "*=" 103 SLASHEQ = "/=" 104 PERCENTEQ = "%=" 105 SHLEQ = "<<=" 106 SHREQ = ">>=" 107 BITWISEOREQ = "|=" 108 BITWISEXOREQ = "^=" 109 BITWISEANDEQ = "&=" 110 SEMICOLON = ";" 111 ARROW = "->" 112 WHITESPACE = \s+ 113 LINE_COMMENT = //.* 114 BLOCK_COMMENT = /\*([^*]|\*[^/])*\*/ 115 INVALID = . 116