Skip to content

Commit

Permalink
Merge pull request #26 from gwenn/rm_buf_redux
Browse files Browse the repository at this point in the history
Drop support of buf_redux / streaming input
  • Loading branch information
gwenn authored Mar 15, 2023
2 parents e55abd5 + 40e0875 commit bd27d0e
Show file tree
Hide file tree
Showing 8 changed files with 299 additions and 510 deletions.
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

0 comments on commit bd27d0e

Please sign in to comment.