| 214 | } |
| 215 | |
| 216 | int 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? '::')? |
| 255 | void asCParser::ParseOptionalScope(asCScriptNode *node) |
no test coverage detected