-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into issue2909
- Loading branch information
Showing
37 changed files
with
1,030 additions
and
15 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// GitHub: https://github.com/apache/avro | ||
// Docs: https://avro.apache.org/docs/current/idl.html | ||
|
||
Prism.languages['avro-idl'] = { | ||
'comment': { | ||
pattern: /\/\/.*|\/\*[\s\S]*?\*\//, | ||
greedy: true | ||
}, | ||
'string': [ | ||
{ | ||
pattern: /(^|[^\\])"(?:[^\r\n"\\]|\\.)*"/, | ||
lookbehind: true, | ||
greedy: true | ||
}, | ||
{ | ||
pattern: /(^|[^\\])'(?:[^\r\n'\\]|\\(?:[\s\S]|\d{1,3}))'/, | ||
lookbehind: true, | ||
greedy: true | ||
} | ||
], | ||
|
||
'annotation': { | ||
pattern: /@(?:[$\w.-]|`[^\r\n`]+`)+/, | ||
greedy: true, | ||
alias: 'function' | ||
}, | ||
'function-identifier': { | ||
pattern: /`[^\r\n`]+`(?=\s*\()/, | ||
greedy: true, | ||
alias: 'function' | ||
}, | ||
'identifier': { | ||
pattern: /`[^\r\n`]+`/, | ||
greedy: true | ||
}, | ||
|
||
'class-name': { | ||
pattern: /(\b(?:enum|error|protocol|record|throws)\b\s+)[$\w]+/, | ||
lookbehind: true, | ||
greedy: true | ||
}, | ||
'keyword': /\b(?:array|boolean|bytes|date|decimal|double|enum|error|false|fixed|float|idl|import|int|local_timestamp_ms|long|map|null|oneway|protocol|record|schema|string|throws|time_ms|timestamp_ms|true|union|uuid|void)\b/, | ||
'function': /\b[a-z_]\w*(?=\s*\()/i, | ||
|
||
'number': [ | ||
{ | ||
pattern: /(^|[^\w.])-?(?:(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|0x(?:[a-f0-9]+(?:\.[a-f0-9]*)?|\.[a-f0-9]+)(?:p[+-]?\d+)?)[dfl]?(?![\w.])/i, | ||
lookbehind: true | ||
}, | ||
/-?\b(?:NaN|Infinity)\b/ | ||
], | ||
|
||
'operator': /=/, | ||
'punctuation': /[()\[\]{}<>.:,;-]/ | ||
}; | ||
|
||
Prism.languages.avdl = Prism.languages['avro-idl']; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// https://gn.googlesource.com/gn/+/refs/heads/main/docs/reference.md#grammar | ||
|
||
Prism.languages.gn = { | ||
'comment': { | ||
pattern: /#.*/, | ||
greedy: true | ||
}, | ||
'string-literal': { | ||
pattern: /(^|[^\\"])"(?:[^\r\n"\\]|\\.)*"/, | ||
lookbehind: true, | ||
greedy: true, | ||
inside: { | ||
'interpolation': { | ||
pattern: /((?:^|[^\\])(?:\\{2})*)\$(?:\{[\s\S]*?\}|[a-zA-Z_]\w*|0x[a-fA-F0-9]{2})/, | ||
lookbehind: true, | ||
inside: { | ||
'number': /^\$0x[\s\S]{2}$/, | ||
'variable': /^\$\w+$/, | ||
'interpolation-punctuation': { | ||
pattern: /^\$\{|\}$/, | ||
alias: 'punctuation' | ||
}, | ||
'expression': { | ||
pattern: /[\s\S]+/, | ||
inside: null // see below | ||
} | ||
} | ||
}, | ||
'string': /[\s\S]+/ | ||
} | ||
}, | ||
|
||
'keyword': /\b(?:else|if)\b/, | ||
'boolean': /\b(?:true|false)\b/, | ||
'builtin-function': { | ||
// a few functions get special highlighting to improve readability | ||
pattern: /\b(?:assert|defined|foreach|import|pool|print|template|tool|toolchain)(?=\s*\()/i, | ||
alias: 'keyword' | ||
}, | ||
'function': /\b[a-z_]\w*(?=\s*\()/i, | ||
'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_out_dir|target_os)\b/, | ||
|
||
'number': /-?\b\d+\b/, | ||
|
||
'operator': /[-+!=<>]=?|&&|\|\|/, | ||
'punctuation': /[(){}[\],.]/ | ||
}; | ||
|
||
Prism.languages.gn['string-literal'].inside['interpolation'].inside['expression'].inside = Prism.languages.gn; | ||
|
||
Prism.languages.gni = Prism.languages.gn; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<h2>Full example</h2> | ||
<pre><code>// Source: https://avro.apache.org/docs/current/idl.html#example | ||
|
||
/** | ||
* An example protocol in Avro IDL | ||
*/ | ||
@namespace("org.apache.avro.test") | ||
protocol Simple { | ||
|
||
@aliases(["org.foo.KindOf"]) | ||
enum Kind { | ||
FOO, | ||
BAR, // the bar enum value | ||
BAZ | ||
} | ||
|
||
fixed MD5(16); | ||
|
||
record TestRecord { | ||
@order("ignore") | ||
string name; | ||
|
||
@order("descending") | ||
Kind kind; | ||
|
||
MD5 hash; | ||
|
||
union { MD5, null} @aliases(["hash"]) nullableHash; | ||
|
||
array<long> arrayOfLongs; | ||
} | ||
|
||
error TestError { | ||
string message; | ||
} | ||
|
||
string hello(string greeting); | ||
TestRecord echo(TestRecord `record`); | ||
int add(int arg1, int arg2); | ||
bytes echoBytes(bytes data); | ||
void `error`() throws TestError; | ||
void ping() oneway; | ||
} | ||
</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<h2>Full example</h2> | ||
<pre><code># Source: https://gn.googlesource.com/gn/+/main/docs/cross_compiles.md | ||
|
||
declare_args() { | ||
# Applies only to toolchains targeting target_cpu. | ||
sysroot = "" | ||
} | ||
|
||
config("my_config") { | ||
# Uses current_cpu because compile flags are toolchain-dependent. | ||
if (current_cpu == "arm") { | ||
defines = [ "CPU_IS_32_BIT" ] | ||
} else { | ||
defines = [ "CPU_IS_64_BIT" ] | ||
} | ||
# Compares current_cpu with target_cpu to see whether current_toolchain | ||
# has the same architecture as target_toolchain. | ||
if (sysroot != "" && current_cpu == target_cpu) { | ||
cflags = [ | ||
"-isysroot", | ||
sysroot, | ||
] | ||
} | ||
}</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.