source: node_modules/refractor/lang/q.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 3.0 KB
Line 
1'use strict'
2
3module.exports = q
4q.displayName = 'q'
5q.aliases = []
6function q(Prism) {
7 Prism.languages.q = {
8 string: /"(?:\\.|[^"\\\r\n])*"/,
9 comment: [
10 // From http://code.kx.com/wiki/Reference/Slash:
11 // When / is following a space (or a right parenthesis, bracket, or brace), it is ignored with the rest of the line.
12 {
13 pattern: /([\t )\]}])\/.*/,
14 lookbehind: true,
15 greedy: true
16 }, // From http://code.kx.com/wiki/Reference/Slash:
17 // A line which has / as its first character and contains at least one other non-whitespace character is a whole-line comment and is ignored entirely.
18 // A / on a line by itself begins a multiline comment which is terminated by the next \ on a line by itself.
19 // If a / is not matched by a \, the multiline comment is unterminated and continues to end of file.
20 // The / and \ must be the first char on the line, but may be followed by any amount of whitespace.
21 {
22 pattern:
23 /(^|\r?\n|\r)\/[\t ]*(?:(?:\r?\n|\r)(?:.*(?:\r?\n|\r(?!\n)))*?(?:\\(?=[\t ]*(?:\r?\n|\r))|$)|\S.*)/,
24 lookbehind: true,
25 greedy: true
26 }, // From http://code.kx.com/wiki/Reference/Slash:
27 // A \ on a line by itself with no preceding matching / will comment to end of file.
28 {
29 pattern: /^\\[\t ]*(?:\r?\n|\r)[\s\S]+/m,
30 greedy: true
31 },
32 {
33 pattern: /^#!.+/m,
34 greedy: true
35 }
36 ],
37 symbol: /`(?::\S+|[\w.]*)/,
38 datetime: {
39 pattern:
40 /0N[mdzuvt]|0W[dtz]|\d{4}\.\d\d(?:m|\.\d\d(?:T(?:\d\d(?::\d\d(?::\d\d(?:[.:]\d\d\d)?)?)?)?)?[dz]?)|\d\d:\d\d(?::\d\d(?:[.:]\d\d\d)?)?[uvt]?/,
41 alias: 'number'
42 },
43 // The negative look-ahead prevents bad highlighting
44 // of verbs 0: and 1:
45 number:
46 /\b(?![01]:)(?:0N[hje]?|0W[hj]?|0[wn]|0x[\da-fA-F]+|\d+(?:\.\d*)?(?:e[+-]?\d+)?[hjfeb]?)/,
47 keyword:
48 /\\\w+\b|\b(?:abs|acos|aj0?|all|and|any|asc|asin|asof|atan|attr|avgs?|binr?|by|ceiling|cols|cor|cos|count|cov|cross|csv|cut|delete|deltas|desc|dev|differ|distinct|div|do|dsave|ej|enlist|eval|except|exec|exit|exp|fby|fills|first|fkeys|flip|floor|from|get|getenv|group|gtime|hclose|hcount|hdel|hopen|hsym|iasc|identity|idesc|if|ij|in|insert|inter|inv|keys?|last|like|list|ljf?|load|log|lower|lsq|ltime|ltrim|mavg|maxs?|mcount|md5|mdev|med|meta|mins?|mmax|mmin|mmu|mod|msum|neg|next|not|null|or|over|parse|peach|pj|plist|prds?|prev|prior|rand|rank|ratios|raze|read0|read1|reciprocal|reval|reverse|rload|rotate|rsave|rtrim|save|scan|scov|sdev|select|set|setenv|show|signum|sin|sqrt|ssr?|string|sublist|sums?|sv|svar|system|tables|tan|til|trim|txf|type|uj|ungroup|union|update|upper|upsert|value|var|views?|vs|wavg|where|while|within|wj1?|wsum|ww|xasc|xbar|xcols?|xdesc|xexp|xgroup|xkey|xlog|xprev|xrank)\b/,
49 adverb: {
50 pattern: /['\/\\]:?|\beach\b/,
51 alias: 'function'
52 },
53 verb: {
54 pattern: /(?:\B\.\B|\b[01]:|<[=>]?|>=?|[:+\-*%,!?~=|$&#@^]):?|\b_\b:?/,
55 alias: 'operator'
56 },
57 punctuation: /[(){}\[\];.]/
58 }
59}
Note: See TracBrowser for help on using the repository browser.