Single-character tokens printing fix
This commit is contained in:
parent
6bcd7fd2e7
commit
3d17f23e65
|
@ -278,24 +278,12 @@ func lexString(l *Lexer) stateFn {
|
||||||
func (i Item) String() string {
|
func (i Item) String() string {
|
||||||
var label string
|
var label string
|
||||||
switch i.Token {
|
switch i.Token {
|
||||||
|
case BraceOpen, BraceClose, BracketOpen, BracketClose, Quote, Colon, Comma:
|
||||||
|
label = i.Val
|
||||||
case EOF:
|
case EOF:
|
||||||
label = "EOF"
|
label = "EOF"
|
||||||
case Error:
|
case Error:
|
||||||
label = fmt.Sprintf("(Error: %q)", i.Val)
|
label = fmt.Sprintf("(Error: %q)", i.Val)
|
||||||
case BraceOpen:
|
|
||||||
label = "{"
|
|
||||||
case BraceClose:
|
|
||||||
label = "}"
|
|
||||||
case BracketOpen:
|
|
||||||
label = "["
|
|
||||||
case BracketClose:
|
|
||||||
label = "]"
|
|
||||||
case Quote:
|
|
||||||
label = "\""
|
|
||||||
case Colon:
|
|
||||||
label = ":"
|
|
||||||
case Comma:
|
|
||||||
label = ","
|
|
||||||
case Null:
|
case Null:
|
||||||
label = fmt.Sprintf("(NULL: %q)", i.Val)
|
label = fmt.Sprintf("(NULL: %q)", i.Val)
|
||||||
case Bool:
|
case Bool:
|
||||||
|
|
Loading…
Reference in New Issue