Module pear::parsers

source ·

Functions§

  • Parse a token stream that starts with start and ends with end, returning all of the tokens in between. The tokens in between must match cond. Succeeds even if there are no tokens between start and end.
  • Parse a token stream that starts with start and ends with end, returning all of the tokens in between. The tokens in between must match cond. There must be at least one token between start and end.
  • Eats the current token if it is token.
  • Eats the current token unconditionally. Fails if there are no tokens.
  • Eats the token token if cond holds on the current token.
  • Eats the current slice if it is slice.
  • Like delimited but keeps the start and end.
  • Succeeds only if the input has reached EOF.
  • Consumes no tokens. Always succeeds. Equivalent to take_while(|_| false).
  • Succeeds if the current token is token.
  • Returns the current token.
  • Succeeds if cond holds for the current token.
  • Succeeds if cond holds for the current token.
  • Succeeds if the current slice is slice.
  • Succeeds if the current slice is slice.
  • Skips the current token unconditionally. Fails if there are no tokens.
  • Skips tokens while cond matches.
  • Takes at most n tokens.
  • Take exactly n tokens, ensuring cond holds on all n.
  • Takes at most n tokens as long as cond holds.
  • Consumes tokens while cond matches and returns them. Succeeds only if at least one token matched cond.
  • Consumes tokens while cond matches on a window of tokens of size n and returns them. Fails if there aren’t at least n tokens or if no tokens match, otherwise returns all of the tokens before the first failure.
  • Consumes tokens while cond matches and the token is not until. Succeeds only if at least one token matched cond.
  • Consumes tokens while cond matches on a window of tokens of size n and returns them. Fails if there no tokens match, otherwise returns all of the tokens before the first failure.
  • Consumes tokens while cond matches on a window of tokens of size n and returns them. Succeeds even if no tokens match.
  • Consumes tokens while cond matches and returns them. Succeeds even if no tokens match.
  • Consumes tokens while cond matches on a continously growing slice beginning at a length of 0 and ending when cond fails. Returns the slice between 0 and cond failing. Errors if no such slice exists.
  • Consumes tokens while cond matches on a window of tokens of size n and returns them. Fails if there aren’t at least n tokens, otherwise always otherwise always succeeds. If no tokens match, the result will be empty.
  • Consumes tokens while cond matches and the token is not until. Succeeds even if no tokens match.
  • Consumes tokens while cond matches on a window of tokens of size n and returns all of the tokens prior to the first failure to match. For example, given a string of “aaab” and a size 2 window predicate of window == "aa", the return value is "aa" as the first failure to match is at "ab".