diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-10-03 00:02:21 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-10-03 00:02:21 +0900 |
commit | 60a508960e71c73c5a8b72eb60ab0ac39d4f347d (patch) | |
tree | 58ed842cff7ac38db43444dbba0a41bff7a8b0ee /README.md | |
parent | Format the source code of a lexer maleeni-go generates (diff) | |
download | tre-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.md | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -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 |