(CommonTokenStream tokens, int i)
| 373 | } |
| 374 | |
| 375 | public static int getPrecedingNL(CommonTokenStream tokens, int i) { |
| 376 | int precedingNL = 0; |
| 377 | List<Token> previousWS = getPreviousWS(tokens, i); |
| 378 | if ( previousWS!=null ) { |
| 379 | for (Token ws : previousWS) { |
| 380 | precedingNL += Tool.count(ws.getText(), '\n'); |
| 381 | } |
| 382 | } |
| 383 | return precedingNL; |
| 384 | } |
| 385 | |
| 386 | // if we have non-ws tokens like comments, we only count ws not in comments |
| 387 | public static List<Token> getPreviousWS(CommonTokenStream tokens, int i) { |
no test coverage detected