224 (r'(#\{?)(' + identifier + r')(\}?)(\s?\()', |
224 (r'(#\{?)(' + identifier + r')(\}?)(\s?\()', |
225 bygroups(Comment.Preproc, Name.Function, Comment.Preproc, Punctuation), |
225 bygroups(Comment.Preproc, Name.Function, Comment.Preproc, Punctuation), |
226 'directiveparams'), |
226 'directiveparams'), |
227 (r'(#\{?)(' + identifier + r')(\}|\b)', |
227 (r'(#\{?)(' + identifier + r')(\}|\b)', |
228 bygroups(Comment.Preproc, Name.Function, Comment.Preproc)), |
228 bygroups(Comment.Preproc, Name.Function, Comment.Preproc)), |
229 (r'\$\{?', Punctuation, 'variable') |
229 (r'\$!?\{?', Punctuation, 'variable') |
230 ], |
230 ], |
231 'variable': [ |
231 'variable': [ |
232 (identifier, Name.Variable), |
232 (identifier, Name.Variable), |
233 (r'\(', Punctuation, 'funcparams'), |
233 (r'\(', Punctuation, 'funcparams'), |
234 (r'(\.)(' + identifier + r')', |
234 (r'(\.)(' + identifier + r')', |
247 (r'\.\.', Operator), |
247 (r'\.\.', Operator), |
248 include('funcparams'), |
248 include('funcparams'), |
249 (r'\]', Operator, '#pop') |
249 (r'\]', Operator, '#pop') |
250 ], |
250 ], |
251 'funcparams': [ |
251 'funcparams': [ |
252 (r'\$\{?', Punctuation, 'variable'), |
252 (r'\$!?\{?', Punctuation, 'variable'), |
253 (r'\s+', Text), |
253 (r'\s+', Text), |
254 (r'[,:]', Punctuation), |
254 (r'[,:]', Punctuation), |
255 (r'"(\\\\|\\"|[^"])*"', String.Double), |
255 (r'"(\\\\|\\"|[^"])*"', String.Double), |
256 (r"'(\\\\|\\'|[^'])*'", String.Single), |
256 (r"'(\\\\|\\'|[^'])*'", String.Single), |
257 (r"0[xX][0-9a-fA-F]+[Ll]?", Number), |
257 (r"0[xX][0-9a-fA-F]+[Ll]?", Number), |
373 (r'(loop|block|super|forloop)\b', Name.Builtin), |
373 (r'(loop|block|super|forloop)\b', Name.Builtin), |
374 (r'[a-zA-Z_][\w-]*', Name.Variable), |
374 (r'[a-zA-Z_][\w-]*', Name.Variable), |
375 (r'\.\w+', Name.Variable), |
375 (r'\.\w+', Name.Variable), |
376 (r':?"(\\\\|\\"|[^"])*"', String.Double), |
376 (r':?"(\\\\|\\"|[^"])*"', String.Double), |
377 (r":?'(\\\\|\\'|[^'])*'", String.Single), |
377 (r":?'(\\\\|\\'|[^'])*'", String.Single), |
378 (r'([{}()\[\]+\-*/,:~]|[><=]=?)', Operator), |
378 (r'([{}()\[\]+\-*/%,:~]|[><=]=?|!=)', Operator), |
379 (r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|" |
379 (r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|" |
380 r"0[xX][0-9a-fA-F]+[Ll]?", Number), |
380 r"0[xX][0-9a-fA-F]+[Ll]?", Number), |
381 ], |
381 ], |
382 'var': [ |
382 'var': [ |
383 (r'\s+', Text), |
383 (r'\s+', Text), |
1800 |
1800 |
1801 tokens = { |
1801 tokens = { |
1802 'root': [ |
1802 'root': [ |
1803 (r'[^{]+', Other), |
1803 (r'[^{]+', Other), |
1804 |
1804 |
|
1805 # Comment start {{! }} or {{!-- |
1805 (r'\{\{!.*\}\}', Comment), |
1806 (r'\{\{!.*\}\}', Comment), |
1806 |
1807 |
|
1808 # HTML Escaping open {{{expression |
1807 (r'(\{\{\{)(\s*)', bygroups(Comment.Special, Text), 'tag'), |
1809 (r'(\{\{\{)(\s*)', bygroups(Comment.Special, Text), 'tag'), |
|
1810 |
|
1811 # {{blockOpen {{#blockOpen {{/blockClose with optional tilde ~ |
|
1812 (r'(\{\{)([#~/]+)([^\s}]*)', |
|
1813 bygroups(Comment.Preproc, Number.Attribute, Number.Attribute), 'tag'), |
1808 (r'(\{\{)(\s*)', bygroups(Comment.Preproc, Text), 'tag'), |
1814 (r'(\{\{)(\s*)', bygroups(Comment.Preproc, Text), 'tag'), |
1809 ], |
1815 ], |
1810 |
1816 |
1811 'tag': [ |
1817 'tag': [ |
1812 (r'\s+', Text), |
1818 (r'\s+', Text), |
|
1819 # HTML Escaping close }}} |
1813 (r'\}\}\}', Comment.Special, '#pop'), |
1820 (r'\}\}\}', Comment.Special, '#pop'), |
1814 (r'\}\}', Comment.Preproc, '#pop'), |
1821 # blockClose}}, includes optional tilde ~ |
1815 |
1822 (r'(~?)(\}\})', bygroups(Number, Comment.Preproc), '#pop'), |
1816 # Handlebars |
|
1817 (r'([#/]*)(each|if|unless|else|with|log|in(line)?)', bygroups(Keyword, |
|
1818 Keyword)), |
|
1819 (r'#\*inline', Keyword), |
|
1820 |
|
1821 # General {{#block}} |
|
1822 (r'([#/])([\w-]+)', bygroups(Name.Function, Name.Function)), |
|
1823 |
1823 |
1824 # {{opt=something}} |
1824 # {{opt=something}} |
1825 (r'([\w-]+)(=)', bygroups(Name.Attribute, Operator)), |
1825 (r'([^\s}]+)(=)', bygroups(Name.Attribute, Operator)), |
1826 |
1826 |
1827 # Partials {{> ...}} |
1827 # Partials {{> ...}} |
1828 (r'(>)(\s*)(@partial-block)', bygroups(Keyword, Text, Keyword)), |
1828 (r'(>)(\s*)(@partial-block)', bygroups(Keyword, Text, Keyword)), |
1829 (r'(#?>)(\s*)([\w-]+)', bygroups(Keyword, Text, Name.Variable)), |
1829 (r'(#?>)(\s*)([\w-]+)', bygroups(Keyword, Text, Name.Variable)), |
1830 (r'(>)(\s*)(\()', bygroups(Keyword, Text, Punctuation), |
1830 (r'(>)(\s*)(\()', bygroups(Keyword, Text, Punctuation), |
1843 (r'[\w-]+', Name.Function), |
1843 (r'[\w-]+', Name.Function), |
1844 |
1844 |
1845 include('generic'), |
1845 include('generic'), |
1846 ], |
1846 ], |
1847 'variable': [ |
1847 'variable': [ |
1848 (r'[a-zA-Z][\w-]*', Name.Variable), |
1848 (r'[()/@a-zA-Z][\w-]*', Name.Variable), |
1849 (r'\.[\w-]+', Name.Variable), |
1849 (r'\.[\w-]+', Name.Variable), |
1850 (r'(this\/|\.\/|(\.\.\/)+)[\w-]+', Name.Variable), |
1850 (r'(this\/|\.\/|(\.\.\/)+)[\w-]+', Name.Variable), |
1851 ], |
1851 ], |
1852 'generic': [ |
1852 'generic': [ |
1853 include('variable'), |
1853 include('variable'), |