diff options
Diffstat (limited to 'bitbake/lib/bb/parse/parse_c/bitbakeparser.y')
-rw-r--r-- | bitbake/lib/bb/parse/parse_c/bitbakeparser.y | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/bitbake/lib/bb/parse/parse_c/bitbakeparser.y b/bitbake/lib/bb/parse/parse_c/bitbakeparser.y index 4bc81a913a..252d87792f 100644 --- a/bitbake/lib/bb/parse/parse_c/bitbakeparser.y +++ b/bitbake/lib/bb/parse/parse_c/bitbakeparser.y | |||
@@ -42,13 +42,14 @@ | |||
42 | 42 | ||
43 | %include { | 43 | %include { |
44 | #include "token.h" | 44 | #include "token.h" |
45 | #include "lexer.h" | ||
46 | #include "python_output.h" | ||
45 | } | 47 | } |
46 | 48 | ||
47 | 49 | ||
48 | %token_destructor { $$.release_this (); } | 50 | %token_destructor { $$.release_this (); } |
49 | 51 | ||
50 | %syntax_error { printf ("%s:%d: syntax error\n", | 52 | %syntax_error { e_parse_error( lex ); } |
51 | lex->filename (), lex->line ()); } | ||
52 | 53 | ||
53 | program ::= statements. | 54 | program ::= statements. |
54 | 55 | ||
@@ -56,79 +57,82 @@ statements ::= statements statement. | |||
56 | statements ::= . | 57 | statements ::= . |
57 | 58 | ||
58 | variable(r) ::= SYMBOL(s). | 59 | variable(r) ::= SYMBOL(s). |
59 | { r.assignString( s.string() ); | 60 | { r.assignString( (char*)s.string() ); |
60 | s.assignString( 0 ); | 61 | s.assignString( 0 ); |
61 | s.release_this(); } | 62 | s.release_this(); } |
62 | variable(r) ::= VARIABLE(v). | 63 | variable(r) ::= VARIABLE(v). |
63 | { | 64 | { |
64 | r.assignString( v.string() ); | 65 | r.assignString( (char*)v.string() ); |
65 | v.assignString( 0 ); | 66 | v.assignString( 0 ); |
66 | v.release_this(); } | 67 | v.release_this(); } |
67 | 68 | ||
68 | statement ::= EXPORT variable(s) OP_ASSIGN STRING(v). | 69 | statement ::= EXPORT variable(s) OP_ASSIGN STRING(v). |
69 | { e_assign( s.string(), v.string() ); | 70 | { e_assign( lex, s.string(), v.string() ); |
70 | e_export( s.string() ); | 71 | e_export( lex, s.string() ); |
71 | s.release_this(); v.release_this(); } | 72 | s.release_this(); v.release_this(); } |
72 | statement ::= EXPORT variable(s) OP_IMMEDIATE STRING(v). | 73 | statement ::= EXPORT variable(s) OP_IMMEDIATE STRING(v). |
73 | { e_immediate (s.string(), v.string() ); | 74 | { e_immediate ( lex, s.string(), v.string() ); |
74 | e_export( s.string() ); | 75 | e_export( lex, s.string() ); |
75 | s.release_this(); v.release_this(); } | 76 | s.release_this(); v.release_this(); } |
76 | statement ::= EXPORT variable(s) OP_COND STRING(v). | 77 | statement ::= EXPORT variable(s) OP_COND STRING(v). |
77 | { e_cond( s.string(), v.string() ); | 78 | { e_cond( lex, s.string(), v.string() ); |
78 | s.release_this(); v.release_this(); } | 79 | s.release_this(); v.release_this(); } |
79 | 80 | ||
80 | statement ::= variable(s) OP_ASSIGN STRING(v). | 81 | statement ::= variable(s) OP_ASSIGN STRING(v). |
81 | { e_assign( s.string(), v.string() ); | 82 | { e_assign( lex, s.string(), v.string() ); |
82 | s.release_this(); v.release_this(); } | 83 | s.release_this(); v.release_this(); } |
83 | statement ::= variable(s) OP_PREPEND STRING(v). | 84 | statement ::= variable(s) OP_PREPEND STRING(v). |
84 | { e_prepend( s.string(), v.string() ); | 85 | { e_prepend( lex, s.string(), v.string() ); |
85 | s.release_this(); v.release_this(); } | 86 | s.release_this(); v.release_this(); } |
86 | statement ::= variable(s) OP_APPEND STRING(v). | 87 | statement ::= variable(s) OP_APPEND STRING(v). |
87 | { e_append( s.string() , v.string() ); | 88 | { e_append( lex, s.string() , v.string() ); |
88 | s.release_this(); v.release_this(); } | 89 | s.release_this(); v.release_this(); } |
89 | statement ::= variable(s) OP_IMMEDIATE STRING(v). | 90 | statement ::= variable(s) OP_IMMEDIATE STRING(v). |
90 | { e_immediate( s.string(), v.string() ); | 91 | { e_immediate( lex, s.string(), v.string() ); |
91 | s.release_this(); v.release_this(); } | 92 | s.release_this(); v.release_this(); } |
92 | statement ::= variable(s) OP_COND STRING(v). | 93 | statement ::= variable(s) OP_COND STRING(v). |
93 | { e_cond( s.string(), v.string() ); | 94 | { e_cond( lex, s.string(), v.string() ); |
94 | s.release_this(); v.release_this(); } | 95 | s.release_this(); v.release_this(); } |
95 | 96 | ||
96 | task ::= TSYMBOL(t) BEFORE TSYMBOL(b) AFTER TSYMBOL(a). | 97 | task ::= TSYMBOL(t) BEFORE TSYMBOL(b) AFTER TSYMBOL(a). |
97 | { e_addtask( t.string(), b.string(), a.string() ); | 98 | { e_addtask( lex, t.string(), b.string(), a.string() ); |
98 | t.release_this(); b.release_this(); a.release_this(); } | 99 | t.release_this(); b.release_this(); a.release_this(); } |
99 | task ::= TSYMBOL(t) AFTER TSYMBOL(a) BEFORE TSYMBOL(b). | 100 | task ::= TSYMBOL(t) AFTER TSYMBOL(a) BEFORE TSYMBOL(b). |
100 | { e_addtask( t.string(), b.string(), a.string()); | 101 | { e_addtask( lex, t.string(), b.string(), a.string()); |
101 | t.release_this(); a.release_this(); b.release_this(); } | 102 | t.release_this(); a.release_this(); b.release_this(); } |
102 | task ::= TSYMBOL(t). | 103 | task ::= TSYMBOL(t). |
103 | { e_addtask( t.string(), NULL, NULL); | 104 | { e_addtask( lex, t.string(), NULL, NULL); |
104 | t.release_this();} | 105 | t.release_this();} |
105 | task ::= TSYMBOL(t) BEFORE TSYMBOL(b). | 106 | task ::= TSYMBOL(t) BEFORE TSYMBOL(b). |
106 | { e_addtask( t.string(), b.string(), NULL); | 107 | { e_addtask( lex, t.string(), b.string(), NULL); |
107 | t.release_this(); b.release_this(); } | 108 | t.release_this(); b.release_this(); } |
108 | task ::= TSYMBOL(t) AFTER TSYMBOL(a). | 109 | task ::= TSYMBOL(t) AFTER TSYMBOL(a). |
109 | { e_addtask( t.string(), NULL, a.string()); | 110 | { e_addtask( lex, t.string(), NULL, a.string()); |
110 | t.release_this(); a.release_this(); } | 111 | t.release_this(); a.release_this(); } |
111 | tasks ::= tasks task. | 112 | tasks ::= tasks task. |
112 | tasks ::= task. | 113 | tasks ::= task. |
113 | statement ::= ADDTASK tasks. | 114 | statement ::= ADDTASK tasks. |
114 | 115 | ||
115 | statement ::= ADDHANDLER SYMBOL(s). | 116 | statement ::= ADDHANDLER SYMBOL(s). |
116 | { e_addhandler( s.string()); s.release_this (); } | 117 | { e_addhandler( lex, s.string()); s.release_this (); } |
117 | 118 | ||
118 | func ::= FSYMBOL(f). { e_export_func(f.string()); f.release_this(); } | 119 | func ::= FSYMBOL(f). { e_export_func( lex, f.string()); f.release_this(); } |
119 | funcs ::= funcs func. | 120 | funcs ::= funcs func. |
120 | funcs ::= func. | 121 | funcs ::= func. |
121 | statement ::= EXPORT_FUNC funcs. | 122 | statement ::= EXPORT_FUNC funcs. |
122 | 123 | ||
123 | inherit ::= ISYMBOL(i). { e_inherit(i.string() ); i.release_this (); } | 124 | inherit ::= ISYMBOL(i). { e_inherit( lex, i.string() ); i.release_this (); } |
124 | inherits ::= inherits inherit. | 125 | inherits ::= inherits inherit. |
125 | inherits ::= inherit. | 126 | inherits ::= inherit. |
126 | statement ::= INHERIT inherits. | 127 | statement ::= INHERIT inherits. |
127 | 128 | ||
128 | statement ::= INCLUDE ISYMBOL(i). | 129 | statement ::= INCLUDE ISYMBOL(i). |
129 | { e_include(i.string() ); i.release_this(); } | 130 | { e_include( lex, i.string() ); i.release_this(); } |
130 | 131 | ||
131 | proc_body(r) ::= proc_body(l) PROC_BODY(b). | 132 | statement ::= REQUIRE ISYMBOL(i). |
133 | { e_require( lex, i.string() ); i.release_this(); } | ||
134 | |||
135 | proc_body(r) ::= proc_body(l) PROC_BODY(b). | ||
132 | { /* concatenate body lines */ | 136 | { /* concatenate body lines */ |
133 | r.assignString( token_t::concatString(l.string(), b.string()) ); | 137 | r.assignString( token_t::concatString(l.string(), b.string()) ); |
134 | l.release_this (); | 138 | l.release_this (); |
@@ -136,26 +140,26 @@ proc_body(r) ::= proc_body(l) PROC_BODY(b). | |||
136 | } | 140 | } |
137 | proc_body(b) ::= . { b.assignString(0); } | 141 | proc_body(b) ::= . { b.assignString(0); } |
138 | statement ::= variable(p) PROC_OPEN proc_body(b) PROC_CLOSE. | 142 | statement ::= variable(p) PROC_OPEN proc_body(b) PROC_CLOSE. |
139 | { e_proc( p.string(), b.string() ); | 143 | { e_proc( lex, p.string(), b.string() ); |
140 | p.release_this(); b.release_this(); } | 144 | p.release_this(); b.release_this(); } |
141 | statement ::= PYTHON SYMBOL(p) PROC_OPEN proc_body(b) PROC_CLOSE. | 145 | statement ::= PYTHON SYMBOL(p) PROC_OPEN proc_body(b) PROC_CLOSE. |
142 | { e_proc_python (p.string(), b.string() ); | 146 | { e_proc_python ( lex, p.string(), b.string() ); |
143 | p.release_this(); b.release_this(); } | 147 | p.release_this(); b.release_this(); } |
144 | statement ::= PYTHON PROC_OPEN proc_body(b) PROC_CLOSE. | 148 | statement ::= PYTHON PROC_OPEN proc_body(b) PROC_CLOSE. |
145 | { e_proc_python( NULL, b.string()); | 149 | { e_proc_python( lex, NULL, b.string()); |
146 | b.release_this (); } | 150 | b.release_this (); } |
147 | 151 | ||
148 | statement ::= FAKEROOT SYMBOL(p) PROC_OPEN proc_body(b) PROC_CLOSE. | 152 | statement ::= FAKEROOT SYMBOL(p) PROC_OPEN proc_body(b) PROC_CLOSE. |
149 | { e_proc_fakeroot(p.string(), b.string() ); | 153 | { e_proc_fakeroot( lex, p.string(), b.string() ); |
150 | p.release_this (); b.release_this (); } | 154 | p.release_this (); b.release_this (); } |
151 | 155 | ||
152 | def_body(r) ::= def_body(l) DEF_BODY(b). | 156 | def_body(r) ::= def_body(l) DEF_BODY(b). |
153 | { /* concatenate body lines */ | 157 | { /* concatenate body lines */ |
154 | r.assignString( token_t::concatString(l.string(), b.string()); | 158 | r.assignString( token_t::concatString(l.string(), b.string()) ); |
155 | l.release_this (); b.release_this (); | 159 | l.release_this (); b.release_this (); |
156 | } | 160 | } |
157 | def_body(b) ::= . { b.sz = 0; } | 161 | def_body(b) ::= . { b.assignString( 0 ); } |
158 | statement ::= SYMBOL(p) DEF_ARGS(a) def_body(b). | 162 | statement ::= SYMBOL(p) DEF_ARGS(a) def_body(b). |
159 | { e_def( p.string(), a.string(), b.string()); | 163 | { e_def( lex, p.string(), a.string(), b.string()); |
160 | p.release_this(); a.release_this(); b.release_this(); } | 164 | p.release_this(); a.release_this(); b.release_this(); } |
161 | 165 | ||