shithub: scc

Download patch

ref: a2e43bb731e42e513878f7ae93255ae329ebbf0c
parent: e888ffdaf5a6a7aee73253cc982847e72be0bd94
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Aug 11 19:38:41 EDT 2014

Add comma operator

--- a/cc2/cc2.h
+++ b/cc2/cc2.h
@@ -88,6 +88,7 @@
 #define OAND      'y'
 #define ONEG      '_'
 #define OCPL      '~'
+#define OCOMMA    ','
 
 extern void error(unsigned nerror, ...);
 extern void genaddable(Node *list[]);
--- a/cc2/cgen.c
+++ b/cc2/cgen.c
@@ -124,6 +124,7 @@
 	}
 
 	switch (np->op) {
+	case OCOMMA:
 	case ONEG:   case OCPL:
 	case OOR:    case OAND:
 	case OPTR:   case OADDR:
@@ -200,6 +201,7 @@
 	case OPTR:   case OADDR:
 		xaddable(lp);
 		break;
+	case OCOMMA:
 	case OOR:    case OAND:
 	case OLT:    case OGT:  case OGE:  case OLE:  case OEQ:  case ONE:
 	case OINC:
@@ -238,3 +240,4 @@
 	while (np = *list++)
 		xaddable(np);
 }
+
--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -304,6 +304,7 @@
 	['o'] = operator,
 	['_'] = unary,
 	['~'] = unary,
+	[','] = operator,
 	['\177'] = NULL
 };