Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
477 changes: 477 additions & 0 deletions crates/barsql-sql/src/algebra.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/barsql-sql/src/enum_values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ impl<'t, 'a> Parser<'t, 'a> {
}

// The text of a string literal: 'it''s', N'x' and, where backslashes escape, 'it\'s'.
fn unquote(literal: &str, backslash_escapes: bool) -> String {
pub(crate) fn unquote(literal: &str, backslash_escapes: bool) -> String {
let literal = literal.strip_prefix(['N', 'n']).unwrap_or(literal);
let mut chars = literal.chars();
let Some(quote) = chars.next() else { return String::new() };
Expand Down
5 changes: 4 additions & 1 deletion crates/barsql-sql/src/lang/tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ fn is_ident_char(c: u8, rules: &LexRules) -> bool {

// $tag$ delimiters are ops, so dollar-quoted bodies stay tokenized and completion works inside them.
pub fn tokenize<'a>(text: &'a str, driver: Option<&DriverType>) -> Vec<Token<'a>> {
let rules = LexRules::for_driver(driver);
tokenize_with(text, LexRules::for_driver(driver))
}

pub fn tokenize_with(text: &str, rules: LexRules) -> Vec<Token<'_>> {
let b = text.as_bytes();
let len = b.len();
let mut tokens = Vec::new();
Expand Down
3 changes: 3 additions & 0 deletions crates/barsql-sql/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod algebra;
pub mod alter;
pub mod ddl;
pub mod dialect;
Expand All @@ -13,13 +14,15 @@ mod plan_showplan;
pub mod quote;
pub mod readonly;
pub mod schema_diff;
pub mod select;
pub mod select_source;
pub mod split;
pub mod sql_text;
pub mod structure;
pub mod system_views;
pub mod type_name;

pub use algebra::{AlgebraError, AlgebraNode, Column, Item, Source, TableColumns, TableRef, algebra, columns};
pub use dialect::Dialect;
pub use explain::{
ExplainStrategy, PlanRequest, SHOWPLAN_COLUMN, ServerVersion, build_explain, build_explain_sql,
Expand Down
Loading