Paul Stemmet
d6f0c71e71
scanner/scalar: make submodules public (to scanner)
2021-06-27 17:35:02 +01:00
Paul Stemmet
cd3e7beb1e
lib/token: add helper methods to Token + Ref
...
- Token.borrowed + Token.copied for wrapping into Ref::Borrowed/Copied
- Ref.PartialEq<Token> for comparisons
2021-06-27 17:35:02 +01:00
Paul Stemmet
da9e4f14e8
scalar/escape: clippy lints
2021-06-26 09:24:08 +01:00
Paul Stemmet
e1d79d4851
scalar/escape: add more unit tests for tag_uri_unescape
2021-06-26 09:24:08 +01:00
Paul Stemmet
5be9c9fb1d
scalar/escape: fix flow_unescape documentation
2021-06-26 09:24:08 +01:00
Paul Stemmet
54614aafd0
scalar/escape: move exported fns to top, document tag_uri_unescape
2021-06-26 09:24:08 +01:00
Paul Stemmet
cb7d622b98
scalar/escape: add tag_uri_unescape
...
This function unescapes percent encoded tag URIs, in accordance with
Section 5.6 Miscellaneous Characters #ns-uri-char
- Also add unit test for function
2021-06-26 09:24:08 +01:00
Paul Stemmet
fb5619c638
scalar/escape: as_hex returns u8
...
This allows the caller to decide if a cast is necessary
2021-06-26 09:24:08 +01:00
Paul Stemmet
b00970e2f4
scanner/macros: add isHex!
2021-06-26 09:24:08 +01:00
Paul Stemmet
56ea9f6921
scanner/macros: fix error path syntax
2021-06-26 09:24:08 +01: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