aboutsummaryrefslogtreecommitdiff
path: root/src/build.y
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/build.y108
1 files changed, 85 insertions, 23 deletions
diff --git a/src/build.y b/src/build.y
index 40f8d34..e9c0083 100644
--- a/src/build.y
+++ b/src/build.y
@@ -55,18 +55,37 @@ input:
55 ; 55 ;
56 56
57// Rule interpretation 57// Rule interpretation
58rule: TOK_RULE STRING {printf("Rule %s:\n", $2 ); } ':' rulecmds 58rule: TOK_RULE STRING ':'
59 {
60 bld.addRule( $2 );
61 }
62 rulecmds
59 ; 63 ;
60 64
61rulecmds: rulecmd 65rulecmds: rulecmd
62 | rulecmds ',' rulecmd 66 | rulecmds ',' rulecmd
63 ; 67 ;
64 68
65rulecmd: TOK_MATCHES { printf(" Matches: " ); } func { printf("\n"); } 69rulecmd: TOK_MATCHES func
66 | TOK_PRODUCES STRING { printf(" Produces: %s\n", $2 ); } 70 {
67 | TOK_REQUIRES { printf(" Requires:\n"); } list {printf("\n");} 71 bld.addRuleMatches();
68 | TOK_INPUT TOK_FILTER { printf(" Input Filter: "); } func {printf("\n");} 72 }
69 | TOK_PERFORM { printf(" Perform: "); } perf {printf("\n");} 73 | TOK_PRODUCES list
74 {
75 bld.addRuleProduces();
76 }
77 | TOK_REQUIRES list
78 {
79 bld.addRuleRequires();
80 }
81 | TOK_INPUT TOK_FILTER func
82 {
83 bld.addRuleInputFilter();
84 }
85 | TOK_PERFORM perf
86 {
87 bld.addRulePerform();
88 }
70 ; 89 ;
71 90
72// Action interpretation 91// Action interpretation
@@ -102,32 +121,62 @@ actioncmd: TOK_CHECK list
102 ; 121 ;
103 122
104// Target interpretation 123// Target interpretation
105target: list ':' { printf(" are targets:\n"); } targetcmds 124target: list ':'
125 {
126 bld.newTarget();
127 }
128 targetcmds
106 ; 129 ;
107 130
108targetcmds: targetcmd 131targetcmds: targetcmd
109 | targetcmds ',' targetcmd 132 | targetcmds ',' targetcmd
110 ; 133 ;
111 134
112targetcmd: TOK_RULE STRING { printf(" Rule %s\n", $2 ); } 135targetcmd: TOK_RULE STRING
113 | TOK_TARGET TOK_PREFIX STRING { printf(" Target prefix: %s\n", $3 ); } 136 {
114 | TOK_TARGET TARGETTYPE { printf(" Target Type: %s\n", $2 ); } 137 bld.setTargetRule( $2 );
115 | TOK_INPUT { printf(" Input: "); } list { printf("\n"); } 138 }
116 | TOK_INPUT TOK_FILTER { printf(" Input filter: "); } func { printf("\n"); } 139 | TOK_TARGET TOK_PREFIX STRING
117 | TOK_REQUIRES { printf(" Requires: "); } list { printf("\n"); } 140 {
118 | TOK_SET { printf(" Set: "); } targetset 141 bld.setTargetPrefix( $3 );
142 }
143 | TOK_TARGET TARGETTYPE
144 {
145 bld.setTargetType( $2 );
146 }
147 | TOK_INPUT list
148 {
149 bld.addTargetInput();
150 }
151 | TOK_REQUIRES list
152 {
153 bld.addTargetRequires();
154 }
155 | TOK_SET targetset
119 ; 156 ;
120 157
121targetset: STRING '=' STRING { printf("%s = %s\n", $1, $3 ); } 158targetset: STRING '=' STRING
122 | STRING TOK_ADDSET STRING { printf("%s += %s\n", $1, $3 ); } 159 {
160 bld.addTargetSet( $1, $3, setSet );
161 }
162 | STRING TOK_ADDSET STRING
163 {
164 bld.addTargetSet( $1, $3, setAdd );
165 }
123 ; 166 ;
124 167
125// global set 168// global set
126set: TOK_SET { printf("Set: "); } setwhat 169set: TOK_SET setwhat
127 ; 170 ;
128 171
129setwhat: STRING '=' STRING { printf("%s = %s\n", $1, $3 ); } 172setwhat: STRING '=' STRING
130 | STRING TOK_ADDSET STRING { printf("%s += %s\n", $1, $3 ); } 173 {
174 bld.addGlobalSet( $1, $3, setSet );
175 }
176 | STRING TOK_ADDSET STRING
177 {
178 bld.addGlobalSet( $1, $3, setAdd );
179 }
131 ; 180 ;
132 181
133// list goo 182// list goo
@@ -140,7 +189,10 @@ list: singlelistitem listfilter
140 ; 189 ;
141 190
142listfilter: 191listfilter:
143 | TOK_FILTER { printf(" filtered by "); } func 192 | TOK_FILTER func
193 {
194 bld.filterList();
195 }
144 ; 196 ;
145 197
146listitems: listitem 198listitems: listitem
@@ -183,12 +235,22 @@ funcparams:
183 ; 235 ;
184 236
185// Perform 237// Perform
186perf: PERFORM { printf("%s(", $1 ); } '(' perfparams ')' { printf(")"); } 238perf: PERFORM
239 {
240 bld.newPerform( $1 );
241 }
242 '(' perfparams ')'
187 ; 243 ;
188 244
189perfparams: 245perfparams:
190 | STRING { printf("%s", $1 ); } 246 | STRING
191 | perfparams ',' STRING { printf(", %s", $3 ); } 247 {
248 bld.addPerformParam( $1 );
249 }
250 | perfparams ',' STRING
251 {
252 bld.addPerformParam( $3 );
253 }
192 ; 254 ;
193%% 255%%
194 256