Subject: | End of list mistakenly seen as end of statement |
The following code fragment
($a || 0) || ($b || 0)
is parsed as follows:
PPI::Document
PPI::Structure::List ( ... )
PPI::Statement::Expression
PPI::Token::Symbol '$a'
PPI::Token::Operator '||'
PPI::Token::Number '0'
PPI::Statement
PPI::Token::Operator '||'
PPI::Structure::List ( ... )
PPI::Statement::Expression
PPI::Token::Symbol '$b'
PPI::Token::Operator '||'
PPI::Token::Number '0'
I believe that instead it should be something more like this:
PPI::Document
PPI::Statement
PPI::Structure::List ( ... )
PPI::Statement::Expression
PPI::Token::Symbol '$a'
PPI::Token::Operator '||'
PPI::Token::Number '0'
PPI::Token::Operator '||'
PPI::Structure::List ( ... )
PPI::Statement::Expression
PPI::Token::Symbol '$b'
PPI::Token::Operator '||'
Without the leading parens, the statement is instead parsed as expected:
$a || 0 || ($b || 0)
becomes (correctly)
PPI::Document
PPI::Statement
PPI::Token::Symbol '$a'
PPI::Token::Operator '||'
PPI::Token::Number '0'
PPI::Token::Operator '||'
PPI::Structure::List ( ... )
PPI::Statement::Expression
PPI::Token::Symbol '$b'
PPI::Token::Operator '||'
PPI::Token::Number '0'
PPI::Token::Number '0'