本文整理汇总了Java中com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg.NEED_LITERAL_ERR属性的典型用法代码示例。如果您正苦于以下问题:Java ErrorMsg.NEED_LITERAL_ERR属性的具体用法?Java ErrorMsg.NEED_LITERAL_ERR怎么用?Java ErrorMsg.NEED_LITERAL_ERR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg
的用法示例。
在下文中一共展示了ErrorMsg.NEED_LITERAL_ERR属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: typeCheck
/**
* Force the argument to this function to be a literal string.
*/
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
if (argument() instanceof LiteralExpr) {
return _type = Type.Boolean;
}
ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
"element-available", this);
throw new TypeCheckError(err);
}
示例2: typeCheck
/**
* Type check the two parameters for this function
*/
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
// Check that the function was passed exactly two arguments
if (argumentCount() != 2) {
throw new TypeCheckError(new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR,
getName(), this));
}
// The first argument must be a literal String
Expression exp = argument(0);
if (exp instanceof LiteralExpr) {
_className = ((LiteralExpr) exp).getValue();
_type = Type.newObjectType(_className);
}
else {
throw new TypeCheckError(new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
getName(), this));
}
// Second argument must be of type reference or object
_right = argument(1);
Type tright = _right.typeCheck(stable);
if (tright != Type.Reference &&
tright instanceof ObjectType == false)
{
throw new TypeCheckError(new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
tright, _type, this));
}
return _type;
}
示例3: typeCheck
/**
* Argument of function-available call must be literal, typecheck
* returns the type of function-available to be boolean.
*/
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
if (_type != null) {
return _type;
}
if (_arg instanceof LiteralExpr) {
return _type = Type.Boolean;
}
ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
"function-available", this);
throw new TypeCheckError(err);
}