Home | Trees | Index | Help |
|
---|
Package nltk_lite :: Package draw :: Module cfg :: Class CFGEditor |
|
object
--+
|
CFGEditor
CFGEditor
places the following restrictions on what
CFG
s can be edited:
Method Summary | |
---|---|
__init__(self,
parent,
cfg,
set_cfg_callback)
| |
Replace -> with arrows, and colorize the entire
buffer. | |
Colorize a given line. | |
Given a line number and a regexp match for a token on that line, colorize the token. | |
_apply(self,
*e)
| |
_cancel(self,
*e)
| |
Check if we've moved to a new line. | |
Remove all tags (except arrow and sel ) from
the given line of the text widget used for editing the productions. | |
_destroy(self,
*e)
| |
_help(self,
*e)
| |
_init_bindings(self)
| |
_init_buttons(self)
| |
_init_nonterminal_tag(self,
tag,
foreground)
| |
_init_prodframe(self)
| |
_init_startframe(self)
| |
Mark the location of an error in a line. | |
_ok(self,
*e)
| |
Parse the current contents of the textwidget buffer, to create a list of productions. | |
Replace any '->' text strings with arrows (char \256,
in symbol font). | |
_reset(self,
*e)
| |
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__str__
|
Class Variable Summary | |
---|---|
str |
ARROW = '\xde'
|
SRE_Pattern |
_ARROW_RE = \s*(->|(Þ))\s*
|
tuple |
_BOLD = ('helvetica', -12, 'bold')
|
SRE_Pattern |
_LHS_RE = (^\s*\w+\s*)(->|(Þ))
|
SRE_Pattern |
_PRODUCTION_RE = (^\s*\w+\s*)(->|(Þ))\s*((\w+|'[\w ]*'|"...
|
SRE_Pattern |
_TOKEN_RE = \w+|->|'[\w ]+'|"[\w ]+"|(Þ)
|
Method Details |
---|
_analyze(self, *e)Replace-> with arrows, and colorize the entire
buffer.
|
_analyze_line(self, linenum)Colorize a given line. |
_analyze_token(self, match, linenum)Given a line number and a regexp match for a token on that line, colorize the token. Note that the regexp match gives us the token's text, start index (on the line), and end index (on the line). |
_check_analyze(self, *e)Check if we've moved to a new line. If we have, then remove all colorization from the line we moved to, and re-colorize the line that we moved from. |
_clear_tags(self, linenum)Remove all tags (exceptarrow and sel )
from the given line of the text widget used for editing the
productions.
|
_mark_error(self, linenum, line)Mark the location of an error in a line. |
_parse_productions(self)Parse the current contents of the textwidget buffer, to create a list of productions. |
_replace_arrows(self, *e)Replace any'->' text strings with arrows (char
\256, in symbol font). This searches the whole buffer, but is fast
enough to be done anytime they press '>'.
|
Class Variable Details |
---|
ARROW
|
_ARROW_RE
|
_BOLD
|
_LHS_RE
|
_PRODUCTION_RE
|
_TOKEN_RE
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Tue Sep 5 09:37:21 2006 | http://epydoc.sf.net |