def interpolate_text(self, text, line=0):
    'Examines text looking for any variable references embedded\n        like $this or like ${ this }.\n        '
    tokens = []
    for match in QUOTED_STRING.finditer(text):
        pre = match.group(1)
        var = (match.group(3) or match.group(4))
        dir = match.group(2)
        if pre:
            line += pre.count('\n')
            tokens.extend(('TEXT', pre.replace('\\$', '$')))
        if var:
            line += dir.count('\n')
            tokens.append([dir, line, self.tokenise_directive(var)])
        elif dir:
            line += dir.count('\n')
            tokens.extend(('TEXT', dir))
    return tokens
Examines text looking for any variable references embedded
like $this or like ${ this }.
def interpolate_text(self, text, line=0):
    'Examines text looking for any variable references embedded\n        like $this or like ${ this }.\n        '
    tokens = []
    for match in QUOTED_STRING.finditer(text):
        pre = match.group(1)
        var = (match.group(3) or match.group(4))
        dir = match.group(2)
        if pre:
            line += pre.count('\n')
            tokens.extend(('TEXT', pre.replace('\\$', '$')))
        if var:
            line += dir.count('\n')
            tokens.append([dir, line, self.tokenise_directive(var)])
        elif dir:
            line += dir.count('\n')
            tokens.extend(('TEXT', dir))
    return tokens