Search in sources :

Example 1 with Type

use of io.github.wysohn.triggerreactor.core.script.Token.Type in project TriggerReactor by wysohn.

the class Parser method nextToken.

private void nextToken() throws IOException, ParserException {
    try {
        token = lexer.getToken();
        if (showWarnings && token != null) {
            int row = lexer.getRow();
            Type type = token.type;
            String value = String.valueOf(token.value);
            if (type == null || value == null)
                return;
            if (deprecationSupervisors.stream().anyMatch(deprecationSupervisor -> deprecationSupervisor.isDeprecated(type, value))) {
                this.warnings.add(new DeprecationWarning(row, value, lexer.getScriptLines()[row - 1]));
            }
        }
    } catch (LexerException lex) {
        ParserException pex = new ParserException("Error occured while processing a token after " + token);
        pex.initCause(lex);
        throw pex;
    }
}
Also used : Type(io.github.wysohn.triggerreactor.core.script.Token.Type) DeprecationWarning(io.github.wysohn.triggerreactor.core.script.warning.DeprecationWarning) LexerException(io.github.wysohn.triggerreactor.core.script.lexer.LexerException)

Aggregations

Type (io.github.wysohn.triggerreactor.core.script.Token.Type)1 LexerException (io.github.wysohn.triggerreactor.core.script.lexer.LexerException)1 DeprecationWarning (io.github.wysohn.triggerreactor.core.script.warning.DeprecationWarning)1