diff options
Diffstat (limited to 'bitbake/lib/bb/parse/parse_c')
-rw-r--r-- | bitbake/lib/bb/parse/parse_c/BBHandler.py | 151 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_c/Makefile | 16 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_c/bitbakec.pyx | 205 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_c/bitbakeparser.cc | 144 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_c/bitbakescanner.cc | 218 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_c/bitbakescanner.l | 30 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_c/lexer.h | 8 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_c/lexerc.h | 2 |
8 files changed, 467 insertions, 307 deletions
diff --git a/bitbake/lib/bb/parse/parse_c/BBHandler.py b/bitbake/lib/bb/parse/parse_c/BBHandler.py index d9f48db17..b430e1f4e 100644 --- a/bitbake/lib/bb/parse/parse_c/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_c/BBHandler.py @@ -5,33 +5,33 @@ Reads a .bb file and obtains its metadata (using a C++ parser) Copyright (C) 2006 Tim Robert Ansell - Copyright (C) 2006 Holger Hans Peter Freyther - + Copyright (C) 2006 Holger Hans Peter Freyther + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT - SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR - THE USE OR OTHER DEALINGS IN THE SOFTWARE. + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT + SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -import os +import os, sys # The Module we will use here import bb @@ -61,51 +61,126 @@ def supports(fn, data): return fn[-3:] == ".bb" or fn[-8:] == ".bbclass" or fn[-4:] == ".inc" or fn[-5:] == ".conf" def init(fn, data): - if not data.getVar('TOPDIR'): - bb.error('TOPDIR is not set') - if not data.getVar('BBPATH'): - bb.error('BBPATH is not set') + if not bb.data.getVar('TOPDIR', data): + bb.data.setVar('TOPDIR', os.getcwd(), data) + if not bb.data.getVar('BBPATH', data): + bb.data.setVar('BBPATH', os.path.join(sys.prefix, 'share', 'bitbake'), data) + +def handle_inherit(d): + """ + Handle inheriting of classes. This will load all default classes. + It could be faster, it could detect infinite loops but this is todo + Also this delayed loading of bb.parse could impose a penalty + """ + from bb.parse import handle + + files = (data.getVar('INHERIT', d, True) or "").split() + if not "base" in i: + files[0:0] = ["base"] + + __inherit_cache = data.getVar('__inherit_cache', d) or [] + for f in files: + file = data.expand(f, d) + if file[0] != "/" and file[-8:] != ".bbclass": + file = os.path.join('classes', '%s.bbclass' % file) + + if not file in __inherit_cache: + debug(2, "BB %s:%d: inheriting %s" % (fn, lineno, file)) + __inherit_cache.append( file ) + + try: + handle(file, d, True) + except IOError: + print "Failed to inherit %s" % file + data.setVar('__inherit_cache', __inherit_cache, d) def handle(fn, d, include): - print "" - print "fn: %s" % fn - print "data: %s" % d - print dir(d) - print d.getVar.__doc__ - print "include: %s" % include + from bb import data, parse + + (root, ext) = os.path.splitext(os.path.basename(fn)) + base_name = "%s%s" % (root,ext) + + # initialize with some data + init(fn,d) # check if we include or are the beginning + oldfile = None if include: - oldfile = d.getVar('FILE') - else: - #d.inheritFromOS() - oldfile = None + oldfile = d.getVar('FILE', False) + is_conf = False + elif ext == ".conf": + is_conf = True + data.inheritFromOS(d) # find the file if not os.path.isabs(fn): - bb.error("No Absolute FILE name") - abs_fn = bb.which(d.getVar('BBPATH'), fn) + abs_fn = bb.which(d.getVar('BBPATH', True), fn) else: abs_fn = fn # check if the file exists if not os.path.exists(abs_fn): - raise IOError("file '%(fn)' not found" % locals() ) + raise IOError("file '%(fn)s' not found" % locals() ) # now we know the file is around mark it as dep if include: parse.mark_dependency(d, abs_fn) + # manipulate the bbpath + if ext != ".bbclass" and ext != ".conf": + old_bb_path = data.getVar('BBPATH', d) + data.setVar('BBPATH', os.path.dirname(abs_fn) + (":%s" %old_bb_path) , d) + + # handle INHERITS and base inherit + if ext != ".bbclass" and ext != ".conf": + data.setVar('FILE', fn, d) + handle_interit(d) + # now parse this file - by defering it to C++ - parsefile(fn, d) + parsefile(abs_fn, d, is_conf) + + # Finish it up + if include == 0: + data.expandKeys(d) + data.update_data(d) + #### !!! XXX Finish it up by executing the anonfunc + # restore the original FILE if oldfile: d.setVar('FILE', oldfile) + # restore bbpath + if ext != ".bbclass" and ext != ".conf": + data.setVar('BBPATH', old_bb_path, d ) + + return d + +# Needed for BitBake files... +__pkgsplit_cache__={} +def vars_from_file(mypkg, d): + if not mypkg: + return (None, None, None) + if mypkg in __pkgsplit_cache__: + return __pkgsplit_cache__[mypkg] + + myfile = os.path.splitext(os.path.basename(mypkg)) + parts = myfile[0].split('_') + __pkgsplit_cache__[mypkg] = parts + exp = 3 - len(parts) + tmplist = [] + while exp != 0: + exp -= 1 + tmplist.append(None) + parts.extend(tmplist) + return parts + + + + # Inform bitbake that we are a parser # We need to define all three from bb.parse import handlers diff --git a/bitbake/lib/bb/parse/parse_c/Makefile b/bitbake/lib/bb/parse/parse_c/Makefile index 9eb7ce9d0..77daccb72 100644 --- a/bitbake/lib/bb/parse/parse_c/Makefile +++ b/bitbake/lib/bb/parse/parse_c/Makefile @@ -1,6 +1,6 @@ -test: bitbakec.so - python test.py +buil: bitbakec.so + echo "Done" bitbakescanner.cc: bitbakescanner.l flex -t bitbakescanner.l > bitbakescanner.cc @@ -28,9 +28,9 @@ bitbakec.so: bitbakec.o bitbakeparser.o bitbakescanner.o g++ -shared -fPIC bitbakeparser.o bitbakescanner.o bitbakec.o -o bitbakec.so clean: - rm *.out - rm *.cc - rm bitbakec.c - rm bitbakec-processed.c - rm *.o - rm *.so + rm -f *.out + rm -f *.cc + rm -f bitbakec.c + rm -f bitbakec-processed.c + rm -f *.o + rm -f *.so diff --git a/bitbake/lib/bb/parse/parse_c/bitbakec.pyx b/bitbake/lib/bb/parse/parse_c/bitbakec.pyx index 362cc2021..c666e9b6b 100644 --- a/bitbake/lib/bb/parse/parse_c/bitbakec.pyx +++ b/bitbake/lib/bb/parse/parse_c/bitbakec.pyx @@ -6,96 +6,107 @@ cdef extern from "stdio.h": FILE *fopen(char*, char*) int fclose(FILE *fp) +cdef extern from "string.h": + int strlen(char*) cdef extern from "lexerc.h": ctypedef struct lex_t: void* parser void* scanner + char* name FILE* file + int config void* data int lineError int errorParse - cdef extern void parse(FILE*, object) + cdef extern int parse(FILE*, char*, object, int) -def parsefile(object file, object data): - print "parsefile: 1", file, data +def parsefile(object file, object data, object config): + #print "parsefile: 1", file, data # Open the file cdef FILE* f f = fopen(file, "r") - print "parsefile: 2 opening file" + #print "parsefile: 2 opening file" if (f == NULL): raise IOError("No such file %s." % file) - print "parsefile: 3 parse" - parse(f, data) + #print "parsefile: 3 parse" + parse(f, file, data, config) # Close the file - print "parsefile: 4 closing" fclose(f) - + cdef public void e_assign(lex_t* container, char* key, char* what): - print "e_assign", key, what + #print "e_assign", key, what + if what == NULL: + print "FUTURE Warning empty string: use \"\"" + what = "" + d = <object>container.data - d.setVar(key, what) + d.setVar(key, what) cdef public void e_export(lex_t* c, char* what): - print "e_export", what + #print "e_export", what #exp: # bb.data.setVarFlag(key, "export", 1, data) - d = <object>container.data - d.setVarFlag(key, "export", 1) + d = <object>c.data + d.setVarFlag(what, "export", 1) cdef public void e_immediate(lex_t* c, char* key, char* what): - print "e_immediate", key, what + #print "e_immediate", key, what #colon: # val = bb.data.expand(groupd["value"], data) d = <object>c.data - d.setVar(key, d.expand(what)) + d.setVar(key, d.expand(what,d)) cdef public void e_cond(lex_t* c, char* key, char* what): - print "e_cond", key, what + #print "e_cond", key, what #ques: # val = bb.data.getVar(key, data) # if val == None: # val = groupd["value"] + if what == NULL: + print "FUTURE warning: Use \"\" for", key + what = "" + d = <object>c.data - d.setVar(key, (d.getVar(key) or what)) + d.setVar(key, (d.getVar(key,False) or what)) cdef public void e_prepend(lex_t* c, char* key, char* what): - print "e_prepend", key, what + #print "e_prepend", key, what #prepend: # val = "%s %s" % (groupd["value"], (bb.data.getVar(key, data) or "")) d = <object>c.data - d.setVar(key, what + " " + (d.getVar(key) or "")) + d.setVar(key, what + " " + (d.getVar(key,0) or "")) cdef public void e_append(lex_t* c, char* key, char* what): - print "e_append", key, what + #print "e_append", key, what #append: # val = "%s %s" % ((bb.data.getVar(key, data) or ""), groupd["value"]) d = <object>c.data - d.setVar(key, (d.getVar(key) or "") + " " + what) + d.setVar(key, (d.getVar(key,0) or "") + " " + what) cdef public void e_precat(lex_t* c, char* key, char* what): - print "e_precat", key, what + #print "e_precat", key, what #predot: # val = "%s%s" % (groupd["value"], (bb.data.getVar(key, data) or "")) d = <object>c.data - d.setVar(key, what + (d.getVar(key) or "")) + d.setVar(key, what + (d.getVar(key,0) or "")) cdef public void e_postcat(lex_t* c, char* key, char* what): - print "e_postcat", key, what + #print "e_postcat", key, what #postdot: # val = "%s%s" % ((bb.data.getVar(key, data) or ""), groupd["value"]) d = <object>c.data - d.setVar(key, (d.getVar(key) or "") + what) + d.setVar(key, (d.getVar(key,0) or "") + what) -cdef public void e_addtask(lex_t* c, char* name, char* before, char* after): - print "e_addtask", name, before, after +cdef public int e_addtask(lex_t* c, char* name, char* before, char* after) except -1: + #print "e_addtask", name # func = m.group("func") # before = m.group("before") # after = m.group("after") @@ -112,69 +123,131 @@ cdef public void e_addtask(lex_t* c, char* name, char* before, char* after): # # set up things that depend on this func # data.setVarFlag(var, "postdeps", before.split(), d) # return - - do = "do_%s" % name + + if c.config == 1: + from bb.parse import ParseError + raise ParseError("No tasks allowed in config files") + return -1 + d = <object>c.data + do = "do_%s" % name d.setVarFlag(do, "task", 1) - if strlen(before) > 0: + if before != NULL and strlen(before) > 0: + #print "Before", before + d.setVarFlag(do, "postdeps", ("%s" % before).split()) + if after != NULL and strlen(after) > 0: + #print "After", after d.setVarFlag(do, "deps", ("%s" % after).split()) - if strlen(after) > 0: - d.setVarFlag(do, "deps", ("%s" % before).split()) + return 0 -cdef public void e_addhandler(lex_t* c, char* h): - print "e_addhandler", h +cdef public int e_addhandler(lex_t* c, char* h) except -1: + #print "e_addhandler", h # data.setVarFlag(h, "handler", 1, d) + if c.config == 1: + from bb.parse import ParseError + raise ParseError("No handlers allowed in config files") + return -1 + d = <object>c.data d.setVarFlag(h, "handler", 1) + return 0 + +cdef public int e_export_func(lex_t* c, char* function) except -1: + #print "e_export_func", function + if c.config == 1: + from bb.parse import ParseError + raise ParseError("No functions allowed in config files") + return -1 + + return 0 + +cdef public int e_inherit(lex_t* c, char* file) except -1: + #print "e_inherit", file -cdef public void e_export_func(lex_t* c, char* function): - print "e_export_func", function - pass + if c.config == 1: + from bb.parse import ParseError + raise ParseError("No inherits allowed in config files") + return -1 -cdef public void e_inherit(lex_t* c, char* file): - print "e_inherit", file - pass + return 0 cdef public void e_include(lex_t* c, char* file): - print "e_include", file + from bb.parse import handle d = <object>c.data - d.expand(file) - + try: - parsefile(file, d) + handle(d.expand(file,d), d, True) except IOError: - print "Could not include required file %s" % file + print "Could not include file", file -cdef public void e_require(lex_t* c, char* file): - print "e_require", file +cdef public int e_require(lex_t* c, char* file) except -1: + #print "e_require", file + from bb.parse import handle d = <object>c.data - d.expand(file) - + try: - parsefile(file, d) + handle(d.expand(file,d), d, True) except IOError: - raise CParseError("Could not include required file %s" % file) + print "ParseError", file + from bb.parse import ParseError + raise ParseError("Could not include required file %s" % file) + return -1 + + return 0 + +cdef public int e_proc(lex_t* c, char* key, char* what) except -1: + #print "e_proc", key, what + if c.config == 1: + from bb.parse import ParseError + raise ParseError("No inherits allowed in config files") + return -1 + + return 0 + +cdef public int e_proc_python(lex_t* c, char* key, char* what) except -1: + #print "e_proc_python" + if c.config == 1: + from bb.parse import ParseError + raise ParseError("No pythin allowed in config files") + return -1 + + if key != NULL: + pass + #print "Key", key + if what != NULL: + pass + #print "What", what + + return 0 + +cdef public int e_proc_fakeroot(lex_t* c, char* key, char* what) except -1: + #print "e_fakeroot", key, what + + if c.config == 1: + from bb.parse import ParseError + raise ParseError("No fakeroot allowed in config files") + return -1 + + return 0 + +cdef public int e_def(lex_t* c, char* a, char* b, char* d) except -1: + #print "e_def", a, b, d -cdef public void e_proc(lex_t* c, char* key, char* what): - print "e_proc", key, what - pass + if c.config == 1: + from bb.parse import ParseError + raise ParseError("No defs allowed in config files") + return -1 -cdef public void e_proc_python(lex_t* c, char* key, char* what): - print "e_proc_python", key, what - pass + return 0 -cdef public void e_proc_fakeroot(lex_t* c, char* key, char* what): - print "e_fakeroot", key, what - pass +cdef public int e_parse_error(lex_t* c) except -1: + print "e_parse_error", c.name, "line:", lineError, "parse:", errorParse -cdef public void e_def(lex_t* c, char* a, char* b, char* d): - print "e_def", key, what - pass -cdef public void e_parse_error(lex_t* c): - print "e_parse_error", "line:", lineError, "parse:", errorParse - raise CParseError("There was an parse error, sorry unable to give more information at the current time.") + from bb.parse import ParseError + raise ParseError("There was an parse error, sorry unable to give more information at the current time. File: %s Line: %d" % (c.name,lineError) ) + return -1 diff --git a/bitbake/lib/bb/parse/parse_c/bitbakeparser.cc b/bitbake/lib/bb/parse/parse_c/bitbakeparser.cc index ee9a901b7..9d9793f8d 100644 --- a/bitbake/lib/bb/parse/parse_c/bitbakeparser.cc +++ b/bitbake/lib/bb/parse/parse_c/bitbakeparser.cc @@ -128,51 +128,49 @@ typedef union { */ static const YYACTIONTYPE yy_action[] = { /* 0 */ 82, 3, 7, 8, 38, 22, 39, 24, 26, 32, - /* 10 */ 34, 28, 30, 128, 1, 40, 53, 70, 55, 5, - /* 20 */ 60, 65, 67, 2, 21, 36, 69, 77, 9, 7, - /* 30 */ 11, 6, 13, 15, 17, 19, 12, 52, 50, 4, - /* 40 */ 74, 42, 46, 59, 57, 10, 64, 62, 38, 14, - /* 50 */ 73, 16, 38, 38, 76, 81, 18, 20, 23, 25, - /* 60 */ 27, 29, 31, 33, 35, 37, 56, 51, 90, 54, - /* 70 */ 58, 71, 41, 43, 63, 45, 44, 47, 72, 48, - /* 80 */ 75, 78, 80, 61, 90, 49, 66, 90, 90, 68, - /* 90 */ 90, 90, 90, 90, 90, 79, + /* 10 */ 34, 28, 30, 2, 21, 40, 53, 70, 55, 44, + /* 20 */ 60, 65, 67, 128, 1, 36, 69, 77, 42, 46, + /* 30 */ 11, 66, 13, 15, 17, 19, 64, 62, 9, 7, + /* 40 */ 74, 38, 45, 81, 59, 57, 38, 38, 73, 76, + /* 50 */ 5, 68, 52, 50, 14, 31, 47, 71, 48, 10, + /* 60 */ 72, 33, 23, 49, 6, 41, 51, 78, 75, 16, + /* 70 */ 4, 54, 35, 25, 18, 80, 79, 56, 27, 37, + /* 80 */ 58, 12, 61, 29, 43, 63, 20, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 0, 1, 2, 3, 23, 4, 25, 6, 7, 8, - /* 10 */ 9, 10, 11, 31, 32, 15, 16, 1, 18, 42, - /* 20 */ 20, 21, 22, 33, 34, 24, 26, 27, 1, 2, - /* 30 */ 4, 28, 6, 7, 8, 9, 5, 35, 36, 29, - /* 40 */ 24, 13, 14, 37, 38, 34, 39, 40, 23, 5, - /* 50 */ 25, 5, 23, 23, 25, 25, 5, 5, 5, 5, - /* 60 */ 5, 5, 5, 5, 5, 41, 17, 35, 43, 1, - /* 70 */ 37, 24, 12, 12, 39, 12, 14, 12, 41, 13, - /* 80 */ 41, 1, 41, 19, 43, 12, 19, 43, 43, 19, - /* 90 */ 43, 43, 43, 43, 43, 24, + /* 10 */ 9, 10, 11, 33, 34, 15, 16, 1, 18, 14, + /* 20 */ 20, 21, 22, 31, 32, 24, 26, 27, 13, 14, + /* 30 */ 4, 19, 6, 7, 8, 9, 39, 40, 1, 2, + /* 40 */ 24, 23, 12, 25, 37, 38, 23, 23, 25, 25, + /* 50 */ 42, 19, 35, 36, 5, 5, 12, 24, 13, 34, + /* 60 */ 41, 5, 5, 12, 28, 12, 35, 1, 41, 5, + /* 70 */ 29, 1, 5, 5, 5, 41, 24, 17, 5, 41, + /* 80 */ 37, 5, 19, 5, 12, 39, 5, }; #define YY_SHIFT_USE_DFLT (-20) static const signed char yy_shift_ofst[] = { - /* 0 */ -20, 0, -20, 10, -20, 3, -20, -20, 27, -20, - /* 10 */ 26, 31, -20, 44, -20, 46, -20, 51, -20, 52, - /* 20 */ -20, 1, 53, -20, 54, -20, 55, -20, 56, -20, - /* 30 */ 57, -20, 58, -20, 59, -20, -20, -19, -20, -20, - /* 40 */ 60, 28, 61, 62, 63, -20, 65, 66, 73, -20, - /* 50 */ 60, -20, -20, 68, -20, 49, -20, 49, -20, -20, - /* 60 */ 64, -20, 64, -20, -20, 67, -20, 70, -20, 16, - /* 70 */ 47, -20, 25, -20, -20, 29, -20, 80, 71, -20, - /* 80 */ 30, -20, + /* 0 */ -20, 0, -20, 41, -20, 36, -20, -20, 37, -20, + /* 10 */ 26, 76, -20, 49, -20, 64, -20, 69, -20, 81, + /* 20 */ -20, 1, 57, -20, 68, -20, 73, -20, 78, -20, + /* 30 */ 50, -20, 56, -20, 67, -20, -20, -19, -20, -20, + /* 40 */ 53, 15, 72, 5, 30, -20, 44, 45, 51, -20, + /* 50 */ 53, -20, -20, 70, -20, 60, -20, 60, -20, -20, + /* 60 */ 63, -20, 63, -20, -20, 12, -20, 32, -20, 16, + /* 70 */ 33, -20, 23, -20, -20, 24, -20, 66, 52, -20, + /* 80 */ 18, -20, }; -#define YY_REDUCE_USE_DFLT (-24) +#define YY_REDUCE_USE_DFLT (-21) static const signed char yy_reduce_ofst[] = { - /* 0 */ -18, -10, -24, -24, -23, -24, -24, -24, 11, -24, - /* 10 */ -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, - /* 20 */ -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, - /* 30 */ -24, -24, -24, -24, -24, -24, 24, -24, -24, -24, - /* 40 */ 2, -24, -24, -24, -24, -24, -24, -24, -24, -24, - /* 50 */ 32, -24, -24, -24, -24, 6, -24, 33, -24, -24, - /* 60 */ 7, -24, 35, -24, -24, -24, -24, -24, -24, -24, - /* 70 */ -24, 37, -24, -24, 39, -24, -24, -24, -24, 41, - /* 80 */ -24, -24, + /* 0 */ -8, -20, -21, -21, 8, -21, -21, -21, 25, -21, + /* 10 */ -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, + /* 20 */ -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, + /* 30 */ -21, -21, -21, -21, -21, -21, 38, -21, -21, -21, + /* 40 */ 17, -21, -21, -21, -21, -21, -21, -21, -21, -21, + /* 50 */ 31, -21, -21, -21, -21, 7, -21, 43, -21, -21, + /* 60 */ -3, -21, 46, -21, -21, -21, -21, -21, -21, -21, + /* 70 */ -21, 19, -21, -21, 27, -21, -21, -21, -21, 34, + /* 80 */ -21, -21, }; static const YYACTIONTYPE yy_default[] = { /* 0 */ 84, 127, 83, 85, 125, 126, 124, 86, 127, 85, @@ -420,7 +418,7 @@ static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ case 29: #line 50 "bitbakeparser.y" { (yypminor->yy0).release_this (); } -#line 425 "bitbakeparser.c" +#line 423 "bitbakeparser.c" break; default: break; /* If no destructor action specified: do nothing */ } @@ -694,7 +692,7 @@ static void yy_reduce( { yygotominor.yy0.assignString( (char*)yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.assignString( 0 ); yymsp[0].minor.yy0.release_this(); } -#line 699 "bitbakeparser.c" +#line 697 "bitbakeparser.c" break; case 4: #line 64 "bitbakeparser.y" @@ -702,7 +700,7 @@ static void yy_reduce( yygotominor.yy0.assignString( (char*)yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.assignString( 0 ); yymsp[0].minor.yy0.release_this(); } -#line 707 "bitbakeparser.c" +#line 705 "bitbakeparser.c" break; case 5: #line 70 "bitbakeparser.y" @@ -711,7 +709,7 @@ static void yy_reduce( yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(3,&yymsp[-3].minor); yy_destructor(4,&yymsp[-1].minor); } -#line 716 "bitbakeparser.c" +#line 714 "bitbakeparser.c" break; case 6: #line 74 "bitbakeparser.y" @@ -720,7 +718,7 @@ static void yy_reduce( yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(3,&yymsp[-3].minor); yy_destructor(6,&yymsp[-1].minor); } -#line 725 "bitbakeparser.c" +#line 723 "bitbakeparser.c" break; case 7: #line 78 "bitbakeparser.y" @@ -729,7 +727,7 @@ static void yy_reduce( yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(3,&yymsp[-3].minor); yy_destructor(7,&yymsp[-1].minor); } -#line 734 "bitbakeparser.c" +#line 732 "bitbakeparser.c" break; case 8: #line 82 "bitbakeparser.y" @@ -738,7 +736,7 @@ static void yy_reduce( yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(3,&yymsp[-3].minor); yy_destructor(8,&yymsp[-1].minor); } -#line 743 "bitbakeparser.c" +#line 741 "bitbakeparser.c" break; case 9: #line 86 "bitbakeparser.y" @@ -746,56 +744,56 @@ static void yy_reduce( yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(3,&yymsp[-3].minor); yy_destructor(9,&yymsp[-1].minor); } -#line 751 "bitbakeparser.c" +#line 749 "bitbakeparser.c" break; case 10: #line 90 "bitbakeparser.y" { e_assign( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(4,&yymsp[-1].minor); } -#line 758 "bitbakeparser.c" +#line 756 "bitbakeparser.c" break; case 11: #line 93 "bitbakeparser.y" { e_precat( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(6,&yymsp[-1].minor); } -#line 765 "bitbakeparser.c" +#line 763 "bitbakeparser.c" break; case 12: #line 96 "bitbakeparser.y" { e_postcat( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(7,&yymsp[-1].minor); } -#line 772 "bitbakeparser.c" +#line 770 "bitbakeparser.c" break; case 13: #line 99 "bitbakeparser.y" { e_prepend( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(10,&yymsp[-1].minor); } -#line 779 "bitbakeparser.c" +#line 777 "bitbakeparser.c" break; case 14: #line 102 "bitbakeparser.y" { e_append( lex, yymsp[-2].minor.yy0.string() , yymsp[0].minor.yy0.string() ); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(11,&yymsp[-1].minor); } -#line 786 "bitbakeparser.c" +#line 784 "bitbakeparser.c" break; case 15: #line 105 "bitbakeparser.y" { e_immediate( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(8,&yymsp[-1].minor); } -#line 793 "bitbakeparser.c" +#line 791 "bitbakeparser.c" break; case 16: #line 108 "bitbakeparser.y" { e_cond( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(9,&yymsp[-1].minor); } -#line 800 "bitbakeparser.c" +#line 798 "bitbakeparser.c" break; case 17: #line 112 "bitbakeparser.y" @@ -803,7 +801,7 @@ static void yy_reduce( yymsp[-4].minor.yy0.release_this(); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(13,&yymsp[-3].minor); yy_destructor(14,&yymsp[-1].minor); } -#line 808 "bitbakeparser.c" +#line 806 "bitbakeparser.c" break; case 18: #line 115 "bitbakeparser.y" @@ -811,55 +809,55 @@ static void yy_reduce( yymsp[-4].minor.yy0.release_this(); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(14,&yymsp[-3].minor); yy_destructor(13,&yymsp[-1].minor); } -#line 816 "bitbakeparser.c" +#line 814 "bitbakeparser.c" break; case 19: #line 118 "bitbakeparser.y" { e_addtask( lex, yymsp[0].minor.yy0.string(), NULL, NULL); yymsp[0].minor.yy0.release_this();} -#line 822 "bitbakeparser.c" +#line 820 "bitbakeparser.c" break; case 20: #line 121 "bitbakeparser.y" { e_addtask( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string(), NULL); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(13,&yymsp[-1].minor); } -#line 829 "bitbakeparser.c" +#line 827 "bitbakeparser.c" break; case 21: #line 124 "bitbakeparser.y" { e_addtask( lex, yymsp[-2].minor.yy0.string(), NULL, yymsp[0].minor.yy0.string()); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(14,&yymsp[-1].minor); } -#line 836 "bitbakeparser.c" +#line 834 "bitbakeparser.c" break; case 25: #line 131 "bitbakeparser.y" { e_addhandler( lex, yymsp[0].minor.yy0.string()); yymsp[0].minor.yy0.release_this (); yy_destructor(16,&yymsp[-1].minor); } -#line 842 "bitbakeparser.c" +#line 840 "bitbakeparser.c" break; case 26: #line 133 "bitbakeparser.y" { e_export_func( lex, yymsp[0].minor.yy0.string()); yymsp[0].minor.yy0.release_this(); } -#line 847 "bitbakeparser.c" +#line 845 "bitbakeparser.c" break; case 30: #line 138 "bitbakeparser.y" { e_inherit( lex, yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this (); } -#line 852 "bitbakeparser.c" +#line 850 "bitbakeparser.c" break; case 34: #line 144 "bitbakeparser.y" { e_include( lex, yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this(); yy_destructor(21,&yymsp[-1].minor); } -#line 858 "bitbakeparser.c" +#line 856 "bitbakeparser.c" break; case 35: #line 147 "bitbakeparser.y" { e_require( lex, yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this(); yy_destructor(22,&yymsp[-1].minor); } -#line 864 "bitbakeparser.c" +#line 862 "bitbakeparser.c" break; case 36: #line 150 "bitbakeparser.y" @@ -868,12 +866,12 @@ static void yy_reduce( yymsp[-1].minor.yy0.release_this (); yymsp[0].minor.yy0.release_this (); } -#line 873 "bitbakeparser.c" +#line 871 "bitbakeparser.c" break; case 37: #line 155 "bitbakeparser.y" { yygotominor.yy0.assignString(0); } -#line 878 "bitbakeparser.c" +#line 876 "bitbakeparser.c" break; case 38: #line 157 "bitbakeparser.y" @@ -881,7 +879,7 @@ static void yy_reduce( yymsp[-3].minor.yy0.release_this(); yymsp[-1].minor.yy0.release_this(); yy_destructor(24,&yymsp[-2].minor); yy_destructor(25,&yymsp[0].minor); } -#line 886 "bitbakeparser.c" +#line 884 "bitbakeparser.c" break; case 39: #line 160 "bitbakeparser.y" @@ -890,7 +888,7 @@ static void yy_reduce( yy_destructor(24,&yymsp[-2].minor); yy_destructor(25,&yymsp[0].minor); } -#line 895 "bitbakeparser.c" +#line 893 "bitbakeparser.c" break; case 40: #line 163 "bitbakeparser.y" @@ -899,7 +897,7 @@ static void yy_reduce( yy_destructor(24,&yymsp[-2].minor); yy_destructor(25,&yymsp[0].minor); } -#line 904 "bitbakeparser.c" +#line 902 "bitbakeparser.c" break; case 41: #line 167 "bitbakeparser.y" @@ -908,7 +906,7 @@ static void yy_reduce( yy_destructor(24,&yymsp[-2].minor); yy_destructor(25,&yymsp[0].minor); } -#line 913 "bitbakeparser.c" +#line 911 "bitbakeparser.c" break; case 42: #line 171 "bitbakeparser.y" @@ -916,18 +914,18 @@ static void yy_reduce( yygotominor.yy0.assignString( token_t::concatString(yymsp[-1].minor.yy0.string(), yymsp[0].minor.yy0.string()) ); yymsp[-1].minor.yy0.release_this (); yymsp[0].minor.yy0.release_this (); } -#line 921 "bitbakeparser.c" +#line 919 "bitbakeparser.c" break; case 43: #line 175 "bitbakeparser.y" { yygotominor.yy0.assignString( 0 ); } -#line 926 "bitbakeparser.c" +#line 924 "bitbakeparser.c" break; case 44: #line 177 "bitbakeparser.y" { e_def( lex, yymsp[-2].minor.yy0.string(), yymsp[-1].minor.yy0.string(), yymsp[0].minor.yy0.string()); yymsp[-2].minor.yy0.release_this(); yymsp[-1].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); } -#line 932 "bitbakeparser.c" +#line 930 "bitbakeparser.c" break; }; yygoto = yyRuleInfo[yyruleno].lhs; @@ -986,7 +984,7 @@ static void yy_syntax_error( #define TOKEN (yyminor.yy0) #line 52 "bitbakeparser.y" e_parse_error( lex ); -#line 992 "bitbakeparser.c" +#line 990 "bitbakeparser.c" bbparseARG_STORE; /* Suppress warning about unused %extra_argument variable */ } @@ -1042,7 +1040,7 @@ void bbparse( /* (re)initialize the parser, if necessary */ yypParser = (yyParser*)yyp; if( yypParser->yyidx<0 ){ - /* if( yymajor==0 ) return; // not sure why this was here... */ + if( yymajor==0 ) return; yypParser->yyidx = 0; yypParser->yyerrcnt = -1; yypParser->yystack[0].stateno = 0; diff --git a/bitbake/lib/bb/parse/parse_c/bitbakescanner.cc b/bitbake/lib/bb/parse/parse_c/bitbakescanner.cc index 43dad12d3..acc13f7c3 100644 --- a/bitbake/lib/bb/parse/parse_c/bitbakescanner.cc +++ b/bitbake/lib/bb/parse/parse_c/bitbakescanner.cc @@ -8,7 +8,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 31 +#define YY_FLEX_SUBMINOR_VERSION 33 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -30,7 +30,15 @@ /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ -#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#if __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + #include <inttypes.h> typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; @@ -153,6 +161,10 @@ int yylex_init (yyscan_t* scanner); #define YY_BUF_SIZE 16384 #endif +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; @@ -493,7 +505,7 @@ static yyconst flex_int32_t yy_ec[256] = static yyconst flex_int32_t yy_meta[59] = { 0, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, - 5, 6, 5, 5, 7, 8, 1, 7, 1, 9, + 5, 6, 5, 5, 5, 7, 1, 8, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 1, 11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, @@ -565,18 +577,18 @@ static yyconst flex_int16_t yy_base[847] = 2077, 2072, 2066, 2069, 2056, 2067, 1398, 1343, 1408, 1404, 643, 1409, 2071, 2066, 2060, 2063, 2050, 2061, 2065, 2060, 2054, 2057, 2044, 2055, 1420, 1445, 1413, 1447, 1453, 1454, - 2059, 2054, 2047, 2050, 2035, 2043, 1455, 1459, 1460, 1461, + 2059, 2053, 2047, 2049, 2032, 2043, 1455, 1459, 1460, 1461, 1462, 1463, 1471, 1436, 1430, 1192, 1433, 1479, 1482, 1492, - 1506, 1519, 1520, 1528, 2047, 2040, 2031, 0, 2034, 2019, - 2027, 1486, 1496, 1505, 1506, 1510, 1516, 1524, 2044, 2018, - 0, 0, 0, 0, 1281, 1517, 2043, 2042, 2039, 2035, - 2023, 1994, 2309, 2309, 2309, 2309, 2005, 1981, 0, 0, + 1506, 1519, 1520, 1528, 2046, 2037, 2031, 0, 2033, 2016, + 2027, 1486, 1496, 1505, 1506, 1510, 1516, 1524, 2043, 2015, + 0, 0, 0, 0, 1281, 1517, 2043, 2041, 2036, 2034, + 2024, 1995, 2309, 2309, 2309, 2309, 2005, 1981, 0, 0, 0, 0, 1538, 1528, 1530, 1534, 1537, 1540, 1981, 1957, 0, 0, 0, 0, 1557, 1558, 1559, 1560, 1561, 1563, - 1568, 1547, 1988, 1959, 1954, 1948, 1580, 1581, 1582, 1590, - 1592, 1594, 1923, 1863, 0, 0, 0, 0, 1598, 1599, - 1600, 1874, 1858, 1350, 1584, 1803, 1792, 1801, 1790, 1603, + 1568, 1547, 1988, 1959, 1955, 1948, 1580, 1581, 1582, 1590, + 1592, 1594, 1924, 1863, 0, 0, 0, 0, 1598, 1599, + 1600, 1875, 1859, 1350, 1584, 1803, 1792, 1801, 1790, 1603, 1601, 1799, 1788, 1604, 1602, 1610, 1609, 1643, 1644, 1797, 1786, 1611, 1630, 1800, 1773, 1010, 1606, 1798, 1771, 1795, @@ -593,8 +605,8 @@ static yyconst flex_int16_t yy_base[847] = 1768, 0, 742, 2309, 0, 1764, 0, 1778, 678, 1801, 0, 2309, 1835, 1847, 1859, 1871, 1883, 550, 1892, 1898, 1907, 1919, 1931, 1939, 1945, 1950, 1956, 1965, 1977, 1989, - 2001, 2013, 2025, 2033, 2039, 2042, 306, 304, 301, 2049, - 213, 2057, 136, 2065, 2073, 2081 + 2001, 2013, 2025, 2033, 2039, 2043, 306, 304, 301, 2050, + 213, 2058, 136, 2066, 2074, 2082 } ; static yyconst flex_int16_t yy_def[847] = @@ -903,14 +915,14 @@ static yyconst flex_int16_t yy_nxt[2368] = 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 155, 155, 155, 155, 155, 155, 155, - 155, 155, 155, 155, 155, 167, 167, 167, 705, 167, + 155, 155, 155, 155, 155, 167, 167, 167, 167, 705, - 167, 167, 177, 177, 704, 177, 177, 183, 701, 183, + 167, 167, 177, 177, 177, 704, 177, 183, 701, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 201, 201, 201, 201, 201, 201, 201, 201, 201, - 201, 201, 201, 209, 209, 700, 209, 209, 217, 217, - 238, 217, 217, 217, 223, 223, 238, 223, 223, 231, + 201, 201, 201, 209, 209, 209, 700, 209, 217, 217, + 238, 217, 217, 217, 223, 223, 223, 238, 223, 231, 231, 238, 231, 231, 231, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 256, @@ -919,13 +931,13 @@ static yyconst flex_int16_t yy_nxt[2368] = 256, 261, 693, 692, 261, 261, 261, 261, 261, 261, 261, 261, 261, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 267, 689, 688, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 284, 284, 687, - 284, 284, 292, 292, 292, 686, 292, 292, 292, 296, - 296, 184, 296, 418, 418, 184, 418, 418, 184, 184, - 418, 433, 433, 683, 433, 433, 682, 678, 433, 465, - 465, 677, 465, 465, 676, 675, 465, 500, 500, 674, - 500, 500, 673, 654, 500, 514, 514, 653, 514, 514, - 652, 651, 514, 650, 649, 642, 641, 640, 639, 638, + 267, 267, 267, 267, 267, 267, 267, 284, 284, 284, + 687, 284, 292, 292, 292, 292, 686, 292, 292, 296, + 184, 296, 184, 296, 418, 418, 418, 184, 418, 184, + 683, 418, 433, 433, 433, 682, 433, 678, 677, 433, + 465, 465, 465, 676, 465, 675, 674, 465, 500, 500, + 500, 673, 500, 654, 653, 500, 514, 514, 514, 652, + 514, 651, 650, 514, 649, 642, 641, 640, 639, 638, 637, 636, 635, 634, 633, 632, 631, 624, 623, 622, 621, 620, 619, 611, 610, 609, 608, 607, 606, 605, @@ -1167,14 +1179,14 @@ static yyconst flex_int16_t yy_chk[2368] = 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 817, 817, 817, 817, 817, 817, 817, - 817, 817, 817, 817, 817, 819, 819, 819, 683, 819, + 817, 817, 817, 817, 817, 819, 819, 819, 819, 683, - 819, 819, 820, 820, 682, 820, 820, 821, 674, 821, + 819, 819, 820, 820, 820, 682, 820, 821, 674, 821, 821, 821, 821, 821, 821, 821, 821, 821, 821, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 823, 823, 823, 823, 823, 823, 823, 823, 823, - 823, 823, 823, 824, 824, 673, 824, 824, 825, 825, - 666, 825, 825, 825, 826, 826, 665, 826, 826, 827, + 823, 823, 823, 824, 824, 824, 673, 824, 825, 825, + 666, 825, 825, 825, 826, 826, 826, 665, 826, 827, 827, 664, 827, 827, 827, 828, 828, 828, 828, 828, 828, 828, 828, 828, 828, 828, 828, 829, 829, 829, 829, 829, 829, 829, 829, 829, 829, 829, 829, 830, @@ -1183,13 +1195,13 @@ static yyconst flex_int16_t yy_chk[2368] = 830, 831, 650, 649, 831, 831, 831, 831, 831, 831, 831, 831, 831, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 833, 638, 637, 833, 833, - 833, 833, 833, 833, 833, 833, 833, 834, 834, 632, - 834, 834, 835, 835, 835, 631, 835, 835, 835, 836, - 836, 630, 836, 840, 840, 629, 840, 840, 628, 627, - 840, 842, 842, 620, 842, 842, 619, 611, 842, 844, - 844, 610, 844, 844, 609, 607, 844, 845, 845, 606, - 845, 845, 605, 586, 845, 846, 846, 585, 846, 846, - 584, 583, 846, 582, 581, 574, 573, 572, 571, 570, + 833, 833, 833, 833, 833, 833, 833, 834, 834, 834, + 632, 834, 835, 835, 835, 835, 631, 835, 835, 836, + 630, 836, 629, 836, 840, 840, 840, 628, 840, 627, + 620, 840, 842, 842, 842, 619, 842, 611, 610, 842, + 844, 844, 844, 609, 844, 607, 606, 844, 845, 845, + 845, 605, 845, 586, 585, 845, 846, 846, 846, 584, + 846, 583, 582, 846, 581, 574, 573, 572, 571, 570, 569, 568, 567, 566, 565, 564, 563, 556, 555, 554, 553, 552, 551, 541, 540, 539, 538, 536, 535, 534, @@ -1323,7 +1335,7 @@ int errorParse; enum { errorNone = 0, errorUnexpectedInput, - errorUnsupportedFeature, + errorUnsupportedFeature, }; } @@ -1351,7 +1363,7 @@ static const char* fixup_escapes (const char* sz); -#line 1355 "<stdout>" +#line 1367 "<stdout>" #define INITIAL 0 #define S_DEF 1 @@ -1587,11 +1599,11 @@ YY_DECL #line 164 "bitbakescanner.l" -#line 1591 "<stdout>" +#line 1603 "<stdout>" - if ( yyg->yy_init ) + if ( !yyg->yy_init ) { - yyg->yy_init = 0; + yyg->yy_init = 1; #ifdef YY_USER_INIT YY_USER_INIT; @@ -1972,7 +1984,7 @@ YY_RULE_SETUP #line 254 "bitbakescanner.l" ECHO; YY_BREAK -#line 1976 "<stdout>" +#line 1988 "<stdout>" case YY_END_OF_BUFFER: { @@ -2274,7 +2286,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) { register int yy_is_jam; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ register char *yy_cp = yyg->yy_c_buf_p; register YY_CHAR yy_c = 1; @@ -2730,10 +2742,10 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str , yyscan_t yyscanner) +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) { - return yy_scan_bytes(yy_str,strlen(yy_str) ,yyscanner); + return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will @@ -2743,7 +2755,7 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str , yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len , yyscan_t yyscanner) +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; @@ -2751,15 +2763,15 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len , yyscan_t yyscan int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; + n = _yybytes_len + 2; buf = (char *) yyalloc(n ,yyscanner ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer(buf,n ,yyscanner); if ( ! b ) @@ -2987,21 +2999,51 @@ void yyset_debug (int bdebug , yyscan_t yyscanner) /* Accessor methods for yylval and yylloc */ +/* User-visible API */ + +/* yylex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int yylex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + static int yy_init_globals (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Initialization is the same as for the non-reentrant scanner. - This function is called once per scanner lifetime. */ + * This function is called from yylex_destroy(), so don't allocate here. + */ yyg->yy_buffer_stack = 0; yyg->yy_buffer_stack_top = 0; yyg->yy_buffer_stack_max = 0; yyg->yy_c_buf_p = (char *) 0; - yyg->yy_init = 1; + yyg->yy_init = 0; yyg->yy_start = 0; + yyg->yy_start_stack_ptr = 0; yyg->yy_start_stack_depth = 0; - yyg->yy_start_stack = (int *) 0; + yyg->yy_start_stack = NULL; /* Defined in main.c */ #ifdef YY_STDINIT @@ -3018,33 +3060,6 @@ static int yy_init_globals (yyscan_t yyscanner) return 0; } -/* User-visible API */ - -/* yylex_init is special because it creates the scanner itself, so it is - * the ONLY reentrant function that doesn't take the scanner as the last argument. - * That's why we explicitly handle the declaration, instead of using our macros. - */ - -int yylex_init(yyscan_t* ptr_yy_globals) - -{ - if (ptr_yy_globals == NULL){ - errno = EINVAL; - return 1; - } - - *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); - - if (*ptr_yy_globals == NULL){ - errno = ENOMEM; - return 1; - } - - memset(*ptr_yy_globals,0,sizeof(struct yyguts_t)); - - return yy_init_globals ( *ptr_yy_globals ); -} - /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (yyscan_t yyscanner) { @@ -3065,8 +3080,13 @@ int yylex_destroy (yyscan_t yyscanner) yyfree(yyg->yy_start_stack ,yyscanner ); yyg->yy_start_stack = NULL; + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + /* Destroy the main struct (reentrant only). */ yyfree ( yyscanner , yyscanner ); + yyscanner = NULL; return 0; } @@ -3078,7 +3098,6 @@ int yylex_destroy (yyscan_t yyscanner) static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) { register int i; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -3088,7 +3107,6 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yysca static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) { register int n; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; for ( n = 0; s[n]; ++n ) ; @@ -3120,18 +3138,6 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#undef YY_NEW_FILE -#undef YY_FLUSH_BUFFER -#undef yy_set_bol -#undef yy_new_buffer -#undef yy_set_interactive -#undef yytext_ptr -#undef YY_DO_BEFORE_ACTION - -#ifdef YY_DECL_IS_OURS -#undef YY_DECL_IS_OURS -#undef YY_DECL -#endif #line 254 "bitbakescanner.l" @@ -3148,47 +3154,49 @@ void lex_t::accept (int token, const char* sz) void lex_t::input (char *buf, int *result, int max_size) { - printf("lex_t::input %p %d\n", buf, max_size); + /* printf("lex_t::input %p %d\n", buf, max_size); */ *result = fread(buf, 1, max_size, file); - printf("lex_t::input result %d\n", *result); + /* printf("lex_t::input result %d\n", *result); */ } int lex_t::line ()const { - printf("lex_t::line\n"); + /* printf("lex_t::line\n"); */ return yyget_lineno (scanner); } extern "C" { - void parse (FILE* file, PyObject* data) + void parse (FILE* file, char* name, PyObject* data, int config) { - printf("parse bbparseAlloc\n"); + /* printf("parse bbparseAlloc\n"); */ void* parser = bbparseAlloc (malloc); yyscan_t scanner; lex_t lex; - printf("parse yylex_init\n"); + /* printf("parse yylex_init\n"); */ yylex_init (&scanner); lex.parser = parser; lex.scanner = scanner; lex.file = file; + lex.name = name; lex.data = data; + lex.config = config; lex.parse = bbparse; - printf("parse yyset_extra\n"); + /*printf("parse yyset_extra\n"); */ yyset_extra (&lex, scanner); - printf("parse yylex\n"); + /* printf("parse yylex\n"); */ int result = yylex (scanner); - - printf("parse result %d\n", result); + + /* printf("parse result %d\n", result); */ lex.accept (0); - printf("parse lex.accept\n"); + /* printf("parse lex.accept\n"); */ bbparseTrace (NULL, NULL); - printf("parse bbparseTrace\n"); + /* printf("parse bbparseTrace\n"); */ if (result != T_EOF) printf ("premature end of file\n"); diff --git a/bitbake/lib/bb/parse/parse_c/bitbakescanner.l b/bitbake/lib/bb/parse/parse_c/bitbakescanner.l index f69a7325c..b6592f28e 100644 --- a/bitbake/lib/bb/parse/parse_c/bitbakescanner.l +++ b/bitbake/lib/bb/parse/parse_c/bitbakescanner.l @@ -91,7 +91,7 @@ int errorParse; enum { errorNone = 0, errorUnexpectedInput, - errorUnsupportedFeature, + errorUnsupportedFeature, }; } @@ -142,7 +142,7 @@ SSTRING \'([^\n\r]|"\\\n")*\' VALUE ([^'" \t\n])|([^'" \t\n]([^\n]|(\\\n))*[^'" \t\n]) C_SS [a-zA-Z_] -C_SB [a-zA-Z0-9_+-.] +C_SB [a-zA-Z0-9_+-./] REF $\{{C_SS}{C_SB}*\} SYMBOL {C_SS}{C_SB}* VARIABLE $?{C_SS}({C_SB}*|{REF})*(\[[a-zA-Z0-9_]*\])? @@ -265,47 +265,49 @@ void lex_t::accept (int token, const char* sz) void lex_t::input (char *buf, int *result, int max_size) { - printf("lex_t::input %p %d\n", buf, max_size); + /* printf("lex_t::input %p %d\n", buf, max_size); */ *result = fread(buf, 1, max_size, file); - printf("lex_t::input result %d\n", *result); + /* printf("lex_t::input result %d\n", *result); */ } int lex_t::line ()const { - printf("lex_t::line\n"); + /* printf("lex_t::line\n"); */ return yyget_lineno (scanner); } extern "C" { - void parse (FILE* file, PyObject* data) + void parse (FILE* file, char* name, PyObject* data, int config) { - printf("parse bbparseAlloc\n"); + /* printf("parse bbparseAlloc\n"); */ void* parser = bbparseAlloc (malloc); yyscan_t scanner; lex_t lex; - printf("parse yylex_init\n"); + /* printf("parse yylex_init\n"); */ yylex_init (&scanner); lex.parser = parser; lex.scanner = scanner; lex.file = file; + lex.name = name; lex.data = data; + lex.config = config; lex.parse = bbparse; - printf("parse yyset_extra\n"); + /*printf("parse yyset_extra\n"); */ yyset_extra (&lex, scanner); - printf("parse yylex\n"); + /* printf("parse yylex\n"); */ int result = yylex (scanner); - - printf("parse result %d\n", result); + + /* printf("parse result %d\n", result); */ lex.accept (0); - printf("parse lex.accept\n"); + /* printf("parse lex.accept\n"); */ bbparseTrace (NULL, NULL); - printf("parse bbparseTrace\n"); + /* printf("parse bbparseTrace\n"); */ if (result != T_EOF) printf ("premature end of file\n"); diff --git a/bitbake/lib/bb/parse/parse_c/lexer.h b/bitbake/lib/bb/parse/parse_c/lexer.h index 651f3a861..cb32be703 100644 --- a/bitbake/lib/bb/parse/parse_c/lexer.h +++ b/bitbake/lib/bb/parse/parse_c/lexer.h @@ -27,13 +27,15 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "Python.h" extern "C" { - + struct lex_t { void* parser; void* scanner; - FILE* file; + FILE* file; + char *name; PyObject *data; - + int config; + void* (*parse)(void*, int, token_t, lex_t*); void accept(int token, const char* sz = NULL); diff --git a/bitbake/lib/bb/parse/parse_c/lexerc.h b/bitbake/lib/bb/parse/parse_c/lexerc.h index 0163a7d63..c8a19fb22 100644 --- a/bitbake/lib/bb/parse/parse_c/lexerc.h +++ b/bitbake/lib/bb/parse/parse_c/lexerc.h @@ -11,7 +11,9 @@ typedef struct { void *parser; void *scanner; FILE *file; + char *name; PyObject *data; + int config; } lex_t; #endif |