private Ast.Expr ParseExpr(TokenQueue q) { var start = q.GetLocation(); var tok = q.SourceToken; Ast.SqliteSyntaxProduction syntaxNode; var result = SqliteParser.ReadExpr(q, out syntaxNode); if (result.IsValid) { return(new Ast.Expr { Sql = q.Substring(start, result.NumValidTokens), SourceToken = tok, SqliteSyntax = syntaxNode }); } else if (result.InvalidMessage != null) { throw new SyntaxException(result.InvalidMessage); } else { throw new SyntaxException(q); } }
private bool PeekExpr(TokenQueue q) { var start = q.GetLocation(); var tok = q.SourceToken; Ast.SqliteSyntaxProduction ast; var result = SqliteParser.ReadExpr(q, out ast); q.Jump(start); return(result.IsValid); }