Lines Matching refs:Token
134 , fPushback(Token::INVALID, -1, -1) in Parser()
147 case Token::END_OF_FILE: in file()
149 case Token::DIRECTIVE: { in file()
156 case Token::SECTION: { in file()
174 Token Parser::nextRawToken() { in nextRawToken()
175 if (fPushback.fKind != Token::INVALID) { in nextRawToken()
176 Token result = fPushback; in nextRawToken()
177 fPushback.fKind = Token::INVALID; in nextRawToken()
180 Token result = fLexer.next(); in nextRawToken()
184 Token Parser::nextToken() { in nextToken()
185 Token token = this->nextRawToken(); in nextToken()
186 while (token.fKind == Token::WHITESPACE || token.fKind == Token::LINE_COMMENT || in nextToken()
187 token.fKind == Token::BLOCK_COMMENT) { in nextToken()
193 void Parser::pushback(Token t) { in pushback()
194 SkASSERT(fPushback.fKind == Token::INVALID); in pushback()
198 Token Parser::peek() { in peek()
199 if (fPushback.fKind == Token::INVALID) { in peek()
205 bool Parser::checkNext(Token::Kind kind, Token* result) { in checkNext()
206 if (fPushback.fKind != Token::INVALID && fPushback.fKind != kind) { in checkNext()
209 Token next = this->nextToken(); in checkNext()
220 bool Parser::expect(Token::Kind kind, const char* expected, Token* result) { in expect()
221 Token next = this->nextToken(); in expect()
234 StringFragment Parser::text(Token token) { in text()
238 void Parser::error(Token token, String msg) { in error()
253 Token start; in directive()
254 if (!this->expect(Token::DIRECTIVE, "a directive", &start)) { in directive()
259 this->expect(Token::INT_LITERAL, "a version number"); in directive()
260 Token next = this->peek(); in directive()
269 Token name; in directive()
270 if (!this->expect(Token::IDENTIFIER, "an identifier", &name)) { in directive()
273 if (!this->expect(Token::COLON, "':'")) { in directive()
277 if (!this->expect(Token::IDENTIFIER, "an identifier")) { in directive()
291 Token start; in section()
292 if (!this->expect(Token::SECTION, "a section token", &start)) { in section()
296 if (this->peek().fKind == Token::LPAREN) { in section()
298 Token argToken; in section()
299 if (!this->expect(Token::IDENTIFIER, "an identifier", &argToken)) { in section()
303 if (!this->expect(Token::RPAREN, "')'")) { in section()
307 if (!this->expect(Token::LBRACE, "'{'")) { in section()
313 Token next = this->nextRawToken(); in section()
315 case Token::LBRACE: in section()
318 case Token::RBRACE: in section()
321 case Token::END_OF_FILE: in section()
344 Token start; in enumDeclaration()
345 if (!this->expect(Token::ENUM, "'enum'", &start)) { in enumDeclaration()
348 if (!this->expect(Token::CLASS, "'class'")) { in enumDeclaration()
351 Token name; in enumDeclaration()
352 if (!this->expect(Token::IDENTIFIER, "an identifier", &name)) { in enumDeclaration()
355 if (!this->expect(Token::LBRACE, "'{'")) { in enumDeclaration()
362 if (!this->checkNext(Token::RBRACE)) { in enumDeclaration()
363 Token id; in enumDeclaration()
364 if (!this->expect(Token::IDENTIFIER, "an identifier", &id)) { in enumDeclaration()
368 if (this->checkNext(Token::EQ)) { in enumDeclaration()
377 while (!this->checkNext(Token::RBRACE)) { in enumDeclaration()
378 if (!this->expect(Token::COMMA, "','")) { in enumDeclaration()
381 if (!this->expect(Token::IDENTIFIER, "an identifier", &id)) { in enumDeclaration()
385 if (this->checkNext(Token::EQ)) { in enumDeclaration()
396 this->expect(Token::SEMICOLON, "';'"); in enumDeclaration()
404 Token lookahead = this->peek(); in declaration()
405 if (lookahead.fKind == Token::ENUM) { in declaration()
410 if (lookahead.fKind == Token::IDENTIFIER && !this->isType(this->text(lookahead))) { in declaration()
414 if (lookahead.fKind == Token::STRUCT) { in declaration()
417 if (lookahead.fKind == Token::SEMICOLON) { in declaration()
425 if (type->fKind == ASTType::kStruct_Kind && this->checkNext(Token::SEMICOLON)) { in declaration()
428 Token name; in declaration()
429 if (!this->expect(Token::IDENTIFIER, "an identifier", &name)) { in declaration()
432 if (this->checkNext(Token::LPAREN)) { in declaration()
434 while (this->peek().fKind != Token::RPAREN) { in declaration()
436 if (!this->expect(Token::COMMA, "','")) { in declaration()
448 if (!this->checkNext(Token::SEMICOLON)) { in declaration()
472 Token name; in varDeclarations()
473 if (!this->expect(Token::IDENTIFIER, "an identifier", &name)) { in varDeclarations()
481 if (!this->expect(Token::STRUCT, "'struct'")) { in structDeclaration()
484 Token name; in structDeclaration()
485 if (!this->expect(Token::IDENTIFIER, "an identifier", &name)) { in structDeclaration()
488 if (!this->expect(Token::LBRACE, "'{'")) { in structDeclaration()
492 while (this->peek().fKind != Token::RBRACE) { in structDeclaration()
515 if (!this->expect(Token::RBRACE, "'}'")) { in structDeclaration()
530 Token name; in structVarDeclaration()
531 if (this->checkNext(Token::IDENTIFIER, &name)) { in structVarDeclaration()
545 this->expect(Token::SEMICOLON, "';'"); in structVarDeclaration()
556 while (this->checkNext(Token::LBRACKET)) { in varDeclarationEnd()
557 if (this->checkNext(Token::RBRACKET)) { in varDeclarationEnd()
565 if (!this->expect(Token::RBRACKET, "']'")) { in varDeclarationEnd()
571 if (this->checkNext(Token::EQ)) { in varDeclarationEnd()
578 while (this->checkNext(Token::COMMA)) { in varDeclarationEnd()
579 Token name; in varDeclarationEnd()
580 if (!this->expect(Token::IDENTIFIER, "an identifier", &name)) { in varDeclarationEnd()
585 while (this->checkNext(Token::LBRACKET)) { in varDeclarationEnd()
586 if (this->checkNext(Token::RBRACKET)) { in varDeclarationEnd()
594 if (!this->expect(Token::RBRACKET, "']'")) { in varDeclarationEnd()
599 if (this->checkNext(Token::EQ)) { in varDeclarationEnd()
607 if (!this->expect(Token::SEMICOLON, "';'")) { in varDeclarationEnd()
622 Token name; in parameter()
623 if (!this->expect(Token::IDENTIFIER, "an identifier", &name)) { in parameter()
627 while (this->checkNext(Token::LBRACKET)) { in parameter()
628 Token sizeToken; in parameter()
629 if (!this->expect(Token::INT_LITERAL, "a positive integer", &sizeToken)) { in parameter()
633 if (!this->expect(Token::RBRACKET, "']'")) { in parameter()
643 if (!this->expect(Token::EQ, "'='")) { in layoutInt()
646 Token resultToken; in layoutInt()
647 if (this->expect(Token::INT_LITERAL, "a non-negative integer", &resultToken)) { in layoutInt()
655 if (!this->expect(Token::EQ, "'='")) { in layoutIdentifier()
658 Token resultToken; in layoutIdentifier()
659 if (!this->expect(Token::IDENTIFIER, "an identifier", &resultToken)) { in layoutIdentifier()
668 if (!this->expect(Token::EQ, "'='")) { in layoutCode()
671 Token start = this->nextRawToken(); in layoutCode()
677 Token next = this->nextRawToken(); in layoutCode()
679 case Token::LPAREN: in layoutCode()
682 case Token::RPAREN: in layoutCode()
685 case Token::COMMA: in layoutCode()
690 case Token::END_OF_FILE: in layoutCode()
711 if (this->peek().fKind == Token::EQ) { in layoutKey()
712 this->expect(Token::EQ, "'='"); in layoutKey()
713 Token key; in layoutKey()
714 if (this->expect(Token::IDENTIFIER, "an identifer", &key)) { in layoutKey()
726 if (this->expect(Token::EQ, "'='")) { in layoutCType()
727 Token t = this->nextToken(); in layoutCType()
766 if (this->checkNext(Token::LAYOUT)) { in layout()
767 if (!this->expect(Token::LPAREN, "'('")) { in layout()
773 Token t = this->nextToken(); in layout()
904 if (this->checkNext(Token::RPAREN)) { in layout()
907 if (!this->expect(Token::COMMA, "','")) { in layout()
925 case Token::UNIFORM: in modifiers()
929 case Token::CONST: in modifiers()
933 case Token::IN: in modifiers()
937 case Token::OUT: in modifiers()
941 case Token::INOUT: in modifiers()
946 case Token::FLAT: in modifiers()
950 case Token::NOPERSPECTIVE: in modifiers()
954 case Token::READONLY: in modifiers()
958 case Token::WRITEONLY: in modifiers()
962 case Token::COHERENT: in modifiers()
966 case Token::VOLATILE: in modifiers()
970 case Token::RESTRICT: in modifiers()
974 case Token::BUFFER: in modifiers()
978 case Token::HASSIDEEFFECTS: in modifiers()
982 case Token::PLS: in modifiers()
986 case Token::PLSIN: in modifiers()
990 case Token::PLSOUT: in modifiers()
1010 Token start = this->peek(); in statement()
1012 case Token::IF: // fall through in statement()
1013 case Token::STATIC_IF: in statement()
1015 case Token::FOR: in statement()
1017 case Token::DO: in statement()
1019 case Token::WHILE: in statement()
1021 case Token::SWITCH: // fall through in statement()
1022 case Token::STATIC_SWITCH: in statement()
1024 case Token::RETURN: in statement()
1026 case Token::BREAK: in statement()
1028 case Token::CONTINUE: in statement()
1030 case Token::DISCARD: in statement()
1032 case Token::LBRACE: in statement()
1034 case Token::SEMICOLON: in statement()
1038 case Token::CONST: { in statement()
1045 case Token::IDENTIFIER: in statement()
1062 Token type; in type()
1063 if (!this->expect(Token::IDENTIFIER, "a type", &type)) { in type()
1071 while (this->checkNext(Token::LBRACKET)) { in type()
1072 if (this->peek().fKind != Token::RBRACKET) { in type()
1082 this->expect(Token::RBRACKET, "']'"); in type()
1084 bool nullable = this->checkNext(Token::QUESTION); in type()
1091 Token name; in interfaceBlock()
1092 if (!this->expect(Token::IDENTIFIER, "an identifier", &name)) { in interfaceBlock()
1095 if (peek().fKind != Token::LBRACE) { in interfaceBlock()
1104 while (this->peek().fKind != Token::RBRACE) { in interfaceBlock()
1114 Token instanceNameToken; in interfaceBlock()
1115 if (this->checkNext(Token::IDENTIFIER, &instanceNameToken)) { in interfaceBlock()
1116 while (this->checkNext(Token::LBRACKET)) { in interfaceBlock()
1117 if (this->peek().fKind != Token::RBRACKET) { in interfaceBlock()
1126 this->expect(Token::RBRACKET, "']'"); in interfaceBlock()
1130 this->expect(Token::SEMICOLON, "';'"); in interfaceBlock()
1140 Token start; in ifStatement()
1141 bool isStatic = this->checkNext(Token::STATIC_IF, &start); in ifStatement()
1142 if (!isStatic && !this->expect(Token::IF, "'if'", &start)) { in ifStatement()
1145 if (!this->expect(Token::LPAREN, "'('")) { in ifStatement()
1152 if (!this->expect(Token::RPAREN, "')'")) { in ifStatement()
1160 if (this->checkNext(Token::ELSE)) { in ifStatement()
1175 Token start; in doStatement()
1176 if (!this->expect(Token::DO, "'do'", &start)) { in doStatement()
1183 if (!this->expect(Token::WHILE, "'while'")) { in doStatement()
1186 if (!this->expect(Token::LPAREN, "'('")) { in doStatement()
1193 if (!this->expect(Token::RPAREN, "')'")) { in doStatement()
1196 if (!this->expect(Token::SEMICOLON, "';'")) { in doStatement()
1206 Token start; in whileStatement()
1207 if (!this->expect(Token::WHILE, "'while'", &start)) { in whileStatement()
1210 if (!this->expect(Token::LPAREN, "'('")) { in whileStatement()
1217 if (!this->expect(Token::RPAREN, "')'")) { in whileStatement()
1231 Token start; in switchCase()
1232 if (!this->expect(Token::CASE, "'case'", &start)) { in switchCase()
1239 if (!this->expect(Token::COLON, "':'")) { in switchCase()
1243 while (this->peek().fKind != Token::RBRACE && this->peek().fKind != Token::CASE && in switchCase()
1244 this->peek().fKind != Token::DEFAULT) { in switchCase()
1257 Token start; in switchStatement()
1258 bool isStatic = this->checkNext(Token::STATIC_SWITCH, &start); in switchStatement()
1259 if (!isStatic && !this->expect(Token::SWITCH, "'switch'", &start)) { in switchStatement()
1262 if (!this->expect(Token::LPAREN, "'('")) { in switchStatement()
1269 if (!this->expect(Token::RPAREN, "')'")) { in switchStatement()
1272 if (!this->expect(Token::LBRACE, "'{'")) { in switchStatement()
1276 while (this->peek().fKind == Token::CASE) { in switchStatement()
1285 if (this->peek().fKind == Token::DEFAULT) { in switchStatement()
1286 Token defaultStart; in switchStatement()
1287 SkAssertResult(this->expect(Token::DEFAULT, "'default'", &defaultStart)); in switchStatement()
1288 if (!this->expect(Token::COLON, "':'")) { in switchStatement()
1292 while (this->peek().fKind != Token::RBRACE) { in switchStatement()
1302 if (!this->expect(Token::RBRACE, "'}'")) { in switchStatement()
1314 Token start; in forStatement()
1315 if (!this->expect(Token::FOR, "'for'", &start)) { in forStatement()
1318 if (!this->expect(Token::LPAREN, "'('")) { in forStatement()
1322 Token nextToken = this->peek(); in forStatement()
1324 case Token::SEMICOLON: in forStatement()
1327 case Token::CONST: { in forStatement()
1336 case Token::IDENTIFIER: { in forStatement()
1351 if (this->peek().fKind != Token::SEMICOLON) { in forStatement()
1357 if (!this->expect(Token::SEMICOLON, "';'")) { in forStatement()
1361 if (this->peek().fKind != Token::RPAREN) { in forStatement()
1367 if (!this->expect(Token::RPAREN, "')'")) { in forStatement()
1382 Token start; in returnStatement()
1383 if (!this->expect(Token::RETURN, "'return'", &start)) { in returnStatement()
1387 if (this->peek().fKind != Token::SEMICOLON) { in returnStatement()
1393 if (!this->expect(Token::SEMICOLON, "';'")) { in returnStatement()
1402 Token start; in breakStatement()
1403 if (!this->expect(Token::BREAK, "'break'", &start)) { in breakStatement()
1406 if (!this->expect(Token::SEMICOLON, "';'")) { in breakStatement()
1414 Token start; in continueStatement()
1415 if (!this->expect(Token::CONTINUE, "'continue'", &start)) { in continueStatement()
1418 if (!this->expect(Token::SEMICOLON, "';'")) { in continueStatement()
1426 Token start; in discardStatement()
1427 if (!this->expect(Token::DISCARD, "'continue'", &start)) { in discardStatement()
1430 if (!this->expect(Token::SEMICOLON, "';'")) { in discardStatement()
1442 Token start; in block()
1443 if (!this->expect(Token::LBRACE, "'{'", &start)) { in block()
1449 case Token::RBRACE: in block()
1453 case Token::END_OF_FILE: in block()
1471 if (this->expect(Token::SEMICOLON, "';'")) { in expressionStatement()
1494 Token t; in commaExpression()
1495 while (this->checkNext(Token::COMMA, &t)) { in commaExpression()
1516 case Token::EQ: // fall through in assignmentExpression()
1517 case Token::STAREQ: // fall through in assignmentExpression()
1518 case Token::SLASHEQ: // fall through in assignmentExpression()
1519 case Token::PERCENTEQ: // fall through in assignmentExpression()
1520 case Token::PLUSEQ: // fall through in assignmentExpression()
1521 case Token::MINUSEQ: // fall through in assignmentExpression()
1522 case Token::SHLEQ: // fall through in assignmentExpression()
1523 case Token::SHREQ: // fall through in assignmentExpression()
1524 case Token::BITWISEANDEQ: // fall through in assignmentExpression()
1525 case Token::BITWISEXOREQ: // fall through in assignmentExpression()
1526 case Token::BITWISEOREQ: // fall through in assignmentExpression()
1527 case Token::LOGICALANDEQ: // fall through in assignmentExpression()
1528 case Token::LOGICALXOREQ: // fall through in assignmentExpression()
1529 case Token::LOGICALOREQ: { in assignmentExpression()
1530 Token t = this->nextToken(); in assignmentExpression()
1552 if (this->checkNext(Token::QUESTION)) { in ternaryExpression()
1557 if (this->expect(Token::COLON, "':'")) { in ternaryExpression()
1574 Token t; in logicalOrExpression()
1575 while (this->checkNext(Token::LOGICALOR, &t)) { in logicalOrExpression()
1591 Token t; in logicalXorExpression()
1592 while (this->checkNext(Token::LOGICALXOR, &t)) { in logicalXorExpression()
1608 Token t; in logicalAndExpression()
1609 while (this->checkNext(Token::LOGICALAND, &t)) { in logicalAndExpression()
1625 Token t; in bitwiseOrExpression()
1626 while (this->checkNext(Token::BITWISEOR, &t)) { in bitwiseOrExpression()
1642 Token t; in bitwiseXorExpression()
1643 while (this->checkNext(Token::BITWISEXOR, &t)) { in bitwiseXorExpression()
1659 Token t; in bitwiseAndExpression()
1660 while (this->checkNext(Token::BITWISEAND, &t)) { in bitwiseAndExpression()
1678 case Token::EQEQ: // fall through in equalityExpression()
1679 case Token::NEQ: { in equalityExpression()
1680 Token t = this->nextToken(); in equalityExpression()
1702 case Token::LT: // fall through in relationalExpression()
1703 case Token::GT: // fall through in relationalExpression()
1704 case Token::LTEQ: // fall through in relationalExpression()
1705 case Token::GTEQ: { in relationalExpression()
1706 Token t = this->nextToken(); in relationalExpression()
1729 case Token::SHL: // fall through in shiftExpression()
1730 case Token::SHR: { in shiftExpression()
1731 Token t = this->nextToken(); in shiftExpression()
1754 case Token::PLUS: // fall through in additiveExpression()
1755 case Token::MINUS: { in additiveExpression()
1756 Token t = this->nextToken(); in additiveExpression()
1779 case Token::STAR: // fall through in multiplicativeExpression()
1780 case Token::SLASH: // fall through in multiplicativeExpression()
1781 case Token::PERCENT: { in multiplicativeExpression()
1782 Token t = this->nextToken(); in multiplicativeExpression()
1800 case Token::PLUS: // fall through in unaryExpression()
1801 case Token::MINUS: // fall through in unaryExpression()
1802 case Token::LOGICALNOT: // fall through in unaryExpression()
1803 case Token::BITWISENOT: // fall through in unaryExpression()
1804 case Token::PLUSPLUS: // fall through in unaryExpression()
1805 case Token::MINUSMINUS: { in unaryExpression()
1810 Token t = this->nextToken(); in unaryExpression()
1831 case Token::LBRACKET: // fall through in postfixExpression()
1832 case Token::DOT: // fall through in postfixExpression()
1833 case Token::LPAREN: // fall through in postfixExpression()
1834 case Token::PLUSPLUS: // fall through in postfixExpression()
1835 case Token::MINUSMINUS: // fall through in postfixExpression()
1836 case Token::COLONCOLON: { in postfixExpression()
1853 Token next = this->nextToken(); in suffix()
1855 case Token::LBRACKET: { in suffix()
1856 if (this->checkNext(Token::RBRACKET)) { in suffix()
1863 this->expect(Token::RBRACKET, "']' to complete array access expression"); in suffix()
1866 case Token::DOT: // fall through in suffix()
1867 case Token::COLONCOLON: { in suffix()
1875 case Token::LPAREN: { in suffix()
1877 if (this->peek().fKind != Token::RPAREN) { in suffix()
1884 if (!this->checkNext(Token::COMMA)) { in suffix()
1889 this->expect(Token::RPAREN, "')' to complete function parameters"); in suffix()
1893 case Token::PLUSPLUS: in suffix()
1896 case Token::MINUSMINUS: in suffix()
1910 Token t = this->peek(); in term()
1912 case Token::IDENTIFIER: { in term()
1919 case Token::INT_LITERAL: { in term()
1926 case Token::FLOAT_LITERAL: { in term()
1933 case Token::TRUE_LITERAL: // fall through in term()
1934 case Token::FALSE_LITERAL: { in term()
1941 case Token::NULL_LITERAL: in term()
1945 case Token::LPAREN: { in term()
1949 this->expect(Token::RPAREN, "')' to complete expression"); in term()
1963 Token t; in intLiteral()
1964 if (this->expect(Token::INT_LITERAL, "integer literal", &t)) { in intLiteral()
1973 Token t; in floatLiteral()
1974 if (this->expect(Token::FLOAT_LITERAL, "float literal", &t)) { in floatLiteral()
1983 Token t = this->nextToken(); in boolLiteral()
1985 case Token::TRUE_LITERAL: in boolLiteral()
1988 case Token::FALSE_LITERAL: in boolLiteral()
1999 Token t; in identifier()
2000 if (this->expect(Token::IDENTIFIER, "identifier", &t)) { in identifier()