File tree Expand file tree Collapse file tree
parser-generator/src/parser_generator
postgresql-cst-parser/src/tree_sitter Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -250,9 +250,7 @@ impl Lalr {
250250 . map ( |c| id_mapper. to_component_id ( & c) )
251251 . or_else ( || {
252252 rule. components
253- . iter ( )
254- . filter ( |c| matches ! ( c, Component :: Terminal ( _) ) )
255- . next_back ( )
253+ . iter ( ) . rfind ( |c| matches ! ( c, Component :: Terminal ( _) ) )
256254 . map ( |c| id_mapper. to_component_id ( c) )
257255 } )
258256 . and_then ( |component_id| assoc[ component_id. 0 as usize ] . clone ( ) ) ;
Original file line number Diff line number Diff line change @@ -155,7 +155,8 @@ fn walk_and_build(
155155 | SyntaxKind :: insert_column_list
156156 | SyntaxKind :: index_params
157157 | SyntaxKind :: values_clause
158- | SyntaxKind :: TableFuncElementList ) => {
158+ | SyntaxKind :: TableFuncElementList
159+ | SyntaxKind :: array_expr_list) => {
159160 if parent_kind == child_kind {
160161 // [Node: Flatten]
161162 //
@@ -526,5 +527,15 @@ FROM
526527 let ( new_root, _) = get_ts_tree_and_range_map ( input, & root) ;
527528 assert_no_direct_nested_kind ( & new_root, SyntaxKind :: TableFuncElementList ) ;
528529 }
530+
531+ #[ test]
532+ fn no_nested_array_expr_list ( ) {
533+ let input = "select array[[1,2],[3,4]];" ;
534+ let root = cst:: parse ( input) . unwrap ( ) ;
535+ assert_direct_nested_kind ( & root, SyntaxKind :: array_expr_list) ;
536+
537+ let ( new_root, _) = get_ts_tree_and_range_map ( input, & root) ;
538+ assert_no_direct_nested_kind ( & new_root, SyntaxKind :: array_expr_list) ;
539+ }
529540 }
530541}
You can’t perform that action at this time.
0 commit comments