| 106 | } |
| 107 | |
| 108 | bool ParseArrayDefinition(Lexeme** str) |
| 109 | { |
| 110 | if(!ParseLexem(str, lex_obracket)) |
| 111 | return false; |
| 112 | |
| 113 | TypeInfo *currType = GetSelectedType(); |
| 114 | |
| 115 | ResetConstantFoldError(); |
| 116 | if((*str)->type == lex_cbracket) |
| 117 | { |
| 118 | (*str)++; |
| 119 | AddUnfixedArraySize(); |
| 120 | }else{ |
| 121 | if(!ParseTernaryExpr(str)) |
| 122 | ThrowError((*str)->pos, "ERROR: unexpected expression after '['"); |
| 123 | if(!ParseLexem(str, lex_cbracket)) |
| 124 | ThrowError((*str)->pos, "ERROR: matching ']' not found"); |
| 125 | } |
| 126 | ThrowConstantFoldError((*str)->pos); |
| 127 | |
| 128 | SelectTypeByPointer(currType); |
| 129 | |
| 130 | if((*str)->type == lex_obracket) |
| 131 | ParseArrayDefinition(str); |
| 132 | |
| 133 | ConvertTypeToArray((*str)->pos); |
| 134 | return true; |
| 135 | } |
| 136 | |
| 137 | struct TypeHandler |
| 138 | { |
no test coverage detected