File tree Expand file tree Collapse file tree 3 files changed +47
-3
lines changed
Expand file tree Collapse file tree 3 files changed +47
-3
lines changed Original file line number Diff line number Diff line change @@ -673,12 +673,12 @@ endfunction
673673" start and end.
674674"
675675" Different languages have different rules for delimiters, so it might be a
676- " better idea to write a specific parser. See autoload/sj/argparser/js .vim for
677- " inspiration.
676+ " better idea to write a specific parser. See autoload/sj/argparser/json .vim
677+ " for inspiration.
678678"
679679function ! sj#ParseJsonObjectBody (from, to )
680680 " Just use js object parser
681- let parser = sj#argparser#js #Construct (a: from , a: to , getline (' .' ))
681+ let parser = sj#argparser#json #Construct (a: from , a: to , getline (' .' ))
682682 call parser.Process ()
683683 return parser.args
684684endfunction
Original file line number Diff line number Diff line change 1+ function ! sj#argparser#json#Construct (start_index, end_index, line )
2+ let parser = sj#argparser#common#Construct (a: start_index , a: end_index , a: line )
3+
4+ call extend (parser, {
5+ \ ' Process' : function (' sj#argparser#json#Process' ),
6+ \ })
7+
8+ return parser
9+ endfunction
10+
11+ " Note: Differs from "js" parser by the fact that JSON doesn't have /regexes/
12+ " to skip through.
13+ function ! sj#argparser#json#Process () dict
14+ while ! self .Finished ()
15+ if self .body[0 ] == ' ,'
16+ call self .PushArg ()
17+ call self .Next ()
18+ continue
19+ elseif self .body[0 ] = ~ " [\" '{\[ (]"
20+ call self .JumpPair (" \" '{[(" , " \" '}])" )
21+ endif
22+
23+ call self .PushChar ()
24+ endwhile
25+
26+ if len (sj#Trim (self .current_arg)) > 0
27+ call self .PushArg ()
28+ endif
29+ endfunction
Original file line number Diff line number Diff line change 686686 - prop: { a: 'one', b: 'two' }
687687 EOF
688688 end
689+
690+ specify "splitting paths in maps" do
691+ set_file_contents <<~EOF
692+ - copy: { dest: /etc/default/locale, content: "LANG=en_US.UTF-8" }
693+ EOF
694+
695+ vim . search 'dest'
696+ split
697+
698+ assert_file_contents <<~EOF
699+ - copy:
700+ dest: /etc/default/locale
701+ content: "LANG=en_US.UTF-8"
702+ EOF
703+ end
689704 end
690705end
You can’t perform that action at this time.
0 commit comments