//%debug
//%print-tokens
//%no-lines
%filenames parser
%default-actions off
%scanner ../scanner/scanner.h
%token-path tokens.h

%baseclass-preinclude preheaders.h


%token BASECLASS_HEADER BASECLASS_PREINCLUDE BLOCK CLASS_HEADER CLASS_NAME
        CONSTRUCTOR_CHECKS DEBUGFLAG DEFAULT_ACTIONS ERROR_VERBOSE EXPECT
        FILENAMES FLEX IDENTIFIER IMPLEMENTATION_HEADER LEFT LOCATIONSTRUCT
        LSP_NEEDED LTYPE NAMESPACE NEG_DOLLAR NOLINES NONASSOC NUMBER
        PARSEFUN_SOURCE POLYMORPHIC PREC PRINT_TOKENS QUOTE REQUIRED RIGHT
        SCANNER SCANNER_CLASS_NAME SCANNER_MATCHED_TEXT_FUNCTION
        SCANNER_TOKEN_FUNCTION STACK_EXPANSION START STRING STYPE
        TARGET_DIRECTORY TOKEN TWO_PERCENTS TYPE UNION WARN_TAGS WEAK_TAGS
        PROMPT THREAD_SAFE TOKEN_CLASS TOKEN_NAMESPACE TOKEN_PATH 
        
%polymorphic    BOOL:       bool;
                SIZE_T:     size_t;
                TEXT:       std::string;
                BLOCK:      Block;
                TERMINAL:   Terminal *;
                SYMBOL:     Symbol *;

%type <TEXT>    identifier
%type <BOOL>    optNumber
%type <SIZE_T>  _pushPrecedence _precSpec

   // NEW: USE THIS TO ASSIGN A GENERIC POLYMORPHIC VALUE TO (NON-)TERMINALS
    // these (non-)terminals MUST explicitly return an STYPE_
%type <STYPE_> _productionElements _productionElement

%%

input:
    directives
    _two_percents
    rules
    optTwo_percents
;

_two_percents:
    TWO_PERCENTS
    {
        expectRules();
    }
;

%include inc/identifier
%include inc/typename
%include inc/opt
%include inc/directives
%include inc/rules
