Skip to content

Commit

Permalink
feat: Metaclass operator now only accepts a classname literal.
Browse files Browse the repository at this point in the history
  • Loading branch information
apozharski committed Aug 19, 2024
1 parent ad1c471 commit ef2fc93
Show file tree
Hide file tree
Showing 5 changed files with 20,554 additions and 21,155 deletions.
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ module.exports = grammar({

not_operator: ($) => prec(PREC.not, seq('~', $._expression)),

metaclass_operator: ($) => prec.left(seq('?', $._expression)),
metaclass_operator: ($) => prec.left(seq('?', seq($.identifier,repeat(seq('.',$.identifier))))),

handle_operator: ($) =>
seq('@', seq($.identifier, repeat(seq('.', $.identifier)))),
Expand Down
26 changes: 24 additions & 2 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,29 @@
"value": "?"
},
{
"type": "SYMBOL",
"name": "_expression"
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "."
},
{
"type": "SYMBOL",
"name": "identifier"
}
]
}
}
]
}
]
}
Expand Down Expand Up @@ -3950,3 +3971,4 @@
"inline": [],
"supertypes": []
}

74 changes: 1 addition & 73 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,84 +2083,12 @@
"named": true,
"fields": {},
"children": {
"multiple": false,
"multiple": true,
"required": true,
"types": [
{
"type": "binary_operator",
"named": true
},
{
"type": "boolean",
"named": true
},
{
"type": "boolean_operator",
"named": true
},
{
"type": "cell",
"named": true
},
{
"type": "comparison_operator",
"named": true
},
{
"type": "field_expression",
"named": true
},
{
"type": "function_call",
"named": true
},
{
"type": "handle_operator",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "lambda",
"named": true
},
{
"type": "matrix",
"named": true
},
{
"type": "metaclass_operator",
"named": true
},
{
"type": "not_operator",
"named": true
},
{
"type": "number",
"named": true
},
{
"type": "parenthesis",
"named": true
},
{
"type": "postfix_operator",
"named": true
},
{
"type": "range",
"named": true
},
{
"type": "string",
"named": true
},
{
"type": "unary_operator",
"named": true
}
]
}
Expand Down
Loading

0 comments on commit ef2fc93

Please sign in to comment.