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