@@ -731,11 +731,10 @@ public Tuple2<? extends ParseTree, Integer> visitTokensSpec(TokensSpecContext ct
731
731
return Tuple .create (ctx , 0 );
732
732
}
733
733
734
- // align to the previous element
735
- for (int i = priorSiblings .size () - 2 ; i >= 0 ; i --) {
734
+ // align to the previous element; stop at the first id rule, index 0 is the TOKENS terminal itself
735
+ for (int i = priorSiblings .size () - 2 ; i >= 1 ; i --) {
736
736
ParseTree sibling = priorSiblings .get (i );
737
- // stop at the first id rule, index 0 is the TOKENS terminal itself
738
- if (i == 1 || ParseTrees .elementStartsLine (sibling )) {
737
+ if (ParseTrees .elementStartsLine (sibling )) {
739
738
return Tuple .create (sibling , 0 );
740
739
}
741
740
}
@@ -754,11 +753,10 @@ public Tuple2<? extends ParseTree, Integer> visitChannelsSpec(ChannelsSpecContex
754
753
return Tuple .create (ctx , 0 );
755
754
}
756
755
757
- // align to the previous element
758
- for (int i = priorSiblings .size () - 2 ; i >= 0 ; i --) {
756
+ // align to the previous element; stop at the first id rule, index 0 is the CHANNELS terminal itself
757
+ for (int i = priorSiblings .size () - 2 ; i >= 1 ; i --) {
759
758
ParseTree sibling = priorSiblings .get (i );
760
- // stop at the first id rule, index 0 is the CHANNELS terminal itself
761
- if (i == 1 || ParseTrees .elementStartsLine (sibling )) {
759
+ if (ParseTrees .elementStartsLine (sibling )) {
762
760
return Tuple .create (sibling , 0 );
763
761
}
764
762
}
0 commit comments