//%default-actions quiet

%filenames parser
%scanner ../scanner/scanner.h
%token-path ../tokens/tokens.h

//%print-tokens

%baseclass-preinclude  ../enums/enums.h

//    lowest precedence on top
%token
    IF
    ACTION
    DATE
    FILE
    HDR
    LETTER
    NOT
    NR
    REGEX
%left
    AND

%stype eTruth
    
%%

grammar:
    grammar ifStmnt
|
    // no rules ok: by default accept all input
;

%include "inc/opt"
%include "inc/expression"
%include "inc/rules"
%include "inc/condition"

if:
    IF
    {
                                // members set d_expect and call the
        startIf();              // equally named Filter member
    }
;

ifStmnt:
    if condition ACTION
    {
        action();               // uses d_scanner.matched()
    }
|
    error ACTION
|
    '\n'
;
