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
3 changes: 2 additions & 1 deletion crates/parser-generator/src/parser_generator/lalr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ impl Lalr {
.map(|c| id_mapper.to_component_id(&c))
.or_else(|| {
rule.components
.iter().rfind(|c| matches!(c, Component::Terminal(_)))
.iter()
.rfind(|c| matches!(c, Component::Terminal(_)))
.map(|c| id_mapper.to_component_id(c))
})
.and_then(|component_id| assoc[component_id.0 as usize].clone());
Expand Down
36 changes: 25 additions & 11 deletions crates/parser-generator/src/parser_generator/lexer/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
use std::collections::HashMap;

use super::{
Lexer, NAMEDATALEN, ParserError, TokenKind, Yylval,
lexer_ported::{
get_char_by_byte_pos, is_highbit_set, is_utf16_surrogate_first, is_utf16_surrogate_second,
surrogate_pair_to_codepoint,
},
Lexer, ParserError, TokenKind, Yylval, NAMEDATALEN,
};

macro_rules! ereport {
Expand Down Expand Up @@ -4027,11 +4027,18 @@ impl Lexer {

self.set_yylloc();
if !STANDARD_CONFORMING_STRINGS {
ereport!(self, ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("unsafe use of string constant with Unicode escapes"),
errdetail("String constants with Unicode escapes cannot be used when standard_conforming_strings is off."),
self.lexer_errposition()));
ereport!(
self,
ERROR,
(
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("unsafe use of string constant with Unicode escapes"),
errdetail(
"String constants with Unicode escapes cannot be used when standard_conforming_strings is off."
),
self.lexer_errposition()
)
);
}
self.begin(State::xus);
self.literal.clear();
Expand Down Expand Up @@ -5370,11 +5377,18 @@ impl Lexer {

self.set_yylloc();
if !STANDARD_CONFORMING_STRINGS {
ereport!(self, ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("unsafe use of string constant with Unicode escapes"),
errdetail("String constants with Unicode escapes cannot be used when standard_conforming_strings is off."),
self.lexer_errposition()));
ereport!(
self,
ERROR,
(
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("unsafe use of string constant with Unicode escapes"),
errdetail(
"String constants with Unicode escapes cannot be used when standard_conforming_strings is off."
),
self.lexer_errposition()
)
);
}
self.begin(State::xus);
self.literal.clear();
Expand Down
2 changes: 1 addition & 1 deletion crates/postgresql-cst-parser/src/lexer/lexer_ported.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// Ported sources from PostgreSQL
use super::{Lexer, Token, TokenKind, Yylval, parser_error::ParserError};
use super::{parser_error::ParserError, Lexer, Token, TokenKind, Yylval};

pub fn is_highbit_set(c: char) -> u8 {
(c as u8) & 0x80
Expand Down
2 changes: 1 addition & 1 deletion crates/postgresql-cst-parser/src/lexer/util.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![allow(dead_code)]

use super::{
generated::{get_keyword_map, State},
Lexer, ScanReport, Yylval,
generated::{State, get_keyword_map},
};

impl Lexer {
Expand Down
Loading
Loading