Skip to content

Commit

Permalink
Added Schema Kwargs
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal <[email protected]>
  • Loading branch information
Vishalk91-4 committed Jul 23, 2024
1 parent 173307c commit 10ed19e
Show file tree
Hide file tree
Showing 5 changed files with 79,542 additions and 77,713 deletions.
8 changes: 7 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ module.exports = grammar({
$.dict_expr,
),

schema_instantiation: $ => seq(
field('constructor', $.call),
field('initialization', $.dictionary)
),

schema_index_signature: $ => seq(
'[',
optional(seq(
Expand Down Expand Up @@ -576,6 +581,7 @@ module.exports = grammar({
$.lambda_expr,
$.quant_expr,
$.schema_expr,
$.schema_instantiation,
$.paren_expression,
$.braces_expression,
$.optional_attribute,
Expand Down Expand Up @@ -761,7 +767,7 @@ module.exports = grammar({
assignment: $ => seq(
field('left', $.dotted_name),
choice(
seq('=', field('right', choice($.dotted_name,$.expression, $.selector_expression))),
seq('=', field('right', choice($.dotted_name,$.expression, $.selector_expression, $.schema_instantiation))),
seq(':', field('type', $.type), '=', field('right', $.expression)),
alias(seq(':',field('type', $.type)),'null_assignment'),
),
Expand Down
29 changes: 29 additions & 0 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,27 @@
}
]
},
"schema_instantiation": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "constructor",
"content": {
"type": "SYMBOL",
"name": "call"
}
},
{
"type": "FIELD",
"name": "initialization",
"content": {
"type": "SYMBOL",
"name": "dictionary"
}
}
]
},
"schema_index_signature": {
"type": "SEQ",
"members": [
Expand Down Expand Up @@ -1650,6 +1671,10 @@
"type": "SYMBOL",
"name": "schema_expr"
},
{
"type": "SYMBOL",
"name": "schema_instantiation"
},
{
"type": "SYMBOL",
"name": "paren_expression"
Expand Down Expand Up @@ -2893,6 +2918,10 @@
{
"type": "SYMBOL",
"name": "selector_expression"
},
{
"type": "SYMBOL",
"name": "schema_instantiation"
}
]
}
Expand Down
38 changes: 36 additions & 2 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@
"type": "schema_expr",
"named": true
},
{
"type": "schema_instantiation",
"named": true
},
{
"type": "select_suffix",
"named": true
Expand Down Expand Up @@ -372,6 +376,10 @@
{
"type": "expression",
"named": true
},
{
"type": "schema_instantiation",
"named": true
}
]
},
Expand Down Expand Up @@ -2036,6 +2044,32 @@
}
}
},
{
"type": "schema_instantiation",
"named": true,
"fields": {
"constructor": {
"multiple": false,
"required": true,
"types": [
{
"type": "call",
"named": true
}
]
},
"initialization": {
"multiple": false,
"required": true,
"types": [
{
"type": "dictionary",
"named": true
}
]
}
}
},
{
"type": "schema_statement",
"named": true,
Expand Down Expand Up @@ -2738,11 +2772,11 @@
},
{
"type": "float",
"named": true
"named": false
},
{
"type": "float",
"named": false
"named": true
},
{
"type": "for",
Expand Down
Loading

0 comments on commit 10ed19e

Please sign in to comment.