diff options
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/BBHandler.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 9633340d1b..56d4672b0f 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py | |||
@@ -32,7 +32,7 @@ import bb.build, bb.utils | |||
32 | from bb import data | 32 | from bb import data |
33 | 33 | ||
34 | from . import ConfHandler | 34 | from . import ConfHandler |
35 | from .. import resolve_file, ast, logger | 35 | from .. import resolve_file, ast, logger, ParseError |
36 | from .ConfHandler import include, init | 36 | from .ConfHandler import include, init |
37 | 37 | ||
38 | # For compatibility | 38 | # For compatibility |
@@ -48,7 +48,7 @@ __def_regexp__ = re.compile( r"def\s+(\w+).*:" ) | |||
48 | __python_func_regexp__ = re.compile( r"(\s+.*)|(^$)" ) | 48 | __python_func_regexp__ = re.compile( r"(\s+.*)|(^$)" ) |
49 | 49 | ||
50 | 50 | ||
51 | __infunc__ = "" | 51 | __infunc__ = [] |
52 | __inpython__ = False | 52 | __inpython__ = False |
53 | __body__ = [] | 53 | __body__ = [] |
54 | __classname__ = "" | 54 | __classname__ = "" |
@@ -120,7 +120,7 @@ def get_statements(filename, absolute_filename, base_name): | |||
120 | def handle(fn, d, include): | 120 | def handle(fn, d, include): |
121 | global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__, __classname__ | 121 | global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__, __classname__ |
122 | __body__ = [] | 122 | __body__ = [] |
123 | __infunc__ = "" | 123 | __infunc__ = [] |
124 | __classname__ = "" | 124 | __classname__ = "" |
125 | __residue__ = [] | 125 | __residue__ = [] |
126 | 126 | ||
@@ -159,6 +159,11 @@ def handle(fn, d, include): | |||
159 | if include == 0: | 159 | if include == 0: |
160 | return { "" : d } | 160 | return { "" : d } |
161 | 161 | ||
162 | if __infunc__: | ||
163 | raise ParseError("Shell function %s is never closed" % __infunc__[0], __infunc__[1], __infunc__[2]) | ||
164 | if __residue__: | ||
165 | raise ParseError("Leftover unparsed (incomplete?) data %s from %s" % __residue__, fn) | ||
166 | |||
162 | if ext != ".bbclass" and include == 0: | 167 | if ext != ".bbclass" and include == 0: |
163 | return ast.multi_finalize(fn, d) | 168 | return ast.multi_finalize(fn, d) |
164 | 169 | ||
@@ -172,8 +177,8 @@ def feeder(lineno, s, fn, root, statements): | |||
172 | if __infunc__: | 177 | if __infunc__: |
173 | if s == '}': | 178 | if s == '}': |
174 | __body__.append('') | 179 | __body__.append('') |
175 | ast.handleMethod(statements, fn, lineno, __infunc__, __body__) | 180 | ast.handleMethod(statements, fn, lineno, __infunc__[0], __body__) |
176 | __infunc__ = "" | 181 | __infunc__ = [] |
177 | __body__ = [] | 182 | __body__ = [] |
178 | else: | 183 | else: |
179 | __body__.append(s) | 184 | __body__.append(s) |
@@ -217,8 +222,8 @@ def feeder(lineno, s, fn, root, statements): | |||
217 | 222 | ||
218 | m = __func_start_regexp__.match(s) | 223 | m = __func_start_regexp__.match(s) |
219 | if m: | 224 | if m: |
220 | __infunc__ = m.group("func") or "__anonymous" | 225 | __infunc__ = [m.group("func") or "__anonymous", fn, lineno] |
221 | ast.handleMethodFlags(statements, fn, lineno, __infunc__, m) | 226 | ast.handleMethodFlags(statements, fn, lineno, __infunc__[0], m) |
222 | return | 227 | return |
223 | 228 | ||
224 | m = __def_regexp__.match(s) | 229 | m = __def_regexp__.match(s) |