@@ -65,6 +65,16 @@ def convertNumbers(s, l, toks):
65
65
return float (n )
66
66
67
67
68
+ def convertString2 (s , s2 ):
69
+ tmp = s2 [0 ].replace ("\\ \" " , "\" " )
70
+ tmp = tmp .replace ("\" " , "\\ \" " )
71
+ tmp = tmp .replace ("\' " , "\\ '" )
72
+ tmp = tmp .replace ("\f " , "\\ f" )
73
+ tmp = tmp .replace ("\n " , "\\ n" )
74
+ tmp = tmp .replace ("\r " , "\\ r" )
75
+ tmp = tmp .replace ("\t " , "\\ t" )
76
+ return "'" + tmp + "'" ;
77
+
68
78
def convertString (s , s2 ):
69
79
return s2 [0 ].replace ("\\ \" " , '"' )
70
80
@@ -90,7 +100,8 @@ def convertTuple(t):
90
100
Optional ('.' + Word (nums )) +
91
101
Optional (Word ('eE' , exact = 1 ) + Word (nums + '+-' , nums )))
92
102
93
- ident = Word (alphas + "_" , alphanums + "_" ) | Combine ("'" + Word (alphanums + "!#$%&()*+,-./:;<>=?@[]^{}|~ " ) + "'" )
103
+ #ident = Word(alphas + "_", alphanums + "_") | Combine("'" + Word(alphanums + "!#$%&()*+,-./:;<>=?@[]^{}|~ ") + "'")
104
+ ident = Word (alphas + "_" , alphanums + "_" ) | QuotedString (quoteChar = '\' ' , escChar = '\\ ' ).setParseAction (convertString2 )
94
105
fqident = Forward ()
95
106
fqident << ((ident + "." + fqident ) | ident )
96
107
omcValues = delimitedList (omcValue )
0 commit comments