From 42f44eb5bf4ecd36e26e051fada79d861d0f92d2 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Tue, 7 Mar 2017 19:54:56 +0100 Subject: [PATCH] bison --- .gitignore | 7 +- Makefile.frag | 32 +- TODO | 4 +- config.m4 | 3 +- m4/psi/psi.m4 | 39 + m4/psi/psi_type.m4 | 15 + php_psi_cpp.h.in | 36 + php_psi_posix.h.in | 28 +- php_psi_stdinc.h.in | 26 + scripts/gen_calc_oper.php | 6 +- src/calc/oper.h | 94 +- src/context.c | 7 +- src/cpp.c | 331 +- src/cpp.h | 62 +- src/cpp_tokiter.c | 71 +- src/marshal.c | 2 + src/module.c | 26 +- src/parser.c | 14963 ++++++++-------- src/parser.h | 55 +- src/parser.re | 283 +- src/parser_def.h | 76 - src/parser_proc.c | 9565 ++++++---- src/parser_proc.h | 759 +- src/parser_proc.inc | 34 - src/parser_proc.y | 1069 -- src/parser_proc_def.h | 2076 +-- src/parser_proc_grammar.y | 1690 ++ src/plist.c | 47 +- src/plist.h | 1 + src/token.c | 111 +- src/token.h | 13 +- src/types/assert_stmt.h | 10 +- src/types/cpp_exp.c | 195 + src/types/cpp_exp.h | 2 + src/types/cpp_macro_decl.c | 49 + src/types/cpp_macro_decl.h | 1 + src/types/decl_arg.c | 10 +- src/types/decl_enum_item.c | 3 +- src/types/decl_type.c | 16 + src/types/decl_type.h | 1 + src/types/num_exp.c | 73 +- src/types/num_exp.h | 6 + src/types/number.c | 167 +- .../parser/{cpp/define001.psi => cpp001.phpt} | 21 +- tests/parser/{dump => }/dump001.phpt | 0 tests/parser/enum/enum001.psi | 17 - tests/parser/{enum => }/enum001.phpt | 21 +- tests/parser/validate001.phpt | 25 - tests/parser/validate002.phpt | 17 + tests/parser/validate003.phpt | 18 + tests/parser/validate004.phpt | 17 + tests/parser/validate005.phpt | 25 + tests/parser/validate006.phpt | 17 + 53 files changed, 17529 insertions(+), 14713 deletions(-) create mode 100644 php_psi_cpp.h.in delete mode 100644 src/parser_def.h delete mode 100644 src/parser_proc.inc delete mode 100644 src/parser_proc.y create mode 100644 src/parser_proc_grammar.y rename tests/parser/{cpp/define001.psi => cpp001.phpt} (64%) rename tests/parser/{dump => }/dump001.phpt (100%) delete mode 100644 tests/parser/enum/enum001.psi rename tests/parser/{enum => }/enum001.phpt (51%) create mode 100644 tests/parser/validate002.phpt create mode 100644 tests/parser/validate003.phpt create mode 100644 tests/parser/validate004.phpt create mode 100644 tests/parser/validate005.phpt create mode 100644 tests/parser/validate006.phpt diff --git a/.gitignore b/.gitignore index 93a5b6c..ce94c07 100644 --- a/.gitignore +++ b/.gitignore @@ -44,9 +44,6 @@ tests/*/*.sh /*.diff /*.phar /tmp/ -/lemon.c -/lempar.c -/lemon /context.h /libffi.h /libjit.h @@ -61,8 +58,8 @@ tests/*/*.sh /parser_proc.h /token.h /types.h -/src/parser_proc.out +/src/parser_proc.output /php_psi_stdinc.h /php_psi_posix.h /types/ -/calc/ \ No newline at end of file +/calc/ diff --git a/Makefile.frag b/Makefile.frag index 39ba8c0..7df00ad 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -11,43 +11,19 @@ $(PHP_PSI_BUILDDIR)/types/%.h: $(PHP_PSI_SRCDIR)/src/types/%.h | $(PHP_PSI_BUILD $(PHP_PSI_BUILDDIR)/%.h: $(PHP_PSI_SRCDIR)/src/%.h @cat >$@ <$< -$(PHP_PSI_BUILDDIR)/lempar.c: - curl -sSo $@ "http://www.sqlite.org/src/raw/tool/lempar.c?name=db1bdb4821f2d8fbd76e577cf3ab18642c8d08d1" - -$(PHP_PSI_BUILDDIR)/lemon.c: - curl -sSo $@ "http://www.sqlite.org/src/raw/tool/lemon.c?name=5ccba178a8e8a4b21e1c9232944d23973da38ad7" - -$(PHP_PSI_BUILDDIR)/lemon: $(PHP_PSI_BUILDDIR)/lemon.c | $(PHP_PSI_BUILDDIR)/lempar.c - $(CC) -o $@ $< - $(PHP_PSI_SRCDIR)/src/parser_proc.h: $(PHP_PSI_SRCDIR)/src/parser_proc.c -$(PHP_PSI_SRCDIR)/src/parser_proc.inc: -$(PHP_PSI_SRCDIR)/src/parser_proc_def.h: $(PHP_PSI_SRCDIR)/src/parser_def.h -$(PHP_PSI_SRCDIR)/src/parser_proc.y: $(PHP_PSI_SRCDIR)/src/parser_proc_def.h $(PHP_PSI_SRCDIR)/src/parser_proc.inc - cat $(PHP_PSI_SRCDIR)/src/parser_proc.inc >$@ - $(CPP) -P -DGENERATE $< >>$@ -$(PHP_PSI_SRCDIR)/src/parser_proc.c: $(PHP_PSI_SRCDIR)/src/parser_proc.y $(LEMON) +$(PHP_PSI_SRCDIR)/src/parser_proc.c: $(PHP_PSI_SRCDIR)/src/parser_proc_grammar.y # trickery needed for relative #line directives - cd $(PHP_PSI_SRCDIR) && $(LEMON_PATH)$(LEMON) $(patsubst $(PHP_PSI_SRCDIR)/%,%,$<) + cd $(PHP_PSI_SRCDIR) && bison -Wall -v -d -o $(patsubst $(PHP_PSI_SRCDIR)/%,%,$@) $(patsubst $(PHP_PSI_SRCDIR)/%,%,$<) $(PHP_PSI_SRCDIR)/src/parser.re: $(PHP_PSI_SRCDIR)/src/parser_proc.h touch $@ $(PHP_PSI_SRCDIR)/src/parser.c: $(PHP_PSI_SRCDIR)/src/parser.re # trickery needed for relative #line directives - cd $(PHP_PSI_SRCDIR) && $(RE2C) -o $(patsubst $(PHP_PSI_SRCDIR)/%,%,$@) $(patsubst $(PHP_PSI_SRCDIR)/%,%,$<) + cd $(PHP_PSI_SRCDIR) && $(RE2C) -W -o $(patsubst $(PHP_PSI_SRCDIR)/%,%,$@) $(patsubst $(PHP_PSI_SRCDIR)/%,%,$<) -$(PHP_PSI_SRCDIR)/src/calc/basic.h: $(PHP_PSI_SRCDIR)/scripts/gen_calc_basic.php - $(PHP_EXECUTABLE) $< >$@ -$(PHP_PSI_SRCDIR)/src/calc/bin.h: $(PHP_PSI_SRCDIR)/scripts/gen_calc_bin.php - $(PHP_EXECUTABLE) $< >$@ -$(PHP_PSI_SRCDIR)/src/calc/bool.h: $(PHP_PSI_SRCDIR)/scripts/gen_calc_bool.php - $(PHP_EXECUTABLE) $< >$@ -$(PHP_PSI_SRCDIR)/src/calc/cast.h: $(PHP_PSI_SRCDIR)/scripts/gen_calc_cast.php - $(PHP_EXECUTABLE) $< >$@ -$(PHP_PSI_SRCDIR)/src/calc/cmp.h: $(PHP_PSI_SRCDIR)/scripts/gen_calc_cmp.php - $(PHP_EXECUTABLE) $< >$@ -$(PHP_PSI_SRCDIR)/src/calc/oper.h: $(PHP_PSI_SRCDIR)/scripts/gen_calc_oper.php +$(PHP_PSI_SRCDIR)/src/calc/%.h: $(PHP_PSI_SRCDIR)/scripts/gen_calc_%.php $(PHP_EXECUTABLE) $< >$@ $(PHP_PSI_SRCDIR)/src/calc.h: | $(PHP_PSI_SRCDIR)/src/calc/basic.h $(PHP_PSI_SRCDIR)/src/calc/bin.h $(PHP_PSI_SRCDIR)/src/calc/bool.h $(PHP_PSI_SRCDIR)/src/calc/cast.h $(PHP_PSI_SRCDIR)/src/calc/cmp.h $(PHP_PSI_SRCDIR)/src/calc/oper.h diff --git a/TODO b/TODO index 502044b..5157da6 100644 --- a/TODO +++ b/TODO @@ -5,4 +5,6 @@ * pemalloc * CPP style #if(def(ined)) support in parser.re with a HashTable * think about a better system for EXTVARs, separate \set and \get functions are clunky -* impl_def_val: allow num_exp \ No newline at end of file +* impl_def_val: allow num_exp +* fix right recursion of let_exp and set_exp +* numeral suffixes \ No newline at end of file diff --git a/config.m4 b/config.m4 index 5c8ed57..63458ad 100644 --- a/config.m4 +++ b/config.m4 @@ -91,7 +91,6 @@ if test "$PHP_PSI" != no; then AC_MSG_CHECKING([psi build dir]) AC_MSG_RESULT([$PHP_PSI_BUILDDIR]) - PSI_LEMON PSI_CHECK_LIBJIT PSI_CHECK_LIBFFI @@ -174,7 +173,7 @@ if test "$PHP_PSI" != no; then )` \ " PHP_PSI_GENERATED=" \ - src/parser_proc.y src/parser_proc.c src/parser.c \ + src/parser_proc.c src/parser.c \ src/calc/basic.h src/calc/bin.h src/calc/bool.h src/calc/cast.h \ src/calc/cmp.h src/calc/oper.h \ " diff --git a/m4/psi/psi.m4 b/m4/psi/psi.m4 index f99d582..984aa60 100644 --- a/m4/psi/psi.m4 +++ b/m4/psi/psi.m4 @@ -18,6 +18,42 @@ AC_DEFUN(PSI_CONFIG_INIT, [ ]) psi_cv_libc_main=$psi_libc_main ]) + + AC_MSG_CHECKING(for preprocessor defaults) + psi_cpp_predef=`$CPP -Wp,-dM - &1 >/dev/null \ + | $AWK ' + /include.*search.*start/ { + capture = 1 + next + } + /[Ee]nd.*search/ { + capture = 0 + } + { + if (capture) + print $1 + } + ' \ + ` + psi_cpp_predef_count=`printf %s "$psi_cpp_predef" | wc -l` + psi_cpp_search_count=`printf %s "$psi_cpp_search" | wc -l` + AC_MSG_RESULT([$psi_cpp_predef_count predefined macros, and $psi_cpp_search_count search paths]) + PSI_CPP_PREDEF=`printf "%s\n" "$psi_cpp_predef" | \ + $AWK '{ + gsub(/"/, "\\\\\""); + printf "\"%s\\\n\"\n", $[]0 + }' \ + ` + PSI_CPP_SEARCH=`printf %s "$psi_cpp_search" | \ + $AWK '{ + if (i) printf ":"; + gsub(/^@<:@@<:@:space:@:>@@:>@+/,""); + gsub(/@<:@@<:@:space:@:>@@:>@+$/,""); + printf "%s", $[]0; + ++i + }' \ + ` if test "$PHP_PSI_MAINTAINER_MODE" = "yes"; then PSI_FAST_CONFIG=true @@ -48,6 +84,7 @@ AC_DEFUN(PSI_CONFIG_INIT, [ AC_CONFIG_FILES( [$PHP_PSI_BUILDDIR/php_psi_stdinc.h:$PHP_PSI_SRCDIR/php_psi_stdinc.h.in] [$PHP_PSI_BUILDDIR/php_psi_posix.h:$PHP_PSI_SRCDIR/php_psi_posix.h.in] + [$PHP_PSI_BUILDDIR/php_psi_cpp.h:$PHP_PSI_SRCDIR/php_psi_cpp.h.in] ) ]) @@ -86,6 +123,8 @@ AC_DEFUN(PSI_CONFIG_DONE, [ AC_SUBST([PSI_REDIRS]) AC_SUBST([PSI_MACROS]) AC_SUBST([PSI_DECLS]) + AC_SUBST([PSI_CPP_SEARCH]) + AC_SUBST([PSI_CPP_PREDEF]) ]) dnl PSI_SH_CONFIG_POSIX_ENABLED(section) diff --git a/m4/psi/psi_type.m4 b/m4/psi/psi_type.m4 index 27aeeac..b3940a4 100644 --- a/m4/psi/psi_type.m4 +++ b/m4/psi/psi_type.m4 @@ -243,8 +243,12 @@ AC_DEFUN(PSI_CHECK_STD_TYPES, [ PSI_STDTYPE(short int, int) PSI_STDTYPE(signed short, int) PSI_STDTYPE(signed short int, int) + PSI_STDTYPE(short signed, int) + PSI_STDTYPE(short signed int, int) PSI_STDTYPE(unsigned short, uint) PSI_STDTYPE(unsigned short int, uint) + PSI_STDTYPE(short unsigned, uint) + PSI_STDTYPE(short unsigned int, uint) PSI_STDTYPE(int, int) AC_CHECK_ALIGNOF(int) PSI_STDTYPE(signed int, int) @@ -255,14 +259,25 @@ AC_DEFUN(PSI_CHECK_STD_TYPES, [ AC_CHECK_ALIGNOF(long) PSI_STDTYPE(long int, int) PSI_STDTYPE(signed long int, int) + PSI_STDTYPE(long signed int, int) PSI_STDTYPE(unsigned long, uint) PSI_STDTYPE(unsigned long int, uint) + PSI_STDTYPE(long unsigned, uint) + PSI_STDTYPE(long unsigned int, uint) PSI_STDTYPE(long long, int) AC_CHECK_ALIGNOF(long long) PSI_STDTYPE(signed long long, int) PSI_STDTYPE(signed long long int, int) + PSI_STDTYPE(long signed long, int) + PSI_STDTYPE(long signed long int, int) + PSI_STDTYPE(long long signed, int) + PSI_STDTYPE(long long signed int, int) PSI_STDTYPE(unsigned long long, uint) PSI_STDTYPE(unsigned long long int, uint) + PSI_STDTYPE(long unsigned long, uint) + PSI_STDTYPE(long unsigned long int, uint) + PSI_STDTYPE(long long unsigned, uint) + PSI_STDTYPE(long long unsigned int, uint) dnl this must come after the check for "unsigned long long int"; autoconf, wth? PSI_STDTYPE(long long int, int) ]) diff --git a/php_psi_cpp.h.in b/php_psi_cpp.h.in new file mode 100644 index 0000000..3069ba4 --- /dev/null +++ b/php_psi_cpp.h.in @@ -0,0 +1,36 @@ +/******************************************************************************* + Copyright (c) 2016, Michael Wallner . + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*******************************************************************************/ + +/* generated by configure */ + +#ifdef PSI_CPP_SEARCH +static const char psi_cpp_search[] = "@PSI_CPP_SEARCH@"; +#endif + +#ifdef PSI_CPP_PREDEF +static const char psi_cpp_predef[] = "" +@PSI_CPP_PREDEF@ +; +#endif diff --git a/php_psi_posix.h.in b/php_psi_posix.h.in index 1b2f07a..882e30c 100644 --- a/php_psi_posix.h.in +++ b/php_psi_posix.h.in @@ -1,6 +1,29 @@ +/******************************************************************************* + Copyright (c) 2016, Michael Wallner . + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*******************************************************************************/ + /* generated by configure */ -#ifndef PSI_POSIX_H -#define PSI_POSIX_H #include "php_psi_stdinc.h" @@ -92,4 +115,3 @@ static struct psi_func_redir { }; #endif -#endif diff --git a/php_psi_stdinc.h.in b/php_psi_stdinc.h.in index 55c2f09..7bf0bd8 100644 --- a/php_psi_stdinc.h.in +++ b/php_psi_stdinc.h.in @@ -1,4 +1,30 @@ +/******************************************************************************* + Copyright (c) 2016, Michael Wallner . + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*******************************************************************************/ + /* generated by configure */ + #ifndef PSI_STDINC_H #define PSI_STDINC_H diff --git a/scripts/gen_calc_oper.php b/scripts/gen_calc_oper.php index 126e9ac..b6e62aa 100644 --- a/scripts/gen_calc_oper.php +++ b/scripts/gen_calc_oper.php @@ -3,7 +3,7 @@ include __DIR__."/_include.php"; $oper = [ - ["NOT", "TILDE"], + ["NOT", "TILDE", "CAST"], ["ASTERISK", "SLASH", "MODULO"], ["PLUS", "MINUS"], ["LSHIFT", "RSHIFT"], @@ -27,9 +27,9 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; } else if (op1 == op2) { return 0; - } else if (!op1) { + } else if (!op1 || op1 == PSI_T_NUMBER) { return 1; - } else if (!op2) { + } else if (!op2 || op2 == PSI_T_NUMBER) { return -1; } diff --git a/src/calc/oper.h b/src/calc/oper.h index cf86b18..8208e30 100644 --- a/src/calc/oper.h +++ b/src/calc/oper.h @@ -36,9 +36,9 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; } else if (op1 == op2) { return 0; - } else if (!op1) { + } else if (!op1 || op1 == PSI_T_NUMBER) { return 1; - } else if (!op2) { + } else if (!op2 || op2 == PSI_T_NUMBER) { return -1; } @@ -49,6 +49,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 0; case PSI_T_TILDE: return 0; + case PSI_T_CAST: + return 0; case PSI_T_ASTERISK: return -1; case PSI_T_SLASH: @@ -97,6 +99,58 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 0; case PSI_T_TILDE: return 0; + case PSI_T_CAST: + return 0; + case PSI_T_ASTERISK: + return -1; + case PSI_T_SLASH: + return -1; + case PSI_T_MODULO: + return -1; + case PSI_T_PLUS: + return -1; + case PSI_T_MINUS: + return -1; + case PSI_T_LSHIFT: + return -1; + case PSI_T_RSHIFT: + return -1; + case PSI_T_LCHEVR: + return -1; + case PSI_T_CMP_LE: + return -1; + case PSI_T_RCHEVR: + return -1; + case PSI_T_CMP_GE: + return -1; + case PSI_T_AMPERSAND: + return -1; + case PSI_T_CMP_EQ: + return -1; + case PSI_T_CMP_NE: + return -1; + case PSI_T_CARET: + return -1; + case PSI_T_PIPE: + return -1; + case PSI_T_AND: + return -1; + case PSI_T_OR: + return -1; + default: + assert(0); + break; + } + break; + + case PSI_T_CAST: + switch (op2) { + case PSI_T_NOT: + return 0; + case PSI_T_TILDE: + return 0; + case PSI_T_CAST: + return 0; case PSI_T_ASTERISK: return -1; case PSI_T_SLASH: @@ -145,6 +199,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 0; case PSI_T_SLASH: @@ -193,6 +249,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 0; case PSI_T_SLASH: @@ -241,6 +299,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 0; case PSI_T_SLASH: @@ -289,6 +349,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 1; case PSI_T_SLASH: @@ -337,6 +399,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 1; case PSI_T_SLASH: @@ -385,6 +449,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 1; case PSI_T_SLASH: @@ -433,6 +499,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 1; case PSI_T_SLASH: @@ -481,6 +549,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 1; case PSI_T_SLASH: @@ -529,6 +599,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 1; case PSI_T_SLASH: @@ -577,6 +649,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 1; case PSI_T_SLASH: @@ -625,6 +699,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 1; case PSI_T_SLASH: @@ -673,6 +749,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 1; case PSI_T_SLASH: @@ -721,6 +799,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 1; case PSI_T_SLASH: @@ -769,6 +849,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 1; case PSI_T_SLASH: @@ -817,6 +899,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 1; case PSI_T_SLASH: @@ -865,6 +949,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 1; case PSI_T_SLASH: @@ -913,6 +999,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 1; case PSI_T_SLASH: @@ -961,6 +1049,8 @@ static inline int psi_calc_oper(token_t op1, token_t op2) return 1; case PSI_T_TILDE: return 1; + case PSI_T_CAST: + return 1; case PSI_T_ASTERISK: return 1; case PSI_T_SLASH: diff --git a/src/context.c b/src/context.c index 199f533..161534e 100644 --- a/src/context.c +++ b/src/context.c @@ -240,6 +240,7 @@ void psi_context_build(struct psi_context *C, const char *paths) for (i = 0; i < n; ++i) { char psi[MAXPATHLEN]; struct psi_parser P; + struct psi_parser_input *I; if (MAXPATHLEN <= slprintf(psi, MAXPATHLEN, "%s/%s", ptr, entries[i]->d_name)) { C->error(PSI_DATA(C), NULL, PSI_WARNING, "Path to PSI file too long: %s/%s", @@ -250,15 +251,15 @@ void psi_context_build(struct psi_context *C, const char *paths) psi, strerror(errno)); continue; } - if (!psi_parser_open_file(&P, psi)) { + if (!(I = psi_parser_open_file(&P, psi, true))) { C->error(PSI_DATA(C), NULL, PSI_WARNING, "Failed to open PSI file (%s): %s", psi, strerror(errno)); continue; } - - psi_parser_parse(&P); + psi_parser_parse(&P, I); psi_context_add_data(C, PSI_DATA(&P)); psi_parser_dtor(&P); + free(I); } } diff --git a/src/cpp.c b/src/cpp.c index 8fcd5cf..0c64246 100644 --- a/src/cpp.c +++ b/src/cpp.c @@ -28,164 +28,70 @@ #include "cpp.h" #include "parser.h" -static inline bool psi_cpp_level_skipped(struct psi_cpp_data *cpp) -{ - return cpp->skip == cpp->level; -} -static inline void psi_cpp_level_skip(struct psi_cpp_data *cpp) -{ - assert(!cpp->skip); - cpp->skip = cpp->level; -} -static inline void psi_cpp_level_unskip(struct psi_cpp_data *cpp) +#define PSI_CPP_SEARCH +#define PSI_CPP_PREDEF +#include "php_psi_cpp.h" + +static void free_cpp_def(zval *p) { - if (psi_cpp_level_skipped(cpp)) { - cpp->skip = 0; + if (Z_TYPE_P(p) == IS_PTR) { + psi_cpp_macro_decl_free((void *) &Z_PTR_P(p)); } } -static inline bool psi_cpp_level_masked(struct psi_cpp_data *cpp) -{ - return cpp->seen & (1 << cpp->level); -} -static inline void psi_cpp_level_mask(struct psi_cpp_data *cpp) + +struct psi_cpp *psi_cpp_init(struct psi_parser *P) { - assert(!psi_cpp_level_masked(cpp)); - cpp->seen |= (1 << cpp->level); + struct psi_cpp *cpp = calloc(1, sizeof(*cpp)); + + cpp->parser = P; + ALLOC_HASHTABLE(cpp->defs); + zend_hash_init(cpp->defs, 0, NULL, free_cpp_def, 1); + + return cpp; } -static inline void psi_cpp_level_unmask(struct psi_cpp_data *cpp) + +bool psi_cpp_load_defaults(struct psi_cpp *cpp) { - cpp->seen &= ~(1 << cpp->level); + struct psi_parser_input *predef; + + if ((predef = psi_parser_open_string(cpp->parser, psi_cpp_predef, sizeof(psi_cpp_predef) - 1))) { + bool parsed = psi_parser_parse(cpp->parser, predef); + free(predef); + return parsed; + } + + return false; } -static void psi_cpp_eval(struct psi_data *D, struct psi_cpp_data *cpp) +static int dump_def(zval *p) { - assert(cpp->exp); + struct psi_cpp_macro_decl *decl = Z_PTR_P(p); - PSI_DEBUG_PRINT(D, "PSI: CPP EVAL < %s (level=%u, skip=%u)\n", - cpp->exp->token->text, cpp->level, cpp->skip); + if (decl) { + dprintf(2, "#define "); + psi_cpp_macro_decl_dump(2, decl); + dprintf(2, "\n"); + } + return ZEND_HASH_APPLY_KEEP; +} -#if PSI_CPP_DEBUG - psi_cpp_exp_dump(2, cpp->exp); -#endif +void psi_cpp_free(struct psi_cpp **cpp_ptr) +{ + if (*cpp_ptr) { + struct psi_cpp *cpp = *cpp_ptr; - switch (cpp->exp->type) { - case PSI_T_ERROR: - if (!cpp->skip) { - D->error(D, cpp->exp->token, PSI_ERROR, "%s", - cpp->exp->data.tok->text); - } - break; - case PSI_T_WARNING: - if (!cpp->skip) { - D->error(D, cpp->exp->token, PSI_WARNING, "%s", - cpp->exp->data.tok->text); - } - break; - case PSI_T_UNDEF: - if (!cpp->skip) { - psi_cpp_undef(cpp, cpp->exp->data.tok); - } - break; - case PSI_T_DEFINE: - if (!cpp->skip) { - psi_cpp_define(cpp, cpp->exp->data.decl); - /* FIXME: copy */ - cpp->exp->data.decl = NULL; + *cpp_ptr = NULL; + if (cpp->parser->flags & PSI_DEBUG) { + fprintf(stderr, "PSI: CPP decls:\n"); + zend_hash_apply(cpp->defs, dump_def); } - break; - case PSI_T_IFDEF: - ++cpp->level; - if (!cpp->skip) { - if (psi_cpp_defined(cpp, cpp->exp->data.tok)) { - psi_cpp_level_mask(cpp); - } else { - psi_cpp_level_skip(cpp); - } - } - break; - case PSI_T_IFNDEF: - ++cpp->level; - if (!cpp->skip) { - if (psi_cpp_defined(cpp, cpp->exp->data.tok)) { - psi_cpp_level_skip(cpp); - } else { - psi_cpp_level_mask(cpp); - } - } - break; - case PSI_T_IF: - ++cpp->level; - if (!cpp->skip) { - if (psi_cpp_if(cpp->exp, &cpp->defs, D)) { - psi_cpp_level_mask(cpp); - } else { - psi_cpp_level_skip(cpp); - } - } - break; - case PSI_T_ENDIF: - if (!cpp->level) { - D->error(D, cpp->exp->token, PSI_WARNING, "Ingoring lone #endif"); - } else { - psi_cpp_level_unskip(cpp); - psi_cpp_level_unmask(cpp); - --cpp->level; - } - break; - case PSI_T_ELSE: - /* FIXME: catch "else" after "else" */ - if (!cpp->level) { - D->error(D, cpp->exp->token, PSI_WARNING, "Ingoring lone #else"); - } else if (psi_cpp_level_skipped(cpp) && !psi_cpp_level_masked(cpp)) { - /* - * if skip is set on this level and the level has - * not been masked yet, then unskip and mask this level - */ - psi_cpp_level_unskip(cpp); - psi_cpp_level_mask(cpp); - } else if (!cpp->skip && psi_cpp_level_masked(cpp)) { - /* - * previous block masked this level - */ - psi_cpp_level_skip(cpp); - } else { - assert(cpp->skip < cpp->level); - } - break; - case PSI_T_ELIF: - if (!cpp->level) { - D->error(D, cpp->exp->token, PSI_WARNING, "Ingoring lone #elif"); - } else if (psi_cpp_level_skipped(cpp) && !psi_cpp_level_masked(cpp)) { - /* - * if skip is set on this level and the level has - * not been masked yet, then unskip and mask this - * level, if the condition evals truthy - */ - if (psi_cpp_if(cpp->exp, &cpp->defs, D)) { - psi_cpp_level_unskip(cpp); - psi_cpp_level_mask(cpp); - } - } else if (!cpp->skip && psi_cpp_level_masked(cpp)) { - /* - * previous block masked this level - */ - psi_cpp_level_skip(cpp); - } else { - assert(cpp->skip < cpp->level); - } - break; - default: - assert(0); - break; + zend_hash_destroy(cpp->defs); + FREE_HASHTABLE(cpp->defs); + free(cpp); } - - PSI_DEBUG_PRINT(D, "PSI: CPP EVAL > %s (level=%u, skip=%u)\n", - cpp->exp->token->text, cpp->level, cpp->skip); - - psi_cpp_exp_free(&cpp->exp); } -static bool psi_cpp_stage1(struct psi_parser *P, struct psi_cpp_data *cpp) +static bool psi_cpp_stage1(struct psi_cpp *cpp) { bool name = false, define = false, hash = false, eol = true, esc = false, ws = false; @@ -272,8 +178,10 @@ static bool psi_cpp_stage1(struct psi_parser *P, struct psi_cpp_data *cpp) return true; } -static bool psi_cpp_stage2(struct psi_parser *P, struct psi_cpp_data *cpp) +static bool psi_cpp_stage2(struct psi_cpp *cpp) { + struct psi_plist *parser_tokens = psi_plist_init((psi_plist_dtor) psi_token_free); + do { bool is_eol = true, do_cpp = false, do_expansion = true, skip_paren = false, skip_all = false; @@ -322,6 +230,7 @@ static bool psi_cpp_stage2(struct psi_parser *P, struct psi_cpp_data *cpp) do_expansion = false; break; case PSI_T_LPAREN: + if (!skip_all) { if (skip_paren) { skip_paren = false; @@ -338,7 +247,7 @@ static bool psi_cpp_stage2(struct psi_parser *P, struct psi_cpp_data *cpp) default: do_expansion = !skip_all; #if PSI_CPP_DEBUG - fprintf(stderr, "PSI CPP do_expansion=%s, <- !skip_all\n", do_expansion?"true":"false"); + fprintf(stderr, "PSI: CPP do_expansion=%s, <- !skip_all\n", do_expansion?"true":"false"); #endif } } @@ -368,25 +277,21 @@ static bool psi_cpp_stage2(struct psi_parser *P, struct psi_cpp_data *cpp) } if (do_cpp) { - if (is_eol) { - do_cpp = false; - skip_all = false; - } - - if (P->flags & PSI_DEBUG) { - fprintf(stderr, "PSI> Parse (%zu) ", psi_cpp_tokiter_index(cpp)); - psi_token_dump(2, current); - } - - psi_parser_proc_parse(P->proc, current->type, current, P); + parser_tokens = psi_plist_add(parser_tokens, ¤t); psi_cpp_tokiter_del_cur(cpp, false); if (is_eol) { - psi_parser_proc_parse(P->proc, 0, NULL, P); - psi_cpp_eval(PSI_DATA(P), cpp); + size_t processed = 0; + + if (!psi_parser_process(cpp->parser, parser_tokens, &processed)) { + psi_plist_free(parser_tokens); + return false; + } + psi_plist_clean(parser_tokens); + do_cpp = false; } -#if PSI_CPP_DEBUG +#if PSI_CPP_DEBUG > 1 psi_cpp_tokiter_dump(2, cpp); #endif @@ -397,28 +302,32 @@ static bool psi_cpp_stage2(struct psi_parser *P, struct psi_cpp_data *cpp) } } while (cpp->expanded); + psi_plist_free(parser_tokens); + return true; } -bool psi_cpp_preprocess(struct psi_parser *P, struct psi_cpp_data *cpp) +bool psi_cpp_process(struct psi_cpp *cpp, struct psi_plist **tokens) { - if (!psi_cpp_stage1(P, cpp)) { - return false; - } + struct psi_cpp temp = *cpp; - if (!psi_cpp_stage2(P, cpp)) { - return false; + temp.tokens = *tokens; + + if (psi_cpp_stage1(&temp) && psi_cpp_stage2(&temp)) { + *tokens = temp.tokens; + return true; } - return true; + *tokens = temp.tokens; + return false; } -bool psi_cpp_defined(struct psi_cpp_data *cpp, struct psi_token *tok) +bool psi_cpp_defined(struct psi_cpp *cpp, struct psi_token *tok) { bool defined; if (tok->type == PSI_T_NAME) { - defined = zend_hash_str_exists(&cpp->defs, tok->text, tok->size); + defined = zend_hash_str_exists(cpp->defs, tok->text, tok->size); } else { defined = false; } @@ -431,23 +340,97 @@ bool psi_cpp_defined(struct psi_cpp_data *cpp, struct psi_token *tok) return defined; } -void psi_cpp_define(struct psi_cpp_data *cpp, struct psi_cpp_macro_decl *decl) +void psi_cpp_define(struct psi_cpp *cpp, struct psi_cpp_macro_decl *decl) { - zend_hash_str_add_ptr(&cpp->defs, decl->token->text, decl->token->size, decl); + struct psi_cpp_macro_decl *old = zend_hash_str_find_ptr(cpp->defs, decl->token->text, decl->token->size); + + if (old && !psi_cpp_macro_decl_equal(old, decl)) { + cpp->parser->error(PSI_DATA(cpp->parser), decl->token, PSI_WARNING, + "'%s' redefined", decl->token->text); + cpp->parser->error(PSI_DATA(cpp->parser), old->token, PSI_WARNING, + "'%s' previously defined", old->token->text); + } + zend_hash_str_update_ptr(cpp->defs, decl->token->text, decl->token->size, decl); } -bool psi_cpp_undef(struct psi_cpp_data *cpp, struct psi_token *tok) +bool psi_cpp_undef(struct psi_cpp *cpp, struct psi_token *tok) { - return SUCCESS == zend_hash_str_del(&cpp->defs, tok->text, tok->size); + return SUCCESS == zend_hash_str_del(cpp->defs, tok->text, tok->size); } -bool psi_cpp_if(struct psi_cpp_exp *exp, HashTable *defs, struct psi_data *D) +bool psi_cpp_if(struct psi_cpp *cpp, struct psi_cpp_exp *exp) { - if (!psi_num_exp_validate(D, exp->data.num, NULL, NULL, NULL, NULL, NULL)) { + if (!psi_num_exp_validate(PSI_DATA(cpp->parser), exp->data.num, NULL, NULL, NULL, NULL, NULL)) { return false; } - if (!psi_long_num_exp(exp->data.num, NULL, defs)) { + if (!psi_long_num_exp(exp->data.num, NULL, cpp->defs)) { return false; } return true; } + +static inline bool try_include(struct psi_cpp *cpp, const char *path, bool *parsed) +{ + struct psi_parser_input *include; + + PSI_DEBUG_PRINT(cpp->parser, "PSI: CPP include trying %s\n", path); + + include = psi_parser_open_file(cpp->parser, path, false); + if (include) { + struct psi_plist *tokens; + + PSI_DEBUG_PRINT(cpp->parser, "PSI: CPP include scanning %s\n", path); + + tokens = psi_parser_scan(cpp->parser, include); + if (tokens) { + if ((*parsed = psi_cpp_process(cpp, &tokens))) { + psi_cpp_tokiter_ins_range(cpp, psi_cpp_tokiter_index(cpp), + psi_plist_count(tokens), psi_plist_eles(tokens)); + } + psi_plist_free(tokens); + } + free(include); + return true; + } + return false; +} + +bool psi_cpp_include(struct psi_cpp *cpp, const char *file, unsigned flags) +{ + char path[PATH_MAX]; + bool parsed = false; + int f_len = strlen(file) - 2; + + if (file[1] == '/' && PATH_MAX > snprintf(path, PATH_MAX, "%.*s", f_len, file + 1)) { + return try_include(cpp, path, &parsed) && parsed; + } else { + const char *sep; + + if ((flags & PSI_CPP_INCLUDE_NEXT) && cpp->search) { + if ((sep = strchr(cpp->search, ':'))) { + cpp->search = sep + 1; + } else { + cpp->search += strlen(cpp->search); /* point to end of string */ + } + } + if (!(flags & PSI_CPP_INCLUDE_NEXT) || !cpp->search) { + cpp->search = &psi_cpp_search[0]; + } + + do { + int d_len; + + sep = strchr(cpp->search, ':'); + d_len = sep ? sep - cpp->search : strlen(cpp->search); + + if (PATH_MAX > snprintf(path, PATH_MAX, "%.*s/%.*s", d_len, cpp->search, f_len, file + 1)) { + if (try_include(cpp, path, &parsed)) { + break; + } + } + cpp->search = sep + 1; + } while (sep); + } + + return parsed; +} diff --git a/src/cpp.h b/src/cpp.h index 1a8fc2c..b778b14 100644 --- a/src/cpp.h +++ b/src/cpp.h @@ -32,38 +32,52 @@ # define PSI_CPP_DEBUG 0 #endif -struct psi_cpp_data { - HashTable defs; +struct psi_cpp_tokiter { +}; + +struct psi_cpp { + HashTable *defs; + struct psi_parser *parser; + struct psi_plist *tokens; + const char *search; + size_t index; unsigned level; unsigned skip; unsigned seen; - size_t index; - struct psi_plist *tokens; unsigned expanded; - struct psi_cpp_exp *exp; }; -bool psi_cpp_preprocess(struct psi_parser *P, struct psi_cpp_data *cpp); -bool psi_cpp_if(struct psi_cpp_exp *exp, HashTable *defs, struct psi_data *D); -bool psi_cpp_defined(struct psi_cpp_data *cpp, struct psi_token *tok); -void psi_cpp_define(struct psi_cpp_data *cpp, struct psi_cpp_macro_decl *decl); -bool psi_cpp_undef(struct psi_cpp_data *cpp, struct psi_token *tok); +struct psi_cpp *psi_cpp_init(struct psi_parser *parser); +bool psi_cpp_load_defaults(struct psi_cpp *cpp); +bool psi_cpp_process(struct psi_cpp *cpp, struct psi_plist **tokens); +void psi_cpp_free(struct psi_cpp **cpp_ptr); + +bool psi_cpp_if(struct psi_cpp *cpp, struct psi_cpp_exp *exp); +bool psi_cpp_defined(struct psi_cpp *cpp, struct psi_token *tok); +void psi_cpp_define(struct psi_cpp *cpp, struct psi_cpp_macro_decl *decl); +bool psi_cpp_undef(struct psi_cpp *cpp, struct psi_token *tok); + +#define PSI_CPP_INCLUDE 0x0 +#define PSI_CPP_INCLUDE_NEXT 0x1 +#define PSI_CPP_INCLUDE_ONCE 0x2 + +bool psi_cpp_include(struct psi_cpp *cpp, const char *file, unsigned flags); -void psi_cpp_tokiter_reset(struct psi_cpp_data *cpp); -bool psi_cpp_tokiter_seek(struct psi_cpp_data *cpp, size_t index); -void psi_cpp_tokiter_dump(int fd, struct psi_cpp_data *cpp); -struct psi_token *psi_cpp_tokiter_current(struct psi_cpp_data *cpp); -size_t psi_cpp_tokiter_index(struct psi_cpp_data *cpp); -void psi_cpp_tokiter_next(struct psi_cpp_data *cpp); -void psi_cpp_tokiter_prev(struct psi_cpp_data *cpp); -bool psi_cpp_tokiter_valid(struct psi_cpp_data *cpp); -bool psi_cpp_tokiter_del_cur(struct psi_cpp_data *cpp, bool free_token); -bool psi_cpp_tokiter_del_range(struct psi_cpp_data *cpp, size_t offset, +void psi_cpp_tokiter_reset(struct psi_cpp *cpp); +bool psi_cpp_tokiter_seek(struct psi_cpp *cpp, size_t index); +void psi_cpp_tokiter_dump(int fd, struct psi_cpp *cpp); +struct psi_token *psi_cpp_tokiter_current(struct psi_cpp *cpp); +size_t psi_cpp_tokiter_index(struct psi_cpp *cpp); +void psi_cpp_tokiter_next(struct psi_cpp *cpp); +void psi_cpp_tokiter_prev(struct psi_cpp *cpp); +bool psi_cpp_tokiter_valid(struct psi_cpp *cpp); +bool psi_cpp_tokiter_del_cur(struct psi_cpp *cpp, bool free_token); +bool psi_cpp_tokiter_del_range(struct psi_cpp *cpp, size_t offset, size_t num_eles, bool free_tokens); -bool psi_cpp_tokiter_ins_cur(struct psi_cpp_data *cpp, struct psi_token *tok); -bool psi_cpp_tokiter_ins_range(struct psi_cpp_data *cpp, size_t offset, +bool psi_cpp_tokiter_ins_cur(struct psi_cpp *cpp, struct psi_token *tok); +bool psi_cpp_tokiter_ins_range(struct psi_cpp *cpp, size_t offset, size_t num_eles, void **eles); -bool psi_cpp_tokiter_defined(struct psi_cpp_data *cpp); -bool psi_cpp_tokiter_expand(struct psi_cpp_data *cpp); +bool psi_cpp_tokiter_defined(struct psi_cpp *cpp); +bool psi_cpp_tokiter_expand(struct psi_cpp *cpp); #endif diff --git a/src/cpp_tokiter.c b/src/cpp_tokiter.c index 7aa938e..d980e61 100644 --- a/src/cpp_tokiter.c +++ b/src/cpp_tokiter.c @@ -29,7 +29,7 @@ #include "parser.h" -void psi_cpp_tokiter_dump(int fd, struct psi_cpp_data *cpp) +void psi_cpp_tokiter_dump(int fd, struct psi_cpp *cpp) { size_t i; struct psi_token *T; @@ -40,17 +40,19 @@ void psi_cpp_tokiter_dump(int fd, struct psi_cpp_data *cpp) } } -void psi_cpp_tokiter_reset(struct psi_cpp_data *cpp) +void psi_cpp_tokiter_reset(struct psi_cpp *cpp) { #if PSI_CPP_DEBUG fprintf(stderr, "PSI: CPP reset (%zu tokens)\n", psi_plist_count(cpp->tokens)); +# if PSI_CPP_DEBUG > 1 psi_cpp_tokiter_dump(2, cpp); +# endif #endif cpp->index = 0; cpp->expanded = 0; } -bool psi_cpp_tokiter_seek(struct psi_cpp_data *cpp, size_t index) +bool psi_cpp_tokiter_seek(struct psi_cpp *cpp, size_t index) { if (index < psi_plist_count(cpp->tokens)) { cpp->index = index; @@ -59,7 +61,7 @@ bool psi_cpp_tokiter_seek(struct psi_cpp_data *cpp, size_t index) return false; } -struct psi_token *psi_cpp_tokiter_current(struct psi_cpp_data *cpp) +struct psi_token *psi_cpp_tokiter_current(struct psi_cpp *cpp) { struct psi_token *current = NULL; bool found = psi_plist_get(cpp->tokens, cpp->index, ¤t); @@ -69,12 +71,12 @@ struct psi_token *psi_cpp_tokiter_current(struct psi_cpp_data *cpp) return current; } -size_t psi_cpp_tokiter_index(struct psi_cpp_data *cpp) +size_t psi_cpp_tokiter_index(struct psi_cpp *cpp) { return cpp->index; } -void psi_cpp_tokiter_next(struct psi_cpp_data *cpp) +void psi_cpp_tokiter_next(struct psi_cpp *cpp) { #if 0 && PSI_CPP_DEBUG fprintf(stderr, "PSI: CPP next -> index=%zu -> index=%zu\n", cpp->index, cpp->index+1); @@ -82,7 +84,7 @@ void psi_cpp_tokiter_next(struct psi_cpp_data *cpp) ++cpp->index; } -void psi_cpp_tokiter_prev(struct psi_cpp_data *cpp) +void psi_cpp_tokiter_prev(struct psi_cpp *cpp) { #if 0 && PSI_CPP_DEBUG fprintf(stderr, "PSI: CPP prev -> index=%zu -> index=%zu\n", cpp->index, cpp->index-1); @@ -92,7 +94,7 @@ void psi_cpp_tokiter_prev(struct psi_cpp_data *cpp) } } -bool psi_cpp_tokiter_valid(struct psi_cpp_data *cpp) +bool psi_cpp_tokiter_valid(struct psi_cpp *cpp) { #if 0 && PSI_CPP_DEBUG fprintf(stderr, "PSI: CPP valid -> index=%zu -> %d\n", cpp->index, cpp->index < psi_plist_count(cpp->tokens)); @@ -100,14 +102,15 @@ bool psi_cpp_tokiter_valid(struct psi_cpp_data *cpp) return cpp->index < psi_plist_count(cpp->tokens); } -bool psi_cpp_tokiter_del_cur(struct psi_cpp_data *cpp, bool free_token) +bool psi_cpp_tokiter_del_cur(struct psi_cpp *cpp, bool free_token) { struct psi_token *cur = NULL; bool deleted = psi_plist_del(cpp->tokens, cpp->index, &cur); + size_t count; #if PSI_CPP_DEBUG - fprintf(stderr, "PSI: CPP del_cur -> index=%zu, del=%d, free=%d ", - cpp->index, (int) deleted, (int) free_token); + fprintf(stderr, "PSI: CPP del_cur -> index=%zu, del=%d, free=%d, count=%zu ", + cpp->index, (int) deleted, (int) free_token, psi_plist_count(cpp->tokens)); if (cur) { psi_token_dump(2, cur); } else { @@ -117,13 +120,18 @@ bool psi_cpp_tokiter_del_cur(struct psi_cpp_data *cpp, bool free_token) if (cur && free_token) { free(cur); } - if (deleted && cpp->index >= psi_plist_count(cpp->tokens)) { - cpp->index = MAX(0, psi_plist_count(cpp->tokens)-1); + count = psi_plist_count(cpp->tokens); + if (deleted && cpp->index >= count) { + if (count > 0) { + cpp->index = count - 1; + } else { + cpp->index = 0; + } } return deleted; } -bool psi_cpp_tokiter_del_range(struct psi_cpp_data *cpp, size_t offset, size_t num_eles, bool free_tokens) +bool psi_cpp_tokiter_del_range(struct psi_cpp *cpp, size_t offset, size_t num_eles, bool free_tokens) { struct psi_token **ptr; bool deleted; @@ -135,7 +143,8 @@ bool psi_cpp_tokiter_del_range(struct psi_cpp_data *cpp, size_t offset, size_t n } #if PSI_CPP_DEBUG - fprintf(stderr, "PSI: CPP del_range -> index=%zu, offset=%zu, num_eles=%zu\n", cpp->index, offset, num_eles); + fprintf(stderr, "PSI: CPP del_range -> index=%zu, offset=%zu, num_eles=%zu, count=%zu\n", + cpp->index, offset, num_eles, psi_plist_count(cpp->tokens)); #endif deleted = psi_plist_del_r(cpp->tokens, offset, num_eles, (void *) ptr); @@ -156,7 +165,7 @@ bool psi_cpp_tokiter_del_range(struct psi_cpp_data *cpp, size_t offset, size_t n return deleted; } -bool psi_cpp_tokiter_ins_cur(struct psi_cpp_data *cpp, struct psi_token *tok) +bool psi_cpp_tokiter_ins_cur(struct psi_cpp *cpp, struct psi_token *tok) { struct psi_plist *tokens = psi_plist_ins(cpp->tokens, cpp->index, &tok); @@ -172,14 +181,20 @@ bool psi_cpp_tokiter_ins_cur(struct psi_cpp_data *cpp, struct psi_token *tok) return true; } -bool psi_cpp_tokiter_ins_range(struct psi_cpp_data *cpp, size_t offset, +bool psi_cpp_tokiter_ins_range(struct psi_cpp *cpp, size_t offset, size_t num_eles, void **eles) { - struct psi_plist *tokens = psi_plist_ins_r(cpp->tokens, offset, - num_eles, eles); + struct psi_plist *tokens; + + if (!num_eles) { + return true; + } + + tokens = psi_plist_ins_r(cpp->tokens, offset, num_eles, eles); #if PSI_CPP_DEBUG - fprintf(stderr, "PSI: CPP ins_range -> index=%zu, offset=%zu, num_eles=%zu\n", cpp->index, offset, num_eles); + fprintf(stderr, "PSI: CPP ins_range -> index=%zu, offset=%zu, num_eles=%zu, count=%zu\n", + cpp->index, offset, num_eles, psi_plist_count(tokens)); #endif if (!tokens) { @@ -189,7 +204,7 @@ bool psi_cpp_tokiter_ins_range(struct psi_cpp_data *cpp, size_t offset, return true; } -bool psi_cpp_tokiter_defined(struct psi_cpp_data *cpp) +bool psi_cpp_tokiter_defined(struct psi_cpp *cpp) { if (psi_cpp_tokiter_valid(cpp)) { struct psi_token *current = psi_cpp_tokiter_current(cpp); @@ -200,7 +215,7 @@ bool psi_cpp_tokiter_defined(struct psi_cpp_data *cpp) return false; } -void psi_cpp_tokiter_expand_tokens(struct psi_cpp_data *cpp, struct psi_plist *tokens) +void psi_cpp_tokiter_expand_tokens(struct psi_cpp *cpp, struct psi_plist *tokens) { if (tokens && psi_plist_count(tokens)) { size_t i = 0, n = 0; @@ -267,11 +282,11 @@ static void psi_cpp_tokiter_free_call_tokens(struct psi_plist **arg_tokens_list, } static struct psi_plist **psi_cpp_tokiter_read_call_tokens( - struct psi_cpp_data *cpp, size_t arg_count) + struct psi_cpp *cpp, size_t arg_count) { size_t arg_index = 0, lparens = 1, rparens = 0; struct psi_plist **arg_tokens = calloc(arg_count, sizeof(*arg_tokens)); - struct psi_plist *free_tokens = psi_plist_init((void (*)(void *)) psi_token_free); + struct psi_plist *free_tokens = psi_plist_init((psi_plist_dtor) psi_token_free); struct psi_token *tok; arg_tokens[0] = psi_plist_init(NULL); @@ -339,7 +354,7 @@ fail: return NULL; } -static void psi_cpp_tokiter_expand_call_tokens(struct psi_cpp_data *cpp, +static void psi_cpp_tokiter_expand_call_tokens(struct psi_cpp *cpp, struct psi_cpp_macro_decl *macro, struct psi_plist **arg_tokens_list) { size_t i; @@ -374,7 +389,7 @@ static void psi_cpp_tokiter_expand_call_tokens(struct psi_cpp_data *cpp, psi_plist_free(tokens); } -static bool psi_cpp_tokiter_expand_call(struct psi_cpp_data *cpp, +static bool psi_cpp_tokiter_expand_call(struct psi_cpp *cpp, struct psi_cpp_macro_decl *macro) { /* function-like macro @@ -405,14 +420,14 @@ static bool psi_cpp_tokiter_expand_call(struct psi_cpp_data *cpp, return true; } -bool psi_cpp_tokiter_expand(struct psi_cpp_data *cpp) +bool psi_cpp_tokiter_expand(struct psi_cpp *cpp) { if (psi_cpp_tokiter_valid(cpp)) { struct psi_token *current = psi_cpp_tokiter_current(cpp); if (current) { struct psi_cpp_macro_decl *macro = zend_hash_str_find_ptr( - &cpp->defs, current->text, current->size); + cpp->defs, current->text, current->size); /* don't expand itself */ if (macro && macro->token != current) { diff --git a/src/marshal.c b/src/marshal.c index b36eb5f..e7ffc67 100644 --- a/src/marshal.c +++ b/src/marshal.c @@ -459,12 +459,14 @@ impl_val *psi_let_strlen(impl_val *tmp, struct psi_decl_type *spec, token_t impl return tmp; } +#if 0 static impl_val *iterate(impl_val *val, size_t size, unsigned i, impl_val *tmp) { memset(tmp, 0, sizeof(*tmp)); memcpy(tmp, ((char *) val) + size * i, size); return tmp; } +#endif /* * set $ivar = to_array(dvar, diff --git a/src/module.c b/src/module.c index 1db2adf..778f396 100644 --- a/src/module.c +++ b/src/module.c @@ -127,10 +127,17 @@ ZEND_END_ARG_INFO(); static PHP_FUNCTION(psi_validate) { zend_string *file; + struct psi_parser_input *I; struct psi_parser P; struct psi_data D = {0}; zend_long flags = 0; +#if PHP_DEBUG + if (psi_check_env("PSI_DEBUG")) { + flags |= PSI_DEBUG; + } +#endif + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "P|l", &file, &flags)) { return; } @@ -138,17 +145,17 @@ static PHP_FUNCTION(psi_validate) if (!psi_parser_init(&P, psi_error_wrapper, flags)) { RETURN_FALSE; } - if (!psi_parser_open_file(&P, file->val)) { + if (!(I = psi_parser_open_file(&P, file->val, true))) { psi_parser_dtor(&P); RETURN_FALSE; } - psi_parser_parse(&P); + psi_parser_parse(&P, I); psi_data_ctor(&D, P.error, P.flags); RETVAL_BOOL(psi_data_validate(&D, PSI_DATA(&P)) && !P.errors); psi_data_dtor(&D); - psi_parser_dtor(&P); + free(I); } ZEND_BEGIN_ARG_INFO_EX(ai_psi_validate_string, 0, 0, 1) @@ -157,10 +164,17 @@ ZEND_END_ARG_INFO(); static PHP_FUNCTION(psi_validate_string) { zend_string *string; + struct psi_parser_input *I; struct psi_parser P; struct psi_data D = {0}; zend_long flags = 0; +#if PHP_DEBUG + if (psi_check_env("PSI_DEBUG")) { + flags |= PSI_DEBUG; + } +#endif + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S|l", &string, &flags)) { return; } @@ -168,17 +182,17 @@ static PHP_FUNCTION(psi_validate_string) if (!psi_parser_init(&P, psi_error_wrapper, flags)) { RETURN_FALSE; } - if (!psi_parser_open_string(&P, string->val, string->len)) { + if (!(I = psi_parser_open_string(&P, string->val, string->len))) { psi_parser_dtor(&P); RETURN_FALSE; } - psi_parser_parse(&P); + psi_parser_parse(&P, I); psi_data_ctor(&D, P.error, P.flags); RETVAL_BOOL(psi_data_validate(&D, PSI_DATA(&P)) && !P.errors); psi_data_dtor(&D); - psi_parser_dtor(&P); + free(I); } static PHP_MINIT_FUNCTION(psi) diff --git a/src/parser.c b/src/parser.c index 2b6c11e..12ea648 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.16 on Tue Mar 7 09:49:40 2017 */ +/* Generated by re2c 0.16 on Fri Mar 24 12:21:07 2017 */ #line 1 "src/parser.re" /******************************************************************************* Copyright (c) 2016, Michael Wallner . @@ -32,21 +32,10 @@ #include "parser.h" -#define YYMAXFILL 12 +#define YYMAXFILL 13 #ifndef YYMAXFILL # define YYMAXFILL 256 #endif -#line 57 "src/parser.re" - - -static void free_cpp_def(zval *p) -{ - if (Z_TYPE_P(p) == IS_PTR) { - psi_cpp_macro_decl_free((void *) &Z_PTR_P(p)); - } else if (Z_REFCOUNTED_P(p)) { - zval_ptr_dtor(p); - } -} struct psi_parser *psi_parser_init(struct psi_parser *P, psi_error_cb error, unsigned flags) { @@ -57,104 +46,85 @@ struct psi_parser *psi_parser_init(struct psi_parser *P, psi_error_cb error, uns psi_data_ctor_with_dtors(PSI_DATA(P), error, flags); - P->col = 1; - P->line = 1; - P->proc = psi_parser_proc_init(); - - zend_hash_init(&P->cpp.defs, 0, NULL, free_cpp_def, 1); - zval tmp; - ZVAL_ARR(&tmp, &P->cpp.defs); - add_assoc_string(&tmp, "PHP_OS", PHP_OS); + P->preproc = psi_cpp_init(P); - if (flags & PSI_DEBUG) { - psi_parser_proc_trace(stderr, "PSI> "); - } + psi_cpp_load_defaults(P->preproc); return P; } -void psi_parser_reset(struct psi_parser *P) -{ - P->cur = P->tok = P->mrk = P->input.buffer; - P->lim = P->input.buffer + P->input.length; -} - -bool psi_parser_open_file(struct psi_parser *P, const char *filename) +struct psi_parser_input *psi_parser_open_file(struct psi_parser *P, const char *filename, bool report_errors) { struct stat sb; FILE *fp; - char *fb; + struct psi_parser_input *fb; if (stat(filename, &sb)) { - P->error(PSI_DATA(P), NULL, PSI_WARNING, - "Could not stat '%s': %s", - filename, strerror(errno)); - return false; + if (report_errors) { + P->error(PSI_DATA(P), NULL, PSI_WARNING, + "Could not stat '%s': %s", + filename, strerror(errno)); + } + return NULL; } - if (!(fb = malloc(sb.st_size + YYMAXFILL))) { - P->error(PSI_DATA(P), NULL, PSI_WARNING, - "Could not allocate %zu bytes for reading '%s': %s", - sb.st_size + YYMAXFILL, filename, strerror(errno)); - return false; + if (!(fb = malloc(sizeof(*fb) + strlen(filename) + 1 + sb.st_size + YYMAXFILL))) { + if (report_errors) { + P->error(PSI_DATA(P), NULL, PSI_WARNING, + "Could not allocate %zu bytes for reading '%s': %s", + sb.st_size + YYMAXFILL, filename, strerror(errno)); + } + return NULL; } if (!(fp = fopen(filename, "r"))) { free(fb); - P->error(PSI_DATA(P), NULL, PSI_WARNING, - "Could not open '%s' for reading: %s", - filename, strerror(errno)); - return false; + if (report_errors) { + P->error(PSI_DATA(P), NULL, PSI_WARNING, + "Could not open '%s' for reading: %s", + filename, strerror(errno)); + } + return NULL; } - if (sb.st_size != fread(fb, 1, sb.st_size, fp)) { + if (sb.st_size != fread(fb->buffer, 1, sb.st_size, fp)) { free(fb); fclose(fp); - P->error(PSI_DATA(P), NULL, PSI_WARNING, - "Could not read %zu bytes from '%s': %s", - sb.st_size + YYMAXFILL, filename, strerror(errno)); - return false; - } - memset(fb + sb.st_size, 0, YYMAXFILL); - - if (P->input.buffer) { - free(P->input.buffer); + if (report_errors) { + P->error(PSI_DATA(P), NULL, PSI_WARNING, + "Could not read %zu bytes from '%s': %s", + sb.st_size + YYMAXFILL, filename, strerror(errno)); + } + return NULL; } - P->input.buffer = fb; - P->input.length = sb.st_size; - P->file.fn = strdup(filename); + memset(fb->buffer + sb.st_size, 0, YYMAXFILL); + fb->length = sb.st_size; + fb->file = &fb->buffer[sb.st_size + YYMAXFILL]; + memcpy(fb->file, filename, strlen(filename) + 1); - psi_parser_reset(P); - - return true; + return fb; } -bool psi_parser_open_string(struct psi_parser *P, const char *string, size_t length) +struct psi_parser_input *psi_parser_open_string(struct psi_parser *P, const char *string, size_t length) { - char *sb; + struct psi_parser_input *sb; - if (!(sb = malloc(length + YYMAXFILL))) { + if (!(sb = malloc(sizeof(*sb) + sizeof("") + length + YYMAXFILL))) { P->error(PSI_DATA(P), NULL, PSI_WARNING, "Could not allocate %zu bytes: %s", length + YYMAXFILL, strerror(errno)); - return false; - } - - memcpy(sb, string, length); - memset(sb + length, 0, YYMAXFILL); - - if (P->input.buffer) { - free(P->input.buffer); + return NULL; } - P->input.buffer = sb; - P->input.length = length; - P->file.fn = strdup(""); + memcpy(sb->buffer, string, length); + memset(sb->buffer + length, 0, YYMAXFILL); - psi_parser_reset(P); + sb->length = length; + sb->file = &sb->buffer[length + YYMAXFILL]; + memcpy(sb->file, "", sizeof("")); - return true; + return sb; } #if 0 @@ -213,42 +183,58 @@ static void psi_parser_register_constants(struct psi_parser *P) } #endif -void psi_parser_parse(struct psi_parser *P) +struct psi_plist *psi_parser_preprocess(struct psi_parser *P, struct psi_plist *tokens) { - size_t i = 0; - struct psi_token *T; - - P->cpp.tokens = psi_parser_scan(P); + if (psi_cpp_process(P->preproc, &tokens)) { + return tokens; + } + return NULL; +} - psi_cpp_preprocess(P, &P->cpp); +bool psi_parser_process(struct psi_parser *P, struct psi_plist *tokens, size_t *processed) +{ + if (psi_plist_count(tokens)) { + int rc; - if (psi_plist_count(P->cpp.tokens)) { - while (psi_plist_get(P->cpp.tokens, i++, &T)) { - if (P->flags & PSI_DEBUG) { - fprintf(stderr, "PSI> "); - psi_token_dump(2, T); - } - psi_parser_proc_parse(P->proc, T->type, T, P); + if (P->flags & PSI_DEBUG) { + psi_parser_proc_debug = 1; } - psi_parser_proc_parse(P->proc, 0, NULL, P); + rc = psi_parser_proc_parse(P, tokens, processed); + if (P->flags & PSI_DEBUG) { + psi_parser_proc_debug = 0; + } + return rc == 0; } - - psi_plist_free(P->cpp.tokens); - P->cpp.tokens = NULL; + return true; } -void psi_parser_dtor(struct psi_parser *P) +bool psi_parser_parse(struct psi_parser *P, struct psi_parser_input *I) { - psi_parser_proc_free(&P->proc); + struct psi_plist *scanned, *preproc; + size_t processed = 0; - if (P->input.buffer) { - free(P->input.buffer); - P->input.buffer = NULL; + if (!(scanned = psi_parser_scan(P, I))) { + return false; } - psi_data_dtor(PSI_DATA(P)); + if (!(preproc = psi_parser_preprocess(P, scanned))) { + psi_plist_free(scanned); + return false; + } + + if (!psi_parser_process(P, preproc, &processed)) { + psi_plist_free(preproc); + return false; + } + + psi_plist_free(preproc); + return true; +} - zend_hash_destroy(&P->cpp.defs); +void psi_parser_dtor(struct psi_parser *P) +{ + psi_cpp_free(&P->preproc); + psi_data_dtor(PSI_DATA(P)); memset(P, 0, sizeof(*P)); } @@ -263,43 +249,73 @@ void psi_parser_free(struct psi_parser **P) } #define NEWLINE() \ - P->col = 1; \ - ++P->line + eol = cur; \ + ++I->lines #define NEWTOKEN(t) \ - P->num = t; \ - token = psi_token_alloc(P); \ + token = psi_token_init(t, tok, cur - tok, tok - eol + 1, I->lines, I->file); \ tokens = psi_plist_add(tokens, &token); \ - P->col += P->cur - P->tok; \ if (P->flags & PSI_DEBUG) { \ fprintf(stderr, "PSI< "); \ psi_token_dump(2, token); \ - } \ - token = NULL + } -struct psi_plist *psi_parser_scan(struct psi_parser *P) +struct psi_plist *psi_parser_scan(struct psi_parser *P, struct psi_parser_input *I) { struct psi_plist *tokens; struct psi_token *token; + const char *tok, *cur, *lim, *mrk, *eol; - if (!P->cur) { - return NULL; - } - - tokens = psi_plist_init(NULL); + tok = mrk = eol = cur = I->buffer; + lim = I->buffer + I->length; + I->lines = 1; + tokens = psi_plist_init((void (*)(void *)) psi_token_free); start: ; - P->tok = P->cur; + tok = cur; -#line 297 "src/parser.c" +#line 280 "src/parser.c" { unsigned char yych; unsigned int yyaccept = 0; - if ((P->lim - P->cur) < 12) if (P->cur >= P->lim) goto done;; - yych = *P->cur; - switch (yych) { + if ((lim - cur) < 13) if (cur >= lim) goto done;; + yych = *cur; + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\v': + case '\f': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case '?': + case '@': + case '`': + case 0x7F: goto yy2; case '\t': case ' ': goto yy4; case '\n': @@ -310,15 +326,16 @@ struct psi_plist *psi_parser_scan(struct psi_parser *P) case '$': goto yy14; case '%': goto yy15; case '&': goto yy17; - case '(': goto yy19; - case ')': goto yy21; - case '*': goto yy23; - case '+': goto yy25; - case ',': goto yy27; - case '-': goto yy29; - case '.': goto yy31; - case '/': goto yy32; - case '0': + case '\'': goto yy19; + case '(': goto yy20; + case ')': goto yy22; + case '*': goto yy24; + case '+': goto yy26; + case ',': goto yy28; + case '-': goto yy30; + case '.': goto yy32; + case '/': goto yy34; + case '0': goto yy36; case '1': case '2': case '3': @@ -327,124 +344,365 @@ struct psi_plist *psi_parser_scan(struct psi_parser *P) case '6': case '7': case '8': - case '9': goto yy34; - case ':': goto yy37; - case ';': goto yy39; - case '<': goto yy41; - case '=': goto yy43; - case '>': goto yy45; + case '9': goto yy38; + case ':': goto yy40; + case ';': goto yy42; + case '<': goto yy44; + case '=': goto yy46; + case '>': goto yy48; case 'A': - case 'a': goto yy47; + case 'a': goto yy50; case 'B': - case 'b': goto yy49; + case 'b': goto yy52; case 'C': - case 'c': goto yy50; + case 'c': goto yy53; case 'D': - case 'd': goto yy51; + case 'd': goto yy54; case 'E': - case 'e': goto yy52; + case 'e': goto yy55; case 'F': - case 'f': goto yy53; - case 'G': - case 'H': - case 'J': - case 'K': - case 'Q': - case 'X': - case 'Y': - case '_': - case 'g': - case 'h': - case 'j': - case 'k': - case 'q': - case 'x': - case 'y': goto yy54; + case 'f': goto yy56; case 'I': - case 'i': goto yy56; - case 'L': - case 'l': goto yy57; + case 'i': goto yy59; + case 'L': goto yy60; case 'M': - case 'm': goto yy58; + case 'm': goto yy61; case 'N': - case 'n': goto yy59; + case 'n': goto yy62; case 'O': - case 'o': goto yy60; + case 'o': goto yy63; case 'P': - case 'p': goto yy61; + case 'p': goto yy64; case 'R': - case 'r': goto yy62; + case 'r': goto yy65; case 'S': - case 's': goto yy63; + case 's': goto yy66; case 'T': - case 't': goto yy64; + case 't': goto yy67; case 'U': - case 'u': goto yy65; + case 'u': goto yy68; case 'V': - case 'v': goto yy66; + case 'v': goto yy69; case 'W': - case 'w': goto yy67; + case 'w': goto yy70; case 'Z': - case 'z': goto yy68; - case '[': goto yy69; - case '\\': goto yy71; - case ']': goto yy73; - case '^': goto yy75; - case '{': goto yy77; - case '|': goto yy79; - case '}': goto yy81; - case '~': goto yy83; - default: goto yy2; + case 'z': goto yy71; + case '[': goto yy72; + case '\\': goto yy74; + case ']': goto yy76; + case '^': goto yy78; + case 'l': goto yy80; + case '{': goto yy81; + case '|': goto yy83; + case '}': goto yy85; + case '~': goto yy87; + default: goto yy57; } yy2: - ++P->cur; + ++cur; yy3: -#line 426 "src/parser.re" - { goto error; } -#line 405 "src/parser.c" +#line 433 "src/parser.re" + { NEWTOKEN(-2); goto error; } +#line 407 "src/parser.c" yy4: - ++P->cur; - if (P->lim <= P->cur) if (P->cur >= P->lim) goto done;; - yych = *P->cur; + ++cur; + if (lim <= cur) if (cur >= lim) goto done;; + yych = *cur; switch (yych) { case '\t': case ' ': goto yy4; default: goto yy6; } yy6: -#line 425 "src/parser.re" +#line 432 "src/parser.re" { NEWTOKEN(PSI_T_WHITESPACE); goto start; } -#line 418 "src/parser.c" +#line 420 "src/parser.c" yy7: - ++P->cur; -#line 424 "src/parser.re" + ++cur; +#line 431 "src/parser.re" { NEWTOKEN(PSI_T_EOL); NEWLINE(); goto start; } -#line 423 "src/parser.c" +#line 425 "src/parser.c" yy9: - ++P->cur; - switch ((yych = *P->cur)) { - case '=': goto yy85; + ++cur; + switch ((yych = *cur)) { + case '=': goto yy89; default: goto yy10; } yy10: -#line 333 "src/parser.re" +#line 335 "src/parser.re" { NEWTOKEN(PSI_T_NOT); goto start; } -#line 433 "src/parser.c" +#line 435 "src/parser.c" yy11: yyaccept = 0; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case '"': goto yy3; - default: goto yy87; + default: goto yy91; } yy12: - ++P->cur; -#line 316 "src/parser.re" + ++cur; +#line 318 "src/parser.re" { NEWTOKEN(PSI_T_HASH); goto start; } -#line 445 "src/parser.c" +#line 447 "src/parser.c" yy14: - yych = *++P->cur; + yych = *++cur; + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case '\\': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy3; + default: goto yy93; + } +yy15: + ++cur; +#line 336 "src/parser.re" + { NEWTOKEN(PSI_T_MODULO); goto start; } +#line 522 "src/parser.c" +yy17: + ++cur; + switch ((yych = *cur)) { + case '&': goto yy96; + default: goto yy18; + } +yy18: +#line 337 "src/parser.re" + { NEWTOKEN(PSI_T_AMPERSAND); goto start; } +#line 532 "src/parser.c" +yy19: + yyaccept = 0; + yych = *(mrk = ++cur); + switch (yych) { + case '\'': goto yy3; + default: goto yy98; + } +yy20: + ++cur; +#line 319 "src/parser.re" + { NEWTOKEN(PSI_T_LPAREN); goto start; } +#line 544 "src/parser.c" +yy22: + ++cur; +#line 320 "src/parser.re" + { NEWTOKEN(PSI_T_RPAREN); goto start; } +#line 549 "src/parser.c" +yy24: + ++cur; +#line 333 "src/parser.re" + { NEWTOKEN(PSI_T_ASTERISK); goto start; } +#line 554 "src/parser.c" +yy26: + ++cur; + switch ((yych = *cur)) { + case '.': goto yy100; + case '0': goto yy36; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy38; + default: goto yy27; + } +yy27: +#line 338 "src/parser.re" + { NEWTOKEN(PSI_T_PLUS); goto start; } +#line 574 "src/parser.c" +yy28: + ++cur; +#line 322 "src/parser.re" + { NEWTOKEN(PSI_T_COMMA); goto start; } +#line 579 "src/parser.c" +yy30: + ++cur; + switch ((yych = *cur)) { + case '.': goto yy100; + case '0': goto yy36; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy38; + default: goto yy31; + } +yy31: +#line 339 "src/parser.re" + { NEWTOKEN(PSI_T_MINUS); goto start; } +#line 599 "src/parser.c" +yy32: + yyaccept = 1; + yych = *(mrk = ++cur); + switch (yych) { + case '.': goto yy102; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy100; + case 'D': + case 'd': goto yy104; + case 'F': + case 'L': + case 'f': + case 'l': goto yy105; + default: goto yy33; + } +yy33: +#line 350 "src/parser.re" + { NEWTOKEN(PSI_T_PERIOD); goto start; } +#line 626 "src/parser.c" +yy34: + ++cur; + switch ((yych = *cur)) { + case '*': goto yy106; + case '/': goto yy108; + default: goto yy35; + } +yy35: +#line 340 "src/parser.re" + { NEWTOKEN(PSI_T_SLASH); goto start; } +#line 637 "src/parser.c" +yy36: + yyaccept = 2; + yych = *(mrk = ++cur); + switch (yych) { + case '.': goto yy110; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': goto yy112; + case 'E': + case 'e': goto yy114; + case 'L': + case 'l': goto yy115; + case 'U': + case 'u': goto yy116; + case 'X': + case 'x': goto yy117; + default: goto yy37; + } +yy37: +#line 424 "src/parser.re" + { NEWTOKEN(PSI_T_NUMBER); goto start; } +#line 664 "src/parser.c" +yy38: + yyaccept = 2; + mrk = ++cur; + if ((lim - cur) < 3) if (cur >= lim) goto done;; + yych = *cur; + switch (yych) { + case '.': goto yy110; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy38; + case 'E': + case 'e': goto yy114; + case 'L': + case 'l': goto yy115; + case 'U': + case 'u': goto yy116; + default: goto yy37; + } +yy40: + ++cur; +#line 323 "src/parser.re" + { NEWTOKEN(PSI_T_COLON); goto start; } +#line 694 "src/parser.c" +yy42: + ++cur; +#line 321 "src/parser.re" + { NEWTOKEN(PSI_T_EOS); goto start; } +#line 699 "src/parser.c" +yy44: + yyaccept = 3; + yych = *(mrk = ++cur); switch (yych) { + case '-': + case '.': + case '/': case '0': case '1': case '2': @@ -507,569 +765,552 @@ yy14: case 'w': case 'x': case 'y': - case 'z': goto yy89; - default: goto yy3; + case 'z': goto yy118; + case '<': goto yy120; + case '=': goto yy122; + default: goto yy45; } -yy15: - ++P->cur; -#line 334 "src/parser.re" - { NEWTOKEN(PSI_T_MODULO); goto start; } -#line 518 "src/parser.c" -yy17: - ++P->cur; - switch ((yych = *P->cur)) { - case '&': goto yy92; - default: goto yy18; +yy45: +#line 348 "src/parser.re" + { NEWTOKEN(PSI_T_LCHEVR); goto start; } +#line 777 "src/parser.c" +yy46: + ++cur; + switch ((yych = *cur)) { + case '=': goto yy124; + default: goto yy47; } -yy18: -#line 335 "src/parser.re" - { NEWTOKEN(PSI_T_AMPERSAND); goto start; } -#line 528 "src/parser.c" -yy19: - ++P->cur; -#line 317 "src/parser.re" - { NEWTOKEN(PSI_T_LPAREN); goto start; } -#line 533 "src/parser.c" -yy21: - ++P->cur; -#line 318 "src/parser.re" - { NEWTOKEN(PSI_T_RPAREN); goto start; } -#line 538 "src/parser.c" -yy23: - ++P->cur; -#line 331 "src/parser.re" - { NEWTOKEN(PSI_T_ASTERISK); goto start; } -#line 543 "src/parser.c" -yy25: - yyaccept = 1; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '.': goto yy94; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto yy34; - default: goto yy26; +yy47: +#line 332 "src/parser.re" + { NEWTOKEN(PSI_T_EQUALS); goto start; } +#line 787 "src/parser.c" +yy48: + ++cur; + switch ((yych = *cur)) { + case '=': goto yy126; + case '>': goto yy128; + default: goto yy49; } -yy26: -#line 336 "src/parser.re" - { NEWTOKEN(PSI_T_PLUS); goto start; } -#line 564 "src/parser.c" -yy27: - ++P->cur; -#line 320 "src/parser.re" - { NEWTOKEN(PSI_T_COMMA); goto start; } -#line 569 "src/parser.c" -yy29: - yyaccept = 2; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '.': goto yy94; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto yy34; - default: goto yy30; - } -yy30: -#line 337 "src/parser.re" - { NEWTOKEN(PSI_T_MINUS); goto start; } -#line 590 "src/parser.c" -yy31: - yyaccept = 0; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '.': goto yy96; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto yy97; - default: goto yy3; - } -yy32: - ++P->cur; - switch ((yych = *P->cur)) { - case '*': goto yy99; - case '/': goto yy101; - default: goto yy33; - } -yy33: -#line 338 "src/parser.re" - { NEWTOKEN(PSI_T_SLASH); goto start; } -#line 618 "src/parser.c" -yy34: - yyaccept = 3; - P->mrk = ++P->cur; - if ((P->lim - P->cur) < 3) if (P->cur >= P->lim) goto done;; - yych = *P->cur; - switch (yych) { - case '.': goto yy94; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto yy34; - case 'E': - case 'e': goto yy103; - default: goto yy36; - } -yy36: -#line 419 "src/parser.re" - { NEWTOKEN(PSI_T_NUMBER); goto start; } -#line 643 "src/parser.c" -yy37: - ++P->cur; -#line 321 "src/parser.re" - { NEWTOKEN(PSI_T_COLON); goto start; } -#line 648 "src/parser.c" -yy39: - ++P->cur; -#line 319 "src/parser.re" - { NEWTOKEN(PSI_T_EOS); goto start; } -#line 653 "src/parser.c" -yy41: - ++P->cur; - switch ((yych = *P->cur)) { - case '<': goto yy104; - case '=': goto yy106; - default: goto yy42; - } -yy42: -#line 346 "src/parser.re" - { NEWTOKEN(PSI_T_LCHEVR); goto start; } -#line 664 "src/parser.c" -yy43: - ++P->cur; - switch ((yych = *P->cur)) { - case '=': goto yy108; - default: goto yy44; - } -yy44: -#line 330 "src/parser.re" - { NEWTOKEN(PSI_T_EQUALS); goto start; } -#line 674 "src/parser.c" -yy45: - ++P->cur; - switch ((yych = *P->cur)) { - case '=': goto yy110; - case '>': goto yy112; - default: goto yy46; - } -yy46: -#line 347 "src/parser.re" - { NEWTOKEN(PSI_T_RCHEVR); goto start; } -#line 685 "src/parser.c" -yy47: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); +yy49: +#line 349 "src/parser.re" + { NEWTOKEN(PSI_T_RCHEVR); goto start; } +#line 798 "src/parser.c" +yy50: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { case 'R': - case 'r': goto yy114; - default: goto yy55; + case 'r': goto yy130; + default: goto yy58; } -yy48: -#line 420 "src/parser.re" +yy51: +#line 425 "src/parser.re" { NEWTOKEN(PSI_T_NAME); goto start; } -#line 697 "src/parser.c" -yy49: +#line 810 "src/parser.c" +yy52: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'O': - case 'o': goto yy116; - default: goto yy55; + case 'o': goto yy132; + default: goto yy58; } -yy50: +yy53: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'A': - case 'a': goto yy117; + case 'a': goto yy133; case 'H': - case 'h': goto yy118; + case 'h': goto yy134; case 'O': - case 'o': goto yy119; - default: goto yy55; + case 'o': goto yy135; + default: goto yy58; } -yy51: +yy54: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy120; + case 'e': goto yy136; case 'O': - case 'o': goto yy121; - default: goto yy55; + case 'o': goto yy137; + default: goto yy58; } -yy52: +yy55: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'L': - case 'l': goto yy122; + case 'l': goto yy138; case 'N': - case 'n': goto yy123; + case 'n': goto yy139; case 'R': - case 'r': goto yy124; - default: goto yy55; + case 'r': goto yy140; + default: goto yy58; } -yy53: +yy56: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'A': - case 'a': goto yy125; + case 'a': goto yy141; case 'L': - case 'l': goto yy126; + case 'l': goto yy142; case 'R': - case 'r': goto yy127; + case 'r': goto yy143; case 'U': - case 'u': goto yy128; - default: goto yy55; + case 'u': goto yy144; + default: goto yy58; } -yy54: +yy57: yyaccept = 4; - P->mrk = ++P->cur; - if (P->lim <= P->cur) if (P->cur >= P->lim) goto done;; - yych = *P->cur; -yy55: + mrk = ++cur; + if (lim <= cur) if (cur >= lim) goto done;; + yych = *cur; +yy58: switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy48; + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy51; + case '\\': goto yy131; + default: goto yy57; } -yy56: +yy59: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'F': - case 'f': goto yy129; + case 'f': goto yy145; case 'N': - case 'n': goto yy131; - default: goto yy55; + case 'n': goto yy147; + default: goto yy58; } -yy57: +yy60: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { + case '"': goto yy148; + case '\'': goto yy149; case 'E': - case 'e': goto yy132; + case 'e': goto yy150; case 'I': - case 'i': goto yy133; + case 'i': goto yy151; case 'O': - case 'o': goto yy134; - default: goto yy55; + case 'o': goto yy152; + default: goto yy58; } -yy58: +yy61: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'I': - case 'i': goto yy135; - default: goto yy55; + case 'i': goto yy153; + default: goto yy58; } -yy59: +yy62: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'U': - case 'u': goto yy136; - default: goto yy55; + case 'u': goto yy154; + default: goto yy58; } -yy60: +yy63: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'B': - case 'b': goto yy137; - default: goto yy55; + case 'b': goto yy155; + default: goto yy58; } -yy61: +yy64: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'A': - case 'a': goto yy138; + case 'a': goto yy156; case 'O': - case 'o': goto yy139; + case 'o': goto yy157; case 'R': - case 'r': goto yy140; - default: goto yy55; + case 'r': goto yy158; + default: goto yy58; } -yy62: +yy65: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy141; - default: goto yy55; + case 'e': goto yy159; + default: goto yy58; } -yy63: +yy66: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy142; + case 'e': goto yy160; case 'H': - case 'h': goto yy143; + case 'h': goto yy161; case 'I': - case 'i': goto yy144; + case 'i': goto yy162; case 'T': - case 't': goto yy145; - default: goto yy55; + case 't': goto yy163; + default: goto yy58; } -yy64: +yy67: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy146; + case 'e': goto yy164; case 'O': - case 'o': goto yy147; + case 'o': goto yy165; case 'R': - case 'r': goto yy148; + case 'r': goto yy166; case 'Y': - case 'y': goto yy149; - default: goto yy55; + case 'y': goto yy167; + default: goto yy58; } -yy65: +yy68: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'I': - case 'i': goto yy150; + case 'i': goto yy168; case 'N': - case 'n': goto yy151; - default: goto yy55; + case 'n': goto yy169; + default: goto yy58; } -yy66: +yy69: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'O': - case 'o': goto yy152; - default: goto yy55; + case 'o': goto yy170; + default: goto yy58; } -yy67: +yy70: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'A': - case 'a': goto yy153; - default: goto yy55; + case 'a': goto yy171; + default: goto yy58; } -yy68: +yy71: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'V': - case 'v': goto yy154; - default: goto yy55; + case 'v': goto yy172; + default: goto yy58; } -yy69: - ++P->cur; -#line 324 "src/parser.re" +yy72: + ++cur; +#line 326 "src/parser.re" { NEWTOKEN(PSI_T_LBRACKET); goto start; } -#line 959 "src/parser.c" -yy71: - ++P->cur; - switch ((yych = *P->cur)) { - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy155; - default: goto yy72; +#line 1075 "src/parser.c" +yy74: + ++cur; + switch ((yych = *cur)) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case '\\': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy75; + default: goto yy173; } -yy72: -#line 339 "src/parser.re" - { NEWTOKEN(PSI_T_BSLASH); goto start; } -#line 1021 "src/parser.c" -yy73: - ++P->cur; -#line 325 "src/parser.re" - { NEWTOKEN(PSI_T_RBRACKET); goto start; } -#line 1026 "src/parser.c" yy75: - ++P->cur; #line 341 "src/parser.re" - { NEWTOKEN(PSI_T_CARET); goto start; } -#line 1031 "src/parser.c" -yy77: - ++P->cur; -#line 322 "src/parser.re" - { NEWTOKEN(PSI_T_LBRACE); goto start; } -#line 1036 "src/parser.c" -yy79: - ++P->cur; - switch ((yych = *P->cur)) { - case '|': goto yy158; - default: goto yy80; - } + { NEWTOKEN(PSI_T_BSLASH); goto start; } +#line 1159 "src/parser.c" +yy76: + ++cur; +#line 327 "src/parser.re" + { NEWTOKEN(PSI_T_RBRACKET); goto start; } +#line 1164 "src/parser.c" +yy78: + ++cur; +#line 343 "src/parser.re" + { NEWTOKEN(PSI_T_CARET); goto start; } +#line 1169 "src/parser.c" yy80: -#line 340 "src/parser.re" - { NEWTOKEN(PSI_T_PIPE); goto start; } -#line 1046 "src/parser.c" + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'E': + case 'e': goto yy150; + case 'I': + case 'i': goto yy151; + case 'O': + case 'o': goto yy152; + default: goto yy58; + } yy81: - ++P->cur; -#line 323 "src/parser.re" - { NEWTOKEN(PSI_T_RBRACE); goto start; } -#line 1051 "src/parser.c" + ++cur; +#line 324 "src/parser.re" + { NEWTOKEN(PSI_T_LBRACE); goto start; } +#line 1186 "src/parser.c" yy83: - ++P->cur; -#line 332 "src/parser.re" - { NEWTOKEN(PSI_T_TILDE); goto start; } -#line 1056 "src/parser.c" + ++cur; + switch ((yych = *cur)) { + case '|': goto yy176; + default: goto yy84; + } +yy84: +#line 342 "src/parser.re" + { NEWTOKEN(PSI_T_PIPE); goto start; } +#line 1196 "src/parser.c" yy85: - ++P->cur; -#line 326 "src/parser.re" - { NEWTOKEN(PSI_T_CMP_NE); goto start; } -#line 1061 "src/parser.c" + ++cur; +#line 325 "src/parser.re" + { NEWTOKEN(PSI_T_RBRACE); goto start; } +#line 1201 "src/parser.c" yy87: - ++P->cur; - if (P->lim <= P->cur) if (P->cur >= P->lim) goto done;; - yych = *P->cur; + ++cur; +#line 334 "src/parser.re" + { NEWTOKEN(PSI_T_TILDE); goto start; } +#line 1206 "src/parser.c" +yy89: + ++cur; +#line 328 "src/parser.re" + { NEWTOKEN(PSI_T_CMP_NE); goto start; } +#line 1211 "src/parser.c" +yy91: + ++cur; + if (lim <= cur) if (cur >= lim) goto done;; + yych = *cur; switch (yych) { - case '"': goto yy160; - default: goto yy87; + case '"': goto yy178; + default: goto yy91; } -yy89: - ++P->cur; - if (P->lim <= P->cur) if (P->cur >= P->lim) goto done;; - yych = *P->cur; +yy93: + ++cur; + if (lim <= cur) if (cur >= lim) goto done;; + yych = *cur; + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case '\\': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy95; + default: goto yy93; + } +yy95: +#line 427 "src/parser.re" + { NEWTOKEN(PSI_T_DOLLAR_NAME); goto start; } +#line 1295 "src/parser.c" +yy96: + ++cur; +#line 330 "src/parser.re" + { NEWTOKEN(PSI_T_AND); goto start; } +#line 1300 "src/parser.c" +yy98: + ++cur; + if (lim <= cur) if (cur >= lim) goto done;; + yych = *cur; + switch (yych) { + case '\'': goto yy180; + case '\\': goto yy182; + default: goto yy98; + } +yy100: + yyaccept = 2; + mrk = ++cur; + if ((lim - cur) < 2) if (cur >= lim) goto done;; + yych = *cur; switch (yych) { case '0': case '1': @@ -1080,73 +1321,133 @@ yy89: case '6': case '7': case '8': - case '9': - case 'A': - case 'B': - case 'C': + case '9': goto yy100; + case 'D': + case 'd': goto yy104; + case 'F': + case 'L': + case 'f': + case 'l': goto yy105; + default: goto yy37; + } +yy102: + yych = *++cur; + switch (yych) { + case '.': goto yy184; + default: goto yy103; + } +yy103: + cur = mrk; + switch (yyaccept) { + case 0: goto yy3; + case 1: goto yy33; + case 2: goto yy37; + case 3: goto yy45; + case 4: goto yy51; + case 5: goto yy146; + case 6: goto yy175; + case 7: goto yy214; + case 8: goto yy216; + case 9: goto yy218; + case 10: goto yy228; + case 11: goto yy181; + case 12: goto yy250; + case 13: goto yy253; + case 14: goto yy259; + case 15: goto yy261; + case 16: goto yy264; + case 17: goto yy269; + case 18: goto yy280; + case 19: goto yy283; + case 20: goto yy298; + case 21: goto yy306; + case 22: goto yy313; + case 23: goto yy316; + case 24: goto yy318; + case 25: goto yy325; + case 26: goto yy327; + case 27: goto yy331; + case 28: goto yy333; + case 29: goto yy335; + case 30: goto yy337; + case 31: goto yy340; + case 32: goto yy349; + case 33: goto yy357; + case 34: goto yy376; + case 35: goto yy378; + case 36: goto yy382; + case 37: goto yy387; + case 38: goto yy389; + case 39: goto yy391; + case 40: goto yy395; + case 41: goto yy401; + case 42: goto yy403; + case 43: goto yy405; + case 44: goto yy407; + case 45: goto yy412; + case 46: goto yy414; + case 47: goto yy416; + case 48: goto yy418; + case 49: goto yy420; + case 50: goto yy422; + case 51: goto yy424; + case 52: goto yy429; + case 53: goto yy440; + case 54: goto yy444; + case 55: goto yy448; + case 56: goto yy450; + case 57: goto yy452; + case 58: goto yy454; + case 59: goto yy456; + case 60: goto yy461; + case 61: goto yy466; + case 62: goto yy471; + case 63: goto yy474; + case 64: goto yy476; + case 65: goto yy478; + case 66: goto yy480; + case 67: goto yy482; + case 68: goto yy487; + case 69: goto yy489; + case 70: goto yy493; + case 71: goto yy495; + case 72: goto yy497; + case 73: goto yy499; + case 74: goto yy504; + case 75: goto yy506; + case 76: goto yy510; + case 77: goto yy513; + default: goto yy515; + } +yy104: + yych = *++cur; + switch (yych) { case 'D': - case 'E': case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': case 'd': - case 'e': case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy89; - default: goto yy91; + case 'l': goto yy105; + default: goto yy103; } -yy91: -#line 422 "src/parser.re" - { NEWTOKEN(PSI_T_DOLLAR_NAME); goto start; } -#line 1143 "src/parser.c" -yy92: - ++P->cur; -#line 328 "src/parser.re" - { NEWTOKEN(PSI_T_AND); goto start; } -#line 1148 "src/parser.c" -yy94: - yych = *++P->cur; +yy105: + yych = *++cur; + goto yy37; +yy106: + ++cur; +#line 316 "src/parser.re" + { goto comment; } +#line 1441 "src/parser.c" +yy108: + ++cur; +#line 317 "src/parser.re" + { goto comment_sl; } +#line 1446 "src/parser.c" +yy110: + yyaccept = 2; + mrk = ++cur; + if ((lim - cur) < 3) if (cur >= lim) goto done;; + yych = *cur; switch (yych) { case '0': case '1': @@ -1157,101 +1458,41 @@ yy94: case '6': case '7': case '8': - case '9': goto yy97; - default: goto yy95; - } -yy95: - P->cur = P->mrk; - switch (yyaccept) { - case 0: goto yy3; - case 1: goto yy26; - case 2: goto yy30; - case 3: goto yy36; - case 4: goto yy48; - case 5: goto yy130; - case 6: goto yy157; - case 7: goto yy187; - case 8: goto yy189; - case 9: goto yy191; - case 10: goto yy201; - case 11: goto yy220; - case 12: goto yy223; - case 13: goto yy229; - case 14: goto yy231; - case 15: goto yy234; - case 16: goto yy239; - case 17: goto yy249; - case 18: goto yy252; - case 19: goto yy267; - case 20: goto yy275; - case 21: goto yy282; - case 22: goto yy285; - case 23: goto yy287; - case 24: goto yy294; - case 25: goto yy296; - case 26: goto yy300; - case 27: goto yy302; - case 28: goto yy304; - case 29: goto yy306; - case 30: goto yy309; - case 31: goto yy317; - case 32: goto yy325; - case 33: goto yy344; - case 34: goto yy346; - case 35: goto yy350; - case 36: goto yy355; - case 37: goto yy357; - case 38: goto yy359; - case 39: goto yy363; - case 40: goto yy368; - case 41: goto yy370; - case 42: goto yy372; - case 43: goto yy374; - case 44: goto yy379; - case 45: goto yy381; - case 46: goto yy383; - case 47: goto yy385; - case 48: goto yy387; - case 49: goto yy389; - case 50: goto yy391; - case 51: goto yy396; - case 52: goto yy407; - case 53: goto yy411; - case 54: goto yy415; - case 55: goto yy417; - case 56: goto yy419; - case 57: goto yy421; - case 58: goto yy426; - case 59: goto yy431; - case 60: goto yy436; - case 61: goto yy439; - case 62: goto yy441; - case 63: goto yy443; - case 64: goto yy445; - case 65: goto yy447; - case 66: goto yy451; - case 67: goto yy453; - case 68: goto yy457; - case 69: goto yy459; - case 70: goto yy461; - case 71: goto yy463; - case 72: goto yy467; - case 73: goto yy469; - case 74: goto yy472; - default: goto yy474; + case '9': goto yy110; + case 'D': + case 'd': goto yy104; + case 'E': + case 'e': goto yy114; + case 'F': + case 'L': + case 'f': + case 'l': goto yy105; + default: goto yy37; } -yy96: - yych = *++P->cur; +yy112: + ++cur; + if ((lim - cur) < 3) if (cur >= lim) goto done;; + yych = *cur; switch (yych) { - case '.': goto yy162; - default: goto yy95; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': goto yy112; + case 'L': + case 'l': goto yy115; + case 'U': + case 'u': goto yy116; + default: goto yy37; } -yy97: - yyaccept = 3; - P->mrk = ++P->cur; - if ((P->lim - P->cur) < 3) if (P->cur >= P->lim) goto done;; - yych = *P->cur; +yy114: + yych = *++cur; switch (yych) { + case '+': + case '-': goto yy186; case '0': case '1': case '2': @@ -1261,26 +1502,29 @@ yy97: case '6': case '7': case '8': - case '9': goto yy97; - case 'E': - case 'e': goto yy103; - default: goto yy36; + case '9': goto yy100; + default: goto yy103; } -yy99: - ++P->cur; -#line 314 "src/parser.re" - { goto comment; } -#line 1274 "src/parser.c" -yy101: - ++P->cur; -#line 315 "src/parser.re" - { goto comment_sl; } -#line 1279 "src/parser.c" -yy103: - yych = *++P->cur; +yy115: + yyaccept = 2; + yych = *(mrk = ++cur); + switch (yych) { + case 'L': + case 'l': goto yy187; + case 'U': + case 'u': goto yy105; + default: goto yy37; + } +yy116: + yych = *++cur; + switch (yych) { + case 'L': + case 'l': goto yy188; + default: goto yy37; + } +yy117: + yych = *++cur; switch (yych) { - case '+': - case '-': goto yy164; case '0': case '1': case '2': @@ -1290,47 +1534,39 @@ yy103: case '6': case '7': case '8': - case '9': goto yy165; - default: goto yy95; - } -yy104: - ++P->cur; -#line 342 "src/parser.re" - { NEWTOKEN(PSI_T_LSHIFT); goto start; } -#line 1301 "src/parser.c" -yy106: - ++P->cur; -#line 344 "src/parser.re" - { NEWTOKEN(PSI_T_CMP_LE); goto start; } -#line 1306 "src/parser.c" -yy108: - ++P->cur; -#line 327 "src/parser.re" - { NEWTOKEN(PSI_T_CMP_EQ); goto start; } -#line 1311 "src/parser.c" -yy110: - ++P->cur; -#line 345 "src/parser.re" - { NEWTOKEN(PSI_T_CMP_GE); goto start; } -#line 1316 "src/parser.c" -yy112: - ++P->cur; -#line 343 "src/parser.re" - { NEWTOKEN(PSI_T_RSHIFT); goto start; } -#line 1321 "src/parser.c" -yy114: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'R': - case 'r': goto yy167; - default: goto yy55; + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': goto yy189; + default: goto yy103; } -yy115: - ++P->cur; - if (P->lim <= P->cur) if (P->cur >= P->lim) goto done;; - yych = *P->cur; +yy118: + ++cur; + if (lim <= cur) if (cur >= lim) goto done;; + yych = *cur; switch (yych) { + case '-': + case '.': + case '/': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': case 'A': case 'B': case 'C': @@ -1383,483 +1619,634 @@ yy115: case 'w': case 'x': case 'y': - case 'z': goto yy155; - default: goto yy95; + case 'z': goto yy118; + case '>': goto yy191; + default: goto yy103; } -yy116: +yy120: + ++cur; +#line 344 "src/parser.re" + { NEWTOKEN(PSI_T_LSHIFT); goto start; } +#line 1631 "src/parser.c" +yy122: + ++cur; +#line 346 "src/parser.re" + { NEWTOKEN(PSI_T_CMP_LE); goto start; } +#line 1636 "src/parser.c" +yy124: + ++cur; +#line 329 "src/parser.re" + { NEWTOKEN(PSI_T_CMP_EQ); goto start; } +#line 1641 "src/parser.c" +yy126: + ++cur; +#line 347 "src/parser.re" + { NEWTOKEN(PSI_T_CMP_GE); goto start; } +#line 1646 "src/parser.c" +yy128: + ++cur; +#line 345 "src/parser.re" + { NEWTOKEN(PSI_T_RSHIFT); goto start; } +#line 1651 "src/parser.c" +yy130: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'R': + case 'r': goto yy193; + default: goto yy58; + } +yy131: + ++cur; + if (lim <= cur) if (cur >= lim) goto done;; + yych = *cur; + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case '\\': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy103; + default: goto yy173; + } +yy132: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'O': - case 'o': goto yy168; - default: goto yy55; + case 'o': goto yy194; + default: goto yy58; } -yy117: +yy133: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'L': - case 'l': goto yy169; - default: goto yy55; + case 'l': goto yy195; + default: goto yy58; } -yy118: +yy134: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'A': - case 'a': goto yy170; - default: goto yy55; + case 'a': goto yy196; + default: goto yy58; } -yy119: +yy135: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'N': - case 'n': goto yy171; + case 'n': goto yy197; case 'U': - case 'u': goto yy172; - default: goto yy55; + case 'u': goto yy198; + default: goto yy58; } -yy120: +yy136: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'F': - case 'f': goto yy173; - default: goto yy55; + case 'f': goto yy199; + default: goto yy58; } -yy121: +yy137: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'U': - case 'u': goto yy174; - default: goto yy55; + case 'u': goto yy200; + default: goto yy58; } -yy122: +yy138: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'I': - case 'i': goto yy175; + case 'i': goto yy201; case 'S': - case 's': goto yy176; - default: goto yy55; + case 's': goto yy202; + default: goto yy58; } -yy123: +yy139: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'D': - case 'd': goto yy177; + case 'd': goto yy203; case 'U': - case 'u': goto yy178; - default: goto yy55; + case 'u': goto yy204; + default: goto yy58; } -yy124: +yy140: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'R': - case 'r': goto yy179; - default: goto yy55; + case 'r': goto yy205; + default: goto yy58; } -yy125: +yy141: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'L': - case 'l': goto yy180; - default: goto yy55; + case 'l': goto yy206; + default: goto yy58; } -yy126: +yy142: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'O': - case 'o': goto yy181; - default: goto yy55; + case 'o': goto yy207; + default: goto yy58; } -yy127: +yy143: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy182; - default: goto yy55; + case 'e': goto yy208; + default: goto yy58; } -yy128: +yy144: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'N': - case 'n': goto yy183; - default: goto yy55; + case 'n': goto yy209; + default: goto yy58; } -yy129: +yy145: yyaccept = 5; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy146; case 'D': - case 'd': goto yy184; + case 'd': goto yy210; case 'N': - case 'n': goto yy185; - case '\\': goto yy115; - default: goto yy130; + case 'n': goto yy211; + case '\\': goto yy131; + default: goto yy57; } -yy130: -#line 349 "src/parser.re" +yy146: +#line 352 "src/parser.re" { NEWTOKEN(PSI_T_IF); goto start; } -#line 1573 "src/parser.c" -yy131: +#line 1930 "src/parser.c" +yy147: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { + case 'C': + case 'c': goto yy212; case 'T': - case 't': goto yy186; - default: goto yy55; + case 't': goto yy213; + default: goto yy58; } -yy132: +yy148: + yych = *++cur; + switch (yych) { + case '"': goto yy103; + default: goto yy91; + } +yy149: + yych = *++cur; + switch (yych) { + case '\'': goto yy103; + default: goto yy98; + } +yy150: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'T': - case 't': goto yy188; - default: goto yy55; + case 't': goto yy215; + default: goto yy58; } -yy133: +yy151: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'B': - case 'b': goto yy190; - default: goto yy55; + case 'b': goto yy217; + default: goto yy58; } -yy134: +yy152: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'N': - case 'n': goto yy192; - default: goto yy55; + case 'n': goto yy219; + default: goto yy58; } -yy135: +yy153: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'X': - case 'x': goto yy193; - default: goto yy55; + case 'x': goto yy220; + default: goto yy58; } -yy136: +yy154: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'L': - case 'l': goto yy194; - default: goto yy55; + case 'l': goto yy221; + default: goto yy58; } -yy137: +yy155: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'J': - case 'j': goto yy195; - default: goto yy55; + case 'j': goto yy222; + default: goto yy58; } -yy138: +yy156: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'T': - case 't': goto yy196; - default: goto yy55; + case 't': goto yy223; + default: goto yy58; } -yy139: +yy157: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'S': - case 's': goto yy197; - default: goto yy55; + case 's': goto yy224; + default: goto yy58; } -yy140: +yy158: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy198; - default: goto yy55; + case 'e': goto yy225; + default: goto yy58; } -yy141: +yy159: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'T': - case 't': goto yy199; - default: goto yy55; + case 't': goto yy226; + default: goto yy58; } -yy142: +yy160: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'T': - case 't': goto yy200; - default: goto yy55; + case 't': goto yy227; + default: goto yy58; } -yy143: +yy161: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'O': - case 'o': goto yy202; - default: goto yy55; + case 'o': goto yy229; + default: goto yy58; } -yy144: +yy162: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'G': - case 'g': goto yy203; - default: goto yy55; + case 'g': goto yy230; + default: goto yy58; } -yy145: +yy163: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'A': - case 'a': goto yy204; + case 'a': goto yy231; case 'R': - case 'r': goto yy205; - default: goto yy55; + case 'r': goto yy232; + default: goto yy58; } -yy146: +yy164: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'M': - case 'm': goto yy206; - default: goto yy55; + case 'm': goto yy233; + default: goto yy58; } -yy147: +yy165: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case '_': goto yy207; - default: goto yy55; + case '_': goto yy234; + default: goto yy58; } -yy148: +yy166: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'U': - case 'u': goto yy208; - default: goto yy55; + case 'u': goto yy235; + default: goto yy58; } -yy149: +yy167: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'P': - case 'p': goto yy209; - default: goto yy55; + case 'p': goto yy236; + default: goto yy58; } -yy150: +yy168: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'N': - case 'n': goto yy210; - default: goto yy55; + case 'n': goto yy237; + default: goto yy58; } -yy151: +yy169: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'D': - case 'd': goto yy211; + case 'd': goto yy238; case 'I': - case 'i': goto yy212; + case 'i': goto yy239; case 'S': - case 's': goto yy213; - default: goto yy55; + case 's': goto yy240; + default: goto yy58; } -yy152: +yy170: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'I': - case 'i': goto yy214; - default: goto yy55; + case 'i': goto yy241; + default: goto yy58; } -yy153: +yy171: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'R': - case 'r': goto yy215; - default: goto yy55; + case 'r': goto yy242; + default: goto yy58; } -yy154: +yy172: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'A': - case 'a': goto yy216; - default: goto yy55; + case 'a': goto yy243; + default: goto yy58; } -yy155: +yy173: yyaccept = 6; - P->mrk = ++P->cur; - if (P->lim <= P->cur) if (P->cur >= P->lim) goto done;; - yych = *P->cur; - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy155; - case '\\': goto yy115; - default: goto yy157; + mrk = ++cur; + if (lim <= cur) if (cur >= lim) goto done;; + yych = *cur; + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy175; + case '\\': goto yy131; + default: goto yy173; } -yy157: -#line 421 "src/parser.re" +yy175: +#line 426 "src/parser.re" { NEWTOKEN(PSI_T_NSNAME); goto start; } -#line 1846 "src/parser.c" -yy158: - ++P->cur; -#line 329 "src/parser.re" +#line 2218 "src/parser.c" +yy176: + ++cur; +#line 331 "src/parser.re" { NEWTOKEN(PSI_T_OR); goto start; } -#line 1851 "src/parser.c" -yy160: - ++P->cur; -#line 423 "src/parser.re" +#line 2223 "src/parser.c" +yy178: + ++cur; +#line 428 "src/parser.re" { NEWTOKEN(PSI_T_QUOTED_STRING); goto start; } -#line 1856 "src/parser.c" -yy162: - ++P->cur; -#line 348 "src/parser.re" +#line 2228 "src/parser.c" +yy180: + ++cur; +yy181: +#line 429 "src/parser.re" + { NEWTOKEN(PSI_T_QUOTED_CHAR); goto start; } +#line 2234 "src/parser.c" +yy182: + ++cur; + if (lim <= cur) if (cur >= lim) goto done;; + yych = *cur; + switch (yych) { + case '\'': goto yy244; + case '\\': goto yy182; + default: goto yy98; + } +yy184: + ++cur; +#line 351 "src/parser.re" { NEWTOKEN(PSI_T_ELLIPSIS); goto start; } -#line 1861 "src/parser.c" -yy164: - yych = *++P->cur; +#line 2248 "src/parser.c" +yy186: + yych = *++cur; switch (yych) { case '0': case '1': @@ -1870,14 +2257,30 @@ yy164: case '6': case '7': case '8': - case '9': goto yy165; - default: goto yy95; + case '9': goto yy100; + default: goto yy103; } -yy165: - ++P->cur; - if (P->lim <= P->cur) if (P->cur >= P->lim) goto done;; - yych = *P->cur; +yy187: + yych = *++cur; + switch (yych) { + case 'U': + case 'u': goto yy105; + default: goto yy103; + } +yy188: + yych = *++cur; + switch (yych) { + case 'L': + case 'l': goto yy105; + default: goto yy37; + } +yy189: + yyaccept = 2; + mrk = ++cur; + if ((lim - cur) < 3) if (cur >= lim) goto done;; + yych = *cur; switch (yych) { + case '.': goto yy245; case '0': case '1': case '2': @@ -1887,679 +2290,714 @@ yy165: case '6': case '7': case '8': - case '9': goto yy165; - default: goto yy36; + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': goto yy189; + case 'L': + case 'l': goto yy115; + case 'P': + case 'p': goto yy114; + case 'U': + case 'u': goto yy116; + default: goto yy37; } -yy167: +yy191: + ++cur; +#line 430 "src/parser.re" + { NEWTOKEN(PSI_T_CPP_HEADER); goto start; } +#line 2319 "src/parser.c" +yy193: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'A': - case 'a': goto yy217; + case 'a': goto yy247; case 'V': - case 'v': goto yy218; - default: goto yy55; + case 'v': goto yy248; + default: goto yy58; } -yy168: +yy194: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'L': - case 'l': goto yy219; - default: goto yy55; + case 'l': goto yy249; + default: goto yy58; } -yy169: +yy195: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'L': - case 'l': goto yy221; - default: goto yy55; + case 'l': goto yy251; + default: goto yy58; } -yy170: +yy196: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'R': - case 'r': goto yy222; - default: goto yy55; + case 'r': goto yy252; + default: goto yy58; } -yy171: +yy197: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'S': - case 's': goto yy224; - default: goto yy55; + case 's': goto yy254; + default: goto yy58; } -yy172: +yy198: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'N': - case 'n': goto yy225; - default: goto yy55; + case 'n': goto yy255; + default: goto yy58; } -yy173: +yy199: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'I': - case 'i': goto yy226; - default: goto yy55; + case 'i': goto yy256; + default: goto yy58; } -yy174: +yy200: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'B': - case 'b': goto yy227; - default: goto yy55; + case 'b': goto yy257; + default: goto yy58; } -yy175: +yy201: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'F': - case 'f': goto yy228; - default: goto yy55; + case 'f': goto yy258; + default: goto yy58; } -yy176: +yy202: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy230; - default: goto yy55; + case 'e': goto yy260; + default: goto yy58; } -yy177: +yy203: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'I': - case 'i': goto yy232; - default: goto yy55; + case 'i': goto yy262; + default: goto yy58; } -yy178: +yy204: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'M': - case 'm': goto yy233; - default: goto yy55; + case 'm': goto yy263; + default: goto yy58; } -yy179: +yy205: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'O': - case 'o': goto yy235; - default: goto yy55; + case 'o': goto yy265; + default: goto yy58; } -yy180: +yy206: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'S': - case 's': goto yy236; - default: goto yy55; + case 's': goto yy266; + default: goto yy58; } -yy181: +yy207: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'A': - case 'a': goto yy237; - default: goto yy55; + case 'a': goto yy267; + default: goto yy58; } -yy182: +yy208: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy238; - default: goto yy55; + case 'e': goto yy268; + default: goto yy58; } -yy183: +yy209: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'C': - case 'c': goto yy240; - default: goto yy55; + case 'c': goto yy270; + default: goto yy58; } -yy184: +yy210: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy241; - default: goto yy55; + case 'e': goto yy271; + default: goto yy58; } -yy185: +yy211: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'D': - case 'd': goto yy242; - default: goto yy55; + case 'd': goto yy272; + default: goto yy58; } -yy186: - yyaccept = 7; - yych = *(P->mrk = ++P->cur); +yy212: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '2': - case '4': - case '5': - case '7': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '1': goto yy243; - case '3': goto yy244; - case '6': goto yy245; - case '8': goto yy246; + case 'l': goto yy273; + default: goto yy58; + } +yy213: + yyaccept = 7; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy214; + case '1': goto yy274; + case '3': goto yy275; + case '6': goto yy276; + case '8': goto yy277; case 'V': - case 'v': goto yy247; - case '\\': goto yy115; - default: goto yy187; + case 'v': goto yy278; + case '\\': goto yy131; + default: goto yy57; } -yy187: -#line 369 "src/parser.re" +yy214: +#line 374 "src/parser.re" { NEWTOKEN(PSI_T_INT); goto start; } -#line 2121 "src/parser.c" -yy188: +#line 2562 "src/parser.c" +yy215: yyaccept = 8; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy189; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy216; + case '\\': goto yy131; + default: goto yy57; } -yy189: -#line 395 "src/parser.re" +yy216: +#line 400 "src/parser.re" { NEWTOKEN(PSI_T_LET); goto start; } -#line 2195 "src/parser.c" -yy190: +#line 2637 "src/parser.c" +yy217: yyaccept = 9; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy191; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy218; + case '\\': goto yy131; + default: goto yy57; } -yy191: -#line 394 "src/parser.re" +yy218: +#line 399 "src/parser.re" { NEWTOKEN(PSI_T_LIB); goto start; } -#line 2269 "src/parser.c" -yy192: +#line 2712 "src/parser.c" +yy219: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'G': - case 'g': goto yy248; - default: goto yy55; + case 'g': goto yy279; + default: goto yy58; } -yy193: +yy220: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy250; - default: goto yy55; + case 'e': goto yy281; + default: goto yy58; } -yy194: +yy221: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'L': - case 'l': goto yy251; - default: goto yy55; + case 'l': goto yy282; + default: goto yy58; } -yy195: +yy222: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy253; + case 'e': goto yy284; case 'V': - case 'v': goto yy254; - default: goto yy55; + case 'v': goto yy285; + default: goto yy58; } -yy196: +yy223: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'H': - case 'h': goto yy255; - default: goto yy55; + case 'h': goto yy286; + default: goto yy58; } -yy197: +yy224: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'T': - case 't': goto yy256; - default: goto yy55; + case 't': goto yy287; + default: goto yy58; } -yy198: +yy225: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case '_': goto yy257; - default: goto yy55; + case '_': goto yy288; + default: goto yy58; } -yy199: +yy226: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'U': - case 'u': goto yy258; - default: goto yy55; + case 'u': goto yy289; + default: goto yy58; } -yy200: +yy227: yyaccept = 10; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy201; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy228; + case '\\': goto yy131; + default: goto yy57; } -yy201: -#line 396 "src/parser.re" +yy228: +#line 401 "src/parser.re" { NEWTOKEN(PSI_T_SET); goto start; } -#line 2408 "src/parser.c" -yy202: +#line 2852 "src/parser.c" +yy229: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'R': - case 'r': goto yy259; - default: goto yy55; + case 'r': goto yy290; + default: goto yy58; } -yy203: +yy230: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'N': - case 'n': goto yy260; - default: goto yy55; + case 'n': goto yy291; + default: goto yy58; } -yy204: +yy231: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'T': - case 't': goto yy261; - default: goto yy55; + case 't': goto yy292; + default: goto yy58; } -yy205: +yy232: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'I': - case 'i': goto yy262; + case 'i': goto yy293; case 'L': - case 'l': goto yy263; + case 'l': goto yy294; case 'U': - case 'u': goto yy264; + case 'u': goto yy295; case 'V': - case 'v': goto yy265; - default: goto yy55; + case 'v': goto yy296; + default: goto yy58; } -yy206: +yy233: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'P': - case 'p': goto yy266; - default: goto yy55; + case 'p': goto yy297; + default: goto yy58; } -yy207: +yy234: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'A': - case 'a': goto yy268; + case 'a': goto yy299; case 'B': - case 'b': goto yy269; + case 'b': goto yy300; case 'F': - case 'f': goto yy270; + case 'f': goto yy301; case 'I': - case 'i': goto yy271; + case 'i': goto yy302; case 'O': - case 'o': goto yy272; + case 'o': goto yy303; case 'S': - case 's': goto yy273; - default: goto yy55; + case 's': goto yy304; + default: goto yy58; } -yy208: +yy235: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy274; - default: goto yy55; + case 'e': goto yy305; + default: goto yy58; } -yy209: +yy236: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy276; - default: goto yy55; + case 'e': goto yy307; + default: goto yy58; } -yy210: +yy237: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'T': - case 't': goto yy277; - default: goto yy55; + case 't': goto yy308; + default: goto yy58; } -yy211: +yy238: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy278; - default: goto yy55; + case 'e': goto yy309; + default: goto yy58; } -yy212: +yy239: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'O': - case 'o': goto yy279; - default: goto yy55; + case 'o': goto yy310; + default: goto yy58; } -yy213: +yy240: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'I': - case 'i': goto yy280; - default: goto yy55; + case 'i': goto yy311; + default: goto yy58; } -yy214: +yy241: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'D': - case 'd': goto yy281; - default: goto yy55; + case 'd': goto yy312; + default: goto yy58; } -yy215: +yy242: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'N': - case 'n': goto yy283; - default: goto yy55; + case 'n': goto yy314; + default: goto yy58; } -yy216: +yy243: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'L': - case 'l': goto yy284; - default: goto yy55; + case 'l': goto yy315; + default: goto yy58; } -yy217: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'Y': - case 'y': goto yy286; - default: goto yy55; - } -yy218: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); +yy244: + yyaccept = 11; + mrk = ++cur; + if (lim <= cur) if (cur >= lim) goto done;; + yych = *cur; switch (yych) { - case 'A': - case 'a': goto yy288; - default: goto yy55; + case '\'': goto yy180; + default: goto yy98; } -yy219: - yyaccept = 11; - yych = *(P->mrk = ++P->cur); +yy245: + ++cur; + if ((lim - cur) < 3) if (cur >= lim) goto done;; + yych = *cur; switch (yych) { case '0': case '1': @@ -2577,5866 +3015,6197 @@ yy219: case 'D': case 'E': case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': case 'a': case 'b': case 'c': case 'd': case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case 'V': - case 'v': goto yy289; - case '\\': goto yy115; - default: goto yy220; + case 'f': goto yy245; + case 'P': + case 'p': goto yy114; + default: goto yy103; } -yy220: -#line 366 "src/parser.re" - { NEWTOKEN(PSI_T_BOOL); goto start; } -#line 2634 "src/parser.c" -yy221: +yy247: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'Y': + case 'y': goto yy317; + default: goto yy58; + } +yy248: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'A': - case 'a': goto yy290; - case 'B': - case 'b': goto yy291; - case 'O': - case 'o': goto yy292; - default: goto yy55; + case 'a': goto yy319; + default: goto yy58; } -yy222: +yy249: yyaccept = 12; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy250; + case 'V': + case 'v': goto yy320; + case '\\': goto yy131; + default: goto yy57; + } +yy250: +#line 371 "src/parser.re" + { NEWTOKEN(PSI_T_BOOL); goto start; } +#line 3121 "src/parser.c" +yy251: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': case 'A': + case 'a': goto yy321; case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': + case 'b': goto yy322; case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy223; + case 'o': goto yy323; + default: goto yy58; } -yy223: -#line 367 "src/parser.re" +yy252: + yyaccept = 13; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy253; + case '\\': goto yy131; + default: goto yy57; + } +yy253: +#line 372 "src/parser.re" { NEWTOKEN(PSI_T_CHAR); goto start; } -#line 2720 "src/parser.c" -yy224: +#line 3208 "src/parser.c" +yy254: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'T': - case 't': goto yy293; - default: goto yy55; + case 't': goto yy324; + default: goto yy58; } -yy225: +yy255: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'T': - case 't': goto yy295; - default: goto yy55; + case 't': goto yy326; + default: goto yy58; } -yy226: +yy256: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'N': - case 'n': goto yy297; - default: goto yy55; + case 'n': goto yy328; + default: goto yy58; } -yy227: +yy257: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'L': - case 'l': goto yy298; - default: goto yy55; + case 'l': goto yy329; + default: goto yy58; } -yy228: - yyaccept = 13; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy229; +yy258: + yyaccept = 14; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy259; + case '\\': goto yy131; + default: goto yy57; } -yy229: -#line 353 "src/parser.re" +yy259: +#line 356 "src/parser.re" { NEWTOKEN(PSI_T_ELIF); goto start; } -#line 2826 "src/parser.c" -yy230: - yyaccept = 14; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy231; +#line 3315 "src/parser.c" +yy260: + yyaccept = 15; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy261; + case '\\': goto yy131; + default: goto yy57; } -yy231: -#line 352 "src/parser.re" +yy261: +#line 355 "src/parser.re" { NEWTOKEN(PSI_T_ELSE); goto start; } -#line 2900 "src/parser.c" -yy232: +#line 3390 "src/parser.c" +yy262: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'F': - case 'f': goto yy299; - default: goto yy55; + case 'f': goto yy330; + default: goto yy58; } -yy233: - yyaccept = 15; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy234; +yy263: + yyaccept = 16; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy264; + case '\\': goto yy131; + default: goto yy57; } -yy234: -#line 392 "src/parser.re" +yy264: +#line 397 "src/parser.re" { NEWTOKEN(PSI_T_ENUM); goto start; } -#line 2982 "src/parser.c" -yy235: +#line 3473 "src/parser.c" +yy265: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'R': - case 'r': goto yy301; - default: goto yy55; + case 'r': goto yy332; + default: goto yy58; } -yy236: +yy266: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy303; - default: goto yy55; + case 'e': goto yy334; + default: goto yy58; } -yy237: +yy267: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'T': - case 't': goto yy305; - default: goto yy55; + case 't': goto yy336; + default: goto yy58; } -yy238: - yyaccept = 16; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy239; - } -yy239: -#line 400 "src/parser.re" - { NEWTOKEN(PSI_T_FREE); goto start; } -#line 3080 "src/parser.c" -yy240: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); +yy268: + yyaccept = 17; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy269; + case '\\': goto yy131; + default: goto yy57; + } +yy269: +#line 405 "src/parser.re" + { NEWTOKEN(PSI_T_FREE); goto start; } +#line 3572 "src/parser.c" +yy270: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { case 'T': - case 't': goto yy307; - default: goto yy55; + case 't': goto yy338; + default: goto yy58; } -yy241: +yy271: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'F': - case 'f': goto yy308; - default: goto yy55; + case 'f': goto yy339; + default: goto yy58; } -yy242: +yy272: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy310; - default: goto yy55; + case 'e': goto yy341; + default: goto yy58; } -yy243: +yy273: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case '6': goto yy311; - default: goto yy55; + case 'U': + case 'u': goto yy342; + default: goto yy58; } -yy244: +yy274: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case '2': goto yy312; - default: goto yy55; + case '6': goto yy343; + default: goto yy58; } -yy245: +yy275: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case '4': goto yy313; - default: goto yy55; + case '2': goto yy344; + default: goto yy58; } -yy246: +yy276: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case '_': goto yy314; - default: goto yy55; + case '4': goto yy345; + default: goto yy58; } -yy247: +yy277: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case 'A': - case 'a': goto yy315; - default: goto yy55; + case '_': goto yy346; + default: goto yy58; } -yy248: - yyaccept = 17; - yych = *(P->mrk = ++P->cur); +yy278: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy249; + case 'a': goto yy347; + default: goto yy58; } -yy249: -#line 370 "src/parser.re" +yy279: + yyaccept = 18; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy280; + case '\\': goto yy131; + default: goto yy57; + } +yy280: +#line 375 "src/parser.re" { NEWTOKEN(PSI_T_LONG); goto start; } -#line 3214 "src/parser.c" -yy250: +#line 3715 "src/parser.c" +yy281: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'D': - case 'd': goto yy316; - default: goto yy55; + case 'd': goto yy348; + default: goto yy58; } -yy251: - yyaccept = 18; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy252; +yy282: + yyaccept = 19; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy283; + case '\\': goto yy131; + default: goto yy57; } -yy252: -#line 362 "src/parser.re" +yy283: +#line 367 "src/parser.re" { NEWTOKEN(PSI_T_NULL); goto start; } -#line 3296 "src/parser.c" -yy253: +#line 3798 "src/parser.c" +yy284: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'C': - case 'c': goto yy318; - default: goto yy55; + case 'c': goto yy350; + default: goto yy58; } -yy254: +yy285: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'A': - case 'a': goto yy319; - default: goto yy55; + case 'a': goto yy351; + default: goto yy58; } -yy255: +yy286: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'V': - case 'v': goto yy320; - default: goto yy55; + case 'v': goto yy352; + default: goto yy58; } -yy256: +yy287: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case '_': goto yy321; - default: goto yy55; + case '_': goto yy353; + default: goto yy58; } -yy257: +yy288: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'A': - case 'a': goto yy322; - default: goto yy55; + case 'a': goto yy354; + default: goto yy58; } -yy258: +yy289: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'R': - case 'r': goto yy323; - default: goto yy55; + case 'r': goto yy355; + default: goto yy58; } -yy259: +yy290: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'T': - case 't': goto yy324; - default: goto yy55; + case 't': goto yy356; + default: goto yy58; } -yy260: +yy291: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy326; - default: goto yy55; + case 'e': goto yy358; + default: goto yy58; } -yy261: +yy292: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'I': - case 'i': goto yy327; - default: goto yy55; + case 'i': goto yy359; + default: goto yy58; } -yy262: +yy293: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'N': - case 'n': goto yy328; - default: goto yy55; + case 'n': goto yy360; + default: goto yy58; } -yy263: +yy294: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'E': - case 'e': goto yy329; - default: goto yy55; + case 'e': goto yy361; + default: goto yy58; } -yy264: +yy295: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'C': - case 'c': goto yy330; - default: goto yy55; + case 'c': goto yy362; + default: goto yy58; } -yy265: +yy296: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'A': - case 'a': goto yy331; - default: goto yy55; + case 'a': goto yy363; + default: goto yy58; } -yy266: - yyaccept = 19; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy267; +yy297: + yyaccept = 20; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy298; + case '\\': goto yy131; + default: goto yy57; } -yy267: -#line 401 "src/parser.re" +yy298: +#line 406 "src/parser.re" { NEWTOKEN(PSI_T_TEMP); goto start; } -#line 3473 "src/parser.c" -yy268: +#line 3976 "src/parser.c" +yy299: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'R': - case 'r': goto yy332; - default: goto yy55; + case 'r': goto yy364; + default: goto yy58; } -yy269: +yy300: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'O': - case 'o': goto yy333; - default: goto yy55; + case 'o': goto yy365; + default: goto yy58; } -yy270: +yy301: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'L': - case 'l': goto yy334; - default: goto yy55; + case 'l': goto yy366; + default: goto yy58; } -yy271: +yy302: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'N': - case 'n': goto yy335; - default: goto yy55; + case 'n': goto yy367; + default: goto yy58; } -yy272: +yy303: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'B': - case 'b': goto yy336; - default: goto yy55; + case 'b': goto yy368; + default: goto yy58; } -yy273: +yy304: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'T': - case 't': goto yy337; - default: goto yy55; + case 't': goto yy369; + default: goto yy58; } -yy274: - yyaccept = 20; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy275; +yy305: + yyaccept = 21; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy306; + case '\\': goto yy131; + default: goto yy57; } -yy275: -#line 360 "src/parser.re" +yy306: +#line 365 "src/parser.re" { NEWTOKEN(PSI_T_TRUE); goto start; } -#line 3595 "src/parser.c" -yy276: +#line 4099 "src/parser.c" +yy307: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'D': - case 'd': goto yy338; - default: goto yy55; + case 'd': goto yy370; + default: goto yy58; } -yy277: +yy308: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case '1': goto yy339; - case '3': goto yy340; - case '6': goto yy341; - case '8': goto yy342; - default: goto yy55; + case '1': goto yy371; + case '3': goto yy372; + case '6': goto yy373; + case '8': goto yy374; + default: goto yy58; } -yy278: +yy309: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'F': - case 'f': goto yy343; - default: goto yy55; + case 'f': goto yy375; + default: goto yy58; } -yy279: +yy310: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'N': - case 'n': goto yy345; - default: goto yy55; + case 'n': goto yy377; + default: goto yy58; } -yy280: +yy311: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'G': - case 'g': goto yy347; - default: goto yy55; + case 'g': goto yy379; + default: goto yy58; } -yy281: - yyaccept = 21; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy282; +yy312: + yyaccept = 22; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy313; + case '\\': goto yy131; + default: goto yy57; } -yy282: -#line 365 "src/parser.re" +yy313: +#line 370 "src/parser.re" { NEWTOKEN(PSI_T_VOID); goto start; } -#line 3711 "src/parser.c" -yy283: +#line 4216 "src/parser.c" +yy314: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'I': - case 'i': goto yy348; - default: goto yy55; + case 'i': goto yy380; + default: goto yy58; } -yy284: - yyaccept = 22; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy285; +yy315: + yyaccept = 23; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy316; + case '\\': goto yy131; + default: goto yy57; } -yy285: -#line 410 "src/parser.re" +yy316: +#line 415 "src/parser.re" { NEWTOKEN(PSI_T_ZVAL); goto start; } -#line 3793 "src/parser.c" -yy286: - yyaccept = 23; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy287; +#line 4299 "src/parser.c" +yy317: + yyaccept = 24; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy318; + case '\\': goto yy131; + default: goto yy57; } -yy287: -#line 384 "src/parser.re" +yy318: +#line 389 "src/parser.re" { NEWTOKEN(PSI_T_ARRAY); goto start; } -#line 3867 "src/parser.c" -yy288: +#line 4374 "src/parser.c" +yy319: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'L': - case 'l': goto yy349; - default: goto yy55; + case 'l': goto yy381; + default: goto yy58; } -yy289: +yy320: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'A': - case 'a': goto yy351; - default: goto yy55; + case 'a': goto yy383; + default: goto yy58; } -yy290: +yy321: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'B': - case 'b': goto yy352; - default: goto yy55; + case 'b': goto yy384; + default: goto yy58; } -yy291: +yy322: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'A': - case 'a': goto yy353; - default: goto yy55; + case 'a': goto yy385; + default: goto yy58; } -yy292: +yy323: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'C': - case 'c': goto yy354; - default: goto yy55; + case 'c': goto yy386; + default: goto yy58; } -yy293: - yyaccept = 24; - yych = *(P->mrk = ++P->cur); +yy324: + yyaccept = 25; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy325; + case '\\': goto yy131; + default: goto yy57; + } +yy325: +#line 398 "src/parser.re" + { NEWTOKEN(PSI_T_CONST); goto start; } +#line 4489 "src/parser.c" +yy326: + yyaccept = 26; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy327; + case '\\': goto yy131; + default: goto yy57; + } +yy327: +#line 416 "src/parser.re" + { NEWTOKEN(PSI_T_COUNT); goto start; } +#line 4564 "src/parser.c" +yy328: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy294; + case 'e': goto yy388; + default: goto yy58; } -yy294: -#line 393 "src/parser.re" - { NEWTOKEN(PSI_T_CONST); goto start; } -#line 3981 "src/parser.c" -yy295: - yyaccept = 25; - yych = *(P->mrk = ++P->cur); +yy329: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': case 'E': - case 'F': - case 'G': - case 'H': + case 'e': goto yy390; + default: goto yy58; + } +yy330: + yyaccept = 27; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy331; + case '\\': goto yy131; + default: goto yy57; + } +yy331: +#line 357 "src/parser.re" + { NEWTOKEN(PSI_T_ENDIF); goto start; } +#line 4655 "src/parser.c" +yy332: + yyaccept = 28; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy333; + case '\\': goto yy131; + default: goto yy57; + } +yy333: +#line 362 "src/parser.re" + { NEWTOKEN(PSI_T_ERROR); goto start; } +#line 4730 "src/parser.c" +yy334: + yyaccept = 29; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy335; + case '\\': goto yy131; + default: goto yy57; + } +yy335: +#line 366 "src/parser.re" + { NEWTOKEN(PSI_T_FALSE); goto start; } +#line 4805 "src/parser.c" +yy336: + yyaccept = 30; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy337; + case 'V': + case 'v': goto yy392; + case '\\': goto yy131; + default: goto yy57; + } +yy337: +#line 376 "src/parser.re" + { NEWTOKEN(PSI_T_FLOAT); goto start; } +#line 4882 "src/parser.c" +yy338: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'I': - case 'J': - case 'K': + case 'i': goto yy393; + default: goto yy58; + } +yy339: + yyaccept = 31; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy340; + case '\\': goto yy131; + default: goto yy57; + } +yy340: +#line 353 "src/parser.re" + { NEWTOKEN(PSI_T_IFDEF); goto start; } +#line 4965 "src/parser.c" +yy341: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'F': + case 'f': goto yy394; + default: goto yy58; + } +yy342: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'D': + case 'd': goto yy396; + default: goto yy58; + } +yy343: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case '_': goto yy397; + default: goto yy58; + } +yy344: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case '_': goto yy398; + default: goto yy58; + } +yy345: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case '_': goto yy399; + default: goto yy58; + } +yy346: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'T': + case 't': goto yy400; + default: goto yy58; + } +yy347: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': + case 'l': goto yy402; + default: goto yy58; + } +yy348: + yyaccept = 32; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy349; + case '\\': goto yy131; + default: goto yy57; + } +yy349: +#line 368 "src/parser.re" + { NEWTOKEN(PSI_T_MIXED); goto start; } +#line 5093 "src/parser.c" +yy350: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy296; + case 't': goto yy404; + default: goto yy58; } -yy296: -#line 411 "src/parser.re" - { NEWTOKEN(PSI_T_COUNT); goto start; } -#line 4055 "src/parser.c" -yy297: +yy351: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case 'E': - case 'e': goto yy356; - default: goto yy55; + case 'L': + case 'l': goto yy406; + default: goto yy58; } -yy298: +yy352: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case 'E': - case 'e': goto yy358; - default: goto yy55; + case 'A': + case 'a': goto yy408; + default: goto yy58; } -yy299: - yyaccept = 26; - yych = *(P->mrk = ++P->cur); +yy353: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': case 'A': - case 'B': - case 'C': + case 'a': goto yy409; + default: goto yy58; + } +yy354: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'S': + case 's': goto yy410; + default: goto yy58; + } +yy355: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'N': + case 'n': goto yy411; + default: goto yy58; + } +yy356: + yyaccept = 33; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy357; + case '\\': goto yy131; + default: goto yy57; + } +yy357: +#line 373 "src/parser.re" + { NEWTOKEN(PSI_T_SHORT); goto start; } +#line 5216 "src/parser.c" +yy358: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'D': - case 'E': - case 'F': + case 'd': goto yy413; + default: goto yy58; + } +yy359: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'C': + case 'c': goto yy415; + default: goto yy58; + } +yy360: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': + case 'g': goto yy417; + default: goto yy58; + } +yy361: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'N': - case 'O': - case 'P': - case 'Q': + case 'n': goto yy419; + default: goto yy58; + } +yy362: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'T': + case 't': goto yy421; + default: goto yy58; + } +yy363: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'L': + case 'l': goto yy423; + default: goto yy58; + } +yy364: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'R': - case 'S': + case 'r': goto yy425; + default: goto yy58; + } +yy365: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'O': + case 'o': goto yy426; + default: goto yy58; + } +yy366: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'O': + case 'o': goto yy427; + default: goto yy58; + } +yy367: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy300; + case 't': goto yy428; + default: goto yy58; } -yy300: -#line 354 "src/parser.re" - { NEWTOKEN(PSI_T_ENDIF); goto start; } -#line 4145 "src/parser.c" -yy301: - yyaccept = 27; - yych = *(P->mrk = ++P->cur); +yy368: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy302; + case 'j': goto yy430; + default: goto yy58; } -yy302: -#line 359 "src/parser.re" - { NEWTOKEN(PSI_T_ERROR); goto start; } -#line 4219 "src/parser.c" -yy303: - yyaccept = 28; - yych = *(P->mrk = ++P->cur); +yy369: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy304; + case 'r': goto yy431; + default: goto yy58; } -yy304: -#line 361 "src/parser.re" - { NEWTOKEN(PSI_T_FALSE); goto start; } -#line 4293 "src/parser.c" -yy305: - yyaccept = 29; - yych = *(P->mrk = ++P->cur); +yy370: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case 'V': - case 'v': goto yy360; - case '\\': goto yy115; - default: goto yy306; + case 'e': goto yy432; + default: goto yy58; } -yy306: -#line 371 "src/parser.re" - { NEWTOKEN(PSI_T_FLOAT); goto start; } -#line 4367 "src/parser.c" -yy307: +yy371: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case 'I': - case 'i': goto yy361; - default: goto yy55; + case '6': goto yy433; + default: goto yy58; } -yy308: - yyaccept = 30; - yych = *(P->mrk = ++P->cur); +yy372: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy309; + case '2': goto yy434; + default: goto yy58; } -yy309: -#line 350 "src/parser.re" - { NEWTOKEN(PSI_T_IFDEF); goto start; } -#line 4449 "src/parser.c" -yy310: +yy373: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case 'F': - case 'f': goto yy362; - default: goto yy55; + case '4': goto yy435; + default: goto yy58; } -yy311: +yy374: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case '_': goto yy364; - default: goto yy55; + case '_': goto yy436; + default: goto yy58; } -yy312: +yy375: + yyaccept = 34; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy376; + case '\\': goto yy131; + default: goto yy57; + } +yy376: +#line 360 "src/parser.re" + { NEWTOKEN(PSI_T_UNDEF); goto start; } +#line 5423 "src/parser.c" +yy377: + yyaccept = 35; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy378; + case '\\': goto yy131; + default: goto yy57; + } +yy378: +#line 396 "src/parser.re" + { NEWTOKEN(PSI_T_UNION); goto start; } +#line 5498 "src/parser.c" +yy379: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case '_': goto yy365; - default: goto yy55; + case 'N': + case 'n': goto yy437; + default: goto yy58; } -yy313: +yy380: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case '_': goto yy366; - default: goto yy55; + case 'N': + case 'n': goto yy438; + default: goto yy58; } -yy314: +yy381: + yyaccept = 36; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy382; + case '\\': goto yy131; + default: goto yy57; + } +yy382: +#line 413 "src/parser.re" + { NEWTOKEN(PSI_T_ARRVAL); goto start; } +#line 5589 "src/parser.c" +yy383: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case 'T': - case 't': goto yy367; - default: goto yy55; + case 'L': + case 'l': goto yy439; + default: goto yy58; } -yy315: +yy384: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'L': - case 'l': goto yy369; - default: goto yy55; + case 'l': goto yy441; + default: goto yy58; } -yy316: - yyaccept = 31; - yych = *(P->mrk = ++P->cur); +yy385: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': case 'C': + case 'c': goto yy442; + default: goto yy58; + } +yy386: + yyaccept = 37; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy387; + case '\\': goto yy131; + default: goto yy57; + } +yy387: +#line 417 "src/parser.re" + { NEWTOKEN(PSI_T_CALLOC); goto start; } +#line 5688 "src/parser.c" +yy388: + yyaccept = 38; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy389; case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy317; + case 'd': goto yy443; + case '\\': goto yy131; + default: goto yy57; } -yy317: -#line 363 "src/parser.re" - { NEWTOKEN(PSI_T_MIXED); goto start; } -#line 4568 "src/parser.c" -yy318: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'T': - case 't': goto yy371; - default: goto yy55; +yy389: +#line 358 "src/parser.re" + { NEWTOKEN(PSI_T_DEFINE); goto start; } +#line 5765 "src/parser.c" +yy390: + yyaccept = 39; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy391; + case '\\': goto yy131; + default: goto yy57; } -yy319: +yy391: +#line 377 "src/parser.re" + { NEWTOKEN(PSI_T_DOUBLE); goto start; } +#line 5840 "src/parser.c" +yy392: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case 'L': - case 'l': goto yy373; - default: goto yy55; + case 'A': + case 'a': goto yy445; + default: goto yy58; } -yy320: +yy393: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case 'A': - case 'a': goto yy375; - default: goto yy55; + case 'O': + case 'o': goto yy446; + default: goto yy58; } -yy321: +yy394: + yyaccept = 40; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy395; + case '\\': goto yy131; + default: goto yy57; + } +yy395: +#line 354 "src/parser.re" + { NEWTOKEN(PSI_T_IFNDEF); goto start; } +#line 5931 "src/parser.c" +yy396: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case 'A': - case 'a': goto yy376; - default: goto yy55; + case 'E': + case 'e': goto yy447; + default: goto yy58; } -yy322: +yy397: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case 'S': - case 's': goto yy377; - default: goto yy55; + case 'T': + case 't': goto yy449; + default: goto yy58; } -yy323: +yy398: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case 'N': - case 'n': goto yy378; - default: goto yy55; + case 'T': + case 't': goto yy451; + default: goto yy58; } -yy324: - yyaccept = 32; - yych = *(P->mrk = ++P->cur); +yy399: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy325; - } -yy325: -#line 368 "src/parser.re" - { NEWTOKEN(PSI_T_SHORT); goto start; } -#line 4690 "src/parser.c" -yy326: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'D': - case 'd': goto yy380; - default: goto yy55; + case 't': goto yy453; + default: goto yy58; } -yy327: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'C': - case 'c': goto yy382; - default: goto yy55; +yy400: + yyaccept = 41; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy401; + case '\\': goto yy131; + default: goto yy57; } -yy328: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'G': - case 'g': goto yy384; - default: goto yy55; +yy401: +#line 378 "src/parser.re" + { NEWTOKEN(PSI_T_INT8); goto start; } +#line 6038 "src/parser.c" +yy402: + yyaccept = 42; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy403; + case '\\': goto yy131; + default: goto yy57; } -yy329: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'N': - case 'n': goto yy386; - default: goto yy55; +yy403: +#line 410 "src/parser.re" + { NEWTOKEN(PSI_T_INTVAL); goto start; } +#line 6113 "src/parser.c" +yy404: + yyaccept = 43; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy405; + case '\\': goto yy131; + default: goto yy57; } -yy330: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'T': - case 't': goto yy388; - default: goto yy55; +yy405: +#line 390 "src/parser.re" + { NEWTOKEN(PSI_T_OBJECT); goto start; } +#line 6188 "src/parser.c" +yy406: + yyaccept = 44; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy407; + case '\\': goto yy131; + default: goto yy57; } -yy331: +yy407: +#line 414 "src/parser.re" + { NEWTOKEN(PSI_T_OBJVAL); goto start; } +#line 6263 "src/parser.c" +yy408: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'L': - case 'l': goto yy390; - default: goto yy55; - } -yy332: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'R': - case 'r': goto yy392; - default: goto yy55; - } -yy333: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'O': - case 'o': goto yy393; - default: goto yy55; - } -yy334: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'O': - case 'o': goto yy394; - default: goto yy55; - } -yy335: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'T': - case 't': goto yy395; - default: goto yy55; - } -yy336: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'J': - case 'j': goto yy397; - default: goto yy55; - } -yy337: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'R': - case 'r': goto yy398; - default: goto yy55; - } -yy338: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'E': - case 'e': goto yy399; - default: goto yy55; - } -yy339: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '6': goto yy400; - default: goto yy55; - } -yy340: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '2': goto yy401; - default: goto yy55; + case 'l': goto yy455; + default: goto yy58; } -yy341: +yy409: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case '4': goto yy402; - default: goto yy55; + case 'S': + case 's': goto yy457; + default: goto yy58; } -yy342: +yy410: yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '_': goto yy403; - default: goto yy55; - } -yy343: - yyaccept = 33; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy344; + case 's': goto yy458; + default: goto yy58; } -yy344: -#line 357 "src/parser.re" - { NEWTOKEN(PSI_T_UNDEF); goto start; } -#line 4896 "src/parser.c" -yy345: - yyaccept = 34; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy346; - } -yy346: -#line 391 "src/parser.re" - { NEWTOKEN(PSI_T_UNION); goto start; } -#line 4970 "src/parser.c" -yy347: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'N': - case 'n': goto yy404; - default: goto yy55; - } -yy348: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'N': - case 'n': goto yy405; - default: goto yy55; - } -yy349: - yyaccept = 35; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy350; - } -yy350: -#line 408 "src/parser.re" - { NEWTOKEN(PSI_T_ARRVAL); goto start; } -#line 5060 "src/parser.c" -yy351: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'L': - case 'l': goto yy406; - default: goto yy55; - } -yy352: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'L': - case 'l': goto yy408; - default: goto yy55; - } -yy353: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'C': - case 'c': goto yy409; - default: goto yy55; - } -yy354: - yyaccept = 36; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy355; - } -yy355: -#line 412 "src/parser.re" - { NEWTOKEN(PSI_T_CALLOC); goto start; } -#line 5158 "src/parser.c" -yy356: - yyaccept = 37; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case 'D': - case 'd': goto yy410; - case '\\': goto yy115; - default: goto yy357; - } -yy357: -#line 355 "src/parser.re" - { NEWTOKEN(PSI_T_DEFINE); goto start; } -#line 5232 "src/parser.c" -yy358: - yyaccept = 38; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy359; - } -yy359: -#line 372 "src/parser.re" - { NEWTOKEN(PSI_T_DOUBLE); goto start; } -#line 5306 "src/parser.c" -yy360: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'A': - case 'a': goto yy412; - default: goto yy55; - } -yy361: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'O': - case 'o': goto yy413; - default: goto yy55; - } -yy362: - yyaccept = 39; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy363; - } -yy363: -#line 351 "src/parser.re" - { NEWTOKEN(PSI_T_IFNDEF); goto start; } -#line 5396 "src/parser.c" -yy364: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'T': - case 't': goto yy414; - default: goto yy55; - } -yy365: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'T': - case 't': goto yy416; - default: goto yy55; - } -yy366: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'T': - case 't': goto yy418; - default: goto yy55; - } -yy367: - yyaccept = 40; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy368; - } -yy368: -#line 373 "src/parser.re" - { NEWTOKEN(PSI_T_INT8); goto start; } -#line 5494 "src/parser.c" -yy369: - yyaccept = 41; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy370; - } -yy370: -#line 405 "src/parser.re" - { NEWTOKEN(PSI_T_INTVAL); goto start; } -#line 5568 "src/parser.c" -yy371: - yyaccept = 42; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy372; - } -yy372: -#line 385 "src/parser.re" - { NEWTOKEN(PSI_T_OBJECT); goto start; } -#line 5642 "src/parser.c" -yy373: - yyaccept = 43; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy374; - } -yy374: -#line 409 "src/parser.re" - { NEWTOKEN(PSI_T_OBJVAL); goto start; } -#line 5716 "src/parser.c" -yy375: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'L': - case 'l': goto yy420; - default: goto yy55; - } -yy376: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'S': - case 's': goto yy422; - default: goto yy55; - } -yy377: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'S': - case 's': goto yy423; - default: goto yy55; - } -yy378: - yyaccept = 44; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy379; - } -yy379: -#line 399 "src/parser.re" - { NEWTOKEN(PSI_T_RETURN); goto start; } -#line 5814 "src/parser.c" -yy380: - yyaccept = 45; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy381; - } -yy381: -#line 382 "src/parser.re" - { NEWTOKEN(PSI_T_SIGNED); goto start; } -#line 5888 "src/parser.c" -yy382: - yyaccept = 46; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy383; - } -yy383: -#line 387 "src/parser.re" - { NEWTOKEN(PSI_T_STATIC); goto start; } -#line 5962 "src/parser.c" -yy384: - yyaccept = 47; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy385; - } -yy385: -#line 383 "src/parser.re" - { NEWTOKEN(PSI_T_STRING); goto start; } -#line 6036 "src/parser.c" -yy386: - yyaccept = 48; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy387; - } -yy387: -#line 402 "src/parser.re" - { NEWTOKEN(PSI_T_STRLEN); goto start; } -#line 6110 "src/parser.c" -yy388: - yyaccept = 49; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy389; - } -yy389: -#line 390 "src/parser.re" - { NEWTOKEN(PSI_T_STRUCT); goto start; } -#line 6184 "src/parser.c" -yy390: - yyaccept = 50; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy391; - } -yy391: -#line 403 "src/parser.re" - { NEWTOKEN(PSI_T_STRVAL); goto start; } -#line 6258 "src/parser.c" -yy392: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'A': - case 'a': goto yy424; - default: goto yy55; - } -yy393: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'L': - case 'l': goto yy425; - default: goto yy55; - } -yy394: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'A': - case 'a': goto yy427; - default: goto yy55; - } -yy395: - yyaccept = 51; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy396; - } -yy396: -#line 416 "src/parser.re" - { NEWTOKEN(PSI_T_TO_INT); goto start; } -#line 6356 "src/parser.c" -yy397: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'E': - case 'e': goto yy428; - default: goto yy55; - } -yy398: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'I': - case 'i': goto yy429; - default: goto yy55; - } -yy399: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'F': - case 'f': goto yy430; - default: goto yy55; - } -yy400: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '_': goto yy432; - default: goto yy55; - } -yy401: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '_': goto yy433; - default: goto yy55; - } -yy402: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '_': goto yy434; - default: goto yy55; - } -yy403: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'T': - case 't': goto yy435; - default: goto yy55; - } -yy404: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'E': - case 'e': goto yy437; - default: goto yy55; - } -yy405: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'G': - case 'g': goto yy438; - default: goto yy55; - } -yy406: - yyaccept = 52; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy407; - } -yy407: -#line 407 "src/parser.re" - { NEWTOKEN(PSI_T_BOOLVAL); goto start; } -#line 6499 "src/parser.c" -yy408: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'E': - case 'e': goto yy440; - default: goto yy55; - } -yy409: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'K': - case 'k': goto yy442; - default: goto yy55; - } -yy410: - yyaccept = 53; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy411; - } -yy411: -#line 356 "src/parser.re" - { NEWTOKEN(PSI_T_DEFINED); goto start; } -#line 6589 "src/parser.c" -yy412: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'L': - case 'l': goto yy444; - default: goto yy55; - } -yy413: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'N': - case 'n': goto yy446; - default: goto yy55; - } -yy414: - yyaccept = 54; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy415; - } -yy415: -#line 375 "src/parser.re" - { NEWTOKEN(PSI_T_INT16); goto start; } -#line 6679 "src/parser.c" -yy416: - yyaccept = 55; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy417; - } -yy417: -#line 377 "src/parser.re" - { NEWTOKEN(PSI_T_INT32); goto start; } -#line 6753 "src/parser.c" -yy418: - yyaccept = 56; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy419; - } -yy419: -#line 379 "src/parser.re" - { NEWTOKEN(PSI_T_INT64); goto start; } -#line 6827 "src/parser.c" -yy420: - yyaccept = 57; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy421; - } -yy421: -#line 404 "src/parser.re" - { NEWTOKEN(PSI_T_PATHVAL); goto start; } -#line 6901 "src/parser.c" -yy422: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'S': - case 's': goto yy448; - default: goto yy55; - } -yy423: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'E': - case 'e': goto yy449; - default: goto yy55; - } -yy424: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'Y': - case 'y': goto yy450; - default: goto yy55; - } -yy425: - yyaccept = 58; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy426; - } -yy426: -#line 418 "src/parser.re" - { NEWTOKEN(PSI_T_TO_BOOL); goto start; } -#line 6999 "src/parser.c" -yy427: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'T': - case 't': goto yy452; - default: goto yy55; - } -yy428: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'C': - case 'c': goto yy454; - default: goto yy55; - } -yy429: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'N': - case 'n': goto yy455; - default: goto yy55; - } -yy430: - yyaccept = 59; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy431; - } -yy431: -#line 389 "src/parser.re" - { NEWTOKEN(PSI_T_TYPEDEF); goto start; } -#line 7097 "src/parser.c" -yy432: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'T': - case 't': goto yy456; - default: goto yy55; - } -yy433: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'T': - case 't': goto yy458; - default: goto yy55; - } -yy434: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'T': - case 't': goto yy460; - default: goto yy55; - } -yy435: - yyaccept = 60; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy436; - } -yy436: -#line 374 "src/parser.re" - { NEWTOKEN(PSI_T_UINT8); goto start; } -#line 7195 "src/parser.c" -yy437: - yyaccept = 4; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case 'D': - case 'd': goto yy462; - default: goto yy55; - } -yy438: - yyaccept = 61; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy439; - } -yy439: -#line 358 "src/parser.re" - { NEWTOKEN(PSI_T_WARNING); goto start; } -#line 7277 "src/parser.c" -yy440: - yyaccept = 62; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy441; - } -yy441: -#line 364 "src/parser.re" - { NEWTOKEN(PSI_T_CALLABLE); goto start; } -#line 7351 "src/parser.c" -yy442: - yyaccept = 63; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy443; - } -yy443: -#line 386 "src/parser.re" - { NEWTOKEN(PSI_T_CALLBACK); goto start; } -#line 7425 "src/parser.c" -yy444: - yyaccept = 64; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy445; +yy411: + yyaccept = 45; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy412; + case '\\': goto yy131; + default: goto yy57; } -yy445: -#line 406 "src/parser.re" - { NEWTOKEN(PSI_T_FLOATVAL); goto start; } -#line 7499 "src/parser.c" -yy446: - yyaccept = 65; - yych = *(P->mrk = ++P->cur); - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy447; +yy412: +#line 404 "src/parser.re" + { NEWTOKEN(PSI_T_RETURN); goto start; } +#line 6362 "src/parser.c" +yy413: + yyaccept = 46; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy414; + case '\\': goto yy131; + default: goto yy57; } -yy447: +yy414: +#line 387 "src/parser.re" + { NEWTOKEN(PSI_T_SIGNED); goto start; } +#line 6437 "src/parser.c" +yy415: + yyaccept = 47; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy416; + case '\\': goto yy131; + default: goto yy57; + } +yy416: +#line 392 "src/parser.re" + { NEWTOKEN(PSI_T_STATIC); goto start; } +#line 6512 "src/parser.c" +yy417: + yyaccept = 48; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy418; + case '\\': goto yy131; + default: goto yy57; + } +yy418: #line 388 "src/parser.re" - { NEWTOKEN(PSI_T_FUNCTION); goto start; } -#line 7573 "src/parser.c" -yy448: + { NEWTOKEN(PSI_T_STRING); goto start; } +#line 6587 "src/parser.c" +yy419: + yyaccept = 49; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy420; + case '\\': goto yy131; + default: goto yy57; + } +yy420: +#line 407 "src/parser.re" + { NEWTOKEN(PSI_T_STRLEN); goto start; } +#line 6662 "src/parser.c" +yy421: + yyaccept = 50; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy422; + case '\\': goto yy131; + default: goto yy57; + } +yy422: +#line 395 "src/parser.re" + { NEWTOKEN(PSI_T_STRUCT); goto start; } +#line 6737 "src/parser.c" +yy423: + yyaccept = 51; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy424; + case '\\': goto yy131; + default: goto yy57; + } +yy424: +#line 408 "src/parser.re" + { NEWTOKEN(PSI_T_STRVAL); goto start; } +#line 6812 "src/parser.c" +yy425: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case 'E': - case 'e': goto yy464; - default: goto yy55; + case 'A': + case 'a': goto yy459; + default: goto yy58; } -yy449: +yy426: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case 'R': - case 'r': goto yy465; - default: goto yy55; + case 'L': + case 'l': goto yy460; + default: goto yy58; } -yy450: - yyaccept = 66; - yych = *(P->mrk = ++P->cur); +yy427: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': case 'A': - case 'B': - case 'C': - case 'D': + case 'a': goto yy462; + default: goto yy58; + } +yy428: + yyaccept = 52; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy429; + case '\\': goto yy131; + default: goto yy57; + } +yy429: +#line 421 "src/parser.re" + { NEWTOKEN(PSI_T_TO_INT); goto start; } +#line 6911 "src/parser.c" +yy430: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'E': - case 'F': - case 'G': - case 'H': + case 'e': goto yy463; + default: goto yy58; + } +yy431: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': + case 'i': goto yy464; + default: goto yy58; + } +yy432: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'F': + case 'f': goto yy465; + default: goto yy58; + } +yy433: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case '_': goto yy467; + default: goto yy58; + } +yy434: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case '_': goto yy468; + default: goto yy58; + } +yy435: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case '_': goto yy469; + default: goto yy58; + } +yy436: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy451; + case 't': goto yy470; + default: goto yy58; } -yy451: -#line 414 "src/parser.re" - { NEWTOKEN(PSI_T_TO_ARRAY); goto start; } -#line 7663 "src/parser.c" -yy452: - yyaccept = 67; - yych = *(P->mrk = ++P->cur); +yy437: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': case 'E': - case 'F': + case 'e': goto yy472; + default: goto yy58; + } +yy438: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'G': - case 'H': - case 'I': - case 'J': + case 'g': goto yy473; + default: goto yy58; + } +yy439: + yyaccept = 53; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy440; + case '\\': goto yy131; + default: goto yy57; + } +yy440: +#line 412 "src/parser.re" + { NEWTOKEN(PSI_T_BOOLVAL); goto start; } +#line 7055 "src/parser.c" +yy441: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'E': + case 'e': goto yy475; + default: goto yy58; + } +yy442: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy453; + case 'k': goto yy477; + default: goto yy58; } -yy453: -#line 417 "src/parser.re" - { NEWTOKEN(PSI_T_TO_FLOAT); goto start; } -#line 7737 "src/parser.c" -yy454: +yy443: + yyaccept = 54; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy444; + case '\\': goto yy131; + default: goto yy57; + } +yy444: +#line 359 "src/parser.re" + { NEWTOKEN(PSI_T_DEFINED); goto start; } +#line 7146 "src/parser.c" +yy445: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case 'T': - case 't': goto yy466; - default: goto yy55; + case 'L': + case 'l': goto yy479; + default: goto yy58; } -yy455: +yy446: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case 'G': - case 'g': goto yy468; - default: goto yy55; + case 'N': + case 'n': goto yy481; + default: goto yy58; + } +yy447: + yyaccept = 55; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy448; + case '\\': goto yy131; + case '_': goto yy483; + default: goto yy57; + } +yy448: +#line 363 "src/parser.re" + { NEWTOKEN(PSI_T_INCLUDE); goto start; } +#line 7238 "src/parser.c" +yy449: + yyaccept = 56; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy450; + case '\\': goto yy131; + default: goto yy57; + } +yy450: +#line 380 "src/parser.re" + { NEWTOKEN(PSI_T_INT16); goto start; } +#line 7313 "src/parser.c" +yy451: + yyaccept = 57; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy452; + case '\\': goto yy131; + default: goto yy57; + } +yy452: +#line 382 "src/parser.re" + { NEWTOKEN(PSI_T_INT32); goto start; } +#line 7388 "src/parser.c" +yy453: + yyaccept = 58; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy454; + case '\\': goto yy131; + default: goto yy57; + } +yy454: +#line 384 "src/parser.re" + { NEWTOKEN(PSI_T_INT64); goto start; } +#line 7463 "src/parser.c" +yy455: + yyaccept = 59; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy456; + case '\\': goto yy131; + default: goto yy57; } yy456: - yyaccept = 68; - yych = *(P->mrk = ++P->cur); +#line 409 "src/parser.re" + { NEWTOKEN(PSI_T_PATHVAL); goto start; } +#line 7538 "src/parser.c" +yy457: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy457; + case 's': goto yy484; + default: goto yy58; } -yy457: -#line 376 "src/parser.re" - { NEWTOKEN(PSI_T_UINT16); goto start; } -#line 7827 "src/parser.c" yy458: - yyaccept = 69; - yych = *(P->mrk = ++P->cur); + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy459; + case 'e': goto yy485; + default: goto yy58; } yy459: -#line 378 "src/parser.re" - { NEWTOKEN(PSI_T_UINT32); goto start; } -#line 7901 "src/parser.c" -yy460: - yyaccept = 70; - yych = *(P->mrk = ++P->cur); + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy461; + case 'y': goto yy486; + default: goto yy58; + } +yy460: + yyaccept = 60; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy461; + case '\\': goto yy131; + default: goto yy57; } yy461: -#line 380 "src/parser.re" - { NEWTOKEN(PSI_T_UINT64); goto start; } -#line 7975 "src/parser.c" +#line 423 "src/parser.re" + { NEWTOKEN(PSI_T_TO_BOOL); goto start; } +#line 7637 "src/parser.c" yy462: - yyaccept = 71; - yych = *(P->mrk = ++P->cur); + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy463; + case 't': goto yy488; + default: goto yy58; } yy463: -#line 381 "src/parser.re" - { NEWTOKEN(PSI_T_UNSIGNED); goto start; } -#line 8049 "src/parser.c" + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'C': + case 'c': goto yy490; + default: goto yy58; + } yy464: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { - case 'R': - case 'r': goto yy470; - default: goto yy55; + case 'N': + case 'n': goto yy491; + default: goto yy58; } yy465: + yyaccept = 61; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy466; + case '\\': goto yy131; + default: goto yy57; + } +yy466: +#line 394 "src/parser.re" + { NEWTOKEN(PSI_T_TYPEDEF); goto start; } +#line 7736 "src/parser.c" +yy467: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'T': - case 't': goto yy471; - default: goto yy55; + case 't': goto yy492; + default: goto yy58; } -yy466: - yyaccept = 72; - yych = *(P->mrk = ++P->cur); +yy468: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'T': + case 't': goto yy494; + default: goto yy58; + } +yy469: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'T': + case 't': goto yy496; + default: goto yy58; + } +yy470: + yyaccept = 62; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy471; + case '\\': goto yy131; + default: goto yy57; + } +yy471: +#line 379 "src/parser.re" + { NEWTOKEN(PSI_T_UINT8); goto start; } +#line 7835 "src/parser.c" +yy472: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': + case 'd': goto yy498; + default: goto yy58; + } +yy473: + yyaccept = 63; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy474; + case '\\': goto yy131; + default: goto yy57; + } +yy474: +#line 361 "src/parser.re" + { NEWTOKEN(PSI_T_WARNING); goto start; } +#line 7918 "src/parser.c" +yy475: + yyaccept = 64; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy476; + case '\\': goto yy131; + default: goto yy57; + } +yy476: +#line 369 "src/parser.re" + { NEWTOKEN(PSI_T_CALLABLE); goto start; } +#line 7993 "src/parser.c" +yy477: + yyaccept = 65; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy478; + case '\\': goto yy131; + default: goto yy57; + } +yy478: +#line 391 "src/parser.re" + { NEWTOKEN(PSI_T_CALLBACK); goto start; } +#line 8068 "src/parser.c" +yy479: + yyaccept = 66; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy480; + case '\\': goto yy131; + default: goto yy57; + } +yy480: +#line 411 "src/parser.re" + { NEWTOKEN(PSI_T_FLOATVAL); goto start; } +#line 8143 "src/parser.c" +yy481: + yyaccept = 67; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy482; + case '\\': goto yy131; + default: goto yy57; + } +yy482: +#line 393 "src/parser.re" + { NEWTOKEN(PSI_T_FUNCTION); goto start; } +#line 8218 "src/parser.c" +yy483: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'N': - case 'O': - case 'P': - case 'Q': + case 'n': goto yy500; + default: goto yy58; + } +yy484: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'E': + case 'e': goto yy501; + default: goto yy58; + } +yy485: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'R': - case 'S': + case 'r': goto yy502; + default: goto yy58; + } +yy486: + yyaccept = 68; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy487; + case '\\': goto yy131; + default: goto yy57; + } +yy487: +#line 419 "src/parser.re" + { NEWTOKEN(PSI_T_TO_ARRAY); goto start; } +#line 8317 "src/parser.c" +yy488: + yyaccept = 69; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy489; + case '\\': goto yy131; + default: goto yy57; + } +yy489: +#line 422 "src/parser.re" + { NEWTOKEN(PSI_T_TO_FLOAT); goto start; } +#line 8392 "src/parser.c" +yy490: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy467; + case 't': goto yy503; + default: goto yy58; } -yy467: -#line 413 "src/parser.re" - { NEWTOKEN(PSI_T_TO_OBJECT); goto start; } -#line 8139 "src/parser.c" -yy468: +yy491: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'G': + case 'g': goto yy505; + default: goto yy58; + } +yy492: + yyaccept = 70; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy493; + case '\\': goto yy131; + default: goto yy57; + } +yy493: +#line 381 "src/parser.re" + { NEWTOKEN(PSI_T_UINT16); goto start; } +#line 8483 "src/parser.c" +yy494: + yyaccept = 71; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy495; + case '\\': goto yy131; + default: goto yy57; + } +yy495: +#line 383 "src/parser.re" + { NEWTOKEN(PSI_T_UINT32); goto start; } +#line 8558 "src/parser.c" +yy496: + yyaccept = 72; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy497; + case '\\': goto yy131; + default: goto yy57; + } +yy497: +#line 385 "src/parser.re" + { NEWTOKEN(PSI_T_UINT64); goto start; } +#line 8633 "src/parser.c" +yy498: yyaccept = 73; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy499; + case '\\': goto yy131; + default: goto yy57; + } +yy499: +#line 386 "src/parser.re" + { NEWTOKEN(PSI_T_UNSIGNED); goto start; } +#line 8708 "src/parser.c" +yy500: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': + case 'e': goto yy507; + default: goto yy58; + } +yy501: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy469; + case 'r': goto yy508; + default: goto yy58; } -yy469: -#line 415 "src/parser.re" - { NEWTOKEN(PSI_T_TO_STRING); goto start; } -#line 8213 "src/parser.c" -yy470: +yy502: yyaccept = 4; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); switch (yych) { case 'T': - case 't': goto yy473; - default: goto yy55; + case 't': goto yy509; + default: goto yy58; } -yy471: +yy503: yyaccept = 74; - yych = *(P->mrk = ++P->cur); + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy504; + case '\\': goto yy131; + default: goto yy57; + } +yy504: +#line 418 "src/parser.re" + { NEWTOKEN(PSI_T_TO_OBJECT); goto start; } +#line 8807 "src/parser.c" +yy505: + yyaccept = 75; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy506; + case '\\': goto yy131; + default: goto yy57; + } +yy506: +#line 420 "src/parser.re" + { NEWTOKEN(PSI_T_TO_STRING); goto start; } +#line 8882 "src/parser.c" +yy507: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy472; + case 'x': goto yy511; + default: goto yy58; } -yy472: -#line 397 "src/parser.re" +yy508: + yyaccept = 4; + yych = *(mrk = ++cur); + switch (yych) { + case 'T': + case 't': goto yy512; + default: goto yy58; + } +yy509: + yyaccept = 76; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy510; + case '\\': goto yy131; + default: goto yy57; + } +yy510: +#line 402 "src/parser.re" { NEWTOKEN(PSI_T_PRE_ASSERT); goto start; } -#line 8295 "src/parser.c" -yy473: - yyaccept = 75; - yych = *(P->mrk = ++P->cur); +#line 8973 "src/parser.c" +yy511: + yyaccept = 4; + yych = *(mrk = ++cur); switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy54; - case '\\': goto yy115; - default: goto yy474; - } -yy474: -#line 398 "src/parser.re" + case 't': goto yy514; + default: goto yy58; + } +yy512: + yyaccept = 77; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy513; + case '\\': goto yy131; + default: goto yy57; + } +yy513: +#line 403 "src/parser.re" { NEWTOKEN(PSI_T_POST_ASSERT); goto start; } -#line 8369 "src/parser.c" +#line 9056 "src/parser.c" +yy514: + yyaccept = 78; + yych = *(mrk = ++cur); + switch (yych) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case ' ': + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case 0x7F: goto yy515; + case '\\': goto yy131; + default: goto yy57; + } +yy515: +#line 364 "src/parser.re" + { NEWTOKEN(PSI_T_INCLUDE_NEXT); goto start; } +#line 9131 "src/parser.c" } -#line 428 "src/parser.re" +#line 436 "src/parser.re" comment: ; -#line 8376 "src/parser.c" +#line 9138 "src/parser.c" { unsigned char yych; - if ((P->lim - P->cur) < 2) if (P->cur >= P->lim) goto done;; - yych = *P->cur; + if ((lim - cur) < 2) if (cur >= lim) goto done;; + yych = *cur; switch (yych) { case '\n': - case '\r': goto yy479; - case '*': goto yy481; - default: goto yy477; + case '\r': goto yy520; + case '*': goto yy522; + default: goto yy518; } -yy477: - ++P->cur; -yy478: -#line 435 "src/parser.re" +yy518: + ++cur; +yy519: +#line 443 "src/parser.re" { goto comment; } -#line 8392 "src/parser.c" -yy479: - ++P->cur; -#line 433 "src/parser.re" +#line 9154 "src/parser.c" +yy520: + ++cur; +#line 441 "src/parser.re" { NEWLINE(); goto comment; } -#line 8397 "src/parser.c" -yy481: - yych = *++P->cur; +#line 9159 "src/parser.c" +yy522: + yych = *++cur; switch (yych) { - case '/': goto yy482; - default: goto yy478; + case '/': goto yy523; + default: goto yy519; } -yy482: - ++P->cur; -#line 434 "src/parser.re" +yy523: + ++cur; +#line 442 "src/parser.re" { NEWTOKEN(PSI_T_COMMENT); goto start; } -#line 8408 "src/parser.c" +#line 9170 "src/parser.c" } -#line 437 "src/parser.re" +#line 445 "src/parser.re" comment_sl: ; -#line 8415 "src/parser.c" +#line 9177 "src/parser.c" { unsigned char yych; - if (P->lim <= P->cur) if (P->cur >= P->lim) goto done;; - yych = *P->cur; + if (lim <= cur) if (cur >= lim) goto done;; + yych = *cur; switch (yych) { case '\n': - case '\r': goto yy488; - default: goto yy486; + case '\r': goto yy529; + default: goto yy527; } -yy486: - ++P->cur; -#line 443 "src/parser.re" +yy527: + ++cur; +#line 451 "src/parser.re" { goto comment_sl; } -#line 8429 "src/parser.c" -yy488: - ++P->cur; -#line 442 "src/parser.re" +#line 9191 "src/parser.c" +yy529: + ++cur; +#line 450 "src/parser.re" { NEWTOKEN(PSI_T_COMMENT); NEWLINE(); goto start; } -#line 8434 "src/parser.c" +#line 9196 "src/parser.c" } -#line 445 "src/parser.re" +#line 453 "src/parser.re" -error: +error: ; + + P->error(PSI_DATA(P), token, PSI_WARNING, "PSI syntax error: unexpected input (%d) '%.*s' at col %tu", + token->type, token->size, token->text, tok - eol + 1); psi_plist_free(tokens); return NULL; + done: + + PSI_DEBUG_PRINT(P, "PSI: EOF cur=%p lim=%p\n", cur, lim); + return tokens; } diff --git a/src/parser.h b/src/parser.h index 07dc563..b05d185 100644 --- a/src/parser.h +++ b/src/parser.h @@ -26,38 +26,51 @@ #ifndef PSI_PARSER_H #define PSI_PARSER_H +struct psi_parser; + +#include "parser_proc.h" +#undef YYDEBUG + +#include "data.h" #include "token.h" #include "types.h" -#include "data.h" #include "cpp.h" +struct psi_cpp; + struct psi_parser { PSI_DATA_MEMBERS; - token_t num; - unsigned line, col; - char *cur, *tok, *lim, *ctx, *mrk; - - /* internals */ - void *proc; - - struct psi_cpp_data cpp; - struct { - char *buffer; - size_t length; - } input; + + struct psi_cpp *preproc; +}; + +struct psi_parser_input { + size_t length; + char *file; + unsigned lines; + char buffer[1]; +}; + +struct psi_parser_data { + enum { + PSI_PARSER_DATA_SELF, + PSI_PARSER_DATA_CPP + } type; + union { + struct psi_parser *parser; + struct psi_cpp *cpp; + } data; }; struct psi_parser *psi_parser_init(struct psi_parser *P, psi_error_cb error, unsigned flags); -bool psi_parser_open_file(struct psi_parser *P, const char *filename); -bool psi_parser_open_string(struct psi_parser *P, const char *string, size_t length); -struct psi_plist *psi_parser_scan(struct psi_parser *P); -void psi_parser_parse(struct psi_parser *P); +struct psi_parser_input *psi_parser_open_file(struct psi_parser *P, const char *filename, bool report_errors); +struct psi_parser_input *psi_parser_open_string(struct psi_parser *P, const char *string, size_t length); +struct psi_plist *psi_parser_scan(struct psi_parser *P, struct psi_parser_input *I); +struct psi_plist *psi_parser_preprocess(struct psi_parser *P, struct psi_plist *tokens); +bool psi_parser_process(struct psi_parser *P, struct psi_plist *tokens, size_t *processed); +bool psi_parser_parse(struct psi_parser *P, struct psi_parser_input *I); void psi_parser_dtor(struct psi_parser *P); void psi_parser_free(struct psi_parser **P); -void *psi_parser_proc_init(void); -void psi_parser_proc_free(void **parser_proc); -void psi_parser_proc_parse(void *parser_proc, token_t r, struct psi_token *token, struct psi_parser *parser); -void psi_parser_proc_trace(FILE *out, char *prefix); #endif diff --git a/src/parser.re b/src/parser.re index 707d201..cb17b6e 100644 --- a/src/parser.re +++ b/src/parser.re @@ -34,36 +34,6 @@ #ifndef YYMAXFILL # define YYMAXFILL 256 #endif -/*!re2c - -re2c:indent:top = 2; -re2c:define:YYCTYPE = "unsigned char"; -re2c:define:YYCURSOR = P->cur; -re2c:define:YYLIMIT = P->lim; -re2c:define:YYMARKER = P->mrk; -re2c:define:YYFILL = "if (P->cur >= P->lim) goto done;"; -re2c:yyfill:parameter = 0; - -B = [^a-zA-Z0-9_]; -W = [a-zA-Z0-9_]; -SP = [ \t]; -EOL = [\r\n]; -NAME = [a-zA-Z_]W*; -NSNAME = (NAME)? ("\\" NAME)+; -DOLLAR_NAME = '$' W+; -QUOTED_STRING = "\"" ([^"])+ "\""; -NUMBER = [+-]? [0-9]* "."? [0-9]+ ([eE] [+-]? [0-9]+)?; - -*/ - -static void free_cpp_def(zval *p) -{ - if (Z_TYPE_P(p) == IS_PTR) { - psi_cpp_macro_decl_free((void *) &Z_PTR_P(p)); - } else if (Z_REFCOUNTED_P(p)) { - zval_ptr_dtor(p); - } -} struct psi_parser *psi_parser_init(struct psi_parser *P, psi_error_cb error, unsigned flags) { @@ -74,104 +44,85 @@ struct psi_parser *psi_parser_init(struct psi_parser *P, psi_error_cb error, uns psi_data_ctor_with_dtors(PSI_DATA(P), error, flags); - P->col = 1; - P->line = 1; - P->proc = psi_parser_proc_init(); + P->preproc = psi_cpp_init(P); - zend_hash_init(&P->cpp.defs, 0, NULL, free_cpp_def, 1); - zval tmp; - ZVAL_ARR(&tmp, &P->cpp.defs); - add_assoc_string(&tmp, "PHP_OS", PHP_OS); - - if (flags & PSI_DEBUG) { - psi_parser_proc_trace(stderr, "PSI> "); - } + psi_cpp_load_defaults(P->preproc); return P; } -void psi_parser_reset(struct psi_parser *P) -{ - P->cur = P->tok = P->mrk = P->input.buffer; - P->lim = P->input.buffer + P->input.length; -} - -bool psi_parser_open_file(struct psi_parser *P, const char *filename) +struct psi_parser_input *psi_parser_open_file(struct psi_parser *P, const char *filename, bool report_errors) { struct stat sb; FILE *fp; - char *fb; + struct psi_parser_input *fb; if (stat(filename, &sb)) { - P->error(PSI_DATA(P), NULL, PSI_WARNING, - "Could not stat '%s': %s", - filename, strerror(errno)); - return false; + if (report_errors) { + P->error(PSI_DATA(P), NULL, PSI_WARNING, + "Could not stat '%s': %s", + filename, strerror(errno)); + } + return NULL; } - if (!(fb = malloc(sb.st_size + YYMAXFILL))) { - P->error(PSI_DATA(P), NULL, PSI_WARNING, - "Could not allocate %zu bytes for reading '%s': %s", - sb.st_size + YYMAXFILL, filename, strerror(errno)); - return false; + if (!(fb = malloc(sizeof(*fb) + strlen(filename) + 1 + sb.st_size + YYMAXFILL))) { + if (report_errors) { + P->error(PSI_DATA(P), NULL, PSI_WARNING, + "Could not allocate %zu bytes for reading '%s': %s", + sb.st_size + YYMAXFILL, filename, strerror(errno)); + } + return NULL; } if (!(fp = fopen(filename, "r"))) { free(fb); - P->error(PSI_DATA(P), NULL, PSI_WARNING, - "Could not open '%s' for reading: %s", - filename, strerror(errno)); - return false; + if (report_errors) { + P->error(PSI_DATA(P), NULL, PSI_WARNING, + "Could not open '%s' for reading: %s", + filename, strerror(errno)); + } + return NULL; } - if (sb.st_size != fread(fb, 1, sb.st_size, fp)) { + if (sb.st_size != fread(fb->buffer, 1, sb.st_size, fp)) { free(fb); fclose(fp); - P->error(PSI_DATA(P), NULL, PSI_WARNING, - "Could not read %zu bytes from '%s': %s", - sb.st_size + YYMAXFILL, filename, strerror(errno)); - return false; - } - memset(fb + sb.st_size, 0, YYMAXFILL); - - if (P->input.buffer) { - free(P->input.buffer); + if (report_errors) { + P->error(PSI_DATA(P), NULL, PSI_WARNING, + "Could not read %zu bytes from '%s': %s", + sb.st_size + YYMAXFILL, filename, strerror(errno)); + } + return NULL; } - P->input.buffer = fb; - P->input.length = sb.st_size; - - P->file.fn = strdup(filename); - psi_parser_reset(P); + memset(fb->buffer + sb.st_size, 0, YYMAXFILL); + fb->length = sb.st_size; + fb->file = &fb->buffer[sb.st_size + YYMAXFILL]; + memcpy(fb->file, filename, strlen(filename) + 1); - return true; + return fb; } -bool psi_parser_open_string(struct psi_parser *P, const char *string, size_t length) +struct psi_parser_input *psi_parser_open_string(struct psi_parser *P, const char *string, size_t length) { - char *sb; + struct psi_parser_input *sb; - if (!(sb = malloc(length + YYMAXFILL))) { + if (!(sb = malloc(sizeof(*sb) + sizeof("") + length + YYMAXFILL))) { P->error(PSI_DATA(P), NULL, PSI_WARNING, "Could not allocate %zu bytes: %s", length + YYMAXFILL, strerror(errno)); - return false; - } - - memcpy(sb, string, length); - memset(sb + length, 0, YYMAXFILL); - - if (P->input.buffer) { - free(P->input.buffer); + return NULL; } - P->input.buffer = sb; - P->input.length = length; - P->file.fn = strdup(""); + memcpy(sb->buffer, string, length); + memset(sb->buffer + length, 0, YYMAXFILL); - psi_parser_reset(P); + sb->length = length; + sb->file = &sb->buffer[length + YYMAXFILL]; + memcpy(sb->file, "", sizeof("")); - return true; + return sb; } #if 0 @@ -230,42 +181,58 @@ static void psi_parser_register_constants(struct psi_parser *P) } #endif -void psi_parser_parse(struct psi_parser *P) +struct psi_plist *psi_parser_preprocess(struct psi_parser *P, struct psi_plist *tokens) { - size_t i = 0; - struct psi_token *T; - - P->cpp.tokens = psi_parser_scan(P); + if (psi_cpp_process(P->preproc, &tokens)) { + return tokens; + } + return NULL; +} - psi_cpp_preprocess(P, &P->cpp); +bool psi_parser_process(struct psi_parser *P, struct psi_plist *tokens, size_t *processed) +{ + if (psi_plist_count(tokens)) { + int rc; - if (psi_plist_count(P->cpp.tokens)) { - while (psi_plist_get(P->cpp.tokens, i++, &T)) { - if (P->flags & PSI_DEBUG) { - fprintf(stderr, "PSI> "); - psi_token_dump(2, T); - } - psi_parser_proc_parse(P->proc, T->type, T, P); + if (P->flags & PSI_DEBUG) { + psi_parser_proc_debug = 1; } - psi_parser_proc_parse(P->proc, 0, NULL, P); + rc = psi_parser_proc_parse(P, tokens, processed); + if (P->flags & PSI_DEBUG) { + psi_parser_proc_debug = 0; + } + return rc == 0; } - - psi_plist_free(P->cpp.tokens); - P->cpp.tokens = NULL; + return true; } -void psi_parser_dtor(struct psi_parser *P) +bool psi_parser_parse(struct psi_parser *P, struct psi_parser_input *I) { - psi_parser_proc_free(&P->proc); + struct psi_plist *scanned, *preproc; + size_t processed = 0; - if (P->input.buffer) { - free(P->input.buffer); - P->input.buffer = NULL; + if (!(scanned = psi_parser_scan(P, I))) { + return false; } - psi_data_dtor(PSI_DATA(P)); + if (!(preproc = psi_parser_preprocess(P, scanned))) { + psi_plist_free(scanned); + return false; + } + + if (!psi_parser_process(P, preproc, &processed)) { + psi_plist_free(preproc); + return false; + } + + psi_plist_free(preproc); + return true; +} - zend_hash_destroy(&P->cpp.defs); +void psi_parser_dtor(struct psi_parser *P) +{ + psi_cpp_free(&P->preproc); + psi_data_dtor(PSI_DATA(P)); memset(P, 0, sizeof(*P)); } @@ -280,37 +247,72 @@ void psi_parser_free(struct psi_parser **P) } #define NEWLINE() \ - P->col = 1; \ - ++P->line + eol = cur; \ + ++I->lines #define NEWTOKEN(t) \ - P->num = t; \ - token = psi_token_alloc(P); \ + token = psi_token_init(t, tok, cur - tok, tok - eol + 1, I->lines, I->file); \ tokens = psi_plist_add(tokens, &token); \ - P->col += P->cur - P->tok; \ if (P->flags & PSI_DEBUG) { \ fprintf(stderr, "PSI< "); \ psi_token_dump(2, token); \ - } \ - token = NULL + } -struct psi_plist *psi_parser_scan(struct psi_parser *P) +struct psi_plist *psi_parser_scan(struct psi_parser *P, struct psi_parser_input *I) { struct psi_plist *tokens; struct psi_token *token; + const char *tok, *cur, *lim, *mrk, *eol; - if (!P->cur) { - return NULL; - } - - tokens = psi_plist_init(NULL); + tok = mrk = eol = cur = I->buffer; + lim = I->buffer + I->length; + I->lines = 1; + tokens = psi_plist_init((void (*)(void *)) psi_token_free); start: ; - P->tok = P->cur; + tok = cur; /*!re2c + re2c:indent:top = 2; + re2c:define:YYCTYPE = "unsigned char"; + re2c:define:YYCURSOR = cur; + re2c:define:YYLIMIT = lim; + re2c:define:YYMARKER = mrk; + re2c:define:YYFILL = "if (cur >= lim) goto done;"; + re2c:yyfill:parameter = 0; + + W = [a-zA-Z0-9_\x80-\xff]; + SP = [ \t]; + EOL = [\r\n]; + NAME = [a-zA-Z_\x80-\xff]W*; + NSNAME = (NAME)? ("\\" NAME)+; + DOLLAR_NAME = '$' W+; + QUOTED_STRING = "L"? "\"" ([^"])+ "\""; + QUOTED_CHAR = "L"? "'" ([^']+ "\\'"?)+ "'"; + CPP_HEADER = "<" [-._/a-zA-Z0-9]+ ">"; + + DEC_CONST = [1-9] [0-9]*; + OCT_CONST = "0" [0-7]*; + HEX_CONST = '0x' [0-9a-fA-F]+; + INT_SUFFIX = 'u'('l' 'l'? )? | 'l'('l'? 'u')?; + INT_NUMBER = (DEC_CONST | OCT_CONST | HEX_CONST) INT_SUFFIX?; + + FLT_HEX_FRAC = [0-9a-fA-F]*; + FLT_HEX_SIG = HEX_CONST ("." FLT_HEX_FRAC)?; + FLT_HEX_EXPO = 'p' [+-]? [0-9]+; + FLT_HEX_CONST = FLT_HEX_SIG FLT_HEX_EXPO; + FLT_DEC_NUM = "0" | DEC_CONST; + FLT_DEC_FRAC = [0-9]*; + FLT_DEC_SIG = FLT_DEC_NUM ("." FLT_DEC_FRAC)?; + FLT_DEC_EXPO = 'e' [+-]? [0-9]+; + FLT_DEC_CONST = (FLT_DEC_SIG FLT_DEC_EXPO) | (FLT_DEC_NUM? "." FLT_DEC_FRAC); + FLT_SUFFIX = 'f' | 'l' | ('d' ('f' | 'd' | 'l')); + FLT_NUMBER = (FLT_DEC_CONST | FLT_HEX_CONST) FLT_SUFFIX?; + + NUMBER = [+-]? (INT_NUMBER | FLT_NUMBER); + "/*" { goto comment; } "//" { goto comment_sl; } "#" { NEWTOKEN(PSI_T_HASH); goto start; } @@ -345,6 +347,7 @@ struct psi_plist *psi_parser_scan(struct psi_parser *P) ">=" { NEWTOKEN(PSI_T_CMP_GE); goto start; } "<" { NEWTOKEN(PSI_T_LCHEVR); goto start; } ">" { NEWTOKEN(PSI_T_RCHEVR); goto start; } + "." { NEWTOKEN(PSI_T_PERIOD); goto start; } "..." { NEWTOKEN(PSI_T_ELLIPSIS); goto start; } 'IF' { NEWTOKEN(PSI_T_IF); goto start; } 'IFDEF' { NEWTOKEN(PSI_T_IFDEF); goto start; } @@ -357,6 +360,8 @@ struct psi_plist *psi_parser_scan(struct psi_parser *P) 'UNDEF' { NEWTOKEN(PSI_T_UNDEF); goto start; } 'WARNING' { NEWTOKEN(PSI_T_WARNING); goto start; } 'ERROR' { NEWTOKEN(PSI_T_ERROR); goto start; } + 'INCLUDE' { NEWTOKEN(PSI_T_INCLUDE); goto start; } + 'INCLUDE_NEXT' { NEWTOKEN(PSI_T_INCLUDE_NEXT); goto start; } 'TRUE' { NEWTOKEN(PSI_T_TRUE); goto start; } 'FALSE' { NEWTOKEN(PSI_T_FALSE); goto start; } 'NULL' { NEWTOKEN(PSI_T_NULL); goto start; } @@ -421,9 +426,12 @@ struct psi_plist *psi_parser_scan(struct psi_parser *P) NSNAME { NEWTOKEN(PSI_T_NSNAME); goto start; } DOLLAR_NAME { NEWTOKEN(PSI_T_DOLLAR_NAME); goto start; } QUOTED_STRING { NEWTOKEN(PSI_T_QUOTED_STRING); goto start; } + QUOTED_CHAR { NEWTOKEN(PSI_T_QUOTED_CHAR); goto start; } + CPP_HEADER { NEWTOKEN(PSI_T_CPP_HEADER); goto start; } EOL { NEWTOKEN(PSI_T_EOL); NEWLINE(); goto start; } SP+ { NEWTOKEN(PSI_T_WHITESPACE); goto start; } - * { goto error; } + [^] { NEWTOKEN(-2); goto error; } + * { NEWTOKEN(-1); goto error; } */ @@ -443,9 +451,16 @@ struct psi_plist *psi_parser_scan(struct psi_parser *P) * { goto comment_sl; } */ -error: +error: ; + + P->error(PSI_DATA(P), token, PSI_WARNING, "PSI syntax error: unexpected input (%d) '%.*s' at col %tu", + token->type, token->size, token->text, tok - eol + 1); psi_plist_free(tokens); return NULL; + done: + + PSI_DEBUG_PRINT(P, "PSI: EOF cur=%p lim=%p\n", cur, lim); + return tokens; } diff --git a/src/parser_def.h b/src/parser_def.h deleted file mode 100644 index 0139748..0000000 --- a/src/parser_def.h +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - Copyright (c) 2017, Michael Wallner . - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*******************************************************************************/ - -#ifndef PSI_PARSER_INC -#define PSI_PARSER_INC - -#define CONCAT2(x,y) x##y -#define CONCAT1(x,y) CONCAT2(x,y) -#define COUNTED(x) CONCAT1(parse_ ##x## _, __LINE__) - -#define TOKEN_PREFIX PSI_T -#define TOKEN_STRUCT struct psi_token * - -#ifdef GENERATE -# define DEF(dn, dv) dn dv -# define PASS(nt, rule) nt ::= rule. -# define PARSE(nt, rule) nt ::= rule. -# define PARSE_NAMED(nt, nt_name, rule) NAMED(nt, nt_name) ::= rule. -# define PARSE_TYPED(nt, nt_name, rule) TYPED(nt, nt_name) ::= rule. -# define TOKEN(t) t -# define NAMED(t, name) t(name) -# define TYPED(t, name) t(name) -# define TOKEN_TYPE(token, type_) %type token {type_} -# define TOKEN_DTOR(token, dtor) %destructor token {dtor} -# define T(token) token -# define TOKEN_CLASS(type, tokens) DEF(%token_class, type##_token tokens .) -#else -# ifndef TEST -# include "parser.h" -# include "plist.h" -# endif -# define DEF(dn, dv) -# define PASS(nt, rule) \ - static void COUNTED(nt) (struct psi_parser *P) { \ - (void) #rule; \ - } -# define PARSE(nt, rule) \ - static void COUNTED(nt) (struct psi_parser *P rule) -# define PARSE_NAMED(nt, nt_name, rule) \ - static void COUNTED(nt) (struct psi_parser *P NAMED(nt, nt_name) rule) -# define PARSE_TYPED(nt, nt_name, rule) \ - static void COUNTED(nt) (struct psi_parser *P TYPED(nt, nt_name) rule) -# define TOKEN(t) -# define NAMED(t, name) , struct psi_token *name -# define TYPED(t, name) , TOKEN_TYPE_NAME(t) name -# define TOKEN_TYPE_NAME(token) token##_parse_t -# define TOKEN_TYPE(token, type) typedef type TOKEN_TYPE_NAME(token); -# define TOKEN_DTOR(token, dtor) -# define T(token) CONCAT1(TOKEN_PREFIX, _ ##token ), -# define TOKEN_CLASS(type, tokens) static token_t type##_token[] = { tokens 0 }; -#endif - - -#endif diff --git a/src/parser_proc.c b/src/parser_proc.c index 295c60f..7d785a1 100644 --- a/src/parser_proc.c +++ b/src/parser_proc.c @@ -1,3980 +1,6183 @@ -/* -** 2000-05-29 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** Driver template for the LEMON parser generator. -** -** The "lemon" program processes an LALR(1) input grammar file, then uses -** this template to construct a parser. The "lemon" program inserts text -** at each "%%" line. Also, any "P-a-r-s-e" identifer prefix (without the -** interstitial "-" characters) contained in this template is changed into -** the value of the %name directive from the grammar. Otherwise, the content -** of this template is copied straight through into the generate parser -** source file. -** -** The following is the concatenation of all %include directives from the -** input grammar file: -*/ -#include -/************ Begin %include sections from the grammar ************************/ -#line 1 "src/parser_proc.y" +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Skeleton implementation for Bison GLR parsers in C + + Copyright (C) 2002-2015 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 . */ + +/* 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. */ + +/* C GLR parser skeleton written by Paul Hilfinger. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "glr.c" + +/* Pure parsers. */ +#define YYPURE 1 + + +/* "%code top" blocks. */ +#line 1 "src/parser_proc_grammar.y" /* glr.c:222 */ #include "php_psi_stdinc.h" +#line 54 "src/parser_proc.c" /* glr.c:222 */ + + +/* Substitute the variable and function names. */ +#define yyparse psi_parser_proc_parse +#define yylex psi_parser_proc_lex +#define yyerror psi_parser_proc_error +#define yydebug psi_parser_proc_debug + + +/* First part of user declarations. */ + +#line 66 "src/parser_proc.c" /* glr.c:240 */ + +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif + +#include "parser_proc.h" + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 1 +#endif + +/* Default (constant) value used for initialization for null + right-hand sides. Unlike the standard yacc.c template, here we set + the default value of $$ to a zeroed-out value. Since the default + value is undefined, this behavior is technically correct. */ +static YYSTYPE yyval_default; + +/* Copy the second part of user declarations. */ + +#line 94 "src/parser_proc.c" /* glr.c:263 */ +/* Unqualified %code blocks. */ +#line 5 "src/parser_proc_grammar.y" /* glr.c:264 */ + #include #include #include "plist.h" #include "parser.h" +#define YYDEBUG 1 -/* rename lemon symbols, works better than DEF(%name) */ -#define ParseAlloc psi_parser_proc_init_ex -#define Parse psi_parser_proc_parse -#define ParseTrace psi_parser_proc_trace -#define ParseFree psi_parser_proc_free_ex - -/* fwd decls */ -void *ParseAlloc(void *(*mallocProc)(size_t)); -void ParseFree(void *p, void (*freeProc)(void*)); +static int psi_parser_proc_lex(YYSTYPE *u, struct psi_parser *P, struct psi_plist *tokens, size_t *index); +static void psi_parser_proc_error(struct psi_parser *P, struct psi_plist *tokens, size_t *index, const char *msg); -/* wrappers */ -void *psi_parser_proc_init(void) +static inline void psi_parser_proc_add_struct(struct psi_parser *P, struct psi_decl_struct *strct) { - return ParseAlloc(malloc); + assert(strct); + if (!P->structs) { + P->structs = psi_plist_init((psi_plist_dtor) psi_decl_struct_free); + } + P->structs = psi_plist_add(P->structs, &strct); } - -void psi_parser_proc_free(void **parser_proc) +static inline void psi_parser_proc_add_union(struct psi_parser *P, struct psi_decl_union *u) { - if (*parser_proc) { - ParseFree(*parser_proc, free); - *parser_proc = NULL; + assert(u); + if (!P->unions) { + P->unions = psi_plist_init((psi_plist_dtor) psi_decl_union_free); } + P->unions = psi_plist_add(P->unions, &u); } +static inline void psi_parser_proc_add_enum(struct psi_parser *P, struct psi_decl_enum *e) +{ + assert(e); + if (!P->enums) { + P->enums = psi_plist_init((psi_plist_dtor) psi_decl_enum_free); + } + P->enums = psi_plist_add(P->enums, &e); +} +static inline void psi_parser_proc_add_from_typedef(struct psi_parser *P, struct psi_decl_arg *def) +{ + if (def->type->real.def) { + switch (def->type->type) { + case PSI_T_STRUCT: + psi_parser_proc_add_struct(P, def->type->real.strct); + break; + case PSI_T_UNION: + psi_parser_proc_add_union(P, def->type->real.unn); + break; + case PSI_T_ENUM: + psi_parser_proc_add_enum(P, def->type->real.enm); + break; + default: + break; + } + } +} +static inline void psi_parser_proc_add_typedef(struct psi_parser *P, struct psi_decl_arg *def) +{ + assert(def); + if (!P->types) { + P->types = psi_plist_init((psi_plist_dtor) psi_decl_arg_free); + } + P->types = psi_plist_add(P->types, &def); + + psi_parser_proc_add_from_typedef(P, def); +} +static inline void psi_parser_proc_add_const(struct psi_parser *P, struct psi_const *cnst) { + assert(cnst); + if (!P->consts) { + P->consts = psi_plist_init((psi_plist_dtor) psi_const_free); + } + P->consts = psi_plist_add(P->consts, &cnst); + +} +static inline void psi_parser_proc_add_decl(struct psi_parser *P, struct psi_decl *decl) { + assert(decl); + if (!P->decls) { + P->decls = psi_plist_init((psi_plist_dtor) psi_decl_free); + } + P->decls = psi_plist_add(P->decls, &decl); +} +static inline void psi_parser_proc_add_impl(struct psi_parser *P, struct psi_impl *impl) { + assert(impl); + if (!P->impls) { + P->impls = psi_plist_init((psi_plist_dtor) psi_impl_free); + } + P->impls = psi_plist_add(P->impls, &impl); +} + +/* end code */ + +#line 185 "src/parser_proc.c" /* glr.c:264 */ + +#include +#include +#include + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YYFREE +# define YYFREE free +#endif +#ifndef YYMALLOC +# define YYMALLOC malloc +#endif +#ifndef YYREALLOC +# define YYREALLOC realloc +#endif + +#define YYSIZEMAX ((size_t) -1) + +#ifdef __cplusplus + typedef bool yybool; +#else + typedef unsigned char yybool; +#endif +#define yytrue 1 +#define yyfalse 0 + +#ifndef YYSETJMP +# include +# define YYJMP_BUF jmp_buf +# define YYSETJMP(Env) setjmp (Env) +/* Pacify clang. */ +# define YYLONGJMP(Env, Val) (longjmp (Env, Val), YYASSERT (0)) +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif -#line 62 "src/parser_proc.c" -/**************** End of %include directives **********************************/ -/* These constants specify the various numeric values for terminal symbols -** in a format understandable to "makeheaders". This section is blank unless -** "lemon" is run with the "-m" command-line option. -***************** Begin makeheaders token definitions *************************/ -/**************** End makeheaders token definitions ***************************/ - -/* The next sections is a series of control #defines. -** various aspects of the generated parser. -** YYCODETYPE is the data type used to store the integer codes -** that represent terminal and non-terminal symbols. -** "unsigned char" is used if there are fewer than -** 256 symbols. Larger types otherwise. -** YYNOCODE is a number of type YYCODETYPE that is not used for -** any terminal or nonterminal symbol. -** YYFALLBACK If defined, this indicates that one or more tokens -** (also known as: "terminal symbols") have fall-back -** values which should be used if the original symbol -** would not parse. This permits keywords to sometimes -** be used as identifiers, for example. -** YYACTIONTYPE is the data type used for "action codes" - numbers -** that indicate what to do in response to the next -** token. -** ParseTOKENTYPE is the data type used for minor type for terminal -** symbols. Background: A "minor type" is a semantic -** value associated with a terminal or non-terminal -** symbols. For example, for an "ID" terminal symbol, -** the minor type might be the name of the identifier. -** Each non-terminal can have a different minor type. -** Terminal symbols all have the same minor type, though. -** This macros defines the minor type for terminal -** symbols. -** YYMINORTYPE is the data type used for all minor types. -** This is typically a union of many types, one of -** which is ParseTOKENTYPE. The entry in the union -** for terminal symbols is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. If -** zero the stack is dynamically sized using realloc() -** ParseARG_SDECL A static variable declaration for the %extra_argument -** ParseARG_PDECL A parameter declaration for the %extra_argument -** ParseARG_STORE Code to store %extra_argument into yypParser -** ParseARG_FETCH Code to extract %extra_argument from yypParser -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YY_MAX_SHIFT Maximum value for shift actions -** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions -** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions -** YY_MIN_REDUCE Maximum value for reduce actions -** YY_ERROR_ACTION The yy_action[] code for syntax error -** YY_ACCEPT_ACTION The yy_action[] code for accept -** YY_NO_ACTION The yy_action[] code for no-op -*/ -#ifndef INTERFACE -# define INTERFACE 1 +#if defined __GNUC__ && 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 -/************* Begin control #defines *****************************************/ -#define YYCODETYPE unsigned char -#define YYNOCODE 193 -#define YYACTIONTYPE unsigned short int -#define YYWILDCARD 74 -#define ParseTOKENTYPE struct psi_token * -typedef union { - int yyinit; - ParseTOKENTYPE yy0; - struct psi_decl_union* yy15; - struct psi_decl_abi* yy26; - struct psi_impl_arg* yy34; - struct psi_const* yy38; - struct psi_let_calloc* yy45; - struct psi_impl* yy49; - struct psi_impl_func* yy56; - struct psi_number* yy57; - struct psi_let_func* yy67; - bool yy89; - struct psi_let_callback* yy120; - struct psi_cpp_macro_decl* yy134; - struct psi_impl_def_val* yy145; - struct psi_free_exp* yy146; - struct psi_decl_enum_item* yy169; - struct psi_decl_type* yy172; - struct psi_plist* yy179; - struct psi_set_exp* yy180; - struct psi_let_exp* yy200; - struct psi_assert_stmt* yy201; - struct psi_num_exp* yy207; - struct psi_free_stmt* yy220; - struct psi_token** yy238; - struct psi_layout yy239; - struct psi_plist * yy243; - struct psi_impl_type* yy246; - struct psi_decl_var* yy271; - struct psi_cpp_exp* yy274; - struct psi_decl* yy303; - struct psi_let_stmt* yy319; - struct psi_decl_arg* yy320; - struct psi_decl_enum * yy323; - struct psi_decl_struct* yy324; - struct psi_return_stmt* yy342; - struct psi_const_type* yy351; - struct psi_set_stmt* yy358; - struct psi_set_func* yy362; - struct psi_layout* yy369; - struct psi_impl_var* yy370; - unsigned yy382; -} YYMINORTYPE; -#ifndef YYSTACKDEPTH -#define YYSTACKDEPTH 100 +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif -#define ParseARG_SDECL struct psi_parser *P; -#define ParseARG_PDECL ,struct psi_parser *P -#define ParseARG_FETCH struct psi_parser *P = yypParser->P -#define ParseARG_STORE yypParser->P = P -#define YYFALLBACK 1 -#define YYNSTATE 233 -#define YYNRULE 191 -#define YY_MAX_SHIFT 232 -#define YY_MIN_SHIFTREDUCE 385 -#define YY_MAX_SHIFTREDUCE 575 -#define YY_MIN_REDUCE 576 -#define YY_MAX_REDUCE 766 -#define YY_ERROR_ACTION 767 -#define YY_ACCEPT_ACTION 768 -#define YY_NO_ACTION 769 -/************* End control #defines *******************************************/ - -/* Define the yytestcase() macro to be a no-op if is not already defined -** otherwise. -** -** Applications can choose to define yytestcase() in the %include section -** to a macro that can assist in verifying code coverage. For production -** code the yytestcase() macro should be turned off. But it is useful -** for testing. -*/ -#ifndef yytestcase -# define yytestcase(X) + + +#ifndef YYASSERT +# define YYASSERT(Condition) ((void) ((Condition) || (abort (), 0))) #endif +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 129 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 2029 -/* Next are the tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N <= YY_MAX_SHIFT Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then -** and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE. -** -** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE -** and YY_MAX_REDUCE -** -** N == YY_ERROR_ACTION A syntax error has occurred. -** -** N == YY_ACCEPT_ACTION The parser accepts its input. -** -** N == YY_NO_ACTION No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as either: -** -** (A) N = yy_action[ yy_shift_ofst[S] + X ] -** (B) N = yy_default[S] -** -** The (A) formula is preferred. The B formula is used instead if: -** (1) The yy_shift_ofst[S]+X value is out of range, or -** (2) yy_lookahead[yy_shift_ofst[S]+X] is not equal to X, or -** (3) yy_shift_ofst[S] equal YY_SHIFT_USE_DFLT. -** (Implementation note: YY_SHIFT_USE_DFLT is chosen so that -** YY_SHIFT_USE_DFLT+X will be out of range for all possible lookaheads X. -** Hence only tests (1) and (2) need to be evaluated.) -** -** The formulas above are for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -** -*********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1132) -static const YYACTIONTYPE yy_action[] = { - /* 0 */ 482, 497, 520, 497, 497, 497, 497, 497, 497, 497, - /* 10 */ 497, 497, 497, 104, 525, 519, 189, 136, 565, 519, - /* 20 */ 521, 114, 17, 529, 531, 28, 28, 568, 25, 25, - /* 30 */ 510, 127, 42, 52, 11, 10, 70, 104, 28, 28, - /* 40 */ 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - /* 50 */ 142, 568, 25, 25, 50, 94, 42, 52, 11, 10, - /* 60 */ 70, 568, 511, 501, 505, 505, 505, 505, 505, 438, - /* 70 */ 174, 59, 30, 30, 30, 30, 30, 30, 30, 30, - /* 80 */ 30, 30, 30, 30, 30, 29, 51, 30, 30, 171, - /* 90 */ 2, 101, 100, 99, 499, 436, 158, 37, 401, 401, - /* 100 */ 584, 585, 478, 92, 77, 75, 74, 482, 497, 226, - /* 110 */ 497, 497, 497, 497, 497, 497, 497, 497, 497, 497, - /* 120 */ 120, 104, 526, 519, 144, 504, 166, 519, 441, 441, - /* 130 */ 441, 441, 559, 28, 28, 568, 166, 166, 166, 166, - /* 140 */ 166, 166, 166, 218, 493, 81, 28, 28, 173, 173, - /* 150 */ 173, 173, 173, 173, 173, 173, 173, 173, 392, 146, - /* 160 */ 485, 78, 94, 437, 440, 482, 497, 464, 497, 497, - /* 170 */ 497, 497, 497, 497, 497, 497, 497, 497, 174, 68, - /* 180 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - /* 190 */ 68, 68, 482, 29, 68, 68, 232, 471, 204, 206, - /* 200 */ 205, 503, 498, 46, 37, 513, 178, 502, 515, 478, - /* 210 */ 92, 77, 75, 74, 183, 135, 517, 516, 462, 128, - /* 220 */ 44, 514, 518, 482, 497, 463, 497, 497, 497, 497, - /* 230 */ 497, 497, 497, 497, 497, 497, 467, 423, 457, 180, - /* 240 */ 129, 560, 421, 453, 422, 149, 420, 419, 498, 46, - /* 250 */ 569, 417, 493, 21, 470, 134, 101, 100, 99, 498, - /* 260 */ 46, 91, 36, 418, 176, 161, 142, 478, 92, 77, - /* 270 */ 75, 74, 118, 142, 437, 439, 149, 119, 94, 172, - /* 280 */ 121, 482, 497, 162, 497, 497, 497, 497, 497, 497, - /* 290 */ 497, 497, 497, 497, 478, 92, 77, 221, 493, 573, - /* 300 */ 574, 575, 60, 768, 3, 3, 132, 219, 56, 493, - /* 310 */ 126, 112, 152, 142, 101, 100, 99, 106, 215, 195, - /* 320 */ 37, 454, 506, 73, 1, 478, 92, 77, 75, 74, - /* 330 */ 170, 142, 124, 80, 79, 568, 87, 182, 186, 482, - /* 340 */ 497, 207, 497, 497, 497, 497, 497, 497, 497, 497, - /* 350 */ 497, 497, 447, 191, 142, 104, 88, 519, 18, 512, - /* 360 */ 190, 519, 515, 122, 172, 498, 35, 28, 28, 568, - /* 370 */ 517, 516, 204, 206, 205, 514, 518, 520, 37, 105, - /* 380 */ 28, 28, 133, 478, 92, 77, 75, 74, 431, 464, - /* 390 */ 445, 444, 185, 186, 76, 521, 108, 482, 497, 207, - /* 400 */ 497, 497, 497, 497, 497, 497, 497, 497, 497, 497, - /* 410 */ 203, 219, 98, 96, 103, 493, 172, 402, 90, 591, - /* 420 */ 4, 472, 509, 498, 46, 142, 466, 29, 569, 520, - /* 430 */ 204, 206, 205, 188, 186, 520, 37, 142, 142, 142, - /* 440 */ 569, 478, 92, 77, 75, 74, 159, 521, 109, 143, - /* 450 */ 432, 192, 94, 521, 110, 482, 497, 207, 497, 497, - /* 460 */ 497, 497, 497, 497, 497, 497, 497, 497, 203, 219, - /* 470 */ 98, 96, 194, 493, 153, 38, 90, 142, 520, 473, - /* 480 */ 490, 498, 46, 142, 562, 40, 175, 489, 204, 206, - /* 490 */ 205, 540, 8, 402, 37, 586, 521, 116, 139, 478, - /* 500 */ 92, 77, 75, 74, 521, 115, 483, 528, 530, 148, - /* 510 */ 85, 527, 542, 482, 497, 79, 497, 497, 497, 497, - /* 520 */ 497, 497, 497, 497, 497, 497, 142, 219, 98, 96, - /* 530 */ 156, 493, 550, 13, 142, 408, 547, 547, 547, 547, - /* 540 */ 547, 547, 547, 547, 547, 547, 204, 206, 205, 549, - /* 550 */ 7, 520, 548, 467, 520, 539, 6, 478, 92, 77, - /* 560 */ 75, 74, 157, 520, 179, 23, 165, 569, 93, 521, - /* 570 */ 111, 22, 521, 113, 470, 137, 561, 169, 167, 498, - /* 580 */ 46, 521, 123, 104, 545, 519, 552, 448, 24, 519, - /* 590 */ 412, 65, 565, 41, 520, 28, 28, 568, 465, 142, - /* 600 */ 172, 456, 142, 125, 204, 206, 205, 224, 28, 28, - /* 610 */ 166, 142, 521, 117, 455, 478, 92, 77, 75, 74, - /* 620 */ 166, 166, 166, 166, 166, 166, 166, 396, 225, 493, - /* 630 */ 616, 104, 449, 519, 616, 19, 512, 519, 214, 515, - /* 640 */ 565, 45, 142, 28, 28, 568, 201, 517, 516, 202, - /* 650 */ 488, 486, 514, 518, 481, 29, 28, 28, 166, 479, - /* 660 */ 175, 138, 2, 47, 95, 48, 430, 97, 166, 166, - /* 670 */ 166, 166, 166, 166, 166, 231, 231, 140, 521, 115, - /* 680 */ 755, 528, 530, 141, 429, 527, 541, 130, 208, 428, - /* 690 */ 230, 229, 389, 390, 228, 227, 49, 423, 217, 425, - /* 700 */ 69, 64, 421, 29, 422, 461, 420, 419, 142, 460, - /* 710 */ 433, 417, 398, 21, 147, 61, 71, 150, 164, 151, - /* 720 */ 62, 63, 32, 418, 176, 30, 30, 30, 30, 30, - /* 730 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - /* 740 */ 30, 30, 30, 507, 507, 507, 507, 30, 30, 30, - /* 750 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - /* 760 */ 30, 30, 30, 30, 30, 572, 155, 219, 15, 25, - /* 770 */ 25, 558, 34, 42, 52, 11, 10, 70, 557, 563, - /* 780 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - /* 790 */ 30, 30, 30, 30, 30, 30, 30, 30, 536, 507, - /* 800 */ 507, 507, 507, 507, 500, 535, 82, 551, 12, 14, - /* 810 */ 43, 506, 537, 538, 30, 30, 30, 30, 30, 30, - /* 820 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - /* 830 */ 30, 30, 168, 5, 53, 54, 27, 9, 452, 16, - /* 840 */ 177, 451, 20, 181, 83, 84, 55, 26, 68, 68, - /* 850 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - /* 860 */ 68, 68, 68, 68, 68, 68, 184, 520, 569, 104, - /* 870 */ 86, 519, 187, 57, 644, 519, 443, 442, 565, 165, - /* 880 */ 522, 28, 28, 568, 72, 521, 113, 193, 89, 196, - /* 890 */ 477, 198, 197, 199, 28, 28, 166, 554, 131, 552, - /* 900 */ 200, 475, 496, 474, 495, 494, 166, 166, 166, 166, - /* 910 */ 166, 166, 166, 172, 405, 142, 30, 30, 30, 30, - /* 920 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - /* 930 */ 30, 30, 30, 30, 507, 507, 507, 507, 446, 616, - /* 940 */ 427, 29, 68, 68, 68, 68, 68, 68, 68, 68, - /* 950 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - /* 960 */ 761, 209, 211, 212, 210, 102, 459, 31, 216, 416, - /* 970 */ 222, 213, 410, 220, 457, 39, 410, 58, 223, 175, - /* 980 */ 409, 399, 66, 66, 107, 33, 391, 388, 387, 386, - /* 990 */ 507, 507, 507, 507, 507, 66, 66, 521, 115, 385, - /* 1000 */ 528, 530, 578, 578, 527, 534, 578, 578, 578, 578, - /* 1010 */ 578, 578, 578, 578, 578, 578, 578, 578, 578, 578, - /* 1020 */ 154, 578, 578, 578, 578, 578, 578, 142, 578, 578, - /* 1030 */ 578, 578, 578, 221, 578, 573, 574, 575, 60, 578, - /* 1040 */ 578, 578, 67, 578, 520, 578, 175, 145, 578, 578, - /* 1050 */ 578, 578, 578, 106, 215, 195, 165, 578, 578, 73, - /* 1060 */ 1, 520, 521, 113, 521, 115, 520, 528, 530, 80, - /* 1070 */ 79, 527, 163, 165, 160, 578, 552, 578, 165, 521, - /* 1080 */ 113, 578, 578, 520, 521, 113, 578, 578, 578, 578, - /* 1090 */ 172, 556, 142, 552, 142, 165, 555, 578, 552, 578, - /* 1100 */ 578, 521, 113, 578, 578, 578, 578, 172, 578, 142, - /* 1110 */ 578, 578, 172, 546, 142, 552, 578, 578, 578, 578, - /* 1120 */ 578, 578, 578, 578, 578, 578, 578, 578, 578, 172, - /* 1130 */ 578, 142, +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 123 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 110 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 429 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 629 +/* YYMAXRHS -- Maximum number of symbols on right-hand side of rule. */ +#define YYMAXRHS 13 +/* YYMAXLEFT -- Maximum number of symbols to the left of a handle + accessed by $0, $-1, etc., in any rule. */ +#define YYMAXLEFT 0 + +/* YYTRANSLATE(X) -- Bison symbol number corresponding to X. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 377 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const unsigned char yytranslate[] = +{ + 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, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122 }; -static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 2, 3, 130, 5, 6, 7, 8, 9, 10, 11, - /* 10 */ 12, 13, 14, 14, 15, 16, 177, 178, 23, 20, - /* 20 */ 148, 149, 23, 151, 152, 26, 27, 28, 62, 63, - /* 30 */ 143, 144, 66, 67, 68, 69, 70, 14, 39, 40, - /* 40 */ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - /* 50 */ 178, 28, 62, 63, 167, 57, 66, 67, 68, 69, - /* 60 */ 70, 28, 143, 97, 15, 16, 17, 18, 19, 75, - /* 70 */ 71, 72, 22, 23, 24, 25, 26, 27, 28, 29, - /* 80 */ 30, 31, 32, 33, 34, 86, 167, 37, 38, 191, - /* 90 */ 96, 93, 94, 95, 137, 97, 14, 99, 74, 74, - /* 100 */ 76, 76, 104, 105, 106, 107, 108, 2, 3, 85, - /* 110 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 120 */ 171, 14, 15, 16, 175, 167, 41, 20, 1, 2, - /* 130 */ 3, 4, 75, 26, 27, 28, 51, 52, 53, 54, - /* 140 */ 55, 56, 57, 14, 187, 88, 39, 40, 41, 42, - /* 150 */ 43, 44, 45, 46, 47, 48, 49, 50, 169, 170, - /* 160 */ 5, 172, 57, 116, 117, 2, 3, 130, 5, 6, - /* 170 */ 7, 8, 9, 10, 11, 12, 13, 14, 71, 22, - /* 180 */ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - /* 190 */ 33, 34, 2, 86, 37, 38, 168, 132, 93, 94, - /* 200 */ 95, 167, 137, 138, 99, 147, 101, 167, 150, 104, - /* 210 */ 105, 106, 107, 108, 177, 178, 158, 159, 130, 131, - /* 220 */ 57, 163, 164, 2, 3, 130, 5, 6, 7, 8, - /* 230 */ 9, 10, 11, 12, 13, 14, 14, 113, 14, 128, - /* 240 */ 165, 166, 118, 132, 120, 142, 122, 123, 137, 138, - /* 250 */ 28, 127, 187, 129, 132, 133, 93, 94, 95, 137, - /* 260 */ 138, 106, 99, 139, 140, 130, 178, 104, 105, 106, - /* 270 */ 107, 108, 171, 178, 116, 117, 142, 171, 57, 176, - /* 280 */ 171, 2, 3, 130, 5, 6, 7, 8, 9, 10, - /* 290 */ 11, 12, 13, 14, 104, 105, 106, 73, 187, 75, - /* 300 */ 76, 77, 78, 179, 180, 181, 130, 183, 86, 187, - /* 310 */ 176, 171, 101, 178, 93, 94, 95, 93, 94, 95, - /* 320 */ 99, 14, 111, 99, 100, 104, 105, 106, 107, 108, - /* 330 */ 142, 178, 171, 109, 110, 28, 57, 177, 178, 2, - /* 340 */ 3, 113, 5, 6, 7, 8, 9, 10, 11, 12, - /* 350 */ 13, 14, 124, 125, 178, 14, 128, 16, 146, 147, - /* 360 */ 132, 20, 150, 171, 176, 137, 138, 26, 27, 28, - /* 370 */ 158, 159, 93, 94, 95, 163, 164, 130, 99, 88, - /* 380 */ 39, 40, 142, 104, 105, 106, 107, 108, 97, 130, - /* 390 */ 130, 130, 177, 178, 57, 148, 149, 2, 3, 113, - /* 400 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 410 */ 124, 183, 184, 185, 14, 187, 176, 74, 132, 76, - /* 420 */ 134, 135, 141, 137, 138, 178, 14, 86, 28, 130, - /* 430 */ 93, 94, 95, 177, 178, 130, 99, 178, 178, 178, - /* 440 */ 28, 104, 105, 106, 107, 108, 162, 148, 149, 114, - /* 450 */ 115, 141, 57, 148, 149, 2, 3, 113, 5, 6, - /* 460 */ 7, 8, 9, 10, 11, 12, 13, 14, 124, 183, - /* 470 */ 184, 185, 121, 187, 87, 88, 132, 178, 130, 135, - /* 480 */ 187, 137, 138, 178, 87, 88, 130, 187, 93, 94, - /* 490 */ 95, 87, 88, 74, 99, 76, 148, 149, 178, 104, - /* 500 */ 105, 106, 107, 108, 148, 149, 189, 151, 152, 170, - /* 510 */ 57, 155, 156, 2, 3, 110, 5, 6, 7, 8, - /* 520 */ 9, 10, 11, 12, 13, 14, 178, 183, 184, 185, - /* 530 */ 176, 187, 87, 88, 178, 14, 41, 42, 43, 44, - /* 540 */ 45, 46, 47, 48, 49, 50, 93, 94, 95, 87, - /* 550 */ 88, 130, 57, 14, 130, 87, 88, 104, 105, 106, - /* 560 */ 107, 108, 140, 130, 87, 88, 142, 28, 57, 148, - /* 570 */ 149, 86, 148, 149, 132, 133, 166, 153, 154, 137, - /* 580 */ 138, 148, 149, 14, 160, 16, 162, 87, 88, 20, - /* 590 */ 87, 88, 23, 176, 130, 26, 27, 28, 126, 178, - /* 600 */ 176, 126, 178, 178, 93, 94, 95, 86, 39, 40, - /* 610 */ 41, 178, 148, 149, 126, 104, 105, 106, 107, 108, - /* 620 */ 51, 52, 53, 54, 55, 56, 57, 87, 88, 187, - /* 630 */ 92, 14, 126, 16, 96, 146, 147, 20, 92, 150, - /* 640 */ 23, 119, 178, 26, 27, 28, 92, 158, 159, 136, - /* 650 */ 2, 190, 163, 164, 2, 86, 39, 40, 41, 188, - /* 660 */ 130, 178, 96, 116, 119, 116, 182, 119, 51, 52, - /* 670 */ 53, 54, 55, 56, 57, 64, 65, 14, 148, 149, - /* 680 */ 111, 151, 152, 14, 182, 155, 156, 157, 14, 182, - /* 690 */ 79, 80, 81, 82, 83, 84, 119, 113, 102, 14, - /* 700 */ 89, 90, 118, 86, 120, 186, 122, 123, 178, 186, - /* 710 */ 115, 127, 14, 129, 173, 92, 98, 87, 101, 111, - /* 720 */ 92, 92, 86, 139, 140, 21, 22, 23, 24, 25, - /* 730 */ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - /* 740 */ 36, 37, 38, 1, 2, 3, 4, 21, 22, 23, - /* 750 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - /* 760 */ 34, 35, 36, 37, 38, 181, 20, 183, 96, 62, - /* 770 */ 63, 75, 86, 66, 67, 68, 69, 70, 75, 75, - /* 780 */ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - /* 790 */ 31, 32, 33, 34, 35, 36, 37, 38, 75, 57, - /* 800 */ 58, 59, 60, 61, 97, 75, 98, 87, 98, 88, - /* 810 */ 86, 111, 87, 87, 21, 22, 23, 24, 25, 26, - /* 820 */ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - /* 830 */ 37, 38, 87, 86, 86, 86, 86, 98, 75, 96, - /* 840 */ 87, 75, 86, 14, 87, 87, 86, 88, 21, 22, - /* 850 */ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - /* 860 */ 33, 34, 35, 36, 37, 38, 14, 130, 28, 14, - /* 870 */ 87, 16, 14, 86, 86, 20, 75, 75, 23, 142, - /* 880 */ 87, 26, 27, 28, 98, 148, 149, 20, 14, 16, - /* 890 */ 87, 16, 88, 86, 39, 40, 41, 160, 161, 162, - /* 900 */ 92, 75, 14, 75, 14, 14, 51, 52, 53, 54, - /* 910 */ 55, 56, 57, 176, 87, 178, 21, 22, 23, 24, - /* 920 */ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - /* 930 */ 35, 36, 37, 38, 1, 2, 3, 4, 14, 96, - /* 940 */ 87, 86, 21, 22, 23, 24, 25, 26, 27, 28, - /* 950 */ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - /* 960 */ 0, 16, 16, 86, 88, 14, 103, 98, 16, 75, - /* 970 */ 14, 92, 16, 19, 14, 86, 20, 96, 14, 130, - /* 980 */ 87, 14, 26, 27, 86, 14, 14, 14, 14, 19, - /* 990 */ 57, 58, 59, 60, 61, 39, 40, 148, 149, 76, - /* 1000 */ 151, 152, 192, 192, 155, 156, 192, 192, 192, 192, - /* 1010 */ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, - /* 1020 */ 87, 192, 192, 192, 192, 192, 192, 178, 192, 192, - /* 1030 */ 192, 192, 192, 73, 192, 75, 76, 77, 78, 192, - /* 1040 */ 192, 192, 86, 192, 130, 192, 130, 91, 192, 192, - /* 1050 */ 192, 192, 192, 93, 94, 95, 142, 192, 192, 99, - /* 1060 */ 100, 130, 148, 149, 148, 149, 130, 151, 152, 109, - /* 1070 */ 110, 155, 156, 142, 160, 192, 162, 192, 142, 148, - /* 1080 */ 149, 192, 192, 130, 148, 149, 192, 192, 192, 192, - /* 1090 */ 176, 160, 178, 162, 178, 142, 160, 192, 162, 192, - /* 1100 */ 192, 148, 149, 192, 192, 192, 192, 176, 192, 178, - /* 1110 */ 192, 192, 176, 160, 178, 162, 192, 192, 192, 192, - /* 1120 */ 192, 192, 192, 192, 192, 192, 192, 192, 192, 176, - /* 1130 */ 192, 178, + +#if YYDEBUG +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const unsigned short int yyrline[] = +{ + 0, 386, 386, 386, 386, 386, 386, 386, 386, 386, + 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + 387, 387, 387, 387, 388, 388, 388, 388, 388, 388, + 388, 388, 388, 388, 388, 388, 388, 388, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, + 389, 389, 393, 394, 397, 398, 401, 402, 403, 404, + 410, 418, 421, 424, 427, 430, 433, 436, 442, 448, + 454, 477, 481, 485, 490, 495, 499, 506, 507, 511, + 512, 513, 517, 518, 522, 523, 527, 528, 529, 533, + 534, 538, 543, 548, 556, 559, 563, 568, 576, 579, + 583, 587, 594, 598, 602, 606, 616, 626, 631, 636, + 642, 651, 654, 658, 662, 668, 675, 681, 682, 683, + 684, 688, 691, 698, 699, 700, 701, 702, 706, 712, + 713, 721, 731, 739, 750, 753, 757, 761, 765, 770, + 775, 783, 784, 785, 788, 794, 797, 800, 806, 807, + 808, 809, 810, 811, 812, 813, 817, 818, 822, 825, + 828, 834, 837, 840, 848, 860, 863, 866, 873, 876, + 886, 889, 892, 895, 896, 900, 903, 906, 917, 923, + 930, 938, 945, 956, 957, 961, 967, 977, 987, 1000, + 1001, 1013, 1016, 1019, 1022, 1028, 1031, 1041, 1054, 1059, + 1067, 1077, 1087, 1090, 1094, 1100, 1103, 1109, 1117, 1124, + 1127, 1133, 1138, 1146, 1150, 1154, 1158, 1162, 1169, 1173, + 1177, 1181, 1188, 1201, 1214, 1227, 1230, 1237, 1240, 1246, + 1250, 1257, 1260, 1266, 1269, 1275, 1278, 1290, 1293, 1300, + 1305, 1310, 1320, 1323, 1329, 1332, 1338, 1345, 1352, 1353, + 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1364, 1367, 1373, + 1376, 1379, 1382, 1385, 1391, 1395, 1403, 1404, 1408, 1415, + 1418, 1421, 1424, 1427, 1433, 1437, 1445, 1452, 1460, 1468, + 1469, 1470, 1471, 1472, 1473, 1474, 1475, 1476, 1477, 1481, + 1484, 1490, 1493, 1499, 1500, 1504, 1507, 1513, 1516, 1522, + 1529, 1536, 1539, 1542, 1549, 1554, 1562, 1563, 1564, 1565, + 1566, 1567, 1568, 1569, 1573, 1576, 1582, 1585, 1591, 1598, + 1599, 1603, 1610, 1613, 1619, 1627, 1630, 1636, 1639, 1645 }; -#define YY_SHIFT_USE_DFLT (1132) -#define YY_SHIFT_COUNT (232) -#define YY_SHIFT_MIN (-34) -#define YY_SHIFT_MAX (974) -static const short yy_shift_ofst[] = { - /* 0 */ 224, 163, 221, 960, -2, 569, -1, 617, -1, -1, - /* 10 */ -1, 855, 855, 855, 855, -10, -10, 107, -34, 707, - /* 20 */ 279, 337, 279, 105, 395, 341, 341, 341, 341, 341, - /* 30 */ 341, 341, 933, 24, 23, 23, 453, 511, 742, 956, - /* 40 */ 23, 23, 23, 23, 307, -6, 23, 23, 23, -6, - /* 50 */ -5, -5, 82, -5, -5, 33, 33, 33, 129, 495, - /* 60 */ 611, 742, 742, 742, 956, 956, 956, 956, 956, 956, - /* 70 */ 85, 49, 49, 127, 190, 190, 307, 155, 25, -5, - /* 80 */ 405, 82, -5, 485, 485, 33, 485, 33, 485, 546, - /* 90 */ 554, 648, 652, 33, 33, 566, 546, 566, 546, 663, - /* 100 */ 669, 674, 546, 596, 596, 129, 685, 698, 704, 726, - /* 110 */ 759, 793, 827, 895, 895, 895, 895, 895, 921, 921, - /* 120 */ 921, 921, 921, 50, 157, 222, 211, 387, 397, 57, - /* 130 */ 404, 445, 462, 468, 477, 400, 412, 500, 539, 412, - /* 140 */ 538, 538, 400, 291, 503, 521, 343, 540, 419, 618, - /* 150 */ 623, 630, 608, 628, 629, 636, 746, 672, 686, 696, - /* 160 */ 703, 723, 708, 730, 720, 710, 724, 721, 725, 745, - /* 170 */ 747, 748, 700, 749, 750, 739, 743, 763, 753, 766, - /* 180 */ 756, 757, 829, 760, 758, 852, 840, 783, 858, 787, - /* 190 */ 788, 801, 802, 786, 867, 874, 803, 873, 804, 875, - /* 200 */ 807, 808, 826, 828, 888, 890, 891, 924, 843, 853, - /* 210 */ 945, 876, 946, 877, 879, 951, 863, 952, 869, 881, - /* 220 */ 894, 954, 889, 893, 964, 967, 898, 971, 972, 973, - /* 230 */ 974, 970, 923, +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 1 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "\"end of file\"", "error", "$undefined", "BOOL", "CHAR", "SHORT", + "INT", "SIGNED", "UNSIGNED", "LONG", "FLOAT", "DOUBLE", "STRING", + "MIXED", "ARRAY", "OBJECT", "CALLABLE", "VOID", "ZVAL", "INT8", "UINT8", + "INT16", "UINT16", "INT32", "UINT32", "INT64", "UINT64", "NULL", "TRUE", + "FALSE", "NAME", "NSNAME", "DOLLAR_NAME", "NUMBER", "QUOTED_STRING", + "QUOTED_CHAR", "\"end of line\"", "\";\"", "\"(\"", "\")\"", "\",\"", + "\":\"", "\"{\"", "\"}\"", "\"[\"", "\"]\"", "\"=\"", "\"#\"", "\"|\"", + "\"^\"", "\"&\"", "\"<<\"", "\">>\"", "\"+\"", "\"-\"", "\"*\"", "\"/\"", + "\"%\"", "\"<\"", "\">\"", "\">=\"", "\"<=\"", "\"||\"", "\"&&\"", + "\"==\"", "\"!=\"", "\"~\"", "\"!\"", "\".\"", "\"\\\\\"", "\"...\"", + "ERROR", "WARNING", "IF", "IFDEF", "IFNDEF", "ELSE", "ELIF", "ENDIF", + "DEFINE", "DEFINED", "UNDEF", "IMPORT", "INCLUDE", "INCLUDE_NEXT", + "TYPEDEF", "STRUCT", "UNION", "ENUM", "CONST", "LIB", "STATIC", + "CALLBACK", "FUNCTION", "LET", "SET", "TEMP", "FREE", "RETURN", + "PRE_ASSERT", "POST_ASSERT", "BOOLVAL", "INTVAL", "STRVAL", "PATHVAL", + "STRLEN", "FLOATVAL", "ARRVAL", "OBJVAL", "COUNT", "CALLOC", "TO_BOOL", + "TO_INT", "TO_STRING", "TO_FLOAT", "TO_ARRAY", "TO_OBJECT", "COMMENT", + "WHITESPACE", "NO_WHITESPACE", "CPP_HEADER", "BINARY", "UNARY", + "$accept", "binary_op_token", "unary_op_token", "name_token", + "any_noeol_token", "file", "blocks", "block", "lib", "cpp", "cpp_exp", + "cpp_message_token", "cpp_include_token", "cpp_header_token", + "cpp_no_arg_token", "cpp_name_arg_token", "cpp_exp_arg_token", + "cpp_macro_decl", "cpp_macro_sig", "cpp_macro_sig_args", + "cpp_macro_decl_tokens", "cpp_macro_decl_token_list", "cpp_macro_exp", + "cpp_macro_call_args", "cpp_macro_call_arg_list", "constant", + "constant_type", "constant_type_token", "impl_def_val", + "impl_def_val_token", "decl_typedef", "typedef", "const_decl_type", + "decl_type", "decl_type_complex", "decl_type_simple", "decl_real_type", + "decl_stdint_type", "int_signed", "int_width", "decl_int_type", + "int_signed_types", "signed_short_types", "signed_long_types", + "int_width_types", "decl_stmt", "decl", "decl_fn", "decl_functor", + "decl_func", "decl_args", "decl_arg", "decl_var", "decl_union", + "decl_struct", "decl_struct_args", "struct_args_block", "struct_args", + "struct_arg", "decl_enum", "decl_enum_items", "decl_enum_item", + "num_exp", "number", "enum_name", "union_name", "struct_name", + "optional_name", "decl_layout", "align_and_size", "array_size", + "indirection", "pointers", "impl", "impl_func", "impl_args", "impl_arg", + "impl_var", "impl_type", "impl_type_token", "impl_stmts", "impl_stmt", + "let_stmt", "let_exp", "let_exp_byref", "let_exp_assign", "let_calloc", + "let_callback", "let_func", "let_func_token", "let_func_exps", + "let_exps", "callback_rval", "callback_arg_list", "callback_args", + "return_stmt", "set_stmt", "set_exp", "set_func", "set_func_token", + "set_func_exps", "set_exps", "assert_stmt", "assert_stmt_token", + "free_stmt", "free_exps", "free_exp", "decl_vars", "reference", "byref", YY_NULLPTR }; -#define YY_REDUCE_USE_DFLT (-162) -#define YY_REDUCE_COUNT (107) -#define YY_REDUCE_MIN (-161) -#define YY_REDUCE_MAX (953) -static const short yy_reduce_ofst[] = { - /* 0 */ 124, 228, 286, 584, 344, 424, 530, 737, 356, 849, - /* 10 */ 916, 914, 931, 936, 953, 212, 489, -128, 58, 58, - /* 20 */ 122, 111, 442, 65, 65, 247, 299, 305, 348, 421, - /* 30 */ 433, 464, -113, -11, 88, 37, -43, -43, -81, -51, - /* 40 */ 95, 135, 153, 176, -161, 47, 259, 260, 261, 158, - /* 50 */ 103, 134, 75, 188, 240, 160, 215, 256, 335, -102, - /* 60 */ 28, -42, 34, 40, 101, 106, 109, 140, 161, 192, - /* 70 */ 284, 281, 310, 351, 293, 300, 320, 317, 339, 354, - /* 80 */ 422, 410, 417, 472, 475, 425, 488, 320, 506, 522, - /* 90 */ 513, 461, 471, 483, 320, 547, 545, 549, 548, 484, - /* 100 */ 502, 507, 577, 519, 523, 595, 507, 541, +#endif + +#define YYPACT_NINF -490 +#define YYTABLE_NINF -428 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const short int yypact[] = +{ + 925, -490, -490, -490, -490, -490, 54, -490, -490, 1321, + -490, -490, -490, -490, -490, -490, -490, -490, 1695, -490, + -490, 1423, 1722, 1473, 1473, 1473, 1568, 0, -50, -3, + -490, 45, 925, -490, -490, -490, -490, -490, 347, -490, + -490, -490, -490, -490, 82, 97, -490, -490, 19, 28, + -490, -490, -490, -490, -490, -490, 40, -490, 42, -490, + -490, -490, -490, -490, -490, 55, -490, -490, -490, -490, + -490, -490, -490, -490, -490, -490, -490, -490, 1332, -490, + 1473, 1473, 1473, 1795, 31, -490, -490, -490, -490, -490, + -490, -490, -490, 885, -490, -490, -490, -490, 87, 697, + -12, -490, 1155, 1251, 1473, 1473, 88, -490, 89, 1473, + 99, 99, 75, 75, 108, -490, -490, 122, 126, -490, + 55, 128, -490, -490, 114, 118, -490, 134, -490, -490, + -490, 123, -490, 130, 1378, -490, 171, -490, 35, -490, + -490, 82, -490, -490, 1749, 1473, 384, 1473, 124, 55, + -490, -490, -490, -490, -490, 1749, 697, 579, -490, -490, + -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, + -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, + -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, + -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, + -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, + -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, + -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, + -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, + -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, + -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, + -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, + -490, -490, -490, -490, -490, -490, 697, -490, -490, -490, + -490, -490, -490, -490, 1251, -490, -490, -490, -490, 1441, + 1251, 140, 1964, 38, -490, 38, -490, -490, -490, 139, + 146, 146, -2, -2, 1368, 136, -490, 384, 151, 157, + -490, 55, 123, -490, -490, -490, -490, -490, -490, 55, + 1822, 347, 50, -490, 145, 14, -490, 347, 812, 347, + 1473, 59, -490, -490, 120, -490, -490, -490, -490, -490, + 337, -490, 153, 1473, 67, -490, 156, -490, -490, 1866, + 1473, -490, -490, 1251, -490, -490, -490, -490, -490, -490, + -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, + -490, -490, 1251, 158, 1722, 347, 347, -490, -490, -490, + -490, 55, -490, 3, 234, 36, 150, 1473, -490, 1378, + 55, 1378, 123, 1595, 337, 1473, -490, 154, 162, -490, + 166, -490, -490, -490, 1025, -490, -490, -490, -490, -490, + -490, 337, -490, 1964, -490, 176, 192, -490, 193, 198, + 187, 196, 18, -490, -490, 200, -490, -490, 1839, -490, + 199, 123, 1622, 1473, -490, 209, 1964, 210, 211, -490, + 206, 212, 979, -490, -490, -490, 1473, -490, -490, -490, + -490, -490, 213, -490, -490, -490, -490, -490, -490, -490, + -490, -490, -490, -490, 216, 74, -490, -3, -490, -490, + 219, 1378, -490, 55, 221, -490, 1964, -490, 1098, -490, + 222, 1849, 223, 1893, -490, 337, 812, -490, 347, -490, + -3, 347, -490, 1473, -490, -490, -490, -490, 224, -490, + 226, 227, -490, -490, 1251, 228, 225, 215, -490, -490, + 232, -490, 505, 231, 505, 233, -490, 123, 235, -490, + 104, -490, -490, -490, -490, -490, -490, -490, -490, 236, + 240, 1964, -490, -490, -490, -490, 242, 1206, 337, -490, + -490, -490, 244, 347, -490, 79, -490, 123, 697, 1473, + 1964, 252, 248, -490, -490, -490, 505, -490, -3, 3, + -490, -490, -490, -490, -490, 249, 337, -3, -490, -490, + 131, 251, 255, -490, 347, -490, -490, -490, 254, 264, + -490, -6, -490, -3, 1946, 260, 262, -490, 263, -490, + -490, -490, -490, 265, 256, 266, 337, 1098, 268, -490, + 812, 269, 270, 459, 1920, 154, -490, -490, -490, 271, + 1206, -490, -490, 273, 272, 276, 278, -490, -490, 1098, + -490, -490, 505, 277, 812, -490, -490, -490, -490 }; -static const YYACTIONTYPE yy_default[] = { - /* 0 */ 767, 767, 767, 767, 767, 734, 767, 755, 767, 767, - /* 10 */ 767, 755, 755, 755, 755, 767, 767, 767, 767, 767, - /* 20 */ 659, 767, 659, 767, 767, 767, 767, 767, 767, 767, - /* 30 */ 767, 767, 767, 767, 767, 757, 767, 767, 767, 604, - /* 40 */ 767, 767, 767, 767, 757, 767, 767, 767, 767, 767, - /* 50 */ 755, 755, 767, 755, 755, 757, 757, 757, 767, 767, - /* 60 */ 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, - /* 70 */ 767, 767, 767, 767, 683, 682, 767, 675, 767, 755, - /* 80 */ 767, 767, 755, 767, 767, 767, 767, 660, 767, 617, - /* 90 */ 667, 678, 671, 767, 767, 767, 617, 767, 617, 615, - /* 100 */ 615, 615, 617, 649, 649, 767, 615, 588, 767, 767, - /* 110 */ 767, 767, 767, 744, 724, 723, 715, 625, 595, 606, - /* 120 */ 605, 597, 594, 714, 598, 767, 767, 767, 767, 767, - /* 130 */ 767, 767, 767, 767, 767, 758, 758, 767, 767, 767, - /* 140 */ 686, 685, 767, 767, 767, 767, 767, 767, 767, 699, - /* 150 */ 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, - /* 160 */ 767, 767, 767, 767, 767, 767, 767, 735, 767, 767, - /* 170 */ 767, 767, 767, 767, 767, 711, 767, 767, 767, 767, - /* 180 */ 767, 767, 767, 767, 767, 767, 758, 767, 767, 767, - /* 190 */ 641, 767, 767, 767, 767, 767, 767, 767, 767, 767, - /* 200 */ 767, 767, 767, 767, 767, 767, 767, 767, 687, 767, - /* 210 */ 767, 767, 767, 767, 767, 767, 767, 767, 626, 767, - /* 220 */ 767, 767, 602, 767, 767, 767, 767, 767, 767, 767, - /* 230 */ 767, 767, 767, + + /* 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 unsigned short int yydefact[] = +{ + 152, 261, 258, 262, 256, 257, 259, 245, 246, 0, + 248, 249, 250, 251, 252, 253, 254, 255, 244, 157, + 156, 0, 0, 0, 0, 325, 0, 0, 0, 427, + 158, 0, 153, 154, 160, 159, 161, 163, 333, 235, + 237, 236, 242, 243, 265, 275, 241, 162, 0, 0, + 284, 283, 289, 165, 164, 166, 0, 167, 0, 260, + 247, 37, 33, 31, 24, 333, 335, 35, 36, 32, + 30, 28, 27, 25, 26, 34, 29, 290, 0, 244, + 0, 0, 0, 0, 0, 177, 178, 189, 186, 187, + 184, 190, 185, 0, 188, 179, 180, 181, 0, 198, + 0, 172, 0, 0, 325, 325, 0, 230, 229, 0, + 329, 329, 238, 239, 240, 322, 217, 262, 245, 220, + 0, 0, 216, 234, 0, 0, 429, 0, 428, 1, + 155, 331, 295, 0, 334, 266, 270, 268, 272, 263, + 276, 265, 264, 278, 291, 0, 0, 0, 334, 333, + 336, 297, 238, 239, 240, 291, 198, 198, 175, 169, + 71, 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, 63, 64, 65, 66, + 67, 68, 69, 70, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 200, 170, 199, 182, 183, 171, + 174, 173, 207, 208, 0, 22, 23, 20, 21, 0, + 0, 209, 176, 238, 324, 239, 323, 228, 231, 0, + 0, 0, 0, 0, 0, 0, 168, 0, 0, 0, + 299, 333, 331, 271, 267, 273, 274, 269, 277, 292, + 0, 0, 0, 293, 311, 0, 309, 0, 427, 0, + 0, 0, 419, 420, 0, 357, 360, 359, 361, 362, + 0, 363, 0, 0, 0, 193, 0, 192, 201, 0, + 0, 205, 203, 211, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 13, 12, 14, 15, 16, 17, + 18, 19, 0, 0, 0, 0, 0, 302, 301, 303, + 300, 333, 296, 221, 0, 0, 0, 0, 298, 0, + 0, 0, 331, 0, 0, 0, 308, 0, 0, 413, + 31, 319, 318, 320, 0, 411, 409, 408, 410, 407, + 406, 0, 321, 402, 313, 0, 0, 401, 0, 0, + 0, 0, 0, 422, 412, 0, 337, 358, 0, 288, + 0, 331, 0, 194, 202, 0, 213, 0, 212, 204, + 0, 327, 0, 305, 233, 232, 0, 223, 225, 226, + 224, 227, 0, 222, 338, 350, 351, 352, 353, 349, + 354, 355, 356, 348, 0, 0, 342, 427, 347, 332, + 0, 0, 279, 0, 0, 294, 312, 310, 0, 364, + 24, 0, 0, 0, 317, 0, 427, 400, 0, 346, + 427, 0, 421, 0, 399, 418, 287, 281, 0, 196, + 0, 195, 206, 210, 0, 0, 0, 0, 304, 306, + 0, 215, 0, 0, 0, 344, 285, 331, 31, 369, + 30, 387, 386, 384, 382, 383, 385, 381, 380, 34, + 29, 373, 374, 370, 371, 372, 0, 0, 0, 315, + 316, 403, 414, 0, 425, 0, 423, 331, 198, 0, + 214, 0, 0, 307, 286, 339, 0, 343, 427, 221, + 280, 393, 379, 388, 394, 0, 0, 427, 375, 314, + 427, 0, 0, 424, 0, 282, 191, 197, 0, 0, + 340, 0, 345, 427, 0, 389, 0, 416, 415, 404, + 365, 426, 330, 0, 0, 0, 0, 0, 0, 405, + 427, 0, 0, 395, 0, 321, 391, 368, 366, 390, + 0, 378, 417, 0, 0, 0, 396, 397, 376, 0, + 367, 328, 0, 0, 427, 392, 341, 377, 398 }; -/********** End of lemon-generated parsing tables *****************************/ - -/* The next table maps tokens (terminal symbols) into fallback tokens. -** If a construct like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammar, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -** -** This feature can be used, for example, to cause some keywords in a language -** to revert to identifiers if they keyword does not apply in the context where -** it appears. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { - 0, /* $ => nothing */ - 0, /* BOOL => nothing */ - 0, /* INT => nothing */ - 0, /* FLOAT => nothing */ - 14, /* STRING => NAME */ - 0, /* DOUBLE => nothing */ - 0, /* INT8 => nothing */ - 0, /* UINT8 => nothing */ - 0, /* INT16 => nothing */ - 0, /* UINT16 => nothing */ - 0, /* INT32 => nothing */ - 0, /* UINT32 => nothing */ - 0, /* INT64 => nothing */ - 0, /* UINT64 => nothing */ - 0, /* NAME => nothing */ - 0, /* NULL => nothing */ - 0, /* NUMBER => nothing */ - 0, /* TRUE => nothing */ - 0, /* FALSE => nothing */ - 0, /* QUOTED_STRING => nothing */ - 0, /* NSNAME => nothing */ - 0, /* PIPE => nothing */ - 0, /* CARET => nothing */ - 0, /* AMPERSAND => nothing */ - 0, /* LSHIFT => nothing */ - 0, /* RSHIFT => nothing */ - 0, /* PLUS => nothing */ - 0, /* MINUS => nothing */ - 0, /* ASTERISK => nothing */ - 0, /* SLASH => nothing */ - 0, /* MODULO => nothing */ - 0, /* RCHEVR => nothing */ - 0, /* LCHEVR => nothing */ - 0, /* CMP_GE => nothing */ - 0, /* CMP_LE => nothing */ - 0, /* OR => nothing */ - 0, /* AND => nothing */ - 0, /* CMP_EQ => nothing */ - 0, /* CMP_NE => nothing */ - 0, /* TILDE => nothing */ - 0, /* NOT => nothing */ - 14, /* ZVAL => NAME */ - 0, /* OBJVAL => nothing */ - 0, /* ARRVAL => nothing */ - 0, /* PATHVAL => nothing */ - 0, /* STRLEN => nothing */ - 0, /* STRVAL => nothing */ - 0, /* FLOATVAL => nothing */ - 0, /* INTVAL => nothing */ - 0, /* BOOLVAL => nothing */ - 14, /* COUNT => NAME */ - 0, /* TO_OBJECT => nothing */ - 0, /* TO_ARRAY => nothing */ - 0, /* TO_STRING => nothing */ - 0, /* TO_INT => nothing */ - 0, /* TO_FLOAT => nothing */ - 0, /* TO_BOOL => nothing */ - 0, /* VOID => nothing */ - 0, /* MIXED => nothing */ - 0, /* ARRAY => nothing */ - 0, /* OBJECT => nothing */ - 0, /* CALLABLE => nothing */ - 0, /* PRE_ASSERT => nothing */ - 0, /* POST_ASSERT => nothing */ - 14, /* ERROR => NAME */ - 14, /* WARNING => NAME */ - 14, /* TEMP => NAME */ - 14, /* FREE => NAME */ - 14, /* SET => NAME */ - 14, /* LET => NAME */ - 14, /* RETURN => NAME */ - 14, /* CALLOC => NAME */ - 14, /* CALLBACK => NAME */ - 14, /* LIB => NAME */ + + /* YYPGOTO[NTERM-NUM]. */ +static const short int yypgoto[] = +{ + -490, -281, -97, -8, 43, -490, -490, 288, -490, -490, + -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, + -149, -490, -272, -490, -490, -490, -490, -490, -249, -490, + -490, 299, -134, -21, -490, -490, -490, -490, 279, -490, + -490, 182, -490, -490, -490, -490, 27, 308, -490, -490, + 172, -20, -38, -490, -490, 33, -171, -490, -103, 29, + -490, -54, -302, -490, -490, -490, -490, 37, -490, 34, + -293, -56, -5, -490, 315, -490, -170, -447, -489, -490, + 39, -306, -490, -271, -454, 20, -490, -490, -490, -169, + -490, -490, -490, -490, -490, -490, -490, -472, 21, -490, + -490, -490, -490, -490, -490, -490, -140, -490, -26, -465 }; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -** -** After the "shift" half of a SHIFTREDUCE action, the stateno field -** actually contains the reduce action for the second half of the -** SHIFTREDUCE. -*/ -struct yyStackEntry { - YYACTIONTYPE stateno; /* The state-number, or reduce action in SHIFTREDUCE */ - YYCODETYPE major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ + + /* YYDEFGOTO[NTERM-NUM]. */ +static const short int yydefgoto[] = +{ + -1, 485, 411, 131, 274, 31, 32, 33, 34, 35, + 98, 99, 100, 279, 101, 102, 103, 158, 500, 501, + 275, 276, 292, 437, 438, 36, 121, 122, 452, 453, + 37, 441, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 139, 314, 317, 142, 47, 107, 49, 50, 51, + 322, 52, 412, 53, 54, 378, 379, 442, 443, 109, + 325, 326, 413, 414, 56, 110, 111, 115, 507, 300, + 310, 133, 391, 57, 58, 465, 466, 415, 467, 468, + 334, 335, 336, 606, 607, 608, 533, 534, 535, 536, + 598, 609, 565, 615, 616, 337, 338, 416, 417, 418, + 571, 588, 339, 340, 341, 422, 423, 545, 419, 128 }; -typedef struct yyStackEntry yyStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - yyStackEntry *yytos; /* Pointer to top element of the stack */ -#ifdef YYTRACKMAXSTACKDEPTH - int yyhwm; /* High-water mark of the stack */ -#endif -#ifndef YYNOERRORRECOVERY - int yyerrcnt; /* Shifts left before out of the error */ -#endif - ParseARG_SDECL /* A place to hold %extra_argument */ -#if YYSTACKDEPTH<=0 - int yystksz; /* Current side of the stack */ - yyStackEntry *yystack; /* The parser's stack */ - yyStackEntry yystk0; /* First stack entry */ -#else - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -#endif + + /* 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 short int yytable[] = +{ + 132, 77, 108, 127, 78, 123, 290, 345, 347, 147, + 321, 372, 349, 537, 541, 112, 113, 114, 352, 388, + 515, 321, 277, 555, 532, 558, 489, 48, 427, 55, + 447, 448, 449, 134, 124, 377, 450, 451, 428, 455, + 374, 315, 456, 29, 316, 129, 457, 126, 458, 459, + 460, 461, 462, 463, 395, 492, 143, 396, 493, 48, + 148, 55, 123, 59, 594, 60, 144, 580, 372, 155, + 151, 372, 152, 153, 154, 464, 399, 424, 427, -326, + -326, 436, 145, 568, 146, 157, 135, 136, 137, 392, + 393, 138, 476, 343, 281, 291, 293, 295, 587, 472, + 439, 298, 483, 140, 4, 5, 431, 432, 278, 484, + 66, 515, -329, 513, 514, 304, 299, -329, 573, 574, + 585, 561, 562, 159, 323, 297, 312, -289, 612, 375, + 376, 617, 610, 626, 61, 323, 595, 324, 497, 342, + 299, 294, 296, 62, 148, 301, 302, 303, 399, 400, + -326, 306, 628, -218, 610, 372, 620, -219, 372, 305, + 307, 64, 401, 426, 402, 308, 403, 309, 311, 404, + 405, 406, 407, 408, 409, 410, 531, 313, 353, 150, + 373, 126, 383, 540, 285, 286, 66, 290, 374, 385, + 386, 394, 429, 290, 433, 469, 440, 287, 288, 479, + 478, 586, 67, 68, -412, 521, 522, 523, 524, 525, + 526, 527, 528, 563, 327, 328, 329, 330, 331, 332, + 333, 69, 486, 70, 560, 71, 72, 73, 74, 487, + 489, 488, 550, 490, 491, 531, 569, 494, 496, 505, + 75, 76, 405, 406, 407, 408, 409, 410, 502, 503, + 511, 504, 553, 506, 575, 387, 290, 512, 516, 321, + 517, -24, 538, 547, 584, 548, 552, 549, 551, 372, + 482, 554, 556, -379, -388, 290, 291, 454, 566, 559, + 567, 351, 291, 132, 570, 578, 579, 583, 602, 397, + 589, 420, 590, 592, 604, 531, 382, 593, 321, 123, + 597, 599, 613, 600, 603, 601, 148, 611, 531, 614, + 582, 619, 621, 622, 389, 623, 627, 531, 624, 348, + 130, 106, 421, 318, 141, 446, 84, 344, 327, 328, + 329, 330, 331, 332, 333, 430, 380, 444, 445, 509, + 61, 477, 435, 125, 557, 291, 384, 398, 625, 62, + 61, 564, 425, 546, 108, 63, 0, 0, 0, 62, + 0, 0, 0, 0, 291, 63, 0, 64, 401, 0, + 402, 0, 403, 475, 0, 404, 148, 64, 0, 470, + 0, 151, 0, 312, 0, 471, 0, 324, 0, 0, + 285, 286, 66, 0, 0, 0, 0, 0, 0, 576, + 0, 0, 66, 287, 288, 0, 0, 290, 67, 68, + 0, 0, 475, 0, 0, 0, 0, 0, 67, 68, + 0, 0, 108, 0, 0, 499, 0, 69, 0, 70, + 0, 71, 72, 73, 74, 0, 0, 69, 510, 70, + 0, 71, 72, 73, 74, 0, 75, 76, 0, 0, + 542, 0, 0, 544, 0, 0, 75, 76, 0, 0, + 123, 0, 61, 382, 543, 0, 0, 0, 389, 0, + 0, 62, 0, 0, 0, 0, 399, 400, 327, 328, + 329, 330, 331, 332, 333, 421, 0, 0, 0, 64, + 401, -427, 402, 0, 403, 0, 291, 404, 0, 0, + 0, 0, 0, 0, 0, 572, 0, 0, 455, 126, + 0, 456, 285, 286, 66, 457, 0, 458, 459, 460, + 461, 462, 463, 0, 0, 287, 288, 0, 0, 0, + 67, 68, 581, 0, 0, 0, 591, 0, 0, 0, + 0, 577, 0, 0, 0, 0, 0, 0, 0, 69, + 0, 70, 0, 71, 72, 73, 74, 0, 0, 605, + 0, 0, 0, 0, 0, 0, 0, 0, 75, 76, + 405, 406, 407, 408, 409, 410, 0, 0, 0, 160, + 0, 605, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 0, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 0, 239, 0, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 160, 346, 273, + 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, + 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, + 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 0, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 0, + 239, 0, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 61, 0, 273, 0, 0, + 0, 0, 0, 0, 62, 0, 0, 0, 0, 399, + 400, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 64, 401, 0, 402, 0, 403, 0, 0, + 404, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 126, 0, 0, 285, 286, 66, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 287, 288, + 0, 0, 0, 67, 68, 0, 0, 0, 61, 0, + 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, + 0, 0, 69, 63, 70, 0, 71, 72, 73, 74, + 0, 0, 156, 0, 0, 64, 0, 0, 0, 0, + 0, 75, 76, 405, 406, 407, 408, 409, 410, 1, + 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, + 0, 0, 9, 0, 10, 11, 12, 13, 14, 15, + 16, 17, 0, 0, 0, 18, 67, 68, 0, 0, + 0, 19, 20, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 21, 0, 0, 69, 0, 70, 0, 71, + 72, 73, 74, 1, 2, 3, 4, 5, 6, 7, + 8, 0, 0, 0, 75, 76, 9, 0, 10, 11, + 12, 13, 14, 15, 16, 17, 0, 0, 0, 18, + 22, 23, 24, 25, 26, 27, 28, 0, 29, 0, + 0, 0, 508, 0, 0, 0, 0, 0, 61, 1, + 2, 3, 4, 5, 6, 7, 8, 62, 0, 0, + 0, 0, 30, 63, 10, 11, 12, 13, 14, 15, + 16, 17, 0, 0, 0, 480, 401, 0, 402, 0, + 403, 0, 0, 404, 0, 104, 105, 25, 83, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 285, 286, + 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 287, 288, 0, 0, 0, 67, 68, 0, 0, + 0, 61, 0, 0, 0, 0, 0, 0, 0, 0, + 62, 80, 81, 82, 481, 69, 518, 70, 0, 71, + 72, 73, 74, 0, 0, 519, 0, 0, 64, 401, + 0, 402, 0, 403, 75, 76, 404, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 126, 0, + 0, 285, 286, 66, 0, 0, 0, 0, 61, 0, + 0, 0, 0, 0, 287, 288, 0, 62, 0, 67, + 68, 0, 0, 63, 0, 0, 0, 0, 0, 0, + 0, 0, 280, 0, 0, 64, 0, 0, 69, 0, + 520, 0, 71, 72, 73, 74, 0, 0, 0, 521, + 522, 523, 524, 525, 526, 527, 528, 529, 530, 61, + 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, + 0, 0, 0, 0, 518, 0, 67, 68, 0, 0, + 0, 0, 0, 519, 0, 0, 64, 401, 0, 402, + 0, 403, 0, 0, 404, 69, 0, 70, 0, 71, + 72, 73, 74, 0, 61, 0, 0, 0, 0, 285, + 286, 66, 0, 62, 75, 76, 0, 0, 0, 63, + 0, 0, 287, 288, 0, 0, 0, 67, 68, 0, + 0, 64, 0, 0, 282, 0, 283, 0, 0, 284, + 0, 0, 0, 0, 0, 0, 69, 0, 520, 0, + 71, 72, 73, 74, 285, 286, 0, 521, 522, 523, + 524, 525, 526, 527, 528, 529, 530, 287, 288, 0, + 0, 0, 67, 68, 61, 0, 0, 0, 0, 0, + 0, 289, 0, 62, 0, 61, 0, 0, 0, 63, + 0, 69, 0, 70, 62, 71, 72, 73, 74, 0, + 63, 64, 0, 0, 0, 0, 0, 0, 0, 65, + 75, 76, 64, 0, 0, 0, 0, 0, 0, 0, + 149, 61, 0, 0, 0, 0, 66, 0, 0, 0, + 62, 61, 0, 0, 0, 0, 63, 150, 0, 0, + 62, 0, 67, 68, 0, 0, 63, 0, 64, 0, + 0, 0, 0, 67, 68, 0, 381, 0, 64, 0, + 0, 69, 0, 70, 0, 71, 72, 73, 74, 0, + 0, 0, 69, 150, 70, 0, 71, 72, 73, 74, + 75, 76, 0, 150, 0, 0, 0, 0, 0, 67, + 68, 75, 76, 0, 61, 0, 0, 0, 0, 67, + 68, 0, 0, 62, 0, 0, 0, 0, 69, 63, + 70, 0, 71, 72, 73, 74, 0, 0, 69, 0, + 70, 64, 71, 72, 73, 74, 61, 75, 76, 350, + 0, 0, 0, 0, 0, 62, 0, 75, 76, 0, + 0, 63, 0, 0, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 64, 94, 95, 96, 97, 0, 0, + 0, 0, 67, 68, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 69, 0, 70, 0, 71, 72, 73, 74, 0, + 0, 0, 0, 0, 67, 68, 0, 0, 0, 0, + 75, 76, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 69, 0, 70, 0, 71, 72, 73, + 74, 116, 1, 2, 117, 4, 5, 6, 118, 8, + 119, 0, 75, 76, 0, 120, 0, 10, 11, 12, + 13, 14, 15, 16, 17, 0, 0, 0, 79, 1, + 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, + 0, 0, 473, 0, 10, 11, 12, 13, 14, 15, + 16, 17, 0, 0, 0, 79, 1, 2, 3, 4, + 5, 6, 7, 8, 0, 0, 0, 0, 0, 473, + 0, 10, 11, 12, 13, 14, 15, 16, 17, 0, + 0, 0, 79, 0, 80, 81, 82, 0, 0, 0, + 0, 0, 0, 0, 0, 474, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 80, 81, 82, 320, 0, 0, 0, 0, 0, + 0, 0, 498, 0, 0, 0, 0, 0, 0, 1, + 2, 3, 4, 5, 6, 7, 8, 0, 80, 81, + 82, 320, 9, 0, 10, 11, 12, 13, 14, 15, + 16, 17, 0, 0, 0, 79, 1, 2, 3, 4, + 5, 6, 7, 8, 0, 0, 0, 0, 0, 9, + 0, 10, 11, 12, 13, 14, 15, 16, 17, 0, + 0, 0, 18, 1, 2, 3, 4, 5, 6, 7, + 8, 0, 0, 0, 0, 0, 319, 0, 10, 11, + 12, 13, 14, 15, 16, 17, 0, 0, 0, 79, + 0, 80, 81, 82, 83, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + 2, 3, 4, 5, 6, 7, 8, 0, 104, 105, + 25, 83, 120, 0, 10, 11, 12, 13, 14, 15, + 16, 17, 0, 0, 0, 79, 1, 2, 3, 4, + 5, 6, 7, 8, 0, 80, 81, 82, 320, 390, + 0, 10, 11, 12, 13, 14, 15, 16, 17, 0, + 0, 0, 79, 1, 2, 3, 4, 5, 6, 7, + 8, 0, 0, 0, 0, 0, 0, 0, 10, 11, + 12, 13, 14, 15, 16, 17, 495, 0, 0, 79, + 0, 80, 81, 82, 0, 0, 0, 354, 355, 356, + 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, + 367, 368, 369, 370, 371, 434, 0, 0, 80, 81, + 82, 0, 0, 0, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, + 370, 371, 539, 0, 0, 80, 81, 82, 0, 0, + 0, 354, 355, 356, 357, 358, 359, 360, 361, 362, + 363, 364, 365, 366, 367, 368, 369, 370, 371, 618, + 0, 0, 0, 0, 0, 0, 0, 0, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, 367, 368, 369, 370, 371, 596, 0, 0, 0, + 0, 0, 0, 0, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, + 370, 371, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 364, 365, 366, 367, 368, 369, 370, 371 }; -typedef struct yyParser yyParser; -#ifndef NDEBUG -#include -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* -** Turn parser tracing on by giving a stream to which to write the trace -** and a prompt to preface each trace message. Tracing is turned off -** by making either argument NULL -** -** Inputs: -**
    -**
  • A FILE* to which trace output should be written. -** If NULL, then tracing is turned off. -**
  • A prefix string written at the beginning of every -** line of trace output. If NULL, then tracing is -** turned off. -**
-** -** Outputs: -** None. -*/ -void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *const yyTokenName[] = { - "$", "BOOL", "INT", "FLOAT", - "STRING", "DOUBLE", "INT8", "UINT8", - "INT16", "UINT16", "INT32", "UINT32", - "INT64", "UINT64", "NAME", "NULL", - "NUMBER", "TRUE", "FALSE", "QUOTED_STRING", - "NSNAME", "PIPE", "CARET", "AMPERSAND", - "LSHIFT", "RSHIFT", "PLUS", "MINUS", - "ASTERISK", "SLASH", "MODULO", "RCHEVR", - "LCHEVR", "CMP_GE", "CMP_LE", "OR", - "AND", "CMP_EQ", "CMP_NE", "TILDE", - "NOT", "ZVAL", "OBJVAL", "ARRVAL", - "PATHVAL", "STRLEN", "STRVAL", "FLOATVAL", - "INTVAL", "BOOLVAL", "COUNT", "TO_OBJECT", - "TO_ARRAY", "TO_STRING", "TO_INT", "TO_FLOAT", - "TO_BOOL", "VOID", "MIXED", "ARRAY", - "OBJECT", "CALLABLE", "PRE_ASSERT", "POST_ASSERT", - "ERROR", "WARNING", "TEMP", "FREE", - "SET", "LET", "RETURN", "CALLOC", - "CALLBACK", "LIB", "ANY", "EOS", - "EOL", "COMMENT", "HASH", "IFDEF", - "IFNDEF", "ENDIF", "ELSE", "UNDEF", - "DEFINE", "NO_WHITESPACE", "LPAREN", "RPAREN", - "COMMA", "IF", "ELIF", "DEFINED", - "COLON", "ENUM", "STRUCT", "UNION", - "LBRACE", "RBRACE", "EQUALS", "CONST", - "TYPEDEF", "ELLIPSIS", "LBRACKET", "RBRACKET", - "CHAR", "SHORT", "LONG", "UNSIGNED", - "SIGNED", "STATIC", "FUNCTION", "DOLLAR_NAME", - "error", "decl_enum", "decl_enum_items", "decl_enum_item", - "decl_struct_args_block", "decl_struct_args", "decl_struct", "align_and_size", - "decl_union", "const_type", "constant", "decl_typedef", - "decl_typedef_body_ex", "decl_typedef_body", "decl_typedef_body_fn_args", "decl", - "decl_func", "decl_abi", "decl_var", "decl_vars", - "decl_arg", "decl_args", "struct_args", "struct_arg", - "decl_layout", "decl_type", "const_decl_type", "impl", - "impl_func", "impl_def_val", "impl_var", "impl_arg", - "impl_args", "impl_vararg", "impl_stmts", "impl_stmt", - "number", "num_exp", "let_stmt", "let_calloc", - "let_func", "callback_arg_list", "callback_args", "let_callback", - "let_exp", "let_exps", "assert_stmt", "set_stmt", - "set_exp", "set_exps", "set_func", "return_stmt", - "free_stmt", "free_exps", "free_exp", "impl_type", - "cpp_exp", "cpp_macro_decl", "cpp_macro_decl_tokens", "cpp_macro_exp", - "cpp_macro_sig", "cpp_macro_sig_args", "cpp_macro_call", "cpp_macro_call_args", - "reference", "indirection", "pointers", "file", - "blocks", "block", "optional_name", "enum_name", - "struct_name", "union_name", "decl_var_array_size", "decl_scalar_type", - "decl_scalar_type_short", "decl_scalar_type_long", "decl_scalar_type_long_long", "callback_rval", +static const short int yycheck[] = +{ + 38, 9, 22, 29, 9, 26, 103, 156, 157, 65, + 144, 292, 284, 478, 486, 23, 24, 25, 290, 312, + 467, 155, 34, 512, 478, 514, 32, 0, 334, 0, + 27, 28, 29, 38, 34, 37, 33, 34, 340, 3, + 42, 6, 6, 93, 9, 0, 10, 50, 12, 13, + 14, 15, 16, 17, 40, 37, 37, 43, 40, 32, + 65, 32, 83, 9, 70, 11, 38, 556, 349, 38, + 78, 352, 80, 81, 82, 39, 17, 18, 384, 41, + 42, 353, 42, 537, 42, 93, 4, 5, 6, 39, + 40, 9, 394, 149, 102, 103, 104, 105, 570, 392, + 372, 109, 404, 6, 7, 8, 39, 40, 120, 411, + 55, 558, 37, 39, 40, 120, 41, 42, 39, 40, + 567, 17, 18, 36, 144, 37, 134, 38, 600, 300, + 301, 603, 597, 622, 3, 155, 583, 145, 431, 147, + 41, 104, 105, 12, 149, 111, 112, 113, 17, 18, + 42, 37, 624, 31, 619, 436, 610, 31, 439, 31, + 42, 30, 31, 43, 33, 31, 35, 44, 38, 38, + 111, 112, 113, 114, 115, 116, 478, 6, 38, 55, + 41, 50, 46, 485, 53, 54, 55, 284, 42, 38, + 33, 46, 39, 290, 38, 45, 38, 66, 67, 37, + 46, 70, 71, 72, 38, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 94, 95, 96, 97, 98, 99, + 100, 90, 46, 92, 517, 94, 95, 96, 97, 37, + 32, 38, 504, 46, 38, 537, 538, 37, 39, 33, + 109, 110, 111, 112, 113, 114, 115, 116, 39, 39, + 37, 40, 37, 41, 547, 311, 353, 41, 39, 393, + 39, 39, 39, 39, 566, 39, 41, 40, 40, 550, + 404, 39, 41, 38, 38, 372, 284, 43, 38, 46, + 38, 289, 290, 321, 40, 33, 38, 38, 32, 327, + 39, 329, 37, 39, 596, 597, 304, 33, 432, 320, + 40, 39, 33, 40, 38, 40, 311, 39, 610, 39, + 559, 40, 39, 41, 319, 39, 39, 619, 40, 276, + 32, 22, 330, 141, 45, 381, 18, 155, 94, 95, + 96, 97, 98, 99, 100, 343, 303, 375, 376, 442, + 3, 395, 350, 28, 514, 353, 307, 327, 619, 12, + 3, 520, 331, 493, 374, 18, -1, -1, -1, 12, + -1, -1, -1, -1, 372, 18, -1, 30, 31, -1, + 33, -1, 35, 393, -1, 38, 381, 30, -1, 387, + -1, 389, -1, 391, -1, 390, -1, 395, -1, -1, + 53, 54, 55, -1, -1, -1, -1, -1, -1, 548, + -1, -1, 55, 66, 67, -1, -1, 504, 71, 72, + -1, -1, 432, -1, -1, -1, -1, -1, 71, 72, + -1, -1, 442, -1, -1, 433, -1, 90, -1, 92, + -1, 94, 95, 96, 97, -1, -1, 90, 446, 92, + -1, 94, 95, 96, 97, -1, 109, 110, -1, -1, + 488, -1, -1, 491, -1, -1, 109, 110, -1, -1, + 481, -1, 3, 471, 490, -1, -1, -1, 473, -1, + -1, 12, -1, -1, -1, -1, 17, 18, 94, 95, + 96, 97, 98, 99, 100, 493, -1, -1, -1, 30, + 31, 32, 33, -1, 35, -1, 504, 38, -1, -1, + -1, -1, -1, -1, -1, 543, -1, -1, 3, 50, + -1, 6, 53, 54, 55, 10, -1, 12, 13, 14, + 15, 16, 17, -1, -1, 66, 67, -1, -1, -1, + 71, 72, 558, -1, -1, -1, 574, -1, -1, -1, + -1, 549, -1, -1, -1, -1, -1, -1, -1, 90, + -1, 92, -1, 94, 95, 96, 97, -1, -1, 597, + -1, -1, -1, -1, -1, -1, -1, -1, 109, 110, + 111, 112, 113, 114, 115, 116, -1, -1, -1, 0, + -1, 619, 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, -1, 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, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, -1, 83, -1, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, + 111, 112, 113, 114, 115, 116, 117, 0, 119, 120, + 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, -1, 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, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, -1, + 83, -1, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, 117, 3, -1, 120, -1, -1, + -1, -1, -1, -1, 12, -1, -1, -1, -1, 17, + 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 30, 31, -1, 33, -1, 35, -1, -1, + 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 50, -1, -1, 53, 54, 55, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 66, 67, + -1, -1, -1, 71, 72, -1, -1, -1, 3, -1, + -1, -1, -1, -1, -1, -1, -1, 12, -1, -1, + -1, -1, 90, 18, 92, -1, 94, 95, 96, 97, + -1, -1, 27, -1, -1, 30, -1, -1, -1, -1, + -1, 109, 110, 111, 112, 113, 114, 115, 116, 4, + 5, 6, 7, 8, 9, 10, 11, -1, -1, -1, + -1, -1, 17, -1, 19, 20, 21, 22, 23, 24, + 25, 26, -1, -1, -1, 30, 71, 72, -1, -1, + -1, 36, 37, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 47, -1, -1, 90, -1, 92, -1, 94, + 95, 96, 97, 4, 5, 6, 7, 8, 9, 10, + 11, -1, -1, -1, 109, 110, 17, -1, 19, 20, + 21, 22, 23, 24, 25, 26, -1, -1, -1, 30, + 85, 86, 87, 88, 89, 90, 91, -1, 93, -1, + -1, -1, 43, -1, -1, -1, -1, -1, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, + -1, -1, 117, 18, 19, 20, 21, 22, 23, 24, + 25, 26, -1, -1, -1, 30, 31, -1, 33, -1, + 35, -1, -1, 38, -1, 86, 87, 88, 89, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 53, 54, + 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 66, 67, -1, -1, -1, 71, 72, -1, -1, + -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, + 12, 86, 87, 88, 89, 90, 18, 92, -1, 94, + 95, 96, 97, -1, -1, 27, -1, -1, 30, 31, + -1, 33, -1, 35, 109, 110, 38, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 50, -1, + -1, 53, 54, 55, -1, -1, -1, -1, 3, -1, + -1, -1, -1, -1, 66, 67, -1, 12, -1, 71, + 72, -1, -1, 18, -1, -1, -1, -1, -1, -1, + -1, -1, 27, -1, -1, 30, -1, -1, 90, -1, + 92, -1, 94, 95, 96, 97, -1, -1, -1, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 3, + -1, -1, -1, -1, -1, -1, -1, -1, 12, -1, + -1, -1, -1, -1, 18, -1, 71, 72, -1, -1, + -1, -1, -1, 27, -1, -1, 30, 31, -1, 33, + -1, 35, -1, -1, 38, 90, -1, 92, -1, 94, + 95, 96, 97, -1, 3, -1, -1, -1, -1, 53, + 54, 55, -1, 12, 109, 110, -1, -1, -1, 18, + -1, -1, 66, 67, -1, -1, -1, 71, 72, -1, + -1, 30, -1, -1, 33, -1, 35, -1, -1, 38, + -1, -1, -1, -1, -1, -1, 90, -1, 92, -1, + 94, 95, 96, 97, 53, 54, -1, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 66, 67, -1, + -1, -1, 71, 72, 3, -1, -1, -1, -1, -1, + -1, 80, -1, 12, -1, 3, -1, -1, -1, 18, + -1, 90, -1, 92, 12, 94, 95, 96, 97, -1, + 18, 30, -1, -1, -1, -1, -1, -1, -1, 38, + 109, 110, 30, -1, -1, -1, -1, -1, -1, -1, + 38, 3, -1, -1, -1, -1, 55, -1, -1, -1, + 12, 3, -1, -1, -1, -1, 18, 55, -1, -1, + 12, -1, 71, 72, -1, -1, 18, -1, 30, -1, + -1, -1, -1, 71, 72, -1, 38, -1, 30, -1, + -1, 90, -1, 92, -1, 94, 95, 96, 97, -1, + -1, -1, 90, 55, 92, -1, 94, 95, 96, 97, + 109, 110, -1, 55, -1, -1, -1, -1, -1, 71, + 72, 109, 110, -1, 3, -1, -1, -1, -1, 71, + 72, -1, -1, 12, -1, -1, -1, -1, 90, 18, + 92, -1, 94, 95, 96, 97, -1, -1, 90, -1, + 92, 30, 94, 95, 96, 97, 3, 109, 110, 38, + -1, -1, -1, -1, -1, 12, -1, 109, 110, -1, + -1, 18, -1, -1, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 30, 81, 82, 83, 84, -1, -1, + -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 90, -1, 92, -1, 94, 95, 96, 97, -1, + -1, -1, -1, -1, 71, 72, -1, -1, -1, -1, + 109, 110, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 90, -1, 92, -1, 94, 95, 96, + 97, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, -1, 109, 110, -1, 17, -1, 19, 20, 21, + 22, 23, 24, 25, 26, -1, -1, -1, 30, 4, + 5, 6, 7, 8, 9, 10, 11, -1, -1, -1, + -1, -1, 17, -1, 19, 20, 21, 22, 23, 24, + 25, 26, -1, -1, -1, 30, 4, 5, 6, 7, + 8, 9, 10, 11, -1, -1, -1, -1, -1, 17, + -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, + -1, -1, 30, -1, 86, 87, 88, -1, -1, -1, + -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 86, 87, 88, 89, -1, -1, -1, -1, -1, + -1, -1, 70, -1, -1, -1, -1, -1, -1, 4, + 5, 6, 7, 8, 9, 10, 11, -1, 86, 87, + 88, 89, 17, -1, 19, 20, 21, 22, 23, 24, + 25, 26, -1, -1, -1, 30, 4, 5, 6, 7, + 8, 9, 10, 11, -1, -1, -1, -1, -1, 17, + -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, + -1, -1, 30, 4, 5, 6, 7, 8, 9, 10, + 11, -1, -1, -1, -1, -1, 17, -1, 19, 20, + 21, 22, 23, 24, 25, 26, -1, -1, -1, 30, + -1, 86, 87, 88, 89, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, + 5, 6, 7, 8, 9, 10, 11, -1, 86, 87, + 88, 89, 17, -1, 19, 20, 21, 22, 23, 24, + 25, 26, -1, -1, -1, 30, 4, 5, 6, 7, + 8, 9, 10, 11, -1, 86, 87, 88, 89, 17, + -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, + -1, -1, 30, 4, 5, 6, 7, 8, 9, 10, + 11, -1, -1, -1, -1, -1, -1, -1, 19, 20, + 21, 22, 23, 24, 25, 26, 37, -1, -1, 30, + -1, 86, 87, 88, -1, -1, -1, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 39, -1, -1, 86, 87, + 88, -1, -1, -1, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 39, -1, -1, 86, 87, 88, -1, -1, + -1, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 39, + -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 40, -1, -1, -1, + -1, -1, -1, -1, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65 }; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *const yyRuleName[] = { - /* 0 */ "block ::= HASH cpp_exp EOL", - /* 1 */ "cpp_exp ::= ERROR|WARNING QUOTED_STRING", - /* 2 */ "cpp_exp ::= IFDEF NAME", - /* 3 */ "cpp_exp ::= IFNDEF NAME", - /* 4 */ "cpp_exp ::= ENDIF", - /* 5 */ "cpp_exp ::= ELSE", - /* 6 */ "cpp_exp ::= UNDEF NAME", - /* 7 */ "cpp_exp ::= DEFINE NAME cpp_macro_decl", - /* 8 */ "cpp_macro_decl ::=", - /* 9 */ "cpp_macro_decl ::= cpp_macro_sig", - /* 10 */ "cpp_macro_decl ::= cpp_macro_sig cpp_macro_decl_tokens", - /* 11 */ "cpp_macro_sig ::= NO_WHITESPACE LPAREN cpp_macro_sig_args RPAREN", - /* 12 */ "cpp_macro_sig_args ::=", - /* 13 */ "cpp_macro_sig_args ::= NAME", - /* 14 */ "cpp_macro_sig_args ::= cpp_macro_sig_args COMMA NAME", - /* 15 */ "cpp_macro_decl ::= cpp_macro_decl_tokens", - /* 16 */ "cpp_macro_decl_tokens ::= ANY", - /* 17 */ "cpp_macro_decl_tokens ::= cpp_macro_decl_tokens ANY", - /* 18 */ "cpp_exp ::= IF cpp_macro_exp", - /* 19 */ "cpp_exp ::= ELIF cpp_macro_exp", - /* 20 */ "cpp_macro_exp ::= LPAREN cpp_macro_exp RPAREN", - /* 21 */ "cpp_macro_exp ::= TILDE|NOT|PLUS|MINUS cpp_macro_exp", - /* 22 */ "cpp_macro_exp ::= cpp_macro_exp PIPE|CARET|AMPERSAND|LSHIFT|RSHIFT|PLUS|MINUS|ASTERISK|SLASH|MODULO|RCHEVR|LCHEVR|CMP_GE|CMP_LE|OR|AND|CMP_EQ|CMP_NE cpp_macro_exp", - /* 23 */ "cpp_macro_exp ::= DEFINED NAME", - /* 24 */ "cpp_macro_exp ::= DEFINED LPAREN NAME RPAREN", - /* 25 */ "cpp_macro_exp ::= NUMBER|NSNAME", - /* 26 */ "cpp_macro_exp ::= NAME", - /* 27 */ "cpp_macro_exp ::= NAME LPAREN cpp_macro_call_args RPAREN", - /* 28 */ "cpp_macro_call_args ::=", - /* 29 */ "cpp_macro_call_args ::= cpp_macro_exp", - /* 30 */ "cpp_macro_call_args ::= cpp_macro_call_args COMMA cpp_macro_exp", - /* 31 */ "block ::= LIB QUOTED_STRING EOS", - /* 32 */ "block ::= decl", - /* 33 */ "block ::= impl", - /* 34 */ "block ::= decl_typedef", - /* 35 */ "block ::= constant", - /* 36 */ "block ::= decl_struct", - /* 37 */ "block ::= decl_union", - /* 38 */ "block ::= decl_enum", - /* 39 */ "optional_name ::=", - /* 40 */ "optional_name ::= NAME", - /* 41 */ "align_and_size ::=", - /* 42 */ "align_and_size ::= COLON COLON LPAREN NUMBER COMMA NUMBER RPAREN", - /* 43 */ "enum_name ::= ENUM optional_name", - /* 44 */ "struct_name ::= STRUCT optional_name", - /* 45 */ "union_name ::= UNION optional_name", - /* 46 */ "decl_enum ::= enum_name LBRACE decl_enum_items RBRACE", - /* 47 */ "decl_enum_items ::= decl_enum_item", - /* 48 */ "decl_enum_items ::= decl_enum_items COMMA decl_enum_item", - /* 49 */ "decl_enum_item ::= NAME EQUALS num_exp", - /* 50 */ "decl_enum_item ::= NAME", - /* 51 */ "decl_struct_args_block ::= LBRACE struct_args RBRACE", - /* 52 */ "decl_struct_args ::= decl_struct_args_block", - /* 53 */ "decl_struct_args ::= EOS", - /* 54 */ "decl_struct ::= STRUCT NAME align_and_size decl_struct_args", - /* 55 */ "decl_union ::= UNION NAME align_and_size decl_struct_args", - /* 56 */ "const_type ::= BOOL|INT|FLOAT|STRING", - /* 57 */ "constant ::= CONST const_type NSNAME EQUALS impl_def_val EOS", - /* 58 */ "decl_typedef ::= TYPEDEF decl_typedef_body EOS", - /* 59 */ "decl_typedef_body_ex ::= struct_name align_and_size decl_struct_args_block decl_var", - /* 60 */ "decl_typedef_body_ex ::= union_name align_and_size decl_struct_args_block decl_var", - /* 61 */ "decl_typedef_body_ex ::= decl_enum NAME", - /* 62 */ "decl_typedef_body ::= decl_typedef_body_ex", - /* 63 */ "decl_typedef_body_fn_args ::= LPAREN decl_args RPAREN", - /* 64 */ "decl_typedef_body ::= decl_func decl_typedef_body_fn_args", - /* 65 */ "decl_typedef_body ::= decl_arg", - /* 66 */ "decl ::= decl_abi decl_func LPAREN decl_args RPAREN EOS", - /* 67 */ "decl ::= decl_abi decl_func LPAREN decl_args COMMA ELLIPSIS RPAREN EOS", - /* 68 */ "decl_func ::= decl_arg", - /* 69 */ "decl_func ::= VOID NAME", - /* 70 */ "decl_typedef_body ::= VOID indirection LPAREN indirection NAME RPAREN decl_typedef_body_fn_args", - /* 71 */ "decl_typedef_body ::= CONST VOID pointers LPAREN indirection NAME RPAREN decl_typedef_body_fn_args", - /* 72 */ "decl_abi ::= NAME", - /* 73 */ "decl_var_array_size ::=", - /* 74 */ "decl_var_array_size ::= LBRACKET NUMBER RBRACKET", - /* 75 */ "decl_var ::= NAME decl_var_array_size", - /* 76 */ "decl_var ::= pointers NAME decl_var_array_size", - /* 77 */ "decl_vars ::= decl_var", - /* 78 */ "decl_vars ::= decl_vars COMMA decl_var", - /* 79 */ "decl_arg ::= const_decl_type decl_var", - /* 80 */ "decl_typedef_body ::= const_decl_type indirection LPAREN indirection NAME RPAREN decl_typedef_body_fn_args", - /* 81 */ "decl_arg ::= VOID pointers NAME", - /* 82 */ "decl_arg ::= CONST VOID pointers NAME", - /* 83 */ "decl_args ::=", - /* 84 */ "decl_args ::= VOID", - /* 85 */ "decl_args ::= decl_arg", - /* 86 */ "decl_args ::= decl_args COMMA decl_arg", - /* 87 */ "struct_args ::= struct_arg", - /* 88 */ "struct_args ::= struct_args struct_arg", - /* 89 */ "struct_arg ::= decl_typedef_body_ex EOS", - /* 90 */ "struct_arg ::= decl_arg decl_layout EOS", - /* 91 */ "decl_layout ::=", - /* 92 */ "decl_layout ::= COLON COLON LPAREN NUMBER COMMA NUMBER RPAREN", - /* 93 */ "decl_scalar_type ::= CHAR", - /* 94 */ "decl_scalar_type ::= SHORT decl_scalar_type_short", - /* 95 */ "decl_scalar_type_short ::=", - /* 96 */ "decl_scalar_type_short ::= INT", - /* 97 */ "decl_scalar_type ::= INT", - /* 98 */ "decl_scalar_type ::= LONG decl_scalar_type_long", - /* 99 */ "decl_scalar_type_long ::=", - /* 100 */ "decl_scalar_type_long ::= DOUBLE", - /* 101 */ "decl_scalar_type_long ::= LONG decl_scalar_type_long_long", - /* 102 */ "decl_scalar_type_long_long ::=", - /* 103 */ "decl_scalar_type_long_long ::= INT", - /* 104 */ "decl_type ::= UNSIGNED decl_scalar_type", - /* 105 */ "decl_type ::= SIGNED decl_scalar_type", - /* 106 */ "decl_type ::= UNSIGNED", - /* 107 */ "decl_type ::= SIGNED", - /* 108 */ "decl_type ::= decl_scalar_type", - /* 109 */ "decl_type ::= STRUCT NAME", - /* 110 */ "decl_type ::= UNION NAME", - /* 111 */ "decl_type ::= ENUM NAME", - /* 112 */ "decl_type ::= FLOAT|DOUBLE|INT8|UINT8|INT16|UINT16|INT32|UINT32|INT64|UINT64|NAME", - /* 113 */ "const_decl_type ::= decl_type", - /* 114 */ "const_decl_type ::= CONST decl_type", - /* 115 */ "impl ::= impl_func LBRACE impl_stmts RBRACE", - /* 116 */ "impl ::= STATIC impl_func LBRACE impl_stmts RBRACE", - /* 117 */ "impl_func ::= FUNCTION reference NSNAME LPAREN RPAREN COLON impl_type", - /* 118 */ "impl_func ::= FUNCTION reference NSNAME LPAREN impl_args RPAREN COLON impl_type", - /* 119 */ "impl_func ::= FUNCTION reference NSNAME LPAREN impl_args COMMA impl_type reference ELLIPSIS DOLLAR_NAME RPAREN COLON impl_type", - /* 120 */ "impl_def_val ::= NULL|NUMBER|TRUE|FALSE|QUOTED_STRING", - /* 121 */ "impl_var ::= reference DOLLAR_NAME", - /* 122 */ "impl_type ::= VOID|MIXED|BOOL|INT|FLOAT|STRING|ARRAY|OBJECT|CALLABLE", - /* 123 */ "impl_arg ::= impl_type impl_var", - /* 124 */ "impl_arg ::= impl_type impl_var EQUALS impl_def_val", - /* 125 */ "impl_args ::= impl_arg", - /* 126 */ "impl_args ::= impl_args COMMA impl_arg", - /* 127 */ "impl_stmts ::= impl_stmt", - /* 128 */ "impl_stmts ::= impl_stmts impl_stmt", - /* 129 */ "impl_stmt ::= return_stmt", - /* 130 */ "impl_stmt ::= let_stmt", - /* 131 */ "impl_stmt ::= set_stmt", - /* 132 */ "impl_stmt ::= assert_stmt", - /* 133 */ "impl_stmt ::= free_stmt", - /* 134 */ "number ::= NUMBER|NSNAME", - /* 135 */ "number ::= decl_var", - /* 136 */ "num_exp ::= number", - /* 137 */ "num_exp ::= LPAREN num_exp RPAREN", - /* 138 */ "num_exp ::= num_exp PIPE|CARET|AMPERSAND|LSHIFT|RSHIFT|PLUS|MINUS|ASTERISK|SLASH|MODULO|RCHEVR|LCHEVR|CMP_GE|CMP_LE|OR|AND|CMP_EQ|CMP_NE num_exp", - /* 139 */ "num_exp ::= TILDE|NOT|PLUS|MINUS num_exp", - /* 140 */ "let_exp ::= NULL", - /* 141 */ "let_exp ::= AMPERSAND NULL", - /* 142 */ "let_exp ::= let_callback", - /* 143 */ "let_exp ::= let_calloc", - /* 144 */ "let_exp ::= AMPERSAND let_calloc", - /* 145 */ "let_exp ::= let_func", - /* 146 */ "let_exp ::= AMPERSAND let_func", - /* 147 */ "let_exp ::= num_exp", - /* 148 */ "let_exp ::= AMPERSAND num_exp", - /* 149 */ "let_exp ::= decl_var EQUALS let_exp", - /* 150 */ "let_stmt ::= LET let_exp EOS", - /* 151 */ "let_stmt ::= TEMP decl_var EQUALS reference decl_var EOS", - /* 152 */ "let_callback ::= CALLBACK callback_rval LPAREN impl_var LPAREN callback_arg_list RPAREN RPAREN", - /* 153 */ "let_calloc ::= CALLOC LPAREN num_exp COMMA num_exp RPAREN", - /* 154 */ "let_func ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT LPAREN impl_var RPAREN", - /* 155 */ "let_func ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT LPAREN impl_var COMMA let_exps RPAREN", - /* 156 */ "let_exps ::= let_exp", - /* 157 */ "let_exps ::= let_exps COMMA let_exp", - /* 158 */ "callback_arg_list ::=", - /* 159 */ "callback_arg_list ::= callback_args", - /* 160 */ "callback_args ::= set_exp", - /* 161 */ "callback_args ::= callback_args COMMA set_exp", - /* 162 */ "callback_rval ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT", - /* 163 */ "callback_rval ::= VOID", - /* 164 */ "set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var RPAREN", - /* 165 */ "set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var COMMA set_exps RPAREN", - /* 166 */ "set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var COMMA ELLIPSIS RPAREN", - /* 167 */ "set_exp ::= set_func", - /* 168 */ "set_exp ::= num_exp", - /* 169 */ "set_exps ::= set_exp", - /* 170 */ "set_exps ::= set_exps COMMA set_exp", - /* 171 */ "set_exp ::= impl_var EQUALS set_exp", - /* 172 */ "set_stmt ::= SET set_exp EOS", - /* 173 */ "return_stmt ::= RETURN set_func EOS", - /* 174 */ "free_stmt ::= FREE free_exps EOS", - /* 175 */ "free_exps ::= free_exp", - /* 176 */ "free_exps ::= free_exps COMMA free_exp", - /* 177 */ "free_exp ::= NAME LPAREN decl_vars RPAREN", - /* 178 */ "assert_stmt ::= PRE_ASSERT|POST_ASSERT num_exp EOS", - /* 179 */ "reference ::=", - /* 180 */ "reference ::= AMPERSAND", - /* 181 */ "indirection ::=", - /* 182 */ "indirection ::= pointers", - /* 183 */ "pointers ::= ASTERISK", - /* 184 */ "pointers ::= pointers ASTERISK", - /* 185 */ "file ::= blocks", - /* 186 */ "blocks ::= block", - /* 187 */ "blocks ::= blocks block", - /* 188 */ "block ::= EOS", - /* 189 */ "block ::= EOL", - /* 190 */ "block ::= COMMENT", + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned char yystos[] = +{ + 0, 4, 5, 6, 7, 8, 9, 10, 11, 17, + 19, 20, 21, 22, 23, 24, 25, 26, 30, 36, + 37, 47, 85, 86, 87, 88, 89, 90, 91, 93, + 117, 128, 129, 130, 131, 132, 148, 153, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 168, 169, 170, + 171, 172, 174, 176, 177, 182, 187, 196, 197, 9, + 11, 3, 12, 18, 30, 38, 55, 71, 72, 90, + 92, 94, 95, 96, 97, 109, 110, 126, 195, 30, + 86, 87, 88, 89, 170, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 81, 82, 83, 84, 133, 134, + 135, 137, 138, 139, 86, 87, 154, 169, 174, 182, + 188, 189, 126, 126, 126, 190, 3, 6, 10, 12, + 17, 149, 150, 156, 34, 197, 50, 231, 232, 0, + 130, 126, 175, 194, 195, 4, 5, 6, 9, 164, + 6, 161, 167, 37, 38, 42, 42, 194, 195, 38, + 55, 126, 126, 126, 126, 38, 27, 126, 140, 36, + 0, 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, 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, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 83, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 120, 127, 143, 144, 34, 120, 136, + 27, 126, 33, 35, 38, 53, 54, 66, 67, 80, + 125, 126, 145, 126, 190, 126, 190, 37, 126, 41, + 192, 192, 192, 192, 195, 31, 37, 42, 31, 44, + 193, 38, 126, 6, 165, 6, 9, 166, 164, 17, + 89, 155, 173, 174, 126, 183, 184, 94, 95, 96, + 97, 98, 99, 100, 203, 204, 205, 218, 219, 225, + 226, 227, 126, 194, 173, 143, 119, 143, 127, 145, + 38, 126, 145, 38, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 124, 41, 42, 179, 179, 37, 178, 179, + 178, 38, 126, 46, 203, 38, 33, 194, 193, 195, + 17, 195, 39, 40, 46, 40, 43, 175, 208, 17, + 18, 31, 33, 35, 38, 111, 112, 113, 114, 115, + 116, 125, 175, 185, 186, 200, 220, 221, 222, 231, + 175, 126, 228, 229, 18, 221, 43, 204, 185, 39, + 126, 39, 40, 38, 39, 126, 145, 146, 147, 145, + 38, 154, 180, 181, 175, 175, 194, 27, 28, 29, + 33, 34, 151, 152, 43, 3, 6, 10, 12, 13, + 14, 15, 16, 17, 39, 198, 199, 201, 202, 45, + 126, 195, 193, 17, 70, 174, 185, 184, 46, 37, + 30, 89, 155, 185, 185, 124, 46, 37, 38, 32, + 46, 38, 37, 40, 37, 37, 39, 193, 70, 126, + 141, 142, 39, 39, 40, 33, 41, 191, 43, 181, + 126, 37, 41, 39, 40, 200, 39, 39, 18, 27, + 92, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 185, 207, 209, 210, 211, 212, 232, 39, 39, + 185, 220, 175, 231, 175, 230, 229, 39, 39, 40, + 145, 40, 41, 37, 39, 201, 41, 199, 201, 46, + 193, 17, 18, 109, 212, 215, 38, 38, 207, 185, + 40, 223, 175, 39, 40, 193, 143, 126, 33, 38, + 201, 231, 151, 38, 185, 200, 70, 220, 224, 39, + 37, 175, 39, 33, 70, 200, 40, 40, 213, 39, + 40, 40, 32, 38, 185, 175, 206, 207, 208, 214, + 232, 39, 220, 33, 39, 216, 217, 220, 39, 40, + 207, 39, 41, 39, 40, 206, 201, 39, 220 }; -#endif /* NDEBUG */ - - -#if YYSTACKDEPTH<=0 -/* -** Try to increase the size of the parser stack. Return the number -** of errors. Return 0 on success. -*/ -static int yyGrowStack(yyParser *p){ - int newSize; - int idx; - yyStackEntry *pNew; - - newSize = p->yystksz*2 + 100; - idx = p->yytos ? (int)(p->yytos - p->yystack) : 0; - if( p->yystack==&p->yystk0 ){ - pNew = malloc(newSize*sizeof(pNew[0])); - if( pNew ) pNew[0] = p->yystk0; - }else{ - pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); - } - if( pNew ){ - p->yystack = pNew; - p->yytos = &p->yystack[idx]; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", - yyTracePrompt, p->yystksz, newSize); - } + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const unsigned char yyr1[] = +{ + 0, 123, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 125, 125, 125, 125, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 128, 128, 129, 129, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 131, 132, + 133, 133, 133, 133, 133, 133, 133, 134, 134, 135, + 135, 135, 136, 136, 137, 137, 138, 138, 138, 139, + 139, 140, 140, 140, 141, 141, 142, 142, 143, 143, + 144, 144, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 146, 146, 147, 147, 148, 149, 150, 150, 150, + 150, 151, 151, 152, 152, 152, 152, 152, 153, 154, + 154, 154, 154, 154, 155, 155, 156, 156, 157, 157, + 157, 158, 158, 158, 158, 159, 159, 159, 160, 160, + 160, 160, 160, 160, 160, 160, 161, 161, 162, 162, + 162, 163, 163, 163, 163, 164, 164, 164, 164, 164, + 165, 165, 166, 166, 166, 167, 167, 167, 168, 169, + 169, 169, 169, 170, 170, 171, 171, 171, 171, 172, + 172, 173, 173, 173, 173, 174, 174, 174, 175, 175, + 176, 177, 178, 178, 179, 180, 180, 181, 182, 183, + 183, 184, 184, 185, 185, 185, 185, 185, 186, 186, + 186, 186, 187, 188, 189, 190, 190, 191, 191, 192, + 192, 193, 193, 194, 194, 195, 195, 196, 196, 197, + 197, 197, 198, 198, 199, 199, 200, 201, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 203, 203, 204, + 204, 204, 204, 204, 205, 205, 206, 206, 206, 207, + 207, 207, 207, 207, 208, 208, 209, 210, 211, 212, + 212, 212, 212, 212, 212, 212, 212, 212, 212, 213, + 213, 214, 214, 215, 215, 216, 216, 217, 217, 218, + 219, 220, 220, 220, 221, 221, 222, 222, 222, 222, + 222, 222, 222, 222, 223, 223, 224, 224, 225, 226, + 226, 227, 228, 228, 229, 230, 230, 231, 231, 232 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const unsigned char yyr2[] = +{ + 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 0, 1, 1, 2, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, + 2, 2, 1, 2, 2, 2, 2, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 6, 2, 2, 0, 1, 1, 3, 0, 1, + 1, 2, 3, 2, 3, 2, 4, 1, 1, 1, + 4, 0, 1, 1, 3, 6, 1, 1, 1, 1, + 1, 0, 1, 1, 1, 1, 1, 1, 3, 1, + 1, 2, 4, 4, 2, 1, 1, 1, 2, 2, + 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 1, 1, 2, 2, 0, 1, 2, 1, 2, + 0, 1, 0, 1, 1, 0, 1, 2, 2, 5, + 7, 6, 8, 1, 1, 6, 7, 6, 5, 1, + 2, 0, 1, 1, 3, 2, 4, 3, 3, 2, + 4, 4, 1, 1, 3, 1, 2, 3, 4, 1, + 3, 1, 3, 1, 4, 3, 3, 2, 1, 1, + 1, 1, 2, 2, 2, 0, 1, 0, 7, 0, + 7, 0, 3, 0, 1, 1, 2, 4, 5, 7, + 8, 13, 1, 3, 2, 4, 2, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, + 1, 1, 1, 1, 3, 6, 1, 2, 1, 1, + 1, 1, 1, 1, 3, 4, 6, 8, 5, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, + 2, 1, 3, 1, 1, 0, 1, 1, 3, 3, + 3, 1, 1, 3, 5, 6, 1, 1, 1, 1, + 1, 1, 1, 1, 0, 2, 1, 3, 3, 1, + 1, 3, 1, 3, 4, 1, 3, 0, 1, 1 +}; + + +/* YYDPREC[RULE-NUM] -- Dynamic precedence of rule #RULE-NUM (0 if none). */ +static const unsigned char yydprec[] = +{ + 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, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* YYMERGER[RULE-NUM] -- Index of merging function for rule #RULE-NUM. */ +static const unsigned char yymerger[] = +{ + 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, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* YYIMMEDIATE[RULE-NUM] -- True iff rule #RULE-NUM is not to be deferred, as + in the case of predicates. */ +static const yybool yyimmediate[] = +{ + 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, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of + list of conflicting reductions corresponding to action entry for + state STATE-NUM in yytable. 0 means no conflicts. The list in + yyconfl is terminated by a rule number of 0. */ +static const unsigned char yyconflp[] = +{ + 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, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 0, 3, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 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, 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, 0, 0, + 0, 0, 0, 0, 0, 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, 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, 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, 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, + 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, 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, 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, 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, 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, + 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by + 0, pointed into by YYCONFLP. */ +static const short int yyconfl[] = +{ + 0, 244, 0, 244, 0 +}; + +/* Error token number */ +#define YYTERROR 1 + + + + +#undef yynerrs +#define yynerrs (yystackp->yyerrcnt) +#undef yychar +#define yychar (yystackp->yyrawchar) +#undef yylval +#define yylval (yystackp->yyval) +#undef yylloc +#define yylloc (yystackp->yyloc) +#define psi_parser_proc_nerrs yynerrs +#define psi_parser_proc_char yychar +#define psi_parser_proc_lval yylval +#define psi_parser_proc_lloc yylloc + +static const int YYEOF = 0; +static const int YYEMPTY = -2; + +typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG; + +#define YYCHK(YYE) \ + do { \ + YYRESULTTAG yychk_flag = YYE; \ + if (yychk_flag != yyok) \ + return yychk_flag; \ + } while (0) + +#if YYDEBUG + +# ifndef YYFPRINTF +# define YYFPRINTF fprintf +# endif + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif - p->yystksz = newSize; - } - return pNew==0; + + +# define YYDPRINTF(Args) \ + do { \ + if (yydebug) \ + YYFPRINTF Args; \ + } while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + YYUSE (P); + YYUSE (tokens); + YYUSE (index); + if (!yyvaluep) + return; + YYUSE (yytype); } -#endif -/* Datatype of the argument to the memory allocated passed as the -** second argument to ParseAlloc() below. This can be changed by -** putting an appropriate #define in the %include section of the input -** grammar. -*/ -#ifndef YYMALLOCARGTYPE -# define YYMALLOCARGTYPE size_t + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep, P, tokens, index); + YYFPRINTF (yyoutput, ")"); +} + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ + do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, Type, Value, P, tokens, index); \ + YYFPRINTF (stderr, "\n"); \ + } \ + } while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; + +struct yyGLRStack; +static void yypstack (struct yyGLRStack* yystackp, size_t yyk) + YY_ATTRIBUTE_UNUSED; +static void yypdumpstack (struct yyGLRStack* yystackp) + YY_ATTRIBUTE_UNUSED; + +#else /* !YYDEBUG */ + +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) + +#endif /* !YYDEBUG */ + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 #endif -/* Initialize a new parser that has already been allocated. -*/ -void ParseInit(void *yypParser){ - yyParser *pParser = (yyParser*)yypParser; -#ifdef YYTRACKMAXSTACKDEPTH - pParser->yyhwm = 0; +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + SIZE_MAX < YYMAXDEPTH * sizeof (GLRStackItem) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 #endif -#if YYSTACKDEPTH<=0 - pParser->yytos = NULL; - pParser->yystack = NULL; - pParser->yystksz = 0; - if( yyGrowStack(pParser) ){ - pParser->yystack = &pParser->yystk0; - pParser->yystksz = 1; - } + +/* Minimum number of free items on the stack allowed after an + allocation. This is to allow allocation and initialization + to be completed by functions that call yyexpandGLRStack before the + stack is expanded, thus insuring that all necessary pointers get + properly redirected to new data. */ +#define YYHEADROOM 2 + +#ifndef YYSTACKEXPANDABLE +# define YYSTACKEXPANDABLE 1 #endif -#ifndef YYNOERRORRECOVERY - pParser->yyerrcnt = -1; + +#if YYSTACKEXPANDABLE +# define YY_RESERVE_GLRSTACK(Yystack) \ + do { \ + if (Yystack->yyspaceLeft < YYHEADROOM) \ + yyexpandGLRStack (Yystack); \ + } while (0) +#else +# define YY_RESERVE_GLRSTACK(Yystack) \ + do { \ + if (Yystack->yyspaceLeft < YYHEADROOM) \ + yyMemoryExhausted (Yystack); \ + } while (0) #endif - pParser->yytos = pParser->yystack; - pParser->yystack[0].stateno = 0; - pParser->yystack[0].major = 0; -} - -#ifndef Parse_ENGINEALWAYSONSTACK -/* -** This function allocates a new parser. -** The only argument is a pointer to a function which works like -** malloc. -** -** Inputs: -** A pointer to the function used to allocate memory. -** -** Outputs: -** A pointer to a parser. This pointer is used in subsequent calls -** to Parse and ParseFree. -*/ -void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); - if( pParser ) ParseInit(pParser); - return pParser; -} -#endif /* Parse_ENGINEALWAYSONSTACK */ - - -/* The following function deletes the "minor type" or semantic value -** associated with a symbol. The symbol can be either a terminal -** or nonterminal. "yymajor" is the symbol code, and "yypminor" is -** a pointer to the value to be deleted. The code used to do the -** deletions is derived from the %destructor and/or %token_destructor -** directives of the input grammar. -*/ -static void yy_destructor( - yyParser *yypParser, /* The parser */ - YYCODETYPE yymajor, /* Type code for object to destroy */ - YYMINORTYPE *yypminor /* The object to be destroyed */ -){ - ParseARG_FETCH; - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are *not* used - ** inside the C code. - */ -/********* Begin destructor definitions ***************************************/ - /* TERMINAL Destructor */ - case 1: /* BOOL */ - case 2: /* INT */ - case 3: /* FLOAT */ - case 4: /* STRING */ - case 5: /* DOUBLE */ - case 6: /* INT8 */ - case 7: /* UINT8 */ - case 8: /* INT16 */ - case 9: /* UINT16 */ - case 10: /* INT32 */ - case 11: /* UINT32 */ - case 12: /* INT64 */ - case 13: /* UINT64 */ - case 14: /* NAME */ - case 15: /* NULL */ - case 16: /* NUMBER */ - case 17: /* TRUE */ - case 18: /* FALSE */ - case 19: /* QUOTED_STRING */ - case 20: /* NSNAME */ - case 21: /* PIPE */ - case 22: /* CARET */ - case 23: /* AMPERSAND */ - case 24: /* LSHIFT */ - case 25: /* RSHIFT */ - case 26: /* PLUS */ - case 27: /* MINUS */ - case 28: /* ASTERISK */ - case 29: /* SLASH */ - case 30: /* MODULO */ - case 31: /* RCHEVR */ - case 32: /* LCHEVR */ - case 33: /* CMP_GE */ - case 34: /* CMP_LE */ - case 35: /* OR */ - case 36: /* AND */ - case 37: /* CMP_EQ */ - case 38: /* CMP_NE */ - case 39: /* TILDE */ - case 40: /* NOT */ - case 41: /* ZVAL */ - case 42: /* OBJVAL */ - case 43: /* ARRVAL */ - case 44: /* PATHVAL */ - case 45: /* STRLEN */ - case 46: /* STRVAL */ - case 47: /* FLOATVAL */ - case 48: /* INTVAL */ - case 49: /* BOOLVAL */ - case 50: /* COUNT */ - case 51: /* TO_OBJECT */ - case 52: /* TO_ARRAY */ - case 53: /* TO_STRING */ - case 54: /* TO_INT */ - case 55: /* TO_FLOAT */ - case 56: /* TO_BOOL */ - case 57: /* VOID */ - case 58: /* MIXED */ - case 59: /* ARRAY */ - case 60: /* OBJECT */ - case 61: /* CALLABLE */ - case 62: /* PRE_ASSERT */ - case 63: /* POST_ASSERT */ - case 64: /* ERROR */ - case 65: /* WARNING */ - case 66: /* TEMP */ - case 67: /* FREE */ - case 68: /* SET */ - case 69: /* LET */ - case 70: /* RETURN */ - case 71: /* CALLOC */ - case 72: /* CALLBACK */ - case 73: /* LIB */ - case 74: /* ANY */ - case 75: /* EOS */ - case 76: /* EOL */ - case 77: /* COMMENT */ - case 78: /* HASH */ - case 79: /* IFDEF */ - case 80: /* IFNDEF */ - case 81: /* ENDIF */ - case 82: /* ELSE */ - case 83: /* UNDEF */ - case 84: /* DEFINE */ - case 85: /* NO_WHITESPACE */ - case 86: /* LPAREN */ - case 87: /* RPAREN */ - case 88: /* COMMA */ - case 89: /* IF */ - case 90: /* ELIF */ - case 91: /* DEFINED */ - case 92: /* COLON */ - case 93: /* ENUM */ - case 94: /* STRUCT */ - case 95: /* UNION */ - case 96: /* LBRACE */ - case 97: /* RBRACE */ - case 98: /* EQUALS */ - case 99: /* CONST */ - case 100: /* TYPEDEF */ - case 101: /* ELLIPSIS */ - case 102: /* LBRACKET */ - case 103: /* RBRACKET */ - case 104: /* CHAR */ - case 105: /* SHORT */ - case 106: /* LONG */ - case 107: /* UNSIGNED */ - case 108: /* SIGNED */ - case 109: /* STATIC */ - case 110: /* FUNCTION */ - case 111: /* DOLLAR_NAME */ -{ -#line 37 "src/parser_proc.y" -free((yypminor->yy0)); -#line 1220 "src/parser_proc.c" -} - break; - /* Default NON-TERMINAL Destructor */ - case 112: /* error */ - case 119: /* align_and_size */ - case 176: /* reference */ - case 177: /* indirection */ - case 178: /* pointers */ - case 179: /* file */ - case 180: /* blocks */ - case 181: /* block */ - case 182: /* optional_name */ - case 183: /* enum_name */ - case 184: /* struct_name */ - case 185: /* union_name */ - case 186: /* decl_var_array_size */ - case 187: /* decl_scalar_type */ - case 188: /* decl_scalar_type_short */ - case 189: /* decl_scalar_type_long */ - case 190: /* decl_scalar_type_long_long */ - case 191: /* callback_rval */ -{ -#line 38 "src/parser_proc.y" -(void)P; -#line 1245 "src/parser_proc.c" -} - break; - case 113: /* decl_enum */ -{ -#line 66 "src/parser_proc.y" -psi_decl_enum_free(&(yypminor->yy323)); -#line 1252 "src/parser_proc.c" -} - break; - case 114: /* decl_enum_items */ - case 116: /* decl_struct_args_block */ - case 117: /* decl_struct_args */ - case 126: /* decl_typedef_body_fn_args */ - case 131: /* decl_vars */ - case 133: /* decl_args */ - case 134: /* struct_args */ - case 144: /* impl_args */ - case 146: /* impl_stmts */ - case 157: /* let_exps */ - case 161: /* set_exps */ - case 165: /* free_exps */ - case 170: /* cpp_macro_decl_tokens */ - case 172: /* cpp_macro_sig */ - case 173: /* cpp_macro_sig_args */ - case 174: /* cpp_macro_call */ - case 175: /* cpp_macro_call_args */ -{ -#line 68 "src/parser_proc.y" -psi_plist_free((yypminor->yy179)); -#line 1275 "src/parser_proc.c" -} - break; - case 115: /* decl_enum_item */ -{ -#line 70 "src/parser_proc.y" -psi_decl_enum_item_free(&(yypminor->yy169)); -#line 1282 "src/parser_proc.c" + + +#if YYERROR_VERBOSE + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; } - break; - case 118: /* decl_struct */ -{ -#line 76 "src/parser_proc.y" -psi_decl_struct_free(&(yypminor->yy324)); -#line 1289 "src/parser_proc.c" +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static size_t +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + size_t yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return strlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; } - break; - case 120: /* decl_union */ +# endif + +#endif /* !YYERROR_VERBOSE */ + +/** State numbers, as in LALR(1) machine */ +typedef int yyStateNum; + +/** Rule numbers, as in LALR(1) machine */ +typedef int yyRuleNum; + +/** Grammar symbol */ +typedef int yySymbol; + +/** Item references, as in LALR(1) machine */ +typedef short int yyItemNum; + +typedef struct yyGLRState yyGLRState; +typedef struct yyGLRStateSet yyGLRStateSet; +typedef struct yySemanticOption yySemanticOption; +typedef union yyGLRStackItem yyGLRStackItem; +typedef struct yyGLRStack yyGLRStack; + +struct yyGLRState { + /** Type tag: always true. */ + yybool yyisState; + /** Type tag for yysemantics. If true, yysval applies, otherwise + * yyfirstVal applies. */ + yybool yyresolved; + /** Number of corresponding LALR(1) machine state. */ + yyStateNum yylrState; + /** Preceding state in this stack */ + yyGLRState* yypred; + /** Source position of the last token produced by my symbol */ + size_t yyposn; + union { + /** First in a chain of alternative reductions producing the + * non-terminal corresponding to this state, threaded through + * yynext. */ + yySemanticOption* yyfirstVal; + /** Semantic value for this state. */ + YYSTYPE yysval; + } yysemantics; +}; + +struct yyGLRStateSet { + yyGLRState** yystates; + /** During nondeterministic operation, yylookaheadNeeds tracks which + * stacks have actually needed the current lookahead. During deterministic + * operation, yylookaheadNeeds[0] is not maintained since it would merely + * duplicate yychar != YYEMPTY. */ + yybool* yylookaheadNeeds; + size_t yysize, yycapacity; +}; + +struct yySemanticOption { + /** Type tag: always false. */ + yybool yyisState; + /** Rule number for this reduction */ + yyRuleNum yyrule; + /** The last RHS state in the list of states to be reduced. */ + yyGLRState* yystate; + /** The lookahead for this reduction. */ + int yyrawchar; + YYSTYPE yyval; + /** Next sibling in chain of options. To facilitate merging, + * options are chained in decreasing order by address. */ + yySemanticOption* yynext; +}; + +/** Type of the items in the GLR stack. The yyisState field + * indicates which item of the union is valid. */ +union yyGLRStackItem { + yyGLRState yystate; + yySemanticOption yyoption; +}; + +struct yyGLRStack { + int yyerrState; + + + int yyerrcnt; + int yyrawchar; + YYSTYPE yyval; + + YYJMP_BUF yyexception_buffer; + yyGLRStackItem* yyitems; + yyGLRStackItem* yynextFree; + size_t yyspaceLeft; + yyGLRState* yysplitPoint; + yyGLRState* yylastDeleted; + yyGLRStateSet yytops; +}; + +#if YYSTACKEXPANDABLE +static void yyexpandGLRStack (yyGLRStack* yystackp); +#endif + +static _Noreturn void +yyFail (yyGLRStack* yystackp, struct psi_parser *P, struct psi_plist *tokens, size_t *index, const char* yymsg) { -#line 79 "src/parser_proc.y" -psi_decl_union_free(&(yypminor->yy15)); -#line 1296 "src/parser_proc.c" + if (yymsg != YY_NULLPTR) + yyerror (P, tokens, index, yymsg); + YYLONGJMP (yystackp->yyexception_buffer, 1); } - break; - case 121: /* const_type */ + +static _Noreturn void +yyMemoryExhausted (yyGLRStack* yystackp) { -#line 81 "src/parser_proc.y" -psi_const_type_free(&(yypminor->yy351)); -#line 1303 "src/parser_proc.c" + YYLONGJMP (yystackp->yyexception_buffer, 2); } - break; - case 122: /* constant */ + +#if YYDEBUG || YYERROR_VERBOSE +/** A printable representation of TOKEN. */ +static inline const char* +yytokenName (yySymbol yytoken) { -#line 83 "src/parser_proc.y" -psi_const_free(&(yypminor->yy38)); -#line 1310 "src/parser_proc.c" + if (yytoken == YYEMPTY) + return ""; + + return yytname[yytoken]; } - break; - case 123: /* decl_typedef */ - case 124: /* decl_typedef_body_ex */ - case 125: /* decl_typedef_body */ - case 128: /* decl_func */ - case 132: /* decl_arg */ - case 135: /* struct_arg */ +#endif + +/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting + * at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred + * containing the pointer to the next state in the chain. */ +static void yyfillin (yyGLRStackItem *, int, int) YY_ATTRIBUTE_UNUSED; +static void +yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1) { -#line 85 "src/parser_proc.y" -psi_decl_arg_free(&(yypminor->yy320)); -#line 1322 "src/parser_proc.c" + int i; + yyGLRState *s = yyvsp[yylow0].yystate.yypred; + for (i = yylow0-1; i >= yylow1; i -= 1) + { +#if YYDEBUG + yyvsp[i].yystate.yylrState = s->yylrState; +#endif + yyvsp[i].yystate.yyresolved = s->yyresolved; + if (s->yyresolved) + yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval; + else + /* The effect of using yysval or yyloc (in an immediate rule) is + * undefined. */ + yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULLPTR; + s = yyvsp[i].yystate.yypred = s->yypred; + } } - break; - case 127: /* decl */ -{ -#line 93 "src/parser_proc.y" -psi_decl_free(&(yypminor->yy303)); -#line 1329 "src/parser_proc.c" + +/* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1. Otherwise, fill in + * YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1. + * For convenience, always return YYLOW1. */ +static inline int yyfill (yyGLRStackItem *, int *, int, yybool) + YY_ATTRIBUTE_UNUSED; +static inline int +yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal) +{ + if (!yynormal && yylow1 < *yylow) + { + yyfillin (yyvsp, *yylow, yylow1); + *yylow = yylow1; + } + return yylow1; } - break; - case 129: /* decl_abi */ -{ -#line 97 "src/parser_proc.y" -psi_decl_abi_free(&(yypminor->yy26)); -#line 1336 "src/parser_proc.c" + +/** Perform user action for rule number YYN, with RHS length YYRHSLEN, + * and top stack item YYVSP. YYLVALP points to place to put semantic + * value ($$), and yylocp points to place for location information + * (@$). Returns yyok for normal return, yyaccept for YYACCEPT, + * yyerr for YYERROR, yyabort for YYABORT. */ +static YYRESULTTAG +yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp, + yyGLRStack* yystackp, + YYSTYPE* yyvalp, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + yybool yynormal YY_ATTRIBUTE_UNUSED = (yystackp->yysplitPoint == YY_NULLPTR); + int yylow; + YYUSE (yyvalp); + YYUSE (P); + YYUSE (tokens); + YYUSE (index); + YYUSE (yyrhslen); +# undef yyerrok +# define yyerrok (yystackp->yyerrState = 0) +# undef YYACCEPT +# define YYACCEPT return yyaccept +# undef YYABORT +# define YYABORT return yyabort +# undef YYERROR +# define YYERROR return yyerrok, yyerr +# undef YYRECOVERING +# define YYRECOVERING() (yystackp->yyerrState != 0) +# undef yyclearin +# define yyclearin (yychar = YYEMPTY) +# undef YYFILL +# define YYFILL(N) yyfill (yyvsp, &yylow, N, yynormal) +# undef YYBACKUP +# define YYBACKUP(Token, Value) \ + return yyerror (P, tokens, index, YY_("syntax error: cannot back up")), \ + yyerrok, yyerr + + yylow = 1; + if (yyrhslen == 0) + *yyvalp = yyval_default; + else + *yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval; + switch (yyn) + { + case 159: +#line 404 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + if ((*(struct psi_cpp_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))) { + psi_cpp_exp_exec((*(struct psi_cpp_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)), P->preproc, PSI_DATA(P)); + psi_cpp_exp_free(&(*(struct psi_cpp_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + } } - break; - case 130: /* decl_var */ -{ -#line 99 "src/parser_proc.y" -psi_decl_var_free(&(yypminor->yy271)); -#line 1343 "src/parser_proc.c" +#line 2014 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 160: +#line 410 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + if (P->file.ln) { + P->error(PSI_DATA(P), (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)), PSI_WARNING, + "Extra 'lib %s' statement has no effect", (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text); + } else { + P->file.ln = strndup((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text + 1, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->size - 2); + } } - break; - case 136: /* decl_layout */ -{ -#line 111 "src/parser_proc.y" -psi_layout_free(&(yypminor->yy369)); -#line 1350 "src/parser_proc.c" +#line 2027 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 161: +#line 418 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + psi_parser_proc_add_const(P, (*(struct psi_const **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 137: /* decl_type */ - case 138: /* const_decl_type */ -{ -#line 113 "src/parser_proc.y" -psi_decl_type_free(&(yypminor->yy172)); -#line 1358 "src/parser_proc.c" +#line 2035 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 162: +#line 421 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + psi_parser_proc_add_decl(P, (*(struct psi_decl **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 139: /* impl */ -{ -#line 117 "src/parser_proc.y" -psi_impl_free(&(yypminor->yy49)); -#line 1365 "src/parser_proc.c" +#line 2043 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 163: +#line 424 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + psi_parser_proc_add_typedef(P, (*(struct psi_decl_arg **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 140: /* impl_func */ -{ -#line 119 "src/parser_proc.y" -psi_impl_func_free(&(yypminor->yy56)); -#line 1372 "src/parser_proc.c" +#line 2051 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 164: +#line 427 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + psi_parser_proc_add_struct(P, (*(struct psi_decl_struct **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 141: /* impl_def_val */ -{ -#line 121 "src/parser_proc.y" -psi_impl_def_val_free(&(yypminor->yy145)); -#line 1379 "src/parser_proc.c" +#line 2059 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 165: +#line 430 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + psi_parser_proc_add_union(P, (*(struct psi_decl_union **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 142: /* impl_var */ -{ -#line 123 "src/parser_proc.y" -psi_impl_var_free(&(yypminor->yy370)); -#line 1386 "src/parser_proc.c" +#line 2067 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 166: +#line 433 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + psi_parser_proc_add_enum(P, (*(struct psi_decl_enum **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 143: /* impl_arg */ - case 145: /* impl_vararg */ -{ -#line 125 "src/parser_proc.y" -psi_impl_arg_free(&(yypminor->yy34)); -#line 1394 "src/parser_proc.c" +#line 2075 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 167: +#line 436 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + psi_parser_proc_add_impl(P, (*(struct psi_impl **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 147: /* impl_stmt */ -{ -#line 133 "src/parser_proc.y" -psi_impl_stmt_free(&(yypminor->yy238)); -#line 1401 "src/parser_proc.c" +#line 2083 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 168: +#line 442 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)); } - break; - case 148: /* number */ -{ -#line 135 "src/parser_proc.y" -psi_number_free(&(yypminor->yy57)); -#line 1408 "src/parser_proc.c" +#line 2091 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 169: +#line 448 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_cpp_exp **)(&(*yyvalp))) = (*(struct psi_cpp_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)); } - break; - case 149: /* num_exp */ - case 171: /* cpp_macro_exp */ -{ -#line 137 "src/parser_proc.y" -psi_num_exp_free(&(yypminor->yy207)); -#line 1416 "src/parser_proc.c" +#line 2099 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 170: +#line 454 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + if ((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))) { + struct psi_token *msg = NULL; + + if (psi_plist_get((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)), 0, &msg)) { + size_t index = 1; + struct psi_token *next; + + msg = psi_token_copy(msg); + while (psi_plist_get((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)), index++, &next)) { + struct psi_token *old = msg; + msg = psi_token_cat(" ", 2, msg, next); + free(old); + } + } + psi_plist_free((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + + (*(struct psi_cpp_exp **)(&(*yyvalp))) = psi_cpp_exp_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type, msg); + } else { + (*(struct psi_cpp_exp **)(&(*yyvalp))) = psi_cpp_exp_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type, NULL); + } + (*(struct psi_cpp_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); } - break; - case 150: /* let_stmt */ -{ -#line 139 "src/parser_proc.y" -psi_let_stmt_free(&(yypminor->yy319)); -#line 1423 "src/parser_proc.c" +#line 2127 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 171: +#line 477 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_cpp_exp **)(&(*yyvalp))) = psi_cpp_exp_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type, psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)))); + (*(struct psi_cpp_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 2136 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 172: +#line 481 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_cpp_exp **)(&(*yyvalp))) = psi_cpp_exp_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type, NULL); + (*(struct psi_cpp_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2145 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 173: +#line 485 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_cpp_exp **)(&(*yyvalp))) = psi_cpp_exp_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type, psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)))); + (*(struct psi_cpp_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 2155 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 174: +#line 490 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_cpp_exp **)(&(*yyvalp))) = psi_cpp_exp_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type, psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)))); + (*(struct psi_cpp_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 2165 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 175: +#line 495 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_cpp_exp **)(&(*yyvalp))) = psi_cpp_exp_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type, (*(struct psi_cpp_macro_decl **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_cpp_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 2174 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 176: +#line 499 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_cpp_exp **)(&(*yyvalp))) = psi_cpp_exp_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type, (*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_cpp_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 2183 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 191: +#line 538 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_cpp_macro_decl **)(&(*yyvalp))) = psi_cpp_macro_decl_init((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)), (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)), NULL); + (*(struct psi_cpp_macro_decl **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))); +} +#line 2193 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 192: +#line 543 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_cpp_macro_decl **)(&(*yyvalp))) = psi_cpp_macro_decl_init(NULL, (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)), NULL); + (*(struct psi_cpp_macro_decl **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 2203 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 193: +#line 548 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_cpp_macro_decl **)(&(*yyvalp))) = psi_cpp_macro_decl_init(NULL, (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)), NULL); + (*(struct psi_cpp_macro_decl **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 2213 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 194: +#line 556 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_init(NULL); } - break; - case 151: /* let_calloc */ -{ -#line 141 "src/parser_proc.y" -psi_let_calloc_free(&(yypminor->yy45)); -#line 1430 "src/parser_proc.c" +#line 2221 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 196: +#line 563 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_token_free), &(*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2231 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 197: +#line 568 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)), &(*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2241 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 198: +#line 576 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = NULL; } - break; - case 152: /* let_func */ -{ -#line 143 "src/parser_proc.y" -psi_let_func_free(&(yypminor->yy67)); -#line 1437 "src/parser_proc.c" +#line 2249 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 200: +#line 583 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_token_free), &(*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2258 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 201: +#line 587 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), &(*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2267 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 202: +#line 594 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_num_exp **)(&(*yyvalp))) = psi_num_exp_init_unary((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))->type, (*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_num_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); +} +#line 2276 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 203: +#line 598 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_num_exp **)(&(*yyvalp))) = psi_num_exp_init_unary((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type, (*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_num_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 2285 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 204: +#line 602 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_num_exp **)(&(*yyvalp))) = psi_num_exp_init_binary((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type, (*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)), (*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_num_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 2294 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 205: +#line 606 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + { + uint8_t exists; + + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + exists = psi_cpp_defined(P->preproc, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_num_exp **)(&(*yyvalp))) = psi_num_exp_init_num(psi_number_init(PSI_T_UINT8, &exists)); + (*(struct psi_num_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + } } - break; - case 153: /* callback_arg_list */ - case 154: /* callback_args */ -{ -#line 145 "src/parser_proc.y" -psi_plist_free((yypminor->yy243)); -#line 1445 "src/parser_proc.c" +#line 2309 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 206: +#line 616 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + { + uint8_t exists; + + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + exists = psi_cpp_defined(P->preproc, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_num_exp **)(&(*yyvalp))) = psi_num_exp_init_num(psi_number_init(PSI_T_UINT8, &exists)); + (*(struct psi_num_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + } } - break; - case 155: /* let_callback */ -{ -#line 149 "src/parser_proc.y" -psi_let_callback_free(&(yypminor->yy120)); -#line 1452 "src/parser_proc.c" +#line 2324 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 207: +#line 626 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_num_exp **)(&(*yyvalp))) = psi_num_exp_init_num(psi_number_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text)); + (*(struct psi_num_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_num_exp **)(&(*yyvalp)))->data.n->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2334 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 208: +#line 631 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_num_exp **)(&(*yyvalp))) = psi_num_exp_init_num(psi_number_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text)); + (*(struct psi_num_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_num_exp **)(&(*yyvalp)))->data.n->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2344 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 209: +#line 636 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_num_exp **)(&(*yyvalp))) = psi_num_exp_init_num(psi_number_init(PSI_T_DEFINE, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text)); + (*(struct psi_num_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_num_exp **)(&(*yyvalp)))->data.n->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2355 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 210: +#line 642 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_num_exp **)(&(*yyvalp))) = psi_num_exp_init_num(psi_number_init(PSI_T_FUNCTION, + psi_cpp_macro_call_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))->text, (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))))); + (*(struct psi_num_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))); +} +#line 2366 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 211: +#line 651 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = NULL; } - break; - case 156: /* let_exp */ -{ -#line 151 "src/parser_proc.y" -psi_let_exp_free(&(yypminor->yy200)); -#line 1459 "src/parser_proc.c" +#line 2374 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 213: +#line 658 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add(psi_plist_init((void (*)(void *)) psi_num_exp_free), + &(*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2383 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 214: +#line 662 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)), &(*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 158: /* assert_stmt */ -{ -#line 155 "src/parser_proc.y" -psi_assert_stmt_free(&(yypminor->yy201)); -#line 1466 "src/parser_proc.c" +#line 2391 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 215: +#line 668 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_const **)(&(*yyvalp))) = psi_const_init((*(struct psi_const_type **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval)), (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))->text, (*(struct psi_impl_def_val **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_const **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))); +} +#line 2400 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 216: +#line 675 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_const_type **)(&(*yyvalp))) = psi_const_type_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text); } - break; - case 159: /* set_stmt */ -{ -#line 157 "src/parser_proc.y" -psi_set_stmt_free(&(yypminor->yy358)); -#line 1473 "src/parser_proc.c" +#line 2408 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 221: +#line 688 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_impl_def_val **)(&(*yyvalp))) = NULL; } - break; - case 160: /* set_exp */ -{ -#line 159 "src/parser_proc.y" -psi_set_exp_free(&(yypminor->yy180)); -#line 1480 "src/parser_proc.c" +#line 2416 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 222: +#line 691 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_impl_def_val **)(&(*yyvalp))) = psi_impl_def_val_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text); + (*(struct psi_impl_def_val **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2425 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 228: +#line 706 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_decl_arg **)(&(*yyvalp))) = (*(struct psi_decl_arg **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)); } - break; - case 162: /* set_func */ -{ -#line 163 "src/parser_proc.y" -psi_set_func_free(&(yypminor->yy362)); -#line 1487 "src/parser_proc.c" +#line 2433 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 230: +#line 713 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_decl_arg **)(&(*yyvalp))) = psi_decl_arg_init( + psi_decl_type_init(PSI_T_FUNCTION, (*(struct psi_decl **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->func->var->name), + psi_decl_var_copy((*(struct psi_decl **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->func->var) + ); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->token = psi_token_copy((*(struct psi_decl **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->func->token); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->real.func = (*(struct psi_decl **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); +} +#line 2446 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 231: +#line 721 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_decl_arg **)(&(*yyvalp))) = psi_decl_arg_init( + psi_decl_type_init(PSI_T_ENUM, (*(struct psi_decl_enum **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->name), + psi_decl_var_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text, 0, 0) + ); + (*(struct psi_decl_arg **)(&(*yyvalp)))->var->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->token = psi_token_copy((*(struct psi_decl_enum **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->token); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->real.enm = (*(struct psi_decl_enum **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)); +} +#line 2461 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 232: +#line 731 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_decl_arg **)(&(*yyvalp))) = psi_decl_arg_init(psi_decl_type_init(PSI_T_STRUCT, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))->text), (*(struct psi_decl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->token = (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval)); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->real.strct = psi_decl_struct_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))->text, (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->real.strct->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->real.strct->align = (*(struct psi_layout*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)).pos; + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->real.strct->size = (*(struct psi_layout*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)).len; +} +#line 2474 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 233: +#line 739 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_decl_arg **)(&(*yyvalp))) = psi_decl_arg_init(psi_decl_type_init(PSI_T_UNION, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))->text), (*(struct psi_decl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->token = (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval)); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->real.unn = psi_decl_union_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))->text, (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->real.unn->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->real.unn->align = (*(struct psi_layout*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)).pos; + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->real.unn->size = (*(struct psi_layout*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)).len; +} +#line 2487 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 234: +#line 750 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_decl_type **)(&(*yyvalp))) = (*(struct psi_decl_type **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); } - break; - case 163: /* return_stmt */ -{ -#line 165 "src/parser_proc.y" -psi_return_stmt_free(&(yypminor->yy342)); -#line 1494 "src/parser_proc.c" +#line 2495 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 236: +#line 757 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_decl_type **)(&(*yyvalp))) = psi_decl_type_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text); + (*(struct psi_decl_type **)(&(*yyvalp)))->token = (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); +} +#line 2504 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 238: +#line 765 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_decl_type **)(&(*yyvalp))) = psi_decl_type_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text); + (*(struct psi_decl_type **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2514 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 239: +#line 770 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_decl_type **)(&(*yyvalp))) = psi_decl_type_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text); + (*(struct psi_decl_type **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2524 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 240: +#line 775 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_decl_type **)(&(*yyvalp))) = psi_decl_type_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text); + (*(struct psi_decl_type **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2534 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 243: +#line 785 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 164: /* free_stmt */ -{ -#line 167 "src/parser_proc.y" -psi_free_stmt_free(&(yypminor->yy220)); -#line 1501 "src/parser_proc.c" +#line 2542 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 244: +#line 788 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 166: /* free_exp */ -{ -#line 171 "src/parser_proc.y" -psi_free_exp_free(&(yypminor->yy146)); -#line 1508 "src/parser_proc.c" +#line 2550 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 245: +#line 794 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 167: /* impl_type */ -{ -#line 173 "src/parser_proc.y" -psi_impl_type_free(&(yypminor->yy246)); -#line 1515 "src/parser_proc.c" +#line 2558 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 246: +#line 797 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 168: /* cpp_exp */ -{ -#line 175 "src/parser_proc.y" -psi_cpp_exp_free(&(yypminor->yy274)); -#line 1522 "src/parser_proc.c" +#line 2566 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 247: +#line 800 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_cat(" ", 2, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 169: /* cpp_macro_decl */ -{ -#line 177 "src/parser_proc.y" -psi_cpp_macro_decl_free(&(yypminor->yy134)); -#line 1529 "src/parser_proc.c" +#line 2574 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 258: +#line 822 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; -/********* End destructor definitions *****************************************/ - default: break; /* If no destructor action specified: do nothing */ - } +#line 2582 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 259: +#line 825 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } +#line 2590 "src/parser_proc.c" /* glr.c:816 */ + break; -/* -** Pop the parser's stack once. -** -** If there is a destructor routine associated with the token which -** is popped from the stack, then call it. -*/ -static void yy_pop_parser_stack(yyParser *pParser){ - yyStackEntry *yytos; - assert( pParser->yytos!=0 ); - assert( pParser->yytos > pParser->yystack ); - yytos = pParser->yytos--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yy_destructor(pParser, yytos->major, &yytos->minor); + case 260: +#line 828 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_cat(" ", 2, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } +#line 2598 "src/parser_proc.c" /* glr.c:816 */ + break; -/* -** Clear all secondary memory allocations from the parser -*/ -void ParseFinalize(void *p){ - yyParser *pParser = (yyParser*)p; - while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser); -#if YYSTACKDEPTH<=0 - if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack); -#endif + case 261: +#line 834 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } +#line 2606 "src/parser_proc.c" /* glr.c:816 */ + break; -#ifndef Parse_ENGINEALWAYSONSTACK -/* -** Deallocate and destroy a parser. Destructors are called for -** all stack elements before shutting the parser down. -** -** If the YYPARSEFREENEVERNULL macro exists (for example because it -** is defined in a %include section of the input grammar) then it is -** assumed that the input pointer is never NULL. -*/ -void ParseFree( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ -#ifndef YYPARSEFREENEVERNULL - if( p==0 ) return; -#endif - ParseFinalize(p); - (*freeProc)(p); + case 262: +#line 837 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#endif /* Parse_ENGINEALWAYSONSTACK */ +#line 2614 "src/parser_proc.c" /* glr.c:816 */ + break; -/* -** Return the peak depth of the stack for a parser. -*/ -#ifdef YYTRACKMAXSTACKDEPTH -int ParseStackPeak(void *p){ - yyParser *pParser = (yyParser*)p; - return pParser->yyhwm; + case 263: +#line 840 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + if ((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))) { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_cat(" ", 2, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + free((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + } else { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + } } -#endif +#line 2627 "src/parser_proc.c" /* glr.c:816 */ + break; -/* -** Find the appropriate action for a parser given the terminal -** look-ahead token iLookAhead. -*/ -static unsigned int yy_find_shift_action( - yyParser *pParser, /* The parser */ - YYCODETYPE iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yytos->stateno; - - if( stateno>=YY_MIN_REDUCE ) return stateno; - assert( stateno <= YY_SHIFT_COUNT ); - do{ - i = yy_shift_ofst[stateno]; - assert( iLookAhead!=YYNOCODE ); - i += iLookAhead; - if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - YYCODETYPE iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */ - iLookAhead = iFallback; - continue; - } -#endif -#ifdef YYWILDCARD - { - int j = i - iLookAhead + YYWILDCARD; - if( -#if YY_SHIFT_MIN+YYWILDCARD<0 - j>=0 && -#endif -#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT - j0 - ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", - yyTracePrompt, yyTokenName[iLookAhead], - yyTokenName[YYWILDCARD]); - } -#endif /* NDEBUG */ - return yy_action[j]; - } - } -#endif /* YYWILDCARD */ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } - }while(1); + case 264: +#line 848 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + if ((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))) { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_cat(" ", 2, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + free((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + free((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + } else { + (*(struct psi_token **)(&(*yyvalp))) = (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)); + } } +#line 2641 "src/parser_proc.c" /* glr.c:816 */ + break; -/* -** Find the appropriate action for a parser given the non-terminal -** look-ahead token iLookAhead. -*/ -static int yy_find_reduce_action( - int stateno, /* Current state number */ - YYCODETYPE iLookAhead /* The look-ahead token */ -){ - int i; -#ifdef YYERRORSYMBOL - if( stateno>YY_REDUCE_COUNT ){ - return yy_default[stateno]; - } -#else - assert( stateno<=YY_REDUCE_COUNT ); -#endif - i = yy_reduce_ofst[stateno]; - assert( i!=YY_REDUCE_USE_DFLT ); - assert( iLookAhead!=YYNOCODE ); - i += iLookAhead; -#ifdef YYERRORSYMBOL - if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - } -#else - assert( i>=0 && iyytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ -/******** Begin %stack_overflow code ******************************************/ -/******** End %stack_overflow code ********************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ -} - -/* -** Print tracing information for a SHIFT action -*/ -#ifndef NDEBUG -static void yyTraceShift(yyParser *yypParser, int yyNewState){ - if( yyTraceFILE ){ - if( yyNewStateyytos->major], - yyNewState); - }else{ - fprintf(yyTraceFILE,"%sShift '%s'\n", - yyTracePrompt,yyTokenName[yypParser->yytos->major]); - } - } + case 265: +#line 860 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = NULL; } -#else -# define yyTraceShift(X,Y) -#endif +#line 2649 "src/parser_proc.c" /* glr.c:816 */ + break; -/* -** Perform a shift action. -*/ -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - ParseTOKENTYPE yyMinor /* The minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yytos++; -#ifdef YYTRACKMAXSTACKDEPTH - if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ - yypParser->yyhwm++; - assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); - } -#endif -#if YYSTACKDEPTH>0 - if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH] ){ - yypParser->yytos--; - yyStackOverflow(yypParser); - return; - } -#else - if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){ - if( yyGrowStack(yypParser) ){ - yypParser->yytos--; - yyStackOverflow(yypParser); - return; - } - } -#endif - if( yyNewState > YY_MAX_SHIFT ){ - yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; - } - yytos = yypParser->yytos; - yytos->stateno = (YYACTIONTYPE)yyNewState; - yytos->major = (YYCODETYPE)yyMajor; - yytos->minor.yy0 = yyMinor; - yyTraceShift(yypParser, yyNewState); -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static const struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { - { 181, 3 }, - { 168, 2 }, - { 168, 2 }, - { 168, 2 }, - { 168, 1 }, - { 168, 1 }, - { 168, 2 }, - { 168, 3 }, - { 169, 0 }, - { 169, 1 }, - { 169, 2 }, - { 172, 4 }, - { 173, 0 }, - { 173, 1 }, - { 173, 3 }, - { 169, 1 }, - { 170, 1 }, - { 170, 2 }, - { 168, 2 }, - { 168, 2 }, - { 171, 3 }, - { 171, 2 }, - { 171, 3 }, - { 171, 2 }, - { 171, 4 }, - { 171, 1 }, - { 171, 1 }, - { 171, 4 }, - { 175, 0 }, - { 175, 1 }, - { 175, 3 }, - { 181, 3 }, - { 181, 1 }, - { 181, 1 }, - { 181, 1 }, - { 181, 1 }, - { 181, 1 }, - { 181, 1 }, - { 181, 1 }, - { 182, 0 }, - { 182, 1 }, - { 119, 0 }, - { 119, 7 }, - { 183, 2 }, - { 184, 2 }, - { 185, 2 }, - { 113, 4 }, - { 114, 1 }, - { 114, 3 }, - { 115, 3 }, - { 115, 1 }, - { 116, 3 }, - { 117, 1 }, - { 117, 1 }, - { 118, 4 }, - { 120, 4 }, - { 121, 1 }, - { 122, 6 }, - { 123, 3 }, - { 124, 4 }, - { 124, 4 }, - { 124, 2 }, - { 125, 1 }, - { 126, 3 }, - { 125, 2 }, - { 125, 1 }, - { 127, 6 }, - { 127, 8 }, - { 128, 1 }, - { 128, 2 }, - { 125, 7 }, - { 125, 8 }, - { 129, 1 }, - { 186, 0 }, - { 186, 3 }, - { 130, 2 }, - { 130, 3 }, - { 131, 1 }, - { 131, 3 }, - { 132, 2 }, - { 125, 7 }, - { 132, 3 }, - { 132, 4 }, - { 133, 0 }, - { 133, 1 }, - { 133, 1 }, - { 133, 3 }, - { 134, 1 }, - { 134, 2 }, - { 135, 2 }, - { 135, 3 }, - { 136, 0 }, - { 136, 7 }, - { 187, 1 }, - { 187, 2 }, - { 188, 0 }, - { 188, 1 }, - { 187, 1 }, - { 187, 2 }, - { 189, 0 }, - { 189, 1 }, - { 189, 2 }, - { 190, 0 }, - { 190, 1 }, - { 137, 2 }, - { 137, 2 }, - { 137, 1 }, - { 137, 1 }, - { 137, 1 }, - { 137, 2 }, - { 137, 2 }, - { 137, 2 }, - { 137, 1 }, - { 138, 1 }, - { 138, 2 }, - { 139, 4 }, - { 139, 5 }, - { 140, 7 }, - { 140, 8 }, - { 140, 13 }, - { 141, 1 }, - { 142, 2 }, - { 167, 1 }, - { 143, 2 }, - { 143, 4 }, - { 144, 1 }, - { 144, 3 }, - { 146, 1 }, - { 146, 2 }, - { 147, 1 }, - { 147, 1 }, - { 147, 1 }, - { 147, 1 }, - { 147, 1 }, - { 148, 1 }, - { 148, 1 }, - { 149, 1 }, - { 149, 3 }, - { 149, 3 }, - { 149, 2 }, - { 156, 1 }, - { 156, 2 }, - { 156, 1 }, - { 156, 1 }, - { 156, 2 }, - { 156, 1 }, - { 156, 2 }, - { 156, 1 }, - { 156, 2 }, - { 156, 3 }, - { 150, 3 }, - { 150, 6 }, - { 155, 8 }, - { 151, 6 }, - { 152, 4 }, - { 152, 6 }, - { 157, 1 }, - { 157, 3 }, - { 153, 0 }, - { 153, 1 }, - { 154, 1 }, - { 154, 3 }, - { 191, 1 }, - { 191, 1 }, - { 162, 4 }, - { 162, 6 }, - { 162, 6 }, - { 160, 1 }, - { 160, 1 }, - { 161, 1 }, - { 161, 3 }, - { 160, 3 }, - { 159, 3 }, - { 163, 3 }, - { 164, 3 }, - { 165, 1 }, - { 165, 3 }, - { 166, 4 }, - { 158, 3 }, - { 176, 0 }, - { 176, 1 }, - { 177, 0 }, - { 177, 1 }, - { 178, 1 }, - { 178, 2 }, - { 179, 1 }, - { 180, 1 }, - { 180, 2 }, - { 181, 1 }, - { 181, 1 }, - { 181, 1 }, -}; + case 266: +#line 863 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2657 "src/parser_proc.c" /* glr.c:816 */ + break; -static void yy_accept(yyParser*); /* Forward Declaration */ - -/* -** Perform a reduce action and the shift that must immediately -** follow the reduce. -*/ -static void yy_reduce( - yyParser *yypParser, /* The parser */ - unsigned int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - ParseARG_FETCH; - yymsp = yypParser->yytos; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - yysize = yyRuleInfo[yyruleno].nrhs; - fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt, - yyRuleName[yyruleno], yymsp[-yysize].stateno); - } -#endif /* NDEBUG */ - - /* Check that the stack is large enough to grow by a single entry - ** if the RHS of the rule is empty. This ensures that there is room - ** enough on the stack to push the LHS value */ - if( yyRuleInfo[yyruleno].nrhs==0 ){ -#ifdef YYTRACKMAXSTACKDEPTH - if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ - yypParser->yyhwm++; - assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); - } -#endif -#if YYSTACKDEPTH>0 - if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH-1] ){ - yyStackOverflow(yypParser); - return; - } -#else - if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ - if( yyGrowStack(yypParser) ){ - yyStackOverflow(yypParser); - return; - } - yymsp = yypParser->yytos; - } -#endif - } + case 267: +#line 866 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + if ((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))) { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_cat(" ", 2, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + } else { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + } +} +#line 2669 "src/parser_proc.c" /* glr.c:816 */ + break; - switch( yyruleno ){ - /* Beginning here are the reduction cases. A typical example - ** follows: - ** case 0: - ** #line - ** { ... } // User supplied code - ** #line - ** break; - */ -/********** Begin reduce actions **********************************************/ - YYMINORTYPE yylhsminor; - case 0: /* block ::= HASH cpp_exp EOL */ -{ yy_destructor(yypParser,78,&yymsp[-2].minor); -#line 199 "src/parser_proc.y" -{ - P->cpp.exp = yymsp[-1].minor.yy274; + case 268: +#line 873 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2041 "src/parser_proc.c" - yy_destructor(yypParser,76,&yymsp[0].minor); +#line 2677 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 269: +#line 876 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + if ((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))) { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_cat(" ", 2, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + } else { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + } } - break; - case 1: /* cpp_exp ::= ERROR|WARNING QUOTED_STRING */ - case 2: /* cpp_exp ::= IFDEF NAME */ yytestcase(yyruleno==2); - case 3: /* cpp_exp ::= IFNDEF NAME */ yytestcase(yyruleno==3); - case 6: /* cpp_exp ::= UNDEF NAME */ yytestcase(yyruleno==6); -#line 202 "src/parser_proc.y" -{ - yylhsminor.yy274 = psi_cpp_exp_init(yymsp[-1].minor.yy0->type, yymsp[0].minor.yy0); - yylhsminor.yy274->token = yymsp[-1].minor.yy0; +#line 2689 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 270: +#line 886 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = NULL; } -#line 2054 "src/parser_proc.c" - yymsp[-1].minor.yy274 = yylhsminor.yy274; - break; - case 4: /* cpp_exp ::= ENDIF */ - case 5: /* cpp_exp ::= ELSE */ yytestcase(yyruleno==5); -#line 214 "src/parser_proc.y" -{ - yylhsminor.yy274 = psi_cpp_exp_init(yymsp[0].minor.yy0->type, NULL); - yylhsminor.yy274->token = yymsp[0].minor.yy0; +#line 2697 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 272: +#line 892 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = NULL; } -#line 2064 "src/parser_proc.c" - yymsp[0].minor.yy274 = yylhsminor.yy274; - break; - case 7: /* cpp_exp ::= DEFINE NAME cpp_macro_decl */ -#line 226 "src/parser_proc.y" -{ - yylhsminor.yy274 = psi_cpp_exp_init(yymsp[-2].minor.yy0->type, yymsp[0].minor.yy134); - yylhsminor.yy274->token = yymsp[-2].minor.yy0; - yymsp[0].minor.yy134->token = yymsp[-1].minor.yy0; +#line 2705 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 275: +#line 900 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = NULL; } -#line 2074 "src/parser_proc.c" - yymsp[-2].minor.yy274 = yylhsminor.yy274; - break; - case 8: /* cpp_macro_decl ::= */ -#line 231 "src/parser_proc.y" -{ - yymsp[1].minor.yy134 = psi_cpp_macro_decl_init(NULL, NULL, NULL); +#line 2713 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 276: +#line 903 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2082 "src/parser_proc.c" - break; - case 9: /* cpp_macro_decl ::= cpp_macro_sig */ -#line 234 "src/parser_proc.y" -{ - yylhsminor.yy134 = psi_cpp_macro_decl_init(yymsp[0].minor.yy179, NULL, NULL); +#line 2721 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 277: +#line 906 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + if ((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))) { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_cat(" ", 2, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + free((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + } else { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + } } -#line 2089 "src/parser_proc.c" - yymsp[0].minor.yy134 = yylhsminor.yy134; - break; - case 10: /* cpp_macro_decl ::= cpp_macro_sig cpp_macro_decl_tokens */ -#line 237 "src/parser_proc.y" -{ - yylhsminor.yy134 = psi_cpp_macro_decl_init(yymsp[-1].minor.yy179, yymsp[0].minor.yy179, NULL); +#line 2734 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 278: +#line 917 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_decl **)(&(*yyvalp))) = (*(struct psi_decl **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)); } -#line 2097 "src/parser_proc.c" - yymsp[-1].minor.yy134 = yylhsminor.yy134; - break; - case 11: /* cpp_macro_sig ::= NO_WHITESPACE LPAREN cpp_macro_sig_args RPAREN */ -{ yy_destructor(yypParser,85,&yymsp[-3].minor); -#line 240 "src/parser_proc.y" -{ - yymsp[-3].minor.yy179 = yymsp[-1].minor.yy179; +#line 2742 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 279: +#line 923 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_decl **)(&(*yyvalp))) = psi_decl_init(psi_decl_abi_init("default"), (*(struct psi_decl_arg **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval)), (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); + if ((*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))) { + (*(struct psi_decl **)(&(*yyvalp)))->func->var->pointer_level += 1; + (*(struct psi_decl **)(&(*yyvalp)))->func->var->array_size = (*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); + } } -#line 2106 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-2].minor); - yy_destructor(yypParser,87,&yymsp[0].minor); +#line 2754 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 280: +#line 930 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_decl **)(&(*yyvalp))) = psi_decl_init(psi_decl_abi_init("default"), (*(struct psi_decl_arg **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-6)].yystate.yysemantics.yysval)), (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval))); + (*(struct psi_decl **)(&(*yyvalp)))->varargs = 1; + if ((*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))) { + (*(struct psi_decl **)(&(*yyvalp)))->func->var->pointer_level += 1; + (*(struct psi_decl **)(&(*yyvalp)))->func->var->array_size = (*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); + } } - break; - case 12: /* cpp_macro_sig_args ::= */ - case 28: /* cpp_macro_call_args ::= */ yytestcase(yyruleno==28); - case 83: /* decl_args ::= */ yytestcase(yyruleno==83); -#line 243 "src/parser_proc.y" -{ - yymsp[1].minor.yy179 = NULL; +#line 2767 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 281: +#line 938 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_decl **)(&(*yyvalp))) = psi_decl_init(psi_decl_abi_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))->text), (*(struct psi_decl_arg **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval)), (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); + if ((*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))) { + (*(struct psi_decl **)(&(*yyvalp)))->func->var->pointer_level += 1; + (*(struct psi_decl **)(&(*yyvalp)))->func->var->array_size = (*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); + } } -#line 2118 "src/parser_proc.c" - break; - case 13: /* cpp_macro_sig_args ::= NAME */ - case 16: /* cpp_macro_decl_tokens ::= ANY */ yytestcase(yyruleno==16); -#line 246 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(psi_plist_init((void (*)(void *)) psi_token_free), &yymsp[0].minor.yy0); +#line 2779 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 282: +#line 945 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_decl **)(&(*yyvalp))) = psi_decl_init(psi_decl_abi_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-7)].yystate.yysemantics.yysval))->text), (*(struct psi_decl_arg **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-6)].yystate.yysemantics.yysval)), (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval))); + (*(struct psi_decl **)(&(*yyvalp)))->varargs = 1; + if ((*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))) { + (*(struct psi_decl **)(&(*yyvalp)))->func->var->pointer_level += 1; + (*(struct psi_decl **)(&(*yyvalp)))->func->var->array_size = (*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); + } } -#line 2126 "src/parser_proc.c" - yymsp[0].minor.yy179 = yylhsminor.yy179; - break; - case 14: /* cpp_macro_sig_args ::= cpp_macro_sig_args COMMA NAME */ -#line 249 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(yymsp[-2].minor.yy179, &yymsp[0].minor.yy0); +#line 2792 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 285: +#line 961 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_decl_arg **)(&(*yyvalp))) = psi_decl_arg_init((*(struct psi_decl_type **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval)), psi_decl_var_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->text, (*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval)), 0)); + (*(struct psi_decl_arg **)(&(*yyvalp)))->var->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 2803 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 286: +#line 967 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_decl_arg **)(&(*yyvalp))) = psi_decl_arg_init( + psi_decl_type_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))->text), + psi_decl_var_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->text, (*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval)), 0) + ); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->var->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 2818 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 287: +#line 977 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_decl_arg **)(&(*yyvalp))) = psi_decl_arg_init( + psi_decl_type_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))->text), + psi_decl_var_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->text, (*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval)), 0) + ); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->var->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 2833 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 288: +#line 987 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_decl_arg **)(&(*yyvalp))) = psi_decl_arg_init( + psi_decl_type_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval))->text), + psi_decl_var_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->text, 0, 0) + ); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->var->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 2848 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 290: +#line 1001 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_decl_arg **)(&(*yyvalp))) = psi_decl_arg_init( + psi_decl_type_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->text), + psi_decl_var_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text, 0, 0) + ); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->var->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2862 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 291: +#line 1013 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = NULL; } -#line 2134 "src/parser_proc.c" - yy_destructor(yypParser,88,&yymsp[-1].minor); - yymsp[-2].minor.yy179 = yylhsminor.yy179; - break; - case 15: /* cpp_macro_decl ::= cpp_macro_decl_tokens */ -#line 252 "src/parser_proc.y" -{ - yylhsminor.yy134 = psi_cpp_macro_decl_init(NULL, yymsp[0].minor.yy179, NULL); +#line 2870 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 292: +#line 1016 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = NULL; } -#line 2143 "src/parser_proc.c" - yymsp[0].minor.yy134 = yylhsminor.yy134; - break; - case 17: /* cpp_macro_decl_tokens ::= cpp_macro_decl_tokens ANY */ -#line 258 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(yymsp[-1].minor.yy179, &yymsp[0].minor.yy0); +#line 2878 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 293: +#line 1019 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_arg_free), &(*(struct psi_decl_arg **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2151 "src/parser_proc.c" - yymsp[-1].minor.yy179 = yylhsminor.yy179; - break; - case 18: /* cpp_exp ::= IF cpp_macro_exp */ - case 19: /* cpp_exp ::= ELIF cpp_macro_exp */ yytestcase(yyruleno==19); -#line 261 "src/parser_proc.y" -{ - yylhsminor.yy274 = psi_cpp_exp_init(yymsp[-1].minor.yy0->type, yymsp[0].minor.yy207); - yylhsminor.yy274->token = yymsp[-1].minor.yy0; +#line 2886 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 294: +#line 1022 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)), &(*(struct psi_decl_arg **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2161 "src/parser_proc.c" - yymsp[-1].minor.yy274 = yylhsminor.yy274; - break; - case 20: /* cpp_macro_exp ::= LPAREN cpp_macro_exp RPAREN */ -#line 269 "src/parser_proc.y" -{ - yylhsminor.yy207 = psi_num_exp_init_unary(yymsp[-2].minor.yy0->type, yymsp[-1].minor.yy207); - yylhsminor.yy207->token = yymsp[-2].minor.yy0; +#line 2894 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 295: +#line 1028 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_decl_arg **)(&(*yyvalp))) = psi_decl_arg_init((*(struct psi_decl_type **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), (*(struct psi_decl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2170 "src/parser_proc.c" - yy_destructor(yypParser,87,&yymsp[0].minor); - yymsp[-2].minor.yy207 = yylhsminor.yy207; - break; - case 21: /* cpp_macro_exp ::= TILDE|NOT|PLUS|MINUS cpp_macro_exp */ - case 139: /* num_exp ::= TILDE|NOT|PLUS|MINUS num_exp */ yytestcase(yyruleno==139); -#line 273 "src/parser_proc.y" -{ - yylhsminor.yy207 = psi_num_exp_init_unary(yymsp[-1].minor.yy0->type, yymsp[0].minor.yy207); - yylhsminor.yy207->token = yymsp[-1].minor.yy0; +#line 2902 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 296: +#line 1031 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_decl_arg **)(&(*yyvalp))) = psi_decl_arg_init( + psi_decl_type_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))->text), + psi_decl_var_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text, (*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), 0) + ); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->var->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2917 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 297: +#line 1041 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_decl_arg **)(&(*yyvalp))) = psi_decl_arg_init( + psi_decl_type_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))->text), + psi_decl_var_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text, (*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), 0) + ); + (*(struct psi_decl_arg **)(&(*yyvalp)))->type->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->var->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_decl_arg **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 2932 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 298: +#line 1054 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_decl_var **)(&(*yyvalp))) = psi_decl_var_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->text, (*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)) + !! (*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)), (*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_decl_var **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 2942 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 299: +#line 1059 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_decl_var **)(&(*yyvalp))) = psi_decl_var_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->text, !! (*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)), (*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_decl_var **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 2952 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 300: +#line 1067 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_decl_union **)(&(*yyvalp))) = psi_decl_union_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))->text, (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_decl_union **)(&(*yyvalp)))->align = (*(struct psi_layout*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)).pos; + (*(struct psi_decl_union **)(&(*yyvalp)))->size = (*(struct psi_layout*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)).len; + (*(struct psi_decl_union **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); +} +#line 2964 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 301: +#line 1077 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_decl_struct **)(&(*yyvalp))) = psi_decl_struct_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))->text, (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_decl_struct **)(&(*yyvalp)))->align = (*(struct psi_layout*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)).pos; + (*(struct psi_decl_struct **)(&(*yyvalp)))->size = (*(struct psi_layout*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)).len; + (*(struct psi_decl_struct **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); +} +#line 2976 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 302: +#line 1087 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = NULL; } -#line 2181 "src/parser_proc.c" - yymsp[-1].minor.yy207 = yylhsminor.yy207; - break; - case 22: /* cpp_macro_exp ::= cpp_macro_exp PIPE|CARET|AMPERSAND|LSHIFT|RSHIFT|PLUS|MINUS|ASTERISK|SLASH|MODULO|RCHEVR|LCHEVR|CMP_GE|CMP_LE|OR|AND|CMP_EQ|CMP_NE cpp_macro_exp */ - case 138: /* num_exp ::= num_exp PIPE|CARET|AMPERSAND|LSHIFT|RSHIFT|PLUS|MINUS|ASTERISK|SLASH|MODULO|RCHEVR|LCHEVR|CMP_GE|CMP_LE|OR|AND|CMP_EQ|CMP_NE num_exp */ yytestcase(yyruleno==138); -#line 277 "src/parser_proc.y" -{ - yylhsminor.yy207 = psi_num_exp_init_binary(yymsp[-1].minor.yy0->type, yymsp[-2].minor.yy207, yymsp[0].minor.yy207); - yylhsminor.yy207->token = yymsp[-1].minor.yy0; +#line 2984 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 304: +#line 1094 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)); } -#line 2191 "src/parser_proc.c" - yymsp[-2].minor.yy207 = yylhsminor.yy207; - break; - case 23: /* cpp_macro_exp ::= DEFINED NAME */ -{ yy_destructor(yypParser,91,&yymsp[-1].minor); -#line 281 "src/parser_proc.y" -{ - { - uint8_t exists = zend_hash_str_exists(&P->cpp.defs, yymsp[0].minor.yy0->text, yymsp[0].minor.yy0->size); - yymsp[-1].minor.yy207 = psi_num_exp_init_num(psi_number_init(PSI_T_UINT8, &exists)); - yymsp[-1].minor.yy207->token = yymsp[0].minor.yy0; - } +#line 2992 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 305: +#line 1100 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_arg_free), &(*(struct psi_decl_arg **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2204 "src/parser_proc.c" +#line 3000 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 306: +#line 1103 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), &(*(struct psi_decl_arg **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 24: /* cpp_macro_exp ::= DEFINED LPAREN NAME RPAREN */ -{ yy_destructor(yypParser,91,&yymsp[-3].minor); -#line 288 "src/parser_proc.y" -{ - { - uint8_t exists = zend_hash_str_exists(&P->cpp.defs, yymsp[-1].minor.yy0->text, yymsp[-1].minor.yy0->size); - yymsp[-3].minor.yy207 = psi_num_exp_init_num(psi_number_init(PSI_T_UINT8, &exists)); - yymsp[-3].minor.yy207->token = yymsp[-1].minor.yy0; - } +#line 3008 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 307: +#line 1109 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_decl_arg **)(&(*yyvalp))) = (*(struct psi_decl_arg **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)); + (*(struct psi_decl_arg **)(&(*yyvalp)))->layout = (*(struct psi_layout **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)); + psi_parser_proc_add_from_typedef(P, (*(struct psi_decl_arg **)(&(*yyvalp)))); +} +#line 3018 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 308: +#line 1117 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_decl_enum **)(&(*yyvalp))) = psi_decl_enum_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))->text, (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_decl_enum **)(&(*yyvalp)))->token = (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval)); +} +#line 3027 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 309: +#line 1124 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_enum_item_free), &(*(struct psi_decl_enum_item **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2217 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-2].minor); - yy_destructor(yypParser,87,&yymsp[0].minor); +#line 3035 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 310: +#line 1127 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)), &(*(struct psi_decl_enum_item **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 25: /* cpp_macro_exp ::= NUMBER|NSNAME */ -#line 295 "src/parser_proc.y" -{ - yylhsminor.yy207 = psi_num_exp_init_num(psi_number_init(yymsp[0].minor.yy0->type, yymsp[0].minor.yy0->text)); - yylhsminor.yy207->token = yymsp[0].minor.yy0; - yylhsminor.yy207->data.n->token = psi_token_copy(yymsp[0].minor.yy0); +#line 3043 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 311: +#line 1133 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_decl_enum_item **)(&(*yyvalp))) = psi_decl_enum_item_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text, NULL); + (*(struct psi_decl_enum_item **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 3053 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 312: +#line 1138 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_decl_enum_item **)(&(*yyvalp))) = psi_decl_enum_item_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))->text, (*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_decl_enum_item **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); +} +#line 3063 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 313: +#line 1146 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_num_exp **)(&(*yyvalp))) = psi_num_exp_init_num((*(struct psi_number **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_num_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_number **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->token); +} +#line 3072 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 314: +#line 1150 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_num_exp **)(&(*yyvalp))) = psi_num_exp_init_cast((*(struct psi_decl_type **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)), (*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_num_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_decl_type **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))->token); +} +#line 3081 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 315: +#line 1154 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_num_exp **)(&(*yyvalp))) = psi_num_exp_init_unary(PSI_T_LPAREN, (*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_num_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); +} +#line 3090 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 316: +#line 1158 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_num_exp **)(&(*yyvalp))) = psi_num_exp_init_binary((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type, (*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)), (*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_num_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 3099 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 317: +#line 1162 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_num_exp **)(&(*yyvalp))) = psi_num_exp_init_unary((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->type, (*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_num_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); +} +#line 3108 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 318: +#line 1169 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_number **)(&(*yyvalp))) = psi_number_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text); + (*(struct psi_number **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 3117 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 319: +#line 1173 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_number **)(&(*yyvalp))) = psi_number_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text); + (*(struct psi_number **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 3126 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 320: +#line 1177 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_number **)(&(*yyvalp))) = psi_number_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text); + (*(struct psi_number **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 3135 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 321: +#line 1181 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_number **)(&(*yyvalp))) = psi_number_init(PSI_T_NAME, (*(struct psi_decl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_number **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_decl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->token); +} +#line 3144 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 322: +#line 1188 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + if ((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))) { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + } else { + char digest[17]; + + psi_token_hash((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), digest); + (*(struct psi_token **)(&(*yyvalp))) = psi_token_append("@", psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))), 1, digest); + } } -#line 2229 "src/parser_proc.c" - yymsp[0].minor.yy207 = yylhsminor.yy207; - break; - case 26: /* cpp_macro_exp ::= NAME */ -#line 300 "src/parser_proc.y" -{ - yylhsminor.yy207 = psi_num_exp_init_num(psi_number_init(PSI_T_DEFINE, yymsp[0].minor.yy0->text)); - yylhsminor.yy207->token = yymsp[0].minor.yy0; - yylhsminor.yy207->data.n->token = psi_token_copy(yymsp[0].minor.yy0); +#line 3159 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 323: +#line 1201 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + if ((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))) { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + } else { + char digest[17]; + + psi_token_hash((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), digest); + (*(struct psi_token **)(&(*yyvalp))) = psi_token_append("@", psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))), 1, digest); + } } -#line 2239 "src/parser_proc.c" - yymsp[0].minor.yy207 = yylhsminor.yy207; - break; - case 27: /* cpp_macro_exp ::= NAME LPAREN cpp_macro_call_args RPAREN */ -#line 305 "src/parser_proc.y" -{ - yylhsminor.yy207 = psi_num_exp_init_num(psi_number_init(PSI_T_FUNCTION, - psi_cpp_macro_call_init(yymsp[-3].minor.yy0->text, yymsp[-1].minor.yy179))); - yylhsminor.yy207->token = yymsp[-3].minor.yy0; +#line 3174 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 324: +#line 1214 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + if ((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))) { + (*(struct psi_token **)(&(*yyvalp))) = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + } else { + char digest[17]; + + psi_token_hash((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), digest); + (*(struct psi_token **)(&(*yyvalp))) = psi_token_append("@", psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))), 1, digest); + } } -#line 2249 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-2].minor); - yy_destructor(yypParser,87,&yymsp[0].minor); - yymsp[-3].minor.yy207 = yylhsminor.yy207; - break; - case 29: /* cpp_macro_call_args ::= cpp_macro_exp */ -#line 313 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(psi_plist_init((void (*)(void *)) psi_num_exp_free), &yymsp[0].minor.yy207); +#line 3189 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 325: +#line 1227 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = NULL; } -#line 2259 "src/parser_proc.c" - yymsp[0].minor.yy179 = yylhsminor.yy179; - break; - case 30: /* cpp_macro_call_args ::= cpp_macro_call_args COMMA cpp_macro_exp */ -#line 316 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(yymsp[-2].minor.yy179, &yymsp[0].minor.yy207); +#line 3197 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 326: +#line 1230 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&(*yyvalp))) = (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); + (*(struct psi_token **)(&(*yyvalp)))->type = PSI_T_NAME; +} +#line 3206 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 327: +#line 1237 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_layout **)(&(*yyvalp))) = NULL; } -#line 2267 "src/parser_proc.c" - yy_destructor(yypParser,88,&yymsp[-1].minor); - yymsp[-2].minor.yy179 = yylhsminor.yy179; - break; - case 31: /* block ::= LIB QUOTED_STRING EOS */ -#line 319 "src/parser_proc.y" -{ - if (P->file.ln) { - P->error(PSI_DATA(P), yymsp[-2].minor.yy0, PSI_WARNING, "Extra 'lib %s' statement has no effect", yymsp[-1].minor.yy0->text); - } else { - P->file.ln = strndup(yymsp[-1].minor.yy0->text + 1, yymsp[-1].minor.yy0->size - 2); - } - free(yymsp[-1].minor.yy0); - free(yymsp[-2].minor.yy0); +#line 3214 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 328: +#line 1240 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_layout **)(&(*yyvalp))) = psi_layout_init(atol((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))->text), atol((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->text)); } -#line 2282 "src/parser_proc.c" - yy_destructor(yypParser,75,&yymsp[0].minor); - break; - case 32: /* block ::= decl */ -#line 328 "src/parser_proc.y" -{ - if (!P->decls) { - P->decls = psi_plist_init((psi_plist_dtor) psi_decl_free); - } - P->decls = psi_plist_add(P->decls, &yymsp[0].minor.yy303); +#line 3222 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 329: +#line 1246 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_layout*)(&(*yyvalp))).pos = 0; + (*(struct psi_layout*)(&(*yyvalp))).len = 0; +} +#line 3231 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 330: +#line 1250 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_layout*)(&(*yyvalp))).pos = atol((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))->text); + (*(struct psi_layout*)(&(*yyvalp))).len = atol((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->text); +} +#line 3240 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 331: +#line 1257 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(size_t*)(&(*yyvalp))) = 0; } -#line 2293 "src/parser_proc.c" - break; - case 33: /* block ::= impl */ -#line 334 "src/parser_proc.y" -{ - if (!P->impls) { - P->impls = psi_plist_init((psi_plist_dtor) psi_impl_free); - } - P->impls = psi_plist_add(P->impls, &yymsp[0].minor.yy49); +#line 3248 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 332: +#line 1260 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(size_t*)(&(*yyvalp))) = atol((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))->text); } -#line 2303 "src/parser_proc.c" - break; - case 34: /* block ::= decl_typedef */ -#line 340 "src/parser_proc.y" -{ - if (!P->types) { - P->types = psi_plist_init((psi_plist_dtor) psi_decl_arg_free); - } - P->types = psi_plist_add(P->types, &yymsp[0].minor.yy320); - switch (yymsp[0].minor.yy320->type->type) { - case PSI_T_STRUCT: - if (yymsp[0].minor.yy320->type->real.strct) { - if (!P->structs) { - P->structs = psi_plist_init((psi_plist_dtor) psi_decl_struct_free); - } - P->structs = psi_plist_add(P->structs, &yymsp[0].minor.yy320->type->real.strct); - } - break; - case PSI_T_UNION: - if (yymsp[0].minor.yy320->type->real.unn) { - if (!P->unions) { - P->unions = psi_plist_init((psi_plist_dtor) psi_decl_union_free); - } - P->unions = psi_plist_add(P->unions, &yymsp[0].minor.yy320->type->real.unn); - } - break; - case PSI_T_ENUM: - if (yymsp[0].minor.yy320->type->real.enm) { - if (!P->enums) { - P->enums = psi_plist_init((psi_plist_dtor) psi_decl_enum_free); - } - P->enums = psi_plist_add(P->enums, &yymsp[0].minor.yy320->type->real.enm); - } - break; - } +#line 3256 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 333: +#line 1266 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(size_t*)(&(*yyvalp))) = 0; } -#line 2339 "src/parser_proc.c" - break; - case 35: /* block ::= constant */ -#line 372 "src/parser_proc.y" -{ - if (!P->consts) { - P->consts = psi_plist_init((psi_plist_dtor) psi_const_free); - } - P->consts = psi_plist_add(P->consts, &yymsp[0].minor.yy38); +#line 3264 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 334: +#line 1269 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(size_t*)(&(*yyvalp))) = (*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); } -#line 2349 "src/parser_proc.c" - break; - case 36: /* block ::= decl_struct */ -#line 378 "src/parser_proc.y" -{ - if (!P->structs) { - P->structs = psi_plist_init((psi_plist_dtor) psi_decl_struct_free); - } - P->structs = psi_plist_add(P->structs, &yymsp[0].minor.yy324); +#line 3272 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 335: +#line 1275 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(size_t*)(&(*yyvalp))) = 1; } -#line 2359 "src/parser_proc.c" - break; - case 37: /* block ::= decl_union */ -#line 384 "src/parser_proc.y" -{ - if (!P->unions) { - P->unions = psi_plist_init((psi_plist_dtor) psi_decl_union_free); - } - P->unions = psi_plist_add(P->unions, &yymsp[0].minor.yy15); +#line 3280 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 336: +#line 1278 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(size_t*)(&(*yyvalp))) = (*(size_t*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)) + 1; } -#line 2369 "src/parser_proc.c" - break; - case 38: /* block ::= decl_enum */ -#line 390 "src/parser_proc.y" -{ - if (!P->enums) { - P->enums = psi_plist_init((psi_plist_dtor) psi_decl_enum_free); - } - P->enums = psi_plist_add(P->enums, &yymsp[0].minor.yy323); +#line 3288 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 337: +#line 1290 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_impl **)(&(*yyvalp))) = psi_impl_init((*(struct psi_impl_func **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval)), (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); } -#line 2379 "src/parser_proc.c" - break; - case 39: /* optional_name ::= */ - case 73: /* decl_var_array_size ::= */ yytestcase(yyruleno==73); - case 95: /* decl_scalar_type_short ::= */ yytestcase(yyruleno==95); - case 99: /* decl_scalar_type_long ::= */ yytestcase(yyruleno==99); - case 102: /* decl_scalar_type_long_long ::= */ yytestcase(yyruleno==102); -#line 396 "src/parser_proc.y" -{ - yymsp[1].minor.yy0 = NULL; +#line 3296 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 338: +#line 1293 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_impl **)(&(*yyvalp))) = psi_impl_init((*(struct psi_impl_func **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval)), (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_impl_func **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))->static_memory = 1; +} +#line 3305 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 339: +#line 1300 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_impl_func **)(&(*yyvalp))) = psi_impl_func_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval))->text, NULL, (*(struct psi_impl_type **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_impl_func **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval))); + (*(struct psi_impl_func **)(&(*yyvalp)))->return_reference = (*(bool*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval)); +} +#line 3315 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 340: +#line 1305 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_impl_func **)(&(*yyvalp))) = psi_impl_func_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))->text, (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval)), (*(struct psi_impl_type **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_impl_func **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))); + (*(struct psi_impl_func **)(&(*yyvalp)))->return_reference = (*(bool*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-6)].yystate.yysemantics.yysval)); +} +#line 3325 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 341: +#line 1310 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_impl_func **)(&(*yyvalp))) = psi_impl_func_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-10)].yystate.yysemantics.yysval))->text, (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-8)].yystate.yysemantics.yysval)), (*(struct psi_impl_type **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); + (*(struct psi_impl_func **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-10)].yystate.yysemantics.yysval))); + (*(struct psi_impl_func **)(&(*yyvalp)))->return_reference = (*(bool*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-11)].yystate.yysemantics.yysval)); + (*(struct psi_impl_func **)(&(*yyvalp)))->vararg = psi_impl_arg_init((*(struct psi_impl_type **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-6)].yystate.yysemantics.yysval)), psi_impl_var_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))->text, (*(bool*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))), NULL); + (*(struct psi_impl_func **)(&(*yyvalp)))->vararg->var->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))); +} +#line 3337 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 342: +#line 1320 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_impl_arg_free), &(*(struct psi_impl_arg **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2390 "src/parser_proc.c" - break; - case 40: /* optional_name ::= NAME */ - case 93: /* decl_scalar_type ::= CHAR */ yytestcase(yyruleno==93); - case 96: /* decl_scalar_type_short ::= INT */ yytestcase(yyruleno==96); - case 97: /* decl_scalar_type ::= INT */ yytestcase(yyruleno==97); - case 100: /* decl_scalar_type_long ::= DOUBLE */ yytestcase(yyruleno==100); - case 103: /* decl_scalar_type_long_long ::= INT */ yytestcase(yyruleno==103); - case 162: /* callback_rval ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT */ yytestcase(yyruleno==162); - case 163: /* callback_rval ::= VOID */ yytestcase(yyruleno==163); -#line 399 "src/parser_proc.y" -{ - yylhsminor.yy0 = yymsp[0].minor.yy0; +#line 3345 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 343: +#line 1323 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)), &(*(struct psi_impl_arg **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2404 "src/parser_proc.c" - yymsp[0].minor.yy0 = yylhsminor.yy0; - break; - case 41: /* align_and_size ::= */ -#line 402 "src/parser_proc.y" -{ - yymsp[1].minor.yy239.pos = 0; - yymsp[1].minor.yy239.len = 0; +#line 3353 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 344: +#line 1329 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_impl_arg **)(&(*yyvalp))) = psi_impl_arg_init((*(struct psi_impl_type **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), (*(struct psi_impl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)), NULL); } -#line 2413 "src/parser_proc.c" - break; - case 42: /* align_and_size ::= COLON COLON LPAREN NUMBER COMMA NUMBER RPAREN */ -{ yy_destructor(yypParser,92,&yymsp[-6].minor); -#line 406 "src/parser_proc.y" -{ - yymsp[-6].minor.yy239.pos = atol(yymsp[-3].minor.yy0->text); - yymsp[-6].minor.yy239.len = atol(yymsp[-1].minor.yy0->text); - free(yymsp[-3].minor.yy0); - free(yymsp[-1].minor.yy0); +#line 3361 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 345: +#line 1332 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_impl_arg **)(&(*yyvalp))) = psi_impl_arg_init((*(struct psi_impl_type **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval)), (*(struct psi_impl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)), (*(struct psi_impl_def_val **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2424 "src/parser_proc.c" - yy_destructor(yypParser,92,&yymsp[-5].minor); - yy_destructor(yypParser,86,&yymsp[-4].minor); - yy_destructor(yypParser,88,&yymsp[-2].minor); - yy_destructor(yypParser,87,&yymsp[0].minor); +#line 3369 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 346: +#line 1338 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_impl_var **)(&(*yyvalp))) = psi_impl_var_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text, (*(bool*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_impl_var **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 3378 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 347: +#line 1345 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_impl_type **)(&(*yyvalp))) = psi_impl_type_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))->text); + (*(struct psi_impl_type **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); +} +#line 3387 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 357: +#line 1364 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_impl_stmt_free), &(*(struct psi_token ***)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 43: /* enum_name ::= ENUM optional_name */ - case 44: /* struct_name ::= STRUCT optional_name */ yytestcase(yyruleno==44); - case 45: /* union_name ::= UNION optional_name */ yytestcase(yyruleno==45); -#line 412 "src/parser_proc.y" -{ - if (yymsp[0].minor.yy0) { - yylhsminor.yy0 = yymsp[0].minor.yy0; - free(yymsp[-1].minor.yy0); - } else { - char digest[17]; - psi_token_hash(yymsp[-1].minor.yy0, digest); - yylhsminor.yy0 = psi_token_append("@", yymsp[-1].minor.yy0, 1, digest); - } +#line 3395 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 358: +#line 1367 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)), &(*(struct psi_token ***)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2445 "src/parser_proc.c" - yymsp[-1].minor.yy0 = yylhsminor.yy0; - break; - case 46: /* decl_enum ::= enum_name LBRACE decl_enum_items RBRACE */ -#line 442 "src/parser_proc.y" -{ - yylhsminor.yy323 = psi_decl_enum_init(yymsp[-3].minor.yy0->text, yymsp[-1].minor.yy179); - yylhsminor.yy323->token = yymsp[-3].minor.yy0; +#line 3403 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 359: +#line 1373 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token ***)(&(*yyvalp))) = (struct psi_token **) (*(struct psi_return_stmt **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); } -#line 2454 "src/parser_proc.c" - yy_destructor(yypParser,96,&yymsp[-2].minor); - yy_destructor(yypParser,97,&yymsp[0].minor); - yymsp[-3].minor.yy323 = yylhsminor.yy323; - break; - case 47: /* decl_enum_items ::= decl_enum_item */ -#line 446 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_enum_item_free), - &yymsp[0].minor.yy169); +#line 3411 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 360: +#line 1376 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token ***)(&(*yyvalp))) = (struct psi_token **) (*(struct psi_let_stmt **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); } -#line 2465 "src/parser_proc.c" - yymsp[0].minor.yy179 = yylhsminor.yy179; - break; - case 48: /* decl_enum_items ::= decl_enum_items COMMA decl_enum_item */ -#line 450 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(yymsp[-2].minor.yy179, &yymsp[0].minor.yy169); +#line 3419 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 361: +#line 1379 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token ***)(&(*yyvalp))) = (struct psi_token **) (*(struct psi_set_stmt **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); } -#line 2473 "src/parser_proc.c" - yy_destructor(yypParser,88,&yymsp[-1].minor); - yymsp[-2].minor.yy179 = yylhsminor.yy179; - break; - case 49: /* decl_enum_item ::= NAME EQUALS num_exp */ -#line 453 "src/parser_proc.y" -{ - yylhsminor.yy169 = psi_decl_enum_item_init(yymsp[-2].minor.yy0->text, yymsp[0].minor.yy207); - yylhsminor.yy169->token = yymsp[-2].minor.yy0; +#line 3427 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 362: +#line 1382 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token ***)(&(*yyvalp))) = (struct psi_token **) (*(struct psi_assert_stmt **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); } -#line 2483 "src/parser_proc.c" - yy_destructor(yypParser,98,&yymsp[-1].minor); - yymsp[-2].minor.yy169 = yylhsminor.yy169; - break; - case 50: /* decl_enum_item ::= NAME */ -#line 457 "src/parser_proc.y" -{ - yylhsminor.yy169 = psi_decl_enum_item_init(yymsp[0].minor.yy0->text, NULL); - yylhsminor.yy169->token = yymsp[0].minor.yy0; +#line 3435 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 363: +#line 1385 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token ***)(&(*yyvalp))) = (struct psi_token **) (*(struct psi_free_stmt **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); } -#line 2493 "src/parser_proc.c" - yymsp[0].minor.yy169 = yylhsminor.yy169; - break; - case 51: /* decl_struct_args_block ::= LBRACE struct_args RBRACE */ -{ yy_destructor(yypParser,96,&yymsp[-2].minor); -#line 461 "src/parser_proc.y" -{ - yymsp[-2].minor.yy179 = yymsp[-1].minor.yy179; +#line 3443 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 364: +#line 1391 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_let_stmt **)(&(*yyvalp))) = psi_let_stmt_init((*(struct psi_let_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_let_stmt **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); +} +#line 3452 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 365: +#line 1395 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_let_stmt **)(&(*yyvalp))) = psi_let_stmt_init(psi_let_exp_init_ex((*(struct psi_decl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval)), PSI_LET_TMP, (*(struct psi_decl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)))); + (*(struct psi_let_stmt **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))); + (*(struct psi_let_stmt **)(&(*yyvalp)))->exp->is_reference = (*(bool*)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)); +} +#line 3462 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 367: +#line 1404 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_let_exp **)(&(*yyvalp))) = (*(struct psi_let_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); + (*(struct psi_let_exp **)(&(*yyvalp)))->is_reference = true; +} +#line 3471 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 368: +#line 1408 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_let_exp **)(&(*yyvalp))) = (*(struct psi_let_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); + (*(struct psi_let_exp **)(&(*yyvalp)))->is_reference = false; +} +#line 3480 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 369: +#line 1415 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_let_exp **)(&(*yyvalp))) = psi_let_exp_init(PSI_LET_NULL, NULL); } -#line 2502 "src/parser_proc.c" - yy_destructor(yypParser,97,&yymsp[0].minor); +#line 3488 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 370: +#line 1418 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_let_exp **)(&(*yyvalp))) = psi_let_exp_init(PSI_LET_CALLOC, (*(struct psi_let_calloc **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 52: /* decl_struct_args ::= decl_struct_args_block */ -#line 464 "src/parser_proc.y" -{ - yylhsminor.yy179 = yymsp[0].minor.yy179; +#line 3496 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 371: +#line 1421 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_let_exp **)(&(*yyvalp))) = psi_let_exp_init(PSI_LET_CALLBACK, (*(struct psi_let_callback **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2511 "src/parser_proc.c" - yymsp[0].minor.yy179 = yylhsminor.yy179; - break; - case 53: /* decl_struct_args ::= EOS */ -{ yy_destructor(yypParser,75,&yymsp[0].minor); -#line 467 "src/parser_proc.y" -{ - yymsp[0].minor.yy179 = psi_plist_init((psi_plist_dtor) psi_decl_arg_free); +#line 3504 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 372: +#line 1424 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_let_exp **)(&(*yyvalp))) = psi_let_exp_init_ex(NULL, PSI_LET_FUNC, (*(struct psi_let_func **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2520 "src/parser_proc.c" +#line 3512 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 373: +#line 1427 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_let_exp **)(&(*yyvalp))) = psi_let_exp_init_ex(NULL, PSI_LET_NUMEXP, (*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 54: /* decl_struct ::= STRUCT NAME align_and_size decl_struct_args */ -{ yy_destructor(yypParser,94,&yymsp[-3].minor); -#line 470 "src/parser_proc.y" -{ - yymsp[-3].minor.yy324 = psi_decl_struct_init(yymsp[-2].minor.yy0->text, yymsp[0].minor.yy179); - yymsp[-3].minor.yy324->align = yymsp[-1].minor.yy239.pos; - yymsp[-3].minor.yy324->size = yymsp[-1].minor.yy239.len; - yymsp[-3].minor.yy324->token = yymsp[-2].minor.yy0; +#line 3520 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 374: +#line 1433 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_let_exp **)(&(*yyvalp))) = (*(struct psi_let_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); + (*(struct psi_let_exp **)(&(*yyvalp)))->var = (*(struct psi_decl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)); +} +#line 3529 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 375: +#line 1437 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_let_exp **)(&(*yyvalp))) = (*(struct psi_let_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); + (*(struct psi_let_exp **)(&(*yyvalp)))->is_reference = 1; + (*(struct psi_let_exp **)(&(*yyvalp)))->var = (*(struct psi_decl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval)); +} +#line 3539 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 376: +#line 1445 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_let_calloc **)(&(*yyvalp))) = psi_let_calloc_init((*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval)), (*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_let_calloc **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))); +} +#line 3548 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 377: +#line 1452 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_let_callback **)(&(*yyvalp))) = psi_let_callback_init(psi_let_func_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-6)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-6)].yystate.yysemantics.yysval))->text, (*(struct psi_impl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval))), (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); + (*(struct psi_let_callback **)(&(*yyvalp)))->func->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-6)].yystate.yysemantics.yysval))); + (*(struct psi_let_callback **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-7)].yystate.yysemantics.yysval))); +} +#line 3558 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 378: +#line 1460 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_let_func **)(&(*yyvalp))) = psi_let_func_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval))->text, (*(struct psi_impl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); + (*(struct psi_let_func **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval))); + (*(struct psi_let_func **)(&(*yyvalp)))->inner = (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)); +} +#line 3568 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 389: +#line 1481 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = NULL; } -#line 2532 "src/parser_proc.c" +#line 3576 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 390: +#line 1484 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); } - break; - case 55: /* decl_union ::= UNION NAME align_and_size decl_struct_args */ -{ yy_destructor(yypParser,95,&yymsp[-3].minor); -#line 476 "src/parser_proc.y" -{ - yymsp[-3].minor.yy15 = psi_decl_union_init(yymsp[-2].minor.yy0->text, yymsp[0].minor.yy179); - yymsp[-3].minor.yy15->align = yymsp[-1].minor.yy239.pos; - yymsp[-3].minor.yy15->size = yymsp[-1].minor.yy239.len; - yymsp[-3].minor.yy15->token = yymsp[-2].minor.yy0; +#line 3584 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 391: +#line 1490 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_let_exp_free), &(*(struct psi_let_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2544 "src/parser_proc.c" +#line 3592 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 392: +#line 1493 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)), &(*(struct psi_let_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 56: /* const_type ::= BOOL|INT|FLOAT|STRING */ -#line 482 "src/parser_proc.y" -{ - yylhsminor.yy351 = psi_const_type_init(yymsp[0].minor.yy0->type, yymsp[0].minor.yy0->text); - free(yymsp[0].minor.yy0); +#line 3600 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 395: +#line 1504 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = NULL; } -#line 2553 "src/parser_proc.c" - yymsp[0].minor.yy351 = yylhsminor.yy351; - break; - case 57: /* constant ::= CONST const_type NSNAME EQUALS impl_def_val EOS */ -{ yy_destructor(yypParser,99,&yymsp[-5].minor); -#line 486 "src/parser_proc.y" -{ - yymsp[-5].minor.yy38 = psi_const_init(yymsp[-4].minor.yy351, yymsp[-3].minor.yy0->text, yymsp[-1].minor.yy145); - yymsp[-5].minor.yy38->token = yymsp[-3].minor.yy0; +#line 3608 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 396: +#line 1507 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); } -#line 2563 "src/parser_proc.c" - yy_destructor(yypParser,98,&yymsp[-2].minor); - yy_destructor(yypParser,75,&yymsp[0].minor); +#line 3616 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 397: +#line 1513 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_set_exp_free), &(*(struct psi_set_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 58: /* decl_typedef ::= TYPEDEF decl_typedef_body EOS */ -#line 490 "src/parser_proc.y" -{ - yylhsminor.yy320 = yymsp[-1].minor.yy320; - yylhsminor.yy320->token = yymsp[-2].minor.yy0; +#line 3624 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 398: +#line 1516 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)), &(*(struct psi_set_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2574 "src/parser_proc.c" - yy_destructor(yypParser,75,&yymsp[0].minor); - yymsp[-2].minor.yy320 = yylhsminor.yy320; - break; - case 59: /* decl_typedef_body_ex ::= struct_name align_and_size decl_struct_args_block decl_var */ -#line 494 "src/parser_proc.y" -{ - yylhsminor.yy320 = psi_decl_arg_init(psi_decl_type_init(PSI_T_STRUCT, yymsp[-3].minor.yy0->text), yymsp[0].minor.yy271); - yylhsminor.yy320->type->token = psi_token_copy(yymsp[-3].minor.yy0); - yylhsminor.yy320->type->real.strct = psi_decl_struct_init(yymsp[-3].minor.yy0->text, yymsp[-1].minor.yy179); - yylhsminor.yy320->type->real.strct->token = yymsp[-3].minor.yy0; - yylhsminor.yy320->type->real.strct->align = yymsp[-2].minor.yy239.pos; - yylhsminor.yy320->type->real.strct->size = yymsp[-2].minor.yy239.len; +#line 3632 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 399: +#line 1522 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_return_stmt **)(&(*yyvalp))) = psi_return_stmt_init(psi_set_exp_init(PSI_SET_FUNC, (*(struct psi_set_func **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)))); + (*(struct psi_return_stmt **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); +} +#line 3641 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 400: +#line 1529 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_set_stmt **)(&(*yyvalp))) = psi_set_stmt_init((*(struct psi_set_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_set_stmt **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); +} +#line 3650 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 401: +#line 1536 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_set_exp **)(&(*yyvalp))) = psi_set_exp_init(PSI_SET_FUNC, (*(struct psi_set_func **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2588 "src/parser_proc.c" - yymsp[-3].minor.yy320 = yylhsminor.yy320; - break; - case 60: /* decl_typedef_body_ex ::= union_name align_and_size decl_struct_args_block decl_var */ -#line 502 "src/parser_proc.y" -{ - yylhsminor.yy320 = psi_decl_arg_init(psi_decl_type_init(PSI_T_UNION, yymsp[-3].minor.yy0->text), yymsp[0].minor.yy271); - yylhsminor.yy320->type->token = psi_token_copy(yymsp[-3].minor.yy0); - yylhsminor.yy320->type->real.unn = psi_decl_union_init(yymsp[-3].minor.yy0->text, yymsp[-1].minor.yy179); - yylhsminor.yy320->type->real.unn->token = yymsp[-3].minor.yy0; - yylhsminor.yy320->type->real.unn->align = yymsp[-2].minor.yy239.pos; - yylhsminor.yy320->type->real.unn->size = yymsp[-2].minor.yy239.len; +#line 3658 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 402: +#line 1539 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_set_exp **)(&(*yyvalp))) = psi_set_exp_init(PSI_SET_NUMEXP, (*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2601 "src/parser_proc.c" - yymsp[-3].minor.yy320 = yylhsminor.yy320; - break; - case 61: /* decl_typedef_body_ex ::= decl_enum NAME */ -#line 510 "src/parser_proc.y" -{ - yylhsminor.yy320 = psi_decl_arg_init(psi_decl_type_init(PSI_T_ENUM, yymsp[-1].minor.yy323->name), psi_decl_var_init(yymsp[0].minor.yy0->text, 0, 0)); - yylhsminor.yy320->var->token = yymsp[0].minor.yy0; - yylhsminor.yy320->type->token = psi_token_copy(yymsp[-1].minor.yy323->token); - yylhsminor.yy320->type->real.enm = yymsp[-1].minor.yy323; +#line 3666 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 403: +#line 1542 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_set_exp **)(&(*yyvalp))) = (*(struct psi_set_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); + (*(struct psi_set_exp **)(&(*yyvalp)))->var = (*(struct psi_impl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)); +} +#line 3675 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 404: +#line 1549 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_set_func **)(&(*yyvalp))) = psi_set_func_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval))->text, (*(struct psi_decl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); + (*(struct psi_set_func **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-4)].yystate.yysemantics.yysval))); + (*(struct psi_set_func **)(&(*yyvalp)))->inner = (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval)); +} +#line 3685 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 405: +#line 1554 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_set_func **)(&(*yyvalp))) = psi_set_func_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))->type, (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))->text, (*(struct psi_decl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))); + (*(struct psi_set_func **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-5)].yystate.yysemantics.yysval))); + (*(struct psi_set_func **)(&(*yyvalp)))->recursive = 1; +} +#line 3695 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 414: +#line 1573 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = NULL; } -#line 2612 "src/parser_proc.c" - yymsp[-1].minor.yy320 = yylhsminor.yy320; - break; - case 62: /* decl_typedef_body ::= decl_typedef_body_ex */ - case 65: /* decl_typedef_body ::= decl_arg */ yytestcase(yyruleno==65); - case 68: /* decl_func ::= decl_arg */ yytestcase(yyruleno==68); -#line 516 "src/parser_proc.y" -{ - yylhsminor.yy320 = yymsp[0].minor.yy320; +#line 3703 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 415: +#line 1576 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval)); } -#line 2622 "src/parser_proc.c" - yymsp[0].minor.yy320 = yylhsminor.yy320; - break; - case 63: /* decl_typedef_body_fn_args ::= LPAREN decl_args RPAREN */ -{ yy_destructor(yypParser,86,&yymsp[-2].minor); -#line 519 "src/parser_proc.y" -{ - yymsp[-2].minor.yy179 = yymsp[-1].minor.yy179; +#line 3711 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 416: +#line 1582 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_set_exp_free), &(*(struct psi_set_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2631 "src/parser_proc.c" - yy_destructor(yypParser,87,&yymsp[0].minor); +#line 3719 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 417: +#line 1585 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)), &(*(struct psi_set_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } - break; - case 64: /* decl_typedef_body ::= decl_func decl_typedef_body_fn_args */ -#line 522 "src/parser_proc.y" -{ - yylhsminor.yy320 = psi_decl_arg_init(psi_decl_type_init(PSI_T_FUNCTION, yymsp[-1].minor.yy320->var->name), psi_decl_var_copy(yymsp[-1].minor.yy320->var)); - yylhsminor.yy320->type->token = psi_token_copy(yymsp[-1].minor.yy320->token); - yylhsminor.yy320->type->real.func = psi_decl_init(psi_decl_abi_init("default"), yymsp[-1].minor.yy320, yymsp[0].minor.yy179); +#line 3727 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 418: +#line 1591 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_assert_stmt **)(&(*yyvalp))) = psi_assert_stmt_init((enum psi_assert_kind) (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))->type, (*(struct psi_num_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_assert_stmt **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); +} +#line 3736 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 421: +#line 1603 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_free_stmt **)(&(*yyvalp))) = psi_free_stmt_init((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_free_stmt **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval))); +} +#line 3745 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 422: +#line 1610 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_free_exp_free), &(*(struct psi_free_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2642 "src/parser_proc.c" - yymsp[-1].minor.yy320 = yylhsminor.yy320; - break; - case 66: /* decl ::= decl_abi decl_func LPAREN decl_args RPAREN EOS */ -#line 530 "src/parser_proc.y" -{ - yylhsminor.yy303 = psi_decl_init(yymsp[-5].minor.yy26, yymsp[-4].minor.yy320, yymsp[-2].minor.yy179); +#line 3753 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 423: +#line 1613 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)), &(*(struct psi_free_exp **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2650 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-3].minor); - yy_destructor(yypParser,87,&yymsp[-1].minor); - yy_destructor(yypParser,75,&yymsp[0].minor); - yymsp[-5].minor.yy303 = yylhsminor.yy303; - break; - case 67: /* decl ::= decl_abi decl_func LPAREN decl_args COMMA ELLIPSIS RPAREN EOS */ -#line 533 "src/parser_proc.y" -{ - yylhsminor.yy303 = psi_decl_init(yymsp[-7].minor.yy26, yymsp[-6].minor.yy320, yymsp[-4].minor.yy179); - yylhsminor.yy303->varargs = 1; +#line 3761 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 424: +#line 1619 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))->type = PSI_T_NAME; + (*(struct psi_free_exp **)(&(*yyvalp))) = psi_free_exp_init((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))->text, (*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval))); + (*(struct psi_free_exp **)(&(*yyvalp)))->token = psi_token_copy((*(struct psi_token **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval))); +} +#line 3771 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 425: +#line 1627 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_var_free), &(*(struct psi_decl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2662 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-5].minor); - yy_destructor(yypParser,88,&yymsp[-3].minor); - yy_destructor(yypParser,101,&yymsp[-2].minor); - yy_destructor(yypParser,87,&yymsp[-1].minor); - yy_destructor(yypParser,75,&yymsp[0].minor); - yymsp[-7].minor.yy303 = yylhsminor.yy303; - break; - case 69: /* decl_func ::= VOID NAME */ -#line 540 "src/parser_proc.y" -{ - yylhsminor.yy320 = psi_decl_arg_init( - psi_decl_type_init(yymsp[-1].minor.yy0->type, yymsp[-1].minor.yy0->text), - psi_decl_var_init(yymsp[0].minor.yy0->text, 0, 0) - ); - yylhsminor.yy320->type->token = yymsp[-1].minor.yy0; - yylhsminor.yy320->var->token = yymsp[0].minor.yy0; - yylhsminor.yy320->token = yymsp[0].minor.yy0; +#line 3779 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 426: +#line 1630 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(struct psi_plist **)(&(*yyvalp))) = psi_plist_add((*(struct psi_plist **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval)), &(*(struct psi_decl_var **)(&((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval))); } -#line 2681 "src/parser_proc.c" - yymsp[-1].minor.yy320 = yylhsminor.yy320; - break; - case 70: /* decl_typedef_body ::= VOID indirection LPAREN indirection NAME RPAREN decl_typedef_body_fn_args */ -#line 549 "src/parser_proc.y" -{ - struct psi_decl_arg *func_ = psi_decl_arg_init( - psi_decl_type_init(yymsp[-6].minor.yy0->type, yymsp[-6].minor.yy0->text), - psi_decl_var_init(yymsp[-2].minor.yy0->text, yymsp[-5].minor.yy382, 0) - ); - func_->type->token = yymsp[-6].minor.yy0; - func_->var->token = yymsp[-2].minor.yy0; - func_->token = yymsp[-2].minor.yy0; - yylhsminor.yy320 = psi_decl_arg_init( - psi_decl_type_init(PSI_T_FUNCTION, func_->var->name), - psi_decl_var_copy(func_->var) - ); - yylhsminor.yy320->var->pointer_level = yymsp[-3].minor.yy382; - yylhsminor.yy320->type->token = psi_token_copy(func_->token); - yylhsminor.yy320->type->real.func = psi_decl_init(psi_decl_abi_init("default"), func_, yymsp[0].minor.yy179); +#line 3787 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 427: +#line 1636 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(bool*)(&(*yyvalp))) = false; } -#line 2702 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-4].minor); - yy_destructor(yypParser,87,&yymsp[-1].minor); - yymsp[-6].minor.yy320 = yylhsminor.yy320; - break; - case 71: /* decl_typedef_body ::= CONST VOID pointers LPAREN indirection NAME RPAREN decl_typedef_body_fn_args */ -{ yy_destructor(yypParser,99,&yymsp[-7].minor); -#line 565 "src/parser_proc.y" -{ - struct psi_decl_arg *func_ = psi_decl_arg_init( - psi_decl_type_init(yymsp[-6].minor.yy0->type, yymsp[-6].minor.yy0->text), - psi_decl_var_init(yymsp[-2].minor.yy0->text, yymsp[-5].minor.yy382, 0) - ); - func_->type->token = yymsp[-6].minor.yy0; - func_->var->token = yymsp[-2].minor.yy0; - func_->token = yymsp[-2].minor.yy0; - yymsp[-7].minor.yy320 = psi_decl_arg_init( - psi_decl_type_init(PSI_T_FUNCTION, func_->var->name), - psi_decl_var_copy(func_->var) - ); - yymsp[-7].minor.yy320->var->pointer_level = yymsp[-3].minor.yy382; - yymsp[-7].minor.yy320->type->token = psi_token_copy(func_->token); - yymsp[-7].minor.yy320->type->real.func = psi_decl_init(psi_decl_abi_init("default"), func_, yymsp[0].minor.yy179); -} -#line 2726 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-4].minor); - yy_destructor(yypParser,87,&yymsp[-1].minor); -} - break; - case 72: /* decl_abi ::= NAME */ -#line 581 "src/parser_proc.y" -{ - yylhsminor.yy26 = psi_decl_abi_init(yymsp[0].minor.yy0->text); - yylhsminor.yy26->token = yymsp[0].minor.yy0; -} -#line 2737 "src/parser_proc.c" - yymsp[0].minor.yy26 = yylhsminor.yy26; - break; - case 74: /* decl_var_array_size ::= LBRACKET NUMBER RBRACKET */ -{ yy_destructor(yypParser,102,&yymsp[-2].minor); -#line 588 "src/parser_proc.y" -{ - yymsp[-2].minor.yy0 = yymsp[-1].minor.yy0; -} -#line 2746 "src/parser_proc.c" - yy_destructor(yypParser,103,&yymsp[0].minor); -} - break; - case 75: /* decl_var ::= NAME decl_var_array_size */ -#line 591 "src/parser_proc.y" -{ - yylhsminor.yy271 = psi_decl_var_init(yymsp[-1].minor.yy0->text, 0, yymsp[0].minor.yy0?atol(yymsp[0].minor.yy0->text):0); - yylhsminor.yy271->token = yymsp[-1].minor.yy0; - if (yymsp[0].minor.yy0) { - free(yymsp[0].minor.yy0); - } -} -#line 2759 "src/parser_proc.c" - yymsp[-1].minor.yy271 = yylhsminor.yy271; - break; - case 76: /* decl_var ::= pointers NAME decl_var_array_size */ -#line 598 "src/parser_proc.y" -{ - yylhsminor.yy271 = psi_decl_var_init(yymsp[-1].minor.yy0->text, yymsp[-2].minor.yy382+!!yymsp[0].minor.yy0, yymsp[0].minor.yy0?atol(yymsp[0].minor.yy0->text):0); - yylhsminor.yy271->token = yymsp[-1].minor.yy0; - if (yymsp[0].minor.yy0) { - free(yymsp[0].minor.yy0); - } -} -#line 2771 "src/parser_proc.c" - yymsp[-2].minor.yy271 = yylhsminor.yy271; - break; - case 77: /* decl_vars ::= decl_var */ -#line 605 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_var_free), - &yymsp[0].minor.yy271); +#line 3795 "src/parser_proc.c" /* glr.c:816 */ + break; + + case 428: +#line 1639 "src/parser_proc_grammar.y" /* glr.c:816 */ + { + (*(bool*)(&(*yyvalp))) = true; } -#line 2780 "src/parser_proc.c" - yymsp[0].minor.yy179 = yylhsminor.yy179; - break; - case 78: /* decl_vars ::= decl_vars COMMA decl_var */ -#line 609 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(yymsp[-2].minor.yy179, &yymsp[0].minor.yy271); +#line 3803 "src/parser_proc.c" /* glr.c:816 */ + break; + + +#line 3807 "src/parser_proc.c" /* glr.c:816 */ + default: break; + } + + return yyok; +# undef yyerrok +# undef YYABORT +# undef YYACCEPT +# undef YYERROR +# undef YYBACKUP +# undef yyclearin +# undef YYRECOVERING } -#line 2788 "src/parser_proc.c" - yy_destructor(yypParser,88,&yymsp[-1].minor); - yymsp[-2].minor.yy179 = yylhsminor.yy179; - break; - case 79: /* decl_arg ::= const_decl_type decl_var */ -#line 612 "src/parser_proc.y" + + +static void +yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1) { - yylhsminor.yy320 = psi_decl_arg_init(yymsp[-1].minor.yy172, yymsp[0].minor.yy271); + YYUSE (yy0); + YYUSE (yy1); + + switch (yyn) + { + + default: break; + } } -#line 2797 "src/parser_proc.c" - yymsp[-1].minor.yy320 = yylhsminor.yy320; + + /* Bison grammar-table manipulation. */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + YYUSE (yyvaluep); + YYUSE (P); + YYUSE (tokens); + YYUSE (index); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + switch (yytype) + { + case 124: /* binary_op_token */ +#line 269 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 3858 "src/parser_proc.c" /* glr.c:846 */ break; - case 80: /* decl_typedef_body ::= const_decl_type indirection LPAREN indirection NAME RPAREN decl_typedef_body_fn_args */ -#line 615 "src/parser_proc.y" -{ - struct psi_decl_arg *func_ = psi_decl_arg_init( - yymsp[-6].minor.yy172, - psi_decl_var_init(yymsp[-2].minor.yy0->text, yymsp[-5].minor.yy382, 0) - ); - func_->var->token = yymsp[-2].minor.yy0; - func_->token = yymsp[-2].minor.yy0; - yylhsminor.yy320 = psi_decl_arg_init( - psi_decl_type_init(PSI_T_FUNCTION, func_->var->name), - psi_decl_var_copy(func_->var) - ); - yylhsminor.yy320->var->pointer_level = yymsp[-3].minor.yy382; - yylhsminor.yy320->type->token = psi_token_copy(func_->token); - yylhsminor.yy320->type->real.func = psi_decl_init(psi_decl_abi_init("default"), func_, yymsp[0].minor.yy179); -} -#line 2817 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-4].minor); - yy_destructor(yypParser,87,&yymsp[-1].minor); - yymsp[-6].minor.yy320 = yylhsminor.yy320; + + case 125: /* unary_op_token */ +#line 269 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 3864 "src/parser_proc.c" /* glr.c:846 */ break; - case 81: /* decl_arg ::= VOID pointers NAME */ -#line 630 "src/parser_proc.y" -{ - yylhsminor.yy320 = psi_decl_arg_init( - psi_decl_type_init(yymsp[-2].minor.yy0->type, yymsp[-2].minor.yy0->text), - psi_decl_var_init(yymsp[0].minor.yy0->text, yymsp[-1].minor.yy382, 0) - ); - yylhsminor.yy320->type->token = yymsp[-2].minor.yy0; - yylhsminor.yy320->var->token = yymsp[0].minor.yy0; - yylhsminor.yy320->token = yymsp[0].minor.yy0; -} -#line 2833 "src/parser_proc.c" - yymsp[-2].minor.yy320 = yylhsminor.yy320; + + case 126: /* name_token */ +#line 269 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 3870 "src/parser_proc.c" /* glr.c:846 */ break; - case 82: /* decl_arg ::= CONST VOID pointers NAME */ -{ yy_destructor(yypParser,99,&yymsp[-3].minor); -#line 639 "src/parser_proc.y" -{ - yymsp[-3].minor.yy320 = psi_decl_arg_init( - psi_decl_type_init(yymsp[-2].minor.yy0->type, yymsp[-2].minor.yy0->text), - psi_decl_var_init(yymsp[0].minor.yy0->text, yymsp[-1].minor.yy382, 0) - ); - yymsp[-3].minor.yy320->type->token = yymsp[-2].minor.yy0; - yymsp[-3].minor.yy320->var->token = yymsp[0].minor.yy0; - yymsp[-3].minor.yy320->token = yymsp[0].minor.yy0; -} -#line 2848 "src/parser_proc.c" -} + + case 127: /* any_noeol_token */ +#line 269 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 3876 "src/parser_proc.c" /* glr.c:846 */ break; - case 84: /* decl_args ::= VOID */ -{ yy_destructor(yypParser,57,&yymsp[0].minor); -#line 651 "src/parser_proc.y" -{ - yymsp[0].minor.yy179 = NULL; -} -#line 2857 "src/parser_proc.c" -} + + case 131: /* lib */ +#line 263 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_token_free(&(*(struct psi_token **)(&(*yyvaluep))));} +#line 3882 "src/parser_proc.c" /* glr.c:846 */ break; - case 85: /* decl_args ::= decl_arg */ - case 87: /* struct_args ::= struct_arg */ yytestcase(yyruleno==87); -#line 654 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_arg_free), - &yymsp[0].minor.yy320); -} -#line 2867 "src/parser_proc.c" - yymsp[0].minor.yy179 = yylhsminor.yy179; + + case 132: /* cpp */ +#line 278 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_cpp_exp_free(&(*(struct psi_cpp_exp **)(&(*yyvaluep))));} +#line 3888 "src/parser_proc.c" /* glr.c:846 */ break; - case 86: /* decl_args ::= decl_args COMMA decl_arg */ -#line 658 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(yymsp[-2].minor.yy179, &yymsp[0].minor.yy320); -} -#line 2875 "src/parser_proc.c" - yy_destructor(yypParser,88,&yymsp[-1].minor); - yymsp[-2].minor.yy179 = yylhsminor.yy179; + + case 133: /* cpp_exp */ +#line 278 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_cpp_exp_free(&(*(struct psi_cpp_exp **)(&(*yyvaluep))));} +#line 3894 "src/parser_proc.c" /* glr.c:846 */ break; - case 88: /* struct_args ::= struct_args struct_arg */ -#line 665 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(yymsp[-1].minor.yy179, &yymsp[0].minor.yy320); -} -#line 2884 "src/parser_proc.c" - yymsp[-1].minor.yy179 = yylhsminor.yy179; + + case 134: /* cpp_message_token */ +#line 266 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 3900 "src/parser_proc.c" /* glr.c:846 */ break; - case 89: /* struct_arg ::= decl_typedef_body_ex EOS */ -#line 668 "src/parser_proc.y" -{ - yylhsminor.yy320 = yymsp[-1].minor.yy320; - switch (yymsp[-1].minor.yy320->type->type) { - case PSI_T_STRUCT: - if (yymsp[-1].minor.yy320->type->real.strct) { - if (!P->structs) { - P->structs = psi_plist_init((psi_plist_dtor) psi_decl_struct_free); - } - P->structs = psi_plist_add(P->structs, &yymsp[-1].minor.yy320->type->real.strct); - } - break; - case PSI_T_UNION: - if (yymsp[-1].minor.yy320->type->real.unn) { - if (!P->unions) { - P->unions = psi_plist_init((psi_plist_dtor) psi_decl_union_free); - } - P->unions = psi_plist_add(P->unions, &yymsp[-1].minor.yy320->type->real.unn); - } - break; - case PSI_T_ENUM: - if (yymsp[-1].minor.yy320->type->real.enm) { - if (!P->enums) { - P->enums = psi_plist_init((psi_plist_dtor) psi_decl_enum_free); - } - P->enums = psi_plist_add(P->enums, &yymsp[-1].minor.yy320->type->real.enm); - } - break; - } -} -#line 2918 "src/parser_proc.c" - yy_destructor(yypParser,75,&yymsp[0].minor); - yymsp[-1].minor.yy320 = yylhsminor.yy320; + + case 135: /* cpp_include_token */ +#line 266 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 3906 "src/parser_proc.c" /* glr.c:846 */ break; - case 90: /* struct_arg ::= decl_arg decl_layout EOS */ -#line 697 "src/parser_proc.y" -{ - yymsp[-2].minor.yy320->layout = yymsp[-1].minor.yy369; - yylhsminor.yy320 = yymsp[-2].minor.yy320; -} -#line 2928 "src/parser_proc.c" - yy_destructor(yypParser,75,&yymsp[0].minor); - yymsp[-2].minor.yy320 = yylhsminor.yy320; + + case 136: /* cpp_header_token */ +#line 266 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 3912 "src/parser_proc.c" /* glr.c:846 */ break; - case 91: /* decl_layout ::= */ -#line 701 "src/parser_proc.y" -{ - yymsp[1].minor.yy369 = NULL; -} -#line 2937 "src/parser_proc.c" + + case 137: /* cpp_no_arg_token */ +#line 266 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 3918 "src/parser_proc.c" /* glr.c:846 */ break; - case 92: /* decl_layout ::= COLON COLON LPAREN NUMBER COMMA NUMBER RPAREN */ -{ yy_destructor(yypParser,92,&yymsp[-6].minor); -#line 704 "src/parser_proc.y" -{ - yymsp[-6].minor.yy369 = psi_layout_init(atol(yymsp[-3].minor.yy0->text), atol(yymsp[-1].minor.yy0->text)); - free(yymsp[-3].minor.yy0); - free(yymsp[-1].minor.yy0); -} -#line 2947 "src/parser_proc.c" - yy_destructor(yypParser,92,&yymsp[-5].minor); - yy_destructor(yypParser,86,&yymsp[-4].minor); - yy_destructor(yypParser,88,&yymsp[-2].minor); - yy_destructor(yypParser,87,&yymsp[0].minor); -} + + case 138: /* cpp_name_arg_token */ +#line 266 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 3924 "src/parser_proc.c" /* glr.c:846 */ break; - case 94: /* decl_scalar_type ::= SHORT decl_scalar_type_short */ - case 98: /* decl_scalar_type ::= LONG decl_scalar_type_long */ yytestcase(yyruleno==98); - case 101: /* decl_scalar_type_long ::= LONG decl_scalar_type_long_long */ yytestcase(yyruleno==101); -#line 712 "src/parser_proc.y" -{ - if (yymsp[0].minor.yy0) { - yylhsminor.yy0 = psi_token_cat(" ", 2, yymsp[-1].minor.yy0, yymsp[0].minor.yy0); - free(yymsp[-1].minor.yy0); - free(yymsp[0].minor.yy0); - } else { - yylhsminor.yy0 = yymsp[-1].minor.yy0; - } -} -#line 2967 "src/parser_proc.c" - yymsp[-1].minor.yy0 = yylhsminor.yy0; + + case 139: /* cpp_exp_arg_token */ +#line 266 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 3930 "src/parser_proc.c" /* glr.c:846 */ break; - case 104: /* decl_type ::= UNSIGNED decl_scalar_type */ - case 105: /* decl_type ::= SIGNED decl_scalar_type */ yytestcase(yyruleno==105); -#line 760 "src/parser_proc.y" -{ - struct psi_token *T = psi_token_cat(" ", 2, yymsp[-1].minor.yy0, yymsp[0].minor.yy0); - yylhsminor.yy172 = psi_decl_type_init(T->type, T->text); - yylhsminor.yy172->token = T; - free(yymsp[-1].minor.yy0); - free(yymsp[0].minor.yy0); -} -#line 2980 "src/parser_proc.c" - yymsp[-1].minor.yy172 = yylhsminor.yy172; + + case 140: /* cpp_macro_decl */ +#line 280 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_cpp_macro_decl_free(&(*(struct psi_cpp_macro_decl **)(&(*yyvaluep))));} +#line 3936 "src/parser_proc.c" /* glr.c:846 */ break; - case 106: /* decl_type ::= UNSIGNED */ - case 107: /* decl_type ::= SIGNED */ yytestcase(yyruleno==107); -#line 774 "src/parser_proc.y" -{ - yylhsminor.yy172 = psi_decl_type_init(PSI_T_NAME, yymsp[0].minor.yy0->text); - yylhsminor.yy172->token = yymsp[0].minor.yy0; -} -#line 2990 "src/parser_proc.c" - yymsp[0].minor.yy172 = yylhsminor.yy172; + + case 141: /* cpp_macro_sig */ +#line 282 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 3942 "src/parser_proc.c" /* glr.c:846 */ break; - case 108: /* decl_type ::= decl_scalar_type */ - case 112: /* decl_type ::= FLOAT|DOUBLE|INT8|UINT8|INT16|UINT16|INT32|UINT32|INT64|UINT64|NAME */ yytestcase(yyruleno==112); -#line 782 "src/parser_proc.y" -{ - yylhsminor.yy172 = psi_decl_type_init(yymsp[0].minor.yy0->type, yymsp[0].minor.yy0->text); - yylhsminor.yy172->token = yymsp[0].minor.yy0; -} -#line 3000 "src/parser_proc.c" - yymsp[0].minor.yy172 = yylhsminor.yy172; + + case 142: /* cpp_macro_sig_args */ +#line 282 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 3948 "src/parser_proc.c" /* glr.c:846 */ break; - case 109: /* decl_type ::= STRUCT NAME */ - case 110: /* decl_type ::= UNION NAME */ yytestcase(yyruleno==110); - case 111: /* decl_type ::= ENUM NAME */ yytestcase(yyruleno==111); -#line 786 "src/parser_proc.y" -{ - yylhsminor.yy172 = psi_decl_type_init(yymsp[-1].minor.yy0->type, yymsp[0].minor.yy0->text); - yylhsminor.yy172->token = yymsp[0].minor.yy0; - free(yymsp[-1].minor.yy0); -} -#line 3012 "src/parser_proc.c" - yymsp[-1].minor.yy172 = yylhsminor.yy172; + + case 143: /* cpp_macro_decl_tokens */ +#line 282 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 3954 "src/parser_proc.c" /* glr.c:846 */ break; - case 113: /* const_decl_type ::= decl_type */ -#line 805 "src/parser_proc.y" -{ - yylhsminor.yy172 = yymsp[0].minor.yy172; -} -#line 3020 "src/parser_proc.c" - yymsp[0].minor.yy172 = yylhsminor.yy172; + + case 144: /* cpp_macro_decl_token_list */ +#line 282 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 3960 "src/parser_proc.c" /* glr.c:846 */ break; - case 114: /* const_decl_type ::= CONST decl_type */ -{ yy_destructor(yypParser,99,&yymsp[-1].minor); -#line 808 "src/parser_proc.y" -{ - yymsp[-1].minor.yy172 = yymsp[0].minor.yy172; -} -#line 3029 "src/parser_proc.c" -} + + case 145: /* cpp_macro_exp */ +#line 284 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_num_exp_free(&(*(struct psi_num_exp **)(&(*yyvaluep))));} +#line 3966 "src/parser_proc.c" /* glr.c:846 */ break; - case 115: /* impl ::= impl_func LBRACE impl_stmts RBRACE */ -#line 811 "src/parser_proc.y" -{ - yylhsminor.yy49 = psi_impl_init(yymsp[-3].minor.yy56, yymsp[-1].minor.yy179); -} -#line 3037 "src/parser_proc.c" - yy_destructor(yypParser,96,&yymsp[-2].minor); - yy_destructor(yypParser,97,&yymsp[0].minor); - yymsp[-3].minor.yy49 = yylhsminor.yy49; + + case 146: /* cpp_macro_call_args */ +#line 282 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 3972 "src/parser_proc.c" /* glr.c:846 */ break; - case 116: /* impl ::= STATIC impl_func LBRACE impl_stmts RBRACE */ -{ yy_destructor(yypParser,109,&yymsp[-4].minor); -#line 814 "src/parser_proc.y" -{ - yymsp[-3].minor.yy56->static_memory = 1; - yymsp[-4].minor.yy49 = psi_impl_init(yymsp[-3].minor.yy56, yymsp[-1].minor.yy179); -} -#line 3049 "src/parser_proc.c" - yy_destructor(yypParser,96,&yymsp[-2].minor); - yy_destructor(yypParser,97,&yymsp[0].minor); -} + + case 147: /* cpp_macro_call_arg_list */ +#line 282 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 3978 "src/parser_proc.c" /* glr.c:846 */ break; - case 117: /* impl_func ::= FUNCTION reference NSNAME LPAREN RPAREN COLON impl_type */ -{ yy_destructor(yypParser,110,&yymsp[-6].minor); -#line 818 "src/parser_proc.y" -{ - yymsp[-6].minor.yy56 = psi_impl_func_init(yymsp[-4].minor.yy0->text, NULL, yymsp[0].minor.yy246); - yymsp[-6].minor.yy56->token = yymsp[-4].minor.yy0; - yymsp[-6].minor.yy56->return_reference = yymsp[-5].minor.yy89; -} -#line 3062 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-3].minor); - yy_destructor(yypParser,87,&yymsp[-2].minor); - yy_destructor(yypParser,92,&yymsp[-1].minor); -} + + case 148: /* constant */ +#line 290 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_const_free(&(*(struct psi_const **)(&(*yyvaluep))));} +#line 3984 "src/parser_proc.c" /* glr.c:846 */ break; - case 118: /* impl_func ::= FUNCTION reference NSNAME LPAREN impl_args RPAREN COLON impl_type */ -{ yy_destructor(yypParser,110,&yymsp[-7].minor); -#line 823 "src/parser_proc.y" -{ - yymsp[-7].minor.yy56 = psi_impl_func_init(yymsp[-5].minor.yy0->text, yymsp[-3].minor.yy179, yymsp[0].minor.yy246); - yymsp[-7].minor.yy56->token = yymsp[-5].minor.yy0; - yymsp[-7].minor.yy56->return_reference = yymsp[-6].minor.yy89; -} -#line 3076 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-4].minor); - yy_destructor(yypParser,87,&yymsp[-2].minor); - yy_destructor(yypParser,92,&yymsp[-1].minor); -} + + case 149: /* constant_type */ +#line 292 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_const_type_free(&(*(struct psi_const_type **)(&(*yyvaluep))));} +#line 3990 "src/parser_proc.c" /* glr.c:846 */ break; - case 119: /* impl_func ::= FUNCTION reference NSNAME LPAREN impl_args COMMA impl_type reference ELLIPSIS DOLLAR_NAME RPAREN COLON impl_type */ -{ yy_destructor(yypParser,110,&yymsp[-12].minor); -#line 828 "src/parser_proc.y" -{ - yymsp[-12].minor.yy56 = psi_impl_func_init(yymsp[-10].minor.yy0->text, yymsp[-8].minor.yy179, yymsp[0].minor.yy246); - yymsp[-12].minor.yy56->token = yymsp[-10].minor.yy0; - yymsp[-12].minor.yy56->return_reference = yymsp[-11].minor.yy89; - yymsp[-12].minor.yy56->vararg = psi_impl_arg_init(yymsp[-6].minor.yy246, psi_impl_var_init(yymsp[-3].minor.yy0->text, yymsp[-5].minor.yy89), NULL); - free(yymsp[-3].minor.yy0); -} -#line 3092 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-9].minor); - yy_destructor(yypParser,88,&yymsp[-7].minor); - yy_destructor(yypParser,101,&yymsp[-4].minor); - yy_destructor(yypParser,87,&yymsp[-2].minor); - yy_destructor(yypParser,92,&yymsp[-1].minor); -} + + case 150: /* constant_type_token */ +#line 287 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 3996 "src/parser_proc.c" /* glr.c:846 */ break; - case 120: /* impl_def_val ::= NULL|NUMBER|TRUE|FALSE|QUOTED_STRING */ -#line 835 "src/parser_proc.y" -{ - yylhsminor.yy145 = psi_impl_def_val_init(yymsp[0].minor.yy0->type, yymsp[0].minor.yy0->text); - yylhsminor.yy145->token = yymsp[0].minor.yy0; -} -#line 3106 "src/parser_proc.c" - yymsp[0].minor.yy145 = yylhsminor.yy145; + + case 151: /* impl_def_val */ +#line 294 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_impl_def_val_free(&(*(struct psi_impl_def_val **)(&(*yyvaluep))));} +#line 4002 "src/parser_proc.c" /* glr.c:846 */ break; - case 121: /* impl_var ::= reference DOLLAR_NAME */ -#line 839 "src/parser_proc.y" -{ - yylhsminor.yy370 = psi_impl_var_init(yymsp[0].minor.yy0->text, yymsp[-1].minor.yy89); - yylhsminor.yy370->token = yymsp[0].minor.yy0; -} -#line 3115 "src/parser_proc.c" - yymsp[-1].minor.yy370 = yylhsminor.yy370; + + case 152: /* impl_def_val_token */ +#line 287 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 4008 "src/parser_proc.c" /* glr.c:846 */ break; - case 122: /* impl_type ::= VOID|MIXED|BOOL|INT|FLOAT|STRING|ARRAY|OBJECT|CALLABLE */ -#line 843 "src/parser_proc.y" -{ - yylhsminor.yy246 = psi_impl_type_init(yymsp[0].minor.yy0->type, yymsp[0].minor.yy0->text); - free(yymsp[0].minor.yy0); -} -#line 3124 "src/parser_proc.c" - yymsp[0].minor.yy246 = yylhsminor.yy246; + + case 153: /* decl_typedef */ +#line 307 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_arg_free(&(*(struct psi_decl_arg **)(&(*yyvaluep))));} +#line 4014 "src/parser_proc.c" /* glr.c:846 */ break; - case 123: /* impl_arg ::= impl_type impl_var */ -#line 847 "src/parser_proc.y" -{ - yylhsminor.yy34 = psi_impl_arg_init(yymsp[-1].minor.yy246, yymsp[0].minor.yy370, NULL); -} -#line 3132 "src/parser_proc.c" - yymsp[-1].minor.yy34 = yylhsminor.yy34; + + case 154: /* typedef */ +#line 307 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_arg_free(&(*(struct psi_decl_arg **)(&(*yyvaluep))));} +#line 4020 "src/parser_proc.c" /* glr.c:846 */ break; - case 124: /* impl_arg ::= impl_type impl_var EQUALS impl_def_val */ -#line 850 "src/parser_proc.y" -{ - yylhsminor.yy34 = psi_impl_arg_init(yymsp[-3].minor.yy246, yymsp[-2].minor.yy370, yymsp[0].minor.yy145); -} -#line 3140 "src/parser_proc.c" - yy_destructor(yypParser,98,&yymsp[-1].minor); - yymsp[-3].minor.yy34 = yylhsminor.yy34; + + case 155: /* const_decl_type */ +#line 303 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_type_free(&(*(struct psi_decl_type **)(&(*yyvaluep))));} +#line 4026 "src/parser_proc.c" /* glr.c:846 */ break; - case 125: /* impl_args ::= impl_arg */ -#line 853 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_impl_arg_free), - &yymsp[0].minor.yy34); -} -#line 3150 "src/parser_proc.c" - yymsp[0].minor.yy179 = yylhsminor.yy179; + + case 156: /* decl_type */ +#line 303 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_type_free(&(*(struct psi_decl_type **)(&(*yyvaluep))));} +#line 4032 "src/parser_proc.c" /* glr.c:846 */ break; - case 126: /* impl_args ::= impl_args COMMA impl_arg */ -#line 857 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(yymsp[-2].minor.yy179, &yymsp[0].minor.yy34); -} -#line 3158 "src/parser_proc.c" - yy_destructor(yypParser,88,&yymsp[-1].minor); - yymsp[-2].minor.yy179 = yylhsminor.yy179; + + case 157: /* decl_type_complex */ +#line 303 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_type_free(&(*(struct psi_decl_type **)(&(*yyvaluep))));} +#line 4038 "src/parser_proc.c" /* glr.c:846 */ break; - case 127: /* impl_stmts ::= impl_stmt */ -#line 860 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_impl_stmt_free), - &yymsp[0].minor.yy238); -} -#line 3168 "src/parser_proc.c" - yymsp[0].minor.yy179 = yylhsminor.yy179; + + case 158: /* decl_type_simple */ +#line 297 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_token_free(&(*(struct psi_token **)(&(*yyvaluep))));} +#line 4044 "src/parser_proc.c" /* glr.c:846 */ break; - case 128: /* impl_stmts ::= impl_stmts impl_stmt */ -#line 864 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(yymsp[-1].minor.yy179, &yymsp[0].minor.yy238); -} -#line 3176 "src/parser_proc.c" - yymsp[-1].minor.yy179 = yylhsminor.yy179; + + case 159: /* decl_real_type */ +#line 297 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_token_free(&(*(struct psi_token **)(&(*yyvaluep))));} +#line 4050 "src/parser_proc.c" /* glr.c:846 */ break; - case 129: /* impl_stmt ::= return_stmt */ -#line 867 "src/parser_proc.y" -{ - yylhsminor.yy238 = (struct psi_token**) yymsp[0].minor.yy342; -} -#line 3184 "src/parser_proc.c" - yymsp[0].minor.yy238 = yylhsminor.yy238; + + case 160: /* decl_stdint_type */ +#line 300 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 4056 "src/parser_proc.c" /* glr.c:846 */ break; - case 130: /* impl_stmt ::= let_stmt */ -#line 870 "src/parser_proc.y" -{ - yylhsminor.yy238 = (struct psi_token**) yymsp[0].minor.yy319; -} -#line 3192 "src/parser_proc.c" - yymsp[0].minor.yy238 = yylhsminor.yy238; + + case 161: /* int_signed */ +#line 275 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 4062 "src/parser_proc.c" /* glr.c:846 */ break; - case 131: /* impl_stmt ::= set_stmt */ -#line 873 "src/parser_proc.y" -{ - yylhsminor.yy238 = (struct psi_token**) yymsp[0].minor.yy358; -} -#line 3200 "src/parser_proc.c" - yymsp[0].minor.yy238 = yylhsminor.yy238; + + case 162: /* int_width */ +#line 272 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_token_free(&(*(struct psi_token **)(&(*yyvaluep))));} +#line 4068 "src/parser_proc.c" /* glr.c:846 */ break; - case 132: /* impl_stmt ::= assert_stmt */ -#line 876 "src/parser_proc.y" -{ - yylhsminor.yy238 = (struct psi_token **) yymsp[0].minor.yy201; -} -#line 3208 "src/parser_proc.c" - yymsp[0].minor.yy238 = yylhsminor.yy238; + + case 163: /* decl_int_type */ +#line 297 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_token_free(&(*(struct psi_token **)(&(*yyvaluep))));} +#line 4074 "src/parser_proc.c" /* glr.c:846 */ break; - case 133: /* impl_stmt ::= free_stmt */ -#line 879 "src/parser_proc.y" -{ - yylhsminor.yy238 = (struct psi_token**) yymsp[0].minor.yy220; -} -#line 3216 "src/parser_proc.c" - yymsp[0].minor.yy238 = yylhsminor.yy238; + + case 164: /* int_signed_types */ +#line 272 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_token_free(&(*(struct psi_token **)(&(*yyvaluep))));} +#line 4080 "src/parser_proc.c" /* glr.c:846 */ break; - case 134: /* number ::= NUMBER|NSNAME */ -#line 882 "src/parser_proc.y" -{ - yylhsminor.yy57 = psi_number_init(yymsp[0].minor.yy0->type, yymsp[0].minor.yy0->text); - yylhsminor.yy57->token = yymsp[0].minor.yy0; -} -#line 3225 "src/parser_proc.c" - yymsp[0].minor.yy57 = yylhsminor.yy57; + + case 165: /* signed_short_types */ +#line 275 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 4086 "src/parser_proc.c" /* glr.c:846 */ break; - case 135: /* number ::= decl_var */ -#line 886 "src/parser_proc.y" -{ - yylhsminor.yy57 = psi_number_init(PSI_T_NAME, yymsp[0].minor.yy271); - yylhsminor.yy57->token = psi_token_copy(yymsp[0].minor.yy271->token); -} -#line 3234 "src/parser_proc.c" - yymsp[0].minor.yy57 = yylhsminor.yy57; + + case 166: /* signed_long_types */ +#line 275 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 4092 "src/parser_proc.c" /* glr.c:846 */ break; - case 136: /* num_exp ::= number */ -#line 890 "src/parser_proc.y" -{ - yylhsminor.yy207 = psi_num_exp_init_num(yymsp[0].minor.yy57); - yylhsminor.yy207->token = psi_token_copy(yymsp[0].minor.yy57->token); -} -#line 3243 "src/parser_proc.c" - yymsp[0].minor.yy207 = yylhsminor.yy207; + + case 167: /* int_width_types */ +#line 272 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_token_free(&(*(struct psi_token **)(&(*yyvaluep))));} +#line 4098 "src/parser_proc.c" /* glr.c:846 */ break; - case 137: /* num_exp ::= LPAREN num_exp RPAREN */ -#line 894 "src/parser_proc.y" -{ - yylhsminor.yy207 = psi_num_exp_init_unary(PSI_T_LPAREN, yymsp[-1].minor.yy207); - yylhsminor.yy207->token = yymsp[-2].minor.yy0; -} -#line 3252 "src/parser_proc.c" - yy_destructor(yypParser,87,&yymsp[0].minor); - yymsp[-2].minor.yy207 = yylhsminor.yy207; + + case 168: /* decl_stmt */ +#line 305 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_free(&(*(struct psi_decl **)(&(*yyvaluep))));} +#line 4104 "src/parser_proc.c" /* glr.c:846 */ break; - case 140: /* let_exp ::= NULL */ -{ yy_destructor(yypParser,15,&yymsp[0].minor); -#line 906 "src/parser_proc.y" -{ - yymsp[0].minor.yy200 = psi_let_exp_init(PSI_LET_NULL, NULL); -} -#line 3262 "src/parser_proc.c" -} + + case 169: /* decl */ +#line 305 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_free(&(*(struct psi_decl **)(&(*yyvaluep))));} +#line 4110 "src/parser_proc.c" /* glr.c:846 */ break; - case 141: /* let_exp ::= AMPERSAND NULL */ -{ yy_destructor(yypParser,23,&yymsp[-1].minor); -#line 909 "src/parser_proc.y" -{ - yymsp[-1].minor.yy200 = psi_let_exp_init(PSI_LET_NULL, NULL); - yymsp[-1].minor.yy200->is_reference = 1; -} -#line 3272 "src/parser_proc.c" - yy_destructor(yypParser,15,&yymsp[0].minor); -} + + case 170: /* decl_fn */ +#line 307 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_arg_free(&(*(struct psi_decl_arg **)(&(*yyvaluep))));} +#line 4116 "src/parser_proc.c" /* glr.c:846 */ break; - case 142: /* let_exp ::= let_callback */ -#line 913 "src/parser_proc.y" -{ - yylhsminor.yy200 = psi_let_exp_init(PSI_LET_CALLBACK, yymsp[0].minor.yy120); -} -#line 3281 "src/parser_proc.c" - yymsp[0].minor.yy200 = yylhsminor.yy200; + + case 171: /* decl_functor */ +#line 307 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_arg_free(&(*(struct psi_decl_arg **)(&(*yyvaluep))));} +#line 4122 "src/parser_proc.c" /* glr.c:846 */ break; - case 143: /* let_exp ::= let_calloc */ -#line 916 "src/parser_proc.y" -{ - yylhsminor.yy200 = psi_let_exp_init(PSI_LET_CALLOC, yymsp[0].minor.yy45); -} -#line 3289 "src/parser_proc.c" - yymsp[0].minor.yy200 = yylhsminor.yy200; + + case 172: /* decl_func */ +#line 307 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_arg_free(&(*(struct psi_decl_arg **)(&(*yyvaluep))));} +#line 4128 "src/parser_proc.c" /* glr.c:846 */ break; - case 144: /* let_exp ::= AMPERSAND let_calloc */ -{ yy_destructor(yypParser,23,&yymsp[-1].minor); -#line 919 "src/parser_proc.y" -{ - yymsp[-1].minor.yy200 = psi_let_exp_init(PSI_LET_CALLOC, yymsp[0].minor.yy45); - yymsp[-1].minor.yy200->is_reference = 1; -} -#line 3299 "src/parser_proc.c" -} + + case 173: /* decl_args */ +#line 319 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 4134 "src/parser_proc.c" /* glr.c:846 */ break; - case 145: /* let_exp ::= let_func */ -#line 923 "src/parser_proc.y" -{ - yylhsminor.yy200 = psi_let_exp_init_ex(NULL, PSI_LET_FUNC, yymsp[0].minor.yy67); -} -#line 3307 "src/parser_proc.c" - yymsp[0].minor.yy200 = yylhsminor.yy200; + + case 174: /* decl_arg */ +#line 307 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_arg_free(&(*(struct psi_decl_arg **)(&(*yyvaluep))));} +#line 4140 "src/parser_proc.c" /* glr.c:846 */ break; - case 146: /* let_exp ::= AMPERSAND let_func */ -{ yy_destructor(yypParser,23,&yymsp[-1].minor); -#line 926 "src/parser_proc.y" -{ - yymsp[-1].minor.yy200 = psi_let_exp_init_ex(NULL, PSI_LET_FUNC, yymsp[0].minor.yy67); - yymsp[-1].minor.yy200->is_reference = 1; -} -#line 3317 "src/parser_proc.c" -} + + case 175: /* decl_var */ +#line 309 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_var_free(&(*(struct psi_decl_var **)(&(*yyvaluep))));} +#line 4146 "src/parser_proc.c" /* glr.c:846 */ break; - case 147: /* let_exp ::= num_exp */ -#line 930 "src/parser_proc.y" -{ - yylhsminor.yy200 = psi_let_exp_init_ex(NULL, PSI_LET_NUMEXP, yymsp[0].minor.yy207); -} -#line 3325 "src/parser_proc.c" - yymsp[0].minor.yy200 = yylhsminor.yy200; + + case 176: /* decl_union */ +#line 313 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_union_free(&(*(struct psi_decl_union **)(&(*yyvaluep))));} +#line 4152 "src/parser_proc.c" /* glr.c:846 */ break; - case 148: /* let_exp ::= AMPERSAND num_exp */ -{ yy_destructor(yypParser,23,&yymsp[-1].minor); -#line 933 "src/parser_proc.y" -{ - yymsp[-1].minor.yy200 = psi_let_exp_init_ex(NULL, PSI_LET_NUMEXP, yymsp[0].minor.yy207); - yymsp[-1].minor.yy200->is_reference = 1; -} -#line 3335 "src/parser_proc.c" -} + + case 177: /* decl_struct */ +#line 311 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_struct_free(&(*(struct psi_decl_struct **)(&(*yyvaluep))));} +#line 4158 "src/parser_proc.c" /* glr.c:846 */ break; - case 149: /* let_exp ::= decl_var EQUALS let_exp */ -#line 937 "src/parser_proc.y" -{ - yylhsminor.yy200 = yymsp[0].minor.yy200; - yylhsminor.yy200->var = yymsp[-2].minor.yy271; -} -#line 3344 "src/parser_proc.c" - yy_destructor(yypParser,98,&yymsp[-1].minor); - yymsp[-2].minor.yy200 = yylhsminor.yy200; + + case 178: /* decl_struct_args */ +#line 319 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 4164 "src/parser_proc.c" /* glr.c:846 */ break; - case 150: /* let_stmt ::= LET let_exp EOS */ -#line 941 "src/parser_proc.y" -{ - yylhsminor.yy319 = psi_let_stmt_init(yymsp[-1].minor.yy200); - yylhsminor.yy319->token = yymsp[-2].minor.yy0; -} -#line 3354 "src/parser_proc.c" - yy_destructor(yypParser,75,&yymsp[0].minor); - yymsp[-2].minor.yy319 = yylhsminor.yy319; + + case 179: /* struct_args_block */ +#line 319 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 4170 "src/parser_proc.c" /* glr.c:846 */ break; - case 151: /* let_stmt ::= TEMP decl_var EQUALS reference decl_var EOS */ -#line 945 "src/parser_proc.y" -{ - yylhsminor.yy319 = psi_let_stmt_init(psi_let_exp_init_ex(yymsp[-4].minor.yy271, PSI_LET_TMP, yymsp[-1].minor.yy271)); - yylhsminor.yy319->token = yymsp[-5].minor.yy0; - yylhsminor.yy319->exp->is_reference = yymsp[-2].minor.yy89 ? 1 : 0; -} -#line 3365 "src/parser_proc.c" - yy_destructor(yypParser,98,&yymsp[-3].minor); - yy_destructor(yypParser,75,&yymsp[0].minor); - yymsp[-5].minor.yy319 = yylhsminor.yy319; + + case 180: /* struct_args */ +#line 319 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 4176 "src/parser_proc.c" /* glr.c:846 */ break; - case 152: /* let_callback ::= CALLBACK callback_rval LPAREN impl_var LPAREN callback_arg_list RPAREN RPAREN */ -#line 950 "src/parser_proc.y" -{ - yylhsminor.yy120 = psi_let_callback_init(psi_let_func_init(yymsp[-6].minor.yy0->type, yymsp[-6].minor.yy0->text, yymsp[-4].minor.yy370), yymsp[-2].minor.yy243); - yylhsminor.yy120->token = yymsp[-7].minor.yy0; - free(yymsp[-6].minor.yy0); -} -#line 3377 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-5].minor); - yy_destructor(yypParser,86,&yymsp[-3].minor); - yy_destructor(yypParser,87,&yymsp[-1].minor); - yy_destructor(yypParser,87,&yymsp[0].minor); - yymsp[-7].minor.yy120 = yylhsminor.yy120; + + case 181: /* struct_arg */ +#line 307 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_arg_free(&(*(struct psi_decl_arg **)(&(*yyvaluep))));} +#line 4182 "src/parser_proc.c" /* glr.c:846 */ break; - case 153: /* let_calloc ::= CALLOC LPAREN num_exp COMMA num_exp RPAREN */ -#line 955 "src/parser_proc.y" -{ - yylhsminor.yy45 = psi_let_calloc_init(yymsp[-3].minor.yy207, yymsp[-1].minor.yy207); - yylhsminor.yy45->token = yymsp[-5].minor.yy0; -} -#line 3390 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-4].minor); - yy_destructor(yypParser,88,&yymsp[-2].minor); - yy_destructor(yypParser,87,&yymsp[0].minor); - yymsp[-5].minor.yy45 = yylhsminor.yy45; + + case 182: /* decl_enum */ +#line 315 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_enum_free(&(*(struct psi_decl_enum **)(&(*yyvaluep))));} +#line 4188 "src/parser_proc.c" /* glr.c:846 */ break; - case 154: /* let_func ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT LPAREN impl_var RPAREN */ -#line 959 "src/parser_proc.y" -{ - yylhsminor.yy67 = psi_let_func_init(yymsp[-3].minor.yy0->type, yymsp[-3].minor.yy0->text, yymsp[-1].minor.yy370); - yylhsminor.yy67->token = yymsp[-3].minor.yy0; -} -#line 3402 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-2].minor); - yy_destructor(yypParser,87,&yymsp[0].minor); - yymsp[-3].minor.yy67 = yylhsminor.yy67; + + case 183: /* decl_enum_items */ +#line 319 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 4194 "src/parser_proc.c" /* glr.c:846 */ break; - case 155: /* let_func ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT LPAREN impl_var COMMA let_exps RPAREN */ -#line 963 "src/parser_proc.y" -{ - yylhsminor.yy67 = psi_let_func_init(yymsp[-5].minor.yy0->type, yymsp[-5].minor.yy0->text, yymsp[-3].minor.yy370); - yylhsminor.yy67->token = yymsp[-5].minor.yy0; - yylhsminor.yy67->inner = yymsp[-1].minor.yy179; -} -#line 3414 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-4].minor); - yy_destructor(yypParser,88,&yymsp[-2].minor); - yy_destructor(yypParser,87,&yymsp[0].minor); - yymsp[-5].minor.yy67 = yylhsminor.yy67; + + case 184: /* decl_enum_item */ +#line 317 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_decl_enum_item_free(&(*(struct psi_decl_enum_item **)(&(*yyvaluep))));} +#line 4200 "src/parser_proc.c" /* glr.c:846 */ break; - case 156: /* let_exps ::= let_exp */ -#line 968 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_let_exp_free), - &yymsp[0].minor.yy200); -} -#line 3426 "src/parser_proc.c" - yymsp[0].minor.yy179 = yylhsminor.yy179; + + case 185: /* num_exp */ +#line 370 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_num_exp_free(&(*(struct psi_num_exp **)(&(*yyvaluep))));} +#line 4206 "src/parser_proc.c" /* glr.c:846 */ break; - case 157: /* let_exps ::= let_exps COMMA let_exp */ -#line 972 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(yymsp[-2].minor.yy179, &yymsp[0].minor.yy200); -} -#line 3434 "src/parser_proc.c" - yy_destructor(yypParser,88,&yymsp[-1].minor); - yymsp[-2].minor.yy179 = yylhsminor.yy179; + + case 186: /* number */ +#line 372 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_number_free(&(*(struct psi_number **)(&(*yyvaluep))));} +#line 4212 "src/parser_proc.c" /* glr.c:846 */ break; - case 158: /* callback_arg_list ::= */ -#line 975 "src/parser_proc.y" -{ - yymsp[1].minor.yy243 = NULL; -} -#line 3443 "src/parser_proc.c" + + case 187: /* enum_name */ +#line 263 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_token_free(&(*(struct psi_token **)(&(*yyvaluep))));} +#line 4218 "src/parser_proc.c" /* glr.c:846 */ break; - case 159: /* callback_arg_list ::= callback_args */ -#line 978 "src/parser_proc.y" -{ - yylhsminor.yy243 = yymsp[0].minor.yy243; -} -#line 3450 "src/parser_proc.c" - yymsp[0].minor.yy243 = yylhsminor.yy243; + + case 188: /* union_name */ +#line 263 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_token_free(&(*(struct psi_token **)(&(*yyvaluep))));} +#line 4224 "src/parser_proc.c" /* glr.c:846 */ break; - case 160: /* callback_args ::= set_exp */ -#line 981 "src/parser_proc.y" -{ - yylhsminor.yy243 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_set_exp_free), - &yymsp[0].minor.yy180); -} -#line 3459 "src/parser_proc.c" - yymsp[0].minor.yy243 = yylhsminor.yy243; + + case 189: /* struct_name */ +#line 263 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_token_free(&(*(struct psi_token **)(&(*yyvaluep))));} +#line 4230 "src/parser_proc.c" /* glr.c:846 */ break; - case 161: /* callback_args ::= callback_args COMMA set_exp */ -#line 985 "src/parser_proc.y" -{ - yylhsminor.yy243 = psi_plist_add(yymsp[-2].minor.yy243, &yymsp[0].minor.yy180); -} -#line 3467 "src/parser_proc.c" - yy_destructor(yypParser,88,&yymsp[-1].minor); - yymsp[-2].minor.yy243 = yylhsminor.yy243; + + case 190: /* optional_name */ +#line 263 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_token_free(&(*(struct psi_token **)(&(*yyvaluep))));} +#line 4236 "src/parser_proc.c" /* glr.c:846 */ break; - case 164: /* set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var RPAREN */ -#line 994 "src/parser_proc.y" -{ - yylhsminor.yy362 = psi_set_func_init(yymsp[-3].minor.yy0->type, yymsp[-3].minor.yy0->text, yymsp[-1].minor.yy271); - yylhsminor.yy362->token = yymsp[-3].minor.yy0; -} -#line 3477 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-2].minor); - yy_destructor(yypParser,87,&yymsp[0].minor); - yymsp[-3].minor.yy362 = yylhsminor.yy362; + + case 191: /* decl_layout */ +#line 324 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_layout_free(&(*(struct psi_layout **)(&(*yyvaluep))));} +#line 4242 "src/parser_proc.c" /* glr.c:846 */ break; - case 165: /* set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var COMMA set_exps RPAREN */ -#line 998 "src/parser_proc.y" -{ - yylhsminor.yy362 = psi_set_func_init(yymsp[-5].minor.yy0->type, yymsp[-5].minor.yy0->text, yymsp[-3].minor.yy271); - yylhsminor.yy362->token = yymsp[-5].minor.yy0; - yylhsminor.yy362->inner = yymsp[-1].minor.yy179; -} -#line 3489 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-4].minor); - yy_destructor(yypParser,88,&yymsp[-2].minor); - yy_destructor(yypParser,87,&yymsp[0].minor); - yymsp[-5].minor.yy362 = yylhsminor.yy362; + + case 192: /* align_and_size */ +#line 322 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 4248 "src/parser_proc.c" /* glr.c:846 */ break; - case 166: /* set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var COMMA ELLIPSIS RPAREN */ -#line 1003 "src/parser_proc.y" -{ - yylhsminor.yy362 = psi_set_func_init(yymsp[-5].minor.yy0->type, yymsp[-5].minor.yy0->text, yymsp[-3].minor.yy271); - yylhsminor.yy362->token = yymsp[-5].minor.yy0; - yylhsminor.yy362->recursive = 1; -} -#line 3502 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-4].minor); - yy_destructor(yypParser,88,&yymsp[-2].minor); - yy_destructor(yypParser,101,&yymsp[-1].minor); - yy_destructor(yypParser,87,&yymsp[0].minor); - yymsp[-5].minor.yy362 = yylhsminor.yy362; + + case 193: /* array_size */ +#line 375 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 4254 "src/parser_proc.c" /* glr.c:846 */ break; - case 167: /* set_exp ::= set_func */ -#line 1008 "src/parser_proc.y" -{ - yylhsminor.yy180 = psi_set_exp_init(PSI_SET_FUNC, yymsp[0].minor.yy362); -} -#line 3514 "src/parser_proc.c" - yymsp[0].minor.yy180 = yylhsminor.yy180; + + case 194: /* indirection */ +#line 375 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 4260 "src/parser_proc.c" /* glr.c:846 */ break; - case 168: /* set_exp ::= num_exp */ -#line 1011 "src/parser_proc.y" -{ - yylhsminor.yy180 = psi_set_exp_init(PSI_SET_NUMEXP, yymsp[0].minor.yy207); -} -#line 3522 "src/parser_proc.c" - yymsp[0].minor.yy180 = yylhsminor.yy180; + + case 195: /* pointers */ +#line 375 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 4266 "src/parser_proc.c" /* glr.c:846 */ break; - case 169: /* set_exps ::= set_exp */ -#line 1014 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_set_exp_free), - &yymsp[0].minor.yy180); -} -#line 3531 "src/parser_proc.c" - yymsp[0].minor.yy179 = yylhsminor.yy179; + + case 196: /* impl */ +#line 327 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_impl_free(&(*(struct psi_impl **)(&(*yyvaluep))));} +#line 4272 "src/parser_proc.c" /* glr.c:846 */ break; - case 170: /* set_exps ::= set_exps COMMA set_exp */ -#line 1018 "src/parser_proc.y" -{ - yylhsminor.yy179 = psi_plist_add(yymsp[-2].minor.yy179, &yymsp[0].minor.yy180); -} -#line 3539 "src/parser_proc.c" - yy_destructor(yypParser,88,&yymsp[-1].minor); - yymsp[-2].minor.yy179 = yylhsminor.yy179; + + case 197: /* impl_func */ +#line 329 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_impl_func_free(&(*(struct psi_impl_func **)(&(*yyvaluep))));} +#line 4278 "src/parser_proc.c" /* glr.c:846 */ break; - case 171: /* set_exp ::= impl_var EQUALS set_exp */ -#line 1021 "src/parser_proc.y" -{ - yylhsminor.yy180 = yymsp[0].minor.yy180; - yylhsminor.yy180->var = yymsp[-2].minor.yy370; -} -#line 3549 "src/parser_proc.c" - yy_destructor(yypParser,98,&yymsp[-1].minor); - yymsp[-2].minor.yy180 = yylhsminor.yy180; + + case 198: /* impl_args */ +#line 367 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 4284 "src/parser_proc.c" /* glr.c:846 */ break; - case 172: /* set_stmt ::= SET set_exp EOS */ -#line 1025 "src/parser_proc.y" -{ - yylhsminor.yy358 = psi_set_stmt_init(yymsp[-1].minor.yy180); - yylhsminor.yy358->token = yymsp[-2].minor.yy0; -} -#line 3559 "src/parser_proc.c" - yy_destructor(yypParser,75,&yymsp[0].minor); - yymsp[-2].minor.yy358 = yylhsminor.yy358; + + case 199: /* impl_arg */ +#line 331 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_impl_arg_free(&(*(struct psi_impl_arg **)(&(*yyvaluep))));} +#line 4290 "src/parser_proc.c" /* glr.c:846 */ break; - case 173: /* return_stmt ::= RETURN set_func EOS */ -#line 1029 "src/parser_proc.y" -{ - yylhsminor.yy342 = psi_return_stmt_init(psi_set_exp_init(PSI_SET_FUNC, yymsp[-1].minor.yy362)); - yylhsminor.yy342->token = yymsp[-2].minor.yy0; -} -#line 3569 "src/parser_proc.c" - yy_destructor(yypParser,75,&yymsp[0].minor); - yymsp[-2].minor.yy342 = yylhsminor.yy342; + + case 200: /* impl_var */ +#line 335 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_impl_var_free(&(*(struct psi_impl_var **)(&(*yyvaluep))));} +#line 4296 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 201: /* impl_type */ +#line 333 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_impl_type_free(&(*(struct psi_impl_type **)(&(*yyvaluep))));} +#line 4302 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 202: /* impl_type_token */ +#line 365 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_token_free(&(*(struct psi_token **)(&(*yyvaluep))));} +#line 4308 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 203: /* impl_stmts */ +#line 367 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 4314 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 204: /* impl_stmt */ +#line 363 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_impl_stmt_free(&(*(struct psi_token ***)(&(*yyvaluep))));} +#line 4320 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 205: /* let_stmt */ +#line 338 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_let_stmt_free(&(*(struct psi_let_stmt **)(&(*yyvaluep))));} +#line 4326 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 206: /* let_exp */ +#line 340 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_let_exp_free(&(*(struct psi_let_exp **)(&(*yyvaluep))));} +#line 4332 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 207: /* let_exp_byref */ +#line 340 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_let_exp_free(&(*(struct psi_let_exp **)(&(*yyvaluep))));} +#line 4338 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 208: /* let_exp_assign */ +#line 340 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_let_exp_free(&(*(struct psi_let_exp **)(&(*yyvaluep))));} +#line 4344 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 209: /* let_calloc */ +#line 342 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_let_calloc_free(&(*(struct psi_let_calloc **)(&(*yyvaluep))));} +#line 4350 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 210: /* let_callback */ +#line 344 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_let_callback_free(&(*(struct psi_let_callback **)(&(*yyvaluep))));} +#line 4356 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 211: /* let_func */ +#line 346 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_let_func_free(&(*(struct psi_let_func **)(&(*yyvaluep))));} +#line 4362 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 212: /* let_func_token */ +#line 365 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_token_free(&(*(struct psi_token **)(&(*yyvaluep))));} +#line 4368 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 213: /* let_func_exps */ +#line 367 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 4374 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 214: /* let_exps */ +#line 367 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 4380 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 215: /* callback_rval */ +#line 365 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_token_free(&(*(struct psi_token **)(&(*yyvaluep))));} +#line 4386 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 216: /* callback_arg_list */ +#line 367 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 4392 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 217: /* callback_args */ +#line 367 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 4398 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 218: /* return_stmt */ +#line 356 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_return_stmt_free(&(*(struct psi_return_stmt **)(&(*yyvaluep))));} +#line 4404 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 219: /* set_stmt */ +#line 348 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_set_stmt_free(&(*(struct psi_set_stmt **)(&(*yyvaluep))));} +#line 4410 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 220: /* set_exp */ +#line 350 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_set_exp_free(&(*(struct psi_set_exp **)(&(*yyvaluep))));} +#line 4416 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 221: /* set_func */ +#line 352 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_set_func_free(&(*(struct psi_set_func **)(&(*yyvaluep))));} +#line 4422 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 222: /* set_func_token */ +#line 365 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_token_free(&(*(struct psi_token **)(&(*yyvaluep))));} +#line 4428 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 223: /* set_func_exps */ +#line 367 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 4434 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 224: /* set_exps */ +#line 367 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 4440 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 225: /* assert_stmt */ +#line 354 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_assert_stmt_free(&(*(struct psi_assert_stmt **)(&(*yyvaluep))));} +#line 4446 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 226: /* assert_stmt_token */ +#line 365 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_token_free(&(*(struct psi_token **)(&(*yyvaluep))));} +#line 4452 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 227: /* free_stmt */ +#line 358 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_free_stmt_free(&(*(struct psi_free_stmt **)(&(*yyvaluep))));} +#line 4458 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 228: /* free_exps */ +#line 367 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 4464 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 229: /* free_exp */ +#line 360 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_free_exp_free(&(*(struct psi_free_exp **)(&(*yyvaluep))));} +#line 4470 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 230: /* decl_vars */ +#line 319 "src/parser_proc_grammar.y" /* glr.c:846 */ + {psi_plist_free((*(struct psi_plist **)(&(*yyvaluep))));} +#line 4476 "src/parser_proc.c" /* glr.c:846 */ + break; + + case 231: /* reference */ +#line 377 "src/parser_proc_grammar.y" /* glr.c:846 */ + {} +#line 4482 "src/parser_proc.c" /* glr.c:846 */ + break; + + + default: break; - case 174: /* free_stmt ::= FREE free_exps EOS */ -#line 1033 "src/parser_proc.y" + } + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + +/** Number of symbols composing the right hand side of rule #RULE. */ +static inline int +yyrhsLength (yyRuleNum yyrule) { - yylhsminor.yy220 = psi_free_stmt_init(yymsp[-1].minor.yy179); - yylhsminor.yy220->token = yymsp[-2].minor.yy0; + return yyr2[yyrule]; } -#line 3579 "src/parser_proc.c" - yy_destructor(yypParser,75,&yymsp[0].minor); - yymsp[-2].minor.yy220 = yylhsminor.yy220; - break; - case 175: /* free_exps ::= free_exp */ -#line 1037 "src/parser_proc.y" + +static void +yydestroyGLRState (char const *yymsg, yyGLRState *yys, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + if (yys->yyresolved) + yydestruct (yymsg, yystos[yys->yylrState], + &yys->yysemantics.yysval, P, tokens, index); + else + { +#if YYDEBUG + if (yydebug) + { + if (yys->yysemantics.yyfirstVal) + YYFPRINTF (stderr, "%s unresolved", yymsg); + else + YYFPRINTF (stderr, "%s incomplete", yymsg); + YY_SYMBOL_PRINT ("", yystos[yys->yylrState], YY_NULLPTR, &yys->yyloc); + } +#endif + + if (yys->yysemantics.yyfirstVal) + { + yySemanticOption *yyoption = yys->yysemantics.yyfirstVal; + yyGLRState *yyrh; + int yyn; + for (yyrh = yyoption->yystate, yyn = yyrhsLength (yyoption->yyrule); + yyn > 0; + yyrh = yyrh->yypred, yyn -= 1) + yydestroyGLRState (yymsg, yyrh, P, tokens, index); + } + } +} + +/** Left-hand-side symbol for rule #YYRULE. */ +static inline yySymbol +yylhsNonterm (yyRuleNum yyrule) { - yylhsminor.yy179 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_free_exp_free), - &yymsp[0].minor.yy146); + return yyr1[yyrule]; } -#line 3589 "src/parser_proc.c" - yymsp[0].minor.yy179 = yylhsminor.yy179; - break; - case 176: /* free_exps ::= free_exps COMMA free_exp */ -#line 1041 "src/parser_proc.y" + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-490))) + +/** True iff LR state YYSTATE has only a default reduction (regardless + * of token). */ +static inline yybool +yyisDefaultedState (yyStateNum yystate) { - yylhsminor.yy179 = psi_plist_add(yymsp[-2].minor.yy179, &yymsp[0].minor.yy146); + return yypact_value_is_default (yypact[yystate]); } -#line 3597 "src/parser_proc.c" - yy_destructor(yypParser,88,&yymsp[-1].minor); - yymsp[-2].minor.yy179 = yylhsminor.yy179; - break; - case 177: /* free_exp ::= NAME LPAREN decl_vars RPAREN */ -#line 1044 "src/parser_proc.y" + +/** The default reduction for YYSTATE, assuming it has one. */ +static inline yyRuleNum +yydefaultAction (yyStateNum yystate) { - yylhsminor.yy146 = psi_free_exp_init(yymsp[-3].minor.yy0->text, yymsp[-1].minor.yy179); - yylhsminor.yy146->token = yymsp[-3].minor.yy0; + return yydefact[yystate]; } -#line 3607 "src/parser_proc.c" - yy_destructor(yypParser,86,&yymsp[-2].minor); - yy_destructor(yypParser,87,&yymsp[0].minor); - yymsp[-3].minor.yy146 = yylhsminor.yy146; - break; - case 178: /* assert_stmt ::= PRE_ASSERT|POST_ASSERT num_exp EOS */ -#line 1048 "src/parser_proc.y" + +#define yytable_value_is_error(Yytable_value) \ + 0 + +/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN. + * Result R means + * R < 0: Reduce on rule -R. + * R = 0: Error. + * R > 0: Shift to state R. + * Set *YYCONFLICTS to a pointer into yyconfl to a 0-terminated list + * of conflicting reductions. + */ +static inline void +yygetLRActions (yyStateNum yystate, int yytoken, + int* yyaction, const short int** yyconflicts) +{ + int yyindex = yypact[yystate] + yytoken; + if (yypact_value_is_default (yypact[yystate]) + || yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken) + { + *yyaction = -yydefact[yystate]; + *yyconflicts = yyconfl; + } + else if (! yytable_value_is_error (yytable[yyindex])) + { + *yyaction = yytable[yyindex]; + *yyconflicts = yyconfl + yyconflp[yyindex]; + } + else + { + *yyaction = 0; + *yyconflicts = yyconfl + yyconflp[yyindex]; + } +} + +/** Compute post-reduction state. + * \param yystate the current state + * \param yysym the nonterminal to push on the stack + */ +static inline yyStateNum +yyLRgotoState (yyStateNum yystate, yySymbol yysym) +{ + int yyr = yypgoto[yysym - YYNTOKENS] + yystate; + if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate) + return yytable[yyr]; + else + return yydefgoto[yysym - YYNTOKENS]; +} + +static inline yybool +yyisShiftAction (int yyaction) { - yylhsminor.yy201 = psi_assert_stmt_init(yymsp[-2].minor.yy0->type, yymsp[-1].minor.yy207); - yylhsminor.yy201->token = yymsp[-2].minor.yy0; + return 0 < yyaction; } -#line 3618 "src/parser_proc.c" - yy_destructor(yypParser,75,&yymsp[0].minor); - yymsp[-2].minor.yy201 = yylhsminor.yy201; - break; - case 179: /* reference ::= */ -#line 1052 "src/parser_proc.y" + +static inline yybool +yyisErrorAction (int yyaction) { - yymsp[1].minor.yy89 = false; + return yyaction == 0; } -#line 3627 "src/parser_proc.c" - break; - case 180: /* reference ::= AMPERSAND */ -{ yy_destructor(yypParser,23,&yymsp[0].minor); -#line 1055 "src/parser_proc.y" + + /* GLRStates */ + +/** Return a fresh GLRStackItem in YYSTACKP. The item is an LR state + * if YYISSTATE, and otherwise a semantic option. Callers should call + * YY_RESERVE_GLRSTACK afterwards to make sure there is sufficient + * headroom. */ + +static inline yyGLRStackItem* +yynewGLRStackItem (yyGLRStack* yystackp, yybool yyisState) { - yymsp[0].minor.yy89 = true; + yyGLRStackItem* yynewItem = yystackp->yynextFree; + yystackp->yyspaceLeft -= 1; + yystackp->yynextFree += 1; + yynewItem->yystate.yyisState = yyisState; + return yynewItem; } -#line 3635 "src/parser_proc.c" + +/** Add a new semantic action that will execute the action for rule + * YYRULE on the semantic values in YYRHS to the list of + * alternative actions for YYSTATE. Assumes that YYRHS comes from + * stack #YYK of *YYSTACKP. */ +static void +yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate, + yyGLRState* yyrhs, yyRuleNum yyrule) +{ + yySemanticOption* yynewOption = + &yynewGLRStackItem (yystackp, yyfalse)->yyoption; + YYASSERT (!yynewOption->yyisState); + yynewOption->yystate = yyrhs; + yynewOption->yyrule = yyrule; + if (yystackp->yytops.yylookaheadNeeds[yyk]) + { + yynewOption->yyrawchar = yychar; + yynewOption->yyval = yylval; + } + else + yynewOption->yyrawchar = YYEMPTY; + yynewOption->yynext = yystate->yysemantics.yyfirstVal; + yystate->yysemantics.yyfirstVal = yynewOption; + + YY_RESERVE_GLRSTACK (yystackp); } - break; - case 181: /* indirection ::= */ -#line 1058 "src/parser_proc.y" -{ - yymsp[1].minor.yy382 = 0; + + /* GLRStacks */ + +/** Initialize YYSET to a singleton set containing an empty stack. */ +static yybool +yyinitStateSet (yyGLRStateSet* yyset) +{ + yyset->yysize = 1; + yyset->yycapacity = 16; + yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]); + if (! yyset->yystates) + return yyfalse; + yyset->yystates[0] = YY_NULLPTR; + yyset->yylookaheadNeeds = + (yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadNeeds[0]); + if (! yyset->yylookaheadNeeds) + { + YYFREE (yyset->yystates); + return yyfalse; + } + return yytrue; } -#line 3643 "src/parser_proc.c" - break; - case 182: /* indirection ::= pointers */ -#line 1061 "src/parser_proc.y" + +static void yyfreeStateSet (yyGLRStateSet* yyset) { - yylhsminor.yy382 = yymsp[0].minor.yy382; + YYFREE (yyset->yystates); + YYFREE (yyset->yylookaheadNeeds); } -#line 3650 "src/parser_proc.c" - yymsp[0].minor.yy382 = yylhsminor.yy382; - break; - case 183: /* pointers ::= ASTERISK */ -{ yy_destructor(yypParser,28,&yymsp[0].minor); -#line 1064 "src/parser_proc.y" -{ - yymsp[0].minor.yy382 = 1; + +/** Initialize *YYSTACKP to a single empty stack, with total maximum + * capacity for all stacks of YYSIZE. */ +static yybool +yyinitGLRStack (yyGLRStack* yystackp, size_t yysize) +{ + yystackp->yyerrState = 0; + yynerrs = 0; + yystackp->yyspaceLeft = yysize; + yystackp->yyitems = + (yyGLRStackItem*) YYMALLOC (yysize * sizeof yystackp->yynextFree[0]); + if (!yystackp->yyitems) + return yyfalse; + yystackp->yynextFree = yystackp->yyitems; + yystackp->yysplitPoint = YY_NULLPTR; + yystackp->yylastDeleted = YY_NULLPTR; + return yyinitStateSet (&yystackp->yytops); } -#line 3659 "src/parser_proc.c" + + +#if YYSTACKEXPANDABLE +# define YYRELOC(YYFROMITEMS,YYTOITEMS,YYX,YYTYPE) \ + &((YYTOITEMS) - ((YYFROMITEMS) - (yyGLRStackItem*) (YYX)))->YYTYPE + +/** If *YYSTACKP is expandable, extend it. WARNING: Pointers into the + stack from outside should be considered invalid after this call. + We always expand when there are 1 or fewer items left AFTER an + allocation, so that we can avoid having external pointers exist + across an allocation. */ +static void +yyexpandGLRStack (yyGLRStack* yystackp) +{ + yyGLRStackItem* yynewItems; + yyGLRStackItem* yyp0, *yyp1; + size_t yynewSize; + size_t yyn; + size_t yysize = yystackp->yynextFree - yystackp->yyitems; + if (YYMAXDEPTH - YYHEADROOM < yysize) + yyMemoryExhausted (yystackp); + yynewSize = 2*yysize; + if (YYMAXDEPTH < yynewSize) + yynewSize = YYMAXDEPTH; + yynewItems = (yyGLRStackItem*) YYMALLOC (yynewSize * sizeof yynewItems[0]); + if (! yynewItems) + yyMemoryExhausted (yystackp); + for (yyp0 = yystackp->yyitems, yyp1 = yynewItems, yyn = yysize; + 0 < yyn; + yyn -= 1, yyp0 += 1, yyp1 += 1) + { + *yyp1 = *yyp0; + if (*(yybool *) yyp0) + { + yyGLRState* yys0 = &yyp0->yystate; + yyGLRState* yys1 = &yyp1->yystate; + if (yys0->yypred != YY_NULLPTR) + yys1->yypred = + YYRELOC (yyp0, yyp1, yys0->yypred, yystate); + if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULLPTR) + yys1->yysemantics.yyfirstVal = + YYRELOC (yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption); + } + else + { + yySemanticOption* yyv0 = &yyp0->yyoption; + yySemanticOption* yyv1 = &yyp1->yyoption; + if (yyv0->yystate != YY_NULLPTR) + yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate); + if (yyv0->yynext != YY_NULLPTR) + yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption); + } + } + if (yystackp->yysplitPoint != YY_NULLPTR) + yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems, + yystackp->yysplitPoint, yystate); + + for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1) + if (yystackp->yytops.yystates[yyn] != YY_NULLPTR) + yystackp->yytops.yystates[yyn] = + YYRELOC (yystackp->yyitems, yynewItems, + yystackp->yytops.yystates[yyn], yystate); + YYFREE (yystackp->yyitems); + yystackp->yyitems = yynewItems; + yystackp->yynextFree = yynewItems + yysize; + yystackp->yyspaceLeft = yynewSize - yysize; } - break; - case 184: /* pointers ::= pointers ASTERISK */ -#line 1067 "src/parser_proc.y" +#endif + +static void +yyfreeGLRStack (yyGLRStack* yystackp) { - yylhsminor.yy382 = yymsp[-1].minor.yy382+1; + YYFREE (yystackp->yyitems); + yyfreeStateSet (&yystackp->yytops); } -#line 3667 "src/parser_proc.c" - yy_destructor(yypParser,28,&yymsp[0].minor); - yymsp[-1].minor.yy382 = yylhsminor.yy382; - break; - case 185: /* file ::= blocks */ -{ yy_destructor(yypParser,180,&yymsp[0].minor); -#line 193 "src/parser_proc.y" + +/** Assuming that YYS is a GLRState somewhere on *YYSTACKP, update the + * splitpoint of *YYSTACKP, if needed, so that it is at least as deep as + * YYS. */ +static inline void +yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys) { + if (yystackp->yysplitPoint != YY_NULLPTR && yystackp->yysplitPoint > yys) + yystackp->yysplitPoint = yys; } -#line 3676 "src/parser_proc.c" + +/** Invalidate stack #YYK in *YYSTACKP. */ +static inline void +yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk) +{ + if (yystackp->yytops.yystates[yyk] != YY_NULLPTR) + yystackp->yylastDeleted = yystackp->yytops.yystates[yyk]; + yystackp->yytops.yystates[yyk] = YY_NULLPTR; } - break; - case 186: /* blocks ::= block */ -{ yy_destructor(yypParser,181,&yymsp[0].minor); -#line 194 "src/parser_proc.y" + +/** Undelete the last stack in *YYSTACKP that was marked as deleted. Can + only be done once after a deletion, and only when all other stacks have + been deleted. */ +static void +yyundeleteLastStack (yyGLRStack* yystackp) { + if (yystackp->yylastDeleted == YY_NULLPTR || yystackp->yytops.yysize != 0) + return; + yystackp->yytops.yystates[0] = yystackp->yylastDeleted; + yystackp->yytops.yysize = 1; + YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n")); + yystackp->yylastDeleted = YY_NULLPTR; } -#line 3684 "src/parser_proc.c" + +static inline void +yyremoveDeletes (yyGLRStack* yystackp) +{ + size_t yyi, yyj; + yyi = yyj = 0; + while (yyj < yystackp->yytops.yysize) + { + if (yystackp->yytops.yystates[yyi] == YY_NULLPTR) + { + if (yyi == yyj) + { + YYDPRINTF ((stderr, "Removing dead stacks.\n")); + } + yystackp->yytops.yysize -= 1; + } + else + { + yystackp->yytops.yystates[yyj] = yystackp->yytops.yystates[yyi]; + /* In the current implementation, it's unnecessary to copy + yystackp->yytops.yylookaheadNeeds[yyi] since, after + yyremoveDeletes returns, the parser immediately either enters + deterministic operation or shifts a token. However, it doesn't + hurt, and the code might evolve to need it. */ + yystackp->yytops.yylookaheadNeeds[yyj] = + yystackp->yytops.yylookaheadNeeds[yyi]; + if (yyj != yyi) + { + YYDPRINTF ((stderr, "Rename stack %lu -> %lu.\n", + (unsigned long int) yyi, (unsigned long int) yyj)); + } + yyj += 1; + } + yyi += 1; + } } - break; - case 187: /* blocks ::= blocks block */ -{ yy_destructor(yypParser,180,&yymsp[-1].minor); -#line 195 "src/parser_proc.y" -{ + +/** Shift to a new state on stack #YYK of *YYSTACKP, corresponding to LR + * state YYLRSTATE, at input position YYPOSN, with (resolved) semantic + * value *YYVALP and source location *YYLOCP. */ +static inline void +yyglrShift (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState, + size_t yyposn, + YYSTYPE* yyvalp) +{ + yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate; + + yynewState->yylrState = yylrState; + yynewState->yyposn = yyposn; + yynewState->yyresolved = yytrue; + yynewState->yypred = yystackp->yytops.yystates[yyk]; + yynewState->yysemantics.yysval = *yyvalp; + yystackp->yytops.yystates[yyk] = yynewState; + + YY_RESERVE_GLRSTACK (yystackp); } -#line 3692 "src/parser_proc.c" - yy_destructor(yypParser,181,&yymsp[0].minor); + +/** Shift stack #YYK of *YYSTACKP, to a new state corresponding to LR + * state YYLRSTATE, at input position YYPOSN, with the (unresolved) + * semantic value of YYRHS under the action for YYRULE. */ +static inline void +yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState, + size_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule) +{ + yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate; + YYASSERT (yynewState->yyisState); + + yynewState->yylrState = yylrState; + yynewState->yyposn = yyposn; + yynewState->yyresolved = yyfalse; + yynewState->yypred = yystackp->yytops.yystates[yyk]; + yynewState->yysemantics.yyfirstVal = YY_NULLPTR; + yystackp->yytops.yystates[yyk] = yynewState; + + /* Invokes YY_RESERVE_GLRSTACK. */ + yyaddDeferredAction (yystackp, yyk, yynewState, yyrhs, yyrule); } - break; - case 188: /* block ::= EOS */ -{ yy_destructor(yypParser,75,&yymsp[0].minor); -#line 196 "src/parser_proc.y" -{ + +#if !YYDEBUG +# define YY_REDUCE_PRINT(Args) +#else +# define YY_REDUCE_PRINT(Args) \ +do { \ + if (yydebug) \ + yy_reduce_print Args; \ +} while (0) + +/*----------------------------------------------------------------------. +| Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. | +`----------------------------------------------------------------------*/ + +static inline void +yy_reduce_print (int yynormal, yyGLRStackItem* yyvsp, size_t yyk, + yyRuleNum yyrule, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + int yynrhs = yyrhsLength (yyrule); + int yyi; + YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n", + (unsigned long int) yyk, yyrule - 1, + (unsigned long int) yyrline[yyrule]); + if (! yynormal) + yyfillin (yyvsp, 1, -yynrhs); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyvsp[yyi - yynrhs + 1].yystate.yylrState], + &yyvsp[yyi - yynrhs + 1].yystate.yysemantics.yysval + , P, tokens, index); + if (!yyvsp[yyi - yynrhs + 1].yystate.yyresolved) + YYFPRINTF (stderr, " (unresolved)"); + YYFPRINTF (stderr, "\n"); + } } -#line 3701 "src/parser_proc.c" +#endif + +/** Pop the symbols consumed by reduction #YYRULE from the top of stack + * #YYK of *YYSTACKP, and perform the appropriate semantic action on their + * semantic values. Assumes that all ambiguities in semantic values + * have been previously resolved. Set *YYVALP to the resulting value, + * and *YYLOCP to the computed location (if any). Return value is as + * for userAction. */ +static inline YYRESULTTAG +yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, + YYSTYPE* yyvalp, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + int yynrhs = yyrhsLength (yyrule); + + if (yystackp->yysplitPoint == YY_NULLPTR) + { + /* Standard special case: single stack. */ + yyGLRStackItem* yyrhs = (yyGLRStackItem*) yystackp->yytops.yystates[yyk]; + YYASSERT (yyk == 0); + yystackp->yynextFree -= yynrhs; + yystackp->yyspaceLeft += yynrhs; + yystackp->yytops.yystates[0] = & yystackp->yynextFree[-1].yystate; + YY_REDUCE_PRINT ((1, yyrhs, yyk, yyrule, P, tokens, index)); + return yyuserAction (yyrule, yynrhs, yyrhs, yystackp, + yyvalp, P, tokens, index); + } + else + { + int yyi; + yyGLRState* yys; + yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1]; + yys = yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred + = yystackp->yytops.yystates[yyk]; + for (yyi = 0; yyi < yynrhs; yyi += 1) + { + yys = yys->yypred; + YYASSERT (yys); + } + yyupdateSplit (yystackp, yys); + yystackp->yytops.yystates[yyk] = yys; + YY_REDUCE_PRINT ((0, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, yyk, yyrule, P, tokens, index)); + return yyuserAction (yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, + yystackp, yyvalp, P, tokens, index); + } } - break; - case 189: /* block ::= EOL */ -{ yy_destructor(yypParser,76,&yymsp[0].minor); -#line 197 "src/parser_proc.y" + +/** Pop items off stack #YYK of *YYSTACKP according to grammar rule YYRULE, + * and push back on the resulting nonterminal symbol. Perform the + * semantic action associated with YYRULE and store its value with the + * newly pushed state, if YYFORCEEVAL or if *YYSTACKP is currently + * unambiguous. Otherwise, store the deferred semantic action with + * the new state. If the new state would have an identical input + * position, LR state, and predecessor to an existing state on the stack, + * it is identified with that existing state, eliminating stack #YYK from + * *YYSTACKP. In this case, the semantic value is + * added to the options for the existing state's semantic value. + */ +static inline YYRESULTTAG +yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, + yybool yyforceEval, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + size_t yyposn = yystackp->yytops.yystates[yyk]->yyposn; + + if (yyforceEval || yystackp->yysplitPoint == YY_NULLPTR) + { + YYSTYPE yysval; + + YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yysval, P, tokens, index); + if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR) + { + YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n", + (unsigned long int) yyk, yyrule - 1)); + } + if (yyflag != yyok) + return yyflag; + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyrule], &yysval, &yyloc); + yyglrShift (yystackp, yyk, + yyLRgotoState (yystackp->yytops.yystates[yyk]->yylrState, + yylhsNonterm (yyrule)), + yyposn, &yysval); + } + else + { + size_t yyi; + int yyn; + yyGLRState* yys, *yys0 = yystackp->yytops.yystates[yyk]; + yyStateNum yynewLRState; + + for (yys = yystackp->yytops.yystates[yyk], yyn = yyrhsLength (yyrule); + 0 < yyn; yyn -= 1) + { + yys = yys->yypred; + YYASSERT (yys); + } + yyupdateSplit (yystackp, yys); + yynewLRState = yyLRgotoState (yys->yylrState, yylhsNonterm (yyrule)); + YYDPRINTF ((stderr, + "Reduced stack %lu by rule #%d; action deferred. " + "Now in state %d.\n", + (unsigned long int) yyk, yyrule - 1, yynewLRState)); + for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) + if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR) + { + yyGLRState *yysplit = yystackp->yysplitPoint; + yyGLRState *yyp = yystackp->yytops.yystates[yyi]; + while (yyp != yys && yyp != yysplit && yyp->yyposn >= yyposn) + { + if (yyp->yylrState == yynewLRState && yyp->yypred == yys) + { + yyaddDeferredAction (yystackp, yyk, yyp, yys0, yyrule); + yymarkStackDeleted (yystackp, yyk); + YYDPRINTF ((stderr, "Merging stack %lu into stack %lu.\n", + (unsigned long int) yyk, + (unsigned long int) yyi)); + return yyok; + } + yyp = yyp->yypred; + } + } + yystackp->yytops.yystates[yyk] = yys; + yyglrShiftDefer (yystackp, yyk, yynewLRState, yyposn, yys0, yyrule); + } + return yyok; +} + +static size_t +yysplitStack (yyGLRStack* yystackp, size_t yyk) { + if (yystackp->yysplitPoint == YY_NULLPTR) + { + YYASSERT (yyk == 0); + yystackp->yysplitPoint = yystackp->yytops.yystates[yyk]; + } + if (yystackp->yytops.yysize >= yystackp->yytops.yycapacity) + { + yyGLRState** yynewStates; + yybool* yynewLookaheadNeeds; + + yynewStates = YY_NULLPTR; + + if (yystackp->yytops.yycapacity + > (YYSIZEMAX / (2 * sizeof yynewStates[0]))) + yyMemoryExhausted (yystackp); + yystackp->yytops.yycapacity *= 2; + + yynewStates = + (yyGLRState**) YYREALLOC (yystackp->yytops.yystates, + (yystackp->yytops.yycapacity + * sizeof yynewStates[0])); + if (yynewStates == YY_NULLPTR) + yyMemoryExhausted (yystackp); + yystackp->yytops.yystates = yynewStates; + + yynewLookaheadNeeds = + (yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds, + (yystackp->yytops.yycapacity + * sizeof yynewLookaheadNeeds[0])); + if (yynewLookaheadNeeds == YY_NULLPTR) + yyMemoryExhausted (yystackp); + yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds; + } + yystackp->yytops.yystates[yystackp->yytops.yysize] + = yystackp->yytops.yystates[yyk]; + yystackp->yytops.yylookaheadNeeds[yystackp->yytops.yysize] + = yystackp->yytops.yylookaheadNeeds[yyk]; + yystackp->yytops.yysize += 1; + return yystackp->yytops.yysize-1; } -#line 3709 "src/parser_proc.c" + +/** True iff YYY0 and YYY1 represent identical options at the top level. + * That is, they represent the same rule applied to RHS symbols + * that produce the same terminal symbols. */ +static yybool +yyidenticalOptions (yySemanticOption* yyy0, yySemanticOption* yyy1) +{ + if (yyy0->yyrule == yyy1->yyrule) + { + yyGLRState *yys0, *yys1; + int yyn; + for (yys0 = yyy0->yystate, yys1 = yyy1->yystate, + yyn = yyrhsLength (yyy0->yyrule); + yyn > 0; + yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1) + if (yys0->yyposn != yys1->yyposn) + return yyfalse; + return yytrue; + } + else + return yyfalse; } - break; - case 190: /* block ::= COMMENT */ -{ yy_destructor(yypParser,77,&yymsp[0].minor); -#line 198 "src/parser_proc.y" -{ + +/** Assuming identicalOptions (YYY0,YYY1), destructively merge the + * alternative semantic values for the RHS-symbols of YYY1 and YYY0. */ +static void +yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1) +{ + yyGLRState *yys0, *yys1; + int yyn; + for (yys0 = yyy0->yystate, yys1 = yyy1->yystate, + yyn = yyrhsLength (yyy0->yyrule); + yyn > 0; + yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1) + { + if (yys0 == yys1) + break; + else if (yys0->yyresolved) + { + yys1->yyresolved = yytrue; + yys1->yysemantics.yysval = yys0->yysemantics.yysval; + } + else if (yys1->yyresolved) + { + yys0->yyresolved = yytrue; + yys0->yysemantics.yysval = yys1->yysemantics.yysval; + } + else + { + yySemanticOption** yyz0p = &yys0->yysemantics.yyfirstVal; + yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal; + while (yytrue) + { + if (yyz1 == *yyz0p || yyz1 == YY_NULLPTR) + break; + else if (*yyz0p == YY_NULLPTR) + { + *yyz0p = yyz1; + break; + } + else if (*yyz0p < yyz1) + { + yySemanticOption* yyz = *yyz0p; + *yyz0p = yyz1; + yyz1 = yyz1->yynext; + (*yyz0p)->yynext = yyz; + } + yyz0p = &(*yyz0p)->yynext; + } + yys1->yysemantics.yyfirstVal = yys0->yysemantics.yyfirstVal; + } + } } -#line 3717 "src/parser_proc.c" + +/** Y0 and Y1 represent two possible actions to take in a given + * parsing state; return 0 if no combination is possible, + * 1 if user-mergeable, 2 if Y0 is preferred, 3 if Y1 is preferred. */ +static int +yypreference (yySemanticOption* y0, yySemanticOption* y1) +{ + yyRuleNum r0 = y0->yyrule, r1 = y1->yyrule; + int p0 = yydprec[r0], p1 = yydprec[r1]; + + if (p0 == p1) + { + if (yymerger[r0] == 0 || yymerger[r0] != yymerger[r1]) + return 0; + else + return 1; + } + if (p0 == 0 || p1 == 0) + return 0; + if (p0 < p1) + return 3; + if (p1 < p0) + return 2; + return 0; } - break; - default: - break; -/********** End reduce actions ************************************************/ - }; - assert( yyrulenoYY_MAX_SHIFT ){ - yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; + +static YYRESULTTAG yyresolveValue (yyGLRState* yys, + yyGLRStack* yystackp, struct psi_parser *P, struct psi_plist *tokens, size_t *index); + + +/** Resolve the previous YYN states starting at and including state YYS + * on *YYSTACKP. If result != yyok, some states may have been left + * unresolved possibly with empty semantic option chains. Regardless + * of whether result = yyok, each state has been left with consistent + * data so that yydestroyGLRState can be invoked if necessary. */ +static YYRESULTTAG +yyresolveStates (yyGLRState* yys, int yyn, + yyGLRStack* yystackp, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + if (0 < yyn) + { + YYASSERT (yys->yypred); + YYCHK (yyresolveStates (yys->yypred, yyn-1, yystackp, P, tokens, index)); + if (! yys->yyresolved) + YYCHK (yyresolveValue (yys, yystackp, P, tokens, index)); } - yymsp -= yysize-1; - yypParser->yytos = yymsp; - yymsp->stateno = (YYACTIONTYPE)yyact; - yymsp->major = (YYCODETYPE)yygoto; - yyTraceShift(yypParser, yyact); - }else{ - assert( yyact == YY_ACCEPT_ACTION ); - yypParser->yytos -= yysize; - yy_accept(yypParser); - } + return yyok; } -/* -** The following code executes when the parse fails -*/ -#ifndef YYNOERRORRECOVERY -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ -/************ Begin %parse_failure code ***************************************/ -/************ End %parse_failure code *****************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} -#endif /* YYNOERRORRECOVERY */ - -/* -** The following code executes when a syntax error first occurs. -*/ -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - ParseTOKENTYPE yyminor /* The minor type of the error token */ -){ - ParseARG_FETCH; -#define TOKEN yyminor -/************ Begin %syntax_error code ****************************************/ -#line 40 "src/parser_proc.y" - ++P->errors; if (TOKEN) { psi_error(PSI_WARNING, TOKEN->file, TOKEN->line, "PSI syntax error: Unexpected token '%s' at pos %u", TOKEN->text, TOKEN->col); } else { psi_error(PSI_WARNING, P->file.fn, P->line, "PSI syntax error: Unexpected end of input"); } -#line 3779 "src/parser_proc.c" -/************ End %syntax_error code ******************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* -** The following is executed when the parser accepts -*/ -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); +/** Resolve the states for the RHS of YYOPT on *YYSTACKP, perform its + * user action, and return the semantic value and location in *YYVALP + * and *YYLOCP. Regardless of whether result = yyok, all RHS states + * have been destroyed (assuming the user action destroys all RHS + * semantic values if invoked). */ +static YYRESULTTAG +yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp, + YYSTYPE* yyvalp, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1]; + int yynrhs = yyrhsLength (yyopt->yyrule); + YYRESULTTAG yyflag = + yyresolveStates (yyopt->yystate, yynrhs, yystackp, P, tokens, index); + if (yyflag != yyok) + { + yyGLRState *yys; + for (yys = yyopt->yystate; yynrhs > 0; yys = yys->yypred, yynrhs -= 1) + yydestroyGLRState ("Cleanup: popping", yys, P, tokens, index); + return yyflag; + } + + yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred = yyopt->yystate; + { + int yychar_current = yychar; + YYSTYPE yylval_current = yylval; + yychar = yyopt->yyrawchar; + yylval = yyopt->yyval; + yyflag = yyuserAction (yyopt->yyrule, yynrhs, + yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, + yystackp, yyvalp, P, tokens, index); + yychar = yychar_current; + yylval = yylval_current; } + return yyflag; +} + +#if YYDEBUG +static void +yyreportTree (yySemanticOption* yyx, int yyindent) +{ + int yynrhs = yyrhsLength (yyx->yyrule); + int yyi; + yyGLRState* yys; + yyGLRState* yystates[1 + YYMAXRHS]; + yyGLRState yyleftmost_state; + + for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred) + yystates[yyi] = yys; + if (yys == YY_NULLPTR) + { + yyleftmost_state.yyposn = 0; + yystates[0] = &yyleftmost_state; + } + else + yystates[0] = yys; + + if (yyx->yystate->yyposn < yys->yyposn + 1) + YYFPRINTF (stderr, "%*s%s -> \n", + yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)), + yyx->yyrule - 1); + else + YYFPRINTF (stderr, "%*s%s -> \n", + yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)), + yyx->yyrule - 1, (unsigned long int) (yys->yyposn + 1), + (unsigned long int) yyx->yystate->yyposn); + for (yyi = 1; yyi <= yynrhs; yyi += 1) + { + if (yystates[yyi]->yyresolved) + { + if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn) + YYFPRINTF (stderr, "%*s%s \n", yyindent+2, "", + yytokenName (yystos[yystates[yyi]->yylrState])); + else + YYFPRINTF (stderr, "%*s%s \n", yyindent+2, "", + yytokenName (yystos[yystates[yyi]->yylrState]), + (unsigned long int) (yystates[yyi-1]->yyposn + 1), + (unsigned long int) yystates[yyi]->yyposn); + } + else + yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2); + } +} #endif -#ifndef YYNOERRORRECOVERY - yypParser->yyerrcnt = -1; -#endif - assert( yypParser->yytos==yypParser->yystack ); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ -/*********** Begin %parse_accept code *****************************************/ -/*********** End %parse_accept code *******************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "ParseAlloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -void Parse( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - ParseTOKENTYPE yyminor /* The value for the token */ - ParseARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - unsigned int yyact; /* The parser action. */ -#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) - int yyendofinput; /* True if we are at the end of input */ -#endif -#ifdef YYERRORSYMBOL - int yyerrorhit = 0; /* True if yymajor has invoked an error */ -#endif - yyParser *yypParser; /* The parser */ - yypParser = (yyParser*)yyp; - assert( yypParser->yytos!=0 ); -#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) - yyendofinput = (yymajor==0); +static YYRESULTTAG +yyreportAmbiguity (yySemanticOption* yyx0, + yySemanticOption* yyx1, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + YYUSE (yyx0); + YYUSE (yyx1); + +#if YYDEBUG + YYFPRINTF (stderr, "Ambiguity detected.\n"); + YYFPRINTF (stderr, "Option 1,\n"); + yyreportTree (yyx0, 2); + YYFPRINTF (stderr, "\nOption 2,\n"); + yyreportTree (yyx1, 2); + YYFPRINTF (stderr, "\n"); #endif - ParseARG_STORE; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput '%s'\n",yyTracePrompt,yyTokenName[yymajor]); + yyerror (P, tokens, index, YY_("syntax is ambiguous")); + return yyabort; +} + +/** Resolve the ambiguity represented in state YYS in *YYSTACKP, + * perform the indicated actions, and set the semantic value of YYS. + * If result != yyok, the chain of semantic options in YYS has been + * cleared instead or it has been left unmodified except that + * redundant options may have been removed. Regardless of whether + * result = yyok, YYS has been left with consistent data so that + * yydestroyGLRState can be invoked if necessary. */ +static YYRESULTTAG +yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + yySemanticOption* yyoptionList = yys->yysemantics.yyfirstVal; + yySemanticOption* yybest = yyoptionList; + yySemanticOption** yypp; + yybool yymerge = yyfalse; + YYSTYPE yysval; + YYRESULTTAG yyflag; + + for (yypp = &yyoptionList->yynext; *yypp != YY_NULLPTR; ) + { + yySemanticOption* yyp = *yypp; + + if (yyidenticalOptions (yybest, yyp)) + { + yymergeOptionSets (yybest, yyp); + *yypp = yyp->yynext; + } + else + { + switch (yypreference (yybest, yyp)) + { + case 0: + return yyreportAmbiguity (yybest, yyp, P, tokens, index); + break; + case 1: + yymerge = yytrue; + break; + case 2: + break; + case 3: + yybest = yyp; + yymerge = yyfalse; + break; + default: + /* This cannot happen so it is not worth a YYASSERT (yyfalse), + but some compilers complain if the default case is + omitted. */ + break; + } + yypp = &yyp->yynext; + } + } + + if (yymerge) + { + yySemanticOption* yyp; + int yyprec = yydprec[yybest->yyrule]; + yyflag = yyresolveAction (yybest, yystackp, &yysval, P, tokens, index); + if (yyflag == yyok) + for (yyp = yybest->yynext; yyp != YY_NULLPTR; yyp = yyp->yynext) + { + if (yyprec == yydprec[yyp->yyrule]) + { + YYSTYPE yysval_other; + yyflag = yyresolveAction (yyp, yystackp, &yysval_other, P, tokens, index); + if (yyflag != yyok) + { + yydestruct ("Cleanup: discarding incompletely merged value for", + yystos[yys->yylrState], + &yysval, P, tokens, index); + break; + } + yyuserMerge (yymerger[yyp->yyrule], &yysval, &yysval_other); + } + } + } + else + yyflag = yyresolveAction (yybest, yystackp, &yysval, P, tokens, index); + + if (yyflag == yyok) + { + yys->yyresolved = yytrue; + yys->yysemantics.yysval = yysval; + } + else + yys->yysemantics.yyfirstVal = YY_NULLPTR; + return yyflag; +} + +static YYRESULTTAG +yyresolveStack (yyGLRStack* yystackp, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + if (yystackp->yysplitPoint != YY_NULLPTR) + { + yyGLRState* yys; + int yyn; + + for (yyn = 0, yys = yystackp->yytops.yystates[0]; + yys != yystackp->yysplitPoint; + yys = yys->yypred, yyn += 1) + continue; + YYCHK (yyresolveStates (yystackp->yytops.yystates[0], yyn, yystackp + , P, tokens, index)); + } + return yyok; +} + +static void +yycompressStack (yyGLRStack* yystackp) +{ + yyGLRState* yyp, *yyq, *yyr; + + if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULLPTR) + return; + + for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULLPTR; + yyp != yystackp->yysplitPoint; + yyr = yyp, yyp = yyq, yyq = yyp->yypred) + yyp->yypred = yyr; + + yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems; + yystackp->yynextFree = ((yyGLRStackItem*) yystackp->yysplitPoint) + 1; + yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems; + yystackp->yysplitPoint = YY_NULLPTR; + yystackp->yylastDeleted = YY_NULLPTR; + + while (yyr != YY_NULLPTR) + { + yystackp->yynextFree->yystate = *yyr; + yyr = yyr->yypred; + yystackp->yynextFree->yystate.yypred = &yystackp->yynextFree[-1].yystate; + yystackp->yytops.yystates[0] = &yystackp->yynextFree->yystate; + yystackp->yynextFree += 1; + yystackp->yyspaceLeft -= 1; + } +} + +static YYRESULTTAG +yyprocessOneStack (yyGLRStack* yystackp, size_t yyk, + size_t yyposn, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + while (yystackp->yytops.yystates[yyk] != YY_NULLPTR) + { + yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState; + YYDPRINTF ((stderr, "Stack %lu Entering state %d\n", + (unsigned long int) yyk, yystate)); + + YYASSERT (yystate != YYFINAL); + + if (yyisDefaultedState (yystate)) + { + YYRESULTTAG yyflag; + yyRuleNum yyrule = yydefaultAction (yystate); + if (yyrule == 0) + { + YYDPRINTF ((stderr, "Stack %lu dies.\n", + (unsigned long int) yyk)); + yymarkStackDeleted (yystackp, yyk); + return yyok; + } + yyflag = yyglrReduce (yystackp, yyk, yyrule, yyimmediate[yyrule], P, tokens, index); + if (yyflag == yyerr) + { + YYDPRINTF ((stderr, + "Stack %lu dies " + "(predicate failure or explicit user error).\n", + (unsigned long int) yyk)); + yymarkStackDeleted (yystackp, yyk); + return yyok; + } + if (yyflag != yyok) + return yyflag; + } + else + { + yySymbol yytoken; + int yyaction; + const short int* yyconflicts; + + yystackp->yytops.yylookaheadNeeds[yyk] = yytrue; + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (&yylval, P, tokens, index); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts); + + while (*yyconflicts != 0) + { + YYRESULTTAG yyflag; + size_t yynewStack = yysplitStack (yystackp, yyk); + YYDPRINTF ((stderr, "Splitting off stack %lu from %lu.\n", + (unsigned long int) yynewStack, + (unsigned long int) yyk)); + yyflag = yyglrReduce (yystackp, yynewStack, + *yyconflicts, + yyimmediate[*yyconflicts], P, tokens, index); + if (yyflag == yyok) + YYCHK (yyprocessOneStack (yystackp, yynewStack, + yyposn, P, tokens, index)); + else if (yyflag == yyerr) + { + YYDPRINTF ((stderr, "Stack %lu dies.\n", + (unsigned long int) yynewStack)); + yymarkStackDeleted (yystackp, yynewStack); + } + else + return yyflag; + yyconflicts += 1; + } + + if (yyisShiftAction (yyaction)) + break; + else if (yyisErrorAction (yyaction)) + { + YYDPRINTF ((stderr, "Stack %lu dies.\n", + (unsigned long int) yyk)); + yymarkStackDeleted (yystackp, yyk); + break; + } + else + { + YYRESULTTAG yyflag = yyglrReduce (yystackp, yyk, -yyaction, + yyimmediate[-yyaction], P, tokens, index); + if (yyflag == yyerr) + { + YYDPRINTF ((stderr, + "Stack %lu dies " + "(predicate failure or explicit user error).\n", + (unsigned long int) yyk)); + yymarkStackDeleted (yystackp, yyk); + break; + } + else if (yyflag != yyok) + return yyflag; + } + } + } + return yyok; +} + +static void +yyreportSyntaxError (yyGLRStack* yystackp, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + if (yystackp->yyerrState != 0) + return; +#if ! YYERROR_VERBOSE + yyerror (P, tokens, index, YY_("syntax error")); +#else + { + yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + size_t yysize0 = yytnamerr (YY_NULLPTR, yytokenName (yytoken)); + size_t yysize = yysize0; + yybool yysize_overflow = yyfalse; + char* yymsg = YY_NULLPTR; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[yystackp->yytops.yystates[0]->yylrState]; + yyarg[yycount++] = yytokenName (yytoken); + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for this + state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytokenName (yyx); + { + size_t yysz = yysize + yytnamerr (YY_NULLPTR, yytokenName (yyx)); + yysize_overflow |= yysz < yysize; + yysize = yysz; + } + } + } + } + + switch (yycount) + { +#define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +#undef YYCASE_ + } + + { + size_t yysz = yysize + strlen (yyformat); + yysize_overflow |= yysz < yysize; + yysize = yysz; } -#endif - do{ - yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); - if( yyact <= YY_MAX_SHIFTREDUCE ){ - yy_shift(yypParser,yyact,yymajor,yyminor); -#ifndef YYNOERRORRECOVERY - yypParser->yyerrcnt--; -#endif - yymajor = YYNOCODE; - }else if( yyact <= YY_MAX_REDUCE ){ - yy_reduce(yypParser,yyact-YY_MIN_REDUCE); - }else{ - assert( yyact == YY_ERROR_ACTION ); - yyminorunion.yy0 = yyminor; -#ifdef YYERRORSYMBOL - int yymx; -#endif -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminor); + if (!yysize_overflow) + yymsg = (char *) YYMALLOC (yysize); + + if (yymsg) + { + char *yyp = yymsg; + int yyi = 0; + while ((*yyp = *yyformat)) + { + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + yyerror (P, tokens, index, yymsg); + YYFREE (yymsg); + } + else + { + yyerror (P, tokens, index, YY_("syntax error")); + yyMemoryExhausted (yystackp); + } + } +#endif /* YYERROR_VERBOSE */ + yynerrs += 1; +} + +/* Recover from a syntax error on *YYSTACKP, assuming that *YYSTACKP->YYTOKENP, + yylval, and yylloc are the syntactic category, semantic value, and location + of the lookahead. */ +static void +yyrecoverSyntaxError (yyGLRStack* yystackp, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + size_t yyk; + int yyj; + + if (yystackp->yyerrState == 3) + /* We just shifted the error token and (perhaps) took some + reductions. Skip tokens until we can proceed. */ + while (yytrue) + { + yySymbol yytoken; + if (yychar == YYEOF) + yyFail (yystackp, P, tokens, index, YY_NULLPTR); + if (yychar != YYEMPTY) + { + yytoken = YYTRANSLATE (yychar); + yydestruct ("Error: discarding", + yytoken, &yylval, P, tokens, index); + } + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (&yylval, P, tokens, index); + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + yyj = yypact[yystackp->yytops.yystates[0]->yylrState]; + if (yypact_value_is_default (yyj)) + return; + yyj += yytoken; + if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken) + { + if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0) + return; + } + else if (! yytable_value_is_error (yytable[yyj])) + return; } - yymx = yypParser->yytos->major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); + + /* Reduce to one stack. */ + for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1) + if (yystackp->yytops.yystates[yyk] != YY_NULLPTR) + break; + if (yyk >= yystackp->yytops.yysize) + yyFail (yystackp, P, tokens, index, YY_NULLPTR); + for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1) + yymarkStackDeleted (yystackp, yyk); + yyremoveDeletes (yystackp); + yycompressStack (yystackp); + + /* Now pop stack until we find a state that shifts the error token. */ + yystackp->yyerrState = 3; + while (yystackp->yytops.yystates[0] != YY_NULLPTR) + { + yyGLRState *yys = yystackp->yytops.yystates[0]; + yyj = yypact[yys->yylrState]; + if (! yypact_value_is_default (yyj)) + { + yyj += YYTERROR; + if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR + && yyisShiftAction (yytable[yyj])) + { + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yytable[yyj]], + &yylval, &yyerrloc); + yyglrShift (yystackp, 0, yytable[yyj], + yys->yyposn, &yylval); + yys = yystackp->yytops.yystates[0]; + break; + } } -#endif - yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); - yymajor = YYNOCODE; - }else{ - while( yypParser->yytos >= yypParser->yystack - && yymx != YYERRORSYMBOL - && (yyact = yy_find_reduce_action( - yypParser->yytos->stateno, - YYERRORSYMBOL)) >= YY_MIN_REDUCE - ){ - yy_pop_parser_stack(yypParser); + if (yys->yypred != YY_NULLPTR) + yydestroyGLRState ("Error: popping", yys, P, tokens, index); + yystackp->yytops.yystates[0] = yys->yypred; + yystackp->yynextFree -= 1; + yystackp->yyspaceLeft += 1; + } + if (yystackp->yytops.yystates[0] == YY_NULLPTR) + yyFail (yystackp, P, tokens, index, YY_NULLPTR); +} + +#define YYCHK1(YYE) \ + do { \ + switch (YYE) { \ + case yyok: \ + break; \ + case yyabort: \ + goto yyabortlab; \ + case yyaccept: \ + goto yyacceptlab; \ + case yyerr: \ + goto yyuser_error; \ + default: \ + goto yybuglab; \ + } \ + } while (0) + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + int yyresult; + yyGLRStack yystack; + yyGLRStack* const yystackp = &yystack; + size_t yyposn; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yychar = YYEMPTY; + yylval = yyval_default; + + /* User initialization code. */ + #line 118 "src/parser_proc_grammar.y" /* glr.c:2270 */ +{ +} + +#line 5835 "src/parser_proc.c" /* glr.c:2270 */ + + if (! yyinitGLRStack (yystackp, YYINITDEPTH)) + goto yyexhaustedlab; + switch (YYSETJMP (yystack.yyexception_buffer)) + { + case 0: break; + case 1: goto yyabortlab; + case 2: goto yyexhaustedlab; + default: goto yybuglab; + } + yyglrShift (&yystack, 0, 0, 0, &yylval); + yyposn = 0; + + while (yytrue) + { + /* For efficiency, we have two loops, the first of which is + specialized to deterministic operation (single stack, no + potential ambiguity). */ + /* Standard mode */ + while (yytrue) + { + yyRuleNum yyrule; + int yyaction; + const short int* yyconflicts; + + yyStateNum yystate = yystack.yytops.yystates[0]->yylrState; + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + goto yyacceptlab; + if (yyisDefaultedState (yystate)) + { + yyrule = yydefaultAction (yystate); + if (yyrule == 0) + { + + yyreportSyntaxError (&yystack, P, tokens, index); + goto yyuser_error; + } + YYCHK1 (yyglrReduce (&yystack, 0, yyrule, yytrue, P, tokens, index)); + } + else + { + yySymbol yytoken; + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (&yylval, P, tokens, index); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts); + if (*yyconflicts != 0) + break; + if (yyisShiftAction (yyaction)) + { + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + yychar = YYEMPTY; + yyposn += 1; + yyglrShift (&yystack, 0, yyaction, yyposn, &yylval); + if (0 < yystack.yyerrState) + yystack.yyerrState -= 1; + } + else if (yyisErrorAction (yyaction)) + { + + yyreportSyntaxError (&yystack, P, tokens, index); + goto yyuser_error; + } + else + YYCHK1 (yyglrReduce (&yystack, 0, -yyaction, yytrue, P, tokens, index)); + } } - if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ - yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - yy_parse_failed(yypParser); -#ifndef YYNOERRORRECOVERY - yypParser->yyerrcnt = -1; -#endif - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor); + + while (yytrue) + { + yySymbol yytoken_to_shift; + size_t yys; + + for (yys = 0; yys < yystack.yytops.yysize; yys += 1) + yystackp->yytops.yylookaheadNeeds[yys] = yychar != YYEMPTY; + + /* yyprocessOneStack returns one of three things: + + - An error flag. If the caller is yyprocessOneStack, it + immediately returns as well. When the caller is finally + yyparse, it jumps to an error label via YYCHK1. + + - yyok, but yyprocessOneStack has invoked yymarkStackDeleted + (&yystack, yys), which sets the top state of yys to NULL. Thus, + yyparse's following invocation of yyremoveDeletes will remove + the stack. + + - yyok, when ready to shift a token. + + Except in the first case, yyparse will invoke yyremoveDeletes and + then shift the next token onto all remaining stacks. This + synchronization of the shift (that is, after all preceding + reductions on all stacks) helps prevent double destructor calls + on yylval in the event of memory exhaustion. */ + + for (yys = 0; yys < yystack.yytops.yysize; yys += 1) + YYCHK1 (yyprocessOneStack (&yystack, yys, yyposn, P, tokens, index)); + yyremoveDeletes (&yystack); + if (yystack.yytops.yysize == 0) + { + yyundeleteLastStack (&yystack); + if (yystack.yytops.yysize == 0) + yyFail (&yystack, P, tokens, index, YY_("syntax error")); + YYCHK1 (yyresolveStack (&yystack, P, tokens, index)); + YYDPRINTF ((stderr, "Returning to deterministic operation.\n")); + + yyreportSyntaxError (&yystack, P, tokens, index); + goto yyuser_error; + } + + /* If any yyglrShift call fails, it will fail after shifting. Thus, + a copy of yylval will already be on stack 0 in the event of a + failure in the following loop. Thus, yychar is set to YYEMPTY + before the loop to make sure the user destructor for yylval isn't + called twice. */ + yytoken_to_shift = YYTRANSLATE (yychar); + yychar = YYEMPTY; + yyposn += 1; + for (yys = 0; yys < yystack.yytops.yysize; yys += 1) + { + int yyaction; + const short int* yyconflicts; + yyStateNum yystate = yystack.yytops.yystates[yys]->yylrState; + yygetLRActions (yystate, yytoken_to_shift, &yyaction, + &yyconflicts); + /* Note that yyconflicts were handled by yyprocessOneStack. */ + YYDPRINTF ((stderr, "On stack %lu, ", (unsigned long int) yys)); + YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc); + yyglrShift (&yystack, yys, yyaction, yyposn, + &yylval); + YYDPRINTF ((stderr, "Stack %lu now in state #%d\n", + (unsigned long int) yys, + yystack.yytops.yystates[yys]->yylrState)); + } + + if (yystack.yytops.yysize == 1) + { + YYCHK1 (yyresolveStack (&yystack, P, tokens, index)); + YYDPRINTF ((stderr, "Returning to deterministic operation.\n")); + yycompressStack (&yystack); + break; + } } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#elif defined(YYNOERRORRECOVERY) - /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to - ** do any kind of error recovery. Instead, simply invoke the syntax - ** error routine and continue going as if nothing had happened. - ** - ** Applications can set this macro (for example inside %include) if - ** they intend to abandon the parse upon the first syntax error seen. - */ - yy_syntax_error(yypParser,yymajor, yyminor); - yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - yymajor = YYNOCODE; - -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor, yyminor); - } - yypParser->yyerrcnt = 3; - yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); -#ifndef YYNOERRORRECOVERY - yypParser->yyerrcnt = -1; -#endif - } - yymajor = YYNOCODE; -#endif + continue; + yyuser_error: + yyrecoverSyntaxError (&yystack, P, tokens, index); + yyposn = yystack.yytops.yystates[0]->yyposn; } - }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); -#ifndef NDEBUG - if( yyTraceFILE ){ - yyStackEntry *i; - char cDiv = '['; - fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt); - for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){ - fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]); - cDiv = ' '; + + yyacceptlab: + yyresult = 0; + goto yyreturn; + + yybuglab: + YYASSERT (yyfalse); + goto yyabortlab; + + yyabortlab: + yyresult = 1; + goto yyreturn; + + yyexhaustedlab: + yyerror (P, tokens, index, YY_("memory exhausted")); + yyresult = 2; + goto yyreturn; + + yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + YYTRANSLATE (yychar), &yylval, P, tokens, index); + + /* If the stack is well-formed, pop the stack until it is empty, + destroying its entries as we go. But free the stack regardless + of whether it is well-formed. */ + if (yystack.yyitems) + { + yyGLRState** yystates = yystack.yytops.yystates; + if (yystates) + { + size_t yysize = yystack.yytops.yysize; + size_t yyk; + for (yyk = 0; yyk < yysize; yyk += 1) + if (yystates[yyk]) + { + while (yystates[yyk]) + { + yyGLRState *yys = yystates[yyk]; + if (yys->yypred != YY_NULLPTR) + yydestroyGLRState ("Cleanup: popping", yys, P, tokens, index); + yystates[yyk] = yys->yypred; + yystack.yynextFree -= 1; + yystack.yyspaceLeft += 1; + } + break; + } + } + yyfreeGLRStack (&yystack); } - fprintf(yyTraceFILE,"]\n"); - } + + return yyresult; +} + +/* DEBUGGING ONLY */ +#if YYDEBUG +static void +yy_yypstack (yyGLRState* yys) +{ + if (yys->yypred) + { + yy_yypstack (yys->yypred); + YYFPRINTF (stderr, " -> "); + } + YYFPRINTF (stderr, "%d@%lu", yys->yylrState, + (unsigned long int) yys->yyposn); +} + +static void +yypstates (yyGLRState* yyst) +{ + if (yyst == YY_NULLPTR) + YYFPRINTF (stderr, ""); + else + yy_yypstack (yyst); + YYFPRINTF (stderr, "\n"); +} + +static void +yypstack (yyGLRStack* yystackp, size_t yyk) +{ + yypstates (yystackp->yytops.yystates[yyk]); +} + +#define YYINDEX(YYX) \ + ((YYX) == YY_NULLPTR ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems) + + +static void +yypdumpstack (yyGLRStack* yystackp) +{ + yyGLRStackItem* yyp; + size_t yyi; + for (yyp = yystackp->yyitems; yyp < yystackp->yynextFree; yyp += 1) + { + YYFPRINTF (stderr, "%3lu. ", + (unsigned long int) (yyp - yystackp->yyitems)); + if (*(yybool *) yyp) + { + YYASSERT (yyp->yystate.yyisState); + YYASSERT (yyp->yyoption.yyisState); + YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld", + yyp->yystate.yyresolved, yyp->yystate.yylrState, + (unsigned long int) yyp->yystate.yyposn, + (long int) YYINDEX (yyp->yystate.yypred)); + if (! yyp->yystate.yyresolved) + YYFPRINTF (stderr, ", firstVal: %ld", + (long int) YYINDEX (yyp->yystate + .yysemantics.yyfirstVal)); + } + else + { + YYASSERT (!yyp->yystate.yyisState); + YYASSERT (!yyp->yyoption.yyisState); + YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld", + yyp->yyoption.yyrule - 1, + (long int) YYINDEX (yyp->yyoption.yystate), + (long int) YYINDEX (yyp->yyoption.yynext)); + } + YYFPRINTF (stderr, "\n"); + } + YYFPRINTF (stderr, "Tops:"); + for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) + YYFPRINTF (stderr, "%lu: %ld; ", (unsigned long int) yyi, + (long int) YYINDEX (yystackp->yytops.yystates[yyi])); + YYFPRINTF (stderr, "\n"); +} #endif - return; + +#undef yylval +#undef yychar +#undef yynerrs + +/* Substitute the variable and function names. */ +#define yyparse psi_parser_proc_parse +#define yylex psi_parser_proc_lex +#define yyerror psi_parser_proc_error +#define yylval psi_parser_proc_lval +#define yychar psi_parser_proc_char +#define yydebug psi_parser_proc_debug +#define yynerrs psi_parser_proc_nerrs + +#line 1648 "src/parser_proc_grammar.y" /* glr.c:2584 */ + + +/* epilogue */ + +static int psi_parser_proc_lex(YYSTYPE *lvalp, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + struct psi_token *token; + + if (psi_plist_get(tokens, (*index)++, &token)) { + if (P->flags & PSI_DEBUG) { + psi_token_dump(2, token); + } + + *((struct psi_token **)lvalp) = token; + return token->type; + } else { + (*index)--; + PSI_DEBUG_PRINT(P, "EOF(%d)\n", PSI_T_EOF); + } + + return PSI_T_EOF; } + +static void psi_parser_proc_error(struct psi_parser *P, struct psi_plist *tokens, size_t *index, const char *msg) +{ + struct psi_token *T = NULL; + size_t last; + + if (*index == 0) { + last = 0; + } else { + last = --(*index); + } + + psi_plist_get(tokens, last, &T); + if (T) { + P->error(PSI_DATA(P), T, PSI_WARNING, "PSI %s at col %u", msg, T->col); + } else { + P->error(PSI_DATA(P), NULL, PSI_WARNING, "PSI %s", msg); + } + P->errors++; +} + diff --git a/src/parser_proc.h b/src/parser_proc.h index 1adda48..a865d80 100644 --- a/src/parser_proc.h +++ b/src/parser_proc.h @@ -1,111 +1,648 @@ -#define PSI_T_BOOL 1 -#define PSI_T_INT 2 -#define PSI_T_FLOAT 3 -#define PSI_T_STRING 4 -#define PSI_T_DOUBLE 5 -#define PSI_T_INT8 6 -#define PSI_T_UINT8 7 -#define PSI_T_INT16 8 -#define PSI_T_UINT16 9 -#define PSI_T_INT32 10 -#define PSI_T_UINT32 11 -#define PSI_T_INT64 12 -#define PSI_T_UINT64 13 -#define PSI_T_NAME 14 -#define PSI_T_NULL 15 -#define PSI_T_NUMBER 16 -#define PSI_T_TRUE 17 -#define PSI_T_FALSE 18 -#define PSI_T_QUOTED_STRING 19 -#define PSI_T_NSNAME 20 -#define PSI_T_PIPE 21 -#define PSI_T_CARET 22 -#define PSI_T_AMPERSAND 23 -#define PSI_T_LSHIFT 24 -#define PSI_T_RSHIFT 25 -#define PSI_T_PLUS 26 -#define PSI_T_MINUS 27 -#define PSI_T_ASTERISK 28 -#define PSI_T_SLASH 29 -#define PSI_T_MODULO 30 -#define PSI_T_RCHEVR 31 -#define PSI_T_LCHEVR 32 -#define PSI_T_CMP_GE 33 -#define PSI_T_CMP_LE 34 -#define PSI_T_OR 35 -#define PSI_T_AND 36 -#define PSI_T_CMP_EQ 37 -#define PSI_T_CMP_NE 38 -#define PSI_T_TILDE 39 -#define PSI_T_NOT 40 -#define PSI_T_ZVAL 41 -#define PSI_T_OBJVAL 42 -#define PSI_T_ARRVAL 43 -#define PSI_T_PATHVAL 44 -#define PSI_T_STRLEN 45 -#define PSI_T_STRVAL 46 -#define PSI_T_FLOATVAL 47 -#define PSI_T_INTVAL 48 -#define PSI_T_BOOLVAL 49 -#define PSI_T_COUNT 50 -#define PSI_T_TO_OBJECT 51 -#define PSI_T_TO_ARRAY 52 -#define PSI_T_TO_STRING 53 -#define PSI_T_TO_INT 54 -#define PSI_T_TO_FLOAT 55 -#define PSI_T_TO_BOOL 56 -#define PSI_T_VOID 57 -#define PSI_T_MIXED 58 -#define PSI_T_ARRAY 59 -#define PSI_T_OBJECT 60 -#define PSI_T_CALLABLE 61 -#define PSI_T_PRE_ASSERT 62 -#define PSI_T_POST_ASSERT 63 -#define PSI_T_ERROR 64 -#define PSI_T_WARNING 65 -#define PSI_T_TEMP 66 -#define PSI_T_FREE 67 -#define PSI_T_SET 68 -#define PSI_T_LET 69 -#define PSI_T_RETURN 70 -#define PSI_T_CALLOC 71 -#define PSI_T_CALLBACK 72 -#define PSI_T_LIB 73 -#define PSI_T_ANY 74 -#define PSI_T_EOS 75 -#define PSI_T_EOL 76 -#define PSI_T_COMMENT 77 -#define PSI_T_HASH 78 -#define PSI_T_IFDEF 79 -#define PSI_T_IFNDEF 80 -#define PSI_T_ENDIF 81 -#define PSI_T_ELSE 82 -#define PSI_T_UNDEF 83 -#define PSI_T_DEFINE 84 -#define PSI_T_NO_WHITESPACE 85 -#define PSI_T_LPAREN 86 -#define PSI_T_RPAREN 87 -#define PSI_T_COMMA 88 -#define PSI_T_IF 89 -#define PSI_T_ELIF 90 -#define PSI_T_DEFINED 91 -#define PSI_T_COLON 92 -#define PSI_T_ENUM 93 -#define PSI_T_STRUCT 94 -#define PSI_T_UNION 95 -#define PSI_T_LBRACE 96 -#define PSI_T_RBRACE 97 -#define PSI_T_EQUALS 98 -#define PSI_T_CONST 99 -#define PSI_T_TYPEDEF 100 -#define PSI_T_ELLIPSIS 101 -#define PSI_T_LBRACKET 102 -#define PSI_T_RBRACKET 103 -#define PSI_T_CHAR 104 -#define PSI_T_SHORT 105 -#define PSI_T_LONG 106 -#define PSI_T_UNSIGNED 107 -#define PSI_T_SIGNED 108 -#define PSI_T_STATIC 109 -#define PSI_T_FUNCTION 110 -#define PSI_T_DOLLAR_NAME 111 +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Skeleton interface for Bison GLR parsers in C + + Copyright (C) 2002-2015 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 . */ + +/* 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. */ + +#ifndef YY_PSI_PARSER_PROC_SRC_PARSER_PROC_H_INCLUDED +# define YY_PSI_PARSER_PROC_SRC_PARSER_PROC_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif +#if YYDEBUG +extern int psi_parser_proc_debug; +#endif +/* "%code requires" blocks. */ +#line 94 "src/parser_proc_grammar.y" /* glr.c:197 */ + +#include "plist.h" +#include "types/layout.h" + +struct psi_parser; + + +#line 52 "src/parser_proc.h" /* glr.c:197 */ + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + PSI_T_EOF = 0, + PSI_T_BOOL = 258, + PSI_T_CHAR = 259, + PSI_T_SHORT = 260, + PSI_T_INT = 261, + PSI_T_SIGNED = 262, + PSI_T_UNSIGNED = 263, + PSI_T_LONG = 264, + PSI_T_FLOAT = 265, + PSI_T_DOUBLE = 266, + PSI_T_STRING = 267, + PSI_T_MIXED = 268, + PSI_T_ARRAY = 269, + PSI_T_OBJECT = 270, + PSI_T_CALLABLE = 271, + PSI_T_VOID = 272, + PSI_T_ZVAL = 273, + PSI_T_INT8 = 274, + PSI_T_UINT8 = 275, + PSI_T_INT16 = 276, + PSI_T_UINT16 = 277, + PSI_T_INT32 = 278, + PSI_T_UINT32 = 279, + PSI_T_INT64 = 280, + PSI_T_UINT64 = 281, + PSI_T_NULL = 282, + PSI_T_TRUE = 283, + PSI_T_FALSE = 284, + PSI_T_NAME = 285, + PSI_T_NSNAME = 286, + PSI_T_DOLLAR_NAME = 287, + PSI_T_NUMBER = 288, + PSI_T_QUOTED_STRING = 289, + PSI_T_QUOTED_CHAR = 290, + PSI_T_EOL = 291, + PSI_T_EOS = 292, + PSI_T_LPAREN = 293, + PSI_T_RPAREN = 294, + PSI_T_COMMA = 295, + PSI_T_COLON = 296, + PSI_T_LBRACE = 297, + PSI_T_RBRACE = 298, + PSI_T_LBRACKET = 299, + PSI_T_RBRACKET = 300, + PSI_T_EQUALS = 301, + PSI_T_HASH = 302, + PSI_T_PIPE = 303, + PSI_T_CARET = 304, + PSI_T_AMPERSAND = 305, + PSI_T_LSHIFT = 306, + PSI_T_RSHIFT = 307, + PSI_T_PLUS = 308, + PSI_T_MINUS = 309, + PSI_T_ASTERISK = 310, + PSI_T_SLASH = 311, + PSI_T_MODULO = 312, + PSI_T_LCHEVR = 313, + PSI_T_RCHEVR = 314, + PSI_T_CMP_GE = 315, + PSI_T_CMP_LE = 316, + PSI_T_OR = 317, + PSI_T_AND = 318, + PSI_T_CMP_EQ = 319, + PSI_T_CMP_NE = 320, + PSI_T_TILDE = 321, + PSI_T_NOT = 322, + PSI_T_PERIOD = 323, + PSI_T_BACKSLASH = 324, + PSI_T_ELLIPSIS = 325, + PSI_T_ERROR = 326, + PSI_T_WARNING = 327, + PSI_T_IF = 328, + PSI_T_IFDEF = 329, + PSI_T_IFNDEF = 330, + PSI_T_ELSE = 331, + PSI_T_ELIF = 332, + PSI_T_ENDIF = 333, + PSI_T_DEFINE = 334, + PSI_T_DEFINED = 335, + PSI_T_UNDEF = 336, + PSI_T_IMPORT = 337, + PSI_T_INCLUDE = 338, + PSI_T_INCLUDE_NEXT = 339, + PSI_T_TYPEDEF = 340, + PSI_T_STRUCT = 341, + PSI_T_UNION = 342, + PSI_T_ENUM = 343, + PSI_T_CONST = 344, + PSI_T_LIB = 345, + PSI_T_STATIC = 346, + PSI_T_CALLBACK = 347, + PSI_T_FUNCTION = 348, + PSI_T_LET = 349, + PSI_T_SET = 350, + PSI_T_TEMP = 351, + PSI_T_FREE = 352, + PSI_T_RETURN = 353, + PSI_T_PRE_ASSERT = 354, + PSI_T_POST_ASSERT = 355, + PSI_T_BOOLVAL = 356, + PSI_T_INTVAL = 357, + PSI_T_STRVAL = 358, + PSI_T_PATHVAL = 359, + PSI_T_STRLEN = 360, + PSI_T_FLOATVAL = 361, + PSI_T_ARRVAL = 362, + PSI_T_OBJVAL = 363, + PSI_T_COUNT = 364, + PSI_T_CALLOC = 365, + PSI_T_TO_BOOL = 366, + PSI_T_TO_INT = 367, + PSI_T_TO_STRING = 368, + PSI_T_TO_FLOAT = 369, + PSI_T_TO_ARRAY = 370, + PSI_T_TO_OBJECT = 371, + PSI_T_COMMENT = 372, + PSI_T_WHITESPACE = 373, + PSI_T_NO_WHITESPACE = 374, + PSI_T_CPP_HEADER = 375, + PSI_T_BINARY = 376, + PSI_T_UNARY = 377 + }; +#endif + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + +union YYSTYPE +{ + + /* reference */ + bool PSI_T_reference; + /* array_size */ + size_t PSI_T_array_size; + /* indirection */ + size_t PSI_T_indirection; + /* pointers */ + size_t PSI_T_pointers; + /* assert_stmt */ + struct psi_assert_stmt * PSI_T_assert_stmt; + /* constant */ + struct psi_const * PSI_T_constant; + /* constant_type */ + struct psi_const_type * PSI_T_constant_type; + /* cpp */ + struct psi_cpp_exp * PSI_T_cpp; + /* cpp_exp */ + struct psi_cpp_exp * PSI_T_cpp_exp; + /* cpp_macro_decl */ + struct psi_cpp_macro_decl * PSI_T_cpp_macro_decl; + /* decl_stmt */ + struct psi_decl * PSI_T_decl_stmt; + /* decl */ + struct psi_decl * PSI_T_decl; + /* decl_typedef */ + struct psi_decl_arg * PSI_T_decl_typedef; + /* typedef */ + struct psi_decl_arg * PSI_T_typedef; + /* decl_fn */ + struct psi_decl_arg * PSI_T_decl_fn; + /* decl_functor */ + struct psi_decl_arg * PSI_T_decl_functor; + /* decl_func */ + struct psi_decl_arg * PSI_T_decl_func; + /* decl_arg */ + struct psi_decl_arg * PSI_T_decl_arg; + /* struct_arg */ + struct psi_decl_arg * PSI_T_struct_arg; + /* decl_enum */ + struct psi_decl_enum * PSI_T_decl_enum; + /* decl_enum_item */ + struct psi_decl_enum_item * PSI_T_decl_enum_item; + /* decl_struct */ + struct psi_decl_struct * PSI_T_decl_struct; + /* const_decl_type */ + struct psi_decl_type * PSI_T_const_decl_type; + /* decl_type */ + struct psi_decl_type * PSI_T_decl_type; + /* decl_type_complex */ + struct psi_decl_type * PSI_T_decl_type_complex; + /* decl_union */ + struct psi_decl_union * PSI_T_decl_union; + /* decl_var */ + struct psi_decl_var * PSI_T_decl_var; + /* free_exp */ + struct psi_free_exp * PSI_T_free_exp; + /* free_stmt */ + struct psi_free_stmt * PSI_T_free_stmt; + /* impl */ + struct psi_impl * PSI_T_impl; + /* impl_arg */ + struct psi_impl_arg * PSI_T_impl_arg; + /* impl_def_val */ + struct psi_impl_def_val * PSI_T_impl_def_val; + /* impl_func */ + struct psi_impl_func * PSI_T_impl_func; + /* impl_type */ + struct psi_impl_type * PSI_T_impl_type; + /* impl_var */ + struct psi_impl_var * PSI_T_impl_var; + /* align_and_size */ + struct psi_layout PSI_T_align_and_size; + /* decl_layout */ + struct psi_layout * PSI_T_decl_layout; + /* let_callback */ + struct psi_let_callback * PSI_T_let_callback; + /* let_calloc */ + struct psi_let_calloc * PSI_T_let_calloc; + /* let_exp */ + struct psi_let_exp * PSI_T_let_exp; + /* let_exp_byref */ + struct psi_let_exp * PSI_T_let_exp_byref; + /* let_exp_assign */ + struct psi_let_exp * PSI_T_let_exp_assign; + /* let_func */ + struct psi_let_func * PSI_T_let_func; + /* let_stmt */ + struct psi_let_stmt * PSI_T_let_stmt; + /* cpp_macro_exp */ + struct psi_num_exp * PSI_T_cpp_macro_exp; + /* num_exp */ + struct psi_num_exp * PSI_T_num_exp; + /* number */ + struct psi_number * PSI_T_number; + /* cpp_macro_sig */ + struct psi_plist * PSI_T_cpp_macro_sig; + /* cpp_macro_sig_args */ + struct psi_plist * PSI_T_cpp_macro_sig_args; + /* cpp_macro_decl_tokens */ + struct psi_plist * PSI_T_cpp_macro_decl_tokens; + /* cpp_macro_decl_token_list */ + struct psi_plist * PSI_T_cpp_macro_decl_token_list; + /* cpp_macro_call_args */ + struct psi_plist * PSI_T_cpp_macro_call_args; + /* cpp_macro_call_arg_list */ + struct psi_plist * PSI_T_cpp_macro_call_arg_list; + /* decl_args */ + struct psi_plist * PSI_T_decl_args; + /* decl_struct_args */ + struct psi_plist * PSI_T_decl_struct_args; + /* struct_args_block */ + struct psi_plist * PSI_T_struct_args_block; + /* struct_args */ + struct psi_plist * PSI_T_struct_args; + /* decl_enum_items */ + struct psi_plist * PSI_T_decl_enum_items; + /* impl_args */ + struct psi_plist * PSI_T_impl_args; + /* impl_stmts */ + struct psi_plist * PSI_T_impl_stmts; + /* let_func_exps */ + struct psi_plist * PSI_T_let_func_exps; + /* let_exps */ + struct psi_plist * PSI_T_let_exps; + /* callback_arg_list */ + struct psi_plist * PSI_T_callback_arg_list; + /* callback_args */ + struct psi_plist * PSI_T_callback_args; + /* set_func_exps */ + struct psi_plist * PSI_T_set_func_exps; + /* set_exps */ + struct psi_plist * PSI_T_set_exps; + /* free_exps */ + struct psi_plist * PSI_T_free_exps; + /* decl_vars */ + struct psi_plist * PSI_T_decl_vars; + /* return_stmt */ + struct psi_return_stmt * PSI_T_return_stmt; + /* set_exp */ + struct psi_set_exp * PSI_T_set_exp; + /* set_func */ + struct psi_set_func * PSI_T_set_func; + /* set_stmt */ + struct psi_set_stmt * PSI_T_set_stmt; + /* "end of file" */ + struct psi_token * PSI_T_EOF; + /* BOOL */ + struct psi_token * PSI_T_BOOL; + /* CHAR */ + struct psi_token * PSI_T_CHAR; + /* SHORT */ + struct psi_token * PSI_T_SHORT; + /* INT */ + struct psi_token * PSI_T_INT; + /* SIGNED */ + struct psi_token * PSI_T_SIGNED; + /* UNSIGNED */ + struct psi_token * PSI_T_UNSIGNED; + /* LONG */ + struct psi_token * PSI_T_LONG; + /* FLOAT */ + struct psi_token * PSI_T_FLOAT; + /* DOUBLE */ + struct psi_token * PSI_T_DOUBLE; + /* STRING */ + struct psi_token * PSI_T_STRING; + /* MIXED */ + struct psi_token * PSI_T_MIXED; + /* ARRAY */ + struct psi_token * PSI_T_ARRAY; + /* OBJECT */ + struct psi_token * PSI_T_OBJECT; + /* CALLABLE */ + struct psi_token * PSI_T_CALLABLE; + /* VOID */ + struct psi_token * PSI_T_VOID; + /* ZVAL */ + struct psi_token * PSI_T_ZVAL; + /* INT8 */ + struct psi_token * PSI_T_INT8; + /* UINT8 */ + struct psi_token * PSI_T_UINT8; + /* INT16 */ + struct psi_token * PSI_T_INT16; + /* UINT16 */ + struct psi_token * PSI_T_UINT16; + /* INT32 */ + struct psi_token * PSI_T_INT32; + /* UINT32 */ + struct psi_token * PSI_T_UINT32; + /* INT64 */ + struct psi_token * PSI_T_INT64; + /* UINT64 */ + struct psi_token * PSI_T_UINT64; + /* NULL */ + struct psi_token * PSI_T_NULL; + /* TRUE */ + struct psi_token * PSI_T_TRUE; + /* FALSE */ + struct psi_token * PSI_T_FALSE; + /* NAME */ + struct psi_token * PSI_T_NAME; + /* NSNAME */ + struct psi_token * PSI_T_NSNAME; + /* DOLLAR_NAME */ + struct psi_token * PSI_T_DOLLAR_NAME; + /* NUMBER */ + struct psi_token * PSI_T_NUMBER; + /* QUOTED_STRING */ + struct psi_token * PSI_T_QUOTED_STRING; + /* QUOTED_CHAR */ + struct psi_token * PSI_T_QUOTED_CHAR; + /* "end of line" */ + struct psi_token * PSI_T_EOL; + /* ";" */ + struct psi_token * PSI_T_EOS; + /* "(" */ + struct psi_token * PSI_T_LPAREN; + /* ")" */ + struct psi_token * PSI_T_RPAREN; + /* "," */ + struct psi_token * PSI_T_COMMA; + /* ":" */ + struct psi_token * PSI_T_COLON; + /* "{" */ + struct psi_token * PSI_T_LBRACE; + /* "}" */ + struct psi_token * PSI_T_RBRACE; + /* "[" */ + struct psi_token * PSI_T_LBRACKET; + /* "]" */ + struct psi_token * PSI_T_RBRACKET; + /* "=" */ + struct psi_token * PSI_T_EQUALS; + /* "#" */ + struct psi_token * PSI_T_HASH; + /* "|" */ + struct psi_token * PSI_T_PIPE; + /* "^" */ + struct psi_token * PSI_T_CARET; + /* "&" */ + struct psi_token * PSI_T_AMPERSAND; + /* "<<" */ + struct psi_token * PSI_T_LSHIFT; + /* ">>" */ + struct psi_token * PSI_T_RSHIFT; + /* "+" */ + struct psi_token * PSI_T_PLUS; + /* "-" */ + struct psi_token * PSI_T_MINUS; + /* "*" */ + struct psi_token * PSI_T_ASTERISK; + /* "/" */ + struct psi_token * PSI_T_SLASH; + /* "%" */ + struct psi_token * PSI_T_MODULO; + /* "<" */ + struct psi_token * PSI_T_LCHEVR; + /* ">" */ + struct psi_token * PSI_T_RCHEVR; + /* ">=" */ + struct psi_token * PSI_T_CMP_GE; + /* "<=" */ + struct psi_token * PSI_T_CMP_LE; + /* "||" */ + struct psi_token * PSI_T_OR; + /* "&&" */ + struct psi_token * PSI_T_AND; + /* "==" */ + struct psi_token * PSI_T_CMP_EQ; + /* "!=" */ + struct psi_token * PSI_T_CMP_NE; + /* "~" */ + struct psi_token * PSI_T_TILDE; + /* "!" */ + struct psi_token * PSI_T_NOT; + /* "." */ + struct psi_token * PSI_T_PERIOD; + /* "\\" */ + struct psi_token * PSI_T_BACKSLASH; + /* "..." */ + struct psi_token * PSI_T_ELLIPSIS; + /* ERROR */ + struct psi_token * PSI_T_ERROR; + /* WARNING */ + struct psi_token * PSI_T_WARNING; + /* IF */ + struct psi_token * PSI_T_IF; + /* IFDEF */ + struct psi_token * PSI_T_IFDEF; + /* IFNDEF */ + struct psi_token * PSI_T_IFNDEF; + /* ELSE */ + struct psi_token * PSI_T_ELSE; + /* ELIF */ + struct psi_token * PSI_T_ELIF; + /* ENDIF */ + struct psi_token * PSI_T_ENDIF; + /* DEFINE */ + struct psi_token * PSI_T_DEFINE; + /* DEFINED */ + struct psi_token * PSI_T_DEFINED; + /* UNDEF */ + struct psi_token * PSI_T_UNDEF; + /* IMPORT */ + struct psi_token * PSI_T_IMPORT; + /* INCLUDE */ + struct psi_token * PSI_T_INCLUDE; + /* INCLUDE_NEXT */ + struct psi_token * PSI_T_INCLUDE_NEXT; + /* TYPEDEF */ + struct psi_token * PSI_T_TYPEDEF; + /* STRUCT */ + struct psi_token * PSI_T_STRUCT; + /* UNION */ + struct psi_token * PSI_T_UNION; + /* ENUM */ + struct psi_token * PSI_T_ENUM; + /* CONST */ + struct psi_token * PSI_T_CONST; + /* LIB */ + struct psi_token * PSI_T_LIB; + /* STATIC */ + struct psi_token * PSI_T_STATIC; + /* CALLBACK */ + struct psi_token * PSI_T_CALLBACK; + /* FUNCTION */ + struct psi_token * PSI_T_FUNCTION; + /* LET */ + struct psi_token * PSI_T_LET; + /* SET */ + struct psi_token * PSI_T_SET; + /* TEMP */ + struct psi_token * PSI_T_TEMP; + /* FREE */ + struct psi_token * PSI_T_FREE; + /* RETURN */ + struct psi_token * PSI_T_RETURN; + /* PRE_ASSERT */ + struct psi_token * PSI_T_PRE_ASSERT; + /* POST_ASSERT */ + struct psi_token * PSI_T_POST_ASSERT; + /* BOOLVAL */ + struct psi_token * PSI_T_BOOLVAL; + /* INTVAL */ + struct psi_token * PSI_T_INTVAL; + /* STRVAL */ + struct psi_token * PSI_T_STRVAL; + /* PATHVAL */ + struct psi_token * PSI_T_PATHVAL; + /* STRLEN */ + struct psi_token * PSI_T_STRLEN; + /* FLOATVAL */ + struct psi_token * PSI_T_FLOATVAL; + /* ARRVAL */ + struct psi_token * PSI_T_ARRVAL; + /* OBJVAL */ + struct psi_token * PSI_T_OBJVAL; + /* COUNT */ + struct psi_token * PSI_T_COUNT; + /* CALLOC */ + struct psi_token * PSI_T_CALLOC; + /* TO_BOOL */ + struct psi_token * PSI_T_TO_BOOL; + /* TO_INT */ + struct psi_token * PSI_T_TO_INT; + /* TO_STRING */ + struct psi_token * PSI_T_TO_STRING; + /* TO_FLOAT */ + struct psi_token * PSI_T_TO_FLOAT; + /* TO_ARRAY */ + struct psi_token * PSI_T_TO_ARRAY; + /* TO_OBJECT */ + struct psi_token * PSI_T_TO_OBJECT; + /* COMMENT */ + struct psi_token * PSI_T_COMMENT; + /* WHITESPACE */ + struct psi_token * PSI_T_WHITESPACE; + /* NO_WHITESPACE */ + struct psi_token * PSI_T_NO_WHITESPACE; + /* CPP_HEADER */ + struct psi_token * PSI_T_CPP_HEADER; + /* binary_op_token */ + struct psi_token * PSI_T_binary_op_token; + /* unary_op_token */ + struct psi_token * PSI_T_unary_op_token; + /* name_token */ + struct psi_token * PSI_T_name_token; + /* any_noeol_token */ + struct psi_token * PSI_T_any_noeol_token; + /* lib */ + struct psi_token * PSI_T_lib; + /* cpp_message_token */ + struct psi_token * PSI_T_cpp_message_token; + /* cpp_include_token */ + struct psi_token * PSI_T_cpp_include_token; + /* cpp_header_token */ + struct psi_token * PSI_T_cpp_header_token; + /* cpp_no_arg_token */ + struct psi_token * PSI_T_cpp_no_arg_token; + /* cpp_name_arg_token */ + struct psi_token * PSI_T_cpp_name_arg_token; + /* cpp_exp_arg_token */ + struct psi_token * PSI_T_cpp_exp_arg_token; + /* constant_type_token */ + struct psi_token * PSI_T_constant_type_token; + /* impl_def_val_token */ + struct psi_token * PSI_T_impl_def_val_token; + /* decl_type_simple */ + struct psi_token * PSI_T_decl_type_simple; + /* decl_real_type */ + struct psi_token * PSI_T_decl_real_type; + /* decl_stdint_type */ + struct psi_token * PSI_T_decl_stdint_type; + /* int_signed */ + struct psi_token * PSI_T_int_signed; + /* int_width */ + struct psi_token * PSI_T_int_width; + /* decl_int_type */ + struct psi_token * PSI_T_decl_int_type; + /* int_signed_types */ + struct psi_token * PSI_T_int_signed_types; + /* signed_short_types */ + struct psi_token * PSI_T_signed_short_types; + /* signed_long_types */ + struct psi_token * PSI_T_signed_long_types; + /* int_width_types */ + struct psi_token * PSI_T_int_width_types; + /* enum_name */ + struct psi_token * PSI_T_enum_name; + /* union_name */ + struct psi_token * PSI_T_union_name; + /* struct_name */ + struct psi_token * PSI_T_struct_name; + /* optional_name */ + struct psi_token * PSI_T_optional_name; + /* impl_type_token */ + struct psi_token * PSI_T_impl_type_token; + /* let_func_token */ + struct psi_token * PSI_T_let_func_token; + /* callback_rval */ + struct psi_token * PSI_T_callback_rval; + /* set_func_token */ + struct psi_token * PSI_T_set_func_token; + /* assert_stmt_token */ + struct psi_token * PSI_T_assert_stmt_token; + /* impl_stmt */ + struct psi_token ** PSI_T_impl_stmt; +#line 637 "src/parser_proc.h" /* glr.c:197 */ +}; + +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + + +int psi_parser_proc_parse (struct psi_parser *P, struct psi_plist *tokens, size_t *index); + +#endif /* !YY_PSI_PARSER_PROC_SRC_PARSER_PROC_H_INCLUDED */ diff --git a/src/parser_proc.inc b/src/parser_proc.inc deleted file mode 100644 index 5e2128c..0000000 --- a/src/parser_proc.inc +++ /dev/null @@ -1,34 +0,0 @@ -%include { -#include "php_psi_stdinc.h" - -#include -#include - -#include "plist.h" -#include "parser.h" - -/* rename lemon symbols, works better than DEF(%name) */ -#define ParseAlloc psi_parser_proc_init_ex -#define Parse psi_parser_proc_parse -#define ParseTrace psi_parser_proc_trace -#define ParseFree psi_parser_proc_free_ex - -/* fwd decls */ -void *ParseAlloc(void *(*mallocProc)(size_t)); -void ParseFree(void *p, void (*freeProc)(void*)); - -/* wrappers */ -void *psi_parser_proc_init(void) -{ - return ParseAlloc(malloc); -} - -void psi_parser_proc_free(void **parser_proc) -{ - if (*parser_proc) { - ParseFree(*parser_proc, free); - *parser_proc = NULL; - } -} - -} diff --git a/src/parser_proc.y b/src/parser_proc.y deleted file mode 100644 index 29d354b..0000000 --- a/src/parser_proc.y +++ /dev/null @@ -1,1069 +0,0 @@ -%include { -#include "php_psi_stdinc.h" - -#include -#include - -#include "plist.h" -#include "parser.h" - -/* rename lemon symbols, works better than DEF(%name) */ -#define ParseAlloc psi_parser_proc_init_ex -#define Parse psi_parser_proc_parse -#define ParseTrace psi_parser_proc_trace -#define ParseFree psi_parser_proc_free_ex - -/* fwd decls */ -void *ParseAlloc(void *(*mallocProc)(size_t)); -void ParseFree(void *p, void (*freeProc)(void*)); - -/* wrappers */ -void *psi_parser_proc_init(void) -{ - return ParseAlloc(malloc); -} - -void psi_parser_proc_free(void **parser_proc) -{ - if (*parser_proc) { - ParseFree(*parser_proc, free); - *parser_proc = NULL; - } -} - -} -%token_prefix PSI_T_ -%token_type {struct psi_token *} -%token_destructor {free($$);} -%default_destructor {(void)P;} -%extra_argument {struct psi_parser *P} -%syntax_error { ++P->errors; if (TOKEN) { psi_error(PSI_WARNING, TOKEN->file, TOKEN->line, "PSI syntax error: Unexpected token '%s' at pos %u", TOKEN->text, TOKEN->col); } else { psi_error(PSI_WARNING, P->file.fn, P->line, "PSI syntax error: Unexpected end of input"); } } -%token_class const_type_token BOOL INT FLOAT STRING . -%token_class decl_type_token FLOAT DOUBLE INT8 UINT8 INT16 UINT16 INT32 UINT32 INT64 UINT64 NAME . -%token_class impl_def_val_token NULL NUMBER TRUE FALSE QUOTED_STRING . -%token_class number_token NUMBER NSNAME . -%token_class binary_op_token PIPE CARET AMPERSAND LSHIFT RSHIFT PLUS MINUS ASTERISK SLASH MODULO RCHEVR LCHEVR CMP_GE CMP_LE OR AND CMP_EQ CMP_NE . -%token_class unary_op_token TILDE NOT PLUS MINUS . -%token_class let_func_token ZVAL OBJVAL ARRVAL PATHVAL STRLEN STRVAL FLOATVAL INTVAL BOOLVAL COUNT . -%token_class set_func_token TO_OBJECT TO_ARRAY TO_STRING TO_INT TO_FLOAT TO_BOOL ZVAL VOID . -%token_class impl_type_token VOID MIXED BOOL INT FLOAT STRING ARRAY OBJECT CALLABLE . -%token_class assert_stmt_token PRE_ASSERT POST_ASSERT . -%token_class cpp_message_token ERROR WARNING . -%nonassoc NAME. -%right NOT TILDE. -%left AND OR. -%left PIPE. -%left CARET. -%left AMPERSAND. -%left CMP_EQ CMP_NE. -%left LCHEVR CMP_LE RCHEVR CMP_GE. -%left LSHIFT RSHIFT. -%left PLUS MINUS. -%left ASTERISK SLASH MODULO. -%fallback NAME TEMP FREE SET LET RETURN CALLOC CALLBACK ZVAL LIB STRING COUNT ERROR WARNING. -%wildcard ANY. -%type decl_enum {struct psi_decl_enum *} -%destructor decl_enum {psi_decl_enum_free(&$$);} -%type decl_enum_items {struct psi_plist*} -%destructor decl_enum_items {psi_plist_free($$);} -%type decl_enum_item {struct psi_decl_enum_item*} -%destructor decl_enum_item {psi_decl_enum_item_free(&$$);} -%type decl_struct_args_block {struct psi_plist*} -%destructor decl_struct_args_block {psi_plist_free($$);} -%type decl_struct_args {struct psi_plist*} -%destructor decl_struct_args {psi_plist_free($$);} -%type decl_struct {struct psi_decl_struct*} -%destructor decl_struct {psi_decl_struct_free(&$$);} -%type align_and_size {struct psi_layout} -%type decl_union {struct psi_decl_union*} -%destructor decl_union {psi_decl_union_free(&$$);} -%type const_type {struct psi_const_type*} -%destructor const_type {psi_const_type_free(&$$);} -%type constant {struct psi_const*} -%destructor constant {psi_const_free(&$$);} -%type decl_typedef {struct psi_decl_arg*} -%destructor decl_typedef {psi_decl_arg_free(&$$);} -%type decl_typedef_body_ex {struct psi_decl_arg*} -%destructor decl_typedef_body_ex {psi_decl_arg_free(&$$);} -%type decl_typedef_body {struct psi_decl_arg*} -%destructor decl_typedef_body {psi_decl_arg_free(&$$);} -%type decl_typedef_body_fn_args {struct psi_plist*} -%destructor decl_typedef_body_fn_args {psi_plist_free($$);} -%type decl {struct psi_decl*} -%destructor decl {psi_decl_free(&$$);} -%type decl_func {struct psi_decl_arg*} -%destructor decl_func {psi_decl_arg_free(&$$);} -%type decl_abi {struct psi_decl_abi*} -%destructor decl_abi {psi_decl_abi_free(&$$);} -%type decl_var {struct psi_decl_var*} -%destructor decl_var {psi_decl_var_free(&$$);} -%type decl_vars {struct psi_plist*} -%destructor decl_vars {psi_plist_free($$);} -%type decl_arg {struct psi_decl_arg*} -%destructor decl_arg {psi_decl_arg_free(&$$);} -%type decl_args {struct psi_plist*} -%destructor decl_args {psi_plist_free($$);} -%type struct_args {struct psi_plist*} -%destructor struct_args {psi_plist_free($$);} -%type struct_arg {struct psi_decl_arg*} -%destructor struct_arg {psi_decl_arg_free(&$$);} -%type decl_layout {struct psi_layout*} -%destructor decl_layout {psi_layout_free(&$$);} -%type decl_type {struct psi_decl_type*} -%destructor decl_type {psi_decl_type_free(&$$);} -%type const_decl_type {struct psi_decl_type*} -%destructor const_decl_type {psi_decl_type_free(&$$);} -%type impl {struct psi_impl*} -%destructor impl {psi_impl_free(&$$);} -%type impl_func {struct psi_impl_func*} -%destructor impl_func {psi_impl_func_free(&$$);} -%type impl_def_val {struct psi_impl_def_val*} -%destructor impl_def_val {psi_impl_def_val_free(&$$);} -%type impl_var {struct psi_impl_var*} -%destructor impl_var {psi_impl_var_free(&$$);} -%type impl_arg {struct psi_impl_arg*} -%destructor impl_arg {psi_impl_arg_free(&$$);} -%type impl_args {struct psi_plist*} -%destructor impl_args {psi_plist_free($$);} -%type impl_vararg {struct psi_impl_arg*} -%destructor impl_vararg {psi_impl_arg_free(&$$);} -%type impl_stmts {struct psi_plist*} -%destructor impl_stmts {psi_plist_free($$);} -%type impl_stmt {struct psi_token**} -%destructor impl_stmt {psi_impl_stmt_free(&$$);} -%type number {struct psi_number*} -%destructor number {psi_number_free(&$$);} -%type num_exp {struct psi_num_exp*} -%destructor num_exp {psi_num_exp_free(&$$);} -%type let_stmt {struct psi_let_stmt*} -%destructor let_stmt {psi_let_stmt_free(&$$);} -%type let_calloc {struct psi_let_calloc*} -%destructor let_calloc {psi_let_calloc_free(&$$);} -%type let_func {struct psi_let_func*} -%destructor let_func {psi_let_func_free(&$$);} -%type callback_arg_list {struct psi_plist *} -%destructor callback_arg_list {psi_plist_free($$);} -%type callback_args {struct psi_plist *} -%destructor callback_args {psi_plist_free($$);} -%type let_callback {struct psi_let_callback*} -%destructor let_callback {psi_let_callback_free(&$$);} -%type let_exp {struct psi_let_exp*} -%destructor let_exp {psi_let_exp_free(&$$);} -%type let_exps {struct psi_plist*} -%destructor let_exps {psi_plist_free($$);} -%type assert_stmt {struct psi_assert_stmt*} -%destructor assert_stmt {psi_assert_stmt_free(&$$);} -%type set_stmt {struct psi_set_stmt*} -%destructor set_stmt {psi_set_stmt_free(&$$);} -%type set_exp {struct psi_set_exp*} -%destructor set_exp {psi_set_exp_free(&$$);} -%type set_exps {struct psi_plist*} -%destructor set_exps {psi_plist_free($$);} -%type set_func {struct psi_set_func*} -%destructor set_func {psi_set_func_free(&$$);} -%type return_stmt {struct psi_return_stmt*} -%destructor return_stmt {psi_return_stmt_free(&$$);} -%type free_stmt {struct psi_free_stmt*} -%destructor free_stmt {psi_free_stmt_free(&$$);} -%type free_exps {struct psi_plist*} -%destructor free_exps {psi_plist_free($$);} -%type free_exp {struct psi_free_exp*} -%destructor free_exp {psi_free_exp_free(&$$);} -%type impl_type {struct psi_impl_type*} -%destructor impl_type {psi_impl_type_free(&$$);} -%type cpp_exp {struct psi_cpp_exp*} -%destructor cpp_exp {psi_cpp_exp_free(&$$);} -%type cpp_macro_decl {struct psi_cpp_macro_decl*} -%destructor cpp_macro_decl {psi_cpp_macro_decl_free(&$$);} -%type cpp_macro_decl_tokens {struct psi_plist*} -%destructor cpp_macro_decl_tokens {psi_plist_free($$);} -%type cpp_macro_exp {struct psi_num_exp*} -%destructor cpp_macro_exp {psi_num_exp_free(&$$);} -%type cpp_macro_sig {struct psi_plist*} -%destructor cpp_macro_sig {psi_plist_free($$);} -%type cpp_macro_sig_args {struct psi_plist*} -%destructor cpp_macro_sig_args {psi_plist_free($$);} -%type cpp_macro_call {struct psi_plist*} -%destructor cpp_macro_call {psi_plist_free($$);} -%type cpp_macro_call_args {struct psi_plist*} -%destructor cpp_macro_call_args {psi_plist_free($$);} -%type reference {bool} -%type indirection {unsigned} -%type pointers {unsigned} -file ::= blocks. -blocks ::= block. -blocks ::= blocks block. -block ::= EOS. -block ::= EOL. -block ::= COMMENT. -block ::= HASH cpp_exp(exp_) EOL. { - P->cpp.exp = exp_; -} -cpp_exp(exp) ::= cpp_message_token(T) QUOTED_STRING(S). { - exp = psi_cpp_exp_init(T->type, S); - exp->token = T; -} -cpp_exp(exp) ::= IFDEF(T) NAME(N). { - exp = psi_cpp_exp_init(T->type, N); - exp->token = T; -} -cpp_exp(exp) ::= IFNDEF(T) NAME(N). { - exp = psi_cpp_exp_init(T->type, N); - exp->token = T; -} -cpp_exp(exp) ::= ENDIF(T). { - exp = psi_cpp_exp_init(T->type, NULL); - exp->token = T; -} -cpp_exp(exp) ::= ELSE(T). { - exp = psi_cpp_exp_init(T->type, NULL); - exp->token = T; -} -cpp_exp(exp) ::= UNDEF(T) NAME(N). { - exp = psi_cpp_exp_init(T->type, N); - exp->token = T; -} -cpp_exp(exp) ::= DEFINE(T) NAME(N) cpp_macro_decl(macro). { - exp = psi_cpp_exp_init(T->type, macro); - exp->token = T; - macro->token = N; -} -cpp_macro_decl(macro) ::= . { - macro = psi_cpp_macro_decl_init(NULL, NULL, NULL); -} -cpp_macro_decl(macro) ::= cpp_macro_sig(sig). { - macro = psi_cpp_macro_decl_init(sig, NULL, NULL); -} -cpp_macro_decl(macro) ::= cpp_macro_sig(sig) cpp_macro_decl_tokens(tokens). { - macro = psi_cpp_macro_decl_init(sig, tokens, NULL); -} -cpp_macro_sig(sig) ::= NO_WHITESPACE LPAREN cpp_macro_sig_args(args) RPAREN. { - sig = args; -} -cpp_macro_sig_args(args) ::= . { - args = NULL; -} -cpp_macro_sig_args(args) ::= NAME(arg). { - args = psi_plist_add(psi_plist_init((void (*)(void *)) psi_token_free), &arg); -} -cpp_macro_sig_args(args) ::= cpp_macro_sig_args(args_) COMMA NAME(arg). { - args = psi_plist_add(args_, &arg); -} -cpp_macro_decl(macro) ::= cpp_macro_decl_tokens(tokens). { - macro = psi_cpp_macro_decl_init(NULL, tokens, NULL); -} -cpp_macro_decl_tokens(tokens) ::= ANY(T). { - tokens = psi_plist_add(psi_plist_init((void (*)(void *)) psi_token_free), &T); -} -cpp_macro_decl_tokens(tokens) ::= cpp_macro_decl_tokens(tokens_) ANY(T). { - tokens = psi_plist_add(tokens_, &T); -} -cpp_exp(exp) ::= IF(T) cpp_macro_exp(macro). { - exp = psi_cpp_exp_init(T->type, macro); - exp->token = T; -} -cpp_exp(exp) ::= ELIF(T) cpp_macro_exp(macro). { - exp = psi_cpp_exp_init(T->type, macro); - exp->token = T; -} -cpp_macro_exp(exp) ::= LPAREN(L) cpp_macro_exp(exp_) RPAREN. { - exp = psi_num_exp_init_unary(L->type, exp_); - exp->token = L; -} -cpp_macro_exp(exp) ::= unary_op_token(OP) cpp_macro_exp(exp_). { - exp = psi_num_exp_init_unary(OP->type, exp_); - exp->token = OP; -} -cpp_macro_exp(exp) ::= cpp_macro_exp(lhs) binary_op_token(OP) cpp_macro_exp(rhs). { - exp = psi_num_exp_init_binary(OP->type, lhs, rhs); - exp->token = OP; -} -cpp_macro_exp(exp) ::= DEFINED NAME(N). { - { - uint8_t exists = zend_hash_str_exists(&P->cpp.defs, N->text, N->size); - exp = psi_num_exp_init_num(psi_number_init(PSI_T_UINT8, &exists)); - exp->token = N; - } -} -cpp_macro_exp(exp) ::= DEFINED LPAREN NAME(N) RPAREN. { - { - uint8_t exists = zend_hash_str_exists(&P->cpp.defs, N->text, N->size); - exp = psi_num_exp_init_num(psi_number_init(PSI_T_UINT8, &exists)); - exp->token = N; - } -} -cpp_macro_exp(exp) ::= number_token(tok). { - exp = psi_num_exp_init_num(psi_number_init(tok->type, tok->text)); - exp->token = tok; - exp->data.n->token = psi_token_copy(tok); -} -cpp_macro_exp(exp) ::= NAME(N). { - exp = psi_num_exp_init_num(psi_number_init(PSI_T_DEFINE, N->text)); - exp->token = N; - exp->data.n->token = psi_token_copy(N); -} -cpp_macro_exp(exp) ::= NAME(N) LPAREN cpp_macro_call_args(args) RPAREN. { - exp = psi_num_exp_init_num(psi_number_init(PSI_T_FUNCTION, - psi_cpp_macro_call_init(N->text, args))); - exp->token = N; -} -cpp_macro_call_args(args) ::= . { - args = NULL; -} -cpp_macro_call_args(args) ::= cpp_macro_exp(arg). { - args = psi_plist_add(psi_plist_init((void (*)(void *)) psi_num_exp_free), &arg); -} -cpp_macro_call_args(args) ::= cpp_macro_call_args(args_) COMMA cpp_macro_exp(arg). { - args = psi_plist_add(args_, &arg); -} -block ::= LIB(token) QUOTED_STRING(libname) EOS. { - if (P->file.ln) { - P->error(PSI_DATA(P), token, PSI_WARNING, "Extra 'lib %s' statement has no effect", libname->text); - } else { - P->file.ln = strndup(libname->text + 1, libname->size - 2); - } - free(libname); - free(token); -} -block ::= decl(decl). { - if (!P->decls) { - P->decls = psi_plist_init((psi_plist_dtor) psi_decl_free); - } - P->decls = psi_plist_add(P->decls, &decl); -} -block ::= impl(impl). { - if (!P->impls) { - P->impls = psi_plist_init((psi_plist_dtor) psi_impl_free); - } - P->impls = psi_plist_add(P->impls, &impl); -} -block ::= decl_typedef(def). { - if (!P->types) { - P->types = psi_plist_init((psi_plist_dtor) psi_decl_arg_free); - } - P->types = psi_plist_add(P->types, &def); - switch (def->type->type) { - case PSI_T_STRUCT: - if (def->type->real.strct) { - if (!P->structs) { - P->structs = psi_plist_init((psi_plist_dtor) psi_decl_struct_free); - } - P->structs = psi_plist_add(P->structs, &def->type->real.strct); - } - break; - case PSI_T_UNION: - if (def->type->real.unn) { - if (!P->unions) { - P->unions = psi_plist_init((psi_plist_dtor) psi_decl_union_free); - } - P->unions = psi_plist_add(P->unions, &def->type->real.unn); - } - break; - case PSI_T_ENUM: - if (def->type->real.enm) { - if (!P->enums) { - P->enums = psi_plist_init((psi_plist_dtor) psi_decl_enum_free); - } - P->enums = psi_plist_add(P->enums, &def->type->real.enm); - } - break; - } -} -block ::= constant(constant). { - if (!P->consts) { - P->consts = psi_plist_init((psi_plist_dtor) psi_const_free); - } - P->consts = psi_plist_add(P->consts, &constant); -} -block ::= decl_struct(strct). { - if (!P->structs) { - P->structs = psi_plist_init((psi_plist_dtor) psi_decl_struct_free); - } - P->structs = psi_plist_add(P->structs, &strct); -} -block ::= decl_union(u). { - if (!P->unions) { - P->unions = psi_plist_init((psi_plist_dtor) psi_decl_union_free); - } - P->unions = psi_plist_add(P->unions, &u); -} -block ::= decl_enum(e). { - if (!P->enums) { - P->enums = psi_plist_init((psi_plist_dtor) psi_decl_enum_free); - } - P->enums = psi_plist_add(P->enums, &e); -} -optional_name(n) ::= . { - n = NULL; -} -optional_name(n) ::= NAME(N). { - n = N; -} -align_and_size(as) ::= . { - as.pos = 0; - as.len = 0; -} -align_and_size(as) ::= COLON COLON LPAREN NUMBER(A) COMMA NUMBER(S) RPAREN. { - as.pos = atol(A->text); - as.len = atol(S->text); - free(A); - free(S); -} -enum_name(n) ::= ENUM(E) optional_name(N). { - if (N) { - n = N; - free(E); - } else { - char digest[17]; - psi_token_hash(E, digest); - n = psi_token_append("@", E, 1, digest); - } -} -struct_name(n) ::= STRUCT(S) optional_name(N). { - if (N) { - n = N; - free(S); - } else { - char digest[17]; - psi_token_hash(S, digest); - n = psi_token_append("@", S, 1, digest); - } -} -union_name(n) ::= UNION(U) optional_name(N). { - if (N) { - n = N; - free(U); - } else { - char digest[17]; - psi_token_hash(U, digest); - n = psi_token_append("@", U, 1, digest); - } -} -decl_enum(e) ::= enum_name(N) LBRACE decl_enum_items(list) RBRACE. { - e = psi_decl_enum_init(N->text, list); - e->token = N; -} -decl_enum_items(l) ::= decl_enum_item(i). { - l = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_enum_item_free), - &i); -} -decl_enum_items(l) ::= decl_enum_items(l_) COMMA decl_enum_item(i). { - l = psi_plist_add(l_, &i); -} -decl_enum_item(i) ::= NAME(N) EQUALS num_exp(num). { - i = psi_decl_enum_item_init(N->text, num); - i->token = N; -} -decl_enum_item(i) ::= NAME(N). { - i = psi_decl_enum_item_init(N->text, NULL); - i->token = N; -} -decl_struct_args_block(args_) ::= LBRACE struct_args(args) RBRACE. { - args_ = args; -} -decl_struct_args(args_) ::= decl_struct_args_block(args). { - args_ = args; -} -decl_struct_args(args_) ::= EOS. { - args_ = psi_plist_init((psi_plist_dtor) psi_decl_arg_free); -} -decl_struct(strct) ::= STRUCT NAME(N) align_and_size(as) decl_struct_args(args). { - strct = psi_decl_struct_init(N->text, args); - strct->align = as.pos; - strct->size = as.len; - strct->token = N; -} -decl_union(u) ::= UNION NAME(N) align_and_size(as) decl_struct_args(args). { - u = psi_decl_union_init(N->text, args); - u->align = as.pos; - u->size = as.len; - u->token = N; -} -const_type(type_) ::= const_type_token(T). { - type_ = psi_const_type_init(T->type, T->text); - free(T); -} -constant(constant) ::= CONST const_type(type) NSNAME(T) EQUALS impl_def_val(val) EOS. { - constant = psi_const_init(type, T->text, val); - constant->token = T; -} -decl_typedef(def) ::= TYPEDEF(T) decl_typedef_body(def_) EOS. { - def = def_; - def->token = T; -} -decl_typedef_body_ex(def) ::= struct_name(N) align_and_size(as) decl_struct_args_block(args) decl_var(var). { - def = psi_decl_arg_init(psi_decl_type_init(PSI_T_STRUCT, N->text), var); - def->type->token = psi_token_copy(N); - def->type->real.strct = psi_decl_struct_init(N->text, args); - def->type->real.strct->token = N; - def->type->real.strct->align = as.pos; - def->type->real.strct->size = as.len; -} -decl_typedef_body_ex(def) ::= union_name(N) align_and_size(as) decl_struct_args_block(args) decl_var(var). { - def = psi_decl_arg_init(psi_decl_type_init(PSI_T_UNION, N->text), var); - def->type->token = psi_token_copy(N); - def->type->real.unn = psi_decl_union_init(N->text, args); - def->type->real.unn->token = N; - def->type->real.unn->align = as.pos; - def->type->real.unn->size = as.len; -} -decl_typedef_body_ex(def) ::= decl_enum(e) NAME(ALIAS). { - def = psi_decl_arg_init(psi_decl_type_init(PSI_T_ENUM, e->name), psi_decl_var_init(ALIAS->text, 0, 0)); - def->var->token = ALIAS; - def->type->token = psi_token_copy(e->token); - def->type->real.enm = e; -} -decl_typedef_body(def) ::= decl_typedef_body_ex(def_). { - def = def_; -} -decl_typedef_body_fn_args(args) ::= LPAREN decl_args(args_) RPAREN. { - args = args_; -} -decl_typedef_body(def) ::= decl_func(func_) decl_typedef_body_fn_args(args). { - def = psi_decl_arg_init(psi_decl_type_init(PSI_T_FUNCTION, func_->var->name), psi_decl_var_copy(func_->var)); - def->type->token = psi_token_copy(func_->token); - def->type->real.func = psi_decl_init(psi_decl_abi_init("default"), func_, args); -} -decl_typedef_body(def) ::= decl_arg(arg). { - def = arg; -} -decl(decl) ::= decl_abi(abi) decl_func(func) LPAREN decl_args(args) RPAREN EOS. { - decl = psi_decl_init(abi, func, args); -} -decl(decl) ::= decl_abi(abi) decl_func(func) LPAREN decl_args(args) COMMA ELLIPSIS RPAREN EOS. { - decl = psi_decl_init(abi, func, args); - decl->varargs = 1; -} -decl_func(func) ::= decl_arg(arg). { - func = arg; -} -decl_func(func) ::= VOID(T) NAME(N). { - func = psi_decl_arg_init( - psi_decl_type_init(T->type, T->text), - psi_decl_var_init(N->text, 0, 0) - ); - func->type->token = T; - func->var->token = N; - func->token = N; -} -decl_typedef_body(def) ::= VOID(T) indirection(decl_i) LPAREN indirection(type_i) NAME(N) RPAREN decl_typedef_body_fn_args(args). { - struct psi_decl_arg *func_ = psi_decl_arg_init( - psi_decl_type_init(T->type, T->text), - psi_decl_var_init(N->text, decl_i, 0) - ); - func_->type->token = T; - func_->var->token = N; - func_->token = N; - def = psi_decl_arg_init( - psi_decl_type_init(PSI_T_FUNCTION, func_->var->name), - psi_decl_var_copy(func_->var) - ); - def->var->pointer_level = type_i; - def->type->token = psi_token_copy(func_->token); - def->type->real.func = psi_decl_init(psi_decl_abi_init("default"), func_, args); -} -decl_typedef_body(def) ::= CONST VOID(T) pointers(decl_i) LPAREN indirection(type_i) NAME(N) RPAREN decl_typedef_body_fn_args(args). { - struct psi_decl_arg *func_ = psi_decl_arg_init( - psi_decl_type_init(T->type, T->text), - psi_decl_var_init(N->text, decl_i, 0) - ); - func_->type->token = T; - func_->var->token = N; - func_->token = N; - def = psi_decl_arg_init( - psi_decl_type_init(PSI_T_FUNCTION, func_->var->name), - psi_decl_var_copy(func_->var) - ); - def->var->pointer_level = type_i; - def->type->token = psi_token_copy(func_->token); - def->type->real.func = psi_decl_init(psi_decl_abi_init("default"), func_, args); -} -decl_abi(abi) ::= NAME(T). { - abi = psi_decl_abi_init(T->text); - abi->token = T; -} -decl_var_array_size(as) ::= . { - as = NULL; -} -decl_var_array_size(as) ::= LBRACKET NUMBER(D) RBRACKET. { - as = D; -} -decl_var(var) ::= NAME(T) decl_var_array_size(as). { - var = psi_decl_var_init(T->text, 0, as?atol(as->text):0); - var->token = T; - if (as) { - free(as); - } -} -decl_var(var) ::= pointers(p) NAME(T) decl_var_array_size(as). { - var = psi_decl_var_init(T->text, p+!!as, as?atol(as->text):0); - var->token = T; - if (as) { - free(as); - } -} -decl_vars(vars) ::= decl_var(var). { - vars = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_var_free), - &var); -} -decl_vars(vars) ::= decl_vars(vars_) COMMA decl_var(var). { - vars = psi_plist_add(vars_, &var); -} -decl_arg(arg_) ::= const_decl_type(type) decl_var(var). { - arg_ = psi_decl_arg_init(type, var); -} -decl_typedef_body(def) ::= const_decl_type(type_) indirection(decl_i) LPAREN indirection(type_i) NAME(N) RPAREN decl_typedef_body_fn_args(args). { - struct psi_decl_arg *func_ = psi_decl_arg_init( - type_, - psi_decl_var_init(N->text, decl_i, 0) - ); - func_->var->token = N; - func_->token = N; - def = psi_decl_arg_init( - psi_decl_type_init(PSI_T_FUNCTION, func_->var->name), - psi_decl_var_copy(func_->var) - ); - def->var->pointer_level = type_i; - def->type->token = psi_token_copy(func_->token); - def->type->real.func = psi_decl_init(psi_decl_abi_init("default"), func_, args); -} -decl_arg(arg_) ::= VOID(T) pointers(p) NAME(N). { - arg_ = psi_decl_arg_init( - psi_decl_type_init(T->type, T->text), - psi_decl_var_init(N->text, p, 0) - ); - arg_->type->token = T; - arg_->var->token = N; - arg_->token = N; -} -decl_arg(arg_) ::= CONST VOID(T) pointers(p) NAME(N). { - arg_ = psi_decl_arg_init( - psi_decl_type_init(T->type, T->text), - psi_decl_var_init(N->text, p, 0) - ); - arg_->type->token = T; - arg_->var->token = N; - arg_->token = N; -} -decl_args(args) ::= . { - args = NULL; -} -decl_args(args) ::= VOID. { - args = NULL; -} -decl_args(args) ::= decl_arg(arg). { - args = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_arg_free), - &arg); -} -decl_args(args) ::= decl_args(args_) COMMA decl_arg(arg). { - args = psi_plist_add(args_, &arg); -} -struct_args(args) ::= struct_arg(arg). { - args = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_arg_free), - &arg); -} -struct_args(args) ::= struct_args(args_) struct_arg(arg). { - args = psi_plist_add(args_, &arg); -} -struct_arg(arg_) ::= decl_typedef_body_ex(def) EOS. { - arg_ = def; - switch (def->type->type) { - case PSI_T_STRUCT: - if (def->type->real.strct) { - if (!P->structs) { - P->structs = psi_plist_init((psi_plist_dtor) psi_decl_struct_free); - } - P->structs = psi_plist_add(P->structs, &def->type->real.strct); - } - break; - case PSI_T_UNION: - if (def->type->real.unn) { - if (!P->unions) { - P->unions = psi_plist_init((psi_plist_dtor) psi_decl_union_free); - } - P->unions = psi_plist_add(P->unions, &def->type->real.unn); - } - break; - case PSI_T_ENUM: - if (def->type->real.enm) { - if (!P->enums) { - P->enums = psi_plist_init((psi_plist_dtor) psi_decl_enum_free); - } - P->enums = psi_plist_add(P->enums, &def->type->real.enm); - } - break; - } -} -struct_arg(arg) ::= decl_arg(arg_) decl_layout(layout_) EOS. { - arg_->layout = layout_; - arg = arg_; -} -decl_layout(layout) ::= . { - layout = NULL; -} -decl_layout(layout) ::= COLON COLON LPAREN NUMBER(POS) COMMA NUMBER(SIZ) RPAREN. { - layout = psi_layout_init(atol(POS->text), atol(SIZ->text)); - free(POS); - free(SIZ); -} -decl_scalar_type(type_) ::= CHAR(C). { - type_ = C; -} -decl_scalar_type(type_) ::= SHORT(S) decl_scalar_type_short(s). { - if (s) { - type_ = psi_token_cat(" ", 2, S, s); - free(S); - free(s); - } else { - type_ = S; - } -} -decl_scalar_type_short(s) ::= . { - s = NULL; -} -decl_scalar_type_short(s) ::= INT(I). { - s = I; -} -decl_scalar_type(type_) ::= INT(I). { - type_ = I; -} -decl_scalar_type(type_) ::= LONG(L) decl_scalar_type_long(l). { - if (l) { - type_ = psi_token_cat(" ", 2, L, l); - free(L); - free(l); - } else { - type_ = L; - } -} -decl_scalar_type_long(l) ::= . { - l = NULL; -} -decl_scalar_type_long(l) ::= DOUBLE(D). { - l = D; -} -decl_scalar_type_long(l) ::= LONG(L) decl_scalar_type_long_long(ll). { - if (ll) { - l = psi_token_cat(" ", 2, L, ll); - free(L); - free(ll); - } else { - l = L; - } -} -decl_scalar_type_long_long(ll) ::= . { - ll = NULL; -} -decl_scalar_type_long_long(ll) ::= INT(I). { - ll = I; -} -decl_type(type_) ::= UNSIGNED(U) decl_scalar_type(N). { - struct psi_token *T = psi_token_cat(" ", 2, U, N); - type_ = psi_decl_type_init(T->type, T->text); - type_->token = T; - free(U); - free(N); -} -decl_type(type_) ::= SIGNED(S) decl_scalar_type(N). { - struct psi_token *T = psi_token_cat(" ", 2, S, N); - type_ = psi_decl_type_init(T->type, T->text); - type_->token = T; - free(S); - free(N); -} -decl_type(type_) ::= UNSIGNED(U). { - type_ = psi_decl_type_init(PSI_T_NAME, U->text); - type_->token = U; -} -decl_type(type_) ::= SIGNED(S). { - type_ = psi_decl_type_init(PSI_T_NAME, S->text); - type_->token = S; -} -decl_type(type_) ::= decl_scalar_type(N). { - type_ = psi_decl_type_init(N->type, N->text); - type_->token = N; -} -decl_type(type_) ::= STRUCT(S) NAME(T). { - type_ = psi_decl_type_init(S->type, T->text); - type_->token = T; - free(S); -} -decl_type(type_) ::= UNION(U) NAME(T). { - type_ = psi_decl_type_init(U->type, T->text); - type_->token = T; - free(U); -} -decl_type(type_) ::= ENUM(E) NAME(T). { - type_ = psi_decl_type_init(E->type, T->text); - type_->token = T; - free(E); -} -decl_type(type_) ::= decl_type_token(T). { - type_ = psi_decl_type_init(T->type, T->text); - type_->token = T; -} -const_decl_type(type) ::= decl_type(type_). { - type = type_; -} -const_decl_type(type) ::= CONST decl_type(type_). { - type = type_; -} -impl(impl) ::= impl_func(func) LBRACE impl_stmts(stmts) RBRACE. { - impl = psi_impl_init(func, stmts); -} -impl(impl) ::= STATIC impl_func(func) LBRACE impl_stmts(stmts) RBRACE. { - func->static_memory = 1; - impl = psi_impl_init(func, stmts); -} -impl_func(func) ::= FUNCTION reference(r) NSNAME(NAME) LPAREN RPAREN COLON impl_type(type). { - func = psi_impl_func_init(NAME->text, NULL, type); - func->token = NAME; - func->return_reference = r; -} -impl_func(func) ::= FUNCTION reference(r) NSNAME(NAME) LPAREN impl_args(args) RPAREN COLON impl_type(type). { - func = psi_impl_func_init(NAME->text, args, type); - func->token = NAME; - func->return_reference = r; -} -impl_func(func) ::= FUNCTION reference(func_r) NSNAME(NAME) LPAREN impl_args(args) COMMA impl_type(va_type) reference(va_r) ELLIPSIS DOLLAR_NAME(T) RPAREN COLON impl_type(func_type). { - func = psi_impl_func_init(NAME->text, args, func_type); - func->token = NAME; - func->return_reference = func_r; - func->vararg = psi_impl_arg_init(va_type, psi_impl_var_init(T->text, va_r), NULL); - free(T); -} -impl_def_val(def) ::= impl_def_val_token(T). { - def = psi_impl_def_val_init(T->type, T->text); - def->token = T; -} -impl_var(var) ::= reference(r) DOLLAR_NAME(T). { - var = psi_impl_var_init(T->text, r); - var->token = T; -} -impl_type(type_) ::= impl_type_token(T). { - type_ = psi_impl_type_init(T->type, T->text); - free(T); -} -impl_arg(arg) ::= impl_type(type) impl_var(var). { - arg = psi_impl_arg_init(type, var, NULL); -} -impl_arg(arg) ::= impl_type(type) impl_var(var) EQUALS impl_def_val(def). { - arg = psi_impl_arg_init(type, var, def); -} -impl_args(args) ::= impl_arg(arg). { - args = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_impl_arg_free), - &arg); -} -impl_args(args) ::= impl_args(args_) COMMA impl_arg(arg). { - args = psi_plist_add(args_, &arg); -} -impl_stmts(stmts) ::= impl_stmt(stmt). { - stmts = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_impl_stmt_free), - &stmt); -} -impl_stmts(stmts) ::= impl_stmts(stmts_) impl_stmt(stmt). { - stmts = psi_plist_add(stmts_, &stmt); -} -impl_stmt(i) ::= return_stmt(r). { - i = (struct psi_token**) r; -} -impl_stmt(i) ::= let_stmt(l). { - i = (struct psi_token**) l; -} -impl_stmt(i) ::= set_stmt(s). { - i = (struct psi_token**) s; -} -impl_stmt(i) ::= assert_stmt(s). { - i = (struct psi_token **) s; -} -impl_stmt(i) ::= free_stmt(f). { - i = (struct psi_token**) f; -} -number(exp) ::= number_token(tok). { - exp = psi_number_init(tok->type, tok->text); - exp->token = tok; -} -number(exp) ::= decl_var(var). { - exp = psi_number_init(PSI_T_NAME, var); - exp->token = psi_token_copy(var->token); -} -num_exp(exp) ::= number(num). { - exp = psi_num_exp_init_num(num); - exp->token = psi_token_copy(num->token); -} -num_exp(exp) ::= LPAREN(L) num_exp(exp_) RPAREN. { - exp = psi_num_exp_init_unary(PSI_T_LPAREN, exp_); - exp->token = L; -} -num_exp(exp) ::= num_exp(lhs_) binary_op_token(OP) num_exp(rhs_). { - exp = psi_num_exp_init_binary(OP->type, lhs_, rhs_); - exp->token = OP; -} -num_exp(exp) ::= unary_op_token(OP) num_exp(exp_). { - exp = psi_num_exp_init_unary(OP->type, exp_); - exp->token = OP; -} -let_exp(val) ::= NULL. { - val = psi_let_exp_init(PSI_LET_NULL, NULL); -} -let_exp(val) ::= AMPERSAND NULL. { - val = psi_let_exp_init(PSI_LET_NULL, NULL); - val->is_reference = 1; -} -let_exp(val) ::= let_callback(cb). { - val = psi_let_exp_init(PSI_LET_CALLBACK, cb); -} -let_exp(val) ::= let_calloc(ca). { - val = psi_let_exp_init(PSI_LET_CALLOC, ca); -} -let_exp(val) ::= AMPERSAND let_calloc(ca). { - val = psi_let_exp_init(PSI_LET_CALLOC, ca); - val->is_reference = 1; -} -let_exp(val) ::= let_func(fn). { - val = psi_let_exp_init_ex(NULL, PSI_LET_FUNC, fn); -} -let_exp(val) ::= AMPERSAND let_func(fn). { - val = psi_let_exp_init_ex(NULL, PSI_LET_FUNC, fn); - val->is_reference = 1; -} -let_exp(val) ::= num_exp(exp). { - val = psi_let_exp_init_ex(NULL, PSI_LET_NUMEXP, exp); -} -let_exp(val) ::= AMPERSAND num_exp(exp). { - val = psi_let_exp_init_ex(NULL, PSI_LET_NUMEXP, exp); - val->is_reference = 1; -} -let_exp(exp) ::= decl_var(var_) EQUALS let_exp(val). { - exp = val; - exp->var = var_; -} -let_stmt(let) ::= LET(T) let_exp(val) EOS. { - let = psi_let_stmt_init(val); - let->token = T; -} -let_stmt(let) ::= TEMP(T) decl_var(var) EQUALS reference(r) decl_var(val_) EOS. { - let = psi_let_stmt_init(psi_let_exp_init_ex(var, PSI_LET_TMP, val_)); - let->token = T; - let->exp->is_reference = r ? 1 : 0; -} -let_callback(cb) ::= CALLBACK(T) callback_rval(F) LPAREN impl_var(var) LPAREN callback_arg_list(args_) RPAREN RPAREN. { - cb = psi_let_callback_init(psi_let_func_init(F->type, F->text, var), args_); - cb->token = T; - free(F); -} -let_calloc(alloc) ::= CALLOC(T) LPAREN num_exp(nmemb) COMMA num_exp(size) RPAREN. { - alloc = psi_let_calloc_init(nmemb, size); - alloc->token = T; -} -let_func(func) ::= let_func_token(T) LPAREN impl_var(var) RPAREN. { - func = psi_let_func_init(T->type, T->text, var); - func->token = T; -} -let_func(func) ::= let_func_token(T) LPAREN impl_var(var) COMMA let_exps(vals) RPAREN. { - func = psi_let_func_init(T->type, T->text, var); - func->token = T; - func->inner = vals; -} -let_exps(exps) ::= let_exp(exp). { - exps = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_let_exp_free), - &exp); -} -let_exps(exps) ::= let_exps(exps_) COMMA let_exp(exp). { - exps = psi_plist_add(exps_, &exp); -} -callback_arg_list(args) ::= . { - args = NULL; -} -callback_arg_list(args) ::= callback_args(args_). { - args = args_; -} -callback_args(args) ::= set_exp(val). { - args = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_set_exp_free), - &val); -} -callback_args(args) ::= callback_args(args_) COMMA set_exp(val). { - args = psi_plist_add(args_, &val); -} -callback_rval(rval) ::= let_func_token(F). { - rval = F; -} -callback_rval(rval) ::= VOID(V). { - rval = V; -} -set_func(func) ::= set_func_token(T) LPAREN decl_var(var) RPAREN. { - func = psi_set_func_init(T->type, T->text, var); - func->token = T; -} -set_func(func) ::= set_func_token(T) LPAREN decl_var(var) COMMA set_exps(vals) RPAREN. { - func = psi_set_func_init(T->type, T->text, var); - func->token = T; - func->inner = vals; -} -set_func(func) ::= set_func_token(T) LPAREN decl_var(var) COMMA ELLIPSIS RPAREN. { - func = psi_set_func_init(T->type, T->text, var); - func->token = T; - func->recursive = 1; -} -set_exp(val) ::= set_func(fn). { - val = psi_set_exp_init(PSI_SET_FUNC, fn); -} -set_exp(val) ::= num_exp(num). { - val = psi_set_exp_init(PSI_SET_NUMEXP, num); -} -set_exps(exps) ::= set_exp(exp). { - exps = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_set_exp_free), - &exp); -} -set_exps(exps) ::= set_exps(exps_) COMMA set_exp(exp). { - exps = psi_plist_add(exps_, &exp); -} -set_exp(exp) ::= impl_var(var_) EQUALS set_exp(val). { - exp = val; - exp->var = var_; -} -set_stmt(set) ::= SET(T) set_exp(exp) EOS. { - set = psi_set_stmt_init(exp); - set->token = T; -} -return_stmt(ret) ::= RETURN(T) set_func(func) EOS. { - ret = psi_return_stmt_init(psi_set_exp_init(PSI_SET_FUNC, func)); - ret->token = T; -} -free_stmt(free) ::= FREE(T) free_exps(calls) EOS. { - free = psi_free_stmt_init(calls); - free->token = T; -} -free_exps(calls) ::= free_exp(call). { - calls = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_free_exp_free), - &call); -} -free_exps(calls) ::= free_exps(calls_) COMMA free_exp(call). { - calls = psi_plist_add(calls_, &call); -} -free_exp(call) ::= NAME(F) LPAREN decl_vars(vars) RPAREN. { - call = psi_free_exp_init(F->text, vars); - call->token = F; -} -assert_stmt(ass) ::= assert_stmt_token(T) num_exp(exp) EOS. { - ass = psi_assert_stmt_init(T->type, exp); - ass->token = T; -} -reference(r) ::= . { - r = false; -} -reference(r) ::= AMPERSAND. { - r = true; -} -indirection(i) ::= .{ - i = 0; -} -indirection(i) ::= pointers(p). { - i = p; -} -pointers(p) ::= ASTERISK. { - p = 1; -} -pointers(p) ::= pointers(p_) ASTERISK. { - p = p_+1; -} diff --git a/src/parser_proc_def.h b/src/parser_proc_def.h index 85cb299..2c64b66 100644 --- a/src/parser_proc_def.h +++ b/src/parser_proc_def.h @@ -1,72 +1,3 @@ -/******************************************************************************* - Copyright (c) 2016, Michael Wallner . - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*******************************************************************************/ - -#include "parser_def.h" - -DEF(%token_prefix, CONCAT1(TOKEN_PREFIX,_)) -DEF(%token_type, {TOKEN_STRUCT}) -DEF(%token_destructor, {free($$);}) -DEF(%default_destructor, {(void)P;}) -DEF(%extra_argument, {struct psi_parser *P}) - -/* TOKEN is defined inside syntax_error */ -DEF(%syntax_error, { - ++P->errors; - if (TOKEN) { - psi_error(PSI_WARNING, TOKEN->file, TOKEN->line, "PSI syntax error: Unexpected token '%s' at pos %u", TOKEN->text, TOKEN->col); - } else { - psi_error(PSI_WARNING, P->file.fn, P->line, "PSI syntax error: Unexpected end of input"); - } -}) - -TOKEN_CLASS(const_type, T(BOOL) T(INT) T(FLOAT) T(STRING)) -TOKEN_CLASS(decl_type, T(FLOAT) T(DOUBLE) T(INT8) T(UINT8) T(INT16) T(UINT16) T(INT32) T(UINT32) T(INT64) T(UINT64) T(NAME)) -TOKEN_CLASS(impl_def_val, T(NULL) T(NUMBER) T(TRUE) T(FALSE) T(QUOTED_STRING)) -TOKEN_CLASS(number, T(NUMBER) T(NSNAME)) -TOKEN_CLASS(binary_op, T(PIPE) T(CARET) T(AMPERSAND) T(LSHIFT) T(RSHIFT) T(PLUS) T(MINUS) T(ASTERISK) T(SLASH) T(MODULO) T(RCHEVR) T(LCHEVR) T(CMP_GE) T(CMP_LE) T(OR) T(AND) T(CMP_EQ) T(CMP_NE)) -TOKEN_CLASS(unary_op, T(TILDE) T(NOT) T(PLUS) T(MINUS)) -TOKEN_CLASS(let_func, T(ZVAL) T(OBJVAL) T(ARRVAL) T(PATHVAL) T(STRLEN) T(STRVAL) T(FLOATVAL) T(INTVAL) T(BOOLVAL) T(COUNT)) -TOKEN_CLASS(set_func, T(TO_OBJECT) T(TO_ARRAY) T(TO_STRING) T(TO_INT) T(TO_FLOAT) T(TO_BOOL) T(ZVAL) T(VOID)) -TOKEN_CLASS(impl_type, T(VOID) T(MIXED) T(BOOL) T(INT) T(FLOAT) T(STRING) T(ARRAY) T(OBJECT) T(CALLABLE)) -TOKEN_CLASS(assert_stmt, T(PRE_ASSERT) T(POST_ASSERT)) -TOKEN_CLASS(cpp_message, T(ERROR) T(WARNING)) - -DEF(%nonassoc, NAME.) -DEF(%right, NOT TILDE.) -DEF(%left, AND OR.) -DEF(%left, PIPE.) -DEF(%left, CARET.) -DEF(%left, AMPERSAND.) -DEF(%left, CMP_EQ CMP_NE.) -DEF(%left, LCHEVR CMP_LE RCHEVR CMP_GE.) -DEF(%left, LSHIFT RSHIFT.) -DEF(%left, PLUS MINUS.) -DEF(%left, ASTERISK SLASH MODULO.) - -DEF(%fallback, NAME TEMP FREE SET LET RETURN CALLOC CALLBACK ZVAL LIB STRING COUNT ERROR WARNING.) -DEF(%wildcard, ANY.) TOKEN_TYPE(decl_enum, struct psi_decl_enum *) TOKEN_DTOR(decl_enum, psi_decl_enum_free(&$$);) @@ -198,333 +129,6 @@ TOKEN_TYPE(reference, bool) TOKEN_TYPE(indirection, unsigned) TOKEN_TYPE(pointers, unsigned) -PASS(file, blocks) -PASS(blocks, block) -PASS(blocks, blocks block) - -PASS(block, EOS) -PASS(block, EOL) -PASS(block, COMMENT) - -/* - * cpp: # cpp_exp EOL - */ -PARSE(block, TOKEN(HASH) TYPED(cpp_exp, exp_) TOKEN(EOL)) { - P->cpp.exp = exp_; -} - -/* - * cpp_exp: cpp_message_token QUOTED_STRING - */ -PARSE_TYPED(cpp_exp, exp, - NAMED(cpp_message_token, T) - NAMED(QUOTED_STRING, S)) { - exp = psi_cpp_exp_init(T->type, S); - exp->token = T; -} - -/* - * cpp_exp: IFDEF NAME - */ -PARSE_TYPED(cpp_exp, exp, - NAMED(IFDEF, T) - NAMED(NAME, N)) { - exp = psi_cpp_exp_init(T->type, N); - exp->token = T; -} - -/* - * cpp_exp: IFNDEF NAME - */ -PARSE_TYPED(cpp_exp, exp, - NAMED(IFNDEF, T) - NAMED(NAME, N)) { - exp = psi_cpp_exp_init(T->type, N); - exp->token = T; -} - -/* - * cpp_exp: ENDIF - */ -PARSE_TYPED(cpp_exp, exp, - NAMED(ENDIF, T)) { - exp = psi_cpp_exp_init(T->type, NULL); - exp->token = T; -} - -/* - * cpp_exp: ELSE - */ -PARSE_TYPED(cpp_exp, exp, - NAMED(ELSE, T)) { - exp = psi_cpp_exp_init(T->type, NULL); - exp->token = T; -} - -/* - * cpp_exp: UNDEF NAME - */ -PARSE_TYPED(cpp_exp, exp, - NAMED(UNDEF, T) - NAMED(NAME, N)) { - exp = psi_cpp_exp_init(T->type, N); - exp->token = T; -} - -/* - * cpp_exp: DEFINE NAME cpp_macro_decl - */ -PARSE_TYPED(cpp_exp, exp, - NAMED(DEFINE, T) - NAMED(NAME, N) - TYPED(cpp_macro_decl, macro)) { - exp = psi_cpp_exp_init(T->type, macro); - exp->token = T; - macro->token = N; -} - -/* - * cpp_macro_decl: - */ -PARSE_TYPED(cpp_macro_decl, macro, ) { - macro = psi_cpp_macro_decl_init(NULL, NULL, NULL); -} - -/* - * cpp_macro_decl: cpp_macro_sig - */ -PARSE_TYPED(cpp_macro_decl, macro, - TYPED(cpp_macro_sig, sig)) { - macro = psi_cpp_macro_decl_init(sig, NULL, NULL); -} - -/* - * cpp_macro_decl: cpp_macro_sig cpp_macro_decl_tokens - */ -PARSE_TYPED(cpp_macro_decl, macro, - TYPED(cpp_macro_sig, sig) - TYPED(cpp_macro_decl_tokens, tokens)) { - macro = psi_cpp_macro_decl_init(sig, tokens, NULL); -} - -/* - * cpp_macro_sig: NO_WHITESPACE LPAREN cpp_macro_sig_args RPAREN - */ -PARSE_TYPED(cpp_macro_sig, sig, - TOKEN(NO_WHITESPACE) - TOKEN(LPAREN) - TYPED(cpp_macro_sig_args, args) - TOKEN(RPAREN)) { - sig = args; -} - -/* - * cpp_macro_sig_args: - */ -PARSE_TYPED(cpp_macro_sig_args, args, ) { - args = NULL; -} - -/* - * cpp_macro_sig_args: NAME - */ -PARSE_TYPED(cpp_macro_sig_args, args, - NAMED(NAME, arg)) { - args = psi_plist_add(psi_plist_init((void (*)(void *)) psi_token_free), &arg); -} - -/* - * cpp_macro_sig_args: cpp_macro_sig_args , NAME - */ -PARSE_TYPED(cpp_macro_sig_args, args, - TYPED(cpp_macro_sig_args, args_) - TOKEN(COMMA) - NAMED(NAME, arg)) { - args = psi_plist_add(args_, &arg); -} - -/* - * cpp_macro_decl: cpp_macro_decl_tokens - */ -PARSE_TYPED(cpp_macro_decl, macro, - TYPED(cpp_macro_decl_tokens, tokens)) { - macro = psi_cpp_macro_decl_init(NULL, tokens, NULL); -} - -/* - * cpp_macro_decl_tokens: ANY - */ -PARSE_TYPED(cpp_macro_decl_tokens, tokens, - NAMED(ANY, T)) { - tokens = psi_plist_add(psi_plist_init((void (*)(void *)) psi_token_free), &T); -} - -/* - * cpp_macro_decl_tokens: cpp_macro_decl_tokens ANY - */ -PARSE_TYPED(cpp_macro_decl_tokens, tokens, - TYPED(cpp_macro_decl_tokens, tokens_) - NAMED(ANY, T)) { - tokens = psi_plist_add(tokens_, &T); -} - -/* - * cpp_exp: IF cpp_macro_exp - */ -PARSE_TYPED(cpp_exp, exp, - NAMED(IF, T) - TYPED(cpp_macro_exp, macro)) { - exp = psi_cpp_exp_init(T->type, macro); - exp->token = T; -} - -/* - * cpp_exp: ELIF cpp_macro_exp - */ -PARSE_TYPED(cpp_exp, exp, - NAMED(ELIF, T) - TYPED(cpp_macro_exp, macro)) { - exp = psi_cpp_exp_init(T->type, macro); - exp->token = T; -} - -/* - * cpp_macro_exp: ( cpp_macro_exp ) - */ -PARSE_TYPED(cpp_macro_exp, exp, - NAMED(LPAREN, L) - TYPED(cpp_macro_exp, exp_) - TOKEN(RPAREN)) { - exp = psi_num_exp_init_unary(L->type, exp_); - exp->token = L; -} - -/* - * cpp_macro_exp: unary_op cpp_macro_exp - */ -PARSE_TYPED(cpp_macro_exp, exp, - NAMED(unary_op_token, OP) - TYPED(cpp_macro_exp, exp_)) { - exp = psi_num_exp_init_unary(OP->type, exp_); - exp->token = OP; -} - -/* - * cpp_macro_exp: cpp_macro_exp binary_op cpp_macro_exp - */ -PARSE_TYPED(cpp_macro_exp, exp, - TYPED(cpp_macro_exp, lhs) - NAMED(binary_op_token, OP) - TYPED(cpp_macro_exp, rhs)) { - exp = psi_num_exp_init_binary(OP->type, lhs, rhs); - exp->token = OP; -} - -/* - * cpp_macro_exp: DEFINED NAME - */ -PARSE_TYPED(cpp_macro_exp, exp, - TOKEN(DEFINED) - NAMED(NAME, N)) { - { - uint8_t exists = zend_hash_str_exists(&P->cpp.defs, N->text, N->size); - exp = psi_num_exp_init_num(psi_number_init(PSI_T_UINT8, &exists)); - exp->token = N; - } -} - -/* - * cpp_macro_exp: DEFINED ( NAME ) - */ -PARSE_TYPED(cpp_macro_exp, exp, - TOKEN(DEFINED) - TOKEN(LPAREN) - NAMED(NAME, N) - TOKEN(RPAREN)) { - { - uint8_t exists = zend_hash_str_exists(&P->cpp.defs, N->text, N->size); - exp = psi_num_exp_init_num(psi_number_init(PSI_T_UINT8, &exists)); - exp->token = N; - } -} - -/* - * cpp_macro_exp: number - */ -PARSE_TYPED(cpp_macro_exp, exp, - NAMED(number_token, tok)) { - exp = psi_num_exp_init_num(psi_number_init(tok->type, tok->text)); - exp->token = tok; - exp->data.n->token = psi_token_copy(tok); -} - -/* - * cpp_macro_exp: NAME - */ -PARSE_TYPED(cpp_macro_exp, exp, - NAMED(NAME, N)) { - exp = psi_num_exp_init_num(psi_number_init(PSI_T_DEFINE, N->text)); - exp->token = N; - exp->data.n->token = psi_token_copy(N); -} - -/* - * cpp_macro_exp: NAME ( cpp_macro_call_args ) - */ -PARSE_TYPED(cpp_macro_exp, exp, - NAMED(NAME, N) - TOKEN(LPAREN) - TYPED(cpp_macro_call_args, args) - TOKEN(RPAREN)) { - exp = psi_num_exp_init_num(psi_number_init(PSI_T_FUNCTION, - psi_cpp_macro_call_init(N->text, args))); - exp->token = N; -} - -/* - * cpp_macro_call_args: - */ -PARSE_TYPED(cpp_macro_call_args, args,) { - args = NULL; -} - -/* - * cpp_macro_call_args: cpp_macro_exp - */ -PARSE_TYPED(cpp_macro_call_args, args, - TYPED(cpp_macro_exp, arg)) { - args = psi_plist_add(psi_plist_init((void (*)(void *)) psi_num_exp_free), &arg); -} - -/* - * cpp_macro_call_args: cpp_macro_call_args , cpp_macro_exp - */ -PARSE_TYPED(cpp_macro_call_args, args, - TYPED(cpp_macro_call_args, args_) - TOKEN(COMMA) - TYPED(cpp_macro_exp, arg)) { - args = psi_plist_add(args_, &arg); -} - -/* - * lib: LIB "soname" ; - */ -PARSE(block, NAMED(LIB, token) NAMED(QUOTED_STRING, libname) TOKEN(EOS)) { - if (P->file.ln) { - P->error(PSI_DATA(P), token, PSI_WARNING, "Extra 'lib %s' statement has no effect", libname->text); - } else { - P->file.ln = strndup(libname->text + 1, libname->size - 2); - } - free(libname); - free(token); -} - -PARSE(block, TYPED(decl, decl)) { - if (!P->decls) { - P->decls = psi_plist_init((psi_plist_dtor) psi_decl_free); - } - P->decls = psi_plist_add(P->decls, &decl); -} PARSE(block, TYPED(impl, impl)) { if (!P->impls) { @@ -533,1686 +137,26 @@ PARSE(block, TYPED(impl, impl)) { P->impls = psi_plist_add(P->impls, &impl); } -PARSE(block, TYPED(decl_typedef, def)) { - if (!P->types) { - P->types = psi_plist_init((psi_plist_dtor) psi_decl_arg_free); - } - P->types = psi_plist_add(P->types, &def); - - switch (def->type->type) { - case PSI_T_STRUCT: - if (def->type->real.strct) { - if (!P->structs) { - P->structs = psi_plist_init((psi_plist_dtor) psi_decl_struct_free); - } - P->structs = psi_plist_add(P->structs, &def->type->real.strct); - } - break; - case PSI_T_UNION: - if (def->type->real.unn) { - if (!P->unions) { - P->unions = psi_plist_init((psi_plist_dtor) psi_decl_union_free); - } - P->unions = psi_plist_add(P->unions, &def->type->real.unn); - } - break; - case PSI_T_ENUM: - if (def->type->real.enm) { - if (!P->enums) { - P->enums = psi_plist_init((psi_plist_dtor) psi_decl_enum_free); - } - P->enums = psi_plist_add(P->enums, &def->type->real.enm); - } - break; - } -} - -PARSE(block, TYPED(constant, constant)) { - if (!P->consts) { - P->consts = psi_plist_init((psi_plist_dtor) psi_const_free); - } - P->consts = psi_plist_add(P->consts, &constant); -} - -PARSE(block, TYPED(decl_struct, strct)) { - if (!P->structs) { - P->structs = psi_plist_init((psi_plist_dtor) psi_decl_struct_free); - } - P->structs = psi_plist_add(P->structs, &strct); -} - -PARSE(block, TYPED(decl_union, u)) { - if (!P->unions) { - P->unions = psi_plist_init((psi_plist_dtor) psi_decl_union_free); - } - P->unions = psi_plist_add(P->unions, &u); -} - -PARSE(block, TYPED(decl_enum, e)) { - if (!P->enums) { - P->enums = psi_plist_init((psi_plist_dtor) psi_decl_enum_free); - } - P->enums = psi_plist_add(P->enums, &e); -} - -/* - * optional_name: - */ -PARSE_NAMED(optional_name, n, ) { - n = NULL; -} - -/* - * optional_name: NAME - */ -PARSE_NAMED(optional_name, n, - NAMED(NAME, N)) { - n = N; -} - -/* - * align_and_size: - */ -PARSE_TYPED(align_and_size, as, ) { - as.pos = 0; - as.len = 0; -} - -/* - * align_and_size: :: ( NUMBER , NUMBER ) - */ -PARSE_TYPED(align_and_size, as, - TOKEN(COLON) - TOKEN(COLON) - TOKEN(LPAREN) - NAMED(NUMBER, A) - TOKEN(COMMA) - NAMED(NUMBER, S) - TOKEN(RPAREN)) { - as.pos = atol(A->text); - as.len = atol(S->text); - free(A); - free(S); -} - -/* - * enum_name: ENUM optional_name - */ -PARSE_NAMED(enum_name, n, - NAMED(ENUM, E) - NAMED(optional_name, N)) { - if (N) { - n = N; - free(E); - } else { - char digest[17]; - - psi_token_hash(E, digest); - n = psi_token_append("@", E, 1, digest); - } -} - -/* - * struct_name: STRUCT optional_name - */ -PARSE_NAMED(struct_name, n, - NAMED(STRUCT, S) - NAMED(optional_name, N)) { - if (N) { - n = N; - free(S); - } else { - char digest[17]; - - psi_token_hash(S, digest); - n = psi_token_append("@", S, 1, digest); - } -} - -/* - * union_name: UNION optional_name - */ -PARSE_NAMED(union_name, n, - NAMED(UNION, U) - NAMED(optional_name, N)) { - if (N) { - n = N; - free(U); - } else { - char digest[17]; - - psi_token_hash(U, digest); - n = psi_token_append("@", U, 1, digest); - } -} -/* - * decl_enum: enum_name { items } - */ -PARSE_TYPED(decl_enum, e, - NAMED(enum_name, N) - TOKEN(LBRACE) - TYPED(decl_enum_items, list) - TOKEN(RBRACE)) { - e = psi_decl_enum_init(N->text, list); - e->token = N; -} /* - * decl_enum_items: item + * decl_vars: decl_var */ -PARSE_TYPED(decl_enum_items, l, - TYPED(decl_enum_item, i)) { - l = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_enum_item_free), - &i); +PARSE_TYPED(decl_vars, vars, + TYPED(decl_var, var)) { + vars = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_var_free), + &var); } /* - * decl_enum_items: items , item + * decl_vars: decl_vars , decl_var */ -PARSE_TYPED(decl_enum_items, l, - TYPED(decl_enum_items, l_) +PARSE_TYPED(decl_vars, vars, + TYPED(decl_vars, vars_) TOKEN(COMMA) - TYPED(decl_enum_item, i)) { - l = psi_plist_add(l_, &i); -} - -/* - * decl_enum_item: name = num_exp - */ -PARSE_TYPED(decl_enum_item, i, - NAMED(NAME, N) - TOKEN(EQUALS) - TYPED(num_exp, num)) { - i = psi_decl_enum_item_init(N->text, num); - i->token = N; -} - -/* - * decl_enum_item: name - */ -PARSE_TYPED(decl_enum_item, i, - NAMED(NAME, N)) { - i = psi_decl_enum_item_init(N->text, NULL); - i->token = N; -} - - -/* - * decl_struct_args_block: { args } - */ -PARSE_TYPED(decl_struct_args_block, args_, - TOKEN(LBRACE) - TYPED(struct_args, args) - TOKEN(RBRACE)) { - args_ = args; -} - -/* - * decl_struct_args: args_block - */ -PARSE_TYPED(decl_struct_args, args_, - TYPED(decl_struct_args_block, args)) { - args_ = args; -} - -/* - * decl_struct_args: ; - */ -PARSE_TYPED(decl_struct_args, args_, - TOKEN(EOS)) { - args_ = psi_plist_init((psi_plist_dtor) psi_decl_arg_free); -} - -/* - * decl_struct: STRUCT name align_and_size struct_args - */ -PARSE_TYPED(decl_struct, strct, - TOKEN(STRUCT) - NAMED(NAME, N) - TYPED(align_and_size, as) - TYPED(decl_struct_args, args)) { - strct = psi_decl_struct_init(N->text, args); - strct->align = as.pos; - strct->size = as.len; - strct->token = N; -} - -/* - * decl_union: UNION name align_and_size struct_args - */ -PARSE_TYPED(decl_union, u, - TOKEN(UNION) - NAMED(NAME, N) - TYPED(align_and_size, as) - TYPED(decl_struct_args, args)) { - u = psi_decl_union_init(N->text, args); - u->align = as.pos; - u->size = as.len; - u->token = N; -} - -/* - * const_type: const_type_token - */ -PARSE_TYPED(const_type, type_, - NAMED(const_type_token, T)) { - type_ = psi_const_type_init(T->type, T->text); - free(T); -} - -/* - * constant: CONST const_type NSNAME = def_val ; - */ -PARSE_TYPED(constant, constant, - TOKEN(CONST) - TYPED(const_type, type) - NAMED(NSNAME, T) - TOKEN(EQUALS) - TYPED(impl_def_val, val) - TOKEN(EOS)) { - constant = psi_const_init(type, T->text, val); - constant->token = T; + TYPED(decl_var, var)) { + vars = psi_plist_add(vars_, &var); } -/* - * decl_typdef: TYPEDEF typedef_body ; - */ -PARSE_TYPED(decl_typedef, def, - NAMED(TYPEDEF, T) - TYPED(decl_typedef_body, def_) - TOKEN(EOS)) { - def = def_; - def->token = T; -} -/* - * decl_typedef_body_ex: struct_name align_and_size struct_args_block decl_var - */ -PARSE_TYPED(decl_typedef_body_ex, def, - NAMED(struct_name, N) - TYPED(align_and_size, as) - TYPED(decl_struct_args_block, args) - TYPED(decl_var, var)) { - def = psi_decl_arg_init(psi_decl_type_init(PSI_T_STRUCT, N->text), var); - def->type->token = psi_token_copy(N); - def->type->real.strct = psi_decl_struct_init(N->text, args); - def->type->real.strct->token = N; - def->type->real.strct->align = as.pos; - def->type->real.strct->size = as.len; -} -/* - * decl_typedef_body_ex: union_name align_and_size struct_args_block decl_var - */ -PARSE_TYPED(decl_typedef_body_ex, def, - NAMED(union_name, N) - TYPED(align_and_size, as) - TYPED(decl_struct_args_block, args) - TYPED(decl_var, var)) { - def = psi_decl_arg_init(psi_decl_type_init(PSI_T_UNION, N->text), var); - def->type->token = psi_token_copy(N); - def->type->real.unn = psi_decl_union_init(N->text, args); - def->type->real.unn->token = N; - def->type->real.unn->align = as.pos; - def->type->real.unn->size = as.len; -} - -/* - * decl_typedef_body_ex: decl_enum NAME - */ -PARSE_TYPED(decl_typedef_body_ex, def, - TYPED(decl_enum, e) - NAMED(NAME, ALIAS)) { - def = psi_decl_arg_init(psi_decl_type_init(PSI_T_ENUM, e->name), psi_decl_var_init(ALIAS->text, 0, 0)); - def->var->token = ALIAS; - def->type->token = psi_token_copy(e->token); - def->type->real.enm = e; -} - -/* - * decl_typedef_body: decl_typedef_body_ex - */ -PARSE_TYPED(decl_typedef_body, def, - TYPED(decl_typedef_body_ex, def_)) { - def = def_; -} - -/* - * decl_typedef_body_fn_args: ( decl_args ) - */ -PARSE_TYPED(decl_typedef_body_fn_args, args, - TOKEN(LPAREN) - TYPED(decl_args, args_) - TOKEN(RPAREN)) { - args = args_; -} - -/* - * decl_typedef_body: decl_func decl_typedef_body_fn_args - */ -PARSE_TYPED(decl_typedef_body, def, - TYPED(decl_func, func_) - TYPED(decl_typedef_body_fn_args, args)) { - def = psi_decl_arg_init(psi_decl_type_init(PSI_T_FUNCTION, func_->var->name), psi_decl_var_copy(func_->var)); - def->type->token = psi_token_copy(func_->token); - def->type->real.func = psi_decl_init(psi_decl_abi_init("default"), func_, args); -} - -/* - * decl_typedef_body: decl_arg - */ -PARSE_TYPED(decl_typedef_body, def, - TYPED(decl_arg, arg)) { - def = arg; -} - -/* - * decl: decl_abi decl_func ( decl_args ) ; - */ -PARSE_TYPED(decl, decl, - TYPED(decl_abi, abi) - TYPED(decl_func, func) - TOKEN(LPAREN) - TYPED(decl_args, args) - TOKEN(RPAREN) - TOKEN(EOS)) { - decl = psi_decl_init(abi, func, args); -} - -/* - * decl: decl_abi decl_func ( decl_args , ... ) ; - */ -PARSE_TYPED(decl, decl, - TYPED(decl_abi, abi) - TYPED(decl_func, func) - TOKEN(LPAREN) - TYPED(decl_args, args) - TOKEN(COMMA) - TOKEN(ELLIPSIS) - TOKEN(RPAREN) - TOKEN(EOS)) { - decl = psi_decl_init(abi, func, args); - decl->varargs = 1; -} - -/* - * decl_func: decl_arg - */ -PARSE_TYPED(decl_func, func, - TYPED(decl_arg, arg)) { - func = arg; -} - -/* special case for void functions */ -/* - * decl_func: VOID NAME - */ -PARSE_TYPED(decl_func, func, - NAMED(VOID, T) - NAMED(NAME, N)) { - func = psi_decl_arg_init( - psi_decl_type_init(T->type, T->text), - psi_decl_var_init(N->text, 0, 0) - ); - func->type->token = T; - func->var->token = N; - func->token = N; -} - -/* - * decl_typedef_body: VOID indirection ( indirection NAME ) decl_typedef_body_fn_args - */ -PARSE_TYPED(decl_typedef_body, def, - NAMED(VOID, T) - TYPED(indirection, decl_i) - TOKEN(LPAREN) - TYPED(indirection, type_i) - NAMED(NAME, N) - TOKEN(RPAREN) - TYPED(decl_typedef_body_fn_args, args)) { - struct psi_decl_arg *func_ = psi_decl_arg_init( - psi_decl_type_init(T->type, T->text), - psi_decl_var_init(N->text, decl_i, 0) - ); - func_->type->token = T; - func_->var->token = N; - func_->token = N; - - def = psi_decl_arg_init( - psi_decl_type_init(PSI_T_FUNCTION, func_->var->name), - psi_decl_var_copy(func_->var) - ); - def->var->pointer_level = type_i; - def->type->token = psi_token_copy(func_->token); - def->type->real.func = psi_decl_init(psi_decl_abi_init("default"), func_, args); -} - -/* - * decl_typedef_body: CONST VOID pointers ( indirection NAME ) decl_typdef_body_fn_args - */ -PARSE_TYPED(decl_typedef_body, def, - TOKEN(CONST) - NAMED(VOID, T) - TYPED(pointers, decl_i) - TOKEN(LPAREN) - TYPED(indirection, type_i) - NAMED(NAME, N) - TOKEN(RPAREN) - TYPED(decl_typedef_body_fn_args, args)) { - struct psi_decl_arg *func_ = psi_decl_arg_init( - psi_decl_type_init(T->type, T->text), - psi_decl_var_init(N->text, decl_i, 0) - ); - func_->type->token = T; - func_->var->token = N; - func_->token = N; - - def = psi_decl_arg_init( - psi_decl_type_init(PSI_T_FUNCTION, func_->var->name), - psi_decl_var_copy(func_->var) - ); - def->var->pointer_level = type_i; - def->type->token = psi_token_copy(func_->token); - def->type->real.func = psi_decl_init(psi_decl_abi_init("default"), func_, args); -} - -/* - * decl_abi: NAME - */ -PARSE_TYPED(decl_abi, abi, - NAMED(NAME, T)) { - abi = psi_decl_abi_init(T->text); - abi->token = T; -} - -/* - * decl_var_array_size: - */ -PARSE_NAMED(decl_var_array_size, as, ) { - as = NULL; -} - -/* - * decl_var_array_size: [ NUMBER ] - */ -PARSE_NAMED(decl_var_array_size, as, - TOKEN(LBRACKET) - NAMED(NUMBER, D) - TOKEN(RBRACKET)) { - as = D; -} - -/* - * decl_var: NAME decl_var_array_size - */ -PARSE_TYPED(decl_var, var, - NAMED(NAME, T) - NAMED(decl_var_array_size, as)) { - var = psi_decl_var_init(T->text, 0, as?atol(as->text):0); - var->token = T; - if (as) { - free(as); - } -} - -/* - * decl_var: pointers NAME - */ -PARSE_TYPED(decl_var, var, - TYPED(pointers, p) - NAMED(NAME, T) - NAMED(decl_var_array_size, as)) { - var = psi_decl_var_init(T->text, p+!!as, as?atol(as->text):0); - var->token = T; - if (as) { - free(as); - } -} - -/* - * decl_vars: decl_var - */ -PARSE_TYPED(decl_vars, vars, - TYPED(decl_var, var)) { - vars = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_var_free), - &var); -} - -/* - * decl_vars: decl_vars , decl_var - */ -PARSE_TYPED(decl_vars, vars, - TYPED(decl_vars, vars_) - TOKEN(COMMA) - TYPED(decl_var, var)) { - vars = psi_plist_add(vars_, &var); -} - -/* - * decl_arg: const_decl_type decl_var - */ -PARSE_TYPED(decl_arg, arg_, - TYPED(const_decl_type, type) - TYPED(decl_var, var)) { - arg_ = psi_decl_arg_init(type, var); -} - -/* - * decl_typedef_body: const_decl_type indirection ( indirection NAME ) decl_typedef_body_fn_args - */ -PARSE_TYPED(decl_typedef_body, def, - TYPED(const_decl_type, type_) - TYPED(indirection, decl_i) - TOKEN(LPAREN) - TYPED(indirection, type_i) - NAMED(NAME, N) - TOKEN(RPAREN) - TYPED(decl_typedef_body_fn_args, args)) { - struct psi_decl_arg *func_ = psi_decl_arg_init( - type_, - psi_decl_var_init(N->text, decl_i, 0) - ); - func_->var->token = N; - func_->token = N; - - def = psi_decl_arg_init( - psi_decl_type_init(PSI_T_FUNCTION, func_->var->name), - psi_decl_var_copy(func_->var) - ); - def->var->pointer_level = type_i; - def->type->token = psi_token_copy(func_->token); - def->type->real.func = psi_decl_init(psi_decl_abi_init("default"), func_, args); -} - -/* void pointers need a specific rule */ -/* - * decl_arg: VOID pointers NAME - */ -PARSE_TYPED(decl_arg, arg_, - NAMED(VOID, T) - TYPED(pointers, p) - NAMED(NAME, N)) { - arg_ = psi_decl_arg_init( - psi_decl_type_init(T->type, T->text), - psi_decl_var_init(N->text, p, 0) - ); - arg_->type->token = T; - arg_->var->token = N; - arg_->token = N; -} - -/* - * decl_args: CONST VOID pointers NAME - */ -PARSE_TYPED(decl_arg, arg_, - TOKEN(CONST) - NAMED(VOID, T) - TYPED(pointers, p) - NAMED(NAME, N)) { - arg_ = psi_decl_arg_init( - psi_decl_type_init(T->type, T->text), - psi_decl_var_init(N->text, p, 0) - ); - arg_->type->token = T; - arg_->var->token = N; - arg_->token = N; -} - -/* - * decl_args: - */ -PARSE_TYPED(decl_args, args, ) { - args = NULL; -} - -/* - * decl_args: VOID - */ -PARSE_TYPED(decl_args, args, - TOKEN(VOID)) { - args = NULL; -} - -/* - * decl_args: decl_arg - */ -PARSE_TYPED(decl_args, args, - TYPED(decl_arg, arg)) { - args = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_arg_free), - &arg); -} - -/* - * decl_args: decl_args , decl_arg - */ -PARSE_TYPED(decl_args, args, - TYPED(decl_args, args_) - TOKEN(COMMA) - TYPED(decl_arg, arg)) { - args = psi_plist_add(args_, &arg); -} - -/* - * struct_args: struct_arg - */ -PARSE_TYPED(struct_args, args, - TYPED(struct_arg, arg)) { - args = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_arg_free), - &arg); -} - -/* - * struct_args: struct_args , struct_arg - */ -PARSE_TYPED(struct_args, args, - TYPED(struct_args, args_) - TYPED(struct_arg, arg)) { - args = psi_plist_add(args_, &arg); -} - -/* - * struct_arg: decl_typedef_body_ex ; - */ -PARSE_TYPED(struct_arg, arg_, - TYPED(decl_typedef_body_ex, def) - TOKEN(EOS)) { - arg_ = def; - switch (def->type->type) { - case PSI_T_STRUCT: - if (def->type->real.strct) { - if (!P->structs) { - P->structs = psi_plist_init((psi_plist_dtor) psi_decl_struct_free); - } - P->structs = psi_plist_add(P->structs, &def->type->real.strct); - } - break; - case PSI_T_UNION: - if (def->type->real.unn) { - if (!P->unions) { - P->unions = psi_plist_init((psi_plist_dtor) psi_decl_union_free); - } - P->unions = psi_plist_add(P->unions, &def->type->real.unn); - } - break; - case PSI_T_ENUM: - if (def->type->real.enm) { - if (!P->enums) { - P->enums = psi_plist_init((psi_plist_dtor) psi_decl_enum_free); - } - P->enums = psi_plist_add(P->enums, &def->type->real.enm); - } - break; - } -} - -/* - * struct_arg: decl_arg decl_layout ; - */ -PARSE_TYPED(struct_arg, arg, - TYPED(decl_arg, arg_) - TYPED(decl_layout, layout_) - TOKEN(EOS)) { - arg_->layout = layout_; - arg = arg_; -} - -/* - * decl_layout: - */ -PARSE_TYPED(decl_layout, layout, ) { - layout = NULL; -} - -/* - * decl_layout: :: ( NUMBER , NUMBER ) - */ -PARSE_TYPED(decl_layout, layout, - TOKEN(COLON) - TOKEN(COLON) - TOKEN(LPAREN) - NAMED(NUMBER, POS) - TOKEN(COMMA) - NAMED(NUMBER, SIZ) - TOKEN(RPAREN)) { - layout = psi_layout_init(atol(POS->text), atol(SIZ->text)); - free(POS); - free(SIZ); -} - -/* un/signed, urgh */ -/* - * decl_scalar_type: CHAR - */ -PARSE_NAMED(decl_scalar_type, type_, - NAMED(CHAR, C)) { - type_ = C; -} - -/* - * decl_scalar_type: SHORT decl_scalar_type_short - */ -PARSE_NAMED(decl_scalar_type, type_, - NAMED(SHORT, S) - NAMED(decl_scalar_type_short, s)) { - if (s) { - type_ = psi_token_cat(" ", 2, S, s); - free(S); - free(s); - } else { - type_ = S; - } -} - -/* - * decl_scalar_type_short: - */ -PARSE_NAMED(decl_scalar_type_short, s, ) { - s = NULL; -} - -/* - * decl_scalar_type_short: INT - */ -PARSE_NAMED(decl_scalar_type_short, s, - NAMED(INT, I)) { - s = I; -} - -/* - * decl_sclara_type: INT - */ -PARSE_NAMED(decl_scalar_type, type_, - NAMED(INT, I)) { - type_ = I; -} - -/* - * decl_scalar_type: LONG decl_scalar_type_long - */ -PARSE_NAMED(decl_scalar_type, type_, - NAMED(LONG, L) - NAMED(decl_scalar_type_long, l)) { - if (l) { - type_ = psi_token_cat(" ", 2, L, l); - free(L); - free(l); - } else { - type_ = L; - } -} - -/* - * decl_scalar_type_long: - */ -PARSE_NAMED(decl_scalar_type_long, l, ) { - l = NULL; -} - -/* - * decl_scalar_type_long: DOUBLE - */ -PARSE_NAMED(decl_scalar_type_long, l, - NAMED(DOUBLE, D)) { - l = D; -} - -/* - * decl_scalar_type_long: LONG decl_scalar_type_long_long - */ -PARSE_NAMED(decl_scalar_type_long, l, - NAMED(LONG, L) - NAMED(decl_scalar_type_long_long, ll)) { - if (ll) { - l = psi_token_cat(" ", 2, L, ll); - free(L); - free(ll); - } else { - l = L; - } -} - -/* - * decl_scalar_type_long_long: - */ -PARSE_NAMED(decl_scalar_type_long_long, ll, ) { - ll = NULL; -} - -/* - * decl_scalar_type_long_long: INT - */ -PARSE_NAMED(decl_scalar_type_long_long, ll, - NAMED(INT, I)) { - ll = I; -} - -/* - * decl_type: UNSIGNED decl_scalar_type - */ -PARSE_TYPED(decl_type, type_, - NAMED(UNSIGNED, U) - NAMED(decl_scalar_type, N)) { - struct psi_token *T = psi_token_cat(" ", 2, U, N); - type_ = psi_decl_type_init(T->type, T->text); - type_->token = T; - free(U); - free(N); -} - -/* - * decl_type: SIGNED decl_scalar_type - */ -PARSE_TYPED(decl_type, type_, - NAMED(SIGNED, S) - NAMED(decl_scalar_type, N)) { - struct psi_token *T = psi_token_cat(" ", 2, S, N); - type_ = psi_decl_type_init(T->type, T->text); - type_->token = T; - free(S); - free(N); -} - -/* - * decl_type: UNSIGNED - */ -PARSE_TYPED(decl_type, type_, - NAMED(UNSIGNED, U)) { - type_ = psi_decl_type_init(PSI_T_NAME, U->text); - type_->token = U; -} - -/* - * decl_type: SIGNED - */ -PARSE_TYPED(decl_type, type_, - NAMED(SIGNED, S)) { - type_ = psi_decl_type_init(PSI_T_NAME, S->text); - type_->token = S; -} - -/* - * decl_type: decl_scalar_type - */ -PARSE_TYPED(decl_type, type_, - NAMED(decl_scalar_type, N)) { - type_ = psi_decl_type_init(N->type, N->text); - type_->token = N; -} - -/* structs ! */ -/* - * decl_type: STRUCT NAME - */ -PARSE_TYPED(decl_type, type_, - NAMED(STRUCT, S) - NAMED(NAME, T)) { - type_ = psi_decl_type_init(S->type, T->text); - type_->token = T; - free(S); -} - -/* - * decl_type: UNION NAME - */ -PARSE_TYPED(decl_type, type_, - NAMED(UNION, U) - NAMED(NAME, T)) { - type_ = psi_decl_type_init(U->type, T->text); - type_->token = T; - free(U); -} - -/* - * decl_type: ENUM NAME - */ -PARSE_TYPED(decl_type, type_, - NAMED(ENUM, E) - NAMED(NAME, T)) { - type_ = psi_decl_type_init(E->type, T->text); - type_->token = T; - free(E); -} - -/* - * decl_type: decl_type_token - */ -PARSE_TYPED(decl_type, type_, - NAMED(decl_type_token, T)) { - type_ = psi_decl_type_init(T->type, T->text); - type_->token = T; -} - -/* - * const_decl_type: decl_type - */ -PARSE_TYPED(const_decl_type, type, - TYPED(decl_type, type_)) { - type = type_; -} - -/* - * const_decl_type: CONST decl_type - */ -PARSE_TYPED(const_decl_type, type, - TOKEN(CONST) - TYPED(decl_type, type_)) { - type = type_; -} - -/* - * impl: impl_func { impl_stmts } - */ -PARSE_TYPED(impl, impl, - TYPED(impl_func, func) - TOKEN(LBRACE) - TYPED(impl_stmts, stmts) - TOKEN(RBRACE)) { - impl = psi_impl_init(func, stmts); -} - -/* - * impl: STATIC impl_func { impl_stmts } - */ -PARSE_TYPED(impl, impl, - TOKEN(STATIC) - TYPED(impl_func, func) - TOKEN(LBRACE) - TYPED(impl_stmts, stmts) - TOKEN(RBRACE)) { - func->static_memory = 1; - impl = psi_impl_init(func, stmts); -} - -/* - * impl_func: FUNCTION reference NSNAME ( ) : impl_type - */ -PARSE_TYPED(impl_func, func, - TOKEN(FUNCTION) - TYPED(reference, r) - NAMED(NSNAME, NAME) - TOKEN(LPAREN) - TOKEN(RPAREN) - TOKEN(COLON) - TYPED(impl_type, type)) { - func = psi_impl_func_init(NAME->text, NULL, type); - func->token = NAME; - func->return_reference = r; -} - -/* - * impl_func: FUNCTION reference NSNAME ( impl_args ) : impl_type - */ -PARSE_TYPED(impl_func, func, - TOKEN(FUNCTION) - TYPED(reference, r) - NAMED(NSNAME, NAME) - TOKEN(LPAREN) - TYPED(impl_args, args) - TOKEN(RPAREN) - TOKEN(COLON) - TYPED(impl_type, type)) { - func = psi_impl_func_init(NAME->text, args, type); - func->token = NAME; - func->return_reference = r; -} - -/* - * impl_func: FUNCTION reference NSNAME ( impl_args , impl_type reference ... DOLLAR_NAME ) : impl_type - */ -PARSE_TYPED(impl_func, func, - TOKEN(FUNCTION) - TYPED(reference, func_r) - NAMED(NSNAME, NAME) - TOKEN(LPAREN) - TYPED(impl_args, args) - TOKEN(COMMA) - TYPED(impl_type, va_type) - TYPED(reference, va_r) - TOKEN(ELLIPSIS) - NAMED(DOLLAR_NAME, T) - TOKEN(RPAREN) - TOKEN(COLON) - TYPED(impl_type, func_type)) { - func = psi_impl_func_init(NAME->text, args, func_type); - func->token = NAME; - func->return_reference = func_r; - func->vararg = psi_impl_arg_init(va_type, psi_impl_var_init(T->text, va_r), NULL); - free(T); -} - -/* - * impl_def_val: impl_def_val_token - */ -PARSE_TYPED(impl_def_val, def, - NAMED(impl_def_val_token, T)) { - def = psi_impl_def_val_init(T->type, T->text); - def->token = T; -} - -/* - * impl_var: reference DOLLAR_NAME - */ -PARSE_TYPED(impl_var, var, - TYPED(reference, r) - NAMED(DOLLAR_NAME, T)) { - var = psi_impl_var_init(T->text, r); - var->token = T; -} - -/* - * impl_type: impl_type_token - */ -PARSE_TYPED(impl_type, type_, - NAMED(impl_type_token, T)) { - type_ = psi_impl_type_init(T->type, T->text); - free(T); -} - -/* - * impl_arg: impl_type impl_var - */ -PARSE_TYPED(impl_arg, arg, - TYPED(impl_type, type) - TYPED(impl_var, var)) { - arg = psi_impl_arg_init(type, var, NULL); -} - -/* - * impl_arg: impl_type impl_var = impl_def_val - */ -PARSE_TYPED(impl_arg, arg, - TYPED(impl_type, type) - TYPED(impl_var, var) - TOKEN(EQUALS) - TYPED(impl_def_val, def)) { - arg = psi_impl_arg_init(type, var, def); -} - -/* - * impl_args: impl_arg - */ -PARSE_TYPED(impl_args, args, - TYPED(impl_arg, arg)) { - args = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_impl_arg_free), - &arg); -} - -/* - * impl_args: impl_args , impl_arg - */ -PARSE_TYPED(impl_args, args, - TYPED(impl_args, args_) - TOKEN(COMMA) - TYPED(impl_arg, arg)) { - args = psi_plist_add(args_, &arg); -} - -/* - * impl_stmts: impl_stmt - */ -PARSE_TYPED(impl_stmts, stmts, - TYPED(impl_stmt, stmt)) { - stmts = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_impl_stmt_free), - &stmt); -} - -/* - * impl_stmts: impl_stmts , impl_stmt - */ -PARSE_TYPED(impl_stmts, stmts, - TYPED(impl_stmts, stmts_) - TYPED(impl_stmt, stmt)) { - stmts = psi_plist_add(stmts_, &stmt); -} - -/* - * impl_stmt: return_stmt - */ -PARSE_TYPED(impl_stmt, i, - TYPED(return_stmt, r)) { - i = (struct psi_token**) r; -} - -/* - * impl_stmt: let_stmt - */ -PARSE_TYPED(impl_stmt, i, - TYPED(let_stmt, l)) { - i = (struct psi_token**) l; -} - -/* - * impl_stmt: set_stmt - */ -PARSE_TYPED(impl_stmt, i, - TYPED(set_stmt, s)) { - i = (struct psi_token**) s; -} - -/* - * impl_stmt: assert_stmt - */ -PARSE_TYPED(impl_stmt, i, - TYPED(assert_stmt, s)) { - i = (struct psi_token **) s; -} - -/* - * impl_stmt: free_stmt - */ -PARSE_TYPED(impl_stmt, i, - TYPED(free_stmt, f)) { - i = (struct psi_token**) f; -} - -/* - * number: number_token - */ -PARSE_TYPED(number, exp, - NAMED(number_token, tok)) { - exp = psi_number_init(tok->type, tok->text); - exp->token = tok; -} - -/* - * number: decl_var - */ -PARSE_TYPED(number, exp, - TYPED(decl_var, var)) { - exp = psi_number_init(PSI_T_NAME, var); - exp->token = psi_token_copy(var->token); -} - -/* - * num_exp: number - */ -PARSE_TYPED(num_exp, exp, - TYPED(number, num)) { - exp = psi_num_exp_init_num(num); - exp->token = psi_token_copy(num->token); -} - -/* - * num_exp: ( num_exp ) - */ -PARSE_TYPED(num_exp, exp, - NAMED(LPAREN, L) - TYPED(num_exp, exp_) - TOKEN(RPAREN)) { - exp = psi_num_exp_init_unary(PSI_T_LPAREN, exp_); - exp->token = L; -} - -/* - * num_exp: num_exp binary_op_token num_exp - */ -PARSE_TYPED(num_exp, exp, - TYPED(num_exp, lhs_) - NAMED(binary_op_token, OP) - TYPED(num_exp, rhs_)) { - exp = psi_num_exp_init_binary(OP->type, lhs_, rhs_); - exp->token = OP; -} - -/* - * num_exp: unary_op_token num_exp - */ -PARSE_TYPED(num_exp, exp, - NAMED(unary_op_token, OP) - TYPED(num_exp, exp_)) { - exp = psi_num_exp_init_unary(OP->type, exp_); - exp->token = OP; -} - -/* - * let_exp: NULL - */ -PARSE_TYPED(let_exp, val, - TOKEN(NULL)) { - val = psi_let_exp_init(PSI_LET_NULL, NULL); -} - -/* - * let_exp: & NULL - */ -PARSE_TYPED(let_exp, val, - TOKEN(AMPERSAND) - TOKEN(NULL)) { - val = psi_let_exp_init(PSI_LET_NULL, NULL); - val->is_reference = 1; -} - -/* - * let_exp: callback - */ -PARSE_TYPED(let_exp, val, - TYPED(let_callback, cb)) { - val = psi_let_exp_init(PSI_LET_CALLBACK, cb); -} - -/* - * let_exp: calloc - */ -PARSE_TYPED(let_exp, val, - TYPED(let_calloc, ca)) { - val = psi_let_exp_init(PSI_LET_CALLOC, ca); -} - -/* - * let_exp: & calloc - */ -PARSE_TYPED(let_exp, val, - TOKEN(AMPERSAND) - TYPED(let_calloc, ca)) { - val = psi_let_exp_init(PSI_LET_CALLOC, ca); - val->is_reference = 1; -} - -/* - * let_exp: func - */ -PARSE_TYPED(let_exp, val, - TYPED(let_func, fn)) { - val = psi_let_exp_init_ex(NULL, PSI_LET_FUNC, fn); -} - -/* - * let_exp: & func - */ -PARSE_TYPED(let_exp, val, - TOKEN(AMPERSAND) - TYPED(let_func, fn)) { - val = psi_let_exp_init_ex(NULL, PSI_LET_FUNC, fn); - val->is_reference = 1; -} - -/* - * let_exp: num_exp - */ -PARSE_TYPED(let_exp, val, - TYPED(num_exp, exp)) { - val = psi_let_exp_init_ex(NULL, PSI_LET_NUMEXP, exp); -} - -/* - * let_exp: & num_exp - */ -PARSE_TYPED(let_exp, val, - TOKEN(AMPERSAND) - TYPED(num_exp, exp)) { - val = psi_let_exp_init_ex(NULL, PSI_LET_NUMEXP, exp); - val->is_reference = 1; -} - -/* FIXME - * let_exp: decl_var = let_exp - */ -PARSE_TYPED(let_exp, exp, - TYPED(decl_var, var_) - TOKEN(EQUALS) - TYPED(let_exp, val)) { - exp = val; - exp->var = var_; -} - -/* - * let_stmt: LET let_exp ; - */ -PARSE_TYPED(let_stmt, let, - NAMED(LET, T) - TYPED(let_exp, val) - TOKEN(EOS)) { - let = psi_let_stmt_init(val); - let->token = T; -} - -/* - * let_stmt: TEMP decl_var = reference decl_var ; - */ -PARSE_TYPED(let_stmt, let, - NAMED(TEMP, T) - TYPED(decl_var, var) - TOKEN(EQUALS) - TYPED(reference, r) - TYPED(decl_var, val_) - TOKEN(EOS)) { - let = psi_let_stmt_init(psi_let_exp_init_ex(var, PSI_LET_TMP, val_)); - let->token = T; - let->exp->is_reference = r ? 1 : 0; -} - -/* - * let_callback: CALLBACK callback_rval ( impl_var ( callback_arg_lists ) ) - */ -PARSE_TYPED(let_callback, cb, - NAMED(CALLBACK, T) - NAMED(callback_rval, F) - TOKEN(LPAREN) - TYPED(impl_var, var) - TOKEN(LPAREN) - TYPED(callback_arg_list, args_) - TOKEN(RPAREN) - TOKEN(RPAREN)) { - cb = psi_let_callback_init(psi_let_func_init(F->type, F->text, var), args_); - cb->token = T; - free(F); -} - -/* - * let_calloc: CALLOC ( num_exp , num_exp ) - */ -PARSE_TYPED(let_calloc, alloc, - NAMED(CALLOC, T) - TOKEN(LPAREN) - TYPED(num_exp, nmemb) - TOKEN(COMMA) - TYPED(num_exp, size) - TOKEN(RPAREN)) { - alloc = psi_let_calloc_init(nmemb, size); - alloc->token = T; -} - -/* - * let_func: let_func_token ( impl_var ) - */ -PARSE_TYPED(let_func, func, - NAMED(let_func_token, T) - TOKEN(LPAREN) - TYPED(impl_var, var) - TOKEN(RPAREN)) { - func = psi_let_func_init(T->type, T->text, var); - func->token = T; -} -/* - * let_func: let_func_token ( impl_var , let_exps ) - */ -PARSE_TYPED(let_func, func, - NAMED(let_func_token, T) - TOKEN(LPAREN) - TYPED(impl_var, var) - TOKEN(COMMA) - TYPED(let_exps, vals) - TOKEN(RPAREN)) { - func = psi_let_func_init(T->type, T->text, var); - func->token = T; - func->inner = vals; -} -/* - * let_exps: let_exp - */ -PARSE_TYPED(let_exps, exps, - TYPED(let_exp, exp)) { - exps = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_let_exp_free), - &exp); -} -/* - * let_exps: let_exps , let_exp - */ -PARSE_TYPED(let_exps, exps, - TYPED(let_exps, exps_) - TOKEN(COMMA) - TYPED(let_exp, exp)) { - exps = psi_plist_add(exps_, &exp); -} - -/* - * callback_arg_list: - */ -PARSE_TYPED(callback_arg_list, args, ) { - args = NULL; -} - -/* - * callback_arg_list: callback_args - */ -PARSE_TYPED(callback_arg_list, args, - TYPED(callback_args, args_)) { - args = args_; -} - -/* - * callback_args: set_exp - */ -PARSE_TYPED(callback_args, args, - TYPED(set_exp, val)) { - args = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_set_exp_free), - &val); -} - -/* - * callback_args: callback_args , set_exp - */ -PARSE_TYPED(callback_args, args, - TYPED(callback_args, args_) - TOKEN(COMMA) - TYPED(set_exp, val)) { - args = psi_plist_add(args_, &val); -} - -/* - * callback_rval: let_func_token - */ -PARSE_NAMED(callback_rval, rval, - NAMED(let_func_token, F)) { - rval = F; -} - -/* - * callback_rval: VOID - */ -PARSE_NAMED(callback_rval, rval, - NAMED(VOID, V)) { - rval = V; -} - - -/* - * set_func: set_func_token ( decl_var ) - */ -PARSE_TYPED(set_func, func, - NAMED(set_func_token, T) - TOKEN(LPAREN) - TYPED(decl_var, var) - TOKEN(RPAREN)) { - func = psi_set_func_init(T->type, T->text, var); - func->token = T; -} - -/* - * set_func: set_func_token ( decl_var , set_exps ) - */ -PARSE_TYPED(set_func, func, - NAMED(set_func_token, T) - TOKEN(LPAREN) - TYPED(decl_var, var) - TOKEN(COMMA) - TYPED(set_exps, vals) - TOKEN(RPAREN)) { - func = psi_set_func_init(T->type, T->text, var); - func->token = T; - func->inner = vals; -} - -/* - * set_func: set_func_token ( decl_var , ... ) - */ -PARSE_TYPED(set_func, func, - NAMED(set_func_token, T) - TOKEN(LPAREN) - TYPED(decl_var, var) - TOKEN(COMMA) - TOKEN(ELLIPSIS) - TOKEN(RPAREN)) { - func = psi_set_func_init(T->type, T->text, var); - func->token = T; - func->recursive = 1; -} - -/* - * set_exp: set_func - */ -PARSE_TYPED(set_exp, val, - TYPED(set_func, fn)) { - val = psi_set_exp_init(PSI_SET_FUNC, fn); -} - -/* - * set_exp: num_exp - */ -PARSE_TYPED(set_exp, val, - TYPED(num_exp, num)) { - val = psi_set_exp_init(PSI_SET_NUMEXP, num); -} - -/* - * set_exps: set_exp - */ -PARSE_TYPED(set_exps, exps, - TYPED(set_exp, exp)) { - exps = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_set_exp_free), - &exp); -} - -/* - * set_exps: set_exps , set_exp - */ -PARSE_TYPED(set_exps, exps, - TYPED(set_exps, exps_) - TOKEN(COMMA) - TYPED(set_exp, exp)) { - exps = psi_plist_add(exps_, &exp); -} - -/* FIXME - * set_exp: impl_var = set_exp - */ -PARSE_TYPED(set_exp, exp, - TYPED(impl_var, var_) - TOKEN(EQUALS) - TYPED(set_exp, val)) { - exp = val; - exp->var = var_; -} - -/* - * set_stmt: SET set_exp ; - */ -PARSE_TYPED(set_stmt, set, - NAMED(SET, T) - TYPED(set_exp, exp) - TOKEN(EOS)) { - set = psi_set_stmt_init(exp); - set->token = T; -} - -/* - * return_stmt: RETURN set_exp ; - */ -PARSE_TYPED(return_stmt, ret, - NAMED(RETURN, T) - TYPED(set_func, func) - TOKEN(EOS)) { - ret = psi_return_stmt_init(psi_set_exp_init(PSI_SET_FUNC, func)); - ret->token = T; -} - -/* - * free_stmt: FREE free_exps ; - */ -PARSE_TYPED(free_stmt, free, - NAMED(FREE, T) - TYPED(free_exps, calls) - TOKEN(EOS)) { - free = psi_free_stmt_init(calls); - free->token = T; -} - -/* - * free_exps: free_exp - */ -PARSE_TYPED(free_exps, calls, - TYPED(free_exp, call)) { - calls = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_free_exp_free), - &call); -} - -/* - * free_exps: free_exps , free_exp - */ -PARSE_TYPED(free_exps, calls, - TYPED(free_exps, calls_) - TOKEN(COMMA) - TYPED(free_exp, call)) { - calls = psi_plist_add(calls_, &call); -} - -/* - * free_exp: NAME ( decl_vars ) - */ -PARSE_TYPED(free_exp, call, - NAMED(NAME, F) - TOKEN(LPAREN) - TYPED(decl_vars, vars) - TOKEN(RPAREN)) { - call = psi_free_exp_init(F->text, vars); - call->token = F; -} - -/* - * assert_stmt: assert_stmt_token num_exp ; - */ -PARSE_TYPED(assert_stmt, ass, - NAMED(assert_stmt_token, T) - TYPED(num_exp, exp) - TOKEN(EOS)) { - ass = psi_assert_stmt_init(T->type, exp); - ass->token = T; -} - -/* - * reference: - */ -PARSE_TYPED(reference, r, ) { - r = false; -} - -/* - * reference: & - */ -PARSE_TYPED(reference, r, - TOKEN(AMPERSAND)) { - r = true; -} - -/* - * indirection: - */ -PARSE_TYPED(indirection, i, ){ - i = 0; -} - -/* - * indirection: pointers - */ -PARSE_TYPED(indirection, i, - TYPED(pointers, p)) { - i = p; -} - -/* - * pointers: * - */ -PARSE_TYPED(pointers, p, - TOKEN(ASTERISK)) { - p = 1; -} - -/* - * pointers: pointers * - */ -PARSE_TYPED(pointers, p, - TYPED(pointers, p_) - TOKEN(ASTERISK)) { - p = p_+1; -} diff --git a/src/parser_proc_grammar.y b/src/parser_proc_grammar.y new file mode 100644 index 0000000..30bc959 --- /dev/null +++ b/src/parser_proc_grammar.y @@ -0,0 +1,1690 @@ +%code top { +#include "php_psi_stdinc.h" +} + +%code { +#include +#include + +#include "plist.h" +#include "parser.h" +#define YYDEBUG 1 + +static int psi_parser_proc_lex(YYSTYPE *u, struct psi_parser *P, struct psi_plist *tokens, size_t *index); +static void psi_parser_proc_error(struct psi_parser *P, struct psi_plist *tokens, size_t *index, const char *msg); + +static inline void psi_parser_proc_add_struct(struct psi_parser *P, struct psi_decl_struct *strct) +{ + assert(strct); + if (!P->structs) { + P->structs = psi_plist_init((psi_plist_dtor) psi_decl_struct_free); + } + P->structs = psi_plist_add(P->structs, &strct); +} +static inline void psi_parser_proc_add_union(struct psi_parser *P, struct psi_decl_union *u) +{ + assert(u); + if (!P->unions) { + P->unions = psi_plist_init((psi_plist_dtor) psi_decl_union_free); + } + P->unions = psi_plist_add(P->unions, &u); +} +static inline void psi_parser_proc_add_enum(struct psi_parser *P, struct psi_decl_enum *e) +{ + assert(e); + if (!P->enums) { + P->enums = psi_plist_init((psi_plist_dtor) psi_decl_enum_free); + } + P->enums = psi_plist_add(P->enums, &e); +} +static inline void psi_parser_proc_add_from_typedef(struct psi_parser *P, struct psi_decl_arg *def) +{ + if (def->type->real.def) { + switch (def->type->type) { + case PSI_T_STRUCT: + psi_parser_proc_add_struct(P, def->type->real.strct); + break; + case PSI_T_UNION: + psi_parser_proc_add_union(P, def->type->real.unn); + break; + case PSI_T_ENUM: + psi_parser_proc_add_enum(P, def->type->real.enm); + break; + default: + break; + } + } +} +static inline void psi_parser_proc_add_typedef(struct psi_parser *P, struct psi_decl_arg *def) +{ + assert(def); + if (!P->types) { + P->types = psi_plist_init((psi_plist_dtor) psi_decl_arg_free); + } + P->types = psi_plist_add(P->types, &def); + + psi_parser_proc_add_from_typedef(P, def); +} +static inline void psi_parser_proc_add_const(struct psi_parser *P, struct psi_const *cnst) { + assert(cnst); + if (!P->consts) { + P->consts = psi_plist_init((psi_plist_dtor) psi_const_free); + } + P->consts = psi_plist_add(P->consts, &cnst); + +} +static inline void psi_parser_proc_add_decl(struct psi_parser *P, struct psi_decl *decl) { + assert(decl); + if (!P->decls) { + P->decls = psi_plist_init((psi_plist_dtor) psi_decl_free); + } + P->decls = psi_plist_add(P->decls, &decl); +} +static inline void psi_parser_proc_add_impl(struct psi_parser *P, struct psi_impl *impl) { + assert(impl); + if (!P->impls) { + P->impls = psi_plist_init((psi_plist_dtor) psi_impl_free); + } + P->impls = psi_plist_add(P->impls, &impl); +} + +/* end code */ +} + +%code requires { +#include "plist.h" +#include "types/layout.h" + +struct psi_parser; + +} + +%require "3.0" +%language "c" +%name-prefix "psi_parser_proc_" +%token-table +%verbose +%glr-parser + +%param {struct psi_parser *P} {struct psi_plist *tokens} {size_t *index} + +%define api.pure true +%define api.token.prefix {PSI_T_} +%define api.value.type union + +%define parse.error verbose +%define parse.trace true + +%initial-action { +} + +%start file + +%token BOOL +%token CHAR +%token SHORT +%token INT +%token SIGNED +%token UNSIGNED +%token LONG +%token FLOAT +%token DOUBLE +%token STRING +%token MIXED +%token ARRAY +%token OBJECT +%token CALLABLE +%token VOID +%token ZVAL +%token INT8 +%token UINT8 +%token INT16 +%token UINT16 +%token INT32 +%token UINT32 +%token INT64 +%token UINT64 +%token NULL +%token TRUE +%token FALSE +%token NAME +%token NSNAME +%token DOLLAR_NAME +%token NUMBER +%token QUOTED_STRING +%token QUOTED_CHAR + +%token EOF 0 "end of file" +%token EOL "end of line" +%token EOS ";" +%token LPAREN "(" +%token RPAREN ")" +%token COMMA "," +%token COLON ":" +%token LBRACE "{" +%token RBRACE "}" +%token LBRACKET "[" +%token RBRACKET "]" +%token EQUALS "=" +%token HASH "#" +%token PIPE "|" +%token CARET "^" +%token AMPERSAND "&" +%token LSHIFT "<<" +%token RSHIFT ">>" +%token PLUS "+" +%token MINUS "-" +%token ASTERISK "*" +%token SLASH "/" +%token MODULO "%" +%token LCHEVR "<" +%token RCHEVR ">" +%token CMP_GE ">=" +%token CMP_LE "<=" +%token OR "||" +%token AND "&&" +%token CMP_EQ "==" +%token CMP_NE "!=" +%token TILDE "~" +%token NOT "!" +%token PERIOD "." +%token BACKSLASH "\\" +%token ELLIPSIS "..." + +%token ERROR +%token WARNING +%token IF +%token IFDEF +%token IFNDEF +%token ELSE +%token ELIF +%token ENDIF +%token DEFINE +%token DEFINED +%token UNDEF +%token IMPORT +%token INCLUDE +%token INCLUDE_NEXT + +%token TYPEDEF +%token STRUCT +%token UNION +%token ENUM +%token CONST +%token LIB +%token STATIC +%token CALLBACK +%token FUNCTION +%token LET +%token SET +%token TEMP +%token FREE +%token RETURN +%token PRE_ASSERT +%token POST_ASSERT +%token BOOLVAL +%token INTVAL +%token STRVAL +%token PATHVAL +%token STRLEN +%token FLOATVAL +%token ARRVAL +%token OBJVAL +%token COUNT +%token CALLOC +%token TO_BOOL +%token TO_INT +%token TO_STRING +%token TO_FLOAT +%token TO_ARRAY +%token TO_OBJECT + +%token COMMENT +%token WHITESPACE +%token NO_WHITESPACE +%token CPP_HEADER + +//%destructor {psi_token_free((struct psi_token **) &$$);} <> + +%precedence AND OR +%precedence PIPE +%precedence CARET +%precedence AMPERSAND +%precedence CMP_EQ CMP_NE +%precedence LCHEVR CMP_LE RCHEVR CMP_GE +%precedence LSHIFT RSHIFT +%precedence PLUS MINUS +%precedence ASTERISK SLASH MODULO +//%precedence NOT TILDE +%precedence BINARY +%precedence UNARY + +%type lib optional_name enum_name struct_name union_name +%destructor {psi_token_free(&$$);} lib optional_name enum_name struct_name union_name + +%type cpp_message_token cpp_include_token cpp_header_token cpp_no_arg_token cpp_name_arg_token cpp_exp_arg_token +%destructor {} cpp_message_token cpp_include_token cpp_header_token cpp_no_arg_token cpp_name_arg_token cpp_exp_arg_token + +%type name_token any_noeol_token binary_op_token unary_op_token +%destructor {} name_token any_noeol_token binary_op_token unary_op_token + +%type int_width int_width_types int_signed_types +%destructor {psi_token_free(&$$);} int_width int_width_types int_signed_types + +%type signed_long_types signed_short_types int_signed +%destructor {} signed_long_types signed_short_types int_signed + +%type cpp cpp_exp +%destructor {psi_cpp_exp_free(&$$);} cpp cpp_exp +%type cpp_macro_decl +%destructor {psi_cpp_macro_decl_free(&$$);} cpp_macro_decl +%type cpp_macro_sig cpp_macro_sig_args cpp_macro_decl_tokens cpp_macro_decl_token_list cpp_macro_call_args cpp_macro_call_arg_list +%destructor {psi_plist_free($$);} cpp_macro_sig cpp_macro_sig_args cpp_macro_decl_tokens cpp_macro_decl_token_list cpp_macro_call_args cpp_macro_call_arg_list +%type cpp_macro_exp +%destructor {psi_num_exp_free(&$$);} cpp_macro_exp + +%type constant_type_token impl_def_val_token +%destructor {} constant_type_token impl_def_val_token + +%type constant +%destructor {psi_const_free(&$$);} constant +%type constant_type +%destructor {psi_const_type_free(&$$);} constant_type +%type impl_def_val +%destructor {psi_impl_def_val_free(&$$);} impl_def_val + +%type decl_real_type decl_int_type decl_type_simple +%destructor {psi_token_free(&$$);} decl_real_type decl_int_type decl_type_simple + +%type decl_stdint_type +%destructor {} decl_stdint_type + +%type decl_type const_decl_type decl_type_complex +%destructor {psi_decl_type_free(&$$);} decl_type const_decl_type decl_type_complex +%type decl_stmt decl +%destructor {psi_decl_free(&$$);} decl_stmt decl +%type decl_typedef decl_fn decl_func decl_functor decl_arg struct_arg typedef +%destructor {psi_decl_arg_free(&$$);} decl_typedef decl_fn decl_func decl_functor decl_arg struct_arg typedef +%type decl_var +%destructor {psi_decl_var_free(&$$);} decl_var +%type decl_struct +%destructor {psi_decl_struct_free(&$$);} decl_struct +%type decl_union +%destructor {psi_decl_union_free(&$$);} decl_union +%type decl_enum +%destructor {psi_decl_enum_free(&$$);} decl_enum +%type decl_enum_item +%destructor {psi_decl_enum_item_free(&$$);} decl_enum_item +%type decl_args decl_struct_args struct_args_block struct_args decl_enum_items decl_vars +%destructor {psi_plist_free($$);} decl_args decl_struct_args struct_args_block struct_args decl_enum_items decl_vars + +%type align_and_size +%destructor {} align_and_size +%type decl_layout +%destructor {psi_layout_free(&$$);} decl_layout + +%type impl +%destructor {psi_impl_free(&$$);} impl +%type impl_func +%destructor {psi_impl_func_free(&$$);} impl_func +%type impl_arg +%destructor {psi_impl_arg_free(&$$);} impl_arg +%type impl_type +%destructor {psi_impl_type_free(&$$);} impl_type +%type impl_var +%destructor {psi_impl_var_free(&$$);} impl_var + +%type let_stmt +%destructor {psi_let_stmt_free(&$$);} let_stmt +%type let_exp let_exp_byref let_exp_assign +%destructor {psi_let_exp_free(&$$);} let_exp let_exp_byref let_exp_assign +%type let_calloc +%destructor {psi_let_calloc_free(&$$);} let_calloc +%type let_callback +%destructor {psi_let_callback_free(&$$);} let_callback +%type let_func +%destructor {psi_let_func_free(&$$);} let_func +%type set_stmt +%destructor {psi_set_stmt_free(&$$);} set_stmt +%type set_exp +%destructor {psi_set_exp_free(&$$);} set_exp +%type set_func +%destructor {psi_set_func_free(&$$);} set_func +%type assert_stmt +%destructor {psi_assert_stmt_free(&$$);} assert_stmt +%type return_stmt +%destructor {psi_return_stmt_free(&$$);} return_stmt +%type free_stmt +%destructor {psi_free_stmt_free(&$$);} free_stmt +%type free_exp +%destructor {psi_free_exp_free(&$$);} free_exp + +%type impl_stmt +%destructor {psi_impl_stmt_free(&$$);} impl_stmt +%type impl_type_token callback_rval let_func_token set_func_token assert_stmt_token +%destructor {psi_token_free(&$$);} impl_type_token callback_rval let_func_token set_func_token assert_stmt_token +%type impl_args impl_stmts let_exps let_func_exps callback_arg_list callback_args set_exps set_func_exps free_exps +%destructor {psi_plist_free($$);} impl_args impl_stmts let_exps let_func_exps callback_arg_list callback_args set_exps set_func_exps free_exps + +%type num_exp +%destructor {psi_num_exp_free(&$$);} num_exp +%type number +%destructor {psi_number_free(&$$);} number + +%type indirection pointers array_size +%destructor {} indirection pointers array_size +%type reference +%destructor {} reference + +//%destructor {} file blocks block + +%% + +/* rules */ + + +binary_op_token: PIPE | CARET | AMPERSAND | LSHIFT | RSHIFT | PLUS | MINUS | ASTERISK | SLASH | MODULO | RCHEVR | LCHEVR | CMP_GE | CMP_LE | OR | AND | CMP_EQ | CMP_NE ; +unary_op_token: TILDE | NOT | PLUS | MINUS ; +name_token: NAME | TEMP | FREE | SET | LET | CALLOC | CALLBACK | ZVAL | LIB | STRING | COUNT | ERROR | WARNING | BOOL ; +any_noeol_token: BOOL | CHAR | SHORT | INT | SIGNED | UNSIGNED | LONG | FLOAT | DOUBLE | STRING | MIXED | ARRAY | OBJECT | CALLABLE | VOID | ZVAL | INT8 | UINT8 | INT16 | UINT16 | INT32 | UINT32 | INT64 | UINT64 | NULL | TRUE | FALSE | NAME | NSNAME | DOLLAR_NAME | NUMBER | QUOTED_STRING | QUOTED_CHAR | EOF | EOS | LPAREN | RPAREN | COMMA | COLON | LBRACE | RBRACE | LBRACKET | RBRACKET | EQUALS | HASH | PIPE | CARET | AMPERSAND | LSHIFT | RSHIFT | PLUS | MINUS | ASTERISK | SLASH | MODULO | LCHEVR | RCHEVR | CMP_GE | CMP_LE | OR | AND | CMP_EQ | CMP_NE | TILDE | NOT | PERIOD | BACKSLASH | ELLIPSIS | ERROR | WARNING | IF | IFDEF | IFNDEF | ELSE | ELIF | ENDIF | DEFINE | DEFINED | UNDEF | INCLUDE | TYPEDEF | STRUCT | UNION | ENUM | CONST | LIB | STATIC | CALLBACK | FUNCTION | LET | SET | TEMP | FREE | RETURN | PRE_ASSERT | POST_ASSERT | BOOLVAL | INTVAL | STRVAL | PATHVAL | STRLEN | FLOATVAL | ARRVAL | OBJVAL | COUNT | CALLOC | TO_BOOL | TO_INT | TO_STRING | TO_FLOAT | TO_ARRAY | TO_OBJECT | COMMENT | CPP_HEADER ; + + +file: + %empty +| blocks +; +blocks: + block +| blocks block +; +block: + EOS +| EOL +| COMMENT +| cpp { + if ($cpp) { + psi_cpp_exp_exec($cpp, P->preproc, PSI_DATA(P)); + psi_cpp_exp_free(&$cpp); + } +} +| lib { + if (P->file.ln) { + P->error(PSI_DATA(P), $lib, PSI_WARNING, + "Extra 'lib %s' statement has no effect", $lib->text); + } else { + P->file.ln = strndup($lib->text + 1, $lib->size - 2); + } +} +| constant { + psi_parser_proc_add_const(P, $constant); +} +| decl_stmt { + psi_parser_proc_add_decl(P, $decl_stmt); +} +| decl_typedef[def] { + psi_parser_proc_add_typedef(P, $def); +} +| decl_struct[struct] { + psi_parser_proc_add_struct(P, $struct); +} +| decl_union[union] { + psi_parser_proc_add_union(P, $union); +} +| decl_enum[enum] { + psi_parser_proc_add_enum(P, $enum); +} +| impl { + psi_parser_proc_add_impl(P, $impl); +} +; + +lib: + LIB QUOTED_STRING EOS { + $lib = $QUOTED_STRING; +} +; + +cpp: + HASH cpp_exp[exp] EOL { + $cpp = $exp; +} +; + +cpp_exp[exp]: + cpp_message_token cpp_macro_decl_tokens[tokens] { + if ($tokens) { + struct psi_token *msg = NULL; + + if (psi_plist_get($tokens, 0, &msg)) { + size_t index = 1; + struct psi_token *next; + + msg = psi_token_copy(msg); + while (psi_plist_get($tokens, index++, &next)) { + struct psi_token *old = msg; + msg = psi_token_cat(" ", 2, msg, next); + free(old); + } + } + psi_plist_free($tokens); + + $exp = psi_cpp_exp_init($cpp_message_token->type, msg); + } else { + $exp = psi_cpp_exp_init($cpp_message_token->type, NULL); + } + $exp->token = psi_token_copy($cpp_message_token); +} +| cpp_include_token[INCLUDE] cpp_header_token { + $exp = psi_cpp_exp_init($INCLUDE->type, psi_token_copy($cpp_header_token)); + $exp->token = psi_token_copy($INCLUDE); +} +| cpp_no_arg_token { + $exp = psi_cpp_exp_init($cpp_no_arg_token->type, NULL); + $exp->token = psi_token_copy($cpp_no_arg_token); +} +| cpp_name_arg_token name_token { + $name_token->type = PSI_T_NAME; + $exp = psi_cpp_exp_init($cpp_name_arg_token->type, psi_token_copy($name_token)); + $exp->token = psi_token_copy($cpp_name_arg_token); +} +| cpp_name_arg_token NULL[name_token] { + $name_token->type = PSI_T_NAME; + $exp = psi_cpp_exp_init($cpp_name_arg_token->type, psi_token_copy($name_token)); + $exp->token = psi_token_copy($cpp_name_arg_token); +} +| DEFINE cpp_macro_decl { + $exp = psi_cpp_exp_init($DEFINE->type, $cpp_macro_decl); + $exp->token = psi_token_copy($DEFINE); +} +| cpp_exp_arg_token cpp_macro_exp { + $exp = psi_cpp_exp_init($cpp_exp_arg_token->type, $cpp_macro_exp); + $exp->token = psi_token_copy($cpp_exp_arg_token); +} +; + +cpp_message_token: + ERROR +| WARNING +; + +cpp_include_token: + IMPORT +| INCLUDE +| INCLUDE_NEXT +; + +cpp_header_token: + QUOTED_STRING +| CPP_HEADER +; + +cpp_no_arg_token: + ELSE +| ENDIF +; + +cpp_name_arg_token: + IFDEF +| IFNDEF +| UNDEF +; + +cpp_exp_arg_token: + IF +| ELIF +; + +cpp_macro_decl[macro]: + name_token NO_WHITESPACE LPAREN cpp_macro_sig RPAREN cpp_macro_decl_tokens { + $name_token->type = PSI_T_NAME; + $macro = psi_cpp_macro_decl_init($cpp_macro_sig, $cpp_macro_decl_tokens, NULL); + $macro->token = psi_token_copy($name_token); +} +| name_token cpp_macro_decl_tokens { + $name_token->type = PSI_T_NAME; + $macro = psi_cpp_macro_decl_init(NULL, $cpp_macro_decl_tokens, NULL); + $macro->token = psi_token_copy($name_token); +} +| NULL[name_token] cpp_macro_decl_tokens { + $name_token->type = PSI_T_NAME; + $macro = psi_cpp_macro_decl_init(NULL, $cpp_macro_decl_tokens, NULL); + $macro->token = psi_token_copy($name_token); +} +; + +cpp_macro_sig[sig]: + %empty { + $sig = psi_plist_init(NULL); +} +| cpp_macro_sig_args +; + +cpp_macro_sig_args[args]: + name_token { + $name_token = psi_token_copy($name_token); + $name_token->type = PSI_T_NAME; + $args = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_token_free), &$name_token); +} +| cpp_macro_sig_args[args_] COMMA name_token { + $name_token = psi_token_copy($name_token); + $name_token->type = PSI_T_NAME; + $args = psi_plist_add($args_, &$name_token); +} +; + +cpp_macro_decl_tokens[tokens]: + %empty { + $tokens = NULL; +} +| cpp_macro_decl_token_list +; + +cpp_macro_decl_token_list[tokens]: + any_noeol_token[token] { + $token = psi_token_copy($token); + $tokens = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_token_free), &$token); +} +| cpp_macro_decl_token_list[tokens_] any_noeol_token[token] { + $token = psi_token_copy($token); + $tokens = psi_plist_add($tokens_, &$token); +} +; + +cpp_macro_exp[exp]: + LPAREN cpp_macro_exp[exp_] RPAREN { + $exp = psi_num_exp_init_unary($LPAREN->type, $exp_); + $exp->token = psi_token_copy($LPAREN); +} +| unary_op_token cpp_macro_exp[exp_] %prec UNARY { + $exp = psi_num_exp_init_unary($unary_op_token->type, $exp_); + $exp->token = psi_token_copy($unary_op_token); +} +| cpp_macro_exp[lhs] binary_op_token cpp_macro_exp[rhs] %prec BINARY { + $exp = psi_num_exp_init_binary($binary_op_token->type, $lhs, $rhs); + $exp->token = psi_token_copy($binary_op_token); +} +| DEFINED name_token { + { + uint8_t exists; + + $name_token->type = PSI_T_NAME; + exists = psi_cpp_defined(P->preproc, $name_token); + $exp = psi_num_exp_init_num(psi_number_init(PSI_T_UINT8, &exists)); + $exp->token = psi_token_copy($name_token); + } +} +| DEFINED LPAREN name_token RPAREN { + { + uint8_t exists; + + $name_token->type = PSI_T_NAME; + exists = psi_cpp_defined(P->preproc, $name_token); + $exp = psi_num_exp_init_num(psi_number_init(PSI_T_UINT8, &exists)); + $exp->token = psi_token_copy($name_token); + } +} +| NUMBER { + $exp = psi_num_exp_init_num(psi_number_init($NUMBER->type, $NUMBER->text)); + $exp->token = psi_token_copy($NUMBER); + $exp->data.n->token = psi_token_copy($NUMBER); +} +| QUOTED_CHAR { + $exp = psi_num_exp_init_num(psi_number_init($QUOTED_CHAR->type, $QUOTED_CHAR->text)); + $exp->token = psi_token_copy($QUOTED_CHAR); + $exp->data.n->token = psi_token_copy($QUOTED_CHAR); +} +| name_token { + $name_token->type = PSI_T_NAME; + $exp = psi_num_exp_init_num(psi_number_init(PSI_T_DEFINE, $name_token->text)); + $exp->token = psi_token_copy($name_token); + $exp->data.n->token = psi_token_copy($name_token); +} +| name_token LPAREN cpp_macro_call_args RPAREN { + $name_token->type = PSI_T_NAME; + $exp = psi_num_exp_init_num(psi_number_init(PSI_T_FUNCTION, + psi_cpp_macro_call_init($name_token->text, $cpp_macro_call_args))); + $exp->token = psi_token_copy($name_token); +} +; + +cpp_macro_call_args[args]: + %empty { + $args = NULL; +} +| cpp_macro_call_arg_list +; + +cpp_macro_call_arg_list[args]: + cpp_macro_exp { + $args = psi_plist_add(psi_plist_init((void (*)(void *)) psi_num_exp_free), + &$cpp_macro_exp); +} +| cpp_macro_call_arg_list[args_] COMMA cpp_macro_exp { + $args = psi_plist_add($args_, &$cpp_macro_exp); +} +; + +constant[const]: + CONST constant_type NSNAME EQUALS impl_def_val EOS { + $const = psi_const_init($constant_type, $NSNAME->text, $impl_def_val); + $const->token = psi_token_copy($NSNAME); +} +; + +constant_type[type]: + constant_type_token[token] { + $type = psi_const_type_init($token->type, $token->text); +} +; + +constant_type_token: + BOOL +| INT +| FLOAT +| STRING +; + +impl_def_val[val]: + %empty { + $val = NULL; +} +| impl_def_val_token[token] { + $val = psi_impl_def_val_init($token->type, $token->text); + $val->token = psi_token_copy($token); +} +; + +impl_def_val_token: + NULL +| NUMBER +| TRUE +| FALSE +| QUOTED_STRING +; + +decl_typedef[def]: + TYPEDEF typedef[def_] EOS { + $def = $def_; +} +; + +typedef[def]: + decl_arg +| decl { + $def = psi_decl_arg_init( + psi_decl_type_init(PSI_T_FUNCTION, $decl->func->var->name), + psi_decl_var_copy($decl->func->var) + ); + $def->type->token = psi_token_copy($decl->func->token); + $def->type->real.func = $decl; +} +| decl_enum[enum] name_token { + $name_token->type = PSI_T_NAME; + $def = psi_decl_arg_init( + psi_decl_type_init(PSI_T_ENUM, $enum->name), + psi_decl_var_init($name_token->text, 0, 0) + ); + $def->var->token = psi_token_copy($name_token); + $def->type->token = psi_token_copy($enum->token); + $def->type->real.enm = $enum; +} +| struct_name[struct] align_and_size[as] struct_args_block[args] decl_var[var] { + $def = psi_decl_arg_init(psi_decl_type_init(PSI_T_STRUCT, $struct->text), $var); + $def->type->token = $struct; + $def->type->real.strct = psi_decl_struct_init($struct->text, $args); + $def->type->real.strct->token = psi_token_copy($struct); + $def->type->real.strct->align = $as.pos; + $def->type->real.strct->size = $as.len; +} +| union_name[union] align_and_size[as] struct_args_block[args] decl_var[var] { + $def = psi_decl_arg_init(psi_decl_type_init(PSI_T_UNION, $union->text), $var); + $def->type->token = $union; + $def->type->real.unn = psi_decl_union_init($union->text, $args); + $def->type->real.unn->token = psi_token_copy($union); + $def->type->real.unn->align = $as.pos; + $def->type->real.unn->size = $as.len; +} +; + +const_decl_type[type]: + CONST decl_type[type_] { + $type = $type_; +} +| decl_type +; + +decl_type[type]: + decl_type_simple[token] { + $type = psi_decl_type_init($token->type, $token->text); + $type->token = $token; +} +| decl_type_complex +; + +decl_type_complex[type]: + STRUCT[token] name_token { + $name_token->type = PSI_T_NAME; + $type = psi_decl_type_init($token->type, $name_token->text); + $type->token = psi_token_copy($name_token); +} +| UNION[token] name_token { + $name_token->type = PSI_T_NAME; + $type = psi_decl_type_init($token->type, $name_token->text); + $type->token = psi_token_copy($name_token); +} +| ENUM[token] name_token { + $name_token->type = PSI_T_NAME; + $type = psi_decl_type_init($token->type, $name_token->text); + $type->token = psi_token_copy($name_token); +} +; + +decl_type_simple[type]: + decl_int_type +| decl_real_type +| decl_stdint_type[type_] { + $type = psi_token_copy($type_); +} +| NAME[type_] { + $type = psi_token_copy($type_); +} +; + +decl_real_type[type]: + FLOAT[type_] { + $type = psi_token_copy($type_); +} +| DOUBLE[type_] { + $type = psi_token_copy($type_); +} +| LONG DOUBLE { + $type = psi_token_cat(" ", 2, $LONG, $DOUBLE); +} +; + +decl_stdint_type[type]: + INT8 +| UINT8 +| INT16 +| UINT16 +| INT32 +| UINT32 +| INT64 +| UINT64 +; + +int_signed[i]: + SIGNED +| UNSIGNED +; + +int_width[i]: + SHORT { + $i = psi_token_copy($SHORT); +} +| LONG { + $i = psi_token_copy($LONG); +} +| LONG[l1] LONG[l2] { + $i = psi_token_cat(" ", 2, $l1, $l2); +} +; + +decl_int_type[type]: + CHAR { + $type = psi_token_copy($CHAR); +} +| INT { + $type = psi_token_copy($INT); +} +| int_signed int_signed_types { + if ($2) { + $type = psi_token_cat(" ", 2, $1, $2); + free($2); + } else { + $type = psi_token_copy($1); + } +} +| int_width int_width_types { + if ($2) { + $type = psi_token_cat(" ", 2, $1, $2); + free($1); + free($2); + } else { + $type = $1; + } +} +; + +int_signed_types[type]: + %empty { + $type = NULL; +} +| CHAR { + $type = psi_token_copy($CHAR); +} +| SHORT signed_short_types { + if ($2) { + $type = psi_token_cat(" ", 2, $1, $2); + } else { + $type = psi_token_copy($1); + } +} +| INT { + $type = psi_token_copy($INT); +} +| LONG signed_long_types { + if ($2) { + $type = psi_token_cat(" ", 2, $1, $2); + } else { + $type = psi_token_copy($1); + } +} +; + +signed_short_types[type]: + %empty { + $type = NULL; +} +| INT +; +signed_long_types[type]: + %empty { + $type = NULL; +} +| INT +| LONG +; + +int_width_types[type]: + %empty { + $type = NULL; +} +| INT { + $type = psi_token_copy($INT); +} +| int_signed int_signed_types { + if ($2) { + $type = psi_token_cat(" ", 2, $1, $2); + free($2); + } else { + $type = psi_token_copy($1); + } +} +; + +decl_stmt: + decl EOS { + $decl_stmt = $decl; +} +; + +decl: + decl_fn[func] LPAREN decl_args[args] RPAREN array_size[as] { + $decl = psi_decl_init(psi_decl_abi_init("default"), $func, $args); + if ($as) { + $decl->func->var->pointer_level += 1; + $decl->func->var->array_size = $as; + } +} +| decl_fn[func] LPAREN decl_args[args] COMMA ELLIPSIS RPAREN array_size[as] { + $decl = psi_decl_init(psi_decl_abi_init("default"), $func, $args); + $decl->varargs = 1; + if ($as) { + $decl->func->var->pointer_level += 1; + $decl->func->var->array_size = $as; + } +} +| NAME[abi] decl_fn[func] LPAREN decl_args[args] RPAREN array_size[as] { + $decl = psi_decl_init(psi_decl_abi_init($abi->text), $func, $args); + if ($as) { + $decl->func->var->pointer_level += 1; + $decl->func->var->array_size = $as; + } +} +| NAME[abi] decl_fn[func] LPAREN decl_args[args] COMMA ELLIPSIS RPAREN array_size[as] { + $decl = psi_decl_init(psi_decl_abi_init($abi->text), $func, $args); + $decl->varargs = 1; + if ($as) { + $decl->func->var->pointer_level += 1; + $decl->func->var->array_size = $as; + } +} +; + +decl_fn: + decl_func +| decl_functor +; + +decl_functor[arg]: + const_decl_type[type] indirection[i] LPAREN indirection name_token[NAME] RPAREN { + $NAME->type = PSI_T_NAME; + $arg = psi_decl_arg_init($type, psi_decl_var_init($NAME->text, $i, 0)); + $arg->var->token = psi_token_copy($NAME); + $arg->token = psi_token_copy($NAME); +} +| CONST VOID pointers LPAREN indirection name_token[NAME] RPAREN { + $NAME->type = PSI_T_NAME; + $arg = psi_decl_arg_init( + psi_decl_type_init($VOID->type, $VOID->text), + psi_decl_var_init($NAME->text, $pointers, 0) + ); + $arg->type->token = psi_token_copy($VOID); + $arg->var->token = psi_token_copy($NAME); + $arg->token = psi_token_copy($NAME); +} +| VOID pointers LPAREN indirection name_token[NAME] RPAREN { + $NAME->type = PSI_T_NAME; + $arg = psi_decl_arg_init( + psi_decl_type_init($VOID->type, $VOID->text), + psi_decl_var_init($NAME->text, $pointers, 0) + ); + $arg->type->token = psi_token_copy($VOID); + $arg->var->token = psi_token_copy($NAME); + $arg->token = psi_token_copy($NAME); +} +| VOID LPAREN indirection name_token[NAME] RPAREN { + $NAME->type = PSI_T_NAME; + $arg = psi_decl_arg_init( + psi_decl_type_init($VOID->type, $VOID->text), + psi_decl_var_init($NAME->text, 0, 0) + ); + $arg->type->token = psi_token_copy($VOID); + $arg->var->token = psi_token_copy($NAME); + $arg->token = psi_token_copy($NAME); +} +; + +decl_func[func]: + decl_arg +| VOID name_token[NAME] { + $func = psi_decl_arg_init( + psi_decl_type_init($VOID->type, $VOID->text), + psi_decl_var_init($NAME->text, 0, 0) + ); + $func->type->token = psi_token_copy($VOID); + $func->var->token = psi_token_copy($NAME); + $func->token = psi_token_copy($NAME); +} +; + +decl_args[args]: + %empty { + $args = NULL; +} +| VOID { + $args = NULL; +} +| decl_arg[arg] { + $args = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_arg_free), &$arg); +} +| decl_args[args_] COMMA decl_arg[arg] { + $args = psi_plist_add($args_, &$arg); +} +; + +decl_arg[arg]: + const_decl_type[type] decl_var[var] { + $arg = psi_decl_arg_init($type, $var); +} +| CONST VOID pointers name_token[NAME] { + $NAME->type = PSI_T_NAME; + $arg = psi_decl_arg_init( + psi_decl_type_init($VOID->type, $VOID->text), + psi_decl_var_init($NAME->text, $pointers, 0) + ); + $arg->type->token = psi_token_copy($VOID); + $arg->var->token = psi_token_copy($NAME); + $arg->token = psi_token_copy($NAME); +} +| VOID pointers name_token[NAME] { + $NAME->type = PSI_T_NAME; + $arg = psi_decl_arg_init( + psi_decl_type_init($VOID->type, $VOID->text), + psi_decl_var_init($NAME->text, $pointers, 0) + ); + $arg->type->token = psi_token_copy($VOID); + $arg->var->token = psi_token_copy($NAME); + $arg->token = psi_token_copy($NAME); +} +; + +decl_var[var]: + pointers name_token array_size { + $name_token->type = PSI_T_NAME; + $var = psi_decl_var_init($name_token->text, $pointers + !! $array_size, $array_size); + $var->token = psi_token_copy($name_token); +} +| name_token array_size { + $name_token->type = PSI_T_NAME; + $var = psi_decl_var_init($name_token->text, !! $array_size, $array_size); + $var->token = psi_token_copy($name_token); +} +; + +decl_union[union]: + UNION name_token align_and_size[as] decl_struct_args[args] { + $name_token->type = PSI_T_NAME; + $union = psi_decl_union_init($name_token->text, $args); + $union->align = $as.pos; + $union->size = $as.len; + $union->token = psi_token_copy($name_token); +} +; + +decl_struct[struct]: + STRUCT name_token align_and_size[as] decl_struct_args[args] { + $name_token->type = PSI_T_NAME; + $struct = psi_decl_struct_init($name_token->text, $args); + $struct->align = $as.pos; + $struct->size = $as.len; + $struct->token = psi_token_copy($name_token); +} +; + +decl_struct_args[args]: + EOS { + $args = NULL; +} +| struct_args_block +; + +struct_args_block[args]: + LBRACE struct_args RBRACE { + $args = $struct_args; +} +; + +struct_args[args]: + struct_arg[arg] { + $args = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_arg_free), &$arg); +} +| struct_args[args_] struct_arg[arg] { + $args = psi_plist_add($args_, &$arg); +} +; + +struct_arg[arg]: + typedef[arg_] decl_layout[layout] EOS { + $arg = $arg_; + $arg->layout = $layout; + psi_parser_proc_add_from_typedef(P, $arg); +} +; + +decl_enum[enum]: + enum_name LBRACE decl_enum_items[list] RBRACE { + $enum = psi_decl_enum_init($enum_name->text, $list); + $enum->token = $enum_name; +} +; + +decl_enum_items[list]: + decl_enum_item[i] { + $list = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_enum_item_free), &$i); +} +| decl_enum_items[list_] COMMA decl_enum_item[i] { + $list = psi_plist_add($list_, &$i); +} +; + +decl_enum_item[i]: + name_token { + $name_token->type = PSI_T_NAME; + $i = psi_decl_enum_item_init($name_token->text, NULL); + $i->token = psi_token_copy($name_token); +} +| name_token EQUALS num_exp { + $name_token->type = PSI_T_NAME; + $i = psi_decl_enum_item_init($name_token->text, $num_exp); + $i->token = psi_token_copy($name_token); +} +; + +num_exp[exp]: + number { + $exp = psi_num_exp_init_num($number); + $exp->token = psi_token_copy($number->token); +} +| LPAREN const_decl_type[type] RPAREN num_exp[exp_] %prec UNARY { + $exp = psi_num_exp_init_cast($type, $exp_); + $exp->token = psi_token_copy($type->token); +} +| LPAREN num_exp[exp_] RPAREN { + $exp = psi_num_exp_init_unary(PSI_T_LPAREN, $exp_); + $exp->token = psi_token_copy($LPAREN); +} +| num_exp[lhs] binary_op_token[op] num_exp[rhs] %prec BINARY { + $exp = psi_num_exp_init_binary($op->type, $lhs, $rhs); + $exp->token = psi_token_copy($op); +} +| unary_op_token[op] num_exp[exp_] %prec UNARY { + $exp = psi_num_exp_init_unary($op->type, $exp_); + $exp->token = psi_token_copy($op); +} +; + +number[num]: + NUMBER[token] { + $num = psi_number_init($token->type, $token->text); + $num->token = psi_token_copy($token); +} +| NSNAME[token] { + $num = psi_number_init($token->type, $token->text); + $num->token = psi_token_copy($token); +} +| QUOTED_CHAR[token] { + $num = psi_number_init($token->type, $token->text); + $num->token = psi_token_copy($token); +} +| decl_var { + $num = psi_number_init(PSI_T_NAME, $decl_var); + $num->token = psi_token_copy($decl_var->token); +} +; + +enum_name[name]: + ENUM optional_name[name_] { + if ($name_) { + $name = psi_token_copy($name_); + } else { + char digest[17]; + + psi_token_hash($ENUM, digest); + $name = psi_token_append("@", psi_token_copy($ENUM), 1, digest); + } +} +; + +union_name[name]: + UNION optional_name[name_] { + if ($name_) { + $name = psi_token_copy($name_); + } else { + char digest[17]; + + psi_token_hash($UNION, digest); + $name = psi_token_append("@", psi_token_copy($UNION), 1, digest); + } +} +; + +struct_name[name]: + STRUCT optional_name[name_] { + if ($name_) { + $name = psi_token_copy($name_); + } else { + char digest[17]; + + psi_token_hash($STRUCT, digest); + $name = psi_token_append("@", psi_token_copy($STRUCT), 1, digest); + } +} +; + +optional_name[name]: + %empty { + $name = NULL; +} +| name_token { + $name = $name_token; + $name->type = PSI_T_NAME; +} +; + +decl_layout[l]: + %empty { + $l = NULL; +} +| COLON COLON LPAREN NUMBER[align] COMMA NUMBER[size] RPAREN { + $l = psi_layout_init(atol($align->text), atol($size->text)); +} +; + +align_and_size[as]: + %empty { + $as.pos = 0; + $as.len = 0; +} +| COLON COLON LPAREN NUMBER[align] COMMA NUMBER[size] RPAREN { + $as.pos = atol($align->text); + $as.len = atol($size->text); +} +; + +array_size[as]: + %empty { + $as = 0; +} +| LBRACKET NUMBER RBRACKET { + $as = atol($NUMBER->text); +} +; + +indirection[i]: + %empty { + $i = 0; +} +| pointers[p] %prec UNARY { + $i = $p; +} +; + +pointers[p]: + ASTERISK { + $p = 1; +} +| pointers[p_] ASTERISK { + $p = $p_ + 1; +} +; + +/* + * + * impl + * + */ + +impl: + impl_func[func] LBRACE impl_stmts[stmts] RBRACE { + $impl = psi_impl_init($func, $stmts); +} +| STATIC impl_func[func] LBRACE impl_stmts[stmts] RBRACE { + $impl = psi_impl_init($func, $stmts); + $func->static_memory = 1; +} +; + +impl_func[func]: + FUNCTION reference[r] NSNAME LPAREN RPAREN COLON impl_type[type] { + $func = psi_impl_func_init($NSNAME->text, NULL, $type); + $func->token = psi_token_copy($NSNAME); + $func->return_reference = $r; +} +| FUNCTION reference[r] NSNAME LPAREN impl_args[args] RPAREN COLON impl_type[type] { + $func = psi_impl_func_init($NSNAME->text, $args, $type); + $func->token = psi_token_copy($NSNAME); + $func->return_reference = $r; +} +| FUNCTION reference[r] NSNAME LPAREN impl_args[args] COMMA impl_type[va_type] reference[va_r] ELLIPSIS DOLLAR_NAME RPAREN COLON impl_type[type] { + $func = psi_impl_func_init($NSNAME->text, $args, $type); + $func->token = psi_token_copy($NSNAME); + $func->return_reference = $r; + $func->vararg = psi_impl_arg_init($va_type, psi_impl_var_init($DOLLAR_NAME->text, $va_r), NULL); + $func->vararg->var->token = psi_token_copy($DOLLAR_NAME); +} +; + +impl_args[args]: + impl_arg[arg] { + $args = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_impl_arg_free), &$arg); +} +| impl_args[args_] COMMA impl_arg[arg] { + $args = psi_plist_add($args_, &$arg); +} +; + +impl_arg[arg]: + impl_type[type] impl_var[var] { + $arg = psi_impl_arg_init($type, $var, NULL); +} +| impl_type[type] impl_var[var] EQUALS impl_def_val[val] { + $arg = psi_impl_arg_init($type, $var, $val); +} +; + +impl_var[var]: + reference DOLLAR_NAME { + $var = psi_impl_var_init($DOLLAR_NAME->text, $reference); + $var->token = psi_token_copy($DOLLAR_NAME); +} +; + +impl_type[type]: + impl_type_token[token] { + $type = psi_impl_type_init($token->type, $token->text); + $type->token = psi_token_copy($token); +} +; + +impl_type_token: + VOID +| MIXED +| BOOL +| INT +| FLOAT +| STRING +| ARRAY +| OBJECT +| CALLABLE +; + +impl_stmts[stmts]: + impl_stmt[stmt] { + $stmts = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_impl_stmt_free), &$stmt); +} +| impl_stmts[stmts_] impl_stmt[stmt] { + $stmts = psi_plist_add($stmts_, &$stmt); +} +; + +impl_stmt[stmt]: + return_stmt[s] { + $stmt = (struct psi_token **) $s; +} +| let_stmt[s] { + $stmt = (struct psi_token **) $s; +} +| set_stmt[s] { + $stmt = (struct psi_token **) $s; +} +| assert_stmt[s] { + $stmt = (struct psi_token **) $s; +} +| free_stmt[s] { + $stmt = (struct psi_token **) $s; +} +; + +let_stmt[let]: + LET let_exp_assign[exp] EOS { + $let = psi_let_stmt_init($exp); + $let->token = psi_token_copy($LET); +} +| TEMP decl_var[var] EQUALS reference decl_var[val] EOS { + $let = psi_let_stmt_init(psi_let_exp_init_ex($var, PSI_LET_TMP, $val)); + $let->token = psi_token_copy($TEMP); + $let->exp->is_reference = $reference; +} +; + +let_exp[exp]: + let_exp_assign +| byref let_exp_byref[exp_] { + $exp = $exp_; + $exp->is_reference = true; +} +| let_exp_byref[exp_] { + $exp = $exp_; + $exp->is_reference = false; +} +; + +let_exp_byref[exp]: + NULL { + $exp = psi_let_exp_init(PSI_LET_NULL, NULL); +} +| let_calloc[calloc] { + $exp = psi_let_exp_init(PSI_LET_CALLOC, $calloc); +} +| let_callback[callback] { + $exp = psi_let_exp_init(PSI_LET_CALLBACK, $callback); +} +| let_func[func] { + $exp = psi_let_exp_init_ex(NULL, PSI_LET_FUNC, $func); +} +| num_exp[num] { + $exp = psi_let_exp_init_ex(NULL, PSI_LET_NUMEXP, $num); +} +; + +let_exp_assign[exp]: + decl_var[var] EQUALS let_exp_byref[exp_] { + $exp = $exp_; + $exp->var = $var; +} +| decl_var[var] EQUALS byref let_exp_byref[exp_] { + $exp = $exp_; + $exp->is_reference = 1; + $exp->var = $var; +} +; + +let_calloc[calloc]: + CALLOC LPAREN num_exp[nmemb] COMMA num_exp[size] RPAREN { + $calloc = psi_let_calloc_init($nmemb, $size); + $calloc->token = psi_token_copy($CALLOC); +} +; + +let_callback[callback]: + CALLBACK callback_rval[func] LPAREN impl_var[var] LPAREN callback_arg_list[args] RPAREN RPAREN { + $callback = psi_let_callback_init(psi_let_func_init($func->type, $func->text, $var), $args); + $callback->func->token = psi_token_copy($func); + $callback->token = psi_token_copy($CALLBACK); +} +; + +let_func[func]: + let_func_token[token] LPAREN impl_var[var] let_func_exps[exps] RPAREN { + $func = psi_let_func_init($token->type, $token->text, $var); + $func->token = psi_token_copy($token); + $func->inner = $exps; +} +; + +let_func_token: + ZVAL +| OBJVAL +| ARRVAL +| PATHVAL +| STRLEN +| STRVAL +| FLOATVAL +| INTVAL +| BOOLVAL +| COUNT +; + +let_func_exps[exps]: + %empty { + $exps = NULL; +} +| COMMA let_exps[exps_] { + $exps = $exps_; +} +; + +let_exps[exps]: + let_exp[exp] { + $exps = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_let_exp_free), &$exp); +} +| let_exps[exps_] COMMA let_exp[exp] { + $exps = psi_plist_add($exps_, &$exp); +} +; + +callback_rval[rval]: + VOID +| let_func_token +; + +callback_arg_list[list]: + %empty { + $list = NULL; +} +| callback_args[args] { + $list = $args; +} +; + +callback_args[args]: + set_exp[exp] { + $args = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_set_exp_free), &$exp); +} +| callback_args[args_] COMMA set_exp[exp] { + $args = psi_plist_add($args_, &$exp); +} +; + +return_stmt[return]: + RETURN set_func[func] EOS { + $return = psi_return_stmt_init(psi_set_exp_init(PSI_SET_FUNC, $func)); + $return->token = psi_token_copy($RETURN); +} +; + +set_stmt[set]: + SET set_exp[exp] EOS { + $set = psi_set_stmt_init($exp); + $set->token = psi_token_copy($SET); +} +; + +set_exp[exp]: + set_func[func] { + $exp = psi_set_exp_init(PSI_SET_FUNC, $func); +} +| num_exp[num] { + $exp = psi_set_exp_init(PSI_SET_NUMEXP, $num); +} +| impl_var[var] EQUALS set_exp[exp_] { + $exp = $exp_; + $exp->var = $var; +} +; + +set_func[func]: + set_func_token[token] LPAREN decl_var[var] set_func_exps[exps] RPAREN { + $func = psi_set_func_init($token->type, $token->text, $var); + $func->token = psi_token_copy($token); + $func->inner = $exps; +} +| set_func_token[token] LPAREN decl_var[var] COMMA ELLIPSIS RPAREN { + $func = psi_set_func_init($token->type, $token->text, $var); + $func->token = psi_token_copy($token); + $func->recursive = 1; +} +; + +set_func_token: + TO_OBJECT +| TO_ARRAY +| TO_STRING +| TO_INT +| TO_FLOAT +| TO_BOOL +| ZVAL +| VOID +; + +set_func_exps[exps]: + %empty { + $exps = NULL; +} +| COMMA set_exps[exps_] { + $exps = $exps_; +} +; + +set_exps[exps]: + set_exp[exp] { + $exps = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_set_exp_free), &$exp); +} +| set_exps[exps_] COMMA set_exp[exp] { + $exps = psi_plist_add($exps_, &$exp); +} +; + +assert_stmt[assert]: + assert_stmt_token[token] num_exp[exp] EOS { + $assert = psi_assert_stmt_init((enum psi_assert_kind) $token->type, $exp); + $assert->token = psi_token_copy($token); +} +; + +assert_stmt_token: + PRE_ASSERT +| POST_ASSERT +; + +free_stmt[free]: + FREE free_exps[exps] EOS { + $free = psi_free_stmt_init($exps); + $free->token = psi_token_copy($FREE); +} +; + +free_exps[exps]: + free_exp[exp] { + $exps = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_free_exp_free), &$exp); +} +| free_exps[exps_] COMMA free_exp[exp] { + $exps = psi_plist_add($exps_, &$exp); +} +; + +free_exp[exp]: + name_token[NAME] LPAREN decl_vars[vars] RPAREN { + $NAME->type = PSI_T_NAME; + $exp = psi_free_exp_init($NAME->text, $vars); + $exp->token = psi_token_copy($NAME); +} +; + +decl_vars[vars]: + decl_var[var] { + $vars = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_var_free), &$var); +} +| decl_vars[vars_] COMMA decl_var[var] { + $vars = psi_plist_add($vars_, &$var); +} +; + +reference: + %empty { + $reference = false; +} +| byref { + $reference = true; +} +; + +byref: + AMPERSAND %prec UNARY +; + +%% + +/* epilogue */ + +static int psi_parser_proc_lex(YYSTYPE *lvalp, struct psi_parser *P, struct psi_plist *tokens, size_t *index) +{ + struct psi_token *token; + + if (psi_plist_get(tokens, (*index)++, &token)) { + if (P->flags & PSI_DEBUG) { + psi_token_dump(2, token); + } + + *((struct psi_token **)lvalp) = token; + return token->type; + } else { + (*index)--; + PSI_DEBUG_PRINT(P, "EOF(%d)\n", PSI_T_EOF); + } + + return PSI_T_EOF; +} + +static void psi_parser_proc_error(struct psi_parser *P, struct psi_plist *tokens, size_t *index, const char *msg) +{ + struct psi_token *T = NULL; + size_t last; + + if (*index == 0) { + last = 0; + } else { + last = --(*index); + } + + psi_plist_get(tokens, last, &T); + if (T) { + P->error(PSI_DATA(P), T, PSI_WARNING, "PSI %s at col %u", msg, T->col); + } else { + P->error(PSI_DATA(P), NULL, PSI_WARNING, "PSI %s", msg); + } + P->errors++; +} + diff --git a/src/plist.c b/src/plist.c index b5acd76..2cf4eb3 100644 --- a/src/plist.c +++ b/src/plist.c @@ -66,12 +66,17 @@ struct psi_plist *psi_plist_init_ex(size_t size, void (*dtor)(void *)) { return list; } -void psi_plist_free(struct psi_plist *list) { +void psi_plist_clean(struct psi_plist *list) { size_t i; if (list->dtor) for (i = 0; i < list->count; ++i) { list->dtor(PLIST_ELE(list, i)); } + list->count = 0; +} + +void psi_plist_free(struct psi_plist *list) { + psi_plist_clean(list); free(list); } @@ -156,7 +161,7 @@ bool psi_plist_del_r(struct psi_plist *list, size_t offset_start, size_t num_ele if (eles) { memcpy(eles, PLIST_ELE(list, offset_start), num_eles * list->size); } - + assert(list->count >= num_eles); if ((list->count -= num_eles)) { PLIST_MOV_REDUCE_EX(list, offset_start, num_eles); } @@ -167,33 +172,39 @@ bool psi_plist_del_r(struct psi_plist *list, size_t offset_start, size_t num_ele } struct psi_plist *psi_plist_ins(struct psi_plist *list, size_t index, void *ptr) { - size_t new_count = MAX(list->count + 1, index); + size_t new_count; - if (list && new_count) { - list = realloc(list, sizeof(*list) + list->size + new_count * list->size); - } if (list) { - PLIST_MOV_EXPAND(list, index); - PLIST_CPY(list, PLIST_ELE(list, index), ptr); - list->count = new_count; + new_count = MAX(list->count + 1, index); + if (new_count) { + list = realloc(list, sizeof(*list) + list->size + new_count * list->size); + } + if (list) { + PLIST_MOV_EXPAND(list, index); + PLIST_CPY(list, PLIST_ELE(list, index), ptr); + list->count = new_count; + } } return list; } struct psi_plist *psi_plist_ins_r(struct psi_plist *list, size_t offset_start, size_t num_eles, void **eles) { - size_t new_count = MAX(offset_start, list->count) + num_eles; + size_t new_count; - if (list && new_count) { - list = realloc(list, sizeof(*list) + list->size + new_count * list->size); - } if (list) { - size_t e; + new_count = MAX(offset_start + 1, list->count) + num_eles; + if (new_count) { + list = realloc(list, sizeof(*list) + list->size + new_count * list->size); + } + if (list) { + size_t e; - PLIST_MOV_EXPAND_EX(list, offset_start, num_eles); - for (e = 0; e < num_eles; ++e) { - PLIST_CPY(list, PLIST_ELE(list, offset_start + e), &eles[e]); + PLIST_MOV_EXPAND_EX(list, offset_start, num_eles); + for (e = 0; e < num_eles; ++e) { + PLIST_CPY(list, PLIST_ELE(list, offset_start + e), &eles[e]); + } + list->count = new_count; } - list->count = new_count; } return list; } diff --git a/src/plist.h b/src/plist.h index 4bb76b5..b4187a4 100644 --- a/src/plist.h +++ b/src/plist.h @@ -32,6 +32,7 @@ typedef void (*psi_plist_dtor)(void *); struct psi_plist *psi_plist_init(void (*dtor)(void *)); struct psi_plist *psi_plist_init_ex(size_t size, void (*dtor)(void *)); +void psi_plist_clean(struct psi_plist *list); void psi_plist_free(struct psi_plist *list); struct psi_plist *psi_plist_copy(struct psi_plist *list, void (*ctor)(void *)); diff --git a/src/token.c b/src/token.c index 8cfc0d5..f375065 100644 --- a/src/token.c +++ b/src/token.c @@ -34,29 +34,22 @@ size_t psi_token_alloc_size(size_t token_len, size_t fname_len) { return sizeof(struct psi_token) + token_len + fname_len + 2; } -struct psi_token *psi_token_alloc(struct psi_parser *P) { +struct psi_token *psi_token_init(token_t token_typ, const char *token_txt, + size_t token_len, unsigned col, unsigned line, const char *file) +{ struct psi_token *T; - size_t token_len, fname_len; - token_t token_typ; - - if (P->cur < P->tok) { - return NULL; - } + size_t file_len = strlen(file); - token_typ = P->num; - token_len = P->cur - P->tok; - fname_len = strlen(P->file.fn); - - T = calloc(1, psi_token_alloc_size(token_len, fname_len)); + T = calloc(1, psi_token_alloc_size(token_len, file_len)); T->type = token_typ; T->size = token_len; T->text = &T->buf[0]; T->file = &T->buf[token_len + 1]; - T->line = P->line; - T->col = P->col; + T->line = line; + T->col = col; - memcpy(T->text, P->tok, token_len); - memcpy(T->file, P->file.fn, fname_len); + memcpy(T->text, token_txt, token_len); + memcpy(T->file, file, file_len); return T; } @@ -110,7 +103,7 @@ struct psi_token *psi_token_cat(const char *sep, unsigned argc, ...) { T->text = &T->buf[0]; T->file = &T->buf[T->size + 1]; - memmove(&T->buf[T->size + 1], &T->buf[token_len + sep_len], fname_len + 1); + memmove(&T->buf[T->size + 1], &T->buf[token_len + 1], fname_len + 1); memcpy(&T->buf[token_len], sep, sep_len); memcpy(&T->buf[token_len + sep_len], arg->text, arg->size + 1); } else { @@ -136,7 +129,7 @@ struct psi_token *psi_token_prepend(const char *sep, struct psi_token *T, unsign T = realloc(T, psi_token_alloc_size(T->size += str_len + sep_len, fname_len)); T->text = &T->buf[0]; T->file = &T->buf[T->size + 1]; - memmove(&T->buf[str_len + sep_len], &T->buf[0], T->size + 1 + fname_len + 1); + memmove(&T->buf[str_len + sep_len], &T->buf[0], token_len + 1 + fname_len + 1); memcpy(&T->buf[0], str, str_len); memcpy(&T->buf[str_len], sep, sep_len); T->buf[T->size] = '\0'; @@ -158,7 +151,7 @@ struct psi_token *psi_token_append(const char *sep, struct psi_token *T, unsigne T = realloc(T, psi_token_alloc_size(T->size += str_len + sep_len, fname_len)); T->text = &T->buf[0]; T->file = &T->buf[T->size + 1]; - memmove(&T->buf[T->size + 1], &T->buf[token_len + sep_len], fname_len + 1); + memmove(&T->buf[T->size + 1], &T->buf[token_len + 1], fname_len + 1); memcpy(&T->buf[token_len], sep, sep_len); memcpy(&T->buf[token_len + sep_len], str, str_len + 1); } @@ -206,44 +199,50 @@ void psi_token_dump(int fd, struct psi_token *t) { size_t i; - dprintf(fd, "TOKEN %p (%d) \"", t, t->type); - for (i = 0; i < MIN(t->size, 16); ++i) { - switch (t->text[i]) { - case '\0': - dprintf(fd, "\\0"); - break; - case '\a': - dprintf(fd, "\\a"); - break; - case '\b': - dprintf(fd, "\\b"); - break; - case '\f': - dprintf(fd, "\\f"); - break; - case '\n': - dprintf(fd, "\\n"); - break; - case '\r': - dprintf(fd, "\\r"); - break; - case '\t': - dprintf(fd, "\\t"); - break; - case '\v': - dprintf(fd, "\\v"); - break; - case '"': - dprintf(fd, "\\\""); - break; - default: - if (isprint(t->text[i])) { - dprintf(fd, "%c", t->text[i]); - } else { - dprintf(fd, "\\%03hho", t->text[i]); + dprintf(fd, "TOKEN %p (%d) ", t, t->type); + if (t->type == PSI_T_EOF) { + dprintf(fd, "EOF"); + } else { + dprintf(fd, "\""); + for (i = 0; i < MIN(t->size, 16); ++i) { + switch (t->text[i]) { + case '\0': + dprintf(fd, "\\0"); + break; + case '\a': + dprintf(fd, "\\a"); + break; + case '\b': + dprintf(fd, "\\b"); + break; + case '\f': + dprintf(fd, "\\f"); + break; + case '\n': + dprintf(fd, "\\n"); + break; + case '\r': + dprintf(fd, "\\r"); + break; + case '\t': + dprintf(fd, "\\t"); + break; + case '\v': + dprintf(fd, "\\v"); + break; + case '"': + dprintf(fd, "\\\""); + break; + default: + if (isprint(t->text[i])) { + dprintf(fd, "%c", t->text[i]); + } else { + dprintf(fd, "\\x%02hhX", t->text[i]); + } + break; } - break; } + dprintf(fd, "%s\"", t->size > 16 ? "..." : ""); } - dprintf(fd, "\" at col %u in %s on line %u\n", t->col, t->file, t->line); + dprintf(fd, " at col %u in %s on line %u\n", t->col, t->file, t->line); } diff --git a/src/token.h b/src/token.h index 322843b..a8e68ee 100644 --- a/src/token.h +++ b/src/token.h @@ -45,11 +45,13 @@ static inline size_t psi_offset_padding(size_t diff, size_t alignment) { } #include "parser_proc.h" +#undef YYDEBUG -#define PSI_T_POINTER PSI_T_ASTERISK -#define PSI_T_LONG_DOUBLE (PSI_T_DOUBLE << 16) -#define PSI_T_BSLASH (PSI_T_SLASH << 16) -#define PSI_T_WHITESPACE -PSI_T_NO_WHITESPACE +#define PSI_T_CAST PSI_T_EQUALS +#define PSI_T_POINTER PSI_T_ASTERISK +#define PSI_T_LONG_DOUBLE (PSI_T_DOUBLE << 16) +#define PSI_T_BSLASH (PSI_T_SLASH << 16) +#define PSI_T_WHITESPACE -PSI_T_NO_WHITESPACE typedef int token_t; @@ -136,7 +138,8 @@ struct psi_token { struct psi_parser; -struct psi_token *psi_token_alloc(struct psi_parser *P); +struct psi_token *psi_token_init(token_t token_typ, const char *token_txt, + size_t token_len, unsigned col, unsigned line, const char *file); size_t psi_token_alloc_size(size_t token_len, size_t fname_len); struct psi_token *psi_token_copy(struct psi_token *src); void psi_token_copy_ctor(struct psi_token **src); diff --git a/src/types/assert_stmt.h b/src/types/assert_stmt.h index 44d865e..5c7f39a 100644 --- a/src/types/assert_stmt.h +++ b/src/types/assert_stmt.h @@ -32,13 +32,15 @@ struct psi_impl; struct psi_num_exp; struct psi_call_frame; +enum psi_assert_kind { + PSI_ASSERT_PRE = PSI_T_PRE_ASSERT, + PSI_ASSERT_POST = PSI_T_POST_ASSERT +}; + struct psi_assert_stmt { struct psi_token *token; struct psi_num_exp *exp; - enum psi_assert_kind { - PSI_ASSERT_PRE = PSI_T_PRE_ASSERT, - PSI_ASSERT_POST = PSI_T_POST_ASSERT - } kind; + enum psi_assert_kind kind; }; struct psi_assert_stmt *psi_assert_stmt_init(enum psi_assert_kind kind, struct psi_num_exp *exp); diff --git a/src/types/cpp_exp.c b/src/types/cpp_exp.c index f2a29bc..ee7a30b 100644 --- a/src/types/cpp_exp.c +++ b/src/types/cpp_exp.c @@ -28,6 +28,7 @@ #include #include "data.h" +#include "cpp.h" struct psi_cpp_exp *psi_cpp_exp_init(token_t type, void *data) { @@ -36,8 +37,12 @@ struct psi_cpp_exp *psi_cpp_exp_init(token_t type, void *data) switch ((exp->type = type)) { case PSI_T_WARNING: case PSI_T_ERROR: + case PSI_T_UNDEF: case PSI_T_IFDEF: case PSI_T_IFNDEF: + case PSI_T_IMPORT: + case PSI_T_INCLUDE: + case PSI_T_INCLUDE_NEXT: exp->data.tok = data; break; case PSI_T_DEFINE: @@ -54,6 +59,7 @@ struct psi_cpp_exp *psi_cpp_exp_init(token_t type, void *data) assert(0); break; } + return exp; } @@ -66,8 +72,16 @@ void psi_cpp_exp_free(struct psi_cpp_exp **exp_ptr) switch (exp->type) { case PSI_T_WARNING: case PSI_T_ERROR: + if (!exp->data.tok) { + break; + } + /* no break */ + case PSI_T_UNDEF: case PSI_T_IFDEF: case PSI_T_IFNDEF: + case PSI_T_IMPORT: + case PSI_T_INCLUDE: + case PSI_T_INCLUDE_NEXT: free(exp->data.tok); exp->data.tok = NULL; break; @@ -98,8 +112,16 @@ void psi_cpp_exp_dump(int fd, struct psi_cpp_exp *exp) switch (exp->type) { case PSI_T_WARNING: case PSI_T_ERROR: + if (!exp->data.tok) { + break; + } + /* no break */ + case PSI_T_UNDEF: case PSI_T_IFDEF: case PSI_T_IFNDEF: + case PSI_T_IMPORT: + case PSI_T_INCLUDE: + case PSI_T_INCLUDE_NEXT: dprintf(fd, "%s", exp->data.tok->text); break; case PSI_T_DEFINE: @@ -118,3 +140,176 @@ void psi_cpp_exp_dump(int fd, struct psi_cpp_exp *exp) } dprintf(fd, "\n"); } + + +static inline bool psi_cpp_level_skipped(struct psi_cpp *cpp) +{ + return cpp->skip == cpp->level; +} + +static inline void psi_cpp_level_skip(struct psi_cpp *cpp) +{ + assert(!cpp->skip); + cpp->skip = cpp->level; +} + +static inline void psi_cpp_level_unskip(struct psi_cpp *cpp) +{ + if (psi_cpp_level_skipped(cpp)) { + cpp->skip = 0; + } +} + +static inline bool psi_cpp_level_masked(struct psi_cpp *cpp) +{ + return cpp->seen & (1 << cpp->level); +} + +static inline void psi_cpp_level_mask(struct psi_cpp *cpp) +{ + assert(!psi_cpp_level_masked(cpp)); + cpp->seen |= (1 << cpp->level); +} + +static inline void psi_cpp_level_unmask(struct psi_cpp *cpp) +{ + cpp->seen &= ~(1 << cpp->level); +} + +void psi_cpp_exp_exec(struct psi_cpp_exp *exp, struct psi_cpp *cpp, struct psi_data *D) +{ + PSI_DEBUG_PRINT(D, "PSI: CPP EVAL < %s (level=%u, skip=%u)\n", + exp->token->text, cpp->level, cpp->skip); + +#if PSI_CPP_DEBUG + psi_cpp_exp_dump(2, exp); +#endif + + switch (exp->type) { + case PSI_T_ERROR: + if (!cpp->skip) { + D->error(D, exp->token, PSI_ERROR, "%s", + exp->data.tok ? exp->data.tok->text : ""); + } + break; + case PSI_T_WARNING: + if (!cpp->skip) { + D->error(D, exp->token, PSI_WARNING, "%s", + exp->data.tok ? exp->data.tok->text : ""); + } + break; + case PSI_T_UNDEF: + if (!cpp->skip) { + psi_cpp_undef(cpp, exp->data.tok); + } + break; + case PSI_T_DEFINE: + if (!cpp->skip) { + psi_cpp_define(cpp, exp->data.decl); + /* FIXME: copy */ + exp->data.decl = NULL; + } + break; + case PSI_T_IFDEF: + ++cpp->level; + if (!cpp->skip) { + if (psi_cpp_defined(cpp, exp->data.tok)) { + psi_cpp_level_mask(cpp); + } else { + psi_cpp_level_skip(cpp); + } + } + break; + case PSI_T_IFNDEF: + ++cpp->level; + if (!cpp->skip) { + if (psi_cpp_defined(cpp, exp->data.tok)) { + psi_cpp_level_skip(cpp); + } else { + psi_cpp_level_mask(cpp); + } + } + break; + case PSI_T_IF: + ++cpp->level; + if (!cpp->skip) { + if (psi_cpp_if(cpp, exp)) { + psi_cpp_level_mask(cpp); + } else { + psi_cpp_level_skip(cpp); + } + } + break; + case PSI_T_ENDIF: + if (!cpp->level) { + D->error(D, exp->token, PSI_WARNING, "Ingoring lone #endif"); + } else { + psi_cpp_level_unskip(cpp); + psi_cpp_level_unmask(cpp); + --cpp->level; + } + break; + case PSI_T_ELSE: + /* FIXME: catch "else" after "else" */ + if (!cpp->level) { + D->error(D, exp->token, PSI_WARNING, "Ingoring lone #else"); + } else if (psi_cpp_level_skipped(cpp) && !psi_cpp_level_masked(cpp)) { + /* + * if skip is set on this level and the level has + * not been masked yet, then unskip and mask this level + */ + psi_cpp_level_unskip(cpp); + psi_cpp_level_mask(cpp); + } else if (!cpp->skip && psi_cpp_level_masked(cpp)) { + /* + * previous block masked this level + */ + psi_cpp_level_skip(cpp); + } else { + assert(cpp->skip <= cpp->level); + } + break; + case PSI_T_ELIF: + if (!cpp->level) { + D->error(D, exp->token, PSI_WARNING, "Ingoring lone #elif"); + } else if (psi_cpp_level_skipped(cpp) && !psi_cpp_level_masked(cpp)) { + /* + * if skip is set on this level and the level has + * not been masked yet, then unskip and mask this + * level, if the condition evals truthy + */ + if (psi_cpp_if(cpp, exp)) { + psi_cpp_level_unskip(cpp); + psi_cpp_level_mask(cpp); + } + } else if (!cpp->skip && psi_cpp_level_masked(cpp)) { + /* + * previous block masked this level + */ + psi_cpp_level_skip(cpp); + } else { + assert(cpp->skip <= cpp->level); + } + break; + case PSI_T_INCLUDE: + if (!cpp->skip) { + if (!psi_cpp_include(cpp, exp->data.tok->text, PSI_CPP_INCLUDE)) { + D->error(D, exp->token, PSI_WARNING, "Failed to include %s", exp->data.tok->text); + } + } + break; + case PSI_T_INCLUDE_NEXT: + if (!cpp->skip) { + if (!psi_cpp_include(cpp, exp->data.tok->text, PSI_CPP_INCLUDE_NEXT)) { + D->error(D, exp->token, PSI_WARNING, "Failed to include %s", exp->data.tok->text); + } + } + break; + default: + assert(0); + break; + } + + PSI_DEBUG_PRINT(D, "PSI: CPP EVAL > %s (level=%u, skip=%u)\n", + exp->token->text, cpp->level, cpp->skip); +} diff --git a/src/types/cpp_exp.h b/src/types/cpp_exp.h index e66c218..f2706bb 100644 --- a/src/types/cpp_exp.h +++ b/src/types/cpp_exp.h @@ -28,6 +28,7 @@ #include "token.h" +struct psi_cpp; struct psi_cpp_macro_decl; struct psi_cpp_macro_call; struct psi_num_exp; @@ -45,5 +46,6 @@ struct psi_cpp_exp { struct psi_cpp_exp *psi_cpp_exp_init(token_t type, void *data); void psi_cpp_exp_free(struct psi_cpp_exp **exp_ptr); void psi_cpp_exp_dump(int fd, struct psi_cpp_exp *exp); +void psi_cpp_exp_exec(struct psi_cpp_exp *exp, struct psi_cpp *cpp, struct psi_data *D); #endif diff --git a/src/types/cpp_macro_decl.c b/src/types/cpp_macro_decl.c index d5e195c..42ed0f4 100644 --- a/src/types/cpp_macro_decl.c +++ b/src/types/cpp_macro_decl.c @@ -87,3 +87,52 @@ void psi_cpp_macro_decl_dump(int fd, struct psi_cpp_macro_decl *macro) } } } + +static inline bool cmp_token_list(struct psi_plist *l1, struct psi_plist *l2) +{ + size_t c = psi_plist_count(l1), i; + + if (c != psi_plist_count(l2)) { + return false; + } + + for (i = 0; i < c; ++i) { + struct psi_token *t1, *t2; + + psi_plist_get(l1, i, &t1); + psi_plist_get(l2, i, &t2); + + if (strcmp(t1->text, t2->text)) { + return false; + } + } + + return true; +} + +bool psi_cpp_macro_decl_equal(struct psi_cpp_macro_decl *d1, struct psi_cpp_macro_decl *d2) +{ + if (d1->sig) { + if (!d2->sig) { + return false; + } + + if (!cmp_token_list(d1->sig, d2->sig)) { + return false; + } + } + + if (d1->tokens) { + if (!d2->tokens) { + return false; + } + + if (!cmp_token_list(d1->tokens, d2->tokens)) { + return false; + } + } + + /* FIXME compare num_exps */ + + return true; +} diff --git a/src/types/cpp_macro_decl.h b/src/types/cpp_macro_decl.h index 993d280..e8ab300 100644 --- a/src/types/cpp_macro_decl.h +++ b/src/types/cpp_macro_decl.h @@ -41,5 +41,6 @@ struct psi_cpp_macro_decl *psi_cpp_macro_decl_init(struct psi_plist *sig, struct psi_plist *tokens, struct psi_num_exp *exp); void psi_cpp_macro_decl_free(struct psi_cpp_macro_decl **macro_ptr); void psi_cpp_macro_decl_dump(int fd, struct psi_cpp_macro_decl *decl); +bool psi_cpp_macro_decl_equal(struct psi_cpp_macro_decl *d1, struct psi_cpp_macro_decl *d2); #endif diff --git a/src/types/decl_arg.c b/src/types/decl_arg.c index 1c29619..ba77e79 100644 --- a/src/types/decl_arg.c +++ b/src/types/decl_arg.c @@ -61,9 +61,10 @@ void psi_decl_arg_dump(int fd, struct psi_decl_arg *arg, unsigned level) { if (arg->type->type == PSI_T_FUNCTION) { psi_decl_type_dump(fd, arg->type->real.func->func->type, level); - dprintf(fd, " (*"); - psi_decl_var_dump(fd, arg->var); - dprintf(fd, ")("); + dprintf(fd, " %s(*%s)", + psi_t_indirection(arg->var->pointer_level - !! arg->var->array_size), + arg->var->name); + dprintf(fd, "("); if (arg->type->real.func->args) { size_t j = 0; struct psi_decl_arg *farg; @@ -81,6 +82,9 @@ void psi_decl_arg_dump(int fd, struct psi_decl_arg *arg, unsigned level) } } dprintf(fd, ")"); + if (arg->var->array_size) { + dprintf(fd, "[%u]", arg->var->array_size); + } } else { psi_decl_type_dump(fd, arg->type, level); dprintf(fd, " "); diff --git a/src/types/decl_enum_item.c b/src/types/decl_enum_item.c index 32533e2..ad78ddd 100644 --- a/src/types/decl_enum_item.c +++ b/src/types/decl_enum_item.c @@ -47,7 +47,7 @@ void psi_decl_enum_item_free(struct psi_decl_enum_item **i_ptr) if (i->num) { if (i->num == &i->inc) { switch (i->inc.op) { - case 0: + case PSI_T_NUMBER: psi_number_free(&i->inc.data.n); break; case PSI_T_PLUS: @@ -91,6 +91,7 @@ bool psi_decl_enum_item_validate(struct psi_data *data, } else { int64_t nil = 0; + item->inc.op = PSI_T_NUMBER; item->inc.data.n = psi_number_init(PSI_T_INT64, &nil); item->num = &item->inc; } diff --git a/src/types/decl_type.c b/src/types/decl_type.c index f3b500a..590c8ee 100644 --- a/src/types/decl_type.c +++ b/src/types/decl_type.c @@ -55,6 +55,20 @@ void psi_decl_type_free(struct psi_decl_type **type_ptr) } } +struct psi_decl_type *psi_decl_type_copy(struct psi_decl_type *src) +{ + struct psi_decl_type *dst = calloc(1, sizeof(*dst)); + + dst->type = src->type; + if (src->name) { + dst->name = strdup(src->name); + } + if (src->token) { + dst->token = psi_token_copy(src->token); + } + return dst; +} + struct psi_plist *psi_decl_type_get_args(struct psi_decl_type *dtyp, struct psi_decl_type **real_typ_ptr) { @@ -324,6 +338,8 @@ int psi_decl_type_is_weak(struct psi_decl_type *type) case PSI_T_SHORT: case PSI_T_INT: case PSI_T_LONG: + case PSI_T_UNSIGNED: + case PSI_T_SIGNED: case PSI_T_NAME: return type->type; default: diff --git a/src/types/decl_type.h b/src/types/decl_type.h index f5aa4dc..e7c341f 100644 --- a/src/types/decl_type.h +++ b/src/types/decl_type.h @@ -54,6 +54,7 @@ struct psi_decl_type { #define psi_decl_type_is_anon(name, type) !strncmp(name, type "@", sizeof(type)) struct psi_decl_type *psi_decl_type_init(token_t type, const char *name); +struct psi_decl_type *psi_decl_type_copy(struct psi_decl_type *src); void psi_decl_type_free(struct psi_decl_type **type_ptr); void psi_decl_type_dump(int fd, struct psi_decl_type *t, unsigned level); bool psi_decl_type_validate(struct psi_data *data, struct psi_decl_type *type, struct psi_decl_arg *def); diff --git a/src/types/num_exp.c b/src/types/num_exp.c index 9718ced..0577acf 100644 --- a/src/types/num_exp.c +++ b/src/types/num_exp.c @@ -60,11 +60,24 @@ struct psi_num_exp *psi_num_exp_init_num(struct psi_number *n) { struct psi_num_exp *exp = calloc(1, sizeof(*exp)); + exp->op = PSI_T_NUMBER; exp->data.n = n; return exp; } +struct psi_num_exp *psi_num_exp_init_cast(struct psi_decl_type *typ, + struct psi_num_exp *num) +{ + struct psi_num_exp *exp = calloc(1, sizeof(*exp)); + + exp->op = PSI_T_CAST; + exp->data.c.typ = typ; + exp->data.c.num = num; + + return exp; +} + struct psi_num_exp *psi_num_exp_copy(struct psi_num_exp *exp) { struct psi_num_exp *cpy; @@ -77,10 +90,15 @@ struct psi_num_exp *psi_num_exp_copy(struct psi_num_exp *exp) *cpy = *exp; switch (exp->op) { - case 0: + case PSI_T_NUMBER: cpy->data.n = psi_number_copy(exp->data.n); break; + case PSI_T_CAST: + cpy->data.c.typ = psi_decl_type_copy(exp->data.c.typ); + cpy->data.c.num = psi_num_exp_copy(exp->data.c.num); + break; + case PSI_T_NOT: case PSI_T_TILDE: case PSI_T_LPAREN: @@ -130,9 +148,15 @@ void psi_num_exp_free(struct psi_num_exp **c_ptr) *c_ptr = NULL; switch (c->op) { - case 0: + case PSI_T_NUMBER: psi_number_free(&c->data.n); break; + + case PSI_T_CAST: + psi_decl_type_free(&c->data.c.typ); + psi_num_exp_free(&c->data.c.num); + break; + case PSI_T_NOT: case PSI_T_TILDE: case PSI_T_LPAREN: @@ -184,6 +208,8 @@ static inline const char *psi_num_exp_op_tok(token_t op) return "~"; case PSI_T_LPAREN: return "("; + case PSI_T_CAST: + return "(cast)"; case PSI_T_PIPE: return "|"; @@ -236,7 +262,7 @@ static inline const char *psi_num_exp_op_tok(token_t op) void psi_num_exp_dump(int fd, struct psi_num_exp *exp) { switch (exp->op) { - case 0: + case PSI_T_NUMBER: psi_number_dump(fd, exp->data.n); break; @@ -287,7 +313,7 @@ bool psi_num_exp_validate(struct psi_data *data, struct psi_num_exp *exp, struct psi_impl *impl, struct psi_decl *cb_decl, struct psi_let_exp *current_let, struct psi_set_exp *current_set, struct psi_decl_enum *current_enum) { - if (exp->op) { + if (exp->op && exp->op != PSI_T_NUMBER) { switch (exp->op) { case PSI_T_NOT: exp->calc = psi_calc_bool_not; @@ -321,6 +347,7 @@ bool psi_num_exp_validate(struct psi_data *data, struct psi_num_exp *exp, exp->calc = psi_calc_cmp_gt; break; + case PSI_T_CAST: case PSI_T_LPAREN: break; @@ -362,9 +389,14 @@ bool psi_num_exp_validate(struct psi_data *data, struct psi_num_exp *exp, } switch (exp->op) { - case 0: + case PSI_T_NUMBER: return psi_number_validate(data, exp->data.n, impl, cb_decl, current_let, current_set, current_enum); + case PSI_T_CAST: + return psi_num_exp_validate(data, exp->data.c.num, impl, cb_decl, current_let, current_set, current_enum) + && psi_decl_type_validate(data, exp->data.c.typ, NULL); + break; + case PSI_T_NOT: case PSI_T_TILDE: case PSI_T_LPAREN: @@ -447,11 +479,12 @@ static void psi_num_exp_reduce(struct psi_num_exp *exp, struct psi_plist **outpu union { impl_val value; psi_calc calc; + struct psi_decl_type *cast; } data; } entry; switch (exp->op) { - case 0: + case PSI_T_NUMBER: entry.type = psi_number_eval(exp->data.n, &entry.data.value, frame, defs); output = psi_plist_add(output, &entry); break; @@ -469,6 +502,22 @@ static void psi_num_exp_reduce(struct psi_num_exp *exp, struct psi_plist **outpu } break; + case PSI_T_CAST: + while (psi_plist_top(input, &entry)) { + /* bail out if exp->op >= entry.type */ + if (psi_calc_oper(exp->op, entry.type) != 1) { + break; + } + psi_plist_pop(input, NULL); + if (frame) PSI_DEBUG_PRINT(frame->context, " %s", psi_num_exp_op_tok(entry.type)); + output = psi_plist_add(output, &entry); + } + entry.type = exp->op; + entry.data.cast = exp->data.c.typ; + input = psi_plist_add(input, &entry); + psi_num_exp_reduce(exp->data.c.num, &output, &input, frame, defs); + break; + case PSI_T_NOT: case PSI_T_TILDE: while (psi_plist_top(input, &entry)) { @@ -517,6 +566,7 @@ token_t psi_num_exp_exec(struct psi_num_exp *exp, impl_val *res, union { impl_val value; psi_calc calc; + struct psi_decl_type *cast; } data; } entry, lhs, rhs; @@ -537,6 +587,17 @@ token_t psi_num_exp_exec(struct psi_num_exp *exp, impl_val *res, input = psi_plist_add(input, &entry); break; + case PSI_T_CAST: + psi_plist_pop(input, &rhs); + if (frame) PSI_DEBUG_PRINT(frame->context, " %s", psi_num_exp_op_tok(entry.type)); + psi_impl_val_dump(rhs.type, &rhs.data.value, frame); + + entry.type = psi_decl_type_get_real(entry.data.cast)->type; + psi_calc_cast(rhs.type, &rhs.data.value, entry.type, &entry.data.value); + input = psi_plist_add(input, &entry); + psi_num_exp_verify_result(entry.type, &entry.data.value, frame); + break; + case PSI_T_NOT: case PSI_T_TILDE: psi_plist_pop(input, &rhs); diff --git a/src/types/num_exp.h b/src/types/num_exp.h index 6e122bb..99f0b69 100644 --- a/src/types/num_exp.h +++ b/src/types/num_exp.h @@ -46,6 +46,10 @@ struct psi_num_exp { struct psi_num_exp *lhs; struct psi_num_exp *rhs; } b; + struct { + struct psi_decl_type *typ; + struct psi_num_exp *num; + } c; struct psi_num_exp *u; struct psi_number *n; } data; @@ -57,6 +61,8 @@ struct psi_num_exp *psi_num_exp_init_binary(token_t op, struct psi_num_exp *psi_num_exp_init_unary(token_t op, struct psi_num_exp *u); struct psi_num_exp *psi_num_exp_init_num(struct psi_number *n); +struct psi_num_exp *psi_num_exp_init_cast(struct psi_decl_type *typ, + struct psi_num_exp *num); void psi_num_exp_free(struct psi_num_exp **c_ptr); struct psi_num_exp *psi_num_exp_copy(struct psi_num_exp *exp); diff --git a/src/types/number.c b/src/types/number.c index aab8151..c5f22d2 100644 --- a/src/types/number.c +++ b/src/types/number.c @@ -38,35 +38,37 @@ struct psi_number *psi_number_init(token_t t, void *num) switch (exp->type = t) { case PSI_T_INT8: - exp->data.ival.i64 = *(int8_t *) num; + exp->data.ival.i8 = *(int8_t *) num; break; case PSI_T_UINT8: - exp->data.ival.i64 = *(uint8_t *) num; + exp->data.ival.u8 = *(uint8_t *) num; break; case PSI_T_INT16: - exp->data.ival.i64 = *(int16_t *) num; + exp->data.ival.i16 = *(int16_t *) num; break; case PSI_T_UINT16: - exp->data.ival.i64 = *(uint16_t *) num; + exp->data.ival.u16 = *(uint16_t *) num; break; case PSI_T_INT32: - exp->data.ival.i64 = *(int32_t *) num; + exp->data.ival.i32 = *(int32_t *) num; break; case PSI_T_UINT32: - exp->data.ival.i64 = *(uint32_t *) num; + exp->data.ival.u32 = *(uint32_t *) num; break; case PSI_T_INT64: exp->data.ival.i64 = *(int64_t *) num; break; case PSI_T_UINT64: - exp->data.ival.i64 = *(uint64_t *) num; + exp->data.ival.u64 = *(uint64_t *) num; break; case PSI_T_FLOAT: exp->data.ival.dval = *(float *) num; + exp->type = PSI_T_DOUBLE; break; case PSI_T_DOUBLE: exp->data.ival.dval = *(double *) num; break; + case PSI_T_QUOTED_CHAR: case PSI_T_NUMBER: case PSI_T_NSNAME: case PSI_T_DEFINE: @@ -95,7 +97,14 @@ struct psi_number *psi_number_copy(struct psi_number *exp) num->token = psi_token_copy(num->token); } switch (num->type) { + case PSI_T_INT8: + case PSI_T_UINT8: + case PSI_T_INT16: + case PSI_T_UINT16: + case PSI_T_INT32: + case PSI_T_UINT32: case PSI_T_INT64: + case PSI_T_UINT64: case PSI_T_DOUBLE: case PSI_T_ENUM: case PSI_T_CONST: @@ -103,6 +112,7 @@ struct psi_number *psi_number_copy(struct psi_number *exp) case PSI_T_NUMBER: case PSI_T_NSNAME: case PSI_T_DEFINE: + case PSI_T_QUOTED_CHAR: num->data.numb = strdup(num->data.numb); break; case PSI_T_NAME: @@ -127,7 +137,14 @@ void psi_number_free(struct psi_number **exp_ptr) free(exp->token); } switch (exp->type) { + case PSI_T_INT8: + case PSI_T_UINT8: + case PSI_T_INT16: + case PSI_T_UINT16: + case PSI_T_INT32: + case PSI_T_UINT32: case PSI_T_INT64: + case PSI_T_UINT64: case PSI_T_DOUBLE: case PSI_T_ENUM: case PSI_T_CONST: @@ -138,6 +155,7 @@ void psi_number_free(struct psi_number **exp_ptr) case PSI_T_NSNAME: case PSI_T_NUMBER: case PSI_T_DEFINE: + case PSI_T_QUOTED_CHAR: free(exp->data.numb); break; case PSI_T_NAME: @@ -153,15 +171,37 @@ void psi_number_free(struct psi_number **exp_ptr) void psi_number_dump(int fd, struct psi_number *exp) { switch (exp->type) { + case PSI_T_INT8: + dprintf(fd, "%" PRId8, exp->data.ival.i8); + break; + case PSI_T_UINT8: + dprintf(fd, "%" PRIu8, exp->data.ival.u8); + break; + case PSI_T_INT16: + dprintf(fd, "%" PRId16, exp->data.ival.i16); + break; + case PSI_T_UINT16: + dprintf(fd, "%" PRIu16, exp->data.ival.u16); + break; + case PSI_T_INT32: + dprintf(fd, "%" PRId32, exp->data.ival.i32); + break; + case PSI_T_UINT32: + dprintf(fd, "%" PRIu32, exp->data.ival.u32); + break; case PSI_T_INT64: dprintf(fd, "%" PRId64, exp->data.ival.i64); break; + case PSI_T_UINT64: + dprintf(fd, "%" PRIu64, exp->data.ival.u64); + break; case PSI_T_DOUBLE: dprintf(fd, "%F", exp->data.ival.dval); break; case PSI_T_NUMBER: case PSI_T_NSNAME: case PSI_T_DEFINE: + case PSI_T_QUOTED_CHAR: dprintf(fd, "%s", exp->data.numb); break; case PSI_T_CONST: @@ -207,7 +247,14 @@ bool psi_number_validate(struct psi_data *data, struct psi_number *exp, switch (exp->type) { case PSI_T_CONST: + case PSI_T_INT8: + case PSI_T_UINT8: + case PSI_T_INT16: + case PSI_T_UINT16: + case PSI_T_INT32: + case PSI_T_UINT32: case PSI_T_INT64: + case PSI_T_UINT64: case PSI_T_DOUBLE: case PSI_T_ENUM: case PSI_T_DEFINE: @@ -253,7 +300,7 @@ bool psi_number_validate(struct psi_data *data, struct psi_number *exp, return false; case PSI_T_NUMBER: - switch (is_numeric_string(exp->data.numb, strlen(exp->data.numb), (zend_long *) &tmp, (double *) &tmp, 0)) { + switch (is_numeric_string(exp->data.numb, strlen(exp->data.numb), (zend_long *) &tmp, (double *) &tmp, 1)) { case IS_LONG: free(exp->data.numb); exp->type = PSI_T_INT64; @@ -269,6 +316,80 @@ bool psi_number_validate(struct psi_data *data, struct psi_number *exp, data->error(data, exp->token, PSI_WARNING, "Expected numeric entity (parser error?)"); return false; + case PSI_T_QUOTED_CHAR: + /* FIXME L */ + tmp.i8 = exp->data.numb[1 + (*exp->data.numb == 'L')]; + switch(tmp.i8) { + case '\\': + tmp.i8 = exp->data.numb[2 + (*exp->data.numb == 'L')]; + switch(tmp.i8) { + case 'x': + tmp.i8 = strtol(&exp->data.numb[3 + (*exp->data.numb == 'L')], &exp->data.numb[strlen(exp->data.numb)-1], 16); + free(exp->data.numb); + exp->type = PSI_T_INT8; + exp->data.ival.i8 = tmp.i8; + return true; + case '\'': + free(exp->data.numb); + exp->type = PSI_T_INT8; + exp->data.ival.i8 = '\''; + return true; + case 'a': + free(exp->data.numb); + exp->type = PSI_T_INT8; + exp->data.ival.i8 = '\a'; + return true; + case 'b': + free(exp->data.numb); + exp->type = PSI_T_INT8; + exp->data.ival.i8 = '\b'; + return true; + case 'f': + free(exp->data.numb); + exp->type = PSI_T_INT8; + exp->data.ival.i8 = '\f'; + return true; + case 'n': + free(exp->data.numb); + exp->type = PSI_T_INT8; + exp->data.ival.i8 = '\n'; + return true; + case 'r': + free(exp->data.numb); + exp->type = PSI_T_INT8; + exp->data.ival.i8 = '\r'; + return true; + case 't': + free(exp->data.numb); + exp->type = PSI_T_INT8; + exp->data.ival.i8 = '\t'; + return true; + case 'v': + free(exp->data.numb); + exp->type = PSI_T_INT8; + exp->data.ival.i8 = '\v'; + return true; + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': + tmp.i8 = strtol(&exp->data.numb[2 + (*exp->data.numb == 'L')], &exp->data.numb[strlen(exp->data.numb)-1], 8); + free(exp->data.numb); + exp->type = PSI_T_INT8; + exp->data.ival.i8 = tmp.i8; + return true; + default: + free(exp->data.numb); + exp->type = PSI_T_INT8; + exp->data.ival.i8 = tmp.i8; + return true; + } + break; + default: + free(exp->data.numb); + exp->type = PSI_T_INT8; + exp->data.ival.i8 = tmp.i8; + return true; + } + break; + default: assert(0); } @@ -323,6 +444,8 @@ static inline token_t psi_number_eval_define(struct psi_number *exp, struct psi_cpp_macro_decl *macro = zend_hash_str_find_ptr(defs, exp->data.numb, strlen(exp->data.numb)); //WHATT? + fprintf(stderr, "number_eval_define: %s %s(%p)\n", + exp->token->text, macro ? macro->token->text : "", macro); res->u8 = 0; return PSI_T_UINT8; @@ -331,10 +454,38 @@ static inline token_t psi_number_eval_define(struct psi_number *exp, token_t psi_number_eval(struct psi_number *exp, impl_val *res, struct psi_call_frame *frame, HashTable *defs) { switch (exp->type) { + case PSI_T_INT8: + *res = exp->data.ival; + if (frame) PSI_DEBUG_PRINT(frame->context, " %" PRIi8, res->i8); + return PSI_T_INT8; + case PSI_T_UINT8: + *res = exp->data.ival; + if (frame) PSI_DEBUG_PRINT(frame->context, " %" PRIu8, res->u8); + return PSI_T_UINT8; + case PSI_T_INT16: + *res = exp->data.ival; + if (frame) PSI_DEBUG_PRINT(frame->context, " %" PRIi16, res->i16); + return PSI_T_INT16; + case PSI_T_UINT16: + *res = exp->data.ival; + if (frame) PSI_DEBUG_PRINT(frame->context, " %" PRIu16, res->u16); + return PSI_T_UINT16; + case PSI_T_INT32: + *res = exp->data.ival; + if (frame) PSI_DEBUG_PRINT(frame->context, " %" PRIi32, res->i32); + return PSI_T_INT32; + case PSI_T_UINT32: + *res = exp->data.ival; + if (frame) PSI_DEBUG_PRINT(frame->context, " %" PRIu32, res->u32); + return PSI_T_UINT32; case PSI_T_INT64: *res = exp->data.ival; if (frame) PSI_DEBUG_PRINT(frame->context, " %" PRIi64, res->i64); return PSI_T_INT64; + case PSI_T_UINT64: + *res = exp->data.ival; + if (frame) PSI_DEBUG_PRINT(frame->context, " %" PRIu64, res->u64); + return PSI_T_UINT64; case PSI_T_DOUBLE: *res = exp->data.ival; diff --git a/tests/parser/cpp/define001.psi b/tests/parser/cpp001.phpt similarity index 64% rename from tests/parser/cpp/define001.psi rename to tests/parser/cpp001.phpt index 875d447..ff912a3 100644 --- a/tests/parser/cpp/define001.psi +++ b/tests/parser/cpp001.phpt @@ -1,3 +1,14 @@ +--TEST-- +CPP defines +--SKIPIF-- + +--FILE-- +===TEST=== + +===DONE=== +--EXPECT-- +===TEST=== +bool(true) +===DONE=== diff --git a/tests/parser/dump/dump001.phpt b/tests/parser/dump001.phpt similarity index 100% rename from tests/parser/dump/dump001.phpt rename to tests/parser/dump001.phpt diff --git a/tests/parser/enum/enum001.psi b/tests/parser/enum/enum001.psi deleted file mode 100644 index 0d37876..0000000 --- a/tests/parser/enum/enum001.psi +++ /dev/null @@ -1,17 +0,0 @@ -enum a { - A, - B, - C -} - -enum b { - FAILURE = -1, - SUCCESS = 0 -} - -enum c { - no = -1, - maybe = SUCCESS, - yes, - sure = yes -} diff --git a/tests/parser/enum/enum001.phpt b/tests/parser/enum001.phpt similarity index 51% rename from tests/parser/enum/enum001.phpt rename to tests/parser/enum001.phpt index b186de5..c73ce9e 100644 --- a/tests/parser/enum/enum001.phpt +++ b/tests/parser/enum001.phpt @@ -7,7 +7,26 @@ extension_loaded("psi") or die("skip - need ext/psi"); --FILE-- ===TEST=== ===DONE=== --EXPECT-- diff --git a/tests/parser/validate001.phpt b/tests/parser/validate001.phpt index 5774d77..e251d26 100644 --- a/tests/parser/validate001.phpt +++ b/tests/parser/validate001.phpt @@ -15,13 +15,10 @@ function validate($check, $psi) { } } -validate(false, "typedef void foo;"); validate(true, "typedef void *bar;"); -validate(false, "typedef long int;"); validate(true, "typedef long foo;"); validate(true, "typedef struct foo bar;"); validate(true, "typedef struct {int a;} foo;"); -validate(false, "struct a; \ntypedef struct a a_t;"); validate(true, "struct a::(8,8); \ntypedef struct a a_t;"); validate(true, "typedef struct a a_t; \nstruct a::(8,8);"); @@ -34,15 +31,6 @@ enum { } PSI ); -validate(false, -<< +--FILE-- +===TEST=== + +===DONE=== +--EXPECTF-- +===TEST=== + +Warning: PSI syntax error, unexpected ;, expecting %s at col 17 in %s on line 1 +===DONE=== diff --git a/tests/parser/validate003.phpt b/tests/parser/validate003.phpt new file mode 100644 index 0000000..f597d24 --- /dev/null +++ b/tests/parser/validate003.phpt @@ -0,0 +1,18 @@ +--TEST-- +validate types +--SKIPIF-- + +--FILE-- +===TEST=== + +===DONE=== +--EXPECTF-- +===TEST=== + +Warning: PSI syntax error, unexpected ;, expecting %s at col 17 in %s on line 1 +===DONE=== diff --git a/tests/parser/validate004.phpt b/tests/parser/validate004.phpt new file mode 100644 index 0000000..31b8509 --- /dev/null +++ b/tests/parser/validate004.phpt @@ -0,0 +1,17 @@ +--TEST-- +validate types +--SKIPIF-- + +--FILE-- +===TEST=== + +===DONE=== +--EXPECTF-- +===TEST=== + +Warning: Cannot compute size of empty struct 'a' in %s on line 1 +===DONE=== diff --git a/tests/parser/validate005.phpt b/tests/parser/validate005.phpt new file mode 100644 index 0000000..1638aaa --- /dev/null +++ b/tests/parser/validate005.phpt @@ -0,0 +1,25 @@ +--TEST-- +validate types +--SKIPIF-- + +--FILE-- +===TEST=== + +===DONE=== +--EXPECTF-- +===TEST=== + +Warning: Unknown variable 'X' in numeric expression in %s on line 4 +===DONE=== diff --git a/tests/parser/validate006.phpt b/tests/parser/validate006.phpt new file mode 100644 index 0000000..ab1b02f --- /dev/null +++ b/tests/parser/validate006.phpt @@ -0,0 +1,17 @@ +--TEST-- +validate types +--SKIPIF-- + +--FILE-- +===TEST=== + +===DONE=== +--EXPECTF-- +===TEST=== + +Warning: PSI syntax error, unexpected ( at col 26 in %s on line 1 +===DONE=== -- 2.30.2