9q fix#17 ply name and hex ambiguity

This commit is contained in:
shrlnm 2019-12-22 09:43:40 +03:00
parent 4ec29342b3
commit 3bbe509d54
2 changed files with 18 additions and 2 deletions

View File

@ -865,7 +865,19 @@ class DDTScreen (tk.Frame):
r = str (self.decu.requests[self.decu.req4data[closest]]) r = str (self.decu.requests[self.decu.req4data[closest]])
xText = d + '\n' + '*' * 50 + '\n' + r + '\n' + '*' * 50 + '\n' + p try:
xText = d + '\n' + '*' * 50 + '\n'
except:
pass
try:
xText += r + '\n' + '*' * 50 + '\n'
except:
pass
try:
xText += p
except:
pass
dialog = InfoDialog (self.root, xText) dialog = InfoDialog (self.root, xText)
self.root.wait_window (dialog.top) self.root.wait_window (dialog.top)

View File

@ -8,6 +8,7 @@ import ply.lex as lex
import ply.yacc as yacc import ply.yacc as yacc
import os import os
import time import time
import re
class Parser: class Parser:
@ -345,7 +346,10 @@ class Calc(Parser):
p[0] = self.names[p[1]] p[0] = self.names[p[1]]
except LookupError: except LookupError:
print "PLY:Parser:Undefined name '%s'" % p[1] print "PLY:Parser:Undefined name '%s'" % p[1]
p[0] = 0 if re.match('^[a-fA-F0-9]*$',p[1]) != None:
p[0] = p[1]
else:
p[0] = 0
p_expression_name.func_doc='expression : NAME' p_expression_name.func_doc='expression : NAME'
def p_error(self, p): def p_error(self, p):