|
|
@ -150,11 +150,22 @@ func lexString(l *lexer) (stateFn, error) {
|
|
|
|
case '"':
|
|
|
|
case '"':
|
|
|
|
l.emit(str1ng)
|
|
|
|
l.emit(str1ng)
|
|
|
|
return lexWhitespace, nil
|
|
|
|
return lexWhitespace, nil
|
|
|
|
|
|
|
|
case '\\':
|
|
|
|
|
|
|
|
return lexStringEsc, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
l.append(r)
|
|
|
|
l.append(r)
|
|
|
|
return lexString, nil
|
|
|
|
return lexString, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func lexStringEsc(l *lexer) (stateFn, error) {
|
|
|
|
|
|
|
|
r, err := l.next()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
l.append(r)
|
|
|
|
|
|
|
|
return lexString, nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// lex an integer. Once we're on an integer, the only valid characters are
|
|
|
|
// lex an integer. Once we're on an integer, the only valid characters are
|
|
|
|
// whitespace, close paren, a period to indicate we want a float, or more
|
|
|
|
// whitespace, close paren, a period to indicate we want a float, or more
|
|
|
|
// digits. Everything else is crap.
|
|
|
|
// digits. Everything else is crap.
|
|
|
|