mirror of https://github.com/mindoc-org/mindoc.git
78 lines
2.0 KiB
Go
78 lines
2.0 KiB
Go
/*
|
|
Language: XQuery
|
|
Author: Dirk Kirsten <dk@basex.org>
|
|
Description: Supports XQuery 3.1 including XQuery Update 3, so also XPath (as it is a superset)
|
|
Category: functional
|
|
*/
|
|
|
|
function(hljs) {
|
|
var KEYWORDS = 'for let if while then else return where group by xquery encoding version' +
|
|
'module namespace boundary-space preserve strip default collation base-uri ordering' +
|
|
'copy-namespaces order declare import schema namespace function option in allowing empty' +
|
|
'at tumbling window sliding window start when only end when previous next stable ascending' +
|
|
'descending empty greatest least some every satisfies switch case typeswitch try catch and' +
|
|
'or to union intersect instance of treat as castable cast map array delete insert into' +
|
|
'replace value rename copy modify update';
|
|
var LITERAL = 'false true xs:string xs:integer element item xs:date xs:datetime xs:float xs:double xs:decimal QName xs:anyURI xs:long xs:int xs:short xs:byte attribute';
|
|
var VAR = {
|
|
begin: /\$[a-zA-Z0-9\-]+/
|
|
};
|
|
|
|
var NUMBER = {
|
|
className: 'number',
|
|
begin: '(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b',
|
|
relevance: 0
|
|
};
|
|
|
|
var STRING = {
|
|
className: 'string',
|
|
variants: [
|
|
{begin: /"/, end: /"/, contains: [{begin: /""/, relevance: 0}]},
|
|
{begin: /'/, end: /'/, contains: [{begin: /''/, relevance: 0}]}
|
|
]
|
|
};
|
|
|
|
var ANNOTATION = {
|
|
className: 'meta',
|
|
begin: '%\\w+'
|
|
};
|
|
|
|
var COMMENT = {
|
|
className: 'comment',
|
|
begin: '\\(:', end: ':\\)',
|
|
relevance: 10,
|
|
contains: [
|
|
{
|
|
className: 'doctag', begin: '@\\w+'
|
|
}
|
|
]
|
|
};
|
|
|
|
var METHOD = {
|
|
begin: '{', end: '}'
|
|
};
|
|
|
|
var CONTAINS = [
|
|
VAR,
|
|
STRING,
|
|
NUMBER,
|
|
COMMENT,
|
|
ANNOTATION,
|
|
METHOD
|
|
];
|
|
METHOD.contains = CONTAINS;
|
|
|
|
|
|
return {
|
|
aliases: ['xpath', 'xq'],
|
|
case_insensitive: false,
|
|
lexemes: /[a-zA-Z\$][a-zA-Z0-9_:\-]*/,
|
|
illegal: /(proc)|(abstract)|(extends)|(until)|(#)/,
|
|
keywords: {
|
|
keyword: KEYWORDS,
|
|
literal: LITERAL
|
|
},
|
|
contains: CONTAINS
|
|
};
|
|
}
|