org.nutz.el.parse.IdentifierParse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nutz Show documentation
Show all versions of nutz Show documentation
Nutz, which is a collections of lightweight frameworks, each of them can be used independently
package org.nutz.el.parse;
import org.nutz.el.Parse;
import org.nutz.el.obj.AbstractObj;
import org.nutz.el.obj.IdentifierObj;
/**
* 标识符转换
* @author juqkai([email protected])
*
*/
public class IdentifierParse implements Parse{
public Object fetchItem(CharQueue exp) {
StringBuilder sb = new StringBuilder();
if(Character.isJavaIdentifierStart(exp.peek())){
sb.append(exp.poll());
while(!exp.isEmpty() && Character.isJavaIdentifierPart(exp.peek())){
sb.append(exp.poll());
}
if(sb.toString().equals("null")){
return new IdentifierObj(null);
}
if(sb.toString().equals("true")){
return Boolean.TRUE;
}
if(sb.toString().equals("false")){
return Boolean.FALSE;
}
return new AbstractObj(sb.toString());
}
return nullobj;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy