public static void throwParseException(String msg, int line, int column) { throw new SSEParseException("Line " + line + ", column " + column + ": " + msg, line, column) ; } }
public SSEParseException(String msg, int line, int column) { super(msg) ; set(line, column) ; }
public static void exprPrefix(String string, Binding binding) { try { Expr expr = SSE.parseExpr(string) ; evalPrint(expr, binding) ; } catch (SSEParseException ex) { System.err.println("Parse error: "+ex.getMessage()) ; return ; } } }
public static ReorderTransformation chooseOptimizer(Location location) { if ( location == null ) return ReorderLib.identity() ; ReorderTransformation reorder = null ; if ( location.exists(Names.optStats) ) { try { reorder = ReorderLib.weighted(location.getPath(Names.optStats)) ; log.debug("Statistics-based BGP optimizer") ; } catch (SSEParseException ex) { log.warn("Error in stats file: " + ex.getMessage()) ; reorder = null ; } } if ( reorder == null && location.exists(Names.optFixed) ) { // Not as good but better than nothing. reorder = ReorderLib.fixed() ; log.debug("Fixed pattern BGP optimizer") ; } if ( location.exists(Names.optNone) ) { reorder = ReorderLib.identity() ; log.debug("Optimizer explicitly turned off") ; } if ( reorder == null ) reorder = SystemTDB.defaultReorderTransform ; if ( reorder == null && warnAboutOptimizer ) ARQ.getExecLogger().warn("No BGP optimizer") ; return reorder ; }
protected void runTestWorker(Query query, Syntax syntax) { IndentedLineBuffer buff = new IndentedLineBuffer() ; query.serialize(buff, syntax) ; String baseURI = null ; if ( ! query.explicitlySetBaseURI() ) // Not in query - use the same one (e.g. file read from) . baseURI = query.getBaseURI() ; // Query syntax and algebra tests. try { QueryUtils.checkParse(query) ; } catch (RuntimeException ex) { System.err.println("**** Test: "+getName()) ; System.err.println("** "+ex.getMessage()) ; System.err.println(query) ; throw ex ; } try { QueryUtils.checkOp(query, true) ; } catch (SSEParseException ex) { System.err.println("**** Test: "+getName()) ; System.err.println("** Algebra error: "+ex.getMessage()) ; } }
protected static void throwException(String msg, int line, int column) { throw new SSEParseException("[" + line + ", " + column + "] " + msg, line, column) ; }
public SSEParseException(String msg, Throwable cause,int line, int column) { super(msg, cause) ; set(line, column) ; }
public static void parse(Reader reader, ParseHandler handler) { SSE_ParserCore p = new SSE_ParserCore(reader) ; p.setHandler(handler) ; try { p.parse() ; } catch (ParseException ex) { throw new SSEParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn) ; } catch (TokenMgrError tErr) { // Last valid token : not the same as token error message - but this should not happen int col = p.token.endColumn ; int line = p.token.endLine ; throw new SSEParseException(tErr.getMessage(), line, col) ; } //catch (JenaException ex) { throw new TurtleParseException(ex.getMessage(), ex) ; } } }
public SSEParseException(Throwable cause, int line, int column) { super(cause) ; set(line, column) ; }
private static Node parseNode(Reader reader, PrefixMapping pmap) { Item item = parseTerm(reader, pmap) ; if ( item.isSymbol() ) { String str = item.getSymbol() ; if ( "true".equalsIgnoreCase(str) ) return NodeConst.nodeTrue ; if ( "false".equalsIgnoreCase(str) ) return NodeConst.nodeFalse ; throw new SSEParseException("Not a node: "+item, item.getLine(), item.getColumn()) ; } if ( ! item.isNode() ) throw new SSEParseException("Not a node: "+item, item.getLine(), item.getColumn()) ; return item.getNode() ; }
public SSEParseException(int line, int column) { super() ; set(line, column) ; }
public static void term(Reader reader, ParseHandler handler) { SSE_ParserCore p = new SSE_ParserCore(reader) ; p.setHandler(handler) ; try { p.term() ; // Checks for EOF // //<EOF> test : EOF is always token 0. // if ( p.token_source.getNextToken().kind != 0 ) // throw new SSEParseException("Trailing characters after "+item, item.getLine(), item.getColumn()) ; } catch (ParseException ex) { throw new SSEParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn) ; } catch (TokenMgrError tErr) { // Last valid token : not the same as token error message - but this should not happen int col = p.token.endColumn ; int line = p.token.endLine ; throw new SSEParseException(tErr.getMessage(), line, col) ; } //catch (JenaException ex) { throw new TurtleParseException(ex.getMessage(), ex) ; } }
private static String parseSymbol(Reader reader, PrefixMapping pmap) { Item item = parseTerm(reader, pmap) ; if ( ! item.isSymbol() ) throw new SSEParseException("Not a symbol: "+item, item.getLine(), item.getColumn()) ; return item.getSymbol() ; }