@@ -419,7 +419,6 @@ public enum TokenType
419419 Not ,
420420 Or ,
421421 Make ,
422- Is ,
423422 RunExec ,
424423 EZCodeDataType ,
425424 Include ,
@@ -492,10 +491,14 @@ private LineWithTokens[] TokenArray(string code, bool insideClass = false)
492491 }
493492 internal Token SingleToken ( object [ ] parts , int partIndex , string stringPart )
494493 {
495- TokenType tokenType = TokenType . None ;
494+ TokenType tokenType = TokenType . None ; // the output token type
495+
496+ // checks if the part is a string
496497 if ( parts [ partIndex ] is string )
497498 {
498- string part = parts [ partIndex ] as string ;
499+ string part = parts [ partIndex ] as string ; // the part from parts
500+
501+ // sets the tokenType to the correct type
499502 switch ( part )
500503 {
501504 default : tokenType = TokenType . Identifier ; break ;
@@ -522,19 +525,20 @@ internal Token SingleToken(object[] parts, int partIndex, string stringPart)
522525 case "break" : tokenType = TokenType . Break ; break ;
523526 case "yield" : tokenType = TokenType . Yield ; break ;
524527 case "global" : tokenType = TokenType . Global ; break ;
525- case "is" : tokenType = TokenType . Is ; break ;
526528 case "get" : tokenType = TokenType . Get ; break ;
527529 case "new" : tokenType = TokenType . New ; break ;
528530 case "make" : tokenType = TokenType . Make ; break ;
529531 case "null" : tokenType = TokenType . Null ; parts [ partIndex ] = "" ; break ;
530532 }
531- if ( part . StartsWith ( "//" ) ) tokenType = TokenType . Comment ;
532- if ( part . StartsWith ( '@' ) ) tokenType = TokenType . DataType ;
533+ if ( part . StartsWith ( "//" ) ) tokenType = TokenType . Comment ; // If the part starts with '//', it is comment
534+ if ( part . StartsWith ( '@' ) ) tokenType = TokenType . DataType ; // If the part starts with '@', it is a datatype
533535 }
536+ // If the part is a statement
534537 else if ( parts [ partIndex ] is Statement )
535538 {
536539 Statement part = ( Statement ) parts [ partIndex ] ;
537540
541+ // sets the tokenType to the type of statement 'part' is
538542 switch ( part . Type )
539543 {
540544 case "if" : tokenType = TokenType . If ; break ;
@@ -545,26 +549,32 @@ internal Token SingleToken(object[] parts, int partIndex, string stringPart)
545549 case "fail" : tokenType = TokenType . Fail ; break ;
546550 }
547551 }
552+ // If it is Class, set the part to the appropriate type
548553 else if ( parts [ partIndex ] is Class )
549554 {
550555 tokenType = TokenType . Class ;
551556 }
557+ // If it is RunMethod (A match), set the part to the appropriate type
552558 else if ( parts [ partIndex ] is RunMethod )
553559 {
554560 tokenType = TokenType . Match ;
555561 }
562+ // If it is Method, set the part to the appropriate type
556563 else if ( parts [ partIndex ] is Method )
557564 {
558565 tokenType = TokenType . Method ;
559566 }
567+ // If it is C# method, set the part to the appropriate type
560568 else if ( parts [ partIndex ] is CSharpMethod )
561569 {
562570 tokenType = TokenType . RunExec ;
563571 }
572+ // If it is C# datatype, set the part to the appropriate type
564573 else if ( parts [ partIndex ] is CSharpDataType )
565574 {
566575 tokenType = TokenType . EZCodeDataType ;
567576 }
577+ // If it is Container, set the part to the appropriate type
568578 else if ( parts [ partIndex ] is Container )
569579 {
570580 tokenType = TokenType . Container ;
0 commit comments