MCPcopy Create free account
hub / github.com/WheretIB/nullc / ParseArrayDefinition

Function ParseArrayDefinition

NULLC/Parser.cpp:108–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108bool 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
137struct TypeHandler
138{

Callers 1

ParseTypePostExpressionsFunction · 0.85

Calls 9

ParseLexemFunction · 0.85
GetSelectedTypeFunction · 0.85
ResetConstantFoldErrorFunction · 0.85
AddUnfixedArraySizeFunction · 0.85
ParseTernaryExprFunction · 0.85
ThrowErrorFunction · 0.85
ThrowConstantFoldErrorFunction · 0.85
SelectTypeByPointerFunction · 0.85
ConvertTypeToArrayFunction · 0.85

Tested by

no test coverage detected