Skip to content

Commit

Permalink
Merge pull request #286 from tamasvajk/remove-impossible-base-types
Browse files Browse the repository at this point in the history
Remove impossible base types from nullables, pointers and object creation
  • Loading branch information
tamasvajk authored Jan 13, 2023
2 parents 9c0b3e4 + ce5f27d commit e0f7253
Show file tree
Hide file tree
Showing 5 changed files with 1,011,126 additions and 1,009,130 deletions.
7 changes: 0 additions & 7 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ module.exports = grammar({

[$._nullable_base_type, $.stack_alloc_array_creation_expression],
[$._array_base_type, $.stack_alloc_array_creation_expression],
[$._pointer_base_type, $.stack_alloc_array_creation_expression],

[$._ref_base_type, $._array_base_type],
[$._ref_base_type, $._nullable_base_type],
Expand All @@ -95,7 +94,6 @@ module.exports = grammar({

[$.array_creation_expression, $._array_base_type],
[$.array_creation_expression, $._nullable_base_type],
[$.array_creation_expression, $._pointer_base_type],

[$._parameter_type_with_modifiers, $.this_expression],
[$._parameter_type_with_modifiers, $.ref_type],
Expand Down Expand Up @@ -720,15 +718,13 @@ module.exports = grammar({
_nullable_base_type: $ => choice(
$.array_type,
$._name,
$.function_pointer_type,
$.predefined_type,
$.tuple_type
),

pointer_type: $ => seq($._pointer_base_type, '*'),

_pointer_base_type: $ => choice(
$.array_type,
$._name,
$.nullable_type,
$.pointer_type,
Expand Down Expand Up @@ -1383,10 +1379,7 @@ module.exports = grammar({
_object_creation_type: $ => choice(
$._name,
$.nullable_type,
$.pointer_type,
$.function_pointer_type,
$.predefined_type,
$.tuple_type
),

parenthesized_expression: $ => seq('(', $._non_lvalue_expression, ')'),
Expand Down
8 changes: 4 additions & 4 deletions script/file_sizes.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
src/grammar.json 0.2MB 10909
src/node-types.json 0.1MB 7665
src/parser.c 50.6MB 1576511
src/grammar.json 0.2MB 10881
src/node-types.json 0.1MB 7645
src/parser.c 50.6MB 1578562
src/scanner.c 0.0MB 29
total 51.0MB 1595114
total 51.0MB 1597117
28 changes: 0 additions & 28 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3627,10 +3627,6 @@
"type": "SYMBOL",
"name": "_name"
},
{
"type": "SYMBOL",
"name": "function_pointer_type"
},
{
"type": "SYMBOL",
"name": "predefined_type"
Expand All @@ -3657,10 +3653,6 @@
"_pointer_base_type": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "array_type"
},
{
"type": "SYMBOL",
"name": "_name"
Expand Down Expand Up @@ -7320,21 +7312,9 @@
"type": "SYMBOL",
"name": "nullable_type"
},
{
"type": "SYMBOL",
"name": "pointer_type"
},
{
"type": "SYMBOL",
"name": "function_pointer_type"
},
{
"type": "SYMBOL",
"name": "predefined_type"
},
{
"type": "SYMBOL",
"name": "tuple_type"
}
]
},
Expand Down Expand Up @@ -10782,10 +10762,6 @@
"_array_base_type",
"stack_alloc_array_creation_expression"
],
[
"_pointer_base_type",
"stack_alloc_array_creation_expression"
],
[
"_ref_base_type",
"_array_base_type"
Expand Down Expand Up @@ -10822,10 +10798,6 @@
"array_creation_expression",
"_nullable_base_type"
],
[
"array_creation_expression",
"_pointer_base_type"
],
[
"_parameter_type_with_modifiers",
"this_expression"
Expand Down
Loading

0 comments on commit e0f7253

Please sign in to comment.