Skip to content

Commit

Permalink
feat: support json5 (#539)
Browse files Browse the repository at this point in the history
  • Loading branch information
narasux authored Oct 14, 2024
1 parent 2019102 commit df4cd7b
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions LANGUAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ Jenkins Buildfile (jenkinsfile)
Jinja (jinja,j2,jinja2)
jq (jq)
JSON (json)
JSON5 (json5)
JSONC (jsonc)
JSONL (jsonl)
Jsonnet (jsonnet,libsonnet)
Expand Down
6 changes: 3 additions & 3 deletions SCC-OUTPUT-REPORT.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<th>444</th>
<th>7611</th>
<th>1501</th>
<th>252816</th>
<th>252876</th>
<th>4061</th>
</tr><tr>
<td>processor/workers_test.go</td>
Expand Down Expand Up @@ -288,7 +288,7 @@
<td>0</td>
<td>4</td>
<td>0</td>
<td>22565</td>
<td>22625</td>
<td>5</td>
</tr></tbody>
<tfoot><tr>
Expand All @@ -299,7 +299,7 @@
<th>444</th>
<th>7611</th>
<th>1501</th>
<th>252816</th>
<th>252876</th>
<th>4061</th>
</tr>
<tr>
Expand Down
13 changes: 13 additions & 0 deletions examples/language/kitchen-sink.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// example from https://json5.org/
{
// comments
unquoted: 'and you can quote me on that',
singleQuotes: 'I can use "double quotes" here',
lineBreaks: "Look, Mom! \
No \\n's!",
hexadecimal: 0xdecaf,
leadingDecimalPoint: .8675309, andTrailing: 8675309.,
positiveSign: +1,
trailingComma: 'in objects', andIn: ['arrays',],
"backwardsCompatible": "with JSON",
}
7 changes: 7 additions & 0 deletions languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2952,6 +2952,13 @@
"multi_line": [],
"quotes": []
},
"JSON5": {
"complexitychecks": [],
"extensions": ["json5"],
"line_comment": ["//"],
"multi_line": [],
"quotes": []
},
"JSONC": {
"complexitychecks": [],
"extensions": ["jsonc"],
Expand Down
2 changes: 1 addition & 1 deletion processor/constants.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,7 @@ specificLanguages=(
'ignore '
'INI '
'Java '
'JSON5 '
'JSONC '
'jq '
'Korn Shell '
Expand Down

0 comments on commit df4cd7b

Please sign in to comment.