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

upgrade pygments from 1.6 to 2.1.3
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 05 Sep 2016 23:55:33 +0200
parents
children
rev   line source
6097
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
2 """
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
3 pygments.lexers.rdf
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4 ~~~~~~~~~~~~~~~~~~~
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
5
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
6 Lexers for semantic web and RDF query languages and markup.
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
7
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
8 :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
9 :license: BSD, see LICENSE for details.
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
10 """
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
11
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
12 import re
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
13
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
14 from pygments.lexer import RegexLexer, bygroups, default
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
15 from pygments.token import Keyword, Punctuation, String, Number, Operator, Generic, \
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
16 Whitespace, Name, Literal, Comment, Text
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
17
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
18 __all__ = ['SparqlLexer', 'TurtleLexer']
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
19
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
20
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
21 class SparqlLexer(RegexLexer):
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
22 """
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
23 Lexer for `SPARQL <http://www.w3.org/TR/rdf-sparql-query/>`_ query language.
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
24
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
25 .. versionadded:: 2.0
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
26 """
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
27 name = 'SPARQL'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
28 aliases = ['sparql']
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
29 filenames = ['*.rq', '*.sparql']
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
30 mimetypes = ['application/sparql-query']
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
31
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
32 # character group definitions ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
33
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
34 PN_CHARS_BASE_GRP = (u'a-zA-Z'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
35 u'\u00c0-\u00d6'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
36 u'\u00d8-\u00f6'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
37 u'\u00f8-\u02ff'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
38 u'\u0370-\u037d'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
39 u'\u037f-\u1fff'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
40 u'\u200c-\u200d'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
41 u'\u2070-\u218f'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
42 u'\u2c00-\u2fef'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
43 u'\u3001-\ud7ff'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
44 u'\uf900-\ufdcf'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
45 u'\ufdf0-\ufffd'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
46 u'\U00010000-\U000effff')
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
47
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
48 PN_CHARS_U_GRP = (PN_CHARS_BASE_GRP + '_')
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
49
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
50 PN_CHARS_GRP = (PN_CHARS_U_GRP +
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
51 r'\-' +
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
52 r'0-9' +
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
53 u'\u00b7' +
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
54 u'\u0300-\u036f' +
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
55 u'\u203f-\u2040')
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
56
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
57 HEX_GRP = '0-9A-Fa-f'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
58
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
59 PN_LOCAL_ESC_CHARS_GRP = r' _~.\-!$&""()*+,;=/?#@%'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
60
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
61 # terminal productions ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
62
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
63 PN_CHARS_BASE = '[' + PN_CHARS_BASE_GRP + ']'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
64
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
65 PN_CHARS_U = '[' + PN_CHARS_U_GRP + ']'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
66
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
67 PN_CHARS = '[' + PN_CHARS_GRP + ']'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
68
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
69 HEX = '[' + HEX_GRP + ']'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
70
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
71 PN_LOCAL_ESC_CHARS = '[' + PN_LOCAL_ESC_CHARS_GRP + ']'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
72
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
73 IRIREF = r'<(?:[^<>"{}|^`\\\x00-\x20])*>'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
74
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
75 BLANK_NODE_LABEL = '_:[0-9' + PN_CHARS_U_GRP + '](?:[' + PN_CHARS_GRP + \
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
76 '.]*' + PN_CHARS + ')?'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
77
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
78 PN_PREFIX = PN_CHARS_BASE + '(?:[' + PN_CHARS_GRP + '.]*' + PN_CHARS + ')?'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
79
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
80 VARNAME = u'[0-9' + PN_CHARS_U_GRP + '][' + PN_CHARS_U_GRP + \
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
81 u'0-9\u00b7\u0300-\u036f\u203f-\u2040]*'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
82
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
83 PERCENT = '%' + HEX + HEX
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
84
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
85 PN_LOCAL_ESC = r'\\' + PN_LOCAL_ESC_CHARS
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
86
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
87 PLX = '(?:' + PERCENT + ')|(?:' + PN_LOCAL_ESC + ')'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
88
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
89 PN_LOCAL = ('(?:[' + PN_CHARS_U_GRP + ':0-9' + ']|' + PLX + ')' +
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
90 '(?:(?:[' + PN_CHARS_GRP + '.:]|' + PLX + ')*(?:[' +
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
91 PN_CHARS_GRP + ':]|' + PLX + '))?')
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
92
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
93 EXPONENT = r'[eE][+-]?\d+'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
94
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
95 # Lexer token definitions ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
96
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
97 tokens = {
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
98 'root': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
99 (r'\s+', Text),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
100 # keywords ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
101 (r'((?i)select|construct|describe|ask|where|filter|group\s+by|minus|'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
102 r'distinct|reduced|from\s+named|from|order\s+by|desc|asc|limit|'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
103 r'offset|bindings|load|clear|drop|create|add|move|copy|'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
104 r'insert\s+data|delete\s+data|delete\s+where|delete|insert|'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
105 r'using\s+named|using|graph|default|named|all|optional|service|'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
106 r'silent|bind|union|not\s+in|in|as|having|to|prefix|base)\b', Keyword),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
107 (r'(a)\b', Keyword),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
108 # IRIs ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
109 ('(' + IRIREF + ')', Name.Label),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
110 # blank nodes ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
111 ('(' + BLANK_NODE_LABEL + ')', Name.Label),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
112 # # variables ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
113 ('[?$]' + VARNAME, Name.Variable),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
114 # prefixed names ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
115 (r'(' + PN_PREFIX + ')?(\:)(' + PN_LOCAL + ')?',
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
116 bygroups(Name.Namespace, Punctuation, Name.Tag)),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
117 # function names ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
118 (r'((?i)str|lang|langmatches|datatype|bound|iri|uri|bnode|rand|abs|'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
119 r'ceil|floor|round|concat|strlen|ucase|lcase|encode_for_uri|'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
120 r'contains|strstarts|strends|strbefore|strafter|year|month|day|'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
121 r'hours|minutes|seconds|timezone|tz|now|md5|sha1|sha256|sha384|'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
122 r'sha512|coalesce|if|strlang|strdt|sameterm|isiri|isuri|isblank|'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
123 r'isliteral|isnumeric|regex|substr|replace|exists|not\s+exists|'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
124 r'count|sum|min|max|avg|sample|group_concat|separator)\b',
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
125 Name.Function),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
126 # boolean literals ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
127 (r'(true|false)', Keyword.Constant),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
128 # double literals ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
129 (r'[+\-]?(\d+\.\d*' + EXPONENT + '|\.?\d+' + EXPONENT + ')', Number.Float),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
130 # decimal literals ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
131 (r'[+\-]?(\d+\.\d*|\.\d+)', Number.Float),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
132 # integer literals ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
133 (r'[+\-]?\d+', Number.Integer),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
134 # operators ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
135 (r'(\|\||&&|=|\*|\-|\+|/|!=|<=|>=|!|<|>)', Operator),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
136 # punctuation characters ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
137 (r'[(){}.;,:^\[\]]', Punctuation),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
138 # line comments ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
139 (r'#[^\n]*', Comment),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
140 # strings ::
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
141 (r'"""', String, 'triple-double-quoted-string'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
142 (r'"', String, 'single-double-quoted-string'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
143 (r"'''", String, 'triple-single-quoted-string'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
144 (r"'", String, 'single-single-quoted-string'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
145 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
146 'triple-double-quoted-string': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
147 (r'"""', String, 'end-of-string'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
148 (r'[^\\]+', String),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
149 (r'\\', String, 'string-escape'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
150 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
151 'single-double-quoted-string': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
152 (r'"', String, 'end-of-string'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
153 (r'[^"\\\n]+', String),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
154 (r'\\', String, 'string-escape'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
155 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
156 'triple-single-quoted-string': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
157 (r"'''", String, 'end-of-string'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
158 (r'[^\\]+', String),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
159 (r'\\', String.Escape, 'string-escape'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
160 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
161 'single-single-quoted-string': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
162 (r"'", String, 'end-of-string'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
163 (r"[^'\\\n]+", String),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
164 (r'\\', String, 'string-escape'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
165 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
166 'string-escape': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
167 (r'u' + HEX + '{4}', String.Escape, '#pop'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
168 (r'U' + HEX + '{8}', String.Escape, '#pop'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
169 (r'.', String.Escape, '#pop'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
170 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
171 'end-of-string': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
172 (r'(@)([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)',
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
173 bygroups(Operator, Name.Function), '#pop:2'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
174 (r'\^\^', Operator, '#pop:2'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
175 default('#pop:2'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
176 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
177 }
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
178
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
179
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
180 class TurtleLexer(RegexLexer):
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
181 """
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
182 Lexer for `Turtle <http://www.w3.org/TR/turtle/>`_ data language.
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
183
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
184 .. versionadded:: 2.1
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
185 """
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
186 name = 'Turtle'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
187 aliases = ['turtle']
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
188 filenames = ['*.ttl']
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
189 mimetypes = ['text/turtle', 'application/x-turtle']
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
190
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
191 flags = re.IGNORECASE
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
192
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
193 patterns = {
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
194 'PNAME_NS': r'((?:[a-zA-Z][\w-]*)?\:)', # Simplified character range
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
195 'IRIREF': r'(<[^<>"{}|^`\\\x00-\x20]*>)'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
196 }
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
197
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
198 # PNAME_NS PN_LOCAL (with simplified character range)
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
199 patterns['PrefixedName'] = r'%(PNAME_NS)s([a-z][\w-]*)' % patterns
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
200
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
201 tokens = {
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
202 'root': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
203 (r'\s+', Whitespace),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
204
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
205 # Base / prefix
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
206 (r'(@base|BASE)(\s+)%(IRIREF)s(\s*)(\.?)' % patterns,
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
207 bygroups(Keyword, Whitespace, Name.Variable, Whitespace,
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
208 Punctuation)),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
209 (r'(@prefix|PREFIX)(\s+)%(PNAME_NS)s(\s+)%(IRIREF)s(\s*)(\.?)' % patterns,
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
210 bygroups(Keyword, Whitespace, Name.Namespace, Whitespace,
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
211 Name.Variable, Whitespace, Punctuation)),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
212
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
213 # The shorthand predicate 'a'
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
214 (r'(?<=\s)a(?=\s)', Keyword.Type),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
215
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
216 # IRIREF
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
217 (r'%(IRIREF)s' % patterns, Name.Variable),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
218
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
219 # PrefixedName
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
220 (r'%(PrefixedName)s' % patterns,
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
221 bygroups(Name.Namespace, Name.Tag)),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
222
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
223 # Comment
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
224 (r'#[^\n]+', Comment),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
225
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
226 (r'\b(true|false)\b', Literal),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
227 (r'[+\-]?\d*\.\d+', Number.Float),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
228 (r'[+\-]?\d*(:?\.\d+)?E[+\-]?\d+', Number.Float),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
229 (r'[+\-]?\d+', Number.Integer),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
230 (r'[\[\](){}.;,:^]', Punctuation),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
231
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
232 (r'"""', String, 'triple-double-quoted-string'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
233 (r'"', String, 'single-double-quoted-string'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
234 (r"'''", String, 'triple-single-quoted-string'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
235 (r"'", String, 'single-single-quoted-string'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
236 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
237 'triple-double-quoted-string': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
238 (r'"""', String, 'end-of-string'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
239 (r'[^\\]+', String),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
240 (r'\\', String, 'string-escape'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
241 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
242 'single-double-quoted-string': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
243 (r'"', String, 'end-of-string'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
244 (r'[^"\\\n]+', String),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
245 (r'\\', String, 'string-escape'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
246 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
247 'triple-single-quoted-string': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
248 (r"'''", String, 'end-of-string'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
249 (r'[^\\]+', String),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
250 (r'\\', String, 'string-escape'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
251 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
252 'single-single-quoted-string': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
253 (r"'", String, 'end-of-string'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
254 (r"[^'\\\n]+", String),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
255 (r'\\', String, 'string-escape'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
256 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
257 'string-escape': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
258 (r'.', String, '#pop'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
259 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
260 'end-of-string': [
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
261
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
262 (r'(@)([a-zA-Z]+(:?-[a-zA-Z0-9]+)*)',
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
263 bygroups(Operator, Generic.Emph), '#pop:2'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
264
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
265 (r'(\^\^)%(IRIREF)s' % patterns, bygroups(Operator, Generic.Emph), '#pop:2'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
266 (r'(\^\^)%(PrefixedName)s' % patterns,
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
267 bygroups(Operator, Generic.Emph, Generic.Emph), '#pop:2'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
268
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
269 default('#pop:2'),
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
270
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
271 ],
815981fad7fd upgrade pygments from 1.6 to 2.1.3
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
272 }