Example extended.
This commit is contained in:
parent
e9c618580d
commit
8a6815332e
|
@ -119,6 +119,14 @@ func Example_minimalAnnotated() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Example_minimal() {
|
func Example_minimal() {
|
||||||
|
// Let's write a small example for parsing a really basic calculator.
|
||||||
|
// The calculator understands input that looks like:
|
||||||
|
//
|
||||||
|
// 10 + 20 - 8+4
|
||||||
|
//
|
||||||
|
// So positive numbers that can be either added or substracted, with
|
||||||
|
// optional whitespace around the operators.
|
||||||
|
|
||||||
var c, a, m = parsekit.C, parsekit.A, parsekit.M
|
var c, a, m = parsekit.C, parsekit.A, parsekit.M
|
||||||
|
|
||||||
var number = c.OneOrMore(a.Digit)
|
var number = c.OneOrMore(a.Digit)
|
||||||
|
|
Loading…
Reference in New Issue