本文整理汇总了Java中org.codehaus.jparsec.error.ParserException类的典型用法代码示例。如果您正苦于以下问题:Java ParserException类的具体用法?Java ParserException怎么用?Java ParserException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParserException类属于org.codehaus.jparsec.error包,在下文中一共展示了ParserException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parseAndGenDVals
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
private ASTToDNALGenerator parseAndGenDVals(String input) {
Log.debugLog("parsing: " + input);
context.perf.startTimer("jparsec");
DNALDocument doc = null;
boolean ok = false;
try {
List<Exp> list = FullParser.fullParse(input);
doc = new DNALDocument(list);
ok = true;
} catch (ParserException e) {
//e.printStackTrace();
int lineNum = e.getLocation().line;
NewErrorMessage err = new NewErrorMessage();
err.setLineNum(lineNum);
err.setMessage(e.getMessage());
addErrorObj(err);
}
context.perf.endTimer("jparsec");
if (! ok) {
return null;
}
//pass 2
if (! pass2(doc.getStatementList())) {
return null;
}
context.perf.startTimer("ast-to-dnal");
PackageExp pkgExp = doc.getPackage();
context.packageName = (pkgExp == null) ? null : pkgExp.val;
ASTToDNALGenerator dnalGenerator = new ASTToDNALGenerator(world, registry, getET(),
this.crf, context);
boolean b = dnalGenerator.generate(doc.getStatementList());
context.perf.endTimer("ast-to-dnal");
return (b) ? dnalGenerator : null;
}
开发者ID:ianrae,项目名称:dnal-lang,代码行数:39,代码来源:SourceCompiler.java
示例2: parse
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
/** Parses {@code string} to a {@link TypeToken}. */
public TypeToken<?> parse(String string) throws ParserException {
Parser.Reference<Type> ref = Parser.newReference();
Parser<Type> type = Parsers.or(
wildcardType(ref.lazy()), parameterizedType(ref.lazy()), arrayClass(), rawType());
ref.set(type.postfix(TERMS.phrase("[", "]").retn(Types::newArrayType)));
return TypeToken.of(
ref.get().from(TERMS.tokenizer(), Scanners.WHITESPACES.optional()).parse(string));
}
开发者ID:jparsec,项目名称:jparsec-g,代码行数:10,代码来源:TypeParser.java
示例3: assertScanOne
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
protected static void assertScanOne (String test, Parser<?>... expected)
{
try {
make(expected).from(Scanner.LINE_SCANNER).parse(test);
} catch (ParserException pe) {
Assert.fail("Scanning failed: " + pe.getMessage());
}
}
开发者ID:impl,项目名称:yashiro,代码行数:9,代码来源:ScannerTest.java
示例4: assertScanBody
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
protected static void assertScanBody (String test, Parser<?>... expected)
{
try {
make(expected).from(SCANNER.scanner()).parse(test);
} catch (ParserException pe) {
Assert.fail("Scanning failed: " + pe.getMessage());
}
}
开发者ID:impl,项目名称:yashiro,代码行数:9,代码来源:ScannerTest.java
示例5: printCommand
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
private Parser<Void> printCommand(Parser<Expression> exprParser) {
return token("print").next(exprParser).map(new Map<Expression, Void>() {
public Void map(Expression body) {
try {
PacioliValue result = body.eval(store);
if (result != null) {
logln("%s", result.toText());
}
} catch (Exception ex) {
throw new ParserException(ex, null, null, null);
}
return null;
}
});
}
开发者ID:pgriffel,项目名称:pacioli,代码行数:16,代码来源:Machine.java
示例6: literalMatrix
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
private Parser<Expression> literalMatrix() {
return Parsers
.sequence(
token("literal_matrix").followedBy(token("("))
.next(shapeParser()).followedBy(token(",")),
Parsers.tuple(DECIMAL, DECIMAL, STRING)
.followedBy(token(",")).many()
.followedBy(token(")")),
new Map2<MatrixShape, List<Tuple3<String, String, String>>, Expression>() {
public Expression map(MatrixShape shape,
List<Tuple3<String, String, String>> data) {
try {
Matrix matrix = new Matrix(shape);
for (Tuple3<String, String, String> triple : data) {
Integer i = Integer.parseInt(triple.a);
Integer j = Integer.parseInt(triple.b);
Double value = Double
.parseDouble(triple.c);
matrix.set(i, j, value);
}
return new Const(matrix);
} catch (Exception ex) {
log(ex.getClass().toString());
throw new ParserException(ex, null, null,
null);
}
}
});
}
开发者ID:pgriffel,项目名称:pacioli,代码行数:33,代码来源:Machine.java
示例7: parseQlSelect
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
@Override
public <OperatorT extends QlConstraintOperator> QlSelectStatement parseQlSelect(String query,
QlSelectStatementValidator validator, QlExecutableConstraintEvaluator evaluator,
QlPostProcessor postProcessor, ConstraintOperatorSupport<OperatorT> opSupport)
throws InvalidQueryException, QueryValidationException {
if (query == null) {
throw new IllegalArgumentException("query cannot be null");
}
if (validator == null) {
throw new IllegalArgumentException("validator cannot be null");
}
if (evaluator == null) {
throw new IllegalArgumentException("evaluator cannot be null");
}
if (opSupport == null) {
throw new IllegalArgumentException("operator support cannot be null");
}
if (postProcessor == null) {
throw new IllegalArgumentException("post processor cannot be null");
}
try {
QlSelectStatement selectStatement = qlSelectParser(opSupport).parse(query);
evaluator.evaluate(selectStatement);
validator.validate(selectStatement);
return postProcessor.processQueryStatement(selectStatement);
} catch (ParserException e) {
throw new InvalidQueryException(e.getMessage(), query);
}
}
开发者ID:lithiumtech,项目名称:starql,代码行数:30,代码来源:JparsecQueryMarkupManager.java
示例8: parseQlConstraintsClause
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
@Override
public <OperatorT extends QlConstraintOperator> QlWhereClause parseQlConstraintsClause(String query,
QlConstraintsClauseValidator validator, QlExecutableConstraintEvaluator evaluator,
ConstraintOperatorSupport<OperatorT> opSupport) throws InvalidQueryException, QueryValidationException {
if (query == null) {
throw new IllegalArgumentException("query cannot be null");
}
if (validator == null) {
throw new IllegalArgumentException("validator cannot be null");
}
if (evaluator == null) {
throw new IllegalArgumentException("evaluator cannot be null");
}
if (opSupport == null) {
throw new IllegalArgumentException("operator support cannot be null");
}
try {
QlBooleanConstraintNode constraintsRootNode = constraintsParser(opSupport).parse(query);
if (constraintsRootNode != null) {
QlWhereClause clause = new QlWhereClause.Builder()
.setRoot(constraintsRootNode)
.build();
evaluator.evaluate(clause);
validator.validate(clause);
return clause;
}
throw new InvalidQueryException("", query);
} catch (ParserException e) {
throw new InvalidQueryException(e.getMessage(), query);
}
}
开发者ID:lithiumtech,项目名称:starql,代码行数:32,代码来源:JparsecQueryMarkupManager.java
示例9: test_pageConstraints
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
@Test
public final void test_pageConstraints() {
try {
String word = "";
QlPageConstraints pageConstraint = inst.pageConstraintParser().parse(word);
assertEquals(-1, pageConstraint.getLimit());
assertEquals(-1, pageConstraint.getOffset());
} catch (ParserException e) {
Assert.fail("PageConstraints can be blank");
}
}
开发者ID:lithiumtech,项目名称:starql,代码行数:12,代码来源:JparsecPageConstraintsTest.java
示例10: primitiveTypeCannotBeUsedAsTypeParameter
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
@Test(expected = ParserException.class)
public void primitiveTypeCannotBeUsedAsTypeParameter() {
new TypeParser().parse("Iterable<int>");
}
开发者ID:jparsec,项目名称:jparsec-g,代码行数:5,代码来源:TypeParserTest.java
示例11: voidArrayDisallowed
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
@Test(expected = ParserException.class)
public void voidArrayDisallowed() {
new TypeParser().parse("void[]");
}
开发者ID:jparsec,项目名称:jparsec-g,代码行数:5,代码来源:TypeParserTest.java
示例12: insufficientTypeParameters
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
@Test(expected = ParserException.class)
public void insufficientTypeParameters() {
new TypeParser().parse("java.util.Map<String>");
}
开发者ID:jparsec,项目名称:jparsec-g,代码行数:5,代码来源:TypeParserTest.java
示例13: tooManyTypeParameters
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
@Test(expected = ParserException.class)
public void tooManyTypeParameters() {
new TypeParser().parse("java.util.List<String, ?>");
}
开发者ID:jparsec,项目名称:jparsec-g,代码行数:5,代码来源:TypeParserTest.java
示例14: invalidClassName
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
@Test(expected = ParserException.class)
public void invalidClassName() {
new TypeParser().parse("no.such.class");
}
开发者ID:jparsec,项目名称:jparsec-g,代码行数:5,代码来源:TypeParserTest.java
示例15: cantParameterizeArray
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
@Test(expected = ParserException.class)
public void cantParameterizeArray() {
new TypeParser().parse("int[]<String>");
}
开发者ID:jparsec,项目名称:jparsec-g,代码行数:5,代码来源:TypeParserTest.java
示例16: cantParameterizeInternalArrayClass
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
@Test(expected = ParserException.class)
public void cantParameterizeInternalArrayClass() {
new TypeParser().parse("[I<String>");
}
开发者ID:jparsec,项目名称:jparsec-g,代码行数:5,代码来源:TypeParserTest.java
示例17: internalClassMissingSemicolon
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
@Test(expected = ParserException.class)
public void internalClassMissingSemicolon() {
new TypeParser().parse("[Ljava.lang.Object");
}
开发者ID:jparsec,项目名称:jparsec-g,代码行数:5,代码来源:TypeParserTest.java
示例18: internalClassMissingL
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
@Test(expected = ParserException.class)
public void internalClassMissingL() {
new TypeParser().parse("[java.lang.Object;");
}
开发者ID:jparsec,项目名称:jparsec-g,代码行数:5,代码来源:TypeParserTest.java
示例19: internalClassWithSuperfluousSemicolons
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
@Test(expected = ParserException.class)
public void internalClassWithSuperfluousSemicolons() {
new TypeParser().parse("[Ljava.lang.Object;;");
}
开发者ID:jparsec,项目名称:jparsec-g,代码行数:5,代码来源:TypeParserTest.java
示例20: cantParameterizeAlreadyParameterized
import org.codehaus.jparsec.error.ParserException; //导入依赖的package包/类
@Test(expected = ParserException.class)
public void cantParameterizeAlreadyParameterized() {
new TypeParser().parse("Iterable<Integer><String>");
}
开发者ID:jparsec,项目名称:jparsec-g,代码行数:5,代码来源:TypeParserTest.java
注:本文中的org.codehaus.jparsec.error.ParserException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论