Volksdata 1.0b7
RDF library
Loading...
Searching...
No Matches
grammar_ttl.c
Go to the documentation of this file.
1/* This file is automatically generated by Lemon from input grammar
2** source file "grammar_ttl.y". */
10
11#include "volksdata/codec.h"
12
13#line 39 "../../build/grammar_ttl.c"
14/**************** End of %include directives **********************************/
15/* These constants specify the various numeric values for terminal symbols.
16***************** Begin token definitions *************************************/
17#ifndef T_PERIOD
18#define T_PERIOD 1
19#define T_SEMICOLON 2
20#define T_COMMA 3
21#define T_STRING 4
22#define T_INTEGER 5
23#define T_DOUBLE 6
24#define T_DECIMAL 7
25#define T_BOOLEAN 8
26#define T_BNODE_ID 9
27#define T_NSIRI 10
28#define T_IRIREF 11
29#define T_LANGTAG 12
30#define T_PREFIX 13
31#define T_COLON 14
32#define T_EOF 15
33#define T_WS 16
34#define T_BASE 17
35#define T_RDF_TYPE 18
36#define T_DTYPE_MARKER 19
37#define T_ANON 20
38#define T_LBRACKET 21
39#define T_RBRACKET 22
40#define T_LPAREN 23
41#define T_RPAREN 24
42#endif
43/**************** End token definitions ***************************************/
44
45/* The next sections is a series of control #defines.
46** various aspects of the generated parser.
47** YYCODETYPE is the data type used to store the integer codes
48** that represent terminal and non-terminal symbols.
49** "unsigned char" is used if there are fewer than
50** 256 symbols. Larger types otherwise.
51** YYNOCODE is a number of type YYCODETYPE that is not used for
52** any terminal or nonterminal symbol.
53** YYFALLBACK If defined, this indicates that one or more tokens
54** (also known as: "terminal symbols") have fall-back
55** values which should be used if the original symbol
56** would not parse. This permits keywords to sometimes
57** be used as identifiers, for example.
58** YYACTIONTYPE is the data type used for "action codes" - numbers
59** that indicate what to do in response to the next
60** token.
61** TTLParseTOKENTYPE is the data type used for minor type for terminal
62** symbols. Background: A "minor type" is a semantic
63** value associated with a terminal or non-terminal
64** symbols. For example, for an "ID" terminal symbol,
65** the minor type might be the name of the identifier.
66** Each non-terminal can have a different minor type.
67** Terminal symbols all have the same minor type, though.
68** This macros defines the minor type for terminal
69** symbols.
70** YYMINORTYPE is the data type used for all minor types.
71** This is typically a union of many types, one of
72** which is TTLParseTOKENTYPE. The entry in the union
73** for terminal symbols is called "yy0".
74** YYSTACKDEPTH is the maximum depth of the parser's stack. If
75** zero the stack is dynamically sized using realloc()
76** TTLParseARG_SDECL A static variable declaration for the %extra_argument
77** TTLParseARG_PDECL A parameter declaration for the %extra_argument
78** TTLParseARG_PARAM Code to pass %extra_argument as a subroutine parameter
79** TTLParseARG_STORE Code to store %extra_argument into yypParser
80** TTLParseARG_FETCH Code to extract %extra_argument from yypParser
81** TTLParseCTX_* As TTLParseARG_ except for %extra_context
82** YYERRORSYMBOL is the code number of the error symbol. If not
83** defined, then do no error processing.
84** YYNSTATE the combined number of states.
85** YYNRULE the number of rules in the grammar
86** YYNTOKEN Number of terminal symbols
87** YY_MAX_SHIFT Maximum value for shift actions
88** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions
89** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions
90** YY_ERROR_ACTION The yy_action[] code for syntax error
91** YY_ACCEPT_ACTION The yy_action[] code for accept
92** YY_NO_ACTION The yy_action[] code for no-op
93** YY_MIN_REDUCE Minimum value for reduce actions
94** YY_MAX_REDUCE Maximum value for reduce actions
95*/
96#ifndef INTERFACE
97# define INTERFACE 1
98#endif
99/************* Begin control #defines *****************************************/
100#define YYCODETYPE unsigned char
101#define YYNOCODE 42
102#define YYACTIONTYPE unsigned char
103#define TTLParseTOKENTYPE char *
104typedef union {
105 int yyinit;
107 char * yy1;
112#ifndef YYSTACKDEPTH
113#define YYSTACKDEPTH 100
114#endif
115#define TTLParseARG_SDECL VOLK_TTLParserState *state ;
116#define TTLParseARG_PDECL , VOLK_TTLParserState *state
117#define TTLParseARG_PARAM ,state
118#define TTLParseARG_FETCH VOLK_TTLParserState *state =yypParser->state ;
119#define TTLParseARG_STORE yypParser->state =state ;
120#define TTLParseCTX_SDECL
121#define TTLParseCTX_PDECL
122#define TTLParseCTX_PARAM
123#define TTLParseCTX_FETCH
124#define TTLParseCTX_STORE
125#define YYNSTATE 28
126#define YYNRULE 41
127#define YYNRULE_WITH_ACTION 27
128#define YYNTOKEN 25
129#define YY_MAX_SHIFT 27
130#define YY_MIN_SHIFTREDUCE 63
131#define YY_MAX_SHIFTREDUCE 103
132#define YY_ERROR_ACTION 104
133#define YY_ACCEPT_ACTION 105
134#define YY_NO_ACTION 106
135#define YY_MIN_REDUCE 107
136#define YY_MAX_REDUCE 147
137/************* End control #defines *******************************************/
138#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
139
140/* Define the yytestcase() macro to be a no-op if is not already defined
141** otherwise.
142**
143** Applications can choose to define yytestcase() in the %include section
144** to a macro that can assist in verifying code coverage. For production
145** code the yytestcase() macro should be turned off. But it is useful
146** for testing.
147*/
148#ifndef yytestcase
149# define yytestcase(X)
150#endif
151
152
153/* Next are the tables used to determine what action to take based on the
154** current state and lookahead token. These tables are used to implement
155** functions that take a state number and lookahead value and return an
156** action integer.
157**
158** Suppose the action integer is N. Then the action is determined as
159** follows
160**
161** 0 <= N <= YY_MAX_SHIFT Shift N. That is, push the lookahead
162** token onto the stack and goto state N.
163**
164** N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then
165** and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE.
166**
167** N == YY_ERROR_ACTION A syntax error has occurred.
168**
169** N == YY_ACCEPT_ACTION The parser accepts its input.
170**
171** N == YY_NO_ACTION No such action. Denotes unused
172** slots in the yy_action[] table.
173**
174** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE
175** and YY_MAX_REDUCE
176**
177** The action table is constructed as a single large table named yy_action[].
178** Given state S and lookahead X, the action is computed as either:
179**
180** (A) N = yy_action[ yy_shift_ofst[S] + X ]
181** (B) N = yy_default[S]
182**
183** The (A) formula is preferred. The B formula is used instead if
184** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X.
185**
186** The formulas above are for computing the action when the lookahead is
187** a terminal symbol. If the lookahead is a non-terminal (as occurs after
188** a reduce action) then the yy_reduce_ofst[] array is used in place of
189** the yy_shift_ofst[] array.
190**
191** The following are the tables generated in this section:
192**
193** yy_action[] A single table containing all actions.
194** yy_lookahead[] A table containing the lookahead for each entry in
195** yy_action. Used to detect hash collisions.
196** yy_shift_ofst[] For each state, the offset into yy_action for
197** shifting terminals.
198** yy_reduce_ofst[] For each state, the offset into yy_action for
199** shifting non-terminals after a reduce.
200** yy_default[] Default action for each state.
201**
202*********** Begin parsing tables **********************************************/
203#define YY_ACTTAB_COUNT (115)
204static const YYACTIONTYPE yy_action[] = {
205 /* 0 */ 105, 1, 65, 9, 17, 77, 78, 79, 80, 81,
206 /* 10 */ 89, 88, 17, 77, 78, 79, 80, 81, 89, 88,
207 /* 20 */ 82, 7, 14, 2, 84, 14, 16, 13, 82, 7,
208 /* 30 */ 13, 2, 120, 81, 89, 88, 5, 26, 102, 27,
209 /* 40 */ 96, 23, 18, 13, 82, 7, 13, 2, 135, 135,
210 /* 50 */ 135, 135, 15, 130, 130, 130, 130, 130, 115, 116,
211 /* 60 */ 3, 116, 89, 88, 4, 131, 131, 131, 131, 131,
212 /* 70 */ 11, 19, 114, 114, 114, 114, 114, 20, 114, 114,
213 /* 80 */ 114, 114, 114, 66, 113, 113, 113, 113, 113, 89,
214 /* 90 */ 88, 102, 89, 88, 10, 75, 8, 73, 6, 85,
215 /* 100 */ 73, 64, 12, 22, 21, 63, 25, 24, 134, 106,
216 /* 110 */ 106, 106, 106, 106, 83,
217};
218static const YYCODETYPE yy_lookahead[] = {
219 /* 0 */ 25, 26, 1, 2, 4, 5, 6, 7, 8, 9,
220 /* 10 */ 10, 11, 4, 5, 6, 7, 8, 9, 10, 11,
221 /* 20 */ 20, 21, 34, 23, 24, 37, 33, 34, 20, 21,
222 /* 30 */ 37, 23, 37, 9, 10, 11, 32, 13, 16, 15,
223 /* 40 */ 16, 17, 33, 34, 20, 21, 37, 23, 27, 28,
224 /* 50 */ 29, 30, 31, 36, 37, 38, 39, 40, 37, 38,
225 /* 60 */ 32, 40, 10, 11, 32, 36, 37, 38, 39, 40,
226 /* 70 */ 41, 35, 36, 37, 38, 39, 40, 35, 36, 37,
227 /* 80 */ 38, 39, 40, 1, 36, 37, 38, 39, 40, 10,
228 /* 90 */ 11, 16, 10, 11, 2, 12, 32, 18, 3, 24,
229 /* 100 */ 18, 1, 19, 16, 11, 1, 16, 11, 0, 42,
230 /* 110 */ 42, 42, 42, 42, 22, 42, 42, 42, 42, 42,
231 /* 120 */ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
232 /* 130 */ 42, 42, 42, 42, 25, 25, 25, 25, 25, 25,
233};
234#define YY_SHIFT_COUNT (27)
235#define YY_SHIFT_MIN (0)
236#define YY_SHIFT_MAX (108)
237static const unsigned char yy_shift_ofst[] = {
238 /* 0 */ 115, 24, 0, 8, 8, 8, 8, 79, 79, 82,
239 /* 10 */ 79, 75, 52, 22, 22, 22, 92, 83, 1, 95,
240 /* 20 */ 95, 100, 93, 87, 104, 96, 90, 108,
241};
242#define YY_REDUCE_COUNT (15)
243#define YY_REDUCE_MIN (-25)
244#define YY_REDUCE_MAX (64)
245static const signed char yy_reduce_ofst[] = {
246 /* 0 */ -25, 21, 29, 36, 42, 17, 48, -7, 9, -12,
247 /* 10 */ -12, 4, -5, 28, 32, 64,
248};
249static const YYACTIONTYPE yy_default[] = {
250 /* 0 */ 136, 104, 104, 104, 104, 104, 104, 104, 104, 104,
251 /* 10 */ 104, 147, 104, 147, 147, 147, 104, 118, 104, 111,
252 /* 20 */ 112, 104, 104, 104, 104, 104, 104, 104,
253};
254/********** End of lemon-generated parsing tables *****************************/
255
256/* The next table maps tokens (terminal symbols) into fallback tokens.
257** If a construct like the following:
258**
259** %fallback ID X Y Z.
260**
261** appears in the grammar, then ID becomes a fallback token for X, Y,
262** and Z. Whenever one of the tokens X, Y, or Z is input to the parser
263** but it does not parse, the type of the token is changed to ID and
264** the parse is retried before an error is thrown.
265**
266** This feature can be used, for example, to cause some keywords in a language
267** to revert to identifiers if they keyword does not apply in the context where
268** it appears.
269*/
270#ifdef YYFALLBACK
271static const YYCODETYPE yyFallback[] = {
272};
273#endif /* YYFALLBACK */
274
275/* The following structure represents a single element of the
276** parser's stack. Information stored includes:
277**
278** + The state number for the parser at this level of the stack.
279**
280** + The value of the token stored at this level of the stack.
281** (In other words, the "major" token.)
282**
283** + The semantic value stored at this level of the stack. This is
284** the information used by the action routines in the grammar.
285** It is sometimes called the "minor" token.
286**
287** After the "shift" half of a SHIFTREDUCE action, the stateno field
288** actually contains the reduce action for the second half of the
289** SHIFTREDUCE.
290*/
291struct yyStackEntry {
292 YYACTIONTYPE stateno; /* The state-number, or reduce action in SHIFTREDUCE */
293 YYCODETYPE major; /* The major token value. This is the code
294 ** number for the token at this stack level */
295 YYMINORTYPE minor; /* The user-supplied minor token value. This
296 ** is the value of the token */
297};
298typedef struct yyStackEntry yyStackEntry;
299
300/* The state of the parser is completely contained in an instance of
301** the following structure */
302struct yyParser {
303 yyStackEntry *yytos; /* Pointer to top element of the stack */
304#ifdef YYTRACKMAXSTACKDEPTH
305 int yyhwm; /* High-water mark of the stack */
306#endif
307#ifndef YYNOERRORRECOVERY
308 int yyerrcnt; /* Shifts left before out of the error */
309#endif
310 TTLParseARG_SDECL /* A place to hold %extra_argument */
311 TTLParseCTX_SDECL /* A place to hold %extra_context */
312#if YYSTACKDEPTH<=0
313 int yystksz; /* Current side of the stack */
314 yyStackEntry *yystack; /* The parser's stack */
315 yyStackEntry yystk0; /* First stack entry */
316#else
317 yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
318 yyStackEntry *yystackEnd; /* Last entry in the stack */
319#endif
320};
321typedef struct yyParser yyParser;
322
323#include <assert.h>
324#ifndef NDEBUG
325#include <stdio.h>
326static FILE *yyTraceFILE = 0;
327static char *yyTracePrompt = 0;
328#endif /* NDEBUG */
329
330#ifndef NDEBUG
331/*
332** Turn parser tracing on by giving a stream to which to write the trace
333** and a prompt to preface each trace message. Tracing is turned off
334** by making either argument NULL
335**
336** Inputs:
337** <ul>
338** <li> A FILE* to which trace output should be written.
339** If NULL, then tracing is turned off.
340** <li> A prefix string written at the beginning of every
341** line of trace output. If NULL, then tracing is
342** turned off.
343** </ul>
344**
345** Outputs:
346** None.
347*/
348void TTLParseTrace(FILE *TraceFILE, char *zTracePrompt){
349 yyTraceFILE = TraceFILE;
350 yyTracePrompt = zTracePrompt;
351 if( yyTraceFILE==0 ) yyTracePrompt = 0;
352 else if( yyTracePrompt==0 ) yyTraceFILE = 0;
353}
354#endif /* NDEBUG */
355
356#if defined(YYCOVERAGE) || !defined(NDEBUG)
357/* For tracing shifts, the names of all terminals and nonterminals
358** are required. The following table supplies these names */
359static const char *const yyTokenName[] = {
360 /* 0 */ "$",
361 /* 1 */ "PERIOD",
362 /* 2 */ "SEMICOLON",
363 /* 3 */ "COMMA",
364 /* 4 */ "STRING",
365 /* 5 */ "INTEGER",
366 /* 6 */ "DOUBLE",
367 /* 7 */ "DECIMAL",
368 /* 8 */ "BOOLEAN",
369 /* 9 */ "BNODE_ID",
370 /* 10 */ "NSIRI",
371 /* 11 */ "IRIREF",
372 /* 12 */ "LANGTAG",
373 /* 13 */ "PREFIX",
374 /* 14 */ "COLON",
375 /* 15 */ "EOF",
376 /* 16 */ "WS",
377 /* 17 */ "BASE",
378 /* 18 */ "RDF_TYPE",
379 /* 19 */ "DTYPE_MARKER",
380 /* 20 */ "ANON",
381 /* 21 */ "LBRACKET",
382 /* 22 */ "RBRACKET",
383 /* 23 */ "LPAREN",
384 /* 24 */ "RPAREN",
385 /* 25 */ "turtleDoc",
386 /* 26 */ "statements",
387 /* 27 */ "statement",
388 /* 28 */ "prefixID",
389 /* 29 */ "base",
390 /* 30 */ "triples",
391 /* 31 */ "subject",
392 /* 32 */ "ows",
393 /* 33 */ "predObjList",
394 /* 34 */ "predicate",
395 /* 35 */ "objectList",
396 /* 36 */ "object",
397 /* 37 */ "resource",
398 /* 38 */ "blank",
399 /* 39 */ "literal",
400 /* 40 */ "collection",
401 /* 41 */ "itemList",
402};
403#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
404
405#ifndef NDEBUG
406/* For tracing reduce actions, the names of all rules are required.
407*/
408static const char *const yyRuleName[] = {
409 /* 0 */ "prefixID ::= PREFIX WS IRIREF PERIOD",
410 /* 1 */ "base ::= BASE WS IRIREF PERIOD",
411 /* 2 */ "triples ::= subject ows predObjList PERIOD",
412 /* 3 */ "triples ::= subject ows predObjList SEMICOLON PERIOD",
413 /* 4 */ "predObjList ::= predicate ows objectList",
414 /* 5 */ "predObjList ::= predObjList SEMICOLON predicate ows objectList",
415 /* 6 */ "objectList ::= objectList COMMA object",
416 /* 7 */ "objectList ::= object",
417 /* 8 */ "subject ::= resource",
418 /* 9 */ "subject ::= blank",
419 /* 10 */ "predicate ::= RDF_TYPE",
420 /* 11 */ "literal ::= STRING",
421 /* 12 */ "literal ::= STRING LANGTAG",
422 /* 13 */ "literal ::= STRING DTYPE_MARKER resource",
423 /* 14 */ "literal ::= INTEGER",
424 /* 15 */ "literal ::= DOUBLE",
425 /* 16 */ "literal ::= DECIMAL",
426 /* 17 */ "literal ::= BOOLEAN",
427 /* 18 */ "blank ::= BNODE_ID",
428 /* 19 */ "blank ::= ANON",
429 /* 20 */ "blank ::= LBRACKET predObjList RBRACKET",
430 /* 21 */ "blank ::= LPAREN RPAREN",
431 /* 22 */ "collection ::= LPAREN itemList RPAREN",
432 /* 23 */ "itemList ::= itemList ows object",
433 /* 24 */ "itemList ::= object",
434 /* 25 */ "resource ::= IRIREF",
435 /* 26 */ "resource ::= NSIRI",
436 /* 27 */ "turtleDoc ::= statements EOF",
437 /* 28 */ "statements ::= statements statement",
438 /* 29 */ "statements ::=",
439 /* 30 */ "statement ::= prefixID",
440 /* 31 */ "statement ::= base",
441 /* 32 */ "statement ::= triples",
442 /* 33 */ "statement ::= WS",
443 /* 34 */ "predicate ::= resource",
444 /* 35 */ "object ::= resource",
445 /* 36 */ "object ::= blank",
446 /* 37 */ "object ::= literal",
447 /* 38 */ "blank ::= collection",
448 /* 39 */ "ows ::= WS",
449 /* 40 */ "ows ::=",
450};
451#endif /* NDEBUG */
452
453
454#if YYSTACKDEPTH<=0
455/*
456** Try to increase the size of the parser stack. Return the number
457** of errors. Return 0 on success.
458*/
459static int yyGrowStack(yyParser *p){
460 int newSize;
461 int idx;
462 yyStackEntry *pNew;
463
464 newSize = p->yystksz*2 + 100;
465 idx = p->yytos ? (int)(p->yytos - p->yystack) : 0;
466 if( p->yystack==&p->yystk0 ){
467 pNew = malloc(newSize*sizeof(pNew[0]));
468 if( pNew ) pNew[0] = p->yystk0;
469 }else{
470 pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
471 }
472 if( pNew ){
473 p->yystack = pNew;
474 p->yytos = &p->yystack[idx];
475#ifndef NDEBUG
476 if( yyTraceFILE ){
477 fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
478 yyTracePrompt, p->yystksz, newSize);
479 }
480#endif
481 p->yystksz = newSize;
482 }
483 return pNew==0;
484}
485#endif
486
487/* Datatype of the argument to the memory allocated passed as the
488** second argument to TTLParseAlloc() below. This can be changed by
489** putting an appropriate #define in the %include section of the input
490** grammar.
491*/
492#ifndef YYMALLOCARGTYPE
493# define YYMALLOCARGTYPE size_t
494#endif
495
496/* Initialize a new parser that has already been allocated.
497*/
498void TTLParseInit(void *yypRawParser TTLParseCTX_PDECL){
499 yyParser *yypParser = (yyParser*)yypRawParser;
501#ifdef YYTRACKMAXSTACKDEPTH
502 yypParser->yyhwm = 0;
503#endif
504#if YYSTACKDEPTH<=0
505 yypParser->yytos = NULL;
506 yypParser->yystack = NULL;
507 yypParser->yystksz = 0;
508 if( yyGrowStack(yypParser) ){
509 yypParser->yystack = &yypParser->yystk0;
510 yypParser->yystksz = 1;
511 }
512#endif
513#ifndef YYNOERRORRECOVERY
514 yypParser->yyerrcnt = -1;
515#endif
516 yypParser->yytos = yypParser->yystack;
517 yypParser->yystack[0].stateno = 0;
518 yypParser->yystack[0].major = 0;
519#if YYSTACKDEPTH>0
520 yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1];
521#endif
522}
523
524#ifndef TTLParse_ENGINEALWAYSONSTACK
525/*
526** This function allocates a new parser.
527** The only argument is a pointer to a function which works like
528** malloc.
529**
530** Inputs:
531** A pointer to the function used to allocate memory.
532**
533** Outputs:
534** A pointer to a parser. This pointer is used in subsequent calls
535** to TTLParse and TTLParseFree.
536*/
538 yyParser *yypParser;
539 yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
540 if( yypParser ){
543 }
544 return (void*)yypParser;
545}
546#endif /* TTLParse_ENGINEALWAYSONSTACK */
547
548
549/* The following function deletes the "minor type" or semantic value
550** associated with a symbol. The symbol can be either a terminal
551** or nonterminal. "yymajor" is the symbol code, and "yypminor" is
552** a pointer to the value to be deleted. The code used to do the
553** deletions is derived from the %destructor and/or %token_destructor
554** directives of the input grammar.
555*/
556static void yy_destructor(
557 yyParser *yypParser, /* The parser */
558 YYCODETYPE yymajor, /* Type code for object to destroy */
559 YYMINORTYPE *yypminor /* The object to be destroyed */
560){
563 switch( yymajor ){
564 /* Here is inserted the actions which take place when a
565 ** terminal or non-terminal is destroyed. This can happen
566 ** when the symbol is popped from the stack during a
567 ** reduce or during error processing or when a parser is
568 ** being destroyed before it is finished parsing.
569 **
570 ** Note: during a reduce, the only symbols destroyed are those
571 ** which appear on the RHS of the rule, but which are *not* used
572 ** inside the C code.
573 */
574/********* Begin destructor definitions ***************************************/
575 /* TERMINAL Destructor */
576 case 1: /* PERIOD */
577 case 2: /* SEMICOLON */
578 case 3: /* COMMA */
579 case 4: /* STRING */
580 case 5: /* INTEGER */
581 case 6: /* DOUBLE */
582 case 7: /* DECIMAL */
583 case 8: /* BOOLEAN */
584 case 9: /* BNODE_ID */
585 case 10: /* NSIRI */
586 case 11: /* IRIREF */
587 case 12: /* LANGTAG */
588 case 13: /* PREFIX */
589 case 14: /* COLON */
590 case 15: /* EOF */
591 case 16: /* WS */
592 case 17: /* BASE */
593 case 18: /* RDF_TYPE */
594 case 19: /* DTYPE_MARKER */
595 case 20: /* ANON */
596 case 21: /* LBRACKET */
597 case 22: /* RBRACKET */
598 case 23: /* LPAREN */
599 case 24: /* RPAREN */
600{
601#line 36 "grammar_ttl.y"
602 (void) state; free ((yypminor->yy0));
603#line 628 "../../build/grammar_ttl.c"
604}
605 break;
606 case 31: /* subject */
607 case 34: /* predicate */
608 case 36: /* object */
609 case 37: /* resource */
610 case 38: /* blank */
611 case 39: /* literal */
612 case 40: /* collection */
613{
614#line 129 "grammar_ttl.y"
615 VOLK_term_free ((yypminor->yy50));
616#line 641 "../../build/grammar_ttl.c"
617}
618 break;
619 case 33: /* predObjList */
620{
621#line 97 "grammar_ttl.y"
622 VOLK_link_map_free ((yypminor->yy34));
623#line 648 "../../build/grammar_ttl.c"
624}
625 break;
626 case 35: /* objectList */
627 case 41: /* itemList */
628{
629#line 117 "grammar_ttl.y"
630 VOLK_term_set_free ((yypminor->yy22));
631#line 656 "../../build/grammar_ttl.c"
632}
633 break;
634/********* End destructor definitions *****************************************/
635 default: break; /* If no destructor action specified: do nothing */
636 }
637}
638
639/*
640** Pop the parser's stack once.
641**
642** If there is a destructor routine associated with the token which
643** is popped from the stack, then call it.
644*/
645static void yy_pop_parser_stack(yyParser *pParser){
647 assert( pParser->yytos!=0 );
648 assert( pParser->yytos > pParser->yystack );
649 yytos = pParser->yytos--;
650#ifndef NDEBUG
651 if( yyTraceFILE ){
652 fprintf(yyTraceFILE,"%sPopping %s\n",
653 yyTracePrompt,
654 yyTokenName[yytos->major]);
655 }
656#endif
657 yy_destructor(pParser, yytos->major, &yytos->minor);
658}
659
660/*
661** Clear all secondary memory allocations from the parser
662*/
663void TTLParseFinalize(void *p){
664 yyParser *pParser = (yyParser*)p;
665 while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser);
666#if YYSTACKDEPTH<=0
667 if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack);
668#endif
669}
670
671#ifndef TTLParse_ENGINEALWAYSONSTACK
672/*
673** Deallocate and destroy a parser. Destructors are called for
674** all stack elements before shutting the parser down.
675**
676** If the YYPARSEFREENEVERNULL macro exists (for example because it
677** is defined in a %include section of the input grammar) then it is
678** assumed that the input pointer is never NULL.
679*/
681 void *p, /* The parser to be deleted */
682 void (*freeProc)(void*) /* Function used to reclaim memory */
683){
684#ifndef YYPARSEFREENEVERNULL
685 if( p==0 ) return;
686#endif
688 (*freeProc)(p);
689}
690#endif /* TTLParse_ENGINEALWAYSONSTACK */
691
692/*
693** Return the peak depth of the stack for a parser.
694*/
695#ifdef YYTRACKMAXSTACKDEPTH
696int TTLParseStackPeak(void *p){
697 yyParser *pParser = (yyParser*)p;
698 return pParser->yyhwm;
699}
700#endif
701
702/* This array of booleans keeps track of the parser statement
703** coverage. The element yycoverage[X][Y] is set when the parser
704** is in state X and has a lookahead token Y. In a well-tested
705** systems, every element of this matrix should end up being set.
706*/
707#if defined(YYCOVERAGE)
708static unsigned char yycoverage[YYNSTATE][YYNTOKEN];
709#endif
710
711/*
712** Write into out a description of every state/lookahead combination that
713**
714** (1) has not been used by the parser, and
715** (2) is not a syntax error.
716**
717** Return the number of missed state/lookahead combinations.
718*/
719#if defined(YYCOVERAGE)
720int TTLParseCoverage(FILE *out){
721 int stateno, iLookAhead, i;
722 int nMissed = 0;
723 for(stateno=0; stateno<YYNSTATE; stateno++){
724 i = yy_shift_ofst[stateno];
725 for(iLookAhead=0; iLookAhead<YYNTOKEN; iLookAhead++){
726 if( yy_lookahead[i+iLookAhead]!=iLookAhead ) continue;
727 if( yycoverage[stateno][iLookAhead]==0 ) nMissed++;
728 if( out ){
729 fprintf(out,"State %d lookahead %s %s\n", stateno,
730 yyTokenName[iLookAhead],
731 yycoverage[stateno][iLookAhead] ? "ok" : "missed");
732 }
733 }
734 }
735 return nMissed;
736}
737#endif
738
739/*
740** Find the appropriate action for a parser given the terminal
741** look-ahead token iLookAhead.
742*/
743static YYACTIONTYPE yy_find_shift_action(
744 YYCODETYPE iLookAhead, /* The look-ahead token */
745 YYACTIONTYPE stateno /* Current state number */
746){
747 int i;
748
749 if( stateno>YY_MAX_SHIFT ) return stateno;
750 assert( stateno <= YY_SHIFT_COUNT );
751#if defined(YYCOVERAGE)
752 yycoverage[stateno][iLookAhead] = 1;
753#endif
754 do{
755 i = yy_shift_ofst[stateno];
756 assert( i>=0 );
757 assert( i<=YY_ACTTAB_COUNT );
758 assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD );
759 assert( iLookAhead!=YYNOCODE );
760 assert( iLookAhead < YYNTOKEN );
761 i += iLookAhead;
762 assert( i<(int)YY_NLOOKAHEAD );
763 if( yy_lookahead[i]!=iLookAhead ){
764#ifdef YYFALLBACK
765 YYCODETYPE iFallback; /* Fallback token */
766 assert( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0]) );
767 iFallback = yyFallback[iLookAhead];
768 if( iFallback!=0 ){
769#ifndef NDEBUG
770 if( yyTraceFILE ){
771 fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
772 yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
773 }
774#endif
775 assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */
776 iLookAhead = iFallback;
777 continue;
778 }
779#endif
780#ifdef YYWILDCARD
781 {
782 int j = i - iLookAhead + YYWILDCARD;
783 assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) );
784 if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){
785#ifndef NDEBUG
786 if( yyTraceFILE ){
787 fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
788 yyTracePrompt, yyTokenName[iLookAhead],
789 yyTokenName[YYWILDCARD]);
790 }
791#endif /* NDEBUG */
792 return yy_action[j];
793 }
794 }
795#endif /* YYWILDCARD */
796 return yy_default[stateno];
797 }else{
798 assert( i>=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) );
799 return yy_action[i];
800 }
801 }while(1);
802}
803
804/*
805** Find the appropriate action for a parser given the non-terminal
806** look-ahead token iLookAhead.
807*/
808static YYACTIONTYPE yy_find_reduce_action(
809 YYACTIONTYPE stateno, /* Current state number */
810 YYCODETYPE iLookAhead /* The look-ahead token */
811){
812 int i;
813#ifdef YYERRORSYMBOL
814 if( stateno>YY_REDUCE_COUNT ){
815 return yy_default[stateno];
816 }
817#else
818 assert( stateno<=YY_REDUCE_COUNT );
819#endif
820 i = yy_reduce_ofst[stateno];
821 assert( iLookAhead!=YYNOCODE );
822 i += iLookAhead;
823#ifdef YYERRORSYMBOL
824 if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
825 return yy_default[stateno];
826 }
827#else
828 assert( i>=0 && i<YY_ACTTAB_COUNT );
829 assert( yy_lookahead[i]==iLookAhead );
830#endif
831 return yy_action[i];
832}
833
834/*
835** The following routine is called if the stack overflows.
836*/
837static void yyStackOverflow(yyParser *yypParser){
840#ifndef NDEBUG
841 if( yyTraceFILE ){
842 fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
843 }
844#endif
845 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
846 /* Here code is inserted which will execute if the parser
847 ** stack every overflows */
848/******** Begin %stack_overflow code ******************************************/
849#line 17 "grammar_ttl.y"
850
851 log_error ("Stack oveflow in TTL parsing.");
852 state->rc = VOLK_MEM_ERR;
853#line 878 "../../build/grammar_ttl.c"
854/******** End %stack_overflow code ********************************************/
855 TTLParseARG_STORE /* Suppress warning about unused %extra_argument var */
857}
858
859/*
860** Print tracing information for a SHIFT action
861*/
862#ifndef NDEBUG
863static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){
864 if( yyTraceFILE ){
865 if( yyNewState<YYNSTATE ){
866 fprintf(yyTraceFILE,"%s%s '%s', go to state %d\n",
867 yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
868 yyNewState);
869 }else{
870 fprintf(yyTraceFILE,"%s%s '%s', pending reduce %d\n",
871 yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
872 yyNewState - YY_MIN_REDUCE);
873 }
874 }
875}
876#else
877# define yyTraceShift(X,Y,Z)
878#endif
879
880/*
881** Perform a shift action.
882*/
883static void yy_shift(
884 yyParser *yypParser, /* The parser to be shifted */
885 YYACTIONTYPE yyNewState, /* The new state to shift in */
886 YYCODETYPE yyMajor, /* The major token to shift in */
887 TTLParseTOKENTYPE yyMinor /* The minor token to shift in */
888){
890 yypParser->yytos++;
891#ifdef YYTRACKMAXSTACKDEPTH
892 if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
893 yypParser->yyhwm++;
894 assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) );
895 }
896#endif
897#if YYSTACKDEPTH>0
898 if( yypParser->yytos>yypParser->yystackEnd ){
899 yypParser->yytos--;
900 yyStackOverflow(yypParser);
901 return;
902 }
903#else
904 if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){
905 if( yyGrowStack(yypParser) ){
906 yypParser->yytos--;
907 yyStackOverflow(yypParser);
908 return;
909 }
910 }
911#endif
912 if( yyNewState > YY_MAX_SHIFT ){
913 yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
914 }
915 yytos = yypParser->yytos;
916 yytos->stateno = yyNewState;
917 yytos->major = yyMajor;
918 yytos->minor.yy0 = yyMinor;
919 yyTraceShift(yypParser, yyNewState, "Shift");
920}
921
922/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
923** of that rule */
924static const YYCODETYPE yyRuleInfoLhs[] = {
925 28, /* (0) prefixID ::= PREFIX WS IRIREF PERIOD */
926 29, /* (1) base ::= BASE WS IRIREF PERIOD */
927 30, /* (2) triples ::= subject ows predObjList PERIOD */
928 30, /* (3) triples ::= subject ows predObjList SEMICOLON PERIOD */
929 33, /* (4) predObjList ::= predicate ows objectList */
930 33, /* (5) predObjList ::= predObjList SEMICOLON predicate ows objectList */
931 35, /* (6) objectList ::= objectList COMMA object */
932 35, /* (7) objectList ::= object */
933 31, /* (8) subject ::= resource */
934 31, /* (9) subject ::= blank */
935 34, /* (10) predicate ::= RDF_TYPE */
936 39, /* (11) literal ::= STRING */
937 39, /* (12) literal ::= STRING LANGTAG */
938 39, /* (13) literal ::= STRING DTYPE_MARKER resource */
939 39, /* (14) literal ::= INTEGER */
940 39, /* (15) literal ::= DOUBLE */
941 39, /* (16) literal ::= DECIMAL */
942 39, /* (17) literal ::= BOOLEAN */
943 38, /* (18) blank ::= BNODE_ID */
944 38, /* (19) blank ::= ANON */
945 38, /* (20) blank ::= LBRACKET predObjList RBRACKET */
946 38, /* (21) blank ::= LPAREN RPAREN */
947 40, /* (22) collection ::= LPAREN itemList RPAREN */
948 41, /* (23) itemList ::= itemList ows object */
949 41, /* (24) itemList ::= object */
950 37, /* (25) resource ::= IRIREF */
951 37, /* (26) resource ::= NSIRI */
952 25, /* (27) turtleDoc ::= statements EOF */
953 26, /* (28) statements ::= statements statement */
954 26, /* (29) statements ::= */
955 27, /* (30) statement ::= prefixID */
956 27, /* (31) statement ::= base */
957 27, /* (32) statement ::= triples */
958 27, /* (33) statement ::= WS */
959 34, /* (34) predicate ::= resource */
960 36, /* (35) object ::= resource */
961 36, /* (36) object ::= blank */
962 36, /* (37) object ::= literal */
963 38, /* (38) blank ::= collection */
964 32, /* (39) ows ::= WS */
965 32, /* (40) ows ::= */
966};
967
968/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
969** of symbols on the right-hand side of that rule. */
970static const signed char yyRuleInfoNRhs[] = {
971 -4, /* (0) prefixID ::= PREFIX WS IRIREF PERIOD */
972 -4, /* (1) base ::= BASE WS IRIREF PERIOD */
973 -4, /* (2) triples ::= subject ows predObjList PERIOD */
974 -5, /* (3) triples ::= subject ows predObjList SEMICOLON PERIOD */
975 -3, /* (4) predObjList ::= predicate ows objectList */
976 -5, /* (5) predObjList ::= predObjList SEMICOLON predicate ows objectList */
977 -3, /* (6) objectList ::= objectList COMMA object */
978 -1, /* (7) objectList ::= object */
979 -1, /* (8) subject ::= resource */
980 -1, /* (9) subject ::= blank */
981 -1, /* (10) predicate ::= RDF_TYPE */
982 -1, /* (11) literal ::= STRING */
983 -2, /* (12) literal ::= STRING LANGTAG */
984 -3, /* (13) literal ::= STRING DTYPE_MARKER resource */
985 -1, /* (14) literal ::= INTEGER */
986 -1, /* (15) literal ::= DOUBLE */
987 -1, /* (16) literal ::= DECIMAL */
988 -1, /* (17) literal ::= BOOLEAN */
989 -1, /* (18) blank ::= BNODE_ID */
990 -1, /* (19) blank ::= ANON */
991 -3, /* (20) blank ::= LBRACKET predObjList RBRACKET */
992 -2, /* (21) blank ::= LPAREN RPAREN */
993 -3, /* (22) collection ::= LPAREN itemList RPAREN */
994 -3, /* (23) itemList ::= itemList ows object */
995 -1, /* (24) itemList ::= object */
996 -1, /* (25) resource ::= IRIREF */
997 -1, /* (26) resource ::= NSIRI */
998 -2, /* (27) turtleDoc ::= statements EOF */
999 -2, /* (28) statements ::= statements statement */
1000 0, /* (29) statements ::= */
1001 -1, /* (30) statement ::= prefixID */
1002 -1, /* (31) statement ::= base */
1003 -1, /* (32) statement ::= triples */
1004 -1, /* (33) statement ::= WS */
1005 -1, /* (34) predicate ::= resource */
1006 -1, /* (35) object ::= resource */
1007 -1, /* (36) object ::= blank */
1008 -1, /* (37) object ::= literal */
1009 -1, /* (38) blank ::= collection */
1010 -1, /* (39) ows ::= WS */
1011 0, /* (40) ows ::= */
1012};
1013
1014static void yy_accept(yyParser*); /* Forward Declaration */
1015
1016/*
1017** Perform a reduce action and the shift that must immediately
1018** follow the reduce.
1019**
1020** The yyLookahead and yyLookaheadToken parameters provide reduce actions
1021** access to the lookahead token (if any). The yyLookahead will be YYNOCODE
1022** if the lookahead token has already been consumed. As this procedure is
1023** only called from one place, optimizing compilers will in-line it, which
1024** means that the extra parameters have no performance impact.
1025*/
1026static YYACTIONTYPE yy_reduce(
1027 yyParser *yypParser, /* The parser */
1028 unsigned int yyruleno, /* Number of the rule by which to reduce */
1029 int yyLookahead, /* Lookahead token, or YYNOCODE if none */
1030 TTLParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */
1031 TTLParseCTX_PDECL /* %extra_context */
1032){
1033 int yygoto; /* The next state */
1034 YYACTIONTYPE yyact; /* The next action */
1035 yyStackEntry *yymsp; /* The top of the parser's stack */
1036 int yysize; /* Amount to pop the stack */
1038 (void)yyLookahead;
1039 (void)yyLookaheadToken;
1040 yymsp = yypParser->yytos;
1041
1042 switch( yyruleno ){
1043 /* Beginning here are the reduction cases. A typical example
1044 ** follows:
1045 ** case 0:
1046 ** #line <lineno> <grammarfile>
1047 ** { ... } // User supplied code
1048 ** #line <lineno> <thisfile>
1049 ** break;
1050 */
1051/********** Begin reduce actions **********************************************/
1052 YYMINORTYPE yylhsminor;
1053 case 0: /* prefixID ::= PREFIX WS IRIREF PERIOD */
1054#line 63 "grammar_ttl.y"
1055{
1056 VOLK_nsmap_add (yymsp[-3].minor.yy0, yymsp[-1].minor.yy0);
1057
1058 free (yymsp[-3].minor.yy0);
1059 free (yymsp[-1].minor.yy0);
1060 }
1061#line 1086 "../../build/grammar_ttl.c"
1062 yy_destructor(yypParser,16,&yymsp[-2].minor);
1063 yy_destructor(yypParser,1,&yymsp[0].minor);
1064 break;
1065 case 1: /* base ::= BASE WS IRIREF PERIOD */
1066{ yy_destructor(yypParser,17,&yymsp[-3].minor);
1067#line 70 "grammar_ttl.y"
1068{
1069 VOLK_term_free (state->base);
1070 state->base = VOLK_iriref_new (yymsp[-1].minor.yy0);
1071
1072 free (yymsp[-1].minor.yy0);
1073 }
1074#line 1099 "../../build/grammar_ttl.c"
1075 yy_destructor(yypParser,16,&yymsp[-2].minor);
1076 yy_destructor(yypParser,1,&yymsp[0].minor);
1077}
1078 break;
1079 case 2: /* triples ::= subject ows predObjList PERIOD */
1080#line 77 "grammar_ttl.y"
1081{
1082 size_t ct = VOLK_graph_add_link_map (state->it, yymsp[-1].minor.yy34);
1083 state->ct += ct;
1084 state->rc = VOLK_OK;
1085 LOG_TRACE("Added %lu triples.", ct);
1086
1087 VOLK_term_free (yymsp[-3].minor.yy50);
1088 VOLK_link_map_free (yymsp[-1].minor.yy34);
1089 }
1090#line 1115 "../../build/grammar_ttl.c"
1091 yy_destructor(yypParser,1,&yymsp[0].minor);
1092 break;
1093 case 3: /* triples ::= subject ows predObjList SEMICOLON PERIOD */
1094#line 86 "grammar_ttl.y"
1095{
1096 size_t ct = VOLK_graph_add_link_map (state->it, yymsp[-2].minor.yy34);
1097 state->ct += ct;
1098 state->rc = VOLK_OK;
1099 LOG_TRACE("Added %lu triples.", ct);
1100
1101 VOLK_term_free (yymsp[-4].minor.yy50);
1102 VOLK_link_map_free (yymsp[-2].minor.yy34);
1103 }
1104#line 1129 "../../build/grammar_ttl.c"
1105 yy_destructor(yypParser,2,&yymsp[-1].minor);
1106 yy_destructor(yypParser,1,&yymsp[0].minor);
1107 break;
1108 case 4: /* predObjList ::= predicate ows objectList */
1109#line 98 "grammar_ttl.y"
1110{
1111 VOLK_Term *s;
1112 if (state->lms) s = state->lms;
1113 else {
1114 // TODO This may be brittle. It is not verifying the
1115 // full BNode syntax.
1116 log_info ("Link map subject not present. Assuming BNode.");
1117 s = VOLK_bnode_new (NULL);
1118 }
1119 yylhsminor.yy34 = VOLK_link_map_new (s, VOLK_LINK_OUTBOUND);
1120 VOLK_link_map_add (yylhsminor.yy34, yymsp[-2].minor.yy50, yymsp[0].minor.yy22);
1121 if (s != state->lms) VOLK_term_free (s);
1122 }
1123#line 1148 "../../build/grammar_ttl.c"
1124 yymsp[-2].minor.yy34 = yylhsminor.yy34;
1125 break;
1126 case 5: /* predObjList ::= predObjList SEMICOLON predicate ows objectList */
1127#line 111 "grammar_ttl.y"
1128{
1129 VOLK_link_map_add (yymsp[-4].minor.yy34, yymsp[-2].minor.yy50, yymsp[0].minor.yy22);
1130 yylhsminor.yy34 = yymsp[-4].minor.yy34;
1131 }
1132#line 1157 "../../build/grammar_ttl.c"
1133 yy_destructor(yypParser,2,&yymsp[-3].minor);
1134 yymsp[-4].minor.yy34 = yylhsminor.yy34;
1135 break;
1136 case 6: /* objectList ::= objectList COMMA object */
1137#line 118 "grammar_ttl.y"
1138{
1139 if (VOLK_term_set_add (yymsp[-2].minor.yy22, yymsp[0].minor.yy50, NULL) == VOLK_NOACTION)
1140 VOLK_term_free (yymsp[0].minor.yy50);
1141 yylhsminor.yy22 = yymsp[-2].minor.yy22;
1142 }
1143#line 1168 "../../build/grammar_ttl.c"
1144 yy_destructor(yypParser,3,&yymsp[-1].minor);
1145 yymsp[-2].minor.yy22 = yylhsminor.yy22;
1146 break;
1147 case 7: /* objectList ::= object */
1148#line 123 "grammar_ttl.y"
1149{
1150 yylhsminor.yy22 = VOLK_term_set_new();
1151 VOLK_term_set_add (yylhsminor.yy22, yymsp[0].minor.yy50, NULL);
1152 }
1153#line 1178 "../../build/grammar_ttl.c"
1154 yymsp[0].minor.yy22 = yylhsminor.yy22;
1155 break;
1156 case 8: /* subject ::= resource */
1157 case 9: /* subject ::= blank */ yytestcase(yyruleno==9);
1158#line 130 "grammar_ttl.y"
1159{ state->lms = yymsp[0].minor.yy50; }
1160#line 1185 "../../build/grammar_ttl.c"
1161 break;
1162 case 10: /* predicate ::= RDF_TYPE */
1163{ yy_destructor(yypParser,18,&yymsp[0].minor);
1164#line 136 "grammar_ttl.y"
1165{ yymsp[0].minor.yy50 = VOLK_iriref_new_ns ("rdf:type"); }
1166#line 1191 "../../build/grammar_ttl.c"
1167}
1168 break;
1169 case 11: /* literal ::= STRING */
1170#line 146 "grammar_ttl.y"
1171{
1172 yylhsminor.yy50 = VOLK_literal_new (yymsp[0].minor.yy0, NULL);
1173 LOG_TRACE("Created plain literal: \"%s\"", yylhsminor.yy50->data);
1174 free (yymsp[0].minor.yy0);
1175 }
1176#line 1201 "../../build/grammar_ttl.c"
1177 yymsp[0].minor.yy50 = yylhsminor.yy50;
1178 break;
1179 case 12: /* literal ::= STRING LANGTAG */
1180#line 151 "grammar_ttl.y"
1181{
1182 yylhsminor.yy50 = VOLK_lt_literal_new (yymsp[-1].minor.yy0, yymsp[0].minor.yy0);
1183 LOG_TRACE("Created LT-literal: \"%s\"@%s", yylhsminor.yy50->data, yylhsminor.yy50->lang);
1184 free (yymsp[-1].minor.yy0);
1185 free (yymsp[0].minor.yy0);
1186 }
1187#line 1212 "../../build/grammar_ttl.c"
1188 yymsp[-1].minor.yy50 = yylhsminor.yy50;
1189 break;
1190 case 13: /* literal ::= STRING DTYPE_MARKER resource */
1191#line 157 "grammar_ttl.y"
1192{
1193 yylhsminor.yy50 = VOLK_literal_new (yymsp[-2].minor.yy0, yymsp[0].minor.yy50);
1194 LOG_TRACE(
1195 "Created DT-literal: \"%s\"^^%s",
1196 yylhsminor.yy50->data, yylhsminor.yy50->datatype);
1197 free (yymsp[-2].minor.yy0);
1198 }
1199#line 1224 "../../build/grammar_ttl.c"
1200 yy_destructor(yypParser,19,&yymsp[-1].minor);
1201 yymsp[-2].minor.yy50 = yylhsminor.yy50;
1202 break;
1203 case 14: /* literal ::= INTEGER */
1204#line 164 "grammar_ttl.y"
1205{
1206 yylhsminor.yy50 = VOLK_literal_new (yymsp[0].minor.yy0, VOLK_iriref_new_ns ("xsd:integer"));
1207 free (yymsp[0].minor.yy0);
1208 }
1209#line 1234 "../../build/grammar_ttl.c"
1210 yymsp[0].minor.yy50 = yylhsminor.yy50;
1211 break;
1212 case 15: /* literal ::= DOUBLE */
1213#line 168 "grammar_ttl.y"
1214{
1215 yylhsminor.yy50 = VOLK_literal_new (yymsp[0].minor.yy0, VOLK_iriref_new_ns ("xsd:double"));
1216 free (yymsp[0].minor.yy0);
1217 }
1218#line 1243 "../../build/grammar_ttl.c"
1219 yymsp[0].minor.yy50 = yylhsminor.yy50;
1220 break;
1221 case 16: /* literal ::= DECIMAL */
1222#line 172 "grammar_ttl.y"
1223{
1224 yylhsminor.yy50 = VOLK_literal_new (yymsp[0].minor.yy0, VOLK_iriref_new_ns ("xsd:decimal"));
1225 free (yymsp[0].minor.yy0);
1226 }
1227#line 1252 "../../build/grammar_ttl.c"
1228 yymsp[0].minor.yy50 = yylhsminor.yy50;
1229 break;
1230 case 17: /* literal ::= BOOLEAN */
1231#line 176 "grammar_ttl.y"
1232{
1233 yylhsminor.yy50 = VOLK_literal_new (yymsp[0].minor.yy0, VOLK_iriref_new_ns ("xsd:boolean"));
1234 free (yymsp[0].minor.yy0);
1235 }
1236#line 1261 "../../build/grammar_ttl.c"
1237 yymsp[0].minor.yy50 = yylhsminor.yy50;
1238 break;
1239 case 18: /* blank ::= BNODE_ID */
1240#line 183 "grammar_ttl.y"
1241{
1242 yylhsminor.yy50 = VOLK_bnode_new (yymsp[0].minor.yy0);
1243 LOG_TRACE("Created blank node: _:%s", yylhsminor.yy50->data);
1244 free (yymsp[0].minor.yy0);
1245 }
1246#line 1271 "../../build/grammar_ttl.c"
1247 yymsp[0].minor.yy50 = yylhsminor.yy50;
1248 break;
1249 case 19: /* blank ::= ANON */
1250{ yy_destructor(yypParser,20,&yymsp[0].minor);
1251#line 188 "grammar_ttl.y"
1252{
1253 LOG_TRACE ("Found empty BNode.");
1254 yymsp[0].minor.yy50 = VOLK_bnode_new (NULL);
1255 LOG_TRACE("Created empty list BN: _:%s", yymsp[0].minor.yy50->data);
1256 }
1257#line 1282 "../../build/grammar_ttl.c"
1258}
1259 break;
1260 case 20: /* blank ::= LBRACKET predObjList RBRACKET */
1261{ yy_destructor(yypParser,21,&yymsp[-2].minor);
1262#line 193 "grammar_ttl.y"
1263{
1264 LOG_TRACE ("Found BNode with data.");
1265 yymsp[-2].minor.yy50 = VOLK_bnode_new (NULL);
1266 state->lms = yymsp[-2].minor.yy50;
1267 state->ct += VOLK_graph_add_link_map (state->it, yymsp[-1].minor.yy34);
1268 LOG_TRACE("Created list BN: _:%s", yymsp[-2].minor.yy50->data);
1269
1270 VOLK_link_map_free (yymsp[-1].minor.yy34);
1271 }
1272#line 1297 "../../build/grammar_ttl.c"
1273 yy_destructor(yypParser,22,&yymsp[0].minor);
1274}
1275 break;
1276 case 21: /* blank ::= LPAREN RPAREN */
1277{ yy_destructor(yypParser,23,&yymsp[-1].minor);
1278#line 203 "grammar_ttl.y"
1279{
1280 yymsp[-1].minor.yy50 = VOLK_iriref_new_ns ("rdf:nil");
1281 LOG_TRACE("Created list terminator: %s", yymsp[-1].minor.yy50->data);
1282 }
1283#line 1308 "../../build/grammar_ttl.c"
1284 yy_destructor(yypParser,24,&yymsp[0].minor);
1285}
1286 break;
1287 case 22: /* collection ::= LPAREN itemList RPAREN */
1288{ yy_destructor(yypParser,23,&yymsp[-2].minor);
1289#line 212 "grammar_ttl.y"
1290{
1291 yymsp[-2].minor.yy50 = VOLK_bnode_add_collection (state->it, yymsp[-1].minor.yy22);
1292 VOLK_term_set_free (yymsp[-1].minor.yy22);
1293 }
1294#line 1319 "../../build/grammar_ttl.c"
1295 yy_destructor(yypParser,24,&yymsp[0].minor);
1296}
1297 break;
1298 case 23: /* itemList ::= itemList ows object */
1299#line 219 "grammar_ttl.y"
1300{
1301 if (VOLK_term_set_add (yymsp[-2].minor.yy22, yymsp[0].minor.yy50, NULL) == VOLK_NOACTION)
1302 VOLK_term_free (yymsp[0].minor.yy50);
1303 yylhsminor.yy22 = yymsp[-2].minor.yy22;
1304 }
1305#line 1330 "../../build/grammar_ttl.c"
1306 yymsp[-2].minor.yy22 = yylhsminor.yy22;
1307 break;
1308 case 24: /* itemList ::= object */
1309#line 224 "grammar_ttl.y"
1310{
1311 yylhsminor.yy22 = VOLK_term_set_new ();
1312 VOLK_term_set_add (yylhsminor.yy22, yymsp[0].minor.yy50, NULL);
1313 }
1314#line 1339 "../../build/grammar_ttl.c"
1315 yymsp[0].minor.yy22 = yylhsminor.yy22;
1316 break;
1317 case 25: /* resource ::= IRIREF */
1318#line 231 "grammar_ttl.y"
1319{
1320 VOLK_Term *rel_iri = VOLK_iriref_new (yymsp[0].minor.yy0);
1321 free (yymsp[0].minor.yy0);
1322 if (state->base) {
1323 yylhsminor.yy50 = VOLK_iriref_new_abs (rel_iri, state->base);
1324 VOLK_term_free (rel_iri);
1325 } else {
1326 yylhsminor.yy50 = rel_iri;
1327 }
1328 LOG_TRACE("Created IRI: <%s>", yylhsminor.yy50->data);
1329 }
1330#line 1355 "../../build/grammar_ttl.c"
1331 yymsp[0].minor.yy50 = yylhsminor.yy50;
1332 break;
1333 case 26: /* resource ::= NSIRI */
1334#line 242 "grammar_ttl.y"
1335{
1336 yylhsminor.yy50 = VOLK_iriref_new_ns (yymsp[0].minor.yy0);
1337 LOG_TRACE("Created IRI: %s", yylhsminor.yy50->data);
1338 free (yymsp[0].minor.yy0);
1339 }
1340#line 1365 "../../build/grammar_ttl.c"
1341 yymsp[0].minor.yy50 = yylhsminor.yy50;
1342 break;
1343 case 27: /* turtleDoc ::= statements EOF */
1344#line 54 "grammar_ttl.y"
1345{
1346}
1347#line 1372 "../../build/grammar_ttl.c"
1348 yy_destructor(yypParser,15,&yymsp[0].minor);
1349 break;
1350 case 33: /* statement ::= WS */
1351 case 39: /* ows ::= WS */ yytestcase(yyruleno==39);
1352{ yy_destructor(yypParser,16,&yymsp[0].minor);
1353#line 61 "grammar_ttl.y"
1354{
1355}
1356#line 1381 "../../build/grammar_ttl.c"
1357}
1358 break;
1359 case 34: /* predicate ::= resource */
1360 case 35: /* object ::= resource */ yytestcase(yyruleno==35);
1361{ yy_destructor(yypParser,37,&yymsp[0].minor);
1362#line 135 "grammar_ttl.y"
1363{
1364}
1365#line 1390 "../../build/grammar_ttl.c"
1366}
1367 break;
1368 case 36: /* object ::= blank */
1369{ yy_destructor(yypParser,38,&yymsp[0].minor);
1370#line 141 "grammar_ttl.y"
1371{
1372}
1373#line 1398 "../../build/grammar_ttl.c"
1374}
1375 break;
1376 case 37: /* object ::= literal */
1377{ yy_destructor(yypParser,39,&yymsp[0].minor);
1378#line 142 "grammar_ttl.y"
1379{
1380}
1381#line 1406 "../../build/grammar_ttl.c"
1382}
1383 break;
1384 case 38: /* blank ::= collection */
1385{ yy_destructor(yypParser,40,&yymsp[0].minor);
1386#line 202 "grammar_ttl.y"
1387{
1388}
1389#line 1414 "../../build/grammar_ttl.c"
1390}
1391 break;
1392 default:
1393 /* (28) statements ::= statements statement */ yytestcase(yyruleno==28);
1394 /* (29) statements ::= */ yytestcase(yyruleno==29);
1395 /* (30) statement ::= prefixID (OPTIMIZED OUT) */ assert(yyruleno!=30);
1396 /* (31) statement ::= base (OPTIMIZED OUT) */ assert(yyruleno!=31);
1397 /* (32) statement ::= triples (OPTIMIZED OUT) */ assert(yyruleno!=32);
1398 /* (40) ows ::= */ yytestcase(yyruleno==40);
1399 break;
1400/********** End reduce actions ************************************************/
1401 };
1402 assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
1403 yygoto = yyRuleInfoLhs[yyruleno];
1404 yysize = yyRuleInfoNRhs[yyruleno];
1405 yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto);
1406
1407 /* There are no SHIFTREDUCE actions on nonterminals because the table
1408 ** generator has simplified them to pure REDUCE actions. */
1409 assert( !(yyact>YY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) );
1410
1411 /* It is not possible for a REDUCE to be followed by an error */
1412 assert( yyact!=YY_ERROR_ACTION );
1413
1414 yymsp += yysize+1;
1415 yypParser->yytos = yymsp;
1416 yymsp->stateno = (YYACTIONTYPE)yyact;
1417 yymsp->major = (YYCODETYPE)yygoto;
1418 yyTraceShift(yypParser, yyact, "... then shift");
1419 return yyact;
1420}
1421
1422/*
1423** The following code executes when the parse fails
1424*/
1425#ifndef YYNOERRORRECOVERY
1426static void yy_parse_failed(
1427 yyParser *yypParser /* The parser */
1428){
1431#ifndef NDEBUG
1432 if( yyTraceFILE ){
1433 fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
1434 }
1435#endif
1436 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
1437 /* Here code is inserted which will be executed whenever the
1438 ** parser fails */
1439/************ Begin %parse_failure code ***************************************/
1440#line 22 "grammar_ttl.y"
1441
1442 log_error ("TTL parse error. Cannot continue.");
1443 state->rc = VOLK_PARSE_ERR;
1444#line 1469 "../../build/grammar_ttl.c"
1445/************ End %parse_failure code *****************************************/
1446 TTLParseARG_STORE /* Suppress warning about unused %extra_argument variable */
1448}
1449#endif /* YYNOERRORRECOVERY */
1450
1451/*
1452** The following code executes when a syntax error first occurs.
1453*/
1454static void yy_syntax_error(
1455 yyParser *yypParser, /* The parser */
1456 int yymajor, /* The major type of the error token */
1457 TTLParseTOKENTYPE yyminor /* The minor type of the error token */
1458){
1461#define TOKEN yyminor
1462/************ Begin %syntax_error code ****************************************/
1463#line 27 "grammar_ttl.y"
1464
1465 // Fail immediately on first error.
1466 yy_parse_failed (yypParser);
1467#line 1492 "../../build/grammar_ttl.c"
1468/************ End %syntax_error code ******************************************/
1469 TTLParseARG_STORE /* Suppress warning about unused %extra_argument variable */
1471}
1472
1473/*
1474** The following is executed when the parser accepts
1475*/
1476static void yy_accept(
1477 yyParser *yypParser /* The parser */
1478){
1481#ifndef NDEBUG
1482 if( yyTraceFILE ){
1483 fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
1484 }
1485#endif
1486#ifndef YYNOERRORRECOVERY
1487 yypParser->yyerrcnt = -1;
1488#endif
1489 assert( yypParser->yytos==yypParser->yystack );
1490 /* Here code is inserted which will be executed whenever the
1491 ** parser accepts */
1492/*********** Begin %parse_accept code *****************************************/
1493/*********** End %parse_accept code *******************************************/
1494 TTLParseARG_STORE /* Suppress warning about unused %extra_argument variable */
1496}
1497
1498/* The main parser program.
1499** The first argument is a pointer to a structure obtained from
1500** "TTLParseAlloc" which describes the current state of the parser.
1501** The second argument is the major token number. The third is
1502** the minor token. The fourth optional argument is whatever the
1503** user wants (and specified in the grammar) and is available for
1504** use by the action routines.
1505**
1506** Inputs:
1507** <ul>
1508** <li> A pointer to the parser (an opaque structure.)
1509** <li> The major token number.
1510** <li> The minor token number.
1511** <li> An option argument of a grammar-specified type.
1512** </ul>
1513**
1514** Outputs:
1515** None.
1516*/
1518 void *yyp, /* The parser */
1519 int yymajor, /* The major token code number */
1520 TTLParseTOKENTYPE yyminor /* The value for the token */
1521 TTLParseARG_PDECL /* Optional %extra_argument parameter */
1522){
1523 YYMINORTYPE yyminorunion;
1524 YYACTIONTYPE yyact; /* The parser action. */
1525#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
1526 int yyendofinput; /* True if we are at the end of input */
1527#endif
1528#ifdef YYERRORSYMBOL
1529 int yyerrorhit = 0; /* True if yymajor has invoked an error */
1530#endif
1531 yyParser *yypParser = (yyParser*)yyp; /* The parser */
1534
1535 assert( yypParser->yytos!=0 );
1536#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
1537 yyendofinput = (yymajor==0);
1538#endif
1539
1540 yyact = yypParser->yytos->stateno;
1541#ifndef NDEBUG
1542 if( yyTraceFILE ){
1543 if( yyact < YY_MIN_REDUCE ){
1544 fprintf(yyTraceFILE,"%sInput '%s' in state %d\n",
1545 yyTracePrompt,yyTokenName[yymajor],yyact);
1546 }else{
1547 fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
1548 yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE);
1549 }
1550 }
1551#endif
1552
1553 while(1){ /* Exit by "break" */
1554 assert( yypParser->yytos>=yypParser->yystack );
1555 assert( yyact==yypParser->yytos->stateno );
1556 yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact);
1557 if( yyact >= YY_MIN_REDUCE ){
1558 unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */
1559#ifndef NDEBUG
1560 assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) );
1561 if( yyTraceFILE ){
1562 int yysize = yyRuleInfoNRhs[yyruleno];
1563 if( yysize ){
1564 fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
1565 yyTracePrompt,
1566 yyruleno, yyRuleName[yyruleno],
1567 yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action",
1568 yypParser->yytos[yysize].stateno);
1569 }else{
1570 fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n",
1571 yyTracePrompt, yyruleno, yyRuleName[yyruleno],
1572 yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action");
1573 }
1574 }
1575#endif /* NDEBUG */
1576
1577 /* Check that the stack is large enough to grow by a single entry
1578 ** if the RHS of the rule is empty. This ensures that there is room
1579 ** enough on the stack to push the LHS value */
1580 if( yyRuleInfoNRhs[yyruleno]==0 ){
1581#ifdef YYTRACKMAXSTACKDEPTH
1582 if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
1583 yypParser->yyhwm++;
1584 assert( yypParser->yyhwm ==
1585 (int)(yypParser->yytos - yypParser->yystack));
1586 }
1587#endif
1588#if YYSTACKDEPTH>0
1589 if( yypParser->yytos>=yypParser->yystackEnd ){
1590 yyStackOverflow(yypParser);
1591 break;
1592 }
1593#else
1594 if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
1595 if( yyGrowStack(yypParser) ){
1596 yyStackOverflow(yypParser);
1597 break;
1598 }
1599 }
1600#endif
1601 }
1602 yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor TTLParseCTX_PARAM);
1603 }else if( yyact <= YY_MAX_SHIFTREDUCE ){
1604 yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor);
1605#ifndef YYNOERRORRECOVERY
1606 yypParser->yyerrcnt--;
1607#endif
1608 break;
1609 }else if( yyact==YY_ACCEPT_ACTION ){
1610 yypParser->yytos--;
1611 yy_accept(yypParser);
1612 return;
1613 }else{
1614 assert( yyact == YY_ERROR_ACTION );
1615 yyminorunion.yy0 = yyminor;
1616#ifdef YYERRORSYMBOL
1617 int yymx;
1618#endif
1619#ifndef NDEBUG
1620 if( yyTraceFILE ){
1621 fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
1622 }
1623#endif
1624#ifdef YYERRORSYMBOL
1625 /* A syntax error has occurred.
1626 ** The response to an error depends upon whether or not the
1627 ** grammar defines an error token "ERROR".
1628 **
1629 ** This is what we do if the grammar does define ERROR:
1630 **
1631 ** * Call the %syntax_error function.
1632 **
1633 ** * Begin popping the stack until we enter a state where
1634 ** it is legal to shift the error symbol, then shift
1635 ** the error symbol.
1636 **
1637 ** * Set the error count to three.
1638 **
1639 ** * Begin accepting and shifting new tokens. No new error
1640 ** processing will occur until three tokens have been
1641 ** shifted successfully.
1642 **
1643 */
1644 if( yypParser->yyerrcnt<0 ){
1645 yy_syntax_error(yypParser,yymajor,yyminor);
1646 }
1647 yymx = yypParser->yytos->major;
1648 if( yymx==YYERRORSYMBOL || yyerrorhit ){
1649#ifndef NDEBUG
1650 if( yyTraceFILE ){
1651 fprintf(yyTraceFILE,"%sDiscard input token %s\n",
1652 yyTracePrompt,yyTokenName[yymajor]);
1653 }
1654#endif
1655 yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
1656 yymajor = YYNOCODE;
1657 }else{
1658 while( yypParser->yytos > yypParser->yystack ){
1659 yyact = yy_find_reduce_action(yypParser->yytos->stateno,
1660 YYERRORSYMBOL);
1661 if( yyact<=YY_MAX_SHIFTREDUCE ) break;
1662 yy_pop_parser_stack(yypParser);
1663 }
1664 if( yypParser->yytos <= yypParser->yystack || yymajor==0 ){
1665 yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
1666 yy_parse_failed(yypParser);
1667#ifndef YYNOERRORRECOVERY
1668 yypParser->yyerrcnt = -1;
1669#endif
1670 yymajor = YYNOCODE;
1671 }else if( yymx!=YYERRORSYMBOL ){
1672 yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor);
1673 }
1674 }
1675 yypParser->yyerrcnt = 3;
1676 yyerrorhit = 1;
1677 if( yymajor==YYNOCODE ) break;
1678 yyact = yypParser->yytos->stateno;
1679#elif defined(YYNOERRORRECOVERY)
1680 /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
1681 ** do any kind of error recovery. Instead, simply invoke the syntax
1682 ** error routine and continue going as if nothing had happened.
1683 **
1684 ** Applications can set this macro (for example inside %include) if
1685 ** they intend to abandon the parse upon the first syntax error seen.
1686 */
1687 yy_syntax_error(yypParser,yymajor, yyminor);
1688 yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
1689 break;
1690#else /* YYERRORSYMBOL is not defined */
1691 /* This is what we do if the grammar does not define ERROR:
1692 **
1693 ** * Report an error message, and throw away the input token.
1694 **
1695 ** * If the input token is $, then fail the parse.
1696 **
1697 ** As before, subsequent error messages are suppressed until
1698 ** three input tokens have been successfully shifted.
1699 */
1700 if( yypParser->yyerrcnt<=0 ){
1701 yy_syntax_error(yypParser,yymajor, yyminor);
1702 }
1703 yypParser->yyerrcnt = 3;
1704 yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
1705 if( yyendofinput ){
1706 yy_parse_failed(yypParser);
1707#ifndef YYNOERRORRECOVERY
1708 yypParser->yyerrcnt = -1;
1709#endif
1710 }
1711 break;
1712#endif
1713 }
1714 }
1715#ifndef NDEBUG
1716 if( yyTraceFILE ){
1717 yyStackEntry *i;
1718 char cDiv = '[';
1719 fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
1720 for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){
1721 fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]);
1722 cDiv = ' ';
1723 }
1724 fprintf(yyTraceFILE,"]\n");
1725 }
1726#endif
1727 return;
1728}
1729
1730/*
1731** Return the fallback token corresponding to canonical token iToken, or
1732** 0 if iToken has no fallback.
1733*/
1734int TTLParseFallback(int iToken){
1735#ifdef YYFALLBACK
1736 assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) );
1737 return yyFallback[iToken];
1738#else
1739 (void)iToken;
1740 return 0;
1741#endif
1742}
#define YYCODETYPE
Definition grammar_nt.c:82
#define YYACTIONTYPE
Definition grammar_nt.c:84
#define YYNOCODE
Definition grammar_nt.c:83
#define YY_MIN_SHIFTREDUCE
Definition grammar_nt.c:111
#define YY_ERROR_ACTION
Definition grammar_nt.c:113
#define YY_NLOOKAHEAD
Definition grammar_nt.c:119
#define YYNSTATE
Definition grammar_nt.c:106
#define YY_ACTTAB_COUNT
Definition grammar_nt.c:184
#define YY_MIN_REDUCE
Definition grammar_nt.c:116
#define YYMALLOCARGTYPE
Definition grammar_nt.c:401
#define YY_MAX_SHIFT
Definition grammar_nt.c:110
#define YY_SHIFT_COUNT
Definition grammar_nt.c:197
#define YY_REDUCE_COUNT
Definition grammar_nt.c:204
#define YY_ACCEPT_ACTION
Definition grammar_nt.c:114
#define YYNTOKEN
Definition grammar_nt.c:109
#define YY_MAX_SHIFTREDUCE
Definition grammar_nt.c:112
#define YYSTACKDEPTH
Definition grammar_nt.c:94
#define YYNRULE_WITH_ACTION
Definition grammar_nt.c:108
void TTLParseFinalize(void *p)
#define TTLParseCTX_STORE
int TTLParseFallback(int iToken)
#define TTLParseARG_PDECL
#define YYCODETYPE
#define TTLParseTOKENTYPE
#define TTLParseCTX_PDECL
void TTLParseTrace(FILE *TraceFILE, char *zTracePrompt)
#define YYACTIONTYPE
#define TTLParseCTX_FETCH
#define TTLParseCTX_SDECL
#define yytestcase(X)
#define TTLParseARG_FETCH
void TTLParseInit(void *yypRawParser TTLParseCTX_PDECL)
#define TTLParseCTX_PARAM
#define YYSTACKDEPTH
#define TTLParseARG_SDECL
#define TTLParseARG_STORE
size_t VOLK_graph_add_link_map(VOLK_GraphIterator *it, VOLK_LinkMap *lm)
Add triples for a term and related link map to a graph.
Definition graph.c:812
VOLK_Term * VOLK_bnode_add_collection(VOLK_GraphIterator *it, VOLK_TermSet *ts)
Add triples for an anonymous collection to a graph.
Definition graph.c:831
VOLK_rc VOLK_nsmap_add(const char *pfx, const char *nsstr)
Add a prefix -> namespace pair to the map or update it.
Definition namespace.c:42
#define LOG_TRACE(...)
Definition core.h:276
#define VOLK_MEM_ERR
Memory allocation error.
Definition core.h:144
#define VOLK_OK
Generic success return code.
Definition core.h:83
#define VOLK_NOACTION
No action taken.
Definition core.h:93
#define VOLK_PARSE_ERR
Codec parser error.
Definition core.h:126
VOLK_Term * VOLK_lt_literal_new(const char *data, char *lang)
Shortcut to create a language-tagged literal term.
Definition term.h:317
VOLK_rc VOLK_term_set_add(VOLK_TermSet *ts, VOLK_Term *term, VOLK_Term **existing)
Add term to a term set.
Definition term.c:562
struct hashmap VOLK_TermSet
a set of unique terms.
Definition term.h:124
VOLK_Term * VOLK_iriref_new(const char *data)
Create an IRI reference.
Definition term.h:192
VOLK_Term * VOLK_iriref_new_abs(const VOLK_Term *root, const VOLK_Term *iri)
Create a new absolute IRI from a path relative to a root IRI.
Definition term.c:231
VOLK_Term * VOLK_literal_new(const char *data, VOLK_Term *datatype)
Shortcut to create a literal term.
Definition term.h:266
VOLK_LinkMap * VOLK_link_map_new(const VOLK_Term *linked_term, VOLK_LinkType type)
New link map.
Definition term.c:617
VOLK_Term * VOLK_bnode_new(const char *data)
Shortcut to create a blank node.
Definition term.h:331
VOLK_TermSet * VOLK_term_set_new()
Create a new term set.
Definition term.c:549
void VOLK_term_set_free(VOLK_TermSet *ts)
Free a term set.
Definition term.c:604
void VOLK_link_map_free(VOLK_LinkMap *lm)
Free a link map.
Definition term.c:637
VOLK_Term * VOLK_iriref_new_ns(const char *data)
Create an IRI reference from a namespace-prefixed string.
Definition term.h:205
void VOLK_term_free(VOLK_Term *term)
Definition term.c:387
VOLK_rc VOLK_link_map_add(VOLK_LinkMap *lmap, VOLK_Term *term, VOLK_TermSet *tset)
Add a term - term set pair to a link map.
Definition term.c:652
@ VOLK_LINK_OUTBOUND
Outbound link (po).
Definition term.h:96
void * TTLParseAlloc()
void TTLParse()
void TTLParseFree()
RDF term.
Definition term.h:62
char * data
URI, literal value, or BNode label.
Definition term.h:63
struct term_t * datatype
Data type IRI for VOLK_TERM_LITERAL.
Definition term.h:65
VOLK_LangTag lang
Lang tag for VOLK_TERM_LT_LITERAL.
Definition term.h:66
yyStackEntry * yytos
Definition grammar_nt.c:263
NTParseARG_SDECL NTParseCTX_SDECL yyStackEntry yystack[YYSTACKDEPTH]
Definition grammar_nt.c:277
yyStackEntry * yystackEnd
Definition grammar_nt.c:278
int yyerrcnt
Definition grammar_nt.c:268
YYMINORTYPE minor
Definition grammar_nt.c:255
YYACTIONTYPE stateno
Definition grammar_nt.c:252
YYCODETYPE major
Definition grammar_nt.c:253
VOLK_Term * yy22
Definition grammar_nt.c:91
VOLK_LinkMap * yy34
VOLK_Term * yy50
NTParseTOKENTYPE yy0
Definition grammar_nt.c:88