plcopen/structures.py
changeset 9 b29105e29081
parent 5 f8652b073e84
child 14 cd0133ed377b
equal deleted inserted replaced
8:7ceec5c40d77 9:b29105e29081
    20 #
    20 #
    21 #You should have received a copy of the GNU General Public
    21 #You should have received a copy of the GNU General Public
    22 #License along with this library; if not, write to the Free Software
    22 #License along with this library; if not, write to the Free Software
    23 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    23 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    24 
    24 
       
    25 
       
    26 LANGUAGES = ["IL","ST","FBD","LD","SFC"]
    25 
    27 
    26 #-------------------------------------------------------------------------------
    28 #-------------------------------------------------------------------------------
    27 #                        Function Block Types definitions
    29 #                        Function Block Types definitions
    28 #-------------------------------------------------------------------------------
    30 #-------------------------------------------------------------------------------
    29 
    31 
   375         test = TypeHierarchy[test]
   377         test = TypeHierarchy[test]
   376     return False
   378     return False
   377 
   379 
   378 
   380 
   379 #-------------------------------------------------------------------------------
   381 #-------------------------------------------------------------------------------
       
   382 #                             Test identifier
       
   383 #-------------------------------------------------------------------------------
       
   384 
       
   385 
       
   386 
       
   387 # Test if identifier is valid
       
   388 def TestIdentifier(identifier):
       
   389      if identifier[0].isdigit():
       
   390         return False
       
   391      words = identifier.split('_')
       
   392      for i, word in enumerate(words):
       
   393          if len(word) == 0 and i != 0:
       
   394              return False
       
   395          if len(word) != 0 and not word.isalnum():
       
   396              return False
       
   397      return True
       
   398 
       
   399 #-------------------------------------------------------------------------------
   380 #                            Languages Keywords
   400 #                            Languages Keywords
   381 #-------------------------------------------------------------------------------
   401 #-------------------------------------------------------------------------------
   382 
   402 
   383 
   403 
   384 
   404