Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/usr.bin/xlint/lint1



Module Name:    src
Committed By:   rillig
Date:           Sun Jul 11 16:57:21 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: cgram.y

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.306 -r1.307 src/usr.bin/xlint/lint1/cgram.y

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index