class_docstr: Formatter allowing Itpl style $foo replacement, for names and attribute
  access only. Standard {foo} replacement also works, and allows full
  evaluation of its arguments.
  
  Examples
  --------
  ::
  
      In [1]: f = DollarFormatter()
      In [2]: f.format('{n//4}', n=8)
      Out[2]: u'2'
  
      In [3]: f.format('23 * 76 is $result', result=23*76)
      Out[3]: u'23 * 76 is 1748'
  
      In [4]: f.format('$a or {b}', a=1, b=2)
      Out[4]: u'1 or 2'
class_docstr_tok: ["Formatter","allowing","Itpl","style","$","foo","replacement",",","for","names","and","attribute","access","only",".","Standard","{","foo","}","replacement","also","works",",","and","allows","full","evaluation","of","its","arguments",".","Examples","--","--","--","--",":",":","In","[","1","]",":","f","=","DollarFormatter","(",")","In","[","2","]",":","f.format","(","'","{","n\/\/4","}","'",",","n=8",")","Out","[","2","]",":","u","'","2'","In","[","3","]",":","f.format","(","'23","*","76","is","$","result","'",",","result=23","*","76",")","Out","[","3","]",":","u'23","*","76","is","1748'","In","[","4","]",":","f.format","(","'","$","a","or","{","b","}","'",",","a=1",",","b=2",")","Out","[","4","]",":","u","'","1","or","2","'"]
code: def parse(self, fmt_string):
      for (
          literal_txt,
          field_name,
          format_spec,
          conversion,
      ) in Formatter.parse(self, fmt_string):
          # Find $foo patterns in the literal text.
          continue_from = 0
          txt = ""
          for m in self._dollar_pattern.finditer(literal_txt):
              new_txt, new_field = m.group(1, 2)
              # $$foo --> $foo
              if new_field.startswith("$"):
                  txt += new_txt + new_field
              else:
                  yield (txt + new_txt, new_field, "", None)
                  txt = ""
              continue_from = m.end()
  
          # Re-yield the {foo} style pattern
          yield (
              txt + literal_txt[continue_from:],
              field_name,
              format_spec,
              conversion,
          )
  
imports: from __future__ import absolute_import
  import os
  import re
  import sys
  import textwrap
  from string import Formatter
  from IPython.testing.skipdoctest import skip_doctest_py3, skip_doctest
  from IPython.utils import py3compat
label_desc: Use image node_id 1 for calling the DollarFormatter obj's underlying member method code with example usage: obj.parse(fmt_string) without return types