| 1 |
%class-name Parser |
| 2 |
%default-actions off |
| 3 |
%filenames parser |
| 4 |
%parsefun-source parse.cc |
| 5 |
%scanner ../scanner/scanner.h |
| 6 |
%debug |
| 7 |
%token-path ../scanner/tokens.h |
| 8 |
|
| 9 |
%baseclass-preinclude preinclude.h |
| 10 |
|
| 11 |
// definition section |
| 12 |
%token EXCL_START_CONDITION |
| 13 |
INCL_START_CONDITION |
| 14 |
SECTION_DELIMITER |
| 15 |
|
| 16 |
// directives |
| 17 |
%token BASECLASSHEADER |
| 18 |
BASECLASSPREINCLUDE |
| 19 |
CASEINSENSITIVE |
| 20 |
CLASSHEADER |
| 21 |
CLASSNAME |
| 22 |
DEBUG |
| 23 |
FILENAMES |
| 24 |
IMPLEMENTATIONHEADER |
| 25 |
INPUTIMPLEMENTATION |
| 26 |
INPUTINLINE |
| 27 |
INPUTINTERFACE |
| 28 |
INTERACTIVE |
| 29 |
LEXFUNCTIONNAME |
| 30 |
LEXSOURCE |
| 31 |
NAMESPACE |
| 32 |
NOLINES |
| 33 |
PRINT |
| 34 |
SKELETON_DIRECTORY |
| 35 |
STARTCONDITION |
| 36 |
TARGET_DIRECTORY |
| 37 |
TOKEN_PATH |
| 38 |
|
| 39 |
// rules |
| 40 |
%token BLOCK |
| 41 |
IDENTIFIER |
| 42 |
EOF_PATTERN |
| 43 |
RAWSTRING |
| 44 |
STRING |
| 45 |
QUOTES |
| 46 |
DECIMAL |
| 47 |
DOLLAR |
| 48 |
ESCAPE_SEQUENCE |
| 49 |
CC_START |
| 50 |
CC_NEGATED |
| 51 |
|
| 52 |
// character classes |
| 53 |
%token PREDEFINED_CLASS |
| 54 |
|
| 55 |
// rule operators: |
| 56 |
|
| 57 |
// lowest precedence |
| 58 |
|
| 59 |
%left ORNL |
| 60 |
%left '/' |
| 61 |
%left '|' |
| 62 |
%left CHAR |
| 63 |
%left '*' '?' '+' '{' |
| 64 |
%left CC_PLUS CC_MINUS |
| 65 |
|
| 66 |
// highest precedence |
| 67 |
|
| 68 |
%polymorphic TEXTTYPE: FlexTypes::TextType; |
| 69 |
STRING: std::string; |
| 70 |
PATTERN: FPattern; |
| 71 |
CHARCLASS: CharClass; |
| 72 |
INTERVAL: Interval; |
| 73 |
VECTOR: std::vector<std::string>; |
| 74 |
|
| 75 |
%type <TEXTTYPE> _stringOrIdent _stringType |
| 76 |
%type <STRING> identifier _name_def _decimal _cc_element |
| 77 |
%type <CHARCLASS> characterclass |
| 78 |
_cc_set _cc_start _cc_negated |
| 79 |
%type <INTERVAL> _interval |
| 80 |
%type <PATTERN> _unit _regex _optMs_regex _regex_unit regexOrEOF |
| 81 |
%type <VECTOR> _cc_content |
| 82 |
|
| 83 |
%% |
| 84 |
|
| 85 |
input: |
| 86 |
opt_directives // in inc/directives; options in inc/options |
| 87 |
section_delimiter |
| 88 |
rules |
| 89 |
; |
| 90 |
|
| 91 |
section_delimiter: |
| 92 |
SECTION_DELIMITER '\n' |
| 93 |
{ |
| 94 |
d_nLOPstartConditions = d_rules.startConditions().size(); |
| 95 |
d_rules.setEndUserSC(); |
| 96 |
reset(); |
| 97 |
} |
| 98 |
; |
| 99 |
|
| 100 |
identifier: |
| 101 |
IDENTIFIER |
| 102 |
{ |
| 103 |
$$ = d_matched; |
| 104 |
} |
| 105 |
; |
| 106 |
|
| 107 |
%include inc/directives |
| 108 |
%include inc/options |
| 109 |
|
| 110 |
%include inc/combichars |
| 111 |
%include inc/msspec |
| 112 |
%include inc/characterclass |
| 113 |
%include inc/regexoreof |
| 114 |
%include inc/action |
| 115 |
%include inc/reset |
| 116 |
%include inc/mscompound |
| 117 |
%include inc/optmsrule |
| 118 |
%include inc/rules |