From 60a508960e71c73c5a8b72eb60ab0ac39d4f347d Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Sun, 3 Oct 2021 00:02:21 +0900 Subject: Remove the ModeName and KindName fields from the driver.Token struct --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'README.md') 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 -- cgit v1.2.3