We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// comment
/* comment */
The text was updated successfully, but these errors were encountered:
https://github.com/Geal/nom/blob/main/doc/nom_recipes.md#comments
ok: many0(alt((..., multispace1)))
bad: many0(alt((..., multispace0)))
bad: many0(alt(multispace0, ...)
bad: many1(alt((..., multispace0)))
bad: many1(alt((multispace0, ...)))
ok: FnMut(&'a str) ...
bad: Fn(&'a str)
/// multispace0の代わりにparse_commentを使うべき pub fn ws<'a, F: 'a, O, E: ParseError<&'a str>>( inner: F, ) -> impl FnMut(&'a str) -> IResult<&'a str, O, E> where F: FnMut(&'a str) -> IResult<&'a str, O, E>, { delimited( many0(alt((parse_comments, value((), multispace1)))), inner, many0(alt((parse_comments, value((), multispace1)))), ) } fn parse_comments<'a, E: ParseError<&'a str>>(s: &'a str) -> IResult<&str, (), E> { alt((parse_comment_oneline, parse_comment_multiline))(s) } // ファイルの末尾に改行なしのコメントが書けるので // 末尾の改行は消費しないことに注意する fn parse_comment_oneline<'a, E: ParseError<&'a str>>(s: &'a str) -> IResult<&str, (), E> { value((), pair(tag("//"), is_not("\n")))(s) } fn parse_comment_multiline<'a, E: ParseError<&'a str>>(s: &'a str) -> IResult<&str, (), E> { value( (), // Output is thrown away. tuple((tag("/*"), take_until("*/"), tag("*/"))), )(s) }
Sorry, something went wrong.
No branches or pull requests
overview
// comment
,/* comment */
)The text was updated successfully, but these errors were encountered: