MCPcopy Create free account
hub / github.com/anjo76/angelscript / ParseListPattern

Method ParseListPattern

sdk/angelscript/source/as_parser.cpp:1206–1295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1204}
1205
1206asCScriptNode *asCParser::ParseListPattern()
1207{
1208 asCScriptNode *node = CreateNode(snListPattern);
1209 if( node == 0 ) return 0;
1210
1211 sToken t1;
1212
1213 GetToken(&t1);
1214 if( t1.type != ttStartStatementBlock )
1215 {
1216 Error(ExpectedToken("{"), &t1);
1217 Error(InsteadFound(t1), &t1);
1218 return node;
1219 }
1220
1221 node->UpdateSourcePos(t1.pos, t1.length);
1222
1223 sToken start = t1;
1224
1225 bool isBeginning = true;
1226 bool afterType = false;
1227 while( !isSyntaxError )
1228 {
1229 GetToken(&t1);
1230 if( t1.type == ttEndStatementBlock )
1231 {
1232 if( !afterType )
1233 {
1234 Error(TXT_EXPECTED_DATA_TYPE, &t1);
1235 Error(InsteadFound(t1), &t1);
1236 }
1237 break;
1238 }
1239 else if( t1.type == ttStartStatementBlock )
1240 {
1241 if( afterType )
1242 {
1243 Error(ExpectedTokens(",","}"), &t1);
1244 Error(InsteadFound(t1), &t1);
1245 }
1246 RewindTo(&t1);
1247 node->AddChildLast(ParseListPattern());
1248 afterType = true;
1249 }
1250 else if( t1.type == ttIdentifier && (IdentifierIs(t1, "repeat") || IdentifierIs(t1, "repeat_same")) )
1251 {
1252 if( !isBeginning )
1253 {
1254 asCString msg;
1255 asCString token(&script->code[t1.pos], t1.length);
1256 msg.Format(TXT_UNEXPECTED_TOKEN_s, token.AddressOf());
1257 Error(msg.AddressOf(), &t1);
1258 }
1259 RewindTo(&t1);
1260 node->AddChildLast(ParseIdentifier());
1261 }
1262 else if( t1.type == ttEnd )
1263 {

Callers

nothing calls this directly

Calls 4

UpdateSourcePosMethod · 0.80
AddChildLastMethod · 0.80
FormatMethod · 0.45
AddressOfMethod · 0.45

Tested by

no test coverage detected