Package PyDSTool :: Module parseUtils :: Class parserObject
[hide private]
[frames] | no frames]

Class parserObject

source code

object --+
         |
        parserObject

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.

Instance Methods [hide private]
 
__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__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, specStr, includeProtected=True, treatMultiRefs=False, ignoreTokens=[], preserveSpace=False)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

isCompound(self, ops=['+', '-', '*', '/'])

source code 

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. not inside braces).