Annotation of embedaddon/php/ext/tokenizer/tokenizer_data_gen.sh, revision 1.1

1.1     ! misho       1: #!/bin/sh
        !             2: 
        !             3: INFILE="../../Zend/zend_language_parser.h"
        !             4: OUTFILE="tokenizer_data.c"
        !             5: AWK=awk
        !             6: 
        !             7: ####################################################################
        !             8: 
        !             9: if test ! -f "./tokenizer.c"; then
        !            10:     echo "Please run this script from within php-src/ext/tokenizer"
        !            11:     exit 0
        !            12: fi
        !            13: 
        !            14: 
        !            15: echo '/*
        !            16:    +----------------------------------------------------------------------+
        !            17:    | PHP Version 5                                                        |
        !            18:    +----------------------------------------------------------------------+
        !            19:    | Copyright (c) 1997-2012 The PHP Group                                |
        !            20:    +----------------------------------------------------------------------+
        !            21:    | This source file is subject to version 3.01 of the PHP license,      |
        !            22:    | that is bundled with this package in the file LICENSE, and is        |
        !            23:    | available through the world-wide-web at the following url:           |
        !            24:    | http://www.php.net/license/3_01.txt                                  |
        !            25:    | If you did not receive a copy of the PHP license and are unable to   |
        !            26:    | obtain it through the world-wide-web, please send a note to          |
        !            27:    | license@php.net so we can mail you a copy immediately.               |
        !            28:    +----------------------------------------------------------------------+
        !            29:    | Author: Johannes Schlueter <johannes@php.net>                        |
        !            30:    +----------------------------------------------------------------------+
        !            31: */
        !            32: 
        !            33: /* $Id: tokenizer_data_gen.sh,v 1.1.2.2.2.1 2008-02-12 00:45:14 stas Exp $ */
        !            34: 
        !            35: /*
        !            36:    DO NOT EDIT THIS FILE!
        !            37:    This file is generated using tokenizer_data_gen.sh
        !            38: */
        !            39: 
        !            40: #include "php.h"
        !            41: #include "zend.h"
        !            42: #include <zend_language_parser.h>
        !            43: 
        !            44: ' > $OUTFILE
        !            45: 
        !            46: 
        !            47: echo 'void tokenizer_register_constants(INIT_FUNC_ARGS) {' >> $OUTFILE
        !            48: $AWK '/^#define T_/  { print " REGISTER_LONG_CONSTANT(\"" $2 "\", " $2 ", CONST_CS | CONST_PERSISTENT);" }' < $INFILE >> $OUTFILE
        !            49: echo ' REGISTER_LONG_CONSTANT("T_DOUBLE_COLON", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT);' >> $OUTFILE
        !            50: echo '}' >> $OUTFILE
        !            51: 
        !            52: 
        !            53: echo '
        !            54: char *get_token_type_name(int token_type)
        !            55: {
        !            56:        switch (token_type) {
        !            57: ' >> $OUTFILE
        !            58: 
        !            59: $AWK '
        !            60:        /^#define T_PAAMAYIM_NEKUDOTAYIM/ {
        !            61:                print "         case T_PAAMAYIM_NEKUDOTAYIM: return \"T_DOUBLE_COLON\";"
        !            62:                next
        !            63:        }
        !            64:        /^#define T_/ {
        !            65:                print "         case " $2 ": return \"" $2 "\";"
        !            66:        }
        !            67: ' < $INFILE >> $OUTFILE
        !            68: 
        !            69: echo '
        !            70:        }
        !            71:        return "UNKNOWN";
        !            72: }
        !            73: ' >> $OUTFILE
        !            74: 
        !            75: echo "Wrote $OUTFILE"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>