@@ -120,6 +120,7 @@ where
120120 // onto the line so we can start working on the next one
121121 self . last_gcode_type = Some ( word) ;
122122 if let Some ( completed) = temp_gcode. take ( ) {
123+ print ! ( "Panic push {:?}" , completed) ;
123124 if let Err ( e) = line. push_gcode ( completed) {
124125 self . on_gcode_push_error ( e. 0 ) ;
125126 }
@@ -130,6 +131,8 @@ where
130131 word. span ,
131132 B :: Arguments :: default ( ) ,
132133 ) ) ;
134+
135+ println ! ( "temp: {}{}" , mnemonic, word. value) ;
133136 return ;
134137 }
135138
@@ -429,9 +432,8 @@ mod tests {
429432
430433 #[ test]
431434 fn implicit_command_after_newline ( ) {
432- let src = "G90 \n G01 X1.0 Y2.0\n X3.0 Y4.0" ;
435+ let src = "G01 X1.0 Y2.0\n X3.0 Y4.0" ;
433436 let expected = vec ! [
434- GCode :: new( Mnemonic :: General , 90.0 , Span :: PLACEHOLDER ) ,
435437 GCode :: new( Mnemonic :: General , 1.0 , Span :: PLACEHOLDER )
436438 . with_argument( Word :: new( 'X' , 1.0 , Span :: PLACEHOLDER ) )
437439 . with_argument( Word :: new( 'Y' , 2.0 , Span :: PLACEHOLDER ) ) ,
@@ -444,4 +446,23 @@ mod tests {
444446 assert_eq ! ( got, expected) ;
445447 }
446448
449+ #[ test]
450+ #[ ignore]
451+ // This test focuses on the G90 and M7 on the same line.
452+ fn two_commands_in_a_row ( ) {
453+ let src = "G90 M7\n G01 X1.0 Y2.0\n X3.0 Y4.0" ;
454+ let expected = vec ! [
455+ GCode :: new( Mnemonic :: General , 90.0 , Span :: PLACEHOLDER ) ,
456+ GCode :: new( Mnemonic :: Miscellaneous , 7.0 , Span :: PLACEHOLDER ) ,
457+ GCode :: new( Mnemonic :: General , 1.0 , Span :: PLACEHOLDER )
458+ . with_argument( Word :: new( 'X' , 1.0 , Span :: PLACEHOLDER ) )
459+ . with_argument( Word :: new( 'Y' , 2.0 , Span :: PLACEHOLDER ) ) ,
460+ GCode :: new( Mnemonic :: General , 1.0 , Span :: PLACEHOLDER )
461+ . with_argument( Word :: new( 'X' , 3.0 , Span :: PLACEHOLDER ) )
462+ . with_argument( Word :: new( 'Y' , 4.0 , Span :: PLACEHOLDER ) ) ,
463+ ] ;
464+
465+ let got: Vec < _ > = crate :: parse ( src) . collect ( ) ;
466+ assert_eq ! ( got, expected) ;
467+ }
447468}
0 commit comments