Alphanumeric symbol (pseudo-)parser for mathematical expressions.
An AST is not properly implemented -- rather, we tokenize, identify
free symbols, and apply a small number of syntactic rule checks. The
target language parser is relied upon for full syntax checking.
|
|
__init__(self,
specStr,
includeProtected=True,
treatMultiRefs=False,
ignoreTokens=[],
preserveSpace=False)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
source code
|
|
|
|
isCompound(self,
ops=['+', '-', '*', '/'])
Function to verify whether an expression is 'compound', in the sense
that it has an operator at the root of its syntax parse tree (i.e. |
source code
|
|
|
|
| __call__(self,
specialtoks=None,
symbolMap=None,
includeProtected=True) |
source code
|
|
|
|
find(self,
token)
Find all occurrences of the given token in the expression, returning
a list of indices (empty if not present). |
source code
|
|
|
|
| parse(self,
specialtoks,
symbolMap=None,
includeProtected=True,
reset=False) |
source code
|
|
|
Inherited from object:
__delattr__,
__getattribute__,
__hash__,
__new__,
__reduce__,
__reduce_ex__,
__repr__,
__setattr__,
__str__
|