diff options
| author | Richard Purdie <richard@openedhand.com> | 2007-11-17 22:21:42 +0000 |
|---|---|---|
| committer | Richard Purdie <richard@openedhand.com> | 2007-11-17 22:21:42 +0000 |
| commit | 636e360eea3a0faadd669a409b76fae372c6c38b (patch) | |
| tree | 19efa4ed475df669bbbbfac8c69a76415d1a8030 /bitbake/lib/bb/parse | |
| parent | 688eca78c088dc45957dde6cc74204f5ac83e5ca (diff) | |
| download | openembedded-core-636e360eea3a0faadd669a409b76fae372c6c38b.tar.gz openembedded-core-636e360eea3a0faadd669a409b76fae372c6c38b.tar.bz2 openembedded-core-636e360eea3a0faadd669a409b76fae372c6c38b.zip | |
Remove broken c based parser code
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3192 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/lib/bb/parse')
| -rw-r--r-- | bitbake/lib/bb/parse/parse_c/BBHandler.py | 188 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/parse_c/Makefile | 36 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/parse_c/README.build | 12 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/parse_c/__init__.py | 28 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/parse_c/bitbakec.pyx | 253 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/parse_c/bitbakeparser.cc | 1157 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/parse_c/bitbakeparser.h | 29 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/parse_c/bitbakeparser.y | 179 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/parse_c/bitbakescanner.cc | 3209 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/parse_c/bitbakescanner.l | 319 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/parse_c/lexer.h | 48 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/parse_c/lexerc.h | 19 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/parse_c/python_output.h | 56 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/parse_c/token.h | 96 |
14 files changed, 0 insertions, 5629 deletions
diff --git a/bitbake/lib/bb/parse/parse_c/BBHandler.py b/bitbake/lib/bb/parse/parse_c/BBHandler.py deleted file mode 100644 index b430e1f4e5..0000000000 --- a/bitbake/lib/bb/parse/parse_c/BBHandler.py +++ /dev/null @@ -1,188 +0,0 @@ -# ex:ts=4:sw=4:sts=4:et -# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- -"""class for handling .bb files (using a C++ parser) - - Reads a .bb file and obtains its metadata (using a C++ parser) - - Copyright (C) 2006 Tim Robert Ansell - Copyright (C) 2006 Holger Hans Peter Freyther - - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT - SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR - THE USE OR OTHER DEALINGS IN THE SOFTWARE. -""" - -import os, sys - -# The Module we will use here -import bb - -from bitbakec import parsefile - -# -# 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. - -def _init(fn, d): - """ - Initialize the data implementation with values of - the environment and data from the file. - """ - pass - -# -# public -# -def supports(fn, data): - return fn[-3:] == ".bb" or fn[-8:] == ".bbclass" or fn[-4:] == ".inc" or fn[-5:] == ".conf" - -def init(fn, data): - if not bb.data.getVar('TOPDIR', data): - bb.data.setVar('TOPDIR', os.getcwd(), data) - if not bb.data.getVar('BBPATH', data): - bb.data.setVar('BBPATH', os.path.join(sys.prefix, 'share', 'bitbake'), data) - -def handle_inherit(d): - """ - Handle inheriting of classes. This will load all default classes. - It could be faster, it could detect infinite loops but this is todo - Also this delayed loading of bb.parse could impose a penalty - """ - from bb.parse import handle - - files = (data.getVar('INHERIT', d, True) or "").split() - if not "base" in i: - files[0:0] = ["base"] - - __inherit_cache = data.getVar('__inherit_cache', d) or [] - for f in files: - file = data.expand(f, d) - if file[0] != "/" and file[-8:] != ".bbclass": - file = os.path.join('classes', '%s.bbclass' % file) - - if not file in __inherit_cache: - debug(2, "BB %s:%d: inheriting %s" % (fn, lineno, file)) - __inherit_cache.append( file ) - - try: - handle(file, d, True) - except IOError: - print "Failed to inherit %s" % file - data.setVar('__inherit_cache', __inherit_cache, d) - - -def handle(fn, d, include): - from bb import data, parse - - (root, ext) = os.path.splitext(os.path.basename(fn)) - base_name = "%s%s" % (root,ext) - - # initialize with some data - init(fn,d) - - # check if we include or are the beginning - oldfile = None - if include: - oldfile = d.getVar('FILE', False) - is_conf = False - elif ext == ".conf": - is_conf = True - data.inheritFromOS(d) - - # find the file - if not os.path.isabs(fn): - abs_fn = bb.which(d.getVar('BBPATH', True), fn) - else: - abs_fn = fn - - # check if the file exists - if not os.path.exists(abs_fn): - raise IOError("file '%(fn)s' not found" % locals() ) - - # now we know the file is around mark it as dep - if include: - parse.mark_dependency(d, abs_fn) - - # manipulate the bbpath - if ext != ".bbclass" and ext != ".conf": - old_bb_path = data.getVar('BBPATH', d) - data.setVar('BBPATH', os.path.dirname(abs_fn) + (":%s" %old_bb_path) , d) - - # handle INHERITS and base inherit - if ext != ".bbclass" and ext != ".conf": - data.setVar('FILE', fn, d) - handle_interit(d) - - # now parse this file - by defering it to C++ - parsefile(abs_fn, d, is_conf) - - # Finish it up - if include == 0: - data.expandKeys(d) - data.update_data(d) - #### !!! XXX Finish it up by executing the anonfunc - - - # restore the original FILE - if oldfile: - d.setVar('FILE', oldfile) - - # restore bbpath - if ext != ".bbclass" and ext != ".conf": - data.setVar('BBPATH', old_bb_path, d ) - - - return d - - -# Needed for BitBake files... -__pkgsplit_cache__={} -def vars_from_file(mypkg, d): - if not mypkg: - return (None, None, None) - if mypkg in __pkgsplit_cache__: - return __pkgsplit_cache__[mypkg] - - myfile = os.path.splitext(os.path.basename(mypkg)) - parts = myfile[0].split('_') - __pkgsplit_cache__[mypkg] = parts - exp = 3 - len(parts) - tmplist = [] - while exp != 0: - exp -= 1 - tmplist.append(None) - parts.extend(tmplist) - return parts - - - - -# Inform bitbake that we are a parser -# We need to define all three -from bb.parse import handlers -handlers.append( {'supports' : supports, 'handle': handle, 'init' : init}) -del handlers diff --git a/bitbake/lib/bb/parse/parse_c/Makefile b/bitbake/lib/bb/parse/parse_c/Makefile deleted file mode 100644 index 77daccb72d..0000000000 --- a/bitbake/lib/bb/parse/parse_c/Makefile +++ /dev/null @@ -1,36 +0,0 @@ - -buil: bitbakec.so - echo "Done" - -bitbakescanner.cc: bitbakescanner.l - flex -t bitbakescanner.l > bitbakescanner.cc - -bitbakeparser.cc: bitbakeparser.y python_output.h - lemon bitbakeparser.y - mv bitbakeparser.c bitbakeparser.cc - -bitbakec.c: bitbakec.pyx - pyrexc bitbakec.pyx - -bitbakec-processed.c: bitbakec.c - cat bitbakec.c | sed -e"s/__pyx_f_8bitbakec_//" > bitbakec-processed.c - -bitbakec.o: bitbakec-processed.c - gcc -c bitbakec-processed.c -o bitbakec.o -fPIC -I/usr/include/python2.4 - -bitbakeparser.o: bitbakeparser.cc - g++ -c bitbakeparser.cc -fPIC -I/usr/include/python2.4 - -bitbakescanner.o: bitbakescanner.cc - g++ -c bitbakescanner.cc -fPIC -I/usr/include/python2.4 - -bitbakec.so: bitbakec.o bitbakeparser.o bitbakescanner.o - g++ -shared -fPIC bitbakeparser.o bitbakescanner.o bitbakec.o -o bitbakec.so - -clean: - rm -f *.out - rm -f *.cc - rm -f bitbakec.c - rm -f bitbakec-processed.c - rm -f *.o - rm -f *.so diff --git a/bitbake/lib/bb/parse/parse_c/README.build b/bitbake/lib/bb/parse/parse_c/README.build deleted file mode 100644 index eb6ad8c862..0000000000 --- a/bitbake/lib/bb/parse/parse_c/README.build +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index bbb318e51f..0000000000 --- a/bitbake/lib/bb/parse/parse_c/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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/bitbakec.pyx b/bitbake/lib/bb/parse/parse_c/bitbakec.pyx deleted file mode 100644 index c666e9b6b1..0000000000 --- a/bitbake/lib/bb/parse/parse_c/bitbakec.pyx +++ /dev/null @@ -1,253 +0,0 @@ -# ex:ts=4:sw=4:sts=4:et -# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- - -cdef extern from "stdio.h": - ctypedef int FILE - FILE *fopen(char*, char*) - int fclose(FILE *fp) - -cdef extern from "string.h": - int strlen(char*) - -cdef extern from "lexerc.h": - ctypedef struct lex_t: - void* parser - void* scanner - char* name - FILE* file - int config - void* data - - int lineError - int errorParse - - cdef extern int parse(FILE*, char*, object, int) - -def parsefile(object file, object data, object config): - #print "parsefile: 1", file, data - - # Open the file - cdef FILE* f - - f = fopen(file, "r") - #print "parsefile: 2 opening file" - if (f == NULL): - raise IOError("No such file %s." % file) - - #print "parsefile: 3 parse" - parse(f, file, data, config) - - # Close the file - fclose(f) - - -cdef public void e_assign(lex_t* container, char* key, char* what): - #print "e_assign", key, what - if what == NULL: - print "FUTURE Warning empty string: use \"\"" - what = "" - - d = <object>container.data - d.setVar(key, what) - -cdef public void e_export(lex_t* c, char* what): - #print "e_export", what - #exp: - # bb.data.setVarFlag(key, "export", 1, data) - d = <object>c.data - d.setVarFlag(what, "export", 1) - -cdef public void e_immediate(lex_t* c, char* key, char* what): - #print "e_immediate", key, what - #colon: - # val = bb.data.expand(groupd["value"], data) - d = <object>c.data - d.setVar(key, d.expand(what,d)) - -cdef public void e_cond(lex_t* c, char* key, char* what): - #print "e_cond", key, what - #ques: - # val = bb.data.getVar(key, data) - # if val == None: - # val = groupd["value"] - if what == NULL: - print "FUTURE warning: Use \"\" for", key - what = "" - - d = <object>c.data - d.setVar(key, (d.getVar(key,False) or what)) - -cdef public void e_prepend(lex_t* c, char* key, char* what): - #print "e_prepend", key, what - #prepend: - # val = "%s %s" % (groupd["value"], (bb.data.getVar(key, data) or "")) - d = <object>c.data - d.setVar(key, what + " " + (d.getVar(key,0) or "")) - -cdef public void e_append(lex_t* c, char* key, char* what): - #print "e_append", key, what - #append: - # val = "%s %s" % ((bb.data.getVar(key, data) or ""), groupd["value"]) - d = <object>c.data - d.setVar(key, (d.getVar(key,0) or "") + " " + what) - -cdef public void e_precat(lex_t* c, char* key, char* what): - #print "e_precat", key, what - #predot: - # val = "%s%s" % (groupd["value"], (bb.data.getVar(key, data) or "")) - d = <object>c.data - d.setVar(key, what + (d.getVar(key,0) or "")) - -cdef public void e_postcat(lex_t* c, char* key, char* what): - #print "e_postcat", key, what - #postdot: - # val = "%s%s" % ((bb.data.getVar(key, data) or ""), groupd["value"]) - d = <object>c.data - d.setVar(key, (d.getVar(key,0) or "") + what) - -cdef public int e_addtask(lex_t* c, char* name, char* before, char* after) except -1: - #print "e_addtask", name - # func = m.group("func") - # before = m.group("before") - # after = m.group("after") - # if func is None: - # return - # var = "do_" + func - # - # data.setVarFlag(var, "task", 1, d) - # - # if after is not None: - # # set up deps for function - # data.setVarFlag(var, "deps", after.split(), d) - # if before is not None: - # # set up things that depend on this func - # data.setVarFlag(var, "postdeps", before.split(), d) - # return - - if c.config == 1: - from bb.parse import ParseError - raise ParseError("No tasks allowed in config files") - return -1 - - d = <object>c.data - do = "do_%s" % name - d.setVarFlag(do, "task", 1) - - if before != NULL and strlen(before) > 0: - #print "Before", before - d.setVarFlag(do, "postdeps", ("%s" % before).split()) - if after != NULL and strlen(after) > 0: - #print "After", after - d.setVarFlag(do, "deps", ("%s" % after).split()) - - return 0 - -cdef public int e_addhandler(lex_t* c, char* h) except -1: - #print "e_addhandler", h - # data.setVarFlag(h, "handler", 1, d) - if c.config == 1: - from bb.parse import ParseError - raise ParseError("No handlers allowed in config files") - return -1 - - d = <object>c.data - d.setVarFlag(h, "handler", 1) - return 0 - -cdef public int e_export_func(lex_t* c, char* function) except -1: - #print "e_export_func", function - if c.config == 1: - from bb.parse import ParseError - raise ParseError("No functions allowed in config files") - return -1 - - return 0 - -cdef public int e_inherit(lex_t* c, char* file) except -1: - #print "e_inherit", file - - if c.config == 1: - from bb.parse import ParseError - raise ParseError("No inherits allowed in config files") - return -1 - - return 0 - -cdef public void e_include(lex_t* c, char* file): - from bb.parse import handle - d = <object>c.data - - try: - handle(d.expand(file,d), d, True) - except IOError: - print "Could not include file", file - - -cdef public int e_require(lex_t* c, char* file) except -1: - #print "e_require", file - from bb.parse import handle - d = <object>c.data - - try: - handle(d.expand(file,d), d, True) - except IOError: - print "ParseError", file - from bb.parse import ParseError - raise ParseError("Could not include required file %s" % file) - return -1 - - return 0 - -cdef public int e_proc(lex_t* c, char* key, char* what) except -1: - #print "e_proc", key, what - if c.config == 1: - from bb.parse import ParseError - raise ParseError("No inherits allowed in config files") - return -1 - - return 0 - -cdef public int e_proc_python(lex_t* c, char* key, char* what) except -1: - #print "e_proc_python" - if c.config == 1: - from bb.parse import ParseError - raise ParseError("No pythin allowed in config files") - return -1 - - if key != NULL: - pass - #print "Key", key - if what != NULL: - pass - #print "What", what - - return 0 - -cdef public int e_proc_fakeroot(lex_t* c, char* key, char* what) except -1: - #print "e_fakeroot", key, what - - if c.config == 1: - from bb.parse import ParseError - raise ParseError("No fakeroot allowed in config files") - return -1 - - return 0 - -cdef public int e_def(lex_t* c, char* a, char* b, char* d) except -1: - #print "e_def", a, b, d - - if c.config == 1: - from bb.parse import ParseError - raise ParseError("No defs allowed in config files") - return -1 - - return 0 - -cdef public int e_parse_error(lex_t* c) except -1: - print "e_parse_error", c.name, "line:", lineError, "parse:", errorParse - - - from bb.parse import ParseError - raise ParseError("There was an parse error, sorry unable to give more information at the current time. File: %s Line: %d" % (c.name,lineError) ) - return -1 - diff --git a/bitbake/lib/bb/parse/parse_c/bitbakeparser.cc b/bitbake/lib/bb/parse/parse_c/bitbakeparser.cc deleted file mode 100644 index 9d9793f8df..0000000000 --- a/bitbake/lib/bb/parse/parse_c/bitbakeparser.cc +++ /dev/null @@ -1,1157 +0,0 @@ -/* 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 44 -#define YYACTIONTYPE unsigned char -#define bbparseTOKENTYPE token_t -typedef union { - bbparseTOKENTYPE yy0; - int yy87; -} 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 82 -#define YYNRULE 45 -#define YYERRORSYMBOL 30 -#define YYERRSYMDT yy87 -#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 */ 82, 3, 7, 8, 38, 22, 39, 24, 26, 32, - /* 10 */ 34, 28, 30, 2, 21, 40, 53, 70, 55, 44, - /* 20 */ 60, 65, 67, 128, 1, 36, 69, 77, 42, 46, - /* 30 */ 11, 66, 13, 15, 17, 19, 64, 62, 9, 7, - /* 40 */ 74, 38, 45, 81, 59, 57, 38, 38, 73, 76, - /* 50 */ 5, 68, 52, 50, 14, 31, 47, 71, 48, 10, - /* 60 */ 72, 33, 23, 49, 6, 41, 51, 78, 75, 16, - /* 70 */ 4, 54, 35, 25, 18, 80, 79, 56, 27, 37, - /* 80 */ 58, 12, 61, 29, 43, 63, 20, -}; -static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 0, 1, 2, 3, 23, 4, 25, 6, 7, 8, - /* 10 */ 9, 10, 11, 33, 34, 15, 16, 1, 18, 14, - /* 20 */ 20, 21, 22, 31, 32, 24, 26, 27, 13, 14, - /* 30 */ 4, 19, 6, 7, 8, 9, 39, 40, 1, 2, - /* 40 */ 24, 23, 12, 25, 37, 38, 23, 23, 25, 25, - /* 50 */ 42, 19, 35, 36, 5, 5, 12, 24, 13, 34, - /* 60 */ 41, 5, 5, 12, 28, 12, 35, 1, 41, 5, - /* 70 */ 29, 1, 5, 5, 5, 41, 24, 17, 5, 41, - /* 80 */ 37, 5, 19, 5, 12, 39, 5, -}; -#define YY_SHIFT_USE_DFLT (-20) -static const signed char yy_shift_ofst[] = { - /* 0 */ -20, 0, -20, 41, -20, 36, -20, -20, 37, -20, - /* 10 */ 26, 76, -20, 49, -20, 64, -20, 69, -20, 81, - /* 20 */ -20, 1, 57, -20, 68, -20, 73, -20, 78, -20, - /* 30 */ 50, -20, 56, -20, 67, -20, -20, -19, -20, -20, - /* 40 */ 53, 15, 72, 5, 30, -20, 44, 45, 51, -20, - /* 50 */ 53, -20, -20, 70, -20, 60, -20, 60, -20, -20, - /* 60 */ 63, -20, 63, -20, -20, 12, -20, 32, -20, 16, - /* 70 */ 33, -20, 23, -20, -20, 24, -20, 66, 52, -20, - /* 80 */ 18, -20, -}; -#define YY_REDUCE_USE_DFLT (-21) -static const signed char yy_reduce_ofst[] = { - /* 0 */ -8, -20, -21, -21, 8, -21, -21, -21, 25, -21, - /* 10 */ -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - /* 20 */ -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - /* 30 */ -21, -21, -21, -21, -21, -21, 38, -21, -21, -21, - /* 40 */ 17, -21, -21, -21, -21, -21, -21, -21, -21, -21, - /* 50 */ 31, -21, -21, -21, -21, 7, -21, 43, -21, -21, - /* 60 */ -3, -21, 46, -21, -21, -21, -21, -21, -21, -21, - /* 70 */ -21, 19, -21, -21, 27, -21, -21, -21, -21, 34, - /* 80 */ -21, -21, -}; -static const YYACTIONTYPE yy_default[] = { - /* 0 */ 84, 127, 83, 85, 125, 126, 124, 86, 127, 85, - /* 10 */ 127, 127, 87, 127, 88, 127, 89, 127, 90, 127, - /* 20 */ 91, 127, 127, 92, 127, 93, 127, 94, 127, 95, - /* 30 */ 127, 96, 127, 97, 127, 98, 119, 127, 118, 120, - /* 40 */ 127, 101, 127, 102, 127, 99, 127, 103, 127, 100, - /* 50 */ 106, 104, 105, 127, 107, 127, 108, 111, 109, 110, - /* 60 */ 127, 112, 115, 113, 114, 127, 116, 127, 117, 127, - /* 70 */ 127, 119, 127, 121, 119, 127, 122, 127, 127, 119, - /* 80 */ 127, 123, -}; -#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_PREDOT", "OP_POSTDOT", - "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_PREDOT STRING", - /* 7 */ "statement ::= EXPORT variable OP_POSTDOT STRING", - /* 8 */ "statement ::= EXPORT variable OP_IMMEDIATE STRING", - /* 9 */ "statement ::= EXPORT variable OP_COND STRING", - /* 10 */ "statement ::= variable OP_ASSIGN STRING", - /* 11 */ "statement ::= variable OP_PREDOT STRING", - /* 12 */ "statement ::= variable OP_POSTDOT STRING", - /* 13 */ "statement ::= variable OP_PREPEND STRING", - /* 14 */ "statement ::= variable OP_APPEND STRING", - /* 15 */ "statement ::= variable OP_IMMEDIATE STRING", - /* 16 */ "statement ::= variable OP_COND STRING", - /* 17 */ "task ::= TSYMBOL BEFORE TSYMBOL AFTER TSYMBOL", - /* 18 */ "task ::= TSYMBOL AFTER TSYMBOL BEFORE TSYMBOL", - /* 19 */ "task ::= TSYMBOL", - /* 20 */ "task ::= TSYMBOL BEFORE TSYMBOL", - /* 21 */ "task ::= TSYMBOL AFTER TSYMBOL", - /* 22 */ "tasks ::= tasks task", - /* 23 */ "tasks ::= task", - /* 24 */ "statement ::= ADDTASK tasks", - /* 25 */ "statement ::= A |
