annotate MoinMoin/support/pygments/lexers/parsers.py @ 5614:f76914e77229

upgrade pygments to 1.3.1
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 07 Mar 2010 21:36:31 +0100
parents 74fa6f714526
children b48a69886ca4
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
5564
74fa6f714526 upgraded pygments to 1.2.2
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5184
diff changeset
8 :copyright: Copyright 2006-2010 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, \
f76914e77229 upgrade pygments to 1.3.1
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5564
diff changeset
17 Keyword, Name, String, Number, Whitespace
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
18 from pygments.lexers.compiled import JavaLexer, CLexer, CppLexer, \
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
19 ObjectiveCLexer, DLexer
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
20 from pygments.lexers.dotnet import CSharpLexer
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
21 from pygments.lexers.agile import RubyLexer, PythonLexer, PerlLexer
0970ed47d2cd updated pygments 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.web import ActionScriptLexer
5614
f76914e77229 upgrade pygments to 1.3.1
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5564
diff changeset
23
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
24
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
25 __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
26 '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
27 '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
28 'AntlrPerlLexer', 'AntlrRubyLexer', 'AntlrCppLexer',
0970ed47d2cd updated pygments 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 #'AntlrCLexer',
0970ed47d2cd updated pygments 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 'AntlrCSharpLexer', 'AntlrObjectiveCLexer',
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
31 'AntlrJavaLexer', "AntlrActionScriptLexer"]
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
33
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
34 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
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 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
37 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
38 (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
39
0970ed47d2cd updated pygments 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 *New in Pygments 1.1.*
0970ed47d2cd updated pygments 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 """
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
43 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
44 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
45 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
46
0970ed47d2cd updated pygments 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 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
48 '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
49 (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
50 ],
0970ed47d2cd updated pygments 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 '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
52 (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
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 '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
55 (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
56 (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
57 (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
58 (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
59 ],
0970ed47d2cd updated pygments 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 '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
61 (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
62 (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
63 ],
0970ed47d2cd updated pygments 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 '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
65 (r'"(\\\\|\\"|[^"])*"', String), # double quote 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
66 (r"'(\\\\|\\'|[^'])*'", String), # single quote 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
67 (r'\[(\\\\|\\\]|[^\]])*\]', String), # square bracket 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
68 (r'/(?!\*)(\\\\|\\/|[^/])*/', String.Regex), # regular expressions
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
69 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
70 '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
71 (r'[a-zA-Z_][a-zA-Z_0-9]*', Name.Variable),
0970ed47d2cd updated pygments 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 '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
74 (r',', Operator), # Join
0970ed47d2cd updated pygments 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 (r'\||&|-|--', Operator), # Union, Intersection and Subtraction
0970ed47d2cd updated pygments 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 (r'\.|<:|:>|:>>', Operator), # Concatention
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
77 (r':', Operator), # Label
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
78 (r'->', Operator), # Epsilon Transition
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
79 (r'(>|\$|%|<|@|<>)(/|eof\b)', Operator), # 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
80 (r'(>|\$|%|<|@|<>)(!|err\b)', Operator), # Global Error 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
81 (r'(>|\$|%|<|@|<>)(\^|lerr\b)', Operator), # Local Error 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
82 (r'(>|\$|%|<|@|<>)(~|to\b)', Operator), # To-State 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
83 (r'(>|\$|%|<|@|<>)(\*|from\b)', Operator), # From-State 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
84 (r'>|@|\$|%', Operator), # Transition Actions and Priorities
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
85 (r'\*|\?|\+|{[0-9]*,[0-9]*}', Operator), # Repetition
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
86 (r'!|\^', Operator), # Negation
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
87 (r'\(|\)', Operator), # Grouping
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
88 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
89 '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
90 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
91 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
92 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
93 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
94 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
95 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
96 include('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
97 (r'{', Punctuation, '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
98 (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
99 (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
100 ],
0970ed47d2cd updated pygments 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 '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
102 (r'(' + r'|'.join(( # keep host code in largest possible chunks
0970ed47d2cd updated pygments 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 r'[^{}\'"/#]+', # exclude unsafe characters
0970ed47d2cd updated pygments 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 r'[^\\][\\][{}]', # allow escaped { or }
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
105
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
106 # strings and comments may safely contain unsafe characters
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
107 r'"(\\\\|\\"|[^"])*"', # double quote 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
108 r"'(\\\\|\\'|[^'])*'", # single quote 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
109 r'//.*$\n?', # single line 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
110 r'/\*(.|\n)*?\*/', # multi-line javadoc-style 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
111 r'\#.*$\n?', # ruby 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
112
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
113 # 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
114 # 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
115 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
116
0970ed47d2cd updated pygments 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 # / 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
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 )) + 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
120
0970ed47d2cd updated pygments 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'{', 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
122 (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
123 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
124 }
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
125
0970ed47d2cd updated pygments 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 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
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 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
130
0970ed47d2cd updated pygments 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 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
132 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
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 *New in Pygments 1.1.*
0970ed47d2cd updated pygments 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 """
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
137 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
138 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
139 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
140
0970ed47d2cd updated pygments 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 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
142 '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
143 (r'(' + r'|'.join(( # keep host code in largest possible chunks
0970ed47d2cd updated pygments 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 r'[^%\'"/#]+', # exclude unsafe characters
0970ed47d2cd updated pygments 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 r'%(?=[^%]|$)', # a single % sign is okay, just not 2 of them
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
146
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
147 # strings and comments may safely contain unsafe characters
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
148 r'"(\\\\|\\"|[^"])*"', # double quote 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
149 r"'(\\\\|\\'|[^'])*'", # single quote 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
150 r'/\*(.|\n)*?\*/', # multi-line javadoc-style 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
151 r'//.*$\n?', # single line 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
152 r'\#.*$\n?', # ruby/ragel 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
153 r'/(?!\*)(\\\\|\\/|[^/])*/', # regular expression
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
154
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
155 # / 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
156 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
157 )) + 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
158
0970ed47d2cd updated pygments 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 # 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
160 # 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
161 # 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
162 (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
163 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
164 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
165
0970ed47d2cd updated pygments 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 # Multi 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
167 (r'(%%%%|%%){', Punctuation, 'multi-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
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': [
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
170 (r'(' + r'|'.join(( # keep ragel code in largest possible chunks.
0970ed47d2cd updated pygments 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 r'(' + r'|'.join((
0970ed47d2cd updated pygments 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 r'[^}\'"\[/#]', # exclude unsafe characters
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
173 r'}(?=[^%]|$)', # } is okay as long as it's not followed 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
174 r'}%(?=[^%]|$)', # ...well, one %'s okay, just not two...
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
175 r'[^\\][\\][{}]', # ...and } is okay if it's escaped
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
176
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
177 # 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
178 # (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
179 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
180
0970ed47d2cd updated pygments 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 # 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
182 # 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
183 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
184
0970ed47d2cd updated pygments 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 # allow / as long as it's not followed by another / or by 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
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 # 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
189 # 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
190 # does it help performance?
0970ed47d2cd updated pygments 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 )) + 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
192
0970ed47d2cd updated pygments 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 # strings and comments may safely contain unsafe characters
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
194 r'"(\\\\|\\"|[^"])*"', # double quote 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
195 r"'(\\\\|\\'|[^'])*'", # single quote 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
196 r"\[(\\\\|\\\]|[^\]])*\]", # square bracket 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
197 r'/\*(.|\n)*?\*/', # multi-line javadoc-style 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
198 r'//.*$\n?', # single line 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
199 r'\#.*$\n?', # ruby/ragel 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
200 )) + 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
201
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
202 (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
203 ]
0970ed47d2cd updated pygments 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 }
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
205
0970ed47d2cd updated pygments 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 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
207 return '@LANG: indep' in text or 0.1
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
210 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
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 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
213
0970ed47d2cd updated pygments 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 *New in Pygments 1.1.*
0970ed47d2cd updated pygments 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 """
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
217 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
218 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
219 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
220
0970ed47d2cd updated pygments 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 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
222 super(RagelRubyLexer, self).__init__(RubyLexer, 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
223 **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
224
0970ed47d2cd updated pygments 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 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
226 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
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
0970ed47d2cd updated pygments 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 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
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 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
232
0970ed47d2cd updated pygments 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 *New in Pygments 1.1.*
0970ed47d2cd updated pygments 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 """
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
236 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
237 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
238 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
239
0970ed47d2cd updated pygments 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 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
241 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
242 **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
243
0970ed47d2cd updated pygments 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 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
245 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
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
0970ed47d2cd updated pygments 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 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
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 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
251
0970ed47d2cd updated pygments 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 *New in Pygments 1.1.*
0970ed47d2cd updated pygments 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 """
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
255 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
256 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
257 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
258
0970ed47d2cd updated pygments 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 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
260 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
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 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
263 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
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
0970ed47d2cd updated pygments 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 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
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 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
269
0970ed47d2cd updated pygments 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 *New in Pygments 1.1.*
0970ed47d2cd updated pygments 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 """
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
273 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
274 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
275 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
276
0970ed47d2cd updated pygments 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 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
278 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
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 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
281 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
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
0970ed47d2cd updated pygments 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 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
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 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
287
0970ed47d2cd updated pygments 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 *New in Pygments 1.1.*
0970ed47d2cd updated pygments 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 """
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
291 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
292 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
293 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
294
0970ed47d2cd updated pygments 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 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
296 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
297 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
298 **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
0970ed47d2cd updated pygments 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 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
301 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
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
0970ed47d2cd updated pygments 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 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
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 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
307
0970ed47d2cd updated pygments 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 *New in Pygments 1.1.*
0970ed47d2cd updated pygments 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 """
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
311 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
312 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
313 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
314
0970ed47d2cd updated pygments 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 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
316 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
317 **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
318
0970ed47d2cd updated pygments 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 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
320 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
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
0970ed47d2cd updated pygments 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 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
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 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
326 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
327 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
328
0970ed47d2cd updated pygments 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 *New in Pygments 1.1.*
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments 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 .. _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
332 """
0970ed47d2cd updated pygments 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 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
335 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
336 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
337
0970ed47d2cd updated pygments 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 _id = r'[A-Za-z][A-Za-z_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
339 _TOKEN_REF = r'[A-Z][A-Za-z_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
340 _RULE_REF = r'[a-z][A-Za-z_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
341 _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
342 _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
343
0970ed47d2cd updated pygments 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 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
345 '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
346 (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
347 ],
0970ed47d2cd updated pygments 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 '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
349 (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
350 (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
351 ],
0970ed47d2cd updated pygments 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 '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
353 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
354 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
355
0970ed47d2cd updated pygments 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 (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
357 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
358 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
359 # 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
360 (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
361 # 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
362 (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
363 # attrScope
0970ed47d2cd updated pygments 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 (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
365 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
366 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
367 # 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
368 (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
369 # 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 (r'(@' + _id + ')(\s*)(::)?(\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
371 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
372 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
373 # rule
0970ed47d2cd updated pygments 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 (r'((?:protected|private|public|fragment)\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
375 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
376 ('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
377 ],
0970ed47d2cd updated pygments 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 '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
379 (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
380 (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
381 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
382
0970ed47d2cd updated pygments 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'\[', 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
384 (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
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 '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
387 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
388 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
389
0970ed47d2cd updated pygments 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 (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
391 (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
392 (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
393 # 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
394 (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
395 bygroups(Keyword, Whitespace, Name.Label)),
0970ed47d2cd updated pygments 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 (r'(?:(,)(\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
397 bygroups(Punctuation, Whitespace, Name.Label)), # Additional throws
0970ed47d2cd updated pygments 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 # 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
399 (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
400 # 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
401 # 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
402 # L173 ANTLRv3.g from ANTLR book
0970ed47d2cd updated pygments 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 (r'(scope)(\s+)({)', bygroups(Keyword, 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
404 '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
405 (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
406 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
407 # ruleAction
0970ed47d2cd updated pygments 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'(@' + _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(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
410 # 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
411 (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
412 ],
0970ed47d2cd updated pygments 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 '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 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
415 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
416
0970ed47d2cd updated pygments 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 # 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
418 (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
419 (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
420
0970ed47d2cd updated pygments 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 # 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
422 (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
423 (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
424 (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
425 # 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
426 # Tokens start with capital letter.
0970ed47d2cd updated pygments 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'\$?[A-Z_][A-Za-z_0-9]*', Name.Constant),
0970ed47d2cd updated pygments 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 # Rules start with small letter.
0970ed47d2cd updated pygments 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 (r'\$?[a-z_][A-Za-z_0-9]*', Name.Variable),
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
430 # 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
431 (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
432 (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
433 (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
434 (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
435 (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
436 ],
0970ed47d2cd updated pygments 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 '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
438 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
439 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
440 (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
441 (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
442 + ')?(\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
443 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
444 String, 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
445 (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
446 ],
0970ed47d2cd updated pygments 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 '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
448 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
449 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
450 (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
451 (r'(' + _id + r')(\s*)(=)(\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
452 '|'.join((_id, _STRING_LITERAL, _INT, '\*'))+ ')(\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
453 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
454 Text, 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
455 (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
456 ],
0970ed47d2cd updated pygments 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 '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
458 (r'(' + r'|'.join(( # keep host code in largest possible chunks
0970ed47d2cd updated pygments 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 r'[^\${}\'"/\\]+', # exclude unsafe characters
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
461 # strings and comments may safely contain unsafe characters
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
462 r'"(\\\\|\\"|[^"])*"', # double quote 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
463 r"'(\\\\|\\'|[^'])*'", # single quote 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
464 r'//.*$\n?', # single line 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
465 r'/\*(.|\n)*?\*/', # multi-line javadoc-style 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
466
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
467 # 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
468 # 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
469 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
470
0970ed47d2cd updated pygments 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 # 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
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 # 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
475 # 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
476 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
477 )) + 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
478 (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
479 (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
480 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
481 (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
482 (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
483 ],
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
484 '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
485 (r'(' + r'|'.join(( # keep host code in largest possible chunks.
0970ed47d2cd updated pygments 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 r'[^\$\[\]\'"/]+', # exclude unsafe characters
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
488 # strings and comments may safely contain unsafe characters
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
489 r'"(\\\\|\\"|[^"])*"', # double quote 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
490 r"'(\\\\|\\'|[^'])*'", # single quote 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
491 r'//.*$\n?', # single line 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
492 r'/\*(.|\n)*?\*/', # multi-line javadoc-style 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
493
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
494 # 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
495 # 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
496 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
497
0970ed47d2cd updated pygments 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 # 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
499 # 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
500 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
501 )) + 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
502
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments 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'\[', 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
505 (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
506 (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
507 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
508 (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
509 ]
0970ed47d2cd updated pygments 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 }
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments 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 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
513 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
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 # 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
516
0970ed47d2cd updated pygments 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 # 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
518 # 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
519 # 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
520 # 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
521
0970ed47d2cd updated pygments 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 #class AntlrCLexer(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
523 # """
0970ed47d2cd updated pygments 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 # 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
525 #
0970ed47d2cd updated pygments 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 # *New in Pygments 1.1*
0970ed47d2cd updated pygments 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 # """
0970ed47d2cd updated pygments 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 #
0970ed47d2cd updated pygments to 1.1.1+ ( http://dev.pocoo.org/hg/pygments-main/rev/948f8885af16 )
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
529 # 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
530 # 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
531 # 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
532 #
0970ed47d2cd updated pygments 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 # 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
534 # 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
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 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
537 # 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
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 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
540 """
0970ed47d2cd updated pygments 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 `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
542
0970ed47d2cd updated pygments 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 *New in Pygments 1.1.*
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments 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 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
547 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
548 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
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 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
551 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
552
0970ed47d2cd updated pygments 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 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
554 return AntlrLexer.analyse_text(text) and \
0970ed47d2cd updated pygments 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 re.search(r'^\s*language\s*=\s*C\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
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
0970ed47d2cd updated pygments 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 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
559 """
0970ed47d2cd updated pygments 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 `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
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 *New in Pygments 1.1.*
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments 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 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
566 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
567 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
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 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
570 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
571 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
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 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
574 return AntlrLexer.analyse_text(text) and \
0970ed47d2cd updated pygments 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 re.search(r'^\s*language\s*=\s*ObjC\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
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
0970ed47d2cd updated pygments 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 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
579 """
0970ed47d2cd updated pygments 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 `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
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 *New in Pygments 1.1.*
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments 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 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
586 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
587 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
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 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
590 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
591 **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
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 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
594 return AntlrLexer.analyse_text(text) and \
0970ed47d2cd updated pygments 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 re.search(r'^\s*language\s*=\s*CSharp2\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
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
0970ed47d2cd updated pygments 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 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
599 """
0970ed47d2cd updated pygments 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 `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
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 *New in Pygments 1.1.*
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments 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 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
606 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
607 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
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 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
610 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
611 **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
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 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
614 return AntlrLexer.analyse_text(text) and \
0970ed47d2cd updated pygments 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 re.search(r'^\s*language\s*=\s*Python\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
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
0970ed47d2cd updated pygments 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 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
619 """
0970ed47d2cd updated pygments 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 `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
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 *New in Pygments 1.1*
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments 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 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
626 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
627 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
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 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
630 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
631 **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
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 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
634 # 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
635 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
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
0970ed47d2cd updated pygments 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 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
639 """
0970ed47d2cd updated pygments 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 `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
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 *New in Pygments 1.1.*
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments 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 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
646 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
647 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
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 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
650 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
651 **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
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 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
654 return AntlrLexer.analyse_text(text) and \
0970ed47d2cd updated pygments 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 re.search(r'^\s*language\s*=\s*Ruby\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
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
0970ed47d2cd updated pygments 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 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
659 """
0970ed47d2cd updated pygments 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 `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
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 *New in Pygments 1.1.*
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments 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 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
666 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
667 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
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 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
670 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
671 **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
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 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
674 return AntlrLexer.analyse_text(text) and \
0970ed47d2cd updated pygments 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 re.search(r'^\s*language\s*=\s*Perl5\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
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
0970ed47d2cd updated pygments 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 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
679 """
0970ed47d2cd updated pygments 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 `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
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 *New in Pygments 1.1.*
0970ed47d2cd updated pygments 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
0970ed47d2cd updated pygments 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 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
686 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
687 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
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 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
690 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
691 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
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 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
694 return AntlrLexer.analyse_text(text) and \
0970ed47d2cd updated pygments 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 re.search(r'^\s*language\s*=\s*ActionScript\s*;', text, re.M)