use of org.smartdata.rule.exceptions.RuleParserException in project SSM by Intel-bigdata.
the class SmartRuleVisitTranslator method visitIdObjAtt.
@Override
public TreeNode visitIdObjAtt(SmartRuleParser.IdObjAttContext ctx) {
SmartObject obj = createIfNotExist(ctx.OBJECTTYPE().toString());
Property p = obj.getProperty(ctx.ID().getText());
if (p == null) {
throw new RuleParserException("Object " + obj.toString() + " does not have a attribute named '" + "'" + ctx.ID().getText());
}
if (p.getParamsTypes() != null) {
throw new RuleParserException("Should have no parameter(s) for " + ctx.getText());
}
PropertyRealParas realParas = new PropertyRealParas(p, null);
realParases.add(realParas);
return new ValueNode(new VisitResult(p.getValueType(), null, realParas));
}
use of org.smartdata.rule.exceptions.RuleParserException in project SSM by Intel-bigdata.
the class SmartRuleVisitTranslator method visitIdObjAttPara.
@Override
public TreeNode visitIdObjAttPara(SmartRuleParser.IdObjAttParaContext ctx) {
String objName = ctx.OBJECTTYPE().getText();
String propertyName = ctx.ID().getText();
Property p = createIfNotExist(objName).getProperty(propertyName);
if (p == null) {
throw new RuleParserException("Object " + ctx.OBJECTTYPE().toString() + " does not have a attribute named '" + "'" + ctx.ID().getText());
}
if (p.getParamsTypes() == null) {
throw new RuleParserException(ctx.OBJECTTYPE().toString() + "." + ctx.ID().getText() + " does not need parameter(s)");
}
int numParameters = ctx.getChildCount() / 2 - 2;
if (p.getParamsTypes().size() != numParameters) {
throw new RuleParserException(ctx.OBJECTTYPE().toString() + "." + ctx.ID().getText() + " needs " + p.getParamsTypes().size() + " instead of " + numParameters);
}
return parseIdParams(ctx, p, 4);
}
use of org.smartdata.rule.exceptions.RuleParserException in project SSM by Intel-bigdata.
the class SmartRuleVisitTranslator method visitCmdlet.
@Override
public TreeNode visitCmdlet(SmartRuleParser.CmdletContext ctx) {
Interval i = new Interval(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex());
String cmd = ctx.getStart().getInputStream().getText(i);
try {
cmdDescriptor = CmdletDescriptor.fromCmdletString(cmd);
} catch (ParseException e) {
throw new RuleParserException(e.getMessage());
}
return null;
}
Aggregations