Bug that didn't affect standard function names as keywords fixed
authorlbessard
Fri, 19 Oct 2007 10:15:23 +0200
changeset 109 734e02ab4018
parent 108 9aa1fdfb7cb2
child 110 29b6b70e1721
Bug that didn't affect standard function names as keywords fixed
plcopen/structures.py
--- a/plcopen/structures.py	Wed Oct 17 17:50:27 2007 +0200
+++ b/plcopen/structures.py	Fri Oct 19 10:15:23 2007 +0200
@@ -327,63 +327,8 @@
 
 
 #-------------------------------------------------------------------------------
-#                            Languages Keywords
-#-------------------------------------------------------------------------------
-
-
-# Keywords for Pou Declaration
-POU_KEYWORDS = ["FUNCTION", "END_FUNCTION", "FUNCTION_BLOCK", "END_FUNCTION_BLOCK",
- "PROGRAM", "END_PROGRAM", "EN", "ENO", "F_EDGE", "R_EDGE"]
-for category in BlockTypes:
-    for block in category["list"]:
-        if block["name"] not in POU_KEYWORDS:
-            POU_KEYWORDS.append(block["name"])
-
-
-# Keywords for Type Declaration
-TYPE_KEYWORDS = ["TYPE", "END_TYPE", "STRUCT", "END_STRUCT", "ARRAY", "OF", "T",
- "D", "TIME_OF_DAY", "DATE_AND_TIME"]
-TYPE_KEYWORDS.extend([keyword for keyword in TypeHierarchy.keys() if keyword not in TYPE_KEYWORDS])
-
-
-# Keywords for Variable Declaration
-VAR_KEYWORDS = ["VAR", "VAR_INPUT", "VAR_OUTPUT", "VAR_IN_OUT", "VAR_TEMP", 
- "VAR_EXTERNAL", "END_VAR", "AT", "CONSTANT", "RETAIN", "NON_RETAIN"]
-
-
-# Keywords for Configuration Declaration
-CONFIG_KEYWORDS = ["CONFIGURATION", "END_CONFIGURATION", "RESOURCE", "ON", "END_RESOURCE",
- "PROGRAM", "WITH", "READ_ONLY", "READ_WRITE", "TASK", "VAR_ACCESS", "VAR_CONFIG", 
- "VAR_GLOBAL", "END_VAR"]
-
-
-# Keywords for Structured Function Chart
-SFC_KEYWORDS = ["ACTION", "END_ACTION", "INITIAL_STEP", "STEP", "END_STEP", "TRANSITION",
- "FROM", "TO", "END_TRANSITION"]
-
-
-# Keywords for Instruction List
-IL_KEYWORDS = ["TRUE", "FALSE", "LD", "LDN", "ST", "STN", "S", "R", "AND", "ANDN", "OR", "ORN",
- "XOR", "XORN", "NOT", "ADD", "SUB", "MUL", "DIV", "MOD", "GT", "GE", "EQ", "NE",
- "LE", "LT", "JMP", "JMPC", "JMPNC", "CAL", "CALC", "CALNC", "RET", "RETC", "RETNC"]
-
-
-# Keywords for Instruction List and Structured Text
-ST_KEYWORDS = ["TRUE", "FALSE", "IF", "THEN", "ELSIF", "ELSE", "END_IF", "CASE", "OF", "END_CASE", 
- "FOR", "TO", "BY", "DO", "END_FOR", "WHILE", "DO", "END_WHILE", "REPEAT", "UNTIL", 
- "END_REPEAT", "EXIT", "RETURN", "NOT", "MOD", "AND", "XOR", "OR"]
-
- 
-# All the keywords of IEC
-IEC_KEYWORDS = ["E", "TRUE", "FALSE"]
-IEC_KEYWORDS.extend([keyword for keyword in POU_KEYWORDS if keyword not in IEC_KEYWORDS])
-IEC_KEYWORDS.extend([keyword for keyword in TYPE_KEYWORDS if keyword not in IEC_KEYWORDS])
-IEC_KEYWORDS.extend([keyword for keyword in VAR_KEYWORDS if keyword not in IEC_KEYWORDS])
-IEC_KEYWORDS.extend([keyword for keyword in CONFIG_KEYWORDS if keyword not in IEC_KEYWORDS])
-IEC_KEYWORDS.extend([keyword for keyword in SFC_KEYWORDS if keyword not in IEC_KEYWORDS])
-IEC_KEYWORDS.extend([keyword for keyword in IL_KEYWORDS if keyword not in IEC_KEYWORDS])
-IEC_KEYWORDS.extend([keyword for keyword in ST_KEYWORDS if keyword not in IEC_KEYWORDS])
-
+#                        Standard functions list generation
+#-------------------------------------------------------------------------------
 
 
 """
@@ -601,3 +546,62 @@
 
 BlockTypes.extend(std_decl)
 
+
+#-------------------------------------------------------------------------------
+#                            Languages Keywords
+#-------------------------------------------------------------------------------
+
+
+# Keywords for Pou Declaration
+POU_KEYWORDS = ["FUNCTION", "END_FUNCTION", "FUNCTION_BLOCK", "END_FUNCTION_BLOCK",
+ "PROGRAM", "END_PROGRAM", "EN", "ENO", "F_EDGE", "R_EDGE"]
+for category in BlockTypes:
+    for block in category["list"]:
+        if block["name"] not in POU_KEYWORDS:
+            POU_KEYWORDS.append(block["name"])
+
+
+# Keywords for Type Declaration
+TYPE_KEYWORDS = ["TYPE", "END_TYPE", "STRUCT", "END_STRUCT", "ARRAY", "OF", "T",
+ "D", "TIME_OF_DAY", "DATE_AND_TIME"]
+TYPE_KEYWORDS.extend([keyword for keyword in TypeHierarchy.keys() if keyword not in TYPE_KEYWORDS])
+
+
+# Keywords for Variable Declaration
+VAR_KEYWORDS = ["VAR", "VAR_INPUT", "VAR_OUTPUT", "VAR_IN_OUT", "VAR_TEMP", 
+ "VAR_EXTERNAL", "END_VAR", "AT", "CONSTANT", "RETAIN", "NON_RETAIN"]
+
+
+# Keywords for Configuration Declaration
+CONFIG_KEYWORDS = ["CONFIGURATION", "END_CONFIGURATION", "RESOURCE", "ON", "END_RESOURCE",
+ "PROGRAM", "WITH", "READ_ONLY", "READ_WRITE", "TASK", "VAR_ACCESS", "VAR_CONFIG", 
+ "VAR_GLOBAL", "END_VAR"]
+
+
+# Keywords for Structured Function Chart
+SFC_KEYWORDS = ["ACTION", "END_ACTION", "INITIAL_STEP", "STEP", "END_STEP", "TRANSITION",
+ "FROM", "TO", "END_TRANSITION"]
+
+
+# Keywords for Instruction List
+IL_KEYWORDS = ["TRUE", "FALSE", "LD", "LDN", "ST", "STN", "S", "R", "AND", "ANDN", "OR", "ORN",
+ "XOR", "XORN", "NOT", "ADD", "SUB", "MUL", "DIV", "MOD", "GT", "GE", "EQ", "NE",
+ "LE", "LT", "JMP", "JMPC", "JMPNC", "CAL", "CALC", "CALNC", "RET", "RETC", "RETNC"]
+
+
+# Keywords for Structured Text
+ST_KEYWORDS = ["TRUE", "FALSE", "IF", "THEN", "ELSIF", "ELSE", "END_IF", "CASE", "OF", "END_CASE", 
+ "FOR", "TO", "BY", "DO", "END_FOR", "WHILE", "DO", "END_WHILE", "REPEAT", "UNTIL", 
+ "END_REPEAT", "EXIT", "RETURN", "NOT", "MOD", "AND", "XOR", "OR"]
+
+
+# All the keywords of IEC
+IEC_KEYWORDS = ["E", "TRUE", "FALSE"]
+IEC_KEYWORDS.extend([keyword for keyword in POU_KEYWORDS if keyword not in IEC_KEYWORDS])
+IEC_KEYWORDS.extend([keyword for keyword in TYPE_KEYWORDS if keyword not in IEC_KEYWORDS])
+IEC_KEYWORDS.extend([keyword for keyword in VAR_KEYWORDS if keyword not in IEC_KEYWORDS])
+IEC_KEYWORDS.extend([keyword for keyword in CONFIG_KEYWORDS if keyword not in IEC_KEYWORDS])
+IEC_KEYWORDS.extend([keyword for keyword in SFC_KEYWORDS if keyword not in IEC_KEYWORDS])
+IEC_KEYWORDS.extend([keyword for keyword in IL_KEYWORDS if keyword not in IEC_KEYWORDS])
+IEC_KEYWORDS.extend([keyword for keyword in ST_KEYWORDS if keyword not in IEC_KEYWORDS])
+