webmisc.py 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991
  1. """
  2. pygments.lexers.webmisc
  3. ~~~~~~~~~~~~~~~~~~~~~~~
  4. Lexers for misc. web stuff.
  5. :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
  6. :license: BSD, see LICENSE for details.
  7. """
  8. import re
  9. from pygments.lexer import RegexLexer, ExtendedRegexLexer, include, bygroups, \
  10. default, using
  11. from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
  12. Number, Punctuation, Literal
  13. from pygments.lexers.css import _indentation, _starts_block
  14. from pygments.lexers.html import HtmlLexer
  15. from pygments.lexers.javascript import JavascriptLexer
  16. from pygments.lexers.ruby import RubyLexer
  17. __all__ = ['DuelLexer', 'SlimLexer', 'XQueryLexer', 'QmlLexer', 'CirruLexer']
  18. class DuelLexer(RegexLexer):
  19. """
  20. Lexer for Duel Views Engine (formerly JBST) markup with JavaScript code blocks.
  21. See http://duelengine.org/.
  22. See http://jsonml.org/jbst/.
  23. .. versionadded:: 1.4
  24. """
  25. name = 'Duel'
  26. aliases = ['duel', 'jbst', 'jsonml+bst']
  27. filenames = ['*.duel', '*.jbst']
  28. mimetypes = ['text/x-duel', 'text/x-jbst']
  29. flags = re.DOTALL
  30. tokens = {
  31. 'root': [
  32. (r'(<%[@=#!:]?)(.*?)(%>)',
  33. bygroups(Name.Tag, using(JavascriptLexer), Name.Tag)),
  34. (r'(<%\$)(.*?)(:)(.*?)(%>)',
  35. bygroups(Name.Tag, Name.Function, Punctuation, String, Name.Tag)),
  36. (r'(<%--)(.*?)(--%>)',
  37. bygroups(Name.Tag, Comment.Multiline, Name.Tag)),
  38. (r'(<script.*?>)(.*?)(</script>)',
  39. bygroups(using(HtmlLexer),
  40. using(JavascriptLexer), using(HtmlLexer))),
  41. (r'(.+?)(?=<)', using(HtmlLexer)),
  42. (r'.+', using(HtmlLexer)),
  43. ],
  44. }
  45. class XQueryLexer(ExtendedRegexLexer):
  46. """
  47. An XQuery lexer, parsing a stream and outputting the tokens needed to
  48. highlight xquery code.
  49. .. versionadded:: 1.4
  50. """
  51. name = 'XQuery'
  52. aliases = ['xquery', 'xqy', 'xq', 'xql', 'xqm']
  53. filenames = ['*.xqy', '*.xquery', '*.xq', '*.xql', '*.xqm']
  54. mimetypes = ['text/xquery', 'application/xquery']
  55. xquery_parse_state = []
  56. # FIX UNICODE LATER
  57. # ncnamestartchar = (
  58. # r"[A-Z]|_|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|"
  59. # r"[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|"
  60. # r"[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|"
  61. # r"[\u10000-\uEFFFF]"
  62. # )
  63. ncnamestartchar = r"(?:[A-Z]|_|[a-z])"
  64. # FIX UNICODE LATER
  65. # ncnamechar = ncnamestartchar + (r"|-|\.|[0-9]|\u00B7|[\u0300-\u036F]|"
  66. # r"[\u203F-\u2040]")
  67. ncnamechar = r"(?:" + ncnamestartchar + r"|-|\.|[0-9])"
  68. ncname = "(?:%s+%s*)" % (ncnamestartchar, ncnamechar)
  69. pitarget_namestartchar = r"(?:[A-KN-WYZ]|_|:|[a-kn-wyz])"
  70. pitarget_namechar = r"(?:" + pitarget_namestartchar + r"|-|\.|[0-9])"
  71. pitarget = "%s+%s*" % (pitarget_namestartchar, pitarget_namechar)
  72. prefixedname = "%s:%s" % (ncname, ncname)
  73. unprefixedname = ncname
  74. qname = "(?:%s|%s)" % (prefixedname, unprefixedname)
  75. entityref = r'(?:&(?:lt|gt|amp|quot|apos|nbsp);)'
  76. charref = r'(?:&#[0-9]+;|&#x[0-9a-fA-F]+;)'
  77. stringdouble = r'(?:"(?:' + entityref + r'|' + charref + r'|""|[^&"])*")'
  78. stringsingle = r"(?:'(?:" + entityref + r"|" + charref + r"|''|[^&'])*')"
  79. # FIX UNICODE LATER
  80. # elementcontentchar = (r'\t|\r|\n|[\u0020-\u0025]|[\u0028-\u003b]|'
  81. # r'[\u003d-\u007a]|\u007c|[\u007e-\u007F]')
  82. elementcontentchar = r'[A-Za-z]|\s|\d|[!"#$%()*+,\-./:;=?@\[\\\]^_\'`|~]'
  83. # quotattrcontentchar = (r'\t|\r|\n|[\u0020-\u0021]|[\u0023-\u0025]|'
  84. # r'[\u0027-\u003b]|[\u003d-\u007a]|\u007c|[\u007e-\u007F]')
  85. quotattrcontentchar = r'[A-Za-z]|\s|\d|[!#$%()*+,\-./:;=?@\[\\\]^_\'`|~]'
  86. # aposattrcontentchar = (r'\t|\r|\n|[\u0020-\u0025]|[\u0028-\u003b]|'
  87. # r'[\u003d-\u007a]|\u007c|[\u007e-\u007F]')
  88. aposattrcontentchar = r'[A-Za-z]|\s|\d|[!"#$%()*+,\-./:;=?@\[\\\]^_`|~]'
  89. # CHAR elements - fix the above elementcontentchar, quotattrcontentchar,
  90. # aposattrcontentchar
  91. # x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
  92. flags = re.DOTALL | re.MULTILINE | re.UNICODE
  93. def punctuation_root_callback(lexer, match, ctx):
  94. yield match.start(), Punctuation, match.group(1)
  95. # transition to root always - don't pop off stack
  96. ctx.stack = ['root']
  97. ctx.pos = match.end()
  98. def operator_root_callback(lexer, match, ctx):
  99. yield match.start(), Operator, match.group(1)
  100. # transition to root always - don't pop off stack
  101. ctx.stack = ['root']
  102. ctx.pos = match.end()
  103. def popstate_tag_callback(lexer, match, ctx):
  104. yield match.start(), Name.Tag, match.group(1)
  105. if lexer.xquery_parse_state:
  106. ctx.stack.append(lexer.xquery_parse_state.pop())
  107. ctx.pos = match.end()
  108. def popstate_xmlcomment_callback(lexer, match, ctx):
  109. yield match.start(), String.Doc, match.group(1)
  110. ctx.stack.append(lexer.xquery_parse_state.pop())
  111. ctx.pos = match.end()
  112. def popstate_kindtest_callback(lexer, match, ctx):
  113. yield match.start(), Punctuation, match.group(1)
  114. next_state = lexer.xquery_parse_state.pop()
  115. if next_state == 'occurrenceindicator':
  116. if re.match("[?*+]+", match.group(2)):
  117. yield match.start(), Punctuation, match.group(2)
  118. ctx.stack.append('operator')
  119. ctx.pos = match.end()
  120. else:
  121. ctx.stack.append('operator')
  122. ctx.pos = match.end(1)
  123. else:
  124. ctx.stack.append(next_state)
  125. ctx.pos = match.end(1)
  126. def popstate_callback(lexer, match, ctx):
  127. yield match.start(), Punctuation, match.group(1)
  128. # if we have run out of our state stack, pop whatever is on the pygments
  129. # state stack
  130. if len(lexer.xquery_parse_state) == 0:
  131. ctx.stack.pop()
  132. if not ctx.stack:
  133. # make sure we have at least the root state on invalid inputs
  134. ctx.stack = ['root']
  135. elif len(ctx.stack) > 1:
  136. ctx.stack.append(lexer.xquery_parse_state.pop())
  137. else:
  138. # i don't know if i'll need this, but in case, default back to root
  139. ctx.stack = ['root']
  140. ctx.pos = match.end()
  141. def pushstate_element_content_starttag_callback(lexer, match, ctx):
  142. yield match.start(), Name.Tag, match.group(1)
  143. lexer.xquery_parse_state.append('element_content')
  144. ctx.stack.append('start_tag')
  145. ctx.pos = match.end()
  146. def pushstate_cdata_section_callback(lexer, match, ctx):
  147. yield match.start(), String.Doc, match.group(1)
  148. ctx.stack.append('cdata_section')
  149. lexer.xquery_parse_state.append(ctx.state.pop)
  150. ctx.pos = match.end()
  151. def pushstate_starttag_callback(lexer, match, ctx):
  152. yield match.start(), Name.Tag, match.group(1)
  153. lexer.xquery_parse_state.append(ctx.state.pop)
  154. ctx.stack.append('start_tag')
  155. ctx.pos = match.end()
  156. def pushstate_operator_order_callback(lexer, match, ctx):
  157. yield match.start(), Keyword, match.group(1)
  158. yield match.start(), Text, match.group(2)
  159. yield match.start(), Punctuation, match.group(3)
  160. ctx.stack = ['root']
  161. lexer.xquery_parse_state.append('operator')
  162. ctx.pos = match.end()
  163. def pushstate_operator_map_callback(lexer, match, ctx):
  164. yield match.start(), Keyword, match.group(1)
  165. yield match.start(), Text, match.group(2)
  166. yield match.start(), Punctuation, match.group(3)
  167. ctx.stack = ['root']
  168. lexer.xquery_parse_state.append('operator')
  169. ctx.pos = match.end()
  170. def pushstate_operator_root_validate(lexer, match, ctx):
  171. yield match.start(), Keyword, match.group(1)
  172. yield match.start(), Text, match.group(2)
  173. yield match.start(), Punctuation, match.group(3)
  174. ctx.stack = ['root']
  175. lexer.xquery_parse_state.append('operator')
  176. ctx.pos = match.end()
  177. def pushstate_operator_root_validate_withmode(lexer, match, ctx):
  178. yield match.start(), Keyword, match.group(1)
  179. yield match.start(), Text, match.group(2)
  180. yield match.start(), Keyword, match.group(3)
  181. ctx.stack = ['root']
  182. lexer.xquery_parse_state.append('operator')
  183. ctx.pos = match.end()
  184. def pushstate_operator_processing_instruction_callback(lexer, match, ctx):
  185. yield match.start(), String.Doc, match.group(1)
  186. ctx.stack.append('processing_instruction')
  187. lexer.xquery_parse_state.append('operator')
  188. ctx.pos = match.end()
  189. def pushstate_element_content_processing_instruction_callback(lexer, match, ctx):
  190. yield match.start(), String.Doc, match.group(1)
  191. ctx.stack.append('processing_instruction')
  192. lexer.xquery_parse_state.append('element_content')
  193. ctx.pos = match.end()
  194. def pushstate_element_content_cdata_section_callback(lexer, match, ctx):
  195. yield match.start(), String.Doc, match.group(1)
  196. ctx.stack.append('cdata_section')
  197. lexer.xquery_parse_state.append('element_content')
  198. ctx.pos = match.end()
  199. def pushstate_operator_cdata_section_callback(lexer, match, ctx):
  200. yield match.start(), String.Doc, match.group(1)
  201. ctx.stack.append('cdata_section')
  202. lexer.xquery_parse_state.append('operator')
  203. ctx.pos = match.end()
  204. def pushstate_element_content_xmlcomment_callback(lexer, match, ctx):
  205. yield match.start(), String.Doc, match.group(1)
  206. ctx.stack.append('xml_comment')
  207. lexer.xquery_parse_state.append('element_content')
  208. ctx.pos = match.end()
  209. def pushstate_operator_xmlcomment_callback(lexer, match, ctx):
  210. yield match.start(), String.Doc, match.group(1)
  211. ctx.stack.append('xml_comment')
  212. lexer.xquery_parse_state.append('operator')
  213. ctx.pos = match.end()
  214. def pushstate_kindtest_callback(lexer, match, ctx):
  215. yield match.start(), Keyword, match.group(1)
  216. yield match.start(), Text, match.group(2)
  217. yield match.start(), Punctuation, match.group(3)
  218. lexer.xquery_parse_state.append('kindtest')
  219. ctx.stack.append('kindtest')
  220. ctx.pos = match.end()
  221. def pushstate_operator_kindtestforpi_callback(lexer, match, ctx):
  222. yield match.start(), Keyword, match.group(1)
  223. yield match.start(), Text, match.group(2)
  224. yield match.start(), Punctuation, match.group(3)
  225. lexer.xquery_parse_state.append('operator')
  226. ctx.stack.append('kindtestforpi')
  227. ctx.pos = match.end()
  228. def pushstate_operator_kindtest_callback(lexer, match, ctx):
  229. yield match.start(), Keyword, match.group(1)
  230. yield match.start(), Text, match.group(2)
  231. yield match.start(), Punctuation, match.group(3)
  232. lexer.xquery_parse_state.append('operator')
  233. ctx.stack.append('kindtest')
  234. ctx.pos = match.end()
  235. def pushstate_occurrenceindicator_kindtest_callback(lexer, match, ctx):
  236. yield match.start(), Name.Tag, match.group(1)
  237. yield match.start(), Text, match.group(2)
  238. yield match.start(), Punctuation, match.group(3)
  239. lexer.xquery_parse_state.append('occurrenceindicator')
  240. ctx.stack.append('kindtest')
  241. ctx.pos = match.end()
  242. def pushstate_operator_starttag_callback(lexer, match, ctx):
  243. yield match.start(), Name.Tag, match.group(1)
  244. lexer.xquery_parse_state.append('operator')
  245. ctx.stack.append('start_tag')
  246. ctx.pos = match.end()
  247. def pushstate_operator_root_callback(lexer, match, ctx):
  248. yield match.start(), Punctuation, match.group(1)
  249. lexer.xquery_parse_state.append('operator')
  250. ctx.stack = ['root']
  251. ctx.pos = match.end()
  252. def pushstate_operator_root_construct_callback(lexer, match, ctx):
  253. yield match.start(), Keyword, match.group(1)
  254. yield match.start(), Text, match.group(2)
  255. yield match.start(), Punctuation, match.group(3)
  256. lexer.xquery_parse_state.append('operator')
  257. ctx.stack = ['root']
  258. ctx.pos = match.end()
  259. def pushstate_root_callback(lexer, match, ctx):
  260. yield match.start(), Punctuation, match.group(1)
  261. cur_state = ctx.stack.pop()
  262. lexer.xquery_parse_state.append(cur_state)
  263. ctx.stack = ['root']
  264. ctx.pos = match.end()
  265. def pushstate_operator_attribute_callback(lexer, match, ctx):
  266. yield match.start(), Name.Attribute, match.group(1)
  267. ctx.stack.append('operator')
  268. ctx.pos = match.end()
  269. def pushstate_operator_callback(lexer, match, ctx):
  270. yield match.start(), Keyword, match.group(1)
  271. yield match.start(), Text, match.group(2)
  272. yield match.start(), Punctuation, match.group(3)
  273. lexer.xquery_parse_state.append('operator')
  274. ctx.pos = match.end()
  275. tokens = {
  276. 'comment': [
  277. # xquery comments
  278. (r'(:\))', Comment, '#pop'),
  279. (r'(\(:)', Comment, '#push'),
  280. (r'[^:)]', Comment),
  281. (r'([^:)]|:|\))', Comment),
  282. ],
  283. 'whitespace': [
  284. (r'\s+', Text),
  285. ],
  286. 'operator': [
  287. include('whitespace'),
  288. (r'(\})', popstate_callback),
  289. (r'\(:', Comment, 'comment'),
  290. (r'(\{)', pushstate_root_callback),
  291. (r'then|else|external|at|div|except', Keyword, 'root'),
  292. (r'order by', Keyword, 'root'),
  293. (r'group by', Keyword, 'root'),
  294. (r'is|mod|order\s+by|stable\s+order\s+by', Keyword, 'root'),
  295. (r'and|or', Operator.Word, 'root'),
  296. (r'(eq|ge|gt|le|lt|ne|idiv|intersect|in)(?=\b)',
  297. Operator.Word, 'root'),
  298. (r'return|satisfies|to|union|where|count|preserve\s+strip',
  299. Keyword, 'root'),
  300. (r'(>=|>>|>|<=|<<|<|-|\*|!=|\+|\|\||\||:=|=|!)',
  301. operator_root_callback),
  302. (r'(::|:|;|\[|//|/|,)',
  303. punctuation_root_callback),
  304. (r'(castable|cast)(\s+)(as)\b',
  305. bygroups(Keyword, Text, Keyword), 'singletype'),
  306. (r'(instance)(\s+)(of)\b',
  307. bygroups(Keyword, Text, Keyword), 'itemtype'),
  308. (r'(treat)(\s+)(as)\b',
  309. bygroups(Keyword, Text, Keyword), 'itemtype'),
  310. (r'(case)(\s+)(' + stringdouble + ')',
  311. bygroups(Keyword, Text, String.Double), 'itemtype'),
  312. (r'(case)(\s+)(' + stringsingle + ')',
  313. bygroups(Keyword, Text, String.Single), 'itemtype'),
  314. (r'(case|as)\b', Keyword, 'itemtype'),
  315. (r'(\))(\s*)(as)',
  316. bygroups(Punctuation, Text, Keyword), 'itemtype'),
  317. (r'\$', Name.Variable, 'varname'),
  318. (r'(for|let|previous|next)(\s+)(\$)',
  319. bygroups(Keyword, Text, Name.Variable), 'varname'),
  320. (r'(for)(\s+)(tumbling|sliding)(\s+)(window)(\s+)(\$)',
  321. bygroups(Keyword, Text, Keyword, Text, Keyword, Text, Name.Variable),
  322. 'varname'),
  323. # (r'\)|\?|\]', Punctuation, '#push'),
  324. (r'\)|\?|\]', Punctuation),
  325. (r'(empty)(\s+)(greatest|least)', bygroups(Keyword, Text, Keyword)),
  326. (r'ascending|descending|default', Keyword, '#push'),
  327. (r'(allowing)(\s+)(empty)', bygroups(Keyword, Text, Keyword)),
  328. (r'external', Keyword),
  329. (r'(start|when|end)', Keyword, 'root'),
  330. (r'(only)(\s+)(end)', bygroups(Keyword, Text, Keyword), 'root'),
  331. (r'collation', Keyword, 'uritooperator'),
  332. # eXist specific XQUF
  333. (r'(into|following|preceding|with)', Keyword, 'root'),
  334. # support for current context on rhs of Simple Map Operator
  335. (r'\.', Operator),
  336. # finally catch all string literals and stay in operator state
  337. (stringdouble, String.Double),
  338. (stringsingle, String.Single),
  339. (r'(catch)(\s*)', bygroups(Keyword, Text), 'root'),
  340. ],
  341. 'uritooperator': [
  342. (stringdouble, String.Double, '#pop'),
  343. (stringsingle, String.Single, '#pop'),
  344. ],
  345. 'namespacedecl': [
  346. include('whitespace'),
  347. (r'\(:', Comment, 'comment'),
  348. (r'(at)(\s+)('+stringdouble+')', bygroups(Keyword, Text, String.Double)),
  349. (r"(at)(\s+)("+stringsingle+')', bygroups(Keyword, Text, String.Single)),
  350. (stringdouble, String.Double),
  351. (stringsingle, String.Single),
  352. (r',', Punctuation),
  353. (r'=', Operator),
  354. (r';', Punctuation, 'root'),
  355. (ncname, Name.Namespace),
  356. ],
  357. 'namespacekeyword': [
  358. include('whitespace'),
  359. (r'\(:', Comment, 'comment'),
  360. (stringdouble, String.Double, 'namespacedecl'),
  361. (stringsingle, String.Single, 'namespacedecl'),
  362. (r'inherit|no-inherit', Keyword, 'root'),
  363. (r'namespace', Keyword, 'namespacedecl'),
  364. (r'(default)(\s+)(element)', bygroups(Keyword, Text, Keyword)),
  365. (r'preserve|no-preserve', Keyword),
  366. (r',', Punctuation),
  367. ],
  368. 'annotationname': [
  369. (r'\(:', Comment, 'comment'),
  370. (qname, Name.Decorator),
  371. (r'(\()(' + stringdouble + ')', bygroups(Punctuation, String.Double)),
  372. (r'(\()(' + stringsingle + ')', bygroups(Punctuation, String.Single)),
  373. (r'(\,)(\s+)(' + stringdouble + ')',
  374. bygroups(Punctuation, Text, String.Double)),
  375. (r'(\,)(\s+)(' + stringsingle + ')',
  376. bygroups(Punctuation, Text, String.Single)),
  377. (r'\)', Punctuation),
  378. (r'(\s+)(\%)', bygroups(Text, Name.Decorator), 'annotationname'),
  379. (r'(\s+)(variable)(\s+)(\$)',
  380. bygroups(Text, Keyword.Declaration, Text, Name.Variable), 'varname'),
  381. (r'(\s+)(function)(\s+)',
  382. bygroups(Text, Keyword.Declaration, Text), 'root')
  383. ],
  384. 'varname': [
  385. (r'\(:', Comment, 'comment'),
  386. (r'(' + qname + r')(\()?', bygroups(Name, Punctuation), 'operator'),
  387. ],
  388. 'singletype': [
  389. include('whitespace'),
  390. (r'\(:', Comment, 'comment'),
  391. (ncname + r'(:\*)', Name.Variable, 'operator'),
  392. (qname, Name.Variable, 'operator'),
  393. ],
  394. 'itemtype': [
  395. include('whitespace'),
  396. (r'\(:', Comment, 'comment'),
  397. (r'\$', Name.Variable, 'varname'),
  398. (r'(void)(\s*)(\()(\s*)(\))',
  399. bygroups(Keyword, Text, Punctuation, Text, Punctuation), 'operator'),
  400. (r'(element|attribute|schema-element|schema-attribute|comment|text|'
  401. r'node|binary|document-node|empty-sequence)(\s*)(\()',
  402. pushstate_occurrenceindicator_kindtest_callback),
  403. # Marklogic specific type?
  404. (r'(processing-instruction)(\s*)(\()',
  405. bygroups(Keyword, Text, Punctuation),
  406. ('occurrenceindicator', 'kindtestforpi')),
  407. (r'(item)(\s*)(\()(\s*)(\))(?=[*+?])',
  408. bygroups(Keyword, Text, Punctuation, Text, Punctuation),
  409. 'occurrenceindicator'),
  410. (r'(\(\#)(\s*)', bygroups(Punctuation, Text), 'pragma'),
  411. (r';', Punctuation, '#pop'),
  412. (r'then|else', Keyword, '#pop'),
  413. (r'(at)(\s+)(' + stringdouble + ')',
  414. bygroups(Keyword, Text, String.Double), 'namespacedecl'),
  415. (r'(at)(\s+)(' + stringsingle + ')',
  416. bygroups(Keyword, Text, String.Single), 'namespacedecl'),
  417. (r'except|intersect|in|is|return|satisfies|to|union|where|count',
  418. Keyword, 'root'),
  419. (r'and|div|eq|ge|gt|le|lt|ne|idiv|mod|or', Operator.Word, 'root'),
  420. (r':=|=|,|>=|>>|>|\[|\(|<=|<<|<|-|!=|\|\||\|', Operator, 'root'),
  421. (r'external|at', Keyword, 'root'),
  422. (r'(stable)(\s+)(order)(\s+)(by)',
  423. bygroups(Keyword, Text, Keyword, Text, Keyword), 'root'),
  424. (r'(castable|cast)(\s+)(as)',
  425. bygroups(Keyword, Text, Keyword), 'singletype'),
  426. (r'(treat)(\s+)(as)', bygroups(Keyword, Text, Keyword)),
  427. (r'(instance)(\s+)(of)', bygroups(Keyword, Text, Keyword)),
  428. (r'(case)(\s+)(' + stringdouble + ')',
  429. bygroups(Keyword, Text, String.Double), 'itemtype'),
  430. (r'(case)(\s+)(' + stringsingle + ')',
  431. bygroups(Keyword, Text, String.Single), 'itemtype'),
  432. (r'case|as', Keyword, 'itemtype'),
  433. (r'(\))(\s*)(as)', bygroups(Operator, Text, Keyword), 'itemtype'),
  434. (ncname + r':\*', Keyword.Type, 'operator'),
  435. (r'(function|map|array)(\()', bygroups(Keyword.Type, Punctuation)),
  436. (qname, Keyword.Type, 'occurrenceindicator'),
  437. ],
  438. 'kindtest': [
  439. (r'\(:', Comment, 'comment'),
  440. (r'\{', Punctuation, 'root'),
  441. (r'(\))([*+?]?)', popstate_kindtest_callback),
  442. (r'\*', Name, 'closekindtest'),
  443. (qname, Name, 'closekindtest'),
  444. (r'(element|schema-element)(\s*)(\()', pushstate_kindtest_callback),
  445. ],
  446. 'kindtestforpi': [
  447. (r'\(:', Comment, 'comment'),
  448. (r'\)', Punctuation, '#pop'),
  449. (ncname, Name.Variable),
  450. (stringdouble, String.Double),
  451. (stringsingle, String.Single),
  452. ],
  453. 'closekindtest': [
  454. (r'\(:', Comment, 'comment'),
  455. (r'(\))', popstate_callback),
  456. (r',', Punctuation),
  457. (r'(\{)', pushstate_operator_root_callback),
  458. (r'\?', Punctuation),
  459. ],
  460. 'xml_comment': [
  461. (r'(-->)', popstate_xmlcomment_callback),
  462. (r'[^-]{1,2}', Literal),
  463. (r'\t|\r|\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|[\U00010000-\U0010FFFF]',
  464. Literal),
  465. ],
  466. 'processing_instruction': [
  467. (r'\s+', Text, 'processing_instruction_content'),
  468. (r'\?>', String.Doc, '#pop'),
  469. (pitarget, Name),
  470. ],
  471. 'processing_instruction_content': [
  472. (r'\?>', String.Doc, '#pop'),
  473. (r'\t|\r|\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|[\U00010000-\U0010FFFF]',
  474. Literal),
  475. ],
  476. 'cdata_section': [
  477. (r']]>', String.Doc, '#pop'),
  478. (r'\t|\r|\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|[\U00010000-\U0010FFFF]',
  479. Literal),
  480. ],
  481. 'start_tag': [
  482. include('whitespace'),
  483. (r'(/>)', popstate_tag_callback),
  484. (r'>', Name.Tag, 'element_content'),
  485. (r'"', Punctuation, 'quot_attribute_content'),
  486. (r"'", Punctuation, 'apos_attribute_content'),
  487. (r'=', Operator),
  488. (qname, Name.Tag),
  489. ],
  490. 'quot_attribute_content': [
  491. (r'"', Punctuation, 'start_tag'),
  492. (r'(\{)', pushstate_root_callback),
  493. (r'""', Name.Attribute),
  494. (quotattrcontentchar, Name.Attribute),
  495. (entityref, Name.Attribute),
  496. (charref, Name.Attribute),
  497. (r'\{\{|\}\}', Name.Attribute),
  498. ],
  499. 'apos_attribute_content': [
  500. (r"'", Punctuation, 'start_tag'),
  501. (r'\{', Punctuation, 'root'),
  502. (r"''", Name.Attribute),
  503. (aposattrcontentchar, Name.Attribute),
  504. (entityref, Name.Attribute),
  505. (charref, Name.Attribute),
  506. (r'\{\{|\}\}', Name.Attribute),
  507. ],
  508. 'element_content': [
  509. (r'</', Name.Tag, 'end_tag'),
  510. (r'(\{)', pushstate_root_callback),
  511. (r'(<!--)', pushstate_element_content_xmlcomment_callback),
  512. (r'(<\?)', pushstate_element_content_processing_instruction_callback),
  513. (r'(<!\[CDATA\[)', pushstate_element_content_cdata_section_callback),
  514. (r'(<)', pushstate_element_content_starttag_callback),
  515. (elementcontentchar, Literal),
  516. (entityref, Literal),
  517. (charref, Literal),
  518. (r'\{\{|\}\}', Literal),
  519. ],
  520. 'end_tag': [
  521. include('whitespace'),
  522. (r'(>)', popstate_tag_callback),
  523. (qname, Name.Tag),
  524. ],
  525. 'xmlspace_decl': [
  526. include('whitespace'),
  527. (r'\(:', Comment, 'comment'),
  528. (r'preserve|strip', Keyword, '#pop'),
  529. ],
  530. 'declareordering': [
  531. (r'\(:', Comment, 'comment'),
  532. include('whitespace'),
  533. (r'ordered|unordered', Keyword, '#pop'),
  534. ],
  535. 'xqueryversion': [
  536. include('whitespace'),
  537. (r'\(:', Comment, 'comment'),
  538. (stringdouble, String.Double),
  539. (stringsingle, String.Single),
  540. (r'encoding', Keyword),
  541. (r';', Punctuation, '#pop'),
  542. ],
  543. 'pragma': [
  544. (qname, Name.Variable, 'pragmacontents'),
  545. ],
  546. 'pragmacontents': [
  547. (r'#\)', Punctuation, 'operator'),
  548. (r'\t|\r|\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|[\U00010000-\U0010FFFF]',
  549. Literal),
  550. (r'(\s+)', Text),
  551. ],
  552. 'occurrenceindicator': [
  553. include('whitespace'),
  554. (r'\(:', Comment, 'comment'),
  555. (r'\*|\?|\+', Operator, 'operator'),
  556. (r':=', Operator, 'root'),
  557. default('operator'),
  558. ],
  559. 'option': [
  560. include('whitespace'),
  561. (qname, Name.Variable, '#pop'),
  562. ],
  563. 'qname_braren': [
  564. include('whitespace'),
  565. (r'(\{)', pushstate_operator_root_callback),
  566. (r'(\()', Punctuation, 'root'),
  567. ],
  568. 'element_qname': [
  569. (qname, Name.Variable, 'root'),
  570. ],
  571. 'attribute_qname': [
  572. (qname, Name.Variable, 'root'),
  573. ],
  574. 'root': [
  575. include('whitespace'),
  576. (r'\(:', Comment, 'comment'),
  577. # handle operator state
  578. # order on numbers matters - handle most complex first
  579. (r'\d+(\.\d*)?[eE][+-]?\d+', Number.Float, 'operator'),
  580. (r'(\.\d+)[eE][+-]?\d+', Number.Float, 'operator'),
  581. (r'(\.\d+|\d+\.\d*)', Number.Float, 'operator'),
  582. (r'(\d+)', Number.Integer, 'operator'),
  583. (r'(\.\.|\.|\))', Punctuation, 'operator'),
  584. (r'(declare)(\s+)(construction)',
  585. bygroups(Keyword.Declaration, Text, Keyword.Declaration), 'operator'),
  586. (r'(declare)(\s+)(default)(\s+)(order)',
  587. bygroups(Keyword.Declaration, Text, Keyword.Declaration, Text, Keyword.Declaration), 'operator'),
  588. (r'(declare)(\s+)(context)(\s+)(item)',
  589. bygroups(Keyword.Declaration, Text, Keyword.Declaration, Text, Keyword.Declaration), 'operator'),
  590. (ncname + r':\*', Name, 'operator'),
  591. (r'\*:'+ncname, Name.Tag, 'operator'),
  592. (r'\*', Name.Tag, 'operator'),
  593. (stringdouble, String.Double, 'operator'),
  594. (stringsingle, String.Single, 'operator'),
  595. (r'(\}|\])', popstate_callback),
  596. # NAMESPACE DECL
  597. (r'(declare)(\s+)(default)(\s+)(collation)',
  598. bygroups(Keyword.Declaration, Text, Keyword.Declaration, Text, Keyword.Declaration)),
  599. (r'(module|declare)(\s+)(namespace)',
  600. bygroups(Keyword.Declaration, Text, Keyword.Declaration), 'namespacedecl'),
  601. (r'(declare)(\s+)(base-uri)',
  602. bygroups(Keyword.Declaration, Text, Keyword.Declaration), 'namespacedecl'),
  603. # NAMESPACE KEYWORD
  604. (r'(declare)(\s+)(default)(\s+)(element|function)',
  605. bygroups(Keyword.Declaration, Text, Keyword.Declaration, Text, Keyword.Declaration),
  606. 'namespacekeyword'),
  607. (r'(import)(\s+)(schema|module)',
  608. bygroups(Keyword.Pseudo, Text, Keyword.Pseudo), 'namespacekeyword'),
  609. (r'(declare)(\s+)(copy-namespaces)',
  610. bygroups(Keyword.Declaration, Text, Keyword.Declaration), 'namespacekeyword'),
  611. # VARNAMEs
  612. (r'(for|let|some|every)(\s+)(\$)',
  613. bygroups(Keyword, Text, Name.Variable), 'varname'),
  614. (r'(for)(\s+)(tumbling|sliding)(\s+)(window)(\s+)(\$)',
  615. bygroups(Keyword, Text, Keyword, Text, Keyword, Text, Name.Variable), 'varname'),
  616. (r'\$', Name.Variable, 'varname'),
  617. (r'(declare)(\s+)(variable)(\s+)(\$)',
  618. bygroups(Keyword.Declaration, Text, Keyword.Declaration, Text, Name.Variable), 'varname'),
  619. # ANNOTATED GLOBAL VARIABLES AND FUNCTIONS
  620. (r'(declare)(\s+)(\%)', bygroups(Keyword.Declaration, Text, Name.Decorator), 'annotationname'),
  621. # ITEMTYPE
  622. (r'(\))(\s+)(as)', bygroups(Operator, Text, Keyword), 'itemtype'),
  623. (r'(element|attribute|schema-element|schema-attribute|comment|'
  624. r'text|node|document-node|empty-sequence)(\s+)(\()',
  625. pushstate_operator_kindtest_callback),
  626. (r'(processing-instruction)(\s+)(\()',
  627. pushstate_operator_kindtestforpi_callback),
  628. (r'(<!--)', pushstate_operator_xmlcomment_callback),
  629. (r'(<\?)', pushstate_operator_processing_instruction_callback),
  630. (r'(<!\[CDATA\[)', pushstate_operator_cdata_section_callback),
  631. # (r'</', Name.Tag, 'end_tag'),
  632. (r'(<)', pushstate_operator_starttag_callback),
  633. (r'(declare)(\s+)(boundary-space)',
  634. bygroups(Keyword.Declaration, Text, Keyword.Declaration), 'xmlspace_decl'),
  635. (r'(validate)(\s+)(lax|strict)',
  636. pushstate_operator_root_validate_withmode),
  637. (r'(validate)(\s*)(\{)', pushstate_operator_root_validate),
  638. (r'(typeswitch)(\s*)(\()', bygroups(Keyword, Text, Punctuation)),
  639. (r'(switch)(\s*)(\()', bygroups(Keyword, Text, Punctuation)),
  640. (r'(element|attribute|namespace)(\s*)(\{)',
  641. pushstate_operator_root_construct_callback),
  642. (r'(document|text|processing-instruction|comment)(\s*)(\{)',
  643. pushstate_operator_root_construct_callback),
  644. # ATTRIBUTE
  645. (r'(attribute)(\s+)(?=' + qname + r')',
  646. bygroups(Keyword, Text), 'attribute_qname'),
  647. # ELEMENT
  648. (r'(element)(\s+)(?=' + qname + r')',
  649. bygroups(Keyword, Text), 'element_qname'),
  650. # PROCESSING_INSTRUCTION
  651. (r'(processing-instruction|namespace)(\s+)(' + ncname + r')(\s*)(\{)',
  652. bygroups(Keyword, Text, Name.Variable, Text, Punctuation),
  653. 'operator'),
  654. (r'(declare|define)(\s+)(function)',
  655. bygroups(Keyword.Declaration, Text, Keyword.Declaration)),
  656. (r'(\{|\[)', pushstate_operator_root_callback),
  657. (r'(unordered|ordered)(\s*)(\{)',
  658. pushstate_operator_order_callback),
  659. (r'(map|array)(\s*)(\{)',
  660. pushstate_operator_map_callback),
  661. (r'(declare)(\s+)(ordering)',
  662. bygroups(Keyword.Declaration, Text, Keyword.Declaration), 'declareordering'),
  663. (r'(xquery)(\s+)(version)',
  664. bygroups(Keyword.Pseudo, Text, Keyword.Pseudo), 'xqueryversion'),
  665. (r'(\(#)(\s*)', bygroups(Punctuation, Text), 'pragma'),
  666. # sometimes return can occur in root state
  667. (r'return', Keyword),
  668. (r'(declare)(\s+)(option)', bygroups(Keyword.Declaration, Text, Keyword.Declaration),
  669. 'option'),
  670. # URI LITERALS - single and double quoted
  671. (r'(at)(\s+)('+stringdouble+')', String.Double, 'namespacedecl'),
  672. (r'(at)(\s+)('+stringsingle+')', String.Single, 'namespacedecl'),
  673. (r'(ancestor-or-self|ancestor|attribute|child|descendant-or-self)(::)',
  674. bygroups(Keyword, Punctuation)),
  675. (r'(descendant|following-sibling|following|parent|preceding-sibling'
  676. r'|preceding|self)(::)', bygroups(Keyword, Punctuation)),
  677. (r'(if)(\s*)(\()', bygroups(Keyword, Text, Punctuation)),
  678. (r'then|else', Keyword),
  679. # eXist specific XQUF
  680. (r'(update)(\s*)(insert|delete|replace|value|rename)', bygroups(Keyword, Text, Keyword)),
  681. (r'(into|following|preceding|with)', Keyword),
  682. # Marklogic specific
  683. (r'(try)(\s*)', bygroups(Keyword, Text), 'root'),
  684. (r'(catch)(\s*)(\()(\$)',
  685. bygroups(Keyword, Text, Punctuation, Name.Variable), 'varname'),
  686. (r'(@'+qname+')', Name.Attribute, 'operator'),
  687. (r'(@'+ncname+')', Name.Attribute, 'operator'),
  688. (r'@\*:'+ncname, Name.Attribute, 'operator'),
  689. (r'@\*', Name.Attribute, 'operator'),
  690. (r'(@)', Name.Attribute, 'operator'),
  691. (r'//|/|\+|-|;|,|\(|\)', Punctuation),
  692. # STANDALONE QNAMES
  693. (qname + r'(?=\s*\{)', Name.Tag, 'qname_braren'),
  694. (qname + r'(?=\s*\([^:])', Name.Function, 'qname_braren'),
  695. (r'(' + qname + ')(#)([0-9]+)', bygroups(Name.Function, Keyword.Type, Number.Integer)),
  696. (qname, Name.Tag, 'operator'),
  697. ]
  698. }
  699. class QmlLexer(RegexLexer):
  700. """
  701. For QML files. See http://doc.qt.digia.com/4.7/qdeclarativeintroduction.html.
  702. .. versionadded:: 1.6
  703. """
  704. # QML is based on javascript, so much of this is taken from the
  705. # JavascriptLexer above.
  706. name = 'QML'
  707. aliases = ['qml', 'qbs']
  708. filenames = ['*.qml', '*.qbs']
  709. mimetypes = ['application/x-qml', 'application/x-qt.qbs+qml']
  710. # pasted from JavascriptLexer, with some additions
  711. flags = re.DOTALL | re.MULTILINE
  712. tokens = {
  713. 'commentsandwhitespace': [
  714. (r'\s+', Text),
  715. (r'<!--', Comment),
  716. (r'//.*?\n', Comment.Single),
  717. (r'/\*.*?\*/', Comment.Multiline)
  718. ],
  719. 'slashstartsregex': [
  720. include('commentsandwhitespace'),
  721. (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
  722. r'([gim]+\b|\B)', String.Regex, '#pop'),
  723. (r'(?=/)', Text, ('#pop', 'badregex')),
  724. default('#pop')
  725. ],
  726. 'badregex': [
  727. (r'\n', Text, '#pop')
  728. ],
  729. 'root': [
  730. (r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
  731. include('commentsandwhitespace'),
  732. (r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
  733. r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
  734. (r'[{(\[;,]', Punctuation, 'slashstartsregex'),
  735. (r'[})\].]', Punctuation),
  736. # QML insertions
  737. (r'\bid\s*:\s*[A-Za-z][\w.]*', Keyword.Declaration,
  738. 'slashstartsregex'),
  739. (r'\b[A-Za-z][\w.]*\s*:', Keyword, 'slashstartsregex'),
  740. # the rest from JavascriptLexer
  741. (r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
  742. r'throw|try|catch|finally|new|delete|typeof|instanceof|void|'
  743. r'this)\b', Keyword, 'slashstartsregex'),
  744. (r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
  745. (r'(abstract|boolean|byte|char|class|const|debugger|double|enum|export|'
  746. r'extends|final|float|goto|implements|import|int|interface|long|native|'
  747. r'package|private|protected|public|short|static|super|synchronized|throws|'
  748. r'transient|volatile)\b', Keyword.Reserved),
  749. (r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant),
  750. (r'(Array|Boolean|Date|Error|Function|Math|netscape|'
  751. r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
  752. r'decodeURIComponent|encodeURI|encodeURIComponent|'
  753. r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
  754. r'window)\b', Name.Builtin),
  755. (r'[$a-zA-Z_]\w*', Name.Other),
  756. (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
  757. (r'0x[0-9a-fA-F]+', Number.Hex),
  758. (r'[0-9]+', Number.Integer),
  759. (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
  760. (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
  761. ]
  762. }
  763. class CirruLexer(RegexLexer):
  764. r"""
  765. Syntax rules of Cirru can be found at:
  766. http://cirru.org/
  767. * using ``()`` for expressions, but restricted in a same line
  768. * using ``""`` for strings, with ``\`` for escaping chars
  769. * using ``$`` as folding operator
  770. * using ``,`` as unfolding operator
  771. * using indentations for nested blocks
  772. .. versionadded:: 2.0
  773. """
  774. name = 'Cirru'
  775. aliases = ['cirru']
  776. filenames = ['*.cirru']
  777. mimetypes = ['text/x-cirru']
  778. flags = re.MULTILINE
  779. tokens = {
  780. 'string': [
  781. (r'[^"\\\n]', String),
  782. (r'\\', String.Escape, 'escape'),
  783. (r'"', String, '#pop'),
  784. ],
  785. 'escape': [
  786. (r'.', String.Escape, '#pop'),
  787. ],
  788. 'function': [
  789. (r'\,', Operator, '#pop'),
  790. (r'[^\s"()]+', Name.Function, '#pop'),
  791. (r'\)', Operator, '#pop'),
  792. (r'(?=\n)', Text, '#pop'),
  793. (r'\(', Operator, '#push'),
  794. (r'"', String, ('#pop', 'string')),
  795. (r'[ ]+', Text.Whitespace),
  796. ],
  797. 'line': [
  798. (r'(?<!\w)\$(?!\w)', Operator, 'function'),
  799. (r'\(', Operator, 'function'),
  800. (r'\)', Operator),
  801. (r'\n', Text, '#pop'),
  802. (r'"', String, 'string'),
  803. (r'[ ]+', Text.Whitespace),
  804. (r'[+-]?[\d.]+\b', Number),
  805. (r'[^\s"()]+', Name.Variable)
  806. ],
  807. 'root': [
  808. (r'^\n+', Text.Whitespace),
  809. default(('line', 'function')),
  810. ]
  811. }
  812. class SlimLexer(ExtendedRegexLexer):
  813. """
  814. For Slim markup.
  815. .. versionadded:: 2.0
  816. """
  817. name = 'Slim'
  818. aliases = ['slim']
  819. filenames = ['*.slim']
  820. mimetypes = ['text/x-slim']
  821. flags = re.IGNORECASE
  822. _dot = r'(?: \|\n(?=.* \|)|.)'
  823. tokens = {
  824. 'root': [
  825. (r'[ \t]*\n', Text),
  826. (r'[ \t]*', _indentation),
  827. ],
  828. 'css': [
  829. (r'\.[\w:-]+', Name.Class, 'tag'),
  830. (r'\#[\w:-]+', Name.Function, 'tag'),
  831. ],
  832. 'eval-or-plain': [
  833. (r'([ \t]*==?)(.*\n)',
  834. bygroups(Punctuation, using(RubyLexer)),
  835. 'root'),
  836. (r'[ \t]+[\w:-]+(?==)', Name.Attribute, 'html-attributes'),
  837. default('plain'),
  838. ],
  839. 'content': [
  840. include('css'),
  841. (r'[\w:-]+:[ \t]*\n', Text, 'plain'),
  842. (r'(-)(.*\n)',
  843. bygroups(Punctuation, using(RubyLexer)),
  844. '#pop'),
  845. (r'\|' + _dot + r'*\n', _starts_block(Text, 'plain'), '#pop'),
  846. (r'/' + _dot + r'*\n', _starts_block(Comment.Preproc, 'slim-comment-block'), '#pop'),
  847. (r'[\w:-]+', Name.Tag, 'tag'),
  848. include('eval-or-plain'),
  849. ],
  850. 'tag': [
  851. include('css'),
  852. (r'[<>]{1,2}(?=[ \t=])', Punctuation),
  853. (r'[ \t]+\n', Punctuation, '#pop:2'),
  854. include('eval-or-plain'),
  855. ],
  856. 'plain': [
  857. (r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Text),
  858. (r'(#\{)(.*?)(\})',
  859. bygroups(String.Interpol, using(RubyLexer), String.Interpol)),
  860. (r'\n', Text, 'root'),
  861. ],
  862. 'html-attributes': [
  863. (r'=', Punctuation),
  864. (r'"[^"]+"', using(RubyLexer), 'tag'),
  865. (r'\'[^\']+\'', using(RubyLexer), 'tag'),
  866. (r'\w+', Text, 'tag'),
  867. ],
  868. 'slim-comment-block': [
  869. (_dot + '+', Comment.Preproc),
  870. (r'\n', Text, 'root'),
  871. ],
  872. }