Lionel Landwerlin | 865a47c | 2017-12-18 23:00:54 +0000 | [diff] [blame] | 1 | TracepointFmt = |
Lionel Landwerlin | a20a69e | 2018-02-01 17:28:33 +0000 | [diff] [blame] | 2 | 'name' ':' Space n:PropertyName EndLine { free(n.string); } |
Lionel Landwerlin | 812eeed | 2018-02-01 17:27:51 +0000 | [diff] [blame] | 3 | 'ID:' Space v:Number EndLine { yy->ctx.tp->event_id = v.integer; } |
Lionel Landwerlin | 865a47c | 2017-12-18 23:00:54 +0000 | [diff] [blame] | 4 | 'format:' EndLine |
| 5 | Field+ |
| 6 | 'print fmt:' [^.]* !. |
| 7 | |
Lionel Landwerlin | 812eeed | 2018-02-01 17:27:51 +0000 | [diff] [blame] | 8 | Field = Space (Property ';' Space)+ EndLine |
| 9 | { yy->ctx.tp->n_fields++; } |
| 10 | | EndLine |
Lionel Landwerlin | 865a47c | 2017-12-18 23:00:54 +0000 | [diff] [blame] | 11 | |
Lionel Landwerlin | 812eeed | 2018-02-01 17:27:51 +0000 | [diff] [blame] | 12 | Property = 'offset' ':' v:Number |
| 13 | { yy->ctx.tp->fields[yy->ctx.tp->n_fields].offset = v.integer; } |
| 14 | | 'size' ':' v:Number |
| 15 | { yy->ctx.tp->fields[yy->ctx.tp->n_fields].size = v.integer; } |
| 16 | | 'signed' ':' v:Number |
| 17 | { yy->ctx.tp->fields[yy->ctx.tp->n_fields].is_signed = v.integer != 0; } |
| 18 | | 'field' ':' v:PropertyValue |
| 19 | { snprintf(yy->ctx.tp->fields[yy->ctx.tp->n_fields].name, |
| 20 | sizeof(yy->ctx.tp->fields[yy->ctx.tp->n_fields].name), |
| 21 | "%s", strrchr(v.string, ' ') + 1); |
| 22 | free(v.string); } |
| 23 | | n:PropertyName ':' v:PropertyValue |
| 24 | { free(n.string); free(v.string); } |
Lionel Landwerlin | 865a47c | 2017-12-18 23:00:54 +0000 | [diff] [blame] | 25 | |
| 26 | PropertyName = < [A-Za-z0-9_]+ > |
| 27 | { $$.string = strdup(yytext); } |
| 28 | PropertyValue = < [^;]+ > |
| 29 | { $$.string = strdup(yytext); } |
| 30 | Number = < [0-9]+ > |
| 31 | { $$.integer = atoi(yytext); } |
| 32 | |
| 33 | EndLine = [\n] |
| 34 | Space = [ \t]* |