diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-07-30 06:39:27 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-07-30 06:39:27 +0000 |
commit | 900976d2d74e0de57858b265c2ef0d17a29e921a (patch) | |
tree | 3d7e0c804b2bb5163d2998158b7c1f6e1891240c /src/build.y | |
parent | 28e92029752693ffe33de12c10de3e7bd39a3c94 (diff) | |
download | build-900976d2d74e0de57858b265c2ef0d17a29e921a.tar.gz build-900976d2d74e0de57858b265c2ef0d17a29e921a.tar.bz2 build-900976d2d74e0de57858b265c2ef0d17a29e921a.tar.xz build-900976d2d74e0de57858b265c2ef0d17a29e921a.zip |
Found out all of the c++ stuff in bison broke in 2.2, now we have to pick a
version, there is no way around it nicely.
Diffstat (limited to 'src/build.y')
-rw-r--r-- | src/build.y | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/src/build.y b/src/build.y index e69de29..600b923 100644 --- a/src/build.y +++ b/src/build.y | |||
@@ -0,0 +1,91 @@ | |||
1 | %skeleton "lalr1.cc" | ||
2 | %define "parser_class_name" "BuildParser" | ||
3 | %defines | ||
4 | %{ | ||
5 | # include <string> | ||
6 | # include "builder.h" | ||
7 | # include "build.tab.h" | ||
8 | %} | ||
9 | |||
10 | %parse-param { Builder &bld } | ||
11 | %lex-param { Builder &bld } | ||
12 | |||
13 | %locations | ||
14 | %initial-action | ||
15 | { | ||
16 | @$.begin.filename = @$.end.filename = &bld.file; | ||
17 | } | ||
18 | |||
19 | %debug | ||
20 | %error-verbose | ||
21 | %union { | ||
22 | char *strval; | ||
23 | } | ||
24 | |||
25 | %token <strval> STRING "string literal" | ||
26 | |||
27 | %token TOK_ADDSET "+=" | ||
28 | %token TOK_DEFAULT "keyword 'default'" | ||
29 | %token TOK_ACTION "keyword 'action'" | ||
30 | %token TOK_CREATE "keyword 'create'" | ||
31 | %token TOK_FILE "keyword 'file'" | ||
32 | %token TOK_FROM "keyword 'from'" | ||
33 | %token TOK_FILES "keyword 'files'" | ||
34 | %token TOK_IN "keyword 'in'" | ||
35 | %token TOK_USING "keyword 'using'" | ||
36 | %token TOK_RULE "keyword 'rule'" | ||
37 | %token TOK_REQUIRES "keyword 'requires'" | ||
38 | %token TOK_FOR "keyword 'for'" | ||
39 | %token TOK_SET "keyword 'set'" | ||
40 | %token TOK_MATCHES "keyword 'matches'" | ||
41 | %token TOK_ALL "keyword 'all'" | ||
42 | %token TOK_ONE "keyword 'one'" | ||
43 | %token TOK_PERFORM "keyword 'perform'" | ||
44 | %token TOK_PRODUCES "keyword 'produces'" | ||
45 | %token TOK_COMMAND "keyword 'command'" | ||
46 | %token TOK_EOL "end of line" | ||
47 | |||
48 | %destructor { delete[] $$; } STRING | ||
49 | |||
50 | %% | ||
51 | |||
52 | input: | ||
53 | | input line | ||
54 | ; | ||
55 | |||
56 | line: stuff TOK_EOL { printf("\n"); } | ||
57 | ; | ||
58 | |||
59 | stuff: | ||
60 | | stuff token | ||
61 | ; | ||
62 | |||
63 | token: TOK_ADDSET { printf("+= "); } | ||
64 | | TOK_DEFAULT { printf("default "); } | ||
65 | | TOK_ACTION { printf("action "); } | ||
66 | | TOK_CREATE { printf("create "); } | ||
67 | | TOK_FILE { printf("file "); } | ||
68 | | TOK_FROM { printf("from "); } | ||
69 | | TOK_FILES { printf("files "); } | ||
70 | | TOK_IN { printf("in "); } | ||
71 | | TOK_USING { printf("using "); } | ||
72 | | TOK_RULE { printf("rule "); } | ||
73 | | TOK_REQUIRES { printf("requires "); } | ||
74 | | TOK_FOR { printf("for "); } | ||
75 | | TOK_SET { printf("set "); } | ||
76 | | TOK_MATCHES { printf("matches "); } | ||
77 | | TOK_ALL { printf("all "); } | ||
78 | | TOK_ONE { printf("one "); } | ||
79 | | TOK_PERFORM { printf("perform "); } | ||
80 | | TOK_PRODUCES { printf("produces "); } | ||
81 | | TOK_COMMAND { printf("command "); } | ||
82 | ; | ||
83 | |||
84 | %% | ||
85 | |||
86 | void yy::BuildParser::error( const yy::BuildParser::location_type &l, | ||
87 | const std::string &m ) | ||
88 | { | ||
89 | bld.error( l, m ); | ||
90 | } | ||
91 | |||