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: Colorize a given line.
docstr_tok: ["Colorize","a","given","line","."]
code: def _analyze_line(self, linenum):
      """
      Colorize a given line.
      """
      # Get rid of any tags that were previously on the line.
      self._clear_tags(linenum)
  
      # Get the line line's text string.
      line = self._textwidget.get(
          repr(linenum) + ".0", repr(linenum) + ".end"
      )
  
      # If it's a valid production, then colorize each token.
      if CFGEditor._PRODUCTION_RE.match(line):
          # It's valid; Use _TOKEN_RE to tokenize the production,
          # and call analyze_token on each token.
          def analyze_token(match, self=self, linenum=linenum):
              self._analyze_token(match, linenum)
              return ""
  
          CFGEditor._TOKEN_RE.sub(analyze_token, line)
      elif line.strip() != "":
          # It's invalid; show the user where the error is.
          self._mark_error(linenum, line)
  
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 11 for calling the CFGEditor obj's underlying member method code with example usage: obj._analyze_line(linenum) and returns: str