%token WHITESPACE
%token <string> WORD
+%type <string> line;
+%type <string> text;
%type <string> variable;
%type <string> value;
%type <string> words;
{
$$ = $1;
}
- | words WHITESPACE WORD;
+ | words WHITESPACE WORD
+ | /* empty */;
+
+line : whitespace words NEWLINE
+ {
+ printf("line = %s\n", $2);
+ };
+
+text : text line
+ | line
+ | /* empty */;
block_opening : variable NEWLINE
{
assignments : assignments assignment
| assignments empty
+ | assignments block_assignment
| /* empty */
;
printf("ASSIGNMENT FOUND: %s = %s\n", $2, $6);
};
+block_assignment : whitespace DEFINE WHITESPACE variable NEWLINE text whitespace END NEWLINE
+ {
+ printf("BLOCK ASSIGNMENT: %s: %s\n", $4, $6);
+ }
+
%%
int pakfire_parser_parse_metadata(Pakfire _pakfire, const char* data, size_t len) {
digit [0-9]
letter [A-Za-z]
underscore _
-special [/!@$%&*()+=:<>,;?_\.\[\]\-\\]+
+special [/'!@$%&*()+=:<>,;?_\.\[\]\-\\]+
whitespace ([ \t])+
word ({digit}|{letter}|{special})+