File tree Expand file tree Collapse file tree 2 files changed +21
-19
lines changed Expand file tree Collapse file tree 2 files changed +21
-19
lines changed Original file line number Diff line number Diff line change @@ -24,9 +24,10 @@ pub fn run() -> Result<(), Box<dyn Error>> {
24
24
let parsed_input = parser:: parse ( input_program. as_str ( ) ) ?;
25
25
let parse_output = parsed_input. dump ( ) ;
26
26
27
- match cli_options. output_file {
28
- Some ( output_path) => fs:: write ( output_path, parse_output) ?,
29
- None => println ! ( "{}" , parse_output) ,
27
+ if let Some ( output_path) = cli_options. output_file {
28
+ fs:: write ( output_path, parse_output) ?;
29
+ } else {
30
+ println ! ( "{}" , parse_output) ;
30
31
} ;
31
32
32
33
Ok ( ( ) )
Original file line number Diff line number Diff line change 1
1
;redcode
2
2
3
- ;name Dwarf
4
- ;author A. K. Dewdney
5
- ;version 94.1
6
- ;date April 29, 1993
3
+ ;name Dwarf
4
+ ;author A. K. Dewdney
5
+ ;version 94.1
6
+ ;date April 29, 1993
7
7
8
- ;strategy Bombs every fourth instruction.
9
- ;assert CORESIZE % 4 == 0
8
+ ;strategy Bombs every fourth instruction.
9
+ ;assert ( CORESIZE % 4 == 0) && (foo > baz)
10
10
11
- ORG start ; Indicates the instruction with
12
- ; the label "start" should be the
13
- ; first to execute.
11
+ ORG start ; Indicates the instruction with
12
+ ; the label "start" should be the
13
+ ; first to execute.
14
14
15
- step EQU 4 ; Replaces all occurrences of "step"
16
- ; with the character "4".
15
+ step EQU 4 ; Replaces all occurrences of "step"
16
+ ; with the character "4".
17
+
18
+ target DAT.F #0, #0 ; Pointer to target instruction.
19
+ start ADD.AB #step, target ; Increments pointer by step.
20
+ MOV.AB #0, @target ; Bombs target instruction.
21
+ JMP.A start ; Same as JMP.A -2. Loops back to
22
+ ; the instruction labelled "start
17
23
18
- target DAT.F #0, #0 ; Pointer to target instruction.
19
- start ADD.AB #step, target ; Increments pointer by step.
20
- MOV.AB #0, @target ; Bombs target instruction.
21
- JMP.A start ; Same as JMP.A -2. Loops back to
22
- ; the instruction labelled "start".
23
24
END
You can’t perform that action at this time.
0 commit comments