aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ast/testdata
Commit message (Collapse)AuthorAgeFilesLines
* pkg/compiler: support negative integersDmitry Vyukov2018-07-091-0/+1
| | | | | | Currently we have to use 0xffffffffffffffff to represent -1, and we can't express e.g. -20:20 int range. Support negative consts to fix both problems.
* pkg/ast: support char constantsDmitry Vyukov2018-04-291-0/+3
| | | | | | | Frequently it's useful to do something like: int8['a':'z'] punctuation = ',', '-', ':'
* pkg/compiler: switch attributes from Ident to TypeDmitry Vyukov2018-03-051-0/+4
| | | | | This allows parametrized attributes like size[10]. But this is not used for now.
* pkg/compiler: allow use of empty stringsDmitry Vyukov2018-01-231-2/+2
| | | | This comes up in several contexts in netfilter.
* pkg/compiler: support type templatesDmitry Vyukov2018-01-131-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Netlink descriptions contain tons of code duplication, and need much more for proper descriptions. Introduce type templates to simplify writing such descriptions and remove code duplication. Note: type templates are experimental, have poor error handling and are subject to change. Type templates can be declared as follows: ``` type buffer[DIR] ptr[DIR, array[int8]] type fileoff[BASE] BASE type nlattr[TYPE, PAYLOAD] { nla_len len[parent, int16] nla_type const[TYPE, int16] payload PAYLOAD } [align_4] ``` and later used as follows: ``` syscall(a buffer[in], b fileoff[int64], c ptr[in, nlattr[FOO, int32]]) ```
* pkg/compiler: add builtin bool type aliasesDmitry Vyukov2018-01-081-2/+2
| | | | | | | | | | | | | | | | This adds builtin: type bool8 int8[0:1] type bool16 int16[0:1] type bool32 int32[0:1] type bool64 int64[0:1] type boolptr intptr[0:1] We used to use just int's for bools. But bool types provide several advantages: - make true/false probability equal - improve description expressiveness - reduce search space (we will take advantage of this later)
* sys: support type aliases (aka typedefs)Dmitry Vyukov2018-01-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | Complex types that are often repeated can be given short type aliases using the following syntax: ``` type identifier underlying_type ``` For example: ``` type signalno int32[0:65] type net_port proc[20000, 4, int16be] ``` Then, type alias can be used instead of the underlying type in any contexts. Underlying type needs to be described as if it's a struct field, that is, with the base type if it's required. However, type alias can be used as syscall arguments as well. Underlying types are currently restricted to integer types, `ptr`, `ptr64`, `const`, `flags` and `proc` types.
* pkg/ast: prohibit empty stringsDmitry Vyukov2017-09-041-0/+6
| | | | This is currently unsupported and unused.
* pkg/ast: fix struct comment parsingDmitry Vyukov2017-09-041-0/+11
|
* pkg/compiler: move more const-processing code to compilerDmitry Vyukov2017-08-271-0/+2
|
* pkg/ast: new parser for sys descriptionsDmitry Vyukov2017-08-181-0/+28
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.