class_docstr: 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.
class_docstr_tok: ["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","."]
docstr: 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).
docstr_tok: ["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",")","."]
code: def _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).
      """
      # What type of token is it?
      if match.group()[0] in "'\"":
          tag = "terminal"
      elif match.group() in ("->", self.ARROW):
          tag = "arrow"
      else:
          # If it's a nonterminal, then set up new bindings, so we
          # can highlight all instances of that nonterminal when we
          # put the mouse over it.
          tag = "nonterminal_" + match.group()
          if tag not in self._textwidget.tag_names():
              self._init_nonterminal_tag(tag)
  
      start = "%d.%d" % (linenum, match.start())
      end = "%d.%d" % (linenum, match.end())
      self._textwidget.tag_add(tag, start, end)
  
imports: import re
  from tkinter import Button, Canvas, Entry, Frame, IntVar, Label, Scrollbar, Text, Tk, Toplevel
  from nltk.draw.tree import TreeSegmentWidget, tree_to_treesegment
  from nltk.draw.util import CanvasFrame, ColorizedList, ShowText, SymbolWidget, TextWidget
  from nltk.grammar import CFG, Nonterminal, _read_cfg_production, nonterminals
  from nltk.tree import Tree
label_desc: Use image node_id 9 for calling the CFGEditor obj's underlying member method code with example usage: obj._analyze_token(match, linenum) without return types