Feature/directive/version #6

Closed
bazaah wants to merge 11 commits from feature/directive/version into master

11 Commits

Author SHA1 Message Date
Paul Stemmet da8dbc0e33
lib/scanner: scan tag directives
+ add unit tests for tag directives
2021-06-06 00:04:31 +00:00
Paul Stemmet 90e45604a7
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 00:01:35 +00:00
Paul Stemmet 83553c2e13
lib/scanner: add InvalidTagHandle, InvalidTagPrefix variants 2021-06-05 23:59:59 +00:00
Paul Stemmet 865fd9f557
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-05 17:02:24 +00:00
Paul Stemmet 37cc45803a
lib/scanner: add UnexpectedEOF error variant 2021-06-05 17:01:38 +00:00
Paul Stemmet 7b3b773b79
lib/scanner: add tokens! > variant for matching Results 2021-06-05 17:00:39 +00:00
Paul Stemmet f9b03dd48e
lib/deps: add atoi
for fast slice -> ascii conversions
2021-06-05 16:58:53 +00:00
Paul Stemmet f519e1ad44
lib/scanner: clippy lints 2021-06-05 12:13:03 +00:00
Paul Stemmet 1a54b71659
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-05 12:07:44 +00:00
Paul Stemmet 14d69fe6f8
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-05 11:59:40 +00:00
Paul Stemmet 713e0a4918
lib/scanner: add error::ScanError
In preparation for moving the scanner iterator to return
Result<Token, ScanError>
2021-06-05 11:58:05 +00:00