on master help sign in
Add JQ syntax highlighting
commite4f6fb2afef5b7d732d3960924294fe7ec86a94a authorltdk <usr@ltdk.xyz> dateSat 12 Feb 2022, 14:18 (5 years ago) parentd21f1e8
6 files changed+150
.gitmodules+3 CHANGELOG.md+1 assets/syntaxes/02_Extra/SublimeJQ+1 tests/syntax-tests/highlighted/JQ/sample.jq+60 tests/syntax-tests/source/JQ/LICENSE.md+25 tests/syntax-tests/source/JQ/sample.jq+60
.gitmodules+3
@@ -236,3 +236,6 @@
236236[submodule "assets/syntaxes/02_Extra/Dart"]
237237 path = assets/syntaxes/02_Extra/Dart
238238 url = https://github.com/elMuso/Dartlight.git
239+[submodule "assets/syntaxes/02_Extra/SublimeJQ"]
240+ path = assets/syntaxes/02_Extra/SublimeJQ
241+ url = https://github.com/zogwarg/SublimeJQ.git
CHANGELOG.md+1
@@ -15,6 +15,7 @@
1515- Associate `_vimrc` and `_gvimrc` files with the `VimL` syntax. See #2002
1616- Associate `poetry.lock` files with the `TOML` syntax. See #2049
1717- Associate `.mesh`, `.task`, `.rgen`, `.rint`, `.rahit`, `.rchit`, `.rmiss`, and `.rcall` with the `GLSL` syntax. See #2050
18+- Added support for `JQ` syntax, see #2072
1819
1920## Themes
2021
assets/syntaxes/02_Extra/SublimeJQnew file+1

Submodule changed.

tests/syntax-tests/highlighted/JQ/sample.jqnew file+60
@@ -0,0 +1,60 @@
1+import "../imported-file" ;
2+
3+# With Comments !
4+def weird($a; $b; $c):
5+ [ $a, $b, $c ] | transpose | reduce .[][] as $item (
6+ [];
7+ . + $item.property
8+ )
9+;
10+
11+. | weird (.a; .b; .c) |
12+
13+(
14+
15+if (. | contains("never") ) then
16+ "Why yes"
17+else
18+ 12.23
19+end
20+
21+) as $never |
22+
23+{
24+ hello,
25+ why: "because",
26+ hello: ( weird | ascii_upcase ),
27+ format_eg: ( . | @json "My json string \( . | this | part | just | white | ascii_upcase | transpose)" ),
28+ never: $never,
29+ "literal_key": literal_value,
30+ "this": 12.1e12,
31+ "part": "almost"
32+ "like": [
33+ 12,
34+ 2
35+ "json"
36+ {
37+ "quite": {
38+ similar: "but not quite"
39+ }
40+ }
41+ ],
42+} | (
43+ 
44+ # And with very basic brace matching
45+ 
46+ # Invalid End
47+ ] 
48+ 
49+ # Other invalid ends
50+ ( [ } ] )
51+
52+ # A "valid" sequence
53+ ( [ { key: () , other_key:( [ [] [[]] ] ), gaga } ] )
54+
55+ # A "invalid" sequence
56+ ( [ { key: () , other_key:( [ [] [[] ] ), gaga } ] )
57+
58+ "A string\n whith escaped characters \" because we can"
59+)
60+
tests/syntax-tests/source/JQ/LICENSE.mdnew file+25
@@ -0,0 +1,25 @@
1+The `sample.jq` file was taken from [SublimeJQ] under the following license:
2+
3+[SublimeJQ]: https://github.com/zogwarg/SublimeJQ
4+
5+MIT License
6+
7+Copyright (c) 2017 Thomas Buick
8+
9+Permission is hereby granted, free of charge, to any person obtaining a copy
10+of this software and associated documentation files (the "Software"), to deal
11+in the Software without restriction, including without limitation the rights
12+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+copies of the Software, and to permit persons to whom the Software is
14+furnished to do so, subject to the following conditions:
15+
16+The above copyright notice and this permission notice shall be included in all
17+copies or substantial portions of the Software.
18+
19+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25+SOFTWARE.
tests/syntax-tests/source/JQ/sample.jqnew file+60
@@ -0,0 +1,60 @@
1+import "../imported-file" ;
2+
3+# With Comments !
4+def weird($a; $b; $c):
5+ [ $a, $b, $c ] | transpose | reduce .[][] as $item (
6+ [];
7+ . + $item.property
8+ )
9+;
10+
11+. | weird (.a; .b; .c) |
12+
13+(
14+
15+if (. | contains("never") ) then
16+ "Why yes"
17+else
18+ 12.23
19+end
20+
21+) as $never |
22+
23+{
24+ hello,
25+ why: "because",
26+ hello: ( weird | ascii_upcase ),
27+ format_eg: ( . | @json "My json string \( . | this | part | just | white | ascii_upcase | transpose)" ),
28+ never: $never,
29+ "literal_key": literal_value,
30+ "this": 12.1e12,
31+ "part": "almost"
32+ "like": [
33+ 12,
34+ 2
35+ "json"
36+ {
37+ "quite": {
38+ similar: "but not quite"
39+ }
40+ }
41+ ],
42+} | (
43+
44+ # And with very basic brace matching
45+
46+ # Invalid End
47+ ]
48+
49+ # Other invalid ends
50+ ( [ } ] )
51+
52+ # A "valid" sequence
53+ ( [ { key: () , other_key:( [ [] [[]] ] ), gaga } ] )
54+
55+ # A "invalid" sequence
56+ ( [ { key: () , other_key:( [ [] [[] ] ), gaga } ] )
57+
58+ "A string\n whith escaped characters \" because we can"
59+)
60+