aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2021-10-03 00:02:21 +0900
committerRyo Nihei <nihei.dev@gmail.com>2021-10-03 00:02:21 +0900
commit60a508960e71c73c5a8b72eb60ab0ac39d4f347d (patch)
tree58ed842cff7ac38db43444dbba0a41bff7a8b0ee /README.md
parentFormat the source code of a lexer maleeni-go generates (diff)
downloadtre-60a508960e71c73c5a8b72eb60ab0ac39d4f347d.tar.gz
tre-60a508960e71c73c5a8b72eb60ab0ac39d4f347d.tar.xz
Remove the ModeName and KindName fields from the driver.Token struct
Diffstat (limited to 'README.md')
-rw-r--r--README.md20
1 files changed, 10 insertions, 10 deletions
diff --git a/README.md b/README.md
index 0a05876..a6899db 100644
--- a/README.md
+++ b/README.md
@@ -125,9 +125,9 @@ func main() {
break
}
if tok.Invalid {
- fmt.Printf("invalid: '%v'\n", string(tok.Lexeme))
+ fmt.Printf("invalid: %#v\n", string(tok.Lexeme))
} else {
- fmt.Printf("valid: %v: '%v'\n", tok.KindName, string(tok.Lexeme))
+ fmt.Printf("valid: %v: %#v\n", KindIDToName(tok.KindID), string(tok.Lexeme))
}
}
}
@@ -145,14 +145,14 @@ Now, you can perform the lexical analysis.
```sh
$ echo -n 'I want to believe.' | go run main.go statement_lexer.go
-valid: word: 'I'
-valid: whitespace: ' '
-valid: word: 'want'
-valid: whitespace: ' '
-valid: word: 'to'
-valid: whitespace: ' '
-valid: word: 'believe'
-valid: punctuation: '.'
+valid: word: "I"
+valid: whitespace: " "
+valid: word: "want"
+valid: whitespace: " "
+valid: word: "to"
+valid: whitespace: " "
+valid: word: "believe"
+valid: punctuation: "."
```
## More Practical Usage