Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support of buf_redux / streaming input #26

Merged
merged 4 commits into from
Mar 15, 2023
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
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ YYNOERRORRECOVERY = []
YYSTACKDYNAMIC = []
YYCOVERAGE = []
NDEBUG = []
default = ["YYNOERRORRECOVERY", "buf_redux"]
default = ["YYNOERRORRECOVERY"]

[dependencies]
phf = { version = "0.11", features = ["uncased"] }
log = "0.4"
memchr = "2.0"
fallible-iterator = "0.2"
smallvec = ">=1.6.1"
buf_redux = { version = "0.8", optional = true }
bitflags = "2.0"
uncased = "0.9"
indexmap = "1.9"
Expand Down
8 changes: 3 additions & 5 deletions examples/sql_check.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use fallible_iterator::FallibleIterator;
use std::env;
use std::fs::File;
use std::fs::read;
use std::panic;

use sqlite3_parser::lexer::sql::Parser;
use sqlite3_parser::lexer::InputStream;

/// Parse specified files and check all commands.
fn main() {
Expand All @@ -13,9 +12,8 @@ fn main() {
for arg in args.skip(1) {
println!("{arg}");
let result = panic::catch_unwind(|| {
let f = File::open(arg.clone()).unwrap();
let input = InputStream::new(f);
let mut parser = Parser::new(input);
let input = read(arg.clone()).unwrap();
let mut parser = Parser::new(&input);
loop {
match parser.next() {
Ok(None) => break,
Expand Down
8 changes: 3 additions & 5 deletions examples/sql_cmds.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use fallible_iterator::FallibleIterator;
use std::env;
use std::fs::File;
use std::fs::read;
use std::panic;

use sqlite3_parser::lexer::sql::Parser;
use sqlite3_parser::lexer::InputStream;

/// Parse specified files and print all commands.
fn main() {
Expand All @@ -13,9 +12,8 @@ fn main() {
for arg in args.skip(1) {
println!("{arg}");
let result = panic::catch_unwind(|| {
let f = File::open(arg.clone()).unwrap();
let input = InputStream::new(f);
let mut parser = Parser::new(input);
let input = read(arg.clone()).unwrap();
let mut parser = Parser::new(input.as_ref());
loop {
match parser.next() {
Ok(None) => break,
Expand Down
11 changes: 5 additions & 6 deletions examples/sql_tokens.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use sqlite3_parser::lexer::sql::{TokenType, Tokenizer};
use sqlite3_parser::lexer::{InputStream, Scanner};
use sqlite3_parser::lexer::Scanner;

use std::env;
use std::fs::File;
use std::fs::read;
use std::i64;
use std::str;

Expand All @@ -11,12 +11,11 @@ fn main() {
use TokenType::*;
let args = env::args();
for arg in args.skip(1) {
let f = File::open(arg.clone()).unwrap();
let input = InputStream::new(f);
let input = read(arg.clone()).unwrap();
let tokenizer = Tokenizer::new();
let mut s = Scanner::new(input, tokenizer);
let mut s = Scanner::new(tokenizer);
loop {
match s.scan() {
match s.scan(&input) {
Ok(None) => break,
Err(err) => {
//eprintln!("{} at line: {}, column: {}", err, s.line(), s.column());
Expand Down
4 changes: 1 addition & 3 deletions src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
mod scan;
pub mod sql;

#[cfg(feature = "buf_redux")]
pub use scan::InputStream;
pub use scan::{Input, ScanError, Scanner, Splitter};
pub use scan::{ScanError, Scanner, Splitter};
Loading