def p_type_qualifier(self, p): """ type_qualifier : CONST | RESTRICT | VOLATILE """ p[0] = ast.TextNode('%s' % p[1])
def p_expression_4(self, p): """ expression : arg PLUSPLUS | arg MINUSMINUS | PLUSPLUS arg | MINUSMINUS arg """ p[0] = ast.TextNode("%s%s" % (p[1], p[2]))
def p_storage_class(self, p): """ storage_class : AUTO | REGISTER | STATIC | EXTERN | TYPEDEF """ p[0] = ast.TextNode('%s' % p[1])
def p_constant_1(self, p): """ constant : STRING_LITERAL | INT_CONST_DEC | INT_CONST_HEX | INT_CONST_OCT | FLOAT_CONST | CHAR_CONST """ p[0] = ast.TextNode('%s' % p[1])
def p_type_spec_1(self, p): """ type_spec : VOID | CHAR | SHORT | INT | LONG | FLOAT | DOUBLE | SIGNED | UNSIGNED | ID """ p[0] = ast.TextNode('%s' % p[1])
def p_f_arg_list_1(self, p): 'f_arg_list : empty' p[0] = ast.TextNode('')
def p_f_arg_list_2(self, p): 'f_arg_list : decl_specs type_spec variable' p[0] = ast.TextNode('%s%s %s' % (p[1], p[2], p[3]))
def p_array_expression_3(self, p): 'array_expression : empty' p[0] = ast.TextNode('')
def p_expression_7(self, p): 'expression : SIZEOF expression' p[0] = ast.TextNode('%s %s' % (p[1], p[2]))
def p_decl_specs_1(self, p): 'decl_specs : empty' p[0] = ast.TextNode('')
def p_decl_specs_3(self, p): 'decl_specs : decl_specs storage_class' p[0] = ast.TextNode('%s %s' % (p[1], p[2]))
def p_expression_5(self, p): """ expression : NOT expression | LNOT expression """ p[0] = ast.TextNode("%s%s" % (p[1], p[2]))
def p_label(self, p): 'label : ID COLON' p[0] = ast.TextNode("%s" % p[1])
def p_arg_3(self, p): 'arg : arg_name array' p[0] = ast.TextNode('%s%s' % (p[1], p[2]))
def p_arg_name_1(self, p): 'arg_name : ID' p[0] = ast.TextNode('%s' % p[1])
def p_arg_2(self, p): 'arg : TIMES arg %prec POINTER' p[0] = ast.TextNode('*%s' % p[2])
def p_arg_1(self, p): 'arg : arg_name' p[0] = ast.TextNode('%s' % p[1])
def p_expression_8(self, p): 'expression : expression CONDOP expression COLON expression' p[0] = ast.TextNode('%s ? %s : %s' % (p[1], p[3], p[5]))
def p_f_arg_list_3(self, p): 'f_arg_list : f_arg_list COMMA decl_specs type_spec variable' p[0] = ast.TextNode('%s, %s%s %s' % (p[1], p[3], p[4], p[5]))
def p_function_call(self, p): 'function_call : func_name LPAREN arglist RPAREN' p[0] = ast.TextNode('%s(%s)' % (p[1], p[3]))
def p_f_arg_list_4(self, p): 'f_arg_list : f_arg_list COMMA ELLIPSIS' p[0] = ast.TextNode('%s, ...' % p[1])
def p_func_name(self, p): 'func_name : ID' p[0] = ast.TextNode('%s' % p[1])
def p_for_header_1(self, p): 'for_header : LPAREN initializer SEMI expression SEMI expression RPAREN' p[0] = ast.TextNode("(%s; %s; %s)" % (p[2], p[4], p[6]))
def p_array_expression_2(self, p): 'array_expression : TIMES' p[0] = ast.TextNode('%s' % p[1])
def p_decl_specs_2(self, p): 'decl_specs : decl_specs type_qualifier' p[0] = ast.TextNode('%s %s' % (p[1], p[2]))
def p_arglist_1(self, p): 'arglist : arg' p[0] = ast.TextNode('%s' % p[1])
def p_decl_specs_4(self, p): 'decl_specs : decl_specs func_spec' p[0] = ast.TextNode('%s %s' % (p[1], p[2]))
def p_arglist_2(self, p): 'arglist : arglist COMMA arg' p[0] = ast.TextNode('%s, %s' % (p[1], p[3]))
def p_arglist_0(self, p): 'arglist : empty' p[0] = ast.TextNode('')
def p_expression_6(self, p): 'expression : LPAREN expression RPAREN' p[0] = ast.TextNode("(%s)" % p[2])