json sample in gallery

This commit is contained in:
liquidex 2024-03-12 20:05:31 +01:00
parent 1265796996
commit 34e20b13b0

View file

@ -91,3 +91,44 @@
```
note that `[^]` is not the same as `.`, because the latter omits newlines.
% id = "01HRT0W4AKQJEAMJ8XHJVMY4ZV"
- `json`
% id = "01HRT0W4AKPFENNFWMA7AAGN5Z"
- patterns
```json
abcd
0.912392198e+2113
"abcd":
"abcd"
,
```
% id = "01HRT0W4AK8D1W9ZN9HJTHC85Q"
- keywords
```json
null true false
```
% id = "01HRT0W4AK4F2S65M1NT75PCGQ"
- sample
```json
{
"patterns": [
{ "regex": "[a-zA-Z_][a-zA-Z0-9_]*", "is": "error" },
{ "regex": "[0-9]+(\\.[0-9]*([eE][-+]?[0-9]+)?)?", "is": "literal" },
{
"regex": "\"(\\\\\"|[^\"])*\"(:)",
"is": { "default": "keyword2", "captures": ["keyword2", "punct"] }
},
{ "regex": "\"(\\\\\"|[^\"])*\"", "is": "string" },
{ "regex": "[,]", "is": "punct" }
],
"keywords": {
"null": { "into": "literal" },
"true": { "into": "literal" },
"false": { "into": "literal" }
}
}
```