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

Add more scopes to the tree-sitter grammar #303

Merged
merged 5 commits into from
Nov 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions grammars/tree-sitter-c.cson
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,20 @@ scopes:
'"_Atomic"': 'storage.modifier'
'function_specifier': 'storage.modifier'

'";"': 'punctuation.terminator.statement'
'"["': 'punctuation.definition.begin.bracket.square'
'"]"': 'punctuation.definition.end.bracket.square'
'","': 'punctuation.separator.delimiter'
'char_literal > "\'"': 'punctuation.definition.string'
# 'string_literal > "\"': 'punctuation.definition.string' # TODO: Figure out why this doesn't work
'"{"': 'punctuation.section.block.begin.bracket.curly'
'"}"': 'punctuation.section.block.end.bracket.curly'
'"("': 'punctuation.section.parens.begin.bracket.round'
'")"': 'punctuation.section.parens.end.bracket.round'

'"sizeof"': 'keyword.operator.sizeof'
'"."': 'keyword.operator.member'
'"->"': 'keyword.operator.member'
'"*"': 'keyword.operator'
'"-"': 'keyword.operator'
'"+"': 'keyword.operator'
Expand All @@ -136,6 +149,7 @@ scopes:
'"!"': 'keyword.operator'
'"!="': 'keyword.operator'
'"<"': 'keyword.operator'
'">"': 'keyword.operator'
'">="': 'keyword.operator'
'"<="': 'keyword.operator'
'"&&"': 'keyword.operator'
Expand Down
29 changes: 27 additions & 2 deletions grammars/tree-sitter-cpp.cson
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,33 @@ scopes:
'"final"': 'storage.modifier'
'"override"': 'storage.modifier'

'";"': 'punctuation.terminator.statement'
'"["': 'punctuation.definition.begin.bracket.square'
'"]"': 'punctuation.definition.end.bracket.square'
'access_specifier > ":"': 'punctuation.definition.visibility.colon'
'base_class_clause > ":"': 'punctuation.definition.inheritance.colon'
'base_class_clause > ","': 'punctuation.definition.separator.class.comma'
'field_declaration > ","': 'punctuation.separator.delimiter'
'parameter_list > ","': 'punctuation.separator.delimiter'
'field_initializer_list > ":"': 'punctuation.definition.initialization.colon'
'field_initializer_list > ","': 'punctuation.separator.delimiter'
'"::"': 'punctuation.separator.method.double-colon'
'template_parameter_list > "<"': 'punctuation.definition.template.bracket.angle'
'template_parameter_list > ">"': 'punctuation.definition.template.bracket.angle'
'template_argument_list > ">"': 'punctuation.definition.template.bracket.angle'
'template_argument_list > "<"': 'punctuation.definition.template.bracket.angle'
'char_literal > "\'"': 'punctuation.definition.string'
# 'string_literal > "\""': 'punctuation.definition.string' # TODO: Figure out why this doesn't work
'"{"': 'punctuation.section.block.begin.bracket.curly'
'"}"': 'punctuation.section.block.end.bracket.curly'
'"("': 'punctuation.section.parens.begin.bracket.round'
'")"': 'punctuation.section.parens.end.bracket.round'

'"sizeof"': 'keyword.operator.sizeof'
'"new"': 'keyword.operator'
'"delete"': 'keyword.operator'
'"."': 'keyword.operator.member'
'"->"': 'keyword.operator.member'
'"*"': 'keyword.operator'
'"-"': 'keyword.operator'
'"+"': 'keyword.operator'
Expand All @@ -185,7 +209,8 @@ scopes:
'"=="': 'keyword.operator'
'"!"': 'keyword.operator'
'"!="': 'keyword.operator'
'"<"': 'keyword.operator'
'relational_expression > "<"': 'keyword.operator'
'relational_expression > ">"': 'keyword.operator'
'">="': 'keyword.operator'
'"<="': 'keyword.operator'
'"&&"': 'keyword.operator'
Expand All @@ -208,4 +233,4 @@ scopes:
'"^="': 'keyword.operator'
'"|="': 'keyword.operator'
'"?"': 'keyword.operator'
'":"': 'keyword.operator'
'conditional_expression > ":"': 'keyword.operator'