Search in sources :

Example 1 with NoneCodeGenerator

use of com.googlecode.aviator.code.NoneCodeGenerator in project aviatorscript by killme2008.

the class AviatorEvaluatorInstance method validate.

/**
 * Validate a script text whether is a legal aviatorscript text, throw exception if not.
 *
 * @since 5.0.2
 * @param script the script text
 */
public void validate(final String script) {
    if (script == null || script.trim().length() == 0) {
        throw new CompileExpressionErrorException("Blank script");
    }
    ExpressionLexer lexer = new ExpressionLexer(this, script);
    CodeGenerator codeGenerator = new NoneCodeGenerator();
    ExpressionParser parser = new ExpressionParser(this, lexer, codeGenerator);
    parser.parse();
}
Also used : ExpressionLexer(com.googlecode.aviator.lexer.ExpressionLexer) CompileExpressionErrorException(com.googlecode.aviator.exception.CompileExpressionErrorException) NoneCodeGenerator(com.googlecode.aviator.code.NoneCodeGenerator) ExpressionParser(com.googlecode.aviator.parser.ExpressionParser) NoneCodeGenerator(com.googlecode.aviator.code.NoneCodeGenerator) EvalCodeGenerator(com.googlecode.aviator.code.EvalCodeGenerator) ASMCodeGenerator(com.googlecode.aviator.code.asm.ASMCodeGenerator) OptimizeCodeGenerator(com.googlecode.aviator.code.OptimizeCodeGenerator) CodeGenerator(com.googlecode.aviator.code.CodeGenerator) InterpretCodeGenerator(com.googlecode.aviator.code.interpreter.InterpretCodeGenerator)

Aggregations

CodeGenerator (com.googlecode.aviator.code.CodeGenerator)1 EvalCodeGenerator (com.googlecode.aviator.code.EvalCodeGenerator)1 NoneCodeGenerator (com.googlecode.aviator.code.NoneCodeGenerator)1 OptimizeCodeGenerator (com.googlecode.aviator.code.OptimizeCodeGenerator)1 ASMCodeGenerator (com.googlecode.aviator.code.asm.ASMCodeGenerator)1 InterpretCodeGenerator (com.googlecode.aviator.code.interpreter.InterpretCodeGenerator)1 CompileExpressionErrorException (com.googlecode.aviator.exception.CompileExpressionErrorException)1 ExpressionLexer (com.googlecode.aviator.lexer.ExpressionLexer)1 ExpressionParser (com.googlecode.aviator.parser.ExpressionParser)1