Skip to content

Commit fcb318f

Browse files
randomeizerstephencelismbrandonw
authored
Printer prepending instead of appending (#145)
* Pointing `swift-custom-dump` to the "main" branch, since `0.4.0` hasn't been released publicly yet. * Switched printing to `prepend` rather than `append` Consequentially, all parsers that compose multiple parsers work backwards through provided parsers, and the `input` is built up from the back to the front. This allows print to check that the output is correct for cases like `Rest`, `Prefix`, `Not`, and `Peek`. * Added `Many` tests, fixed terminator bug * Whitespace cleanup * Fixed typo in test name. * Updated `End` to check input when printing. Added related tests. * Switched `Literal` printing to append rather than insert They now append into a copy of themselves, then append the `input`. * Updated `PrependableCollection` to use `append` internally * Improved error output for OneOfMany * Adds backtracking to `Optionally` * Added unit test to check backtracking * Updated the `testBacktracking` case Makes it clearer under what circumstances it will fail without backtracking. * Added backtracking to Optionally Also updated documentation about backtracking in general. * Removed incorrectly merged test case. * Added `Expect` Which can be both parsed and printed. * Made the unexpected `Peek` success a passing test Added notes about why it doesn't throw an error. * wip * wip * wip * wip * wip * Update README.md Co-authored-by: Brandon Williams <[email protected]> * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * fixes Co-authored-by: Stephen Celis <[email protected]> Co-authored-by: Stephen Celis <[email protected]> Co-authored-by: Brandon Williams <[email protected]>
1 parent 69d3472 commit fcb318f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+5390
-2808
lines changed

Package.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let package = Package(
1212
.library(
1313
name: "_URLRouting",
1414
targets: ["_URLRouting"]
15-
)
15+
),
1616
],
1717
dependencies: [
1818
.package(url: "https://github.com/apple/swift-argument-parser", from: "0.5.0"),
@@ -48,7 +48,8 @@ let package = Package(
4848
name: "_URLRouting", dependencies: ["Parsing"]
4949
),
5050
.testTarget(
51-
name: "_URLRoutingTests", dependencies: [
51+
name: "_URLRoutingTests",
52+
dependencies: [
5253
"_URLRouting",
5354
.product(name: "CustomDump", package: "swift-custom-dump"),
5455
]

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,6 @@ README Example.Scanner 19786.000 ns ± 35.26 % 62125
254254

255255
That's the basics of parsing a simple string format, but there's a lot more operators and tricks to learn in order to performantly parse larger inputs. Read the [documentation][swift-parsing-docs] to dive more deeply into the concepts of parsing, and view the [benchmarks](Sources/swift-parsing-benchmark) for more examples of real life parsing scenarios.
256256

257-
### Error messages
258-
259-
All parsers and operators that ship with this library provide
260-
261257
## Benchmarks
262258

263259
This library comes with a benchmark executable that not only demonstrates the performance of the library, but also provides a wide variety of parsing examples:

Sources/Parsing/AppendableCollection.swift

Lines changed: 0 additions & 117 deletions
This file was deleted.

0 commit comments

Comments
 (0)