Commit Graph

55 Commits

Author SHA1 Message Date
Paul Stemmet b7575fa0da
scanner/macros: fix error path syntax 2021-06-26 07:24:57 +00:00
Paul Stemmet c4e514f6c2 lib/token: move Ref to token
Ref is a type that allows us to discriminate between different lifetimes
specifically, whether the underlying Token is borrowed from the data, or
borrowed from the scratch space.

This buys us the ability to attempt zero copy deserialization, but fall
back to copying if required.
2021-06-23 21:51:33 +01:00
Paul Stemmet 70d2f3a2e5 git: ignore .vim/ 2021-06-23 21:51:33 +01:00
Paul Stemmet 82d27199b5 docs/flow-logic: notes from scalar line joining
This doc is incorrect, but kept for posterity
2021-06-23 21:51:33 +01:00
Paul Stemmet 0de27e1092 ci/clippy: fix error, allow styles
- On suspicious else, this is simply part of how I format this repo,
  so this style lint will be ignored
- On the manual range impl, inclusive ranges in Rust are slower than
  writing them out by hand by a significant amount
2021-06-23 21:51:33 +01:00
Paul Stemmet b4245b0936 scanner/scalar: implement double quote handling
- and add unit tests covering double quoted scalars
2021-06-23 21:51:33 +01:00
Paul Stemmet fa8988213e scanner/scalar: implement line break handling/joining 2021-06-23 21:51:33 +01:00
Paul Stemmet fd409a8f20 scanner/macros: check! handle EOF checks gracefully 2021-06-23 21:51:33 +01:00
Paul Stemmet ab668c7e3e scanner/macros: standardize documentation 2021-06-23 21:51:33 +01:00
Paul Stemmet 3b012f461d scanner/scalar: further improvements
- Improved docs
- Expand unit tests
- Slight improvements to code
2021-06-23 21:51:33 +01:00
Paul Stemmet 4dc5efae33 scalar/escape: various touchups
- Renamed fn flow_double_unescape -> flow_unescape
- Added unit tests for flow_unescape return
- Improved existing test coverage for hex escapes
- Documented module + flow_unescape
- Slight refactoring of module layout for readability
2021-06-23 21:51:33 +01:00
Paul Stemmet a750275b47 scalar/escape: add flow_double_unescape, unit tests
- partial coverage on units tests, need more
2021-06-23 21:51:33 +01:00
Paul Stemmet 5117961b23 scanner/scalar: implement skeleton for flow scalar scanning 2021-06-23 21:51:33 +01:00
Paul Stemmet 9cf1600088 scanner/macros: add unit tests for isBlank!, isBreak!, isBlankZ! 2021-06-23 21:51:33 +01:00
Paul Stemmet c478e26281 scanner/macros: isLineBreak! -> isBreak, add isBlank!, isBlankZ!
- isBlank checks for spaces or tabs
- isBlankZ = isBreak! || isBlank! || empty

names need some work
2021-06-23 21:51:33 +01:00
Paul Stemmet ba10beb0c6 scanner/macros: rewrite check! to be simpler to use, add isLineBreak! 2021-06-23 21:51:33 +01:00
Paul Stemmet 3526cd29c4 scanner/macros: allow advance! to update a var with $amount consumed 2021-06-23 21:51:33 +01:00
Paul Stemmet aa2dec094e scanner/error: add InvalidFlowScalar, UnknownEscape variants
for the coming work on scalars
2021-06-23 21:51:33 +01:00
Paul Stemmet 4bf4b50e3d lib/scanner: fix macro propagation to submodules 2021-06-23 21:51:33 +01:00
Paul Stemmet e7882ed599
ci/fmt: move rustfmt.toml to repo root 2021-06-22 21:14:34 +00:00
Paul Stemmet 93e3ff8f76 lib/scanner: allow YAML anchors (*ref, &ref) to be tokenized
- add units tests for anchors
2021-06-06 10:54:28 +01:00
Paul Stemmet f6f7102a16 lib/scanner: add InvalidAnchorName error variant 2021-06-06 10:54:28 +01:00
Paul Stemmet 8ce016f320 lib/scanner: clippy lints 2021-06-06 08:44:15 +01:00
Paul Stemmet 5240cb7330 lib/scanner: scan tag directives
+ add unit tests for tag directives
2021-06-06 08:44:15 +01:00
Paul Stemmet a66664dd27 lib/scanner: mv cow! to normal macros, add check!
- cow! is useful for non test
- check! is a macro for determining if a buffer has the given byte at
  the given pos (default 0)
