Search in sources :

Example 1 with InferredSemicolon

use of dyvilx.tools.parsing.token.InferredSemicolon in project Dyvil by Dyvil.

the class SemicolonInference method inferSemicolons.

public static void inferSemicolons(IToken first) {
    if (first == null) {
        return;
    }
    IToken prev = first;
    IToken next = first.next();
    while (next.type() != Tokens.EOF) {
        next.setPrev(prev);
        if (inferSemicolon(prev, next)) {
            final IToken semicolon = new InferredSemicolon(prev.endLine(), prev.endColumn());
            semicolon.setNext(next);
            semicolon.setPrev(prev);
            next.setPrev(semicolon);
            prev.setNext(semicolon);
        }
        prev = next;
        next = next.next();
    }
}
Also used : IToken(dyvilx.tools.parsing.token.IToken) InferredSemicolon(dyvilx.tools.parsing.token.InferredSemicolon)

Aggregations

IToken (dyvilx.tools.parsing.token.IToken)1 InferredSemicolon (dyvilx.tools.parsing.token.InferredSemicolon)1