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

Method ParsePropertyDeclaration

sdk/angelscript/source/as_parser.cpp:216–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216int asCParser::ParsePropertyDeclaration(asCScriptCode *in_script)
217{
218 Reset();
219
220 this->script = in_script;
221
222 scriptNode = CreateNode(snDeclaration);
223 if( scriptNode == 0 ) return -1;
224
225 scriptNode->AddChildLast(ParseType(true));
226 if( isSyntaxError ) return -1;
227
228 // Allow optional '&' to indicate that the property is indirect, i.e. stored as reference
229 sToken t;
230 GetToken(&t);
231 RewindTo(&t);
232 if( t.type == ttAmp )
233 scriptNode->AddChildLast(ParseToken(ttAmp));
234
235 // Allow optional namespace to be defined before the identifier in case
236 // the declaration is to be used for searching for an existing property
237 ParseOptionalScope(scriptNode);
238
239 scriptNode->AddChildLast(ParseIdentifier());
240 if( isSyntaxError ) return -1;
241
242 // The declaration should end after the identifier
243 GetToken(&t);
244 if( t.type != ttEnd )
245 {
246 Error(ExpectedToken(asCTokenizer::GetDefinition(ttEnd)), &t);
247 Error(InsteadFound(t), &t);
248 return -1;
249 }
250
251 return 0;
252}
253
254// BNF:5: SCOPE ::= '::'? (IDENTIFIER '::')* (IDENTIFIER TEMPLTYPELIST? '::')?
255void asCParser::ParseOptionalScope(asCScriptNode *node)

Callers 2

VerifyPropertyMethod · 0.80

Calls 1

AddChildLastMethod · 0.80

Tested by

no test coverage detected