Skip to content

Commit

Permalink
Merge pull request #631 from pjhades/replace-debug-with-trace-in-sqli…
Browse files Browse the repository at this point in the history
…te3-parser

sqlite3-parser: replace debug! with trace!
  • Loading branch information
MarinPostma authored Nov 16, 2023
2 parents 54bd90d + e2ae8a6 commit a9fd876
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions vendored/sqlite3-parser/src/lexer/scan.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Adaptation/port of [Go scanner](http://tip.golang.org/pkg/bufio/#Scanner).

use log::debug;
use log::trace;

use std::error::Error;
use std::fmt;
Expand Down Expand Up @@ -106,7 +106,7 @@ impl<S: Splitter> Scanner<S> {
&mut self,
input: &'input [u8],
) -> ScanResult<'input, S::TokenType, S::Error> {
debug!(target: "scanner", "scan(line: {}, column: {})", self.line, self.column);
trace!(target: "scanner", "scan(line: {}, column: {})", self.line, self.column);
// Loop until we have a token.
loop {
// See if we can get a token with what we already have.
Expand Down Expand Up @@ -140,7 +140,7 @@ impl<S: Splitter> Scanner<S> {

/// Consume `amt` bytes of the buffer.
fn consume(&mut self, data: &[u8], amt: usize) {
debug!(target: "scanner", "consume({})", amt);
trace!(target: "scanner", "consume({})", amt);
debug_assert!(amt <= data.len());
for byte in &data[..amt] {
if *byte == b'\n' {
Expand Down
2 changes: 1 addition & 1 deletion vendored/sqlite3-parser/src/parser/parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
use crate::parser::ast::*;
use crate::parser::{Context, ParserError};
use crate::dialect::{from_token, Token, TokenType};
use log::{debug, error, log_enabled};
use log::{trace, error, log_enabled};

#[allow(non_camel_case_types)]
type sqlite3ParserError = crate::parser::ParserError;
Expand Down
28 changes: 14 additions & 14 deletions vendored/sqlite3-parser/third_party/lemon/lempar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ impl yyParser<'_> {
self.yystack.reserve(additional);
#[cfg(not(feature = "NDEBUG"))]
{
debug!(
trace!(
target: TARGET,
"Stack grows from {} to {} entries.",
capacity,
Expand Down Expand Up @@ -345,7 +345,7 @@ impl yyParser<'_> {
//assert_eq!(self.yyidx+1, self.yystack.len());
#[cfg(not(feature = "NDEBUG"))]
{
debug!(
trace!(
target: TARGET,
"Popping {}", yyTokenName[yytos.major as usize]
);
Expand Down Expand Up @@ -453,7 +453,7 @@ fn yy_find_shift_action(
if iFallback != 0 {
#[cfg(not(feature = "NDEBUG"))]
{
debug!(
trace!(
target: TARGET,
"FALLBACK {} => {}",
yyTokenName[iLookAhead as usize],
Expand All @@ -470,7 +470,7 @@ fn yy_find_shift_action(
if yy_lookahead[j] == YYWILDCARD && iLookAhead > 0 {
#[cfg(not(feature = "NDEBUG"))]
{
debug!(
trace!(
target: TARGET,
"WILDCARD {} => {}",
yyTokenName[iLookAhead as usize],
Expand Down Expand Up @@ -548,12 +548,12 @@ impl yyParser<'_> {
{
let yytos = &self[0];
if yyNewState < YYNSTATE {
debug!(
trace!(
target: TARGET,
"{} '{}', go to state {}", zTag, yyTokenName[yytos.major as usize], yyNewState
);
} else {
debug!(
trace!(
target: TARGET,
"{} '{}', pending reduce {:?}",
zTag,
Expand Down Expand Up @@ -709,7 +709,7 @@ impl yyParser<'_> {
fn yy_accept(&mut self) {
#[cfg(not(feature = "NDEBUG"))]
{
debug!(target: TARGET, "Accept!");
trace!(target: TARGET, "Accept!");
}
if cfg!(not(feature = "YYNOERRORRECOVERY")) {
self.yyerrcnt = -1;
Expand Down Expand Up @@ -764,12 +764,12 @@ impl yyParser<'_> {
#[cfg(not(feature = "NDEBUG"))]
{
if yyact < YY_MIN_REDUCE {
debug!(
trace!(
target: TARGET,
"Input '{}' in state {}", yyTokenName[yymajor as usize], yyact
);
} else {
debug!(
trace!(
target: TARGET,
"Input '{}' with pending reduce {}",
yyTokenName[yymajor as usize],
Expand All @@ -793,7 +793,7 @@ impl yyParser<'_> {
" without external action"
};
if yysize != 0 {
debug!(
trace!(
target: TARGET,
"Reduce {} [{}]{}, pop back to state {}.",
yyruleno,
Expand All @@ -802,7 +802,7 @@ impl yyParser<'_> {
self[yysize].stateno
);
} else {
debug!(
trace!(
target: TARGET,
"Reduce {} [{}]{}.", yyruleno, yyRuleName[yyruleno as usize], action
);
Expand Down Expand Up @@ -832,7 +832,7 @@ impl yyParser<'_> {
assert_eq!(yyact, YY_ERROR_ACTION);
#[cfg(not(feature = "NDEBUG"))]
{
debug!(target: TARGET, "Syntax Error!");
trace!(target: TARGET, "Syntax Error!");
}
if YYERRORSYMBOL > 0 {
/* A syntax error has occurred.
Expand Down Expand Up @@ -861,7 +861,7 @@ impl yyParser<'_> {
if yymx == YYERRORSYMBOL || yyerrorhit {
#[cfg(not(feature = "NDEBUG"))]
{
debug!(
trace!(
target: TARGET,
"Discard input token {}", yyTokenName[yymajor as usize]
);
Expand Down Expand Up @@ -937,7 +937,7 @@ impl yyParser<'_> {
.map(|entry| yyTokenName[entry.major as usize])
.collect::<Vec<&str>>()
.join(" ");
debug!(target: TARGET, "Return. Stack=[{}]", msg);
trace!(target: TARGET, "Return. Stack=[{}]", msg);
}
}
return Ok(());
Expand Down

0 comments on commit a9fd876

Please sign in to comment.