plcopen/structures.py
changeset 9 b29105e29081
parent 5 f8652b073e84
child 14 cd0133ed377b
--- a/plcopen/structures.py	Wed Apr 11 17:26:07 2007 +0200
+++ b/plcopen/structures.py	Thu Apr 12 17:26:07 2007 +0200
@@ -23,6 +23,8 @@
 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
+LANGUAGES = ["IL","ST","FBD","LD","SFC"]
+
 #-------------------------------------------------------------------------------
 #                        Function Block Types definitions
 #-------------------------------------------------------------------------------
@@ -377,6 +379,24 @@
 
 
 #-------------------------------------------------------------------------------
+#                             Test identifier
+#-------------------------------------------------------------------------------
+
+
+
+# Test if identifier is valid
+def TestIdentifier(identifier):
+     if identifier[0].isdigit():
+        return False
+     words = identifier.split('_')
+     for i, word in enumerate(words):
+         if len(word) == 0 and i != 0:
+             return False
+         if len(word) != 0 and not word.isalnum():
+             return False
+     return True
+
+#-------------------------------------------------------------------------------
 #                            Languages Keywords
 #-------------------------------------------------------------------------------