354 name = 'BBCode' |
354 name = 'BBCode' |
355 aliases = ['bbcode'] |
355 aliases = ['bbcode'] |
356 mimetypes = ['text/x-bbcode'] |
356 mimetypes = ['text/x-bbcode'] |
357 |
357 |
358 tokens = { |
358 tokens = { |
359 'root' : [ |
359 'root': [ |
360 (r'[\s\w]+', Text), |
360 (r'[^[]+', Text), |
361 (r'(\[)(/?[^\]\n\r=]+)(\])', |
361 # tag/end tag begin |
362 bygroups(Keyword, Keyword.Pseudo, Keyword)), |
362 (r'\[/?\w+', Keyword, 'tag'), |
363 (r'(\[)([^\]\n\r=]+)(=)([^\]\n\r]+)(\])', |
363 # stray bracket |
364 bygroups(Keyword, Keyword.Pseudo, Operator, String, Keyword)), |
364 (r'\[', Text), |
|
365 ], |
|
366 'tag': [ |
|
367 (r'\s+', Text), |
|
368 # attribute with value |
|
369 (r'(\w+)(=)("?[^\s"\]]+"?)', |
|
370 bygroups(Name.Attribute, Operator, String)), |
|
371 # tag argument (a la [color=green]) |
|
372 (r'(=)("?[^\s"\]]+"?)', |
|
373 bygroups(Operator, String)), |
|
374 # tag end |
|
375 (r'\]', Keyword, '#pop'), |
365 ], |
376 ], |
366 } |
377 } |
367 |
378 |
368 |
379 |
369 class TexLexer(RegexLexer): |
380 class TexLexer(RegexLexer): |