Skip to content

Commit

Permalink
fix: Support pg_trgm operators
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zero authored and shssoichiro committed Jan 10, 2025
1 parent 3ae1db4 commit e9cec22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,7 @@ mod tests {
"<>", "<", ">=", ">>=", ">>", ">^", "->>", "->", "-|-", "-", "+", "/", "=", "%", "?||",
"?|", "?-|", "?-", "?#", "?&", "?", "@@@", "@@", "@>", "@?", "@-@", "@", "^@", "^",
"|&>", "|>>", "|/", "|", "||/", "||", "~>=~", "~>~", "~<=~", "~<~", "~=", "~*", "~~*",
"~~", "~",
"~~", "~", "%", "<%", "%>", "<<%", "%>>", "<<->", "<->>", "<<<->", "<->>>",
];

// Test each operator individually
Expand Down Expand Up @@ -1838,6 +1838,8 @@ mod tests {
left |>& right,
left <^ right,
left >^ right,
left <% right,
left %> right,
?- left,
left ?-| right,
left ?|| right,
Expand All @@ -1864,6 +1866,8 @@ SELECT
left |>& right,
left <^ right,
left >^ right,
left <% right,
left %> right,
?- left,
left ?-| right,
left ?|| right,
Expand Down
2 changes: 1 addition & 1 deletion src/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ fn get_word_token<'i>(input: &mut &'i str) -> PResult<Token<'i>> {
fn get_operator_token<'i>(input: &mut &'i str) -> PResult<Token<'i>> {
// Define the allowed operator characters
let allowed_operators = (
'!', '<', '>', '=', '|', ':', '-', '~', '*', '&', '@', '^', '?', '#', '/',
'!', '<', '>', '=', '|', ':', '-', '~', '*', '&', '@', '^', '?', '#', '/', '%',
);

take_while(2..=5, allowed_operators)
Expand Down

0 comments on commit e9cec22

Please sign in to comment.