Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Implement naming conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
chbk committed Jan 12, 2021
1 parent 8ab471d commit d3d01dc
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 44 deletions.
19 changes: 10 additions & 9 deletions grammars/tree-sitter-ejs.cson
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ comments:

scopes:
'comment_directive': 'comment.block'
'comment_directive > "%>"': 'comment.block'

'"<%#"': 'keyword.control.directive'
'"<%"': 'keyword.control.directive'
'"<%="': 'keyword.control.directive'
'"<%_"': 'keyword.control.directive'
'"<%-"': 'keyword.control.directive'
'"%>"': 'keyword.control.directive'
'"-%>"': 'keyword.control.directive'
'"_%>"': 'keyword.control.directive'
'"<%#"': 'punctuation.definition.comment'
'comment_directive > "%>"': 'punctuation.definition.comment'

'"<%"': 'punctuation.delimiter.embedded.ejs'
'"<%="': 'punctuation.delimiter.embedded.ejs'
'"<%_"': 'punctuation.delimiter.embedded.ejs'
'"<%-"': 'punctuation.delimiter.embedded.ejs'
'"%>"': 'punctuation.delimiter.embedded.ejs'
'"-%>"': 'punctuation.delimiter.embedded.ejs'
'"_%>"': 'punctuation.delimiter.embedded.ejs'
19 changes: 10 additions & 9 deletions grammars/tree-sitter-erb.cson
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ comments:

scopes:
'comment_directive': 'comment.block'
'comment_directive > "%>"': 'comment.block'

'"<%#"': 'keyword.control.directive'
'"<%"': 'keyword.control.directive'
'"<%="': 'keyword.control.directive'
'"<%_"': 'keyword.control.directive'
'"<%-"': 'keyword.control.directive'
'"%>"': 'keyword.control.directive'
'"-%>"': 'keyword.control.directive'
'"_%>"': 'keyword.control.directive'
'"<%#"': 'punctuation.definition.comment'
'comment_directive > "%>"': 'punctuation.definition.comment'

'"<%"': 'punctuation.delimiter.embedded.erb'
'"<%="': 'punctuation.delimiter.embedded.erb'
'"<%_"': 'punctuation.delimiter.embedded.erb'
'"<%-"': 'punctuation.delimiter.embedded.erb'
'"%>"': 'punctuation.delimiter.embedded.erb'
'"-%>"': 'punctuation.delimiter.embedded.erb'
'"_%>"': 'punctuation.delimiter.embedded.erb'
64 changes: 38 additions & 26 deletions grammars/tree-sitter-html.cson
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,41 @@ comments:

scopes:
'fragment': 'source.html'
'tag_name': 'entity.name.tag'
'erroneous_end_tag_name': 'invalid.illegal'
'doctype': 'meta.tag.doctype.html'
'attribute_name': 'entity.other.attribute-name'
'attribute_value': 'string.html'
'comment': 'comment.block.html'

'
start_tag > "<",
end_tag > "</"
': 'punctuation.definition.tag.begin'
'
start_tag > ">",
end_tag > ">"
': 'punctuation.definition.tag.end'

'attribute > "="': 'punctuation.separator.key-value.html'

# quoted_attribute_value has three child nodes: ", attribute_value, and ".
# Target the first and last.
# Single quotes and double quotes are targeted in separate selectors because
# of quote-escaping difficulties.
"quoted_attribute_value > '\"':nth-child(0)": 'punctuation.definition.string.begin'
'quoted_attribute_value > "\'":nth-child(0)': 'punctuation.definition.string.begin'
"quoted_attribute_value > '\"':nth-child(2)": 'punctuation.definition.string.end'
'quoted_attribute_value > "\'":nth-child(2)': 'punctuation.definition.string.end'

# Entity
'tag_name': 'entity.tag'
'erroneous_end_tag_name': 'entity.tag.invalid.illegal'
'attribute_name': 'entity.attribute'

# String
'attribute > attribute_value': 'string.unquoted.attribute-value'
'attribute > quoted_attribute_value': 'string.quoted.attribute-value'

# Text
'text': 'text'

# Comment
'comment': 'comment.block'

# Punctuation
'"<"': 'punctuation.definition.tag'
'"</"': 'punctuation.definition.tag'
'">"': 'punctuation.definition.tag'
'"/>"': 'punctuation.definition.tag'
'"<!"': 'punctuation.definition.tag.doctype'
'doctype > ">"': 'punctuation.definition.tag.doctype'
'"="': 'punctuation.delimiter.pair'
'"\\""': 'punctuation.definition.string.quoted'
'"\'"': 'punctuation.definition.string.quoted'

'ERROR > "<"': 'punctuation.definition.tag.invalid.illegal'
'ERROR > "</"': 'punctuation.definition.tag.invalid.illegal'
'ERROR > ">"': 'punctuation.definition.tag.invalid.illegal'
'ERROR > "/>"': 'punctuation.definition.tag.invalid.illegal'
'ERROR > "<!"': 'punctuation.definition.tag.doctype.invalid.illegal'
'ERROR > "="': 'punctuation.delimiter.pair.invalid.illegal'
'ERROR > "\\""': 'punctuation.definition.string.quoted.invalid.illegal'
'ERROR > "\'"': 'punctuation.definition.string.quoted.invalid.illegal'

# Meta
'doctype': 'meta.doctype'

0 comments on commit d3d01dc

Please sign in to comment.