diff --git a/input.lisp b/input.lisp index 9dcdb64..1b85171 100644 --- a/input.lisp +++ b/input.lisp @@ -8,7 +8,9 @@ 4.0 (dave 1 + "here's an escaped quote: \" how neat!!!" 2 + "and here's an escaped \\, sweet!" albert-camus 3 (sam 3 2 2))) diff --git a/skeam.go b/skeam.go index c3de638..5b4dac2 100644 --- a/skeam.go +++ b/skeam.go @@ -150,11 +150,22 @@ func lexString(l *lexer) (stateFn, error) { case '"': l.emit(str1ng) return lexWhitespace, nil + case '\\': + return lexStringEsc, nil } l.append(r) 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 // whitespace, close paren, a period to indicate we want a float, or more // digits. Everything else is crap.