diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-08-21 15:24:10 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-08-21 15:24:10 +0000 |
commit | e95c31f841b67fc69d93ec650fe285d34f996a1e (patch) | |
tree | bb0153ba0ee01958743d31be70a73b032b3ea2fc /src/build.y | |
parent | 4887f62bea708f24e03b3f926f2698c60a94c807 (diff) | |
download | build-e95c31f841b67fc69d93ec650fe285d34f996a1e.tar.gz build-e95c31f841b67fc69d93ec650fe285d34f996a1e.tar.bz2 build-e95c31f841b67fc69d93ec650fe285d34f996a1e.tar.xz build-e95c31f841b67fc69d93ec650fe285d34f996a1e.zip |
Alright, the grammer is almost there, just debugging, in what I call extreme-
debugging mode. If you wanted something intelligable, don't use this one.
Diffstat (limited to '')
-rw-r--r-- | src/build.y | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/src/build.y b/src/build.y index d852c4c..5580299 100644 --- a/src/build.y +++ b/src/build.y | |||
@@ -40,9 +40,9 @@ void yyerror( YYLTYPE *locp, Builder &bld, char const *msg ); | |||
40 | %token TOK_PERFORM "perform" | 40 | %token TOK_PERFORM "perform" |
41 | %token TOK_PRODUCES "produces" | 41 | %token TOK_PRODUCES "produces" |
42 | 42 | ||
43 | %token ',' ':' '=' | 43 | %token ',' ':' '=' '(' ')' |
44 | 44 | ||
45 | %destructor { delete[] $$; } STRING | 45 | %destructor { delete[] $$; } STRING FUNCTION |
46 | 46 | ||
47 | %% | 47 | %% |
48 | 48 | ||
@@ -54,57 +54,61 @@ input: | |||
54 | ; | 54 | ; |
55 | 55 | ||
56 | // Rule interpretation | 56 | // Rule interpretation |
57 | rule: TOK_RULE STRING ':' rulecmds | 57 | rule: TOK_RULE STRING {printf("Rule %s:\n", $2 ); } ':' rulecmds |
58 | ; | 58 | ; |
59 | 59 | ||
60 | rulecmds: rulecmd | 60 | rulecmds: rulecmd |
61 | | rulecmds ',' rulecmd | 61 | | rulecmds ',' rulecmd |
62 | ; | 62 | ; |
63 | 63 | ||
64 | rulecmd: TOK_MATCHES REGEXP | 64 | rulecmd: TOK_MATCHES REGEXP { printf(" Matches: %s\n", $2 ); } |
65 | | TOK_PRODUCES STRING | 65 | | TOK_PRODUCES STRING { printf(" Produces: %s\n", $2 ); } |
66 | | TOK_REQUIRES list | 66 | | TOK_REQUIRES { printf(" Requires:\n"); } list {printf("\n");} |
67 | | TOK_INPUT TOK_FILTER REGEXP | 67 | | TOK_INPUT TOK_FILTER REGEXP { printf(" Input Filter: %s\n", $3 ); } |
68 | | TOK_INPUT TOK_FILTER func | 68 | | TOK_INPUT TOK_FILTER { printf(" Input Filter: "); } func {printf("\n");} |
69 | | TOK_PERFORM func | 69 | | TOK_PERFORM { printf(" Perform: "); } func {printf("\n");} |
70 | ; | 70 | ; |
71 | 71 | ||
72 | // Action interpretation | 72 | // Action interpretation |
73 | action: TOK_DEFAULT TOK_ACTION ':' actioncmds | 73 | action: TOK_DEFAULT TOK_ACTION ':' { printf("Default action:\n"); } actioncmds |
74 | | STRING TOK_ACTION ':' actioncmds | 74 | | STRING TOK_ACTION ':' { printf("\"%s\" action:\n", $1 ); } actioncmds |
75 | ; | 75 | ; |
76 | 76 | ||
77 | actioncmds: actioncmd | 77 | actioncmds: actioncmd |
78 | | actioncmds ',' actioncmd | 78 | | actioncmds ',' actioncmd |
79 | ; | 79 | ; |
80 | 80 | ||
81 | actioncmd: actioncmdtype list | 81 | actioncmd: { printf("\t"); } actioncmdtype list {printf("\n");} |
82 | ; | 82 | ; |
83 | 83 | ||
84 | actioncmdtype: TOK_CHECK | 84 | actioncmdtype: TOK_CHECK { printf("check "); } |
85 | | TOK_CLEAN | 85 | | TOK_CLEAN { printf("clean "); } |
86 | ; | 86 | ; |
87 | 87 | ||
88 | // Target interpretation | 88 | // Target interpretation |
89 | 89 | target: list ':' { printf(" are targets:\n"); } targetcmds | |
90 | target: list ':' targetcmds | ||
91 | ; | 90 | ; |
92 | 91 | ||
93 | targetcmds: targetcmd | 92 | targetcmds: targetcmd |
94 | | targetcmds ',' targetcmd | 93 | | targetcmds ',' targetcmd |
95 | ; | 94 | ; |
96 | 95 | ||
97 | targetcmd: TOK_RULE STRING | 96 | targetcmd: TOK_RULE STRING { printf(" Rule %s\n", $2 ); } |
98 | | TOK_TARGET TOK_PREFIX STRING | 97 | | TOK_TARGET TOK_PREFIX STRING { printf(" Target prefix: %s\n", $3 ); } |
99 | | TOK_TARGET TARGETTYPE | 98 | | TOK_TARGET TARGETTYPE { printf(" Target Type: %d\n", $2 ); } |
100 | | TOK_INPUT list | 99 | | TOK_INPUT { printf(" Input: "); } list { printf("\n"); } |
101 | | TOK_REQUIRES list | 100 | | TOK_REQUIRES { printf(" Requires: "); } list { printf("\n"); } |
101 | | TOK_SET { printf(" Set: "); } targetset | ||
102 | ; | ||
103 | |||
104 | targetset: STRING '=' STRING { printf("%s = %s\n", $1, $3 ); } | ||
105 | | STRING TOK_ADDSET STRING { printf("%s += %s\n", $1, $3 ); } | ||
102 | ; | 106 | ; |
103 | 107 | ||
104 | // list goo | 108 | // list goo |
105 | 109 | ||
106 | list: listitem listfilter | 110 | list: listitem listfilter |
107 | | '[' listitems ']' listfilter | 111 | | '[' { printf("["); } listitems ']' { printf("]"); } listfilter |
108 | ; | 112 | ; |
109 | 113 | ||
110 | listfilter: | 114 | listfilter: |
@@ -113,21 +117,21 @@ listfilter: | |||
113 | ; | 117 | ; |
114 | 118 | ||
115 | listitems: listitem | 119 | listitems: listitem |
116 | | listitems ',' listitem | 120 | | listitems ',' {printf(", "); } listitem |
117 | ; | 121 | ; |
118 | 122 | ||
119 | listitem: STRING | 123 | listitem: STRING {printf("%s", $1 ); } |
120 | | func | 124 | | func |
121 | ; | 125 | ; |
122 | 126 | ||
123 | // Function | 127 | // Function |
124 | 128 | ||
125 | func: FUNCTION '(' funcparams ')' | 129 | func: FUNCTION { printf("%s(", $1 ); } '(' funcparams ')' { printf(")"); } |
126 | ; | 130 | ; |
127 | 131 | ||
128 | funcparams: | 132 | funcparams: |
129 | | STRING | 133 | | STRING { printf("%s", $1 ); } |
130 | | funcparams ',' STRING | 134 | | funcparams ',' STRING { printf(", %s", $3 ); } |
131 | ; | 135 | ; |
132 | 136 | ||
133 | %% | 137 | %% |
@@ -136,3 +140,4 @@ void yyerror( YYLTYPE *locp, Builder &bld, char const *msg ) | |||
136 | { | 140 | { |
137 | bld.error( locp, msg ); | 141 | bld.error( locp, msg ); |
138 | } | 142 | } |
143 | |||