return t
def t_DOUBLENUM(t):
- r'\d+\.\d*'
+ r'(\d+\.\d*|\.\d+)'
if t.value[-1] == '.':
t.value += "0"
+ if t.value[0] == '.':
+ t.value = "0" + t.value
return t
def t_BOOLNUM(t):
if statement[0] == 'end_function' and i < len(deck)-1 and deck[i+1][3][0] != 'extern':
deck.insert(i+1, (file, line, None, ('entry', 'main.', ())))
hasmain = True
+ # Sanity check -- all labels in through statements must hit targwts
+ labels = filter(lambda x: x, map(lambda x: x[2], deck))
+ for (file, line, label, statement) in deck:
+ if statement[0] == 'for':
+ target = statement[1]
+ if not target in labels:
+ croak((file,line,label,statement),"no such label as "+`target`)
+ sys.exit(1)
+ # On to actual analysis
try:
# Mine the code for compile-time directives
for (file, line, label, statement) in deck: