Пример #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);
     }
 }
Пример #2
0
 private bool ProcessCommentLine(TerminalToken token)
 {
     if (OnCommentRead == null)
     {
         tokenizer.SkipToChar('\n');
         //SkipToEndOfLine();
         return(true);
     }
     else
     {
         Location start = this.tokenizer.GetCurrentLocation();
         tokenizer.SkipToChar('\n');
         //SkipToEndOfLine();
         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(true);
     }
 }