Skip to content

How can I Isolate a number from a string? #225

Answered by d-frey
deathwishdave asked this question in Q&A
Discussion options

You must be logged in to vote

Your grammar is not skipping whitespace or comments, even without comments it will not work. Note that the PEGTL does not automatically skip whitespace (and newlines) for you, it has to be part of the grammar.

Check out some of our examples, maybe start with https://github.com/taocpp/PEGTL/blob/master/src/example/pegtl/parse_tree.cpp and see how we use pad and space to allow skipping whitespace. Then look for examples like abnf2pegtl.cpp where we also skip comments.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by d-frey
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #225 on December 09, 2020 07:59.