final PatternDescr patternDescr,
final Pattern pattern,
final ExprConstraintDescr descr ) {
if ( descr.getType() == ExprConstraintDescr.Type.POSITIONAL && pattern.getObjectType() instanceof ClassObjectType ) {
Class< ? > klazz = ((ClassObjectType) pattern.getObjectType()).getClassType();
TypeDeclaration tDecl = context.getPackageBuilder().getTypeDeclaration( klazz );
if ( tDecl == null ) {
context.getErrors().add( new DescrBuildError( context.getParentDescr(),
descr,
klazz,
"Unable to find @positional definitions for :" + klazz + "\n" ) );
return;
}
ClassDefinition clsDef = tDecl.getTypeClassDef();
if ( clsDef == null ) {
context.getErrors().add( new DescrBuildError( context.getParentDescr(),
descr,
null,
"Unable to find @positional field " + descr.getPosition() + " for class " + tDecl.getTypeName() + "\n" ) );
return;
}
FieldDefinition field = clsDef.getField( descr.getPosition() );
if ( field == null ) {
context.getErrors().add( new DescrBuildError( context.getParentDescr(),
descr,
null,
"Unable to find @positional field " + descr.getPosition() + " for class " + tDecl.getTypeName() + "\n" ) );
return;
}
// TODO: WTH is this??????
DRLLexer lex = new DRLLexer( new ANTLRStringStream( descr.getExpression() ) );