diff --git a/lex.go b/lex.go index 767010f..e96b9bb 100644 --- a/lex.go +++ b/lex.go @@ -358,7 +358,7 @@ func lexNameOrString(l *lexer) stateFn { case r == eof: l.emit(t_string) return nil - case unicode.IsGraphic(r): + case unicode.IsPrint(r): l.keep(r) return lexNameOrString default: @@ -386,7 +386,7 @@ func lexVariable(l *lexer) stateFn { case r == eof: l.emit(t_variable) return nil - case unicode.IsGraphic(r): + case unicode.IsPrint(r): l.keep(r) return lexVariable default: @@ -451,7 +451,7 @@ func lexDuration(l *lexer) stateFn { if err == nil { l.emit(t_duration) } else { - l.emit(t_string) + l.emit(t_name) } l.keep(r) l.emit(t_object_separator) @@ -476,7 +476,7 @@ func lexDuration(l *lexer) stateFn { l.emit(t_string) } return nil - case unicode.IsGraphic(r): + case unicode.IsPrint(r): l.keep(r) return lexDuration default: diff --git a/tests/lex/15.in b/tests/lex/15.in new file mode 100644 index 0000000..500f1e0 --- /dev/null +++ b/tests/lex/15.in @@ -0,0 +1 @@ +mix_string: this is "one" bare string that contains quotes diff --git a/tests/lex/15.out b/tests/lex/15.out new file mode 100644 index 0000000..b4fdbfa --- /dev/null +++ b/tests/lex/15.out @@ -0,0 +1,3 @@ +{t_name mix_string} +{t_object_separator :} +{t_string this is "one" bare string that contains quotes} diff --git a/tests/lex/16.in b/tests/lex/16.in new file mode 100644 index 0000000..d147fcf --- /dev/null +++ b/tests/lex/16.in @@ -0,0 +1 @@ +1nbz32k: doauhef diff --git a/tests/lex/16.out b/tests/lex/16.out new file mode 100644 index 0000000..a11b6e8 --- /dev/null +++ b/tests/lex/16.out @@ -0,0 +1,3 @@ +{t_name 1nbz32k} +{t_object_separator :} +{t_string doauhef}