OLD | NEW |
(Empty) | |
| 1 /* |
| 2 |
| 3 This file is IGNORED during the build process! |
| 4 |
| 5 As this file is updated so infrequently and flex is not universally pres
ent on build machines, |
| 6 the lex.sksl.c file must be manually regenerated if you make any changes
to this file. Just run: |
| 7 |
| 8 flex sksl.flex |
| 9 |
| 10 You will have to manually add a copyright notice to the top of lex.sksl.c. |
| 11 |
| 12 */ |
| 13 |
| 14 %option prefix="sksl" |
| 15 %option reentrant |
| 16 %option yylineno |
| 17 %option never-interactive |
| 18 %option nounistd |
| 19 |
| 20 DIGIT [0-9] |
| 21 LETTER [a-zA-Z_$] |
| 22 |
| 23 %% |
| 24 |
| 25 {DIGIT}*"."{DIGIT}+([eE][+-]?{DIGIT}+)? { return SkSL::Token::FLOAT_LITERAL; } |
| 26 |
| 27 {DIGIT}+"."{DIGIT}*([eE][+-]?{DIGIT}+)? { return SkSL::Token::FLOAT_LITERAL; } |
| 28 |
| 29 {DIGIT}+([eE][+-]?{DIGIT}+) { return SkSL::Token::FLOAT_LITERAL; } |
| 30 |
| 31 {DIGIT}+ { return SkSL::Token::INT_LITERAL; } |
| 32 |
| 33 true { return SkSL::Token::TRUE_LITERAL; } |
| 34 |
| 35 false { return SkSL::Token::FALSE_LITERAL; } |
| 36 |
| 37 if { return SkSL::Token::IF; } |
| 38 |
| 39 else { return SkSL::Token::ELSE; } |
| 40 |
| 41 for { return SkSL::Token::FOR; } |
| 42 |
| 43 while { return SkSL::Token::WHILE; } |
| 44 |
| 45 do { return SkSL::Token::DO; } |
| 46 |
| 47 break { return SkSL::Token::BREAK; } |
| 48 |
| 49 continue { return SkSL::Token::CONTINUE; } |
| 50 |
| 51 discard { return SkSL::Token::DISCARD; } |
| 52 |
| 53 return { return SkSL::Token::RETURN; } |
| 54 |
| 55 in { return SkSL::Token::IN; } |
| 56 |
| 57 out { return SkSL::Token::OUT; } |
| 58 |
| 59 inout { return SkSL::Token::INOUT; } |
| 60 |
| 61 uniform { return SkSL::Token::UNIFORM; } |
| 62 |
| 63 const { return SkSL::Token::CONST; } |
| 64 |
| 65 lowp { return SkSL::Token::LOWP; } |
| 66 |
| 67 mediump { return SkSL::Token::MEDIUMP; } |
| 68 |
| 69 highp { return SkSL::Token::HIGHP; } |
| 70 |
| 71 struct { return SkSL::Token::STRUCT; } |
| 72 |
| 73 layout { return SkSL::Token::LAYOUT; } |
| 74 |
| 75 precision { return SkSL::Token::PRECISION; } |
| 76 |
| 77 {LETTER}({DIGIT}|{LETTER})* { return SkSL::Token::IDENTIFIER; } |
| 78 |
| 79 "#"{LETTER}({DIGIT}|{LETTER})* { return SkSL::Token::DIRECTIVE; } |
| 80 |
| 81 "(" { return SkSL::Token::LPAREN; } |
| 82 |
| 83 ")" { return SkSL::Token::RPAREN; } |
| 84 |
| 85 "{" { return SkSL::Token::LBRACE; } |
| 86 |
| 87 "}" { return SkSL::Token::RBRACE; } |
| 88 |
| 89 "[" { return SkSL::Token::LBRACKET; } |
| 90 |
| 91 "]" { return SkSL::Token::RBRACKET; } |
| 92 |
| 93 "." { return SkSL::Token::DOT; } |
| 94 |
| 95 "," { return SkSL::Token::COMMA; } |
| 96 |
| 97 "++" { return SkSL::Token::PLUSPLUS; } |
| 98 |
| 99 "--" { return SkSL::Token::MINUSMINUS; } |
| 100 |
| 101 "+" { return SkSL::Token::PLUS; } |
| 102 |
| 103 "-" { return SkSL::Token::MINUS; } |
| 104 |
| 105 "*" { return SkSL::Token::STAR; } |
| 106 |
| 107 "/" { return SkSL::Token::SLASH; } |
| 108 |
| 109 "%" { return SkSL::Token::PERCENT; } |
| 110 |
| 111 "<<" { return SkSL::Token::SHL; } |
| 112 |
| 113 ">>" { return SkSL::Token::SHR; } |
| 114 |
| 115 "|" { return SkSL::Token::BITWISEOR; } |
| 116 |
| 117 "^" { return SkSL::Token::BITWISEXOR; } |
| 118 |
| 119 "&" { return SkSL::Token::BITWISEAND; } |
| 120 |
| 121 "||" { return SkSL::Token::LOGICALOR; } |
| 122 |
| 123 "^^" { return SkSL::Token::LOGICALXOR; } |
| 124 |
| 125 "&&" { return SkSL::Token::LOGICALAND; } |
| 126 |
| 127 "!" { return SkSL::Token::NOT; } |
| 128 |
| 129 "?" { return SkSL::Token::QUESTION; } |
| 130 |
| 131 ":" { return SkSL::Token::COLON; } |
| 132 |
| 133 "=" { return SkSL::Token::EQ; } |
| 134 |
| 135 "==" { return SkSL::Token::EQEQ; } |
| 136 |
| 137 "!=" { return SkSL::Token::NEQ; } |
| 138 |
| 139 ">" { return SkSL::Token::GT; } |
| 140 |
| 141 "<" { return SkSL::Token::LT; } |
| 142 |
| 143 ">=" { return SkSL::Token::GTEQ; } |
| 144 |
| 145 "<=" { return SkSL::Token::LTEQ; } |
| 146 |
| 147 "+=" { return SkSL::Token::PLUSEQ; } |
| 148 |
| 149 "-=" { return SkSL::Token::MINUSEQ; } |
| 150 |
| 151 "*=" { return SkSL::Token::STAREQ; } |
| 152 |
| 153 "/=" { return SkSL::Token::SLASHEQ; } |
| 154 |
| 155 "%=" { return SkSL::Token::PERCENTEQ; } |
| 156 |
| 157 "<<=" { return SkSL::Token::SHLEQ; } |
| 158 |
| 159 ">>=" { return SkSL::Token::SHREQ; } |
| 160 |
| 161 "|=" { return SkSL::Token::BITWISEOREQ; } |
| 162 |
| 163 "^=" { return SkSL::Token::BITWISEXOREQ; } |
| 164 |
| 165 "&=" { return SkSL::Token::BITWISEANDEQ; } |
| 166 |
| 167 "||=" { return SkSL::Token::LOGICALOREQ; } |
| 168 |
| 169 "^^=" { return SkSL::Token::LOGICALXOREQ; } |
| 170 |
| 171 "&&=" { return SkSL::Token::LOGICALANDEQ; } |
| 172 |
| 173 ";" { return SkSL::Token::SEMICOLON; } |
| 174 |
| 175 "//".* /* line comment */ |
| 176 |
| 177 "/*"([^*]|"*"[^/])*"*/" /* block comment */ |
| 178 |
| 179 [ \t\r\n]+ /* whitespace */ |
| 180 |
| 181 . { return SkSL::Token::INVALID_TOKEN; } |
| 182 |
| 183 %% |
| 184 |
| 185 int skslwrap(yyscan_t scanner) { |
| 186 return 1; // terminate |
| 187 } |
OLD | NEW |