From a0e66b1c46ec57218f8a95a21ace7cbbceb29ec2 Mon Sep 17 00:00:00 2001 From: Adam Scarr Date: Thu, 10 Aug 2017 21:58:14 +1000 Subject: Document cuts --- examples_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 examples_test.go (limited to 'examples_test.go') diff --git a/examples_test.go b/examples_test.go new file mode 100644 index 0000000..a1de129 --- /dev/null +++ b/examples_test.go @@ -0,0 +1,24 @@ +package goparsify_test + +import ( + "fmt" + + . "github.com/vektah/goparsify" +) + +func ExampleCuts() { + // without a cut if the close tag is left out the parser will backtrack and ignore the rest of the string + alpha := Chars("a-z") + nocut := Many(Any(Seq("<", alpha, ">"), alpha)) + _, err := Run(nocut, "asdf "), alpha)) + _, err = Run(cut, "asdf +} -- cgit v1.2.3