/* Special handling for a character array initialized by a literal */
if (IsTypeChar (ElementType) && CurTok.Tok == TOK_SCONST) {
- /* Optional curly braces */
- unsigned BraceCount = OpeningCurlyBraces (0);
-
/* Char array initialized by string constant */
const char* Str = GetLiteral (CurTok.IVal);
Count = GetLiteralPoolOffs () - CurTok.IVal;
ResetLiteralPoolOffs (CurTok.IVal);
NextToken ();
- /* Closing curly braces (if we had any opening ones) */
- ClosingCurlyBraces (BraceCount);
-
} else {
- /* Optional curly braces */
- unsigned BraceCount = OpeningCurlyBraces (1);
+ /* Curly brace */
+ ConsumeLCurly ();
/* Initialize the array members */
Count = 0;
NextToken ();
}
- /* Closing curly braces (if we had any opening ones) */
- ClosingCurlyBraces (BraceCount);
+ /* Closing curly braces */
+ ConsumeRCurly ();
}
/* Consume the opening curly brace */
- unsigned BraceCount = OpeningCurlyBraces (1);
+ ConsumeLCurly ();
/* Get a pointer to the struct entry from the type */
Entry = DecodePtr (Type + 1);
if (Tab == 0) {
Error ("Cannot initialize variables with incomplete type");
/* Try error recovery */
- SkipInitializer (BraceCount);
+ SkipInitializer (1);
/* Nothing initialized */
return 0;
}
while (CurTok.Tok != TOK_RCURLY) {
if (Entry == 0) {
Error ("Too many initializers");
- SkipInitializer (BraceCount);
+ SkipInitializer (1);
return Size;
}
/* Parse initialization of one field. Flexible array members may
}
/* Consume the closing curly brace */
- ClosingCurlyBraces (BraceCount);
+ ConsumeRCurly ();
/* If there are struct fields left, reserve additional storage */
if (Size < StructSize) {
unsigned Size;
/* Opening brace */
- unsigned BraceCount = OpeningCurlyBraces (1);
+ ConsumeLCurly ();
/* Allow an arbitrary list of values */
Size = 0;
} while (CurTok.Tok != TOK_RCURLY);
/* Closing brace */
- ClosingCurlyBraces (BraceCount);
+ ConsumeRCurly ();
/* Return the number of bytes initialized */
return Size;
}
}
-
+
unsigned ParseInit (type* T)