Home | Trees | Index | Help |
|
---|
Package lemon :: Package external :: Package gadfly :: Module kjParser :: Class Grammar |
|
CGrammar
the grammar class: a grammar consists of - a LexDict lexical dictionary; - a deterministic FSMachine; - a Rulelist and optionally a dictionary that maps Rulenames to Rulelist indices (used for dumping and externally)
Method Summary | |
---|---|
__init__(self,
LexD,
DFA,
RuleL,
RuleNameDict)
| |
this method associates rules to names using a RuleNameDict dictionary which maps names to rule indices. | |
bind a terminal to a regular expression and interp function... | |
if the Name dictionary has been initialized... | |
this may be silly, but to save some space in construction a token dictionary may be used that facilitates sharing of token representations. | |
parse a string using the grammar, return result and context... | |
parse a string using the grammar, but only return... | |
look for default bindings... | |
setting case sensitivity: must happen before keyword installation in LexD. |
Method Details |
---|
AddNameDict(self, RuleNameDict)this method associates rules to names using a RuleNameDict dictionary which maps names to rule indices. after invocation self.RuleNameToIndex[ name ] gives the index in self.RuleL for the rule associated with name, and self.RuleL[index].Name gives the name associated with the rule self.RuleL[index] |
Addterm(self, termname, regexpstr, funct)bind a terminal to a regular expression and interp function in the lexical dictionary (convenience) |
Bind(self, Rulename, NewFunction)if the Name dictionary has been initialized this method will (re)bind a reduction function to a rule associated with Rulename |
CleanUp(self)this may be silly, but to save some space in construction a token dictionary may be used that facilitates sharing of token representations. This method either initializes the dictionary or disposes of it if it exists |
DoParse(self, String, Context=None, DoReductions=1)parse a string using the grammar, return result and context |
DoParse1(self, String, Context=None, DoReductions=1)parse a string using the grammar, but only return the result of the last reduction, without the context |
PrintDefaults(self)look for default bindings |
SetCaseSensitivity(self, Boolean)setting case sensitivity: must happen before keyword installation in LexD. |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.0 on Mon Nov 10 15:07:55 2003 | http://epydoc.sf.net |