diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-11-29 16:01:41 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2024-02-19 11:54:01 +0000 |
| commit | e59ec59b027f921a6bfbe5014b15c2a802445ada (patch) | |
| tree | 1c69d1db1b34e0b53d620f9fe272cf9f374b1400 /pkg/ast/testdata/errors.txt | |
| parent | 164800ebad7f26d05eefb0095d190462ed97bee0 (diff) | |
pkg/ast: support expressions with ast.Type
So far they have the following grammar:
OP = "==", "!=", "&"
value-expr = value-expr OP value-expr
| factor
factor = "(" and-expr ")"
| integer
| identifier
| string
Operators are left associative, e.g. A & B & C is the same as
(A & B) & C.
Further restrictions will be imposed in pkg/compiler.
This will help implement conditionally included fields.
Diffstat (limited to 'pkg/ast/testdata/errors.txt')
| -rw-r--r-- | pkg/ast/testdata/errors.txt | 10 |
1 files changed, 9 insertions, 1 deletions
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 |
