aboutsummaryrefslogtreecommitdiff
path: root/gprofng
diff options
context:
space:
mode:
Diffstat (limited to 'gprofng')
-rw-r--r--gprofng/Makefile.in1
-rwxr-xr-xgprofng/configure79
-rw-r--r--gprofng/configure.ac4
-rw-r--r--gprofng/doc/Makefile.in1
-rw-r--r--gprofng/gp-display-html/Makefile.in1
-rwxr-xr-xgprofng/libcollector/configure20
-rw-r--r--gprofng/src/DbeSession.cc40
-rw-r--r--gprofng/src/DbeSession.h4
-rw-r--r--gprofng/src/Makefile.am6
-rw-r--r--gprofng/src/Makefile.in19
-rw-r--r--gprofng/src/QLParser.tab.cc1453
-rw-r--r--gprofng/src/QLParser.tab.hh2038
-rw-r--r--gprofng/src/QLParser.yy142
13 files changed, 222 insertions, 3586 deletions
diff --git a/gprofng/Makefile.in b/gprofng/Makefile.in
index e77b06d..fd5279b 100644
--- a/gprofng/Makefile.in
+++ b/gprofng/Makefile.in
@@ -238,6 +238,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BISON = @BISON@
BUILD_SUBDIRS = @BUILD_SUBDIRS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
diff --git a/gprofng/configure b/gprofng/configure
index 08af658..6e38a14 100755
--- a/gprofng/configure
+++ b/gprofng/configure
@@ -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
diff --git a/gprofng/configure.ac b/gprofng/configure.ac
index 550dd80..80bbc85 100644
--- a/gprofng/configure.ac
+++ b/gprofng/configure.ac
@@ -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
diff --git a/gprofng/doc/Makefile.in b/gprofng/doc/Makefile.in
index 03d9e24..4050586 100644
--- a/gprofng/doc/Makefile.in
+++ b/gprofng/doc/Makefile.in
@@ -222,6 +222,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BISON = @BISON@
BUILD_SUBDIRS = @BUILD_SUBDIRS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
diff --git a/gprofng/gp-display-html/Makefile.in b/gprofng/gp-display-html/Makefile.in
index e75703c..a222b95 100644
--- a/gprofng/gp-display-html/Makefile.in
+++ b/gprofng/gp-display-html/Makefile.in
@@ -186,6 +186,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BISON = @BISON@
BUILD_SUBDIRS = @BUILD_SUBDIRS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
diff --git a/gprofng/libcollector/configure b/gprofng/libcollector/configure
index 9fea098..0afa31d 100755
--- a/gprofng/libcollector/configure
+++ b/gprofng/libcollector/configure
@@ -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
diff --git a/gprofng/src/DbeSession.cc b/gprofng/src/DbeSession.cc
index 4370114..94b8f6b 100644
--- a/gprofng/src/DbeSession.cc
+++ b/gprofng/src/DbeSession.cc
@@ -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*> *
diff --git a/gprofng/src/DbeSession.h b/gprofng/src/DbeSession.h
index 0a5c01c..0173f1a 100644
--- a/gprofng/src/DbeSession.h
+++ b/gprofng/src/DbeSession.h
@@ -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
diff --git a/gprofng/src/Makefile.am b/gprofng/src/Makefile.am
index 47fd8c9..0718ab6 100644
--- a/gprofng/src/Makefile.am
+++ b/gprofng/src/Makefile.am
@@ -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)
diff --git a/gprofng/src/Makefile.in b/gprofng/src/Makefile.in
index 7d3f9c6..1de9b36 100644
--- a/gprofng/src/Makefile.in
+++ b/gprofng/src/Makefile.in
@@ -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) > $@
diff --git a/gprofng/src/QLParser.tab.cc b/gprofng/src/QLParser.tab.cc
deleted file mode 100644
index 4517b2e..0000000
--- a/gprofng/src/QLParser.tab.cc
+++ /dev/null
@@ -1,1453 +0,0 @@
-// A Bison parser, made by GNU Bison 3.7.5.
-
-// Skeleton implementation for Bison LALR(1) parsers in C++
-
-// Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-// As a special exception, you may create a larger work that contains
-// part or all of the Bison parser skeleton and distribute that work
-// under terms of your choice, so long as that work isn't itself a
-// parser generator using the skeleton or a modified version thereof
-// as a parser skeleton. Alternatively, if you modify or redistribute
-// the parser skeleton itself, you may (at your option) remove this
-// special exception, which will cause the skeleton and the resulting
-// Bison output files to be licensed under the GNU General Public
-// License without this special exception.
-
-// This special exception was added by the Free Software Foundation in
-// version 2.2 of Bison.
-
-// DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
-// especially those whose name start with YY_ or yy_. They are
-// private implementation details that can be changed or removed.
-
-// "%code top" blocks.
-#line 28 "QLParser.yy"
-
-#include <stdio.h>
-#include <string.h>
-#include <string>
-
-#line 45 "QLParser.tab.cc"
-
-
-
-
-#include "QLParser.tab.hh"
-
-
-// Unqualified %code blocks.
-#line 42 "QLParser.yy"
-
-namespace QL
-{
- static QL::Parser::symbol_type yylex (QL::Result &result);
-}
-
-#line 61 "QLParser.tab.cc"
-
-
-#ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
-# if ENABLE_NLS
-# include <libintl.h> // FIXME: INFRINGES ON USER NAME SPACE.
-# define YY_(msgid) dgettext ("bison-runtime", msgid)
-# endif
-# endif
-# ifndef YY_
-# define YY_(msgid) msgid
-# endif
-#endif
-
-
-// Whether we are compiled with exception support.
-#ifndef YY_EXCEPTIONS
-# if defined __GNUC__ && !defined __EXCEPTIONS
-# define YY_EXCEPTIONS 0
-# else
-# define YY_EXCEPTIONS 1
-# endif
-#endif
-
-
-
-// Enable debugging if requested.
-#if YYDEBUG
-
-// A pseudo ostream that takes yydebug_ into account.
-# define YYCDEBUG if (yydebug_) (*yycdebug_)
-
-# define YY_SYMBOL_PRINT(Title, Symbol) \
- do { \
- if (yydebug_) \
- { \
- *yycdebug_ << Title << ' '; \
- yy_print_ (*yycdebug_, Symbol); \
- *yycdebug_ << '\n'; \
- } \
- } while (false)
-
-# define YY_REDUCE_PRINT(Rule) \
- do { \
- if (yydebug_) \
- yy_reduce_print_ (Rule); \
- } while (false)
-
-# define YY_STACK_PRINT() \
- do { \
- if (yydebug_) \
- yy_stack_print_ (); \
- } while (false)
-
-#else // !YYDEBUG
-
-# define YYCDEBUG if (false) std::cerr
-# define YY_SYMBOL_PRINT(Title, Symbol) YY_USE (Symbol)
-# define YY_REDUCE_PRINT(Rule) static_cast<void> (0)
-# define YY_STACK_PRINT() static_cast<void> (0)
-
-#endif // !YYDEBUG
-
-#define yyerrok (yyerrstatus_ = 0)
-#define yyclearin (yyla.clear ())
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-#define YYRECOVERING() (!!yyerrstatus_)
-
-#line 50 "QLParser.yy"
-namespace QL {
-#line 135 "QLParser.tab.cc"
-
- /// Build a parser object.
- Parser::Parser (QL::Result &result_yyarg)
-#if YYDEBUG
- : yydebug_ (false),
- yycdebug_ (&std::cerr),
-#else
- :
-#endif
- result (result_yyarg)
- {}
-
- Parser::~Parser ()
- {}
-
- Parser::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW
- {}
-
- /*---------------.
- | symbol kinds. |
- `---------------*/
-
-
-
- // by_state.
- Parser::by_state::by_state () YY_NOEXCEPT
- : state (empty_state)
- {}
-
- Parser::by_state::by_state (const by_state& that) YY_NOEXCEPT
- : state (that.state)
- {}
-
- void
- Parser::by_state::clear () YY_NOEXCEPT
- {
- state = empty_state;
- }
-
- void
- Parser::by_state::move (by_state& that)
- {
- state = that.state;
- that.clear ();
- }
-
- Parser::by_state::by_state (state_type s) YY_NOEXCEPT
- : state (s)
- {}
-
- Parser::symbol_kind_type
- Parser::by_state::kind () const YY_NOEXCEPT
- {
- if (state == empty_state)
- return symbol_kind::S_YYEMPTY;
- else
- return YY_CAST (symbol_kind_type, yystos_[+state]);
- }
-
- Parser::stack_symbol_type::stack_symbol_type ()
- {}
-
- Parser::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that)
- : super_type (YY_MOVE (that.state))
- {
- switch (that.kind ())
- {
- case symbol_kind::S_NUM: // "number"
- case symbol_kind::S_NAME: // "name"
- case symbol_kind::S_FNAME: // FNAME
- case symbol_kind::S_JGROUP: // JGROUP
- case symbol_kind::S_JPARENT: // JPARENT
- case symbol_kind::S_QSTR: // QSTR
- case symbol_kind::S_FILEIOVFD: // FILEIOVFD
- case symbol_kind::S_exp: // exp
- case symbol_kind::S_term: // term
- value.YY_MOVE_OR_COPY< Expression * > (YY_MOVE (that.value));
- break;
-
- default:
- break;
- }
-
-#if 201103L <= YY_CPLUSPLUS
- // that is emptied.
- that.state = empty_state;
-#endif
- }
-
- Parser::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that)
- : super_type (s)
- {
- switch (that.kind ())
- {
- case symbol_kind::S_NUM: // "number"
- case symbol_kind::S_NAME: // "name"
- case symbol_kind::S_FNAME: // FNAME
- case symbol_kind::S_JGROUP: // JGROUP
- case symbol_kind::S_JPARENT: // JPARENT
- case symbol_kind::S_QSTR: // QSTR
- case symbol_kind::S_FILEIOVFD: // FILEIOVFD
- case symbol_kind::S_exp: // exp
- case symbol_kind::S_term: // term
- value.move< Expression * > (YY_MOVE (that.value));
- break;
-
- default:
- break;
- }
-
- // that is emptied.
- that.kind_ = symbol_kind::S_YYEMPTY;
- }
-
-#if YY_CPLUSPLUS < 201103L
- Parser::stack_symbol_type&
- Parser::stack_symbol_type::operator= (const stack_symbol_type& that)
- {
- state = that.state;
- switch (that.kind ())
- {
- case symbol_kind::S_NUM: // "number"
- case symbol_kind::S_NAME: // "name"
- case symbol_kind::S_FNAME: // FNAME
- case symbol_kind::S_JGROUP: // JGROUP
- case symbol_kind::S_JPARENT: // JPARENT
- case symbol_kind::S_QSTR: // QSTR
- case symbol_kind::S_FILEIOVFD: // FILEIOVFD
- case symbol_kind::S_exp: // exp
- case symbol_kind::S_term: // term
- value.copy< Expression * > (that.value);
- break;
-
- default:
- break;
- }
-
- return *this;
- }
-
- Parser::stack_symbol_type&
- Parser::stack_symbol_type::operator= (stack_symbol_type& that)
- {
- state = that.state;
- switch (that.kind ())
- {
- case symbol_kind::S_NUM: // "number"
- case symbol_kind::S_NAME: // "name"
- case symbol_kind::S_FNAME: // FNAME
- case symbol_kind::S_JGROUP: // JGROUP
- case symbol_kind::S_JPARENT: // JPARENT
- case symbol_kind::S_QSTR: // QSTR
- case symbol_kind::S_FILEIOVFD: // FILEIOVFD
- case symbol_kind::S_exp: // exp
- case symbol_kind::S_term: // term
- value.move< Expression * > (that.value);
- break;
-
- default:
- break;
- }
-
- // that is emptied.
- that.state = empty_state;
- return *this;
- }
-#endif
-
- template <typename Base>
- void
- Parser::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
- {
- if (yymsg)
- YY_SYMBOL_PRINT (yymsg, yysym);
- }
-
-#if YYDEBUG
- template <typename Base>
- void
- Parser::yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const
- {
- std::ostream& yyoutput = yyo;
- YY_USE (yyoutput);
- if (yysym.empty ())
- yyo << "empty symbol";
- else
- {
- symbol_kind_type yykind = yysym.kind ();
- yyo << (yykind < YYNTOKENS ? "token" : "nterm")
- << ' ' << yysym.name () << " (";
- YY_USE (yykind);
- yyo << ')';
- }
- }
-#endif
-
- void
- Parser::yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym)
- {
- if (m)
- YY_SYMBOL_PRINT (m, sym);
- yystack_.push (YY_MOVE (sym));
- }
-
- void
- Parser::yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym)
- {
-#if 201103L <= YY_CPLUSPLUS
- yypush_ (m, stack_symbol_type (s, std::move (sym)));
-#else
- stack_symbol_type ss (s, sym);
- yypush_ (m, ss);
-#endif
- }
-
- void
- Parser::yypop_ (int n)
- {
- yystack_.pop (n);
- }
-
-#if YYDEBUG
- std::ostream&
- Parser::debug_stream () const
- {
- return *yycdebug_;
- }
-
- void
- Parser::set_debug_stream (std::ostream& o)
- {
- yycdebug_ = &o;
- }
-
-
- Parser::debug_level_type
- Parser::debug_level () const
- {
- return yydebug_;
- }
-
- void
- Parser::set_debug_level (debug_level_type l)
- {
- yydebug_ = l;
- }
-#endif // YYDEBUG
-
- Parser::state_type
- Parser::yy_lr_goto_state_ (state_type yystate, int yysym)
- {
- int yyr = yypgoto_[yysym - YYNTOKENS] + yystate;
- if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
- return yytable_[yyr];
- else
- return yydefgoto_[yysym - YYNTOKENS];
- }
-
- bool
- Parser::yy_pact_value_is_default_ (int yyvalue)
- {
- return yyvalue == yypact_ninf_;
- }
-
- bool
- Parser::yy_table_value_is_error_ (int yyvalue)
- {
- return yyvalue == yytable_ninf_;
- }
-
- int
- Parser::operator() ()
- {
- return parse ();
- }
-
- int
- Parser::parse ()
- {
- int yyn;
- /// Length of the RHS of the rule being reduced.
- int yylen = 0;
-
- // Error handling.
- int yynerrs_ = 0;
- int yyerrstatus_ = 0;
-
- /// The lookahead symbol.
- symbol_type yyla;
-
- /// The return value of parse ().
- int yyresult;
-
-#if YY_EXCEPTIONS
- try
-#endif // YY_EXCEPTIONS
- {
- YYCDEBUG << "Starting parse\n";
-
-
- /* Initialize the stack. The initial state will be set in
- yynewstate, since the latter expects the semantical and the
- location values to have been already stored, initialize these
- stacks with a primary value. */
- yystack_.clear ();
- yypush_ (YY_NULLPTR, 0, YY_MOVE (yyla));
-
- /*-----------------------------------------------.
- | yynewstate -- push a new symbol on the stack. |
- `-----------------------------------------------*/
- yynewstate:
- YYCDEBUG << "Entering state " << int (yystack_[0].state) << '\n';
- YY_STACK_PRINT ();
-
- // Accept?
- if (yystack_[0].state == yyfinal_)
- YYACCEPT;
-
- goto yybackup;
-
-
- /*-----------.
- | yybackup. |
- `-----------*/
- yybackup:
- // Try to take a decision without lookahead.
- yyn = yypact_[+yystack_[0].state];
- if (yy_pact_value_is_default_ (yyn))
- goto yydefault;
-
- // Read a lookahead token.
- if (yyla.empty ())
- {
- YYCDEBUG << "Reading a token\n";
-#if YY_EXCEPTIONS
- try
-#endif // YY_EXCEPTIONS
- {
- symbol_type yylookahead (yylex (result));
- yyla.move (yylookahead);
- }
-#if YY_EXCEPTIONS
- catch (const syntax_error& yyexc)
- {
- YYCDEBUG << "Caught exception: " << yyexc.what() << '\n';
- error (yyexc);
- goto yyerrlab1;
- }
-#endif // YY_EXCEPTIONS
- }
- YY_SYMBOL_PRINT ("Next token is", yyla);
-
- if (yyla.kind () == symbol_kind::S_YYerror)
- {
- // The scanner already issued an error message, process directly
- // to error recovery. But do not keep the error token as
- // lookahead, it is too special and may lead us to an endless
- // loop in error recovery. */
- yyla.kind_ = symbol_kind::S_YYUNDEF;
- goto yyerrlab1;
- }
-
- /* If the proper action on seeing token YYLA.TYPE is to reduce or
- to detect an error, take that action. */
- yyn += yyla.kind ();
- if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.kind ())
- {
- goto yydefault;
- }
-
- // Reduce or error.
- yyn = yytable_[yyn];
- if (yyn <= 0)
- {
- if (yy_table_value_is_error_ (yyn))
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
-
- // Count tokens shifted since error; after three, turn off error status.
- if (yyerrstatus_)
- --yyerrstatus_;
-
- // Shift the lookahead token.
- yypush_ ("Shifting", state_type (yyn), YY_MOVE (yyla));
- goto yynewstate;
-
-
- /*-----------------------------------------------------------.
- | yydefault -- do the default action for the current state. |
- `-----------------------------------------------------------*/
- yydefault:
- yyn = yydefact_[+yystack_[0].state];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
-
- /*-----------------------------.
- | yyreduce -- do a reduction. |
- `-----------------------------*/
- yyreduce:
- yylen = yyr2_[yyn];
- {
- stack_symbol_type yylhs;
- yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]);
- /* Variants are always initialized to an empty instance of the
- correct type. The default '$$ = $1' action is NOT applied
- when using variants. */
- switch (yyr1_[yyn])
- {
- case symbol_kind::S_NUM: // "number"
- case symbol_kind::S_NAME: // "name"
- case symbol_kind::S_FNAME: // FNAME
- case symbol_kind::S_JGROUP: // JGROUP
- case symbol_kind::S_JPARENT: // JPARENT
- case symbol_kind::S_QSTR: // QSTR
- case symbol_kind::S_FILEIOVFD: // FILEIOVFD
- case symbol_kind::S_exp: // exp
- case symbol_kind::S_term: // term
- yylhs.value.emplace< Expression * > ();
- break;
-
- default:
- break;
- }
-
-
-
- // Perform the reduction.
- YY_REDUCE_PRINT (yyn);
-#if YY_EXCEPTIONS
- try
-#endif // YY_EXCEPTIONS
- {
- switch (yyn)
- {
- case 2: // S: %empty
-#line 104 "QLParser.yy"
- { result.out = new Expression (Expression::OP_NUM, (uint64_t) 1); }
-#line 577 "QLParser.tab.cc"
- break;
-
- case 3: // S: exp
-#line 105 "QLParser.yy"
- { result.out = new Expression (yystack_[0].value.as < Expression * > ()); }
-#line 583 "QLParser.tab.cc"
- break;
-
- case 4: // exp: exp DEG exp
-#line 107 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_DEG, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 589 "QLParser.tab.cc"
- break;
-
- case 5: // exp: exp MUL exp
-#line 108 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_MUL, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 595 "QLParser.tab.cc"
- break;
-
- case 6: // exp: exp DIV exp
-#line 109 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_DIV, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 601 "QLParser.tab.cc"
- break;
-
- case 7: // exp: exp REM exp
-#line 110 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_REM, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 607 "QLParser.tab.cc"
- break;
-
- case 8: // exp: exp ADD exp
-#line 111 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_ADD, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 613 "QLParser.tab.cc"
- break;
-
- case 9: // exp: exp MINUS exp
-#line 112 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_MINUS, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 619 "QLParser.tab.cc"
- break;
-
- case 10: // exp: exp LS exp
-#line 113 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_LS, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 625 "QLParser.tab.cc"
- break;
-
- case 11: // exp: exp RS exp
-#line 114 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_RS, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 631 "QLParser.tab.cc"
- break;
-
- case 12: // exp: exp LT exp
-#line 115 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_LT, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 637 "QLParser.tab.cc"
- break;
-
- case 13: // exp: exp LE exp
-#line 116 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_LE, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 643 "QLParser.tab.cc"
- break;
-
- case 14: // exp: exp GT exp
-#line 117 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_GT, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 649 "QLParser.tab.cc"
- break;
-
- case 15: // exp: exp GE exp
-#line 118 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_GE, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 655 "QLParser.tab.cc"
- break;
-
- case 16: // exp: exp EQ exp
-#line 119 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_EQ, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 661 "QLParser.tab.cc"
- break;
-
- case 17: // exp: exp NE exp
-#line 120 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_NE, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 667 "QLParser.tab.cc"
- break;
-
- case 18: // exp: exp BITAND exp
-#line 121 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_BITAND, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 673 "QLParser.tab.cc"
- break;
-
- case 19: // exp: exp BITXOR exp
-#line 122 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_BITXOR, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 679 "QLParser.tab.cc"
- break;
-
- case 20: // exp: exp BITOR exp
-#line 123 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_BITOR, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 685 "QLParser.tab.cc"
- break;
-
- case 21: // exp: exp AND exp
-#line 124 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_AND, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 691 "QLParser.tab.cc"
- break;
-
- case 22: // exp: exp OR exp
-#line 125 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_OR, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 697 "QLParser.tab.cc"
- break;
-
- case 23: // exp: exp NEQV exp
-#line 126 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_NEQV, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 703 "QLParser.tab.cc"
- break;
-
- case 24: // exp: exp EQV exp
-#line 127 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_EQV, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 709 "QLParser.tab.cc"
- break;
-
- case 25: // exp: exp QWE exp COLON exp
-#line 128 "QLParser.yy"
- { Expression colon = Expression (Expression::OP_COLON, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ());
- yylhs.value.as < Expression * > () = new Expression (Expression::OP_QWE, yystack_[4].value.as < Expression * > (), &colon); }
-#line 716 "QLParser.tab.cc"
- break;
-
- case 26: // exp: exp COMMA exp
-#line 130 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_COMMA, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 722 "QLParser.tab.cc"
- break;
-
- case 27: // exp: exp IN exp
-#line 131 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_IN, yystack_[2].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 728 "QLParser.tab.cc"
- break;
-
- case 28: // exp: exp SOME IN exp
-#line 132 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_SOMEIN, yystack_[3].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 734 "QLParser.tab.cc"
- break;
-
- case 29: // exp: exp ORDR IN exp
-#line 133 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_ORDRIN, yystack_[3].value.as < Expression * > (), yystack_[0].value.as < Expression * > ()); }
-#line 740 "QLParser.tab.cc"
- break;
-
- case 30: // exp: term
-#line 134 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (yystack_[0].value.as < Expression * > ()); }
-#line 746 "QLParser.tab.cc"
- break;
-
- case 31: // term: MINUS term
-#line 136 "QLParser.yy"
- { Expression num = Expression (Expression::OP_NUM, (uint64_t) 0);
- yylhs.value.as < Expression * > () = new Expression (Expression::OP_MINUS, &num, yystack_[0].value.as < Expression * > ()); }
-#line 753 "QLParser.tab.cc"
- break;
-
- case 32: // term: NOT term
-#line 138 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_NOT, yystack_[0].value.as < Expression * > (), NULL); }
-#line 759 "QLParser.tab.cc"
- break;
-
- case 33: // term: BITNOT term
-#line 139 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_BITNOT, yystack_[0].value.as < Expression * > (), NULL); }
-#line 765 "QLParser.tab.cc"
- break;
-
- case 34: // term: "(" exp ")"
-#line 140 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (yystack_[1].value.as < Expression * > ()); }
-#line 771 "QLParser.tab.cc"
- break;
-
- case 35: // term: FNAME "(" QSTR ")"
-#line 141 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_FUNC, yystack_[3].value.as < Expression * > (), yystack_[1].value.as < Expression * > ()); }
-#line 777 "QLParser.tab.cc"
- break;
-
- case 36: // term: HASPROP "(" "name" ")"
-#line 142 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_HASPROP, yystack_[1].value.as < Expression * > (), NULL); }
-#line 783 "QLParser.tab.cc"
- break;
-
- case 37: // term: JGROUP "(" QSTR ")"
-#line 143 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_JAVA, yystack_[3].value.as < Expression * > (), yystack_[1].value.as < Expression * > ()); }
-#line 789 "QLParser.tab.cc"
- break;
-
- case 38: // term: JPARENT "(" QSTR ")"
-#line 144 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_JAVA, yystack_[3].value.as < Expression * > (), yystack_[1].value.as < Expression * > ()); }
-#line 795 "QLParser.tab.cc"
- break;
-
- case 39: // term: FILEIOVFD "(" QSTR ")"
-#line 145 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (Expression::OP_FILE, yystack_[3].value.as < Expression * > (), yystack_[1].value.as < Expression * > ()); }
-#line 801 "QLParser.tab.cc"
- break;
-
- case 40: // term: "number"
-#line 146 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (yystack_[0].value.as < Expression * > ()); }
-#line 807 "QLParser.tab.cc"
- break;
-
- case 41: // term: "name"
-#line 147 "QLParser.yy"
- { yylhs.value.as < Expression * > () = new Expression (yystack_[0].value.as < Expression * > ()); }
-#line 813 "QLParser.tab.cc"
- break;
-
-
-#line 817 "QLParser.tab.cc"
-
- default:
- break;
- }
- }
-#if YY_EXCEPTIONS
- catch (const syntax_error& yyexc)
- {
- YYCDEBUG << "Caught exception: " << yyexc.what() << '\n';
- error (yyexc);
- YYERROR;
- }
-#endif // YY_EXCEPTIONS
- YY_SYMBOL_PRINT ("-> $$ =", yylhs);
- yypop_ (yylen);
- yylen = 0;
-
- // Shift the result of the reduction.
- yypush_ (YY_NULLPTR, YY_MOVE (yylhs));
- }
- goto yynewstate;
-
-
- /*--------------------------------------.
- | yyerrlab -- here on detecting error. |
- `--------------------------------------*/
- yyerrlab:
- // If not already recovering from an error, report this error.
- if (!yyerrstatus_)
- {
- ++yynerrs_;
- std::string msg = YY_("syntax error");
- error (YY_MOVE (msg));
- }
-
-
- if (yyerrstatus_ == 3)
- {
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
-
- // Return failure if at end of input.
- if (yyla.kind () == symbol_kind::S_YYEOF)
- YYABORT;
- else if (!yyla.empty ())
- {
- yy_destroy_ ("Error: discarding", yyla);
- yyla.clear ();
- }
- }
-
- // Else will try to reuse lookahead token after shifting the error token.
- goto yyerrlab1;
-
-
- /*---------------------------------------------------.
- | yyerrorlab -- error raised explicitly by YYERROR. |
- `---------------------------------------------------*/
- yyerrorlab:
- /* Pacify compilers when the user code never invokes YYERROR and
- the label yyerrorlab therefore never appears in user code. */
- if (false)
- YYERROR;
-
- /* Do not reclaim the symbols of the rule whose action triggered
- this YYERROR. */
- yypop_ (yylen);
- yylen = 0;
- YY_STACK_PRINT ();
- goto yyerrlab1;
-
-
- /*-------------------------------------------------------------.
- | yyerrlab1 -- common code for both syntax error and YYERROR. |
- `-------------------------------------------------------------*/
- yyerrlab1:
- yyerrstatus_ = 3; // Each real token shifted decrements this.
- // Pop stack until we find a state that shifts the error token.
- for (;;)
- {
- yyn = yypact_[+yystack_[0].state];
- if (!yy_pact_value_is_default_ (yyn))
- {
- yyn += symbol_kind::S_YYerror;
- if (0 <= yyn && yyn <= yylast_
- && yycheck_[yyn] == symbol_kind::S_YYerror)
- {
- yyn = yytable_[yyn];
- if (0 < yyn)
- break;
- }
- }
-
- // Pop the current state because it cannot handle the error token.
- if (yystack_.size () == 1)
- YYABORT;
-
- yy_destroy_ ("Error: popping", yystack_[0]);
- yypop_ ();
- YY_STACK_PRINT ();
- }
- {
- stack_symbol_type error_token;
-
-
- // Shift the error token.
- error_token.state = state_type (yyn);
- yypush_ ("Shifting", YY_MOVE (error_token));
- }
- goto yynewstate;
-
-
- /*-------------------------------------.
- | yyacceptlab -- YYACCEPT comes here. |
- `-------------------------------------*/
- yyacceptlab:
- yyresult = 0;
- goto yyreturn;
-
-
- /*-----------------------------------.
- | yyabortlab -- YYABORT comes here. |
- `-----------------------------------*/
- yyabortlab:
- yyresult = 1;
- goto yyreturn;
-
-
- /*-----------------------------------------------------.
- | yyreturn -- parsing is finished, return the result. |
- `-----------------------------------------------------*/
- yyreturn:
- if (!yyla.empty ())
- yy_destroy_ ("Cleanup: discarding lookahead", yyla);
-
- /* Do not reclaim the symbols of the rule whose action triggered
- this YYABORT or YYACCEPT. */
- yypop_ (yylen);
- YY_STACK_PRINT ();
- while (1 < yystack_.size ())
- {
- yy_destroy_ ("Cleanup: popping", yystack_[0]);
- yypop_ ();
- }
-
- return yyresult;
- }
-#if YY_EXCEPTIONS
- catch (...)
- {
- YYCDEBUG << "Exception caught: cleaning lookahead and stack\n";
- // Do not try to display the values of the reclaimed symbols,
- // as their printers might throw an exception.
- if (!yyla.empty ())
- yy_destroy_ (YY_NULLPTR, yyla);
-
- while (1 < yystack_.size ())
- {
- yy_destroy_ (YY_NULLPTR, yystack_[0]);
- yypop_ ();
- }
- throw;
- }
-#endif // YY_EXCEPTIONS
- }
-
- void
- Parser::error (const syntax_error& yyexc)
- {
- error (yyexc.what ());
- }
-
-#if YYDEBUG || 0
- const char *
- Parser::symbol_name (symbol_kind_type yysymbol)
- {
- return yytname_[yysymbol];
- }
-#endif // #if YYDEBUG || 0
-
-
-
-
-
- const signed char Parser::yypact_ninf_ = -3;
-
- const signed char Parser::yytable_ninf_ = -1;
-
- const short
- Parser::yypact_[] =
- {
- 0, 0, -3, -3, -2, 1, 8, 13, 14, 0,
- 0, 0, 2, 142, -3, 50, 7, 15, 9, 11,
- 12, -3, -3, -3, -3, 0, 6, 38, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, -3, 21, 22, 48, 49, 51, 188, 0, 0,
- 221, 96, 95, 95, 95, 95, 95, 95, 95, 141,
- 141, 141, 141, 141, 141, 17, 17, 17, 17, 17,
- 17, 17, 17, -3, -3, -3, -3, -3, 188, 188,
- 0, 221
- };
-
- const signed char
- Parser::yydefact_[] =
- {
- 2, 0, 40, 41, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 30, 0, 0, 0, 0, 0,
- 0, 31, 32, 33, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 34, 0, 0, 0, 0, 0, 27, 0, 0,
- 26, 0, 21, 22, 24, 23, 18, 20, 19, 16,
- 17, 12, 14, 13, 15, 10, 11, 8, 9, 5,
- 6, 7, 4, 35, 36, 37, 38, 39, 28, 29,
- 0, 25
- };
-
- const signed char
- Parser::yypgoto_[] =
- {
- -3, -3, -1, 4
- };
-
- const signed char
- Parser::yydefgoto_[] =
- {
- 0, 12, 13, 14
- };
-
- const signed char
- Parser::yytable_[] =
- {
- 15, 16, 24, 1, 17, 2, 3, 4, 5, 6,
- 7, 18, 8, 21, 22, 23, 19, 20, 52, 58,
- 54, 53, 55, 56, 57, 83, 84, 60, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
- 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
- 9, 59, 85, 86, 51, 87, 0, 88, 89, 10,
- 0, 11, 0, 25, 26, 27, 28, 0, 29, 0,
- 0, 0, 30, 0, 31, 50, 32, 33, 34, 35,
- 36, 0, 37, 0, 38, 0, 39, 0, 40, 91,
- 41, 0, 42, 0, 43, 0, 44, 0, 45, 0,
- 46, 0, 47, 0, 48, 0, 49, 0, 50, 25,
- 26, 27, 28, 0, 29, 0, 90, 0, 30, 0,
- 31, 0, 32, 33, 34, 35, 36, 37, 37, 38,
- 38, 39, 39, 40, 40, 41, 41, 42, 42, 43,
- 43, 44, 44, 45, 45, 46, 46, 47, 47, 48,
- 48, 49, 49, 50, 50, 25, 26, 27, 28, 0,
- 29, 0, 0, 0, 30, 0, 31, 0, 32, 33,
- 34, 35, 36, -1, 37, -1, 38, -1, 39, -1,
- 40, -1, 41, -1, 42, 43, 43, 44, 44, 45,
- 45, 46, 46, 47, 47, 48, 48, 49, 49, 50,
- 50, -1, -1, -1, 28, 0, 29, 0, 0, 0,
- 30, 0, 31, 0, 32, 33, 34, 35, 36, 0,
- 37, 0, 38, 0, 39, 0, 40, 0, 41, 0,
- 42, 0, 43, 0, 44, 0, 45, 0, 46, 29,
- 47, 0, 48, 30, 49, 31, 50, 32, 33, 34,
- 35, 36, 0, 37, 0, 38, 0, 39, 0, 40,
- 0, 41, 0, 42, 0, 43, 0, 44, 0, 45,
- 0, 46, 0, 47, 0, 48, 0, 49, 0, 50
- };
-
- const signed char
- Parser::yycheck_[] =
- {
- 1, 3, 0, 3, 3, 5, 6, 7, 8, 9,
- 10, 3, 12, 9, 10, 11, 3, 3, 11, 13,
- 11, 6, 11, 11, 25, 4, 4, 28, 29, 30,
- 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
- 50, 13, 4, 4, 4, 4, -1, 58, 59, 59,
- -1, 61, -1, 13, 14, 15, 16, -1, 18, -1,
- -1, -1, 22, -1, 24, 58, 26, 27, 28, 29,
- 30, -1, 32, -1, 34, -1, 36, -1, 38, 90,
- 40, -1, 42, -1, 44, -1, 46, -1, 48, -1,
- 50, -1, 52, -1, 54, -1, 56, -1, 58, 13,
- 14, 15, 16, -1, 18, -1, 20, -1, 22, -1,
- 24, -1, 26, 27, 28, 29, 30, 32, 32, 34,
- 34, 36, 36, 38, 38, 40, 40, 42, 42, 44,
- 44, 46, 46, 48, 48, 50, 50, 52, 52, 54,
- 54, 56, 56, 58, 58, 13, 14, 15, 16, -1,
- 18, -1, -1, -1, 22, -1, 24, -1, 26, 27,
- 28, 29, 30, 32, 32, 34, 34, 36, 36, 38,
- 38, 40, 40, 42, 42, 44, 44, 46, 46, 48,
- 48, 50, 50, 52, 52, 54, 54, 56, 56, 58,
- 58, 13, 14, 15, 16, -1, 18, -1, -1, -1,
- 22, -1, 24, -1, 26, 27, 28, 29, 30, -1,
- 32, -1, 34, -1, 36, -1, 38, -1, 40, -1,
- 42, -1, 44, -1, 46, -1, 48, -1, 50, 18,
- 52, -1, 54, 22, 56, 24, 58, 26, 27, 28,
- 29, 30, -1, 32, -1, 34, -1, 36, -1, 38,
- -1, 40, -1, 42, -1, 44, -1, 46, -1, 48,
- -1, 50, -1, 52, -1, 54, -1, 56, -1, 58
- };
-
- const signed char
- Parser::yystos_[] =
- {
- 0, 3, 5, 6, 7, 8, 9, 10, 12, 50,
- 59, 61, 64, 65, 66, 65, 3, 3, 3, 3,
- 3, 66, 66, 66, 0, 13, 14, 15, 16, 18,
- 22, 24, 26, 27, 28, 29, 30, 32, 34, 36,
- 38, 40, 42, 44, 46, 48, 50, 52, 54, 56,
- 58, 4, 11, 6, 11, 11, 11, 65, 13, 13,
- 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 4, 4, 4, 4, 4, 65, 65,
- 20, 65
- };
-
- const signed char
- Parser::yyr1_[] =
- {
- 0, 63, 64, 64, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 66, 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66
- };
-
- const signed char
- Parser::yyr2_[] =
- {
- 0, 2, 0, 1, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 5, 3, 3, 4, 4,
- 1, 2, 2, 2, 3, 4, 4, 4, 4, 4,
- 1, 1
- };
-
-
-#if YYDEBUG
- // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- // First, the terminals, then, starting at \a YYNTOKENS, nonterminals.
- const char*
- const Parser::yytname_[] =
- {
- "\"end of file\"", "error", "\"invalid token\"", "\"(\"", "\")\"",
- "\"number\"", "\"name\"", "FNAME", "HASPROP", "JGROUP", "JPARENT",
- "QSTR", "FILEIOVFD", "IN", "SOME", "ORDR", "COMMA", "\",\"", "QWE",
- "\"?\"", "COLON", "\":\"", "AND", "\"&&\"", "OR", "\"|\"", "EQV", "NEQV",
- "BITAND", "BITOR", "BITXOR", "\"^\"", "EQ", "\"=\"", "NE", "\"!=\"",
- "LT", "\"<\"", "GT", "\">\"", "LE", "\"<=\"", "GE", "\">=\"", "LS",
- "\"<<\"", "RS", "\">>\"", "ADD", "\"+\"", "MINUS", "\"-\"", "MUL",
- "\"*\"", "DIV", "\"/\"", "REM", "\"%\"", "DEG", "NOT", "\"!\"", "BITNOT",
- "\"~\"", "$accept", "S", "exp", "term", YY_NULLPTR
- };
-#endif
-
-
-#if YYDEBUG
- const unsigned char
- Parser::yyrline_[] =
- {
- 0, 104, 104, 105, 107, 108, 109, 110, 111, 112,
- 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
- 123, 124, 125, 126, 127, 128, 130, 131, 132, 133,
- 134, 136, 138, 139, 140, 141, 142, 143, 144, 145,
- 146, 147
- };
-
- void
- Parser::yy_stack_print_ () const
- {
- *yycdebug_ << "Stack now";
- for (stack_type::const_iterator
- i = yystack_.begin (),
- i_end = yystack_.end ();
- i != i_end; ++i)
- *yycdebug_ << ' ' << int (i->state);
- *yycdebug_ << '\n';
- }
-
- void
- Parser::yy_reduce_print_ (int yyrule) const
- {
- int yylno = yyrline_[yyrule];
- int yynrhs = yyr2_[yyrule];
- // Print the symbols being reduced, and their result.
- *yycdebug_ << "Reducing stack by rule " << yyrule - 1
- << " (line " << yylno << "):\n";
- // The symbols being reduced.
- for (int yyi = 0; yyi < yynrhs; yyi++)
- YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
- yystack_[(yynrhs) - (yyi + 1)]);
- }
-#endif // YYDEBUG
-
-
-#line 50 "QLParser.yy"
-} // QL
-#line 1210 "QLParser.tab.cc"
-
-#line 149 "QLParser.yy"
-
-
-namespace QL
-{
- static Parser::symbol_type
- unget_ret (std::istream &in, char c, Parser::symbol_type tok)
- {
- in.putback (c);
- 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)
- {
- int base = 0;
- int c;
-
- do
- c = result.in.get ();
- while (result.in && (c == ' ' || c == '\t'));
- if (!result.in)
- return Parser::make_YYEOF ();
-
- switch (c)
- {
- case '\n': return Parser::make_YYEOF ();
- case '(': return Parser::make_LPAR () ;
- case ')': return Parser::make_RPAR ();
- case ',': return Parser::make_COMMA ();
- case '%': return Parser::make_REM ();
- case '/': return Parser::make_DIV ();
- case '*': return Parser::make_MUL ();
- case '-': return Parser::make_MINUS ();
- case '+': return Parser::make_ADD ();
- case '~': return Parser::make_BITNOT ();
- case '^': return Parser::make_BITXOR ();
- case '?': return Parser::make_QWE ();
- case ':': return Parser::make_COLON ();
- case '|':
- c = result.in.get ();
- if (c == '|')
- return Parser::make_OR ();
- else
- return unget_ret (result.in, c, Parser::make_BITOR ());
- case '&':
- c = result.in.get ();
- if (c == '&')
- return Parser::make_AND ();
- else
- return unget_ret (result.in, c, Parser::make_BITAND ());
- case '!':
- c = result.in.get ();
- if (c == '=')
- return Parser::make_NE ();
- else
- return unget_ret (result.in, c, Parser::make_NOT ());
- case '=':
- c = result.in.get ();
- if (c == '=')
- return Parser::make_EQ ();
- else
- throw Parser::syntax_error ("Syntax error after =");
- case '<':
- c = result.in.get ();
- if (c == '=')
- return Parser::make_LE ();
- else if (c == '<')
- return Parser::make_LS ();
- else
- return unget_ret (result.in, c, Parser::make_LT ());
- case '>':
- c = result.in.get ();
- if (c == '=')
- return Parser::make_GE ();
- else if (c == '>')
- return Parser::make_RS ();
- else
- return unget_ret (result.in, c, Parser::make_GT ());
- case '"':
- {
- int maxsz = 16;
- char *str = (char *) malloc (maxsz);
- char *ptr = str;
-
- for (;;)
- {
- c = result.in.get ();
- if (!result.in)
- {
- free (str);
- throw Parser::syntax_error ("Unclosed \"");
- }
-
- switch (c)
- {
- case '"':
- *ptr = (char)0;
- // XXX omazur: need new string type
- return Parser::make_QSTR (new Expression (Expression::OP_NUM, (uint64_t) str));
- case 0:
- case '\n':
- free (str);
- throw Parser::syntax_error ("Multiline strings are not supported");
- default:
- if (ptr - str >= maxsz)
- {
- size_t len = ptr - str;
- maxsz = maxsz > 8192 ? maxsz + 8192 : maxsz * 2;
- char *new_s = (char *) realloc (str, maxsz);
- str = new_s;
- ptr = str + len;
- }
- *ptr++ = c;
- }
- }
- }
- default:
- if (c == '0')
- {
- base = 8;
- c = result.in.get ();
- if ( c == 'x' )
- {
- base = 16;
- c = result.in.get ();
- }
- }
- else if (c >= '1' && c <='9')
- base = 10;
-
- if (base)
- {
- uint64_t lval = 0;
- for (;;)
- {
- int digit = -1;
- switch (c)
- {
- case '0': case '1': case '2': case '3':
- case '4': case '5': case '6': case '7':
- digit = c - '0';
- break;
- case '8': case '9':
- if (base > 8)
- digit = c - '0';
- break;
- case 'a': case 'b': case 'c':
- case 'd': case 'e': case 'f':
- if (base == 16)
- digit = c - 'a' + 10;
- break;
- case 'A': case 'B': case 'C':
- case 'D': case 'E': case 'F':
- if (base == 16)
- digit = c - 'A' + 10;
- break;
- }
- if (digit == -1)
- {
- result.in.putback (c);
- break;
- }
- lval = lval * base + digit;
- c = result.in.get ();
- }
- return Parser::make_NUM (new Expression (Expression::OP_NUM, lval));
- }
-
- if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))
- {
- char name[32]; // omazur XXX: accept any length
- name[0] = (char)c;
- for (size_t i = 1; i < sizeof (name); i++)
- {
- c = result.in.get ();
- if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') ||
- (c >= '0' && c <= '9') || (c == '_'))
- name[i] = c;
- else
- {
- name[i] = (char)0;
- result.in.putback (c);
- break;
- }
- }
-
- if (strcasecmp (name, NTXT ("IN")) == 0)
- return Parser::make_IN ();
- else if (strcasecmp (name, NTXT ("SOME")) == 0)
- return Parser::make_SOME ();
- 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));
- else if (strcasecmp (name, NTXT ("FALSE")) == 0)
- return Parser::make_NUM (new Expression (Expression::OP_NUM, (uint64_t) 0));
- else if (strcasecmp (name, NTXT ("FNAME")) == 0)
- return Parser::make_FNAME (new Expression (Expression::OP_NUM, 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));
- else if (strcasecmp (name, NTXT ("JPARENT")) == 0 )
- return Parser::make_JPARENT (new Expression (Expression::OP_NUM, Expression::JAVA_JPARENT));
- else if (strcasecmp (name, NTXT ("DNAME")) == 0)
- return Parser::make_FNAME (new Expression (Expression::OP_NUM, 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_NAME (processName (name));
- }
-
- throw Parser::syntax_error ("Syntax error");
- }
- }
- void
- Parser::error (const std::string &)
- {
- // do nothing for now
- }
-}
-
diff --git a/gprofng/src/QLParser.tab.hh b/gprofng/src/QLParser.tab.hh
deleted file mode 100644
index eaf2cb5..0000000
--- a/gprofng/src/QLParser.tab.hh
+++ /dev/null
@@ -1,2038 +0,0 @@
-// A Bison parser, made by GNU Bison 3.7.5.
-
-// Skeleton interface for Bison LALR(1) parsers in C++
-
-// Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-// As a special exception, you may create a larger work that contains
-// part or all of the Bison parser skeleton and distribute that work
-// under terms of your choice, so long as that work isn't itself a
-// parser generator using the skeleton or a modified version thereof
-// as a parser skeleton. Alternatively, if you modify or redistribute
-// the parser skeleton itself, you may (at your option) remove this
-// special exception, which will cause the skeleton and the resulting
-// Bison output files to be licensed under the GNU General Public
-// License without this special exception.
-
-// This special exception was added by the Free Software Foundation in
-// version 2.2 of Bison.
-
-
-/**
- ** \file QLParser.tab.hh
- ** Define the QL::parser class.
- */
-
-// C++ LALR(1) parser skeleton written by Akim Demaille.
-
-// DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
-// especially those whose name start with YY_ or yy_. They are
-// private implementation details that can be changed or removed.
-
-#ifndef YY_YY_QLPARSER_TAB_HH_INCLUDED
-# define YY_YY_QLPARSER_TAB_HH_INCLUDED
-// "%code requires" blocks.
-#line 33 "QLParser.yy"
-
-#include "QLParser.h"
-#include "DbeSession.h"
-#include "Expression.h"
-#include "Table.h"
-#include "i18n.h"
-
-#line 57 "QLParser.tab.hh"
-
-# include <cassert>
-# include <cstdlib> // std::abort
-# include <iostream>
-# include <stdexcept>
-# include <string>
-# include <vector>
-
-#if defined __cplusplus
-# define YY_CPLUSPLUS __cplusplus
-#else
-# define YY_CPLUSPLUS 199711L
-#endif
-
-// Support move semantics when possible.
-#if 201103L <= YY_CPLUSPLUS
-# define YY_MOVE std::move
-# define YY_MOVE_OR_COPY move
-# define YY_MOVE_REF(Type) Type&&
-# define YY_RVREF(Type) Type&&
-# define YY_COPY(Type) Type
-#else
-# define YY_MOVE
-# define YY_MOVE_OR_COPY copy
-# define YY_MOVE_REF(Type) Type&
-# define YY_RVREF(Type) const Type&
-# define YY_COPY(Type) const Type&
-#endif
-
-// Support noexcept when possible.
-#if 201103L <= YY_CPLUSPLUS
-# define YY_NOEXCEPT noexcept
-# define YY_NOTHROW
-#else
-# define YY_NOEXCEPT
-# define YY_NOTHROW throw ()
-#endif
-
-// Support constexpr when possible.
-#if 201703 <= YY_CPLUSPLUS
-# define YY_CONSTEXPR constexpr
-#else
-# define YY_CONSTEXPR
-#endif
-
-#include <typeinfo>
-#ifndef YY_ASSERT
-# include <cassert>
-# define YY_ASSERT assert
-#endif
-
-
-#ifndef YY_ATTRIBUTE_PURE
-# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
-# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
-# else
-# define YY_ATTRIBUTE_PURE
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE_UNUSED
-# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
-# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
-# else
-# define YY_ATTRIBUTE_UNUSED
-# endif
-#endif
-
-/* Suppress unused-variable warnings by "using" E. */
-#if ! defined lint || defined __GNUC__
-# define YY_USE(E) ((void) (E))
-#else
-# define YY_USE(E) /* empty */
-#endif
-
-#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized. */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
- _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
- _Pragma ("GCC diagnostic pop")
-#else
-# define YY_INITIAL_VALUE(Value) Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
-#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
-#endif
-
-#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
-# define YY_IGNORE_USELESS_CAST_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
-# define YY_IGNORE_USELESS_CAST_END \
- _Pragma ("GCC diagnostic pop")
-#endif
-#ifndef YY_IGNORE_USELESS_CAST_BEGIN
-# define YY_IGNORE_USELESS_CAST_BEGIN
-# define YY_IGNORE_USELESS_CAST_END
-#endif
-
-# ifndef YY_CAST
-# ifdef __cplusplus
-# define YY_CAST(Type, Val) static_cast<Type> (Val)
-# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
-# else
-# define YY_CAST(Type, Val) ((Type) (Val))
-# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
-# endif
-# endif
-# ifndef YY_NULLPTR
-# if defined __cplusplus
-# if 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
-# else
-# define YY_NULLPTR 0
-# endif
-# else
-# define YY_NULLPTR ((void*)0)
-# endif
-# endif
-
-/* Debug traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-
-#line 50 "QLParser.yy"
-namespace QL {
-#line 192 "QLParser.tab.hh"
-
-
-
-
- /// A Bison parser.
- class Parser
- {
- public:
-#ifndef YYSTYPE
- /// A buffer to store and retrieve objects.
- ///
- /// Sort of a variant, but does not keep track of the nature
- /// of the stored data, since that knowledge is available
- /// via the current parser state.
- class semantic_type
- {
- public:
- /// Type of *this.
- typedef semantic_type self_type;
-
- /// Empty construction.
- semantic_type () YY_NOEXCEPT
- : yybuffer_ ()
- , yytypeid_ (YY_NULLPTR)
- {}
-
- /// Construct and fill.
- template <typename T>
- semantic_type (YY_RVREF (T) t)
- : yytypeid_ (&typeid (T))
- {
- YY_ASSERT (sizeof (T) <= size);
- new (yyas_<T> ()) T (YY_MOVE (t));
- }
-
-#if 201103L <= YY_CPLUSPLUS
- /// Non copyable.
- semantic_type (const self_type&) = delete;
- /// Non copyable.
- self_type& operator= (const self_type&) = delete;
-#endif
-
- /// Destruction, allowed only if empty.
- ~semantic_type () YY_NOEXCEPT
- {
- YY_ASSERT (!yytypeid_);
- }
-
-# if 201103L <= YY_CPLUSPLUS
- /// Instantiate a \a T in here from \a t.
- template <typename T, typename... U>
- T&
- emplace (U&&... u)
- {
- YY_ASSERT (!yytypeid_);
- YY_ASSERT (sizeof (T) <= size);
- yytypeid_ = & typeid (T);
- return *new (yyas_<T> ()) T (std::forward <U>(u)...);
- }
-# else
- /// Instantiate an empty \a T in here.
- template <typename T>
- T&
- emplace ()
- {
- YY_ASSERT (!yytypeid_);
- YY_ASSERT (sizeof (T) <= size);
- yytypeid_ = & typeid (T);
- return *new (yyas_<T> ()) T ();
- }
-
- /// Instantiate a \a T in here from \a t.
- template <typename T>
- T&
- emplace (const T& t)
- {
- YY_ASSERT (!yytypeid_);
- YY_ASSERT (sizeof (T) <= size);
- yytypeid_ = & typeid (T);
- return *new (yyas_<T> ()) T (t);
- }
-# endif
-
- /// Instantiate an empty \a T in here.
- /// Obsolete, use emplace.
- template <typename T>
- T&
- build ()
- {
- return emplace<T> ();
- }
-
- /// Instantiate a \a T in here from \a t.
- /// Obsolete, use emplace.
- template <typename T>
- T&
- build (const T& t)
- {
- return emplace<T> (t);
- }
-
- /// Accessor to a built \a T.
- template <typename T>
- T&
- as () YY_NOEXCEPT
- {
- YY_ASSERT (yytypeid_);
- YY_ASSERT (*yytypeid_ == typeid (T));
- YY_ASSERT (sizeof (T) <= size);
- return *yyas_<T> ();
- }
-
- /// Const accessor to a built \a T (for %printer).
- template <typename T>
- const T&
- as () const YY_NOEXCEPT
- {
- YY_ASSERT (yytypeid_);
- YY_ASSERT (*yytypeid_ == typeid (T));
- YY_ASSERT (sizeof (T) <= size);
- return *yyas_<T> ();
- }
-
- /// Swap the content with \a that, of same type.
- ///
- /// Both variants must be built beforehand, because swapping the actual
- /// data requires reading it (with as()), and this is not possible on
- /// unconstructed variants: it would require some dynamic testing, which
- /// should not be the variant's responsibility.
- /// Swapping between built and (possibly) non-built is done with
- /// self_type::move ().
- template <typename T>
- void
- swap (self_type& that) YY_NOEXCEPT
- {
- YY_ASSERT (yytypeid_);
- YY_ASSERT (*yytypeid_ == *that.yytypeid_);
- std::swap (as<T> (), that.as<T> ());
- }
-
- /// Move the content of \a that to this.
- ///
- /// Destroys \a that.
- template <typename T>
- void
- move (self_type& that)
- {
-# if 201103L <= YY_CPLUSPLUS
- emplace<T> (std::move (that.as<T> ()));
-# else
- emplace<T> ();
- swap<T> (that);
-# endif
- that.destroy<T> ();
- }
-
-# if 201103L <= YY_CPLUSPLUS
- /// Move the content of \a that to this.
- template <typename T>
- void
- move (self_type&& that)
- {
- emplace<T> (std::move (that.as<T> ()));
- that.destroy<T> ();
- }
-#endif
-
- /// Copy the content of \a that to this.
- template <typename T>
- void
- copy (const self_type& that)
- {
- emplace<T> (that.as<T> ());
- }
-
- /// Destroy the stored \a T.
- template <typename T>
- void
- destroy ()
- {
- as<T> ().~T ();
- yytypeid_ = YY_NULLPTR;
- }
-
- private:
-#if YY_CPLUSPLUS < 201103L
- /// Non copyable.
- semantic_type (const self_type&);
- /// Non copyable.
- self_type& operator= (const self_type&);
-#endif
-
- /// Accessor to raw memory as \a T.
- template <typename T>
- T*
- yyas_ () YY_NOEXCEPT
- {
- void *yyp = yybuffer_.yyraw;
- return static_cast<T*> (yyp);
- }
-
- /// Const accessor to raw memory as \a T.
- template <typename T>
- const T*
- yyas_ () const YY_NOEXCEPT
- {
- const void *yyp = yybuffer_.yyraw;
- return static_cast<const T*> (yyp);
- }
-
- /// An auxiliary type to compute the largest semantic type.
- union union_type
- {
- // "number"
- // "name"
- // FNAME
- // JGROUP
- // JPARENT
- // QSTR
- // FILEIOVFD
- // exp
- // term
- char dummy1[sizeof (Expression *)];
- };
-
- /// The size of the largest semantic type.
- enum { size = sizeof (union_type) };
-
- /// A buffer to store semantic values.
- union
- {
- /// Strongest alignment constraints.
- long double yyalign_me;
- /// A buffer large enough to store any of the semantic values.
- char yyraw[size];
- } yybuffer_;
-
- /// Whether the content is built: if defined, the name of the stored type.
- const std::type_info *yytypeid_;
- };
-
-#else
- typedef YYSTYPE semantic_type;
-#endif
-
- /// Syntax errors thrown from user actions.
- struct syntax_error : std::runtime_error
- {
- syntax_error (const std::string& m)
- : std::runtime_error (m)
- {}
-
- syntax_error (const syntax_error& s)
- : std::runtime_error (s.what ())
- {}
-
- ~syntax_error () YY_NOEXCEPT YY_NOTHROW;
- };
-
- /// Token kinds.
- struct token
- {
- enum token_kind_type
- {
- L_YYEMPTY = -2,
- L_YYEOF = 0, // "end of file"
- L_YYerror = 256, // error
- L_YYUNDEF = 257, // "invalid token"
- L_LPAR = 258, // "("
- L_RPAR = 259, // ")"
- L_NUM = 260, // "number"
- L_NAME = 261, // "name"
- L_FNAME = 262, // FNAME
- L_HASPROP = 263, // HASPROP
- L_JGROUP = 264, // JGROUP
- L_JPARENT = 265, // JPARENT
- L_QSTR = 266, // QSTR
- L_FILEIOVFD = 267, // FILEIOVFD
- L_IN = 268, // IN
- L_SOME = 269, // SOME
- L_ORDR = 270, // ORDR
- L_COMMA = 271, // COMMA
- L_QWE = 273, // QWE
- L_COLON = 275, // COLON
- L_AND = 277, // AND
- L_OR = 279, // OR
- L_EQV = 281, // EQV
- L_NEQV = 282, // NEQV
- L_BITAND = 283, // BITAND
- L_BITOR = 284, // BITOR
- L_BITXOR = 285, // BITXOR
- L_EQ = 287, // EQ
- L_NE = 289, // NE
- L_LT = 291, // LT
- L_GT = 293, // GT
- L_LE = 295, // LE
- L_GE = 297, // GE
- L_LS = 299, // LS
- L_RS = 301, // RS
- L_ADD = 303, // ADD
- L_MINUS = 305, // MINUS
- L_MUL = 307, // MUL
- L_DIV = 309, // DIV
- L_REM = 311, // REM
- L_DEG = 313, // DEG
- L_NOT = 314, // NOT
- L_BITNOT = 316 // BITNOT
- };
- /// Backward compatibility alias (Bison 3.6).
- typedef token_kind_type yytokentype;
- };
-
- /// Token kind, as returned by yylex.
- typedef token::yytokentype token_kind_type;
-
- /// Backward compatibility alias (Bison 3.6).
- typedef token_kind_type token_type;
-
- /// Symbol kinds.
- struct symbol_kind
- {
- enum symbol_kind_type
- {
- YYNTOKENS = 63, ///< Number of tokens.
- S_YYEMPTY = -2,
- S_YYEOF = 0, // "end of file"
- S_YYerror = 1, // error
- S_YYUNDEF = 2, // "invalid token"
- S_LPAR = 3, // "("
- S_RPAR = 4, // ")"
- S_NUM = 5, // "number"
- S_NAME = 6, // "name"
- S_FNAME = 7, // FNAME
- S_HASPROP = 8, // HASPROP
- S_JGROUP = 9, // JGROUP
- S_JPARENT = 10, // JPARENT
- S_QSTR = 11, // QSTR
- S_FILEIOVFD = 12, // FILEIOVFD
- S_IN = 13, // IN
- S_SOME = 14, // SOME
- S_ORDR = 15, // ORDR
- S_COMMA = 16, // COMMA
- S_17_ = 17, // ","
- S_QWE = 18, // QWE
- S_19_ = 19, // "?"
- S_COLON = 20, // COLON
- S_21_ = 21, // ":"
- S_AND = 22, // AND
- S_23_ = 23, // "&&"
- S_OR = 24, // OR
- S_25_ = 25, // "|"
- S_EQV = 26, // EQV
- S_NEQV = 27, // NEQV
- S_BITAND = 28, // BITAND
- S_BITOR = 29, // BITOR
- S_BITXOR = 30, // BITXOR
- S_31_ = 31, // "^"
- S_EQ = 32, // EQ
- S_33_ = 33, // "="
- S_NE = 34, // NE
- S_35_ = 35, // "!="
- S_LT = 36, // LT
- S_37_ = 37, // "<"
- S_GT = 38, // GT
- S_39_ = 39, // ">"
- S_LE = 40, // LE
- S_41_ = 41, // "<="
- S_GE = 42, // GE
- S_43_ = 43, // ">="
- S_LS = 44, // LS
- S_45_ = 45, // "<<"
- S_RS = 46, // RS
- S_47_ = 47, // ">>"
- S_ADD = 48, // ADD
- S_49_ = 49, // "+"
- S_MINUS = 50, // MINUS
- S_51_ = 51, // "-"
- S_MUL = 52, // MUL
- S_53_ = 53, // "*"
- S_DIV = 54, // DIV
- S_55_ = 55, // "/"
- S_REM = 56, // REM
- S_57_ = 57, // "%"
- S_DEG = 58, // DEG
- S_NOT = 59, // NOT
- S_60_ = 60, // "!"
- S_BITNOT = 61, // BITNOT
- S_62_ = 62, // "~"
- S_YYACCEPT = 63, // $accept
- S_S = 64, // S
- S_exp = 65, // exp
- S_term = 66 // term
- };
- };
-
- /// (Internal) symbol kind.
- typedef symbol_kind::symbol_kind_type symbol_kind_type;
-
- /// The number of tokens.
- static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS;
-
- /// A complete symbol.
- ///
- /// Expects its Base type to provide access to the symbol kind
- /// via kind ().
- ///
- /// Provide access to semantic value.
- template <typename Base>
- struct basic_symbol : Base
- {
- /// Alias to Base.
- typedef Base super_type;
-
- /// Default constructor.
- basic_symbol ()
- : value ()
- {}
-
-#if 201103L <= YY_CPLUSPLUS
- /// Move constructor.
- basic_symbol (basic_symbol&& that)
- : Base (std::move (that))
- , value ()
- {
- switch (this->kind ())
- {
- case symbol_kind::S_NUM: // "number"
- case symbol_kind::S_NAME: // "name"
- case symbol_kind::S_FNAME: // FNAME
- case symbol_kind::S_JGROUP: // JGROUP
- case symbol_kind::S_JPARENT: // JPARENT
- case symbol_kind::S_QSTR: // QSTR
- case symbol_kind::S_FILEIOVFD: // FILEIOVFD
- case symbol_kind::S_exp: // exp
- case symbol_kind::S_term: // term
- value.move< Expression * > (std::move (that.value));
- break;
-
- default:
- break;
- }
-
- }
-#endif
-
- /// Copy constructor.
- basic_symbol (const basic_symbol& that);
-
- /// Constructors for typed symbols.
-#if 201103L <= YY_CPLUSPLUS
- basic_symbol (typename Base::kind_type t)
- : Base (t)
- {}
-#else
- basic_symbol (typename Base::kind_type t)
- : Base (t)
- {}
-#endif
-
-#if 201103L <= YY_CPLUSPLUS
- basic_symbol (typename Base::kind_type t, Expression *&& v)
- : Base (t)
- , value (std::move (v))
- {}
-#else
- basic_symbol (typename Base::kind_type t, const Expression *& v)
- : Base (t)
- , value (v)
- {}
-#endif
-
- /// Destroy the symbol.
- ~basic_symbol ()
- {
- clear ();
- }
-
- /// Destroy contents, and record that is empty.
- void clear () YY_NOEXCEPT
- {
- // User destructor.
- symbol_kind_type yykind = this->kind ();
- basic_symbol<Base>& yysym = *this;
- (void) yysym;
- switch (yykind)
- {
- case symbol_kind::S_NUM: // "number"
-#line 100 "QLParser.yy"
- { delete yysym.value.template as < Expression * > (); }
-#line 682 "QLParser.tab.hh"
- break;
-
- case symbol_kind::S_NAME: // "name"
-#line 100 "QLParser.yy"
- { delete yysym.value.template as < Expression * > (); }
-#line 688 "QLParser.tab.hh"
- break;
-
- case symbol_kind::S_FNAME: // FNAME
-#line 100 "QLParser.yy"
- { delete yysym.value.template as < Expression * > (); }
-#line 694 "QLParser.tab.hh"
- break;
-
- case symbol_kind::S_JGROUP: // JGROUP
-#line 100 "QLParser.yy"
- { delete yysym.value.template as < Expression * > (); }
-#line 700 "QLParser.tab.hh"
- break;
-
- case symbol_kind::S_JPARENT: // JPARENT
-#line 100 "QLParser.yy"
- { delete yysym.value.template as < Expression * > (); }
-#line 706 "QLParser.tab.hh"
- break;
-
- case symbol_kind::S_QSTR: // QSTR
-#line 100 "QLParser.yy"
- { delete yysym.value.template as < Expression * > (); }
-#line 712 "QLParser.tab.hh"
- break;
-
- case symbol_kind::S_FILEIOVFD: // FILEIOVFD
-#line 100 "QLParser.yy"
- { delete yysym.value.template as < Expression * > (); }
-#line 718 "QLParser.tab.hh"
- break;
-
- case symbol_kind::S_exp: // exp
-#line 100 "QLParser.yy"
- { delete yysym.value.template as < Expression * > (); }
-#line 724 "QLParser.tab.hh"
- break;
-
- case symbol_kind::S_term: // term
-#line 100 "QLParser.yy"
- { delete yysym.value.template as < Expression * > (); }
-#line 730 "QLParser.tab.hh"
- break;
-
- default:
- break;
- }
-
- // Value type destructor.
-switch (yykind)
- {
- case symbol_kind::S_NUM: // "number"
- case symbol_kind::S_NAME: // "name"
- case symbol_kind::S_FNAME: // FNAME
- case symbol_kind::S_JGROUP: // JGROUP
- case symbol_kind::S_JPARENT: // JPARENT
- case symbol_kind::S_QSTR: // QSTR
- case symbol_kind::S_FILEIOVFD: // FILEIOVFD
- case symbol_kind::S_exp: // exp
- case symbol_kind::S_term: // term
- value.template destroy< Expression * > ();
- break;
-
- default:
- break;
- }
-
- Base::clear ();
- }
-
-#if YYDEBUG || 0
- /// The user-facing name of this symbol.
- const char *name () const YY_NOEXCEPT
- {
- return Parser::symbol_name (this->kind ());
- }
-#endif // #if YYDEBUG || 0
-
-
- /// Backward compatibility (Bison 3.6).
- symbol_kind_type type_get () const YY_NOEXCEPT;
-
- /// Whether empty.
- bool empty () const YY_NOEXCEPT;
-
- /// Destructive move, \a s is emptied into this.
- void move (basic_symbol& s);
-
- /// The semantic value.
- semantic_type value;
-
- private:
-#if YY_CPLUSPLUS < 201103L
- /// Assignment operator.
- basic_symbol& operator= (const basic_symbol& that);
-#endif
- };
-
- /// Type access provider for token (enum) based symbols.
- struct by_kind
- {
- /// Default constructor.
- by_kind ();
-
-#if 201103L <= YY_CPLUSPLUS
- /// Move constructor.
- by_kind (by_kind&& that);
-#endif
-
- /// Copy constructor.
- by_kind (const by_kind& that);
-
- /// The symbol kind as needed by the constructor.
- typedef token_kind_type kind_type;
-
- /// Constructor from (external) token numbers.
- by_kind (kind_type t);
-
- /// Record that this symbol is empty.
- void clear () YY_NOEXCEPT;
-
- /// Steal the symbol kind from \a that.
- void move (by_kind& that);
-
- /// The (internal) type number (corresponding to \a type).
- /// \a empty when empty.
- symbol_kind_type kind () const YY_NOEXCEPT;
-
- /// Backward compatibility (Bison 3.6).
- symbol_kind_type type_get () const YY_NOEXCEPT;
-
- /// The symbol kind.
- /// \a S_YYEMPTY when empty.
- symbol_kind_type kind_;
- };
-
- /// Backward compatibility for a private implementation detail (Bison 3.6).
- typedef by_kind by_type;
-
- /// "External" symbols: returned by the scanner.
- struct symbol_type : basic_symbol<by_kind>
- {
- /// Superclass.
- typedef basic_symbol<by_kind> super_type;
-
- /// Empty symbol.
- symbol_type () {}
-
- /// Constructor for valueless symbols, and symbols from each type.
-#if 201103L <= YY_CPLUSPLUS
- symbol_type (int tok)
- : super_type(token_type (tok))
-#else
- symbol_type (int tok)
- : super_type(token_type (tok))
-#endif
- {
- YY_ASSERT (tok == token::L_YYEOF
- || (token::L_YYerror <= tok && tok <= token::L_RPAR)
- || tok == token::L_HASPROP
- || (token::L_IN <= tok && tok <= 317));
- }
-#if 201103L <= YY_CPLUSPLUS
- symbol_type (int tok, Expression * v)
- : super_type(token_type (tok), std::move (v))
-#else
- symbol_type (int tok, const Expression *& v)
- : super_type(token_type (tok), v)
-#endif
- {
- YY_ASSERT ((token::L_NUM <= tok && tok <= token::L_FNAME)
- || (token::L_JGROUP <= tok && tok <= token::L_FILEIOVFD));
- }
- };
-
- /// Build a parser object.
- Parser (QL::Result &result_yyarg);
- virtual ~Parser ();
-
-#if 201103L <= YY_CPLUSPLUS
- /// Non copyable.
- Parser (const Parser&) = delete;
- /// Non copyable.
- Parser& operator= (const Parser&) = delete;
-#endif
-
- /// Parse. An alias for parse ().
- /// \returns 0 iff parsing succeeded.
- int operator() ();
-
- /// Parse.
- /// \returns 0 iff parsing succeeded.
- virtual int parse ();
-
-#if YYDEBUG
- /// The current debugging stream.
- std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
- /// Set the current debugging stream.
- void set_debug_stream (std::ostream &);
-
- /// Type for debugging levels.
- typedef int debug_level_type;
- /// The current debugging level.
- debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
- /// Set the current debugging level.
- void set_debug_level (debug_level_type l);
-#endif
-
- /// Report a syntax error.
- /// \param msg a description of the syntax error.
- virtual void error (const std::string& msg);
-
- /// Report a syntax error.
- void error (const syntax_error& err);
-
-#if YYDEBUG || 0
- /// The user-facing name of the symbol whose (internal) number is
- /// YYSYMBOL. No bounds checking.
- static const char *symbol_name (symbol_kind_type yysymbol);
-#endif // #if YYDEBUG || 0
-
-
- // Implementation of make_symbol for each symbol type.
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_YYEOF ()
- {
- return symbol_type (token::L_YYEOF);
- }
-#else
- static
- symbol_type
- make_YYEOF ()
- {
- return symbol_type (token::L_YYEOF);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_YYerror ()
- {
- return symbol_type (token::L_YYerror);
- }
-#else
- static
- symbol_type
- make_YYerror ()
- {
- return symbol_type (token::L_YYerror);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_YYUNDEF ()
- {
- return symbol_type (token::L_YYUNDEF);
- }
-#else
- static
- symbol_type
- make_YYUNDEF ()
- {
- return symbol_type (token::L_YYUNDEF);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_LPAR ()
- {
- return symbol_type (token::L_LPAR);
- }
-#else
- static
- symbol_type
- make_LPAR ()
- {
- return symbol_type (token::L_LPAR);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_RPAR ()
- {
- return symbol_type (token::L_RPAR);
- }
-#else
- static
- symbol_type
- make_RPAR ()
- {
- return symbol_type (token::L_RPAR);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_NUM (Expression * v)
- {
- return symbol_type (token::L_NUM, std::move (v));
- }
-#else
- static
- symbol_type
- make_NUM (const Expression *& v)
- {
- return symbol_type (token::L_NUM, v);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_NAME (Expression * v)
- {
- return symbol_type (token::L_NAME, std::move (v));
- }
-#else
- static
- symbol_type
- make_NAME (const Expression *& v)
- {
- return symbol_type (token::L_NAME, v);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_FNAME (Expression * v)
- {
- return symbol_type (token::L_FNAME, std::move (v));
- }
-#else
- static
- symbol_type
- make_FNAME (const Expression *& v)
- {
- return symbol_type (token::L_FNAME, v);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_HASPROP ()
- {
- return symbol_type (token::L_HASPROP);
- }
-#else
- static
- symbol_type
- make_HASPROP ()
- {
- return symbol_type (token::L_HASPROP);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_JGROUP (Expression * v)
- {
- return symbol_type (token::L_JGROUP, std::move (v));
- }
-#else
- static
- symbol_type
- make_JGROUP (const Expression *& v)
- {
- return symbol_type (token::L_JGROUP, v);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_JPARENT (Expression * v)
- {
- return symbol_type (token::L_JPARENT, std::move (v));
- }
-#else
- static
- symbol_type
- make_JPARENT (const Expression *& v)
- {
- return symbol_type (token::L_JPARENT, v);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_QSTR (Expression * v)
- {
- return symbol_type (token::L_QSTR, std::move (v));
- }
-#else
- static
- symbol_type
- make_QSTR (const Expression *& v)
- {
- return symbol_type (token::L_QSTR, v);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_FILEIOVFD (Expression * v)
- {
- return symbol_type (token::L_FILEIOVFD, std::move (v));
- }
-#else
- static
- symbol_type
- make_FILEIOVFD (const Expression *& v)
- {
- return symbol_type (token::L_FILEIOVFD, v);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_IN ()
- {
- return symbol_type (token::L_IN);
- }
-#else
- static
- symbol_type
- make_IN ()
- {
- return symbol_type (token::L_IN);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_SOME ()
- {
- return symbol_type (token::L_SOME);
- }
-#else
- static
- symbol_type
- make_SOME ()
- {
- return symbol_type (token::L_SOME);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_ORDR ()
- {
- return symbol_type (token::L_ORDR);
- }
-#else
- static
- symbol_type
- make_ORDR ()
- {
- return symbol_type (token::L_ORDR);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_COMMA ()
- {
- return symbol_type (token::L_COMMA);
- }
-#else
- static
- symbol_type
- make_COMMA ()
- {
- return symbol_type (token::L_COMMA);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_QWE ()
- {
- return symbol_type (token::L_QWE);
- }
-#else
- static
- symbol_type
- make_QWE ()
- {
- return symbol_type (token::L_QWE);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_COLON ()
- {
- return symbol_type (token::L_COLON);
- }
-#else
- static
- symbol_type
- make_COLON ()
- {
- return symbol_type (token::L_COLON);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_AND ()
- {
- return symbol_type (token::L_AND);
- }
-#else
- static
- symbol_type
- make_AND ()
- {
- return symbol_type (token::L_AND);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_OR ()
- {
- return symbol_type (token::L_OR);
- }
-#else
- static
- symbol_type
- make_OR ()
- {
- return symbol_type (token::L_OR);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_EQV ()
- {
- return symbol_type (token::L_EQV);
- }
-#else
- static
- symbol_type
- make_EQV ()
- {
- return symbol_type (token::L_EQV);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_NEQV ()
- {
- return symbol_type (token::L_NEQV);
- }
-#else
- static
- symbol_type
- make_NEQV ()
- {
- return symbol_type (token::L_NEQV);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_BITAND ()
- {
- return symbol_type (token::L_BITAND);
- }
-#else
- static
- symbol_type
- make_BITAND ()
- {
- return symbol_type (token::L_BITAND);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_BITOR ()
- {
- return symbol_type (token::L_BITOR);
- }
-#else
- static
- symbol_type
- make_BITOR ()
- {
- return symbol_type (token::L_BITOR);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_BITXOR ()
- {
- return symbol_type (token::L_BITXOR);
- }
-#else
- static
- symbol_type
- make_BITXOR ()
- {
- return symbol_type (token::L_BITXOR);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_EQ ()
- {
- return symbol_type (token::L_EQ);
- }
-#else
- static
- symbol_type
- make_EQ ()
- {
- return symbol_type (token::L_EQ);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_NE ()
- {
- return symbol_type (token::L_NE);
- }
-#else
- static
- symbol_type
- make_NE ()
- {
- return symbol_type (token::L_NE);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_LT ()
- {
- return symbol_type (token::L_LT);
- }
-#else
- static
- symbol_type
- make_LT ()
- {
- return symbol_type (token::L_LT);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_GT ()
- {
- return symbol_type (token::L_GT);
- }
-#else
- static
- symbol_type
- make_GT ()
- {
- return symbol_type (token::L_GT);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_LE ()
- {
- return symbol_type (token::L_LE);
- }
-#else
- static
- symbol_type
- make_LE ()
- {
- return symbol_type (token::L_LE);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_GE ()
- {
- return symbol_type (token::L_GE);
- }
-#else
- static
- symbol_type
- make_GE ()
- {
- return symbol_type (token::L_GE);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_LS ()
- {
- return symbol_type (token::L_LS);
- }
-#else
- static
- symbol_type
- make_LS ()
- {
- return symbol_type (token::L_LS);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_RS ()
- {
- return symbol_type (token::L_RS);
- }
-#else
- static
- symbol_type
- make_RS ()
- {
- return symbol_type (token::L_RS);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_ADD ()
- {
- return symbol_type (token::L_ADD);
- }
-#else
- static
- symbol_type
- make_ADD ()
- {
- return symbol_type (token::L_ADD);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_MINUS ()
- {
- return symbol_type (token::L_MINUS);
- }
-#else
- static
- symbol_type
- make_MINUS ()
- {
- return symbol_type (token::L_MINUS);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_MUL ()
- {
- return symbol_type (token::L_MUL);
- }
-#else
- static
- symbol_type
- make_MUL ()
- {
- return symbol_type (token::L_MUL);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_DIV ()
- {
- return symbol_type (token::L_DIV);
- }
-#else
- static
- symbol_type
- make_DIV ()
- {
- return symbol_type (token::L_DIV);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_REM ()
- {
- return symbol_type (token::L_REM);
- }
-#else
- static
- symbol_type
- make_REM ()
- {
- return symbol_type (token::L_REM);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_DEG ()
- {
- return symbol_type (token::L_DEG);
- }
-#else
- static
- symbol_type
- make_DEG ()
- {
- return symbol_type (token::L_DEG);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_NOT ()
- {
- return symbol_type (token::L_NOT);
- }
-#else
- static
- symbol_type
- make_NOT ()
- {
- return symbol_type (token::L_NOT);
- }
-#endif
-#if 201103L <= YY_CPLUSPLUS
- static
- symbol_type
- make_BITNOT ()
- {
- return symbol_type (token::L_BITNOT);
- }
-#else
- static
- symbol_type
- make_BITNOT ()
- {
- return symbol_type (token::L_BITNOT);
- }
-#endif
-
-
- private:
-#if YY_CPLUSPLUS < 201103L
- /// Non copyable.
- Parser (const Parser&);
- /// Non copyable.
- Parser& operator= (const Parser&);
-#endif
-
-
- /// Stored state numbers (used for stacks).
- typedef signed char state_type;
-
- /// Compute post-reduction state.
- /// \param yystate the current state
- /// \param yysym the nonterminal to push on the stack
- static state_type yy_lr_goto_state_ (state_type yystate, int yysym);
-
- /// Whether the given \c yypact_ value indicates a defaulted state.
- /// \param yyvalue the value to check
- static bool yy_pact_value_is_default_ (int yyvalue);
-
- /// Whether the given \c yytable_ value indicates a syntax error.
- /// \param yyvalue the value to check
- static bool yy_table_value_is_error_ (int yyvalue);
-
- static const signed char yypact_ninf_;
- static const signed char yytable_ninf_;
-
- /// Convert a scanner token kind \a t to a symbol kind.
- /// In theory \a t should be a token_kind_type, but character literals
- /// are valid, yet not members of the token_type enum.
- static symbol_kind_type yytranslate_ (int t);
-
-#if YYDEBUG || 0
- /// For a symbol, its name in clear.
- static const char* const yytname_[];
-#endif // #if YYDEBUG || 0
-
-
- // Tables.
- // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- // STATE-NUM.
- static const short yypact_[];
-
- // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
- // Performed when YYTABLE does not specify something else to do. Zero
- // means the default is an error.
- static const signed char yydefact_[];
-
- // YYPGOTO[NTERM-NUM].
- static const signed char yypgoto_[];
-
- // YYDEFGOTO[NTERM-NUM].
- static const signed char yydefgoto_[];
-
- // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
- // positive, shift that token. If negative, reduce the rule whose
- // number is the opposite. If YYTABLE_NINF, syntax error.
- static const signed char yytable_[];
-
- static const signed char yycheck_[];
-
- // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- // symbol of state STATE-NUM.
- static const signed char yystos_[];
-
- // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
- static const signed char yyr1_[];
-
- // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
- static const signed char yyr2_[];
-
-
-#if YYDEBUG
- // YYRLINE[YYN] -- Source line where rule number YYN was defined.
- static const unsigned char yyrline_[];
- /// Report on the debug stream that the rule \a r is going to be reduced.
- virtual void yy_reduce_print_ (int r) const;
- /// Print the state stack on the debug stream.
- virtual void yy_stack_print_ () const;
-
- /// Debugging level.
- int yydebug_;
- /// Debug stream.
- std::ostream* yycdebug_;
-
- /// \brief Display a symbol kind, value and location.
- /// \param yyo The output stream.
- /// \param yysym The symbol.
- template <typename Base>
- void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
-#endif
-
- /// \brief Reclaim the memory associated to a symbol.
- /// \param yymsg Why this token is reclaimed.
- /// If null, print nothing.
- /// \param yysym The symbol.
- template <typename Base>
- void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
-
- private:
- /// Type access provider for state based symbols.
- struct by_state
- {
- /// Default constructor.
- by_state () YY_NOEXCEPT;
-
- /// The symbol kind as needed by the constructor.
- typedef state_type kind_type;
-
- /// Constructor.
- by_state (kind_type s) YY_NOEXCEPT;
-
- /// Copy constructor.
- by_state (const by_state& that) YY_NOEXCEPT;
-
- /// Record that this symbol is empty.
- void clear () YY_NOEXCEPT;
-
- /// Steal the symbol kind from \a that.
- void move (by_state& that);
-
- /// The symbol kind (corresponding to \a state).
- /// \a symbol_kind::S_YYEMPTY when empty.
- symbol_kind_type kind () const YY_NOEXCEPT;
-
- /// The state number used to denote an empty symbol.
- /// We use the initial state, as it does not have a value.
- enum { empty_state = 0 };
-
- /// The state.
- /// \a empty when empty.
- state_type state;
- };
-
- /// "Internal" symbol: element of the stack.
- struct stack_symbol_type : basic_symbol<by_state>
- {
- /// Superclass.
- typedef basic_symbol<by_state> super_type;
- /// Construct an empty symbol.
- stack_symbol_type ();
- /// Move or copy construction.
- stack_symbol_type (YY_RVREF (stack_symbol_type) that);
- /// Steal the contents from \a sym to build this.
- stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
-#if YY_CPLUSPLUS < 201103L
- /// Assignment, needed by push_back by some old implementations.
- /// Moves the contents of that.
- stack_symbol_type& operator= (stack_symbol_type& that);
-
- /// Assignment, needed by push_back by other implementations.
- /// Needed by some other old implementations.
- stack_symbol_type& operator= (const stack_symbol_type& that);
-#endif
- };
-
- /// A stack with random access from its top.
- template <typename T, typename S = std::vector<T> >
- class stack
- {
- public:
- // Hide our reversed order.
- typedef typename S::iterator iterator;
- typedef typename S::const_iterator const_iterator;
- typedef typename S::size_type size_type;
- typedef typename std::ptrdiff_t index_type;
-
- stack (size_type n = 200)
- : seq_ (n)
- {}
-
-#if 201103L <= YY_CPLUSPLUS
- /// Non copyable.
- stack (const stack&) = delete;
- /// Non copyable.
- stack& operator= (const stack&) = delete;
-#endif
-
- /// Random access.
- ///
- /// Index 0 returns the topmost element.
- const T&
- operator[] (index_type i) const
- {
- return seq_[size_type (size () - 1 - i)];
- }
-
- /// Random access.
- ///
- /// Index 0 returns the topmost element.
- T&
- operator[] (index_type i)
- {
- return seq_[size_type (size () - 1 - i)];
- }
-
- /// Steal the contents of \a t.
- ///
- /// Close to move-semantics.
- void
- push (YY_MOVE_REF (T) t)
- {
- seq_.push_back (T ());
- operator[] (0).move (t);
- }
-
- /// Pop elements from the stack.
- void
- pop (std::ptrdiff_t n = 1) YY_NOEXCEPT
- {
- for (; 0 < n; --n)
- seq_.pop_back ();
- }
-
- /// Pop all elements from the stack.
- void
- clear () YY_NOEXCEPT
- {
- seq_.clear ();
- }
-
- /// Number of elements on the stack.
- index_type
- size () const YY_NOEXCEPT
- {
- return index_type (seq_.size ());
- }
-
- /// Iterator on top of the stack (going downwards).
- const_iterator
- begin () const YY_NOEXCEPT
- {
- return seq_.begin ();
- }
-
- /// Bottom of the stack.
- const_iterator
- end () const YY_NOEXCEPT
- {
- return seq_.end ();
- }
-
- /// Present a slice of the top of a stack.
- class slice
- {
- public:
- slice (const stack& stack, index_type range)
- : stack_ (stack)
- , range_ (range)
- {}
-
- const T&
- operator[] (index_type i) const
- {
- return stack_[range_ - i];
- }
-
- private:
- const stack& stack_;
- index_type range_;
- };
-
- private:
-#if YY_CPLUSPLUS < 201103L
- /// Non copyable.
- stack (const stack&);
- /// Non copyable.
- stack& operator= (const stack&);
-#endif
- /// The wrapped container.
- S seq_;
- };
-
-
- /// Stack type.
- typedef stack<stack_symbol_type> stack_type;
-
- /// The stack.
- stack_type yystack_;
-
- /// Push a new state on the stack.
- /// \param m a debug message to display
- /// if null, no trace is output.
- /// \param sym the symbol
- /// \warning the contents of \a s.value is stolen.
- void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
-
- /// Push a new look ahead token on the state on the stack.
- /// \param m a debug message to display
- /// if null, no trace is output.
- /// \param s the state
- /// \param sym the symbol (for its value and location).
- /// \warning the contents of \a sym.value is stolen.
- void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
-
- /// Pop \a n symbols from the stack.
- void yypop_ (int n = 1);
-
- /// Constants.
- enum
- {
- yylast_ = 279, ///< Last index in yytable_.
- yynnts_ = 4, ///< Number of nonterminal symbols.
- yyfinal_ = 24 ///< Termination state number.
- };
-
-
- // User arguments.
- QL::Result &result;
-
- };
-
- inline
- Parser::symbol_kind_type
- Parser::yytranslate_ (int t)
- {
- // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
- // TOKEN-NUM as returned by yylex.
- static
- const signed char
- translate_table[] =
- {
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59, 60, 61, 62
- };
- // Last valid token kind.
- const int code_max = 317;
-
- if (t <= 0)
- return symbol_kind::S_YYEOF;
- else if (t <= code_max)
- return YY_CAST (symbol_kind_type, translate_table[t]);
- else
- return symbol_kind::S_YYUNDEF;
- }
-
- // basic_symbol.
- template <typename Base>
- Parser::basic_symbol<Base>::basic_symbol (const basic_symbol& that)
- : Base (that)
- , value ()
- {
- switch (this->kind ())
- {
- case symbol_kind::S_NUM: // "number"
- case symbol_kind::S_NAME: // "name"
- case symbol_kind::S_FNAME: // FNAME
- case symbol_kind::S_JGROUP: // JGROUP
- case symbol_kind::S_JPARENT: // JPARENT
- case symbol_kind::S_QSTR: // QSTR
- case symbol_kind::S_FILEIOVFD: // FILEIOVFD
- case symbol_kind::S_exp: // exp
- case symbol_kind::S_term: // term
- value.copy< Expression * > (YY_MOVE (that.value));
- break;
-
- default:
- break;
- }
-
- }
-
-
-
- template <typename Base>
- Parser::symbol_kind_type
- Parser::basic_symbol<Base>::type_get () const YY_NOEXCEPT
- {
- return this->kind ();
- }
-
- template <typename Base>
- bool
- Parser::basic_symbol<Base>::empty () const YY_NOEXCEPT
- {
- return this->kind () == symbol_kind::S_YYEMPTY;
- }
-
- template <typename Base>
- void
- Parser::basic_symbol<Base>::move (basic_symbol& s)
- {
- super_type::move (s);
- switch (this->kind ())
- {
- case symbol_kind::S_NUM: // "number"
- case symbol_kind::S_NAME: // "name"
- case symbol_kind::S_FNAME: // FNAME
- case symbol_kind::S_JGROUP: // JGROUP
- case symbol_kind::S_JPARENT: // JPARENT
- case symbol_kind::S_QSTR: // QSTR
- case symbol_kind::S_FILEIOVFD: // FILEIOVFD
- case symbol_kind::S_exp: // exp
- case symbol_kind::S_term: // term
- value.move< Expression * > (YY_MOVE (s.value));
- break;
-
- default:
- break;
- }
-
- }
-
- // by_kind.
- inline
- Parser::by_kind::by_kind ()
- : kind_ (symbol_kind::S_YYEMPTY)
- {}
-
-#if 201103L <= YY_CPLUSPLUS
- inline
- Parser::by_kind::by_kind (by_kind&& that)
- : kind_ (that.kind_)
- {
- that.clear ();
- }
-#endif
-
- inline
- Parser::by_kind::by_kind (const by_kind& that)
- : kind_ (that.kind_)
- {}
-
- inline
- Parser::by_kind::by_kind (token_kind_type t)
- : kind_ (yytranslate_ (t))
- {}
-
- inline
- void
- Parser::by_kind::clear () YY_NOEXCEPT
- {
- kind_ = symbol_kind::S_YYEMPTY;
- }
-
- inline
- void
- Parser::by_kind::move (by_kind& that)
- {
- kind_ = that.kind_;
- that.clear ();
- }
-
- inline
- Parser::symbol_kind_type
- Parser::by_kind::kind () const YY_NOEXCEPT
- {
- return kind_;
- }
-
- inline
- Parser::symbol_kind_type
- Parser::by_kind::type_get () const YY_NOEXCEPT
- {
- return this->kind ();
- }
-
-#line 50 "QLParser.yy"
-} // QL
-#line 2034 "QLParser.tab.hh"
-
-
-
-
-#endif // !YY_YY_QLPARSER_TAB_HH_INCLUDED
diff --git a/gprofng/src/QLParser.yy b/gprofng/src/QLParser.yy
index 689d0e1..d7f732c 100644
--- a/gprofng/src/QLParser.yy
+++ b/gprofng/src/QLParser.yy
@@ -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: 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 { $$ = $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");