95 |
95 |
96 tokens = { |
96 tokens = { |
97 'root': [ |
97 'root': [ |
98 (r'\s+', Text), |
98 (r'\s+', Text), |
99 # keywords :: |
99 # keywords :: |
100 (r'((?i)select|construct|describe|ask|where|filter|group\s+by|minus|' |
100 (r'(?i)(select|construct|describe|ask|where|filter|group\s+by|minus|' |
101 r'distinct|reduced|from\s+named|from|order\s+by|desc|asc|limit|' |
101 r'distinct|reduced|from\s+named|from|order\s+by|desc|asc|limit|' |
102 r'offset|bindings|load|clear|drop|create|add|move|copy|' |
102 r'offset|bindings|load|clear|drop|create|add|move|copy|' |
103 r'insert\s+data|delete\s+data|delete\s+where|delete|insert|' |
103 r'insert\s+data|delete\s+data|delete\s+where|delete|insert|' |
104 r'using\s+named|using|graph|default|named|all|optional|service|' |
104 r'using\s+named|using|graph|default|named|all|optional|service|' |
105 r'silent|bind|union|not\s+in|in|as|having|to|prefix|base)\b', Keyword), |
105 r'silent|bind|union|not\s+in|in|as|having|to|prefix|base)\b', Keyword), |
109 # blank nodes :: |
109 # blank nodes :: |
110 ('(' + BLANK_NODE_LABEL + ')', Name.Label), |
110 ('(' + BLANK_NODE_LABEL + ')', Name.Label), |
111 # # variables :: |
111 # # variables :: |
112 ('[?$]' + VARNAME, Name.Variable), |
112 ('[?$]' + VARNAME, Name.Variable), |
113 # prefixed names :: |
113 # prefixed names :: |
114 (r'(' + PN_PREFIX + ')?(\:)(' + PN_LOCAL + ')?', |
114 (r'(' + PN_PREFIX + r')?(\:)(' + PN_LOCAL + r')?', |
115 bygroups(Name.Namespace, Punctuation, Name.Tag)), |
115 bygroups(Name.Namespace, Punctuation, Name.Tag)), |
116 # function names :: |
116 # function names :: |
117 (r'((?i)str|lang|langmatches|datatype|bound|iri|uri|bnode|rand|abs|' |
117 (r'(?i)(str|lang|langmatches|datatype|bound|iri|uri|bnode|rand|abs|' |
118 r'ceil|floor|round|concat|strlen|ucase|lcase|encode_for_uri|' |
118 r'ceil|floor|round|concat|strlen|ucase|lcase|encode_for_uri|' |
119 r'contains|strstarts|strends|strbefore|strafter|year|month|day|' |
119 r'contains|strstarts|strends|strbefore|strafter|year|month|day|' |
120 r'hours|minutes|seconds|timezone|tz|now|md5|sha1|sha256|sha384|' |
120 r'hours|minutes|seconds|timezone|tz|now|md5|sha1|sha256|sha384|' |
121 r'sha512|coalesce|if|strlang|strdt|sameterm|isiri|isuri|isblank|' |
121 r'sha512|coalesce|if|strlang|strdt|sameterm|isiri|isuri|isblank|' |
122 r'isliteral|isnumeric|regex|substr|replace|exists|not\s+exists|' |
122 r'isliteral|isnumeric|regex|substr|replace|exists|not\s+exists|' |
123 r'count|sum|min|max|avg|sample|group_concat|separator)\b', |
123 r'count|sum|min|max|avg|sample|group_concat|separator)\b', |
124 Name.Function), |
124 Name.Function), |
125 # boolean literals :: |
125 # boolean literals :: |
126 (r'(true|false)', Keyword.Constant), |
126 (r'(true|false)', Keyword.Constant), |
127 # double literals :: |
127 # double literals :: |
128 (r'[+\-]?(\d+\.\d*' + EXPONENT + '|\.?\d+' + EXPONENT + ')', Number.Float), |
128 (r'[+\-]?(\d+\.\d*' + EXPONENT + r'|\.?\d+' + EXPONENT + ')', Number.Float), |
129 # decimal literals :: |
129 # decimal literals :: |
130 (r'[+\-]?(\d+\.\d*|\.\d+)', Number.Float), |
130 (r'[+\-]?(\d+\.\d*|\.\d+)', Number.Float), |
131 # integer literals :: |
131 # integer literals :: |
132 (r'[+\-]?\d+', Number.Integer), |
132 (r'[+\-]?\d+', Number.Integer), |
133 # operators :: |
133 # operators :: |