]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/qml.js
1 /*! `qml` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar
= (function () {
7 Requires: javascript.js, xml.js
8 Author: John Foster <jfoster@esri.com>
9 Description: Syntax highlighting for the Qt Quick QML scripting language, based mostly off
10 the JavaScript parser.
11 Website: https://doc.qt.io/qt-5/qmlapplications.html
16 const regex
= hljs
.regex
;
19 'in of on if for while finally var new function do return void else break catch '
20 + 'instanceof with throw case default try this switch continue typeof delete '
21 + 'let yield const export super debugger as async await import',
23 'true false null undefined NaN Infinity',
25 'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent '
26 + 'encodeURI encodeURIComponent escape unescape Object Function Boolean Error '
27 + 'EvalError InternalError RangeError ReferenceError StopIteration SyntaxError '
28 + 'TypeError URIError Number Math Date String RegExp Array Float32Array '
29 + 'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array '
30 + 'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require '
31 + 'module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect '
32 + 'Behavior bool color coordinate date double enumeration font geocircle georectangle '
33 + 'geoshape int list matrix4x4 parent point quaternion real rect '
34 + 'size string url variant vector2d vector3d vector4d '
38 const QML_IDENT_RE
= '[a-zA-Z_][a-zA-Z0-9\\._]*';
40 // Isolate property statements. Ends at a :, =, ;, ,, a comment or end of line.
41 // Use property class.
44 begin: '\\bproperty\\b',
47 end: '(:|=|;|,|//|/\\*|$)',
52 // Isolate signal statements. Ends at a ) a comment or end of line.
53 // Use property class.
56 begin: '\\bsignal\\b',
59 end: '(\\(|:|=|;|,|//|/\\*|$)',
64 // id: is special in QML. When we see id: we want to mark the id: as attribute and
65 // emphasize the token following.
67 className: 'attribute',
76 // Find QML object attribute. An attribute is a QML identifier followed by :.
77 // Unfortunately it's hard to know where it ends, as it may contain scalars,
78 // objects, object definitions, or javascript. The true end is either when the parent
79 // ends or the next attribute is detected.
80 const QML_ATTRIBUTE
= {
81 begin: QML_IDENT_RE
+ '\\s*:',
85 className: 'attribute',
95 // Find QML object. A QML object is a QML identifier followed by { and ends at the matching }.
96 // All we really care about is finding IDENT followed by { and just mark up the IDENT and ignore the {.
98 begin: regex
.concat(QML_IDENT_RE
, /\s*\{/),
102 contains: [ hljs
.inherit(hljs
.TITLE_MODE
, { begin: QML_IDENT_RE
}) ]
108 case_insensitive: false,
113 begin: /^\s
*['"]use (strict|asm)['"]/
115 hljs.APOS_STRING_MODE,
116 hljs.QUOTE_STRING_MODE,
122 hljs.BACKSLASH_ESCAPE,
130 hljs.C_LINE_COMMENT_MODE,
131 hljs.C_BLOCK_COMMENT_MODE,
135 { begin: '\\b(0[bB][01]+)' },
136 { begin: '\\b(0[oO][0-7]+)' },
137 { begin: hljs.C_NUMBER_RE }
141 { // "value
" container
142 begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*',
143 keywords: 'return throw case',
145 hljs.C_LINE_COMMENT_MODE,
146 hljs.C_BLOCK_COMMENT_MODE,
160 className: 'function',
161 beginKeywords: 'function',
165 hljs.inherit(hljs.TITLE_MODE, { begin: /[A-Za-z$_][0-9A-Za-z$_]*/ }),
173 hljs.C_LINE_COMMENT_MODE,
174 hljs.C_BLOCK_COMMENT_MODE
181 // hack: prevents detection of keywords after dots
182 begin: '\\.' + hljs.IDENT_RE,
197 export default hljsGrammar;