Skip to content

Commit

Permalink
added operator nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
urbit-pilled committed Dec 4, 2024
1 parent a007890 commit f89a976
Show file tree
Hide file tree
Showing 8 changed files with 497,038 additions and 504,703 deletions.
Binary file modified crates/wasm-bindings/wasm_parsers/tree-sitter-c-sharp.wasm
Binary file not shown.
92 changes: 49 additions & 43 deletions resources/language-metavariables/tree-sitter-c-sharp/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,29 +457,29 @@ module.exports = grammar({
field(
"operator",
choice(
"!",
"~",
"++",
"--",
"true",
"false",
"+",
"-",
"*",
"/",
"%",
"^",
"|",
"&",
"<<",
">>",
">>>",
"==",
"!=",
">",
"<",
">=",
"<=",
$.op_not,
$.op_bitwise_not,
$.op_plus_plus,
$.op_minus_minus,
$.op_true,
$.op_false,
$.op_plus,
$.op_minus,
$.op_multiply,
$.op_divide,
$.op_modulo,
$.op_bitwise_xor,
$.op_bitwise_or,
$.op_bitwise_and,
$.op_left_shift,
$.op_right_shift,
$.op_unsigned_right_shift,
$.op_eq,
$.op_neq,
$.op_gt,
$.op_lt,
$.op_gte,
$.op_lte,
),
),
field("parameters", $.parameter_list),
Expand Down Expand Up @@ -1328,26 +1328,32 @@ module.exports = grammar({
field("right", $.expression),
),

op_lt: ($) => "<",
op_lte: ($) => "<=",
op_eq: ($) => "==",
op_neq: ($) => "!=",
op_gt: ($) => ">",
op_gte: ($) => ">=",
op_and: ($) => "&&",
op_or: ($) => "||",
op_bitwise_and: ($) => "&",
op_bitwise_or: ($) => "|",
op_bitwise_xor: ($) => "^",
op_left_shift: ($) => "<<",
op_right_shift: ($) => ">>",
op_unsigned_right_shift: ($) => ">>>",
op_plus: ($) => "+",
op_minus: ($) => "-",
op_multiply: ($) => "*",
op_divide: ($) => "/",
op_modulo: ($) => "%",
op_coalescing: ($) => "??",
op_lt: _ => "<",
op_lte: _ => "<=",
op_eq: _ => "==",
op_neq: _ => "!=",
op_gt: _ => ">",
op_gte: _ => ">=",
op_and: _ => "&&",
op_or: _ => "||",
op_bitwise_and: _ => "&",
op_bitwise_or: _ => "|",
op_bitwise_xor: _ => "^",
op_left_shift: _ => "<<",
op_right_shift: _ => ">>",
op_unsigned_right_shift: _ => ">>>",
op_plus: _ => "+",
op_minus: _ => "-",
op_multiply: _ => "*",
op_divide: _ => "/",
op_modulo: _ => "%",
op_coalescing: _ => "??",
op_not: _ => "!",
op_bitwise_not: _ => "~",
op_plus_plus: _ => "++",
op_minus_minus: _ => "--",
op_true: _ => "true",
op_false: _ => "false",

binary_expression: ($) =>
choice(
Expand Down
116 changes: 70 additions & 46 deletions resources/language-metavariables/tree-sitter-c-sharp/src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -1800,96 +1800,96 @@
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "!"
"type": "SYMBOL",
"name": "op_not"
},
{
"type": "STRING",
"value": "~"
"type": "SYMBOL",
"name": "op_bitwise_not"
},
{
"type": "STRING",
"value": "++"
"type": "SYMBOL",
"name": "op_plus_plus"
},
{
"type": "STRING",
"value": "--"
"type": "SYMBOL",
"name": "op_minus_minus"
},
{
"type": "STRING",
"value": "true"
"type": "SYMBOL",
"name": "op_true"
},
{
"type": "STRING",
"value": "false"
"type": "SYMBOL",
"name": "op_false"
},
{
"type": "STRING",
"value": "+"
"type": "SYMBOL",
"name": "op_plus"
},
{
"type": "STRING",
"value": "-"
"type": "SYMBOL",
"name": "op_minus"
},
{
"type": "STRING",
"value": "*"
"type": "SYMBOL",
"name": "op_multiply"
},
{
"type": "STRING",
"value": "/"
"type": "SYMBOL",
"name": "op_divide"
},
{
"type": "STRING",
"value": "%"
"type": "SYMBOL",
"name": "op_modulo"
},
{
"type": "STRING",
"value": "^"
"type": "SYMBOL",
"name": "op_bitwise_xor"
},
{
"type": "STRING",
"value": "|"
"type": "SYMBOL",
"name": "op_bitwise_or"
},
{
"type": "STRING",
"value": "&"
"type": "SYMBOL",
"name": "op_bitwise_and"
},
{
"type": "STRING",
"value": "<<"
"type": "SYMBOL",
"name": "op_left_shift"
},
{
"type": "STRING",
"value": ">>"
"type": "SYMBOL",
"name": "op_right_shift"
},
{
"type": "STRING",
"value": ">>>"
"type": "SYMBOL",
"name": "op_unsigned_right_shift"
},
{
"type": "STRING",
"value": "=="
"type": "SYMBOL",
"name": "op_eq"
},
{
"type": "STRING",
"value": "!="
"type": "SYMBOL",
"name": "op_neq"
},
{
"type": "STRING",
"value": ">"
"type": "SYMBOL",
"name": "op_gt"
},
{
"type": "STRING",
"value": "<"
"type": "SYMBOL",
"name": "op_lt"
},
{
"type": "STRING",
"value": ">="
"type": "SYMBOL",
"name": "op_gte"
},
{
"type": "STRING",
"value": "<="
"type": "SYMBOL",
"name": "op_lte"
}
]
}
Expand Down Expand Up @@ -6904,6 +6904,30 @@
"type": "STRING",
"value": "??"
},
"op_not": {
"type": "STRING",
"value": "!"
},
"op_bitwise_not": {
"type": "STRING",
"value": "~"
},
"op_plus_plus": {
"type": "STRING",
"value": "++"
},
"op_minus_minus": {
"type": "STRING",
"value": "--"
},
"op_true": {
"type": "STRING",
"value": "true"
},
"op_false": {
"type": "STRING",
"value": "false"
},
"binary_expression": {
"type": "CHOICE",
"members": [
Expand Down
Loading

0 comments on commit f89a976

Please sign in to comment.