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); } }
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); } }
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; } }
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; } }
/// <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); }
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; }