annotate MoinMoin/support/pygments/lexers/parsers.py @ 6097:815981fad7fd

upgrade pygments from 1.6 to 2.1.3
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 05 Sep 2016 23:55:33 +0200
parents b48a69886ca4
children
rev   line source
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
2 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
3 pygments.lexers.parsers
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4 ~~~~~~~~~~~~~~~~~~~~~~~
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
5
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
6 Lexers for parser generators.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
7
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
8 :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
9 :license: BSD, see LICENSE for details.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
10 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
11
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
12 import re
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
13
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
14 from pygments.lexer import RegexLexer, DelegatingLexer, \
5614
f76914e77229 upgrade pygments to 1.3.1
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5564
diff changeset
15 include, bygroups, using
f76914e77229 upgrade pygments to 1.3.1
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5564
diff changeset
16 from pygments.token import Punctuation, Other, Text, Comment, Operator, \
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
17 Keyword, Name, String, Number, Whitespace
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
18 from pygments.lexers.jvm import JavaLexer
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
19 from pygments.lexers.c_cpp import CLexer, CppLexer
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
20 from pygments.lexers.objective import ObjectiveCLexer
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
21 from pygments.lexers.d import DLexer
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
22 from pygments.lexers.dotnet import CSharpLexer
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
23 from pygments.lexers.ruby import RubyLexer
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
24 from pygments.lexers.python import PythonLexer
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
25 from pygments.lexers.perl import PerlLexer
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
26
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
27 __all__ = ['RagelLexer', 'RagelEmbeddedLexer', 'RagelCLexer', 'RagelDLexer',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
28 'RagelCppLexer', 'RagelObjectiveCLexer', 'RagelRubyLexer',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
29 'RagelJavaLexer', 'AntlrLexer', 'AntlrPythonLexer',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
30 'AntlrPerlLexer', 'AntlrRubyLexer', 'AntlrCppLexer',
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
31 # 'AntlrCLexer',
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
32 'AntlrCSharpLexer', 'AntlrObjectiveCLexer',
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
33 'AntlrJavaLexer', 'AntlrActionScriptLexer',
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
34 'TreetopLexer', 'EbnfLexer']
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
35
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
36
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
37 class RagelLexer(RegexLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
38 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
39 A pure `Ragel <http://www.complang.org/ragel/>`_ lexer. Use this for
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
40 fragments of Ragel. For ``.rl`` files, use RagelEmbeddedLexer instead
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
41 (or one of the language-specific subclasses).
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
42
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
43 .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
44 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
45
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
46 name = 'Ragel'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
47 aliases = ['ragel']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
48 filenames = []
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
49
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
50 tokens = {
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
51 'whitespace': [
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
52 (r'\s+', Whitespace)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
53 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
54 'comments': [
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
55 (r'\#.*$', Comment),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
56 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
57 'keywords': [
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
58 (r'(access|action|alphtype)\b', Keyword),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
59 (r'(getkey|write|machine|include)\b', Keyword),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
60 (r'(any|ascii|extend|alpha|digit|alnum|lower|upper)\b', Keyword),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
61 (r'(xdigit|cntrl|graph|print|punct|space|zlen|empty)\b', Keyword)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
62 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
63 'numbers': [
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
64 (r'0x[0-9A-Fa-f]+', Number.Hex),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
65 (r'[+-]?[0-9]+', Number.Integer),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
66 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
67 'literals': [
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
68 (r'"(\\\\|\\"|[^"])*"', String), # double quote string
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
69 (r"'(\\\\|\\'|[^'])*'", String), # single quote string
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
70 (r'\[(\\\\|\\\]|[^\]])*\]', String), # square bracket literals
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
71 (r'/(?!\*)(\\\\|\\/|[^/])*/', String.Regex), # regular expressions
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
72 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
73 'identifiers': [
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
74 (r'[a-zA-Z_]\w*', Name.Variable),
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
75 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
76 'operators': [
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
77 (r',', Operator), # Join
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
78 (r'\||&|--?', Operator), # Union, Intersection and Subtraction
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
79 (r'\.|<:|:>>?', Operator), # Concatention
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
80 (r':', Operator), # Label
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
81 (r'->', Operator), # Epsilon Transition
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
82 (r'(>|\$|%|<|@|<>)(/|eof\b)', Operator), # EOF Actions
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
83 (r'(>|\$|%|<|@|<>)(!|err\b)', Operator), # Global Error Actions
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
84 (r'(>|\$|%|<|@|<>)(\^|lerr\b)', Operator), # Local Error Actions
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
85 (r'(>|\$|%|<|@|<>)(~|to\b)', Operator), # To-State Actions
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
86 (r'(>|\$|%|<|@|<>)(\*|from\b)', Operator), # From-State Actions
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
87 (r'>|@|\$|%', Operator), # Transition Actions and Priorities
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
88 (r'\*|\?|\+|\{[0-9]*,[0-9]*\}', Operator), # Repetition
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
89 (r'!|\^', Operator), # Negation
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
90 (r'\(|\)', Operator), # Grouping
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
91 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
92 'root': [
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
93 include('literals'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
94 include('whitespace'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
95 include('comments'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
96 include('keywords'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
97 include('numbers'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
98 include('identifiers'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
99 include('operators'),
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
100 (r'\{', Punctuation, 'host'),
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
101 (r'=', Operator),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
102 (r';', Punctuation),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
103 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
104 'host': [
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
105 (r'(' + r'|'.join(( # keep host code in largest possible chunks
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
106 r'[^{}\'"/#]+', # exclude unsafe characters
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
107 r'[^\\]\\[{}]', # allow escaped { or }
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
108
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
109 # strings and comments may safely contain unsafe characters
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
110 r'"(\\\\|\\"|[^"])*"', # double quote string
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
111 r"'(\\\\|\\'|[^'])*'", # single quote string
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
112 r'//.*$\n?', # single line comment
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
113 r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
114 r'\#.*$\n?', # ruby comment
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
115
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
116 # regular expression: There's no reason for it to start
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
117 # with a * and this stops confusion with comments.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
118 r'/(?!\*)(\\\\|\\/|[^/])*/',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
119
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
120 # / is safe now that we've handled regex and javadoc comments
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
121 r'/',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
122 )) + r')+', Other),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
123
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
124 (r'\{', Punctuation, '#push'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
125 (r'\}', Punctuation, '#pop'),
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
126 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
127 }
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
128
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
129
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
130 class RagelEmbeddedLexer(RegexLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
131 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
132 A lexer for `Ragel`_ embedded in a host language file.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
133
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
134 This will only highlight Ragel statements. If you want host language
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
135 highlighting then call the language-specific Ragel lexer.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
136
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
137 .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
138 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
139
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
140 name = 'Embedded Ragel'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
141 aliases = ['ragel-em']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
142 filenames = ['*.rl']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
143
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
144 tokens = {
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
145 'root': [
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
146 (r'(' + r'|'.join(( # keep host code in largest possible chunks
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
147 r'[^%\'"/#]+', # exclude unsafe characters
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
148 r'%(?=[^%]|$)', # a single % sign is okay, just not 2 of them
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
149
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
150 # strings and comments may safely contain unsafe characters
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
151 r'"(\\\\|\\"|[^"])*"', # double quote string
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
152 r"'(\\\\|\\'|[^'])*'", # single quote string
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
153 r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
154 r'//.*$\n?', # single line comment
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
155 r'\#.*$\n?', # ruby/ragel comment
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
156 r'/(?!\*)(\\\\|\\/|[^/])*/', # regular expression
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
157
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
158 # / is safe now that we've handled regex and javadoc comments
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
159 r'/',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
160 )) + r')+', Other),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
161
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
162 # Single Line FSM.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
163 # Please don't put a quoted newline in a single line FSM.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
164 # That's just mean. It will break this.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
165 (r'(%%)(?![{%])(.*)($|;)(\n?)', bygroups(Punctuation,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
166 using(RagelLexer),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
167 Punctuation, Text)),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
168
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
169 # Multi Line FSM.
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
170 (r'(%%%%|%%)\{', Punctuation, 'multi-line-fsm'),
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
171 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
172 'multi-line-fsm': [
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
173 (r'(' + r'|'.join(( # keep ragel code in largest possible chunks.
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
174 r'(' + r'|'.join((
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
175 r'[^}\'"\[/#]', # exclude unsafe characters
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
176 r'\}(?=[^%]|$)', # } is okay as long as it's not followed by %
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
177 r'\}%(?=[^%]|$)', # ...well, one %'s okay, just not two...
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
178 r'[^\\]\\[{}]', # ...and } is okay if it's escaped
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
179
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
180 # allow / if it's preceded with one of these symbols
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
181 # (ragel EOF actions)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
182 r'(>|\$|%|<|@|<>)/',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
183
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
184 # specifically allow regex followed immediately by *
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
185 # so it doesn't get mistaken for a comment
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
186 r'/(?!\*)(\\\\|\\/|[^/])*/\*',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
187
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
188 # allow / as long as it's not followed by another / or by a *
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
189 r'/(?=[^/*]|$)',
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
190
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
191 # We want to match as many of these as we can in one block.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
192 # Not sure if we need the + sign here,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
193 # does it help performance?
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
194 )) + r')+',
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
195
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
196 # strings and comments may safely contain unsafe characters
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
197 r'"(\\\\|\\"|[^"])*"', # double quote string
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
198 r"'(\\\\|\\'|[^'])*'", # single quote string
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
199 r"\[(\\\\|\\\]|[^\]])*\]", # square bracket literal
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
200 r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
201 r'//.*$\n?', # single line comment
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
202 r'\#.*$\n?', # ruby/ragel comment
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
203 )) + r')+', using(RagelLexer)),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
204
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
205 (r'\}%%', Punctuation, '#pop'),
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
206 ]
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
207 }
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
208
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
209 def analyse_text(text):
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
210 return '@LANG: indep' in text
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
211
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
212
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
213 class RagelRubyLexer(DelegatingLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
214 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
215 A lexer for `Ragel`_ in a Ruby host file.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
216
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
217 .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
218 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
219
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
220 name = 'Ragel in Ruby Host'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
221 aliases = ['ragel-ruby', 'ragel-rb']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
222 filenames = ['*.rl']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
223
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
224 def __init__(self, **options):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
225 super(RagelRubyLexer, self).__init__(RubyLexer, RagelEmbeddedLexer,
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
226 **options)
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
227
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
228 def analyse_text(text):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
229 return '@LANG: ruby' in text
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
230
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
231
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
232 class RagelCLexer(DelegatingLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
233 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
234 A lexer for `Ragel`_ in a C host file.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
235
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
236 .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
237 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
238
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
239 name = 'Ragel in C Host'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
240 aliases = ['ragel-c']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
241 filenames = ['*.rl']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
242
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
243 def __init__(self, **options):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
244 super(RagelCLexer, self).__init__(CLexer, RagelEmbeddedLexer,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
245 **options)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
246
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
247 def analyse_text(text):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
248 return '@LANG: c' in text
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
249
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
250
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
251 class RagelDLexer(DelegatingLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
252 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
253 A lexer for `Ragel`_ in a D host file.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
254
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
255 .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
256 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
257
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
258 name = 'Ragel in D Host'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
259 aliases = ['ragel-d']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
260 filenames = ['*.rl']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
261
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
262 def __init__(self, **options):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
263 super(RagelDLexer, self).__init__(DLexer, RagelEmbeddedLexer, **options)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
264
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
265 def analyse_text(text):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
266 return '@LANG: d' in text
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
267
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
268
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
269 class RagelCppLexer(DelegatingLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
270 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
271 A lexer for `Ragel`_ in a CPP host file.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
272
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
273 .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
274 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
275
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
276 name = 'Ragel in CPP Host'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
277 aliases = ['ragel-cpp']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
278 filenames = ['*.rl']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
279
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
280 def __init__(self, **options):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
281 super(RagelCppLexer, self).__init__(CppLexer, RagelEmbeddedLexer, **options)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
282
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
283 def analyse_text(text):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
284 return '@LANG: c++' in text
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
285
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
286
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
287 class RagelObjectiveCLexer(DelegatingLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
288 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
289 A lexer for `Ragel`_ in an Objective C host file.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
290
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
291 .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
292 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
293
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
294 name = 'Ragel in Objective C Host'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
295 aliases = ['ragel-objc']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
296 filenames = ['*.rl']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
297
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
298 def __init__(self, **options):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
299 super(RagelObjectiveCLexer, self).__init__(ObjectiveCLexer,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
300 RagelEmbeddedLexer,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
301 **options)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
302
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
303 def analyse_text(text):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
304 return '@LANG: objc' in text
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
305
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
306
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
307 class RagelJavaLexer(DelegatingLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
308 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
309 A lexer for `Ragel`_ in a Java host file.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
310
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
311 .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
312 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
313
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
314 name = 'Ragel in Java Host'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
315 aliases = ['ragel-java']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
316 filenames = ['*.rl']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
317
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
318 def __init__(self, **options):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
319 super(RagelJavaLexer, self).__init__(JavaLexer, RagelEmbeddedLexer,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
320 **options)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
321
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
322 def analyse_text(text):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
323 return '@LANG: java' in text
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
324
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
325
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
326 class AntlrLexer(RegexLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
327 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
328 Generic `ANTLR`_ Lexer.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
329 Should not be called directly, instead
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
330 use DelegatingLexer for your target language.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
331
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
332 .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
333
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
334 .. _ANTLR: http://www.antlr.org/
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
335 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
336
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
337 name = 'ANTLR'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
338 aliases = ['antlr']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
339 filenames = []
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
340
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
341 _id = r'[A-Za-z]\w*'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
342 _TOKEN_REF = r'[A-Z]\w*'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
343 _RULE_REF = r'[a-z]\w*'
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
344 _STRING_LITERAL = r'\'(?:\\\\|\\\'|[^\']*)\''
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
345 _INT = r'[0-9]+'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
346
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
347 tokens = {
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
348 'whitespace': [
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
349 (r'\s+', Whitespace),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
350 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
351 'comments': [
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
352 (r'//.*$', Comment),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
353 (r'/\*(.|\n)*?\*/', Comment),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
354 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
355 'root': [
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
356 include('whitespace'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
357 include('comments'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
358
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
359 (r'(lexer|parser|tree)?(\s*)(grammar\b)(\s*)(' + _id + ')(;)',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
360 bygroups(Keyword, Whitespace, Keyword, Whitespace, Name.Class,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
361 Punctuation)),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
362 # optionsSpec
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
363 (r'options\b', Keyword, 'options'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
364 # tokensSpec
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
365 (r'tokens\b', Keyword, 'tokens'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
366 # attrScope
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
367 (r'(scope)(\s*)(' + _id + ')(\s*)(\{)',
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
368 bygroups(Keyword, Whitespace, Name.Variable, Whitespace,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
369 Punctuation), 'action'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
370 # exception
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
371 (r'(catch|finally)\b', Keyword, 'exception'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
372 # action
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
373 (r'(@' + _id + ')(\s*)(::)?(\s*)(' + _id + ')(\s*)(\{)',
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
374 bygroups(Name.Label, Whitespace, Punctuation, Whitespace,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
375 Name.Label, Whitespace, Punctuation), 'action'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
376 # rule
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
377 (r'((?:protected|private|public|fragment)\b)?(\s*)(' + _id + ')(!)?',
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
378 bygroups(Keyword, Whitespace, Name.Label, Punctuation),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
379 ('rule-alts', 'rule-prelims')),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
380 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
381 'exception': [
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
382 (r'\n', Whitespace, '#pop'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
383 (r'\s', Whitespace),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
384 include('comments'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
385
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
386 (r'\[', Punctuation, 'nested-arg-action'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
387 (r'\{', Punctuation, 'action'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
388 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
389 'rule-prelims': [
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
390 include('whitespace'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
391 include('comments'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
392
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
393 (r'returns\b', Keyword),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
394 (r'\[', Punctuation, 'nested-arg-action'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
395 (r'\{', Punctuation, 'action'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
396 # throwsSpec
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
397 (r'(throws)(\s+)(' + _id + ')',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
398 bygroups(Keyword, Whitespace, Name.Label)),
6009
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
399 (r'(,)(\s*)(' + _id + ')',
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
400 bygroups(Punctuation, Whitespace, Name.Label)), # Additional throws
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
401 # optionsSpec
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
402 (r'options\b', Keyword, 'options'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
403 # ruleScopeSpec - scope followed by target language code or name of action
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
404 # TODO finish implementing other possibilities for scope
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
405 # L173 ANTLRv3.g from ANTLR book
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
406 (r'(scope)(\s+)(\{)', bygroups(Keyword, Whitespace, Punctuation),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
407 'action'),
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
408 (r'(scope)(\s+)(' + _id + ')(\s*)(;)',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
409 bygroups(Keyword, Whitespace, Name.Label, Whitespace, Punctuation)),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
410 # ruleAction
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
411 (r'(@' + _id + ')(\s*)(\{)',
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
412 bygroups(Name.Label, Whitespace, Punctuation), 'action'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
413 # finished prelims, go to rule alts!
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
414 (r':', Punctuation, '#pop')
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
415 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
416 'rule-alts': [
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
417 include('whitespace'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
418 include('comments'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
419
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
420 # These might need to go in a separate 'block' state triggered by (
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
421 (r'options\b', Keyword, 'options'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
422 (r':', Punctuation),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
423
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
424 # literals
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
425 (r"'(\\\\|\\'|[^'])*'", String),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
426 (r'"(\\\\|\\"|[^"])*"', String),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
427 (r'<<([^>]|>[^>])>>', String),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
428 # identifiers
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
429 # Tokens start with capital letter.
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
430 (r'\$?[A-Z_]\w*', Name.Constant),
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
431 # Rules start with small letter.
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
432 (r'\$?[a-z_]\w*', Name.Variable),
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
433 # operators
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
434 (r'(\+|\||->|=>|=|\(|\)|\.\.|\.|\?|\*|\^|!|\#|~)', Operator),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
435 (r',', Punctuation),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
436 (r'\[', Punctuation, 'nested-arg-action'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
437 (r'\{', Punctuation, 'action'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
438 (r';', Punctuation, '#pop')
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
439 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
440 'tokens': [
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
441 include('whitespace'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
442 include('comments'),
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
443 (r'\{', Punctuation),
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
444 (r'(' + _TOKEN_REF + r')(\s*)(=)?(\s*)(' + _STRING_LITERAL
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
445 + ')?(\s*)(;)',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
446 bygroups(Name.Label, Whitespace, Punctuation, Whitespace,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
447 String, Whitespace, Punctuation)),
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
448 (r'\}', Punctuation, '#pop'),
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
449 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
450 'options': [
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
451 include('whitespace'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
452 include('comments'),
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
453 (r'\{', Punctuation),
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
454 (r'(' + _id + r')(\s*)(=)(\s*)(' +
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
455 '|'.join((_id, _STRING_LITERAL, _INT, '\*')) + ')(\s*)(;)',
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
456 bygroups(Name.Variable, Whitespace, Punctuation, Whitespace,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
457 Text, Whitespace, Punctuation)),
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
458 (r'\}', Punctuation, '#pop'),
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
459 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
460 'action': [
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
461 (r'(' + r'|'.join(( # keep host code in largest possible chunks
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
462 r'[^${}\'"/\\]+', # exclude unsafe characters
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
463
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
464 # strings and comments may safely contain unsafe characters
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
465 r'"(\\\\|\\"|[^"])*"', # double quote string
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
466 r"'(\\\\|\\'|[^'])*'", # single quote string
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
467 r'//.*$\n?', # single line comment
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
468 r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
469
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
470 # regular expression: There's no reason for it to start
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
471 # with a * and this stops confusion with comments.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
472 r'/(?!\*)(\\\\|\\/|[^/])*/',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
473
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
474 # backslashes are okay, as long as we are not backslashing a %
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
475 r'\\(?!%)',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
476
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
477 # Now that we've handled regex and javadoc comments
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
478 # it's safe to let / through.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
479 r'/',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
480 )) + r')+', Other),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
481 (r'(\\)(%)', bygroups(Punctuation, Other)),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
482 (r'(\$[a-zA-Z]+)(\.?)(text|value)?',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
483 bygroups(Name.Variable, Punctuation, Name.Property)),
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
484 (r'\{', Punctuation, '#push'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
485 (r'\}', Punctuation, '#pop'),
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
486 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
487 'nested-arg-action': [
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
488 (r'(' + r'|'.join(( # keep host code in largest possible chunks.
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
489 r'[^$\[\]\'"/]+', # exclude unsafe characters
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
490
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
491 # strings and comments may safely contain unsafe characters
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
492 r'"(\\\\|\\"|[^"])*"', # double quote string
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
493 r"'(\\\\|\\'|[^'])*'", # single quote string
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
494 r'//.*$\n?', # single line comment
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
495 r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
496
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
497 # regular expression: There's no reason for it to start
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
498 # with a * and this stops confusion with comments.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
499 r'/(?!\*)(\\\\|\\/|[^/])*/',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
500
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
501 # Now that we've handled regex and javadoc comments
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
502 # it's safe to let / through.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
503 r'/',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
504 )) + r')+', Other),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
505
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
506
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
507 (r'\[', Punctuation, '#push'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
508 (r'\]', Punctuation, '#pop'),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
509 (r'(\$[a-zA-Z]+)(\.?)(text|value)?',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
510 bygroups(Name.Variable, Punctuation, Name.Property)),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
511 (r'(\\\\|\\\]|\\\[|[^\[\]])+', Other),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
512 ]
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
513 }
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
514
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
515 def analyse_text(text):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
516 return re.search(r'^\s*grammar\s+[a-zA-Z0-9]+\s*;', text, re.M)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
517
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
518 # http://www.antlr.org/wiki/display/ANTLR3/Code+Generation+Targets
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
519
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
520 # TH: I'm not aware of any language features of C++ that will cause
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
521 # incorrect lexing of C files. Antlr doesn't appear to make a distinction,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
522 # so just assume they're C++. No idea how to make Objective C work in the
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
523 # future.
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
524
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
525 # class AntlrCLexer(DelegatingLexer):
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
526 # """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
527 # ANTLR with C Target
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
528 #
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
529 # .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
530 # """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
531 #
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
532 # name = 'ANTLR With C Target'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
533 # aliases = ['antlr-c']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
534 # filenames = ['*.G', '*.g']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
535 #
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
536 # def __init__(self, **options):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
537 # super(AntlrCLexer, self).__init__(CLexer, AntlrLexer, **options)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
538 #
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
539 # def analyse_text(text):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
540 # return re.match(r'^\s*language\s*=\s*C\s*;', text)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
541
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
542
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
543 class AntlrCppLexer(DelegatingLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
544 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
545 `ANTLR`_ with CPP Target
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
546
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
547 .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
548 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
549
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
550 name = 'ANTLR With CPP Target'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
551 aliases = ['antlr-cpp']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
552 filenames = ['*.G', '*.g']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
553
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
554 def __init__(self, **options):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
555 super(AntlrCppLexer, self).__init__(CppLexer, AntlrLexer, **options)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
556
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
557 def analyse_text(text):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
558 return AntlrLexer.analyse_text(text) and \
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
559 re.search(r'^\s*language\s*=\s*C\s*;', text, re.M)
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
560
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
561
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
562 class AntlrObjectiveCLexer(DelegatingLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
563 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
564 `ANTLR`_ with Objective-C Target
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
565
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
566 .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
567 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
568
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
569 name = 'ANTLR With ObjectiveC Target'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
570 aliases = ['antlr-objc']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
571 filenames = ['*.G', '*.g']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
572
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
573 def __init__(self, **options):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
574 super(AntlrObjectiveCLexer, self).__init__(ObjectiveCLexer,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
575 AntlrLexer, **options)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
576
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
577 def analyse_text(text):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
578 return AntlrLexer.analyse_text(text) and \
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
579 re.search(r'^\s*language\s*=\s*ObjC\s*;', text)
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
580
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
581
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
582 class AntlrCSharpLexer(DelegatingLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
583 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
584 `ANTLR`_ with C# Target
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
585
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
586 .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
587 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
588
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
589 name = 'ANTLR With C# Target'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
590 aliases = ['antlr-csharp', 'antlr-c#']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
591 filenames = ['*.G', '*.g']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
592
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
593 def __init__(self, **options):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
594 super(AntlrCSharpLexer, self).__init__(CSharpLexer, AntlrLexer,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
595 **options)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
596
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
597 def analyse_text(text):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
598 return AntlrLexer.analyse_text(text) and \
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
599 re.search(r'^\s*language\s*=\s*CSharp2\s*;', text, re.M)
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
600
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
601
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
602 class AntlrPythonLexer(DelegatingLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
603 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
604 `ANTLR`_ with Python Target
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
605
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
606 .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
607 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
608
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
609 name = 'ANTLR With Python Target'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
610 aliases = ['antlr-python']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
611 filenames = ['*.G', '*.g']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
612
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
613 def __init__(self, **options):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
614 super(AntlrPythonLexer, self).__init__(PythonLexer, AntlrLexer,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
615 **options)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
616
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
617 def analyse_text(text):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
618 return AntlrLexer.analyse_text(text) and \
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
619 re.search(r'^\s*language\s*=\s*Python\s*;', text, re.M)
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
620
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
621
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
622 class AntlrJavaLexer(DelegatingLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
623 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
624 `ANTLR`_ with Java Target
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
625
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
626 .. versionadded:: 1.
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
627 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
628
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
629 name = 'ANTLR With Java Target'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
630 aliases = ['antlr-java']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
631 filenames = ['*.G', '*.g']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
632
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
633 def __init__(self, **options):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
634 super(AntlrJavaLexer, self).__init__(JavaLexer, AntlrLexer,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
635 **options)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
636
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
637 def analyse_text(text):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
638 # Antlr language is Java by default
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
639 return AntlrLexer.analyse_text(text) and 0.9
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
640
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
641
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
642 class AntlrRubyLexer(DelegatingLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
643 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
644 `ANTLR`_ with Ruby Target
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
645
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
646 .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
647 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
648
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
649 name = 'ANTLR With Ruby Target'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
650 aliases = ['antlr-ruby', 'antlr-rb']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
651 filenames = ['*.G', '*.g']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
652
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
653 def __init__(self, **options):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
654 super(AntlrRubyLexer, self).__init__(RubyLexer, AntlrLexer,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
655 **options)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
656
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
657 def analyse_text(text):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
658 return AntlrLexer.analyse_text(text) and \
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
659 re.search(r'^\s*language\s*=\s*Ruby\s*;', text, re.M)
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
660
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
661
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
662 class AntlrPerlLexer(DelegatingLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
663 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
664 `ANTLR`_ with Perl Target
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
665
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
666 .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
667 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
668
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
669 name = 'ANTLR With Perl Target'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
670 aliases = ['antlr-perl']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
671 filenames = ['*.G', '*.g']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
672
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
673 def __init__(self, **options):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
674 super(AntlrPerlLexer, self).__init__(PerlLexer, AntlrLexer,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
675 **options)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
676
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
677 def analyse_text(text):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
678 return AntlrLexer.analyse_text(text) and \
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
679 re.search(r'^\s*language\s*=\s*Perl5\s*;', text, re.M)
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
680
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
681
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
682 class AntlrActionScriptLexer(DelegatingLexer):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
683 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
684 `ANTLR`_ with ActionScript Target
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
685
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
686 .. versionadded:: 1.1
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
687 """
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
688
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
689 name = 'ANTLR With ActionScript Target'
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
690 aliases = ['antlr-as', 'antlr-actionscript']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
691 filenames = ['*.G', '*.g']
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
692
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
693 def __init__(self, **options):
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
694 from pygments.lexers.actionscript import ActionScriptLexer
5184
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
695 super(AntlrActionScriptLexer, self).__init__(ActionScriptLexer,
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
696 AntlrLexer, **options)
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
697
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
698 def analyse_text(text):
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
699 return AntlrLexer.analyse_text(text) and \
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
700 re.search(r'^\s*language\s*=\s*ActionScript\s*;', text, re.M)
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
701
6009
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
702
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
703 class TreetopBaseLexer(RegexLexer):
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
704 """
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
705 A base lexer for `Treetop <http://treetop.rubyforge.org/>`_ grammars.
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
706 Not for direct use; use TreetopLexer instead.
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
707
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
708 .. versionadded:: 1.6
6009
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
709 """
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
710
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
711 tokens = {
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
712 'root': [
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
713 include('space'),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
714 (r'require[ \t]+[^\n\r]+[\n\r]', Other),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
715 (r'module\b', Keyword.Namespace, 'module'),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
716 (r'grammar\b', Keyword, 'grammar'),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
717 ],
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
718 'module': [
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
719 include('space'),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
720 include('end'),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
721 (r'module\b', Keyword, '#push'),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
722 (r'grammar\b', Keyword, 'grammar'),
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
723 (r'[A-Z]\w*(?:::[A-Z]\w*)*', Name.Namespace),
6009
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
724 ],
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
725 'grammar': [
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
726 include('space'),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
727 include('end'),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
728 (r'rule\b', Keyword, 'rule'),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
729 (r'include\b', Keyword, 'include'),
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
730 (r'[A-Z]\w*', Name),
6009
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
731 ],
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
732 'include': [
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
733 include('space'),
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
734 (r'[A-Z]\w*(?:::[A-Z]\w*)*', Name.Class, '#pop'),
6009
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
735 ],
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
736 'rule': [
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
737 include('space'),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
738 include('end'),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
739 (r'"(\\\\|\\"|[^"])*"', String.Double),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
740 (r"'(\\\\|\\'|[^'])*'", String.Single),
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
741 (r'([A-Za-z_]\w*)(:)', bygroups(Name.Label, Punctuation)),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
742 (r'[A-Za-z_]\w*', Name),
6009
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
743 (r'[()]', Punctuation),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
744 (r'[?+*/&!~]', Operator),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
745 (r'\[(?:\\.|\[:\^?[a-z]+:\]|[^\\\]])+\]', String.Regex),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
746 (r'([0-9]*)(\.\.)([0-9]*)',
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
747 bygroups(Number.Integer, Operator, Number.Integer)),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
748 (r'(<)([^>]+)(>)', bygroups(Punctuation, Name.Class, Punctuation)),
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
749 (r'\{', Punctuation, 'inline_module'),
6009
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
750 (r'\.', String.Regex),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
751 ],
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
752 'inline_module': [
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
753 (r'\{', Other, 'ruby'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
754 (r'\}', Punctuation, '#pop'),
6009
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
755 (r'[^{}]+', Other),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
756 ],
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
757 'ruby': [
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
758 (r'\{', Other, '#push'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
759 (r'\}', Other, '#pop'),
6009
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
760 (r'[^{}]+', Other),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
761 ],
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
762 'space': [
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
763 (r'[ \t\n\r]+', Whitespace),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
764 (r'#[^\n]*', Comment.Single),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
765 ],
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
766 'end': [
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
767 (r'end\b', Keyword, '#pop'),
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
768 ],
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
769 }
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
770
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
771
6009
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
772 class TreetopLexer(DelegatingLexer):
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
773 """
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
774 A lexer for `Treetop <http://treetop.rubyforge.org/>`_ grammars.
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
775
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
776 .. versionadded:: 1.6
6009
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
777 """
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
778
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
779 name = 'Treetop'
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
780 aliases = ['treetop']
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
781 filenames = ['*.treetop', '*.tt']
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
782
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
783 def __init__(self, **options):
b48a69886ca4 upgrade bundled pygments to 1.6
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5614
diff changeset
784 super(TreetopLexer, self).__init__(RubyLexer, TreetopBaseLexer, **options)
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
785
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
786
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
787 class EbnfLexer(RegexLexer):
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
788 """
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
789 Lexer for `ISO/IEC 14977 EBNF
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
790 <http://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form>`_
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
791 grammars.
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
792
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
793 .. versionadded:: 2.0
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
794 """
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
795
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
796 name = 'EBNF'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
797 aliases = ['ebnf']
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
798 filenames = ['*.ebnf']
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
799 mimetypes = ['text/x-ebnf']
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
800
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
801 tokens = {
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
802 'root': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
803 include('whitespace'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
804 include('comment_start'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
805 include('identifier'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
806 (r'=', Operator, 'production'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
807 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
808 'production': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
809 include('whitespace'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
810 include('comment_start'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
811 include('identifier'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
812 (r'"[^"]*"', String.Double),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
813 (r"'[^']*'", String.Single),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
814 (r'(\?[^?]*\?)', Name.Entity),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
815 (r'[\[\]{}(),|]', Punctuation),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
816 (r'-', Operator),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
817 (r';', Punctuation, '#pop'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
818 (r'\.', Punctuation, '#pop'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
819 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
820 'whitespace': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
821 (r'\s+', Text),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
822 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
823 'comment_start': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
824 (r'\(\*', Comment.Multiline, 'comment'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
825 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
826 'comment': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
827 (r'[^*)]', Comment.Multiline),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
828 include('comment_start'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
829 (r'\*\)', Comment.Multiline, '#pop'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
830 (r'[*)]', Comment.Multiline),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
831 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
832 'identifier': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
833 (r'([a-zA-Z][\w \-]*)', Keyword),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
834 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 6009
diff changeset
835 }