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

Commit

Permalink
Merge pull request #303 from atom/b3-more-operators
Browse files Browse the repository at this point in the history
Add more scopes to the tree-sitter grammar
  • Loading branch information
Max Brunsfeld authored Nov 8, 2018
2 parents e28c086 + e1362f4 commit 3571118
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
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'

0 comments on commit 3571118

Please sign in to comment.