aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ast/testdata
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-05-22 05:28:31 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-08-18 11:26:50 +0200
commit127a9c2b65ae07f309e839c3b8e5ab2ee7983e56 (patch)
tree3a4dd2af0a2fc09b2bba1dad738c7657d1b0de1d /pkg/ast/testdata
parent5809a8e05714bda367f3fd57f9b983a3403f04b0 (diff)
pkg/ast: new parser for sys descriptions
The old parser in sys/sysparser is too hacky, difficult to extend and drops debug info too early, so that we can't produce proper error messages. Add a new parser that is build like a proper language parser and preserves full debug info for every token.
Diffstat (limited to 'pkg/ast/testdata')
-rw-r--r--pkg/ast/testdata/all.txt28
1 files changed, 28 insertions, 0 deletions
diff --git a/pkg/ast/testdata/all.txt b/pkg/ast/testdata/all.txt
new file mode 100644
index 000000000..443f26368
--- /dev/null
+++ b/pkg/ast/testdata/all.txt
@@ -0,0 +1,28 @@
+# Copyright 2017 syzkaller project authors. All rights reserved.
+# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
+
+0x42 ### unexpected int, expecting comment, define, include, resource, identifier
+foo ### unexpected '\n', expecting '(', '{', '[', '='
+% ### illegal character U+0025 '%'
+
+int_flags0 = 0, 0x1, 0xab
+int_flags1 = 123ab0x ### bad integer "123ab0x"
+int_flags1 == 0, 1 ### unexpected '=', expecting int, identifier, string
+int_flags = 0, "foo" ### unexpected string, expecting int, identifier
+
+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
+
+call(foo ,int32 , bar int32) ### unexpected ',', expecting int, identifier, string
+call(foo int32:"bar") ### unexpected string, expecting int, identifier
+
+define FOO `bar`
+define FOO `bar ### C expression is not terminated
+
+include <linux/foo.h>
+include "linux/foo.h"
+incdir </foo/bar>
+incdir "/foo/bar"