gprofng doesn't build with gcc 5.5
gprofng/ChangeLog 2022-04-07 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/29026 * configure.ac: Check version of bison. * src/Makefile.am (QLParser.yy): Run bison * src/QLParser.yy: Adapted for bison 3.04 or later. * src/DbeSession.cc: make some params const. * src/DbeSession.h: Likewise. * configure: Regenerate. * Makefile.in: Regenerate. * src/Makefile.in: Regenerate. * src/QLParser.tab.cc: Deleted. * src/QLParser.tab.hh: Deleted. * doc/Makefile.in: Regenerate. * gp-display-html/Makefile.in: Regenerate. * libcollector/configure: Regenerate.
This commit is contained in:
parent
5f437feef4
commit
50192212a7
@ -238,6 +238,7 @@ AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BISON = @BISON@
|
||||
BUILD_SUBDIRS = @BUILD_SUBDIRS@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
|
79
gprofng/configure
vendored
79
gprofng/configure
vendored
@ -681,6 +681,7 @@ LD
|
||||
FGREP
|
||||
SED
|
||||
LIBTOOL
|
||||
BISON
|
||||
ac_ct_AR
|
||||
AR
|
||||
RANLIB
|
||||
@ -6042,6 +6043,80 @@ unknown)
|
||||
esac
|
||||
|
||||
|
||||
for ac_prog in bison
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_prog_BISON+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test -n "$BISON"; then
|
||||
ac_cv_prog_BISON="$BISON" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_BISON="$ac_prog"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
BISON=$ac_cv_prog_BISON
|
||||
if test -n "$BISON"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5
|
||||
$as_echo "$BISON" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
test -n "$BISON" && break
|
||||
done
|
||||
|
||||
if test -z "$BISON"; then
|
||||
ac_verc_fail=yes
|
||||
else
|
||||
cat >conftest.y <<_ACEOF
|
||||
%require "3.0.4"
|
||||
%%
|
||||
exp:
|
||||
_ACEOF
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for bison 3.0.4 or newer" >&5
|
||||
$as_echo_n "checking for bison 3.0.4 or newer... " >&6; }
|
||||
ac_prog_version=`$BISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
|
||||
: ${ac_prog_version:='v. ?.??'}
|
||||
if $BISON conftest.y -o conftest.c 2>/dev/null; then
|
||||
ac_prog_version="$ac_prog_version, ok"
|
||||
ac_verc_fail=no
|
||||
else
|
||||
ac_prog_version="$ac_prog_version, bad"
|
||||
ac_verc_fail=yes
|
||||
fi
|
||||
rm -f conftest.y conftest.c
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_prog_version" >&5
|
||||
$as_echo "$ac_prog_version" >&6; }
|
||||
fi
|
||||
if test $ac_verc_fail = yes; then
|
||||
BISON=:
|
||||
fi
|
||||
|
||||
|
||||
if test x$BISON = "x:"; then
|
||||
as_fn_error $? "Building gprofng requires bison 3.0.4 or later." "$LINENO" 5
|
||||
fi
|
||||
|
||||
# Check whether --enable-shared was given.
|
||||
if test "${enable_shared+set}" = set; then :
|
||||
enableval=$enable_shared; p=${PACKAGE-default}
|
||||
@ -12146,7 +12221,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 12149 "configure"
|
||||
#line 12224 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -12252,7 +12327,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 12255 "configure"
|
||||
#line 12330 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
@ -29,6 +29,10 @@ AC_PROG_CXX
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_RANLIB
|
||||
AM_PROG_AR
|
||||
gl_PROG_BISON([BISON],[3.0.4])
|
||||
if test x$BISON = "x:"; then
|
||||
AC_MSG_ERROR([Building gprofng requires bison 3.0.4 or later.])
|
||||
fi
|
||||
|
||||
AC_DISABLE_SHARED
|
||||
LT_INIT
|
||||
|
@ -222,6 +222,7 @@ AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BISON = @BISON@
|
||||
BUILD_SUBDIRS = @BUILD_SUBDIRS@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
|
@ -186,6 +186,7 @@ AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BISON = @BISON@
|
||||
BUILD_SUBDIRS = @BUILD_SUBDIRS@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
|
20
gprofng/libcollector/configure
vendored
20
gprofng/libcollector/configure
vendored
@ -6349,25 +6349,31 @@ else
|
||||
lt_nm_to_check="$lt_nm_to_check nm"
|
||||
fi
|
||||
fi
|
||||
for lt_tmp_nm in $lt_nm_to_check; do
|
||||
for lt_tmp_nm in "$lt_nm_to_check"; do
|
||||
lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
|
||||
for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
|
||||
IFS="$lt_save_ifs"
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
case "$lt_tmp_nm" in
|
||||
# Strip out any user-provided options from the nm to test twice,
|
||||
# the first time to test to see if nm (rather than its options) has
|
||||
# an explicit path, the second time to yield a file which can be
|
||||
# nm'ed itself.
|
||||
tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
|
||||
case "$tmp_nm_path" in
|
||||
*/*|*\\*) tmp_nm="$lt_tmp_nm";;
|
||||
*) tmp_nm="$ac_dir/$lt_tmp_nm";;
|
||||
esac
|
||||
if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
|
||||
tmp_nm_to_nm="`$ECHO "$tmp_nm" | sed 's, -.*$,,'`"
|
||||
if test -f "$tmp_nm_to_nm" || test -f "$tmp_nm_to_nm$ac_exeext" ; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
||||
# nm: unknown option "B" ignored
|
||||
case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
|
||||
case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
|
||||
*$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
|
||||
break
|
||||
;;
|
||||
*)
|
||||
case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
|
||||
case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
|
||||
*$tmp_nm*)
|
||||
lt_cv_path_NM="$tmp_nm -p"
|
||||
break
|
||||
@ -12058,7 +12064,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 12061 "configure"
|
||||
#line 12067 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -12164,7 +12170,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 12167 "configure"
|
||||
#line 12173 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
@ -43,6 +43,16 @@
|
||||
#include "IndexObject.h"
|
||||
#include "PathTree.h"
|
||||
#include "Print.h"
|
||||
|
||||
// Bison 3.0 doesn't define YY_NULLPTR. I copied this from QLParser.tab.cc.
|
||||
// Why this is not in QLParser.tab.hh ? YY_NULLPTR is used in QLParser.tab.hh
|
||||
# ifndef YY_NULLPTR
|
||||
# if defined __cplusplus && 201103L <= __cplusplus
|
||||
# define YY_NULLPTR nullptr
|
||||
# else
|
||||
# define YY_NULLPTR 0
|
||||
# endif
|
||||
# endif
|
||||
#include "QLParser.tab.hh"
|
||||
#include "DbeView.h"
|
||||
#include "MemorySpace.h"
|
||||
@ -2954,7 +2964,7 @@ DbeSession::append (SourceFile *sf)
|
||||
}
|
||||
|
||||
UserLabel *
|
||||
DbeSession::findUserLabel (char *name)
|
||||
DbeSession::findUserLabel (const char *name)
|
||||
{
|
||||
for (int i = 0, sz = userLabels ? userLabels->size () : 0; i < sz; i++)
|
||||
{
|
||||
@ -2966,7 +2976,7 @@ DbeSession::findUserLabel (char *name)
|
||||
}
|
||||
|
||||
Expression *
|
||||
DbeSession::findObjDefByName (char *name)
|
||||
DbeSession::findObjDefByName (const char *name)
|
||||
{
|
||||
Expression *expr = NULL;
|
||||
|
||||
@ -2994,25 +3004,13 @@ DbeSession::findObjDefByName (char *name)
|
||||
Expression *
|
||||
DbeSession::ql_parse (const char *expr_spec)
|
||||
{
|
||||
/* (This slight duplication means we don't need to worry about copy
|
||||
constructors for the QL::Result, nor about the lifetime of the
|
||||
expr_spec.) */
|
||||
if (expr_spec != NULL)
|
||||
{
|
||||
QL::Result result (expr_spec);
|
||||
QL::Parser qlparser (result);
|
||||
if (qlparser () != 0)
|
||||
return NULL;
|
||||
return result ();
|
||||
}
|
||||
else
|
||||
{
|
||||
QL::Result result;
|
||||
QL::Parser qlparser (result);
|
||||
if (qlparser () != 0)
|
||||
return NULL;
|
||||
return result ();
|
||||
}
|
||||
if (expr_spec == NULL)
|
||||
expr_spec = "";
|
||||
QL::Result result (expr_spec);
|
||||
QL::Parser qlparser (result);
|
||||
if (qlparser.parse () != 0)
|
||||
return NULL;
|
||||
return result ();
|
||||
}
|
||||
|
||||
Vector<void*> *
|
||||
|
@ -332,7 +332,7 @@ public:
|
||||
char* getPropUName (int propId);
|
||||
|
||||
Vector<UserLabel*> *userLabels; // List of er_labels
|
||||
UserLabel *findUserLabel (char *name);
|
||||
UserLabel *findUserLabel (const char *name);
|
||||
DbeJarFile *get_JarFile (const char *name);
|
||||
void append (UserLabel *lbl);
|
||||
void append (SourceFile *sf);
|
||||
@ -341,7 +341,7 @@ public:
|
||||
void set_need_refind ();
|
||||
|
||||
// Find user defined object by name
|
||||
Expression *findObjDefByName (char *);
|
||||
Expression *findObjDefByName (const char *);
|
||||
void get_filter_keywords (Vector<void*> *res);
|
||||
|
||||
// Get the Settings class object
|
||||
|
@ -113,6 +113,9 @@ AM_CFLAGS = $(GPROFNG_CFLAGS) $(PTHREAD_CFLAGS) \
|
||||
$(GPROFNG_NO_SWITCH_CFLAGS)
|
||||
AM_CXXFLAGS = $(AM_CFLAGS)
|
||||
|
||||
QLParser.tab.cc QLParser.tab.hh: QLParser.yy
|
||||
$(BISON) $^
|
||||
|
||||
man_MANS = gprofng.1 \
|
||||
gp-archive.1 \
|
||||
gp-collect-app.1 \
|
||||
@ -121,7 +124,8 @@ man_MANS = gprofng.1 \
|
||||
|
||||
MAINTAINERCLEANFILES = $(man_MANS)
|
||||
|
||||
EXTRA_DIST = $(man_MANS)
|
||||
BUILT_SOURCES = QLParser.tab.hh
|
||||
EXTRA_DIST = QLParser.yy $(man_MANS)
|
||||
|
||||
|
||||
pkglib_LTLIBRARIES = $(LIBGPROFNG)
|
||||
|
@ -310,6 +310,7 @@ AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BISON = @BISON@
|
||||
BUILD_SUBDIRS = @BUILD_SUBDIRS@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
@ -550,7 +551,8 @@ man_MANS = gprofng.1 \
|
||||
gp-display-text.1
|
||||
|
||||
MAINTAINERCLEANFILES = $(man_MANS)
|
||||
EXTRA_DIST = $(man_MANS)
|
||||
BUILT_SOURCES = QLParser.tab.hh
|
||||
EXTRA_DIST = QLParser.yy $(man_MANS)
|
||||
pkglib_LTLIBRARIES = $(LIBGPROFNG)
|
||||
libgprofng_la_SOURCES = $(CCSOURCES) $(CSOURCES)
|
||||
libgprofng_la_LDFLAGS = -version-info 0:0:0
|
||||
@ -593,7 +595,8 @@ gp_display_text_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) $(ZLIB)
|
||||
@BUILD_MAN_TRUE@ | sed 's/See also:/\.SH SEE ALSO/' | sed 's/Documentation:/.SH DOCUMENTATION/' \
|
||||
@BUILD_MAN_TRUE@ | sed 's/Limitations:/.SH LIMITATIONS/'
|
||||
|
||||
all: all-am
|
||||
all: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .cc .lo .o .obj
|
||||
@ -1027,13 +1030,15 @@ distdir: $(DISTFILES)
|
||||
top_distdir="$(top_distdir)" distdir="$(distdir)" \
|
||||
dist-hook
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
check: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) $(DATA)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(dbedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
@ -1063,6 +1068,7 @@ distclean-generic:
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
clean: clean-am
|
||||
|
||||
@ -1138,7 +1144,7 @@ uninstall-am: uninstall-binPROGRAMS uninstall-dbeDATA uninstall-man \
|
||||
|
||||
uninstall-man: uninstall-man1
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
.MAKE: all check install install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
|
||||
clean-binPROGRAMS clean-generic clean-libtool \
|
||||
@ -1161,6 +1167,9 @@ uninstall-man: uninstall-man1
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
QLParser.tab.cc QLParser.tab.hh: QLParser.yy
|
||||
$(BISON) $^
|
||||
|
||||
@BUILD_MAN_TRUE@gprofng.1: $(srcdir)/gprofng.cc $(common_mandeps) | ./gprofng$(EXEEXT)
|
||||
@BUILD_MAN_TRUE@ $(AM_V_GEN)_BUILDING_MANPAGE=1 $(HELP2MAN) $(HELP2MAN_OPT) \
|
||||
@BUILD_MAN_TRUE@ --name=$(TEXT_GPROFNG) ./gprofng$(EXEEXT) $(H2M_FILTER) > $@
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@
|
||||
// cd gprofng/src && bison QLParser.yy
|
||||
|
||||
// For "api.parser.class"
|
||||
%require "3.3"
|
||||
%require "3.0"
|
||||
%language "C++"
|
||||
|
||||
%code top {
|
||||
@ -43,12 +43,30 @@
|
||||
namespace QL
|
||||
{
|
||||
static QL::Parser::symbol_type yylex (QL::Result &result);
|
||||
|
||||
static Expression *
|
||||
processName (std::string str)
|
||||
{
|
||||
const char *name = str.c_str();
|
||||
int propID = dbeSession->getPropIdByName (name);
|
||||
if (propID != PROP_NONE)
|
||||
return new Expression (Expression::OP_NAME,
|
||||
new Expression (Expression::OP_NUM, (uint64_t) propID));
|
||||
|
||||
// If a name is not statically known try user defined objects
|
||||
Expression *expr = dbeSession->findObjDefByName (name);
|
||||
if (expr != NULL)
|
||||
return expr->copy();
|
||||
|
||||
throw Parser::syntax_error ("Name not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%defines
|
||||
%define api.namespace {QL}
|
||||
%define api.parser.class {Parser}
|
||||
// in Bison 3.3, use %define api.parser.class {Parser} instead parser_class_name
|
||||
%define parser_class_name {Parser}
|
||||
%define api.token.constructor
|
||||
%define api.value.type variant
|
||||
// Later: api.value.automove
|
||||
@ -60,15 +78,13 @@ namespace QL
|
||||
|
||||
%token LPAR "("
|
||||
RPAR ")"
|
||||
NUM "number"
|
||||
NAME "name"
|
||||
FNAME
|
||||
HASPROP
|
||||
JGROUP
|
||||
JPARENT
|
||||
QSTR
|
||||
FILEIOVFD
|
||||
|
||||
%token YYEOF 0
|
||||
%token <uint64_t> NUM FNAME JGROUP JPARENT QSTR
|
||||
%token <std::string> NAME
|
||||
|
||||
%nonassoc IN SOME ORDR
|
||||
%left COMMA ","
|
||||
%right QWE "?"
|
||||
@ -95,14 +111,14 @@ namespace QL
|
||||
NOT "!"
|
||||
BITNOT "~"
|
||||
|
||||
%type <Expression *> QSTR NUM NAME FNAME JGROUP JPARENT FILEIOVFD exp term
|
||||
%type <Expression *> exp term
|
||||
|
||||
%destructor { delete $$; } <*>;
|
||||
// %destructor { delete $$; } <Expression *>;
|
||||
|
||||
%%
|
||||
|
||||
S: /* empty */ { result.out = new Expression (Expression::OP_NUM, (uint64_t) 1); }
|
||||
| exp { result.out = new Expression ($1); }
|
||||
| exp { result.out = $1; }
|
||||
|
||||
exp: exp DEG exp { $$ = new Expression (Expression::OP_DEG, $1, $3); } /* dead? */
|
||||
| exp MUL exp { $$ = new Expression (Expression::OP_MUL, $1, $3); }
|
||||
@ -125,26 +141,56 @@ exp: exp DEG exp { $$ = new Expression (Expression::OP_DEG, $1, $3); } /* dea
|
||||
| exp OR exp { $$ = new Expression (Expression::OP_OR, $1, $3); }
|
||||
| exp NEQV exp { $$ = new Expression (Expression::OP_NEQV, $1, $3); } /* dead? */
|
||||
| exp EQV exp { $$ = new Expression (Expression::OP_EQV, $1, $3); } /* dead? */
|
||||
| exp QWE exp COLON exp { Expression colon = Expression (Expression::OP_COLON, $3, $5);
|
||||
$$ = new Expression (Expression::OP_QWE, $1, &colon); }
|
||||
| exp QWE exp COLON exp
|
||||
{
|
||||
$$ = new Expression (Expression::OP_QWE, $1,
|
||||
new Expression (Expression::OP_COLON, $3, $5));
|
||||
}
|
||||
| exp COMMA exp { $$ = new Expression (Expression::OP_COMMA, $1, $3); }
|
||||
| exp IN exp { $$ = new Expression (Expression::OP_IN, $1, $3); }
|
||||
| exp SOME IN exp { $$ = new Expression (Expression::OP_SOMEIN, $1, $4); }
|
||||
| exp ORDR IN exp { $$ = new Expression (Expression::OP_ORDRIN, $1, $4); }
|
||||
| term { $$ = new Expression ($1); }
|
||||
| term { $$ = $1; }
|
||||
|
||||
term: MINUS term { Expression num = Expression (Expression::OP_NUM, (uint64_t) 0);
|
||||
$$ = new Expression (Expression::OP_MINUS, &num, $2); }
|
||||
| NOT term { $$ = new Expression (Expression::OP_NOT, $2, NULL); }
|
||||
| BITNOT term { $$ = new Expression (Expression::OP_BITNOT, $2, NULL); }
|
||||
| LPAR exp RPAR { $$ = new Expression ($2); }
|
||||
| FNAME LPAR QSTR RPAR { $$ = new Expression (Expression::OP_FUNC, $1, $3); }
|
||||
| HASPROP LPAR NAME RPAR { $$ = new Expression (Expression::OP_HASPROP, $3, NULL); }
|
||||
| JGROUP LPAR QSTR RPAR { $$ = new Expression (Expression::OP_JAVA, $1, $3); }
|
||||
| JPARENT LPAR QSTR RPAR { $$ = new Expression (Expression::OP_JAVA, $1, $3); }
|
||||
| FILEIOVFD LPAR QSTR RPAR { $$ = new Expression (Expression::OP_FILE, $1, $3); }
|
||||
| NUM { $$ = new Expression ($1); }
|
||||
| NAME { $$ = new Expression ($1); }
|
||||
term: MINUS term
|
||||
{
|
||||
$$ = new Expression (Expression::OP_MINUS,
|
||||
new Expression (Expression::OP_NUM, (uint64_t) 0), $2);
|
||||
}
|
||||
| NOT term { $$ = new Expression (Expression::OP_NOT, $2); }
|
||||
| BITNOT term { $$ = new Expression (Expression::OP_BITNOT, $2); }
|
||||
| LPAR exp RPAR { $$ = $2; }
|
||||
| FNAME LPAR QSTR RPAR
|
||||
{
|
||||
$$ = new Expression (Expression::OP_FUNC,
|
||||
new Expression (Expression::OP_NUM, $1),
|
||||
new Expression (Expression::OP_NUM, $3));
|
||||
}
|
||||
| HASPROP LPAR NAME RPAR
|
||||
{
|
||||
$$ = new Expression (Expression::OP_HASPROP,
|
||||
new Expression (Expression::OP_NUM, processName($3)));
|
||||
}
|
||||
| JGROUP LPAR QSTR RPAR
|
||||
{
|
||||
$$ = new Expression (Expression::OP_JAVA,
|
||||
new Expression (Expression::OP_NUM, $1),
|
||||
new Expression (Expression::OP_NUM, $3));
|
||||
}
|
||||
| JPARENT LPAR QSTR RPAR
|
||||
{
|
||||
$$ = new Expression (Expression::OP_JAVA,
|
||||
new Expression (Expression::OP_NUM, $1),
|
||||
new Expression (Expression::OP_NUM, $3));
|
||||
}
|
||||
| FILEIOVFD LPAR QSTR RPAR
|
||||
{
|
||||
$$ = new Expression (Expression::OP_FILE,
|
||||
new Expression (Expression::OP_NUM, (uint64_t) 0),
|
||||
new Expression (Expression::OP_NUM, $3));
|
||||
}
|
||||
| NUM { $$ = new Expression (Expression::OP_NUM, $1); }
|
||||
| NAME { $$ = processName($1); }
|
||||
|
||||
%%
|
||||
|
||||
@ -157,26 +203,6 @@ namespace QL
|
||||
return tok;
|
||||
}
|
||||
|
||||
static Expression *
|
||||
processName (char *name)
|
||||
{
|
||||
int propID = dbeSession->getPropIdByName (name);
|
||||
if (propID != PROP_NONE)
|
||||
{
|
||||
Expression *expr = new Expression (Expression::OP_NUM, (uint64_t) propID);
|
||||
Expression *ret = new Expression (Expression::OP_NAME, expr);
|
||||
delete expr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// If a name is not statically known try user defined objects
|
||||
Expression *expr = dbeSession->findObjDefByName (name);
|
||||
if (expr != NULL)
|
||||
return expr->copy();
|
||||
|
||||
throw Parser::syntax_error ("Name not found");
|
||||
}
|
||||
|
||||
static Parser::symbol_type
|
||||
yylex (QL::Result &result)
|
||||
{
|
||||
@ -191,6 +217,7 @@ namespace QL
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\0':
|
||||
case '\n': return Parser::make_YYEOF ();
|
||||
case '(': return Parser::make_LPAR () ;
|
||||
case ')': return Parser::make_RPAR ();
|
||||
@ -264,7 +291,7 @@ namespace QL
|
||||
case '"':
|
||||
*ptr = (char)0;
|
||||
// XXX omazur: need new string type
|
||||
return Parser::make_QSTR (new Expression (Expression::OP_NUM, (uint64_t) str));
|
||||
return Parser::make_QSTR ((uint64_t) str);
|
||||
case 0:
|
||||
case '\n':
|
||||
free (str);
|
||||
@ -331,7 +358,7 @@ namespace QL
|
||||
lval = lval * base + digit;
|
||||
c = result.in.get ();
|
||||
}
|
||||
return Parser::make_NUM (new Expression (Expression::OP_NUM, lval));
|
||||
return Parser::make_NUM (lval);
|
||||
}
|
||||
|
||||
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))
|
||||
@ -359,23 +386,24 @@ namespace QL
|
||||
else if (strcasecmp (name, NTXT ("ORDERED")) == 0)
|
||||
return Parser::make_ORDR ();
|
||||
else if (strcasecmp (name, NTXT ("TRUE")) == 0)
|
||||
return Parser::make_NUM (new Expression (Expression::OP_NUM, (uint64_t) 1));
|
||||
return Parser::make_NUM ((uint64_t) 1);
|
||||
else if (strcasecmp (name, NTXT ("FALSE")) == 0)
|
||||
return Parser::make_NUM (new Expression (Expression::OP_NUM, (uint64_t) 0));
|
||||
return Parser::make_NUM ((uint64_t) 0);
|
||||
else if (strcasecmp (name, NTXT ("FNAME")) == 0)
|
||||
return Parser::make_FNAME (new Expression (Expression::OP_NUM, Expression::FUNC_FNAME));
|
||||
return Parser::make_FNAME (Expression::FUNC_FNAME);
|
||||
else if (strcasecmp (name, NTXT ("HAS_PROP")) == 0)
|
||||
return Parser::make_HASPROP ();
|
||||
else if (strcasecmp (name, NTXT ("JGROUP")) == 0)
|
||||
return Parser::make_JGROUP (new Expression (Expression::OP_NUM, Expression::JAVA_JGROUP));
|
||||
return Parser::make_JGROUP (Expression::JAVA_JGROUP);
|
||||
else if (strcasecmp (name, NTXT ("JPARENT")) == 0 )
|
||||
return Parser::make_JPARENT (new Expression (Expression::OP_NUM, Expression::JAVA_JPARENT));
|
||||
return Parser::make_JPARENT (Expression::JAVA_JPARENT);
|
||||
else if (strcasecmp (name, NTXT ("DNAME")) == 0)
|
||||
return Parser::make_FNAME (new Expression (Expression::OP_NUM, Expression::FUNC_DNAME));
|
||||
return Parser::make_FNAME (Expression::FUNC_DNAME);
|
||||
else if (strcasecmp (name, NTXT ("FILEIOVFD")) == 0 )
|
||||
return Parser::make_FILEIOVFD (new Expression (Expression::OP_NUM, (uint64_t) 0));
|
||||
return Parser::make_FILEIOVFD ();
|
||||
|
||||
return Parser::make_NAME (processName (name));
|
||||
std::string nm = std::string (name);
|
||||
return Parser::make_NAME (nm);
|
||||
}
|
||||
|
||||
throw Parser::syntax_error ("Syntax error");
|
||||
|
Loading…
x
Reference in New Issue
Block a user