Add property sheet for syntax highlighting

This commit is contained in:
Max Brunsfeld 2018-12-13 17:23:56 -08:00
parent 22e568ea75
commit 57b42ed645
3 changed files with 277 additions and 1 deletions

View File

@ -21,5 +21,13 @@
"scripts": { "scripts": {
"build": "tree-sitter generate && node-gyp build", "build": "tree-sitter generate && node-gyp build",
"test": "tree-sitter test && tree-sitter parse examples --quiet --time" "test": "tree-sitter test && tree-sitter parse examples --quiet --time"
},
"tree-sitter": [
{
"textmate-scope": "text.html.basic",
"file-types": ["html"],
"highlights": "src/highlights.json",
"injection-regex": "html"
} }
]
} }

24
properties/highlights.css Normal file
View File

@ -0,0 +1,24 @@
tag_name {
scope: 'tag';
}
/* TODO - highlight as an error? */
erroneous_end_tag_name {
scope: 'tag';
}
doctype {
scope: 'constant';
}
attribute_name {
scope: 'attribute';
}
attribute_value {
scope: 'string';
}
comment {
scope: 'comment';
}

244
src/highlights.json Normal file
View File

@ -0,0 +1,244 @@
{
"states": [
{
"id": 0,
"property_set_id": 0,
"transitions": [
{
"type": "attribute_name",
"named": true,
"state_id": 4
},
{
"type": "attribute_value",
"named": true,
"state_id": 2
},
{
"type": "comment",
"named": true,
"state_id": 1
},
{
"type": "doctype",
"named": true,
"state_id": 5
},
{
"type": "erroneous_end_tag_name",
"named": true,
"state_id": 3
},
{
"type": "tag_name",
"named": true,
"state_id": 3
}
],
"default_next_state_id": 0
},
{
"id": 1,
"property_set_id": 1,
"transitions": [
{
"type": "attribute_name",
"named": true,
"state_id": 4
},
{
"type": "attribute_value",
"named": true,
"state_id": 2
},
{
"type": "comment",
"named": true,
"state_id": 1
},
{
"type": "doctype",
"named": true,
"state_id": 5
},
{
"type": "erroneous_end_tag_name",
"named": true,
"state_id": 3
},
{
"type": "tag_name",
"named": true,
"state_id": 3
}
],
"default_next_state_id": 0
},
{
"id": 2,
"property_set_id": 2,
"transitions": [
{
"type": "attribute_name",
"named": true,
"state_id": 4
},
{
"type": "attribute_value",
"named": true,
"state_id": 2
},
{
"type": "comment",
"named": true,
"state_id": 1
},
{
"type": "doctype",
"named": true,
"state_id": 5
},
{
"type": "erroneous_end_tag_name",
"named": true,
"state_id": 3
},
{
"type": "tag_name",
"named": true,
"state_id": 3
}
],
"default_next_state_id": 0
},
{
"id": 3,
"property_set_id": 3,
"transitions": [
{
"type": "attribute_name",
"named": true,
"state_id": 4
},
{
"type": "attribute_value",
"named": true,
"state_id": 2
},
{
"type": "comment",
"named": true,
"state_id": 1
},
{
"type": "doctype",
"named": true,
"state_id": 5
},
{
"type": "erroneous_end_tag_name",
"named": true,
"state_id": 3
},
{
"type": "tag_name",
"named": true,
"state_id": 3
}
],
"default_next_state_id": 0
},
{
"id": 4,
"property_set_id": 4,
"transitions": [
{
"type": "attribute_name",
"named": true,
"state_id": 4
},
{
"type": "attribute_value",
"named": true,
"state_id": 2
},
{
"type": "comment",
"named": true,
"state_id": 1
},
{
"type": "doctype",
"named": true,
"state_id": 5
},
{
"type": "erroneous_end_tag_name",
"named": true,
"state_id": 3
},
{
"type": "tag_name",
"named": true,
"state_id": 3
}
],
"default_next_state_id": 0
},
{
"id": 5,
"property_set_id": 5,
"transitions": [
{
"type": "attribute_name",
"named": true,
"state_id": 4
},
{
"type": "attribute_value",
"named": true,
"state_id": 2
},
{
"type": "comment",
"named": true,
"state_id": 1
},
{
"type": "doctype",
"named": true,
"state_id": 5
},
{
"type": "erroneous_end_tag_name",
"named": true,
"state_id": 3
},
{
"type": "tag_name",
"named": true,
"state_id": 3
}
],
"default_next_state_id": 0
}
],
"property_sets": [
{},
{
"scope": "comment"
},
{
"scope": "string"
},
{
"scope": "tag"
},
{
"scope": "attribute"
},
{
"scope": "constant"
}
]
}