aboutsummaryrefslogtreecommitdiff
path: root/src/build.y
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-08-22 15:12:20 +0000
committerMike Buland <eichlan@xagasoft.com>2006-08-22 15:12:20 +0000
commitf5cf5725026ecb2fa63d729fb6745b4da15e69d8 (patch)
treeaf48e59cc29dcea1218221dbb6ed9f0cd7f19989 /src/build.y
parentee98faf71642cf351d5cda241679b094aeec65ce (diff)
downloadbuild-f5cf5725026ecb2fa63d729fb6745b4da15e69d8.tar.gz
build-f5cf5725026ecb2fa63d729fb6745b4da15e69d8.tar.bz2
build-f5cf5725026ecb2fa63d729fb6745b4da15e69d8.tar.xz
build-f5cf5725026ecb2fa63d729fb6745b4da15e69d8.zip
Started on the crazy process of building the stage one compiled data. It's
going pretty quickly, we'll see how the targets go, they'll be the only tricky part.
Diffstat (limited to '')
-rw-r--r--src/build.y71
1 files changed, 57 insertions, 14 deletions
diff --git a/src/build.y b/src/build.y
index 1424867..40f8d34 100644
--- a/src/build.y
+++ b/src/build.y
@@ -3,6 +3,7 @@
3# include <string> 3# include <string>
4# include "builder.h" 4# include "builder.h"
5# include "build.tab.h" 5# include "build.tab.h"
6# include "action.h"
6void yyerror( YYLTYPE *locp, Builder &bld, char const *msg ); 7void yyerror( YYLTYPE *locp, Builder &bld, char const *msg );
7%} 8%}
8 9
@@ -69,21 +70,37 @@ rulecmd: TOK_MATCHES { printf(" Matches: " ); } func { printf("\n"); }
69 ; 70 ;
70 71
71// Action interpretation 72// Action interpretation
72action: TOK_DEFAULT TOK_ACTION ':' { printf("Default action:\n"); } actioncmds 73action: TOK_DEFAULT TOK_ACTION ':'
73 | STRING TOK_ACTION ':' { printf("\"%s\" action:\n", $1 ); } actioncmds 74 {
75 bld.addAction();
76 }
77 actioncmds
78 | STRING TOK_ACTION ':'
79 {
80 if( $1[0] == '\0' )
81 bld.error(
82 &yylloc,
83 "You cannot use an empty string as the name of an action."
84 );
85 bld.addAction( $1 );
86 }
87 actioncmds
74 ; 88 ;
75 89
76actioncmds: actioncmd 90actioncmds: actioncmd
77 | actioncmds ',' actioncmd 91 | actioncmds ',' actioncmd
78 ; 92 ;
79 93
80actioncmd: { printf(" "); } actioncmdtype list {printf("\n");} 94actioncmd: TOK_CHECK list
95 {
96 bld.addCommand( Action::actCheck );
97 }
98 | TOK_CLEAN list
99 {
100 bld.addCommand( Action::actClean );
101 }
81 ; 102 ;
82 103
83actioncmdtype: TOK_CHECK { printf("check "); }
84 | TOK_CLEAN { printf("clean "); }
85 ;
86
87// Target interpretation 104// Target interpretation
88target: list ':' { printf(" are targets:\n"); } targetcmds 105target: list ':' { printf(" are targets:\n"); } targetcmds
89 ; 106 ;
@@ -114,8 +131,12 @@ setwhat: STRING '=' STRING { printf("%s = %s\n", $1, $3 ); }
114 ; 131 ;
115 132
116// list goo 133// list goo
117list: listitem listfilter 134list: singlelistitem listfilter
118 | '[' { printf("["); } listitems ']' { printf("]"); } listfilter 135 | '['
136 {
137 bld.newList();
138 }
139 listitems ']' listfilter
119 ; 140 ;
120 141
121listfilter: 142listfilter:
@@ -123,20 +144,42 @@ listfilter:
123 ; 144 ;
124 145
125listitems: listitem 146listitems: listitem
126 | listitems ',' { printf(", "); } listitem 147 | listitems ',' listitem
127 ; 148 ;
128 149
129listitem: STRING { printf("%s", $1 ); } 150listitem: STRING
151 {
152 bld.addListString( $1 );
153 }
130 | func 154 | func
155 {
156 bld.addListFunc();
157 }
131 ; 158 ;
132 159
160singlelistitem: STRING
161 {
162 bld.newList();
163 bld.addListString( $1 );
164 }
165 | func
166 {
167 bld.newList();
168 bld.addListFunc();
169 }
170 ;
171
133// Function 172// Function
134func: FUNCTION { printf("%s(", $1 ); } '(' funcparams ')' { printf(")"); } 173func: FUNCTION
174 {
175 bld.newFunctionCall( $1 );
176 }
177 '(' funcparams ')'
135 ; 178 ;
136 179
137funcparams: 180funcparams:
138 | STRING { printf("%s", $1 ); } 181 | STRING { bld.addFunctionParam( $1 ); }
139 | funcparams ',' STRING { printf(", %s", $3 ); } 182 | funcparams ',' STRING { bld.addFunctionParam( $3 ); }
140 ; 183 ;
141 184
142// Perform 185// Perform