* position and free the struct, since we can't match a primary expression.
*/
+ if(pe->data.expr.expr) {
+ free(pe->data.expr.expr);
+ }
+
lex_setpos(pos);
free(pe);
pe = NULL;
return(pe);
}
+
+struct assignment_expression *parse_assignment_expression(void)
+{
+ struct assignment_expression *ae;
+
+ ae = assignment_expression_new();
+
+ if(!ae) {
+ return(NULL);
+ }
+
+ if((ae->data.cexpr = parse_conditional_expression())) {
+ ae->type = ASSIGNMENT_EXPR_CONDITIONAL;
+ } else {
+ int pos;
+
+ pos = lex_getpos();
+
+ ae->data.aexpr.uexpr = parse_unary_expression();
+ ae->data.aexpr.op = lex_gettoken();
+ ae->data.aexpr.aexpr = parse_assignment_expression();
+
+ if(ae->data.aexpr.uexpr && ae->data.aexpr.op && ae->data.aexpr.aexpr &&
+ (ae->data.aexpr.op->type == TOKEN_ASSIGN ||
+ ae->data.aexpr.op->type == TOKEN_ASSIGN_ADD ||
+ ae->data.aexpr.op->type == TOKEN_ASSIGN_AND ||
+ ae->data.aexpr.op->type == TOKEN_ASSIGN_MOD ||
+ ae->data.aexpr.op->type == TOKEN_ASSIGN_MUL ||
+ ae->data.aexpr.op->type == TOKEN_ASSIGN_OR ||
+ ae->data.aexpr.op->type == TOKEN_ASSIGN_SHL ||
+ ae->data.aexpr.op->type == TOKEN_ASSIGN_SHR ||
+ ae->data.aexpr.op->type == TOKEN_ASSIGN_SUB ||
+ ae->data.aexpr.op->type == TOKEN_ASSIGN_XOR)) {
+ ae->type = ASSIGNMENT_EXPR_ASSIGNMENT;
+ } else {
+ if(ae->data.aexpr.uexpr) {
+ free(ae->data.aexpr.uexpr);
+ }
+
+ if(ae->data.aexpr.aexpr) {
+ free(ae->data.aexpr.aexpr);
+ }
+
+ lex_setpos(pos);
+ free(ae);
+ ae = NULL;
+ }
+ }
+
+ return(ae);
+}
+
+struct unary_expression *parse_unary_expression(void)
+{
+ return(NULL);
+}
+
+struct conditional_expression *parse_conditional_expression(void)
+{
+ return(NULL);
+}