diff options
Diffstat (limited to 'pkg/ast/testdata')
| -rw-r--r-- | pkg/ast/testdata/all.txt | 19 | ||||
| -rw-r--r-- | pkg/ast/testdata/errors.txt | 10 |
2 files changed, 28 insertions, 1 deletions
diff --git a/pkg/ast/testdata/all.txt b/pkg/ast/testdata/all.txt index c9569840c..d04fd4992 100644 --- a/pkg/ast/testdata/all.txt +++ b/pkg/ast/testdata/all.txt @@ -8,3 +8,22 @@ incdir <some/path> strflags0 = "foo", strflags1 strflags1 = "bar" + +expressions { + f0 int8 (if[value[X] & Y]) + f1 int8 (if[X & Y == Z]) + f2 int8 (if[X & Y & Z == value[X] & A]) + f3 int8 (if[X & (A == B) & Z != C]) +} + +condFields { + mask int8 +# Simple expressions work. + f0 int16 (if[val[mask] == SOME_CONST]) +# Conditions and other attributes work together. + f1 int16 (out, if[val[mask] == SOME_CONST]) +# Test some more complex expressions. + f2 int16 (out, if[val[mask] & SOME_CONST == OTHER_CONST]) + f3 int16 (out, if[val[mask] & SOME_CONST & OTHER_CONST == val[mask] & CONST_X]) + f4 int16 (out, if[val[mask] & SOME_CONST]) +} diff --git a/pkg/ast/testdata/errors.txt b/pkg/ast/testdata/errors.txt index 266babf8f..b3d9e7f52 100644 --- a/pkg/ast/testdata/errors.txt +++ b/pkg/ast/testdata/errors.txt @@ -11,7 +11,7 @@ meta foo, bar ### unexpected ',', expecting '\n' int_flags0 = 0, 0x1, 0xab int_flags1 = 123ab0x ### bad integer "123ab0x" -int_flags1 == 0, 1 ### unexpected '=', expecting int, identifier, string +int_flags1 == 0, 1 ### unexpected ==, expecting '(', '{', '[', '=' int_flags = 0, "foo" ### unexpected string, expecting int, identifier int_flags2 = ' ### char literal is not terminated int_flags3 = 'a ### char literal is not terminated @@ -67,6 +67,14 @@ s3 { f1 int8 } [attribute[1, "foo"], another[and[another]]] +sCondFieldsError1 { + f0 int16 (out, if[val[mask] SOME_CONST == val[mask]]) ### unexpected identifier, expecting ']' +} ### unexpected '}', expecting comment, define, include, resource, identifier + +sCondFieldsError2 { + f5 int16 (out, if[val[mask] & == val[mask]]) ### unexpected ==, expecting int, identifier, string +} ### unexpected '}', expecting comment, define, include, resource, identifier + type mybool8 int8 type net_port proc[1, 2, int16be] type mybool16 ### unexpected '\n', expecting '[', identifier |
