|
@@ -0,0 +1,1729 @@
|
|
|
|
+/* This file is automatically generated by Lemon from input grammar
|
|
|
|
+** source file "grammar_ttl.y". */
|
|
|
|
+/** @brief Lemon parser grammar for Turtle.
|
|
|
|
+ *
|
|
|
|
+ * The `lemon' parser generator executable must be in your PATH:
|
|
|
|
+ * https://sqlite.org/src/doc/trunk/doc/lemon.html
|
|
|
|
+ *
|
|
|
|
+ * TTL EBNF: https://www.w3.org/TeamSubmission/turtle/#sec-grammar-grammar
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+#include "volksdata/codec.h"
|
|
|
|
+
|
|
|
|
+#line 39 "../../build/grammar_ttl.c"
|
|
|
|
+/**************** End of %include directives **********************************/
|
|
|
|
+/* These constants specify the various numeric values for terminal symbols.
|
|
|
|
+***************** Begin token definitions *************************************/
|
|
|
|
+#ifndef T_PERIOD
|
|
|
|
+#define T_PERIOD 1
|
|
|
|
+#define T_SEMICOLON 2
|
|
|
|
+#define T_COMMA 3
|
|
|
|
+#define T_STRING 4
|
|
|
|
+#define T_INTEGER 5
|
|
|
|
+#define T_DOUBLE 6
|
|
|
|
+#define T_DECIMAL 7
|
|
|
|
+#define T_BOOLEAN 8
|
|
|
|
+#define T_QNAME 9
|
|
|
|
+#define T_BNODE_ID 10
|
|
|
|
+#define T_IRIREF 11
|
|
|
|
+#define T_LANGTAG 12
|
|
|
|
+#define T_PREFIX 13
|
|
|
|
+#define T_COLON 14
|
|
|
|
+#define T_EOF 15
|
|
|
|
+#define T_WS 16
|
|
|
|
+#define T_BASE 17
|
|
|
|
+#define T_RDF_TYPE 18
|
|
|
|
+#define T_DTYPE_MARKER 19
|
|
|
|
+#define T_LBRACKET 20
|
|
|
|
+#define T_RBRACKET 21
|
|
|
|
+#define T_LPAREN 22
|
|
|
|
+#define T_RPAREN 23
|
|
|
|
+#endif
|
|
|
|
+/**************** End token definitions ***************************************/
|
|
|
|
+
|
|
|
|
+/* The next sections is a series of control #defines.
|
|
|
|
+** various aspects of the generated parser.
|
|
|
|
+** YYCODETYPE is the data type used to store the integer codes
|
|
|
|
+** that represent terminal and non-terminal symbols.
|
|
|
|
+** "unsigned char" is used if there are fewer than
|
|
|
|
+** 256 symbols. Larger types otherwise.
|
|
|
|
+** YYNOCODE is a number of type YYCODETYPE that is not used for
|
|
|
|
+** any terminal or nonterminal symbol.
|
|
|
|
+** YYFALLBACK If defined, this indicates that one or more tokens
|
|
|
|
+** (also known as: "terminal symbols") have fall-back
|
|
|
|
+** values which should be used if the original symbol
|
|
|
|
+** would not parse. This permits keywords to sometimes
|
|
|
|
+** be used as identifiers, for example.
|
|
|
|
+** YYACTIONTYPE is the data type used for "action codes" - numbers
|
|
|
|
+** that indicate what to do in response to the next
|
|
|
|
+** token.
|
|
|
|
+** TTLParseTOKENTYPE is the data type used for minor type for terminal
|
|
|
|
+** symbols. Background: A "minor type" is a semantic
|
|
|
|
+** value associated with a terminal or non-terminal
|
|
|
|
+** symbols. For example, for an "ID" terminal symbol,
|
|
|
|
+** the minor type might be the name of the identifier.
|
|
|
|
+** Each non-terminal can have a different minor type.
|
|
|
|
+** Terminal symbols all have the same minor type, though.
|
|
|
|
+** This macros defines the minor type for terminal
|
|
|
|
+** symbols.
|
|
|
|
+** YYMINORTYPE is the data type used for all minor types.
|
|
|
|
+** This is typically a union of many types, one of
|
|
|
|
+** which is TTLParseTOKENTYPE. The entry in the union
|
|
|
|
+** for terminal symbols is called "yy0".
|
|
|
|
+** YYSTACKDEPTH is the maximum depth of the parser's stack. If
|
|
|
|
+** zero the stack is dynamically sized using realloc()
|
|
|
|
+** TTLParseARG_SDECL A static variable declaration for the %extra_argument
|
|
|
|
+** TTLParseARG_PDECL A parameter declaration for the %extra_argument
|
|
|
|
+** TTLParseARG_PARAM Code to pass %extra_argument as a subroutine parameter
|
|
|
|
+** TTLParseARG_STORE Code to store %extra_argument into yypParser
|
|
|
|
+** TTLParseARG_FETCH Code to extract %extra_argument from yypParser
|
|
|
|
+** TTLParseCTX_* As TTLParseARG_ except for %extra_context
|
|
|
|
+** YYERRORSYMBOL is the code number of the error symbol. If not
|
|
|
|
+** defined, then do no error processing.
|
|
|
|
+** YYNSTATE the combined number of states.
|
|
|
|
+** YYNRULE the number of rules in the grammar
|
|
|
|
+** YYNTOKEN Number of terminal symbols
|
|
|
|
+** YY_MAX_SHIFT Maximum value for shift actions
|
|
|
|
+** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions
|
|
|
|
+** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions
|
|
|
|
+** YY_ERROR_ACTION The yy_action[] code for syntax error
|
|
|
|
+** YY_ACCEPT_ACTION The yy_action[] code for accept
|
|
|
|
+** YY_NO_ACTION The yy_action[] code for no-op
|
|
|
|
+** YY_MIN_REDUCE Minimum value for reduce actions
|
|
|
|
+** YY_MAX_REDUCE Maximum value for reduce actions
|
|
|
|
+*/
|
|
|
|
+#ifndef INTERFACE
|
|
|
|
+# define INTERFACE 1
|
|
|
|
+#endif
|
|
|
|
+/************* Begin control #defines *****************************************/
|
|
|
|
+#define YYCODETYPE unsigned char
|
|
|
|
+#define YYNOCODE 41
|
|
|
|
+#define YYACTIONTYPE unsigned char
|
|
|
|
+#define TTLParseTOKENTYPE char *
|
|
|
|
+typedef union {
|
|
|
|
+ int yyinit;
|
|
|
|
+ TTLParseTOKENTYPE yy0;
|
|
|
|
+ VOLK_LinkMap * yy2;
|
|
|
|
+ VOLK_Term * yy12;
|
|
|
|
+ char * yy33;
|
|
|
|
+ VOLK_TermSet * yy60;
|
|
|
|
+} YYMINORTYPE;
|
|
|
|
+#ifndef YYSTACKDEPTH
|
|
|
|
+#define YYSTACKDEPTH 100
|
|
|
|
+#endif
|
|
|
|
+#define TTLParseARG_SDECL VOLK_TTLParserState *state ;
|
|
|
|
+#define TTLParseARG_PDECL , VOLK_TTLParserState *state
|
|
|
|
+#define TTLParseARG_PARAM ,state
|
|
|
|
+#define TTLParseARG_FETCH VOLK_TTLParserState *state =yypParser->state ;
|
|
|
|
+#define TTLParseARG_STORE yypParser->state =state ;
|
|
|
|
+#define TTLParseCTX_SDECL
|
|
|
|
+#define TTLParseCTX_PDECL
|
|
|
|
+#define TTLParseCTX_PARAM
|
|
|
|
+#define TTLParseCTX_FETCH
|
|
|
|
+#define TTLParseCTX_STORE
|
|
|
|
+#define YYNSTATE 28
|
|
|
|
+#define YYNRULE 41
|
|
|
|
+#define YYNRULE_WITH_ACTION 27
|
|
|
|
+#define YYNTOKEN 24
|
|
|
|
+#define YY_MAX_SHIFT 27
|
|
|
|
+#define YY_MIN_SHIFTREDUCE 63
|
|
|
|
+#define YY_MAX_SHIFTREDUCE 103
|
|
|
|
+#define YY_ERROR_ACTION 104
|
|
|
|
+#define YY_ACCEPT_ACTION 105
|
|
|
|
+#define YY_NO_ACTION 106
|
|
|
|
+#define YY_MIN_REDUCE 107
|
|
|
|
+#define YY_MAX_REDUCE 147
|
|
|
|
+/************* End control #defines *******************************************/
|
|
|
|
+#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
|
|
|
|
+
|
|
|
|
+/* Define the yytestcase() macro to be a no-op if is not already defined
|
|
|
|
+** otherwise.
|
|
|
|
+**
|
|
|
|
+** Applications can choose to define yytestcase() in the %include section
|
|
|
|
+** to a macro that can assist in verifying code coverage. For production
|
|
|
|
+** code the yytestcase() macro should be turned off. But it is useful
|
|
|
|
+** for testing.
|
|
|
|
+*/
|
|
|
|
+#ifndef yytestcase
|
|
|
|
+# define yytestcase(X)
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/* Next are the tables used to determine what action to take based on the
|
|
|
|
+** current state and lookahead token. These tables are used to implement
|
|
|
|
+** functions that take a state number and lookahead value and return an
|
|
|
|
+** action integer.
|
|
|
|
+**
|
|
|
|
+** Suppose the action integer is N. Then the action is determined as
|
|
|
|
+** follows
|
|
|
|
+**
|
|
|
|
+** 0 <= N <= YY_MAX_SHIFT Shift N. That is, push the lookahead
|
|
|
|
+** token onto the stack and goto state N.
|
|
|
|
+**
|
|
|
|
+** N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then
|
|
|
|
+** and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE.
|
|
|
|
+**
|
|
|
|
+** N == YY_ERROR_ACTION A syntax error has occurred.
|
|
|
|
+**
|
|
|
|
+** N == YY_ACCEPT_ACTION The parser accepts its input.
|
|
|
|
+**
|
|
|
|
+** N == YY_NO_ACTION No such action. Denotes unused
|
|
|
|
+** slots in the yy_action[] table.
|
|
|
|
+**
|
|
|
|
+** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE
|
|
|
|
+** and YY_MAX_REDUCE
|
|
|
|
+**
|
|
|
|
+** The action table is constructed as a single large table named yy_action[].
|
|
|
|
+** Given state S and lookahead X, the action is computed as either:
|
|
|
|
+**
|
|
|
|
+** (A) N = yy_action[ yy_shift_ofst[S] + X ]
|
|
|
|
+** (B) N = yy_default[S]
|
|
|
|
+**
|
|
|
|
+** The (A) formula is preferred. The B formula is used instead if
|
|
|
|
+** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X.
|
|
|
|
+**
|
|
|
|
+** The formulas above are for computing the action when the lookahead is
|
|
|
|
+** a terminal symbol. If the lookahead is a non-terminal (as occurs after
|
|
|
|
+** a reduce action) then the yy_reduce_ofst[] array is used in place of
|
|
|
|
+** the yy_shift_ofst[] array.
|
|
|
|
+**
|
|
|
|
+** The following are the tables generated in this section:
|
|
|
|
+**
|
|
|
|
+** yy_action[] A single table containing all actions.
|
|
|
|
+** yy_lookahead[] A table containing the lookahead for each entry in
|
|
|
|
+** yy_action. Used to detect hash collisions.
|
|
|
|
+** yy_shift_ofst[] For each state, the offset into yy_action for
|
|
|
|
+** shifting terminals.
|
|
|
|
+** yy_reduce_ofst[] For each state, the offset into yy_action for
|
|
|
|
+** shifting non-terminals after a reduce.
|
|
|
|
+** yy_default[] Default action for each state.
|
|
|
|
+**
|
|
|
|
+*********** Begin parsing tables **********************************************/
|
|
|
|
+#define YY_ACTTAB_COUNT (111)
|
|
|
|
+static const YYACTIONTYPE yy_action[] = {
|
|
|
|
+ /* 0 */ 105, 1, 65, 9, 17, 77, 78, 79, 80, 89,
|
|
|
|
+ /* 10 */ 81, 88, 17, 77, 78, 79, 80, 89, 81, 88,
|
|
|
|
+ /* 20 */ 7, 14, 2, 84, 14, 89, 81, 88, 7, 26,
|
|
|
|
+ /* 30 */ 2, 27, 96, 23, 5, 120, 7, 102, 2, 135,
|
|
|
|
+ /* 40 */ 135, 135, 135, 15, 130, 130, 130, 130, 130, 115,
|
|
|
|
+ /* 50 */ 116, 3, 116, 131, 131, 131, 131, 131, 11, 10,
|
|
|
|
+ /* 60 */ 19, 114, 114, 114, 114, 114, 20, 114, 114, 114,
|
|
|
|
+ /* 70 */ 114, 114, 113, 113, 113, 113, 113, 89, 83, 88,
|
|
|
|
+ /* 80 */ 16, 13, 4, 89, 13, 88, 73, 8, 66, 82,
|
|
|
|
+ /* 90 */ 18, 13, 73, 102, 13, 89, 89, 88, 88, 6,
|
|
|
|
+ /* 100 */ 85, 75, 64, 21, 22, 73, 63, 25, 12, 24,
|
|
|
|
+ /* 110 */ 134,
|
|
|
|
+};
|
|
|
|
+static const YYCODETYPE yy_lookahead[] = {
|
|
|
|
+ /* 0 */ 24, 25, 1, 2, 4, 5, 6, 7, 8, 9,
|
|
|
|
+ /* 10 */ 10, 11, 4, 5, 6, 7, 8, 9, 10, 11,
|
|
|
|
+ /* 20 */ 20, 33, 22, 23, 36, 9, 10, 11, 20, 13,
|
|
|
|
+ /* 30 */ 22, 15, 16, 17, 31, 36, 20, 16, 22, 26,
|
|
|
|
+ /* 40 */ 27, 28, 29, 30, 35, 36, 37, 38, 39, 36,
|
|
|
|
+ /* 50 */ 37, 31, 39, 35, 36, 37, 38, 39, 40, 2,
|
|
|
|
+ /* 60 */ 34, 35, 36, 37, 38, 39, 34, 35, 36, 37,
|
|
|
|
+ /* 70 */ 38, 39, 35, 36, 37, 38, 39, 9, 21, 11,
|
|
|
|
+ /* 80 */ 32, 33, 31, 9, 36, 11, 18, 31, 1, 21,
|
|
|
|
+ /* 90 */ 32, 33, 18, 16, 36, 9, 9, 11, 11, 3,
|
|
|
|
+ /* 100 */ 23, 12, 1, 11, 16, 18, 1, 16, 19, 11,
|
|
|
|
+ /* 110 */ 0, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
|
|
|
+ /* 120 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
|
|
|
+ /* 130 */ 41, 41, 41, 41, 41,
|
|
|
|
+};
|
|
|
|
+#define YY_SHIFT_COUNT (27)
|
|
|
|
+#define YY_SHIFT_MIN (0)
|
|
|
|
+#define YY_SHIFT_MAX (110)
|
|
|
|
+static const unsigned char yy_shift_ofst[] = {
|
|
|
|
+ /* 0 */ 111, 16, 0, 8, 8, 8, 8, 68, 74, 87,
|
|
|
|
+ /* 10 */ 74, 77, 86, 21, 21, 21, 57, 89, 1, 96,
|
|
|
|
+ /* 20 */ 96, 101, 92, 88, 105, 98, 91, 110,
|
|
|
|
+};
|
|
|
|
+#define YY_REDUCE_COUNT (15)
|
|
|
|
+#define YY_REDUCE_MIN (-24)
|
|
|
|
+#define YY_REDUCE_MAX (58)
|
|
|
|
+static const signed char yy_reduce_ofst[] = {
|
|
|
|
+ /* 0 */ -24, 13, 18, 26, 32, 9, 37, 48, 58, -12,
|
|
|
|
+ /* 10 */ -12, 3, -1, 20, 51, 56,
|
|
|
|
+};
|
|
|
|
+static const YYACTIONTYPE yy_default[] = {
|
|
|
|
+ /* 0 */ 136, 104, 104, 104, 104, 104, 104, 104, 104, 104,
|
|
|
|
+ /* 10 */ 104, 147, 104, 147, 147, 147, 104, 118, 104, 111,
|
|
|
|
+ /* 20 */ 112, 104, 104, 104, 104, 104, 104, 104,
|
|
|
|
+};
|
|
|
|
+/********** End of lemon-generated parsing tables *****************************/
|
|
|
|
+
|
|
|
|
+/* The next table maps tokens (terminal symbols) into fallback tokens.
|
|
|
|
+** If a construct like the following:
|
|
|
|
+**
|
|
|
|
+** %fallback ID X Y Z.
|
|
|
|
+**
|
|
|
|
+** appears in the grammar, then ID becomes a fallback token for X, Y,
|
|
|
|
+** and Z. Whenever one of the tokens X, Y, or Z is input to the parser
|
|
|
|
+** but it does not parse, the type of the token is changed to ID and
|
|
|
|
+** the parse is retried before an error is thrown.
|
|
|
|
+**
|
|
|
|
+** This feature can be used, for example, to cause some keywords in a language
|
|
|
|
+** to revert to identifiers if they keyword does not apply in the context where
|
|
|
|
+** it appears.
|
|
|
|
+*/
|
|
|
|
+#ifdef YYFALLBACK
|
|
|
|
+static const YYCODETYPE yyFallback[] = {
|
|
|
|
+};
|
|
|
|
+#endif /* YYFALLBACK */
|
|
|
|
+
|
|
|
|
+/* The following structure represents a single element of the
|
|
|
|
+** parser's stack. Information stored includes:
|
|
|
|
+**
|
|
|
|
+** + The state number for the parser at this level of the stack.
|
|
|
|
+**
|
|
|
|
+** + The value of the token stored at this level of the stack.
|
|
|
|
+** (In other words, the "major" token.)
|
|
|
|
+**
|
|
|
|
+** + The semantic value stored at this level of the stack. This is
|
|
|
|
+** the information used by the action routines in the grammar.
|
|
|
|
+** It is sometimes called the "minor" token.
|
|
|
|
+**
|
|
|
|
+** After the "shift" half of a SHIFTREDUCE action, the stateno field
|
|
|
|
+** actually contains the reduce action for the second half of the
|
|
|
|
+** SHIFTREDUCE.
|
|
|
|
+*/
|
|
|
|
+struct yyStackEntry {
|
|
|
|
+ YYACTIONTYPE stateno; /* The state-number, or reduce action in SHIFTREDUCE */
|
|
|
|
+ YYCODETYPE major; /* The major token value. This is the code
|
|
|
|
+ ** number for the token at this stack level */
|
|
|
|
+ YYMINORTYPE minor; /* The user-supplied minor token value. This
|
|
|
|
+ ** is the value of the token */
|
|
|
|
+};
|
|
|
|
+typedef struct yyStackEntry yyStackEntry;
|
|
|
|
+
|
|
|
|
+/* The state of the parser is completely contained in an instance of
|
|
|
|
+** the following structure */
|
|
|
|
+struct yyParser {
|
|
|
|
+ yyStackEntry *yytos; /* Pointer to top element of the stack */
|
|
|
|
+#ifdef YYTRACKMAXSTACKDEPTH
|
|
|
|
+ int yyhwm; /* High-water mark of the stack */
|
|
|
|
+#endif
|
|
|
|
+#ifndef YYNOERRORRECOVERY
|
|
|
|
+ int yyerrcnt; /* Shifts left before out of the error */
|
|
|
|
+#endif
|
|
|
|
+ TTLParseARG_SDECL /* A place to hold %extra_argument */
|
|
|
|
+ TTLParseCTX_SDECL /* A place to hold %extra_context */
|
|
|
|
+#if YYSTACKDEPTH<=0
|
|
|
|
+ int yystksz; /* Current side of the stack */
|
|
|
|
+ yyStackEntry *yystack; /* The parser's stack */
|
|
|
|
+ yyStackEntry yystk0; /* First stack entry */
|
|
|
|
+#else
|
|
|
|
+ yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
|
|
|
|
+ yyStackEntry *yystackEnd; /* Last entry in the stack */
|
|
|
|
+#endif
|
|
|
|
+};
|
|
|
|
+typedef struct yyParser yyParser;
|
|
|
|
+
|
|
|
|
+#include <assert.h>
|
|
|
|
+#ifndef NDEBUG
|
|
|
|
+#include <stdio.h>
|
|
|
|
+static FILE *yyTraceFILE = 0;
|
|
|
|
+static char *yyTracePrompt = 0;
|
|
|
|
+#endif /* NDEBUG */
|
|
|
|
+
|
|
|
|
+#ifndef NDEBUG
|
|
|
|
+/*
|
|
|
|
+** Turn parser tracing on by giving a stream to which to write the trace
|
|
|
|
+** and a prompt to preface each trace message. Tracing is turned off
|
|
|
|
+** by making either argument NULL
|
|
|
|
+**
|
|
|
|
+** Inputs:
|
|
|
|
+** <ul>
|
|
|
|
+** <li> A FILE* to which trace output should be written.
|
|
|
|
+** If NULL, then tracing is turned off.
|
|
|
|
+** <li> A prefix string written at the beginning of every
|
|
|
|
+** line of trace output. If NULL, then tracing is
|
|
|
|
+** turned off.
|
|
|
|
+** </ul>
|
|
|
|
+**
|
|
|
|
+** Outputs:
|
|
|
|
+** None.
|
|
|
|
+*/
|
|
|
|
+void TTLParseTrace(FILE *TraceFILE, char *zTracePrompt){
|
|
|
|
+ yyTraceFILE = TraceFILE;
|
|
|
|
+ yyTracePrompt = zTracePrompt;
|
|
|
|
+ if( yyTraceFILE==0 ) yyTracePrompt = 0;
|
|
|
|
+ else if( yyTracePrompt==0 ) yyTraceFILE = 0;
|
|
|
|
+}
|
|
|
|
+#endif /* NDEBUG */
|
|
|
|
+
|
|
|
|
+#if defined(YYCOVERAGE) || !defined(NDEBUG)
|
|
|
|
+/* For tracing shifts, the names of all terminals and nonterminals
|
|
|
|
+** are required. The following table supplies these names */
|
|
|
|
+static const char *const yyTokenName[] = {
|
|
|
|
+ /* 0 */ "$",
|
|
|
|
+ /* 1 */ "PERIOD",
|
|
|
|
+ /* 2 */ "SEMICOLON",
|
|
|
|
+ /* 3 */ "COMMA",
|
|
|
|
+ /* 4 */ "STRING",
|
|
|
|
+ /* 5 */ "INTEGER",
|
|
|
|
+ /* 6 */ "DOUBLE",
|
|
|
|
+ /* 7 */ "DECIMAL",
|
|
|
|
+ /* 8 */ "BOOLEAN",
|
|
|
|
+ /* 9 */ "QNAME",
|
|
|
|
+ /* 10 */ "BNODE_ID",
|
|
|
|
+ /* 11 */ "IRIREF",
|
|
|
|
+ /* 12 */ "LANGTAG",
|
|
|
|
+ /* 13 */ "PREFIX",
|
|
|
|
+ /* 14 */ "COLON",
|
|
|
|
+ /* 15 */ "EOF",
|
|
|
|
+ /* 16 */ "WS",
|
|
|
|
+ /* 17 */ "BASE",
|
|
|
|
+ /* 18 */ "RDF_TYPE",
|
|
|
|
+ /* 19 */ "DTYPE_MARKER",
|
|
|
|
+ /* 20 */ "LBRACKET",
|
|
|
|
+ /* 21 */ "RBRACKET",
|
|
|
|
+ /* 22 */ "LPAREN",
|
|
|
|
+ /* 23 */ "RPAREN",
|
|
|
|
+ /* 24 */ "turtleDoc",
|
|
|
|
+ /* 25 */ "statements",
|
|
|
|
+ /* 26 */ "statement",
|
|
|
|
+ /* 27 */ "prefixID",
|
|
|
|
+ /* 28 */ "base",
|
|
|
|
+ /* 29 */ "triples",
|
|
|
|
+ /* 30 */ "subject",
|
|
|
|
+ /* 31 */ "ows",
|
|
|
|
+ /* 32 */ "predObjList",
|
|
|
|
+ /* 33 */ "predicate",
|
|
|
|
+ /* 34 */ "objectList",
|
|
|
|
+ /* 35 */ "object",
|
|
|
|
+ /* 36 */ "resource",
|
|
|
|
+ /* 37 */ "blank",
|
|
|
|
+ /* 38 */ "literal",
|
|
|
|
+ /* 39 */ "collection",
|
|
|
|
+ /* 40 */ "itemList",
|
|
|
|
+};
|
|
|
|
+#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
|
|
|
|
+
|
|
|
|
+#ifndef NDEBUG
|
|
|
|
+/* For tracing reduce actions, the names of all rules are required.
|
|
|
|
+*/
|
|
|
|
+static const char *const yyRuleName[] = {
|
|
|
|
+ /* 0 */ "prefixID ::= PREFIX WS IRIREF PERIOD",
|
|
|
|
+ /* 1 */ "base ::= BASE WS IRIREF PERIOD",
|
|
|
|
+ /* 2 */ "triples ::= subject ows predObjList PERIOD",
|
|
|
|
+ /* 3 */ "triples ::= subject ows predObjList SEMICOLON PERIOD",
|
|
|
|
+ /* 4 */ "predObjList ::= predicate ows objectList",
|
|
|
|
+ /* 5 */ "predObjList ::= predObjList SEMICOLON predicate ows objectList",
|
|
|
|
+ /* 6 */ "objectList ::= objectList COMMA object",
|
|
|
|
+ /* 7 */ "objectList ::= object",
|
|
|
|
+ /* 8 */ "subject ::= resource",
|
|
|
|
+ /* 9 */ "subject ::= blank",
|
|
|
|
+ /* 10 */ "predicate ::= RDF_TYPE",
|
|
|
|
+ /* 11 */ "literal ::= STRING",
|
|
|
|
+ /* 12 */ "literal ::= STRING LANGTAG",
|
|
|
|
+ /* 13 */ "literal ::= STRING DTYPE_MARKER resource",
|
|
|
|
+ /* 14 */ "literal ::= INTEGER",
|
|
|
|
+ /* 15 */ "literal ::= DOUBLE",
|
|
|
|
+ /* 16 */ "literal ::= DECIMAL",
|
|
|
|
+ /* 17 */ "literal ::= BOOLEAN",
|
|
|
|
+ /* 18 */ "blank ::= BNODE_ID",
|
|
|
|
+ /* 19 */ "blank ::= LBRACKET RBRACKET",
|
|
|
|
+ /* 20 */ "blank ::= LBRACKET predObjList RBRACKET",
|
|
|
|
+ /* 21 */ "blank ::= LPAREN RPAREN",
|
|
|
|
+ /* 22 */ "collection ::= LPAREN itemList RPAREN",
|
|
|
|
+ /* 23 */ "itemList ::= itemList ows object",
|
|
|
|
+ /* 24 */ "itemList ::= object",
|
|
|
|
+ /* 25 */ "resource ::= IRIREF",
|
|
|
|
+ /* 26 */ "resource ::= QNAME",
|
|
|
|
+ /* 27 */ "turtleDoc ::= statements EOF",
|
|
|
|
+ /* 28 */ "statements ::= statements statement",
|
|
|
|
+ /* 29 */ "statements ::=",
|
|
|
|
+ /* 30 */ "statement ::= prefixID",
|
|
|
|
+ /* 31 */ "statement ::= base",
|
|
|
|
+ /* 32 */ "statement ::= triples",
|
|
|
|
+ /* 33 */ "statement ::= WS",
|
|
|
|
+ /* 34 */ "predicate ::= resource",
|
|
|
|
+ /* 35 */ "object ::= resource",
|
|
|
|
+ /* 36 */ "object ::= blank",
|
|
|
|
+ /* 37 */ "object ::= literal",
|
|
|
|
+ /* 38 */ "blank ::= collection",
|
|
|
|
+ /* 39 */ "ows ::= WS",
|
|
|
|
+ /* 40 */ "ows ::=",
|
|
|
|
+};
|
|
|
|
+#endif /* NDEBUG */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+#if YYSTACKDEPTH<=0
|
|
|
|
+/*
|
|
|
|
+** Try to increase the size of the parser stack. Return the number
|
|
|
|
+** of errors. Return 0 on success.
|
|
|
|
+*/
|
|
|
|
+static int yyGrowStack(yyParser *p){
|
|
|
|
+ int newSize;
|
|
|
|
+ int idx;
|
|
|
|
+ yyStackEntry *pNew;
|
|
|
|
+
|
|
|
|
+ newSize = p->yystksz*2 + 100;
|
|
|
|
+ idx = p->yytos ? (int)(p->yytos - p->yystack) : 0;
|
|
|
|
+ if( p->yystack==&p->yystk0 ){
|
|
|
|
+ pNew = malloc(newSize*sizeof(pNew[0]));
|
|
|
|
+ if( pNew ) pNew[0] = p->yystk0;
|
|
|
|
+ }else{
|
|
|
|
+ pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
|
|
|
|
+ }
|
|
|
|
+ if( pNew ){
|
|
|
|
+ p->yystack = pNew;
|
|
|
|
+ p->yytos = &p->yystack[idx];
|
|
|
|
+#ifndef NDEBUG
|
|
|
|
+ if( yyTraceFILE ){
|
|
|
|
+ fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
|
|
|
|
+ yyTracePrompt, p->yystksz, newSize);
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+ p->yystksz = newSize;
|
|
|
|
+ }
|
|
|
|
+ return pNew==0;
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+/* Datatype of the argument to the memory allocated passed as the
|
|
|
|
+** second argument to TTLParseAlloc() below. This can be changed by
|
|
|
|
+** putting an appropriate #define in the %include section of the input
|
|
|
|
+** grammar.
|
|
|
|
+*/
|
|
|
|
+#ifndef YYMALLOCARGTYPE
|
|
|
|
+# define YYMALLOCARGTYPE size_t
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+/* Initialize a new parser that has already been allocated.
|
|
|
|
+*/
|
|
|
|
+void TTLParseInit(void *yypRawParser TTLParseCTX_PDECL){
|
|
|
|
+ yyParser *yypParser = (yyParser*)yypRawParser;
|
|
|
|
+ TTLParseCTX_STORE
|
|
|
|
+#ifdef YYTRACKMAXSTACKDEPTH
|
|
|
|
+ yypParser->yyhwm = 0;
|
|
|
|
+#endif
|
|
|
|
+#if YYSTACKDEPTH<=0
|
|
|
|
+ yypParser->yytos = NULL;
|
|
|
|
+ yypParser->yystack = NULL;
|
|
|
|
+ yypParser->yystksz = 0;
|
|
|
|
+ if( yyGrowStack(yypParser) ){
|
|
|
|
+ yypParser->yystack = &yypParser->yystk0;
|
|
|
|
+ yypParser->yystksz = 1;
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+#ifndef YYNOERRORRECOVERY
|
|
|
|
+ yypParser->yyerrcnt = -1;
|
|
|
|
+#endif
|
|
|
|
+ yypParser->yytos = yypParser->yystack;
|
|
|
|
+ yypParser->yystack[0].stateno = 0;
|
|
|
|
+ yypParser->yystack[0].major = 0;
|
|
|
|
+#if YYSTACKDEPTH>0
|
|
|
|
+ yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1];
|
|
|
|
+#endif
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#ifndef TTLParse_ENGINEALWAYSONSTACK
|
|
|
|
+/*
|
|
|
|
+** This function allocates a new parser.
|
|
|
|
+** The only argument is a pointer to a function which works like
|
|
|
|
+** malloc.
|
|
|
|
+**
|
|
|
|
+** Inputs:
|
|
|
|
+** A pointer to the function used to allocate memory.
|
|
|
|
+**
|
|
|
|
+** Outputs:
|
|
|
|
+** A pointer to a parser. This pointer is used in subsequent calls
|
|
|
|
+** to TTLParse and TTLParseFree.
|
|
|
|
+*/
|
|
|
|
+void *TTLParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) TTLParseCTX_PDECL){
|
|
|
|
+ yyParser *yypParser;
|
|
|
|
+ yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
|
|
|
|
+ if( yypParser ){
|
|
|
|
+ TTLParseCTX_STORE
|
|
|
|
+ TTLParseInit(yypParser TTLParseCTX_PARAM);
|
|
|
|
+ }
|
|
|
|
+ return (void*)yypParser;
|
|
|
|
+}
|
|
|
|
+#endif /* TTLParse_ENGINEALWAYSONSTACK */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/* The following function deletes the "minor type" or semantic value
|
|
|
|
+** associated with a symbol. The symbol can be either a terminal
|
|
|
|
+** or nonterminal. "yymajor" is the symbol code, and "yypminor" is
|
|
|
|
+** a pointer to the value to be deleted. The code used to do the
|
|
|
|
+** deletions is derived from the %destructor and/or %token_destructor
|
|
|
|
+** directives of the input grammar.
|
|
|
|
+*/
|
|
|
|
+static void yy_destructor(
|
|
|
|
+ yyParser *yypParser, /* The parser */
|
|
|
|
+ YYCODETYPE yymajor, /* Type code for object to destroy */
|
|
|
|
+ YYMINORTYPE *yypminor /* The object to be destroyed */
|
|
|
|
+){
|
|
|
|
+ TTLParseARG_FETCH
|
|
|
|
+ TTLParseCTX_FETCH
|
|
|
|
+ switch( yymajor ){
|
|
|
|
+ /* Here is inserted the actions which take place when a
|
|
|
|
+ ** terminal or non-terminal is destroyed. This can happen
|
|
|
|
+ ** when the symbol is popped from the stack during a
|
|
|
|
+ ** reduce or during error processing or when a parser is
|
|
|
|
+ ** being destroyed before it is finished parsing.
|
|
|
|
+ **
|
|
|
|
+ ** Note: during a reduce, the only symbols destroyed are those
|
|
|
|
+ ** which appear on the RHS of the rule, but which are *not* used
|
|
|
|
+ ** inside the C code.
|
|
|
|
+ */
|
|
|
|
+/********* Begin destructor definitions ***************************************/
|
|
|
|
+ /* TERMINAL Destructor */
|
|
|
|
+ case 1: /* PERIOD */
|
|
|
|
+ case 2: /* SEMICOLON */
|
|
|
|
+ case 3: /* COMMA */
|
|
|
|
+ case 4: /* STRING */
|
|
|
|
+ case 5: /* INTEGER */
|
|
|
|
+ case 6: /* DOUBLE */
|
|
|
|
+ case 7: /* DECIMAL */
|
|
|
|
+ case 8: /* BOOLEAN */
|
|
|
|
+ case 9: /* QNAME */
|
|
|
|
+ case 10: /* BNODE_ID */
|
|
|
|
+ case 11: /* IRIREF */
|
|
|
|
+ case 12: /* LANGTAG */
|
|
|
|
+ case 13: /* PREFIX */
|
|
|
|
+ case 14: /* COLON */
|
|
|
|
+ case 15: /* EOF */
|
|
|
|
+ case 16: /* WS */
|
|
|
|
+ case 17: /* BASE */
|
|
|
|
+ case 18: /* RDF_TYPE */
|
|
|
|
+ case 19: /* DTYPE_MARKER */
|
|
|
|
+ case 20: /* LBRACKET */
|
|
|
|
+ case 21: /* RBRACKET */
|
|
|
|
+ case 22: /* LPAREN */
|
|
|
|
+ case 23: /* RPAREN */
|
|
|
|
+{
|
|
|
|
+#line 36 "grammar_ttl.y"
|
|
|
|
+ (void) state; free ((yypminor->yy0));
|
|
|
|
+#line 625 "../../build/grammar_ttl.c"
|
|
|
|
+}
|
|
|
|
+ break;
|
|
|
|
+ case 30: /* subject */
|
|
|
|
+ case 33: /* predicate */
|
|
|
|
+ case 35: /* object */
|
|
|
|
+ case 36: /* resource */
|
|
|
|
+ case 37: /* blank */
|
|
|
|
+ case 38: /* literal */
|
|
|
|
+ case 39: /* collection */
|
|
|
|
+{
|
|
|
|
+#line 120 "grammar_ttl.y"
|
|
|
|
+ VOLK_term_free ((yypminor->yy12));
|
|
|
|
+#line 638 "../../build/grammar_ttl.c"
|
|
|
|
+}
|
|
|
|
+ break;
|
|
|
|
+ case 32: /* predObjList */
|
|
|
|
+{
|
|
|
|
+#line 97 "grammar_ttl.y"
|
|
|
|
+ VOLK_link_map_free ((yypminor->yy2));
|
|
|
|
+#line 645 "../../build/grammar_ttl.c"
|
|
|
|
+}
|
|
|
|
+ break;
|
|
|
|
+ case 34: /* objectList */
|
|
|
|
+ case 40: /* itemList */
|
|
|
|
+{
|
|
|
|
+#line 108 "grammar_ttl.y"
|
|
|
|
+ VOLK_term_set_free ((yypminor->yy60));
|
|
|
|
+#line 653 "../../build/grammar_ttl.c"
|
|
|
|
+}
|
|
|
|
+ break;
|
|
|
|
+/********* End destructor definitions *****************************************/
|
|
|
|
+ default: break; /* If no destructor action specified: do nothing */
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+** Pop the parser's stack once.
|
|
|
|
+**
|
|
|
|
+** If there is a destructor routine associated with the token which
|
|
|
|
+** is popped from the stack, then call it.
|
|
|
|
+*/
|
|
|
|
+static void yy_pop_parser_stack(yyParser *pParser){
|
|
|
|
+ yyStackEntry *yytos;
|
|
|
|
+ assert( pParser->yytos!=0 );
|
|
|
|
+ assert( pParser->yytos > pParser->yystack );
|
|
|
|
+ yytos = pParser->yytos--;
|
|
|
|
+#ifndef NDEBUG
|
|
|
|
+ if( yyTraceFILE ){
|
|
|
|
+ fprintf(yyTraceFILE,"%sPopping %s\n",
|
|
|
|
+ yyTracePrompt,
|
|
|
|
+ yyTokenName[yytos->major]);
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+ yy_destructor(pParser, yytos->major, &yytos->minor);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+** Clear all secondary memory allocations from the parser
|
|
|
|
+*/
|
|
|
|
+void TTLParseFinalize(void *p){
|
|
|
|
+ yyParser *pParser = (yyParser*)p;
|
|
|
|
+ while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser);
|
|
|
|
+#if YYSTACKDEPTH<=0
|
|
|
|
+ if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack);
|
|
|
|
+#endif
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#ifndef TTLParse_ENGINEALWAYSONSTACK
|
|
|
|
+/*
|
|
|
|
+** Deallocate and destroy a parser. Destructors are called for
|
|
|
|
+** all stack elements before shutting the parser down.
|
|
|
|
+**
|
|
|
|
+** If the YYPARSEFREENEVERNULL macro exists (for example because it
|
|
|
|
+** is defined in a %include section of the input grammar) then it is
|
|
|
|
+** assumed that the input pointer is never NULL.
|
|
|
|
+*/
|
|
|
|
+void TTLParseFree(
|
|
|
|
+ void *p, /* The parser to be deleted */
|
|
|
|
+ void (*freeProc)(void*) /* Function used to reclaim memory */
|
|
|
|
+){
|
|
|
|
+#ifndef YYPARSEFREENEVERNULL
|
|
|
|
+ if( p==0 ) return;
|
|
|
|
+#endif
|
|
|
|
+ TTLParseFinalize(p);
|
|
|
|
+ (*freeProc)(p);
|
|
|
|
+}
|
|
|
|
+#endif /* TTLParse_ENGINEALWAYSONSTACK */
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+** Return the peak depth of the stack for a parser.
|
|
|
|
+*/
|
|
|
|
+#ifdef YYTRACKMAXSTACKDEPTH
|
|
|
|
+int TTLParseStackPeak(void *p){
|
|
|
|
+ yyParser *pParser = (yyParser*)p;
|
|
|
|
+ return pParser->yyhwm;
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+/* This array of booleans keeps track of the parser statement
|
|
|
|
+** coverage. The element yycoverage[X][Y] is set when the parser
|
|
|
|
+** is in state X and has a lookahead token Y. In a well-tested
|
|
|
|
+** systems, every element of this matrix should end up being set.
|
|
|
|
+*/
|
|
|
|
+#if defined(YYCOVERAGE)
|
|
|
|
+static unsigned char yycoverage[YYNSTATE][YYNTOKEN];
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+** Write into out a description of every state/lookahead combination that
|
|
|
|
+**
|
|
|
|
+** (1) has not been used by the parser, and
|
|
|
|
+** (2) is not a syntax error.
|
|
|
|
+**
|
|
|
|
+** Return the number of missed state/lookahead combinations.
|
|
|
|
+*/
|
|
|
|
+#if defined(YYCOVERAGE)
|
|
|
|
+int TTLParseCoverage(FILE *out){
|
|
|
|
+ int stateno, iLookAhead, i;
|
|
|
|
+ int nMissed = 0;
|
|
|
|
+ for(stateno=0; stateno<YYNSTATE; stateno++){
|
|
|
|
+ i = yy_shift_ofst[stateno];
|
|
|
|
+ for(iLookAhead=0; iLookAhead<YYNTOKEN; iLookAhead++){
|
|
|
|
+ if( yy_lookahead[i+iLookAhead]!=iLookAhead ) continue;
|
|
|
|
+ if( yycoverage[stateno][iLookAhead]==0 ) nMissed++;
|
|
|
|
+ if( out ){
|
|
|
|
+ fprintf(out,"State %d lookahead %s %s\n", stateno,
|
|
|
|
+ yyTokenName[iLookAhead],
|
|
|
|
+ yycoverage[stateno][iLookAhead] ? "ok" : "missed");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return nMissed;
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+** Find the appropriate action for a parser given the terminal
|
|
|
|
+** look-ahead token iLookAhead.
|
|
|
|
+*/
|
|
|
|
+static YYACTIONTYPE yy_find_shift_action(
|
|
|
|
+ YYCODETYPE iLookAhead, /* The look-ahead token */
|
|
|
|
+ YYACTIONTYPE stateno /* Current state number */
|
|
|
|
+){
|
|
|
|
+ int i;
|
|
|
|
+
|
|
|
|
+ if( stateno>YY_MAX_SHIFT ) return stateno;
|
|
|
|
+ assert( stateno <= YY_SHIFT_COUNT );
|
|
|
|
+#if defined(YYCOVERAGE)
|
|
|
|
+ yycoverage[stateno][iLookAhead] = 1;
|
|
|
|
+#endif
|
|
|
|
+ do{
|
|
|
|
+ i = yy_shift_ofst[stateno];
|
|
|
|
+ assert( i>=0 );
|
|
|
|
+ assert( i<=YY_ACTTAB_COUNT );
|
|
|
|
+ assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD );
|
|
|
|
+ assert( iLookAhead!=YYNOCODE );
|
|
|
|
+ assert( iLookAhead < YYNTOKEN );
|
|
|
|
+ i += iLookAhead;
|
|
|
|
+ assert( i<(int)YY_NLOOKAHEAD );
|
|
|
|
+ if( yy_lookahead[i]!=iLookAhead ){
|
|
|
|
+#ifdef YYFALLBACK
|
|
|
|
+ YYCODETYPE iFallback; /* Fallback token */
|
|
|
|
+ assert( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0]) );
|
|
|
|
+ iFallback = yyFallback[iLookAhead];
|
|
|
|
+ if( iFallback!=0 ){
|
|
|
|
+#ifndef NDEBUG
|
|
|
|
+ if( yyTraceFILE ){
|
|
|
|
+ fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
|
|
|
|
+ yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+ assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */
|
|
|
|
+ iLookAhead = iFallback;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+#ifdef YYWILDCARD
|
|
|
|
+ {
|
|
|
|
+ int j = i - iLookAhead + YYWILDCARD;
|
|
|
|
+ assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) );
|
|
|
|
+ if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){
|
|
|
|
+#ifndef NDEBUG
|
|
|
|
+ if( yyTraceFILE ){
|
|
|
|
+ fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
|
|
|
|
+ yyTracePrompt, yyTokenName[iLookAhead],
|
|
|
|
+ yyTokenName[YYWILDCARD]);
|
|
|
|
+ }
|
|
|
|
+#endif /* NDEBUG */
|
|
|
|
+ return yy_action[j];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+#endif /* YYWILDCARD */
|
|
|
|
+ return yy_default[stateno];
|
|
|
|
+ }else{
|
|
|
|
+ assert( i>=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) );
|
|
|
|
+ return yy_action[i];
|
|
|
|
+ }
|
|
|
|
+ }while(1);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+** Find the appropriate action for a parser given the non-terminal
|
|
|
|
+** look-ahead token iLookAhead.
|
|
|
|
+*/
|
|
|
|
+static YYACTIONTYPE yy_find_reduce_action(
|
|
|
|
+ YYACTIONTYPE stateno, /* Current state number */
|
|
|
|
+ YYCODETYPE iLookAhead /* The look-ahead token */
|
|
|
|
+){
|
|
|
|
+ int i;
|
|
|
|
+#ifdef YYERRORSYMBOL
|
|
|
|
+ if( stateno>YY_REDUCE_COUNT ){
|
|
|
|
+ return yy_default[stateno];
|
|
|
|
+ }
|
|
|
|
+#else
|
|
|
|
+ assert( stateno<=YY_REDUCE_COUNT );
|
|
|
|
+#endif
|
|
|
|
+ i = yy_reduce_ofst[stateno];
|
|
|
|
+ assert( iLookAhead!=YYNOCODE );
|
|
|
|
+ i += iLookAhead;
|
|
|
|
+#ifdef YYERRORSYMBOL
|
|
|
|
+ if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
|
|
|
|
+ return yy_default[stateno];
|
|
|
|
+ }
|
|
|
|
+#else
|
|
|
|
+ assert( i>=0 && i<YY_ACTTAB_COUNT );
|
|
|
|
+ assert( yy_lookahead[i]==iLookAhead );
|
|
|
|
+#endif
|
|
|
|
+ return yy_action[i];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+** The following routine is called if the stack overflows.
|
|
|
|
+*/
|
|
|
|
+static void yyStackOverflow(yyParser *yypParser){
|
|
|
|
+ TTLParseARG_FETCH
|
|
|
|
+ TTLParseCTX_FETCH
|
|
|
|
+#ifndef NDEBUG
|
|
|
|
+ if( yyTraceFILE ){
|
|
|
|
+ fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+ while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
|
|
|
|
+ /* Here code is inserted which will execute if the parser
|
|
|
|
+ ** stack every overflows */
|
|
|
|
+/******** Begin %stack_overflow code ******************************************/
|
|
|
|
+#line 17 "grammar_ttl.y"
|
|
|
|
+
|
|
|
|
+ log_error ("Stack oveflow in TTL parsing.");
|
|
|
|
+ state->rc = VOLK_MEM_ERR;
|
|
|
|
+#line 875 "../../build/grammar_ttl.c"
|
|
|
|
+/******** End %stack_overflow code ********************************************/
|
|
|
|
+ TTLParseARG_STORE /* Suppress warning about unused %extra_argument var */
|
|
|
|
+ TTLParseCTX_STORE
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+** Print tracing information for a SHIFT action
|
|
|
|
+*/
|
|
|
|
+#ifndef NDEBUG
|
|
|
|
+static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){
|
|
|
|
+ if( yyTraceFILE ){
|
|
|
|
+ if( yyNewState<YYNSTATE ){
|
|
|
|
+ fprintf(yyTraceFILE,"%s%s '%s', go to state %d\n",
|
|
|
|
+ yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
|
|
|
|
+ yyNewState);
|
|
|
|
+ }else{
|
|
|
|
+ fprintf(yyTraceFILE,"%s%s '%s', pending reduce %d\n",
|
|
|
|
+ yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
|
|
|
|
+ yyNewState - YY_MIN_REDUCE);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+#else
|
|
|
|
+# define yyTraceShift(X,Y,Z)
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+** Perform a shift action.
|
|
|
|
+*/
|
|
|
|
+static void yy_shift(
|
|
|
|
+ yyParser *yypParser, /* The parser to be shifted */
|
|
|
|
+ YYACTIONTYPE yyNewState, /* The new state to shift in */
|
|
|
|
+ YYCODETYPE yyMajor, /* The major token to shift in */
|
|
|
|
+ TTLParseTOKENTYPE yyMinor /* The minor token to shift in */
|
|
|
|
+){
|
|
|
|
+ yyStackEntry *yytos;
|
|
|
|
+ yypParser->yytos++;
|
|
|
|
+#ifdef YYTRACKMAXSTACKDEPTH
|
|
|
|
+ if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
|
|
|
|
+ yypParser->yyhwm++;
|
|
|
|
+ assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) );
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+#if YYSTACKDEPTH>0
|
|
|
|
+ if( yypParser->yytos>yypParser->yystackEnd ){
|
|
|
|
+ yypParser->yytos--;
|
|
|
|
+ yyStackOverflow(yypParser);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+#else
|
|
|
|
+ if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){
|
|
|
|
+ if( yyGrowStack(yypParser) ){
|
|
|
|
+ yypParser->yytos--;
|
|
|
|
+ yyStackOverflow(yypParser);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+ if( yyNewState > YY_MAX_SHIFT ){
|
|
|
|
+ yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
|
|
|
|
+ }
|
|
|
|
+ yytos = yypParser->yytos;
|
|
|
|
+ yytos->stateno = yyNewState;
|
|
|
|
+ yytos->major = yyMajor;
|
|
|
|
+ yytos->minor.yy0 = yyMinor;
|
|
|
|
+ yyTraceShift(yypParser, yyNewState, "Shift");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
|
|
|
|
+** of that rule */
|
|
|
|
+static const YYCODETYPE yyRuleInfoLhs[] = {
|
|
|
|
+ 27, /* (0) prefixID ::= PREFIX WS IRIREF PERIOD */
|
|
|
|
+ 28, /* (1) base ::= BASE WS IRIREF PERIOD */
|
|
|
|
+ 29, /* (2) triples ::= subject ows predObjList PERIOD */
|
|
|
|
+ 29, /* (3) triples ::= subject ows predObjList SEMICOLON PERIOD */
|
|
|
|
+ 32, /* (4) predObjList ::= predicate ows objectList */
|
|
|
|
+ 32, /* (5) predObjList ::= predObjList SEMICOLON predicate ows objectList */
|
|
|
|
+ 34, /* (6) objectList ::= objectList COMMA object */
|
|
|
|
+ 34, /* (7) objectList ::= object */
|
|
|
|
+ 30, /* (8) subject ::= resource */
|
|
|
|
+ 30, /* (9) subject ::= blank */
|
|
|
|
+ 33, /* (10) predicate ::= RDF_TYPE */
|
|
|
|
+ 38, /* (11) literal ::= STRING */
|
|
|
|
+ 38, /* (12) literal ::= STRING LANGTAG */
|
|
|
|
+ 38, /* (13) literal ::= STRING DTYPE_MARKER resource */
|
|
|
|
+ 38, /* (14) literal ::= INTEGER */
|
|
|
|
+ 38, /* (15) literal ::= DOUBLE */
|
|
|
|
+ 38, /* (16) literal ::= DECIMAL */
|
|
|
|
+ 38, /* (17) literal ::= BOOLEAN */
|
|
|
|
+ 37, /* (18) blank ::= BNODE_ID */
|
|
|
|
+ 37, /* (19) blank ::= LBRACKET RBRACKET */
|
|
|
|
+ 37, /* (20) blank ::= LBRACKET predObjList RBRACKET */
|
|
|
|
+ 37, /* (21) blank ::= LPAREN RPAREN */
|
|
|
|
+ 39, /* (22) collection ::= LPAREN itemList RPAREN */
|
|
|
|
+ 40, /* (23) itemList ::= itemList ows object */
|
|
|
|
+ 40, /* (24) itemList ::= object */
|
|
|
|
+ 36, /* (25) resource ::= IRIREF */
|
|
|
|
+ 36, /* (26) resource ::= QNAME */
|
|
|
|
+ 24, /* (27) turtleDoc ::= statements EOF */
|
|
|
|
+ 25, /* (28) statements ::= statements statement */
|
|
|
|
+ 25, /* (29) statements ::= */
|
|
|
|
+ 26, /* (30) statement ::= prefixID */
|
|
|
|
+ 26, /* (31) statement ::= base */
|
|
|
|
+ 26, /* (32) statement ::= triples */
|
|
|
|
+ 26, /* (33) statement ::= WS */
|
|
|
|
+ 33, /* (34) predicate ::= resource */
|
|
|
|
+ 35, /* (35) object ::= resource */
|
|
|
|
+ 35, /* (36) object ::= blank */
|
|
|
|
+ 35, /* (37) object ::= literal */
|
|
|
|
+ 37, /* (38) blank ::= collection */
|
|
|
|
+ 31, /* (39) ows ::= WS */
|
|
|
|
+ 31, /* (40) ows ::= */
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
|
|
|
|
+** of symbols on the right-hand side of that rule. */
|
|
|
|
+static const signed char yyRuleInfoNRhs[] = {
|
|
|
|
+ -4, /* (0) prefixID ::= PREFIX WS IRIREF PERIOD */
|
|
|
|
+ -4, /* (1) base ::= BASE WS IRIREF PERIOD */
|
|
|
|
+ -4, /* (2) triples ::= subject ows predObjList PERIOD */
|
|
|
|
+ -5, /* (3) triples ::= subject ows predObjList SEMICOLON PERIOD */
|
|
|
|
+ -3, /* (4) predObjList ::= predicate ows objectList */
|
|
|
|
+ -5, /* (5) predObjList ::= predObjList SEMICOLON predicate ows objectList */
|
|
|
|
+ -3, /* (6) objectList ::= objectList COMMA object */
|
|
|
|
+ -1, /* (7) objectList ::= object */
|
|
|
|
+ -1, /* (8) subject ::= resource */
|
|
|
|
+ -1, /* (9) subject ::= blank */
|
|
|
|
+ -1, /* (10) predicate ::= RDF_TYPE */
|
|
|
|
+ -1, /* (11) literal ::= STRING */
|
|
|
|
+ -2, /* (12) literal ::= STRING LANGTAG */
|
|
|
|
+ -3, /* (13) literal ::= STRING DTYPE_MARKER resource */
|
|
|
|
+ -1, /* (14) literal ::= INTEGER */
|
|
|
|
+ -1, /* (15) literal ::= DOUBLE */
|
|
|
|
+ -1, /* (16) literal ::= DECIMAL */
|
|
|
|
+ -1, /* (17) literal ::= BOOLEAN */
|
|
|
|
+ -1, /* (18) blank ::= BNODE_ID */
|
|
|
|
+ -2, /* (19) blank ::= LBRACKET RBRACKET */
|
|
|
|
+ -3, /* (20) blank ::= LBRACKET predObjList RBRACKET */
|
|
|
|
+ -2, /* (21) blank ::= LPAREN RPAREN */
|
|
|
|
+ -3, /* (22) collection ::= LPAREN itemList RPAREN */
|
|
|
|
+ -3, /* (23) itemList ::= itemList ows object */
|
|
|
|
+ -1, /* (24) itemList ::= object */
|
|
|
|
+ -1, /* (25) resource ::= IRIREF */
|
|
|
|
+ -1, /* (26) resource ::= QNAME */
|
|
|
|
+ -2, /* (27) turtleDoc ::= statements EOF */
|
|
|
|
+ -2, /* (28) statements ::= statements statement */
|
|
|
|
+ 0, /* (29) statements ::= */
|
|
|
|
+ -1, /* (30) statement ::= prefixID */
|
|
|
|
+ -1, /* (31) statement ::= base */
|
|
|
|
+ -1, /* (32) statement ::= triples */
|
|
|
|
+ -1, /* (33) statement ::= WS */
|
|
|
|
+ -1, /* (34) predicate ::= resource */
|
|
|
|
+ -1, /* (35) object ::= resource */
|
|
|
|
+ -1, /* (36) object ::= blank */
|
|
|
|
+ -1, /* (37) object ::= literal */
|
|
|
|
+ -1, /* (38) blank ::= collection */
|
|
|
|
+ -1, /* (39) ows ::= WS */
|
|
|
|
+ 0, /* (40) ows ::= */
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static void yy_accept(yyParser*); /* Forward Declaration */
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+** Perform a reduce action and the shift that must immediately
|
|
|
|
+** follow the reduce.
|
|
|
|
+**
|
|
|
|
+** The yyLookahead and yyLookaheadToken parameters provide reduce actions
|
|
|
|
+** access to the lookahead token (if any). The yyLookahead will be YYNOCODE
|
|
|
|
+** if the lookahead token has already been consumed. As this procedure is
|
|
|
|
+** only called from one place, optimizing compilers will in-line it, which
|
|
|
|
+** means that the extra parameters have no performance impact.
|
|
|
|
+*/
|
|
|
|
+static YYACTIONTYPE yy_reduce(
|
|
|
|
+ yyParser *yypParser, /* The parser */
|
|
|
|
+ unsigned int yyruleno, /* Number of the rule by which to reduce */
|
|
|
|
+ int yyLookahead, /* Lookahead token, or YYNOCODE if none */
|
|
|
|
+ TTLParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */
|
|
|
|
+ TTLParseCTX_PDECL /* %extra_context */
|
|
|
|
+){
|
|
|
|
+ int yygoto; /* The next state */
|
|
|
|
+ YYACTIONTYPE yyact; /* The next action */
|
|
|
|
+ yyStackEntry *yymsp; /* The top of the parser's stack */
|
|
|
|
+ int yysize; /* Amount to pop the stack */
|
|
|
|
+ TTLParseARG_FETCH
|
|
|
|
+ (void)yyLookahead;
|
|
|
|
+ (void)yyLookaheadToken;
|
|
|
|
+ yymsp = yypParser->yytos;
|
|
|
|
+
|
|
|
|
+ switch( yyruleno ){
|
|
|
|
+ /* Beginning here are the reduction cases. A typical example
|
|
|
|
+ ** follows:
|
|
|
|
+ ** case 0:
|
|
|
|
+ ** #line <lineno> <grammarfile>
|
|
|
|
+ ** { ... } // User supplied code
|
|
|
|
+ ** #line <lineno> <thisfile>
|
|
|
|
+ ** break;
|
|
|
|
+ */
|
|
|
|
+/********** Begin reduce actions **********************************************/
|
|
|
|
+ YYMINORTYPE yylhsminor;
|
|
|
|
+ case 0: /* prefixID ::= PREFIX WS IRIREF PERIOD */
|
|
|
|
+#line 63 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ VOLK_nsmap_add (yymsp[-3].minor.yy0, yymsp[-1].minor.yy0);
|
|
|
|
+
|
|
|
|
+ free (yymsp[-3].minor.yy0);
|
|
|
|
+ free (yymsp[-1].minor.yy0);
|
|
|
|
+ }
|
|
|
|
+#line 1083 "../../build/grammar_ttl.c"
|
|
|
|
+ yy_destructor(yypParser,16,&yymsp[-2].minor);
|
|
|
|
+ yy_destructor(yypParser,1,&yymsp[0].minor);
|
|
|
|
+ break;
|
|
|
|
+ case 1: /* base ::= BASE WS IRIREF PERIOD */
|
|
|
|
+{ yy_destructor(yypParser,17,&yymsp[-3].minor);
|
|
|
|
+#line 70 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ VOLK_term_free (state->base);
|
|
|
|
+ state->base = VOLK_iriref_new (yymsp[-1].minor.yy0);
|
|
|
|
+
|
|
|
|
+ free (yymsp[-1].minor.yy0);
|
|
|
|
+ }
|
|
|
|
+#line 1096 "../../build/grammar_ttl.c"
|
|
|
|
+ yy_destructor(yypParser,16,&yymsp[-2].minor);
|
|
|
|
+ yy_destructor(yypParser,1,&yymsp[0].minor);
|
|
|
|
+}
|
|
|
|
+ break;
|
|
|
|
+ case 2: /* triples ::= subject ows predObjList PERIOD */
|
|
|
|
+#line 77 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ size_t ct = VOLK_graph_add_link_map (state->it, yymsp[-1].minor.yy2);
|
|
|
|
+ state->ct += ct;
|
|
|
|
+ state->rc = VOLK_OK;
|
|
|
|
+ LOG_TRACE("Added %lu triples.", ct);
|
|
|
|
+
|
|
|
|
+ VOLK_term_free (yymsp[-3].minor.yy12);
|
|
|
|
+ VOLK_link_map_free (yymsp[-1].minor.yy2);
|
|
|
|
+ }
|
|
|
|
+#line 1112 "../../build/grammar_ttl.c"
|
|
|
|
+ yy_destructor(yypParser,1,&yymsp[0].minor);
|
|
|
|
+ break;
|
|
|
|
+ case 3: /* triples ::= subject ows predObjList SEMICOLON PERIOD */
|
|
|
|
+#line 86 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ size_t ct = VOLK_graph_add_link_map (state->it, yymsp[-2].minor.yy2);
|
|
|
|
+ state->ct += ct;
|
|
|
|
+ state->rc = VOLK_OK;
|
|
|
|
+ LOG_TRACE("Added %lu triples.", ct);
|
|
|
|
+
|
|
|
|
+ VOLK_term_free (yymsp[-4].minor.yy12);
|
|
|
|
+ VOLK_link_map_free (yymsp[-2].minor.yy2);
|
|
|
|
+ }
|
|
|
|
+#line 1126 "../../build/grammar_ttl.c"
|
|
|
|
+ yy_destructor(yypParser,2,&yymsp[-1].minor);
|
|
|
|
+ yy_destructor(yypParser,1,&yymsp[0].minor);
|
|
|
|
+ break;
|
|
|
|
+ case 4: /* predObjList ::= predicate ows objectList */
|
|
|
|
+#line 98 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ yylhsminor.yy2 = VOLK_link_map_new (state->lms, VOLK_LINK_OUTBOUND);
|
|
|
|
+ VOLK_link_map_add (yylhsminor.yy2, yymsp[-2].minor.yy12, yymsp[0].minor.yy60);
|
|
|
|
+ }
|
|
|
|
+#line 1136 "../../build/grammar_ttl.c"
|
|
|
|
+ yymsp[-2].minor.yy2 = yylhsminor.yy2;
|
|
|
|
+ break;
|
|
|
|
+ case 5: /* predObjList ::= predObjList SEMICOLON predicate ows objectList */
|
|
|
|
+#line 102 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ VOLK_link_map_add (yymsp[-4].minor.yy2, yymsp[-2].minor.yy12, yymsp[0].minor.yy60);
|
|
|
|
+ yylhsminor.yy2 = yymsp[-4].minor.yy2;
|
|
|
|
+ }
|
|
|
|
+#line 1145 "../../build/grammar_ttl.c"
|
|
|
|
+ yy_destructor(yypParser,2,&yymsp[-3].minor);
|
|
|
|
+ yymsp[-4].minor.yy2 = yylhsminor.yy2;
|
|
|
|
+ break;
|
|
|
|
+ case 6: /* objectList ::= objectList COMMA object */
|
|
|
|
+#line 109 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ if (VOLK_term_set_add (yymsp[-2].minor.yy60, yymsp[0].minor.yy12, NULL) == VOLK_NOACTION)
|
|
|
|
+ VOLK_term_free (yymsp[0].minor.yy12);
|
|
|
|
+ yylhsminor.yy60 = yymsp[-2].minor.yy60;
|
|
|
|
+ }
|
|
|
|
+#line 1156 "../../build/grammar_ttl.c"
|
|
|
|
+ yy_destructor(yypParser,3,&yymsp[-1].minor);
|
|
|
|
+ yymsp[-2].minor.yy60 = yylhsminor.yy60;
|
|
|
|
+ break;
|
|
|
|
+ case 7: /* objectList ::= object */
|
|
|
|
+#line 114 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ yylhsminor.yy60 = VOLK_term_set_new();
|
|
|
|
+ VOLK_term_set_add (yylhsminor.yy60, yymsp[0].minor.yy12, NULL);
|
|
|
|
+ }
|
|
|
|
+#line 1166 "../../build/grammar_ttl.c"
|
|
|
|
+ yymsp[0].minor.yy60 = yylhsminor.yy60;
|
|
|
|
+ break;
|
|
|
|
+ case 8: /* subject ::= resource */
|
|
|
|
+ case 9: /* subject ::= blank */ yytestcase(yyruleno==9);
|
|
|
|
+#line 121 "grammar_ttl.y"
|
|
|
|
+{ state->lms = yymsp[0].minor.yy12; }
|
|
|
|
+#line 1173 "../../build/grammar_ttl.c"
|
|
|
|
+ break;
|
|
|
|
+ case 10: /* predicate ::= RDF_TYPE */
|
|
|
|
+{ yy_destructor(yypParser,18,&yymsp[0].minor);
|
|
|
|
+#line 127 "grammar_ttl.y"
|
|
|
|
+{ yymsp[0].minor.yy12 = VOLK_iriref_new_ns ("rdf:type"); }
|
|
|
|
+#line 1179 "../../build/grammar_ttl.c"
|
|
|
|
+}
|
|
|
|
+ break;
|
|
|
|
+ case 11: /* literal ::= STRING */
|
|
|
|
+#line 137 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ yylhsminor.yy12 = VOLK_literal_new (yymsp[0].minor.yy0, NULL);
|
|
|
|
+ LOG_TRACE("Created plain literal: \"%s\"", yylhsminor.yy12->data);
|
|
|
|
+ free (yymsp[0].minor.yy0);
|
|
|
|
+ }
|
|
|
|
+#line 1189 "../../build/grammar_ttl.c"
|
|
|
|
+ yymsp[0].minor.yy12 = yylhsminor.yy12;
|
|
|
|
+ break;
|
|
|
|
+ case 12: /* literal ::= STRING LANGTAG */
|
|
|
|
+#line 142 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ yylhsminor.yy12 = VOLK_lt_literal_new (yymsp[-1].minor.yy0, yymsp[0].minor.yy0);
|
|
|
|
+ LOG_TRACE("Created LT-literal: \"%s\"@%s", yylhsminor.yy12->data, yylhsminor.yy12->lang);
|
|
|
|
+ free (yymsp[-1].minor.yy0);
|
|
|
|
+ free (yymsp[0].minor.yy0);
|
|
|
|
+ }
|
|
|
|
+#line 1200 "../../build/grammar_ttl.c"
|
|
|
|
+ yymsp[-1].minor.yy12 = yylhsminor.yy12;
|
|
|
|
+ break;
|
|
|
|
+ case 13: /* literal ::= STRING DTYPE_MARKER resource */
|
|
|
|
+#line 148 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ yylhsminor.yy12 = VOLK_literal_new (yymsp[-2].minor.yy0, yymsp[0].minor.yy12);
|
|
|
|
+ LOG_TRACE(
|
|
|
|
+ "Created DT-literal: \"%s\"^^%s",
|
|
|
|
+ yylhsminor.yy12->data, yylhsminor.yy12->datatype);
|
|
|
|
+ free (yymsp[-2].minor.yy0);
|
|
|
|
+ }
|
|
|
|
+#line 1212 "../../build/grammar_ttl.c"
|
|
|
|
+ yy_destructor(yypParser,19,&yymsp[-1].minor);
|
|
|
|
+ yymsp[-2].minor.yy12 = yylhsminor.yy12;
|
|
|
|
+ break;
|
|
|
|
+ case 14: /* literal ::= INTEGER */
|
|
|
|
+#line 155 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ yylhsminor.yy12 = VOLK_literal_new (yymsp[0].minor.yy0, VOLK_iriref_new_ns ("xsd:integer"));
|
|
|
|
+ free (yymsp[0].minor.yy0);
|
|
|
|
+ }
|
|
|
|
+#line 1222 "../../build/grammar_ttl.c"
|
|
|
|
+ yymsp[0].minor.yy12 = yylhsminor.yy12;
|
|
|
|
+ break;
|
|
|
|
+ case 15: /* literal ::= DOUBLE */
|
|
|
|
+#line 159 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ yylhsminor.yy12 = VOLK_literal_new (yymsp[0].minor.yy0, VOLK_iriref_new_ns ("xsd:double"));
|
|
|
|
+ free (yymsp[0].minor.yy0);
|
|
|
|
+ }
|
|
|
|
+#line 1231 "../../build/grammar_ttl.c"
|
|
|
|
+ yymsp[0].minor.yy12 = yylhsminor.yy12;
|
|
|
|
+ break;
|
|
|
|
+ case 16: /* literal ::= DECIMAL */
|
|
|
|
+#line 163 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ yylhsminor.yy12 = VOLK_literal_new (yymsp[0].minor.yy0, VOLK_iriref_new_ns ("xsd:decimal"));
|
|
|
|
+ free (yymsp[0].minor.yy0);
|
|
|
|
+ }
|
|
|
|
+#line 1240 "../../build/grammar_ttl.c"
|
|
|
|
+ yymsp[0].minor.yy12 = yylhsminor.yy12;
|
|
|
|
+ break;
|
|
|
|
+ case 17: /* literal ::= BOOLEAN */
|
|
|
|
+#line 167 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ yylhsminor.yy12 = VOLK_literal_new (yymsp[0].minor.yy0, VOLK_iriref_new_ns ("xsd:boolean"));
|
|
|
|
+ free (yymsp[0].minor.yy0);
|
|
|
|
+ }
|
|
|
|
+#line 1249 "../../build/grammar_ttl.c"
|
|
|
|
+ yymsp[0].minor.yy12 = yylhsminor.yy12;
|
|
|
|
+ break;
|
|
|
|
+ case 18: /* blank ::= BNODE_ID */
|
|
|
|
+#line 174 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ yylhsminor.yy12 = VOLK_bnode_new (yymsp[0].minor.yy0);
|
|
|
|
+ LOG_TRACE("Created blank node: _:%s", yylhsminor.yy12->data);
|
|
|
|
+ free (yymsp[0].minor.yy0);
|
|
|
|
+ }
|
|
|
|
+#line 1259 "../../build/grammar_ttl.c"
|
|
|
|
+ yymsp[0].minor.yy12 = yylhsminor.yy12;
|
|
|
|
+ break;
|
|
|
|
+ case 19: /* blank ::= LBRACKET RBRACKET */
|
|
|
|
+{ yy_destructor(yypParser,20,&yymsp[-1].minor);
|
|
|
|
+#line 179 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ yymsp[-1].minor.yy12 = VOLK_bnode_new (NULL);
|
|
|
|
+ LOG_TRACE("Created empty list BN: _:%s", yymsp[-1].minor.yy12->data);
|
|
|
|
+ }
|
|
|
|
+#line 1269 "../../build/grammar_ttl.c"
|
|
|
|
+ yy_destructor(yypParser,21,&yymsp[0].minor);
|
|
|
|
+}
|
|
|
|
+ break;
|
|
|
|
+ case 20: /* blank ::= LBRACKET predObjList RBRACKET */
|
|
|
|
+{ yy_destructor(yypParser,20,&yymsp[-2].minor);
|
|
|
|
+#line 183 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ yymsp[-2].minor.yy12 = VOLK_bnode_new (NULL);
|
|
|
|
+ state->lms = yymsp[-2].minor.yy12;
|
|
|
|
+ state->ct += VOLK_graph_add_link_map (state->it, yymsp[-1].minor.yy2);
|
|
|
|
+ LOG_TRACE("Created list BN: _:%s", yymsp[-2].minor.yy12->data);
|
|
|
|
+
|
|
|
|
+ VOLK_link_map_free (yymsp[-1].minor.yy2);
|
|
|
|
+ }
|
|
|
|
+#line 1284 "../../build/grammar_ttl.c"
|
|
|
|
+ yy_destructor(yypParser,21,&yymsp[0].minor);
|
|
|
|
+}
|
|
|
|
+ break;
|
|
|
|
+ case 21: /* blank ::= LPAREN RPAREN */
|
|
|
|
+{ yy_destructor(yypParser,22,&yymsp[-1].minor);
|
|
|
|
+#line 192 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ yymsp[-1].minor.yy12 = VOLK_iriref_new_ns ("rdf:nil");
|
|
|
|
+ LOG_TRACE("Created list terminator: %s", yymsp[-1].minor.yy12->data);
|
|
|
|
+ }
|
|
|
|
+#line 1295 "../../build/grammar_ttl.c"
|
|
|
|
+ yy_destructor(yypParser,23,&yymsp[0].minor);
|
|
|
|
+}
|
|
|
|
+ break;
|
|
|
|
+ case 22: /* collection ::= LPAREN itemList RPAREN */
|
|
|
|
+{ yy_destructor(yypParser,22,&yymsp[-2].minor);
|
|
|
|
+#line 201 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ yymsp[-2].minor.yy12 = VOLK_bnode_add_collection (state->it, yymsp[-1].minor.yy60);
|
|
|
|
+ VOLK_term_set_free (yymsp[-1].minor.yy60);
|
|
|
|
+ }
|
|
|
|
+#line 1306 "../../build/grammar_ttl.c"
|
|
|
|
+ yy_destructor(yypParser,23,&yymsp[0].minor);
|
|
|
|
+}
|
|
|
|
+ break;
|
|
|
|
+ case 23: /* itemList ::= itemList ows object */
|
|
|
|
+#line 208 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ if (VOLK_term_set_add (yymsp[-2].minor.yy60, yymsp[0].minor.yy12, NULL) == VOLK_NOACTION)
|
|
|
|
+ VOLK_term_free (yymsp[0].minor.yy12);
|
|
|
|
+ yylhsminor.yy60 = yymsp[-2].minor.yy60;
|
|
|
|
+ }
|
|
|
|
+#line 1317 "../../build/grammar_ttl.c"
|
|
|
|
+ yymsp[-2].minor.yy60 = yylhsminor.yy60;
|
|
|
|
+ break;
|
|
|
|
+ case 24: /* itemList ::= object */
|
|
|
|
+#line 213 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ yylhsminor.yy60 = VOLK_term_set_new ();
|
|
|
|
+ VOLK_term_set_add (yylhsminor.yy60, yymsp[0].minor.yy12, NULL);
|
|
|
|
+ }
|
|
|
|
+#line 1326 "../../build/grammar_ttl.c"
|
|
|
|
+ yymsp[0].minor.yy60 = yylhsminor.yy60;
|
|
|
|
+ break;
|
|
|
|
+ case 25: /* resource ::= IRIREF */
|
|
|
|
+#line 220 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ VOLK_Term *rel_iri = VOLK_iriref_new (yymsp[0].minor.yy0);
|
|
|
|
+ free (yymsp[0].minor.yy0);
|
|
|
|
+ if (state->base) {
|
|
|
|
+ yylhsminor.yy12 = VOLK_iriref_new_abs (rel_iri, state->base);
|
|
|
|
+ VOLK_term_free (rel_iri);
|
|
|
|
+ } else {
|
|
|
|
+ yylhsminor.yy12 = rel_iri;
|
|
|
|
+ }
|
|
|
|
+ LOG_TRACE("Created IRI: <%s>", yylhsminor.yy12->data);
|
|
|
|
+ }
|
|
|
|
+#line 1342 "../../build/grammar_ttl.c"
|
|
|
|
+ yymsp[0].minor.yy12 = yylhsminor.yy12;
|
|
|
|
+ break;
|
|
|
|
+ case 26: /* resource ::= QNAME */
|
|
|
|
+#line 231 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+ yylhsminor.yy12 = VOLK_iriref_new_ns (yymsp[0].minor.yy0);
|
|
|
|
+ LOG_TRACE("Created IRI: %s", yylhsminor.yy12->data);
|
|
|
|
+ free (yymsp[0].minor.yy0);
|
|
|
|
+ }
|
|
|
|
+#line 1352 "../../build/grammar_ttl.c"
|
|
|
|
+ yymsp[0].minor.yy12 = yylhsminor.yy12;
|
|
|
|
+ break;
|
|
|
|
+ case 27: /* turtleDoc ::= statements EOF */
|
|
|
|
+#line 54 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+}
|
|
|
|
+#line 1359 "../../build/grammar_ttl.c"
|
|
|
|
+ yy_destructor(yypParser,15,&yymsp[0].minor);
|
|
|
|
+ break;
|
|
|
|
+ case 33: /* statement ::= WS */
|
|
|
|
+ case 39: /* ows ::= WS */ yytestcase(yyruleno==39);
|
|
|
|
+{ yy_destructor(yypParser,16,&yymsp[0].minor);
|
|
|
|
+#line 61 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+}
|
|
|
|
+#line 1368 "../../build/grammar_ttl.c"
|
|
|
|
+}
|
|
|
|
+ break;
|
|
|
|
+ case 34: /* predicate ::= resource */
|
|
|
|
+ case 35: /* object ::= resource */ yytestcase(yyruleno==35);
|
|
|
|
+{ yy_destructor(yypParser,36,&yymsp[0].minor);
|
|
|
|
+#line 126 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+}
|
|
|
|
+#line 1377 "../../build/grammar_ttl.c"
|
|
|
|
+}
|
|
|
|
+ break;
|
|
|
|
+ case 36: /* object ::= blank */
|
|
|
|
+{ yy_destructor(yypParser,37,&yymsp[0].minor);
|
|
|
|
+#line 132 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+}
|
|
|
|
+#line 1385 "../../build/grammar_ttl.c"
|
|
|
|
+}
|
|
|
|
+ break;
|
|
|
|
+ case 37: /* object ::= literal */
|
|
|
|
+{ yy_destructor(yypParser,38,&yymsp[0].minor);
|
|
|
|
+#line 133 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+}
|
|
|
|
+#line 1393 "../../build/grammar_ttl.c"
|
|
|
|
+}
|
|
|
|
+ break;
|
|
|
|
+ case 38: /* blank ::= collection */
|
|
|
|
+{ yy_destructor(yypParser,39,&yymsp[0].minor);
|
|
|
|
+#line 191 "grammar_ttl.y"
|
|
|
|
+{
|
|
|
|
+}
|
|
|
|
+#line 1401 "../../build/grammar_ttl.c"
|
|
|
|
+}
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ /* (28) statements ::= statements statement */ yytestcase(yyruleno==28);
|
|
|
|
+ /* (29) statements ::= */ yytestcase(yyruleno==29);
|
|
|
|
+ /* (30) statement ::= prefixID (OPTIMIZED OUT) */ assert(yyruleno!=30);
|
|
|
|
+ /* (31) statement ::= base (OPTIMIZED OUT) */ assert(yyruleno!=31);
|
|
|
|
+ /* (32) statement ::= triples (OPTIMIZED OUT) */ assert(yyruleno!=32);
|
|
|
|
+ /* (40) ows ::= */ yytestcase(yyruleno==40);
|
|
|
|
+ break;
|
|
|
|
+/********** End reduce actions ************************************************/
|
|
|
|
+ };
|
|
|
|
+ assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
|
|
|
|
+ yygoto = yyRuleInfoLhs[yyruleno];
|
|
|
|
+ yysize = yyRuleInfoNRhs[yyruleno];
|
|
|
|
+ yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto);
|
|
|
|
+
|
|
|
|
+ /* There are no SHIFTREDUCE actions on nonterminals because the table
|
|
|
|
+ ** generator has simplified them to pure REDUCE actions. */
|
|
|
|
+ assert( !(yyact>YY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) );
|
|
|
|
+
|
|
|
|
+ /* It is not possible for a REDUCE to be followed by an error */
|
|
|
|
+ assert( yyact!=YY_ERROR_ACTION );
|
|
|
|
+
|
|
|
|
+ yymsp += yysize+1;
|
|
|
|
+ yypParser->yytos = yymsp;
|
|
|
|
+ yymsp->stateno = (YYACTIONTYPE)yyact;
|
|
|
|
+ yymsp->major = (YYCODETYPE)yygoto;
|
|
|
|
+ yyTraceShift(yypParser, yyact, "... then shift");
|
|
|
|
+ return yyact;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+** The following code executes when the parse fails
|
|
|
|
+*/
|
|
|
|
+#ifndef YYNOERRORRECOVERY
|
|
|
|
+static void yy_parse_failed(
|
|
|
|
+ yyParser *yypParser /* The parser */
|
|
|
|
+){
|
|
|
|
+ TTLParseARG_FETCH
|
|
|
|
+ TTLParseCTX_FETCH
|
|
|
|
+#ifndef NDEBUG
|
|
|
|
+ if( yyTraceFILE ){
|
|
|
|
+ fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+ while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
|
|
|
|
+ /* Here code is inserted which will be executed whenever the
|
|
|
|
+ ** parser fails */
|
|
|
|
+/************ Begin %parse_failure code ***************************************/
|
|
|
|
+#line 22 "grammar_ttl.y"
|
|
|
|
+
|
|
|
|
+ log_error ("TTL parse error. Cannot continue.");
|
|
|
|
+ state->rc = VOLK_PARSE_ERR;
|
|
|
|
+#line 1456 "../../build/grammar_ttl.c"
|
|
|
|
+/************ End %parse_failure code *****************************************/
|
|
|
|
+ TTLParseARG_STORE /* Suppress warning about unused %extra_argument variable */
|
|
|
|
+ TTLParseCTX_STORE
|
|
|
|
+}
|
|
|
|
+#endif /* YYNOERRORRECOVERY */
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+** The following code executes when a syntax error first occurs.
|
|
|
|
+*/
|
|
|
|
+static void yy_syntax_error(
|
|
|
|
+ yyParser *yypParser, /* The parser */
|
|
|
|
+ int yymajor, /* The major type of the error token */
|
|
|
|
+ TTLParseTOKENTYPE yyminor /* The minor type of the error token */
|
|
|
|
+){
|
|
|
|
+ TTLParseARG_FETCH
|
|
|
|
+ TTLParseCTX_FETCH
|
|
|
|
+#define TOKEN yyminor
|
|
|
|
+/************ Begin %syntax_error code ****************************************/
|
|
|
|
+#line 27 "grammar_ttl.y"
|
|
|
|
+
|
|
|
|
+ // Fail immediately on first error.
|
|
|
|
+ yy_parse_failed (yypParser);
|
|
|
|
+#line 1479 "../../build/grammar_ttl.c"
|
|
|
|
+/************ End %syntax_error code ******************************************/
|
|
|
|
+ TTLParseARG_STORE /* Suppress warning about unused %extra_argument variable */
|
|
|
|
+ TTLParseCTX_STORE
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+** The following is executed when the parser accepts
|
|
|
|
+*/
|
|
|
|
+static void yy_accept(
|
|
|
|
+ yyParser *yypParser /* The parser */
|
|
|
|
+){
|
|
|
|
+ TTLParseARG_FETCH
|
|
|
|
+ TTLParseCTX_FETCH
|
|
|
|
+#ifndef NDEBUG
|
|
|
|
+ if( yyTraceFILE ){
|
|
|
|
+ fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+#ifndef YYNOERRORRECOVERY
|
|
|
|
+ yypParser->yyerrcnt = -1;
|
|
|
|
+#endif
|
|
|
|
+ assert( yypParser->yytos==yypParser->yystack );
|
|
|
|
+ /* Here code is inserted which will be executed whenever the
|
|
|
|
+ ** parser accepts */
|
|
|
|
+/*********** Begin %parse_accept code *****************************************/
|
|
|
|
+/*********** End %parse_accept code *******************************************/
|
|
|
|
+ TTLParseARG_STORE /* Suppress warning about unused %extra_argument variable */
|
|
|
|
+ TTLParseCTX_STORE
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/* The main parser program.
|
|
|
|
+** The first argument is a pointer to a structure obtained from
|
|
|
|
+** "TTLParseAlloc" which describes the current state of the parser.
|
|
|
|
+** The second argument is the major token number. The third is
|
|
|
|
+** the minor token. The fourth optional argument is whatever the
|
|
|
|
+** user wants (and specified in the grammar) and is available for
|
|
|
|
+** use by the action routines.
|
|
|
|
+**
|
|
|
|
+** Inputs:
|
|
|
|
+** <ul>
|
|
|
|
+** <li> A pointer to the parser (an opaque structure.)
|
|
|
|
+** <li> The major token number.
|
|
|
|
+** <li> The minor token number.
|
|
|
|
+** <li> An option argument of a grammar-specified type.
|
|
|
|
+** </ul>
|
|
|
|
+**
|
|
|
|
+** Outputs:
|
|
|
|
+** None.
|
|
|
|
+*/
|
|
|
|
+void TTLParse(
|
|
|
|
+ void *yyp, /* The parser */
|
|
|
|
+ int yymajor, /* The major token code number */
|
|
|
|
+ TTLParseTOKENTYPE yyminor /* The value for the token */
|
|
|
|
+ TTLParseARG_PDECL /* Optional %extra_argument parameter */
|
|
|
|
+){
|
|
|
|
+ YYMINORTYPE yyminorunion;
|
|
|
|
+ YYACTIONTYPE yyact; /* The parser action. */
|
|
|
|
+#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
|
|
|
|
+ int yyendofinput; /* True if we are at the end of input */
|
|
|
|
+#endif
|
|
|
|
+#ifdef YYERRORSYMBOL
|
|
|
|
+ int yyerrorhit = 0; /* True if yymajor has invoked an error */
|
|
|
|
+#endif
|
|
|
|
+ yyParser *yypParser = (yyParser*)yyp; /* The parser */
|
|
|
|
+ TTLParseCTX_FETCH
|
|
|
|
+ TTLParseARG_STORE
|
|
|
|
+
|
|
|
|
+ assert( yypParser->yytos!=0 );
|
|
|
|
+#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
|
|
|
|
+ yyendofinput = (yymajor==0);
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+ yyact = yypParser->yytos->stateno;
|
|
|
|
+#ifndef NDEBUG
|
|
|
|
+ if( yyTraceFILE ){
|
|
|
|
+ if( yyact < YY_MIN_REDUCE ){
|
|
|
|
+ fprintf(yyTraceFILE,"%sInput '%s' in state %d\n",
|
|
|
|
+ yyTracePrompt,yyTokenName[yymajor],yyact);
|
|
|
|
+ }else{
|
|
|
|
+ fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
|
|
|
|
+ yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+ while(1){ /* Exit by "break" */
|
|
|
|
+ assert( yypParser->yytos>=yypParser->yystack );
|
|
|
|
+ assert( yyact==yypParser->yytos->stateno );
|
|
|
|
+ yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact);
|
|
|
|
+ if( yyact >= YY_MIN_REDUCE ){
|
|
|
|
+ unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */
|
|
|
|
+#ifndef NDEBUG
|
|
|
|
+ assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) );
|
|
|
|
+ if( yyTraceFILE ){
|
|
|
|
+ int yysize = yyRuleInfoNRhs[yyruleno];
|
|
|
|
+ if( yysize ){
|
|
|
|
+ fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
|
|
|
|
+ yyTracePrompt,
|
|
|
|
+ yyruleno, yyRuleName[yyruleno],
|
|
|
|
+ yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action",
|
|
|
|
+ yypParser->yytos[yysize].stateno);
|
|
|
|
+ }else{
|
|
|
|
+ fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n",
|
|
|
|
+ yyTracePrompt, yyruleno, yyRuleName[yyruleno],
|
|
|
|
+ yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+#endif /* NDEBUG */
|
|
|
|
+
|
|
|
|
+ /* Check that the stack is large enough to grow by a single entry
|
|
|
|
+ ** if the RHS of the rule is empty. This ensures that there is room
|
|
|
|
+ ** enough on the stack to push the LHS value */
|
|
|
|
+ if( yyRuleInfoNRhs[yyruleno]==0 ){
|
|
|
|
+#ifdef YYTRACKMAXSTACKDEPTH
|
|
|
|
+ if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
|
|
|
|
+ yypParser->yyhwm++;
|
|
|
|
+ assert( yypParser->yyhwm ==
|
|
|
|
+ (int)(yypParser->yytos - yypParser->yystack));
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+#if YYSTACKDEPTH>0
|
|
|
|
+ if( yypParser->yytos>=yypParser->yystackEnd ){
|
|
|
|
+ yyStackOverflow(yypParser);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+#else
|
|
|
|
+ if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
|
|
|
|
+ if( yyGrowStack(yypParser) ){
|
|
|
|
+ yyStackOverflow(yypParser);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+ }
|
|
|
|
+ yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor TTLParseCTX_PARAM);
|
|
|
|
+ }else if( yyact <= YY_MAX_SHIFTREDUCE ){
|
|
|
|
+ yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor);
|
|
|
|
+#ifndef YYNOERRORRECOVERY
|
|
|
|
+ yypParser->yyerrcnt--;
|
|
|
|
+#endif
|
|
|
|
+ break;
|
|
|
|
+ }else if( yyact==YY_ACCEPT_ACTION ){
|
|
|
|
+ yypParser->yytos--;
|
|
|
|
+ yy_accept(yypParser);
|
|
|
|
+ return;
|
|
|
|
+ }else{
|
|
|
|
+ assert( yyact == YY_ERROR_ACTION );
|
|
|
|
+ yyminorunion.yy0 = yyminor;
|
|
|
|
+#ifdef YYERRORSYMBOL
|
|
|
|
+ int yymx;
|
|
|
|
+#endif
|
|
|
|
+#ifndef NDEBUG
|
|
|
|
+ if( yyTraceFILE ){
|
|
|
|
+ fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+#ifdef YYERRORSYMBOL
|
|
|
|
+ /* A syntax error has occurred.
|
|
|
|
+ ** The response to an error depends upon whether or not the
|
|
|
|
+ ** grammar defines an error token "ERROR".
|
|
|
|
+ **
|
|
|
|
+ ** This is what we do if the grammar does define ERROR:
|
|
|
|
+ **
|
|
|
|
+ ** * Call the %syntax_error function.
|
|
|
|
+ **
|
|
|
|
+ ** * Begin popping the stack until we enter a state where
|
|
|
|
+ ** it is legal to shift the error symbol, then shift
|
|
|
|
+ ** the error symbol.
|
|
|
|
+ **
|
|
|
|
+ ** * Set the error count to three.
|
|
|
|
+ **
|
|
|
|
+ ** * Begin accepting and shifting new tokens. No new error
|
|
|
|
+ ** processing will occur until three tokens have been
|
|
|
|
+ ** shifted successfully.
|
|
|
|
+ **
|
|
|
|
+ */
|
|
|
|
+ if( yypParser->yyerrcnt<0 ){
|
|
|
|
+ yy_syntax_error(yypParser,yymajor,yyminor);
|
|
|
|
+ }
|
|
|
|
+ yymx = yypParser->yytos->major;
|
|
|
|
+ if( yymx==YYERRORSYMBOL || yyerrorhit ){
|
|
|
|
+#ifndef NDEBUG
|
|
|
|
+ if( yyTraceFILE ){
|
|
|
|
+ fprintf(yyTraceFILE,"%sDiscard input token %s\n",
|
|
|
|
+ yyTracePrompt,yyTokenName[yymajor]);
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+ yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
|
|
|
|
+ yymajor = YYNOCODE;
|
|
|
|
+ }else{
|
|
|
|
+ while( yypParser->yytos > yypParser->yystack ){
|
|
|
|
+ yyact = yy_find_reduce_action(yypParser->yytos->stateno,
|
|
|
|
+ YYERRORSYMBOL);
|
|
|
|
+ if( yyact<=YY_MAX_SHIFTREDUCE ) break;
|
|
|
|
+ yy_pop_parser_stack(yypParser);
|
|
|
|
+ }
|
|
|
|
+ if( yypParser->yytos <= yypParser->yystack || yymajor==0 ){
|
|
|
|
+ yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
|
|
|
|
+ yy_parse_failed(yypParser);
|
|
|
|
+#ifndef YYNOERRORRECOVERY
|
|
|
|
+ yypParser->yyerrcnt = -1;
|
|
|
|
+#endif
|
|
|
|
+ yymajor = YYNOCODE;
|
|
|
|
+ }else if( yymx!=YYERRORSYMBOL ){
|
|
|
|
+ yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ yypParser->yyerrcnt = 3;
|
|
|
|
+ yyerrorhit = 1;
|
|
|
|
+ if( yymajor==YYNOCODE ) break;
|
|
|
|
+ yyact = yypParser->yytos->stateno;
|
|
|
|
+#elif defined(YYNOERRORRECOVERY)
|
|
|
|
+ /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
|
|
|
|
+ ** do any kind of error recovery. Instead, simply invoke the syntax
|
|
|
|
+ ** error routine and continue going as if nothing had happened.
|
|
|
|
+ **
|
|
|
|
+ ** Applications can set this macro (for example inside %include) if
|
|
|
|
+ ** they intend to abandon the parse upon the first syntax error seen.
|
|
|
|
+ */
|
|
|
|
+ yy_syntax_error(yypParser,yymajor, yyminor);
|
|
|
|
+ yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
|
|
|
|
+ break;
|
|
|
|
+#else /* YYERRORSYMBOL is not defined */
|
|
|
|
+ /* This is what we do if the grammar does not define ERROR:
|
|
|
|
+ **
|
|
|
|
+ ** * Report an error message, and throw away the input token.
|
|
|
|
+ **
|
|
|
|
+ ** * If the input token is $, then fail the parse.
|
|
|
|
+ **
|
|
|
|
+ ** As before, subsequent error messages are suppressed until
|
|
|
|
+ ** three input tokens have been successfully shifted.
|
|
|
|
+ */
|
|
|
|
+ if( yypParser->yyerrcnt<=0 ){
|
|
|
|
+ yy_syntax_error(yypParser,yymajor, yyminor);
|
|
|
|
+ }
|
|
|
|
+ yypParser->yyerrcnt = 3;
|
|
|
|
+ yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
|
|
|
|
+ if( yyendofinput ){
|
|
|
|
+ yy_parse_failed(yypParser);
|
|
|
|
+#ifndef YYNOERRORRECOVERY
|
|
|
|
+ yypParser->yyerrcnt = -1;
|
|
|
|
+#endif
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+#endif
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+#ifndef NDEBUG
|
|
|
|
+ if( yyTraceFILE ){
|
|
|
|
+ yyStackEntry *i;
|
|
|
|
+ char cDiv = '[';
|
|
|
|
+ fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
|
|
|
|
+ for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){
|
|
|
|
+ fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]);
|
|
|
|
+ cDiv = ' ';
|
|
|
|
+ }
|
|
|
|
+ fprintf(yyTraceFILE,"]\n");
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+ return;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+** Return the fallback token corresponding to canonical token iToken, or
|
|
|
|
+** 0 if iToken has no fallback.
|
|
|
|
+*/
|
|
|
|
+int TTLParseFallback(int iToken){
|
|
|
|
+#ifdef YYFALLBACK
|
|
|
|
+ assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) );
|
|
|
|
+ return yyFallback[iToken];
|
|
|
|
+#else
|
|
|
|
+ (void)iToken;
|
|
|
|
+ return 0;
|
|
|
|
+#endif
|
|
|
|
+}
|