Skip to content

Commit c7685a4

Browse files
committed
Added extension skeleton files
1 parent 65ee288 commit c7685a4

File tree

4 files changed

+47
-2
lines changed

4 files changed

+47
-2
lines changed

parser/build-linux renamed to build-linux

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
#!/usr/bin/env bash
2+
#
3+
# Zephir Parser
4+
#
5+
# Copyright (c) 2013-2017 Zephir Team and contributors
6+
#
7+
# This source file is subject the MIT license, that is bundled with
8+
# this package in the file LICENSE, and is available through the
9+
# world-wide-web at the following url:
10+
# http://zephir-lang.com/license.html
11+
#
12+
# If you did not receive a copy of the MIT license and are unable
13+
# to obtain it through the world-wide-web, please send a note to
14+
# license@zephir-lang.com so we can mail you a copy immediately.
15+
16+
CURRENT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
217

318
CC=${CC:-}
419

@@ -29,6 +44,8 @@ if [ x"$RE2C_BIN" = x ]; then
2944
exit 2
3045
fi
3146

47+
cd ${CURRENT_DIR}/parser
48+
3249
${RE2C_BIN} -o scanner.c scanner.re
3350

3451
# Compile lemon
@@ -44,7 +61,6 @@ if [ ! -f parser.php5.c ]; then
4461
fi
4562
echo
4663

47-
echo -e "Generating PHP 7 parser..."
4864
./lemon -s parser.php7.lemon
4965
if [ ! -f parser.php7.c ]; then
5066
echo "error: couldn't generate parser"
@@ -62,3 +78,5 @@ cat base.c >> parser.c
6278

6379
sed s/"\#line"/"\/\/"/g scanner.c > xx && mv -f xx scanner.c
6480
sed s/"#line"/"\/\/"/g parser.c > xx && mv -f xx parser.c
81+
82+
cd ${CURRENT_DIR}

config.m4

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
dnl $Id$
2+
dnl config.m4 for extension zephir_parser
3+
4+
dnl Comments in this file start with the string 'dnl'.
5+
dnl Remove where necessary. This file will not work
6+
dnl without editing.
7+
8+
PHP_ARG_ENABLE(zephir-parser, whether to enable zephir_parser,
9+
[ --enable-zephir-parser Enable Zephir Parser])
10+
11+
if test "$PHP_ZEPHIR_PARSER" = "yes"; then
12+
AC_DEFINE(HAVE_ZEPHIR_PARSER, 1, [Whether you have zephir_parser])
13+
zephir_parser_sources="zephir_parser.c parser/parser.c parser/scanner.c"
14+
PHP_NEW_EXTENSION(zephir_parser, $zephir_parser_sources, $ext_shared, "")
15+
PHP_SUBST(ZEPHIR_PARSER_SHARED_LIBADD)
16+
17+
old_CPPFLAGS=$CPPFLAGS
18+
CPPFLAGS="$CPPFLAGS $INCLUDES"
19+
20+
CPPFLAGS=$old_CPPFLAGS
21+
fi

config.w32

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ARG_ENABLE("zephir-parser", "enable zephir_parser", "no");
2+
3+
if (PHP_ZEPHIR_PARSER != "no") {
4+
EXTENSION("zephir_parser", "zephir_parser.c", null, "-I"+configure_module_dirname);
5+
ADD_SOURCES(configure_module_dirname + "/parser", "parser.c scanner.c", "zephir_parser");
6+
}

parser/base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
/*
33
+--------------------------------------------------------------------------+
4-
| Zephir Language |
4+
| Zephir Parser |
55
+--------------------------------------------------------------------------+
66
| Copyright (c) 2013-2017 Zephir Team and contributors |
77
+--------------------------------------------------------------------------+

0 commit comments

Comments
 (0)