Skip to content

Commit

Permalink
feat: add support for jsonnet (#448)
Browse files Browse the repository at this point in the history
* feat: add support for jsonnet

* chore: add jsonnet example
  • Loading branch information
echozio authored Apr 19, 2024
1 parent f7f171d commit 68c29f8
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 2 deletions.
1 change: 1 addition & 0 deletions LANGUAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ Jinja (jinja,j2,jinja2)
JSON (json)
JSONC (jsonc)
JSONL (jsonl)
Jsonnet (jsonnet,libsonnet)
JSX (jsx)
Julia (jl)
Julius (julius)
Expand Down
40 changes: 40 additions & 0 deletions examples/language/jsonnet.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
local foo = "bar";

// This is a comment
# This is another comment
/*
* This is a bigger comment
*/

{
local bar = "foo",

array: [
"foo",
"bar",
123,
{ foo: "bar" },
],

number: 3e10,
anotherNumber: 3.14,
yetAnotherNumber: 4,
bool: true,

f:: function(x) x > 0,

object: {
foo: $.f(1) || $.f(-1),
bar: if std.objectHas(self, "foo") then "foo" else "bar",
another: {
foo: self["bar.bar"],
},
} + {
another+: {
"bar.bar": |||
foo
%(bar)s
||| % $.object,
},
},
}
50 changes: 50 additions & 0 deletions languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3628,6 +3628,56 @@
"multi_line": [],
"quotes": []
},
"Jsonnet": {
"complexitychecks": [
"for",
"if",
"else",
"||",
"&&",
"!=",
"=="
],
"extensions": [
"jsonnet",
"libsonnet"
],
"line_comment": [
"#",
"//"
],
"multi_line": [
[
"/*",
"*/"
]
],
"quotes": [
{
"end": "\"",
"start": "\""
},
{
"end": "'",
"start": "'"
},
{
"end": "|||",
"start": "|||"
},
{
"end": "\"",
"start": "@\""
},
{
"end": "'",
"start": "@'"
}
],
"shebangs": [
"jsonnet"
]
},
"JSX": {
"complexitychecks": [
"for ",
Expand Down
4 changes: 2 additions & 2 deletions processor/constants.go

Large diffs are not rendered by default.

0 comments on commit 68c29f8

Please sign in to comment.