Link [ NetBSD | NetBSD OpenGrok source search | PR fulltext-search | Summary of daily snapshot builds | history of daily build result | pkgsrc commit viewer ]


   
        usage: [branch:branch] [user:user] [path@revision] keyword [... [-excludekeyword [...]]] (e.g. branch:MAIN sys/arch/arm, if_wm.c@1.234 )




switch to index mode

recent branches: MAIN (4h)  netbsd-10 (7d)  netbsd-9 (7d)  netbsd-8 (12d) 

2024-05-24 02:12:31 UTC Now

2021-07-11 16:57:21 UTC MAIN commitmail json YAML

lint: resolve shift/reduce conflicts for unary expressions

The grammar rule 'term' was ambiguous since both the prefix and postfix
increment operators were listed with the same precedence.  The
expression '++x++' was parsed as '++ (x++)', as expected, since
conflicts resolve towards shift.

Resolve these conflicts by structuring the grammar as in C99, with the
GCC extension of statement-expressions.  The resolved conflicts are:

134: shift/reduce conflict (shift 161, reduce 347) on T_LBRACK
134: shift/reduce conflict (shift 162, reduce 347) on T_LPAREN
134: shift/reduce conflict (shift 163, reduce 347) on T_POINT
134: shift/reduce conflict (shift 164, reduce 347) on T_ARROW
134: shift/reduce conflict (shift 165, reduce 347) on T_INCDEC
state 134
term : term . T_INCDEC  (335)
term : term . T_LBRACK expr T_RBRACK  (341)
term : term . T_LPAREN T_RPAREN  (342)
term : term . T_LPAREN argument_expression_list T_RPAREN  (343)
term : term . point_or_arrow T_NAME  (344)
term : T_EXTENSION term .  (347)

No functional change.

(rillig)