ThirdParty/Pygments/pygments/lexers/rdf.py

changeset 5072
aab59042fefb
parent 4697
c2e9bf425554
child 5713
6762afd9f963
equal deleted inserted replaced
5070:4e4651e88674 5072:aab59042fefb
27 name = 'SPARQL' 27 name = 'SPARQL'
28 aliases = ['sparql'] 28 aliases = ['sparql']
29 filenames = ['*.rq', '*.sparql'] 29 filenames = ['*.rq', '*.sparql']
30 mimetypes = ['application/sparql-query'] 30 mimetypes = ['application/sparql-query']
31 31
32 # character group definitions ::
33
34 PN_CHARS_BASE_GRP = (u'a-zA-Z'
35 u'\u00c0-\u00d6'
36 u'\u00d8-\u00f6'
37 u'\u00f8-\u02ff'
38 u'\u0370-\u037d'
39 u'\u037f-\u1fff'
40 u'\u200c-\u200d'
41 u'\u2070-\u218f'
42 u'\u2c00-\u2fef'
43 u'\u3001-\ud7ff'
44 u'\uf900-\ufdcf'
45 u'\ufdf0-\ufffd'
46 u'\U00010000-\U000effff')
47
48 PN_CHARS_U_GRP = (PN_CHARS_BASE_GRP + '_')
49
50 PN_CHARS_GRP = (PN_CHARS_U_GRP +
51 r'\-' +
52 r'0-9' +
53 u'\u00b7' +
54 u'\u0300-\u036f' +
55 u'\u203f-\u2040')
56
57 HEX_GRP = '0-9A-Fa-f'
58
59 PN_LOCAL_ESC_CHARS_GRP = r' _~.\-!$&""()*+,;=/?#@%'
60
32 # terminal productions :: 61 # terminal productions ::
33 62
34 PN_CHARS_BASE = (u'(?:[a-zA-Z' 63 PN_CHARS_BASE = '[' + PN_CHARS_BASE_GRP + ']'
35 u'\u00c0-\u00d6' 64
36 u'\u00d8-\u00f6' 65 PN_CHARS_U = '[' + PN_CHARS_U_GRP + ']'
37 u'\u00f8-\u02ff' 66
38 u'\u0370-\u037d' 67 PN_CHARS = '[' + PN_CHARS_GRP + ']'
39 u'\u037f-\u1fff' 68
40 u'\u200c-\u200d' 69 HEX = '[' + HEX_GRP + ']'
41 u'\u2070-\u218f' 70
42 u'\u2c00-\u2fef' 71 PN_LOCAL_ESC_CHARS = '[' + PN_LOCAL_ESC_CHARS_GRP + ']'
43 u'\u3001-\ud7ff'
44 u'\uf900-\ufdcf'
45 u'\ufdf0-\ufffd]|'
46 u'[^\u0000-\uffff]|'
47 u'[\ud800-\udbff][\udc00-\udfff])')
48
49 PN_CHARS_U = '(?:' + PN_CHARS_BASE + '|_)'
50
51 PN_CHARS = ('(?:' + PN_CHARS_U + r'|[\-0-9' +
52 u'\u00b7' +
53 u'\u0300-\u036f' +
54 u'\u203f-\u2040])')
55
56 HEX = '[0-9A-Fa-f]'
57
58 PN_LOCAL_ESC_CHARS = r'[ _~.\-!$&""()*+,;=/?#@%]'
59 72
60 IRIREF = r'<(?:[^<>"{}|^`\\\x00-\x20])*>' 73 IRIREF = r'<(?:[^<>"{}|^`\\\x00-\x20])*>'
61 74
62 BLANK_NODE_LABEL = '_:(?:' + PN_CHARS_U + '|[0-9])(?:(?:' + PN_CHARS + '|\.)*' + \ 75 BLANK_NODE_LABEL = '_:[0-9' + PN_CHARS_U_GRP + '](?:[' + PN_CHARS_GRP + \
63 PN_CHARS + ')?' 76 '.]*' + PN_CHARS + ')?'
64 77
65 PN_PREFIX = PN_CHARS_BASE + '(?:(?:' + PN_CHARS + '|\.)*' + PN_CHARS + ')?' 78 PN_PREFIX = PN_CHARS_BASE + '(?:[' + PN_CHARS_GRP + '.]*' + PN_CHARS + ')?'
66 79
67 VARNAME = '(?:' + PN_CHARS_U + '|[0-9])(?:' + PN_CHARS_U + \ 80 VARNAME = u'[0-9' + PN_CHARS_U_GRP + '][' + PN_CHARS_U_GRP + \
68 u'|[0-9\u00b7\u0300-\u036f\u203f-\u2040])*' 81 u'0-9\u00b7\u0300-\u036f\u203f-\u2040]*'
69 82
70 PERCENT = '%' + HEX + HEX 83 PERCENT = '%' + HEX + HEX
71 84
72 PN_LOCAL_ESC = r'\\' + PN_LOCAL_ESC_CHARS 85 PN_LOCAL_ESC = r'\\' + PN_LOCAL_ESC_CHARS
73 86
74 PLX = '(?:' + PERCENT + ')|(?:' + PN_LOCAL_ESC + ')' 87 PLX = '(?:' + PERCENT + ')|(?:' + PN_LOCAL_ESC + ')'
75 88
76 PN_LOCAL = ('(?:(?:' + PN_CHARS_U + '|[:0-9])|' + PLX + ')' + 89 PN_LOCAL = ('(?:[' + PN_CHARS_U_GRP + ':0-9' + ']|' + PLX + ')' +
77 '(?:(?:(?:' + PN_CHARS + '|[.:])|' + PLX + ')*(?:(?:' + 90 '(?:(?:[' + PN_CHARS_GRP + '.:]|' + PLX + ')*(?:[' +
78 PN_CHARS + '|:)|' + PLX + '))?') 91 PN_CHARS_GRP + ':]|' + PLX + '))?')
79 92
80 EXPONENT = r'[eE][+-]?\d+' 93 EXPONENT = r'[eE][+-]?\d+'
81 94
82 # Lexer token definitions :: 95 # Lexer token definitions ::
83 96

eric ide

mercurial