Lines Matching refs:token
137 Token token = lexer_.PeekToken(false); in ParseLicense() local
138 if (token.kind == TokenType::COMMENT_BLOCK) { in ParseLicense()
140 return token.value; in ParseLicense()
149 Token token = lexer_.PeekToken(); in ParsePackage() local
150 if (token.kind != TokenType::PACKAGE) { in ParsePackage()
151 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected 'package'")); in ParsePackage()
157 token = lexer_.PeekToken(); in ParsePackage()
158 if (token.kind != TokenType::ID) { in ParsePackage()
159 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected name of package")); in ParsePackage()
163 std::string packageName = token.value; in ParsePackage()
167 token = lexer_.PeekToken(); in ParsePackage()
168 if (token.kind != TokenType::SEMICOLON) { in ParsePackage()
169 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected ';'")); in ParsePackage()
215 Token token = lexer_.PeekToken(); in ParseInterfaceToken() local
216 if (token.kind != TokenType::INTERFACE_TOKEN) { in ParseInterfaceToken()
217 LogError(__func__, __LINE__, token, StringHelper::Format("expected 'interface token'")); in ParseInterfaceToken()
222 token = lexer_.PeekToken(); in ParseInterfaceToken()
223 if (token.kind != TokenType::ID) { in ParseInterfaceToken()
224 …LogError(__func__, __LINE__, token, StringHelper::Format("expected name of interface_token before … in ParseInterfaceToken()
225 token.value.c_str())); in ParseInterfaceToken()
229 std::string interfaceToken = token.value; in ParseInterfaceToken()
232 token = lexer_.PeekToken(); in ParseInterfaceToken()
233 if (token.kind != TokenType::SEMICOLON) { in ParseInterfaceToken()
234 LogError(__func__, __LINE__, token, StringHelper::Format("expected ';' before '%s' token", in ParseInterfaceToken()
235 token.value.c_str())); in ParseInterfaceToken()
241 …LogError(__func__, __LINE__, token, StringHelper::Format("interface_token name is not expected.")); in ParseInterfaceToken()
251 Token token = lexer_.PeekToken(); in ParseSupportDelegator() local
252 if (token.kind != TokenType::SUPPORT_DELEGATOR) { in ParseSupportDelegator()
253 LogError(__func__, __LINE__, token, StringHelper::Format("expected 'support_delegator'")); in ParseSupportDelegator()
258 token = lexer_.PeekToken(); in ParseSupportDelegator()
259 if (token.kind != TokenType::ID) { in ParseSupportDelegator()
260 …LogError(__func__, __LINE__, token, StringHelper::Format("expected name of suport_delegator before… in ParseSupportDelegator()
261 token.value.c_str())); in ParseSupportDelegator()
265 std::string supportDelegator = token.value; in ParseSupportDelegator()
268 token = lexer_.PeekToken(); in ParseSupportDelegator()
269 if (token.kind != TokenType::SEMICOLON) { in ParseSupportDelegator()
270 LogError(__func__, __LINE__, token, StringHelper::Format("expected ';' before '%s' token", in ParseSupportDelegator()
271 token.value.c_str())); in ParseSupportDelegator()
277 …LogError(__func__, __LINE__, token, StringHelper::Format("support_delegator name is not expected."… in ParseSupportDelegator()
287 Token token = lexer_.PeekToken(); in ParseImports() local
288 TokenType kind = token.kind; in ParseImports()
292 token = lexer_.PeekToken(); in ParseImports()
293 if (token.kind != TokenType::ID) { in ParseImports()
294 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected identifier")); in ParseImports()
296 token = lexer_.PeekToken(); in ParseImports()
308 token = lexer_.PeekToken(); in ParseImports()
309 if (token.kind != TokenType::SEMICOLON) { in ParseImports()
310 …LogError(__func__, __LINE__, token, StringHelper::Format("expected ';' before '%s'.", token.value.… in ParseImports()
320 Token token = lexer_.PeekToken(); in ParseImportInfo() local
321 std::string importName = token.value; in ParseImportInfo()
323 LogError(__func__, __LINE__, token, std::string("import name is empty")); in ParseImportInfo()
328 LogError(__func__, __LINE__, token, std::string("import name is illegal")); in ParseImportInfo()
335 LogError(__func__, __LINE__, token, in ParseImportInfo()
341 LogError(__func__, __LINE__, token, in ParseImportInfo()
347 …LogError(__func__, __LINE__, token, StringHelper::Format("multiple import of '%s'", importName.c_s… in ParseImportInfo()
353 Token token = lexer_.PeekToken(); in ParseSequenceableInfo() local
354 std::string seqName = token.value; in ParseSequenceableInfo()
356 LogError(__func__, __LINE__, token, std::string("sequenceable name is empty")); in ParseSequenceableInfo()
381 Token token = lexer_.PeekToken(); in ParseTypeDecls() local
382 switch (token.kind) { in ParseTypeDecls()
399 …LogError(__func__, __LINE__, token, StringHelper::Format("'%s' is not expected", token.value.c_str… in ParseTypeDecls()
410 Token token = lexer_.PeekToken(); in ParseAttribute() local
411 switch (token.kind) { in ParseAttribute()
425 …LogError(__func__, __LINE__, token, StringHelper::Format("'%s' is not expected", token.value.c_str… in ParseAttribute()
426 lexer_.SkipToken(token.kind); in ParseAttribute()
435 Token token = lexer_.PeekToken(); in ParseAttributeInfo() local
436 if (token.kind != TokenType::BRACKETS_LEFT) { in ParseAttributeInfo()
437 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '['")); in ParseAttributeInfo()
438 lexer_.SkipToken(token.kind); in ParseAttributeInfo()
444 token = lexer_.PeekToken(); in ParseAttributeInfo()
445 while (token.kind != TokenType::BRACKETS_RIGHT && token.kind != TokenType::END_OF_FILE) { in ParseAttributeInfo()
450 token = lexer_.PeekToken(); in ParseAttributeInfo()
451 if (token.kind == TokenType::COMMA) { in ParseAttributeInfo()
453 token = lexer_.PeekToken(); in ParseAttributeInfo()
457 if (token.kind == TokenType::BRACKETS_RIGHT) { in ParseAttributeInfo()
460 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected ',' or ']'")); in ParseAttributeInfo()
471 Token token = lexer_.PeekToken(); in ParseAttrUnit() local
472 switch (token.kind) { in ParseAttrUnit()
478 if (attrs.find(token) != attrs.end()) { in ParseAttrUnit()
479 … LogError(__func__, __LINE__, token, StringHelper::Format("Duplicate declared attributes '%s'", in ParseAttrUnit()
480 token.value.c_str())); in ParseAttrUnit()
482 attrs.insert(token); in ParseAttrUnit()
488 if (attrs.find(token) != attrs.end()) { in ParseAttrUnit()
489 …LogError(__func__, __LINE__, token, StringHelper::Format("Duplicate declared attributes cacheable"… in ParseAttrUnit()
491 if (!lexer_.ReadCacheableTime(token)) { in ParseAttrUnit()
492 … LogError(__func__, __LINE__, token, StringHelper::Format("Cacheable time parse failed")); in ParseAttrUnit()
494 attrs.insert(token); in ParseAttrUnit()
500 ParseAttrUnitFreezecontrol(attrs, token); in ParseAttrUnit()
504 LogError(__func__, __LINE__, token, StringHelper::Format("'%s' is a illegal attribute", in ParseAttrUnit()
505 token.value.c_str())); in ParseAttrUnit()
511 void Parser::ParseAttrUnitFreezecontrol(AttrSet &attrs, Token &token) in ParseAttrUnitFreezecontrol() argument
513 if (attrs.find(token) != attrs.end()) { in ParseAttrUnitFreezecontrol()
514 …LogError(__func__, __LINE__, token, StringHelper::Format("Duplicate declared attr freezecontrol")); in ParseAttrUnitFreezecontrol()
516 attrs.insert(token); in ParseAttrUnitFreezecontrol()
518 token = lexer_.PeekToken(); in ParseAttrUnitFreezecontrol()
519 if (token.value == "]") { in ParseAttrUnitFreezecontrol()
520 … LogError(__func__, __LINE__, token, StringHelper::Format("freezecontrol attr cannot be empty")); in ParseAttrUnitFreezecontrol()
521 } else if (token.kind == TokenType::ID) { in ParseAttrUnitFreezecontrol()
522 freezecontrolAttr_ = token.value; in ParseAttrUnitFreezecontrol()
535 Token token = lexer_.PeekToken(); in ParseInterface() local
536 if (token.kind != TokenType::ID) { in ParseInterface()
537 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected interface name")); in ParseInterface()
539 size_t index = token.value.rfind('.'); in ParseInterface()
541 interfaceType->SetName(StringHelper::SubStr(token.value, index + 1)); in ParseInterface()
542 interfaceType->SetNamespace(ast_->ParseNamespace(token.value)); in ParseInterface()
544 interfaceType->SetName(token.value); in ParseInterface()
551 CheckInterfaceAttr(interfaceType, token); in ParseInterface()
553 token = lexer_.PeekToken(); in ParseInterface()
554 if (token.kind == TokenType::SEMICOLON) { in ParseInterface()
558 LogError(__func__, __LINE__, token, StringHelper::Format( in ParseInterface()
603 void Parser::CheckInterfaceAttr(const AutoPtr<ASTInterfaceType> &interface, Token token) in CheckInterfaceAttr() argument
625 …LogError(__func__, __LINE__, token, StringHelper::Format("the system option is '%s', but the '%s' … in CheckInterfaceAttr()
632 Token token = lexer_.PeekToken(); in ParseInterfaceExternal() local
637 …LogError(__func__, __LINE__, token, std::string("interface forward declaration should not have att… in ParseInterfaceExternal()
643 Token token = lexer_.PeekToken(); in ParseInterfaceBody() local
645 if (token.kind != TokenType::BRACES_LEFT) { in ParseInterfaceBody()
646 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '{'")); in ParseInterfaceBody()
652 token = lexer_.PeekToken(); in ParseInterfaceBody()
653 while (token.kind != TokenType::BRACES_RIGHT && token.kind != TokenType::END_OF_FILE) { in ParseInterfaceBody()
656 token = lexer_.PeekToken(); in ParseInterfaceBody()
660 token = lexer_.PeekToken(); in ParseInterfaceBody()
661 if (token.kind != TokenType::BRACES_RIGHT) { in ParseInterfaceBody()
662 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '}'")); in ParseInterfaceBody()
668 token = lexer_.PeekToken(); in ParseInterfaceBody()
669 if (token.kind == TokenType::SEMICOLON) { in ParseInterfaceBody()
686 Token token = lexer_.PeekToken(); in ParseMethod() local
687 if (token.kind != TokenType::ID) { in ParseMethod()
688 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected method name")); in ParseMethod()
690 method->SetName(token.value); in ParseMethod()
699 token = lexer_.PeekToken(); in ParseMethod()
700 if (token.kind != TokenType::SEMICOLON) { in ParseMethod()
701 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected ';'")); in ParseMethod()
727 Token token = lexer_.PeekToken(); in ParseMethodReturnType() local
728 if (token.kind == TokenType::ID && ast_->FindType(token.value) == nullptr) { in ParseMethodReturnType()
732 if (CheckBasicType(token) || CheckUserDefType(token) || token.kind == TokenType::LIST || in ParseMethodReturnType()
733 token.kind == TokenType::MAP || token.kind == TokenType::SMQ) { in ParseMethodReturnType()
824 Token token = lexer_.PeekToken(); in ParseMethodParamList() local
825 if (token.kind != TokenType::PARENTHESES_LEFT) { in ParseMethodParamList()
826 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '('")); in ParseMethodParamList()
832 token = lexer_.PeekToken(); in ParseMethodParamList()
833 if (token.kind == TokenType::PARENTHESES_RIGHT) { in ParseMethodParamList()
839 while (token.kind != TokenType::PARENTHESES_RIGHT && token.kind != TokenType::END_OF_FILE) { in ParseMethodParamList()
842 … LogError(__func__, __LINE__, token, StringHelper::Format("the '%s' parameter of '%s' method " in ParseMethodParamList()
848 token = lexer_.PeekToken(); in ParseMethodParamList()
849 if (token.kind == TokenType::COMMA) { in ParseMethodParamList()
851 token = lexer_.PeekToken(); in ParseMethodParamList()
852 if (token.kind == TokenType::PARENTHESES_RIGHT) { in ParseMethodParamList()
853 LogError(__func__, __LINE__, token, std::string("")); in ParseMethodParamList()
859 if (token.kind == TokenType::PARENTHESES_RIGHT) { in ParseMethodParamList()
862 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected ',' or ')'")); in ParseMethodParamList()
876 Token token = lexer_.PeekToken(); in ParseParam() local
877 if (token.kind != TokenType::ID) { in ParseParam()
878 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected param name")); in ParseParam()
880 paramName = token.value; in ParseParam()
903 Token token = lexer_.PeekToken(); in ParseParamAttr() local
904 while (token.kind != TokenType::BRACKETS_RIGHT && token.kind != TokenType::END_OF_FILE) { in ParseParamAttr()
905 SetParamAttrVal(token, attr); in ParseParamAttr()
908 token = lexer_.PeekToken(); in ParseParamAttr()
909 if (token.kind == TokenType::COMMA) { in ParseParamAttr()
911 token = lexer_.PeekToken(); in ParseParamAttr()
916 if (token.kind != TokenType::BRACKETS_RIGHT) { in ParseParamAttr()
917 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected ']'")); in ParseParamAttr()
918 while (token.kind != TokenType::COMMA && token.kind != TokenType::PARENTHESES_RIGHT && in ParseParamAttr()
919 token.kind != TokenType::END_OF_FILE) { in ParseParamAttr()
921 token = lexer_.PeekToken(); in ParseParamAttr()
936 Token token = lexer_.PeekToken(); in CheckParamAttr() local
937 if (token.kind != TokenType::BRACKETS_LEFT) { in CheckParamAttr()
938 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '['")); in CheckParamAttr()
939 while (token.kind != TokenType::COMMA && token.kind != TokenType::PARENTHESES_RIGHT && in CheckParamAttr()
940 token.kind != TokenType::END_OF_FILE) { in CheckParamAttr()
942 token = lexer_.PeekToken(); in CheckParamAttr()
950 void Parser::SetParamAttrVal(Token token, AutoPtr<ASTParamAttr> attr) in SetParamAttrVal() argument
952 switch (token.kind) { in SetParamAttrVal()
963 LogErrorBeforeToken(__func__, __LINE__, token, in SetParamAttrVal()
973 Token token = lexer_.PeekToken(); in ParseType() local
974 if (CheckBasicType(token)) { in ParseType()
976 } else if (CheckUserDefType(token)) { in ParseType()
979 switch (token.kind) { in ParseType()
990 LogError(__func__, __LINE__, token, StringHelper::Format("'%s' of type is illegal", in ParseType()
991 token.value.c_str())); in ParseType()
997 … LogError(__func__, __LINE__, token, std::string("this type was not declared in this scope")); in ParseType()
999 if (!CheckType(token, type)) { in ParseType()
1009 bool Parser::CheckBasicType(Token token) in CheckBasicType() argument
1011 switch (token.kind) { in CheckBasicType()
1037 Token token = lexer_.PeekToken(); in ParseBasicType() local
1038 if (token.kind == TokenType::UNSIGNED) { in ParseBasicType()
1041 type = ast_->FindType(token.value); in ParseBasicType()
1053 Token token = lexer_.PeekToken(); in ParseUnsignedType() local
1054 switch (token.kind) { in ParseUnsignedType()
1059 type = ast_->FindType(namePrefix + " " + token.value); in ParseUnsignedType()
1063 LogError(__func__, __LINE__, token, in ParseUnsignedType()
1064 … StringHelper::Format("'unsigned %s' was not declared in the idl file", token.value.c_str())); in ParseUnsignedType()
1074 Token token = lexer_.PeekToken(); in ParseArrayType() local
1075 if (token.kind != TokenType::BRACKETS_RIGHT) { in ParseArrayType()
1076 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected ']'")); in ParseArrayType()
1099 Token token = lexer_.PeekToken(); in ParseListType() local
1100 if (token.kind != TokenType::ANGLE_BRACKETS_LEFT) { in ParseListType()
1101 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '<'")); in ParseListType()
1112 token = lexer_.PeekToken(); in ParseListType()
1113 if (token.kind != TokenType::ANGLE_BRACKETS_RIGHT) { in ParseListType()
1114 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '>'")); in ParseListType()
1133 Token token = lexer_.PeekToken(); in ParseMapType() local
1134 if (token.kind != TokenType::ANGLE_BRACKETS_LEFT) { in ParseMapType()
1135 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '<'")); in ParseMapType()
1142 …LogError(__func__, __LINE__, token, StringHelper::Format("key type '%s' is illegal", token.value.c… in ParseMapType()
1147 token = lexer_.PeekToken(); in ParseMapType()
1148 if (token.kind != TokenType::COMMA) { in ParseMapType()
1149 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected ','")); in ParseMapType()
1156 …LogError(__func__, __LINE__, token, StringHelper::Format("value type '%s' is illegal", token.value… in ParseMapType()
1161 token = lexer_.PeekToken(); in ParseMapType()
1162 if (token.kind != TokenType::ANGLE_BRACKETS_RIGHT) { in ParseMapType()
1163 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '>'")); in ParseMapType()
1183 Token token = lexer_.PeekToken(); in ParseSmqType() local
1184 if (token.kind != TokenType::ANGLE_BRACKETS_LEFT) { in ParseSmqType()
1185 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '<'")); in ParseSmqType()
1196 token = lexer_.PeekToken(); in ParseSmqType()
1197 if (token.kind != TokenType::ANGLE_BRACKETS_RIGHT) { in ParseSmqType()
1198 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '>'")); in ParseSmqType()
1210 bool Parser::CheckUserDefType(Token token) in CheckUserDefType() argument
1212 switch (token.kind) { in CheckUserDefType()
1226 Token token = lexer_.GetToken(); in ParseUserDefType() local
1227 if (token.kind == TokenType::ID) { in ParseUserDefType()
1228 return ast_->FindType(token.value); in ParseUserDefType()
1231 token = lexer_.PeekToken(); in ParseUserDefType()
1232 if (token.kind != TokenType::ID) { in ParseUserDefType()
1233 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected identifier")); in ParseUserDefType()
1237 AutoPtr<ASTType> type = ast_->FindType(token.value); in ParseUserDefType()
1249 Token token = lexer_.PeekToken(); in ParseEnumDeclaration() local
1250 if (token.kind != TokenType::ID) { in ParseEnumDeclaration()
1251 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected enum type name")); in ParseEnumDeclaration()
1254 enumType->SetName(token.value); in ParseEnumDeclaration()
1257 token = lexer_.PeekToken(); in ParseEnumDeclaration()
1258 if (token.kind == TokenType::COLON || token.kind == TokenType::BRACES_LEFT) { in ParseEnumDeclaration()
1261 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected ':' or '{'")); in ParseEnumDeclaration()
1265 token = lexer_.PeekToken(); in ParseEnumDeclaration()
1266 if (token.kind != TokenType::BRACES_RIGHT) { in ParseEnumDeclaration()
1267 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '}'")); in ParseEnumDeclaration()
1273 token = lexer_.PeekToken(); in ParseEnumDeclaration()
1274 if (token.kind != TokenType::SEMICOLON) { in ParseEnumDeclaration()
1275 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected ';'")); in ParseEnumDeclaration()
1287 Token token = lexer_.PeekToken(); in ParseEnumBaseType() local
1289 if (token.kind != TokenType::COLON) { in ParseEnumBaseType()
1293 token = lexer_.PeekToken(); in ParseEnumBaseType()
1308 LogError(__func__, __LINE__, token, std::string("illegal base type of enum")); in ParseEnumBaseType()
1315 token = lexer_.PeekToken(); in ParseEnumBaseType()
1316 if (token.kind != TokenType::BRACES_LEFT) { in ParseEnumBaseType()
1317 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '{'")); in ParseEnumBaseType()
1326 Token token = lexer_.GetToken(); in ParserEnumMember() local
1327 AutoPtr<ASTEnumValue> enumValue = new ASTEnumValue(token.value); in ParserEnumMember()
1329 token = lexer_.PeekToken(); in ParserEnumMember()
1330 if (token.kind == TokenType::ASSIGN) { in ParserEnumMember()
1340 token = lexer_.PeekToken(); in ParserEnumMember()
1341 if (token.kind == TokenType::COMMA) { in ParserEnumMember()
1346 if (token.kind != TokenType::BRACES_RIGHT) { in ParserEnumMember()
1347 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected ',' or '}'")); in ParserEnumMember()
1358 Token token = lexer_.PeekToken(); in ParseStructDeclaration() local
1359 if (token.kind != TokenType::ID) { in ParseStructDeclaration()
1360 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected struct name")); in ParseStructDeclaration()
1362 structType->SetName(token.value); in ParseStructDeclaration()
1366 token = lexer_.PeekToken(); in ParseStructDeclaration()
1367 if (token.kind == TokenType::COLON) { in ParseStructDeclaration()
1370 } else if (token.kind != TokenType::BRACES_LEFT) { in ParseStructDeclaration()
1371 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '{'")); in ParseStructDeclaration()
1378 token = lexer_.PeekToken(); in ParseStructDeclaration()
1379 if (token.kind != TokenType::BRACES_RIGHT) { in ParseStructDeclaration()
1380 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '}'")); in ParseStructDeclaration()
1385 token = lexer_.PeekToken(); in ParseStructDeclaration()
1386 if (token.kind != TokenType::SEMICOLON) { in ParseStructDeclaration()
1387 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected ';'")); in ParseStructDeclaration()
1399 Token token = lexer_.PeekToken(); in ParseStructParentType() local
1402 … LogError(__func__, __LINE__, token, std::string("expected base type name before '{' token")); in ParseStructParentType()
1407 … LogError(__func__, __LINE__, token, StringHelper::Format("illegal base type of struct: '%s'", in ParseStructParentType()
1412 token = lexer_.PeekToken(); in ParseStructParentType()
1413 if (token.kind != TokenType::BRACES_LEFT) { in ParseStructParentType()
1414 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '{'")); in ParseStructParentType()
1422 Token token = lexer_.PeekToken(); in ParseStructMember() local
1423 while (token.kind != TokenType::BRACES_RIGHT && token.kind != TokenType::END_OF_FILE) { in ParseStructMember()
1427 token = lexer_.PeekToken(); in ParseStructMember()
1431 token = lexer_.PeekToken(); in ParseStructMember()
1432 if (token.kind != TokenType::ID) { in ParseStructMember()
1433 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected member name")); in ParseStructMember()
1435 token = lexer_.PeekToken(); in ParseStructMember()
1440 std::string memberName = token.value; in ParseStructMember()
1443 token = lexer_.PeekToken(); in ParseStructMember()
1444 if (token.kind == TokenType::SEMICOLON) { in ParseStructMember()
1446 token = lexer_.PeekToken(); in ParseStructMember()
1450 if (token.kind != TokenType::BRACES_RIGHT) { in ParseStructMember()
1451 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected ',' or '}'")); in ParseStructMember()
1462 Token token = lexer_.PeekToken(); in ParseUnionDeclaration() local
1463 if (token.kind != TokenType::ID) { in ParseUnionDeclaration()
1464 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected struct name")); in ParseUnionDeclaration()
1466 unionType->SetName(token.value); in ParseUnionDeclaration()
1470 token = lexer_.PeekToken(); in ParseUnionDeclaration()
1471 if (token.kind != TokenType::BRACES_LEFT) { in ParseUnionDeclaration()
1472 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '{'")); in ParseUnionDeclaration()
1479 token = lexer_.PeekToken(); in ParseUnionDeclaration()
1480 if (token.kind != TokenType::BRACES_RIGHT) { in ParseUnionDeclaration()
1481 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected '}'")); in ParseUnionDeclaration()
1486 token = lexer_.PeekToken(); in ParseUnionDeclaration()
1487 if (token.kind != TokenType::SEMICOLON) { in ParseUnionDeclaration()
1488 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected ';'")); in ParseUnionDeclaration()
1499 Token token = lexer_.PeekToken(); in ParseUnionMember() local
1500 while (token.kind != TokenType::BRACES_RIGHT && token.kind != TokenType::END_OF_FILE) { in ParseUnionMember()
1504 token = lexer_.PeekToken(); in ParseUnionMember()
1508 token = lexer_.PeekToken(); in ParseUnionMember()
1509 if (token.kind != TokenType::ID) { in ParseUnionMember()
1510 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected member name")); in ParseUnionMember()
1512 token = lexer_.PeekToken(); in ParseUnionMember()
1517 std::string memberName = token.value; in ParseUnionMember()
1519 LogError(__func__, __LINE__, token, StringHelper::Format( in ParseUnionMember()
1520 … "union not support this type or name of member duplicate '%s'", token.value.c_str())); in ParseUnionMember()
1523 token = lexer_.PeekToken(); in ParseUnionMember()
1524 if (token.kind == TokenType::SEMICOLON) { in ParseUnionMember()
1526 token = lexer_.PeekToken(); in ParseUnionMember()
1530 if (token.kind != TokenType::BRACES_RIGHT) { in ParseUnionMember()
1531 LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected ',' or '}'")); in ParseUnionMember()
1557 for (const auto &token : attrs) { in ParseUserDefTypeAttr() local
1558 switch (token.kind) { in ParseUserDefTypeAttr()
1569 … LogError(__func__, __LINE__, token, StringHelper::Format("invalid attribute '%s' for type decl", in ParseUserDefTypeAttr()
1570 token.value.c_str())); in ParseUserDefTypeAttr()
1593 Token token = lexer_.PeekToken(); in ParseAndExpr() local
1594 while (token.kind == TokenType::AND) { in ParseAndExpr()
1602 token = lexer_.PeekToken(); in ParseAndExpr()
1610 Token token = lexer_.PeekToken(); in ParseXorExpr() local
1611 while (token.kind == TokenType::XOR) { in ParseXorExpr()
1619 token = lexer_.PeekToken(); in ParseXorExpr()
1627 Token token = lexer_.PeekToken(); in ParseOrExpr() local
1628 while (token.kind == TokenType::OR) { in ParseOrExpr()
1636 token = lexer_.PeekToken(); in ParseOrExpr()
1644 Token token = lexer_.PeekToken(); in ParseShiftExpr() local
1645 while (token.kind == TokenType::LEFT_SHIFT || token.kind == TokenType::RIGHT_SHIFT) { in ParseShiftExpr()
1647 …BinaryOpKind op = (token.kind == TokenType::LEFT_SHIFT) ? BinaryOpKind::LSHIFT : BinaryOpKind::RSH… in ParseShiftExpr()
1654 token = lexer_.PeekToken(); in ParseShiftExpr()
1662 Token token = lexer_.PeekToken(); in ParseAddExpr() local
1663 while (token.kind == TokenType::ADD || token.kind == TokenType::SUB) { in ParseAddExpr()
1665 BinaryOpKind op = (token.kind == TokenType::ADD) ? BinaryOpKind::ADD : BinaryOpKind::SUB; in ParseAddExpr()
1672 token = lexer_.PeekToken(); in ParseAddExpr()
1680 Token token = lexer_.PeekToken(); in ParseMulExpr() local
1682 …token.kind == TokenType::STAR || token.kind == TokenType::SLASH || token.kind == TokenType::PERCEN… in ParseMulExpr()
1685 if (token.kind == TokenType::SLASH) { in ParseMulExpr()
1687 } else if (token.kind == TokenType::PERCENT_SIGN) { in ParseMulExpr()
1696 token = lexer_.PeekToken(); in ParseMulExpr()
1703 Token token = lexer_.PeekToken(); in ParseUnaryExpr() local
1704 switch (token.kind) { in ParseUnaryExpr()
1711 if (token.kind == TokenType::SUB) { in ParseUnaryExpr()
1713 } else if (token.kind == TokenType::TILDE) { in ParseUnaryExpr()
1727 Token token = lexer_.PeekToken(); in ParsePrimaryExpr() local
1728 switch (token.kind) { in ParsePrimaryExpr()
1732 token = lexer_.PeekToken(); in ParsePrimaryExpr()
1733 if (token.kind != TokenType::PARENTHESES_RIGHT) { in ParsePrimaryExpr()
1734 … LogErrorBeforeToken(__func__, __LINE__, token, StringHelper::Format("expected ')'")); in ParsePrimaryExpr()
1745 … LogError(__func__, __LINE__, token, std::string("this expression is not supported")); in ParsePrimaryExpr()
1751 LogError(__func__, __LINE__, token, std::string("this expression is not supported")); in ParsePrimaryExpr()
1759 Token token = lexer_.GetToken(); in ParseNumExpr() local
1760 if (!CheckNumber(token.value)) { in ParseNumExpr()
1761 …LogError(__func__, __LINE__, token, StringHelper::Format("unknown integer number: '%s'", token.val… in ParseNumExpr()
1766 expr->value_ = token.value; in ParseNumExpr()
1772 Token token = lexer_.GetToken(); in ParseEnumExpr() local
1773 if (!g_currentEnum->HasMember(token.value)) { in ParseEnumExpr()
1774 …LogError(__func__, __LINE__, token, StringHelper::Format("unknown enum member: '%s'", token.value.… in ParseEnumExpr()
1779 expr->value_ = token.value; in ParseEnumExpr()
1792 bool Parser::CheckType(const Token &token, const AutoPtr<ASTType> &type) in CheckType() argument
1794 if ((type == nullptr) || !CheckTypeByMode(token, type)) { in CheckType()
1800 …LogError(__func__, __LINE__, token, StringHelper::Format("The %s type is not supported by c langua… in CheckType()
1815 … LogError(__func__, __LINE__, token, StringHelper::Format("The '%s' type is not supported " in CheckType()
1826 bool Parser::CheckTypeByMode(const Token &token, const AutoPtr<ASTType> &type) in CheckTypeByMode() argument
1829 …LogError(__func__, __LINE__, token, StringHelper::Format("The %s type is only supported by passthr… in CheckTypeByMode()
1844 LogError(__func__, __LINE__, token, in CheckTypeByMode()
1925 Token token = lexer_.PeekToken(); in ParseInterfaceExtends() local
1926 if (token.kind != TokenType::EXTENDS) { in ParseInterfaceExtends()
1930 token = lexer_.PeekToken(); in ParseInterfaceExtends()
1931 if (token.kind != TokenType::ID) { in ParseInterfaceExtends()
1932 … LogErrorBeforeToken(__func__, __LINE__, token, std::string("expected extends interface name")); in ParseInterfaceExtends()
1942 Token token = lexer_.PeekToken(); in ParseExtendsInfo() local
1943 std::string extendsInterfaceName = token.value; in ParseExtendsInfo()
1945 LogError(__func__, __LINE__, token, std::string("extends interface name is empty")); in ParseExtendsInfo()
1949 LogError(__func__, __LINE__, token, std::string("extends interface name is illegal")); in ParseExtendsInfo()
1955 …LogError(__func__, __LINE__, token, StringHelper::Format("can not find idl file by extends interfa… in ParseExtendsInfo()
1960 LogError(__func__, __LINE__, token, StringHelper::Format( in ParseExtendsInfo()
1965 LogError(__func__, __LINE__, token, in ParseExtendsInfo()
1970 LogError(__func__, __LINE__, token, StringHelper::Format("multiple extends of '%s'", in ParseExtendsInfo()