diff options
Diffstat (limited to 'src/build.y')
| -rw-r--r-- | src/build.y | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/build.y b/src/build.y index 5580299..1621dbc 100644 --- a/src/build.y +++ b/src/build.y | |||
| @@ -20,9 +20,9 @@ void yyerror( YYLTYPE *locp, Builder &bld, char const *msg ); | |||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | %token <strval> STRING "string literal" | 22 | %token <strval> STRING "string literal" |
| 23 | %token <strval> REGEXP "regular expression" | ||
| 24 | %token <tval> TARGETTYPE "target type" | 23 | %token <tval> TARGETTYPE "target type" |
| 25 | %token <strval> FUNCTION "function name" | 24 | %token <strval> FUNCTION "function name" |
| 25 | %token <strval> PERFORM "perform name" | ||
| 26 | 26 | ||
| 27 | %token TOK_ADDSET "+=" | 27 | %token TOK_ADDSET "+=" |
| 28 | %token TOK_DEFAULT "default" | 28 | %token TOK_DEFAULT "default" |
| @@ -61,12 +61,11 @@ rulecmds: rulecmd | |||
| 61 | | rulecmds ',' rulecmd | 61 | | rulecmds ',' rulecmd |
| 62 | ; | 62 | ; |
| 63 | 63 | ||
| 64 | rulecmd: TOK_MATCHES REGEXP { printf(" Matches: %s\n", $2 ); } | 64 | rulecmd: TOK_MATCHES { printf(" Matches: " ); } func |
| 65 | | TOK_PRODUCES STRING { printf(" Produces: %s\n", $2 ); } | 65 | | TOK_PRODUCES STRING { printf(" Produces: %s\n", $2 ); } |
| 66 | | TOK_REQUIRES { printf(" Requires:\n"); } list {printf("\n");} | 66 | | TOK_REQUIRES { printf(" Requires:\n"); } list {printf("\n");} |
| 67 | | TOK_INPUT TOK_FILTER REGEXP { printf(" Input Filter: %s\n", $3 ); } | ||
| 68 | | TOK_INPUT TOK_FILTER { printf(" Input Filter: "); } func {printf("\n");} | 67 | | TOK_INPUT TOK_FILTER { printf(" Input Filter: "); } func {printf("\n");} |
| 69 | | TOK_PERFORM { printf(" Perform: "); } func {printf("\n");} | 68 | | TOK_PERFORM { printf(" Perform: "); } perf {printf("\n");} |
| 70 | ; | 69 | ; |
| 71 | 70 | ||
| 72 | // Action interpretation | 71 | // Action interpretation |
| @@ -78,7 +77,7 @@ actioncmds: actioncmd | |||
| 78 | | actioncmds ',' actioncmd | 77 | | actioncmds ',' actioncmd |
| 79 | ; | 78 | ; |
| 80 | 79 | ||
| 81 | actioncmd: { printf("\t"); } actioncmdtype list {printf("\n");} | 80 | actioncmd: { printf(" "); } actioncmdtype list {printf("\n");} |
| 82 | ; | 81 | ; |
| 83 | 82 | ||
| 84 | actioncmdtype: TOK_CHECK { printf("check "); } | 83 | actioncmdtype: TOK_CHECK { printf("check "); } |
| @@ -97,6 +96,7 @@ targetcmd: TOK_RULE STRING { printf(" Rule %s\n", $2 ); } | |||
| 97 | | TOK_TARGET TOK_PREFIX STRING { printf(" Target prefix: %s\n", $3 ); } | 96 | | TOK_TARGET TOK_PREFIX STRING { printf(" Target prefix: %s\n", $3 ); } |
| 98 | | TOK_TARGET TARGETTYPE { printf(" Target Type: %d\n", $2 ); } | 97 | | TOK_TARGET TARGETTYPE { printf(" Target Type: %d\n", $2 ); } |
| 99 | | TOK_INPUT { printf(" Input: "); } list { printf("\n"); } | 98 | | TOK_INPUT { printf(" Input: "); } list { printf("\n"); } |
| 99 | | TOK_INPUT TOK_FILTER { printf(" Input filter: "); } func | ||
| 100 | | TOK_REQUIRES { printf(" Requires: "); } list { printf("\n"); } | 100 | | TOK_REQUIRES { printf(" Requires: "); } list { printf("\n"); } |
| 101 | | TOK_SET { printf(" Set: "); } targetset | 101 | | TOK_SET { printf(" Set: "); } targetset |
| 102 | ; | 102 | ; |
| @@ -106,26 +106,23 @@ targetset: STRING '=' STRING { printf("%s = %s\n", $1, $3 ); } | |||
| 106 | ; | 106 | ; |
| 107 | 107 | ||
| 108 | // list goo | 108 | // list goo |
| 109 | |||
| 110 | list: listitem listfilter | 109 | list: listitem listfilter |
| 111 | | '[' { printf("["); } listitems ']' { printf("]"); } listfilter | 110 | | '[' { printf("["); } listitems ']' { printf("]"); } listfilter |
| 112 | ; | 111 | ; |
| 113 | 112 | ||
| 114 | listfilter: | 113 | listfilter: |
| 115 | | TOK_FILTER REGEXP | 114 | | TOK_FILTER { printf(" filtered by "); } func |
| 116 | | TOK_FILTER func | ||
| 117 | ; | 115 | ; |
| 118 | 116 | ||
| 119 | listitems: listitem | 117 | listitems: listitem |
| 120 | | listitems ',' {printf(", "); } listitem | 118 | | listitems ',' { printf(", "); } listitem |
| 121 | ; | 119 | ; |
| 122 | 120 | ||
| 123 | listitem: STRING {printf("%s", $1 ); } | 121 | listitem: STRING { printf("%s", $1 ); } |
| 124 | | func | 122 | | func |
| 125 | ; | 123 | ; |
| 126 | 124 | ||
| 127 | // Function | 125 | // Function |
| 128 | |||
| 129 | func: FUNCTION { printf("%s(", $1 ); } '(' funcparams ')' { printf(")"); } | 126 | func: FUNCTION { printf("%s(", $1 ); } '(' funcparams ')' { printf(")"); } |
| 130 | ; | 127 | ; |
| 131 | 128 | ||
| @@ -134,6 +131,14 @@ funcparams: | |||
| 134 | | funcparams ',' STRING { printf(", %s", $3 ); } | 131 | | funcparams ',' STRING { printf(", %s", $3 ); } |
| 135 | ; | 132 | ; |
| 136 | 133 | ||
| 134 | // Perform | ||
| 135 | perf: PERFORM { printf("%s(", $1 ); } '(' perfparams ')' { printf(")"); } | ||
| 136 | ; | ||
| 137 | |||
| 138 | perfparams: | ||
| 139 | | STRING { printf("%s", $1 ); } | ||
| 140 | | perfparams ',' STRING { printf(", %s", $3 ); } | ||
| 141 | ; | ||
| 137 | %% | 142 | %% |
| 138 | 143 | ||
| 139 | void yyerror( YYLTYPE *locp, Builder &bld, char const *msg ) | 144 | void yyerror( YYLTYPE *locp, Builder &bld, char const *msg ) |
