_sc_name:
    {
        d_expect = "list of start condition names";
    }
;

_start_condition_type:
    INCL_START_CONDITION 
    _sc_name
    {
        d_rules.setType(StartConditions::INCLUSIVE);
    }
|
    EXCL_START_CONDITION 
    _sc_name
    {
        d_rules.setType(StartConditions::EXCLUSIVE);
    }
;

_start_condition_names:
    _start_condition_names identifier
    {
        d_rules.addStartCondition($2);
    }
|
    identifier
    {
        d_rules.addStartCondition($1);
    }
;

_start_condition_directive:
    _start_condition_type
    _start_condition_names
;

_name_def:
    identifier
    {
        d_scanner.newDefinition();  // briefly switches to 'line'
    }
;

_name_definition:
    _name_def STRING
    {
        d_scanner.addDefinition($1, d_scanner.matched());
    }
;

_directive:
    option
|
    _start_condition_directive
|
    _name_definition
|
    error
|
    // empty
;

_directive_line:
    _directive '\n'
;

opt_directives:
    opt_directives _directive_line
|
    // empty
;





