Skip to content
Snippets Groups Projects
  1. Nov 11, 2022
  2. Nov 03, 2022
  3. Sep 28, 2022
  4. Sep 23, 2022
    • Sven M. Hallberg's avatar
      add (naive) multi-chunk operation for packrat · dec43afe
      Sven M. Hallberg authored
      The naive implementation concatenates all input and blindly re-runs the full
      parse on every chunk. Keeping state between chunks is for later.
      
      Note: The iterative API expects us to always consume an entire input chunk
      when we suspend, even if packrat later backtracks into it. We will produce
      the correct parse result and accurately consume from a final chunk, but all
      earlier chunks will be reported as fully consumed and as being part of the
      HParseResult in terms of its bit_length field.
      dec43afe
    • Sven M. Hallberg's avatar
      add h_realloc to go with h_alloc · b3f509ee
      Sven M. Hallberg authored
      b3f509ee
    • Sven M. Hallberg's avatar
      use %zu for printing size_t · 8213eb45
      Sven M. Hallberg authored
      NB: The 'z' size modifier is in C99.
      8213eb45
  5. Sep 22, 2022
    • Sven M. Hallberg's avatar
      fail packrat parsers if they need more input · 866fd4d6
      Sven M. Hallberg authored
      This commit changes the contract for the combinator parse functions:
      
       (1) The input state on failure must retain valid overrun and last_chunk
           fields. The latter is never changed, but overrun would be cleared by
           various combinators that backtrack in case of failure. All other
           fields of the input stream are still considered indeterminate after a
           failed parse.
      
       (2) If an overrun condition is encountered before the final chunk
           (last_chunk is false), the parse *must* fail. A helper want_suspend()
           is introduced as a shorthand for this check.
      
      Fixes the packrat/iterative/dummy test.
      866fd4d6
    • Sven M. Hallberg's avatar
      don't restore input state on failure · 0d7f1091
      Sven M. Hallberg authored
      There's no need.
      0d7f1091
    • Sven M. Hallberg's avatar
      improve a label name · f8e0dffb
      Sven M. Hallberg authored
      This is the case where parsing stops, which may be a parse error or not,
      depending on how many elements were read.
      f8e0dffb
    • Sven M. Hallberg's avatar
      remove an unreachable case · a30adad4
      Sven M. Hallberg authored
      Replace it with an assert. This case could never occur because it tests
      precisely the loop condition and there are no break statements in the loop.
      
      This was the only use of the 'err' label, so that can go. The code under it
      remains the fall-through case for 'err0', i.e. the actual error (parse failure)
      case.
      a30adad4
    • Sven M. Hallberg's avatar
      add a test for using dummy iterative with multiple chunks · 46164756
      Sven M. Hallberg authored
      The test fails because currently parsers that fail may leave the input stream
      in any indeterminate state. Parsers that backtrack (h_many, h_choice,
      h_optional, etc.) do not propagate an overrun of their subordinate parsers to
      h_packrat_parse_chunk where we would detect it and fail.
      46164756
    • Sven M. Hallberg's avatar
      b28f5427
    • Sven M. Hallberg's avatar
      fit comment to 80 columns · 3b22f3e7
      Sven M. Hallberg authored
      3b22f3e7
    • Sven M. Hallberg's avatar
      make header guard match file name · 1c83beb7
      Sven M. Hallberg authored
      Also includes a very important cosmetic whitespace change.
      1c83beb7
    • Sven M. Hallberg's avatar
      refactor perform_lowlevel_parse for readability · f600634a
      Sven M. Hallberg authored
      Drive-by elimination of an age-old TODO. :)
      Code should be functionally equivalent. Changes:
      
       - Remove broken code under CONSISTENCY_CHECK.
       - Transform to chip-away style.
       - Remove braces around single statements.
       - Declare variables at top of function.
       - Shorten some variable names (tmp_res and bit_length).
       - Limit line length to 80 columns.
      f600634a
    • Sven M. Hallberg's avatar
      dummy support for iterative parsing in packrat · 92805cb1
      Sven M. Hallberg authored
      A very first step. This implementation still expects all input in a single
      chunk but allows the use of the iterative API. If the parser attempts to read
      past the first chunk, the parse fails.
      
      Contains some comments for next steps towards full support.
      
      Adds tests for the single-chunk case.
      92805cb1
  6. Sep 21, 2022
  7. Aug 18, 2022
  8. Aug 11, 2022
  9. Aug 09, 2022
  10. Aug 08, 2022
  11. Apr 15, 2022
  12. Jan 27, 2022
  13. Dec 05, 2021
  14. Oct 06, 2021
  15. Sep 09, 2021
  16. Jun 04, 2021
  17. May 15, 2021
  18. May 12, 2021
  19. May 08, 2021
    • picomeg's avatar
      Parsers use backend-vtable pointers without needing the enum. TODO: · 5c30b9c7
      picomeg authored
      right now there is duplication as the enum backend value is still
      present- need to find out if it's OK to make a breaking change for
      anyone who is for reasons known only to themselves chekcing which
      backend enum value is one a parser they may have created and compiled...
      5c30b9c7
  20. Mar 26, 2021
  21. Mar 22, 2021
  22. Mar 09, 2021
Loading