You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by rr...@apache.org on 2019/06/13 18:43:09 UTC
[trafficserver] 01/02: Drop config bits of tsconfig
This is an automated email from the ASF dual-hosted git repository.
rrm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit a9ec130d958a5414aec130a16eafa3352cdbda9d
Author: Randall Meyer <ra...@yahoo.com>
AuthorDate: Wed May 8 19:09:15 2019 -0700
Drop config bits of tsconfig
---
.gitignore | 4 -
lib/tsconfig/BisonHeaderToC++.sed | 8 -
lib/tsconfig/Makefile.am | 39 +-
lib/tsconfig/TsBuilder.cc | 220 ----
lib/tsconfig/TsBuilder.h | 101 --
lib/tsconfig/TsConfigGrammar.c | 1618 ---------------------------
lib/tsconfig/TsConfigGrammar.h | 114 --
lib/tsconfig/TsConfigGrammar.y | 124 ---
lib/tsconfig/TsConfigLexer.h | 61 -
lib/tsconfig/TsConfigParseEvents.h | 67 --
lib/tsconfig/TsConfigSyntax.c | 2168 ------------------------------------
lib/tsconfig/TsConfigSyntax.l | 133 ---
lib/tsconfig/TsConfigTypes.h | 66 --
lib/tsconfig/TsErrataUtil.cc | 190 ----
lib/tsconfig/TsErrataUtil.h | 169 ---
lib/tsconfig/TsValue.cc | 392 -------
lib/tsconfig/TsValue.h | 741 ------------
lib/tsconfig/test-1.tsconfig | 18 -
lib/tsconfig/test-tsconfig.cc | 50 -
19 files changed, 1 insertion(+), 6282 deletions(-)
diff --git a/.gitignore b/.gitignore
index c4dd0f6..89b2b22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -164,10 +164,6 @@ GTAGS
ETAGS
CTAGS
-lib/tsconfig/TsConfigGrammar.hpp
-lib/tsconfig/TsConfigSyntax.c
-lib/tsconfig/test-tsconfig
-
tools/http_load/http_load
tools/jtest/jtest
tools/trafficserver.pc
diff --git a/lib/tsconfig/BisonHeaderToC++.sed b/lib/tsconfig/BisonHeaderToC++.sed
deleted file mode 100644
index abd72ec..0000000
--- a/lib/tsconfig/BisonHeaderToC++.sed
+++ /dev/null
@@ -1,8 +0,0 @@
-1a\
-namespace ts { namespace config {\
- enum TokenType {
-1,/^ *enum/d
-/^ *{/d
-/^ *};/a\
-}} // namespace ts::config
-/^#endif/,$d
diff --git a/lib/tsconfig/Makefile.am b/lib/tsconfig/Makefile.am
index 880840c..fd47d44 100644
--- a/lib/tsconfig/Makefile.am
+++ b/lib/tsconfig/Makefile.am
@@ -17,59 +17,22 @@
# limitations under the License.
lib_LTLIBRARIES = libtsconfig.la
-check_PROGRAMS = test-tsconfig
libtsconfig_la_LDFLAGS = -version-info @TS_LIBTOOL_VERSION@
AM_CFLAGS += @FLEX_CFLAGS@
-AM_YFLAGS = --yacc -d -p tsconfig
AM_CPPFLAGS += \
-I$(abs_top_srcdir)/include \
-I$(abs_top_srcdir)/lib \
$(TS_INCLUDES)
-BUILT_SOURCES = \
- TsConfigGrammar.hpp
-
CLEANFILES = $(BUILT_SOURCES)
libtsconfig_la_SOURCES = \
Errata.cc \
Errata.h \
IntrusivePtr.h \
- NumericType.h \
- TsBuilder.cc \
- TsBuilder.h \
- TsConfigGrammar.hpp \
- TsConfigLexer.h \
- TsConfigParseEvents.h \
- TsConfigTypes.h \
- TsErrataUtil.cc \
- TsErrataUtil.h \
- TsValue.cc \
- TsValue.h
-
-# Depend on the original grammar files only if we can build them.
-if BUILD_TSCONFIG_GRAMMAR
-libtsconfig_la_SOURCES += TsConfigGrammar.y TsConfigSyntax.l
-else
-libtsconfig_la_SOURCES += TsConfigGrammar.c TsConfigGrammar.h TsConfigSyntax.c
-
-# Prevent automatic rules from firing if invalid.
-TsConfigSyntax.c: ;
-TsConfigGrammar.h: ;
-TsConfigGrammar.c: ;
-
-endif
-
-test_tsconfig_SOURCES = test-tsconfig.cc
-
-test_tsconfig_LDADD = libtsconfig.la $(top_builddir)/src/tscore/libtscore.la $(top_builddir)/src/tscpp/util/libtscpputil.la
-
-# Strip to just the enum in the ts::config namespace so we can use
-# it more easily in C++.
-TsConfigGrammar.hpp: TsConfigGrammar.h BisonHeaderToC++.sed
- $(SED) -f $(srcdir)/BisonHeaderToC++.sed $(srcdir)/TsConfigGrammar.h > $@
+ NumericType.h
include $(top_srcdir)/build/tidy.mk
diff --git a/lib/tsconfig/TsBuilder.cc b/lib/tsconfig/TsBuilder.cc
deleted file mode 100644
index c174de1..0000000
--- a/lib/tsconfig/TsBuilder.cc
+++ /dev/null
@@ -1,220 +0,0 @@
-/** @file
-
- Implementation of the handler for parsing events.
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-# include "TsBuilder.h"
-# include "TsErrataUtil.h"
-# include "TsConfigLexer.h"
-# include "TsConfigGrammar.hpp"
-# include <cstdlib>
-
-// Prefix for text of our messages.
-# define PRE "Configuration Parser: "
-
-namespace {
-/** Compress a string by removing escape characters.
- @return The new length of the string.
-*/
-size_t unescape_string(char* text, size_t len) {
- size_t zret = len;
- // quick check - if no escape char, do nothing.
- char* dst = static_cast<char*>(memchr(text, '\\', len));
- if (dst) {
- char* limit = text + len;
- char* src = dst + 1; // skip escape char
- for ( *dst++ = *src++ ; src < limit ; ++src ) {
- if ('\\' != *src) { *dst++ = *src;
- } else if (++src < limit) { *dst++ = *src;
- } else { *dst++ = '\\'; // trailing backslash.
-
-}
-}zret = dst - text;
- }
- return zret;
-}
-} // anon namespace
-
-namespace ts { namespace config {
-
-Builder&
-Builder::init() {
- // Fill in each element to dispatch through the static
- // method. Callback data is a pointer to an entry in @c dispatch
- // which contains pointer to this object and a pointer to the
- // appropriate dispatch method.
-
- // Zero everything first, just to be safe.
- memset(_dispatch, 0, sizeof(_dispatch));
- memset(&_loc, 0, sizeof(_loc));
-
- for ( size_t i = 0 ; i < TS_CONFIG_N_EVENT_TYPES ; ++i) {
- _dispatch[i]._ptr = this;
- _handlers.handler[i]._f = &self::dispatch;
- _handlers.handler[i]._data = &(_dispatch[i]);
- }
-
- _dispatch[TsConfigEventGroupOpen]._method = &self::groupOpen;
- _dispatch[TsConfigEventGroupName]._method = &self::groupName;
- _dispatch[TsConfigEventGroupClose]._method = &self::groupClose;
- _dispatch[TsConfigEventListOpen]._method = &self::listOpen;
- _dispatch[TsConfigEventListClose]._method = &self::listClose;
- _dispatch[TsConfigEventPathOpen]._method = &self::pathOpen;
- _dispatch[TsConfigEventPathTag]._method = &self::pathTag;
- _dispatch[TsConfigEventPathIndex]._method = &self::pathIndex;
- _dispatch[TsConfigEventPathClose]._method = &self::pathClose;
- _dispatch[TsConfigEventLiteralValue]._method = &self::literalValue;
- _dispatch[TsConfigEventInvalidToken]._method = &self::invalidToken;
-
- _handlers.error._data = this;
- _handlers.error._f = &self::syntaxErrorDispatch;
-
- return *this;
-}
-
-// Error messages here have to just be logged, as they effectively report that
-// the dispatcher can't find the builder object.
-void
-Builder::dispatch(void* data, Token* token) {
- if (data) {
- Handler* handler = reinterpret_cast<Handler*>(data);
- if (handler->_ptr) {
- if (handler->_method) {
- ((handler->_ptr)->*(handler->_method))(*token);
- } else {
- msg::logf(msg::WARN, PRE "Unable to dispatch event - no method.");
- }
- } else {
- msg::logf(msg::WARN, PRE "Unable to dispatch event - no builder.");
- }
- } else {
- msg::logf(msg::WARN, PRE "Unable to dispatch event - no handler.");
- }
-}
-
-int
-Builder::syntaxErrorDispatch(void* data, char const* text) {
- return reinterpret_cast<Builder*>(data)->syntaxError(text);
-}
-
-int
-Builder::syntaxError(char const* text) {
- msg::logf(_errata, msg::WARN,
- "Syntax error '%s' near line %d, column %d.",
- text, tsconfiglex_current_line(), tsconfiglex_current_col()
- );
- return 0;
-}
-
-Rv<Configuration>
-Builder::build(Buffer const& buffer) {
- _v = _config.getRoot(); // seed current value.
- _errata.clear(); // no errors yet.
- tsconfig_parse_buffer(&_handlers, buffer._ptr, buffer._size);
- return MakeRv(_config, _errata);
-}
-
-void
-Builder::groupOpen(Token const& token) {
- _v = _v.makeGroup(_name);
- _v.setSource(token._loc._line, token._loc._col);
-}
-void Builder::groupClose(Token const&) {
- _v = _v.getParent();
-}
-void Builder::groupName(Token const& token) {
- _name.set(token._s, token._n);
-}
-void Builder::listOpen(Token const& token) {
- _v = _v.makeList(_name);
- _v.setSource(token._loc._line, token._loc._col);
-}
-void Builder::listClose(Token const&) {
- _v = _v.getParent();
-}
-
-void Builder::pathOpen(Token const&) {
- _path.reset();
- _extent.reset();
-}
-void Builder::pathTag(Token const& token) {
- _path.append(Buffer(token._s, token._n));
- if (_extent._ptr) {
- _extent._size = token._s - _extent._ptr + token._n;
- } else {
- _extent.set(token._s, token._n);
- _loc = token._loc;
- }
-}
-void Builder::pathIndex(Token const& token){
- // We take advantage of the lexer - token will always be a valid
- // digit string that is followed by a non-digit or the FLEX
- // required double null at the end of the input buffer.
- _path.append(Buffer(nullptr, static_cast<size_t>(atol(token._s))));
- if (_extent._ptr) { _extent._size = token._s - _extent._ptr + token._n;
- } else { _extent.set(token._s, token._n);
-}
-}
-
-void Builder::pathClose(Token const&) {
- Rv<Value> cv = _v.makePath(_path, _name);
- if (cv.isOK()) {
- cv.result().setText(_extent).setSource(_loc._line, _loc._col);
- // Terminate path. This will overwrite trailing whitespace or
- // the closing angle bracket, both of which are expendable.
- _extent._ptr[_extent._size] = 0;
- }
- _name.reset();
- _extent.reset();
-}
-
-void Builder::literalValue(Token const& token) {
- Rv<Value> cv;
- Buffer text(token._s, token._n);
-
- // It's just too painful to use these strings with standard
- // libraries without nul terminating. For strings we convert the
- // trailing quote. For integers we abuse the fact that the parser
- // can't reduce using this token before the lexer has read at
- // least one char ahead.
-
- // Note the nul is *not* included in the reported length.
-
- if (INTEGER == token._type) {
- cv = _v.makeInteger(text, _name);
- token._s[token._n] = 0;
- } else if (STRING == token._type) {
- ++text._ptr, text._size -= 2; // Don't include the quotes.
- text._size = unescape_string(text._ptr, text._size);
- text._ptr[text._size] = 0; // OK because we have the trailing quote.
- cv = _v.makeString(text, _name);
- } else {
- msg::logf(_errata, msg::WARN, PRE "Unexpected literal type %d.", token._type);
- }
- if (!cv.isOK()) { _errata.pull(cv.errata());
-}
- if (cv.result()) { cv.result().setSource(token._loc._line, token._loc._col);
-}
- _name.set(nullptr,0); // used, so clear it.
-}
-void Builder::invalidToken(Token const&) { }
-
-}} // namespace ts::config
diff --git a/lib/tsconfig/TsBuilder.h b/lib/tsconfig/TsBuilder.h
deleted file mode 100644
index de765be..0000000
--- a/lib/tsconfig/TsBuilder.h
+++ /dev/null
@@ -1,101 +0,0 @@
-# if ! defined(TS_CONFIG_BUILDER_HEADER)
-# define TS_CONFIG_BUILDER_HEADER
-
-/** @file
-
- Header for handler for parsing events.
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-# include "TsValue.h"
-# include "TsConfigTypes.h"
-# include "TsConfigParseEvents.h"
-
-namespace ts { namespace config {
-
-/** Class to build the configuration table from parser events.
- */
-class Builder {
-public:
- typedef Builder self;
- struct Handler {
- self* _ptr = nullptr; ///< Pointer to Builder instance.
- /// Pointer to method to invoke for this event.
- void (self::*_method)(Token const& token) = nullptr;
-
- /// Default constructor.
- Handler();
- };
-
- /// Default constructor.
- Builder();
- /// Destructor.
- virtual ~Builder() {}
- /// Construct with existing configuration.
- Builder(Configuration const& config);
- /// Build the table.
- /// @return The configuration or error status.
- Rv<Configuration> build(
- Buffer const& buffer ///< Input text.
- );
- protected:
- /// Dispatch table for parse events.
- Handler _dispatch[TS_CONFIG_N_EVENT_TYPES];
- /// Event handler table for the parser.
- TsConfigHandlers _handlers;
- /// Dispatch methods
- virtual void groupOpen(Token const& token);
- virtual void groupClose(Token const& token);
- virtual void groupName(Token const& token);
- virtual void listOpen(Token const& token);
- virtual void listClose(Token const& token);
- virtual void pathOpen(Token const& token);
- virtual void pathTag(Token const& token);
- virtual void pathIndex(Token const& token);
- virtual void pathClose(Token const& token);
- virtual void literalValue(Token const& token);
- virtual void invalidToken(Token const& token);
- /// Syntax error handler
- virtual int syntaxError(char const* text);
- /// Static method to handle parser event callbacks.
- static void dispatch(void* data, Token* token);
- /// Static method for syntax errors.
- static int syntaxErrorDispatch(void* data, char const* text);
-
- // Building state.
- Configuration _config; ///< Configuration to update.
- Errata _errata; ///< Error accumulator.
- Value _v; ///< Current value.
- Buffer _name; ///< Pending group name, if any.
- Buffer _extent; ///< Accumulator for multi-token text.
- Location _loc; ///< Cache for multi-token text.
- Path _path; ///< Path accumulator
-
- /// Initialization, called from constructors.
- self& init();
-};
-
-inline Builder::Handler::Handler() { }
-inline Builder::Builder() { this->init(); }
-inline Builder::Builder(Configuration const& config) : _config(config) { this->init(); }
-
-}} // namespace ts::config
-
-# endif // TS_CONFIG_BUILDER_HEADER
diff --git a/lib/tsconfig/TsConfigGrammar.c b/lib/tsconfig/TsConfigGrammar.c
deleted file mode 100644
index 025b4f9..0000000
--- a/lib/tsconfig/TsConfigGrammar.c
+++ /dev/null
@@ -1,1618 +0,0 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
-
-/* Bison implementation for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-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 <http://www.gnu.org/licenses/>. */
-
-/* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
-/* C LALR(1) parser skeleton written by Richard Stallman, by
- simplifying the original so-called "semantic" parser. */
-
-/* All symbols defined below should begin with yy or YY, to avoid
- infringing on user name space. This should be done even for local
- variables, as they might otherwise be expanded by user macros.
- There are some unavoidable exceptions within include files to
- define necessary library symbols; they are noted "INFRINGES ON
- USER NAME SPACE" below. */
-
-/* Identify Bison output. */
-#define YYBISON 1
-
-/* Bison version. */
-#define YYBISON_VERSION "3.0.4"
-
-/* Skeleton name. */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers. */
-#define YYPURE 1
-
-/* Push parsers. */
-#define YYPUSH 0
-
-/* Pull parsers. */
-#define YYPULL 1
-
-/* "%code top" blocks. */
-#line 26 "TsConfigGrammar.y" /* yacc.c:316 */
-
-# if ! (defined(__clang_analyzer__) || defined(__COVERITY__))
-# include "TsConfigTypes.h"
-# include <stdlib.h>
-
-// Inhibit Bison definitions.
-# define YYMALLOC malloc
-# define YYFREE free
-
-# include "TsConfigParseEvents.h"
-# include "tscore/ink_defs.h"
-
-// Types we need for the lexer.
-typedef void* yyscan_t;
-extern int tsconfiglex(YYSTYPE* yylval, yyscan_t lexer);
-
-
-#line 81 "TsConfigGrammar.c" /* yacc.c:316 */
-
-/* Substitute the variable and function names. */
-#define yyparse tsconfigparse
-#define yylex tsconfiglex
-#define yyerror tsconfigerror
-#define yydebug tsconfigdebug
-#define yynerrs tsconfignerrs
-
-
-/* Copy the first part of user declarations. */
-
-#line 93 "TsConfigGrammar.c" /* yacc.c:339 */
-
-# ifndef YY_NULLPTR
-# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
-# else
-# define YY_NULLPTR 0
-# endif
-# endif
-
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 1
-#endif
-
-/* In a future release of Bison, this section will be replaced
- by #include "y.tab.h". */
-#ifndef YY_TSCONFIG_TSCONFIGGRAMMAR_H_INCLUDED
-# define YY_TSCONFIG_TSCONFIGGRAMMAR_H_INCLUDED
-/* Debug traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-#if YYDEBUG
-extern int tsconfigdebug;
-#endif
-/* "%code requires" blocks. */
-#line 1 "TsConfigGrammar.y" /* yacc.c:355 */
-
-/** @file
-
- TS Configuration grammar.
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-#line 148 "TsConfigGrammar.c" /* yacc.c:355 */
-
-/* Token type. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- enum yytokentype
- {
- STRING = 258,
- IDENT = 259,
- INTEGER = 260,
- LIST_OPEN = 261,
- LIST_CLOSE = 262,
- GROUP_OPEN = 263,
- GROUP_CLOSE = 264,
- PATH_OPEN = 265,
- PATH_CLOSE = 266,
- PATH_SEPARATOR = 267,
- SEPARATOR = 268,
- ASSIGN = 269
- };
-#endif
-/* Tokens. */
-#define STRING 258
-#define IDENT 259
-#define INTEGER 260
-#define LIST_OPEN 261
-#define LIST_CLOSE 262
-#define GROUP_OPEN 263
-#define GROUP_CLOSE 264
-#define PATH_OPEN 265
-#define PATH_CLOSE 266
-#define PATH_SEPARATOR 267
-#define SEPARATOR 268
-#define ASSIGN 269
-
-/* Value type. */
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef int YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-
-
-int tsconfigparse (yyscan_t lexer, struct TsConfigHandlers* handlers);
-
-#endif /* !YY_TSCONFIG_TSCONFIGGRAMMAR_H_INCLUDED */
-
-/* Copy the second part of user declarations. */
-
-#line 198 "TsConfigGrammar.c" /* yacc.c:358 */
-/* Unqualified %code blocks. */
-#line 44 "TsConfigGrammar.y" /* yacc.c:359 */
-
-
-# define HANDLE_EVENT(x,y) \
- if (handlers) { \
- struct TsConfigEventHandler* h = &(handlers->handler[TsConfigEvent##x]); \
- if (h->_f) h->_f(h->_data, &(y)); \
- }
-
-int tsconfigerror(
- yyscan_t lexer ATS_UNUSED,
- struct TsConfigHandlers* handlers,
- char const* text
-) {
- return (handlers && handlers->error._f)
- ? handlers->error._f(handlers->error._data, text)
- : 0
- ;
-}
-
-
-#line 221 "TsConfigGrammar.c" /* yacc.c:359 */
-
-#ifdef short
-# undef short
-#endif
-
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
-#endif
-
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
-#else
-typedef signed char yytype_int8;
-#endif
-
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
-#else
-typedef unsigned short int yytype_uint16;
-#endif
-
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
-#else
-typedef short int yytype_int16;
-#endif
-
-#ifndef YYSIZE_T
-# ifdef __SIZE_TYPE__
-# define YYSIZE_T __SIZE_TYPE__
-# elif defined size_t
-# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# else
-# define YYSIZE_T unsigned int
-# endif
-#endif
-
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
-
-#ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
-# if ENABLE_NLS
-# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
-# endif
-# endif
-# ifndef YY_
-# define YY_(Msgid) Msgid
-# endif
-#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
-
-#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
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
-#endif
-
-
-#if ! defined yyoverflow || YYERROR_VERBOSE
-
-/* The parser invokes alloca or malloc; define the necessary symbols. */
-
-# ifdef YYSTACK_USE_ALLOCA
-# if YYSTACK_USE_ALLOCA
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# elif defined __BUILTIN_VA_ARG_INCR
-# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
-# elif defined _AIX
-# define YYSTACK_ALLOC __alloca
-# elif defined _MSC_VER
-# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
-# define alloca _alloca
-# else
-# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
- /* Use EXIT_SUCCESS as a witness for stdlib.h. */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# endif
-# endif
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
- /* Pacify GCC's 'empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-# ifndef YYSTACK_ALLOC_MAXIMUM
- /* The OS might guarantee only one guard page at the bottom of the stack,
- and a page size can be as small as 4096 bytes. So we cannot safely
- invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
- to allow for a few compiler-allocated temporary stack slots. */
-# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
-# endif
-# else
-# define YYSTACK_ALLOC YYMALLOC
-# define YYSTACK_FREE YYFREE
-# ifndef YYSTACK_ALLOC_MAXIMUM
-# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
-# endif
-# if (defined __cplusplus && ! defined EXIT_SUCCESS \
- && ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# endif
-# endif
-# ifndef YYMALLOC
-# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# ifndef YYFREE
-# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS
-void free (void *); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
-
-#if (! defined yyoverflow \
- && (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member. */
-union yyalloc
-{
- yytype_int16 yyss_alloc;
- YYSTYPE yyvs_alloc;
-};
-
-/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
- N elements. */
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
- + YYSTACK_GAP_MAXIMUM)
-
-# define YYCOPY_NEEDED 1
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (0)
-
-#endif
-
-#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from SRC to DST. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(Dst, Src, Count) \
- __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
-# else
-# define YYCOPY(Dst, Src, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (Dst)[yyi] = (Src)[yyi]; \
- } \
- while (0)
-# endif
-# endif
-#endif /* !YYCOPY_NEEDED */
-
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 3
-/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 33
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 15
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 20
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 32
-/* YYNSTATES -- Number of states. */
-#define YYNSTATES 44
-
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
- by yylex, with out-of-bounds checking. */
-#define YYUNDEFTOK 2
-#define YYMAXUTOK 269
-
-#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
- as returned by yylex, without out-of-bounds checking. */
-static const yytype_uint8 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
-};
-
-#if YYDEBUG
- /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
-static const yytype_uint8 yyrline[] =
-{
- 0, 86, 86, 88, 90, 92, 94, 94, 94, 96,
- 96, 98, 100, 102, 104, 104, 104, 106, 106, 106,
- 106, 108, 108, 108, 110, 110, 112, 114, 116, 118,
- 118, 120, 120
-};
-#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", "error", "$undefined", "STRING", "IDENT", "INTEGER",
- "LIST_OPEN", "LIST_CLOSE", "GROUP_OPEN", "GROUP_CLOSE", "PATH_OPEN",
- "PATH_CLOSE", "PATH_SEPARATOR", "SEPARATOR", "ASSIGN", "$accept",
- "config", "group", "group_open", "group_close", "group_items", "assign",
- "$@1", "list", "list_open", "list_close", "list_items", "value",
- "literal", "separator", "path", "path_open", "path_close", "path_item",
- "path_tag", YY_NULLPTR
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
- (internal) symbol number NUM (which must be that of a token). */
-static const yytype_uint16 yytoknum[] =
-{
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269
-};
-# endif
-
-#define YYPACT_NINF -11
-
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-11)))
-
-#define YYTABLE_NINF -3
-
-#define yytable_value_is_error(Yytable_value) \
- 0
-
- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-static const yytype_int8 yypact[] =
-{
- -11, 2, 21, -11, -2, 5, -2, -11, -11, -11,
- -11, 10, -11, -11, -11, -11, -11, -11, -11, -11,
- -11, -11, -11, -11, -11, 19, 8, 0, -11, -11,
- 15, -11, -11, -11, -2, -11, -11, -2, -11, 19,
- -11, -11, -11, -11
-};
-
- /* 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 yytype_uint8 yydefact[] =
-{
- 6, 0, 0, 1, 24, 0, 24, 25, 8, 9,
- 7, 0, 21, 22, 23, 12, 4, 27, 19, 6,
- 18, 14, 10, 17, 20, 0, 0, 0, 31, 32,
- 0, 29, 5, 3, 24, 13, 11, 24, 28, 0,
- 26, 16, 15, 30
-};
-
- /* YYPGOTO[NTERM-NUM]. */
-static const yytype_int8 yypgoto[] =
-{
- -11, -11, -11, -11, -11, 11, -11, -11, -11, -11,
- -11, -11, 6, -11, -6, -11, -11, -11, -11, -10
-};
-
- /* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int8 yydefgoto[] =
-{
- -1, 1, 18, 19, 33, 2, 6, 11, 20, 21,
- 36, 27, 22, 23, 8, 24, 25, 40, 30, 31
-};
-
- /* 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 yytype_int8 yytable[] =
-{
- 10, 34, 3, 12, 13, 14, 15, 35, 16, 4,
- 17, 7, 5, 12, 13, 14, 15, 32, 16, 9,
- 17, -2, 4, 28, 29, 5, 38, 39, 41, 43,
- 26, 42, 0, 37
-};
-
-static const yytype_int8 yycheck[] =
-{
- 6, 1, 0, 3, 4, 5, 6, 7, 8, 1,
- 10, 13, 4, 3, 4, 5, 6, 9, 8, 14,
- 10, 0, 1, 4, 5, 4, 11, 12, 34, 39,
- 19, 37, -1, 27
-};
-
- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const yytype_uint8 yystos[] =
-{
- 0, 16, 20, 0, 1, 4, 21, 13, 29, 14,
- 29, 22, 3, 4, 5, 6, 8, 10, 17, 18,
- 23, 24, 27, 28, 30, 31, 20, 26, 4, 5,
- 33, 34, 9, 19, 1, 7, 25, 27, 11, 12,
- 32, 29, 29, 34
-};
-
- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 15, 16, 17, 18, 19, 20, 20, 20, 22,
- 21, 23, 24, 25, 26, 26, 26, 27, 27, 27,
- 27, 28, 28, 28, 29, 29, 30, 31, 32, 33,
- 33, 34, 34
-};
-
- /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 1, 3, 1, 1, 0, 3, 3, 0,
- 4, 3, 1, 1, 0, 3, 3, 1, 1, 1,
- 1, 1, 1, 1, 0, 1, 3, 1, 1, 1,
- 3, 1, 1
-};
-
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
-#define YYRECOVERING() (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (yylen); \
- yystate = *yyssp; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (lexer, handlers, YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (0)
-
-/* Error token number */
-#define YYTERROR 1
-#define YYERRCODE 256
-
-
-
-/* Enable debugging if requested. */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (0)
-
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
-
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value, lexer, handlers); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (0)
-
-
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT. |
-`----------------------------------------*/
-
-static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t lexer, struct TsConfigHandlers* handlers)
-{
- FILE *yyo = yyoutput;
- YYUSE (yyo);
- YYUSE (lexer);
- YYUSE (handlers);
- if (!yyvaluep)
- return;
-# ifdef YYPRINT
- if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# endif
- YYUSE (yytype);
-}
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t lexer, struct TsConfigHandlers* handlers)
-{
- YYFPRINTF (yyoutput, "%s %s (",
- yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
-
- yy_symbol_value_print (yyoutput, yytype, yyvaluep, lexer, handlers);
- YYFPRINTF (yyoutput, ")");
-}
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included). |
-`------------------------------------------------------------------*/
-
-static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-{
- YYFPRINTF (stderr, "Stack now");
- for (; yybottom <= yytop; yybottom++)
- {
- int yybot = *yybottom;
- YYFPRINTF (stderr, " %d", yybot);
- }
- YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (0)
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced. |
-`------------------------------------------------*/
-
-static void
-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t lexer, struct TsConfigHandlers* handlers)
-{
- unsigned long int yylno = yyrline[yyrule];
- int yynrhs = yyr2[yyrule];
- int yyi;
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
- /* The symbols being reduced. */
- for (yyi = 0; yyi < yynrhs; yyi++)
- {
- YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr,
- yystos[yyssp[yyi + 1 - yynrhs]],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- , lexer, handlers);
- YYFPRINTF (stderr, "\n");
- }
-}
-
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyssp, yyvsp, Rule, lexer, handlers); \
-} while (0)
-
-/* Nonzero means print parse trace. It is left uninitialized so that
- multiple parsers can coexist. */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* 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
- YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
- evaluated with infinite-precision integer arithmetic. */
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-# if defined __GLIBC__ && defined _STRING_H
-# define yystrlen strlen
-# else
-/* Return the length of YYSTR. */
-static YYSIZE_T
-yystrlen (const char *yystr)
-{
- YYSIZE_T yylen;
- for (yylen = 0; yystr[yylen]; yylen++)
- continue;
- return yylen;
-}
-# endif
-# endif
-
-# 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;
-}
-# 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 YYSIZE_T
-yytnamerr (char *yyres, const char *yystr)
-{
- if (*yystr == '"')
- {
- YYSIZE_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 yystrlen (yystr);
-
- return yystpcpy (yyres, yystr) - yyres;
-}
-# endif
-
-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
- about the unexpected token YYTOKEN for the state stack whose top is
- YYSSP.
-
- Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
- not large enough to hold the message. In that case, also set
- *YYMSG_ALLOC to the required number of bytes. Return 2 if the
- required number of bytes is too large to store. */
-static int
-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
- yytype_int16 *yyssp, int yytoken)
-{
- YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
- YYSIZE_T yysize = yysize0;
- 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[*yyssp];
- yyarg[yycount++] = yytname[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++] = yytname[yyx];
- {
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
- }
- }
- }
-
- 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_
- }
-
- {
- YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
-
- if (*yymsg_alloc < yysize)
- {
- *yymsg_alloc = 2 * yysize;
- if (! (yysize <= *yymsg_alloc
- && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
- *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
- return 1;
- }
-
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- {
- char *yyp = *yymsg;
- int yyi = 0;
- while ((*yyp = *yyformat) != '\0')
- if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyformat += 2;
- }
- else
- {
- yyp++;
- yyformat++;
- }
- }
- return 0;
-}
-#endif /* YYERROR_VERBOSE */
-
-/*-----------------------------------------------.
-| Release the memory associated to this symbol. |
-`-----------------------------------------------*/
-
-static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, yyscan_t lexer, struct TsConfigHandlers* handlers)
-{
- YYUSE (yyvaluep);
- YYUSE (lexer);
- YYUSE (handlers);
- if (!yymsg)
- yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- YYUSE (yytype);
- YY_IGNORE_MAYBE_UNINITIALIZED_END
-}
-
-
-
-
-/*----------.
-| yyparse. |
-`----------*/
-
-int
-yyparse (yyscan_t lexer, struct TsConfigHandlers* handlers)
-{
-/* The lookahead symbol. */
-int yychar;
-
-
-/* The semantic value of the lookahead symbol. */
-/* Default value used for initialization, for pacifying older GCCs
- or non-GCC compilers. */
-YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
-YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
-
- /* Number of syntax errors so far. */
- int yynerrs;
-
- int yystate;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
-
- /* The stacks and their tools:
- 'yyss': related to states.
- 'yyvs': related to semantic values.
-
- Refer to the stacks through separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
-
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss;
- yytype_int16 *yyssp;
-
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs;
- YYSTYPE *yyvsp;
-
- YYSIZE_T yystacksize;
-
- int yyn;
- int yyresult;
- /* Lookahead token as an internal (translated) token number. */
- int yytoken = 0;
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
-
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
-
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
-
- /* The number of symbols on the RHS of the reduced rule.
- Keep to zero when no symbol should be popped. */
- int yylen = 0;
-
- yyssp = yyss = yyssa;
- yyvsp = yyvs = yyvsa;
- yystacksize = YYINITDEPTH;
-
- YYDPRINTF ((stderr, "Starting parse\n"));
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
- goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
-`------------------------------------------------------------*/
- yynewstate:
- /* In all cases, when you get here, the value and location stacks
- have just been pushed. So pushing a state here evens the stacks. */
- yyssp++;
-
- yysetstate:
- *yyssp = yystate;
-
- if (yyss + yystacksize - 1 <= yyssp)
- {
- /* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- {
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
- }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
-# else
- /* Extend the stack our own way. */
- if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
- yystacksize *= 2;
- if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
-
- {
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
- }
-# endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + yysize - 1;
- yyvsp = yyvs + yysize - 1;
-
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
-
- if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
- }
-
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
- if (yystate == YYFINAL)
- YYACCEPT;
-
- goto yybackup;
-
-/*-----------.
-| yybackup. |
-`-----------*/
-yybackup:
-
- /* Do appropriate processing given the current state. Read a
- lookahead token if we need one and don't already have one. */
-
- /* First try to decide what to do without reference to lookahead token. */
- yyn = yypact[yystate];
- if (yypact_value_is_default (yyn))
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
- if (yychar == YYEMPTY)
- {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = yylex (&yylval, lexer);
- }
-
- 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);
- }
-
- /* If the proper action on seeing token YYTOKEN is to reduce or to
- detect an error, take that action. */
- yyn += yytoken;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
- goto yydefault;
- yyn = yytable[yyn];
- if (yyn <= 0)
- {
- if (yytable_value_is_error (yyn))
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
-
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
-
- /* Shift the lookahead token. */
- YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
- /* Discard the shifted token. */
- yychar = YYEMPTY;
-
- yystate = yyn;
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- *++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
-
- goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state. |
-`-----------------------------------------------------------*/
-yydefault:
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction. |
-`-----------------------------*/
-yyreduce:
- /* yyn is the number of a rule to reduce with. */
- yylen = yyr2[yyn];
-
- /* If YYLEN is nonzero, implement the default value of the action:
- '$$ = $1'.
-
- Otherwise, the following line sets YYVAL to garbage.
- This behavior is undocumented and Bison
- users should not rely upon it. Assigning to YYVAL
- unconditionally makes the parser a bit smaller, and it avoids a
- GCC warning that YYVAL may be used uninitialized. */
- yyval = yyvsp[1-yylen];
-
-
- YY_REDUCE_PRINT (yyn);
- switch (yyn)
- {
- case 4:
-#line 90 "TsConfigGrammar.y" /* yacc.c:1646 */
- { HANDLE_EVENT(GroupOpen, (yyvsp[0])); }
-#line 1330 "TsConfigGrammar.c" /* yacc.c:1646 */
- break;
-
- case 5:
-#line 92 "TsConfigGrammar.y" /* yacc.c:1646 */
- { HANDLE_EVENT(GroupClose, (yyvsp[0])); }
-#line 1336 "TsConfigGrammar.c" /* yacc.c:1646 */
- break;
-
- case 9:
-#line 96 "TsConfigGrammar.y" /* yacc.c:1646 */
- { HANDLE_EVENT(GroupName, (yyvsp[-1])); }
-#line 1342 "TsConfigGrammar.c" /* yacc.c:1646 */
- break;
-
- case 12:
-#line 100 "TsConfigGrammar.y" /* yacc.c:1646 */
- { HANDLE_EVENT(ListOpen, (yyvsp[0])); }
-#line 1348 "TsConfigGrammar.c" /* yacc.c:1646 */
- break;
-
- case 13:
-#line 102 "TsConfigGrammar.y" /* yacc.c:1646 */
- { HANDLE_EVENT(ListClose, (yyvsp[0])); }
-#line 1354 "TsConfigGrammar.c" /* yacc.c:1646 */
- break;
-
- case 17:
-#line 106 "TsConfigGrammar.y" /* yacc.c:1646 */
- { HANDLE_EVENT(LiteralValue, (yyvsp[0])); }
-#line 1360 "TsConfigGrammar.c" /* yacc.c:1646 */
- break;
-
- case 27:
-#line 114 "TsConfigGrammar.y" /* yacc.c:1646 */
- { HANDLE_EVENT(PathOpen, (yyvsp[0])); }
-#line 1366 "TsConfigGrammar.c" /* yacc.c:1646 */
- break;
-
- case 28:
-#line 116 "TsConfigGrammar.y" /* yacc.c:1646 */
- { HANDLE_EVENT(PathClose, (yyvsp[0])); }
-#line 1372 "TsConfigGrammar.c" /* yacc.c:1646 */
- break;
-
- case 31:
-#line 120 "TsConfigGrammar.y" /* yacc.c:1646 */
- { HANDLE_EVENT(PathTag, (yyvsp[0])); }
-#line 1378 "TsConfigGrammar.c" /* yacc.c:1646 */
- break;
-
- case 32:
-#line 120 "TsConfigGrammar.y" /* yacc.c:1646 */
- { HANDLE_EVENT(PathIndex, (yyvsp[0])); }
-#line 1384 "TsConfigGrammar.c" /* yacc.c:1646 */
- break;
-
-
-#line 1388 "TsConfigGrammar.c" /* yacc.c:1646 */
- default: break;
- }
- /* User semantic actions sometimes alter yychar, and that requires
- that yytoken be updated with the new translation. We take the
- approach of translating immediately before every use of yytoken.
- One alternative is translating here after every semantic action,
- but that translation would be missed if the semantic action invokes
- YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
- if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
- incorrect destructor might then be invoked immediately. In the
- case of YYERROR or YYBACKUP, subsequent parser actions might lead
- to an incorrect destructor call or verbose syntax error message
- before the lookahead is translated. */
- YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
-
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
-
- *++yyvsp = yyval;
-
- /* Now 'shift' the result of the reduction. Determine what state
- that goes to, based on the state we popped back to and the rule
- number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
-
- goto yynewstate;
-
-
-/*--------------------------------------.
-| yyerrlab -- here on detecting error. |
-`--------------------------------------*/
-yyerrlab:
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
-
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus)
- {
- ++yynerrs;
-#if ! YYERROR_VERBOSE
- yyerror (lexer, handlers, YY_("syntax error"));
-#else
-# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
- yyssp, yytoken)
- {
- char const *yymsgp = YY_("syntax error");
- int yysyntax_error_status;
- yysyntax_error_status = YYSYNTAX_ERROR;
- if (yysyntax_error_status == 0)
- yymsgp = yymsg;
- else if (yysyntax_error_status == 1)
- {
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
- if (!yymsg)
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- yysyntax_error_status = 2;
- }
- else
- {
- yysyntax_error_status = YYSYNTAX_ERROR;
- yymsgp = yymsg;
- }
- }
- yyerror (lexer, handlers, yymsgp);
- if (yysyntax_error_status == 2)
- goto yyexhaustedlab;
- }
-# undef YYSYNTAX_ERROR
-#endif
- }
-
-
-
- if (yyerrstatus == 3)
- {
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
-
- if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
- else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval, lexer, handlers);
- yychar = YYEMPTY;
- }
- }
-
- /* Else will try to reuse lookahead token after shifting the error
- token. */
- goto yyerrlab1;
-
-
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR. |
-`---------------------------------------------------*/
-yyerrorlab:
-
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
-
- /* Do not reclaim the symbols of the rule whose action triggered
- this YYERROR. */
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
- yystate = *yyssp;
- goto yyerrlab1;
-
-
-/*-------------------------------------------------------------.
-| yyerrlab1 -- common code for both syntax error and YYERROR. |
-`-------------------------------------------------------------*/
-yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
-
- for (;;)
- {
- yyn = yypact[yystate];
- if (!yypact_value_is_default (yyn))
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
-
- /* Pop the current state because it cannot handle the error token. */
- if (yyssp == yyss)
- YYABORT;
-
-
- yydestruct ("Error: popping",
- yystos[yystate], yyvsp, lexer, handlers);
- YYPOPSTACK (1);
- yystate = *yyssp;
- YY_STACK_PRINT (yyss, yyssp);
- }
-
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- *++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
-
-
- /* Shift the error token. */
- YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here. |
-`-------------------------------------*/
-yyacceptlab:
- yyresult = 0;
- goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here. |
-`-----------------------------------*/
-yyabortlab:
- yyresult = 1;
- goto yyreturn;
-
-#if !defined yyoverflow || YYERROR_VERBOSE
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here. |
-`-------------------------------------------------*/
-yyexhaustedlab:
- yyerror (lexer, handlers, YY_("memory exhausted"));
- yyresult = 2;
- /* Fall through. */
-#endif
-
-yyreturn:
- if (yychar != YYEMPTY)
- {
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = YYTRANSLATE (yychar);
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval, lexer, handlers);
- }
- /* Do not reclaim the symbols of the rule whose action triggered
- this YYABORT or YYACCEPT. */
- YYPOPSTACK (yylen);
- YY_STACK_PRINT (yyss, yyssp);
- while (yyssp != yyss)
- {
- yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp, lexer, handlers);
- YYPOPSTACK (1);
- }
-#ifndef yyoverflow
- if (yyss != yyssa)
- YYSTACK_FREE (yyss);
-#endif
-#if YYERROR_VERBOSE
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
-#endif
- return yyresult;
-}
-#line 122 "TsConfigGrammar.y" /* yacc.c:1906 */
-
-
-# endif // __clang_analyzer__
diff --git a/lib/tsconfig/TsConfigGrammar.h b/lib/tsconfig/TsConfigGrammar.h
deleted file mode 100644
index 4d98d3a..0000000
--- a/lib/tsconfig/TsConfigGrammar.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
-
-/* Bison interface for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-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 <http://www.gnu.org/licenses/>. */
-
-/* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
-#ifndef YY_TSCONFIG_TSCONFIGGRAMMAR_H_INCLUDED
-# define YY_TSCONFIG_TSCONFIGGRAMMAR_H_INCLUDED
-/* Debug traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-#if YYDEBUG
-extern int tsconfigdebug;
-#endif
-/* "%code requires" blocks. */
-#line 1 "TsConfigGrammar.y" /* yacc.c:1909 */
-
-/** @file
-
- TS Configuration grammar.
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-#line 69 "TsConfigGrammar.h" /* yacc.c:1909 */
-
-/* Token type. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- enum yytokentype
- {
- STRING = 258,
- IDENT = 259,
- INTEGER = 260,
- LIST_OPEN = 261,
- LIST_CLOSE = 262,
- GROUP_OPEN = 263,
- GROUP_CLOSE = 264,
- PATH_OPEN = 265,
- PATH_CLOSE = 266,
- PATH_SEPARATOR = 267,
- SEPARATOR = 268,
- ASSIGN = 269
- };
-#endif
-/* Tokens. */
-#define STRING 258
-#define IDENT 259
-#define INTEGER 260
-#define LIST_OPEN 261
-#define LIST_CLOSE 262
-#define GROUP_OPEN 263
-#define GROUP_CLOSE 264
-#define PATH_OPEN 265
-#define PATH_CLOSE 266
-#define PATH_SEPARATOR 267
-#define SEPARATOR 268
-#define ASSIGN 269
-
-/* Value type. */
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef int YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-
-
-int tsconfigparse (yyscan_t lexer, struct TsConfigHandlers* handlers);
-
-#endif /* !YY_TSCONFIG_TSCONFIGGRAMMAR_H_INCLUDED */
diff --git a/lib/tsconfig/TsConfigGrammar.y b/lib/tsconfig/TsConfigGrammar.y
deleted file mode 100644
index a1e65a1..0000000
--- a/lib/tsconfig/TsConfigGrammar.y
+++ /dev/null
@@ -1,124 +0,0 @@
-%code requires {
-/** @file
-
- TS Configuration grammar.
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-}
-
-%code top {
-# if ! (defined(__clang_analyzer__) || defined(__COVERITY__))
-# include "TsConfigTypes.h"
-# include <stdlib.h>
-
-// Inhibit Bison definitions.
-# define YYMALLOC malloc
-# define YYFREE free
-
-# include "TsConfigParseEvents.h"
-# include "tscore/ink_defs.h"
-
-// Types we need for the lexer.
-typedef void* yyscan_t;
-extern int tsconfiglex(YYSTYPE* yylval, yyscan_t lexer);
-
-}
-
-%code {
-
-# define HANDLE_EVENT(x,y) \
- if (handlers) { \
- struct TsConfigEventHandler* h = &(handlers->handler[TsConfigEvent##x]); \
- if (h->_f) h->_f(h->_data, &(y)); \
- }
-
-int tsconfigerror(
- yyscan_t lexer ATS_UNUSED,
- struct TsConfigHandlers* handlers,
- char const* text
-) {
- return (handlers && handlers->error._f)
- ? handlers->error._f(handlers->error._data, text)
- : 0
- ;
-}
-
-}
-
-%token STRING
-%token IDENT
-%token INTEGER
-%token LIST_OPEN
-%token LIST_CLOSE
-%token GROUP_OPEN
-%token GROUP_CLOSE
-%token PATH_OPEN
-%token PATH_CLOSE
-%token PATH_SEPARATOR
-%token SEPARATOR
-%token ASSIGN
-
-%error-verbose
-%define api.pure
-%parse-param { yyscan_t lexer }
-%parse-param { struct TsConfigHandlers* handlers }
-%lex-param { yyscan_t lexer }
-
-%%
-
-config: group_items;
-
-group: group_open group_items group_close ;
-
-group_open: GROUP_OPEN { HANDLE_EVENT(GroupOpen, $1); } ;
-
-group_close: GROUP_CLOSE { HANDLE_EVENT(GroupClose, $1); } ;
-
-group_items: /* empty */ | group_items assign separator | group_items error separator ;
-
-assign: IDENT ASSIGN { HANDLE_EVENT(GroupName, $1); } value ;
-
-list: list_open list_items list_close ;
-
-list_open: LIST_OPEN { HANDLE_EVENT(ListOpen, $1); } ;
-
-list_close: LIST_CLOSE { HANDLE_EVENT(ListClose, $1); } ;
-
-list_items: /* empty */ | list_items value separator | list_items error separator;
-
-value: literal { HANDLE_EVENT(LiteralValue, $1); } | list | group | path;
-
-literal: STRING | IDENT | INTEGER ;
-
-separator: /* empty */ | SEPARATOR ;
-
-path: path_open path_item path_close;
-
-path_open: PATH_OPEN { HANDLE_EVENT(PathOpen, $1); }
-
-path_close: PATH_CLOSE { HANDLE_EVENT(PathClose, $1); }
-
-path_item: path_tag | path_item PATH_SEPARATOR path_tag ;
-
-path_tag: IDENT { HANDLE_EVENT(PathTag, $1); } | INTEGER { HANDLE_EVENT(PathIndex, $1); };
-
-%%
-
-# endif // __clang_analyzer__
diff --git a/lib/tsconfig/TsConfigLexer.h b/lib/tsconfig/TsConfigLexer.h
deleted file mode 100644
index 40262ed..0000000
--- a/lib/tsconfig/TsConfigLexer.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/** @file
-
- A brief file description
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-# if ! defined(TS_CONFIG_LEXER_HEADER)
-# define TS_CONFIG_LEXER_HEADER
-
-struct TsConfigHandlers; // forward declare.
-
-# if defined(__cplusplus)
- extern "C" {
-# endif
-
-/// Get the current line in the buffer during parsing.
-/// @return 1 based line number.
-extern int tsconfiglex_current_line(void);
-/// Get the current column in the buffer during parsing.
-/// @return 0 base column number.
-extern int tsconfiglex_current_col(void);
-
-/** Parse @a buffer.
-
- The @a buffer is parsed and the events dispatched via @a handlers.
-
- @note The contents of @a buffer are in general modified to handle
- null termination and processing escape codes in strings. Tokens
- passed to the handlers are simply offsets in to @a buffer and
- therefore have the same lifetime as @a buffer.
-
- @return Not sure.
- */
-extern int tsconfig_parse_buffer(
- struct TsConfigHandlers* handlers, ///< Syntax handlers.
- char* buffer, ///< Input buffer.
- size_t buffer_len ///< Length of input buffer.
-);
-
-# if defined(__cplusplus)
-}
-# endif
-
-# endif // TS_CONFIG_LEXER_HEADER
diff --git a/lib/tsconfig/TsConfigParseEvents.h b/lib/tsconfig/TsConfigParseEvents.h
deleted file mode 100644
index 237514b..0000000
--- a/lib/tsconfig/TsConfigParseEvents.h
+++ /dev/null
@@ -1,67 +0,0 @@
-# if ! defined(TS_CONFIG_PARSE_EVENTS_HEADER)
-# define TS_CONFIG_PARSE_EVENTS_HEADER
-
-/** @file
-
- Definition of parsing events and handlers.
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-# include "TsConfigTypes.h"
-
-typedef void (*TsConfigEventFunction)(void* data, YYSTYPE* token);
-struct TsConfigEventHandler {
- TsConfigEventFunction _f; ///< Callback function.
- void* _data; ///< Callback context data.
-};
-typedef int (*TsConfigErrorFunction)(void* data, char const* text);
-struct TsConfigErrorHandler {
- TsConfigErrorFunction _f; ///< Callback function.
- void* _data; ///< Callback context data.
-};
-
-enum TsConfigEventType {
- TsConfigEventGroupOpen,
- TsConfigEventGroupName,
- TsConfigEventGroupClose,
- TsConfigEventListOpen,
- TsConfigEventListClose,
- TsConfigEventPathOpen,
- TsConfigEventPathTag,
- TsConfigEventPathIndex,
- TsConfigEventPathClose,
- TsConfigEventLiteralValue,
- TsConfigEventInvalidToken
-};
-
-# if defined(__cplusplus)
-static const size_t TS_CONFIG_N_EVENT_TYPES = TsConfigEventInvalidToken + 1;
-# else
-# define TS_CONFIG_N_EVENT_TYPES (TsConfigEventInvalidToken + 1)
-# endif
-
-struct TsConfigHandlers {
- struct TsConfigErrorHandler error; ///< Syntax error.
- /// Parsing event handlers.
- /// Indexed by @c TsConfigEventType.
- struct TsConfigEventHandler handler[TS_CONFIG_N_EVENT_TYPES];
-};
-
-# endif // TS_CONFIG_PARSE_EVENTS_HEADER
diff --git a/lib/tsconfig/TsConfigSyntax.c b/lib/tsconfig/TsConfigSyntax.c
deleted file mode 100644
index 8876431..0000000
--- a/lib/tsconfig/TsConfigSyntax.c
+++ /dev/null
@@ -1,2168 +0,0 @@
-#line 2 "TsConfigSyntax.c"
-
-#line 4 "TsConfigSyntax.c"
-
-#define YY_INT_ALIGNED short int
-
-/* A lexical scanner generated by flex */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 0
-#if YY_FLEX_SUBMINOR_VERSION > 0
-#define FLEX_BETA
-#endif
-
-/* First, we deal with platform-specific or compiler-specific issues. */
-
-/* begin standard C headers. */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/* end standard C headers. */
-
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
-
-/* Limits of integral types. */
-#ifndef INT8_MIN
-#define INT8_MIN (-128)
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN (-32767-1)
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN (-2147483647-1)
-#endif
-#ifndef INT8_MAX
-#define INT8_MAX (127)
-#endif
-#ifndef INT16_MAX
-#define INT16_MAX (32767)
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX (2147483647)
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX (255U)
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX (65535U)
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
-#endif
-
-#endif /* ! C99 */
-
-#endif /* ! FLEXINT_H */
-
-#ifdef __cplusplus
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
-
-/* C99 requires __STDC__ to be defined as 1. */
-#if defined (__STDC__)
-
-#define YY_USE_CONST
-
-#endif /* defined (__STDC__) */
-#endif /* ! __cplusplus */
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index. If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* An opaque pointer. */
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
-typedef void* yyscan_t;
-#endif
-
-/* For convenience, these vars (plus the bison vars far below)
- are macros in the reentrant scanner. */
-#define yyin yyg->yyin_r
-#define yyout yyg->yyout_r
-#define yyextra yyg->yyextra_r
-#define yyleng yyg->yyleng_r
-#define yytext yyg->yytext_r
-#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
-#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
-#define yy_flex_debug yyg->yy_flex_debug_r
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yyg->yy_start = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state. The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yyg->yy_start - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE tsconfigrestart(yyin ,yyscanner )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
-#define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
-#endif
-
-/* The state buf must be large enough to hold one state per character in the main buffer.
- */
-#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
-
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
- #define YY_LESS_LINENO(n)
- #define YY_LINENO_REWIND_TO(ptr)
-
-/* Return all but the first "n" matched characters back to the input stream. */
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- yy_size_t yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- *yy_cp = yyg->yy_hold_char; \
- YY_RESTORE_YY_MORE_OFFSET \
- yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-
-#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
-
-#ifndef YY_STRUCT_YY_BUFFER_STATE
-#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- yy_size_t yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- int yy_bs_lineno; /**< The line count. */
- int yy_bs_column; /**< The column count. */
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via tsconfigrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
-
- };
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- *
- * Returns the top of the stack, or NULL.
- */
-#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
- ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
- : NULL)
-
-/* Same as previous macro, but useful when we know that the buffer stack is not
- * NULL or when we need an lvalue. For internal use only.
- */
-#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
-
-void tsconfigrestart (FILE *input_file ,yyscan_t yyscanner );
-void tsconfig_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-YY_BUFFER_STATE tsconfig_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
-void tsconfig_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void tsconfig_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void tsconfigpush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-void tsconfigpop_buffer_state (yyscan_t yyscanner );
-
-static void tsconfigensure_buffer_stack (yyscan_t yyscanner );
-static void tsconfig_load_buffer_state (yyscan_t yyscanner );
-static void tsconfig_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
-
-#define YY_FLUSH_BUFFER tsconfig_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
-
-YY_BUFFER_STATE tsconfig_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
-YY_BUFFER_STATE tsconfig_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
-YY_BUFFER_STATE tsconfig_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
-
-void *tsconfigalloc (yy_size_t ,yyscan_t yyscanner );
-void *tsconfigrealloc (void *,yy_size_t ,yyscan_t yyscanner );
-void tsconfigfree (void * ,yyscan_t yyscanner );
-
-#define yy_new_buffer tsconfig_create_buffer
-
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! YY_CURRENT_BUFFER ){ \
- tsconfigensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
- tsconfig_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
- }
-
-#define yy_set_bol(at_bol) \
- { \
- if ( ! YY_CURRENT_BUFFER ){\
- tsconfigensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
- tsconfig_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
- }
-
-#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
-
-/* Begin user sect3 */
-
-#define tsconfigwrap(yyscanner) (/*CONSTCOND*/1)
-#define YY_SKIP_YYWRAP
-
-typedef unsigned char YY_CHAR;
-
-typedef int yy_state_type;
-
-#define yytext_ptr yytext_r
-
-static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
-static int yy_get_next_buffer (yyscan_t yyscanner );
-#if defined(__GNUC__) && __GNUC__ >= 3
-__attribute__((__noreturn__))
-#endif
-static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
- yyg->yytext_ptr = yy_bp; \
- yyleng = (size_t) (yy_cp - yy_bp); \
- yyg->yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
- yyg->yy_c_buf_p = yy_cp;
-
-#define YY_NUM_RULES 21
-#define YY_END_OF_BUFFER 22
-/* This struct is not used in this scanner,
- but its presence is necessary. */
-struct yy_trans_info
- {
- flex_int32_t yy_verify;
- flex_int32_t yy_nxt;
- };
-static yyconst flex_int16_t yy_accept[48] =
- { 0,
- 0, 0, 0, 0, 22, 17, 3, 1, 17, 17,
- 10, 11, 16, 14, 17, 7, 12, 15, 13, 6,
- 8, 9, 3, 1, 17, 20, 19, 18, 3, 0,
- 2, 0, 0, 0, 16, 0, 7, 0, 6, 3,
- 0, 0, 0, 4, 0, 5, 0
- } ;
-
-static yyconst YY_CHAR yy_ec[256] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 1, 4, 5, 1, 1, 1, 6, 7,
- 8, 1, 1, 9, 10, 11, 12, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 1, 9, 14,
- 15, 16, 1, 1, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
- 1, 18, 1, 1, 17, 1, 17, 17, 17, 17,
-
- 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 19, 1, 20, 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
- } ;
-
-static yyconst YY_CHAR yy_meta[21] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
- 1, 1, 2, 1, 1, 1, 2, 1, 1, 1
- } ;
-
-static yyconst flex_uint16_t yy_base[54] =
- { 0,
- 0, 19, 23, 25, 67, 68, 64, 68, 19, 23,
- 68, 68, 56, 68, 52, 50, 68, 68, 68, 52,
- 68, 68, 28, 59, 57, 68, 68, 68, 57, 28,
- 68, 55, 29, 42, 35, 40, 29, 30, 0, 0,
- 0, 36, 35, 68, 33, 68, 68, 47, 49, 51,
- 32, 53, 55
- } ;
-
-static yyconst flex_int16_t yy_def[54] =
- { 0,
- 47, 1, 48, 48, 47, 47, 47, 47, 49, 50,
- 47, 47, 47, 47, 47, 47, 47, 47, 47, 51,
- 47, 47, 47, 23, 52, 47, 47, 47, 47, 49,
- 47, 49, 50, 50, 47, 53, 47, 51, 38, 23,
- 24, 52, 52, 47, 53, 47, 0, 47, 47, 47,
- 47, 47, 47
- } ;
-
-static yyconst flex_uint16_t yy_nxt[89] =
- { 0,
- 6, 7, 8, 9, 6, 10, 11, 12, 13, 6,
- 14, 15, 16, 17, 18, 19, 20, 6, 21, 22,
- 23, 24, 31, 25, 27, 28, 27, 28, 31, 40,
- 41, 31, 42, 39, 31, 46, 32, 44, 44, 38,
- 34, 37, 46, 35, 47, 32, 34, 26, 26, 30,
- 30, 33, 33, 43, 43, 45, 45, 47, 29, 44,
- 41, 38, 37, 36, 35, 29, 47, 5, 47, 47,
- 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
- 47, 47, 47, 47, 47, 47, 47, 47
- } ;
-
-static yyconst flex_int16_t yy_chk[89] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 9, 2, 3, 3, 4, 4, 10, 23,
- 23, 30, 23, 51, 33, 45, 9, 43, 42, 38,
- 10, 37, 36, 35, 34, 30, 33, 48, 48, 49,
- 49, 50, 50, 52, 52, 53, 53, 32, 29, 25,
- 24, 20, 16, 15, 13, 7, 5, 47, 47, 47,
- 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
- 47, 47, 47, 47, 47, 47, 47, 47
- } ;
-
-/* The intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed.
- */
-#define REJECT reject_used_but_not_detected
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-#line 1 "TsConfigSyntax.l"
-#line 2 "TsConfigSyntax.l"
-
-/** @file
-
- Syntactic analyzer for TS Configuration.
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-# if defined(__GNUC__)
-# pragma GCC diagnostic ignored "-Wsign-compare"
-# endif
-
-
-# if ! (defined(__clang_analyzer__) || defined(__COVERITY__))
-
-# include "TsConfigParseEvents.h"
-# include "TsConfigGrammar.h"
-
-extern int tsconfigparse(yyscan_t lexer, struct TsConfigHandlers* handlers);
-
-struct Location TsConfig_Lex_Location = { 0, 1 };
-
-# define YY_USER_ACTION TsConfig_Lex_Location._col += yyleng;
-
-# define FILL \
- yylval->_s = yytext; \
- yylval->_n = yyleng; \
- yylval->_loc = TsConfig_Lex_Location; \
- yylval->_loc._col -= yyleng;
-
-# define ZRET(t) FILL; yylval->_type = t; return t;
-
-# define HANDLE_EVENT(x) \
- if (yyextra) { \
- struct TsConfigEventHandler* h = &(yyextra->handler[TsConfigEvent##x]); \
- if (h->_f) h->_f(h->_data, yylval); \
- }
-
-#define YY_NO_INPUT 1
-
-#line 533 "TsConfigSyntax.c"
-
-#define INITIAL 0
-#define bad 1
-
-#ifndef YY_NO_UNISTD_H
-/* Special case for "unistd.h", since it is non-ANSI. We include it way
- * down here because we want the user's section 1 to have been scanned first.
- * The user has a chance to override it with an option.
- */
-#include <unistd.h>
-#endif
-
-#define YY_EXTRA_TYPE struct TsConfigHandlers*
-
-/* Holds the entire state of the reentrant scanner. */
-struct yyguts_t
- {
-
- /* User-defined. Not touched by flex. */
- YY_EXTRA_TYPE yyextra_r;
-
- /* The rest are the same as the globals declared in the non-reentrant scanner. */
- FILE *yyin_r, *yyout_r;
- size_t yy_buffer_stack_top; /**< index of top of stack. */
- size_t yy_buffer_stack_max; /**< capacity of stack. */
- YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
- char yy_hold_char;
- yy_size_t yy_n_chars;
- yy_size_t yyleng_r;
- char *yy_c_buf_p;
- int yy_init;
- int yy_start;
- int yy_did_buffer_switch_on_eof;
- int yy_start_stack_ptr;
- int yy_start_stack_depth;
- int *yy_start_stack;
- yy_state_type yy_last_accepting_state;
- char* yy_last_accepting_cpos;
-
- int yylineno_r;
- int yy_flex_debug_r;
-
- char *yytext_r;
- int yy_more_flag;
- int yy_more_len;
-
- YYSTYPE * yylval_r;
-
- }; /* end struct yyguts_t */
-
-static int yy_init_globals (yyscan_t yyscanner );
-
- /* This must go here because YYSTYPE and YYLTYPE are included
- * from bison output in section 1.*/
- # define yylval yyg->yylval_r
-
-int tsconfiglex_init (yyscan_t* scanner);
-
-int tsconfiglex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
-
-/* Accessor methods to globals.
- These are made visible to non-reentrant scanners for convenience. */
-
-int tsconfiglex_destroy (yyscan_t yyscanner );
-
-int tsconfigget_debug (yyscan_t yyscanner );
-
-void tsconfigset_debug (int debug_flag ,yyscan_t yyscanner );
-
-YY_EXTRA_TYPE tsconfigget_extra (yyscan_t yyscanner );
-
-void tsconfigset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
-
-FILE *tsconfigget_in (yyscan_t yyscanner );
-
-void tsconfigset_in (FILE * _in_str ,yyscan_t yyscanner );
-
-FILE *tsconfigget_out (yyscan_t yyscanner );
-
-void tsconfigset_out (FILE * _out_str ,yyscan_t yyscanner );
-
-yy_size_t tsconfigget_leng (yyscan_t yyscanner );
-
-char *tsconfigget_text (yyscan_t yyscanner );
-
-int tsconfigget_lineno (yyscan_t yyscanner );
-
-void tsconfigset_lineno (int _line_number ,yyscan_t yyscanner );
-
-int tsconfigget_column (yyscan_t yyscanner );
-
-void tsconfigset_column (int _column_no ,yyscan_t yyscanner );
-
-YYSTYPE * tsconfigget_lval (yyscan_t yyscanner );
-
-void tsconfigset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int tsconfigwrap (yyscan_t yyscanner );
-#else
-extern int tsconfigwrap (yyscan_t yyscanner );
-#endif
-#endif
-
-#ifndef YY_NO_UNPUT
-
-#endif
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
-#endif
-
-#ifndef YY_NO_INPUT
-
-#ifdef __cplusplus
-static int yyinput (yyscan_t yyscanner );
-#else
-static int input (yyscan_t yyscanner );
-#endif
-
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
-#define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
-#endif
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
- if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
- { \
- int c = '*'; \
- size_t n; \
- for ( n = 0; n < max_size && \
- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else \
- { \
- errno=0; \
- while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
- { \
- if( errno != EINTR) \
- { \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- break; \
- } \
- errno=0; \
- clearerr(yyin); \
- } \
- }\
-\
-
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
-#endif
-
-/* end tables serialization structures and prototypes */
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL_IS_OURS 1
-
-extern int tsconfiglex \
- (YYSTYPE * yylval_param ,yyscan_t yyscanner);
-
-#define YY_DECL int tsconfiglex \
- (YYSTYPE * yylval_param , yyscan_t yyscanner)
-#endif /* !YY_DECL */
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK /*LINTED*/break;
-#endif
-
-#define YY_RULE_SETUP \
- if ( yyleng > 0 ) \
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
- (yytext[yyleng - 1] == '\n'); \
- YY_USER_ACTION
-
-/** The main scanner function which does all the work.
- */
-YY_DECL
-{
- yy_state_type yy_current_state;
- char *yy_cp, *yy_bp;
- int yy_act;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- yylval = yylval_param;
-
- if ( !yyg->yy_init )
- {
- yyg->yy_init = 1;
-
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
- if ( ! yyg->yy_start )
- yyg->yy_start = 1; /* first start state */
-
- if ( ! yyin )
- yyin = stdin;
-
- if ( ! yyout )
- yyout = stdout;
-
- if ( ! YY_CURRENT_BUFFER ) {
- tsconfigensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- tsconfig_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
- }
-
- tsconfig_load_buffer_state(yyscanner );
- }
-
- {
-#line 71 "TsConfigSyntax.l"
-
-
-#line 811 "TsConfigSyntax.c"
-
- while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
- {
- yy_cp = yyg->yy_c_buf_p;
-
- /* Support of yytext. */
- *yy_cp = yyg->yy_hold_char;
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
- yy_current_state = yyg->yy_start;
- yy_current_state += YY_AT_BOL();
-yy_match:
- do
- {
- YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 48 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- ++yy_cp;
- }
- while ( yy_current_state != 47 );
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
-
-yy_find_action:
- yy_act = yy_accept[yy_current_state];
-
- YY_DO_BEFORE_ACTION;
-
-do_action: /* This label is used only to access EOF actions. */
-
- switch ( yy_act )
- { /* beginning of action switch */
- case 0: /* must back up */
- /* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = yyg->yy_hold_char;
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- goto yy_find_action;
-
-case 1:
-/* rule 1 can match eol */
-YY_RULE_SETUP
-#line 73 "TsConfigSyntax.l"
-{
- ++(TsConfig_Lex_Location._line);
- TsConfig_Lex_Location._col = 0;
- }
- YY_BREAK
-case 2:
-/* rule 2 can match eol */
-YY_RULE_SETUP
-#line 78 "TsConfigSyntax.l"
-ZRET(STRING); /* Quote string overrides comments */
- YY_BREAK
-case 3:
-YY_RULE_SETUP
-#line 80 "TsConfigSyntax.l"
-/* Ignore all white space. */
- YY_BREAK
-case 4:
-/* rule 4 can match eol */
-*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
-YY_LINENO_REWIND_TO(yy_cp - 1);
-yyg->yy_c_buf_p = yy_cp -= 1;
-YY_DO_BEFORE_ACTION; /* set up yytext again */
-YY_RULE_SETUP
-#line 81 "TsConfigSyntax.l"
-/* Leading '#' is a comment. */
- YY_BREAK
-case 5:
-*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
-yyg->yy_c_buf_p = yy_cp -= 1;
-YY_DO_BEFORE_ACTION; /* set up yytext again */
-YY_RULE_SETUP
-#line 82 "TsConfigSyntax.l"
-/* Trailing '//' is a comment. */
- YY_BREAK
-case 6:
-YY_RULE_SETUP
-#line 84 "TsConfigSyntax.l"
-ZRET(IDENT);
- YY_BREAK
-case 7:
-YY_RULE_SETUP
-#line 85 "TsConfigSyntax.l"
-ZRET(INTEGER);
- YY_BREAK
-case 8:
-YY_RULE_SETUP
-#line 86 "TsConfigSyntax.l"
-ZRET(GROUP_OPEN);
- YY_BREAK
-case 9:
-YY_RULE_SETUP
-#line 87 "TsConfigSyntax.l"
-ZRET(GROUP_CLOSE);
- YY_BREAK
-case 10:
-YY_RULE_SETUP
-#line 88 "TsConfigSyntax.l"
-ZRET(LIST_OPEN);
- YY_BREAK
-case 11:
-YY_RULE_SETUP
-#line 89 "TsConfigSyntax.l"
-ZRET(LIST_CLOSE);
- YY_BREAK
-case 12:
-YY_RULE_SETUP
-#line 90 "TsConfigSyntax.l"
-ZRET(PATH_OPEN);
- YY_BREAK
-case 13:
-YY_RULE_SETUP
-#line 91 "TsConfigSyntax.l"
-ZRET(PATH_CLOSE);
- YY_BREAK
-case 14:
-YY_RULE_SETUP
-#line 92 "TsConfigSyntax.l"
-ZRET(PATH_SEPARATOR);
- YY_BREAK
-case 15:
-YY_RULE_SETUP
-#line 93 "TsConfigSyntax.l"
-ZRET(ASSIGN);
- YY_BREAK
-case 16:
-YY_RULE_SETUP
-#line 94 "TsConfigSyntax.l"
-ZRET(SEPARATOR);
- YY_BREAK
-case 17:
-YY_RULE_SETUP
-#line 96 "TsConfigSyntax.l"
-BEGIN(bad); FILL;
- YY_BREAK
-case 18:
-/* rule 18 can match eol */
-YY_RULE_SETUP
-#line 97 "TsConfigSyntax.l"
-{
- BEGIN(0); // Terminate bad token mode.
- ++(TsConfig_Lex_Location._line); // Must bump line count.
- HANDLE_EVENT(InvalidToken);
- }
- YY_BREAK
-case 19:
-/* rule 19 can match eol */
-YY_RULE_SETUP
-#line 102 "TsConfigSyntax.l"
-BEGIN(0); HANDLE_EVENT(InvalidToken);
- YY_BREAK
-case 20:
-YY_RULE_SETUP
-#line 103 "TsConfigSyntax.l"
-++(yylval->_n);
- YY_BREAK
-case 21:
-YY_RULE_SETUP
-#line 104 "TsConfigSyntax.l"
-ECHO;
- YY_BREAK
-#line 989 "TsConfigSyntax.c"
-case YY_STATE_EOF(INITIAL):
-case YY_STATE_EOF(bad):
- yyterminate();
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yyg->yy_hold_char;
- YY_RESTORE_YY_MORE_OFFSET
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * tsconfiglex(). If so, then we have to assure
- * consistency between YY_CURRENT_BUFFER and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
-
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yyg->yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer( yyscanner ) )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yyg->yy_did_buffer_switch_on_eof = 0;
-
- if ( tsconfigwrap(yyscanner ) )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p =
- yyg->yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yyg->yy_c_buf_p =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
- } /* end of user's declarations */
-} /* end of tsconfiglex */
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-static int yy_get_next_buffer (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- char *source = yyg->yytext_ptr;
- yy_size_t number_to_move, i;
- int ret_val;
-
- if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
-
- else
- {
- int num_to_read =
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
-
- int yy_c_buf_p_offset =
- (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer )
- {
- yy_size_t new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- tsconfigrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
- number_to_move - 1;
-
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- yyg->yy_n_chars, num_to_read );
-
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- if ( yyg->yy_n_chars == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- tsconfigrestart(yyin ,yyscanner);
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
- /* Extend the array by 50%, plus the number we really need. */
- yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) tsconfigrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
- if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
- }
-
- yyg->yy_n_chars += number_to_move;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
- yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
-
- return ret_val;
-}
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
- static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
-{
- yy_state_type yy_current_state;
- char *yy_cp;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- yy_current_state = yyg->yy_start;
- yy_current_state += YY_AT_BOL();
-
- for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
- {
- YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 48 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- }
-
- return yy_current_state;
-}
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
- static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
-{
- int yy_is_jam;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
- char *yy_cp = yyg->yy_c_buf_p;
-
- YY_CHAR yy_c = 1;
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 48 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 47);
-
- (void)yyg;
- return yy_is_jam ? 0 : yy_current_state;
-}
-
-#ifndef YY_NO_UNPUT
-
-#endif
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
- static int yyinput (yyscan_t yyscanner)
-#else
- static int input (yyscan_t yyscanner)
-#endif
-
-{
- int c;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
-
- if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
- /* This was really a NUL. */
- *yyg->yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
- ++yyg->yy_c_buf_p;
-
- switch ( yy_get_next_buffer( yyscanner ) )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- tsconfigrestart(yyin ,yyscanner);
-
- /*FALLTHROUGH*/
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( tsconfigwrap(yyscanner ) )
- return EOF;
-
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput(yyscanner);
-#else
- return input(yyscanner);
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
- break;
- }
- }
- }
-
- c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
- *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
- yyg->yy_hold_char = *++yyg->yy_c_buf_p;
-
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
-
- return c;
-}
-#endif /* ifndef YY_NO_INPUT */
-
-/** Immediately switch to a different input stream.
- * @param input_file A readable stream.
- * @param yyscanner The scanner object.
- * @note This function does not reset the start condition to @c INITIAL .
- */
- void tsconfigrestart (FILE * input_file , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if ( ! YY_CURRENT_BUFFER ){
- tsconfigensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- tsconfig_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
- }
-
- tsconfig_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
- tsconfig_load_buffer_state(yyscanner );
-}
-
-/** Switch to a different input buffer.
- * @param new_buffer The new input buffer.
- * @param yyscanner The scanner object.
- */
- void tsconfig_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* TODO. We should be able to replace this entire function body
- * with
- * tsconfigpop_buffer_state();
- * tsconfigpush_buffer_state(new_buffer);
- */
- tsconfigensure_buffer_stack (yyscanner);
- if ( YY_CURRENT_BUFFER == new_buffer )
- return;
-
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
- tsconfig_load_buffer_state(yyscanner );
-
- /* We don't actually know whether we did this switch during
- * EOF (tsconfigwrap()) processing, but the only time this flag
- * is looked at is after tsconfigwrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yyg->yy_did_buffer_switch_on_eof = 1;
-}
-
-static void tsconfig_load_buffer_state (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
- yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
- yyg->yy_hold_char = *yyg->yy_c_buf_p;
-}
-
-/** Allocate and initialize an input buffer state.
- * @param file A readable stream.
- * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- * @param yyscanner The scanner object.
- * @return the allocated buffer state.
- */
- YY_BUFFER_STATE tsconfig_create_buffer (FILE * file, int size , yyscan_t yyscanner)
-{
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) tsconfigalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in tsconfig_create_buffer()" );
-
- b->yy_buf_size = (yy_size_t)size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) tsconfigalloc(b->yy_buf_size + 2 ,yyscanner );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in tsconfig_create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- tsconfig_init_buffer(b,file ,yyscanner);
-
- return b;
-}
-
-/** Destroy the buffer.
- * @param b a buffer created with tsconfig_create_buffer()
- * @param yyscanner The scanner object.
- */
- void tsconfig_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if ( ! b )
- return;
-
- if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
- YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
-
- if ( b->yy_is_our_buffer )
- tsconfigfree((void *) b->yy_ch_buf ,yyscanner );
-
- tsconfigfree((void *) b ,yyscanner );
-}
-
-/* Initializes or reinitializes a buffer.
- * This function is sometimes called more than once on the same buffer,
- * such as during a tsconfigrestart() or at EOF.
- */
- static void tsconfig_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
-
-{
- int oerrno = errno;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- tsconfig_flush_buffer(b ,yyscanner);
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
- /* If b is the current buffer, then tsconfig_init_buffer was _probably_
- * called from tsconfigrestart() or through yy_get_next_buffer.
- * In that case, we don't want to reset the lineno or column.
- */
- if (b != YY_CURRENT_BUFFER){
- b->yy_bs_lineno = 1;
- b->yy_bs_column = 0;
- }
-
- b->yy_is_interactive = 0;
-
- errno = oerrno;
-}
-
-/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
- * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- * @param yyscanner The scanner object.
- */
- void tsconfig_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if ( ! b )
- return;
-
- b->yy_n_chars = 0;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[0];
-
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- if ( b == YY_CURRENT_BUFFER )
- tsconfig_load_buffer_state(yyscanner );
-}
-
-/** Pushes the new state onto the stack. The new state becomes
- * the current state. This function will allocate the stack
- * if necessary.
- * @param new_buffer The new state.
- * @param yyscanner The scanner object.
- */
-void tsconfigpush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (new_buffer == NULL)
- return;
-
- tsconfigensure_buffer_stack(yyscanner);
-
- /* This block is copied from tsconfig_switch_to_buffer. */
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- /* Only push if top exists. Otherwise, replace top. */
- if (YY_CURRENT_BUFFER)
- yyg->yy_buffer_stack_top++;
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
-
- /* copied from tsconfig_switch_to_buffer. */
- tsconfig_load_buffer_state(yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
-}
-
-/** Removes and deletes the top of the stack, if present.
- * The next element becomes the new top.
- * @param yyscanner The scanner object.
- */
-void tsconfigpop_buffer_state (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (!YY_CURRENT_BUFFER)
- return;
-
- tsconfig_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
- YY_CURRENT_BUFFER_LVALUE = NULL;
- if (yyg->yy_buffer_stack_top > 0)
- --yyg->yy_buffer_stack_top;
-
- if (YY_CURRENT_BUFFER) {
- tsconfig_load_buffer_state(yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
- }
-}
-
-/* Allocates the stack if it does not exist.
- * Guarantees space for at least one push.
- */
-static void tsconfigensure_buffer_stack (yyscan_t yyscanner)
-{
- yy_size_t num_to_alloc;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if (!yyg->yy_buffer_stack) {
-
- /* First allocation is just for 2 elements, since we don't know if this
- * scanner will even need a stack. We use 2 instead of 1 to avoid an
- * immediate realloc on the next call.
- */
- num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
- yyg->yy_buffer_stack = (struct yy_buffer_state**)tsconfigalloc
- (num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in tsconfigensure_buffer_stack()" );
-
- memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
- yyg->yy_buffer_stack_max = num_to_alloc;
- yyg->yy_buffer_stack_top = 0;
- return;
- }
-
- if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
-
- /* Increase the buffer to prepare for a possible push. */
- yy_size_t grow_size = 8 /* arbitrary grow size */;
-
- num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
- yyg->yy_buffer_stack = (struct yy_buffer_state**)tsconfigrealloc
- (yyg->yy_buffer_stack,
- num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in tsconfigensure_buffer_stack()" );
-
- /* zero only the new slots.*/
- memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
- yyg->yy_buffer_stack_max = num_to_alloc;
- }
-}
-
-/** Setup the input buffer state to scan directly from a user-specified character buffer.
- * @param base the character buffer
- * @param size the size in bytes of the character buffer
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE tsconfig_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
-{
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return 0;
-
- b = (YY_BUFFER_STATE) tsconfigalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in tsconfig_scan_buffer()" );
-
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- tsconfig_switch_to_buffer(b ,yyscanner );
-
- return b;
-}
-
-/** Setup the input buffer state to scan a string. The next call to tsconfiglex() will
- * scan from a @e copy of @a str.
- * @param yystr a NUL-terminated string to scan
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- * @note If you want to scan bytes that may contain NUL values, then use
- * tsconfig_scan_bytes() instead.
- */
-YY_BUFFER_STATE tsconfig_scan_string (yyconst char * yystr , yyscan_t yyscanner)
-{
-
- return tsconfig_scan_bytes(yystr,strlen(yystr) ,yyscanner);
-}
-
-/** Setup the input buffer state to scan the given bytes. The next call to tsconfiglex() will
- * scan from a @e copy of @a bytes.
- * @param yybytes the byte buffer to scan
- * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE tsconfig_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
-{
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- yy_size_t i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = _yybytes_len + 2;
- buf = (char *) tsconfigalloc(n ,yyscanner );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in tsconfig_scan_bytes()" );
-
- for ( i = 0; i < _yybytes_len; ++i )
- buf[i] = yybytes[i];
-
- buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = tsconfig_scan_buffer(buf,n ,yyscanner);
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in tsconfig_scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
-}
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
- (void) fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
-}
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- yy_size_t yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- yytext[yyleng] = yyg->yy_hold_char; \
- yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
- yyg->yy_hold_char = *yyg->yy_c_buf_p; \
- *yyg->yy_c_buf_p = '\0'; \
- yyleng = yyless_macro_arg; \
- } \
- while ( 0 )
-
-/* Accessor methods (get/set functions) to struct members. */
-
-/** Get the user-defined data for this scanner.
- * @param yyscanner The scanner object.
- */
-YY_EXTRA_TYPE tsconfigget_extra (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyextra;
-}
-
-/** Get the current line number.
- * @param yyscanner The scanner object.
- */
-int tsconfigget_lineno (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if (! YY_CURRENT_BUFFER)
- return 0;
-
- return yylineno;
-}
-
-/** Get the current column number.
- * @param yyscanner The scanner object.
- */
-int tsconfigget_column (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if (! YY_CURRENT_BUFFER)
- return 0;
-
- return yycolumn;
-}
-
-/** Get the input stream.
- * @param yyscanner The scanner object.
- */
-FILE *tsconfigget_in (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyin;
-}
-
-/** Get the output stream.
- * @param yyscanner The scanner object.
- */
-FILE *tsconfigget_out (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyout;
-}
-
-/** Get the length of the current token.
- * @param yyscanner The scanner object.
- */
-yy_size_t tsconfigget_leng (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyleng;
-}
-
-/** Get the current token.
- * @param yyscanner The scanner object.
- */
-
-char *tsconfigget_text (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yytext;
-}
-
-/** Set the user-defined data. This data is never touched by the scanner.
- * @param user_defined The data to be associated with this scanner.
- * @param yyscanner The scanner object.
- */
-void tsconfigset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyextra = user_defined ;
-}
-
-/** Set the current line number.
- * @param _line_number line number
- * @param yyscanner The scanner object.
- */
-void tsconfigset_lineno (int _line_number , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* lineno is only valid if an input buffer exists. */
- if (! YY_CURRENT_BUFFER )
- YY_FATAL_ERROR( "tsconfigset_lineno called with no buffer" );
-
- yylineno = _line_number;
-}
-
-/** Set the current column.
- * @param _column_no column number
- * @param yyscanner The scanner object.
- */
-void tsconfigset_column (int _column_no , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* column is only valid if an input buffer exists. */
- if (! YY_CURRENT_BUFFER )
- YY_FATAL_ERROR( "tsconfigset_column called with no buffer" );
-
- yycolumn = _column_no;
-}
-
-/** Set the input stream. This does not discard the current
- * input buffer.
- * @param _in_str A readable stream.
- * @param yyscanner The scanner object.
- * @see tsconfig_switch_to_buffer
- */
-void tsconfigset_in (FILE * _in_str , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyin = _in_str ;
-}
-
-void tsconfigset_out (FILE * _out_str , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyout = _out_str ;
-}
-
-int tsconfigget_debug (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yy_flex_debug;
-}
-
-void tsconfigset_debug (int _bdebug , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yy_flex_debug = _bdebug ;
-}
-
-/* Accessor methods for yylval and yylloc */
-
-YYSTYPE * tsconfigget_lval (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yylval;
-}
-
-void tsconfigset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yylval = yylval_param;
-}
-
-/* User-visible API */
-
-/* tsconfiglex_init is special because it creates the scanner itself, so it is
- * the ONLY reentrant function that doesn't take the scanner as the last argument.
- * That's why we explicitly handle the declaration, instead of using our macros.
- */
-
-int tsconfiglex_init(yyscan_t* ptr_yy_globals)
-
-{
- if (ptr_yy_globals == NULL){
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) tsconfigalloc ( sizeof( struct yyguts_t ), NULL );
-
- if (*ptr_yy_globals == NULL){
- errno = ENOMEM;
- return 1;
- }
-
- /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
- return yy_init_globals ( *ptr_yy_globals );
-}
-
-/* tsconfiglex_init_extra has the same functionality as tsconfiglex_init, but follows the
- * convention of taking the scanner as the last argument. Note however, that
- * this is a *pointer* to a scanner, as it will be allocated by this call (and
- * is the reason, too, why this function also must handle its own declaration).
- * The user defined value in the first argument will be available to tsconfigalloc in
- * the yyextra field.
- */
-
-int tsconfiglex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
-
-{
- struct yyguts_t dummy_yyguts;
-
- tsconfigset_extra (yy_user_defined, &dummy_yyguts);
-
- if (ptr_yy_globals == NULL){
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) tsconfigalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
-
- if (*ptr_yy_globals == NULL){
- errno = ENOMEM;
- return 1;
- }
-
- /* By setting to 0xAA, we expose bugs in
- yy_init_globals. Leave at 0x00 for releases. */
- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
- tsconfigset_extra (yy_user_defined, *ptr_yy_globals);
-
- return yy_init_globals ( *ptr_yy_globals );
-}
-
-static int yy_init_globals (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- /* Initialization is the same as for the non-reentrant scanner.
- * This function is called from tsconfiglex_destroy(), so don't allocate here.
- */
-
- yyg->yy_buffer_stack = 0;
- yyg->yy_buffer_stack_top = 0;
- yyg->yy_buffer_stack_max = 0;
- yyg->yy_c_buf_p = (char *) 0;
- yyg->yy_init = 0;
- yyg->yy_start = 0;
-
- yyg->yy_start_stack_ptr = 0;
- yyg->yy_start_stack_depth = 0;
- yyg->yy_start_stack = NULL;
-
-/* Defined in main.c */
-#ifdef YY_STDINIT
- yyin = stdin;
- yyout = stdout;
-#else
- yyin = (FILE *) 0;
- yyout = (FILE *) 0;
-#endif
-
- /* For future reference: Set errno on error, since we are called by
- * tsconfiglex_init()
- */
- return 0;
-}
-
-/* tsconfiglex_destroy is for both reentrant and non-reentrant scanners. */
-int tsconfiglex_destroy (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* Pop the buffer stack, destroying each element. */
- while(YY_CURRENT_BUFFER){
- tsconfig_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
- YY_CURRENT_BUFFER_LVALUE = NULL;
- tsconfigpop_buffer_state(yyscanner);
- }
-
- /* Destroy the stack itself. */
- tsconfigfree(yyg->yy_buffer_stack ,yyscanner);
- yyg->yy_buffer_stack = NULL;
-
- /* Destroy the start condition stack. */
- tsconfigfree(yyg->yy_start_stack ,yyscanner );
- yyg->yy_start_stack = NULL;
-
- /* Reset the globals. This is important in a non-reentrant scanner so the next time
- * tsconfiglex() is called, initialization will occur. */
- yy_init_globals( yyscanner);
-
- /* Destroy the main struct (reentrant only). */
- tsconfigfree ( yyscanner , yyscanner );
- yyscanner = NULL;
- return 0;
-}
-
-/*
- * Internal utility routines.
- */
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
-
- int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
-}
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
-{
- int n;
- for ( n = 0; s[n]; ++n )
- ;
-
- return n;
-}
-#endif
-
-void *tsconfigalloc (yy_size_t size , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
- return (void *) malloc( size );
-}
-
-void *tsconfigrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
-
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return (void *) realloc( (char *) ptr, size );
-}
-
-void tsconfigfree (void * ptr , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
- free( (char *) ptr ); /* see tsconfigrealloc() for (char *) cast */
-}
-
-#define YYTABLES_NAME "yytables"
-
-#line 104 "TsConfigSyntax.l"
-
-
-
-int tsconfiglex_current_line(void) { return TsConfig_Lex_Location._line; }
-int tsconfiglex_current_col(void) { return TsConfig_Lex_Location._col; }
-
-// This is in here because it's easier than trying to convince automake
-// to let me have a generated header from flex. The header is only needed
-// to define the various macros used here outside of the .l file so if
-// this is here, we don't need the header anymore. This also means we
-// don't have to deal with C/C++ issues in that regard either.
-int tsconfig_parse_buffer(
- struct TsConfigHandlers* handlers,
- char* buffer,
- size_t buffer_len
-) {
- int zret;
- yyscan_t lexer;
- YY_BUFFER_STATE lexer_buffer_state;
-
- tsconfiglex_init(&lexer);
- tsconfigset_extra(handlers, lexer);
- lexer_buffer_state = tsconfig_scan_buffer(buffer, buffer_len, lexer);
- zret = tsconfigparse(lexer, handlers);
- tsconfig_delete_buffer(lexer_buffer_state, lexer);
- tsconfiglex_destroy(lexer);
-
- return zret;
-}
-
-# endif // __clang_analyzer__
-
diff --git a/lib/tsconfig/TsConfigSyntax.l b/lib/tsconfig/TsConfigSyntax.l
deleted file mode 100644
index dc11a2f..0000000
--- a/lib/tsconfig/TsConfigSyntax.l
+++ /dev/null
@@ -1,133 +0,0 @@
-%{
-
-/** @file
-
- Syntactic analyzer for TS Configuration.
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-# if defined(__GNUC__)
-# pragma GCC diagnostic ignored "-Wsign-compare"
-# endif
-
-
-# if ! (defined(__clang_analyzer__) || defined(__COVERITY__))
-
-# include "TsConfigParseEvents.h"
-# include "TsConfigGrammar.h"
-
-extern int tsconfigparse(yyscan_t lexer, struct TsConfigHandlers* handlers);
-
-struct Location TsConfig_Lex_Location = { 0, 1 };
-
-# define YY_USER_ACTION TsConfig_Lex_Location._col += yyleng;
-
-# define FILL \
- yylval->_s = yytext; \
- yylval->_n = yyleng; \
- yylval->_loc = TsConfig_Lex_Location; \
- yylval->_loc._col -= yyleng;
-
-# define ZRET(t) FILL; yylval->_type = t; return t;
-
-# define HANDLE_EVENT(x) \
- if (yyextra) { \
- struct TsConfigEventHandler* h = &(yyextra->handler[TsConfigEvent##x]); \
- if (h->_f) h->_f(h->_data, yylval); \
- }
-
-%}
-
-%option outfile="lex.yy.c"
-%option never-interactive reentrant bison-bridge noyywrap
-%option prefix="tsconfig"
-%option nounput noinput
-%option extra-type="struct TsConfigHandlers*"
-
-DSTRING \"(?:[^\"\\]|\\.)*\"
-SSTRING '(?:[^'\\]|\\.)*'
-QSTRING {DSTRING}|{SSTRING}
-IDENT [[:alpha:]_](?:-*[[:alnum:]_])*
-
-%x bad
-
-%%
-
-\n {
- ++(TsConfig_Lex_Location._line);
- TsConfig_Lex_Location._col = 0;
- }
-
-{QSTRING} ZRET(STRING); /* Quote string overrides comments */
-
-(?:[[:space:]]{-}[\n])+ /* Ignore all white space. */
-^[[:space:]]*#.*$ /* Leading '#' is a comment. */
-\/\/.*$ /* Trailing '//' is a comment. */
-
-{IDENT} ZRET(IDENT);
-[[:digit:]]+ ZRET(INTEGER);
-\{ ZRET(GROUP_OPEN);
-\} ZRET(GROUP_CLOSE);
-\( ZRET(LIST_OPEN);
-\) ZRET(LIST_CLOSE);
-\< ZRET(PATH_OPEN);
-\> ZRET(PATH_CLOSE);
-\. ZRET(PATH_SEPARATOR);
-= ZRET(ASSIGN);
-[,;]+ ZRET(SEPARATOR);
-
-. BEGIN(bad); FILL;
-<bad>\n {
- BEGIN(0); // Terminate bad token mode.
- ++(TsConfig_Lex_Location._line); // Must bump line count.
- HANDLE_EVENT(InvalidToken);
- }
-<bad>[[:space:]] BEGIN(0); HANDLE_EVENT(InvalidToken);
-<bad>. ++(yylval->_n);
-%%
-
-int tsconfiglex_current_line(void) { return TsConfig_Lex_Location._line; }
-int tsconfiglex_current_col(void) { return TsConfig_Lex_Location._col; }
-
-// This is in here because it's easier than trying to convince automake
-// to let me have a generated header from flex. The header is only needed
-// to define the various macros used here outside of the .l file so if
-// this is here, we don't need the header anymore. This also means we
-// don't have to deal with C/C++ issues in that regard either.
-int tsconfig_parse_buffer(
- struct TsConfigHandlers* handlers,
- char* buffer,
- size_t buffer_len
-) {
- int zret;
- yyscan_t lexer;
- YY_BUFFER_STATE lexer_buffer_state;
-
- tsconfiglex_init(&lexer);
- tsconfigset_extra(handlers, lexer);
- lexer_buffer_state = tsconfig_scan_buffer(buffer, buffer_len, lexer);
- zret = tsconfigparse(lexer, handlers);
- tsconfig_delete_buffer(lexer_buffer_state, lexer);
- tsconfiglex_destroy(lexer);
-
- return zret;
-}
-
-# endif // __clang_analyzer__
diff --git a/lib/tsconfig/TsConfigTypes.h b/lib/tsconfig/TsConfigTypes.h
deleted file mode 100644
index 6c64e04..0000000
--- a/lib/tsconfig/TsConfigTypes.h
+++ /dev/null
@@ -1,66 +0,0 @@
-# if ! defined(TS_CONFIG_TYPES_HEADER)
-# define TS_CONFIG_TYPES_HEADER
-
-/** @file
-
- Basic types for configuration parsing.
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-# if defined(_MSC_VER)
-# include <stddef.h>
-# else
-# include <unistd.h>
-# endif
-
-# if defined(__cplusplus)
-namespace ts { namespace config {
-# endif
-
-/** A location in the source stream.
- @internal At some point we may need to add stream information,
- e.g. file name, once includes are supported. Or should that
- be the caller's responsibility?
- */
-struct Location {
- int _col; ///< Column.
- int _line; ///< Line.
-};
-
-/** A token from the source stream.
- @internal We should use ts::Buffer here, but because this
- has to work in C as well, it's less painful to do it by hand.
- */
-struct Token {
- char* _s; ///< Text of token.
- size_t _n; ///< Text length.
- int _type; ///< Type of token.
- struct Location _loc; ///< Location of token.
-};
-
-# if defined(__cplusplus)
-}} // namespace ts::config
-# define YYSTYPE ts::config::Token
-# else
-# define YYSTYPE struct Token
-#endif
-
-
-# endif // TS_CONFIG_TYPES_HEADER
diff --git a/lib/tsconfig/TsErrataUtil.cc b/lib/tsconfig/TsErrataUtil.cc
deleted file mode 100644
index 1f8fbed..0000000
--- a/lib/tsconfig/TsErrataUtil.cc
+++ /dev/null
@@ -1,190 +0,0 @@
-/** @file
-
- TS Configuration utilities for Errata and logging.
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-# if !defined(_MSC_VER)
-# include <cstdio>
-# include <cstring>
-# endif
-# include <cstdarg>
-# include <cerrno>
-# include <TsErrataUtil.h>
-# include "tscore/ink_string.h"
-# include "tscore/ink_defs.h"
-
-namespace ts { namespace msg {
-
-Errata::Code FATAL = 3; ///< Fatal, cannot continue.
-Errata::Code WARN = 2; ///< Significant, should be fixed.
-Errata::Code INFO = 1; /// Interesting, not necessarily a problem.
-Errata::Code DEBUG = 0; /// Debugging information.
-
-# if defined(_MSC_VER)
-char* strerror_r(int err, char* s, size_t n) {
- ink_strlcpy(s, strerror(err), n);
- return s;
-}
-
-# define snprintf _snprintf
-# endif
-
-Errata&
-log(Errata& err, Errata::Id id, Errata::Code code, char const* text) {
- err.push(id, code, text);
- return err;
-}
-
-Errata&
-log(Errata& err, Errata::Code code, char const* text) {
- err.push(0, code, text);
- return err;
-}
-
-Errata&
-log(RvBase& rv, Errata::Code code, char const* text) {
- rv._errata.push(0, code, text);
- return rv._errata;
-}
-
-Errata
-log(Errata::Code code, char const* text) {
- Errata err;
- err.push(0, code, text);
- return err;
-}
-
-Errata&
-vlogf(
- Errata& err,
- Errata::Id id,
- Errata::Code code,
- char const* format,
- va_list& rest
-) {
- static size_t const SIZE = 8192;
- char buffer[SIZE];
-
- vsnprintf(buffer, SIZE, format, rest);
- err.push(id, code, buffer);
- return err;
-}
-
-Errata&
-logf(
- Errata& err,
- Errata::Id id,
- Errata::Code code,
- char const* format,
- ...
-) {
- va_list rest;
- va_start(rest, format);
- vlogf(err, id, code, format, rest);
- va_end(rest);
- return err;
-}
-
-Errata
-logf(Errata::Code code, char const* format, ...) {
- Errata err;
- va_list rest;
- va_start(rest, format);
- vlogf(err, Errata::Id(0), code, format, rest);
- va_end(rest);
- return err;
-}
-
-Errata&
-logf(Errata& err, Errata::Code code, char const* format, ...) {
- va_list rest;
- va_start(rest, format);
- vlogf(err, Errata::Id(0), code, format, rest);
- va_end(rest);
- return err;
-}
-
-Errata&
-logf(RvBase& base, Errata::Code code, char const* format, ...) {
- va_list rest;
- va_start(rest, format);
- vlogf(base._errata, Errata::Id(0), code, format, rest);
- va_end(rest);
- return base._errata;
-}
-
-Errata
-log_errno(Errata::Code code, char const* text) {
- static size_t const SIZE = 1024;
- char buffer[SIZE];
- ATS_UNUSED_RETURN(strerror_r(errno, buffer, SIZE));
- return logf(code, "%s [%d] %s", text, errno, buffer);
-}
-
-Errata
-vlogf_errno(Errata& errata, Errata::Id id, Errata::Code code, char const* format, va_list& rest) {
- int e = errno; // Preserve value before making system calls.
- int n;
- static int const E_SIZE = 512;
- char e_buffer[E_SIZE];
- static int const T_SIZE = 8192;
- char t_buffer[T_SIZE];
-
- n = vsnprintf(t_buffer, T_SIZE, format, rest);
- if (0 <= n && n < T_SIZE) { // still have room.
- ATS_UNUSED_RETURN(strerror_r(e, e_buffer, E_SIZE));
- snprintf(t_buffer + n, T_SIZE - n, "[%d] %s", e, e_buffer);
- }
- errata.push(id, code, t_buffer);
- return errata;
-}
-
-Errata
-logf_errno(Errata::Code code, char const* format, ...) {
- Errata zret;
- va_list rest;
- va_start(rest, format);
- zret = vlogf_errno(zret, 0, code, format, rest);
- va_end(rest);
- return zret;
-}
-
-Errata
-logf_errno(Errata& errata, Errata::Code code, char const* format, ...) {
- Errata zret;
- va_list rest;
- va_start(rest, format);
- zret = vlogf_errno(errata, 0, code, format, rest);
- va_end(rest);
- return zret;
-}
-
-Errata
-logf_errno(RvBase& rv, Errata::Code code, char const* format, ...) {
- Errata zret;
- va_list rest;
- va_start(rest, format);
- zret = vlogf_errno(rv._errata, 0, code, format, rest);
- va_end(rest);
- return zret;
-}
-// ------------------------------------------------------
-}} // namespace ts::msg
diff --git a/lib/tsconfig/TsErrataUtil.h b/lib/tsconfig/TsErrataUtil.h
deleted file mode 100644
index f9df89d..0000000
--- a/lib/tsconfig/TsErrataUtil.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/** @file
-
- TS Configuration utilities for Errata and logging.
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-# if !defined(TS_ERRATA_UTIL_HEADER)
-# define TS_ERRATA_UTIL_HEADER
-
-// TBD: Need to do something better than this to get around using
-// 'DEBUG' as the name of a constant.
-# if defined DEBUG
-# undef DEBUG
-# define DEBUG DEBUG
-# endif
-
-# include <Errata.h>
-
-namespace ts { namespace msg {
-
-/// @name Message severity levels.
-//@{
-extern Errata::Code FATAL; ///< Fatal, cannot continue.
-extern Errata::Code WARN; ///< Significant, function degraded.
-extern Errata::Code INFO; ///< Interesting, not necessarily a problem.
-extern Errata::Code DEBUG; ///< Debugging information.
-//@}
-
-/** Logging / reporting support.
- We build on top of @c Errata but we want to be able to prevent
- message generation / allocation for messages with severity levels
- less than a run time controllable value.
-
- @internal Far from complete but serving as a prototype / experiment
- to learn what's actually useful.
-*/
-//@{
-/// Report literal string to an Errata.
-/// @return @a err.
-Errata& log(
- Errata& err,///< Target errata.
- Errata::Id id, ///< Message ID.
- Errata::Code code, ///< Severity level.
- char const* text ///< Message text.
-);
-/// Report literal string to an Errata.
-/// Use message ID 0.
-/// @return @a err.
-Errata& log(
- Errata& err,///< Target errata.
- Errata::Code code, ///< Severity level.
- char const* text ///< Message text.
-);
-/// Report literal string to a return value.
-/// Use message ID 0.
-/// @return The @c Errata in @a rv.
-Errata& log(
- RvBase& rv,///< Return value.
- Errata::Code code, ///< Severity level.
- char const* text ///< Message text.
-);
-/// printf style log to Errata.
-/// @return @a err.
-Errata& logf(
- Errata& err,///< Target errata.
- Errata::Id id, ///< Message ID.
- Errata::Code code, ///< Severity level.
- char const* format, ///< Format string.
- ... ///< Format string parameters.
-);
-/// printf style log to Errata.
-/// The message id is set to zero.
-/// @return @a err.
-Errata& logf(
- Errata& err,///< Target errata.
- Errata::Code code, ///< Severity level.
- char const* format, ///< Format string.
- ... ///< Format string parameters.
-);
-/// Return an Errata in a return value populated with a printf style formatted string.
-/// Use message ID 0.
-/// @return The @c Errata in @a rv.
-Errata& logf(
- RvBase& rv, ///< Rv value.
- Errata::Code code, ///< Severity level.
- char const* format, ///< Message text.
- ...
-);
-/// Return an Errata populated with a literal string.
-/// Use message ID 0.
-/// @return @a err.
-Errata log(
- Errata::Code code, ///< Severity level.
- char const* text ///< Message text.
-);
-/// Return an Errata populated with a printf style formatted string.
-/// Use message ID 0.
-/// @return @a err.
-Errata logf(
- Errata::Code code, ///< Severity level.
- char const* format, ///< Message text.
- ...
-);
-/** Return an Errata based on @c errno.
- The literal string is combined with the system text for the current
- value of @c errno. This is modeled on @c perror. Message ID 0 is used.
- @return The new @c Errata.
- */
-Errata log_errno(
- Errata::Code code, ///< Severity level.
- char const* text ///< Message text.
-);
-/** Return an @c Errata based on @c errno.
- @c errno and the corresponding system error string are appended to
- the results from the @a format and following arguments.
- @return The new @c Errata.
- */
-Errata
-logf_errno(
- Errata::Code code, ///< Severity code.
- char const* format, ///< Format string.
- ... ///< Arguments for @a format.
-);
-/** Add a message to an @a errata based on @c errno.
- @c errno and the corresponding system error string are appended to
- the results from the @a format and following arguments.
- @return @a errata.
- */
-Errata
-logf_errno(
- Errata& errata, ///< Errata to use.
- Errata::Code code, ///< Severity code.
- char const* format, ///< Format string.
- ... ///< Arguments for @a format.
-);
-/** Add a message to a return value based on @c errno.
- @c errno and the corresponding system error string are appended to
- the results from the @a format and following arguments.
- @return The errata in @a rv.
- */
-Errata
-logf_errno(
- RvBase& rv, ///< Return value.
- Errata::Code code, ///< Severity code.
- char const* format, ///< Format string.
- ... ///< Arguments for @a format.
-);
-//@}
-
-}} // namespace ts::msg
-
-# endif // define TS_ERRATA_UTIL_HEADER
diff --git a/lib/tsconfig/TsValue.cc b/lib/tsconfig/TsValue.cc
deleted file mode 100644
index 0cccc56..0000000
--- a/lib/tsconfig/TsValue.cc
+++ /dev/null
@@ -1,392 +0,0 @@
-/** @file
-
- TS Configuration API implementation.
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-# include "TsValue.h"
-# include "TsBuilder.h"
-# include "tscore/ink_defs.h"
-
-# include <TsErrataUtil.h>
-# include <sys/stat.h>
-# include <cstdio>
-# include <cstdlib>
-
-# if !defined(_MSC_VER)
-# define _fileno fileno
-# endif
-
-// ---------------------------------------------------------------------------
-namespace ts { namespace config {
-// ---------------------------------------------------------------------------
-Buffer const detail::NULL_BUFFER;
-ConstBuffer const detail::NULL_CONST_BUFFER;
-detail::ValueItem detail::ValueTableImpl::NULL_ITEM(VoidValue);
-detail::PseudoBool::Type const detail::PseudoBool::FALSE = nullptr;
-detail::PseudoBool::Type const detail::PseudoBool::TRUE = &detail::PseudoBool::operator !;
-// This should not be called, it is used only as a pointer value.
-bool detail::PseudoBool::operator ! () const { return false; }
-// ---------------------------------------------------------------------------
-unsigned int const detail::Type_Property[N_VALUE_TYPES] = {
- 0, // Void
- detail::IS_VALID | detail::IS_CONTAINER, // List
- detail::IS_VALID | detail::IS_CONTAINER, // Group
- detail::IS_VALID | detail::IS_LITERAL, // String
- detail::IS_VALID | detail::IS_LITERAL, // Integer
-};
-// ---------------------------------------------------------------------------
-detail::ValueTableImpl::ValueTableImpl() : _generation(0) { }
-detail::ValueTableImpl::~ValueTableImpl() {
- for (auto & _buffer : _buffers) {
- free(_buffer._ptr);
-}
-}
-// ---------------------------------------------------------------------------
-detail::ValueTable::ImplType*
-detail::ValueTable::instance() {
- // Stupid workaround for clang analyzer false positive. The new instance isn't leaked because
- // it's stored in a shared ptr type.
-#if !defined(__clang_analyzer__)
- if (! _ptr) { _ptr.reset(new ImplType); }
-#else
- assert(_ptr.get() != nullptr);
-#endif
- return _ptr.get();
-}
-
-detail::ValueTable&
-detail::ValueTable::forceRootItem() {
- ImplType* imp = this->instance();
- if (0 == imp->_values.size()) {
- imp->_values.push_back(ValueItem(GroupValue));
-}
- return *this;
-}
-
-Rv<detail::ValueIndex>
-detail::ValueTable::make(ValueIndex pidx, ValueType type, ConstBuffer const& name) {
- Rv<ValueIndex> zret = NULL_VALUE_INDEX;
- if (_ptr) {
- size_t n = _ptr->_values.size();
- // Check the parent
- if (pidx < n) {
- ValueItem* parent = &(_ptr->_values[pidx]);
- if (IS_CONTAINER & Type_Property[parent->_type]) {
- ValueItem* item;
-
- _ptr->_values.push_back(ValueItem(type));
- parent = &(_ptr->_values[pidx]); // possibly stale, refresh.
- item = &(_ptr->_values[n]);
- item->_parent = pidx;
- parent->_children.push_back(n);
- item->_local_index = parent->_children.size() - 1;
- // Only use the name if the parent is a group.
- if (GroupValue == parent->_type) { item->_name = name;
-}
- zret = n; // mark for return to caller.
- } else {
- msg::log(zret.errata(), msg::WARN, "Add child failed because parent is not a container.");
- }
- } else {
- msg::logf(zret.errata(), msg::WARN, "Add child failed because parent index (%ul) is out of range (%ul).", pidx.raw(), n);
- }
- } else {
- msg::log(zret.errata(), msg::WARN, "Add child failed because the configuration is null.");
- }
- return zret;
-}
-
-detail::ValueItem&
-detail::ValueTable::operator [] ( ValueIndex idx ) {
- assert(_ptr && idx < _ptr->_values.size());
- return _ptr->_values[idx];
-}
-Buffer
-detail::ValueTable::alloc(size_t n) {
- ImplType* imp = this->instance();
- Buffer zret(static_cast<char*>(malloc(n)), n);
- if (zret._ptr) { imp->_buffers.push_back(zret);
-}
- return zret;
-}
-
-// ---------------------------------------------------------------------------
-Value
-Value::operator [] (size_t idx) const {
- Value zret;
- detail::ValueItem const* item = this->item();
- if (item && idx < item->_children.size()) {
- zret = Value(_config, item->_children[idx]);
- if (PathValue == zret.getType()) { zret = _config.getRoot().find(_config._table[zret._vidx]._path);
-}
- }
- return zret;
-}
-
-Value
-Value::operator [] (ConstBuffer const& name) const {
- Value zret;
- detail::ValueItem const* item = this->item();
- if (item) {
- for (const auto & spot : item->_children) {
- if (_config._table[spot]._name == name) {
- zret = Value(_config, spot);
- if (PathValue == zret.getType()) { zret = _config.getRoot().find(_config._table[zret._vidx]._path);
-}
- break;
- }
- }
- }
- return zret;
-}
-
-Value
-Value::find( ConstBuffer const& path ) {
- Value zret = *this;
- Path::Parser parser(path);
- Rv<Path::Parser::Result> x;
- ConstBuffer elt;
- for ( x = parser.parse(&elt) ; zret && Path::Parser::EOP != x && Path::Parser::ERROR != x ; x = parser.parse(&elt) ) {
- if (Path::Parser::TAG == x) { zret = zret[elt];
- } else if (Path::Parser::INDEX == x) { zret = zret[elt._size];
- } else { zret.reset();
-}
- }
- if (Path::Parser::EOP != x) { zret.reset();
-}
- return zret;
-}
-
-Value
-Value::find(Path const& path ) {
- Value zret = *this;
- for ( size_t i = 0, n = path.count() ; i < n && zret ; ++i ) {
- ConstBuffer const& elt = path[i];
- if (elt._ptr) { zret = zret[elt];
- } else { zret = zret[elt._size];
-}
- }
- return zret;
-}
-
-Rv<Value>
-Value::makeChild(ValueType type, ConstBuffer const& name) {
- Rv<Value> zret;
- Rv<detail::ValueIndex> vr = _config._table.make(this->_vidx, type, name);
- if (vr.isOK()) { zret = Value(_config, vr.result());
- } else { zret.errata() = vr.errata();
-}
- return zret;
-}
-
-Rv<Value>
-Value::makeGroup(ConstBuffer const& name) {
- return this->makeChild(GroupValue, name);
-}
-
-Rv<Value>
-Value::makeList(ConstBuffer const& name) {
- return this->makeChild(ListValue, name);
-}
-
-Rv<Value>
-Value::makeString(ConstBuffer const& text, ConstBuffer const& name) {
- Rv<Value> zret = this->makeChild(StringValue, name);
- if (zret.isOK()) { zret.result().setText(text);
-}
- return zret;
-}
-
-Rv<Value>
-Value::makeInteger(ConstBuffer const& text, ConstBuffer const& name) {
- Rv<Value> zret = this->makeChild(IntegerValue, name);
- if (zret.isOK()) { zret.result().setText(text);
-}
- return zret;
-}
-
-Rv<Value>
-Value::makePath(Path const& path, ConstBuffer const& name) {
- Rv<Value> zret = this->makeChild(PathValue, name);
- if (zret.isOK()) { _config._table[zret.result()._vidx]._path = path;
-}
- return zret;
-}
-// ---------------------------------------------------------------------------
-Path& Path::reset() {
- if (_ptr) {
- // If we're sharing the instance, make a new one for us.
- if (_ptr.use_count() > 1) {
- _ptr.reset(new ImplType);
- } else { // clear out the existing instance.
- _ptr->_elements.clear();
- }
- }
- return *this;
-}
-// ---------------------------------------------------------------------------
-Rv<Path::Parser::Result>
-Path::Parser::parse(ConstBuffer *cbuff) {
- Rv<Result> zret = EOP;
- enum State {
- S_INIT, // initial state
- S_INDEX, // reading index.
- S_TAG, // reading tag.
- S_DASH, // reading dashes in tag.
- } state = S_INIT;
-
- // Character bucket
- enum Bucket {
- C_INVALID, // Invalid input.
- C_DIGIT, // digit.
- C_IDENT, // Identifier character.
- C_DASH, // A dash
- C_DOT, // A dot (period).
- };
-
- if (cbuff) { cbuff->reset();
-}
- char const* start = _c; // save starting character location.
- size_t idx = 0; // accumulator for index value.
-
- bool final = false;
- while (! final && this->hasInput()) {
- Bucket cb;
- if (isdigit(*_c)) { cb = C_DIGIT;
- } else if ('_' == *_c || isalpha(*_c)) { cb = C_IDENT;
- } else if ('-' == *_c) { cb = C_DASH;
- } else if ('.' == *_c) { cb = C_DOT;
- } else { cb = C_INVALID;
-}
-
- if (C_INVALID == cb) {
- msg::logf(zret, msg::WARN, "Invalid character '%c' [%u] in path.", *_c, *_c);
- } else { switch (state) {
- case S_INIT:
- switch (cb) {
- case C_DIGIT: state = S_INDEX; idx = *_c - '0'; break;
- case C_IDENT: state = S_TAG; break;
- case C_DASH: msg::logf(zret, msg::WARN, "Dash not allowed as leading character for tag."); final = true; break;
- case C_DOT: msg::logf(zret, msg::WARN, "Separator without preceding element."); final = true; break;
- default: msg::logf(zret, msg::WARN, "Internal error: unexpected character %u in INIT state.", *_c); final = true; break;
- }
- break;
- case S_INDEX: // reading an index.
- if (C_DIGIT == cb) { idx = 10 * idx + *_c - '0';
- } else if (C_DOT == cb) { final = true; }
- else {
- msg::logf(zret, msg::WARN, "Invalid character '%c' [%u] in index element.", *_c, *_c);
- final = true;
- }
- break;
- case S_TAG: // reading a tag.
- if (C_IDENT == cb || C_DIGIT == cb) { ; // continue
- } else if (C_DASH == cb) { state = S_DASH;
- } else if (C_DOT == cb) { final = true; }
- else { // should never happen, but be safe.
- msg::logf(zret, msg::WARN, "Invalid character '%c' [%u] in index element.", *_c, *_c);
- final = true;
- }
- break;
- case S_DASH: // dashes inside tag.
- if (C_IDENT == cb || C_DIGIT == cb) { state = S_TAG;
- } else if (C_DOT == cb) {
- msg::log(zret, msg::WARN, "Trailing dash not allowed in tag element.");
- final = true;
- } else if (C_DASH != cb) { // should never happen, but be safe.
- msg::logf(zret, msg::WARN, "Invalid character '%c' [%u] in index element.", *_c, *_c);
- final = true;
- }
- break;
- }
-}
- ++_c;
- }
- if (!zret.isOK()) {
- zret = ERROR;
- if (cbuff) { cbuff->set(_c - 1, 1);
-}
- _c = nullptr;
- _input.reset();
- } else if (S_INIT == state) {
- zret = EOP;
- } else if (S_TAG == state) {
- zret = TAG;
- if (cbuff) {
- cbuff->set(start, _c - start);
- // if @a final is set, then we parsed a dot separator.
- // don't include it in the returned tag.
- if (final) { cbuff->_size -= 1;
-}
- }
- } else if (S_INDEX == state) {
- zret = INDEX;
- if (cbuff) { cbuff->_size = idx;
-}
- } else if (S_DASH == state) {
- zret = ERROR;
- msg::log(zret, msg::WARN, "Trailing dash not allowed in tag element.");
- if (cbuff) { cbuff->set(start, _c - start);
-}
- }
- return zret;
-}
-// ---------------------------------------------------------------------------
-Value
-Configuration::getRoot() const {
- const_cast<self*>(this)->_table.forceRootItem();
- return Value(*this, 0);
-}
-
-Rv<Configuration>
-Configuration::loadFromPath(char const* path) {
- Rv<Configuration> zret;
- Buffer buffer;
- FILE* in = fopen(path, "r");
-
- if (in) {
- struct stat info;
- if (0 == fstat(_fileno(in), &info)) {
- // Must reserve 2 bytes at the end for FLEX terminator.
- buffer = zret.result().alloc(info.st_size + 2);
- if (buffer._ptr) {
- size_t n;
- if (0 < (n = fread(buffer._ptr, sizeof(char), info.st_size, in))) {
- buffer._size = n+2;
- memset(buffer._ptr + n, 0, 2); // required by FLEX
- zret = Builder(zret.result()).build(buffer);
- } else {
- msg::logf_errno(zret, msg::WARN, "failed to read %" PRIu64 " bytes from configuration file '%s'", info.st_size, path);
- }
- } else {
- msg::logf_errno(zret, msg::WARN, "failed to allocate buffer for configuration file '%s' - needed %" PRIu64 " bytes.", path, info.st_size);
- }
- } else {
- msg::logf_errno(zret, msg::WARN, "failed to determine file information on '%s'", path);
- }
- fclose(in);
- } else {
- msg::logf_errno(zret, msg::WARN, "failed to open configuration file '%s'", path);
- }
- return zret;
-}
-
-}} // namespace ts::config
diff --git a/lib/tsconfig/TsValue.h b/lib/tsconfig/TsValue.h
deleted file mode 100644
index 7d420df..0000000
--- a/lib/tsconfig/TsValue.h
+++ /dev/null
@@ -1,741 +0,0 @@
-# if ! defined(TS_CONFIG_VALUE_HEADER)
-# define TS_CONFIG_VALUE_HEADER
-
-/** @file
-
- TS Configuration API definition.
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-#include <cstring>
-#include "tscore/TsBuffer.h"
-#include <tsconfig/NumericType.h>
-#include <tsconfig/IntrusivePtr.h>
-#include <tsconfig/Errata.h>
-#include <utility>
-#include <vector>
-
-namespace ts { namespace config {
-
-// Forward declares.
-class Value;
-class Path;
-
-namespace detail {
- /** Class to provide a "pseudo bool" value.
- This is used as the return type for the positive logical operator
- (the converse of @c operator! ). This makes a class directly
- usable in logical expressions. It is like a pointer but @b not
- convertible to anything else, and so avoiding any undesirable
- automatic conversions and the resulting ambiguities.
- */
- struct PseudoBool {
- typedef bool (PseudoBool::*Type)() const; ///< The type itself.
- bool operator ! () const; ///< A method to use for the @c true value.
- static Type const TRUE; ///< The @c true equivalent.
- static Type const FALSE; ///< The @c false equivalent.
- };
-}
-
-/// Type of value.
-enum ValueType {
- VoidValue, ///< No value, invalid.
- ListValue, ///< List of values.
- GroupValue, ///< Group of values.
- StringValue, ///< Text string.
- IntegerValue, ///< Integer.
- PathValue, ///< Path.
- // Update N_VALUE_TYPES if you change the last enum value !!
-};
-/// Number of value types.
-static size_t const N_VALUE_TYPES = PathValue + 1;
-
-/** A path to a value in a configuration.
- */
-class Path {
- friend class Value;
-protected:
- class ImplType : public IntrusivePtrCounter {
- friend class Path;
- public:
- ImplType(); ///< Constructor.
- protected:
- /** Container for path elements.
- We are subtle with our elements, which can be either a string
- or a numeric index. By convention, if the pointer in the buffer is
- @c NULL, then the size is a numeric index. Otherwise it's a name.
- */
- typedef std::vector<ConstBuffer> Elements;
- Elements _elements; ///< Path elements.
- };
-public:
- typedef Path self; ///< Self reference type.
-
- Path(); ///< Default constructor.
-
- /// Append a string tag to the path.
- self& append(
- ConstBuffer const& tag ///< Text of tag.
- );
- /// Append a numeric index to the path.
- self& append(
- size_t idx ///< Index.
- );
- /// Reset to default constructed state.
- self& reset();
-
- /// Get the number of elements in this path.
- size_t count() const;
-
- /// Access an element by @a index.
- ConstBuffer const& operator [] (
- size_t index ///< Element index.
- ) const;
-
- /** Parser for path text.
- This is restartable so a path can be parsed in pieces.
- @internal Sadly, FLEX is just too much overhead to be useful here.
- */
- class Parser {
- public:
- typedef Parser self; ///< Self reference type.
-
- Parser(); ///< Default constructor.
- /** Construct with input.
-
- This default constructs the Parser then calls @c setInput with
- @a text. It is provided as a convenience as that will be the
- common use case.
-
- @see setInput.
- */
- Parser(
- ConstBuffer const& text ///< Input text.
- );
-
- /** Set the input @a text.
- Parsing state is reset and the next parsing call will
- start at the beginning of @a text.
- */
- self& setInput(
- ConstBuffer const& text ///< Input buffer.
- );
-
- /// Parsing result.
- enum Result {
- ERROR, ///< Bad input.
- TAG, ///< Path tag.
- INDEX, ///< Path index.
- EOP, ///< End Of Path.
- };
-
- /** Parse the next element in the path.
-
- @a cbuff may be @c NULL in which case no data about elements
- is available. In general this should be called until @c EOP
- or @c ERROR is returned, each call returning the next element.
-
- @return A parse @c Result.
- - TAG: A tag was found. The start and length are stored in @a cbuff.
- - INDEX: An index was found. The value is in @a cbuff._size.
- - EOP: No more path elements were found. Do not continue parsing.
- - ERROR: A syntax error was encountered. See the errata for detail. Do not continue parsing.
- */
- Rv<Result> parse(
- ConstBuffer* cbuff = nullptr ///< [out] Parsed path element.
- );
-
- /// Check if input is available.
- bool hasInput() const;
-
- protected:
- ConstBuffer _input; ///< Current input buffer.
- char const* _c; ///< Next input character.
- };
-protected:
- typedef IntrusivePtr<ImplType> ImplPtr; ///< Smart pointer to implementation.
- ImplPtr _ptr; ///< Our instance.
- /// Force an implementation instance and return a pointer to it.
- ImplType* instance();
-};
-
-namespace detail {
- /// Null buffer, handy in several places.
- extern Buffer const NULL_BUFFER;
- /// Null buffer, handy in several places.
- extern ConstBuffer const NULL_CONST_BUFFER;
- /// Index type for value items in the global table.
- typedef NumericType<size_t, struct ValueIndexTag> ValueIndex;
- /// Index value that presents NULL (invalid value).
- static ValueIndex const NULL_VALUE_INDEX = static_cast<ValueIndex::raw_type>(-1);
- /// Numeric type for configuration generation.
- typedef NumericType<size_t, struct GenerationTag> Generation;
-
- /** Value type properties.
- These are used as bit masks on elements of an array.
- */
- static unsigned int const IS_VALID = 1;
- static unsigned int const IS_LITERAL = 1<<1;
- static unsigned int const IS_CONTAINER = 1<<2;
-
- /// Value type property table.
- extern unsigned int const Type_Property[N_VALUE_TYPES];
-
- /** A value in the configuration.
- This is used in a global table so it handles all types of Values.
- Members that are not used for scalars are designed to be @c NULL
- pointers in that case.
- */
- class ValueItem {
- // Apparently the C++ standard, 7.3.1.2, states that unqualified
- // friend classes only considers the current namespace, not any
- // outer ones. So we have to fully qualify this. Blech.
- friend class ts::config::Value;
- friend class ValueTable;
- public:
- /// Default constructor.
- ValueItem();
- /// Construct empty item of a specific type.
- ValueItem(ValueType type);
- /// Get item type.
- ValueType getType() const;
- protected:
- ValueType _type = VoidValue; ///< Type of value.
- ValueIndex _parent = 0; ///< Table index of parent value.
- ConstBuffer _text; ///< Text of value (if scalar).
- ConstBuffer _name; ///< Local name of value, if available.
- size_t _local_index = 0; ///< Index among siblings.
- int _srcLine = 0; ///< Source line.
- int _srcColumn = 0; ///< Source column.
-
- /// Container for children of this item.
- typedef std::vector<ValueIndex> ChildGroup;
- /// Child items of this item.
- ChildGroup _children;
- /// Path if present.
- Path _path;
-
- // This is for optimizing named access at some point in the future.
- /// Hold a child item name in a table for fast lookup.
- struct Name {
- ConstBuffer _text; ///< Text of name.
- ValueIndex _index; ///< Index of child.
- };
- /// Container for child names.
- typedef std::vector<Name> NameGroup;
- /** Child names, if appropriate.
- This is faulted in when needed, if this value is an aggregate with
- named children. The list must be sorted on name so that it can be binary
- searched for performance.
- */
- NameGroup _names;
- };
-
- class ValueTable;
-
- /** Table of configuration values.
- This holds all the values for a specific configuration.
- */
- class ValueTableImpl : public IntrusivePtrCounter {
- friend class ValueTable;
- public:
- typedef ValueTableImpl self; ///< Self reference type.
-
- ValueTableImpl(); ///< Constructor.
- ~ValueTableImpl(); ///< Destructor.
- protected:
- /// Container for value items.
- typedef std::vector<ValueItem> ItemTable;
- ItemTable _values; ///< All configuration values.
- Generation _generation; ///< Generation number of configuration.
- /// A group of buffers.
- typedef std::vector<Buffer> BufferGroup;
- /** Locally allocated buffers.
- These are freed when this object is destroyed.
- */
- BufferGroup _buffers;
-
- static ValueItem NULL_ITEM; ///< Null item for invalid access return.
- };
-
- /** Wrapper class for a table of configuration values.
- @internal Really, this should be merged in to Configuration. The original
- differences have evolved out of the implementation.
- */
- class ValueTable {
- public:
- typedef ValueTable self; ///< Self reference type.
- typedef ValueTableImpl ImplType; ///< Implementation type.
-
- /// Table size.
- /// @return The number of value items in the table.
- size_t size() const;
- /// Generation.
- /// @return The generation number.
- Generation generation() const;
-
- /// Const access by index.
- /// @return The value item at index @a idx.
- ValueItem const& operator [] (
- ValueIndex idx ///< Index of item.
- ) const;
- /// Access by index.
- /// @return The value item at index @a idx.
- ValueItem& operator [] (
- ValueIndex idx ///< Index of item.
- );
-
- /// Force the existence of the root item in the table.
- /// @return @c this object.
- self& forceRootItem();
- /** Create a new item (value) with optional @a name
- The table must contain @a parent. If @a name is omitted, the item
- has an empty name.
- @return Index of the new value item.
- */
- Rv<ValueIndex> make(
- ValueIndex parent, ///< Index of parent for item.
- ValueType type, ///< Type of item.
- ConstBuffer const& name = NULL_BUFFER ///< Name (may be empty).
- );
-
- /// Test for not table existence.
- /// @return @c false if the implementation instance exists, @c true if not.
- bool operator ! () const;
- /// Test for table existence.
- /// @return @c true if the implementation instance exists, @c false if not.
- operator PseudoBool::Type() const;
- /// Reset to default constructed state.
- /// @return @c this object.
- self& reset();
-
- /** Allocate a local buffer.
- This buffer will persist until the implementation instance
- is destoyed.
- @return The allocated buffer.
- */
- Buffer alloc(size_t n);
- protected:
- typedef IntrusivePtr<ImplType> ImplPtr; ///< Smart pointer to implementation instance.
- ImplPtr _ptr; ///< Implementation instance.
-
- /// Force an implementation instance and return a pointer to it.
- ImplType* instance();
- };
-} // namespace detail
-
-/** Container for a configuration.
- This is a wrapper class that holds a shared reference to a configuration.
-*/
-class Configuration {
- friend class Value;
-public:
- typedef Configuration self; ///< Self reference type.
-
- /** Check if configuration is (not) valid.
- @return @c true if this configuration is invalid, @c false otherwise.
- */
- bool operator ! () const;
- /** Check if the configuration is valid.
- @return The equivalent of @c true if this does @b not contain a value,
- the equivalent of @c false if it does.
- */
- operator detail::PseudoBool::Type () const;
- /** Get the root @c Value of the configuration.
- The root is always a group and has no name.
- @return The root value.
- */
- Value getRoot() const;
-
- /// Get the number of child values on the root value.
- size_t childCount() const;
- /** Root value child access by @a index
- @return The child or a @c Void value if there is no child with @a name.
- */
- Value operator [] (
- size_t idx ///< Index of child value.
- ) const;
- /** Root value child access by @a name.
- @return The child or a @c Void value if there is no child with @a name.
- */
- Value operator [] (
- ConstBuffer const& name
- ) const;
- /** Root value child access by @a name.
- @return The child or a @c Void value if there is no child with @a name.
- */
- Value operator [] (
- char const* name ///< Null terminated string.
- ) const;
-
- /** Find a value.
- @return The value if found, an void valid if not.
- */
- Value find(
- char const* path ///< configuration path to value.
- );
- /** Load a configuration from a file.
-
- @note Check the returned errata for problems during configuration
- load. It is probably not a good idea to use the configuration in
- any error are reported.
- @return A new @c Configuration and errata.
- */
- static Rv<self> loadFromPath(
- char const* path ///< file system path.
- );
- /** Allocate a local buffer of size @a n.
- This buffer will persist until the implementation instance
- is destroyed.
- @return The allocated buffer.
- */
- Buffer alloc(
- size_t n ///< requested size of buffer.
- );
-protected:
- detail::ValueTable _table; ///< Table of values from the configuration.
-};
-
-/** This holds a value from the configuration.
-
- @internal It is critical that none of the type specific subclasses define any data members
- so that instances can be freely converted to and from this base class.
-*/
-class Value {
- friend class Configuration;
-public:
- typedef Value self; ///< Self reference type.
- /// Default constructors.
- /// Creates an @c NULL instance.
- Value();
- /// Destructor.
- ~Value();
-
- /// Get the type of value.
- ValueType getType() const;
- /// Test if this is a valid value.
- /// @return @c true if this contains a value, @c false otherwise.
- bool hasValue() const;
- /** Operator form of @c hasValue.
- @see hasValue
- @return @c true if this does @b not contain a value, @c false if it does.
- */
- bool operator ! () const;
- /** Logical form of @c hasValue for use in logical expressions.
- @see hasValue
- @return The equivalent of @c true if this does @b not contain a value,
- the equivalent of @c false if it does.
- */
- operator detail::PseudoBool::Type () const;
-
- /** Get the value text.
- @return The text in the configuration file for this item if the item
- is a scalar, an empty buffer otherwise.
- */
- ConstBuffer const& getText() const;
- /// Set the @a text for this value.
- self& setText(
- ConstBuffer const& text
- );
-
- /** Get local name.
- This gets the local name of the value. That is the name by which it
- is known to its parent container.
-
- @internal Only works for groups now. It should be made to work
- for lists. This would require allocating strings for each index,
- which should be shared across values. For instance, all values
- at index 1 should return the same string "1", not separately
- allocated for each value.
- */
- ConstBuffer const& getName() const;
- /** Get local index.
- This gets the local index for the value. This is the index which,
- if used on the parent, would yield this value.
- @return The local index.
- */
- size_t getIndex() const;
-
- /// Test for a literal value.
- /// @return @c true if the value is a literal,
- /// @c false if it is a container or invalid.
- bool isLiteral() const;
- /// Test for value container.
- /// @return @c true if the value is a container (can have child values),
- /// @c false otherwise.
- bool isContainer() const;
- /// Get the parent value.
- Value getParent() const;
- /// Test if this is the root value for the configuration.
- bool isRoot() const;
-
- /// Get the number of child values.
- size_t childCount() const;
- /** Child access by @a index
- @return The child or a @c Void value if there is no child with @a name.
- */
- Value operator [] (
- size_t idx ///< Index of child value.
- ) const;
- /** Child access by @a name.
- @return The child or a @c Void value if there is no child with @a name.
- */
- Value operator [] (
- ConstBuffer const& name
- ) const;
- /** Child access by @a name.
- @return The child or a @c Void value if there is no child with @a name.
- */
- Value operator [] (
- char const* name ///< Null terminated string.
- ) const;
-
- /** @name Creating child values.
-
- These methods all take an optional @a name argument. This is
- required if @c this is a @c Group and ignored if @c this is a @c
- List.
-
- These methods will fail if
- - @c this is not a container.
- - @c this is a @c Group and no @a name is provided.
-
- @note Currently for groups, duplicate names are not
- detected. The duplicates will be inaccessible by name but can
- still be found by index. This is a problem but I am still
- pondering the appropriate solution.
-
- @see isContainer
- @return The new value, or an invalid value plus errata on failure.
-
- @internal I original had this as a single method, but changed to
- separate per type. Overall less ugly because we can get the
- arguments more useful.
- */
- //@{
- /// Create a @c String value.
- Rv<Value> makeString(
- ConstBuffer const& text, ///< String content.
- ConstBuffer const& name = detail::NULL_BUFFER///< Optional name of value.
- );
- /// Create an @c Integer value.
- Rv<Value> makeInteger(
- ConstBuffer const& text, ///< Text of number.
- ConstBuffer const& name = detail::NULL_BUFFER///< Optional name of value.
- );
- /// Create a @c Group value.
- Rv<Value> makeGroup(
- ConstBuffer const& name = detail::NULL_BUFFER///< Optional name of value.
- );
- /// Create a @c List value.
- Rv<Value> makeList(
- ConstBuffer const& name = detail::NULL_BUFFER///< Optional name of value.
- );
- /// Create a @c Path value.
- Rv<Value> makePath(
- Path const& path, ///< Path.
- ConstBuffer const& name = detail::NULL_BUFFER///< Optional name of value.
- );
- /// Create a child by type.
- /// Client must fill in any other required elements.
- Rv<Value> makeChild(
- ValueType type, ///< Type of child.
- ConstBuffer const& name = detail::NULL_BUFFER///< Optional name of value.
- );
- //@}
-
- /** Find a value.
- @return The value if found, an void valid if not.
- */
- Value find(
- ConstBuffer const& path ///< Path relative to this value.
- );
- /** Find a value.
- @return The value if found, an void valid if not.
- */
- Value find(
- char const* path ///< Path relative to this value.
- );
- /** Find a value using a precondensed path.
- @return The value if found, an void valid if not.
- */
- Value find(
- Path const& path ///< Path relative to this value.
- );
-
- /** Reset to default constructed state.
- @note This wrapper is reset, the value in the configuration is unchanged.
- @return @c this object.
- */
- self& reset();
-
- /// Set source line.
- /// @return @c this object.
- self& setSourceLine(
- int line ///< Line in source stream.
- );
- /// Set source column.
- /// @return @c this object.
- self& setSourceColumn(
- int col ///< Column in source stream.
- );
- /// Set the source location.
- self& setSource(
- int line, ///< Line in source stream.
- int col ///< Column in source stream.
- );
- /// Get source line.
- /// @return The line in the source stream for this value.
- int getSourceLine() const;
- /// Get source column.
- /// @return The column in the source stream for this value.
- int getSourceColumn() const;
-
-protected:
- // Note: We store an index and not a pointer because a pointer will go stale
- // if any items are added or removed from the underlying table.
- // Also, by storing the configuration, we hold it in memory as long as a Value
- // is in client hands.
- Configuration _config; ///< The configuration for this value.
- detail::ValueIndex _vidx; ///< Index of item.
-
- static Buffer const NULL_BUFFER; ///< Empty buffer to return on method failures.
-
- /// Construct from raw data.
- Value(
- Configuration cfg, ///< Source configuration.
- detail::ValueIndex vidx ///< Index of value.
- );
-
- /** Get raw item pointer.
- @note This pointer is unstable and must be recomputed on each method invocation.
- @return The item pointer or @c NULL if this value is invalid.
- */
- detail::ValueItem* item();
- /** Get constant raw item pointer.
- @note This pointer is unstable and must be recomputed on each method invocation.
- @return The item pointer or @c NULL if this value is invalid.
- */
- detail::ValueItem const* item() const;
-};
-
-// Inline methods.
-namespace detail {
- inline bool ValueTable::operator ! () const { return ! _ptr; }
- inline ValueTable::operator PseudoBool::Type () const { return _ptr ? PseudoBool::TRUE : PseudoBool::FALSE; }
- inline size_t ValueTable::size() const { return _ptr ? _ptr->_values.size() : 0; }
- inline Generation ValueTable::generation() const { return _ptr ? _ptr->_generation : Generation(0); }
- inline ValueItem const& ValueTable::operator [] (ValueIndex idx) const { return const_cast<self*>(this)->operator [] (idx); }
- inline ValueTable& ValueTable::reset() { _ptr.reset(); return *this; }
-
- inline ValueItem::ValueItem() {}
- inline ValueItem::ValueItem(ValueType type) : _type(type) {}
- inline ValueType ValueItem::getType() const { return _type; }
-}
-
-inline Value::~Value() { }
-inline Value::Value() : _vidx(detail::NULL_VALUE_INDEX) {}
-inline Value::Value(Configuration cfg, detail::ValueIndex vidx) : _config(std::move(cfg)), _vidx(vidx) { }
-inline bool Value::hasValue() const { return _config && _vidx != detail::NULL_VALUE_INDEX; }
-inline Value::operator detail::PseudoBool::Type () const { return this->hasValue() ? detail::PseudoBool::TRUE : detail::PseudoBool::FALSE; }
-inline bool Value::operator ! () const { return ! this->hasValue(); }
-inline ValueType Value::getType() const { return this->hasValue() ? _config._table[_vidx]._type : VoidValue; }
-inline ConstBuffer const& Value::getText() const {
- return this->hasValue() ? _config._table[_vidx]._text : detail::NULL_CONST_BUFFER;
-}
-inline Value& Value::setText(ConstBuffer const& text) {
- detail::ValueItem* item = this->item();
- if (item) item->_text = text;
- return *this;
-}
-inline ConstBuffer const& Value::getName() const {
- detail::ValueItem const* item = this->item();
- return item ? item->_name : detail::NULL_CONST_BUFFER;
-}
-inline size_t Value::getIndex() const {
- detail::ValueItem const* item = this->item();
- return item ? item->_local_index : 0;
-}
-
-inline bool Value::isLiteral() const { return 0 != (detail::IS_LITERAL & detail::Type_Property[this->getType()]); }
-inline bool Value::isContainer() const { return 0 != (detail::IS_CONTAINER & detail::Type_Property[this->getType()]); }
-inline Value Value::getParent() const { return this->hasValue() ? Value(_config, _config._table[_vidx]._parent) : Value(); }
-inline bool Value::isRoot() const { return this->hasValue() && _vidx == 0; }
-inline Value& Value::reset() { _config = Configuration(); _vidx = detail::NULL_VALUE_INDEX; return *this; }
-inline detail::ValueItem* Value::item() { return this->hasValue() ? &(_config._table[_vidx]) : nullptr; }
-inline detail::ValueItem const* Value::item() const { return const_cast<self*>(this)->item(); }
-inline Value Value::operator [] (char const* name) const { return (*this)[ConstBuffer(name, strlen(name))]; }
-inline size_t Value::childCount() const {
- detail::ValueItem const* item = this->item();
- return item ? item->_children.size() : 0;
-}
-inline Value Value::find(char const* path) { return this->find(ConstBuffer(path, strlen(path))); }
-inline int Value::getSourceLine() const {
- detail::ValueItem const* item = this->item();
- return item ? item->_srcLine : 0;
-}
-inline int Value::getSourceColumn() const {
- detail::ValueItem const* item = this->item();
- return item ? item->_srcColumn : 0;
-}
-inline Value& Value::setSourceLine(int line) {
- detail::ValueItem* item = this->item();
- if (item) item->_srcLine = line;
- return *this;
-}
-inline Value& Value::setSourceColumn(int col) {
- detail::ValueItem* item = this->item();
- if (item) item->_srcColumn = col;
- return *this;
-}
-inline Value& Value::setSource(int line, int col) {
- detail::ValueItem* item = this->item();
- if (item) {
- item->_srcLine = line;
- item->_srcColumn = col;
- }
- return *this;
-}
-
-inline Path::ImplType::ImplType() { }
-
-inline Path::Path() { }
-inline Path::ImplType* Path::instance() { if (!_ptr) _ptr.reset(new ImplType); return _ptr.get(); }
-inline Path& Path::append(ConstBuffer const& tag) { this->instance()->_elements.push_back(tag); return *this; }
-inline Path& Path::append(size_t index) { this->instance()->_elements.push_back(ConstBuffer(nullptr, index)); return *this; }
-inline size_t Path::count() const { return _ptr ? _ptr->_elements.size() : 0; }
-inline ConstBuffer const& Path::operator [] (size_t idx) const { return _ptr ? _ptr->_elements[idx] : detail::NULL_CONST_BUFFER; }
-
-inline Path::Parser::Parser() { }
-inline Path::Parser::Parser( ConstBuffer const& text ) : _input(text), _c(text._ptr) { }
-inline bool Path::Parser::hasInput() const { return _input._ptr && _input._ptr + _input._size > _c; }
-
-inline bool Configuration::operator ! () const { return ! _table; }
-inline Configuration::operator detail::PseudoBool::Type() const { return _table.operator detail::PseudoBool::Type(); }
-inline Value Configuration::find( char const* path ) { return this->getRoot().find(path); }
-inline Buffer Configuration::alloc(size_t n) { return _table.alloc(n); }
-inline size_t Configuration::childCount() const { return this->getRoot().childCount(); }
-inline Value Configuration::operator [] (size_t idx) const { return (this->getRoot())[idx]; }
-inline Value Configuration::operator [] ( ConstBuffer const& name ) const { return (this->getRoot())[name]; }
-inline Value Configuration::operator [] ( char const* name ) const { return (this->getRoot())[name]; }
-
-}} // namespace ts::config
-
-# endif
diff --git a/lib/tsconfig/test-1.tsconfig b/lib/tsconfig/test-1.tsconfig
deleted file mode 100644
index ee733a8..0000000
--- a/lib/tsconfig/test-1.tsconfig
+++ /dev/null
@@ -1,18 +0,0 @@
-thing-1 = {
- name = "0\12\\\345678\9";
-}
-
-list = (
- {
- prop1 = "Bob";
- prop2 = "Dave";
- },
- {
- prop1 = "Bobby";
- prop2 = "Davy";
- },
- {
- prop1 = "Robert";
- prop2 = "David";
- }
-)
\ No newline at end of file
diff --git a/lib/tsconfig/test-tsconfig.cc b/lib/tsconfig/test-tsconfig.cc
deleted file mode 100644
index 41bbf02..0000000
--- a/lib/tsconfig/test-tsconfig.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-/** @file
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-# include "tsconfig/TsValue.h"
-# include <cstdio>
-# include <iostream>
-
-using ts::config::Configuration;
-using ts::config::Value;
-
-inline std::ostream& operator << ( std::ostream& s, ts::ConstBuffer const& b ) {
- if (b._ptr) { s.write(b._ptr, b._size);
- } else { s << b._size;
-}
- return s;
-}
-
-int main(int /* argc ATS_UNUSED */, char **/* argv ATS_UNUSED */) {
- printf("Testing TsConfig\n");
- ts::Rv<Configuration> cv = Configuration::loadFromPath("test-1.tsconfig");
- if (cv.isOK()) {
- Value v = cv.result().find("thing-1.name");
- if (v) {
- std::cout << "thing-1.name = " << v.getText() << std::endl;
- } else {
- std::cout << "Failed to find 'name' in 'thing-1'" << std::endl;
- }
- } else {
- std::cout << "Load failed" << std::endl
- << cv.errata()
- ;
- }
-}