Tune up bytes example
This commit is contained in:
+4
-2
@@ -10,7 +10,7 @@ import (
|
||||
"git.codemonkeysoftware.net/b/gigaparsec/bytes"
|
||||
)
|
||||
|
||||
func ExampleToken() {
|
||||
func Example() {
|
||||
ptokens := gigaparsec.Choose(
|
||||
bytes.MatchString("("),
|
||||
bytes.MatchString(")"),
|
||||
@@ -21,7 +21,9 @@ func ExampleToken() {
|
||||
)
|
||||
|
||||
tokenize := gigaparsec.Repeat(0, bytes.Token[string](bytes.WhitespaceASCII())(ptokens))
|
||||
tokens, _ := tokenize.Run(strings.NewReader("(alpha + 42) -5 "))
|
||||
const src = `(alpha
|
||||
+ 42 ) -5 `
|
||||
tokens, _ := tokenize.Run(strings.NewReader(src))
|
||||
for _, token := range tokens {
|
||||
fmt.Println(token)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user