diff options
Diffstat (limited to 'src/build.y')
-rw-r--r-- | src/build.y | 77 |
1 files changed, 56 insertions, 21 deletions
diff --git a/src/build.y b/src/build.y index bf565fb..d8cba53 100644 --- a/src/build.y +++ b/src/build.y | |||
@@ -15,10 +15,6 @@ void yyerror( YYLTYPE *locp, Builder &bld, char const *msg ); | |||
15 | %pure-parser | 15 | %pure-parser |
16 | 16 | ||
17 | %locations | 17 | %locations |
18 | %initial-action | ||
19 | { | ||
20 | //@$.begin.filename = @$.end.filename = &bld.file; | ||
21 | } | ||
22 | 18 | ||
23 | %debug | 19 | %debug |
24 | %error-verbose | 20 | %error-verbose |
@@ -43,6 +39,7 @@ void yyerror( YYLTYPE *locp, Builder &bld, char const *msg ); | |||
43 | %token TOK_FOR "for" | 39 | %token TOK_FOR "for" |
44 | %token TOK_SET "set" | 40 | %token TOK_SET "set" |
45 | %token TOK_MATCHES "matches" | 41 | %token TOK_MATCHES "matches" |
42 | %token TOK_MATCHING "matching" | ||
46 | %token TOK_ALL "all" | 43 | %token TOK_ALL "all" |
47 | %token TOK_ONE "one" | 44 | %token TOK_ONE "one" |
48 | %token TOK_PERFORM "perform" | 45 | %token TOK_PERFORM "perform" |
@@ -50,6 +47,8 @@ void yyerror( YYLTYPE *locp, Builder &bld, char const *msg ); | |||
50 | %token TOK_COMMAND "command" | 47 | %token TOK_COMMAND "command" |
51 | %token TOK_CHECK "check" | 48 | %token TOK_CHECK "check" |
52 | %token TOK_CLEAN "clean" | 49 | %token TOK_CLEAN "clean" |
50 | %token TOK_DIRECTORIES "directories" | ||
51 | %token TOK_TARGETS "targets" | ||
53 | %token TOK_EOL "end of line" | 52 | %token TOK_EOL "end of line" |
54 | %token ',' ':' '=' | 53 | %token ',' ':' '=' |
55 | 54 | ||
@@ -75,7 +74,15 @@ line: TOK_DEFAULT TOK_ACTION ':' | |||
75 | bld.add( new Action( $1 ) ); | 74 | bld.add( new Action( $1 ) ); |
76 | } | 75 | } |
77 | actionlst | 76 | actionlst |
78 | | TOK_CREATE createwhat TOK_FROM createfrom TOK_USING createusing | 77 | | TOK_FOR fortypes TOK_MATCHING REGEXP |
78 | { | ||
79 | bld.setFilter( $4 ); | ||
80 | } | ||
81 | augments | ||
82 | { | ||
83 | bld.endList(); | ||
84 | } | ||
85 | listcmds | ||
79 | | STRING TOK_REQUIRES | 86 | | STRING TOK_REQUIRES |
80 | { | 87 | { |
81 | bld.setTmp( $1 ); | 88 | bld.setTmp( $1 ); |
@@ -91,15 +98,37 @@ line: TOK_DEFAULT TOK_ACTION ':' | |||
91 | | listcmds | 98 | | listcmds |
92 | | TOK_FOR STRING | 99 | | TOK_FOR STRING |
93 | { | 100 | { |
94 | bld.setContext( $2 ); | 101 | bld.startList( STRING ); |
102 | bld.addListItem( $2 ); | ||
95 | } | 103 | } |
96 | listcmds | 104 | listcmds |
97 | { | 105 | { |
98 | bld.setContext(); | 106 | |
99 | } | 107 | } |
100 | | rule | 108 | | rule |
101 | ; | 109 | ; |
102 | 110 | ||
111 | fortypes: TOK_DIRECTORIES | ||
112 | { | ||
113 | bld.startList( TOK_DIRECTORIES ); | ||
114 | } | ||
115 | | TOK_TARGETS | ||
116 | { | ||
117 | bld.startList( TOK_TARGETS ); | ||
118 | } | ||
119 | | TOK_FILES | ||
120 | { | ||
121 | bld.startList( TOK_FILES ); | ||
122 | } | ||
123 | ; | ||
124 | |||
125 | augments: | ||
126 | | TOK_IN STRING | ||
127 | { | ||
128 | bld.augmentList( $2 ); | ||
129 | } | ||
130 | ; | ||
131 | |||
103 | reqcompletion: reqlst | 132 | reqcompletion: reqlst |
104 | | TOK_FROM TOK_COMMAND STRING | 133 | | TOK_FROM TOK_COMMAND STRING |
105 | { | 134 | { |
@@ -118,15 +147,23 @@ reqlst: STRING | |||
118 | ; | 147 | ; |
119 | 148 | ||
120 | listcmds: TOK_SET setexpr | 149 | listcmds: TOK_SET setexpr |
150 | | TOK_CREATE createwhat TOK_FROM createfrom TOK_USING createusing | ||
151 | { | ||
152 | bld.endTarget(); | ||
153 | } | ||
121 | ; | 154 | ; |
122 | 155 | ||
123 | createwhat: TOK_FILE STRING | 156 | createwhat: TOK_FILE STRING |
124 | { | 157 | { |
125 | bld.add( new FileTarget( $2 ) ); | 158 | bld.addTarget( TOK_FILE, $2 ); |
126 | } | 159 | } |
127 | ; | 160 | ; |
128 | 161 | ||
129 | createfrom: TOK_FILES TOK_IN createfromdirlst | 162 | createfrom: TOK_FILES TOK_IN |
163 | { | ||
164 | bld.setTargetInputType( TOK_FILES ); | ||
165 | } | ||
166 | createfromdirlst | ||
130 | ; | 167 | ; |
131 | 168 | ||
132 | createfromdirlst: createfromdir | 169 | createfromdirlst: createfromdir |
@@ -135,23 +172,13 @@ createfromdirlst: createfromdir | |||
135 | 172 | ||
136 | createfromdir: STRING | 173 | createfromdir: STRING |
137 | { | 174 | { |
138 | try | 175 | bld.addTargetInput( $1 ); |
139 | { | ||
140 | ((FileTarget *)bld.lastTarget())->addInputDir( $1 ); | ||
141 | } | ||
142 | catch( BuildException &e ) | ||
143 | { | ||
144 | std::string s( $1 ); | ||
145 | s +=": "; | ||
146 | s += e.what(); | ||
147 | yyerror( &yyloc, bld, s.c_str() ); | ||
148 | } | ||
149 | } | 176 | } |
150 | ; | 177 | ; |
151 | 178 | ||
152 | createusing: TOK_RULE STRING | 179 | createusing: TOK_RULE STRING |
153 | { | 180 | { |
154 | bld.lastTarget()->setRule( $2 ); | 181 | bld.setTargetRule( $2 ); |
155 | } | 182 | } |
156 | ; | 183 | ; |
157 | 184 | ||
@@ -163,10 +190,18 @@ action: TOK_CHECK STRING | |||
163 | { | 190 | { |
164 | bld.add( new Command( Command::cmdCheck, $2 ) ); | 191 | bld.add( new Command( Command::cmdCheck, $2 ) ); |
165 | } | 192 | } |
193 | | TOK_CHECK REGEXP | ||
194 | { | ||
195 | bld.addRegexCommand( Command::cmdCheck, $2 ); | ||
196 | } | ||
166 | | TOK_CLEAN STRING | 197 | | TOK_CLEAN STRING |
167 | { | 198 | { |
168 | bld.add( new Command( Command::cmdClean, $2 ) ); | 199 | bld.add( new Command( Command::cmdClean, $2 ) ); |
169 | } | 200 | } |
201 | | TOK_CLEAN REGEXP | ||
202 | { | ||
203 | bld.addRegexCommand( Command::cmdClean, $2 ); | ||
204 | } | ||
170 | ; | 205 | ; |
171 | 206 | ||
172 | setexpr: STRING '=' STRING | 207 | setexpr: STRING '=' STRING |