diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-02-10 14:45:20 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-02-10 14:45:20 +0100 |
| commit | 18847f55bb3fe9db41e46a2e9e49a9f7c28143af (patch) | |
| tree | e181c33c75f5851a5042290ff59dd44cce353c66 /pkg/ast/testdata | |
| parent | d0da558cb16f3fb7cf26f20d24ee89eeb49a6f30 (diff) | |
pkg/ast: introduce hex-encoded string literals
The stringnozescapes does not make sense with filename,
also we may need similar escaping for string flags.
Handle escaped strings on ast level instead.
This avoids introducing new type and works seamleassly with flags.
As alternative I've also tried using strconv.Quote/Unquote
but it leads to ugly half-escaped strings:
"\xb0\x80s\xe8\xd4N\x91\xe3ڒ,\"C\x82D\xbb\x88\\i\xe2i\xc8\xe9\xd85\xb1\x14):M\xdcn"
Make hex-encoded strings a separate string format instead.
Diffstat (limited to 'pkg/ast/testdata')
| -rw-r--r-- | pkg/ast/testdata/all.txt | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/pkg/ast/testdata/all.txt b/pkg/ast/testdata/all.txt index 392796254..122fa514b 100644 --- a/pkg/ast/testdata/all.txt +++ b/pkg/ast/testdata/all.txt @@ -17,15 +17,14 @@ int_flags4 = 1, -2- ### bad integer "-2-" str_flags0 = "foo", "bar" str_flags1 = "non terminated ### string literal is not terminated str_flags2 = "bad chars здесь" ### illegal character U+00D0 'Ð' in string literal -str_flags3 = "string", not a string ### unexpected identifier, expecting string -str_flags4 = "string", 42 ### unexpected int, expecting string +str_flags3 = "string", not a string ### unexpected identifier, expecting string, hex string +str_flags4 = "string", 42 ### unexpected int, expecting string, hex string call(foo ,int32 , bar int32) ### unexpected ',', expecting int, identifier, string call(foo int32:"bar") ### unexpected string, expecting int, identifier call(a int32, b len[a:"bar"]) ### unexpected string, expecting int, identifier -define FOO `bar` -define FOO `bar ### C expression is not terminated +define FOO bar foo(x int32[1:2:3, opt]) foo2(x int32[1[2]:2]) ### unexpected ':', expecting ']' |
