Allow [EOL] after a label in IL.
authorMario de Sousa <msousa@fe.up.pt>
Fri, 03 Jun 2011 17:14:24 +0100
changeset 311 8fcea60029de
parent 310 f111a6986c22
child 312 29add821207d
Allow [EOL] after a label in IL.
stage1_2/iec.y
stage4/generate_c/generate_c_il.cc
stage4/generate_iec/generate_iec.cc
--- a/stage1_2/iec.y	Wed Jun 01 14:02:16 2011 +0200
+++ b/stage1_2/iec.y	Fri Jun 03 17:14:24 2011 +0100
@@ -6197,6 +6197,8 @@
 	{$$ = new il_instruction_c(NULL, $1, locloc(@$));}
 | label ':' il_incomplete_instruction eol_list
 	{$$ = new il_instruction_c($1, $3, locloc(@$));}
+| label ':' eol_list
+	{$$ = new il_instruction_c($1, NULL, locloc(@$));}
 /* ERROR_CHECK_BEGIN */
 | error eol_list
 	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid IL instruction."); yyerrok;}
--- a/stage4/generate_c/generate_c_il.cc	Wed Jun 01 14:02:16 2011 +0200
+++ b/stage4/generate_c/generate_c_il.cc	Fri Jun 03 17:14:24 2011 +0100
@@ -751,7 +751,9 @@
     s4o.print(":\n");
     s4o.print(s4o.indent_spaces);
   }
-  symbol->il_instruction->accept(*this);
+  if (NULL != symbol->il_instruction) {
+    symbol->il_instruction->accept(*this);
+  }  
   return NULL;
 }
 
--- a/stage4/generate_iec/generate_iec.cc	Wed Jun 01 14:02:16 2011 +0200
+++ b/stage4/generate_iec/generate_iec.cc	Fri Jun 03 17:14:24 2011 +0100
@@ -1530,7 +1530,9 @@
     symbol->label->accept(*this);
     s4o.print(": ");
   }
-  symbol->il_instruction->accept(*this);
+  if (symbol->il_instruction != NULL) {
+    symbol->il_instruction->accept(*this);
+  }  
   return NULL;
 }