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:
1.4 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | // https://gn.googlesource.com/gn/+/refs/heads/main/docs/reference.md#grammar
|
---|
| 2 |
|
---|
| 3 | Prism.languages.gn = {
|
---|
| 4 | 'comment': {
|
---|
| 5 | pattern: /#.*/,
|
---|
| 6 | greedy: true
|
---|
| 7 | },
|
---|
| 8 | 'string-literal': {
|
---|
| 9 | pattern: /(^|[^\\"])"(?:[^\r\n"\\]|\\.)*"/,
|
---|
| 10 | lookbehind: true,
|
---|
| 11 | greedy: true,
|
---|
| 12 | inside: {
|
---|
| 13 | 'interpolation': {
|
---|
| 14 | pattern: /((?:^|[^\\])(?:\\{2})*)\$(?:\{[\s\S]*?\}|[a-zA-Z_]\w*|0x[a-fA-F0-9]{2})/,
|
---|
| 15 | lookbehind: true,
|
---|
| 16 | inside: {
|
---|
| 17 | 'number': /^\$0x[\s\S]{2}$/,
|
---|
| 18 | 'variable': /^\$\w+$/,
|
---|
| 19 | 'interpolation-punctuation': {
|
---|
| 20 | pattern: /^\$\{|\}$/,
|
---|
| 21 | alias: 'punctuation'
|
---|
| 22 | },
|
---|
| 23 | 'expression': {
|
---|
| 24 | pattern: /[\s\S]+/,
|
---|
| 25 | inside: null // see below
|
---|
| 26 | }
|
---|
| 27 | }
|
---|
| 28 | },
|
---|
| 29 | 'string': /[\s\S]+/
|
---|
| 30 | }
|
---|
| 31 | },
|
---|
| 32 |
|
---|
| 33 | 'keyword': /\b(?:else|if)\b/,
|
---|
| 34 | 'boolean': /\b(?:false|true)\b/,
|
---|
| 35 | 'builtin-function': {
|
---|
| 36 | // a few functions get special highlighting to improve readability
|
---|
| 37 | pattern: /\b(?:assert|defined|foreach|import|pool|print|template|tool|toolchain)(?=\s*\()/i,
|
---|
| 38 | alias: 'keyword'
|
---|
| 39 | },
|
---|
| 40 | 'function': /\b[a-z_]\w*(?=\s*\()/i,
|
---|
| 41 | 'constant': /\b(?:current_cpu|current_os|current_toolchain|default_toolchain|host_cpu|host_os|root_build_dir|root_gen_dir|root_out_dir|target_cpu|target_gen_dir|target_os|target_out_dir)\b/,
|
---|
| 42 |
|
---|
| 43 | 'number': /-?\b\d+\b/,
|
---|
| 44 |
|
---|
| 45 | 'operator': /[-+!=<>]=?|&&|\|\|/,
|
---|
| 46 | 'punctuation': /[(){}[\],.]/
|
---|
| 47 | };
|
---|
| 48 |
|
---|
| 49 | Prism.languages.gn['string-literal'].inside['interpolation'].inside['expression'].inside = Prism.languages.gn;
|
---|
| 50 |
|
---|
| 51 | Prism.languages.gni = Prism.languages.gn;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.