Exemple #1
0
 def t_NUM(t):
     r"\d+(l|L)?"
     if t.value.lower().endswith("l"):
         t.value = syntax.ENum(int(t.value[:-1])).with_type(syntax.TLong())
     else:
         t.value = syntax.ENum(int(t.value)).with_type(syntax.TInt())
     return t
Exemple #2
0
 def t_FLOAT(t):
     r"(\d+(\.\d+)?[fF])"
     # ".1" not doable since it would create ambiguity w/ foo.1 syntax.
     t.value = syntax.ENum(float(t.value.rstrip("fF"))).with_type(
         syntax.TFloat())
     return t