%token IF
%token NEWLINE
%token TAB
-%token WHITESPACE
%token <string> WORD
%type <string> define;
| empty
;
-empty : whitespace NEWLINE
+empty : NEWLINE
;
-// Optional whitespace
-whitespace : WHITESPACE %dprec 2
- | /* empty */ %dprec 1
- ;
-
-variable : WORD whitespace
- {
- $$ = $1;
- };
+variable : WORD;
-value : whitespace words whitespace
- {
- $$ = $2;
- }
- | whitespace
+value : words
+ | %empty
{
$$ = NULL;
};
words : WORD
+ | words WORD
{
- $$ = $1;
- }
- | words WHITESPACE WORD
- {
- int r = asprintf(&$$, "%s %s", $1, $3);
+ int r = asprintf(&$$, "%s %s", $1, $2);
if (r < 0) {
ERROR(pakfire, "Could not allocate memory");
ABORT;
}
};
-line : whitespace words NEWLINE
+line : words NEWLINE
{
// Only forward words
- $$ = $2;
+ $$ = $1;
}
- | whitespace NEWLINE {
+ | NEWLINE {
$$ = NULL;
};
| line
;
-if_stmt : IF WHITESPACE WORD whitespace EQUALS whitespace WORD NEWLINE block_assignments end
+if_stmt : IF WORD EQUALS WORD NEWLINE block_assignments end
{
- printf("IF STATEMENT NOT EVALUATED, YET: %s %s %s\n", $3, $5, $7);
+ printf("IF STATEMENT NOT EVALUATED, YET: %s %s\n", $2, $4);
};
block_opening : variable NEWLINE
block_assignments : block_assignments block_assignment
| block_assignment;
-block_assignment : WHITESPACE assignment
- | WHITESPACE if_stmt
+block_assignment : assignment
+ | if_stmt
| empty;
assignment : variable ASSIGN value NEWLINE
ABORT;
};
-define : DEFINE WHITESPACE variable NEWLINE
+define : DEFINE variable NEWLINE
{
- $$ = $3;
+ $$ = $2;
}
- | whitespace variable NEWLINE
+ | variable NEWLINE
{
- $$ = $2;
+ $$ = $1;
};
-end : whitespace END NEWLINE;
+end : END NEWLINE;
%%