diff options
author | Richard Purdie <richard@openedhand.com> | 2006-03-20 17:45:11 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2006-03-20 17:45:11 +0000 |
commit | b26a945734ce271aa7d443ff9e96fe2851b21138 (patch) | |
tree | f540b8d58a7411cf0cabe5c8f4ad40f9f597352a /bitbake/lib/bb | |
parent | 3cd47ad235d54a9c539ae6fe4a5a2b4b5f7e5621 (diff) | |
download | openembedded-core-b26a945734ce271aa7d443ff9e96fe2851b21138.tar.gz openembedded-core-b26a945734ce271aa7d443ff9e96fe2851b21138.tar.bz2 openembedded-core-b26a945734ce271aa7d443ff9e96fe2851b21138.zip |
Update to latest bitbake
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@309 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/lib/bb')
24 files changed, 4720 insertions, 376 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py index dabe978bf5..c6c0beb792 100644 --- a/bitbake/lib/bb/__init__.py +++ b/bitbake/lib/bb/__init__.py @@ -23,7 +23,7 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. """ -__version__ = "1.3.3.0" +__version__ = "1.3.3.4" __all__ = [ @@ -1229,38 +1229,6 @@ class digraph: mygraph.okeys=self.okeys[:] return mygraph -####################################################################### -####################################################################### -# -# SECTION: Config -# -# PURPOSE: Reading and handling of system/target-specific/local configuration -# reading of package configuration -# -####################################################################### -####################################################################### - -def reader(cfgfile, feeder): - """Generic configuration file reader that opens a file, reads the lines, - handles continuation lines, comments, empty lines and feed all read lines - into the function feeder(lineno, line). - """ - - f = open(cfgfile,'r') - lineno = 0 - while 1: - lineno = lineno + 1 - s = f.readline() - if not s: break - w = s.strip() - if not w: continue # skip empty lines - s = s.rstrip() - if s[0] == '#': continue # skip comments - while s[-1] == '\\': - s2 = f.readline()[:-1].strip() - s = s[:-1] + s2 - feeder(lineno, s) - if __name__ == "__main__": import doctest, bb doctest.testmod(bb) diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index 599b45d9d3..b59473bc23 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py @@ -25,7 +25,7 @@ You should have received a copy of the GNU General Public License along with Based on functions from the base bb module, Copyright 2003 Holger Schurig """ -from bb import debug, data, fetch, fatal, error, note, event, mkdirhier +from bb import debug, data, fetch, fatal, error, note, event, mkdirhier, utils import bb, os # data holds flags and function name for a given task @@ -122,14 +122,15 @@ def exec_func_python(func, d): """Execute a python BB 'function'""" import re, os - tmp = "def " + func + "():\n%s" % data.getVar(func, d) - comp = compile(tmp + '\n' + func + '()', bb.data.getVar('FILE', d, 1) + ':' + func, "exec") + tmp = "def " + func + "():\n%s" % data.getVar(func, d) + tmp += '\n' + func + '()' + comp = utils.better_compile(tmp, func, bb.data.getVar('FILE', d, 1) ) prevdir = os.getcwd() g = {} # globals g['bb'] = bb g['os'] = os g['d'] = d - exec comp in g + utils.better_exec(comp,g,tmp, bb.data.getVar('FILE',d,1)) if os.path.exists(prevdir): os.chdir(prevdir) diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py index b7d707a920..56ee977f66 100644 --- a/bitbake/lib/bb/data.py +++ b/bitbake/lib/bb/data.py @@ -31,7 +31,7 @@ if sys.argv[0][-5:] == "pydoc": path = os.path.dirname(os.path.dirname(sys.argv[1])) else: path = os.path.dirname(os.path.dirname(sys.argv[0])) -sys.path.append(path) +sys.path.insert(0,path) from bb import note, debug, data_smart @@ -211,6 +211,11 @@ def delVarFlag(var, flag, d): def setVarFlags(var, flags, d): """Set the flags for a given variable + Note: + setVarFlags will not clear previous + flags. Think of this method as + addVarFlags + Example: >>> d = init() >>> myflags = {} diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 741790502f..52f391dec1 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py @@ -29,7 +29,7 @@ Based on functions from the base bb module, Copyright 2003 Holger Schurig """ import copy, os, re, sys, time, types -from bb import note, debug, fatal +from bb import note, debug, fatal, utils try: import cPickle as pickle @@ -287,8 +287,8 @@ class DataSmartPackage(DataSmart): self.unpickle_prep() funcstr = self.getVar('__functions__', 0) if funcstr: - comp = compile(funcstr, "<pickled>", "exec") - exec comp in __builtins__ + comp = utils.better_compile(funcstr, "<pickled>", self.bbfile) + utils.better_exec(comp, __builtins__, funcstr, self.bbfile) def linkDataSet(self): if not self.parent == None: diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index c4e88fa35d..cbe6d2a11a 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py @@ -25,6 +25,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA. import os, re import bb.data +import bb.utils class Event: """Base class for events""" @@ -50,8 +51,8 @@ def tmpHandler(event): return NotHandled def defaultTmpHandler(): - tmp = "def tmpHandler(e):\n\t\"\"\"heh\"\"\"\n\treturn 0" - comp = compile(tmp, "tmpHandler(e)", "exec") + tmp = "def tmpHandler(e):\n\t\"\"\"heh\"\"\"\n\treturn NotHandled" + comp = bb.utils.better_compile(tmp, "tmpHandler(e)", "bb.event.defaultTmpHandler") return comp def fire(event): @@ -71,12 +72,12 @@ def register(handler): if handler is not None: # handle string containing python code if type(handler).__name__ == "str": - return registerCode(handler) + return _registerCode(handler) # prevent duplicate registration if not handler in handlers: handlers.append(handler) -def registerCode(handlerStr): +def _registerCode(handlerStr): """Register a 'code' Event. Deprecated interface; call register instead. @@ -85,7 +86,7 @@ def registerCode(handlerStr): the code will be within a function, so should have had appropriate tabbing put in place.""" tmp = "def tmpHandler(e):\n%s" % handlerStr - comp = compile(tmp, "tmpHandler(e)", "exec") + comp = bb.utils.better_compile(tmp, "tmpHandler(e)", "bb.event._registerCode") # prevent duplicate registration if not comp in handlers: handlers.append(comp) @@ -94,16 +95,16 @@ def remove(handler): """Remove an Event handler""" for h in handlers: if type(handler).__name__ == "str": - return removeCode(handler) + return _removeCode(handler) if handler is h: handlers.remove(handler) -def removeCode(handlerStr): +def _removeCode(handlerStr): """Remove a 'code' Event handler Deprecated interface; call remove instead.""" tmp = "def tmpHandler(e):\n%s" % handlerStr - comp = compile(tmp, "tmpHandler(e)", "exec") + comp = bb.utils.better_compile(tmp, "tmpHandler(e)", "bb.event._removeCode") handlers.remove(comp) def getName(e): @@ -117,7 +118,7 @@ def getName(e): class PkgBase(Event): """Base class for package events""" - def __init__(self, t, d = {}): + def __init__(self, t, d = bb.data.init()): self._pkg = t Event.__init__(self, d) @@ -133,10 +134,11 @@ class PkgBase(Event): class BuildBase(Event): """Base class for bbmake run events""" - def __init__(self, n, p, c): + def __init__(self, n, p, c, failures = 0): self._name = n self._pkgs = p Event.__init__(self, c) + self._failures = failures def getPkgs(self): return self._pkgs @@ -156,6 +158,12 @@ class BuildBase(Event): def setCfg(self, cfg): self.data = cfg + def getFailures(self): + """ + Return the number of failed packages + """ + return self._failures + pkgs = property(getPkgs, setPkgs, None, "pkgs property") name = property(getName, setName, None, "name property") cfg = property(getCfg, setCfg, None, "cfg property") @@ -204,7 +212,43 @@ class UnsatisfiedDep(DepBase): class RecursiveDep(DepBase): """Recursive Dependency""" +class NoProvider(Event): + """No Provider for an Event""" + + def __init__(self, item, data,runtime=False): + Event.__init__(self, data) + self._item = item + self._runtime = runtime + + def getItem(self): + return self._item + + def isRuntime(self): + return self._runtime -class MultipleProviders(PkgBase): +class MultipleProviders(Event): """Multiple Providers""" + def __init__(self, item, candidates, data, runtime = False): + Event.__init__(self, data) + self._item = item + self._candidates = candidates + self._is_runtime = runtime + + def isRuntime(self): + """ + Is this a runtime issue? + """ + return self._is_runtime + + def getItem(self): + """ + The name for the to be build item + """ + return self._item + + def getCandidates(self): + """ + Get the possible Candidates for a PROVIDER. + """ + return self._candidates diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index da5b10c4b6..0515f2a5e9 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py @@ -158,18 +158,47 @@ class Fetch(object): return data.getVar("SRCDATE", d, 1) or data.getVar("CVSDATE", d, 1) or data.getVar("DATE", d, 1 ) getSRCDate = staticmethod(getSRCDate) -#if __name__ == "__main__": + def try_mirror(d, tarfn): + """ + Try to use a mirrored version of the sources. We do this + to avoid massive loads on foreign cvs and svn servers. + This method will be used by the different fetcher + implementations. + + d Is a bb.data instance + tarfn is the name of the tarball + """ + tarpath = os.path.join(data.getVar("DL_DIR", d, 1), tarfn) + if os.access(tarpath, os.R_OK): + return True + + pn = data.getVar('PN', d, True) + src_tarball_stash = None + if pn: + src_tarball_stash = (data.getVar('SRC_TARBALL_STASH_%s' % pn, d, True) or data.getVar('CVS_TARBALL_STASH_%s' % pn, d, True) or data.getVar('SRC_TARBALL_STASH', d, True) or data.getVar('CVS_TARBALL_STASH', d, True) or "").split() + + for stash in src_tarball_stash: + fetchcmd = data.getVar("FETCHCOMMAND_mirror", d, True) or data.getVar("FETCHCOMMAND_wget", d, True) + uri = stash + tarfn + bb.note("fetch " + uri) + fetchcmd = fetchcmd.replace("${URI}", uri) + ret = os.system(fetchcmd) + if ret == 0: + bb.note("Fetched %s from tarball stash, skipping checkout" % tarfn) + return True + return False + try_mirror = staticmethod(try_mirror) -import bk import cvs import git import local import svn import wget +import svk -methods.append(bk.Bk()) methods.append(cvs.Cvs()) methods.append(git.Git()) methods.append(local.Local()) methods.append(svn.Svn()) methods.append(wget.Wget()) +methods.append(svk.Svk()) diff --git a/bitbake/lib/bb/fetch/bk.py b/bitbake/lib/bb/fetch/bk.py deleted file mode 100644 index 6bd6c018fb..0000000000 --- a/bitbake/lib/bb/fetch/bk.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python -# ex:ts=4:sw=4:sts=4:et -# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- -""" -BitBake 'Fetch' implementations - -Classes for obtaining upstream sources for the -BitBake build tools. - -Copyright (C) 2003, 2004 Chris Larson - -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. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA. - -Based on functions from the base bb module, Copyright 2003 Holger Schurig -""" - -import os, re -import bb -from bb import data -from bb.fetch import Fetch - -class Bk(Fetch): - def supports(url, d): - """Check to see if a given url can be fetched via bitkeeper. - Expects supplied url in list form, as outputted by bb.decodeurl(). - """ - (type, host, path, user, pswd, parm) = bb.decodeurl(data.expand(url, d)) - return type in ['bk'] - supports = staticmethod(supports) diff --git a/bitbake/lib/bb/fetch/cvs.py b/bitbake/lib/bb/fetch/cvs.py index 461a2f50f9..10ec700dc9 100644 --- a/bitbake/lib/bb/fetch/cvs.py +++ b/bitbake/lib/bb/fetch/cvs.py @@ -133,21 +133,9 @@ class Cvs(Fetch): bb.debug(1, "%s already exists, skipping cvs checkout." % tarfn) continue - pn = data.getVar('PN', d, 1) - cvs_tarball_stash = None - if pn: - cvs_tarball_stash = data.getVar('CVS_TARBALL_STASH_%s' % pn, d, 1) - if cvs_tarball_stash == None: - cvs_tarball_stash = data.getVar('CVS_TARBALL_STASH', d, 1) - if cvs_tarball_stash: - fetchcmd = data.getVar("FETCHCOMMAND_wget", d, 1) - uri = cvs_tarball_stash + tarfn - bb.note("fetch " + uri) - fetchcmd = fetchcmd.replace("${URI}", uri) - ret = os.system(fetchcmd) - if ret == 0: - bb.note("Fetched %s from tarball stash, skipping checkout" % tarfn) - continue + # try to use the tarball stash + if Fetch.try_mirror(d, tarfn): + continue if date: options.append("-D %s" % date) @@ -194,7 +182,7 @@ class Cvs(Fetch): bb.debug(1, "Running %s" % cvscmd) myret = os.system(cvscmd) - if myret != 0: + if myret != 0 or not os.access(moddir, os.R_OK): try: os.rmdir(moddir) except OSError: diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py index 296b926392..439d522188 100644 --- a/bitbake/lib/bb/fetch/git.py +++ b/bitbake/lib/bb/fetch/git.py @@ -58,6 +58,28 @@ def gettag(parm): return tag +def getprotocol(parm): + if 'protocol' in parm: + proto = parm['protocol'] + else: + proto = "" + if not proto: + proto = "rsync" + + return proto + +def localfile(url, d): + """Return the filename to cache the checkout in""" + (type, host, path, user, pswd, parm) = bb.decodeurl(data.expand(url, d)) + + #if user sets localpath for file, use it instead. + if "localpath" in parm: + return parm["localpath"] + + tag = gettag(parm) + + return data.expand('git_%s%s_%s.tar.gz' % (host, path.replace('/', '.'), tag), d) + class Git(Fetch): """Class to fetch a module or modules from git repositories""" def supports(url, d): @@ -69,17 +91,8 @@ class Git(Fetch): supports = staticmethod(supports) def localpath(url, d): - (type, host, path, user, pswd, parm) = bb.decodeurl(data.expand(url, d)) - - #if user sets localpath for file, use it instead. - if "localpath" in parm: - return parm["localpath"] - tag = gettag(parm) - - localname = data.expand('git_%s%s_%s.tar.gz' % (host, path.replace('/', '.'), tag), d) - - return os.path.join(data.getVar("DL_DIR", d, 1),data.expand('%s' % (localname), d)) + return os.path.join(data.getVar("DL_DIR", d, 1), localfile(url, d)) localpath = staticmethod(localpath) @@ -92,10 +105,12 @@ class Git(Fetch): (type, host, path, user, pswd, parm) = bb.decodeurl(data.expand(loc, d)) tag = gettag(parm) + proto = getprotocol(parm) gitsrcname = '%s%s' % (host, path.replace('/', '.')) - repofile = os.path.join(data.getVar("DL_DIR", d, 1), 'git_%s.tar.gz' % (gitsrcname)) + repofilename = 'git_%s.tar.gz' % (gitsrcname) + repofile = os.path.join(data.getVar("DL_DIR", d, 1), repofilename) repodir = os.path.join(data.expand('${GITDIR}', d), gitsrcname) coname = '%s' % (tag) @@ -103,63 +118,37 @@ class Git(Fetch): cofile = self.localpath(loc, d) - # Always update to current if tag=="master" - #if os.access(cofile, os.R_OK) and (tag != "master"): - if os.access(cofile, os.R_OK): - bb.debug(1, "%s already exists, skipping git checkout." % cofile) + # tag=="master" must always update + if (tag != "master") and Fetch.try_mirror(d, localfile(loc, d)): + bb.debug(1, "%s already exists (or was stashed). Skipping git checkout." % cofile) continue -# Still Need to add GIT_TARBALL_STASH Support... -# pn = data.getVar('PN', d, 1) -# cvs_tarball_stash = None -# if pn: -# cvs_tarball_stash = data.getVar('CVS_TARBALL_STASH_%s' % pn, d, 1) -# if cvs_tarball_stash == None: -# cvs_tarball_stash = data.getVar('CVS_TARBALL_STASH', d, 1) -# if cvs_tarball_stash: -# fetchcmd = data.getVar("FETCHCOMMAND_wget", d, 1) -# uri = cvs_tarball_stash + tarfn -# bb.note("fetch " + uri) -# fetchcmd = fetchcmd.replace("${URI}", uri) -# ret = os.system(fetchcmd) -# if ret == 0: -# bb.note("Fetched %s from tarball stash, skipping checkout" % tarfn) -# continue - - #if os.path.exists(repodir): - #prunedir(repodir) - - bb.mkdirhier(repodir) - os.chdir(repodir) - - #print("Changing to %s" % repodir) + if not os.path.exists(repodir): + if Fetch.try_mirror(d, repofilename): + bb.mkdirhier(repodir) + os.chdir(repodir) + rungitcmd("tar -xzf %s" % (repofile),d) + else: + rungitcmd("git clone %s://%s%s %s" % (proto, host, path, repodir),d) - if os.access(repofile, os.R_OK): - rungitcmd("tar -xzf %s" % (repofile),d) - else: - rungitcmd("git clone rsync://%s%s %s" % (host, path, repodir),d) - - rungitcmd("rsync -a --verbose --stats --progress rsync://%s%s/ %s" % (host, path, os.path.join(repodir, ".git", "")),d) - - #print("Changing to %s" % repodir) os.chdir(repodir) - rungitcmd("git pull rsync://%s%s" % (host, path),d) + rungitcmd("git pull %s://%s%s" % (proto, host, path),d) + rungitcmd("git pull --tags %s://%s%s" % (proto, host, path),d) + # old method of downloading tags + #rungitcmd("rsync -a --verbose --stats --progress rsync://%s%s/ %s" % (host, path, os.path.join(repodir, ".git", "")),d) - #print("Changing to %s" % repodir) os.chdir(repodir) + bb.note("Creating tarball of git repository") rungitcmd("tar -czf %s %s" % (repofile, os.path.join(".", ".git", "*") ),d) if os.path.exists(codir): prunedir(codir) - #print("Changing to %s" % repodir) bb.mkdirhier(codir) os.chdir(repodir) rungitcmd("git read-tree %s" % (tag),d) - rungitcmd("git checkout-index -q -f --prefix=%s -a" % (os.path.join(codir, "git", "")),d) - #print("Changing to %s" % codir) os.chdir(codir) + bb.note("Creating tarball of git checkout") rungitcmd("tar -czf %s %s" % (cofile, os.path.join(".", "*") ),d) - diff --git a/bitbake/lib/bb/fetch/svn.py b/bitbake/lib/bb/fetch/svn.py index ac5eebf5c0..6e3a9277ab 100644 --- a/bitbake/lib/bb/fetch/svn.py +++ b/bitbake/lib/bb/fetch/svn.py @@ -98,20 +98,14 @@ class Svn(Fetch): date = Fetch.getSRCDate(d) - if "method" in parm: - method = parm["method"] - else: - method = "pserver" - if "proto" in parm: proto = parm["proto"] else: proto = "svn" svn_rsh = None - if method == "ext": - if "rsh" in parm: - svn_rsh = parm["rsh"] + if proto == "svn+ssh" and "rsh" in parm: + svn_rsh = parm["rsh"] tarfn = data.expand('%s_%s_%s_%s_%s.tar.gz' % (module.replace('/', '.'), host, path.replace('/', '.'), revision, date), localdata) data.setVar('TARFILES', dlfile, localdata) @@ -122,24 +116,13 @@ class Svn(Fetch): bb.debug(1, "%s already exists, skipping svn checkout." % tarfn) continue - svn_tarball_stash = data.getVar('CVS_TARBALL_STASH', d, 1) - if svn_tarball_stash: - fetchcmd = data.getVar("FETCHCOMMAND_wget", d, 1) - uri = svn_tarball_stash + tarfn - bb.note("fetch " + uri) - fetchcmd = fetchcmd.replace("${URI}", uri) - ret = os.system(fetchcmd) - if ret == 0: - bb.note("Fetched %s from tarball stash, skipping checkout" % tarfn) - continue + # try to use the tarball stash + if Fetch.try_mirror(d, tarfn): + continue olddir = os.path.abspath(os.getcwd()) os.chdir(data.expand(dldir, localdata)) -# setup svnroot -# svnroot = ":" + method + ":" + user -# if pswd: -# svnroot += ":" + pswd svnroot = host + path data.setVar('SVNROOT', svnroot, localdata) diff --git a/bitbake/lib/bb/parse/parse_c/BBHandler.py b/bitbake/lib/bb/parse/parse_c/BBHandler.py new file mode 100644 index 0000000000..300871d9e3 --- /dev/null +++ b/bitbake/lib/bb/parse/parse_c/BBHandler.py @@ -0,0 +1,65 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# Copyright (C) 2006 Holger Hans Peter Freyther +# +# 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. +# + +from bb import data +from bb.parse import ParseError + +# +# This is the Python Part of the Native Parser Implementation. +# We will only parse .bbclass, .inc and .bb files but no +# configuration files. +# supports, init and handle are the public methods used by +# parser module +# +# The rest of the methods are internal implementation details. + + + +# +# internal +# + + +# +# public +# +def supports(fn, data): + return fn[-3:] == ".bb" or fn[-8:] == ".bbclass" or fn[-4:] == ".inc" + +def init(fn, data): + print "Init" + +def handle(fn, data, include): + print "" + print "fn: %s" % fn + print "data: %s" % data + print "include: %s" % include + + pass + +# Inform bitbake that we are a parser +# We need to define all three +from bb.parse import handlers +handlers.append( {'supports' : supports, 'handle': handle, 'init' : init}) +del handlers diff --git a/bitbake/lib/bb/parse/parse_c/README.build b/bitbake/lib/bb/parse/parse_c/README.build new file mode 100644 index 0000000000..eb6ad8c862 --- /dev/null +++ b/bitbake/lib/bb/parse/parse_c/README.build @@ -0,0 +1,12 @@ +To ease portability (lemon, flex, etc) we keep the +result of flex and lemon in the source code. We agree +to not manually change the scanner and parser. + + + +How we create the files: + flex -t bitbakescanner.l > bitbakescanner.cc + lemon bitbakeparser.y + mv bitbakeparser.c bitbakeparser.cc + +Now manually create two files diff --git a/bitbake/lib/bb/parse/parse_c/__init__.py b/bitbake/lib/bb/parse/parse_c/__init__.py new file mode 100644 index 0000000000..bbb318e51f --- /dev/null +++ b/bitbake/lib/bb/parse/parse_c/__init__.py @@ -0,0 +1,28 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# Copyright (C) 2006 Holger Hans Peter Freyther +# +# 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. +# + +__version__ = '0.1' +__all__ = [ 'BBHandler' ] + +import BBHandler diff --git a/bitbake/lib/bb/parse/parse_c/bitbakeparser.cc b/bitbake/lib/bb/parse/parse_c/bitbakeparser.cc new file mode 100644 index 0000000000..3a3c53dd46 --- /dev/null +++ b/bitbake/lib/bb/parse/parse_c/bitbakeparser.cc @@ -0,0 +1,1105 @@ +/* Driver template for the LEMON parser generator. +** The author disclaims copyright to this source code. +*/ +/* First off, code is include which follows the "include" declaration +** in the input file. */ +#include <stdio.h> +#line 43 "bitbakeparser.y" + +#include "token.h" +#include "lexer.h" +#include "python_output.h" +#line 14 "bitbakeparser.c" +/* Next is all token values, in a form suitable for use by makeheaders. +** This section will be null unless lemon is run with the -m switch. +*/ +/* +** These constants (all generated automatically by the parser generator) +** specify the various kinds of tokens (terminals) that the parser +** understands. +** +** Each symbol here is a terminal symbol in the grammar. +*/ +/* Make sure the INTERFACE macro is defined. +*/ +#ifndef INTERFACE +# define INTERFACE 1 +#endif +/* The next thing included is series of defines which control +** various aspects of the generated parser. +** YYCODETYPE is the data type used for storing terminal +** and nonterminal numbers. "unsigned char" is +** used if there are fewer than 250 terminals +** and nonterminals. "int" is used otherwise. +** YYNOCODE is a number of type YYCODETYPE which corresponds +** to no legal terminal or nonterminal number. This +** number is used to fill in empty slots of the hash +** table. +** YYFALLBACK If defined, this indicates that one or more tokens +** have fall-back values which should be used if the +** original value of the token will not parse. +** YYACTIONTYPE is the data type used for storing terminal +** and nonterminal numbers. "unsigned char" is +** used if there are fewer than 250 rules and +** states combined. "int" is used otherwise. +** bbparseTOKENTYPE is the data type used for minor tokens given +** directly to the parser from the tokenizer. +** YYMINORTYPE is the data type used for all minor tokens. +** This is typically a union of many types, one of +** which is bbparseTOKENTYPE. The entry in the union +** for base tokens is called "yy0". +** YYSTACKDEPTH is the maximum depth of the parser's stack. +** bbparseARG_SDECL A static variable declaration for the %extra_argument +** bbparseARG_PDECL A parameter declaration for the %extra_argument +** bbparseARG_STORE Code to store %extra_argument into yypParser +** bbparseARG_FETCH Code to extract %extra_argument from yypParser +** YYNSTATE the combined number of states. +** YYNRULE the number of rules in the grammar +** YYERRORSYMBOL is the code number of the error symbol. If not +** defined, then do no error processing. +*/ +#define YYCODETYPE unsigned char +#define YYNOCODE 42 +#define YYACTIONTYPE unsigned char +#define bbparseTOKENTYPE token_t +typedef union { + bbparseTOKENTYPE yy0; + int yy83; +} YYMINORTYPE; +#define YYSTACKDEPTH 100 +#define bbparseARG_SDECL lex_t* lex; +#define bbparseARG_PDECL ,lex_t* lex +#define bbparseARG_FETCH lex_t* lex = yypParser->lex +#define bbparseARG_STORE yypParser->lex = lex +#define YYNSTATE 74 +#define YYNRULE 41 +#define YYERRORSYMBOL 28 +#define YYERRSYMDT yy83 +#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) +#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) +#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) + +/* Next are that tables used to determine what action to take based on the +** current state and lookahead token. These tables are used to implement +** functions that take a state number and lookahead value and return an +** action integer. +** +** Suppose the action integer is N. Then the action is determined as +** follows +** +** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** token onto the stack and goto state N. +** +** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** +** N == YYNSTATE+YYNRULE A syntax error has occurred. +** +** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** +** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused +** slots in the yy_action[] table. +** +** The action table is constructed as a single large table named yy_action[]. +** Given state S and lookahead X, the action is computed as +** +** yy_action[ yy_shift_ofst[S] + X ] +** +** If the index value yy_shift_ofst[S]+X is out of range or if the value +** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] +** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table +** and that yy_default[S] should be used instead. +** +** The formula above is for computing the action when the lookahead is +** a terminal symbol. If the lookahead is a non-terminal (as occurs after +** a reduce action) then the yy_reduce_ofst[] array is used in place of +** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of +** YY_SHIFT_USE_DFLT. +** +** The following are the tables generated in this section: +** +** yy_action[] A single table containing all actions. +** yy_lookahead[] A table containing the lookahead for each entry in +** yy_action. Used to detect hash collisions. +** yy_shift_ofst[] For each state, the offset into yy_action for +** shifting terminals. +** yy_reduce_ofst[] For each state, the offset into yy_action for +** shifting non-terminals after a reduce. +** yy_default[] Default action for each state. +*/ +static const YYACTIONTYPE yy_action[] = { + /* 0 */ 28, 47, 5, 57, 33, 58, 30, 25, 24, 37, + /* 10 */ 45, 14, 2, 29, 41, 3, 16, 4, 23, 39, + /* 20 */ 69, 8, 11, 17, 26, 48, 47, 32, 21, 42, + /* 30 */ 31, 57, 57, 73, 44, 10, 66, 7, 34, 38, + /* 40 */ 57, 51, 72, 116, 1, 62, 6, 49, 52, 35, + /* 50 */ 36, 59, 54, 9, 20, 64, 43, 22, 40, 50, + /* 60 */ 46, 71, 67, 60, 15, 65, 61, 70, 53, 56, + /* 70 */ 27, 12, 68, 63, 84, 55, 18, 84, 13, 84, + /* 80 */ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + /* 90 */ 84, 19, +}; +static const YYCODETYPE yy_lookahead[] = { + /* 0 */ 1, 2, 3, 21, 4, 23, 6, 7, 8, 9, + /* 10 */ 31, 32, 13, 14, 1, 16, 39, 18, 19, 20, + /* 20 */ 37, 38, 22, 24, 25, 1, 2, 4, 10, 6, + /* 30 */ 7, 21, 21, 23, 23, 22, 35, 36, 11, 12, + /* 40 */ 21, 5, 23, 29, 30, 33, 34, 5, 5, 10, + /* 50 */ 12, 10, 5, 22, 39, 15, 40, 11, 10, 5, + /* 60 */ 26, 17, 17, 10, 32, 35, 33, 17, 5, 5, + /* 70 */ 1, 22, 37, 1, 41, 5, 39, 41, 27, 41, + /* 80 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + /* 90 */ 41, 39, +}; +#define YY_SHIFT_USE_DFLT (-19) +#define YY_SHIFT_MAX 43 +static const signed char yy_shift_ofst[] = { + /* 0 */ -19, -1, 18, 40, 45, 24, 18, 40, 45, -19, + /* 10 */ -19, -19, -19, -19, 0, 23, -18, 13, 19, 10, + /* 20 */ 11, 27, 53, 50, 63, 64, 69, 49, 51, 72, + /* 30 */ 70, 36, 42, 43, 39, 38, 41, 47, 48, 44, + /* 40 */ 46, 31, 54, 34, +}; +#define YY_REDUCE_USE_DFLT (-24) +#define YY_REDUCE_MAX 13 +static const signed char yy_reduce_ofst[] = { + /* 0 */ 14, -21, 12, 1, -17, 32, 33, 30, 35, 37, + /* 10 */ 52, -23, 15, 16, +}; +static const YYACTIONTYPE yy_default[] = { + /* 0 */ 76, 74, 115, 115, 115, 115, 94, 99, 103, 107, + /* 10 */ 107, 107, 107, 113, 115, 115, 115, 115, 115, 115, + /* 20 */ 115, 89, 115, 115, 115, 115, 115, 115, 77, 115, + /* 30 */ 115, 115, 115, 115, 115, 90, 115, 115, 115, 115, + /* 40 */ 91, 115, 115, 114, 111, 75, 112, 78, 77, 79, + /* 50 */ 80, 81, 82, 83, 84, 85, 86, 106, 108, 87, + /* 60 */ 88, 92, 93, 95, 96, 97, 98, 100, 101, 102, + /* 70 */ 104, 105, 109, 110, +}; +#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) + +/* The next table maps tokens into fallback tokens. If a construct +** like the following: +** +** %fallback ID X Y Z. +** +** appears in the grammer, then ID becomes a fallback token for X, Y, +** and Z. Whenever one of the tokens X, Y, or Z is input to the parser +** but it does not parse, the type of the token is changed to ID and +** the parse is retried before an error is thrown. +*/ +#ifdef YYFALLBACK +static const YYCODETYPE yyFallback[] = { +}; +#endif /* YYFALLBACK */ + +/* The following structure represents a single element of the +** parser's stack. Information stored includes: +** +** + The state number for the parser at this level of the stack. +** +** + The value of the token stored at this level of the stack. +** (In other words, the "major" token.) +** +** + The semantic value stored at this level of the stack. This is +** the information used by the action routines in the grammar. +** It is sometimes called the "minor" token. +*/ +struct yyStackEntry { + int stateno; /* The state-number */ + int major; /* The major token value. This is the code + ** number for the token at this stack level */ + YYMINORTYPE minor; /* The user-supplied minor token value. This + ** is the value of the token */ +}; +typedef struct yyStackEntry yyStackEntry; + +/* The state of the parser is completely contained in an instance of +** the following structure */ +struct yyParser { + int yyidx; /* Index of top element in stack */ + int yyerrcnt; /* Shifts left before out of the error */ + bbparseARG_SDECL /* A place to hold %extra_argument */ + yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ +}; +typedef struct yyParser yyParser; + +#ifndef NDEBUG +#include <stdio.h> +static FILE *yyTraceFILE = 0; +static char *yyTracePrompt = 0; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* +** Turn parser tracing on by giving a stream to which to write the trace +** and a prompt to preface each trace message. Tracing is turned off +** by making either argument NULL +** +** Inputs: +** <ul> +** <li> A FILE* to which trace output should be written. +** If NULL, then tracing is turned off. +** <li> A prefix string written at the beginning of every +** line of trace output. If NULL, then tracing is +** turned off. +** </ul> +** +** Outputs: +** None. +*/ +void bbparseTrace(FILE *TraceFILE, char *zTracePrompt){ + yyTraceFILE = TraceFILE; + yyTracePrompt = zTracePrompt; + if( yyTraceFILE==0 ) yyTracePrompt = 0; + else if( yyTracePrompt==0 ) yyTraceFILE = 0; +} +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* For tracing shifts, the names of all terminals and nonterminals +** are required. The following table supplies these names */ +static const char *const yyTokenName[] = { + "$", "SYMBOL", "VARIABLE", "EXPORT", + "OP_ASSIGN", "STRING", "OP_IMMEDIATE", "OP_COND", + "OP_PREPEND", "OP_APPEND", "TSYMBOL", "BEFORE", + "AFTER", "ADDTASK", "ADDHANDLER", "FSYMBOL", + "EXPORT_FUNC", "ISYMBOL", "INHERIT", "INCLUDE", + "REQUIRE", "PROC_BODY", "PROC_OPEN", "PROC_CLOSE", + "PYTHON", "FAKEROOT", "DEF_BODY", "DEF_ARGS", + "error", "program", "statements", "statement", + "variable", "task", "tasks", "func", + "funcs", "inherit", "inherits", "proc_body", + "def_body", +}; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* For tracing reduce actions, the names of all rules are required. +*/ +static const char *const yyRuleName[] = { + /* 0 */ "program ::= statements", + /* 1 */ "statements ::= statements statement", + /* 2 */ "statements ::=", + /* 3 */ "variable ::= SYMBOL", + /* 4 */ "variable ::= VARIABLE", + /* 5 */ "statement ::= EXPORT variable OP_ASSIGN STRING", + /* 6 */ "statement ::= EXPORT variable OP_IMMEDIATE STRING", + /* 7 */ "statement ::= EXPORT variable OP_COND STRING", + /* 8 */ "statement ::= variable OP_ASSIGN STRING", + /* 9 */ "statement ::= variable OP_PREPEND STRING", + /* 10 */ "statement ::= variable OP_APPEND STRING", + /* 11 */ "statement ::= variable OP_IMMEDIATE STRING", + /* 12 */ "statement ::= variable OP_COND STRING", + /* 13 */ "task ::= TSYMBOL BEFORE TSYMBOL AFTER TSYMBOL", + /* 14 */ "task ::= TSYMBOL AFTER TSYMBOL BEFORE TSYMBOL", + /* 15 */ "task ::= TSYMBOL", + /* 16 */ "task ::= TSYMBOL BEFORE TSYMBOL", + /* 17 */ "task ::= TSYMBOL AFTER TSYMBOL", + /* 18 */ "tasks ::= tasks task", + /* 19 */ "tasks ::= task", + /* 20 */ "statement ::= ADDTASK tasks", + /* 21 */ "statement ::= ADDHANDLER SYMBOL", + /* 22 */ "func ::= FSYMBOL", + /* 23 */ "funcs ::= funcs func", + /* 24 */ "funcs ::= func", + /* 25 */ "statement ::= EXPORT_FUNC funcs", + /* 26 */ "inherit ::= ISYMBOL", + /* 27 */ "inherits ::= inherits inherit", + /* 28 */ "inherits ::= inherit", + /* 29 */ "statement ::= INHERIT inherits", + /* 30 */ "statement ::= INCLUDE ISYMBOL", + /* 31 */ "statement ::= REQUIRE ISYMBOL", + /* 32 */ "proc_body ::= proc_body PROC_BODY", + /* 33 */ "proc_body ::=", + /* 34 */ "statement ::= variable PROC_OPEN proc_body PROC_CLOSE", + /* 35 */ "statement ::= PYTHON SYMBOL PROC_OPEN proc_body PROC_CLOSE", + /* 36 */ "statement ::= PYTHON PROC_OPEN proc_body PROC_CLOSE", + /* 37 */ "statement ::= FAKEROOT SYMBOL PROC_OPEN proc_body PROC_CLOSE", + /* 38 */ "def_body ::= def_body DEF_BODY", + /* 39 */ "def_body ::=", + /* 40 */ "statement ::= SYMBOL DEF_ARGS def_body", +}; +#endif /* NDEBUG */ + +/* +** This function returns the symbolic name associated with a token +** value. +*/ +const char *bbparseTokenName(int tokenType){ +#ifndef NDEBUG + if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ + return yyTokenName[tokenType]; + }else{ + return "Unknown"; + } +#else + return ""; +#endif +} + +/* +** This function allocates a new parser. +** The only argument is a pointer to a function which works like +** malloc. +** +** Inputs: +** A pointer to the function used to allocate memory. +** +** Outputs: +** A pointer to a parser. This pointer is used in subsequent calls +** to bbparse and bbparseFree. +*/ +void *bbparseAlloc(void *(*mallocProc)(size_t)){ + yyParser *pParser; + pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); + if( pParser ){ + pParser->yyidx = -1; + } + return pParser; +} + +/* The following function deletes the value associated with a +** symbol. The symbol can be either a terminal or nonterminal. +** "yymajor" is the symbol code, and "yypminor" is a pointer to +** the value. +*/ +static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ + switch( yymajor ){ + /* Here is inserted the actions which take place when a + ** terminal or non-terminal is destroyed. This can happen + ** when the symbol is popped from the stack during a + ** reduce or during error processing or when a parser is + ** being destroyed before it is finished parsing. + ** + ** Note: during a reduce, the only symbols destroyed are those + ** which appear on the RHS of the rule, but which are not used + ** inside the C code. + */ + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: +#line 50 "bitbakeparser.y" +{ (yypminor->yy0).release_this (); } +#line 409 "bitbakeparser.c" + break; + default: break; /* If no destructor action specified: do nothing */ + } +} + +/* +** Pop the parser's stack once. +** +** If there is a destructor routine associated with the token which +** is popped from the stack, then call it. +** +** Return the major token number for the symbol popped. +*/ +static int yy_pop_parser_stack(yyParser *pParser){ + YYCODETYPE yymajor; + yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; + + if( pParser->yyidx<0 ) return 0; +#ifndef NDEBUG + if( yyTraceFILE && pParser->yyidx>=0 ){ + fprintf(yyTraceFILE,"%sPopping %s\n", + yyTracePrompt, + yyTokenName[yytos->major]); + } +#endif + yymajor = yytos->major; + yy_destructor( yymajor, &yytos->minor); + pParser->yyidx--; + return yymajor; +} + +/* +** Deallocate and destroy a parser. Destructors are all called for +** all stack elements before shutting the parser down. +** +** Inputs: +** <ul> +** <li> A pointer to the parser. This should be a pointer +** obtained from bbparseAlloc. +** <li> A pointer to a function used to reclaim memory obtained +** from malloc. +** </ul> +*/ +void bbparseFree( + void *p, /* The parser to be deleted */ + void (*freeProc)(void*) /* Function used to reclaim memory */ +){ + yyParser *pParser = (yyParser*)p; + if( pParser==0 ) return; + while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); + (*freeProc)((void*)pParser); +} + +/* +** Find the appropriate action for a parser given the terminal +** look-ahead token iLookAhead. +** +** If the look-ahead token is YYNOCODE, then check to see if the action is +** independent of the look-ahead. If it is, return the action, otherwise +** return YY_NO_ACTION. +*/ +static int yy_find_shift_action( + yyParser *pParser, /* The parser */ + int iLookAhead /* The look-ahead token */ +){ + int i; + int stateno = pParser->yystack[pParser->yyidx].stateno; + + if( stateno>YY_SHIFT_MAX || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){ + return yy_default[stateno]; + } + if( iLookAhead==YYNOCODE ){ + return YY_NO_ACTION; + } + i += iLookAhead; + if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ +#ifdef YYFALLBACK + int iFallback; /* Fallback token */ + if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0]) + && (iFallback = yyFallback[iLookAhead])!=0 ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n", + yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + } +#endif + return yy_find_shift_action(pParser, iFallback); + } +#endif + return yy_default[stateno]; + }else{ + return yy_action[i]; + } +} + +/* +** Find the appropriate action for a parser given the non-terminal +** look-ahead token iLookAhead. +** +** If the look-ahead token is YYNOCODE, then check to see if the action is +** independent of the look-ahead. If it is, return the action, otherwise +** return YY_NO_ACTION. +*/ +static int yy_find_reduce_action( + int stateno, /* Current state number */ + int iLookAhead /* The look-ahead token */ +){ + int i; + /* int stateno = pParser->yystack[pParser->yyidx].stateno; */ + + if( stateno>YY_REDUCE_MAX || + (i = yy_reduce_ofst[stateno])==YY_REDUCE_USE_DFLT ){ + return yy_default[stateno]; + } + if( iLookAhead==YYNOCODE ){ + return YY_NO_ACTION; + } + i += iLookAhead; + if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ + return yy_default[stateno]; + }else{ + return yy_action[i]; + } +} + +/* +** Perform a shift action. +*/ +static void yy_shift( + yyParser *yypParser, /* The parser to be shifted */ + int yyNewState, /* The new state to shift in */ + int yyMajor, /* The major token to shift in */ + YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ +){ + yyStackEntry *yytos; + yypParser->yyidx++; + if( yypParser->yyidx>=YYSTACKDEPTH ){ + bbparseARG_FETCH; + yypParser->yyidx--; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); + } +#endif + while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will execute if the parser + ** stack every overflows */ + bbparseARG_STORE; /* Suppress warning about unused %extra_argument var */ + return; + } + yytos = &yypParser->yystack[yypParser->yyidx]; + yytos->stateno = yyNewState; + yytos->major = yyMajor; + yytos->minor = *yypMinor; +#ifndef NDEBUG + if( yyTraceFILE && yypParser->yyidx>0 ){ + int i; + fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); + fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); + for(i=1; i<=yypParser->yyidx; i++) + fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); + fprintf(yyTraceFILE,"\n"); + } +#endif +} + +/* The following table contains information about every rule that +** is used during the reduce. +*/ +static const struct { + YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ + unsigned char nrhs; /* Number of right-hand side symbols in the rule */ +} yyRuleInfo[] = { + { 29, 1 }, + { 30, 2 }, + { 30, 0 }, + { 32, 1 }, + { 32, 1 }, + { 31, 4 }, + { 31, 4 }, + { 31, 4 }, + { 31, 3 }, + { 31, 3 }, + { 31, 3 }, + { 31, 3 }, + { 31, 3 }, + { 33, 5 }, + { 33, 5 }, + { 33, 1 }, + { 33, 3 }, + { 33, 3 }, + { 34, 2 }, + { 34, 1 }, + { 31, 2 }, + { 31, 2 }, + { 35, 1 }, + { 36, 2 }, + { 36, 1 }, + { 31, 2 }, + { 37, 1 }, + { 38, 2 }, + { 38, 1 }, + { 31, 2 }, + { 31, 2 }, + { 31, 2 }, + { 39, 2 }, + { 39, 0 }, + { 31, 4 }, + { 31, 5 }, + { 31, 4 }, + { 31, 5 }, + { 40, 2 }, + { 40, 0 }, + { 31, 3 }, +}; + +static void yy_accept(yyParser*); /* Forward Declaration */ + +/* +** Perform a reduce action and the shift that must immediately +** follow the reduce. +*/ +static void yy_reduce( + yyParser *yypParser, /* The parser */ + int yyruleno /* Number of the rule by which to reduce */ +){ + int yygoto; /* The next state */ + int yyact; /* The next action */ + YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ + yyStackEntry *yymsp; /* The top of the parser's stack */ + int yysize; /* Amount to pop the stack */ + bbparseARG_FETCH; + yymsp = &yypParser->yystack[yypParser->yyidx]; +#ifndef NDEBUG + if( yyTraceFILE && yyruleno>=0 + && yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){ + fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt, + yyRuleName[yyruleno]); + } +#endif /* NDEBUG */ + +#ifndef NDEBUG + /* Silence complaints from purify about yygotominor being uninitialized + ** in some cases when it is copied into the stack after the following + ** switch. yygotominor is uninitialized when a rule reduces that does + ** not set the value of its left-hand side nonterminal. Leaving the + ** value of the nonterminal uninitialized is utterly harmless as long + ** as the value is never used. So really the only thing this code + ** accomplishes is to quieten purify. + */ + memset(&yygotominor, 0, sizeof(yygotominor)); +#endif + + switch( yyruleno ){ + /* Beginning here are the reduction cases. A typical example + ** follows: + ** case 0: + ** #line <lineno> <grammarfile> + ** { ... } // User supplied code + ** #line <lineno> <thisfile> + ** break; + */ + case 3: +#line 60 "bitbakeparser.y" +{ yygotominor.yy0.assignString( (char*)yymsp[0].minor.yy0.string() ); + yymsp[0].minor.yy0.assignString( 0 ); + yymsp[0].minor.yy0.release_this(); } +#line 677 "bitbakeparser.c" + break; + case 4: +#line 64 "bitbakeparser.y" +{ + yygotominor.yy0.assignString( (char*)yymsp[0].minor.yy0.string() ); + yymsp[0].minor.yy0.assignString( 0 ); + yymsp[0].minor.yy0.release_this(); } +#line 685 "bitbakeparser.c" + break; + case 5: +#line 70 "bitbakeparser.y" +{ e_assign( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); + e_export( lex, yymsp[-2].minor.yy0.string() ); + 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 694 "bitbakeparser.c" + break; + case 6: +#line 74 "bitbakeparser.y" +{ e_immediate ( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); + e_export( lex, yymsp[-2].minor.yy0.string() ); + 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 703 "bitbakeparser.c" + break; + case 7: +#line 78 "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(3,&yymsp[-3].minor); + yy_destructor(7,&yymsp[-1].minor); +} +#line 711 "bitbakeparser.c" + break; + case 8: +#line 82 "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 718 "bitbakeparser.c" + break; + case 9: +#line 85 "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(8,&yymsp[-1].minor); +} +#line 725 "bitbakeparser.c" + break; + case 10: +#line 88 "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(9,&yymsp[-1].minor); +} +#line 732 "bitbakeparser.c" + break; + case 11: +#line 91 "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(6,&yymsp[-1].minor); +} +#line 739 "bitbakeparser.c" + break; + case 12: +#line 94 "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(7,&yymsp[-1].minor); +} +#line 746 "bitbakeparser.c" + break; + case 13: +#line 98 "bitbakeparser.y" +{ e_addtask( lex, yymsp[-4].minor.yy0.string(), yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); + yymsp[-4].minor.yy0.release_this(); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(11,&yymsp[-3].minor); + yy_destructor(12,&yymsp[-1].minor); +} +#line 754 "bitbakeparser.c" + break; + case 14: +#line 101 "bitbakeparser.y" +{ e_addtask( lex, yymsp[-4].minor.yy0.string(), yymsp[0].minor.yy0.string(), yymsp[-2].minor.yy0.string()); + yymsp[-4].minor.yy0.release_this(); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(12,&yymsp[-3].minor); + yy_destructor(11,&yymsp[-1].minor); +} +#line 762 "bitbakeparser.c" + break; + case 15: +#line 104 "bitbakeparser.y" +{ e_addtask( lex, yymsp[0].minor.yy0.string(), NULL, NULL); + yymsp[0].minor.yy0.release_this();} +#line 768 "bitbakeparser.c" + break; + case 16: +#line 107 "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(11,&yymsp[-1].minor); +} +#line 775 "bitbakeparser.c" + break; + case 17: +#line 110 "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(12,&yymsp[-1].minor); +} +#line 782 "bitbakeparser.c" + break; + case 21: +#line 117 "bitbakeparser.y" +{ e_addhandler( lex, yymsp[0].minor.yy0.string()); yymsp[0].minor.yy0.release_this (); yy_destructor(14,&yymsp[-1].minor); +} +#line 788 "bitbakeparser.c" + break; + case 22: +#line 119 "bitbakeparser.y" +{ e_export_func( lex, yymsp[0].minor.yy0.string()); yymsp[0].minor.yy0.release_this(); } +#line 793 "bitbakeparser.c" + break; + case 26: +#line 124 "bitbakeparser.y" +{ e_inherit( lex, yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this (); } +#line 798 "bitbakeparser.c" + break; + case 30: +#line 130 "bitbakeparser.y" +{ e_include( lex, yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this(); yy_destructor(19,&yymsp[-1].minor); +} +#line 804 "bitbakeparser.c" + break; + case 31: +#line 133 "bitbakeparser.y" +{ e_require( lex, yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this(); yy_destructor(20,&yymsp[-1].minor); +} +#line 810 "bitbakeparser.c" + break; + case 32: +#line 136 "bitbakeparser.y" +{ /* concatenate body lines */ + 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 819 "bitbakeparser.c" + break; + case 33: +#line 141 "bitbakeparser.y" +{ yygotominor.yy0.assignString(0); } +#line 824 "bitbakeparser.c" + break; + case 34: +#line 143 "bitbakeparser.y" +{ e_proc( lex, yymsp[-3].minor.yy0.string(), yymsp[-1].minor.yy0.string() ); + yymsp[-3].minor.yy0.release_this(); yymsp[-1].minor.yy0.release_this(); yy_destructor(22,&yymsp[-2].minor); + yy_destructor(23,&yymsp[0].minor); +} +#line 832 "bitbakeparser.c" + break; + case 35: +#line 146 "bitbakeparser.y" +{ e_proc_python ( lex, yymsp[-3].minor.yy0.string(), yymsp[-1].minor.yy0.string() ); + yymsp[-3].minor.yy0.release_this(); yymsp[-1].minor.yy0.release_this(); yy_destructor(24,&yymsp[-4].minor); + yy_destructor(22,&yymsp[-2].minor); + yy_destructor(23,&yymsp[0].minor); +} +#line 841 "bitbakeparser.c" + break; + case 36: +#line 149 "bitbakeparser.y" +{ e_proc_python( lex, NULL, yymsp[-1].minor.yy0.string()); + yymsp[-1].minor.yy0.release_this (); yy_destructor(24,&yymsp[-3].minor); + yy_destructor(22,&yymsp[-2].minor); + yy_destructor(23,&yymsp[0].minor); +} +#line 850 "bitbakeparser.c" + break; + case 37: +#line 153 "bitbakeparser.y" +{ e_proc_fakeroot( lex, yymsp[-3].minor.yy0.string(), yymsp[-1].minor.yy0.string() ); + yymsp[-3].minor.yy0.release_this (); yymsp[-1].minor.yy0.release_this (); yy_destructor(25,&yymsp[-4].minor); + yy_destructor(22,&yymsp[-2].minor); + yy_destructor(23,&yymsp[0].minor); +} +#line 859 "bitbakeparser.c" + break; + case 38: +#line 157 "bitbakeparser.y" +{ /* concatenate body lines */ + 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 867 "bitbakeparser.c" + break; + case 39: +#line 161 "bitbakeparser.y" +{ yygotominor.yy0.assignString( 0 ); } +#line 872 "bitbakeparser.c" + break; + case 40: +#line 163 "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 878 "bitbakeparser.c" + break; + }; + yygoto = yyRuleInfo[yyruleno].lhs; + yysize = yyRuleInfo[yyruleno].nrhs; + yypParser->yyidx -= yysize; + yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto); + if( yyact < YYNSTATE ){ +#ifdef NDEBUG + /* If we are not debugging and the reduce action popped at least + ** one element off the stack, then we can push the new element back + ** onto the stack here, and skip the stack overflow test in yy_shift(). + ** That gives a significant speed improvement. */ + if( yysize ){ + yypParser->yyidx++; + yymsp -= yysize-1; + yymsp->stateno = yyact; + yymsp->major = yygoto; + yymsp->minor = yygotominor; + }else +#endif + { + yy_shift(yypParser,yyact,yygoto,&yygotominor); + } + }else if( yyact == YYNSTATE + YYNRULE + 1 ){ + yy_accept(yypParser); + } +} + +/* +** The following code executes when the parse fails +*/ +static void yy_parse_failed( + yyParser *yypParser /* The parser */ +){ + bbparseARG_FETCH; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); + } +#endif + while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will be executed whenever the + ** parser fails */ + bbparseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* +** The following code executes when a syntax error first occurs. +*/ +static void yy_syntax_error( + yyParser *yypParser, /* The parser */ + int yymajor, /* The major type of the error token */ + YYMINORTYPE yyminor /* The minor type of the error token */ +){ + bbparseARG_FETCH; +#define TOKEN (yyminor.yy0) +#line 52 "bitbakeparser.y" + e_parse_error( lex ); +#line 938 "bitbakeparser.c" + bbparseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* +** The following is executed when the parser accepts +*/ +static void yy_accept( + yyParser *yypParser /* The parser */ +){ + bbparseARG_FETCH; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); + } +#endif + while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will be executed whenever the + ** parser accepts */ + bbparseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* The main parser program. +** The first argument is a pointer to a structure obtained from +** "bbparseAlloc" which describes the current state of the parser. +** The second argument is the major token number. The third is +** the minor token. The fourth optional argument is whatever the +** user wants (and specified in the grammar) and is available for +** use by the action routines. +** +** Inputs: +** <ul> +** <li> A pointer to the parser (an opaque structure.) +** <li> The major token number. +** <li> The minor token number. +** <li> An option argument of a grammar-specified type. +** </ul> +** +** Outputs: +** None. +*/ +void bbparse( + void *yyp, /* The parser */ + int yymajor, /* The major token code number */ + bbparseTOKENTYPE yyminor /* The value for the token */ + bbparseARG_PDECL /* Optional %extra_argument parameter */ +){ + YYMINORTYPE yyminorunion; + int yyact; /* The parser action. */ + int yyendofinput; /* True if we are at the end of input */ + int yyerrorhit = 0; /* True if yymajor has invoked an error */ + yyParser *yypParser; /* The parser */ + + /* (re)initialize the parser, if necessary */ + yypParser = (yyParser*)yyp; + if( yypParser->yyidx<0 ){ + /* if( yymajor==0 ) return; // not sure why this was here... */ + yypParser->yyidx = 0; + yypParser->yyerrcnt = -1; + yypParser->yystack[0].stateno = 0; + yypParser->yystack[0].major = 0; + } + yyminorunion.yy0 = yyminor; + yyendofinput = (yymajor==0); + bbparseARG_STORE; + +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); + } +#endif + + do{ + yyact = yy_find_shift_action(yypParser,yymajor); + if( yyact<YYNSTATE ){ + yy_shift(yypParser,yyact,yymajor,&yyminorunion); + yypParser->yyerrcnt--; + if( yyendofinput && yypParser->yyidx>=0 ){ + yymajor = 0; + }else{ + yymajor = YYNOCODE; + } + }else if( yyact < YYNSTATE + YYNRULE ){ + yy_reduce(yypParser,yyact-YYNSTATE); + }else if( yyact == YY_ERROR_ACTION ){ + int yymx; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); + } +#endif +#ifdef YYERRORSYMBOL + /* A syntax error has occurred. + ** The response to an error depends upon whether or not the + ** grammar defines an error token "ERROR". + ** + ** This is what we do if the grammar does define ERROR: + ** + ** * Call the %syntax_error function. + ** + ** * Begin popping the stack until we enter a state where + ** it is legal to shift the error symbol, then shift + ** the error symbol. + ** + ** * Set the error count to three. + ** + ** * Begin accepting and shifting new tokens. No new error + ** processing will occur until three tokens have been + ** shifted successfully. + ** + */ + if( yypParser->yyerrcnt<0 ){ + yy_syntax_error(yypParser,yymajor,yyminorunion); + } + yymx = yypParser->yystack[yypParser->yyidx].major; + if( yymx==YYERRORSYMBOL || yyerrorhit ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sDiscard input token %s\n", + yyTracePrompt,yyTokenName[yymajor]); + } +#endif + yy_destructor(yymajor,&yyminorunion); + yymajor = YYNOCODE; + }else{ + while( + yypParser->yyidx >= 0 && + yymx != YYERRORSYMBOL && + (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE + ){ + yy_pop_parser_stack(yypParser); + } + if( yypParser->yyidx < 0 || yymajor==0 ){ + yy_destructor(yymajor,&yyminorunion); + yy_parse_failed(yypParser); + yymajor = YYNOCODE; + }else if( yymx!=YYERRORSYMBOL ){ + YYMINORTYPE u2; + u2.YYERRSYMDT = 0; + yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); + } + } + yypParser->yyerrcnt = 3; + yyerrorhit = 1; +#else /* YYERRORSYMBOL is not defined */ + /* This is what we do if the grammar does not define ERROR: + ** + ** * Report an error message, and throw away the input token. + ** + ** * If the input token is $, then fail the parse. + ** + ** As before, subsequent error messages are suppressed until + ** three input tokens have been successfully shifted. + */ + if( yypParser->yyerrcnt<=0 ){ + yy_syntax_error(yypParser,yymajor,yyminorunion); + } + yypParser->yyerrcnt = 3; + yy_destructor(yymajor,&yyminorunion); + if( yyendofinput ){ + yy_parse_failed(yypParser); + } + yymajor = YYNOCODE; +#endif + }else{ + yy_accept(yypParser); + yymajor = YYNOCODE; + } + }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); + return; +} diff --git a/bitbake/lib/bb/parse/parse_c/bitbakeparser.h b/bitbake/lib/bb/parse/parse_c/bitbakeparser.h new file mode 100644 index 0000000000..2e51702be8 --- /dev/null +++ b/bitbake/lib/bb/parse/parse_c/bitbakeparser.h @@ -0,0 +1,27 @@ +#define T_SYMBOL 1 +#define T_VARIABLE 2 +#define T_EXPORT 3 +#define T_OP_ASSIGN 4 +#define T_STRING 5 +#define T_OP_IMMEDIATE 6 +#define T_OP_COND 7 +#define T_OP_PREPEND 8 +#define T_OP_APPEND 9 +#define T_TSYMBOL 10 +#define T_BEFORE 11 +#define T_AFTER 12 +#define T_ADDTASK 13 +#define T_ADDHANDLER 14 +#define T_FSYMBOL 15 +#define T_EXPORT_FUNC 16 +#define T_ISYMBOL 17 +#define T_INHERIT 18 +#define T_INCLUDE 19 +#define T_REQUIRE 20 +#define T_PROC_BODY 21 +#define T_PROC_OPEN 22 +#define T_PROC_CLOSE 23 +#define T_PYTHON 24 +#define T_FAKEROOT 25 +#define T_DEF_BODY 26 +#define T_DEF_ARGS 27 diff --git a/bitbake/lib/bb/parse/parse_c/bitbakeparser.py b/bitbake/lib/bb/parse/parse_c/bitbakeparser.py deleted file mode 100644 index ed7b13eef9..0000000000 --- a/bitbake/lib/bb/parse/parse_c/bitbakeparser.py +++ /dev/null @@ -1,133 +0,0 @@ -""" - -BitBake C Parser Python Code - -Copyright (C) 2005 Holger Hans Peter Freyther - -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. -""" - -__version__ = "0xdeadbeef" - -class CParser: - """ - The C-based Parser for Bitbake - """ - def __init__(self, data, type): - """ - Constructor - """ - self._data = data - - def _syntax_error(self, file, line): - """ - lemon/flex reports an syntax error to us and we will - raise an exception - """ - pass - - def _export(self, data): - """ - EXPORT VAR = "MOO" - we will now export VAR - """ - pass - - def _assign(self, key, value): - """ - VAR = "MOO" - we will assign moo to VAR - """ - pass - - def _assign(self, key, value): - """ - """ - pass - - def _append(self, key, value): - """ - VAR += "MOO" - we will append " MOO" to var - """ - pass - - def _prepend(self, key, value): - """ - VAR =+ "MOO" - we will prepend "MOO " to var - """ - pass - - def _immediate(self, key, value): - """ - VAR := "MOO ${CVSDATE}" - we will assign immediately and expand vars - """ - pass - - def _conditional(self, key, value): - """ - """ - pass - - def _add_task(self, task, before = None, after = None): - """ - """ - pass - - def _include(self, file): - """ - """ - pass - - def _inherit(self, file): - """ - """ - pass - - def _shell_procedure(self, name, body): - """ - """ - pass - - def _python_procedure(self, name, body): - """ - """ - pass - - def _fakeroot_procedure(self, name, body): - """ - """ - pass - - def _def_procedure(self, a, b, c): - """ - """ - pass - - def _export_func(self, name): - """ - """ - pass - - def _add_handler(self, handler): - """ - """ - pass 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 @@ %include { #include "token.h" +#include "lexer.h" +#include "python_output.h" } %token_destructor { $$.release_this (); } -%syntax_error { printf ("%s:%d: syntax error\n", - lex->filename (), lex->line ()); } +%syntax_error { e_parse_error( lex ); } program ::= statements. @@ -56,79 +57,82 @@ statements ::= statements statement. statements ::= . variable(r) ::= SYMBOL(s). - { r.assignString( s.string() ); + { r.assignString( (char*)s.string() ); s.assignString( 0 ); s.release_this(); } variable(r) ::= VARIABLE(v). { - r.assignString( v.string() ); + r.assignString( (char*)v.string() ); v.assignString( 0 ); v.release_this(); } statement ::= EXPORT variable(s) OP_ASSIGN STRING(v). - { e_assign( s.string(), v.string() ); - e_export( s.string() ); + { e_assign( lex, s.string(), v.string() ); + e_export( lex, s.string() ); s.release_this(); v.release_this(); } statement ::= EXPORT variable(s) OP_IMMEDIATE STRING(v). - { e_immediate (s.string(), v.string() ); - e_export( s.string() ); + { e_immediate ( lex, s.string(), v.string() ); + e_export( lex, s.string() ); s.release_this(); v.release_this(); } statement ::= EXPORT variable(s) OP_COND STRING(v). - { e_cond( s.string(), v.string() ); + { e_cond( lex, s.string(), v.string() ); s.release_this(); v.release_this(); } statement ::= variable(s) OP_ASSIGN STRING(v). - { e_assign( s.string(), v.string() ); + { e_assign( lex, s.string(), v.string() ); s.release_this(); v.release_this(); } statement ::= variable(s) OP_PREPEND STRING(v). - { e_prepend( s.string(), v.string() ); + { e_prepend( lex, s.string(), v.string() ); s.release_this(); v.release_this(); } statement ::= variable(s) OP_APPEND STRING(v). - { e_append( s.string() , v.string() ); + { e_append( lex, s.string() , v.string() ); s.release_this(); v.release_this(); } statement ::= variable(s) OP_IMMEDIATE STRING(v). - { e_immediate( s.string(), v.string() ); + { e_immediate( lex, s.string(), v.string() ); s.release_this(); v.release_this(); } statement ::= variable(s) OP_COND STRING(v). - { e_cond( s.string(), v.string() ); + { e_cond( lex, s.string(), v.string() ); s.release_this(); v.release_this(); } task ::= TSYMBOL(t) BEFORE TSYMBOL(b) AFTER TSYMBOL(a). - { e_addtask( t.string(), b.string(), a.string() ); + { e_addtask( lex, t.string(), b.string(), a.string() ); t.release_this(); b.release_this(); a.release_this(); } task ::= TSYMBOL(t) AFTER TSYMBOL(a) BEFORE TSYMBOL(b). - { e_addtask( t.string(), b.string(), a.string()); + { e_addtask( lex, t.string(), b.string(), a.string()); t.release_this(); a.release_this(); b.release_this(); } task ::= TSYMBOL(t). - { e_addtask( t.string(), NULL, NULL); + { e_addtask( lex, t.string(), NULL, NULL); t.release_this();} task ::= TSYMBOL(t) BEFORE TSYMBOL(b). - { e_addtask( t.string(), b.string(), NULL); + { e_addtask( lex, t.string(), b.string(), NULL); t.release_this(); b.release_this(); } task ::= TSYMBOL(t) AFTER TSYMBOL(a). - { e_addtask( t.string(), NULL, a.string()); + { e_addtask( lex, t.string(), NULL, a.string()); t.release_this(); a.release_this(); } tasks ::= tasks task. tasks ::= task. statement ::= ADDTASK tasks. statement ::= ADDHANDLER SYMBOL(s). - { e_addhandler( s.string()); s.release_this (); } + { e_addhandler( lex, s.string()); s.release_this (); } -func ::= FSYMBOL(f). { e_export_func(f.string()); f.release_this(); } +func ::= FSYMBOL(f). { e_export_func( lex, f.string()); f.release_this(); } funcs ::= funcs func. funcs ::= func. statement ::= EXPORT_FUNC funcs. -inherit ::= ISYMBOL(i). { e_inherit(i.string() ); i.release_this (); } +inherit ::= ISYMBOL(i). { e_inherit( lex, i.string() ); i.release_this (); } inherits ::= inherits inherit. inherits ::= inherit. statement ::= INHERIT inherits. statement ::= INCLUDE ISYMBOL(i). - { e_include(i.string() ); i.release_this(); } + { e_include( lex, i.string() ); i.release_this(); } -proc_body(r) ::= proc_body(l) PROC_BODY(b). +statement ::= REQUIRE ISYMBOL(i). + { e_require( lex, i.string() ); i.release_this(); } + +proc_body(r) ::= proc_body(l) PROC_BODY(b). { /* concatenate body lines */ r.assignString( token_t::concatString(l.string(), b.string()) ); l.release_this (); @@ -136,26 +140,26 @@ proc_body(r) ::= proc_body(l) PROC_BODY(b). } proc_body(b) ::= . { b.assignString(0); } statement ::= variable(p) PROC_OPEN proc_body(b) PROC_CLOSE. - { e_proc( p.string(), b.string() ); + { e_proc( lex, p.string(), b.string() ); p.release_this(); b.release_this(); } statement ::= PYTHON SYMBOL(p) PROC_OPEN proc_body(b) PROC_CLOSE. - { e_proc_python (p.string(), b.string() ); + { e_proc_python ( lex, p.string(), b.string() ); p.release_this(); b.release_this(); } statement ::= PYTHON PROC_OPEN proc_body(b) PROC_CLOSE. - { e_proc_python( NULL, b.string()); + { e_proc_python( lex, NULL, b.string()); b.release_this (); } statement ::= FAKEROOT SYMBOL(p) PROC_OPEN proc_body(b) PROC_CLOSE. - { e_proc_fakeroot(p.string(), b.string() ); + { e_proc_fakeroot( lex, p.string(), b.string() ); p.release_this (); b.release_this (); } def_body(r) ::= def_body(l) DEF_BODY(b). { /* concatenate body lines */ - r.assignString( token_t::concatString(l.string(), b.string()); + r.assignString( token_t::concatString(l.string(), b.string()) ); l.release_this (); b.release_this (); } -def_body(b) ::= . { b.sz = 0; } +def_body(b) ::= . { b.assignString( 0 ); } statement ::= SYMBOL(p) DEF_ARGS(a) def_body(b). - { e_def( p.string(), a.string(), b.string()); + { e_def( lex, p.string(), a.string(), b.string()); p.release_this(); a.release_this(); b.release_this(); } diff --git a/bitbake/lib/bb/parse/parse_c/bitbakescanner.cc b/bitbake/lib/bb/parse/parse_c/bitbakescanner.cc new file mode 100644 index 0000000000..8e95fd97c8 --- /dev/null +++ b/bitbake/lib/bb/parse/parse_c/bitbakescanner.cc @@ -0,0 +1,3126 @@ + +#line 3 "<stdout>" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 31 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +int yylex_init (yyscan_t* scanner); + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ,yyscanner ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires + * access to the local variable yy_act. Since yyless() is a macro, it would break + * existing scanners that call yyless() from OUTSIDE yylex. + * One obvious solution it to make yy_act a global. I tried that, and saw + * a 5% performance hit in a non-yylineno scanner, because yy_act is + * normally declared as a register variable-- so it is not worth it. + */ + #define YY_LESS_LINENO(n) \ + do { \ + int yyl;\ + for ( yyl = n; yyl < yyleng; ++yyl )\ + if ( yytext[yyl] == '\n' )\ + --yylineno;\ + }while(0) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef unsigned int yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void yyrestart (FILE *input_file ,yyscan_t yyscanner ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void yypop_buffer_state (yyscan_t yyscanner ); + +static void yyensure_buffer_stack (yyscan_t yyscanner ); +static void yy_load_buffer_state (yyscan_t yyscanner ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); + +void *yyalloc (yy_size_t ,yyscan_t yyscanner ); +void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); +void yyfree (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define yywrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 45 +#define YY_END_OF_BUFFER 46 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[798] = + { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 24, 24, 0, 0, + 0, 0, 46, 44, 43, 43, 44, 44, 44, 44, + 44, 4, 44, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 26, 26, 26, 26, 26, 26, 44, 43, + 28, 43, 44, 44, 44, 27, 4, 44, 44, 44, + 44, 44, 44, 31, 31, 30, 31, 31, 31, 31, + 31, 4, 31, 31, 31, 31, 31, 31, 41, 36, + 36, 36, 36, 36, 36, 44, 38, 38, 38, 38, + 38, 38, 42, 37, 37, 37, 37, 37, 37, 44, + + 39, 39, 39, 39, 39, 39, 24, 24, 24, 24, + 24, 24, 24, 4, 24, 24, 24, 24, 24, 24, + 23, 9, 43, 10, 9, 44, 9, 44, 9, 9, + 9, 4, 9, 9, 9, 9, 9, 9, 9, 40, + 35, 35, 35, 35, 35, 35, 35, 0, 32, 34, + 0, 0, 1, 3, 2, 5, 0, 33, 0, 33, + 33, 33, 33, 33, 33, 33, 33, 26, 26, 26, + 26, 26, 26, 0, 27, 0, 28, 0, 27, 0, + 0, 1, 2, 5, 0, 0, 0, 0, 0, 0, + 0, 29, 0, 0, 0, 0, 0, 36, 36, 36, + + 36, 36, 36, 0, 0, 38, 38, 38, 38, 38, + 38, 37, 37, 37, 37, 37, 37, 0, 0, 39, + 39, 39, 39, 39, 39, 24, 24, 24, 24, 24, + 24, 1, 3, 2, 5, 24, 24, 24, 24, 24, + 23, 23, 9, 0, 9, 0, 10, 0, 7, 0, + 9, 0, 9, 0, 8, 0, 0, 9, 1, 3, + 2, 5, 9, 6, 9, 9, 9, 9, 35, 35, + 35, 35, 35, 35, 35, 35, 34, 0, 22, 0, + 0, 34, 33, 33, 25, 33, 33, 33, 33, 33, + 33, 26, 26, 25, 26, 26, 26, 0, 22, 0, + + 0, 25, 0, 0, 0, 0, 0, 25, 0, 0, + 0, 36, 36, 25, 36, 36, 36, 0, 0, 38, + 38, 25, 38, 38, 38, 37, 37, 25, 37, 37, + 37, 0, 0, 39, 39, 25, 39, 39, 39, 24, + 22, 24, 24, 24, 24, 24, 24, 32, 0, 9, + 9, 6, 9, 9, 9, 9, 9, 35, 35, 35, + 35, 25, 35, 35, 35, 22, 22, 0, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 26, 26, 26, + 26, 26, 26, 22, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 36, 36, 36, 36, + + 36, 36, 0, 38, 0, 38, 38, 38, 38, 38, + 38, 37, 37, 37, 37, 37, 37, 0, 39, 0, + 39, 39, 39, 39, 39, 39, 22, 22, 24, 24, + 24, 24, 24, 24, 22, 9, 9, 9, 9, 9, + 9, 35, 35, 35, 35, 35, 35, 35, 35, 0, + 34, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 26, 26, 26, 26, 26, 26, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 36, 36, + 36, 36, 36, 36, 0, 38, 38, 38, 38, 38, + 38, 38, 37, 37, 37, 37, 37, 37, 0, 39, + + 39, 39, 39, 39, 39, 39, 24, 24, 24, 24, + 24, 24, 9, 9, 9, 9, 9, 9, 35, 35, + 35, 18, 35, 35, 35, 35, 33, 33, 33, 19, + 33, 33, 33, 21, 33, 26, 26, 26, 26, 26, + 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 36, 36, 36, 36, 36, 36, 38, + 38, 38, 38, 38, 38, 37, 37, 37, 37, 37, + 37, 39, 39, 39, 39, 39, 39, 24, 24, 24, + 24, 24, 24, 9, 9, 9, 9, 9, 9, 35, + 35, 35, 17, 35, 35, 35, 33, 33, 14, 33, + + 11, 13, 12, 26, 26, 14, 11, 13, 12, 0, + 0, 14, 11, 13, 12, 0, 0, 14, 11, 13, + 12, 36, 36, 14, 11, 13, 12, 38, 38, 14, + 11, 13, 12, 37, 37, 14, 11, 13, 12, 39, + 39, 14, 11, 13, 12, 24, 24, 14, 11, 13, + 12, 9, 9, 9, 9, 9, 9, 35, 35, 14, + 11, 13, 12, 33, 33, 20, 26, 26, 0, 0, + 0, 0, 36, 36, 38, 38, 37, 37, 39, 39, + 24, 24, 9, 9, 35, 35, 33, 33, 26, 26, + 0, 0, 0, 0, 36, 36, 38, 38, 37, 37, + + 39, 39, 24, 24, 9, 9, 35, 35, 33, 15, + 26, 15, 0, 15, 0, 15, 36, 15, 38, 15, + 37, 15, 39, 15, 24, 15, 9, 9, 35, 15, + 33, 26, 0, 0, 36, 38, 37, 39, 24, 9, + 35, 33, 26, 0, 0, 36, 38, 37, 39, 24, + 9, 35, 33, 26, 0, 0, 36, 38, 37, 39, + 24, 9, 35, 33, 26, 0, 0, 36, 38, 37, + 39, 24, 9, 35, 33, 26, 0, 0, 36, 38, + 37, 39, 24, 9, 35, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 9, 16, 0 + + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 5, 6, 7, 1, 1, 8, 9, + 10, 1, 11, 12, 13, 14, 15, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 17, 1, 1, + 18, 1, 19, 1, 20, 20, 21, 20, 22, 23, + 20, 20, 24, 20, 20, 20, 20, 25, 26, 27, + 20, 28, 29, 30, 31, 20, 20, 32, 20, 20, + 33, 34, 35, 1, 36, 1, 37, 38, 39, 40, + + 41, 42, 20, 43, 44, 20, 45, 46, 20, 47, + 48, 49, 50, 51, 52, 53, 54, 20, 20, 55, + 56, 20, 57, 1, 58, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +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, 1, 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, + 9, 9, 9, 9, 9, 9, 1, 12 + } ; + +static yyconst flex_int16_t yy_base[832] = + { 0, + 0, 0, 58, 0, 115, 165, 215, 265, 316, 0, + 374, 0, 432, 0, 490, 0, 547, 604, 661, 711, + 762, 0, 2156, 2157, 2157, 2157, 2152, 0, 118, 2136, + 2135, 2141, 2133, 115, 118, 116, 120, 124, 140, 131, + 129, 139, 0, 2118, 2109, 2107, 2100, 2105, 2128, 127, + 2157, 2127, 137, 179, 124, 2125, 128, 173, 126, 146, + 153, 118, 158, 2157, 190, 2157, 2157, 2139, 193, 2123, + 2122, 2128, 2120, 2105, 2096, 2094, 2087, 2092, 2157, 0, + 2100, 2091, 2089, 2082, 2087, 2070, 2119, 181, 190, 194, + 153, 197, 2157, 0, 2093, 2084, 2082, 2075, 2080, 2063, + + 2112, 191, 199, 200, 201, 203, 2115, 2114, 2113, 2112, + 212, 209, 222, 217, 228, 226, 233, 208, 239, 240, + 248, 255, 251, 2111, 270, 251, 552, 254, 565, 575, + 577, 622, 627, 626, 634, 612, 669, 684, 691, 2157, + 0, 2081, 205, 2071, 2070, 2063, 2068, 2105, 2157, 257, + 289, 559, 2157, 2157, 2157, 2157, 2050, 263, 2071, 270, + 273, 555, 545, 556, 642, 585, 569, 0, 2078, 2064, + 2061, 222, 2052, 2084, 2157, 290, 2157, 291, 2097, 674, + 680, 2082, 2081, 2080, 283, 564, 554, 608, 262, 2093, + 312, 2157, 2068, 2054, 2051, 529, 2042, 0, 2064, 2050, + + 2047, 611, 2038, 0, 2030, 2079, 646, 650, 652, 695, + 593, 0, 2058, 2044, 2041, 661, 2032, 0, 2024, 2073, + 680, 681, 699, 701, 702, 2076, 2075, 2074, 2073, 733, + 819, 2072, 2071, 2070, 2069, 720, 600, 708, 820, 821, + 724, 2068, 823, 824, 831, 751, 2067, 822, 830, 835, + 839, 843, 847, 845, 846, 858, 880, 870, 881, 889, + 891, 898, 903, 2067, 905, 914, 916, 926, 0, 2041, + 2027, 2013, 2023, 2022, 703, 2013, 902, 841, 754, 0, + 2027, 2157, 910, 919, 905, 913, 933, 934, 937, 940, + 935, 2035, 258, 0, 2014, 2018, 2004, 947, 979, 732, + + 934, 2040, 912, 843, 707, 2030, 910, 2157, 2009, 2013, + 1999, 2026, 922, 0, 2005, 2009, 1995, 1990, 0, 861, + 926, 2040, 855, 947, 964, 2020, 941, 0, 1999, 2003, + 1989, 1984, 0, 979, 950, 2034, 978, 984, 983, 995, + 757, 989, 992, 2037, 996, 571, 997, 1004, 1005, 1014, + 1006, 2037, 1021, 1025, 1026, 1039, 1041, 2012, 1010, 1996, + 1988, 0, 1989, 1993, 1979, 999, 2029, 1973, 1043, 1049, + 1050, 1051, 1058, 1059, 1060, 1070, 1061, 2002, 1992, 1991, + 1973, 1975, 1981, 1087, 1053, 1061, 1062, 813, 1003, 1044, + 1996, 1986, 1985, 1967, 1969, 1975, 1990, 1980, 1979, 1961, + + 1963, 1969, 1954, 2004, 1952, 867, 1078, 1089, 1062, 1090, + 1093, 1981, 1971, 1970, 1952, 1954, 1960, 1945, 1995, 1943, + 1094, 1099, 1101, 1100, 1105, 1103, 1117, 1997, 1111, 1114, + 1118, 1120, 1121, 1122, 1125, 1141, 1127, 1155, 1160, 1165, + 1174, 1971, 1961, 1960, 1945, 1944, 1940, 1942, 1948, 1933, + 1138, 1151, 1170, 1145, 1173, 1176, 1179, 1178, 1180, 1188, + 1960, 1942, 1936, 1947, 1942, 1934, 1114, 1173, 1136, 1183, + 1181, 1179, 1954, 1936, 1930, 1941, 1936, 1928, 1948, 1930, + 1924, 1935, 1930, 1922, 1914, 1964, 1198, 1184, 1141, 830, + 1194, 1195, 1940, 1922, 1916, 1927, 1922, 1914, 1906, 1956, + + 1203, 1197, 1200, 1208, 1222, 1225, 1231, 1232, 1233, 1234, + 1237, 1238, 1248, 1249, 1257, 1265, 1267, 1282, 1932, 1914, + 1908, 0, 1918, 1918, 1913, 1905, 1235, 1253, 1270, 1273, + 1281, 1285, 1287, 1288, 1290, 1919, 1914, 1908, 1911, 1898, + 1909, 1228, 1285, 1283, 1281, 1290, 1291, 1913, 1908, 1902, + 1905, 1892, 1903, 1907, 1902, 1896, 1899, 1886, 1897, 1303, + 1297, 1305, 1306, 1310, 1312, 1901, 1896, 1890, 1893, 1880, + 1891, 1320, 1317, 1323, 1328, 1327, 1329, 1335, 1338, 1339, + 1341, 1342, 1345, 1347, 1356, 1357, 1371, 1392, 1396, 1895, + 1890, 1884, 0, 1887, 1874, 1885, 1344, 1339, 1359, 1380, + + 1381, 1382, 1386, 1902, 1878, 0, 0, 0, 0, 1117, + 1357, 1906, 1905, 1904, 1903, 1896, 1872, 2157, 2157, 2157, + 2157, 1894, 1870, 0, 0, 0, 0, 1240, 1353, 1908, + 1907, 1906, 1905, 1888, 1864, 0, 0, 0, 0, 1399, + 1400, 1902, 1901, 1900, 1899, 1405, 1372, 1902, 1901, 1900, + 1899, 1415, 1419, 1427, 1434, 1439, 1446, 1878, 1854, 0, + 0, 0, 0, 1424, 1433, 1427, 1867, 1856, 1394, 1426, + 1863, 1849, 1858, 1845, 1445, 1409, 1851, 1840, 1451, 1449, + 1456, 1459, 1467, 1476, 1847, 1833, 1463, 1456, 1848, 1819, + 1125, 1454, 1841, 1814, 1837, 1807, 1470, 1457, 1827, 1795, + + 1472, 1476, 1488, 1482, 1501, 1510, 1809, 1782, 1495, 1486, + 1789, 0, 1503, 1792, 1776, 2157, 1747, 0, 1504, 1756, + 1736, 0, 1515, 1745, 1483, 1712, 1529, 1537, 1690, 0, + 1516, 1675, 1513, 1610, 1609, 1522, 1608, 1525, 1491, 1546, + 1607, 1533, 1612, 1475, 1611, 1609, 1534, 1608, 1540, 1535, + 1560, 1607, 1546, 1604, 1232, 1602, 1601, 1549, 1599, 1560, + 1557, 1580, 1597, 1562, 1596, 1553, 1595, 1593, 1566, 1592, + 1567, 1574, 1588, 1591, 1574, 1581, 1226, 1575, 1572, 1582, + 1485, 1590, 1595, 1600, 1381, 1593, 0, 1392, 2157, 0, + 1347, 0, 1029, 1018, 1607, 0, 2157, 1641, 1653, 1665, + + 1677, 1689, 893, 1698, 1704, 1713, 1725, 1737, 1745, 1751, + 1756, 1762, 1771, 1783, 1795, 1807, 1819, 1831, 1839, 1845, + 1848, 730, 581, 550, 1855, 289, 1863, 286, 1871, 1879, + 1887 + } ; + +static yyconst flex_int16_t yy_def[832] = + { 0, + 797, 1, 797, 3, 798, 798, 799, 799, 797, 9, + 797, 11, 797, 13, 797, 15, 800, 800, 801, 801, + 797, 21, 797, 797, 797, 797, 802, 803, 797, 797, + 797, 797, 797, 804, 804, 804, 804, 804, 804, 804, + 804, 804, 805, 805, 805, 805, 805, 805, 806, 806, + 797, 806, 807, 806, 806, 797, 806, 806, 806, 806, + 806, 806, 806, 797, 808, 797, 797, 802, 797, 797, + 797, 797, 797, 797, 797, 797, 797, 797, 797, 809, + 809, 809, 809, 809, 809, 797, 810, 810, 810, 810, + 810, 810, 797, 811, 811, 811, 811, 811, 811, 797, + + 812, 812, 812, 812, 812, 812, 813, 813, 813, 814, + 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, + 797, 815, 797, 797, 815, 816, 817, 818, 815, 815, + 815, 815, 815, 815, 815, 815, 815, 815, 815, 797, + 819, 819, 819, 819, 819, 819, 819, 802, 797, 820, + 797, 797, 797, 797, 797, 797, 797, 804, 821, 804, + 804, 804, 804, 804, 804, 804, 804, 805, 805, 805, + 805, 805, 805, 806, 797, 806, 797, 807, 802, 806, + 806, 806, 806, 806, 806, 806, 806, 806, 806, 808, + 808, 797, 797, 797, 797, 797, 797, 809, 809, 809, + + 809, 809, 809, 822, 797, 810, 810, 810, 810, 810, + 810, 811, 811, 811, 811, 811, 811, 823, 797, 812, + 812, 812, 812, 812, 812, 813, 797, 814, 797, 813, + 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, + 797, 797, 815, 815, 815, 797, 797, 816, 816, 816, + 817, 817, 817, 818, 818, 818, 815, 815, 815, 815, + 815, 815, 815, 797, 815, 815, 815, 815, 819, 819, + 819, 819, 819, 819, 819, 819, 820, 797, 797, 824, + 821, 797, 804, 804, 804, 804, 804, 804, 804, 804, + 804, 805, 805, 805, 805, 805, 805, 806, 806, 806, + + 806, 806, 806, 806, 806, 797, 797, 797, 797, 797, + 797, 809, 809, 809, 809, 809, 809, 825, 826, 810, + 810, 810, 810, 810, 810, 811, 811, 811, 811, 811, + 811, 827, 828, 812, 812, 812, 812, 812, 812, 813, + 813, 813, 813, 813, 813, 813, 813, 815, 815, 815, + 815, 797, 815, 815, 815, 815, 815, 819, 819, 819, + 819, 819, 819, 819, 819, 797, 797, 829, 804, 804, + 804, 804, 804, 804, 804, 804, 804, 805, 805, 805, + 805, 805, 805, 806, 806, 806, 806, 806, 806, 806, + 797, 797, 797, 797, 797, 797, 809, 809, 809, 809, + + 809, 809, 825, 810, 830, 810, 810, 810, 810, 810, + 810, 811, 811, 811, 811, 811, 811, 827, 812, 831, + 812, 812, 812, 812, 812, 812, 813, 797, 813, 813, + 813, 813, 813, 813, 815, 815, 815, 815, 815, 815, + 815, 819, 819, 819, 819, 819, 819, 819, 819, 829, + 820, 804, 804, 804, 804, 804, 804, 804, 804, 804, + 805, 805, 805, 805, 805, 805, 806, 806, 806, 806, + 806, 806, 797, 797, 797, 797, 797, 797, 809, 809, + 809, 809, 809, 809, 830, 810, 810, 810, 810, 810, + 810, 810, 811, 811, 811, 811, 811, 811, 831, 812, + + 812, 812, 812, 812, 812, 812, 813, 813, 813, 813, + 813, 813, 815, 815, 815, 815, 815, 815, 819, 819, + 819, 819, 819, 819, 819, 819, 804, 804, 804, 804, + 804, 804, 804, 804, 804, 805, 805, 805, 805, 805, + 805, 806, 806, 806, 806, 806, 806, 797, 797, 797, + 797, 797, 797, 809, 809, 809, 809, 809, 809, 810, + 810, 810, 810, 810, 810, 811, 811, 811, 811, 811, + 811, 812, 812, 812, 812, 812, 812, 813, 813, 813, + 813, 813, 813, 815, 815, 815, 815, 815, 815, 819, + 819, 819, 819, 819, 819, 819, 804, 804, 804, 804, + + 804, 804, 804, 805, 805, 805, 805, 805, 805, 806, + 806, 806, 806, 806, 806, 797, 797, 797, 797, 797, + 797, 809, 809, 809, 809, 809, 809, 810, 810, 810, + 810, 810, 810, 811, 811, 811, 811, 811, 811, 812, + 812, 812, 812, 812, 812, 813, 813, 813, 813, 813, + 813, 815, 815, 815, 815, 815, 815, 819, 819, 819, + 819, 819, 819, 804, 804, 804, 805, 805, 806, 806, + 797, 797, 809, 809, 810, 810, 811, 811, 812, 812, + 813, 813, 815, 815, 819, 819, 804, 804, 805, 805, + 806, 806, 797, 797, 809, 809, 810, 810, 811, 811, + + 812, 812, 813, 813, 815, 815, 819, 819, 804, 804, + 805, 805, 806, 806, 797, 797, 809, 809, 810, 810, + 811, 811, 812, 812, 813, 813, 815, 815, 819, 819, + 804, 805, 806, 797, 809, 810, 811, 812, 813, 815, + 819, 804, 805, 806, 797, 809, 810, 811, 812, 813, + 815, 819, 804, 805, 806, 797, 809, 810, 811, 812, + 813, 815, 819, 804, 805, 806, 797, 809, 810, 811, + 812, 813, 815, 819, 804, 805, 806, 797, 809, 810, + 811, 812, 813, 815, 819, 804, 805, 806, 797, 809, + 810, 811, 812, 813, 815, 819, 0, 797, 797, 797, + + 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, + 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, + 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, + 797 + } ; + +static yyconst flex_int16_t yy_nxt[2216] = + { 0, + 24, 25, 26, 25, 24, 27, 28, 24, 29, 24, + 30, 24, 24, 24, 24, 24, 31, 32, 33, 34, + 34, 35, 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 24, 24, 24, 34, 36, 34, 34, 37, + 38, 39, 34, 40, 34, 34, 34, 34, 41, 34, + 42, 34, 34, 34, 34, 34, 24, 24, 24, 25, + 26, 25, 24, 27, 24, 24, 29, 24, 30, 24, + 24, 24, 24, 24, 31, 32, 33, 43, 43, 44, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 24, 24, 24, 43, 45, 43, 43, 46, 43, 43, + + 43, 47, 43, 43, 43, 43, 43, 43, 48, 43, + 43, 43, 43, 43, 24, 24, 50, 51, 52, 151, + 53, 157, 157, 54, 157, 55, 157, 152, 176, 177, + 157, 56, 57, 58, 175, 157, 59, 157, 183, 149, + 175, 182, 175, 175, 175, 157, 157, 159, 159, 160, + 159, 60, 159, 179, 61, 161, 159, 185, 62, 205, + 162, 159, 175, 159, 188, 63, 50, 51, 52, 175, + 53, 159, 159, 54, 175, 55, 164, 165, 163, 167, + 180, 56, 57, 58, 166, 186, 59, 205, 181, 175, + 184, 191, 192, 187, 151, 175, 205, 219, 189, 210, + + 205, 60, 152, 205, 61, 219, 219, 219, 62, 219, + 227, 227, 207, 230, 227, 63, 65, 66, 67, 227, + 68, 231, 221, 69, 227, 70, 232, 234, 227, 208, + 227, 71, 72, 73, 209, 227, 74, 211, 222, 233, + 223, 227, 227, 225, 271, 235, 272, 224, 238, 241, + 242, 75, 246, 247, 76, 249, 244, 236, 77, 244, + 295, 255, 244, 157, 296, 78, 65, 66, 67, 157, + 68, 244, 237, 69, 244, 70, 157, 244, 175, 157, + 240, 71, 72, 73, 250, 239, 74, 256, 245, 159, + 151, 176, 177, 149, 420, 159, 283, 405, 152, 175, + + 379, 75, 159, 245, 76, 159, 175, 179, 77, 300, + 380, 305, 284, 191, 192, 78, 24, 25, 79, 25, + 24, 27, 24, 24, 29, 24, 30, 24, 24, 24, + 24, 24, 31, 32, 33, 80, 80, 81, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 24, 24, + 24, 80, 82, 80, 80, 83, 80, 80, 80, 84, + 80, 80, 80, 80, 80, 80, 85, 80, 80, 80, + 80, 80, 24, 24, 24, 25, 26, 25, 24, 27, + 86, 24, 29, 24, 30, 24, 24, 87, 87, 24, + 31, 32, 33, 87, 87, 88, 87, 87, 87, 87, + + 87, 87, 87, 87, 87, 87, 24, 24, 24, 87, + 89, 87, 87, 90, 87, 87, 87, 91, 87, 87, + 87, 87, 87, 87, 92, 87, 87, 87, 87, 87, + 24, 24, 24, 25, 93, 25, 24, 27, 24, 24, + 29, 24, 30, 24, 24, 24, 24, 24, 31, 32, + 33, 94, 94, 95, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 24, 24, 24, 94, 96, 94, + 94, 97, 94, 94, 94, 98, 94, 94, 94, 94, + 94, 94, 99, 94, 94, 94, 94, 94, 24, 24, + 24, 25, 26, 25, 24, 27, 100, 24, 29, 24, + + 30, 24, 24, 101, 101, 24, 31, 32, 33, 101, + 101, 102, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 24, 24, 24, 101, 103, 101, 101, 104, + 101, 101, 101, 105, 101, 101, 101, 101, 101, 101, + 106, 101, 101, 101, 101, 101, 24, 24, 108, 109, + 108, 157, 110, 252, 149, 111, 252, 112, 368, 252, + 278, 157, 157, 113, 114, 115, 257, 309, 116, 244, + 175, 310, 244, 227, 258, 157, 244, 159, 244, 244, + 175, 244, 244, 117, 244, 253, 118, 159, 159, 332, + 119, 157, 259, 286, 260, 302, 285, 120, 245, 205, + + 287, 159, 227, 301, 121, 108, 109, 108, 245, 110, + 245, 433, 111, 244, 112, 279, 244, 159, 291, 244, + 113, 114, 115, 244, 175, 116, 244, 244, 244, 244, + 244, 244, 261, 244, 244, 244, 264, 290, 244, 343, + 117, 244, 325, 118, 262, 245, 303, 119, 157, 315, + 304, 265, 205, 316, 120, 245, 205, 263, 205, 245, + 245, 121, 123, 124, 125, 126, 127, 245, 128, 129, + 244, 130, 320, 244, 159, 180, 244, 131, 132, 133, + 288, 298, 134, 181, 289, 244, 219, 219, 244, 321, + 175, 244, 244, 322, 135, 244, 175, 136, 244, 329, + + 137, 205, 245, 330, 138, 219, 334, 219, 219, 266, + 227, 139, 123, 124, 125, 126, 127, 245, 128, 129, + 335, 130, 227, 175, 245, 241, 242, 131, 132, 133, + 267, 268, 134, 323, 230, 227, 299, 324, 318, 337, + 336, 363, 231, 338, 135, 364, 342, 136, 175, 344, + 137, 339, 246, 247, 138, 366, 367, 385, 427, 428, + 390, 139, 24, 25, 140, 25, 24, 27, 24, 24, + 29, 24, 30, 24, 24, 24, 24, 24, 31, 32, + 33, 141, 141, 142, 141, 141, 141, 141, 141, 141, + 141, 141, 141, 141, 24, 24, 24, 141, 143, 144, + + 141, 145, 141, 141, 141, 146, 141, 141, 141, 141, + 141, 141, 147, 141, 141, 141, 141, 141, 24, 24, + 340, 227, 227, 227, 244, 244, 249, 244, 244, 175, + 244, 244, 244, 244, 249, 244, 205, 248, 244, 249, + 252, 149, 278, 252, 252, 149, 252, 252, 252, 348, + 252, 252, 255, 255, 252, 250, 245, 245, 345, 175, + 254, 205, 346, 250, 245, 255, 470, 205, 250, 563, + 347, 349, 253, 205, 244, 341, 253, 244, 256, 256, + 253, 257, 244, 389, 244, 244, 406, 244, 244, 258, + 244, 256, 244, 244, 487, 244, 244, 279, 244, 244, + + 409, 150, 244, 245, 244, 244, 244, 244, 157, 244, + 244, 157, 244, 245, 245, 244, 157, 244, 244, 157, + 244, 244, 245, 244, 245, 157, 350, 244, 175, 351, + 244, 245, 205, 244, 159, 369, 245, 159, 245, 157, + 157, 157, 159, 157, 353, 159, 157, 245, 298, 245, + 175, 159, 392, 205, 355, 354, 219, 388, 356, 245, + 372, 370, 393, 175, 398, 159, 159, 159, 407, 159, + 205, 371, 159, 373, 399, 357, 386, 375, 408, 374, + 384, 367, 376, 413, 219, 219, 387, 410, 377, 219, + 219, 227, 422, 414, 227, 175, 340, 227, 227, 227, + + 366, 367, 423, 299, 421, 244, 349, 244, 244, 244, + 244, 244, 244, 244, 429, 435, 367, 411, 244, 175, + 227, 244, 244, 424, 425, 244, 244, 244, 244, 244, + 244, 436, 244, 244, 430, 219, 426, 245, 245, 245, + 244, 432, 244, 244, 431, 244, 244, 245, 244, 157, + 434, 341, 443, 471, 245, 157, 157, 157, 245, 245, + 175, 350, 444, 437, 157, 157, 157, 157, 205, 175, + 452, 439, 245, 438, 245, 159, 157, 175, 175, 440, + 467, 159, 159, 159, 205, 453, 454, 472, 384, 367, + 159, 159, 159, 159, 441, 205, 205, 468, 469, 205, + + 219, 455, 159, 175, 460, 219, 219, 219, 456, 219, + 458, 219, 457, 227, 488, 490, 227, 459, 427, 428, + 227, 501, 227, 227, 227, 489, 435, 367, 244, 244, + 175, 244, 244, 175, 244, 502, 492, 503, 507, 669, + 491, 175, 244, 542, 157, 244, 506, 205, 244, 713, + 508, 157, 175, 504, 509, 505, 244, 157, 245, 244, + 245, 244, 244, 514, 244, 512, 244, 244, 513, 244, + 159, 511, 244, 510, 245, 244, 157, 159, 244, 157, + 527, 244, 157, 159, 157, 157, 157, 544, 245, 175, + 205, 515, 562, 245, 157, 175, 529, 175, 245, 175, + + 205, 205, 159, 219, 205, 159, 219, 245, 159, 219, + 159, 159, 159, 516, 219, 517, 528, 518, 532, 543, + 159, 533, 545, 531, 546, 530, 534, 560, 219, 547, + 561, 219, 572, 227, 227, 227, 227, 564, 535, 227, + 227, 157, 175, 573, 175, 565, 205, 575, 175, 244, + 244, 574, 244, 244, 788, 244, 244, 766, 244, 157, + 578, 244, 675, 610, 244, 576, 244, 159, 244, 244, + 597, 244, 244, 581, 244, 577, 157, 584, 579, 157, + 582, 245, 245, 244, 580, 159, 244, 157, 583, 244, + 245, 157, 598, 157, 157, 585, 157, 175, 245, 175, + + 245, 175, 159, 205, 587, 159, 175, 175, 586, 205, + 588, 205, 205, 159, 599, 245, 205, 159, 205, 159, + 159, 613, 159, 219, 611, 601, 219, 612, 600, 219, + 603, 615, 589, 219, 219, 219, 629, 227, 628, 602, + 227, 227, 614, 227, 227, 157, 631, 227, 244, 630, + 157, 244, 633, 205, 244, 640, 641, 244, 244, 205, + 244, 244, 632, 244, 244, 157, 664, 642, 643, 645, + 646, 159, 244, 175, 227, 244, 159, 647, 244, 644, + 245, 649, 652, 648, 665, 651, 157, 157, 157, 245, + 245, 159, 157, 244, 650, 653, 244, 244, 676, 244, + + 244, 654, 670, 244, 245, 219, 219, 227, 175, 796, + 175, 655, 159, 159, 159, 205, 244, 682, 159, 244, + 244, 679, 244, 244, 691, 245, 244, 681, 244, 245, + 157, 244, 666, 157, 244, 244, 657, 683, 244, 157, + 244, 244, 175, 244, 656, 680, 244, 244, 245, 698, + 244, 205, 245, 244, 687, 219, 159, 219, 227, 159, + 245, 227, 157, 205, 684, 159, 692, 245, 244, 157, + 175, 244, 245, 688, 244, 697, 205, 244, 219, 245, + 244, 701, 219, 244, 227, 227, 703, 709, 159, 702, + 227, 175, 157, 227, 719, 159, 723, 705, 755, 704, + + 245, 157, 244, 739, 714, 244, 710, 720, 244, 245, + 205, 244, 725, 792, 244, 731, 706, 244, 159, 175, + 750, 219, 157, 733, 736, 727, 724, 159, 205, 175, + 244, 219, 726, 244, 245, 738, 244, 227, 244, 157, + 205, 244, 744, 245, 244, 742, 219, 244, 159, 740, + 244, 747, 157, 244, 749, 205, 753, 758, 761, 227, + 728, 244, 245, 760, 244, 159, 219, 244, 157, 175, + 245, 764, 205, 219, 769, 751, 227, 777, 159, 245, + 157, 244, 772, 762, 244, 771, 775, 244, 205, 244, + 780, 782, 244, 245, 159, 244, 219, 227, 783, 157, + + 790, 244, 786, 789, 244, 773, 159, 244, 244, 787, + 791, 244, 784, 245, 244, 785, 781, 779, 793, 778, + 776, 245, 774, 794, 770, 159, 768, 767, 795, 765, + 763, 759, 757, 245, 756, 754, 752, 748, 746, 745, + 245, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + + 148, 158, 158, 158, 743, 158, 158, 158, 168, 168, + 741, 168, 168, 174, 227, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 178, 178, 178, 178, 178, + 178, 178, 178, 178, 178, 178, 178, 190, 190, 190, + 190, 190, 190, 190, 190, 190, 190, 190, 190, 198, + 198, 219, 198, 198, 206, 206, 737, 206, 206, 206, + 212, 212, 205, 212, 212, 220, 220, 735, 220, 220, + 220, 226, 226, 226, 226, 226, 226, 226, 226, 226, + 226, 226, 226, 228, 228, 228, 228, 228, 228, 228, + 228, 228, 228, 228, 228, 243, 734, 243, 243, 243, + + 243, 243, 243, 243, 243, 243, 243, 248, 175, 732, + 248, 248, 248, 248, 248, 248, 248, 248, 248, 251, + 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, + 251, 254, 730, 729, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 269, 269, 722, 269, 269, 277, 277, + 277, 721, 277, 277, 277, 281, 281, 718, 281, 403, + 403, 717, 403, 403, 716, 715, 403, 418, 418, 712, + 418, 418, 711, 708, 418, 450, 450, 707, 450, 450, + 700, 699, 450, 485, 485, 696, 485, 485, 695, 694, + 485, 499, 499, 693, 499, 499, 690, 689, 499, 686, + + 685, 227, 227, 227, 227, 219, 219, 219, 219, 678, + 677, 205, 205, 205, 205, 674, 673, 672, 671, 175, + 175, 175, 175, 668, 667, 663, 662, 661, 660, 659, + 658, 639, 638, 637, 636, 635, 634, 627, 626, 625, + 624, 623, 622, 621, 620, 619, 618, 617, 616, 609, + 608, 607, 606, 605, 604, 596, 595, 594, 593, 592, + 591, 590, 219, 500, 571, 570, 569, 568, 567, 566, + 205, 486, 559, 558, 557, 556, 555, 554, 553, 552, + 551, 550, 549, 548, 541, 540, 539, 538, 537, 536, + 451, 526, 525, 524, 523, 522, 521, 520, 519, 428, + + 500, 219, 419, 498, 497, 496, 495, 494, 493, 486, + 205, 404, 484, 483, 482, 481, 480, 479, 478, 477, + 476, 475, 474, 473, 466, 465, 464, 463, 462, 461, + 451, 367, 449, 448, 447, 446, 445, 442, 352, 227, + 219, 419, 417, 416, 415, 412, 205, 404, 402, 401, + 400, 397, 396, 395, 394, 391, 175, 383, 382, 381, + 378, 282, 365, 362, 361, 360, 359, 358, 352, 247, + 242, 227, 227, 227, 227, 227, 229, 227, 227, 219, + 333, 331, 328, 327, 326, 205, 319, 317, 314, 313, + 312, 311, 308, 307, 306, 192, 175, 175, 175, 149, + + 175, 297, 294, 293, 292, 282, 280, 149, 276, 275, + 274, 273, 270, 247, 229, 227, 227, 227, 219, 218, + 217, 216, 215, 214, 213, 205, 204, 203, 202, 201, + 200, 199, 197, 196, 195, 194, 193, 156, 155, 154, + 153, 149, 154, 175, 175, 173, 172, 171, 170, 169, + 156, 155, 154, 153, 149, 797, 23, 797, 797, 797, + 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, + 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, + 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, + 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, + + 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, + 797, 797, 797, 797, 797 + } ; + +static yyconst flex_int16_t yy_chk[2216] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 5, 5, 5, 29, + 5, 34, 36, 5, 35, 5, 37, 29, 50, 50, + 38, 5, 5, 5, 62, 41, 5, 40, 57, 53, + 55, 55, 59, 50, 57, 42, 39, 34, 36, 35, + 35, 5, 37, 53, 5, 36, 38, 59, 5, 91, + 37, 41, 60, 40, 62, 5, 6, 6, 6, 61, + 6, 42, 39, 6, 63, 6, 39, 40, 38, 42, + 54, 6, 6, 6, 41, 60, 6, 88, 54, 58, + 58, 65, 65, 61, 69, 54, 89, 102, 63, 91, + + 90, 6, 69, 92, 6, 103, 104, 105, 6, 106, + 118, 112, 88, 111, 111, 6, 7, 7, 7, 114, + 7, 111, 102, 7, 113, 7, 112, 114, 116, 89, + 115, 7, 7, 7, 90, 117, 7, 92, 103, 113, + 104, 119, 120, 106, 143, 115, 143, 105, 118, 121, + 121, 7, 123, 123, 7, 126, 122, 116, 7, 122, + 172, 128, 122, 150, 172, 7, 8, 8, 8, 158, + 8, 125, 117, 8, 125, 8, 160, 125, 189, 161, + 120, 8, 8, 8, 126, 119, 8, 128, 122, 150, + 151, 176, 176, 178, 828, 158, 160, 826, 151, 185, + + 293, 8, 160, 125, 8, 161, 176, 178, 8, 185, + 293, 189, 161, 191, 191, 8, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 17, 17, + 17, 163, 17, 127, 127, 17, 127, 17, 824, 127, + 152, 162, 164, 17, 17, 17, 129, 196, 17, 129, + 187, 196, 129, 346, 129, 167, 130, 163, 131, 130, + 186, 131, 130, 17, 131, 127, 17, 162, 164, 823, + 17, 166, 130, 163, 131, 187, 162, 17, 129, 211, + + 164, 167, 237, 186, 17, 18, 18, 18, 130, 18, + 131, 346, 18, 136, 18, 152, 136, 166, 167, 136, + 18, 18, 18, 132, 188, 18, 132, 134, 133, 132, + 134, 133, 132, 134, 133, 135, 135, 166, 135, 237, + 18, 135, 211, 18, 133, 136, 188, 18, 165, 202, + 188, 136, 207, 202, 18, 132, 208, 134, 209, 134, + 133, 18, 19, 19, 19, 19, 19, 135, 19, 19, + 137, 19, 207, 137, 165, 180, 137, 19, 19, 19, + 165, 181, 19, 180, 165, 138, 221, 222, 138, 208, + 180, 138, 139, 209, 19, 139, 181, 19, 139, 216, + + 19, 210, 137, 216, 19, 223, 221, 224, 225, 137, + 238, 19, 20, 20, 20, 20, 20, 138, 20, 20, + 222, 20, 236, 305, 139, 241, 241, 20, 20, 20, + 138, 139, 20, 210, 230, 230, 181, 210, 822, 224, + 223, 275, 230, 224, 20, 275, 236, 20, 300, 238, + 20, 225, 246, 246, 20, 279, 279, 300, 341, 341, + 305, 20, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 231, 231, 239, 240, 243, 244, 248, 243, 244, 388, + 243, 244, 245, 245, 249, 245, 490, 250, 245, 250, + 251, 251, 278, 251, 252, 252, 251, 252, 253, 253, + 252, 253, 254, 255, 253, 248, 243, 244, 239, 304, + 256, 323, 239, 249, 245, 256, 388, 320, 250, 490, + 240, 258, 251, 406, 258, 231, 252, 258, 254, 255, + 253, 257, 259, 304, 257, 259, 320, 257, 259, 257, + 260, 256, 261, 260, 406, 261, 260, 278, 261, 262, + + 323, 803, 262, 258, 263, 262, 265, 263, 277, 265, + 263, 285, 265, 257, 259, 266, 283, 267, 266, 286, + 267, 266, 260, 267, 261, 284, 258, 268, 303, 263, + 268, 262, 321, 268, 277, 283, 263, 285, 265, 287, + 288, 291, 283, 289, 265, 286, 290, 266, 298, 267, + 301, 284, 307, 324, 267, 266, 335, 303, 267, 268, + 286, 284, 307, 298, 313, 287, 288, 291, 321, 289, + 325, 284, 290, 287, 313, 268, 301, 289, 321, 288, + 299, 299, 290, 327, 337, 334, 301, 324, 291, 339, + 338, 342, 335, 327, 343, 299, 340, 340, 345, 347, + + 366, 366, 335, 298, 334, 348, 349, 351, 348, 349, + 351, 348, 349, 351, 342, 350, 350, 325, 350, 389, + 794, 350, 353, 337, 338, 353, 354, 355, 353, 354, + 355, 351, 354, 355, 343, 793, 339, 348, 349, 351, + 356, 345, 357, 356, 343, 357, 356, 350, 357, 369, + 347, 340, 359, 389, 353, 370, 371, 372, 354, 355, + 390, 349, 359, 353, 373, 374, 375, 377, 409, 385, + 369, 355, 356, 353, 357, 369, 376, 386, 387, 356, + 385, 370, 371, 372, 407, 370, 371, 390, 384, 384, + 373, 374, 375, 377, 357, 408, 410, 386, 387, 411, + + 421, 372, 376, 384, 377, 422, 424, 423, 373, 426, + 375, 425, 374, 429, 407, 409, 430, 376, 427, 427, + 431, 421, 432, 433, 434, 408, 435, 435, 437, 435, + 467, 437, 435, 610, 437, 422, 411, 423, 429, 610, + 410, 691, 436, 467, 451, 436, 426, 489, 436, 691, + 430, 454, 469, 424, 431, 425, 438, 452, 435, 438, + 437, 439, 438, 437, 439, 434, 440, 439, 436, 440, + 451, 433, 440, 432, 436, 441, 453, 454, 441, 455, + 452, 441, 456, 452, 458, 457, 459, 469, 438, 468, + 488, 438, 489, 439, 460, 472, 454, 471, 440, 470, + + 491, 492, 453, 502, 487, 455, 503, 441, 456, 501, + 458, 457, 459, 439, 504, 440, 453, 441, 457, 468, + 460, 458, 470, 456, 471, 455, 459, 487, 505, 472, + 488, 506, 501, 507, 508, 509, 510, 491, 460, 511, + 512, 527, 777, 502, 542, 492, 628, 504, 755, 513, + 514, 503, 513, 514, 777, 513, 514, 755, 515, 528, + 507, 515, 628, 542, 515, 505, 516, 527, 517, 516, + 527, 517, 516, 510, 517, 506, 529, 513, 508, 530, + 511, 513, 514, 518, 509, 528, 518, 531, 512, 518, + 515, 532, 528, 533, 534, 514, 535, 545, 516, 544, + + 517, 543, 529, 561, 516, 530, 546, 547, 515, 560, + 517, 562, 563, 531, 529, 518, 564, 532, 565, 533, + 534, 545, 535, 573, 543, 532, 572, 544, 531, 574, + 535, 547, 518, 576, 575, 577, 561, 578, 560, 533, + 579, 580, 546, 581, 582, 598, 563, 583, 584, 562, + 597, 584, 565, 791, 584, 572, 573, 585, 586, 629, + 585, 586, 564, 585, 586, 599, 597, 574, 575, 577, + 578, 598, 587, 611, 647, 587, 597, 579, 587, 576, + 584, 581, 584, 580, 598, 583, 600, 601, 602, 585, + 586, 599, 603, 588, 582, 585, 588, 589, 629, 588, + + 589, 586, 611, 589, 587, 640, 641, 646, 788, 785, + 669, 587, 600, 601, 602, 676, 652, 647, 603, 652, + 653, 640, 652, 653, 669, 588, 653, 646, 654, 589, + 664, 654, 600, 666, 654, 655, 589, 652, 655, 665, + 656, 655, 670, 656, 588, 641, 656, 657, 652, 676, + 657, 675, 653, 657, 664, 680, 664, 679, 681, 666, + 654, 682, 688, 698, 653, 665, 670, 655, 683, 687, + 692, 683, 656, 665, 683, 675, 697, 684, 701, 657, + 684, 679, 702, 684, 704, 725, 681, 687, 688, 680, + 703, 744, 710, 739, 697, 687, 701, 683, 744, 682, + + 683, 709, 705, 725, 692, 705, 688, 698, 705, 684, + 719, 706, 703, 781, 706, 709, 684, 706, 710, 713, + 739, 723, 731, 713, 719, 705, 702, 709, 736, 733, + 727, 738, 704, 727, 705, 723, 727, 750, 728, 742, + 747, 728, 733, 706, 728, 731, 749, 740, 731, 727, + 740, 736, 753, 740, 738, 758, 742, 747, 750, 761, + 706, 751, 727, 749, 751, 742, 760, 751, 764, 766, + 728, 753, 769, 771, 758, 740, 772, 766, 753, 740, + 775, 762, 761, 751, 762, 760, 764, 762, 780, 773, + 769, 771, 773, 751, 764, 773, 782, 783, 772, 786, + + 779, 784, 775, 778, 784, 762, 775, 784, 795, 776, + 780, 795, 773, 762, 795, 774, 770, 768, 782, 767, + 765, 773, 763, 783, 759, 786, 757, 756, 784, 754, + 752, 748, 746, 784, 745, 743, 741, 737, 735, 734, + 795, 798, 798, 798, 798, 798, 798, 798, 798, 798, + 798, 798, 798, 799, 799, 799, 799, 799, 799, 799, + 799, 799, 799, 799, 799, 800, 800, 800, 800, 800, + 800, 800, 800, 800, 800, 800, 800, 801, 801, 801, + 801, 801, 801, 801, 801, 801, 801, 801, 801, 802, + 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, + + 802, 804, 804, 804, 732, 804, 804, 804, 805, 805, + 729, 805, 805, 806, 726, 806, 806, 806, 806, 806, + 806, 806, 806, 806, 806, 807, 807, 807, 807, 807, + 807, 807, 807, 807, 807, 807, 807, 808, 808, 808, + 808, 808, 808, 808, 808, 808, 808, 808, 808, 809, + 809, 724, 809, 809, 810, 810, 721, 810, 810, 810, + 811, 811, 720, 811, 811, 812, 812, 717, 812, 812, + 812, 813, 813, 813, 813, 813, 813, 813, 813, 813, + 813, 813, 813, 814, 814, 814, 814, 814, 814, 814, + 814, 814, 814, 814, 814, 815, 715, 815, 815, 815, + + 815, 815, 815, 815, 815, 815, 815, 816, 714, 711, + 816, 816, 816, 816, 816, 816, 816, 816, 816, 817, + 817, 817, 817, 817, 817, 817, 817, 817, 817, 817, + 817, 818, 708, 707, 818, 818, 818, 818, 818, 818, + 818, 818, 818, 819, 819, 700, 819, 819, 820, 820, + 820, 699, 820, 820, 820, 821, 821, 696, 821, 825, + 825, 695, 825, 825, 694, 693, 825, 827, 827, 690, + 827, 827, 689, 686, 827, 829, 829, 685, 829, 829, + 678, 677, 829, 830, 830, 674, 830, 830, 673, 672, + 830, 831, 831, 671, 831, 831, 668, 667, 831, 659, + + 658, 651, 650, 649, 648, 645, 644, 643, 642, 635, + 634, 633, 632, 631, 630, 623, 622, 617, 616, 615, + 614, 613, 612, 605, 604, 596, 595, 594, 592, 591, + 590, 571, 570, 569, 568, 567, 566, 559, 558, 557, + 556, 555, 554, 553, 552, 551, 550, 549, 548, 541, + 540, 539, 538, 537, 536, 526, 525, 524, 523, 521, + 520, 519, 500, 499, 498, 497, 496, 495, 494, 493, + 486, 485, 484, 483, 482, 481, 480, 479, 478, 477, + 476, 475, 474, 473, 466, 465, 464, 463, 462, 461, + 450, 449, 448, 447, 446, 445, 444, 443, 442, 428, + + 420, 419, 418, 417, 416, 415, 414, 413, 412, 405, + 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, + 394, 393, 392, 391, 383, 382, 381, 380, 379, 378, + 368, 367, 365, 364, 363, 361, 360, 358, 352, 344, + 336, 332, 331, 330, 329, 326, 322, 318, 317, 316, + 315, 312, 311, 310, 309, 306, 302, 297, 296, 295, + 292, 281, 276, 274, 273, 272, 271, 270, 264, 247, + 242, 235, 234, 233, 232, 229, 228, 227, 226, 220, + 219, 217, 215, 214, 213, 206, 205, 203, 201, 200, + 199, 197, 195, 194, 193, 190, 184, 183, 182, 179, + + 174, 173, 171, 170, 169, 159, 157, 148, 147, 146, + 145, 144, 142, 124, 110, 109, 108, 107, 101, 100, + 99, 98, 97, 96, 95, 87, 86, 85, 84, 83, + 82, 81, 78, 77, 76, 75, 74, 73, 72, 71, + 70, 68, 56, 52, 49, 48, 47, 46, 45, 44, + 33, 32, 31, 30, 27, 23, 797, 797, 797, 797, + 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, + 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, + 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, + 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, + + 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, + 797, 797, 797, 797, 797 + } ; + +/* Table of booleans, true if rule could match eol. */ +static yyconst flex_int32_t yy_rule_can_match_eol[46] = + { 0, +0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 0, 0, }; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +#line 1 "bitbakescanner.l" +/* bbf.flex + + written by Marc Singer + 6 January 2005 + + 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. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. + + DESCRIPTION + ----------- + + flex lexer specification for a BitBake input file parser. + + Unfortunately, flex doesn't welcome comments within the rule sets. + I say unfortunately because this lexer is unreasonably complex and + comments would make the code much easier to comprehend. + + The BitBake grammar is not regular. In order to interpret all + of the available input files, the lexer maintains much state as it + parses. There are places where this lexer will emit tokens that + are invalid. The parser will tend to catch these. + + The lexer requires C++ at the moment. The only reason for this has + to do with a very small amount of managed state. Producing a C + lexer should be a reasonably easy task as long as the %reentrant + option is used. + + + NOTES + ----- + + o RVALUES. There are three kinds of RVALUES. There are unquoted + values, double quote enclosed strings, and single quote + strings. Quoted strings may contain unescaped quotes (of either + type), *and* any type may span more than one line by using a + continuation '\' at the end of the line. This requires us to + recognize all types of values with a single expression. + Moreover, the only reason to quote a value is to include + trailing or leading whitespace. Whitespace within a value is + preserved, ugh. + + o CLASSES. C_ patterns define classes. Classes ought not include + a repitition operator, instead letting the reference to the class + define the repitition count. + + C_SS - symbol start + C_SB - symbol body + C_SP - whitespace + +*/ +#line 71 "bitbakescanner.l" + +#include "token.h" +#include "lexer.h" +#include "bitbakeparser.h" +#include <ctype.h> + +extern void *bbparseAlloc(void *(*mallocProc)(size_t)); +extern void bbparseFree(void *p, void (*freeProc)(void*)); +extern void *bbparseAlloc(void *(*mallocProc)(size_t)); +extern void *bbparse(void*, int, token_t, lex_t*); +extern void bbparseTrace(FILE *TraceFILE, char *zTracePrompt); + +//static const char* rgbInput; +//static size_t cbInput; + + +int lineError; +int errorParse; + +enum { + errorNone = 0, + errorUnexpectedInput, + errorUnsupportedFeature, +}; + +#define YY_EXTRA_TYPE lex_t* + + /* Read from buffer */ +#define YY_INPUT(buf,result,max_size) \ + { yyextra->input(buf, &result, max_size); } + +//#define YY_DECL static size_t yylex () + +#define ERROR(e) \ + do { lineError = yylineno; errorParse = e; yyterminate (); } while (0) + +static const char* fixup_escapes (const char* sz); + + + + + + + + + + + +#line 1316 "<stdout>" + +#define INITIAL 0 +#define S_DEF 1 +#define S_DEF_ARGS 2 +#define S_DEF_BODY 3 +#define S_FUNC 4 +#define S_INCLUDE 5 +#define S_INHERIT 6 +#define S_REQUIRE 7 +#define S_PROC 8 +#define S_RVALUE 9 +#define S_TASK 10 + +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + int yy_n_chars; + int yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + }; /* end struct yyguts_t */ + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (yyscan_t yyscanner ); + +int yyget_debug (yyscan_t yyscanner ); + +void yyset_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *yyget_in (yyscan_t yyscanner ); + +void yyset_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *yyget_out (yyscan_t yyscanner ); + +void yyset_out (FILE * out_str ,yyscan_t yyscanner ); + +int yyget_leng (yyscan_t yyscanner ); + +char *yyget_text (yyscan_t yyscanner ); + +int yyget_lineno (yyscan_t yyscanner ); + +void yyset_lineno (int line_number ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (yyscan_t yyscanner ); +#else +extern int yywrap (yyscan_t yyscanner ); +#endif +#endif + + static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (yyscan_t yyscanner ); +#else +static int input (yyscan_t yyscanner ); +#endif + +#endif + + static void yy_push_state (int new_state ,yyscan_t yyscanner); + + static void yy_pop_state (yyscan_t yyscanner ); + + static int yy_top_state (yyscan_t yyscanner ); + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (yyscan_t yyscanner); + +#define YY_DECL int yylex (yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + +#line 159 "bitbakescanner.l" + + +#line 1548 "<stdout>" + + if ( yyg->yy_init ) + { + yyg->yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + yy_load_buffer_state(yyscanner ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 798 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_current_state != 797 ); + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) + { + int yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + + do{ yylineno++; + yycolumn=0; + }while(0) +; + } + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 161 "bitbakescanner.l" +{ BEGIN S_RVALUE; + yyextra->accept (T_OP_APPEND); } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 163 "bitbakescanner.l" +{ BEGIN S_RVALUE; + yyextra->accept (T_OP_PREPEND); } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 165 "bitbakescanner.l" +{ BEGIN S_RVALUE; + yyextra->accept (T_OP_IMMEDIATE); } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 167 "bitbakescanner.l" +{ BEGIN S_RVALUE; + yyextra->accept (T_OP_ASSIGN); } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 169 "bitbakescanner.l" +{ BEGIN S_RVALUE; + yyextra->accept (T_OP_COND); } + YY_BREAK +case 6: +/* rule 6 can match eol */ +YY_RULE_SETUP +#line 172 "bitbakescanner.l" +{ } + YY_BREAK +case 7: +/* rule 7 can match eol */ +YY_RULE_SETUP +#line 173 "bitbakescanner.l" +{ BEGIN INITIAL; + size_t cb = yyleng; + while (cb && isspace (yytext[cb - 1])) + --cb; + yytext[cb - 1] = 0; + yyextra->accept (T_STRING, yytext + 1); } + YY_BREAK +case 8: +/* rule 8 can match eol */ +YY_RULE_SETUP +#line 179 "bitbakescanner.l" +{ BEGIN INITIAL; + size_t cb = yyleng; + while (cb && isspace (yytext[cb - 1])) + --cb; + yytext[cb - 1] = 0; + yyextra->accept (T_STRING, yytext + 1); } + YY_BREAK +case 9: +/* rule 9 can match eol */ +YY_RULE_SETUP +#line 186 "bitbakescanner.l" +{ ERROR (errorUnexpectedInput); } + YY_BREAK +case 10: +/* rule 10 can match eol */ +YY_RULE_SETUP +#line 187 "bitbakescanner.l" +{ BEGIN INITIAL; + yyextra->accept (T_STRING, NULL); } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 190 "bitbakescanner.l" +{ BEGIN S_INCLUDE; + yyextra->accept (T_INCLUDE); } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 192 "bitbakescanner.l" +{ BEGIN S_REQUIRE; + yyextra->accept (T_REQUIRE); } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 194 "bitbakescanner.l" +{ BEGIN S_INHERIT; + yyextra->accept (T_INHERIT); } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 196 "bitbakescanner.l" +{ BEGIN S_TASK; + yyextra->accept (T_ADDTASK); } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 198 "bitbakescanner.l" +{ yyextra->accept (T_ADDHANDLER); } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 199 "bitbakescanner.l" +{ BEGIN S_FUNC; + yyextra->accept (T_EXPORT_FUNC); } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 201 "bitbakescanner.l" +{ yyextra->accept (T_BEFORE); } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 202 "bitbakescanner.l" +{ yyextra->accept (T_AFTER); } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 203 "bitbakescanner.l" +{ yyextra->accept (T_EXPORT); } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 205 "bitbakescanner.l" +{ yyextra->accept (T_FAKEROOT); } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 206 "bitbakescanner.l" +{ yyextra->accept (T_PYTHON); } + YY_BREAK +case 22: +/* rule 22 can match eol */ +YY_RULE_SETUP +#line 207 "bitbakescanner.l" +{ BEGIN S_PROC; + yyextra->accept (T_PROC_OPEN); } + YY_BREAK +case 23: +/* rule 23 can match eol */ +YY_RULE_SETUP +#line 209 "bitbakescanner.l" +{ BEGIN INITIAL; + yyextra->accept (T_PROC_CLOSE); } + YY_BREAK +case 24: +/* rule 24 can match eol */ +YY_RULE_SETUP +#line 211 "bitbakescanner.l" +{ yyextra->accept (T_PROC_BODY, yytext); } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 213 "bitbakescanner.l" +{ BEGIN S_DEF; } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 214 "bitbakescanner.l" +{ BEGIN S_DEF_ARGS; + yyextra->accept (T_SYMBOL, yytext); } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 216 "bitbakescanner.l" +{ yyextra->accept (T_DEF_ARGS, yytext); } + YY_BREAK +case 28: +/* rule 28 can match eol */ +YY_RULE_SETUP +#line 217 "bitbakescanner.l" +{ BEGIN S_DEF_BODY; } + YY_BREAK +case 29: +/* rule 29 can match eol */ +YY_RULE_SETUP +#line 218 "bitbakescanner.l" +{ yyextra->accept (T_DEF_BODY, yytext); } + YY_BREAK +case 30: +/* rule 30 can match eol */ +YY_RULE_SETUP +#line 219 "bitbakescanner.l" +{ yyextra->accept (T_DEF_BODY, yytext); } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 220 "bitbakescanner.l" +{ BEGIN INITIAL; unput (yytext[0]); } + YY_BREAK +case 32: +/* rule 32 can match eol */ +YY_RULE_SETUP +#line 222 "bitbakescanner.l" +{ } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 224 "bitbakescanner.l" +{ yyextra->accept (T_SYMBOL, yytext); } + YY_BREAK +case 34: +YY_RULE_SETUP +#line 225 "bitbakescanner.l" +{ yyextra->accept (T_VARIABLE, yytext); } + YY_BREAK +case 35: +YY_RULE_SETUP +#line 227 "bitbakescanner.l" +{ yyextra->accept (T_TSYMBOL, yytext); } + YY_BREAK +case 36: +YY_RULE_SETUP +#line 228 "bitbakescanner.l" +{ yyextra->accept (T_FSYMBOL, yytext); } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 229 "bitbakescanner.l" +{ yyextra->accept (T_ISYMBOL, yytext); } + YY_BREAK +case 38: +YY_RULE_SETUP +#line 230 "bitbakescanner.l" +{ BEGIN INITIAL; + yyextra->accept (T_ISYMBOL, yytext); } + YY_BREAK +case 39: +YY_RULE_SETUP +#line 232 "bitbakescanner.l" +{ BEGIN INITIAL; + yyextra->accept (T_ISYMBOL, yytext); } + YY_BREAK +case 40: +/* rule 40 can match eol */ +YY_RULE_SETUP +#line 234 "bitbakescanner.l" +{ BEGIN INITIAL; } + YY_BREAK +case 41: +/* rule 41 can match eol */ +YY_RULE_SETUP +#line 235 "bitbakescanner.l" +{ BEGIN INITIAL; } + YY_BREAK +case 42: +/* rule 42 can match eol */ +YY_RULE_SETUP +#line 236 "bitbakescanner.l" +{ BEGIN INITIAL; } + YY_BREAK +case 43: +/* rule 43 can match eol */ +YY_RULE_SETUP +#line 238 "bitbakescanner.l" +/* Insignificant whitespace */ + YY_BREAK +case 44: +YY_RULE_SETUP +#line 240 "bitbakescanner.l" +{ ERROR (errorUnexpectedInput); } + YY_BREAK +/* Check for premature termination */ +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(S_DEF): +case YY_STATE_EOF(S_DEF_ARGS): +case YY_STATE_EOF(S_DEF_BODY): +case YY_STATE_EOF(S_FUNC): +case YY_STATE_EOF(S_INCLUDE): +case YY_STATE_EOF(S_INHERIT): +case YY_STATE_EOF(S_REQUIRE): +case YY_STATE_EOF(S_PROC): +case YY_STATE_EOF(S_RVALUE): +case YY_STATE_EOF(S_TASK): +#line 243 "bitbakescanner.l" +{ return T_EOF; } + YY_BREAK +case 45: +YY_RULE_SETUP +#line 245 "bitbakescanner.l" +ECHO; + YY_BREAK +#line 1921 "<stdout>" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( yywrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = yyg->yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 798 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + 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; + register char *yy_cp = yyg->yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 798 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 797); + + return yy_is_jam ? 0 : yy_current_state; +} + + static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) +{ + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_cp = yyg->yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yyg->yy_hold_char; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yyg->yy_n_chars + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + if ( c == '\n' ){ + --yylineno; + } + + yyg->yytext_ptr = yy_bp; + yyg->yy_hold_char = *yy_cp; + yyg->yy_c_buf_p = yy_cp; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap(yyscanner ) ) + return EOF; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; + + if ( c == '\n' ) + + do{ yylineno++; + yycolumn=0; + }while(0) +; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + yy_load_buffer_state(yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void yy_load_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ,yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * @param yyscanner The scanner object. + */ + void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ,yyscanner ); + + yyfree((void *) b ,yyscanner ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_flush_buffer(b ,yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state(yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(yyscanner); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void yypop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (yyscan_t yyscanner) +{ + int num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ,yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param str a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @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 * str , yyscan_t yyscanner) +{ + + return yy_scan_bytes(str,strlen(str) ,yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * @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 b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = 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]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + + static void yy_push_state (int new_state , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth ) + { + yy_size_t new_size; + + yyg->yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yyg->yy_start_stack_depth * sizeof( int ); + + if ( ! yyg->yy_start_stack ) + yyg->yy_start_stack = (int *) yyalloc(new_size ,yyscanner ); + + else + yyg->yy_start_stack = (int *) yyrealloc((void *) yyg->yy_start_stack,new_size ,yyscanner ); + + if ( ! yyg->yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); +} + + static void yy_pop_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( --yyg->yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]); +} + + static int yy_top_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1]; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int yyget_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int yyget_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +int yyget_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *yyget_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param line_number + * @param yyscanner The scanner object. + */ +void yyset_lineno (int line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner); + + yylineno = line_number; +} + +/** Set the current column. + * @param line_number + * @param yyscanner The scanner object. + */ +void yyset_column (int column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "yyset_column called with no buffer" , yyscanner); + + yycolumn = column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * @param yyscanner The scanner object. + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = in_str ; +} + +void yyset_out (FILE * out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = out_str ; +} + +int yyget_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void yyset_debug (int bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +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. */ + + 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_start = 0; + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = (int *) 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + 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) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + yyfree(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + yyfree(yyg->yy_start_stack ,yyscanner ); + yyg->yy_start_stack = NULL; + + /* Destroy the main struct (reentrant only). */ + yyfree ( yyscanner , yyscanner ); + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +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]; +} +#endif + +#ifdef YY_NEED_STRLEN +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 ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size , yyscan_t yyscanner) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr , yyscan_t yyscanner) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#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 245 "bitbakescanner.l" + + + +void lex_t::accept (int token, const char* sz) +{ + token_t t; + memset (&t, 0, sizeof (t)); + t.copyString(sz); + + /* tell lemon to parse the token */ + parse (parser, token, t, this); +} + +int lex_t::line ()const +{ + return yyget_lineno (scanner); +} + +void parse (FILE* file, PyObject* data) +{ + void* parser = bbparseAlloc (malloc); + yyscan_t scanner; + lex_t lex; + + yylex_init (&scanner); + + lex.parser = parser; + lex.scanner = scanner; + lex.file = file; + lex.data = data; + lex.parse = bbparse; + yyset_extra (&lex, scanner); + + + int result = yylex (scanner); + + lex.accept (0); + bbparseTrace (NULL, NULL); + + if (result != T_EOF) + printf ("premature end of file\n"); + + yylex_destroy (scanner); + bbparseFree (parser, free); +} + diff --git a/bitbake/lib/bb/parse/parse_c/bitbakeparser.l b/bitbake/lib/bb/parse/parse_c/bitbakescanner.l index ee4ce14839..782bc57a0f 100644 --- a/bitbake/lib/bb/parse/parse_c/bitbakeparser.l +++ b/bitbake/lib/bb/parse/parse_c/bitbakescanner.l @@ -71,6 +71,7 @@ #include "token.h" #include "lexer.h" +#include "bitbakeparser.h" #include <ctype.h> extern void *bbparseAlloc(void *(*mallocProc)(size_t)); @@ -124,6 +125,7 @@ K_AFTER "after" K_BEFORE "before" K_DEF "def" K_INCLUDE "include" +K_REQUIRE "require" K_INHERIT "inherit" K_PYTHON "python" K_FAKEROOT "fakeroot" @@ -149,6 +151,7 @@ PROC \({C_SP}*\) %s S_FUNC %s S_INCLUDE %s S_INHERIT +%s S_REQUIRE %s S_PROC %s S_RVALUE %s S_TASK @@ -186,6 +189,8 @@ PROC \({C_SP}*\) {K_INCLUDE} { BEGIN S_INCLUDE; yyextra->accept (T_INCLUDE); } +{K_REQUIRE} { BEGIN S_REQUIRE; + yyextra->accept (T_REQUIRE); } {K_INHERIT} { BEGIN S_INHERIT; yyextra->accept (T_INHERIT); } {K_ADDTASK} { BEGIN S_TASK; @@ -224,7 +229,8 @@ PROC \({C_SP}*\) <S_INHERIT>{SYMBOL} { yyextra->accept (T_ISYMBOL, yytext); } <S_INCLUDE>{FILENAME} { BEGIN INITIAL; yyextra->accept (T_ISYMBOL, yytext); } - +<S_REQUIRE>{FILENAME} { BEGIN INITIAL; + yyextra->accept (T_ISYMBOL, yytext); } <S_TASK>\n { BEGIN INITIAL; } <S_FUNC>\n { BEGIN INITIAL; } <S_INHERIT>\n { BEGIN INITIAL; } @@ -253,12 +259,7 @@ int lex_t::line ()const return yyget_lineno (scanner); } -const char* lex_t::filename ()const -{ - return m_fileName; -} - -void parse (MappedFile* mf) +void parse (FILE* file, PyObject* data) { void* parser = bbparseAlloc (malloc); yyscan_t scanner; @@ -268,9 +269,8 @@ void parse (MappedFile* mf) lex.parser = parser; lex.scanner = scanner; - lex.mf = mf; - lex.rgbInput = mf->m_rgb; - lex.cbInput = mf->m_cb; + lex.file = file; + lex.data = data; lex.parse = bbparse; yyset_extra (&lex, scanner); @@ -281,7 +281,7 @@ void parse (MappedFile* mf) bbparseTrace (NULL, NULL); if (result != T_EOF) - WARNING ("premature end of file\n"); + printf ("premature end of file\n"); yylex_destroy (scanner); bbparseFree (parser, free); diff --git a/bitbake/lib/bb/parse/parse_c/lexer.h b/bitbake/lib/bb/parse/parse_c/lexer.h index 1edf72dcf5..0a985edf23 100644 --- a/bitbake/lib/bb/parse/parse_c/lexer.h +++ b/bitbake/lib/bb/parse/parse_c/lexer.h @@ -24,17 +24,29 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef LEXER_H #define LEXER_H +/* + * The PyObject Token. Likely to be + * a bb.data implementation + */ +struct PyObject; + + +/** + * This is used by the Parser and Scanner + * of BitBake. + * The implementation and creation is done + * in the scanner. + */ struct lex_t { void *parser; void *scanner; + FILE *file; + PyObject *data; void* (*parse)(void*, int, token_t, lex_t*); void accept(int token, const char* string = 0); - void input(char *buf, int *result, int_max_size); + void input(char *buf, int *result, int max_size); int line()const; - const char* filename()const; -private: - const char* m_fileName; }; diff --git a/bitbake/lib/bb/parse/parse_c/python_output.h b/bitbake/lib/bb/parse/parse_c/python_output.h new file mode 100644 index 0000000000..de7544cc9d --- /dev/null +++ b/bitbake/lib/bb/parse/parse_c/python_output.h @@ -0,0 +1,51 @@ +#ifndef PYTHON_OUTPUT_H +#define PYTHON_OUTPUT_H +/* +Copyright (C) 2006 Holger Hans Peter Freyther + +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. + +This is the glue: + It will be called from the lemon grammar and will call into + python to set certain things. + +*/ + +struct lex_t; + +extern void e_assign(lex_t*, const char*, const char*); +extern void e_export(lex_t*, const char*); +extern void e_immediate(lex_t*, const char*, const char*); +extern void e_cond(lex_t*, const char*, const char*); +extern void e_assign(lex_t*, const char*, const char*); +extern void e_prepend(lex_t*, const char*, const char*); +extern void e_append(lex_t*, const char*, const char*); +extern void e_addtask(lex_t*, const char*, const char*, const char*); +extern void e_addhandler(lex_t*,const char*); +extern void e_export_func(lex_t*, const char*); +extern void e_inherit(lex_t*, const char*); +extern void e_include(lex_t*, const char*); +extern void e_require(lex_t*, const char*); +extern void e_proc(lex_t*, const char*, const char*); +extern void e_proc_python(lex_t*, const char*, const char*); +extern void e_proc_fakeroot(lex_t*, const char*, const char*); +extern void e_def(lex_t*, const char*, const char*, const char*); +extern void e_parse_error(lex_t*); + +#endif // PYTHON_OUTPUT_H diff --git a/bitbake/lib/bb/parse/parse_c/token.h b/bitbake/lib/bb/parse/parse_c/token.h index 2351fda6b5..c6242015b7 100644 --- a/bitbake/lib/bb/parse/parse_c/token.h +++ b/bitbake/lib/bb/parse/parse_c/token.h @@ -24,13 +24,24 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef TOKEN_H #define TOKEN_H +#include <ctype.h> +#include <string.h> + #define PURE_METHOD + +/** + * Special Value for End Of File Handling. We set it to + * 1001 so we can have up to 1000 Terminal Symbols on + * grammar. Currenlty we have around 20 + */ +#define T_EOF 1001 + struct token_t { const char* string()const PURE_METHOD; static char* concatString(const char* l, const char* r); - void assignString(const char* str); + void assignString(char* str); void copyString(const char* str); void release_this(); @@ -51,15 +62,17 @@ inline const char* token_t::string()const inline char* token_t::concatString(const char* l, const char* r) { size_t cb = (l ? strlen (l) : 0) + strlen (r) + 1; - r_sz = new char[cb]; + char *r_sz = new char[cb]; *r_sz = 0; - if (l) strcat (r_sz, l); + + if (l) + strcat (r_sz, l); strcat (r_sz, r); return r_sz; } -inline void token_t::assignString(const char* str) +inline void token_t::assignString(char* str) { m_string = str; m_stringLen = str ? strlen(str) : 0; @@ -70,7 +83,7 @@ inline void token_t::copyString(const char* str) if( str ) { m_stringLen = strlen(str); m_string = new char[m_stringLen+1]; - strcpy(m_string, str) + strcpy(m_string, str); } } diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index fac3e85b36..422ce6f9ef 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py @@ -22,7 +22,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.""" import re, bb, os, sys -import bb.fetch, bb.build +import bb.fetch, bb.build, bb.utils from bb import debug, data, fetch, fatal from ConfHandler import include, localpath, obtain, init @@ -206,8 +206,8 @@ def feeder(lineno, s, fn, d): return else: text = '\n'.join(__body__) - comp = compile(text, "<bb>", "exec") - exec comp in __builtins__ + comp = bb.utils.better_compile(text, "<bb>", fn ) + bb.utils.better_exec(comp, __builtins__, text, fn) __body__ = [] __inpython__ = False funcs = data.getVar('__functions__', d) or "" diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index e2319aa123..5b3cb38d81 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -86,10 +86,77 @@ def explode_deps(s): j = [] if flag: j.append(i) - if i.endswith(')'): + else: + r.append(i) + if flag and i.endswith(')'): flag = False # Ignore version #r[-1] += ' ' + ' '.join(j) - else: - r.append(i) return r + + + +def _print_trace(body, line): + """ + Print the Environment of a Text Body + """ + import bb + + # print the environment of the method + bb.error("Printing the environment of the function") + min_line = max(1,line-4) + max_line = min(line+4,len(body)-1) + for i in range(min_line,max_line+1): + bb.error("\t%.4d:%s" % (i, body[i-1]) ) + + +def better_compile(text, file, realfile): + """ + A better compile method. This method + will print the offending lines. + """ + try: + return compile(text, file, "exec") + except Exception, e: + import bb,sys + + # split the text into lines again + body = text.split('\n') + bb.error("Error in compiling: ", realfile) + bb.error("The lines resulting into this error were:") + bb.error("\t%d:%s:'%s'" % (e.lineno, e.__class__.__name__, body[e.lineno-1])) + + _print_trace(body, e.lineno) + + # exit now + sys.exit(1) + +def better_exec(code, context, text, realfile): + """ + Similiar to better_compile, better_exec will + print the lines that are responsible for the + error. + """ + import bb,sys + try: + exec code in context + except: + (t,value,tb) = sys.exc_info() + + if t in [bb.parse.SkipPackage, bb.build.FuncFailed]: + raise + + # print the Header of the Error Message + bb.error("Error in executing: ", realfile) + bb.error("Exception:%s Message:%s" % (t,value) ) + + # let us find the line number now + while tb.tb_next: + tb = tb.tb_next + + import traceback + line = traceback.tb_lineno(tb) + + _print_trace( text.split('\n'), line ) + + raise |