File: grammar

package info (click to toggle)
flexc%2B%2B 2.17.01-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,180 kB
  • sloc: cpp: 6,467; makefile: 148; sh: 130; ansic: 18
file content (117 lines) | stat: -rw-r--r-- 2,410 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
%class-name Parser
%default-actions off
%filenames parser
%parsefun-source parse.cc
%scanner ../scanner/scanner.h
%debug
%token-path ../scanner/tokens.h

%baseclass-preinclude preinclude.h

// definition section
%token  EXCL_START_CONDITION
        INCL_START_CONDITION
        SECTION_DELIMITER

// directives
%token  BASECLASSHEADER
        BASECLASSPREINCLUDE
        CASEINSENSITIVE
        CLASSHEADER
        CLASSNAME
        DEBUG
        FILENAMES
        IMPLEMENTATIONHEADER
        INPUTIMPLEMENTATION
        INPUTINLINE
        INPUTINTERFACE
        INTERACTIVE
        LEXFUNCTIONNAME
        LEXSOURCE
        NAMESPACE
        NOLINES
        PRINT
        SKELETON_DIRECTORY
        STARTCONDITION
        TARGET_DIRECTORY
 
// rules
%token  BLOCK
        IDENTIFIER
        EOF_PATTERN
        RAWSTRING
        STRING
        QUOTES
        DECIMAL
        DOLLAR
        ESCAPE_SEQUENCE
        CC_START
        CC_NEGATED
 
// character classes
%token  PREDEFINED_CLASS
 
// rule operators:

//  lowest precedence

%left       ORNL
%left       '/'
%left       '|'
%left       CHAR 
%left       '*' '?' '+' '{' 
%left       CC_PLUS CC_MINUS

//  highest precedence

%polymorphic    TEXTTYPE:       FlexTypes::TextType;
                STRING:         std::string;
                PATTERN:        FPattern;
                CHARCLASS:      CharClass;
                INTERVAL:       Interval;
                VECTOR:         std::vector<std::string>;

%type <TEXTTYPE>    _stringOrIdent _stringType
%type <STRING>      identifier _name_def _decimal _cc_element
%type <CHARCLASS>   characterclass 
                    _cc_set _cc_start _cc_negated
%type <INTERVAL>    _interval
%type <PATTERN>     _unit _regex _optMs_regex _regex_unit regexOrEOF
%type <VECTOR>      _cc_content 

%%

input:
    opt_directives          // in inc/directives; options in inc/options
    section_delimiter
    rules
;

section_delimiter:
    SECTION_DELIMITER   '\n'
    {
        d_nLOPstartConditions = d_rules.startConditions().size();
        d_rules.setEndUserSC();
        reset();
    }
;

identifier:
    IDENTIFIER
    {
        $$ = d_matched;
    }
;

%include inc/directives
%include inc/options

%include inc/combichars
%include inc/msspec
%include inc/characterclass
%include inc/regexoreof
%include inc/action
%include inc/reset
%include inc/mscompound
%include inc/optmsrule
%include inc/rules