Skip to content

Commit 6f1cec9

Browse files
authored
Merge pull request #33 from gmlarumbe/dynprec
Fix errors related to dynamic precedences
2 parents a4c339c + e84383c commit 6f1cec9

File tree

630 files changed

+1011744
-1000947
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

630 files changed

+1011744
-1000947
lines changed

grammar.js

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3694,7 +3694,7 @@ const rules = {
36943694
)),
36953695

36963696
subroutine_call: $ => choice(
3697-
prec.dynamic(-1, $.tf_call), // Give $.method_call higher priority
3697+
$.tf_call,
36983698
$.system_tf_call,
36993699
$.method_call,
37003700
seq(optseq('std', '::'), $.randomize_call),
@@ -3716,7 +3716,7 @@ const rules = {
37163716
repeat($.attribute_instance),
37173717
field('arguments', optseq('(', optional($.list_of_arguments), ')'))
37183718
),
3719-
$._built_in_method_call
3719+
prec.dynamic(1, $._built_in_method_call)
37203720
)),
37213721

37223722
_built_in_method_call: $ => choice(
@@ -3753,14 +3753,9 @@ const rules = {
37533753

37543754
identifier_list: $ => commaSep1($._identifier),
37553755

3756-
// TODO: Modified with respect to LRM:
3757-
// The $.implicit_class_handle should be matched by $.primary second
3758-
// condition. However there must be some precedences that prevent this from
3759-
// being detected. This workaround might complicate a bit more the parser but
3760-
// seems to work well.
37613756
_method_call_root: $ => choice(
37623757
$.primary,
3763-
prec.dynamic(2, seq($.implicit_class_handle, optional($.select))), // optional($.select) out of LRM
3758+
$.implicit_class_handle,
37643759
$.class_type, // Out of LRM: Added to support calling parameterized static methods
37653760
$.text_macro_usage, // Out of LRM, Added to fix parsing errors in UVM
37663761
),
@@ -3958,16 +3953,16 @@ const rules = {
39583953
constant_primary: $ => prec('constant_primary', choice(
39593954
$.primary_literal,
39603955
seq($.ps_parameter_identifier, optional($.constant_select)),
3961-
// seq($.specparam_identifier, optseq('[', $._constant_range_expression, ']')), // TODO:
3962-
$.genvar_identifier,
3963-
seq($.formal_port_identifier, optional($.constant_select)),
3964-
seq(optchoice($.package_scope, $.class_scope), $.enum_identifier),
3956+
// seq($.specparam_identifier, optseq('[', $._constant_range_expression, ']')),
3957+
// $.genvar_identifier,
3958+
// seq($.formal_port_identifier, optional($.constant_select)),
3959+
// seq(optchoice($.package_scope, $.class_scope), $.enum_identifier),
39653960
$.empty_unpacked_array_concatenation,
39663961
seq($.constant_concatenation, optseq('[', $._constant_range_expression, ']')),
39673962
seq($.constant_multiple_concatenation, optseq('[', $._constant_range_expression, ']')),
39683963
$.constant_function_call, // Out of LRM: original was 'seq($.constant_function_call, optseq('[', $._constant_range_expression, ']'))'
39693964
// $._constant_let_expression, // No need to add since it's syntax is the same as a tf_call/constant_function_call (true ambiguity that adds conflicts)
3970-
seq('(', $.constant_mintypmax_expression, ')'),
3965+
paren_expr($.constant_mintypmax_expression),
39713966
$.constant_cast,
39723967
$._constant_assignment_pattern_expression,
39733968
$.type_reference,
@@ -3986,7 +3981,7 @@ const rules = {
39863981

39873982
primary: $ => prec('primary', choice(
39883983
$.primary_literal,
3989-
prec.dynamic(1, choice(
3984+
choice(
39903985
seq(
39913986
optchoice($.class_qualifier, $.package_scope),
39923987
$.hierarchical_identifier,
@@ -3997,13 +3992,13 @@ const rules = {
39973992
// the option below fixes things and seems to work well (at the expense of maybe
39983993
// some more complexity in the parser)
39993994
seq($.implicit_class_handle, optional($.select)), // Out of LRM, but used as a workaround
4000-
)),
3995+
),
40013996
$.empty_unpacked_array_concatenation,
40023997
seq($.concatenation, optseq('[', $.range_expression, ']')),
40033998
seq($.multiple_concatenation, optseq('[', $.range_expression, ']')),
4004-
prec.dynamic(-1, $.function_subroutine_call), // Avoid giving precedence to nested method_call instead of to hierarchical_identifier
3999+
$.function_subroutine_call,
40054000
// $.let_expression, // No need to add since its syntax is the same as a tf_call/subroutine_call (true ambiguity that adds conflicts)
4006-
seq('(', $.mintypmax_expression, ')'),
4001+
paren_expr($.mintypmax_expression),
40074002
$.cast,
40084003
$.assignment_pattern_expression,
40094004
$.streaming_concatenation,
@@ -6110,7 +6105,6 @@ module.exports = grammar({
61106105
[$.module_path_primary, $.primary_literal],
61116106
[$.tf_call, $.constant_primary, $.module_path_primary, $.hierarchical_identifier],
61126107
[$.module_path_primary, $.primary],
6113-
[$.casting_type, $.path_delay_expression, $.constant_primary],
61146108
[$.full_path_description, $.full_edge_sensitive_path_description],
61156109
[$.parallel_path_description, $.parallel_edge_sensitive_path_description],
61166110
[$.scalar_timing_check_condition, $.mintypmax_expression],

0 commit comments

Comments
 (0)