1 %{ 2 extern int yylex(); 3 #include <stdio.h> 4 #include <stdbool.h> 5 #include <stdint.h> 6 #include "nbdclt.h" 7 typedef char * YYSTYPE; 8 %} 9 10 %define parse.trace 11 %define api.value.type {char *} 12 13 %token SPACE 14 %token STRING 15 16 %% 17 18 nbdtab: 19 %empty 20 | '\n' nbdtab 21 | mountdef nbdtab 22 ; 23 24 mountdef: 25 STRING SPACE STRING SPACE STRING optlist { nbdtab_commit_line($1, $3, $5); } 26 ; 27 28 optlist: 29 %empty 30 | SPACE options 31 ; 32 33 options: 34 options ',' option 35 | option 36 ; 37 38 option: 39 STRING { nbdtab_set_flag($1); } 40 | STRING '=' STRING { nbdtab_set_property($1, $3); } 41 ; 42