Skip to content
This repository has been archived by the owner on Feb 6, 2019. It is now read-only.

Commit

Permalink
Updated parser & leer to be usable with re2c
Browse files Browse the repository at this point in the history
Fixes some weird temporary compilation errors too
  • Loading branch information
bwoebi committed Jun 8, 2014
1 parent 7b93679 commit 4c79fe6
Show file tree
Hide file tree
Showing 11 changed files with 1,552 additions and 3,117 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,4 +2,5 @@
phpdbg
*.lo
*.o
*.output
build
15 changes: 9 additions & 6 deletions Makefile.frag
Expand Up @@ -8,14 +8,17 @@ $(BUILD_SHARED): $(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) $(PHP_PHPDBG_OBJS)
$(BUILD_BINARY): $(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) $(PHP_PHPDBG_OBJS)
$(BUILD_PHPDBG)

$(builddir)/sapi/phpdbg/phpdbg_lexer.lo: $(srcdir)/sapi/phpdbg/phpdbg_parser.h
%.c: %.y
%.c: %.l

$(srcdir)/sapi/phpdbg/phpdbg_lexer.c: $(srcdir)/sapi/phpdbg/phpdbg_lexer.l
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --no-generation-date -cbdFo sapi/phpdbg/phpdbg_lexer.c sapi/phpdbg/phpdbg_lexer.l)
$(builddir)/phpdbg_lexer.lo: $(srcdir)/phpdbg_parser.h

$(srcdir)/sapi/phpdbg/phpdbg_parser.h: $(srcdir)/sapi/phpdbg/phpdbg_parser.c
$(srcdir)/sapi/phpdbg/phpdbg_parser.c: $(srcdir)/sapi/phpdbg/phpdbg_parser.y
@$(YACC) -p phpdbg_ -v -d $(srcdir)/sapi/phpdbg/phpdbg_parser.y -o $@
$(srcdir)/phpdbg_lexer.c: $(srcdir)/phpdbg_lexer.l
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --no-generation-date -cbdFo $(srcdir)/phpdbg_lexer.c $(srcdir)/phpdbg_lexer.l)

$(srcdir)/phpdbg_parser.h: $(srcdir)/phpdbg_parser.c
$(srcdir)/phpdbg_parser.c: $(srcdir)/phpdbg_parser.y
@$(YACC) -p phpdbg_ -v -d $(srcdir)/phpdbg_parser.y -o $@

install-phpdbg: $(BUILD_BINARY)
@echo "Installing phpdbg binary: $(INSTALL_ROOT)$(bindir)/"
Expand Down
2 changes: 1 addition & 1 deletion config.m4
Expand Up @@ -28,7 +28,7 @@ if test "$PHP_PHPDBG" != "no"; then
PHP_SUBST(PHP_PHPDBG_FILES)
PHP_SUBST(PHPDBG_EXTRA_LIBS)

PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/phpdbg/Makefile.frag])
PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/phpdbg/Makefile.frag], [$abs_srcdir/sapi/phpdbg], [$abs_builddir/sapi/phpdbg])
PHP_SELECT_SAPI(phpdbg, program, $PHP_PHPDBG_FILES, $PHP_PHPDBG_CFLAGS, [$(SAPI_PHPDBG_PATH)])

BUILD_BINARY="sapi/phpdbg/phpdbg"
Expand Down
7 changes: 6 additions & 1 deletion phpdbg.h
Expand Up @@ -69,11 +69,14 @@
# include <readline/history.h>
#endif

#include "phpdbg_lexer.h"
#include "phpdbg_cmd.h"
#include "phpdbg_utils.h"
#include "phpdbg_btree.h"
#include "phpdbg_watch.h"

int phpdbg_do_parse(phpdbg_param_t *stack, char *input TSRMLS_DC);

#ifdef ZTS
# define PHPDBG_G(v) TSRMG(phpdbg_globals_id, zend_phpdbg_globals *, v)
#else
Expand Down Expand Up @@ -176,10 +179,12 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
phpdbg_frame_t frame; /* frame */
zend_uint last_line; /* last executed line */

phpdbg_lexer_data lexer; /* lexer data */
phpdbg_param_t *parser_stack; /* param stack during lexer / parser phase */

#ifndef _WIN32
struct sigaction old_sigsegv_signal; /* segv signal handler */
#endif

phpdbg_btree watchpoint_tree; /* tree with watchpoints */
phpdbg_btree watch_HashTables; /* tree with original dtors of watchpoints */
HashTable watchpoints; /* watchpoints */
Expand Down

0 comments on commit 4c79fe6

Please sign in to comment.