- also add an advance! variant that returns the removed slice
2021-06-06 08:44:15 +01:00
Paul Stemmet e852509921 lib/scanner: add InvalidTagHandle, InvalidTagPrefix variants 2021-06-06 08:44:15 +01:00
Paul Stemmet 2596a79e3f lib/scanner: improve version directive parsing
- handle multibyte version numbers correctly
- only advance Scanner.buffer on Token boundaries
- Unit tests for the above items
2021-06-06 08:44:15 +01:00
Paul Stemmet 8c453afcb1 lib/scanner: add UnexpectedEOF error variant 2021-06-06 08:44:15 +01:00
Paul Stemmet 3a93cb006a lib/scanner: add tokens! > variant for matching Results 2021-06-06 08:44:15 +01:00
Paul Stemmet 2768e5c86c lib/deps: add atoi
for fast slice -> ascii conversions
2021-06-06 08:44:15 +01:00
Paul Stemmet 3348cd8fed lib/scanner: clippy lints 2021-06-06 08:44:15 +01:00
Paul Stemmet ea21c0824f lib/scanner: add support for version directive
- refactor common buffer advance pattern into a macro, advance!
- fixup tokens! macro to work with scanner returning results
- unit test for version directive
2021-06-06 08:44:15 +01:00
Paul Stemmet be4c6ad52c lib/token: fix mixup in directive variants
I misunderstood, Version should have (u8, u8) for the major and minor
versions, while Tag contains the borrowed content
2021-06-06 08:44:15 +01:00
Paul Stemmet 7beda497d0 lib/scanner: add error::ScanError
In preparation for moving the scanner iterator to return
Result<Token, ScanError>
2021-06-06 08:44:15 +01:00
Paul Stemmet 2146f55f28 style/fmt: apply rustfmt rules 2021-06-05 10:17:19 +01:00
Paul Stemmet 8dc9d10dfe style/fmt: add .rustfmt to root 2021-06-05 10:17:19 +01:00
Paul Stemmet 832ef5eb33 lib/reader: comments 2021-06-03 17:52:32 +01:00
Paul Stemmet a09c983d56 lib/reader: fix column @newline 2021-06-03 17:52:32 +01:00
Paul Stemmet 2e3562c28e lib/reader: fmt 2021-06-03 17:52:32 +01:00
Paul Stemmet 95e1edd194 lib/reader: add unit tests 2021-06-03 17:52:32 +01:00
Paul Stemmet 7c8b0cdc43 lib/reader: first go at a reader impl
We need to track our column and mark how far through we've read at the
very least.
2021-06-03 17:52:32 +01:00
Paul Stemmet b541afbf91 lib/error: use anyhow as an error stub 2021-06-03 17:52:32 +01:00
Paul Stemmet 85c9a9f0c5 lib/scanner: improve eat_whitespace to chomp comments 2021-06-02 19:34:12 +01:00
Paul Stemmet 68cc3f7342 lib/scanner: improve tokens! macro error reporting 2021-06-02 19:34:12 +01:00
Paul Stemmet 9ecea201c8 lib/scanner: add fn for chomping whitespace between tokens 2021-06-02 16:09:24 +01:00
Paul Stemmet bee55887f0
ci/prtasks: use install over mv 2021-06-02 14:52:43 +00:00
Paul Stemmet 7594379488
ci/prtasks: fix sccache version, improve curl output 2021-06-02 14:44:47 +00:00
Paul Stemmet d4e13dd167
ci: move actions to repo root 2021-06-02 14:39:52 +00:00
Paul Stemmet 5cdf7bfc10
ci/prtasks: add actions for PR unit testing 2021-06-02 14:34:25 +00:00
Paul Stemmet e90176db4b
add Cargo.lock file 2021-06-02 14:33:51 +00:00