File tree Expand file tree Collapse file tree 3 files changed +25
-16
lines changed Expand file tree Collapse file tree 3 files changed +25
-16
lines changed Original file line number Diff line number Diff line change @@ -202,23 +202,23 @@ on_page_complete
202202task_action
203203 = '@action'
204204 '('
205- action : action_type
205+ value : action_type
206206 ')'
207207 break
208208
209209 {
210210 return {
211211 type: ' actions' ,
212- value: action,
212+ value
213213 };
214214 }
215215
216216action_type
217- = action : action_open
218- /* / action_set
219- / action_insert
220- / action_write
221- / action_write_from_file*/
217+ = action_open
218+ // action_set
219+ // action_insert
220+ // action_write
221+ / action_write_from_file
222222
223223
224224action_open
@@ -265,6 +265,7 @@ action_write_from_file
265265 from : file_path
266266 quote
267267 ')'
268+ { return ` writeFromFile("${ to .join (' ' )} ", "${ from .join (' ' )} ")` ; }
268269
269270/*** "pegjs/shared.pegjs" ***/
270271
Original file line number Diff line number Diff line change 11task_action
22 = '@action'
33 '('
4- action : action_type
4+ value : action_type
55 ')'
66 break
77
88 {
99 return {
1010 type: ' actions' ,
11- value: action,
11+ value
1212 };
1313 }
1414
1515action_type
16- = action : action_open
17- /* / action_set
18- / action_insert
19- / action_write
20- / action_write_from_file*/
16+ = action_open
17+ // action_set
18+ // action_insert
19+ // action_write
20+ / action_write_from_file
2121
2222
2323action_open
@@ -64,3 +64,4 @@ action_write_from_file
6464 from : file_path
6565 quote
6666 ')'
67+ { return ` writeFromFile("${ to .join (' ' )} ", "${ from .join (' ' )} ")` ; }
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ test.skip('parses an action: set', t => {
2323 const data = `${ start }
2424@action(set('var a = 42;'))
2525` ;
26- const expected = [ "set(' var a = 42;' )" ] ;
26+ const expected = [ "set(\" var a = 42;\" )" ] ;
2727 const result = parse ( data ) ;
2828 t . deepEqual ( result . pages [ 0 ] . tasks [ 0 ] . actions , expected ) ;
2929} ) ;
@@ -38,6 +38,13 @@ test.skip('parses an action: insert', t => {
3838} ) ;
3939
4040test . todo ( 'parses an action: write' ) ;
41- test . todo ( 'parses an action: writeFileFromFile' ) ;
41+
42+ test ( 'parses an action: writeFromFile' , t => {
43+ const data = `${ start } @action(writeFromFile('to.js', 'from.js'))
44+ ` ;
45+ const expected = [ "writeFromFile(\"to.js\", \"from.js\")" ] ;
46+ const result = parse ( data ) ;
47+ t . deepEqual ( result . pages [ 0 ] . tasks [ 0 ] . actions , expected ) ;
48+ } ) ;
4249
4350test . todo ( 'parses multiple actions: open & set' ) ;
You can’t perform that action at this time.
0 commit comments