-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
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
Question: how to match on end of string? #36
Comments
There isn't an explicit operator for matching the end of the string -- Canopy parsers implicitly match the entire input. If you give the parser some input and the parser doesn't reach the end of the input by following the grammar rules, then it will fail with an error. |
@jcoglan Thanks for the feedback. My work-around has been to append a space before parsing, that triggers a different rule and alleviates my need to identify an |
Oh, I see what you mean. There is a way to match only if an expression appears at the end of the input, which is to use a negative look-ahead to check there is no character after the expression. So, |
(Sorry it took me so long to reply in the first place.) |
How can I match on the end of input (or end of input string)?
in .peg file I have this
end_of_string <- [$]+
, but it does not seem to match the 'end of string'.Is there a better way? (sorry to make an issue, I did look for the answer in the docs and on stackoverflow, first)
The text was updated successfully, but these errors were encountered: