// Accepts whitespace and comment. public static StatementBuilder <StatementType, ParserTokenType, LexerTokenType> AcceptTrailingComment( this StatementBuilder <StatementType, ParserTokenType, LexerTokenType> statement) { statement.Accept(LexerTokenType.Whitespace, ParserTokenType.Whitespace); if (statement.TokenBuffer.Is(LexerTokenType.Hash)) { statement.AggregateWhileNot(LexerTokenType.Newline, ParserTokenType.Comment); } // Note that we *don't* eat the trailing Newline, because callers may need to know about it // for some line-based parsing logic. return(statement); }