Bugs with direct variable in Pou body fixed
authorlbessard
Mon, 17 Sep 2007 17:47:10 +0200
changeset 58 273d6d5cec9d
parent 57 db9cadaab2ea
child 59 37ba6f9e51e2
Bugs with direct variable in Pou body fixed
stage1_2/iec.flex
stage4/generate_cc/generate_location_list.cc
--- a/stage1_2/iec.flex	Thu Aug 30 16:40:20 2007 +0200
+++ b/stage1_2/iec.flex	Mon Sep 17 17:47:10 2007 +0200
@@ -770,6 +770,7 @@
 <il_st_state>{
 {st_whitespace_no_pragma}			/* Eat any whitespace */
 {qualified_identifier}{st_whitespace}":="	unput_text(0); BEGIN(st_state);
+{direct_variable}{st_whitespace}":="	unput_text(0); BEGIN(st_state);
 {qualified_identifier}"["			unput_text(0); BEGIN(st_state);
 
 RETURN						unput_text(0); BEGIN(st_state);
@@ -899,9 +900,11 @@
 	/* B 1.2.1 - Numeric Literals */
 	/******************************/
 TRUE		return TRUE;
-BOOL#1  	return TRUE;
+BOOL#1		return TRUE;
+BOOL#TRUE		return TRUE;
 FALSE		return FALSE;
-BOOL#0  	return FALSE;
+BOOL#0		return FALSE;
+BOOL#FALSE		return FALSE;
 
 
 	/************************/
--- a/stage4/generate_cc/generate_location_list.cc	Thu Aug 30 16:40:20 2007 +0200
+++ b/stage4/generate_cc/generate_location_list.cc	Mon Sep 17 17:47:10 2007 +0200
@@ -118,14 +118,16 @@
 /********************************************/
 
     void *visit(direct_variable_c *symbol) {
-      s4o.print("__LOCATED_VAR(");
-      current_var_type_symbol->accept(*generate_cc_base);
-      s4o.print(",");
-      /* Do not use print_token() as it will change everything into uppercase */
-      s4o.printlocation((symbol->value)+1);
-      s4o.print(",");
-      s4o.printlocation_comasep((symbol->value)+1);
-      s4o.print(")\n");
+      if (current_var_type_symbol) {
+        s4o.print("__LOCATED_VAR(");
+        current_var_type_symbol->accept(*generate_cc_base);
+        s4o.print(",");
+        /* Do not use print_token() as it will change everything into uppercase */
+        s4o.printlocation((symbol->value)+1);
+        s4o.print(",");
+        s4o.printlocation_comasep((symbol->value)+1);
+        s4o.print(")\n");
+      }
       return NULL;
     }