示例#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)
        {
            Location start  = tokenizer.GetCurrentLocation();
            bool     result = SkipToEndOfLine();

            if (result)
            {
                Location end     = tokenizer.GetCurrentLocation();
                string   str     = tokenizer.GetInput();
                int      len     = end.Position - start.Position;
                string   comment = str.Substring(start.Position, len);
                token.UserObject = comment;
                if (OnCommentRead != null)
                {
                    CommentReadEventArgs args = new CommentReadEventArgs(token.Text, comment, true);
                    OnCommentRead(this, args);
                }
            }
            return(result);
        }
 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);
     }
 }
示例#4
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;
     }
 }
示例#5
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;
     }
 }
示例#6
0
 /// <summary>
 /// Event handler for the reading a comment.
 /// </summary>
 /// <param name="parser">parser that is the source of this event</param>
 /// <param name="args">event arguments</param>
 private void CommentReadEvent(LALRParser parser, CommentReadEventArgs args)
 {
     string desc;
     if (args.LineComment)
         desc = "Line Comment";
     else
         desc = "Block Comment";
     AddViewItem("Comment Read", null, desc, args.Content, "", 6);
 }
示例#7
0
 private bool ProcessCommentLine(TerminalToken token)
 {
     Location start = tokenizer.GetCurrentLocation();
     bool result = SkipToEndOfLine();
     if (result)
     {
         Location end = tokenizer.GetCurrentLocation();
         string str = tokenizer.GetInput();
         int len = end.Position - start.Position;
         string comment = str.Substring(start.Position, len);
         token.UserObject = comment;
         if (OnCommentRead != null)
         {
             CommentReadEventArgs args = new CommentReadEventArgs(token.Text, comment, true);
             OnCommentRead(this, args);
         }
     }
     return result;
 }