Ejemplo n.º 1
0
 private bool ProcessCommentStart(TerminalToken token)
 {
     if (OnCommentRead == null)
     {
         return(SkipAfterCommentEnd() != null);
     }
     else
     {
         Location      start      = this.tokenizer.GetCurrentLocation();
         TerminalToken commentEnd = SkipAfterCommentEnd();
         bool          result     = commentEnd != null;
         if (result)
         {
             Location             end     = this.tokenizer.GetCurrentLocation();
             string               str     = this.tokenizer.GetInput();
             int                  len     = end.Position - start.Position;
             string               comment = str.Substring(start.Position, len - commentEnd.Text.Length);
             CommentReadEventArgs args    = new CommentReadEventArgs(token.Text + comment,
                                                                     comment,
                                                                     false);
             OnCommentRead(this, args);
         }
         return(result);
     }
 }
Ejemplo n.º 2
0
 private bool ProcessCommentLine(TerminalToken token)
 {
     if (OnCommentRead == null)
     {
         return(SkipToEndOfLine());
     }
     else
     {
         Location start  = this.tokenizer.GetCurrentLocation();
         bool     result = SkipToEndOfLine();
         if (result)
         {
             Location             end     = this.tokenizer.GetCurrentLocation();
             string               str     = this.tokenizer.GetInput();
             int                  len     = end.Position - start.Position;
             string               comment = str.Substring(start.Position, len);
             CommentReadEventArgs args    = new CommentReadEventArgs(token.Text + comment,
                                                                     comment,
                                                                     true);
             OnCommentRead(this, args);
         }
         return(result);
     }
 }