@@ -5771,7 +5771,7 @@ class parser
5771
5771
5772
5772
// G postfix-expression:
5773
5773
// G primary-expression
5774
- // G postfix-expression postfix-operator // Note: without whitespace before the operator
5774
+ // G postfix-expression postfix-operator
5775
5775
// G postfix-expression '[' expression-list? ','? ']'
5776
5776
// G postfix-expression '(' expression-list? ','? ')'
5777
5777
// G postfix-expression '.' id-expression
@@ -5788,23 +5788,18 @@ class parser
5788
5788
while (
5789
5789
!done ()
5790
5790
&& (
5791
- (is_postfix_operator (curr ().type ())
5792
- // Postfix operators must be lexically adjacent
5793
- && curr ().position ().lineno == peek (-1 )->position ().lineno
5794
- && curr ().position ().colno == peek (-1 )->position ().colno + peek (-1 )->length ()
5795
- )
5791
+ is_postfix_operator (curr ().type ())
5796
5792
|| curr ().type () == lexeme::LeftBracket
5797
5793
|| curr ().type () == lexeme::LeftParen
5798
5794
|| curr ().type () == lexeme::Dot
5799
5795
)
5800
5796
)
5801
5797
{
5802
- // these can't be unary operators if followed by a (, identifier, or literal
5798
+ // * and & can't be unary operators if followed by a (, identifier, or literal
5803
5799
if (
5804
5800
(
5805
5801
curr ().type () == lexeme::Multiply
5806
5802
|| curr ().type () == lexeme::Ampersand
5807
- || curr ().type () == lexeme::Tilde
5808
5803
)
5809
5804
&& peek (1 )
5810
5805
&& (
@@ -5814,18 +5809,6 @@ class parser
5814
5809
)
5815
5810
)
5816
5811
{
5817
- auto op = curr ().to_string ();
5818
- auto msg = " postfix unary " + op;
5819
- if (curr ().type () == lexeme::Multiply ) { msg += " (dereference)" ; }
5820
- else if (curr ().type () == lexeme::Ampersand) { msg += " (address-of)" ; }
5821
- else if (curr ().type () == lexeme::Tilde ) { msg += " (unary bit-complement)" ; }
5822
- msg += " cannot be immediately followed by a (, identifier, or literal - add whitespace before "
5823
- + op + " here if you meant binary " + op;
5824
- if (curr ().type () == lexeme::Multiply ) { msg += " (multiplication)" ; }
5825
- else if (curr ().type () == lexeme::Ampersand) { msg += " (bitwise and)" ; }
5826
- else if (curr ().type () == lexeme::Tilde ) { msg += " (binary bit-complement)" ; }
5827
-
5828
- error (msg, false );
5829
5812
break ;
5830
5813
}
5831
5814
0 commit comments