diff --git a/includes/parser/AFPTreeParser.php b/includes/parser/AFPTreeParser.php index 88246eb95..3058ee381 100644 --- a/includes/parser/AFPTreeParser.php +++ b/includes/parser/AFPTreeParser.php @@ -118,9 +118,11 @@ class AFPTreeParser { $this->move(); $position = $this->mPos; - if ( $this->mCur->type === AFPToken::TNONE || + if ( + $this->mCur->type === AFPToken::TNONE || ( $this->mCur->type === AFPToken::TBRACE && $this->mCur->value == ')' ) ) { + // Handle special cases which the other parser handled in doLevelAtom break; } diff --git a/tests/parserTests/multipleconditionals.t b/tests/parserTests/multipleconditionals.t new file mode 100644 index 000000000..74a7b9fbb --- /dev/null +++ b/tests/parserTests/multipleconditionals.t @@ -0,0 +1,28 @@ +/* For T152281 */ +v1 := 0; v2 := 0; +if ( 1 == 1 ) then +( + v1 := 1; v2 := 1; +) +else +( + v1 := 2; v2 := 2; +) +end; + +if ( 1 == 1 ) then + ( v1 := 1; ) +else +( + v1 := 2; v2 := 2; +) +end; + +if ( 1 == 1 ) then + ( v1 := 2 === 2 ? 1 : 3; ) +else +( + v1 := 'x' === 'y' ? 2 : 3; + v2 := v1 ** 2; +) +end; diff --git a/tests/phpunit/AbuseFilterParserTestCase.php b/tests/phpunit/AbuseFilterParserTestCase.php index ef30d67bd..455bd7a10 100644 --- a/tests/phpunit/AbuseFilterParserTestCase.php +++ b/tests/phpunit/AbuseFilterParserTestCase.php @@ -32,10 +32,6 @@ abstract class AbuseFilterParserTestCase extends MediaWikiTestCase { if ( !$parsers ) { $parsers = [ new AbuseFilterParser(), - // The following line can be removed if some tests fail only due to CachingParser: - // it is currently broken (T156095) and it could produce unwanted failures (T201193) - // @ToDo: This comment can be safely removed (making sure that a CachingParser is - // instantiated below) as T156095 will be resolved. new AbuseFilterCachingParser() ]; } else {