Subject: | until () { } not parsed as compound statement |
"until () BLOCK continue BLOCK" is just like while, but with a reversed condition. However, PPI parses them differently, making it hard to recognize "until" loops by looking at the parsed result (and thus tripping my code up :):
perl examples/test.pl 'until ($a < $b) { $c ++; }'
PPI::Document
PPI::Statement
PPI::Token::Word 'until'
PPI::Structure::Condition ( ... )
PPI::Statement::Expression
PPI::Token::Symbol '$a'
PPI::Token::Operator '<'
PPI::Token::Symbol '$b'
PPI::Structure::Block { ... }
PPI::Statement
PPI::Token::Symbol '$c'
PPI::Token::Operator '++'
PPI::Token::Structure ';'
perl examples/test.pl 'while ($a < $b) { $c ++; }'
PPI::Document
PPI::Statement::Compound
PPI::Token::Word 'while'
PPI::Structure::Condition ( ... )
PPI::Statement::Expression
PPI::Token::Symbol '$a'
PPI::Token::Operator '<'
PPI::Token::Symbol '$b'
PPI::Structure::Block { ... }
PPI::Statement
PPI::Token::Symbol '$c'
PPI::Token::Operator '++'
PPI::Token::Structure ';'
In case of "until", the first PPI::Statement should also be a PPI::Statement::Compound.
Best wishes,
Tels