revert back to make invoking flex, fix a few bugs

This commit is contained in:
Lee Thompson committed 2012-11-28 01:08:23 -06:00
1 parent 006357f954
commit ddeec45b2e
10 files changed
+55 -3597

No files matched your search

+1 -4
View File
@@ -1,13 +1,10 @@
*.o
*~
# Autogenerated
*.gen.*
# Test binaries
jv_test
jv_parse
parsertest*~
# Something delightfully recursive happens otherwise
docs/content/2.download/source/*
docs/content/2.download/source/*
+27 -18
View File
@@ -3,26 +3,30 @@
# setup is only used by distribution developers, not package developers.
# Still, as a matter of allowing patching, its not a bad idea to distribute
# the developer setup script in the tarball.
EXTRA_DIST = setup.sh config.h.in ChangeLog
EXTRA_DIST = setup.sh config.h.in ChangeLog VERSION lexer.l lexer.h gen_utf8_tables.py
# README.md is expected in Github projects, good stuff in it, so we'll
# distribute it and install it with the package in the doc directory.
docdir = ${datadir}/doc/${PACKAGE}
dist_doc_DATA = README.md INSTALL COPYING AUTHORS README NEWS
JQ_SRC = opcode.c bytecode.c compile.c execute.c builtin.c jv.c jv_parse.c jv_print.c jv_dtoa.c jv_unicode.c
# If we distribute the generated files in the source release, packagers won't have to have
# python, bison, and flex
DIST_JQ_SRC = parser.gen.c lexer.gen.c jv_utf8_tables.gen.h parser.gen.h lexer.gen.h
JQ_INCS = jq_parser.h builtin.h bytecode.h compile.h execute.h forkable_stack.h frame_layout.h jv.h jv_dtoa.h jv_parse.h jv_unicode.h locfile.h opcode.h opcode_list.h parser.y jv_utf8_tables.gen.h
JQ_SRC = opcode.c bytecode.c compile.c execute.c builtin.c jv.c jv_parse.c jv_print.c jv_dtoa.c jv_unicode.c lexer.c $(JQ_INCS)
bin_PROGRAMS = jq jq_test
if DEVCFLAGS_ENABLED
DEVCFLAGS = -Wextra -Wall -Wno-missing-field-initializers -Wno-unused -parameter -std=gnu99 -ggdb -Wno-unused-function
DEVCFLAGS = -Wextra -Wall -Wno-missing-field-initializers -Wno-unused-parameter -std=gnu99 -ggdb -Wno-unused-function
AM_CPPFLAGS = $(DEVCFLAGS)
endif
# Tell YACC (bison) autoconf macros that you want a header file created.
# If the --warnings=all fails, you probably have an old version of bison
# OSX ships an old bison, so update with homebrew or macports
AM_YFLAGS = --warnings=all -d
bin_PROGRAMS = jq jq_test
BUILT_SOURCES = jv_utf8_tables.gen.h lexer.h lexer.c
jq_SOURCES = $(JQ_SRC) main.c
dist_jq_SOURCES = $(DIST_JQ_SRC)
jq_CPPFLAGS = -O $(DEVCFLAGS) -DJQ_DEBUG=0
@@ -33,18 +37,22 @@ jq_test_CPPFLAGS = $(DEVCFLAGS) -DJQ_DEBUG=1
LOG_COMPILER = valgrind
AM_LOG_FLAGS = --error-exitcode=1 -q --leak-check=full
lexer.gen.c: lexer.l
flex -o lexer.gen.c --header-file=lexer.gen.h lexer.l
lexer.gen.h: lexer.gen.c
# nasty circular dependency on header files between the generated C files
parser.o: lexer.c
# if this fails on OSX, install bison from macports or homebrew. OSX comes
# with bison 2.3 which is too old
parser.gen.c: parser.y lexer.gen.h
bison --warnings=all -d parser.y -v --report-file=parser.gen.info -o $@
parser.gen.h: parser.gen.c
lexer.o: parcer.c
lexer.c: parser.h
# While there is some autoconf macro support for lex/flex, it doesn't support
# header file creation so we'll use good old make
lexer.c: lexer.l
flex -o lexer.c --header-file=lexer.h lexer.l
lexer.h: lexer.c
jv_utf8_tables.gen.h: gen_utf8_tables.py
python $^ > $@
jv_unicode.c: jv_utf8_tables.gen.h
ChangeLog:
@@ -52,8 +60,6 @@ ChangeLog:
main.c: config.h
releasedep: lexer.gen.c parser.gen.c jv_utf8_tables.gen.h
releasetag:
git tag -s "jq-$$(cat VERSION)" -m "jq release $$(cat VERSION)"
@@ -67,3 +73,6 @@ rpmbuild: jq
cp jq jq-$$(cat VERSION)/bin
tar -zcf rpm/SOURCES/jq-$$(cat VERSION).tgz jq-$$(cat VERSION)/bin/jq
rpmbuild --target $$(uname -m) --buildroot ${PWD}/rpm/BUILDROOT/jq-$$(cat VERSION)-${RELEASE}.noarch --define "_topdir ${PWD}/rpm" --define "version $$(cat VERSION)" --define "release ${RELEASE}" -bb --clean rpm/SPECS/jq.spec
dist-clean-local:
rm -f $(BUILT_SOURCES)
+1 -1
View File
@@ -1,7 +1,7 @@
#include <string.h>
#include "builtin.h"
#include "compile.h"
#include "parser.h"
#include "jq_parser.h"
#include "locfile.h"
enum {
+9 -2
View File
@@ -8,9 +8,13 @@ AM_INIT_AUTOMAKE([parallel-tests])
AC_PROG_CC
AC_PROG_CC_STDC
AC_PROG_CPP_WERROR
AC_PROG_YACC
AM_PROG_CC_C_O
dnl couldn't use AM_PROG_LEX as it doesn't support header files like the
dnl AC_PROG_YACC macros...
dnl CFLAGS is concidered a packagers variable, not a developer variable
dnl in Auto-tools. For developer ease of use, CFLAGS are set how the
dnl developers like them by default but the packager can disable if so
@@ -28,6 +32,10 @@ if test "$enable_devcflags" = "yes"; then
AM_CONDITIONAL(DEVCFLAGS_ENABLED, true)
fi
dnl
dnl these program checks should probably be deleted
dnl
dnl Check for sed
AC_CHECK_PROGS(regex_cmd, sed)
if test x$regex_cmd = "x" ; then
@@ -46,8 +54,6 @@ if test x$bison_cmd = "x" ; then
AC_MSG_NOTICE([bison is required to patch jq.])
fi
AC_CONFIG_HEADERS(config.h)
dnl Check for python
AC_CHECK_PROGS(python_cmd, python)
if test x$python_cmd = "x" ; then
@@ -61,6 +67,7 @@ if test x$valgrind_cmd = "x" ; then
fi
dnl AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE([-Wall dist-bzip2 dist-zip])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
+1 -1
View File
@@ -14,7 +14,7 @@
#include "locfile.h"
#include "jv.h"
#include "parser.h"
#include "jq_parser.h"
#include "builtin.h"
typedef struct {
+2 -2
View File
@@ -1,5 +1,5 @@
#ifndef PARSER_H
#define PARSER_H
#ifndef JQ_PARSER_H
#define JQ_PARSER_H
int jq_parse(struct locfile* source, block* answer);
int jq_parse_library(struct locfile* locations, block* answer);
+1 -1
View File
@@ -3,7 +3,7 @@
struct lexer_param;
#include "parser.gen.h" /* Generated by bison. */
#include "parser.h" /* Generated by bison. */
#define YY_USER_ACTION \
do { \
-3565
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -88,7 +88,7 @@ struct lexer_param;
%type <blk> Exp Term MkDict MkDictPair ExpD ElseBody QQString FuncDef FuncDefs String
%{
#include "lexer.gen.h"
#include "lexer.h"
struct lexer_param {
yyscan_t lexer;
};
+12 -2
View File
@@ -2,9 +2,19 @@
# RUN ME after pulling the code from git!
if [ "clean" == "$1" ]; then
make distclean
make distclean || echo "continuing..."
rm -rf tmp autom4te.cache config
rm -f INSTALL Makefile.in aclocal.m4 configure config.h.in *.gen.c *.gen.h ChangeLog
rm -f INSTALL Makefile.in aclocal.m4 configure config.h.in ChangeLog
rm -f jv_utf8_tables.gen.h lexer.c lexer.h parser.c parser.h
elif [ "superclean" == "$1" ]; then
ver=$(tr -d '\n' <VERSION)
if [ "x${ver}" != "x" ]; then
if [ -d jq-${ver} ]; then
chmod -R u+w jq-${ver}
rm -rf jq-${ver}
fi
rm -f jq-${ver}.*
fi
else
autoreconf --install
./configure --prefix=/opt/junk