Search code examples
mvel

How many keywords or reserved words in MVEL


How many keywords or reserved words in MVEL, can anyone list them out? I did not find out in the official documentation of MVEL, really appreciate any helps your can provide.


Solution

  • There may be new additions and deletions based on the version you are using

    But according to this doc,this is the function used to check if the specified string is a reserved word in the parser.

    public static boolean  isReservedWord(String name) {    
           return LITERALS.containsKey(name) || OPERATORS.containsKey(name);
        }
    

    Where

    Literals Map contains

    true,Array,Boolean,boolean,char,Character,Class,ClassLoader,Compiler,Double,double,empty,false,Float,float,int,Integer,Long,long,Math,nil,null,Object,Runtime,SecurityManager,Short,short,StrictMath,String,StringBuffer,StringBuilder,System,Thread,ThreadLocal,Void
    

    Operators List

    if,-,--,!=,#,%,&,&&,*,**,/,:,;,?,^,|,||,~=,+,++,+=,<,<<,<<<,<=,=,-=,==,>,>=,>>,>>>,and,assert,contains,convertable_to,def,do,else,for,foreach,function,import,import_static,in,instanceof,is,new,or,return,soundslike,strsim,switch,var,while,with