Commit d8f43f0d authored by Phil Jones's avatar Phil Jones

Trial improved expression parsing.

parent e0b5bc04
......@@ -407,8 +407,6 @@ class _KatInstructionLEX(Lexer):
FUNCTION_NAME = "cos|sin"
PARAMETER = "&[a-zA-Z_][a-zA-Z0-9_.]*"
PLUS = TOKEN_MAP["PLUS"]
MINUS = TOKEN_MAP["MINUS"]
TIMES = TOKEN_MAP["TIMES"]
DIVIDE = TOKEN_MAP["DIVIDE"]
COMMA = TOKEN_MAP["COMMA"]
......@@ -426,7 +424,10 @@ class _KatInstructionLEX(Lexer):
return t
# Number token including scientific notation, float, or +/- inf.
@_(r"[+-]?inf", r"[+-]?(\d+\.\d*|\d*\.\d+|\d+)([eE]-?\d*\.?\d*)?j?([pnumkMGT])?")
@_(
r"(\B[+-])?inf",
r"(\B[+-])?(\d+\.\d*|\d*\.\d+|\d+)([eE]-?\d*\.?\d*)?j?([pnumkMGT])?",
)
def NUMBER(self, t):
if re.match(".*[pnumkMGT]$", t.value):
t.value = t.value.replace("p", "e-12")
......@@ -450,6 +451,14 @@ class _KatInstructionLEX(Lexer):
t.value = int(t.value)
return t
@_(r"-")
def MINUS(self, t):
return t
@_(r"\+")
def PLUS(self, t):
return t
@_(r"[a-zA-Z_][a-zA-Z0-9_.]*\*?", "inf")
def STRING(self, t):
if t.value == "inf":
......
This diff was suppressed by a .gitattributes entry.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment