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 Nov 24, 2021
1 parent 8ab471d commit dd94394
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 46 deletions.
25 changes: 14 additions & 11 deletions grammars/tree-sitter-ejs.cson
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ comments:
end: '%>'

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'
'template': 'source.ejs'

'comment_directive': 'comment.block.html.ejs'

'"<%#"': 'punctuation.definition.comment.html.ejs'
'comment_directive > "%>"': 'punctuation.definition.comment.html.ejs'

'"<%"': 'punctuation.delimiter.embedded.html.ejs'
'"<%="': 'punctuation.delimiter.embedded.html.ejs'
'"<%_"': 'punctuation.delimiter.embedded.html.ejs'
'"<%-"': 'punctuation.delimiter.embedded.html.ejs'
'"%>"': 'punctuation.delimiter.embedded.html.ejs'
'"-%>"': 'punctuation.delimiter.embedded.html.ejs'
'"_%>"': 'punctuation.delimiter.embedded.html.ejs'
25 changes: 14 additions & 11 deletions grammars/tree-sitter-erb.cson
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ comments:
end: '%>'

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'
'template': 'source.erb'

'comment_directive': 'comment.block.html.erb'

'"<%#"': 'punctuation.definition.comment.html.erb'
'comment_directive > "%>"': 'punctuation.definition.comment.html.erb'

'"<%"': 'punctuation.delimiter.embedded.html.erb'
'"<%="': 'punctuation.delimiter.embedded.html.erb'
'"<%_"': 'punctuation.delimiter.embedded.html.erb'
'"<%-"': 'punctuation.delimiter.embedded.html.erb'
'"%>"': 'punctuation.delimiter.embedded.html.erb'
'"-%>"': 'punctuation.delimiter.embedded.html.erb'
'"_%>"': 'punctuation.delimiter.embedded.html.erb'
60 changes: 36 additions & 24 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'

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

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

# Text
'text': 'text.html'

# Comment
'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'
# Punctuation
'"<"': 'punctuation.definition.tag.html'
'"</"': 'punctuation.definition.tag.html'
'">"': 'punctuation.definition.tag.html'
'"/>"': 'punctuation.definition.tag.html'
'"<!"': 'punctuation.definition.tag.doctype.html'
'doctype > ">"': 'punctuation.definition.tag.doctype.html'
'"\\""': 'punctuation.definition.string.html'
'"\'"': 'punctuation.definition.string.html'
'"="': 'punctuation.association.pair.attribute-value.html'

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

# Meta
'doctype': 'meta.doctype.html'

0 comments on commit dd94394

Please sign in to comment.