PLCGenerator.py
changeset 893 f528c421637b
parent 889 ac18acb6917f
child 1032 c4989e53f9c3
equal deleted inserted replaced
892:771581a6b0be 893:f528c421637b
    72     bx, by = int(b.getx()), int(b.gety())
    72     bx, by = int(b.getx()), int(b.gety())
    73     if abs(ay - by) < 10:
    73     if abs(ay - by) < 10:
    74         return cmp(ax, bx)
    74         return cmp(ax, bx)
    75     else:
    75     else:
    76         return cmp(ay, by)
    76         return cmp(ay, by)
    77 
       
    78 REAL_MODEL = re.compile("[0-9]+\.[0-9]+$")
       
    79 INTEGER_MODEL = re.compile("[0-9]+$")
       
    80 
    77 
    81 #-------------------------------------------------------------------------------
    78 #-------------------------------------------------------------------------------
    82 #                  Specific exception for PLC generating errors
    79 #                  Specific exception for PLC generating errors
    83 #-------------------------------------------------------------------------------
    80 #-------------------------------------------------------------------------------
    84 
    81 
   683                             var_type = returntype_content["name"]
   680                             var_type = returntype_content["name"]
   684                     elif var_type is None:
   681                     elif var_type is None:
   685                         parts = expression.split("#")
   682                         parts = expression.split("#")
   686                         if len(parts) > 1:
   683                         if len(parts) > 1:
   687                             var_type = parts[0]
   684                             var_type = parts[0]
   688                         elif REAL_MODEL.match(expression):
       
   689                             var_type = "ANY_REAL"
       
   690                         elif INTEGER_MODEL.match(expression):
       
   691                             var_type = "ANY_NUM"
       
   692                         elif expression.startswith("'"):
   685                         elif expression.startswith("'"):
   693                             var_type = "STRING"
   686                             var_type = "STRING"
   694                         elif expression.startswith('"'):
   687                         elif expression.startswith('"'):
   695                             var_type = "WSTRING"
   688                             var_type = "WSTRING"
   696                     if var_type is not None:
   689                     if var_type is not None: