Change Word::keyword to a enum (#193)

This improves performance and paves the way to future API enhancements as discussed in the PR https://github.com/andygrove/sqlparser-rs/pull/193
This commit is contained in:
Daniël Heres 2020-06-11 21:00:35 +02:00 committed by GitHub
parent 0fe3a8ec39
commit 34548e890b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 395 additions and 342 deletions

View file

@ -22,7 +22,7 @@ use matches::assert_matches;
use sqlparser::ast::*;
use sqlparser::dialect::keywords::ALL_KEYWORDS;
use sqlparser::parser::*;
use sqlparser::parser::{Parser, ParserError};
use sqlparser::test_utils::{all_dialects, expr_from_projection, number, only};
#[test]
@ -1354,10 +1354,12 @@ fn parse_window_functions() {
avg(bar) OVER (ORDER BY a \
RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING), \
max(baz) OVER (ORDER BY a \
ROWS UNBOUNDED PRECEDING) \
ROWS UNBOUNDED PRECEDING), \
sum(qux) OVER (ORDER BY a \
GROUPS BETWEEN 1 PRECEDING AND 1 FOLLOWING) \
FROM foo";
let select = verified_only_select(sql);
assert_eq!(4, select.projection.len());
assert_eq!(5, select.projection.len());
assert_eq!(
&Expr::Function(Function {
name: ObjectName(vec![Ident::new("row_number")]),
@ -2872,7 +2874,7 @@ fn parse_drop_index() {
}
#[test]
fn keywords_sorted() {
fn all_keywords_sorted() {
// assert!(ALL_KEYWORDS.is_sorted())
let mut copy = Vec::from(ALL_KEYWORDS);
copy.sort();