/** eats string literal */ public final boolean onText2( String literal, IDContextProvider2 context, StringRef refErr, DatatypeRef refType ) { if(!super.onText2(literal,context,refErr,refType)) return false; final StringToken token = new StringToken(docDecl,literal,context); final ResidualCalculator res = docDecl.resCalc; // some may become invalid, but at least one always remain valid for( int i=0; i<contents.length; i++ ) contents[i] = res.calcResidual( contents[i], token ); return true; }
/** eats string literal */ public final boolean onText2( String literal, IDContextProvider2 context, StringRef refErr, DatatypeRef refType ) { if(!super.onText2(literal,context,refErr,refType)) return false; final StringToken token = new StringToken(docDecl,literal,context); final ResidualCalculator res = docDecl.resCalc; // some may become invalid, but at least one always remain valid for( int i=0; i<contents.length; i++ ) contents[i] = res.calcResidual( contents[i], token ); return true; }
/** eats string literal */ public final boolean onText2( String literal, IDContextProvider2 context, StringRef refErr, DatatypeRef refType ) { if(!super.onText2(literal,context,refErr,refType)) return false; final StringToken token = new StringToken(docDecl,literal,context); final ResidualCalculator res = docDecl.resCalc; // some may become invalid, but at least one always remain valid for( int i=0; i<contents.length; i++ ) contents[i] = res.calcResidual( contents[i], token ); return true; }
/** eats string literal */ public final boolean onText2( String literal, IDContextProvider2 context, StringRef refErr, DatatypeRef refType ) { if(!super.onText2(literal,context,refErr,refType)) return false; final StringToken token = new StringToken(docDecl,literal,context); final ResidualCalculator res = docDecl.resCalc; // some may become invalid, but at least one always remain valid for( int i=0; i<contents.length; i++ ) contents[i] = res.calcResidual( contents[i], token ); return true; }
public boolean match( AttributeExp exp ) { // Attribute name must meet the constraint of NameClass if(!exp.nameClass.accepts(namespaceURI,localName)) return false; // content model of the attribute must consume the value if(!docDecl.resCalc.calcResidual(exp.exp, value).isEpsilonReducible()) failedExp = docDecl.pool.createChoice( failedExp, exp.exp ); // accept AttributeExp regardless of its content restriction return true; }
/** compute the residual */ public final Expression calcResidual( Expression exp, Token token ) { if( token instanceof ElementToken ) return calcResidual(exp,(ElementToken)token); this.token=token; Expression r = exp.visit(this); // if token is ignorable, make expression as so. if( token.isIgnorable() ) r = pool.createChoice(r,exp); return r; }
public boolean match( AttributeExp exp ) { // Attribute name must meet the constraint of NameClass if(!exp.nameClass.accepts(namespaceURI,localName)) return false; // content model of the attribute must consume the value if(!docDecl.resCalc.calcResidual(exp.exp, value).isEpsilonReducible()) failedExp = docDecl.pool.createChoice( failedExp, exp.exp ); // accept AttributeExp regardless of its content restriction return true; }
public boolean match( AttributeExp exp ) { // Attribute name must meet the constraint of NameClass if(!exp.nameClass.accepts(namespaceURI,localName)) return false; // content model of the attribute must consume the value boolean satisfied = false; if(value.literal.trim().length()==0 && exp.exp.isEpsilonReducible()) satisfied = true; else if(docDecl.resCalc.calcResidual(exp.exp, value).isEpsilonReducible()) satisfied = true; if(satisfied) { // store the expression who consumed this token. if( !saturated || exp==matchedExp ) matchedExp=exp; else matchedExp=null; /* the above is the shortened form of: if( !saturated ) matchedExp = exp; else if( exp!=matchedExp ) matchedExp = null; */ saturated = true; return true; } return false; }
/** compute the residual */ public final Expression calcResidual( Expression exp, Token token ) { if( token instanceof ElementToken ) return calcResidual(exp,(ElementToken)token); this.token=token; Expression r = exp.visit(this); // if token is ignorable, make expression as so. if( token.isIgnorable() ) r = pool.createChoice(r,exp); return r; }
public boolean match( AttributeExp exp ) { // Attribute name must meet the constraint of NameClass if(!exp.nameClass.accepts(namespaceURI,localName)) return false; // content model of the attribute must consume the value if(!docDecl.resCalc.calcResidual(exp.exp, value).isEpsilonReducible()) failedExp = docDecl.pool.createChoice( failedExp, exp.exp ); // accept AttributeExp regardless of its content restriction return true; }
public boolean match( AttributeExp exp ) { // Attribute name must meet the constraint of NameClass if(!exp.nameClass.accepts(namespaceURI,localName)) return false; // content model of the attribute must consume the value boolean satisfied = false; if(value.literal.trim().length()==0 && exp.exp.isEpsilonReducible()) satisfied = true; else if(docDecl.resCalc.calcResidual(exp.exp, value).isEpsilonReducible()) satisfied = true; if(satisfied) { // store the expression who consumed this token. if( !saturated || exp==matchedExp ) matchedExp=exp; else matchedExp=null; /* the above is the shortened form of: if( !saturated ) matchedExp = exp; else if( exp!=matchedExp ) matchedExp = null; */ saturated = true; return true; } return false; }
/** compute the residual */ public final Expression calcResidual( Expression exp, Token token ) { if( token instanceof ElementToken ) return calcResidual(exp,(ElementToken)token); this.token=token; Expression r = exp.visit(this); // if token is ignorable, make expression as so. if( token.isIgnorable() ) r = pool.createChoice(r,exp); return r; }
/** compute the residual */ public final Expression calcResidual( Expression exp, Token token ) { if( token instanceof ElementToken ) return calcResidual(exp,(ElementToken)token); this.token=token; Expression r = exp.visit(this); // if token is ignorable, make expression as so. if( token.isIgnorable() ) r = pool.createChoice(r,exp); return r; }
public boolean match( AttributeExp exp ) { // Attribute name must meet the constraint of NameClass if(!exp.nameClass.accepts(namespaceURI,localName)) return false; // content model of the attribute must consume the value boolean satisfied = false; if(value.literal.trim().length()==0 && exp.exp.isEpsilonReducible()) satisfied = true; else if(docDecl.resCalc.calcResidual(exp.exp, value).isEpsilonReducible()) satisfied = true; if(satisfied) { // store the expression who consumed this token. if( !saturated || exp==matchedExp ) matchedExp=exp; else matchedExp=null; /* the above is the shortened form of: if( !saturated ) matchedExp = exp; else if( exp!=matchedExp ) matchedExp = null; */ saturated = true; return true; } return false; }
public boolean match( AttributeExp exp ) { // Attribute name must meet the constraint of NameClass if(!exp.nameClass.accepts(namespaceURI,localName)) return false; // content model of the attribute must consume the value if(!docDecl.resCalc.calcResidual(exp.exp, value).isEpsilonReducible()) failedExp = docDecl.pool.createChoice( failedExp, exp.exp ); // accept AttributeExp regardless of its content restriction return true; }
/** DataExp can consume this token if its datatype can accept this string */ public boolean match(DataExp exp) { if (!exp.dt.isValid(literal, context)) return false; // not accepted. if (exp.except != Expression.nullSet) { if (resCalc.calcResidual(exp.except, this) == Expression.epsilon) // due to the constraint imposed on the body of the 'except' clause, // comparing the residual with the epsilon is OK and cheap. // but it might be better to use the isEpsilonReducible method // for the robustness. return false; // this token is accepted by its 'except' clause } // this type accepts me. if (refType != null) assignType(exp.dt); // if the type has ID semantics, report it. if (exp.dt.getIdType() != Datatype.ID_TYPE_NULL && context != null) // context can be legally null when this datatype is not context dependent. context.onID(exp.dt, this); return true; }
/** DataExp can consume this token if its datatype can accept this string */ public boolean match(DataExp exp) { if (!exp.dt.isValid(literal, context)) return false; // not accepted. if (exp.except != Expression.nullSet) { if (resCalc.calcResidual(exp.except, this).isEpsilonReducible()) // handling whitespace correcly requires isEpsilonReducible() // with the following test case // <data type="string"><except><value/></except></data> // with "". return false; // this token is accepted by its 'except' clause } // this type accepts me. if (refType != null) assignType(exp.dt); // if the type has ID semantics, report it. if (exp.dt.getIdType() != Datatype.ID_TYPE_NULL && context != null) // context can be legally null when this datatype is not context dependent. context.onID(exp.dt, this); return true; }
/** DataExp can consume this token if its datatype can accept this string */ public boolean match(DataExp exp) { if (!exp.dt.isValid(literal, context)) return false; // not accepted. if (exp.except != Expression.nullSet) { if (resCalc.calcResidual(exp.except, this).isEpsilonReducible()) // handling whitespace correcly requires isEpsilonReducible() // with the following test case // <data type="string"><except><value/></except></data> // with "". return false; // this token is accepted by its 'except' clause } // this type accepts me. if (refType != null) assignType(exp.dt); // if the type has ID semantics, report it. if (exp.dt.getIdType() != Datatype.ID_TYPE_NULL && context != null) // context can be legally null when this datatype is not context dependent. context.onID(exp.dt, this); return true; }
/** DataExp can consume this token if its datatype can accept this string */ public boolean match(DataExp exp) { if (!exp.dt.isValid(literal, context)) return false; // not accepted. if (exp.except != Expression.nullSet) { if (resCalc.calcResidual(exp.except, this).isEpsilonReducible()) // handling whitespace correcly requires isEpsilonReducible() // with the following test case // <data type="string"><except><value/></except></data> // with "". return false; // this token is accepted by its 'except' clause } // this type accepts me. if (refType != null) assignType(exp.dt); // if the type has ID semantics, report it. if (exp.dt.getIdType() != Datatype.ID_TYPE_NULL && context != null) // context can be legally null when this datatype is not context dependent. context.onID(exp.dt, this); return true; }
contents[i] = res.calcResidual( contents[i], token );