class documentation

A dialog window for creating and editing context free grammars. CFGEditor imposes the following restrictions:

  • All nonterminals must be strings consisting of word characters.
  • All terminals must be strings consisting of word characters and space characters.
Method __init__ Undocumented
Constant ARROW Undocumented
Method _analyze Replace -> with arrows, and colorize the entire buffer.
Method _analyze_line Colorize a given line.
Method _analyze_token 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).
Method _apply Undocumented
Method _cancel Undocumented
Method _check_analyze 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.
Method _clear_tags Remove all tags (except arrow and sel) from the given line of the text widget used for editing the productions.
Method _destroy Undocumented
Method _help Undocumented
Method _init_bindings Undocumented
Method _init_buttons Undocumented
Method _init_nonterminal_tag Undocumented
Method _init_prodframe Undocumented
Method _init_startframe Undocumented
Method _mark_error Mark the location of an error in a line.
Method _ok Undocumented
Method _parse_productions Parse the current contents of the textwidget buffer, to create a list of productions.
Method _replace_arrows 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 '>'.
Method _reset Undocumented
Constant _ARROW_RE Undocumented
Constant _BOLD Undocumented
Constant _LHS_RE Undocumented
Constant _PRODUCTION_RE Undocumented
Constant _TOKEN_RE Undocumented
Instance Variable _buttonframe Undocumented
Instance Variable _cfg Undocumented
Instance Variable _highlight_matching_nonterminals Undocumented
Instance Variable _linenum Undocumented
Instance Variable _parent Undocumented
Instance Variable _prodframe Undocumented
Instance Variable _set_cfg_callback Undocumented
Instance Variable _start Undocumented
Instance Variable _startframe Undocumented
Instance Variable _textscroll Undocumented
Instance Variable _textwidget Undocumented
Instance Variable _top Undocumented
def __init__(self, parent, cfg=None, set_cfg_callback=None): (source)

Undocumented

Undocumented

Value
SymbolWidget.SYMBOLS['rightarrow']
def _analyze(self, *e): (source)

Replace -> with arrows, and colorize the entire buffer.

def _analyze_line(self, linenum): (source)

Colorize a given line.

def _analyze_token(self, match, linenum): (source)

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).

def _apply(self, *e): (source)

Undocumented

def _cancel(self, *e): (source)

Undocumented

def _check_analyze(self, *e): (source)

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.

def _clear_tags(self, linenum): (source)

Remove all tags (except arrow and sel) from the given line of the text widget used for editing the productions.

def _destroy(self, *e): (source)

Undocumented

def _help(self, *e): (source)

Undocumented

def _init_bindings(self): (source)

Undocumented

def _init_buttons(self): (source)

Undocumented

def _init_nonterminal_tag(self, tag, foreground='blue'): (source)

Undocumented

def _init_prodframe(self): (source)

Undocumented

def _init_startframe(self): (source)

Undocumented

def _mark_error(self, linenum, line): (source)

Mark the location of an error in a line.

def _ok(self, *e): (source)

Undocumented

def _parse_productions(self): (source)

Parse the current contents of the textwidget buffer, to create a list of productions.

def _replace_arrows(self, *e): (source)

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 '>'.

def _reset(self, *e): (source)

Undocumented

_ARROW_RE = (source)

Undocumented

Value
re.compile(('\\s*(->|(' + ARROW + '))\\s*'))
_BOLD: tuple = (source)

Undocumented

Value
('helvetica', -12, 'bold')

Undocumented

Value
re.compile(('(^\\s*\\w+\\s*)(->|(' + ARROW + '))'))
_PRODUCTION_RE = (source)

Undocumented

Value
re.compile(('(^\\s*\\w+\\s*)' + '(->|(' + ARROW + '))\\s*' + '((\\w+|\'[\\w ]*\'|
\\"[\\w ]*\\"|\\|)\\s*)*$'))
_TOKEN_RE = (source)

Undocumented

Value
re.compile(('\\w+|->|\'[\\w ]+\'|"[\\w ]+"|(' + ARROW + ')'))
_buttonframe = (source)

Undocumented

Undocumented

_highlight_matching_nonterminals: int = (source)

Undocumented

_linenum = (source)

Undocumented

Undocumented

_prodframe = (source)

Undocumented

_set_cfg_callback = (source)

Undocumented

Undocumented

_startframe = (source)

Undocumented

_textscroll = (source)

Undocumented

_textwidget = (source)

Undocumented

Undocumented