~groovestomp/c-parser

038b8e0fc6657890e0807c9236206833a9d2486c — Aaron Oman 2 years ago 50fb58a
Normalize coding style
5 files changed, 292 insertions(+), 706 deletions(-)

M lexer.c
M main.c
M parser.c
M test.c
M tree.c
M lexer.c => lexer.c +117 -197
@@ 12,8 12,7 @@
#define CastSizeIntTo32Bits(x) (x)
#endif

enum token_type
{
enum token_type {
        Token_Unknown,

        Token_Asterisk,


@@ 77,9 76,7 @@ enum token_type
        Token_EndOfStream,
};

char *
TokenName(enum token_type Type)
{
char *TokenName(enum token_type Type) {
        switch(Type)
        {
                case Token_Unknown: { return "Unknown"; } break;


@@ 147,8 144,7 @@ TokenName(enum token_type Type)
        }
}

typedef struct token
{
typedef struct token {
        char *Text;
        size_t TextLength;
        enum token_type Type;


@@ 156,183 152,148 @@ typedef struct token
        unsigned int Column;
} token;

typedef struct tokenizer
{
typedef struct tokenizer {
        char *Beginning;
        char *At;
        unsigned int Line;
        unsigned int Column;
} tokenizer;

void
TokenizerInit(struct tokenizer *Self, char *Memory)
{
void TokenizerInit(struct tokenizer *Self, char *Memory) {
        Self->Beginning = Memory;
        Self->At = Memory;
        Self->Line = 0;
        Self->Column = 0;
}

void
AdvanceTokenizer(struct tokenizer *Tokenizer)
{
        if(GSCharIsEndOfLine(Tokenizer->At[0]))
        {
void AdvanceTokenizer(struct tokenizer *Tokenizer) {
        if (GSCharIsEndOfLine(Tokenizer->At[0])) {
                ++Tokenizer->Line;
                Tokenizer->Column = 1;
        }
        else
        {
        } else {
                ++Tokenizer->Column;
        }
        ++Tokenizer->At;
}

void
CopyTokenizer(struct tokenizer *Source, struct tokenizer *Dest)
{
void CopyTokenizer(struct tokenizer *Source, struct tokenizer *Dest) {
        Dest->Beginning = Source->Beginning;
        Dest->At = Source->At;
        Dest->Line = Source->Line;
        Dest->Column = Source->Column;
}

void
AdvanceTokenizerToChar(struct tokenizer *Tokenizer, char Char)
{
        while(!GSCharIsEndOfStream(Tokenizer->At[0]))
        {
                if(Tokenizer->At[0] == Char) break;
void AdvanceTokenizerToChar(struct tokenizer *Tokenizer, char Char) {
        while (!GSCharIsEndOfStream(Tokenizer->At[0])) {
                if (Tokenizer->At[0] == Char) break;
                AdvanceTokenizer(Tokenizer);
        }
}

gs_bool
CopyToTokenAndAdvance(struct tokenizer *Tokenizer, struct token *Token, int Length, enum token_type Type)
{
gs_bool CopyToTokenAndAdvance(struct tokenizer *Tokenizer, struct token *Token, int Length, enum token_type Type) {
        Token->Text = Tokenizer->At;
        Token->TextLength = Length;
        Token->Type = Type;
        Token->Line = Tokenizer->Line;
        Token->Column = Tokenizer->Column;

        for(int I=0; I<Length; ++I) AdvanceTokenizer(Tokenizer);
        for (int i=0; i<Length; ++i) AdvanceTokenizer(Tokenizer);
}

void
EatAllWhitespace(struct tokenizer *Tokenizer)
{
        for(; GSCharIsWhitespace(Tokenizer->At[0]); AdvanceTokenizer(Tokenizer));
void EatAllWhitespace(struct tokenizer *Tokenizer) {
        for (; GSCharIsWhitespace(Tokenizer->At[0]); AdvanceTokenizer(Tokenizer));
}

gs_bool
IsIdentifierCharacter(char C)
{
gs_bool IsIdentifierCharacter(char C) {
	gs_bool Result = (GSCharIsAlphabetical(C) || GSCharIsDecimal(C) || C == '_');
	return(Result);
	return Result;
}

gs_bool
IsIntegerSuffix(char C)
{
gs_bool IsIntegerSuffix(char C) {
	gs_bool Result = (C == 'u' ||
                          C == 'U' ||
                          C == 'l' ||
                          C == 'L');
	return(Result);
	return Result;
}

gs_bool
GetCharacter(struct tokenizer *Tokenizer, struct token *Token)
{
gs_bool GetCharacter(struct tokenizer *Tokenizer, struct token *Token) {
        char *Cursor = Tokenizer->At;

        /* First character must be a single quote. */
        if(*Cursor != '\'') return(false);
        if (*Cursor != '\'') return false;
        ++Cursor; /* Skip past the first single quote. */

        /* Read until closing single quote. */
        for(; *Cursor != '\''; ++Cursor);
        for (; *Cursor != '\''; ++Cursor);

        /* If previous character is an escape, then closing quote is next char. */
        if(*(Cursor-1) == '\\' && *(Cursor -2) != '\\')
        {
        if (*(Cursor-1) == '\\' && *(Cursor -2) != '\\') {
                ++Cursor;
        }
        ++Cursor; /* Point to character after literal. */

        /* Longest char literal is: '\''. */
        if(Cursor - Tokenizer->At > 4) return(false);
        if (Cursor - Tokenizer->At > 4) return false;

        CopyToTokenAndAdvance(Tokenizer, Token, Cursor - Tokenizer->At, Token_Character);

        return(true);
        return true;
}

gs_bool
GetString(struct tokenizer *Tokenizer, struct token *Token)
{
gs_bool GetString(struct tokenizer *Tokenizer, struct token *Token) {
        char *Cursor = Tokenizer->At;
        if(*Cursor != '"') return(false);
        if (*Cursor != '"') return false;

        while(true)
        {
        while (true) {
                ++Cursor;
                if(*Cursor == '\0') return(false);
                if(*Cursor == '"' && *(Cursor - 1) != '\\') break;
                if (*Cursor == '\0') return false;
                if (*Cursor == '"' && *(Cursor - 1) != '\\') break;
        }
        ++Cursor; /* Swallow the last double quote. */

        CopyToTokenAndAdvance(Tokenizer, Token, Cursor - Tokenizer->At, Token_String);

        return(true);
        return true;
}

gs_bool
IsOctalString(char *Text, int Length)
{
        if(Length < 2) return(false);
gs_bool IsOctalString(char *Text, int Length) {
        if (Length < 2) return false;

        char Last = Text[Length-1];

        /* Leading 0 required for octal integers. */
        if('0' != Text[0]) return(false);
        if ('0' != Text[0]) return false;

        if(!(GSCharIsOctal(Last) || IsIntegerSuffix(Last))) return(false);
        if (!(GSCharIsOctal(Last) || IsIntegerSuffix(Last))) return false;

        /* Loop from character after leading '0' to second-last. */
        for(int i=1; i<Length-1; ++i)
        {
                if(!GSCharIsOctal(Text[i])) return(false);
        for (int i=1; i<Length-1; ++i) {
                if (!GSCharIsOctal(Text[i])) return false;
        }

        return(true);
        return true;
}

gs_bool
IsHexadecimalString(char *Text, int Length)
{
        if(Length < 3) return(false);
gs_bool IsHexadecimalString(char *Text, int Length) {
        if (Length < 3) return false;

        char Last = Text[Length-1];

        /* Hex numbers must start with: '0x' or '0X'. */
        if(!(Text[0] == '0' && (Text[1] == 'x' || Text[1] == 'X'))) return(false);
        if (!(Text[0] == '0' && (Text[1] == 'x' || Text[1] == 'X'))) return false;

        if(!(GSCharIsHexadecimal(Last) || IsIntegerSuffix(Last))) return(false);
        if (!(GSCharIsHexadecimal(Last) || IsIntegerSuffix(Last))) return false;

        /* Loop from character after leading '0x' to second-last. */
        for(int i=2; i<Length-1; ++i)
        {
                if(!GSCharIsHexadecimal(Text[i])) return(false);
        for (int i=2; i<Length-1; ++i) {
                if (!GSCharIsHexadecimal(Text[i])) return false;
        }

        return(true);
        return true;
}

gs_bool
GetPrecisionNumber(struct tokenizer *Tokenizer, struct token *Token)
{
gs_bool GetPrecisionNumber(struct tokenizer *Tokenizer, struct token *Token) {
        /*
          A floating constant consists of an integer part, a decimal point, a
          fraction part, an e or E, an optionally signed integer exponent and an


@@ 352,65 313,56 @@ GetPrecisionNumber(struct tokenizer *Tokenizer, struct token *Token)
        gs_bool HasFractionalPart = false;
        gs_bool HasExponentPart = false;

        if(GSCharIsDecimal(*Cursor))
        {
                for(; GSCharIsDecimal(*Cursor); ++Cursor);
        if (GSCharIsDecimal(*Cursor)) {
                for (; GSCharIsDecimal(*Cursor); ++Cursor);
                HasIntegerPart = true;
        }

        if('.' == *Cursor)
        {
        if ('.' == *Cursor) {
                ++Cursor;
                HasDecimalPoint = true;
                if(GSCharIsDecimal(*Cursor))
                if (GSCharIsDecimal(*Cursor))
                {
                        for(; GSCharIsDecimal(*Cursor); ++Cursor);
                        for (; GSCharIsDecimal(*Cursor); ++Cursor);
                        HasFractionalPart = true;
                }
        }

        if('e' == *Cursor || 'E' == *Cursor)
        {
        if ('e' == *Cursor || 'E' == *Cursor){
                ++Cursor;
                HasExponentPart = true;

                /* Optional negative sign for exponent is allowed. */
                if('-' == *Cursor)
                {
                if ('-' == *Cursor) {
                        ++Cursor;
                }

                /* Exponent must contain an exponent part. */
                if(!GSCharIsDecimal(*Cursor))
                {
                        return(false);
                if (!GSCharIsDecimal(*Cursor)) {
                        return false;
                }

                for(; GSCharIsDecimal(*Cursor); ++Cursor);
                for (; GSCharIsDecimal(*Cursor); ++Cursor);
        }

        /* IsFloatSuffix(C) */
        char C = *Cursor;
        if('f' == C || 'F' == C || 'l' == C || 'L' == C)
        {
        if ('f' == C || 'F' == C || 'l' == C || 'L' == C) {
                ++Cursor;
        }

        if((HasIntegerPart || HasFractionalPart) &&
           (HasDecimalPoint || HasExponentPart))
        {
        if ((HasIntegerPart || HasFractionalPart) &&
           (HasDecimalPoint || HasExponentPart)) {
                CopyToTokenAndAdvance(Tokenizer, Token, Cursor - Tokenizer->At, Token_PrecisionNumber);
                return(true);
                return true;
        }

        return(false);
        return false;
}

gs_bool
GetInteger(struct tokenizer *Tokenizer, struct token *Token)
{
gs_bool GetInteger(struct tokenizer *Tokenizer, struct token *Token) {
        char *LastChar = Tokenizer->At;
        for(; *LastChar && (GSCharIsDecimal(*LastChar) || GSCharIsAlphabetical(*LastChar)); ++LastChar);
        for (; *LastChar && (GSCharIsDecimal(*LastChar) || GSCharIsAlphabetical(*LastChar)); ++LastChar);

        int Length = LastChar - Tokenizer->At;
        --LastChar;


@@ 419,73 371,60 @@ GetInteger(struct tokenizer *Tokenizer, struct token *Token)
        /* Token->Text = Tokenizer->At; */
        /* Token->TextLength = Length; */

        if(Length < 1) return(false);
        if (Length < 1) return false;

        char *Cursor = Tokenizer->At;

        if ((IsOctalString(Cursor, Length) || IsHexadecimalString(Cursor, Length)) ||
            (1 == Length && '0' == *Cursor))
        {
            (1 == Length && '0' == *Cursor)) {
                CopyToTokenAndAdvance(Tokenizer, Token, Length, Token_Integer);
                return(true);
                return true;
        }

        /* Can't have a multi-digit integer starting with zero unless it's Octal. */
        if('0' == *Cursor)
        {
                return(false);
        if ('0' == *Cursor) {
                return false;
        }

        for(int I=0; I<Length-1; ++I)
        {
                if(!GSCharIsDecimal(Cursor[I]))
                {
                        return(false);
        for (int i=0; i<Length-1; ++i) {
                if (!GSCharIsDecimal(Cursor[i])) {
                        return false;
                }
        }

        if(GSCharIsDecimal(*LastChar) || IsIntegerSuffix(*LastChar))
        {
        if (GSCharIsDecimal(*LastChar) || IsIntegerSuffix(*LastChar)) {
                CopyToTokenAndAdvance(Tokenizer, Token, Length, Token_Integer);
                return(true);
                return true;
        }

        return(false);
        return false;
}

gs_bool
GetIdentifier(struct tokenizer *Tokenizer, struct token *Token)
{
        if(!GSCharIsAlphabetical(Tokenizer->At[0]) &&
           '_' != Tokenizer->At[0])
        {
                return(false);
gs_bool GetIdentifier(struct tokenizer *Tokenizer, struct token *Token) {
        if (!GSCharIsAlphabetical(Tokenizer->At[0]) &&
           '_' != Tokenizer->At[0]) {
                return false;
        }

        char *Cursor = Tokenizer->At;

        for(; IsIdentifierCharacter(*Cursor); ++Cursor);

        for (; IsIdentifierCharacter(*Cursor); ++Cursor);
        CopyToTokenAndAdvance(Tokenizer, Token, Cursor - Tokenizer->At, Token_Identifier);

        return(true);
        return true;
}

gs_bool
GetComment(struct tokenizer *Tokenizer, struct token *Token)
{
        if(Tokenizer->At[0] != '/' || Tokenizer->At[1] != '*') return(false);
gs_bool GetComment(struct tokenizer *Tokenizer, struct token *Token) {
        if (Tokenizer->At[0] != '/' || Tokenizer->At[1] != '*') return false;

        char *Cursor = Tokenizer->At;

        while(true)
        {
                if('\0' == *Cursor)
                {
                        return(false);
        while (true) {
                if ('\0' == *Cursor) {
                        return false;
                }
                if('*' == Cursor[0] && '/' == Cursor[1])
                {

                if ('*' == Cursor[0] && '/' == Cursor[1]) {
                        break;
                }
                ++Cursor;


@@ 495,12 434,10 @@ GetComment(struct tokenizer *Tokenizer, struct token *Token)

        CopyToTokenAndAdvance(Tokenizer, Token, Cursor - Tokenizer->At, Token_Comment);

        return(true);
        return true;
}

gs_bool
GetKeyword(struct tokenizer *Tokenizer, struct token *Token)
{
gs_bool GetKeyword(struct tokenizer *Tokenizer, struct token *Token) {
        static char *Keywords[] = {
                "auto", "break", "case", "char", "const", "continue", "default",
                "double", "do", "else", "enum", "extern", "float", "for",


@@ 509,61 446,51 @@ GetKeyword(struct tokenizer *Tokenizer, struct token *Token)
                "union", "unsigned", "void", "volatile", "while"
        };

        for(int i = 0; i < ArraySize(Keywords); ++i)
        {
                if(GSStringIsEqual(Tokenizer->At, Keywords[i], GSStringLength(Keywords[i])))
                {
        for (int i = 0; i < ArraySize(Keywords); ++i) {
                if (GSStringIsEqual(Tokenizer->At, Keywords[i], GSStringLength(Keywords[i]))) {
                        CopyToTokenAndAdvance(Tokenizer, Token, GSStringLength(Keywords[i]), Token_Keyword);

                        return(true);
                        return true;
                }
        }

        return(false);
        return false;
}

gs_bool
GetPreprocessorCommand(struct tokenizer *Tokenizer, struct token *Token)
{
        if(Tokenizer->At[0] != '#') return(false);
gs_bool GetPreprocessorCommand(struct tokenizer *Tokenizer, struct token *Token) {
        if (Tokenizer->At[0] != '#') return false;

        char *Cursor = Tokenizer->At;

        /* Preprocessor commands must start a line on their own. */
        for(--Cursor; Cursor > Tokenizer->Beginning && GSCharIsWhitespace(*Cursor); --Cursor);
        for (--Cursor; Cursor > Tokenizer->Beginning && GSCharIsWhitespace(*Cursor); --Cursor);

        if(*(++Cursor) != '\n' && Cursor != Tokenizer->Beginning)
        {
                return(false);
        if (*(++Cursor) != '\n' && Cursor != Tokenizer->Beginning) {
                return false;
        }
        Cursor = Tokenizer->At + 1; /* Skip the starting '#' for macros. */

        while(true)
        {
                if(*Cursor == '\n' && *(Cursor - 1) != '\\') break;
                if(*Cursor == '\0') break;
        while (true) {
                if (*Cursor == '\n' && *(Cursor - 1) != '\\') break;
                if (*Cursor == '\0') break;
                ++Cursor;
        }

        CopyToTokenAndAdvance(Tokenizer, Token, Cursor - Tokenizer->At, Token_PreprocessorCommand);

        return(true);
        return true;
}

gs_bool
GetSymbol(struct tokenizer *Tokenizer, struct token *Token, char *Symbol, enum token_type Type)
{
gs_bool GetSymbol(struct tokenizer *Tokenizer, struct token *Token, char *Symbol, enum token_type Type) {
        int Length = GSStringLength(Symbol);
        if(!GSStringIsEqual(Tokenizer->At, Symbol, Length)) return(false);
        if (!GSStringIsEqual(Tokenizer->At, Symbol, Length)) return false;

        CopyToTokenAndAdvance(Tokenizer, Token, Length, Type);

        return(true);
        return true;
}

struct token
GetToken(struct tokenizer *Tokenizer)
{
struct token GetToken(struct tokenizer *Tokenizer) {
        EatAllWhitespace(Tokenizer);

        struct token Token;


@@ 597,7 524,7 @@ GetToken(struct tokenizer *Tokenizer)
                        GetSymbol(Tokenizer, &Token, "|=", Token_PipeEquals);

        }
        if(Token.Type != Token_Unknown) return(Token);
        if (Token.Type != Token_Unknown) return Token;

        {
                GetKeyword(Tokenizer, &Token) ||


@@ 611,13 538,12 @@ GetToken(struct tokenizer *Tokenizer)

        }

        if(Token.Type == Token_PreprocessorCommand ||
           Token.Type == Token_Comment)
        {
        if (Token.Type == Token_PreprocessorCommand ||
           Token.Type == Token_Comment) {
                Token = GetToken(Tokenizer);
        }

        if(Token.Type != Token_Unknown) return(Token);
        if (Token.Type != Token_Unknown) return Token;

        char C = Tokenizer->At[0];
        CopyToTokenAndAdvance(Tokenizer, &Token, 1, Token_Unknown);


@@ 652,24 578,19 @@ GetToken(struct tokenizer *Tokenizer)
                case '#': { Token.Type = Token_Hash; } break;
        }

        return(Token);
        return Token;
}

gs_bool
Lex(gs_buffer *FileContents)
{
gs_bool Lex(gs_buffer *FileContents) {
        struct tokenizer Tokenizer;
        TokenizerInit(&Tokenizer, FileContents->Start);

        gs_bool Parsing = true;
        while(Parsing)
        {
        while (Parsing) {
                struct token Token = GetToken(&Tokenizer);
                switch(Token.Type)
                {
                switch(Token.Type) {
                        case Token_EndOfStream: { Parsing = false; } break;
                        case Token_Unknown:
                        {
                        case Token_Unknown: {
                                printf("[%u,%u] Token Name: %20s, Token Text: %.*s (%.*s)\n",
                                       Token.Line + 1,
                                       Token.Column,


@@ 677,8 598,7 @@ Lex(gs_buffer *FileContents)
                                       CastSizeIntTo32Bits(Token.TextLength), Token.Text,
                                       CastSizeIntTo32Bits(Token.TextLength + 4), Token.Text - 2);
                        } break;
                        default:
                        {
                        default: {
                                printf("[%u,%u] Token Name: %20s, Token Text: %.*s\n",
                                       Token.Line + 1,
                                       Token.Column,

M main.c => main.c +6 -10
@@ 6,9 6,7 @@
#include "lexer.c"
#include "parser.c"

void
Usage(char *Name)
{
void Usage(char *Name) {
        printf("Usage: %s operation file [options]\n", Name);
        puts("  operation: One of: [parse, lex].");
        puts("  file: Must be a file in this directory.");


@@ 19,12 17,10 @@ Usage(char *Name)
        exit(EXIT_SUCCESS);
}

int
main(int ArgCount, char **Arguments)
{
int main(int ArgCount, char **Arguments) {
        gs_args Args;
        GSArgsInit(&Args, ArgCount, Arguments);
        if(GSArgsHelpWanted(&Args)           ||
        if (GSArgsHelpWanted(&Args)           ||
           ArgCount < 3                      ||
           (!GSArgsIsPresent(&Args, "parse") &&
            !GSArgsIsPresent(&Args, "lex")))


@@ 35,13 31,13 @@ main(int ArgCount, char **Arguments)
        size_t AllocSize = GSFileSize(Filename);
        GSBufferInit(&Buffer, alloca(AllocSize), AllocSize);

        if(!GSFileCopyToBuffer(Filename, &Buffer))
        if (!GSFileCopyToBuffer(Filename, &Buffer))
                GSAbortWithMessage("Couldn't copy entire file to buffer\n");

        if(GSArgsIsPresent(&Args, "parse"))
        if (GSArgsIsPresent(&Args, "parse"))
                Parse(&Buffer, GSArgsIsPresent(&Args, "--show-parse-tree"));
        else
                Lex(&Buffer);

        return(EXIT_SUCCESS);
        return EXIT_SUCCESS;
}

M parser.c => parser.c +98 -291
@@ 37,8 37,7 @@ bool ParseTypeQualifier(struct tokenizer *Tokneizer, parse_tree_node *ParseTree)
bool ParseTypeSpecifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree);
bool ParseDeclaration(struct tokenizer *Tokenizer, parse_tree_node *ParseTree);

struct typedef_names
{
struct typedef_names {
        char *Name;
        int *NameIndex;
        int Capacity; /* Total allocated space for Name */


@@ 47,8 46,7 @@ struct typedef_names
struct typedef_names TypedefNames;

void
TypedefClear()
{
TypedefClear() {
        free((void *)TypedefNames.Name);
        free((void *)TypedefNames.NameIndex);
        TypedefNames.Capacity = 0;


@@ 56,8 54,7 @@ TypedefClear()
}

void
TypedefInit()
{
TypedefInit() {
        char *Memory = (char *)malloc(1024);
        TypedefNames.Name = Memory;
        TypedefNames.Capacity = 1024;


@@ 65,9 62,7 @@ TypedefInit()
        TypedefNames.NumNames = 0;
}

bool
TypedefIsName(struct token Token)
{
bool TypedefIsName(struct token Token) {
        for(int i = 0; i < TypedefNames.NumNames; i++)
        {
                if(GSStringIsEqual(Token.Text, &TypedefNames.Name[TypedefNames.NameIndex[i]], Token.TextLength))


@@ 78,9 73,7 @@ TypedefIsName(struct token Token)
        return(false);
}

bool
TypedefAddName(char *Name)
{
bool TypedefAddName(char *Name) {
        if(TypedefNames.NumNames == 0)
        {
                GSStringCopy(Name, TypedefNames.Name, GSStringLength(Name));


@@ 112,9 105,7 @@ TypedefAddName(char *Name)
          floating-constant
          enumeration-constant
*/
bool
ParseConstant(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseConstant(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token = GetToken(Tokenizer);



@@ 136,9 127,7 @@ ParseConstant(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        }
}

bool
ParseArgumentExpressionListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseArgumentExpressionListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token;



@@ 161,9 150,7 @@ ParseArgumentExpressionListI(struct tokenizer *Tokenizer, parse_tree_node *Parse
          assignment-expression
          argument-expression-list , assignment-expression
*/
bool
ParseArgumentExpressionList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseArgumentExpressionList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Argument Expresion List", 2);


@@ 185,9 172,7 @@ ParseArgumentExpressionList(struct tokenizer *Tokenizer, parse_tree_node *ParseT
          string
          ( expression )
*/
bool
ParsePrimaryExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParsePrimaryExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Tokens[2];



@@ 223,9 208,7 @@ ParsePrimaryExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

bool
ParsePostfixExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParsePostfixExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Tokens[2];



@@ 316,9 299,7 @@ ParsePostfixExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          postfix-expression ++
          postfix-expression --
*/
bool
ParsePostfixExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParsePostfixExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Postfix Expression", 2);


@@ 333,9 314,7 @@ ParsePostfixExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

bool
ParseUnaryOperator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseUnaryOperator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token = GetToken(Tokenizer);
        switch(Token.Type)


@@ 367,9 346,7 @@ ParseUnaryOperator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          sizeof unary-expression
          sizeof ( type-name )
*/
bool
ParseUnaryExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseUnaryExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Tokens[2];



@@ 444,9 421,7 @@ ParseUnaryExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          unary-expression
          ( type-name ) cast-expression
*/
bool
ParseCastExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseCastExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Tokens[2];



@@ 472,9 447,7 @@ ParseCastExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

bool
ParseMultiplicativeExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseMultiplicativeExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token;



@@ 517,9 490,7 @@ ParseMultiplicativeExpressionI(struct tokenizer *Tokenizer, parse_tree_node *Par
          multiplicative-expression / cast-expression
          multiplicative-expression % cast-expression
*/
bool
ParseMultiplicativeExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseMultiplicativeExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Multiplicative Expression", 2);


@@ 534,9 505,7 @@ ParseMultiplicativeExpression(struct tokenizer *Tokenizer, parse_tree_node *Pars
        return(false);
}

bool
ParseAdditiveExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseAdditiveExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token;



@@ 569,9 538,7 @@ ParseAdditiveExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree
          additive-expression + multiplicative-expression
          additive-expression - multiplicative-expression
*/
bool
ParseAdditiveExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseAdditiveExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Additive Expression", 2);


@@ 586,9 553,7 @@ ParseAdditiveExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

bool
ParseShiftExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseShiftExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token;



@@ 621,9 586,7 @@ ParseShiftExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          shift-expression << additive-expression
          shift-expression >> additive-expression
*/
bool
ParseShiftExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseShiftExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Shift Expression", 2);


@@ 638,9 601,7 @@ ParseShiftExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

bool
ParseRelationalExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseRelationalExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token;



@@ 693,9 654,7 @@ ParseRelationalExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTr
          relational-expression <= shift-exression
          relational-expression >= shift-expression
*/
bool
ParseRelationalExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseRelationalExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Relational Expressoin", 2);


@@ 710,9 669,7 @@ ParseRelationalExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTre
        return(false);
}

bool
ParseEqualityExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseEqualityExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token;



@@ 745,9 702,7 @@ ParseEqualityExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree
          equality-expression == relational-expression
          equality-expression != relational-expression
*/
bool
ParseEqualityExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseEqualityExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Equality Expression", 2);


@@ 762,9 717,7 @@ ParseEqualityExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

bool
ParseAndExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseAndExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token;



@@ 787,9 740,7 @@ ParseAndExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          equality-expression
          AND-expression & equality-expression
*/
bool
ParseAndExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseAndExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "And Expression", 2);


@@ 804,9 755,7 @@ ParseAndExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

bool
ParseExclusiveOrExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseExclusiveOrExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token;



@@ 829,9 778,7 @@ ParseExclusiveOrExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseT
          AND-expression
          exclusive-OR-expression ^ AND-expression
 */
bool
ParseExclusiveOrExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseExclusiveOrExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Exclusive Or Expression", 2);


@@ 846,9 793,7 @@ ParseExclusiveOrExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTr
        return(false);
}

bool
ParseInclusiveOrExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseInclusiveOrExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token;



@@ 871,9 816,7 @@ ParseInclusiveOrExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseT
          exclusive-OR-expression
          inclusive-OR-expression | exclusive-OR-expression
*/
bool
ParseInclusiveOrExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseInclusiveOrExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Inclusive Or Expression", 2);


@@ 888,9 831,7 @@ ParseInclusiveOrExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTr
        return(false);
}

bool
ParseLogicalAndExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseLogicalAndExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token;



@@ 913,9 854,7 @@ ParseLogicalAndExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTr
          inclusive-OR-expression
          logical-AND-expression && inclusive-OR-expression
*/
bool
ParseLogicalAndExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseLogicalAndExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Logical And Expression", 2);


@@ 930,9 869,7 @@ ParseLogicalAndExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTre
        return(false);
}

bool
ParseLogicalOrExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseLogicalOrExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token;



@@ 955,9 892,7 @@ ParseLogicalOrExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTre
          logical-AND-expression
          logical-OR-expression || logical-AND-expression
*/
bool
ParseLogicalOrExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseLogicalOrExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Logical Or Expression", 2);


@@ 976,9 911,7 @@ ParseLogicalOrExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree
  constant-expression:
          conditional-expression
*/
bool
ParseConstantExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseConstantExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Constant Expression", 1);


@@ 997,9 930,7 @@ ParseConstantExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          logical-OR-expression
          logical-OR-expression ? expression : conditional-expression
*/
bool
ParseConditionalExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseConditionalExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Tokens[2];



@@ 1032,9 963,7 @@ ParseConditionalExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTr
  assignment-operator:
  one of: = *= /= %= += -= <<= >>= &= ^= |=
*/
bool
ParseAssignmentOperator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseAssignmentOperator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token = GetToken(Tokenizer);



@@ 1066,9 995,7 @@ ParseAssignmentOperator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          conditional-expression
          unary-expression assignment-operator assignment-expression
*/
bool
ParseAssignmentExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseAssignmentExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Assignment Expression", 3);


@@ 1092,9 1019,7 @@ ParseAssignmentExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTre
        return(false);
}

bool
ParseExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token;



@@ 1117,9 1042,7 @@ ParseExpressionI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          assignment-expression
          expression , assignment-expression
*/
bool
ParseExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Expression", 2);


@@ 1134,9 1057,7 @@ ParseExpression(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

bool
ParseIdentifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseIdentifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token;



@@ 1157,9 1078,7 @@ ParseIdentifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          break ;
          return expression(opt) ;
*/
bool
ParseJumpStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseJumpStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Tokens[2];
        Tokens[0] = GetToken(Tokenizer);


@@ 1234,9 1153,7 @@ ParseJumpStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          do statement while ( expression) ;
          for ( expression(opt) ; expression(opt) ; expression(opt) ) statement
*/
bool
ParseIterationStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseIterationStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Tokens[5];
        Tokens[0] = GetToken(Tokenizer);


@@ 1352,9 1269,7 @@ ParseIterationStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          if ( expression ) statement else statement
          switch ( expression ) statement
*/
bool
ParseSelectionStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseSelectionStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Tokens[3];
        Tokens[0] = GetToken(Tokenizer);


@@ 1408,9 1323,7 @@ ParseSelectionStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

bool
ParseStatementListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseStatementListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Statement List'", 2);


@@ 1430,9 1343,7 @@ ParseStatementListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          statement
          statement-list statement
*/
bool
ParseStatementList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseStatementList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Statement List", 2);


@@ 1451,9 1362,7 @@ ParseStatementList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
  compound-statement:
          { declaration-list(opt) statement-list(opt) }
*/
bool
ParseCompoundStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseCompoundStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Token;



@@ 1493,9 1402,7 @@ ParseCompoundStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
  expression-statement:
          expression(opt) ;
*/
bool
ParseExpressionStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseExpressionStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Token;



@@ 1527,9 1434,7 @@ ParseExpressionStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree
          case constant-expression : statement
          default : statement
*/
bool
ParseLabeledStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseLabeledStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Tokens[2];



@@ 1584,9 1489,7 @@ ParseLabeledStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          iteration-statement
          jump-statement
*/
bool
ParseStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Statement", 1);


@@ 1617,9 1520,7 @@ ParseStatement(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
  typedef-name:
          identifier
*/
bool
ParseTypedefName(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseTypedefName(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token = GetToken(Tokenizer);
        *Tokenizer = Start;


@@ 1642,9 1543,7 @@ ParseTypedefName(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          direct-abstract-declarator(opt) [ constant-expression(opt) ]
          direct-abstract-declarator(opt) ( parameter-type-list(opt) )
*/
bool
ParseDirectAbstractDeclaratorI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseDirectAbstractDeclaratorI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Tokens[2];



@@ 1705,9 1604,7 @@ ParseDirectAbstractDeclaratorI(struct tokenizer *Tokenizer, parse_tree_node *Par
          direct-abstract-declarator(opt) [ constant-expression(opt) ]
          direct-abstract-declarator(opt) ( parameter-type-list(opt) )
*/
bool
ParseDirectAbstractDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseDirectAbstractDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Tokens[2];



@@ 1776,9 1673,7 @@ ParseDirectAbstractDeclarator(struct tokenizer *Tokenizer, parse_tree_node *Pars
          pointer
          pointer(opt) direct-abstract-declarator
*/
bool
ParseAbstractDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseAbstractDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Abstract Declarator", 2);


@@ 1811,9 1706,7 @@ ParseAbstractDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
  type-name:
          specifier-qualifier-list abstract-declarator(opt)
*/
bool
ParseTypeName(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseTypeName(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Type Name", 2);


@@ 1836,9 1729,7 @@ ParseTypeName(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

bool
ParseInitializerListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseInitializerListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Token;



@@ 1861,9 1752,7 @@ ParseInitializerListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          initializer
          initializer-list , initializer
*/
bool
ParseInitializerList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseInitializerList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Initializer List", 2);


@@ 1884,9 1773,7 @@ ParseInitializerList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          { initializer-list }
          { initializer-list , }
*/
bool
ParseInitializer(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseInitializer(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Tokens[3];



@@ 1923,9 1810,7 @@ ParseInitializer(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

bool
ParseIdentifierListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseIdentifierListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Token;



@@ 1948,9 1833,7 @@ ParseIdentifierListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          identifier
          identifier-list , identifier
*/
bool
ParseIdentifierList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseIdentifierList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Identifier List", 2);


@@ 1970,9 1853,7 @@ ParseIdentifierList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          declaration-specifiers declarator
          declaration-specifiers abstract-declarator(opt)
*/
bool
ParseParameterDeclaration(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseParameterDeclaration(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Parameter Declaration", 2);


@@ 2002,9 1883,7 @@ ParseParameterDeclaration(struct tokenizer *Tokenizer, parse_tree_node *ParseTre
        return(false);
}

bool
ParseParameterListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseParameterListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Token;



@@ 2027,9 1906,7 @@ ParseParameterListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          parameter-declaration
          parameter-list , parameter-declaration
*/
bool
ParseParameterList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseParameterList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Parameter List", 2);


@@ 2049,9 1926,7 @@ ParseParameterList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          parameter-list
          parameter-list , ...
*/
bool
ParseParameterTypeList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseParameterTypeList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Tokens[2];



@@ 2076,9 1951,7 @@ ParseParameterTypeList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

bool
ParseTypeQualifierListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseTypeQualifierListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Type Qualifier List'", 2);


@@ 2098,9 1971,7 @@ ParseTypeQualifierListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          type-qualifier
          type-qualifier-list type-qualifier
*/
bool
ParseTypeQualifierList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseTypeQualifierList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Type Qualifier List", 2);


@@ 2120,9 1991,7 @@ ParseTypeQualifierList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          * type-qualifier-list(opt)
          * type-qualifier-list(opt) pointer
  */
bool
ParsePointer(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParsePointer(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token = GetToken(Tokenizer);
        struct tokenizer AtToken = *Tokenizer;


@@ 2169,9 2038,7 @@ ParsePointer(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          direct-declarator ( parameter-type-list )
          direct-declarator ( identifier-list(opt) )
*/
bool
ParseDirectDeclaratorI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseDirectDeclaratorI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Tokens[2];



@@ 2245,9 2112,7 @@ ParseDirectDeclaratorI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          direct-declarator ( parameter-type-list )
          direct-declarator ( identifier-list(opt) )
*/
bool
ParseDirectDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseDirectDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Tokens[2];



@@ 2278,9 2143,7 @@ ParseDirectDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
  declarator:
          pointer(opt) direct-declarator
*/
bool
ParseDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Declarator", 2);


@@ 2308,9 2171,7 @@ ParseDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          identifier
          identifier = constant-expression
*/
bool
ParseEnumerator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseEnumerator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Token;



@@ 2336,9 2197,7 @@ ParseEnumerator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

bool
ParseEnumeratorListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseEnumeratorListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Token;



@@ 2361,9 2220,7 @@ ParseEnumeratorListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          enumerator
          enumerator-list , enumerator
*/
bool
ParseEnumeratorList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseEnumeratorList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Enumerator List", 2);


@@ 2383,9 2240,7 @@ ParseEnumeratorList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          enum identifier(opt) { enumerator-list }
          enum identifier
*/
bool
ParseEnumSpecifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseEnumSpecifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token = GetToken(Tokenizer);
        struct tokenizer AtToken = *Tokenizer;


@@ 2442,9 2297,7 @@ ParseEnumSpecifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          declarator
          declarator(opt) : constant-expression
*/
bool
ParseStructDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseStructDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Token;



@@ 2480,9 2333,7 @@ ParseStructDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

bool
ParseStructDeclaratorListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseStructDeclaratorListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Token;



@@ 2505,9 2356,7 @@ ParseStructDeclaratorListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTr
          struct-declarator
          struct-declarator-list , struct-declarator
*/
bool
ParseStructDeclaratorList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseStructDeclaratorList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Struct Declarator List", 2);


@@ 2527,9 2376,7 @@ ParseStructDeclaratorList(struct tokenizer *Tokenizer, parse_tree_node *ParseTre
          type-specifier specifier-qualifier-list(opt)
          type-qualifier specifier-qualifier-list(opt)
*/
bool
ParseSpecifierQualifierList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseSpecifierQualifierList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Specifier Qualifier List", 2);


@@ 2571,9 2418,7 @@ ParseSpecifierQualifierList(struct tokenizer *Tokenizer, parse_tree_node *ParseT
  struct-declaration:
          specifier-qualifier-list struct-declarator-list ;
*/
bool
ParseStructDeclaration(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseStructDeclaration(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Token;



@@ 2596,9 2441,7 @@ ParseStructDeclaration(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          declarator
          declarator = initializer
*/
bool
ParseInitDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseInitDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Token;



@@ 2624,9 2467,7 @@ ParseInitDeclarator(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

bool
ParseInitDeclaratorListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseInitDeclaratorListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        token Token;



@@ 2648,9 2489,7 @@ ParseInitDeclaratorListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree
          init-declarator
          init-declarator-list , init-declarator
*/
bool
ParseInitDeclaratorList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseInitDeclaratorList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Init Declaration List", 2);


@@ 2665,9 2504,7 @@ ParseInitDeclaratorList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

bool
ParseStructDeclarationListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseStructDeclarationListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Struct Declaration List'", 2);


@@ 2687,9 2524,7 @@ ParseStructDeclarationListI(struct tokenizer *Tokenizer, parse_tree_node *ParseT
          struct-declaration
          struct-declaration-list struct-declaration
*/
bool
ParseStructDeclarationList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseStructDeclarationList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Struct Declaration List", 2);


@@ 2708,9 2543,7 @@ ParseStructDeclarationList(struct tokenizer *Tokenizer, parse_tree_node *ParseTr
  struct-or-union:
  One of: struct union
*/
bool
ParseStructOrUnion(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseStructOrUnion(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token = GetToken(Tokenizer);



@@ 2733,9 2566,7 @@ ParseStructOrUnion(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          struct-or-union identifier(opt) { struct-declaration-list }
          struct-or-union identifier
*/
bool
ParseStructOrUnionSpecifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseStructOrUnionSpecifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Struct or Union Specifier", 5);


@@ 2783,9 2614,7 @@ ParseStructOrUnionSpecifier(struct tokenizer *Tokenizer, parse_tree_node *ParseT
  type-qualifier:
  One of: const volatile
*/
bool
ParseTypeQualifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseTypeQualifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token = GetToken(Tokenizer);



@@ 2808,9 2637,7 @@ ParseTypeQualifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
  One of: void char short int long float double signed unsigned
  struct-or-union-specifier enum-specifier typedef-name
*/
bool
ParseTypeSpecifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseTypeSpecifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        char *Keywords[] = { "void", "char", "short", "int", "long", "float",
                             "double", "signed", "unsigned" };


@@ 2856,9 2683,7 @@ ParseTypeSpecifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
  storage-class-specifier:
  One of: auto register static extern typedef
*/
bool
ParseStorageClassSpecifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseStorageClassSpecifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        char *Keywords[] = { "auto", "register", "static", "extern", "typedef" };



@@ 2886,9 2711,7 @@ ParseStorageClassSpecifier(struct tokenizer *Tokenizer, parse_tree_node *ParseTr
          type-specifier declaration-specifiers(opt)
          type-qualifier declaration-specifiers(opt)
*/
bool
ParseDeclarationSpecifiers(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseDeclarationSpecifiers(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Declaration Specifiers", 2);


@@ 2937,9 2760,7 @@ ParseDeclarationSpecifiers(struct tokenizer *Tokenizer, parse_tree_node *ParseTr
        return(false);
}

bool
ParseDeclarationListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseDeclarationListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Declaration List'", 2);


@@ 2959,9 2780,7 @@ ParseDeclarationListI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          declaration
          declaration-list declaration
*/
bool
ParseDeclarationList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseDeclarationList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Declaration List", 2);


@@ 2980,9 2799,7 @@ ParseDeclarationList(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
  declaration:
          declaration-specifiers init-declarator-list(opt) ;
*/
bool
ParseDeclaration(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseDeclaration(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;
        struct token Token;



@@ 3012,9 2829,7 @@ ParseDeclaration(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
  function-definition:
          declaration-specifiers(opt) declarator declaration-list(opt) compound-statement
*/
bool
ParseFunctionDefinition(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseFunctionDefinition(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Function Definition", 4);


@@ 3063,9 2878,7 @@ ParseFunctionDefinition(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          function-definition
          declaration
*/
bool
ParseExternalDeclaration(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseExternalDeclaration(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "External Declaration", 1);


@@ 3079,9 2892,7 @@ ParseExternalDeclaration(struct tokenizer *Tokenizer, parse_tree_node *ParseTree
        return(false);
}

bool
ParseTranslationUnitI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseTranslationUnitI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Translation Unit'", 2);


@@ 3101,9 2912,7 @@ ParseTranslationUnitI(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
          external-declaration
          translation-unit external-declaration
*/
bool
ParseTranslationUnit(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
{
bool ParseTranslationUnit(struct tokenizer *Tokenizer, parse_tree_node *ParseTree) {
        struct tokenizer Start = *Tokenizer;

        __Parser_ParseTreeUpdate(ParseTree, "Translation Unit", 2);


@@ 3118,9 2927,7 @@ ParseTranslationUnit(struct tokenizer *Tokenizer, parse_tree_node *ParseTree)
        return(false);
}

void
Parse(gs_buffer *FileContents, bool ShowParseTree)
{
void Parse(gs_buffer *FileContents, bool ShowParseTree) {
        parse_tree_allocator Allocator;
        Allocator.Alloc = malloc;
        Allocator.Free = free;

M test.c => test.c +70 -206
@@ 29,22 29,18 @@ typedef gs_bool (*parser_function)(struct tokenizer *, parse_tree_node *);
                GSTestAssert(Tokenizer.At == (String), "Tokenizer doesn't advance\n"); \
        }

struct tokenizer
InitTokenizer(char *String)
{
struct tokenizer InitTokenizer(char *String) {
        struct tokenizer Tokenizer;
        Tokenizer.Beginning = Tokenizer.At = String;
        Tokenizer.Line = Tokenizer.Column = 1;
        return(Tokenizer);
        return Tokenizer;
}

/*----------------------------------------------------------------------------
  Tests
  ----------------------------------------------------------------------------*/

void
TestConstant()
{
void TestConstant() {
        parser_function Fn = ParseConstant;
        Accept(Fn, "1");   /* integer-constant */
        Accept(Fn, "'c'"); /* character-constant */


@@ 54,17 50,13 @@ TestConstant()
        Reject(Fn, "sizeof(int)");
}

void
TestArgumentExpressionList()
{
void TestArgumentExpressionList() {
        parser_function Fn = ParseArgumentExpressionList;
        Accept(Fn, "(int)4.0");           /* assignment-expression */
        Accept(Fn, "(int)4.0, (int)4.0"); /* argument-expression-list , assignment-expression */
}

void
TestPrimaryExpression()
{
void TestPrimaryExpression() {
        parser_function Fn = ParsePrimaryExpression;
        Accept(Fn, "my_var");        /* identifier */
        Accept(Fn, "4.0");           /* constant */


@@ 72,9 64,7 @@ TestPrimaryExpression()
        Accept(Fn, "(sizeof(int))"); /* ( expression ) */
}

void
TestPostfixExpression()
{
void TestPostfixExpression() {
        parser_function Fn = ParsePostfixExpression;
        Accept(Fn, "my_var");       /* primary-expression */
        Accept(Fn, "my_var[0]");    /* postfix-expression [ expression ] */


@@ 86,9 76,7 @@ TestPostfixExpression()
        Reject(Fn, "--my_value");
}

void
TestUnaryOperator()
{
void TestUnaryOperator() {
        parser_function Fn = ParseUnaryOperator;
        Accept(Fn, "&");
        Accept(Fn, "*");


@@ 98,9 86,7 @@ TestUnaryOperator()
        Accept(Fn, "!");
}

void
TestUnaryExpression()
{
void TestUnaryExpression() {
        parser_function Fn = ParseUnaryExpression;
        Accept(Fn, "\"String\"");    /* postfix-expression */
        Accept(Fn, "++Foo");         /* ++ unary-expression */


@@ 110,17 96,13 @@ TestUnaryExpression()
        Accept(Fn, "sizeof(int)");   /* sizeof ( type-name ) */
}

void
TestCastExpression()
{
void TestCastExpression() {
        parser_function Fn = ParseCastExpression;
        Accept(Fn, "sizeof(int)"); /* unary-expression */
        Accept(Fn, "(int)4.0");    /* ( type-name ) cast-expression */
}

void
TestMultiplicativeExpression()
{
void TestMultiplicativeExpression() {
        parser_function Fn = ParseMultiplicativeExpression;
        Accept(Fn, "(int)4.0");            /* cast-expression */
        Accept(Fn, "(int)4.0 * (int)4.0"); /* multiplicative-expression * cast-expression */


@@ 128,27 110,21 @@ TestMultiplicativeExpression()
        Accept(Fn, "(int)4.0 % (int)4.0"); /* multiplicative-expression % cast-expression */
}

void
TestAdditiveExpression()
{
void TestAdditiveExpression() {
        parser_function Fn = ParseAdditiveExpression;
        Accept(Fn, "4 * 4");               /* multiplicative-expression */
        Accept(Fn, "(int)4.0 + (int)4.0"); /* additive-expression + multiplicative-expression */
        Accept(Fn, "(int)4.0 - (int)4.0"); /* additive-expression - multiplicative-expression */
}

void
TestShiftExpression()
{
void TestShiftExpression() {
        parser_function Fn = ParseShiftExpression;
        Accept(Fn, "4 + 4");          /* additive-expression */
        Accept(Fn, "4 + 4 << 4 + 4"); /* shift-expression << additive-expression */
        Accept(Fn, "4 + 4 >> 4 + 4"); /* shift-expression >> additive-expression */
}

void
TestRelationalExpression()
{
void TestRelationalExpression() {
        parser_function Fn = ParseRelationalExpression;
        Accept(Fn, "my_value << 4");                        /* shift-expression */
        Accept(Fn, "(my_value << 4) < (your_value >> 2)");  /* relational-expression < shift-expression */


@@ 157,73 133,55 @@ TestRelationalExpression()
        Accept(Fn, "(my_value << 4) >= (your_value >> 2)"); /* relational-expression >= shift-expression */
}

void
TestEqualityExpression()
{
void TestEqualityExpression() {
        parser_function Fn = ParseEqualityExpression;
        Accept(Fn, "1 < 2");              /* relational-expression */
        Accept(Fn, "(1 < 2) == (2 > 1)"); /* equality-expression == relational-expression */
        Accept(Fn, "(1 < 2) != 3");       /* equality-expression != relational-expression */
}

void
TestAndExpression()
{
void TestAndExpression() {
        parser_function Fn = ParseAndExpression;
        Accept(Fn, "1 != 3");      /* equality-expression */
        Accept(Fn, "1 != 3 & 24"); /* AND-expression & equality-expression */
}

void
TestExclusiveOrExpression()
{
void TestExclusiveOrExpression() {
        parser_function Fn = ParseExclusiveOrExpression;
        Accept(Fn, "1 != 3 & 24");        /* AND-expression */
        Accept(Fn, "(2 != 3 & 24) ^ 31"); /* exclusive-OR-expression ^ AND-expression */
}

void
TestInclusiveOrExpression()
{
void TestInclusiveOrExpression() {
        parser_function Fn = ParseInclusiveOrExpression;
        Accept(Fn, "(2 != 3 & 24) ^ 31"); /* exclusive-OR-expression */
        Accept(Fn, "2 | 3");              /* inclusive-OR-expression | exclusive-OR-expression */
}

void
TestLogicalAndExpression()
{
void TestLogicalAndExpression() {
        parser_function Fn = ParseLogicalAndExpression;
        Accept(Fn, "2 | 3");              /* inclusive-OR-expression */
        Accept(Fn, "(2 | 3) && (2 | 3)"); /* logical-AND-expression && inclusive-OR-expression */
}

void
TestLogicalOrExpression()
{
void TestLogicalOrExpression() {
        parser_function Fn = ParseLogicalOrExpression;
        Accept(Fn, "2 && 3");           /* logical-AND-expression */
        Accept(Fn, "2 && 3 || 2 && 3"); /* logical-OR-expression || logical-AND-expression */
}

void
TestConstantExpression()
{
void TestConstantExpression() {
        parser_function Fn = ParseConstantExpression;
        Accept(Fn, "2 || 3 ? 4 : 5");   /* conditional-expression */
}

void
TestConditionalExpression()
{
void TestConditionalExpression() {
        parser_function Fn = ParseConditionalExpression;
        Accept(Fn, "2 && 3 || 2 && 3"); /* logical-OR-expression */
        Accept(Fn, "2 || 3 ? 4 : 5");   /* logical-OR-expression ? expression : conditional-expression */
}

void
TestAssignmentOperator()
{
void TestAssignmentOperator() {
        parser_function Fn = ParseAssignmentOperator;
        Accept(Fn, "=");
        Accept(Fn, "*=");


@@ 238,26 196,20 @@ TestAssignmentOperator()
        Accept(Fn, "|=");
}

void
TestAssignmentExpression()
{
void TestAssignmentExpression() {
        parser_function Fn = ParseAssignmentExpression;
        Accept(Fn, "2 || 3 ? 4 : 5"); /* conditional-expression */
        Accept(Fn, "++Foo |= ++Foo"); /* unary-expression assignment-operator assignment-expression */
}

void
TestExpression()
{
void TestExpression() {
        parser_function Fn = ParseExpression;
        Accept(Fn, "++Foo |= (2 || 3 ? 4 : 5)"); /* assignment-expression */
        Accept(Fn, "++Foo, Foo++");              /* expression, assignment-expression */
        Accept(Fn, "i=0");
}

void
TestIdentifier()
{
void TestIdentifier() {
        parser_function Fn = ParseIdentifier;
        Accept(Fn, "_foo");
        Accept(Fn, "foo123_");


@@ 265,9 217,7 @@ TestIdentifier()
        Reject(Fn, "123_foo");
}

void
TestJumpStatement()
{
void TestJumpStatement() {
        parser_function Fn = ParseJumpStatement;
        Accept(Fn, "goto foo;"); /* goto identifier ; */
        Accept(Fn, "continue;"); /* continue ; */


@@ 275,9 225,7 @@ TestJumpStatement()
        Accept(Fn, "return;");   /* return expression(opt) ; */
}

void
TestIterationStatement()
{
void TestIterationStatement() {
        parser_function Fn = ParseIterationStatement;
        Accept(Fn, "while(true) {}");                     /* while ( expression ) statement */
        Accept(Fn, "do { foo = 2; } while(++Foo |= 3);"); /* do statement while ( expression ) ; */


@@ 285,26 233,20 @@ TestIterationStatement()
        Accept(Fn, "for(i=0; i<Foo; i++) { ; }");         /* for ( expression(opt) ; expression(opt) ; expression(opt) ) statement */
}

void
TestSelectionStatement()
{
void TestSelectionStatement() {
        parser_function Fn = ParseSelectionStatement;
        Accept(Fn, "if(true) return;");                 /* if ( expression ) statement */
        Accept(Fn, "if(1 = 3) goto end; else return;"); /* if ( expression ) statement else statement */
        Accept(Fn, "switch(Foo) { break; }");           /* switch ( expression ) statement */
}

void
TestStatementList()
{
void TestStatementList() {
        parser_function Fn = ParseStatementList;
        Accept(Fn, "i = 1;");        /* statement */
        Accept(Fn, "i = 1; i = 1;"); /* statement-list statement */
}

void
TestCompoundStatement()
{
void TestCompoundStatement() {
        parser_function Fn = ParseCompoundStatement;
        Accept(Fn, "{ int i; i = 2; i = 3; }"); /* { declaration-list(opt) statement-list(opt) } */
        Accept(Fn, "{ }");


@@ 312,9 254,7 @@ TestCompoundStatement()
        Accept(Fn, "{ i = 3; }");
}

void
TestExpressionStatement()
{
void TestExpressionStatement() {
        parser_function Fn = ParseExpressionStatement;
        Accept(Fn, ";"); /* expression(opt) */
        Accept(Fn, "++Foo |= (2 || 3 ? 4 : 5) ;");


@@ 322,18 262,14 @@ TestExpressionStatement()
        Accept(Fn, "i=0;");
}

void
TestLabeledStatement()
{
void TestLabeledStatement() {
        parser_function Fn = ParseLabeledStatement;
        Accept(Fn, "label: i = 0;");                    /* identifier : statement */
        Accept(Fn, "case Foo: break;");                 /* case constant-expression : statement */
        Accept(Fn, "default: { exit(EXIT_SUCCESS); }"); /* default : statement */
}

void
TestStatement()
{
void TestStatement() {
        parser_function Fn = ParseStatement;
        Accept(Fn, "default: { exit(EXIT_SUCCESS); }"); /* labeled-statement */
        Accept(Fn, "++Foo |= (2 || 3 ? 4 : 5);");       /* expression-statement */


@@ 343,9 279,7 @@ TestStatement()
        Accept(Fn, "goto foo;");                        /* jump-statement */
}

void
TestTypedefName()
{
void TestTypedefName() {
        parser_function Fn = ParseTypedefName;
        Reject(Fn, "my_type");
        TypedefInit();


@@ 354,9 288,7 @@ TestTypedefName()
        TypedefClear();
}

void
TestDirectAbstractDeclarator()
{
void TestDirectAbstractDeclarator() {
        parser_function Fn = ParseDirectAbstractDeclarator;
        Accept(Fn, "(int i)");                   /* ( abstract-declarator ) */
        Accept(Fn, "(int i[2])");                /* direct-abstract-declarator(opt) [ constant-expression(opt) ] */


@@ 369,9 301,7 @@ TestDirectAbstractDeclarator()
        Accept(Fn, "(())");                      /* direct-abstract-declarator(opt) ( parameter-type-list(opt) ) */
}

void
TestAbstractDeclarator()
{
void TestAbstractDeclarator() {
        parser_function Fn = ParseAbstractDeclarator;
        Accept(Fn, "*");                              /* pointer */
        Accept(Fn, "* volatile");                     /* pointer */


@@ 380,9 310,7 @@ TestAbstractDeclarator()
        Accept(Fn, "* const ((int arg1, int arg2))"); /* pointer(opt) direct-abstract-declarator */
}

void
TestTypeName()
{
void TestTypeName() {
        parser_function Fn = ParseTypeName;
        Accept(Fn, "volatile int"); /* specifier-qualifier-list abstract-declarator(opt) */
        Accept(Fn, "const void");   /* specifier-qualifier-list abstract-declarator(opt) */


@@ 395,67 323,51 @@ TestTypeName()
        TypedefClear();
}

void
TestInitializerList()
{
void TestInitializerList() {
        parser_function Fn = ParseInitializerList;
        Accept(Fn, "++Foo |= --Foo"); /* initializer */
        Accept(Fn, "++Foo |= --Foo, ++Bar |= --Bar"); /* initializer-list , initializer */
}

void
TestInitializer()
{
void TestInitializer() {
        parser_function Fn = ParseInitializer;
        Accept(Fn, "++Foo |= --Foo");           /* assignment-expression */
        Accept(Fn, "{ i |= --i, ++j |= j }");   /* { initializer-list } */
        Accept(Fn, "{ i |= --i, ++j |= j,  }"); /* { initializer-list , } */
}

void
TestIdentifierList()
{
void TestIdentifierList() {
        parser_function Fn = ParseIdentifierList;
        Accept(Fn, "foo");           /* identifier */
        Accept(Fn, "foo, bar, baz"); /* identifier-list , identifier */
}

void
TestParameterDeclaration()
{
void TestParameterDeclaration() {
        parser_function Fn = ParseParameterDeclaration;
        Accept(Fn, "auto int foo");    /* declaration-specifiers declarator */
        Accept(Fn, "register char *"); /* declaration-specifiers abstract-declarator(opt) */
        Accept(Fn, "extern float");    /* declaration-specifiers abstract-declarator(opt) */
}

void
TestParameterList()
{
void TestParameterList() {
        parser_function Fn = ParseParameterList;
        Accept(Fn, "extern float");                  /* parameter-declaration */
        Accept(Fn, "extern float, register char *"); /* parameter-list, parameter-declaration */
}

void
TestParameterTypeList()
{
void TestParameterTypeList() {
        parser_function Fn = ParseParameterTypeList;
        Accept(Fn, "extern float, register char *"); /* parameter-list */
        Accept(Fn, "float, char, ...");              /* parameter-list , ... */
}

void
TestTypeQualifierList()
{
void TestTypeQualifierList() {
        parser_function Fn = ParseTypeQualifierList;
        Accept(Fn, "const");          /* type-qualifier */
        Accept(Fn, "const volatile"); /* type-qualifier-list type-qualifier */
}

void
TestPointer()
{
void TestPointer() {
        parser_function Fn = ParsePointer;
        Accept(Fn, "*");                  /* type-qualifier-list(opt) */
        Accept(Fn, "* const");            /* type-qualifier-list(opt) */


@@ 464,9 376,7 @@ TestPointer()
        Accept(Fn, "* const * volatile"); /* type-qualifier-list(opt) pointer */
}

void
TestDirectDeclarator()
{
void TestDirectDeclarator() {
        parser_function Fn = ParseDirectDeclarator;
        Accept(Fn, "foo");                  /* identifier */
        Accept(Fn, "(foo)");                /* ( declarator ) */


@@ 476,58 386,44 @@ TestDirectDeclarator()
        Accept(Fn, "(foo)()");              /* direct-declarator ( identifier-list(opt) ) */
}

void
TestDeclarator()
{
void TestDeclarator() {
        parser_function Fn = ParseDeclarator;
        Accept(Fn, "* const * volatile (foo)(int i, char c)"); /* pointer(opt) direct-declarator */
        Accept(Fn, "(foo)(int i, char c)");                    /* pointer(opt) direct-declarator */
}

void
TestEnumerator()
{
void TestEnumerator() {
        parser_function Fn = ParseEnumerator;
        Accept(Fn, "foo");     /* identifier */
        Accept(Fn, "foo = 2"); /* identifier = constant-expression */
}

void
TestEnumeratorList()
{
void TestEnumeratorList() {
        parser_function Fn = ParseEnumeratorList;
        Accept(Fn, "foo = 2");          /* enumerator */
        Accept(Fn, "foo = 2, bar = 3"); /* enumerator-list , enumerator */
}

void
TestEnumSpecifier()
{
void TestEnumSpecifier() {
        parser_function Fn = ParseEnumSpecifier;
        Accept(Fn, "enum { foo = 2, bar = 3 }");        /* enum identifier(opt) { enumerator-list } */
        Accept(Fn, "enum MyEnum { foo = 2, bar = 3 }"); /* enum identifier(opt) { enumerator-list } */
        Accept(Fn, "enum foo");                         /* enum identifier */
}

void
TestStructDeclarator()
{
void TestStructDeclarator() {
        parser_function Fn = ParseStructDeclarator;
        Accept(Fn, "(foo)(int i, char c)");    /* declarator */
        Accept(Fn, "(foo)(int i, char c): 2"); /* declarator(opt) : constant-expression */
}

void
TestStructDeclaratorList()
{
void TestStructDeclaratorList() {
        parser_function Fn = ParseStructDeclaratorList;
        Accept(Fn, "(foo)(int i, char c)"); /* struct-declarator */
        Accept(Fn, "x: 2, y: 3");           /* struct-declarator-list , struct-declarator */
}

void
TestSpecifierQualifierList()
{
void TestSpecifierQualifierList() {
        parser_function Fn = ParseSpecifierQualifierList;
        Accept(Fn, "void char short");                      /* type-specifier specifier-qualifier-list(opt) */
        Accept(Fn, "int");                                  /* type-specifier specifier-qualifier-list(opt) */


@@ 536,65 432,49 @@ TestSpecifierQualifierList()
        Accept(Fn, "void const short volatile double int"); /* type-qualifier specifier-qualifier-list(opt) */
}

void
TestStructDeclaration()
{
void TestStructDeclaration() {
        parser_function Fn = ParseStructDeclaration;
        Accept(Fn, "volatile double x: 2, y: 3;"); /* specifier-qualifier-list struct-declarator-list ; */
}

void
TestInitDeclarator()
{
void TestInitDeclarator() {
        parser_function Fn = ParseInitDeclarator;
        Accept(Fn, "* const * volatile (foo)(int i, char c)"); /* declarator */
        Accept(Fn, "(foo)(int i, char c) = ++Foo |= --Foo");   /* declarator = initializer */
}

void
TestInitDeclaratorList()
{
void TestInitDeclaratorList() {
        parser_function Fn = ParseInitDeclaratorList;
        Accept(Fn, "foo = 2");          /* init-declarator */
        Accept(Fn, "foo = 2, bar = 3"); /* init-declarator-list , init-declarator */
}

void
TestStructDeclarationList()
{
void TestStructDeclarationList() {
        parser_function Fn = ParseStructDeclarationList;
        Accept(Fn, "volatile double x: 2, y: 3;"); /* struct-declaration */
        Accept(Fn, "int x: 2; int y: 3;");         /* struct-declaration-list struct-declaration */
}

void
TestStructOrUnion()
{
void TestStructOrUnion() {
        parser_function Fn = ParseStructOrUnion;
        Accept(Fn, "struct");
        Accept(Fn, "union");
}

void
TestStructOrUnionSpecifier()
{
void TestStructOrUnionSpecifier() {
        parser_function Fn = ParseStructOrUnionSpecifier;
        Accept(Fn, "struct foo { int x: 2; float y: 3.0; }"); /* struct-or-union identifier(opt) { struct-declaration-list } */
        Accept(Fn, "union { int x: 2; float y: 3.0; }");      /* struct-or-union identifier(opt) { struct-declaration-list } */
        Accept(Fn, "struct foo");                             /* struct-or-union identifier */
}

void
TestTypeQualifier()
{
void TestTypeQualifier() {
        parser_function Fn = ParseTypeQualifier;
        Accept(Fn, "const");
        Accept(Fn, "volatile");
}

void
TestTypeSpecifier()
{
void TestTypeSpecifier() {
        parser_function Fn = ParseTypeSpecifier;
        Accept(Fn, "void");
        Accept(Fn, "char");


@@ 610,9 490,7 @@ TestTypeSpecifier()
        Reject(Fn, "foo");                              /* typedef-name */
}

void
TestStorageClassSpecifier()
{
void TestStorageClassSpecifier() {
        parser_function Fn = ParseStorageClassSpecifier;
        Accept(Fn, "auto");
        Accept(Fn, "register");


@@ 621,9 499,7 @@ TestStorageClassSpecifier()
        Accept(Fn, "typedef");
}

void
TestDeclarationSpecifiers()
{
void TestDeclarationSpecifiers() {
        parser_function Fn = ParseDeclarationSpecifiers;
        Accept(Fn, "static static");        /* storage-class-specifier declaration-specifers(opt) */
        Accept(Fn, "static");               /* storage-class-specifier declaration-specifers(opt) */


@@ 636,17 512,13 @@ TestDeclarationSpecifiers()
        Accept(Fn, "const volatile");       /* type-qualifier declaration-specifiers(opt) */
}

void
TestDeclarationList()
{
void TestDeclarationList() {
        parser_function Fn = ParseDeclarationList;
        Accept(Fn, "const volatile foo;");                /* declaration */
        Accept(Fn, "volatile short foo; const int bar;"); /* declaration-list declaration */
}

void
TestDeclaration()
{
void TestDeclaration() {
        parser_function Fn = ParseDeclaration;
        Accept(Fn, "const volatile;");     /* declaration-specifiers init-declarator-list(opt) ; */
        Accept(Fn, "const volatile foo;"); /* declaration-specifiers init-declarator-list(opt) ; */


@@ 654,9 526,7 @@ TestDeclaration()
        Accept(Fn, "const volatile foo = 2, bar = 3;");
}

void
TestFunctionDefinition()
{
void TestFunctionDefinition() {
        parser_function Fn = ParseFunctionDefinition;
        /* declaration-specifiers(opt) declarator declaration-list(opt) compound-statement */
        Accept(Fn, "int main(){}");


@@ 666,17 536,13 @@ TestFunctionDefinition()

}

void
TestExternalDeclaration()
{
void TestExternalDeclaration() {
        parser_function Fn = ParseExternalDeclaration;
        Accept(Fn, "main() {}");                   /* function-definition */
        Accept(Fn, "const volatile int foo = 2;"); /* declaration */
}

void
TestTranslationUnit()
{
void TestTranslationUnit() {
        parser_function Fn = ParseTranslationUnit;
        Accept(Fn, "int global = 1; int main(){}");
        Accept(Fn, "int main(int argc, char **argv) { int i = 2; return(i); }");


@@ 686,9 552,7 @@ TestTranslationUnit()
  Main Entrypoint
  ----------------------------------------------------------------------------*/

int
main(int ArgCount, char **Arguments)
{
int main(int ArgCount, char **Arguments) {
        gs_args Args;
        GSArgsInit(&Args, ArgCount, Arguments);



@@ 767,5 631,5 @@ main(int ArgCount, char **Arguments)
        TestTranslationUnit();

        printf("All tests successful\n");
        return(EXIT_SUCCESS);
        return EXIT_SUCCESS;
}

M tree.c => tree.c +1 -2
@@ 167,8 167,7 @@ void ParseTreePrint(parse_tree_node *Self, uint32_t IndentLevel, uint32_t Indent

        if (Self->Token.Type != Token_Unknown) {
                printf("[%4d,%3d] ", Self->Token.Line, Self->Token.Column);
        }
        else {
        } else {
                printf("           ");
        }