File tree Expand file tree Collapse file tree 4 files changed +22
-44
lines changed Expand file tree Collapse file tree 4 files changed +22
-44
lines changed Original file line number Diff line number Diff line change 11Page 1
2- press button_A show_image LED_image
2+ When press button_A Do show_image LED_image
331 1 . 1 1
441 1 . 1 1
55. . . . .
661 . . . 1
77. 1 1 1 .
8-
98 LED_image
1091 1 . 1 1
1110. . . . .
12111 . . . 1
1312. 1 1 1 .
1413. . . . .
1514
16- EOR
1715
18- press button_A play_sound happy EOR
16+ When press button_A Do play_sound happy
1917
20- press button_B show_image LED_image
18+ When press button_B Do show_image LED_image
21191 1 . 1 1
22201 1 . 1 1
2321. . . . .
2422. 1 1 1 .
25231 . . . 1
26-
2724 LED_image
28251 1 . 1 1
29261 1 . 1 1
3027. . . . .
3128. . . . .
32291 1 1 1 1
3330
34- EOR
3531
36- press button_B play_sound sad EOR
32+ When press button_B Do play_sound sad
3733
38- EOP
3934Page 2
4035
41- EOP
4236Page 3
4337
44- EOP
4538Page 4
4639
47- EOP
4840Page 5
4941
50- EOP
51-
52- button-up
5342
5443Page 1
55- press button_A show_image LED_image
44+ When press button_A Do show_image LED_image
56451 1 . 1 1
57461 1 . 1 1
5847. . . . .
59481 . . . 1
6049. 1 1 1 .
61-
6250 LED_image
63511 1 . 1 1
6452. . . . .
65531 . . . 1
6654. 1 1 1 .
6755. . . . .
6856
69- EOR
7057
71- press button_A play_sound happy EOR
58+ When press button_A Do play_sound happy
7259
73- press button_B show_image LED_image
60+ When press button_B Do show_image LED_image
74611 1 . 1 1
75621 1 . 1 1
7663. . . . .
7764. 1 1 1 .
78651 . . . 1
79-
8066 LED_image
81671 1 . 1 1
82681 1 . 1 1
8369. . . . .
8470. . . . .
85711 1 1 1 1
8672
87- EOR
8873
89- press button_B play_sound sad EOR
74+ When press button_B Do play_sound sad
9075
91- EOP
9276Page 2
9377
94- EOP
9578Page 3
9679
97- EOP
9880Page 4
9981
100- EOP
10182Page 5
10283
103- EOP
84+
Original file line number Diff line number Diff line change @@ -296,7 +296,8 @@ namespace microcode {
296296 this . progdef = ProgramDefn . fromBuffer ( new BufferReader ( buf ) )
297297 // to string
298298 const progAsString = this . progdef . toString ( )
299- const progFromString = parse ( progAsString )
299+ console . log ( progAsString )
300+ // const progFromString = parse(progAsString)
300301 // const progAsBuf = progFromString.toBuffer()
301302 // // compare buffers
302303 // if (buf.length == progAsBuf.length) {
Original file line number Diff line number Diff line change @@ -286,26 +286,24 @@ namespace microcode {
286286 const tok = toToken ( tile )
287287 if ( tile instanceof ModifierEditor ) {
288288 const mod = tile as ModifierEditor
289- return (
290- tok +
291- `\n` +
292- mod . fieldEditor . toString ( mod . getField ( ) ) +
293- "\n"
294- )
289+ const field = mod . fieldEditor . toString ( mod . getField ( ) )
290+ if ( mod instanceof IconEditor ) return `${ tok } \n${ field } `
291+ else return `${ tok } ${ field } \n`
295292 }
296293 return tok
297294 }
298295 return (
296+ "When " +
299297 toToken ( this . sensor ) +
300298 " " +
301299 this . filters . map ( tileToString ) . join ( " " ) +
302- " " +
300+ " Do " +
303301 ( this . actuators . length
304302 ? toToken ( this . actuators [ 0 ] ) +
305303 " " +
306304 this . modifiers . map ( tileToString ) . join ( " " )
307305 : "" ) +
308- " EOR \n"
306+ "\n"
309307 )
310308 }
311309 }
@@ -417,7 +415,7 @@ namespace microcode {
417415
418416 public toString ( ) {
419417 const res = this . pages . map ( page => page . toString ( ) )
420- return res . map ( ( ps , i ) => `Page ${ i + 1 } \n${ ps } \nEOP ` ) . join ( "\n" )
418+ return res . map ( ( ps , i ) => `Page ${ i + 1 } \n${ ps } ` ) . join ( "\n" )
421419 }
422420 }
423421
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ namespace microcode {
2828 for ( let i = 0 ; i < lines . length ; i ++ ) {
2929 if ( currTile && currTile instanceof IconEditor ) {
3030 const all5 = lines . slice ( i , i + 5 ) . join ( "\n" )
31- console . log ( `get the image? ${ all5 } ` )
31+ console . log ( `get the image?\n ${ all5 } ` )
3232 currTile . field = currTile . fieldEditor . fromString ( all5 )
3333 currTile = undefined
3434 i = i + 4 // loop count adds one more
@@ -42,13 +42,11 @@ namespace microcode {
4242 } else if ( tokens [ 0 ] == "EOP" ) {
4343 prog . pages . push ( currPage )
4444 currPage = undefined
45- } else if ( tokens [ 0 ] == "EOR" ) {
46- console . log ( "EOR" )
47- currPage . rules . push ( currRule )
48- currRule = undefined
45+ } else if ( tokens [ 0 ] == "When" ) {
46+ if ( currRule ) currPage . rules . push ( currRule )
47+ currRule = new RuleDefn ( )
4948 } else {
5049 if ( ! currRule ) {
51- currRule = new RuleDefn ( )
5250 currRule . sensors . push ( token2tile ( tokens [ 0 ] ) as number )
5351 tokens . shift ( )
5452 }
You can’t perform that action at this time.
0 commit comments