我是pyparsing的新手,我有以下内容:
operator = Word("+-*/", max=1)
comparator = Word("><=!", max=1)
condition = CaselessKeyword("IF")
comma = Literal(",")
open = Literal("(")
close = Literal(")")
number = Word(nums)
operation = number + op + number
exp = operation + ZeroOrMore(op + operation)
cond = condition + open + operation + comparator + operation + comma + number + comma + number + close
我正在使用在Linux Mint Tessa系统上运行的Python 3.6.7。如何告诉pyparsing我想解析number
规则中的exp
或cond
?