@@ -35,12 +35,11 @@ public GcodeHelper(string item)
3535 thisLine = item ;
3636 GcodeItems = new List < GcodeItem > ( ) ;
3737 bool FoundType = false ;
38- bool FoundAnyCode = false ;
3938 bool FoundNonBlank = false ;
4039 bool CommentActive = false ; // true when whe are in a parenthesis-delimmited comment "(like this)"
41- GcodeTokenTypes thisBlockType = GcodeTokenTypes . Undefined ;
40+ GcodeTokenTypes thisBlockType = GcodeTokenTypes . Gcode_Undefined ;
4241 string thisBlock = "" ;
43- GcodeTokenTypes thisTokenType = GcodeTokenTypes . Undefined ;
42+ GcodeTokenTypes thisTokenType = GcodeTokenTypes . Gcode_Undefined ;
4443 for ( int i = 0 ; i < this . thisLine . Length ; i ++ )
4544 {
4645 string priorChar = ( i > 0 ) ? thisLine . Substring ( i - 1 , 1 ) : "" ;
@@ -54,15 +53,14 @@ public GcodeHelper(string item)
5453 // if a semicolon is encountered, the rest of the line is a comment
5554 if ( thisChar == ";" )
5655 {
57- FoundAnyCode = true ;
5856 if ( thisBlock != "" )
5957 {
6058 // if we have a prior block of text with a different highlight type, add it to the list before moving on
6159 GcodeItems . Add ( new GcodeItem ( thisBlock , thisBlockType ) ) ;
6260 thisBlock = "" ;
6361 }
6462 thisBlock = thisLine . Substring ( i ) ;
65- GcodeItems . Add ( new GcodeItem ( thisBlock , GcodeTokenTypes . comment ) ) ;
63+ GcodeItems . Add ( new GcodeItem ( thisBlock , GcodeTokenTypes . Gcode_Comment ) ) ;
6664 thisBlock = "" ;
6765 break ;
6866 }
@@ -77,7 +75,7 @@ public GcodeHelper(string item)
7775 thisBlock = "" ;
7876 }
7977 thisBlock = thisLine . Substring ( i ) ;
80- GcodeItems . Add ( new GcodeItem ( thisBlock , GcodeTokenTypes . ocode ) ) ; // little o's are "o-codes"
78+ GcodeItems . Add ( new GcodeItem ( thisBlock , GcodeTokenTypes . Gcode_ocode ) ) ; // little o's are "o-codes"
8179 thisBlock = "" ;
8280 break ;
8381 }
@@ -86,7 +84,6 @@ public GcodeHelper(string item)
8684 string thisTargetTypeName ;
8785 if ( thisChar == "(" )
8886 {
89- FoundAnyCode = true ;
9087 if ( thisBlock != "" && ! CommentActive )
9188 {
9289 // if we have a prior block of text with a different highlight type, add it to the list before moving on
@@ -101,7 +98,7 @@ public GcodeHelper(string item)
10198 thisBlock += thisChar ;
10299 if ( CommentActive )
103100 {
104- GcodeItems . Add ( new GcodeItem ( thisBlock , GcodeTokenTypes . comment ) ) ;
101+ GcodeItems . Add ( new GcodeItem ( thisBlock , GcodeTokenTypes . Gcode_Comment ) ) ;
105102 thisBlock = "" ;
106103 }
107104 CommentActive = false ;
@@ -129,15 +126,15 @@ public GcodeHelper(string item)
129126// thisTokenType = GcodeTokenTypes.numbers;
130127 break ;
131128 case " " :
132- thisTokenType = GcodeTokenTypes . Undefined ;
129+ thisTokenType = GcodeTokenTypes . Gcode_Undefined ;
133130 break ;
134131 default :
135132 // check to see if we are searching for a keyword type. Numbers and dashes are included.
136133 if ( ! FoundType &&
137134 ( nextChar != "" ) && // apparently C# thinks an empty string is a number :/
138135 ( nextChar . All ( char . IsNumber ) || ( nextChar == "-" ) ) )
139136 {
140- thisTokenType = GcodeTokenTypes . Undefined ;
137+ thisTokenType = GcodeTokenTypes . Gcode_Undefined ;
141138 if ( CaseSensitivity )
142139 {
143140 thisTargetTypeName = "Gcode_" + thisChar ;
@@ -151,9 +148,8 @@ public GcodeHelper(string item)
151148 break ;
152149 }
153150 // Get an enum item by string name (e.g. Gcode_A, Gcode_B, etc)
154- if ( thisTokenType != GcodeTokenTypes . Undefined )
151+ if ( thisTokenType != GcodeTokenTypes . Gcode_Undefined )
155152 {
156- FoundAnyCode = true ;
157153 if ( ! FoundType )
158154 {
159155 if ( thisBlock != "" )
@@ -174,7 +170,7 @@ public GcodeHelper(string item)
174170 GcodeItems . Add ( new GcodeItem ( thisBlock , thisBlockType ) ) ;
175171 thisBlock = "" ;
176172 }
177- thisBlockType = GcodeTokenTypes . Undefined ;
173+ thisBlockType = GcodeTokenTypes . Gcode_Undefined ;
178174 FoundType = false ;
179175 }
180176 thisBlock += thisChar ;
0 commit comments