Cheetah.Parser module — Cheetah3 - The Python-Powered Template Engine

# Cheetah.Parser module

Parser classes for Cheetah’s Compiler

Classes:

  ParseError( Exception ) _LowLevelParser( Cheetah.SourceReader.SourceReader ), basically a lexer _HighLevelParser( _LowLevelParser ) Parser === _HighLevelParser (an alias)

class Cheetah.Parser.ArgList

  Bases: `object`

  Used by _LowLevelParser.getArgList()

  add_argument(name)
  add_default(token)
  merge()
  next()

class Cheetah.Parser.CheetahVariable(nameChunks, useNameMapper=True, cacheToken=None, rawSource=None)

  Bases: `object`

exception Cheetah.Parser.ForbiddenDirective(stream, msg='Invalid Syntax', extMsg='', lineno=None, col=None)

  Bases: `ForbiddenSyntax`

exception Cheetah.Parser.ForbiddenExpression(stream, msg='Invalid Syntax', extMsg='', lineno=None, col=None)

  Bases: `ForbiddenSyntax`

exception Cheetah.Parser.ForbiddenSyntax(stream, msg='Invalid Syntax', extMsg='', lineno=None, col=None)

  Bases: `ParseError`

exception Cheetah.Parser.ParseError(stream, msg='Invalid Syntax', extMsg='', lineno=None, col=None)

  Bases: `ValueError`

  report()

Cheetah.Parser.Parser

  alias of `_HighLevelParser`

class Cheetah.Parser.Placeholder(nameChunks, useNameMapper=True, cacheToken=None, rawSource=None)

  Bases: `CheetahVariable`

Cheetah.Parser.any(*choices)

Cheetah.Parser.cachedRegex(pattern)

Cheetah.Parser.escapeRegexChars(txt, escapeRE=re.compile('([\\$\\^\\*\\+\\.\\?\\{\\}\\[\\]\\(\\)\\|\\\\])'))

  Return a txt with all special regular expressions chars escaped.

Cheetah.Parser.group(*choices)

Cheetah.Parser.makeTripleQuoteRe(start, end)

Cheetah.Parser.maybe(*choices)

Cheetah.Parser.namedGroup(name, *choices)

Cheetah.Parser.nongroup(*choices)