| 150 | } |
| 151 | |
| 152 | int asCParser::ParseDataType(asCScriptCode *in_script, bool in_isReturnType) |
| 153 | { |
| 154 | Reset(); |
| 155 | |
| 156 | this->script = in_script; |
| 157 | |
| 158 | scriptNode = CreateNode(snDataType); |
| 159 | if( scriptNode == 0 ) return -1; |
| 160 | |
| 161 | scriptNode->AddChildLast(ParseType(true)); |
| 162 | if( isSyntaxError ) return -1; |
| 163 | |
| 164 | if( in_isReturnType ) |
| 165 | { |
| 166 | scriptNode->AddChildLast(ParseTypeMod(false)); |
| 167 | if( isSyntaxError ) return -1; |
| 168 | } |
| 169 | |
| 170 | // The declaration should end after the type |
| 171 | sToken t; |
| 172 | GetToken(&t); |
| 173 | if( t.type != ttEnd ) |
| 174 | { |
| 175 | Error(ExpectedToken(asCTokenizer::GetDefinition(ttEnd)), &t); |
| 176 | Error(InsteadFound(t), &t); |
| 177 | return -1; |
| 178 | } |
| 179 | |
| 180 | if( errorWhileParsing ) |
| 181 | return -1; |
| 182 | |
| 183 | return 0; |
| 184 | } |
| 185 | |
| 186 | |
| 187 | // Parse a template declaration: IDENTIFIER '<' 'class'? IDENTIFIER '>' |
no test coverage detected