Skip to content

Commit

Permalink
fix: import variable into array type
Browse files Browse the repository at this point in the history
  • Loading branch information
hhamud committed Aug 5, 2023
1 parent 7a37221 commit 6784b80
Show file tree
Hide file tree
Showing 5 changed files with 13,063 additions and 13,070 deletions.
4 changes: 2 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ module.exports = grammar({
$.string_literal,
$.identifier,
$.as_identifier,
$.import_identifier
$.import_variable
),

array: ($) =>
Expand Down Expand Up @@ -308,7 +308,7 @@ module.exports = grammar({
$.array_type,
$.generic_type,
$.function_type,
$.import_identifier,
$.import_variable,
field("type", $.identifier)
)
),
Expand Down
3 changes: 2 additions & 1 deletion noir-ts-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@
(let_declaration (binary_expression left: (grouped_expression (identifier) @font-lock-variable-name-face)))
(struct_definition var: (identifier) @font-lock-variable-name-face)
(typed_identifier var: (identifier) @font-lock-variable-name-face)
(global (binary_expression left: (typed_identifier var: (identifier) @font-lock-variable-name-face))))
(global (binary_expression left: (typed_identifier var: (identifier) @font-lock-variable-name-face)))
)

:feature 'string
:language 'noir
Expand Down
144 changes: 114 additions & 30 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@
},
{
"type": "SYMBOL",
"name": "import_identifier"
"name": "import_variable"
}
]
},
Expand Down Expand Up @@ -1282,7 +1282,7 @@
},
{
"type": "SYMBOL",
"name": "import_identifier"
"name": "import_variable"
},
{
"type": "FIELD",
Expand Down Expand Up @@ -2451,34 +2451,117 @@
}
],
"conflicts": [
["function_call", "self_method"],
["return_type", "generic_type"],
["_array_parameter", "_type"],
["_type", "generic_type"],
["_type", "array"],
["_type", "function_import"],
["array_type", "array"],
["generic_type", "typed_identifier"],
["array_identifier", "_expression", "_type"],
["array_identifier", "_expression"],
["function_call", "struct_expression"],
["_definition", "_expression"],
["_statement", "_expression"],
["struct_function", "struct_expression"],
["struct_function", "_expression"],
["struct_initialization", "single_type"],
["generic_type", "_type", "_expression"],
["function_call", "_type", "_expression"],
["_type", "_expression"],
["function_call", "_expression"],
["_expression", "struct_initialization"],
["_type", "_expression", "struct_initialization"],
["module"],
["_type"],
["typed_identifier"],
["self_method"],
["function_import"],
["let_declaration", "function_import"]
[
"function_call",
"self_method"
],
[
"return_type",
"generic_type"
],
[
"_array_parameter",
"_type"
],
[
"_type",
"generic_type"
],
[
"_type",
"array"
],
[
"_type",
"function_import"
],
[
"array_type",
"array"
],
[
"generic_type",
"typed_identifier"
],
[
"array_identifier",
"_expression",
"_type"
],
[
"array_identifier",
"_expression"
],
[
"function_call",
"struct_expression"
],
[
"_definition",
"_expression"
],
[
"_statement",
"_expression"
],
[
"struct_function",
"struct_expression"
],
[
"struct_function",
"_expression"
],
[
"struct_initialization",
"single_type"
],
[
"generic_type",
"_type",
"_expression"
],
[
"function_call",
"_type",
"_expression"
],
[
"_type",
"_expression"
],
[
"function_call",
"_expression"
],
[
"_expression",
"struct_initialization"
],
[
"_type",
"_expression",
"struct_initialization"
],
[
"module"
],
[
"_type"
],
[
"typed_identifier"
],
[
"self_method"
],
[
"function_import"
],
[
"let_declaration",
"function_import"
]
],
"precedences": [],
"externals": [
Expand All @@ -2490,3 +2573,4 @@
"inline": [],
"supertypes": []
}

24 changes: 8 additions & 16 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"named": true
},
{
"type": "import_identifier",
"type": "import_variable",
"named": true
},
{
Expand Down Expand Up @@ -89,7 +89,7 @@
"named": true
},
{
"type": "import_identifier",
"type": "import_variable",
"named": true
},
{
Expand Down Expand Up @@ -147,7 +147,7 @@
"named": true
},
{
"type": "import_identifier",
"type": "import_variable",
"named": true
},
{
Expand Down Expand Up @@ -655,10 +655,6 @@
"type": "import",
"named": true
},
{
"type": "import_identifier",
"named": true
},
{
"type": "import_variable",
"named": true
Expand Down Expand Up @@ -1734,7 +1730,7 @@
"named": true
},
{
"type": "import_identifier",
"type": "import_variable",
"named": true
},
{
Expand Down Expand Up @@ -1895,10 +1891,6 @@
"type": "import",
"named": true
},
{
"type": "import_identifier",
"named": true
},
{
"type": "import_variable",
"named": true
Expand Down Expand Up @@ -2026,7 +2018,7 @@
"named": true
},
{
"type": "import_identifier",
"type": "import_variable",
"named": true
},
{
Expand Down Expand Up @@ -2136,7 +2128,7 @@
"named": true
},
{
"type": "import_identifier",
"type": "import_variable",
"named": true
},
{
Expand Down Expand Up @@ -2227,7 +2219,7 @@
"named": true
},
{
"type": "import_identifier",
"type": "import_variable",
"named": true
},
{
Expand Down Expand Up @@ -2660,4 +2652,4 @@
"type": "}",
"named": false
}
]
]
Loading

0 comments on commit 6784b80

Please sign in to comment.