[antlr-interest] how to check if a optional token exists or not ??
OJAY78 at gmx.de
OJAY78 at gmx.de
Fri Nov 16 00:23:16 PST 2007
Hi,
I stuck on a small Problem. I have this rule with an optional token meta. In the Java Code I want to check if this token is null or not so that I can call a other method. But this check of the meta token will result in a nullpointer exception. Does anyone know how I can solve this? How can I check the meta token?
Thanks
valueType returns[StringObject value]
:'value' ',' rv=function_parameter (',' meta=valueMetaType)?
{
String valName = $rv.value;
FormValue fv = formInstance.getFormValue( valName
if( fv == null ) {
log.debug("VALUE TYPE: Feld ist leer");
$value = new StringObject("",null,null);
}
else {
if ($meta.text == null){
$value = new StringObject(fv.getFieldValue().toString(),fv,valName);
}
else{
$value=FELHelper.getFormValueMeta(fv,$meta.text);
}
}
}
;
--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
More information about the antlr-interest
mailing list