@@ -162,13 +162,13 @@ task_test
162162 quote
163163 ')'
164164 break
165- { return { type: ' tests' , value: testPath . join ( ' ' ) }; }
165+ { return { type: ' tests' , value: adjust (testPath ) }; }
166166
167167task_hint
168168 = '@hint'
169169 hint : [^\n ^\r ]+
170170 break
171- { let h = trimBracketsAndQuotes (hint . join ( ' ' ));
171+ { let h = trimBracketsAndQuotes (adjust (hint ));
172172 return { type: ' hints' , value: h };
173173 }
174174
@@ -223,51 +223,40 @@ action_type
223223action_open
224224 = 'open'
225225 '('
226- quote
227226 file : file_path
228- quote
229227 ')'
230- { return ` open(" ${ file . join ( ' ' ) } " )` ; }
228+ { return ` open(${ adjust (file) } )` ; }
231229
232230action_insert
233231 = 'insert'
234- '('
235- content : between_brackets // TODO: make this more flexible
236- ')'
237- { return ` insert(${ flatten (content).join (' ' )} )` ; }
232+ content : between_brackets
233+ { return ` insert${ adjust (content)} ` ; }
238234
239235action_set
240236 = 'set'
241- '('
242- content : between_brackets // TODO: make this more flexible
243- ')'
244- { return ` set(${ flatten (content).join (' ' )} )` ; }
237+ content : between_brackets
238+ // second: (between_code_block space? ')' space? )
239+ { return ` set${ adjust (content)} ` ; }
245240
246241action_write
247242 = 'write'
248243 '('
249- quote
250244 to : file_path
251- quote
252245 ',' space ?
253246 quote
254247 content : [^\'\" ]+ // TODO: make this more flexible
255248 quote
256249 ')'
257- { return ` write(\" ${ to . join ( ' ' ) } \" , \" ${ content . join ( ' ' )} \" )` }
250+ { return ` write(${ adjust (to) } , \" ${ adjust (content )} \" )` }
258251
259252action_write_from_file
260253 = 'writeFromFile'
261254 '('
262- quote
263255 to : file_path
264- quote
265256 ',' space ?
266- quote
267257 from : file_path
268- quote
269258 ')'
270- { return ` writeFromFile(" ${ to . join ( ' ' ) } ", " ${ from . join ( ' ' ) } " )` ; }
259+ { return ` writeFromFile(${ adjust (to) } , ${ adjust (from) } )` ; }
271260
272261/*** "pegjs/shared.pegjs" ***/
273262
@@ -282,7 +271,8 @@ content = [^#^@^+] until_end
282271until_end = [^\n ^\r ]+ [\n\r ]
283272space = [ \s ]
284273break = [\n\r ]?
285- file_path = [a-zA-Z0-9_\-\s\. ]+
274+ file_path = quote [a-zA-Z0-9_\-\s\. ]+ quote
286275quote = [\"\'\` ]
287- between_brackets = [^\) ]+
276+ between_brackets = '(' [^\) ]+ ')'
277+ between_code_block = '```\n ' [^\` ]+ '```'
288278
0 commit comments