question: private void adjustASIAndCollectFollowElements ( CustomInternalN4JSParser previousParser , boolean strict , Set < FollowElement > result ) { ObservableXtextTokenStream tokens = ( ObservableXtextTokenStream ) previousParser . getTokenStream ( ) ; int lastTokenIndex = tokens . size ( ) - 1 ; if ( lastTokenIndex >= 0 ) { CommonToken lastToken = ( CommonToken ) tokens . LT ( - 1 ) ; @ SuppressWarnings ( "unchecked" ) List < Token > tokenList = tokens . getTokens ( ) ; if ( lastToken == null ) { return ; } if ( shouldSkipASI ( lastToken ) ) { if ( maySkipASI ( lastToken , tokens ) ) { tokenList . remove ( lastTokenIndex ) ; result . addAll ( resetAndGetFollowElements ( tokens , strict ) ) ; removePostfixOperator ( result ) ; } } else if ( shouldAddSyntheticSemicolon ( previousParser , lastTokenIndex , lastToken ) ) { CommonToken token = new CommonToken ( semi ) ; tokenList . add ( token ) ; result . addAll ( resetAndGetFollowElements ( tokens , strict ) ) ; removePostfixOperator ( result ) ; } } }
target:  The second pass over the given input. If the input ends with an ASI, the semicolon is removed and it is parsed again since the production may have skipped the ASI if more input was present. Same applies for the opposite direction, e.g if it does not end with an ASI but the prev token suggests that there may have been a semicolon, it is inserted.