3
U'ícêt ã @ sü U d Z ddlZddlZddlmZ ddlmZ ddlm Z ddl
mZ ddl
mZ dd lmZ ejrxddlZdd
lmZ edZejejdf ejd
ZejdZejdejZejdejejB Z ejdejejB Z!e dZ"e dZ#e dZ$e dZ%e dZ&e dZ'e dZ(e dZ)e dZ*e dZ+e dZ,e dZ-e dZ.e dZ/e d Z0e d!Z1e d"Z2e d#Z3e d$Z4e d%Z5e d&Z6e d'Z7e d(Z8e d)Z9e d*Z:e d+Z;e d,Z<e d-Z=e d.Z>e d/Z?e d0Z@e d1ZAe d2ZBe d3ZCe d4ZDe d5ZEe d6ZFe d7ZGe d8ZHe d9ZIe d:ZJe d;ZKe d<ZLe d=ZMe d>ZNe d?ZOe d@ZPe dAZQe dBZRe"e:e&e)e2e1e5e;e-e7e.e8e,e6e(e3e*e+e/e0e#e'e$e4e%e9dCZSdDdE eSjT D ZUeVeSeVeUksÈtWdFejdGdHjXdIdJ eYeSdKdL dMD dNZZe[eHeJeIe<eMeNeOgZ\e[e<ePeJeOgZ]e^e^dOdPdQZ_dRe^dSdTdUZ`e^e^dVdWdXZae^ebdYdZd[Zcd\ejdeje^e^f d]d^d_ZeG d`da daZfG dbdR dRejgZhG dcdd ddZiG dedf dfZjd\dd]dgdhZkG didj djelZmG dkdl dlejgZnG dmd dZodS )nzúImplements a Jinja / Python combination lexer. The ``Lexer`` class
is used to do some preprocessing. It filters out invalid operators like
the bitshift operators we don't allow in templates. It separates
template code and python code in expressions.
é N)Úliteral_eval)Údeque)Úinterné )Úpattern)ÚTemplateSyntaxError)ÚLRUCache)ÚEnvironmenté2 ÚLexerz\s+z(\r\n|\r|\n)z7('([^'\\]*(?:\\.[^'\\]*)*)'|"([^"\\]*(?:\\.[^"\\]*)*)")z¿
(
0b(_?[0-1])+ # binary
|
0o(_?[0-7])+ # octal
|
0x(_?[\da-f])+ # hex
|
[1-9](_?\d)* # decimal
|
0(_?0)* # decimal zero
)
zü
(?<!\.) # doesn't start with a .
(\d+_)*\d+ # digits, possibly _ separated
(
(\.(\d+_)*\d+)? # optional fractional part
e[+\-]?(\d+_)*\d+ # exponent part
|
\.(\d+_)*\d+ # required fractional part
)
ÚaddZassignZcolonÚcommaÚdivÚdotÚeqÚfloordivÚgtZgteqZlbraceZlbracketZlparenÚltZlteqÚmodÚmulÚneÚpipeÚpowZrbraceZrbracketZrparenZ semicolonÚsubÚtildeÚ
whitespaceÚfloatÚintegerÚnameÚstringÚoperatorZblock_beginZ block_endZvariable_beginZvariable_endZ raw_beginZraw_endZ
comment_beginZcomment_endÚcommentZlinestatement_beginZlinestatement_endZlinecomment_beginZlinecomment_endZlinecommentÚdataÚinitialÚeof)ú+ú-ú/z//Ú*ú%z**ú~ú[ú]ú(ú)Ú{Ú}z==z!=ú>z>=ú<z<=ú=Ú.ú:ú|ú,ú;c C s i | ]\}}||qS © r9 )Ú.0ÚkÚvr9 r9 ú./tmp/pip-build-gk9425m9/Jinja2/jinja2/lexer.pyú
<dictcomp> s r>