Volksdata 1.0b10
RDF library
Loading...
Searching...
No Matches
grammar_nq.c
Go to the documentation of this file.
1/* This file is automatically generated by Lemon from input grammar
2** source file "grammar_nq.y". */
10
12#line 38 "../../build/grammar_nq.c"
13/**************** End of %include directives **********************************/
14/* These constants specify the various numeric values for terminal symbols.
15***************** Begin token definitions *************************************/
16#ifndef T_EOF
17#define T_EOF 1
18#define T_DOT 2
19#define T_IRIREF 3
20#define T_BNODE 4
21#define T_LITERAL 5
22#define T_EOL 6
23#define T_WS 7
24#endif
25/**************** End token definitions ***************************************/
26
27/* The next sections is a series of control #defines.
28** various aspects of the generated parser.
29** YYCODETYPE is the data type used to store the integer codes
30** that represent terminal and non-terminal symbols.
31** "unsigned char" is used if there are fewer than
32** 256 symbols. Larger types otherwise.
33** YYNOCODE is a number of type YYCODETYPE that is not used for
34** any terminal or nonterminal symbol.
35** YYFALLBACK If defined, this indicates that one or more tokens
36** (also known as: "terminal symbols") have fall-back
37** values which should be used if the original symbol
38** would not parse. This permits keywords to sometimes
39** be used as identifiers, for example.
40** YYACTIONTYPE is the data type used for "action codes" - numbers
41** that indicate what to do in response to the next
42** token.
43** NQParseTOKENTYPE is the data type used for minor type for terminal
44** symbols. Background: A "minor type" is a semantic
45** value associated with a terminal or non-terminal
46** symbols. For example, for an "ID" terminal symbol,
47** the minor type might be the name of the identifier.
48** Each non-terminal can have a different minor type.
49** Terminal symbols all have the same minor type, though.
50** This macros defines the minor type for terminal
51** symbols.
52** YYMINORTYPE is the data type used for all minor types.
53** This is typically a union of many types, one of
54** which is NQParseTOKENTYPE. The entry in the union
55** for terminal symbols is called "yy0".
56** YYSTACKDEPTH is the maximum depth of the parser's stack. If
57** zero the stack is dynamically sized using realloc()
58** NQParseARG_SDECL A static variable declaration for the %extra_argument
59** NQParseARG_PDECL A parameter declaration for the %extra_argument
60** NQParseARG_PARAM Code to pass %extra_argument as a subroutine parameter
61** NQParseARG_STORE Code to store %extra_argument into yypParser
62** NQParseARG_FETCH Code to extract %extra_argument from yypParser
63** NQParseCTX_* As NQParseARG_ except for %extra_context
64** YYERRORSYMBOL is the code number of the error symbol. If not
65** defined, then do no error processing.
66** YYNSTATE the combined number of states.
67** YYNRULE the number of rules in the grammar
68** YYNTOKEN Number of terminal symbols
69** YY_MAX_SHIFT Maximum value for shift actions
70** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions
71** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions
72** YY_ERROR_ACTION The yy_action[] code for syntax error
73** YY_ACCEPT_ACTION The yy_action[] code for accept
74** YY_NO_ACTION The yy_action[] code for no-op
75** YY_MIN_REDUCE Minimum value for reduce actions
76** YY_MAX_REDUCE Maximum value for reduce actions
77*/
78#ifndef INTERFACE
79# define INTERFACE 1
80#endif
81/************* Begin control #defines *****************************************/
82#define YYCODETYPE unsigned char
83#define YYNOCODE 18
84#define YYACTIONTYPE unsigned char
85#define NQParseTOKENTYPE VOLK_Term *
93#ifndef YYSTACKDEPTH
94#define YYSTACKDEPTH 100
95#endif
96#define NQParseARG_SDECL NQParserState *state ;
97#define NQParseARG_PDECL , NQParserState *state
98#define NQParseARG_PARAM ,state
99#define NQParseARG_FETCH NQParserState *state =yypParser->state ;
100#define NQParseARG_STORE yypParser->state =state ;
101#define NQParseCTX_SDECL
102#define NQParseCTX_PDECL
103#define NQParseCTX_PARAM
104#define NQParseCTX_FETCH
105#define NQParseCTX_STORE
106#define YYNSTATE 16
107#define YYNRULE 19
108#define YYNRULE_WITH_ACTION 3
109#define YYNTOKEN 8
110#define YY_MAX_SHIFT 15
111#define YY_MIN_SHIFTREDUCE 30
112#define YY_MAX_SHIFTREDUCE 48
113#define YY_ERROR_ACTION 49
114#define YY_ACCEPT_ACTION 50
115#define YY_NO_ACTION 51
116#define YY_MIN_REDUCE 52
117#define YY_MAX_REDUCE 70
118/************* End control #defines *******************************************/
119#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
120
121/* Define the yytestcase() macro to be a no-op if is not already defined
122** otherwise.
123**
124** Applications can choose to define yytestcase() in the %include section
125** to a macro that can assist in verifying code coverage. For production
126** code the yytestcase() macro should be turned off. But it is useful
127** for testing.
128*/
129#ifndef yytestcase
130# define yytestcase(X)
131#endif
132
133
134/* Next are the tables used to determine what action to take based on the
135** current state and lookahead token. These tables are used to implement
136** functions that take a state number and lookahead value and return an
137** action integer.
138**
139** Suppose the action integer is N. Then the action is determined as
140** follows
141**
142** 0 <= N <= YY_MAX_SHIFT Shift N. That is, push the lookahead
143** token onto the stack and goto state N.
144**
145** N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then
146** and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE.
147**
148** N == YY_ERROR_ACTION A syntax error has occurred.
149**
150** N == YY_ACCEPT_ACTION The parser accepts its input.
151**
152** N == YY_NO_ACTION No such action. Denotes unused
153** slots in the yy_action[] table.
154**
155** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE
156** and YY_MAX_REDUCE
157**
158** The action table is constructed as a single large table named yy_action[].
159** Given state S and lookahead X, the action is computed as either:
160**
161** (A) N = yy_action[ yy_shift_ofst[S] + X ]
162** (B) N = yy_default[S]
163**
164** The (A) formula is preferred. The B formula is used instead if
165** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X.
166**
167** The formulas above are for computing the action when the lookahead is
168** a terminal symbol. If the lookahead is a non-terminal (as occurs after
169** a reduce action) then the yy_reduce_ofst[] array is used in place of
170** the yy_shift_ofst[] array.
171**
172** The following are the tables generated in this section:
173**
174** yy_action[] A single table containing all actions.
175** yy_lookahead[] A table containing the lookahead for each entry in
176** yy_action. Used to detect hash collisions.
177** yy_shift_ofst[] For each state, the offset into yy_action for
178** shifting terminals.
179** yy_reduce_ofst[] For each state, the offset into yy_action for
180** shifting non-terminals after a reduce.
181** yy_default[] Default action for each state.
182**
183*********** Begin parsing tables **********************************************/
184#define YY_ACTTAB_COUNT (36)
185static const YYACTIONTYPE yy_action[] = {
186 /* 0 */ 50, 1, 12, 5, 9, 4, 10, 9, 4, 40,
187 /* 10 */ 41, 42, 30, 43, 44, 45, 48, 15, 37, 38,
188 /* 20 */ 54, 13, 11, 48, 45, 39, 8, 48, 31, 6,
189 /* 30 */ 2, 46, 7, 14, 3, 55,
190};
191static const YYCODETYPE yy_lookahead[] = {
192 /* 0 */ 8, 9, 10, 11, 12, 13, 11, 12, 13, 3,
193 /* 10 */ 4, 5, 2, 3, 4, 6, 7, 1, 3, 4,
194 /* 20 */ 17, 14, 10, 7, 6, 3, 15, 7, 2, 16,
195 /* 30 */ 13, 6, 13, 10, 13, 0, 18, 18, 18, 18,
196 /* 40 */ 18, 18, 18, 18,
197};
198#define YY_SHIFT_COUNT (15)
199#define YY_SHIFT_MIN (0)
200#define YY_SHIFT_MAX (35)
201static const unsigned char yy_shift_ofst[] = {
202 /* 0 */ 9, 16, 6, 10, 15, 18, 20, 22, 20, 20,
203 /* 10 */ 18, 25, 25, 26, 25, 35,
204};
205#define YY_REDUCE_COUNT (10)
206#define YY_REDUCE_MIN (-8)
207#define YY_REDUCE_MAX (23)
208static const signed char yy_reduce_ofst[] = {
209 /* 0 */ -8, -5, 3, 7, 11, 12, 17, 13, 19, 21,
210 /* 10 */ 23,
211};
212static const YYACTIONTYPE yy_default[] = {
213 /* 0 */ 69, 69, 49, 49, 49, 49, 69, 49, 69, 69,
214 /* 10 */ 49, 57, 56, 49, 58, 49,
215};
216/********** End of lemon-generated parsing tables *****************************/
217
218/* The next table maps tokens (terminal symbols) into fallback tokens.
219** If a construct like the following:
220**
221** %fallback ID X Y Z.
222**
223** appears in the grammar, then ID becomes a fallback token for X, Y,
224** and Z. Whenever one of the tokens X, Y, or Z is input to the parser
225** but it does not parse, the type of the token is changed to ID and
226** the parse is retried before an error is thrown.
227**
228** This feature can be used, for example, to cause some keywords in a language
229** to revert to identifiers if they keyword does not apply in the context where
230** it appears.
231*/
232#ifdef YYFALLBACK
233static const YYCODETYPE yyFallback[] = {
234};
235#endif /* YYFALLBACK */
236
237/* The following structure represents a single element of the
238** parser's stack. Information stored includes:
239**
240** + The state number for the parser at this level of the stack.
241**
242** + The value of the token stored at this level of the stack.
243** (In other words, the "major" token.)
244**
245** + The semantic value stored at this level of the stack. This is
246** the information used by the action routines in the grammar.
247** It is sometimes called the "minor" token.
248**
249** After the "shift" half of a SHIFTREDUCE action, the stateno field
250** actually contains the reduce action for the second half of the
251** SHIFTREDUCE.
252*/
254 YYACTIONTYPE stateno; /* The state-number, or reduce action in SHIFTREDUCE */
255 YYCODETYPE major; /* The major token value. This is the code
256 ** number for the token at this stack level */
257 YYMINORTYPE minor; /* The user-supplied minor token value. This
258 ** is the value of the token */
259};
260typedef struct yyStackEntry yyStackEntry;
261
262/* The state of the parser is completely contained in an instance of
263** the following structure */
264struct yyParser {
265 yyStackEntry *yytos; /* Pointer to top element of the stack */
266#ifdef YYTRACKMAXSTACKDEPTH
267 int yyhwm; /* High-water mark of the stack */
268#endif
269#ifndef YYNOERRORRECOVERY
270 int yyerrcnt; /* Shifts left before out of the error */
271#endif
272 NQParseARG_SDECL /* A place to hold %extra_argument */
273 NQParseCTX_SDECL /* A place to hold %extra_context */
274#if YYSTACKDEPTH<=0
275 int yystksz; /* Current side of the stack */
276 yyStackEntry *yystack; /* The parser's stack */
277 yyStackEntry yystk0; /* First stack entry */
278#else
279 yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
280 yyStackEntry *yystackEnd; /* Last entry in the stack */
281#endif
282};
283typedef struct yyParser yyParser;
284
285#include <assert.h>
286#ifndef NDEBUG
287#include <stdio.h>
288static FILE *yyTraceFILE = 0;
289static char *yyTracePrompt = 0;
290#endif /* NDEBUG */
291
292#ifndef NDEBUG
293/*
294** Turn parser tracing on by giving a stream to which to write the trace
295** and a prompt to preface each trace message. Tracing is turned off
296** by making either argument NULL
297**
298** Inputs:
299** <ul>
300** <li> A FILE* to which trace output should be written.
301** If NULL, then tracing is turned off.
302** <li> A prefix string written at the beginning of every
303** line of trace output. If NULL, then tracing is
304** turned off.
305** </ul>
306**
307** Outputs:
308** None.
309*/
310void NQParseTrace(FILE *TraceFILE, char *zTracePrompt){
311 yyTraceFILE = TraceFILE;
312 yyTracePrompt = zTracePrompt;
313 if( yyTraceFILE==0 ) yyTracePrompt = 0;
314 else if( yyTracePrompt==0 ) yyTraceFILE = 0;
315}
316#endif /* NDEBUG */
317
318#if defined(YYCOVERAGE) || !defined(NDEBUG)
319/* For tracing shifts, the names of all terminals and nonterminals
320** are required. The following table supplies these names */
321static const char *const yyTokenName[] = {
322 /* 0 */ "$",
323 /* 1 */ "EOF",
324 /* 2 */ "DOT",
325 /* 3 */ "IRIREF",
326 /* 4 */ "BNODE",
327 /* 5 */ "LITERAL",
328 /* 6 */ "EOL",
329 /* 7 */ "WS",
330 /* 8 */ "nquadsDoc",
331 /* 9 */ "statements",
332 /* 10 */ "eol",
333 /* 11 */ "statement",
334 /* 12 */ "triple",
335 /* 13 */ "ws",
336 /* 14 */ "graphLabel",
337 /* 15 */ "subject",
338 /* 16 */ "predicate",
339 /* 17 */ "object",
340};
341#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
342
343#ifndef NDEBUG
344/* For tracing reduce actions, the names of all rules are required.
345*/
346static const char *const yyRuleName[] = {
347 /* 0 */ "statement ::= triple ws DOT",
348 /* 1 */ "statement ::= triple ws graphLabel DOT",
349 /* 2 */ "triple ::= ws subject ws predicate ws object",
350 /* 3 */ "nquadsDoc ::= statements EOF",
351 /* 4 */ "statements ::= eol",
352 /* 5 */ "statements ::= statement eol",
353 /* 6 */ "statements ::= statements statement eol",
354 /* 7 */ "subject ::= IRIREF",
355 /* 8 */ "subject ::= BNODE",
356 /* 9 */ "predicate ::= IRIREF",
357 /* 10 */ "object ::= IRIREF",
358 /* 11 */ "object ::= BNODE",
359 /* 12 */ "object ::= LITERAL",
360 /* 13 */ "graphLabel ::= IRIREF",
361 /* 14 */ "graphLabel ::= BNODE",
362 /* 15 */ "eol ::= EOL",
363 /* 16 */ "eol ::= eol EOL",
364 /* 17 */ "ws ::=",
365 /* 18 */ "ws ::= WS",
366};
367#endif /* NDEBUG */
368
369
370#if YYSTACKDEPTH<=0
371/*
372** Try to increase the size of the parser stack. Return the number
373** of errors. Return 0 on success.
374*/
375static int yyGrowStack(yyParser *p){
376 int newSize;
377 int idx;
378 yyStackEntry *pNew;
379
380 newSize = p->yystksz*2 + 100;
381 idx = p->yytos ? (int)(p->yytos - p->yystack) : 0;
382 if( p->yystack==&p->yystk0 ){
383 pNew = malloc(newSize*sizeof(pNew[0]));
384 if( pNew ) pNew[0] = p->yystk0;
385 }else{
386 pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
387 }
388 if( pNew ){
389 p->yystack = pNew;
390 p->yytos = &p->yystack[idx];
391#ifndef NDEBUG
392 if( yyTraceFILE ){
393 fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
394 yyTracePrompt, p->yystksz, newSize);
395 }
396#endif
397 p->yystksz = newSize;
398 }
399 return pNew==0;
400}
401#endif
402
403/* Datatype of the argument to the memory allocated passed as the
404** second argument to NQParseAlloc() below. This can be changed by
405** putting an appropriate #define in the %include section of the input
406** grammar.
407*/
408#ifndef YYMALLOCARGTYPE
409# define YYMALLOCARGTYPE size_t
410#endif
411
412/* Initialize a new parser that has already been allocated.
413*/
414void NQParseInit(void *yypRawParser NQParseCTX_PDECL){
415 yyParser *yypParser = (yyParser*)yypRawParser;
417#ifdef YYTRACKMAXSTACKDEPTH
418 yypParser->yyhwm = 0;
419#endif
420#if YYSTACKDEPTH<=0
421 yypParser->yytos = NULL;
422 yypParser->yystack = NULL;
423 yypParser->yystksz = 0;
424 if( yyGrowStack(yypParser) ){
425 yypParser->yystack = &yypParser->yystk0;
426 yypParser->yystksz = 1;
427 }
428#endif
429#ifndef YYNOERRORRECOVERY
430 yypParser->yyerrcnt = -1;
431#endif
432 yypParser->yytos = yypParser->yystack;
433 yypParser->yystack[0].stateno = 0;
434 yypParser->yystack[0].major = 0;
435#if YYSTACKDEPTH>0
436 yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1];
437#endif
438}
439
440#ifndef NQParse_ENGINEALWAYSONSTACK
441/*
442** This function allocates a new parser.
443** The only argument is a pointer to a function which works like
444** malloc.
445**
446** Inputs:
447** A pointer to the function used to allocate memory.
448**
449** Outputs:
450** A pointer to a parser. This pointer is used in subsequent calls
451** to NQParse and NQParseFree.
452*/
454 yyParser *yypParser;
455 yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
456 if( yypParser ){
458 NQParseInit(yypParser NQParseCTX_PARAM);
459 }
460 return (void*)yypParser;
461}
462#endif /* NQParse_ENGINEALWAYSONSTACK */
463
464
465/* The following function deletes the "minor type" or semantic value
466** associated with a symbol. The symbol can be either a terminal
467** or nonterminal. "yymajor" is the symbol code, and "yypminor" is
468** a pointer to the value to be deleted. The code used to do the
469** deletions is derived from the %destructor and/or %token_destructor
470** directives of the input grammar.
471*/
472static void yy_destructor(
473 yyParser *yypParser, /* The parser */
474 YYCODETYPE yymajor, /* Type code for object to destroy */
475 YYMINORTYPE *yypminor /* The object to be destroyed */
476){
479 switch( yymajor ){
480 /* Here is inserted the actions which take place when a
481 ** terminal or non-terminal is destroyed. This can happen
482 ** when the symbol is popped from the stack during a
483 ** reduce or during error processing or when a parser is
484 ** being destroyed before it is finished parsing.
485 **
486 ** Note: during a reduce, the only symbols destroyed are those
487 ** which appear on the RHS of the rule, but which are *not* used
488 ** inside the C code.
489 */
490/********* Begin destructor definitions ***************************************/
491 case 12: /* triple */
492{
493#line 54 "grammar_nq.y"
494 VOLK_triple_free ((yypminor->yy22));
495#line 520 "../../build/grammar_nq.c"
496}
497 break;
498 case 14: /* graphLabel */
499 case 15: /* subject */
500 case 16: /* predicate */
501 case 17: /* object */
502{
503#line 75 "grammar_nq.y"
504 (void)state; VOLK_term_free ((yypminor->yy2));
505#line 530 "../../build/grammar_nq.c"
506}
507 break;
508/********* End destructor definitions *****************************************/
509 default: break; /* If no destructor action specified: do nothing */
510 }
511}
512
513/*
514** Pop the parser's stack once.
515**
516** If there is a destructor routine associated with the token which
517** is popped from the stack, then call it.
518*/
519static void yy_pop_parser_stack(yyParser *pParser){
521 assert( pParser->yytos!=0 );
522 assert( pParser->yytos > pParser->yystack );
523 yytos = pParser->yytos--;
524#ifndef NDEBUG
525 if( yyTraceFILE ){
526 fprintf(yyTraceFILE,"%sPopping %s\n",
527 yyTracePrompt,
528 yyTokenName[yytos->major]);
529 }
530#endif
531 yy_destructor(pParser, yytos->major, &yytos->minor);
532}
533
534/*
535** Clear all secondary memory allocations from the parser
536*/
537void NQParseFinalize(void *p){
538 yyParser *pParser = (yyParser*)p;
539 while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser);
540#if YYSTACKDEPTH<=0
541 if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack);
542#endif
543}
544
545#ifndef NQParse_ENGINEALWAYSONSTACK
546/*
547** Deallocate and destroy a parser. Destructors are called for
548** all stack elements before shutting the parser down.
549**
550** If the YYPARSEFREENEVERNULL macro exists (for example because it
551** is defined in a %include section of the input grammar) then it is
552** assumed that the input pointer is never NULL.
553*/
555 void *p, /* The parser to be deleted */
556 void (*freeProc)(void*) /* Function used to reclaim memory */
557){
558#ifndef YYPARSEFREENEVERNULL
559 if( p==0 ) return;
560#endif
562 (*freeProc)(p);
563}
564#endif /* NQParse_ENGINEALWAYSONSTACK */
565
566/*
567** Return the peak depth of the stack for a parser.
568*/
569#ifdef YYTRACKMAXSTACKDEPTH
570int NQParseStackPeak(void *p){
571 yyParser *pParser = (yyParser*)p;
572 return pParser->yyhwm;
573}
574#endif
575
576/* This array of booleans keeps track of the parser statement
577** coverage. The element yycoverage[X][Y] is set when the parser
578** is in state X and has a lookahead token Y. In a well-tested
579** systems, every element of this matrix should end up being set.
580*/
581#if defined(YYCOVERAGE)
582static unsigned char yycoverage[YYNSTATE][YYNTOKEN];
583#endif
584
585/*
586** Write into out a description of every state/lookahead combination that
587**
588** (1) has not been used by the parser, and
589** (2) is not a syntax error.
590**
591** Return the number of missed state/lookahead combinations.
592*/
593#if defined(YYCOVERAGE)
594int NQParseCoverage(FILE *out){
595 int stateno, iLookAhead, i;
596 int nMissed = 0;
597 for(stateno=0; stateno<YYNSTATE; stateno++){
598 i = yy_shift_ofst[stateno];
599 for(iLookAhead=0; iLookAhead<YYNTOKEN; iLookAhead++){
600 if( yy_lookahead[i+iLookAhead]!=iLookAhead ) continue;
601 if( yycoverage[stateno][iLookAhead]==0 ) nMissed++;
602 if( out ){
603 fprintf(out,"State %d lookahead %s %s\n", stateno,
604 yyTokenName[iLookAhead],
605 yycoverage[stateno][iLookAhead] ? "ok" : "missed");
606 }
607 }
608 }
609 return nMissed;
610}
611#endif
612
613/*
614** Find the appropriate action for a parser given the terminal
615** look-ahead token iLookAhead.
616*/
617static YYACTIONTYPE yy_find_shift_action(
618 YYCODETYPE iLookAhead, /* The look-ahead token */
619 YYACTIONTYPE stateno /* Current state number */
620){
621 int i;
622
623 if( stateno>YY_MAX_SHIFT ) return stateno;
624 assert( stateno <= YY_SHIFT_COUNT );
625#if defined(YYCOVERAGE)
626 yycoverage[stateno][iLookAhead] = 1;
627#endif
628 do{
629 i = yy_shift_ofst[stateno];
630 assert( i>=0 );
631 assert( i<=YY_ACTTAB_COUNT );
632 assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD );
633 assert( iLookAhead!=YYNOCODE );
634 assert( iLookAhead < YYNTOKEN );
635 i += iLookAhead;
636 assert( i<(int)YY_NLOOKAHEAD );
637 if( yy_lookahead[i]!=iLookAhead ){
638#ifdef YYFALLBACK
639 YYCODETYPE iFallback; /* Fallback token */
640 assert( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0]) );
641 iFallback = yyFallback[iLookAhead];
642 if( iFallback!=0 ){
643#ifndef NDEBUG
644 if( yyTraceFILE ){
645 fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
646 yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
647 }
648#endif
649 assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */
650 iLookAhead = iFallback;
651 continue;
652 }
653#endif
654#ifdef YYWILDCARD
655 {
656 int j = i - iLookAhead + YYWILDCARD;
657 assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) );
658 if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){
659#ifndef NDEBUG
660 if( yyTraceFILE ){
661 fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
662 yyTracePrompt, yyTokenName[iLookAhead],
663 yyTokenName[YYWILDCARD]);
664 }
665#endif /* NDEBUG */
666 return yy_action[j];
667 }
668 }
669#endif /* YYWILDCARD */
670 return yy_default[stateno];
671 }else{
672 assert( i>=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) );
673 return yy_action[i];
674 }
675 }while(1);
676}
677
678/*
679** Find the appropriate action for a parser given the non-terminal
680** look-ahead token iLookAhead.
681*/
682static YYACTIONTYPE yy_find_reduce_action(
683 YYACTIONTYPE stateno, /* Current state number */
684 YYCODETYPE iLookAhead /* The look-ahead token */
685){
686 int i;
687#ifdef YYERRORSYMBOL
688 if( stateno>YY_REDUCE_COUNT ){
689 return yy_default[stateno];
690 }
691#else
692 assert( stateno<=YY_REDUCE_COUNT );
693#endif
694 i = yy_reduce_ofst[stateno];
695 assert( iLookAhead!=YYNOCODE );
696 i += iLookAhead;
697#ifdef YYERRORSYMBOL
698 if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
699 return yy_default[stateno];
700 }
701#else
702 assert( i>=0 && i<YY_ACTTAB_COUNT );
703 assert( yy_lookahead[i]==iLookAhead );
704#endif
705 return yy_action[i];
706}
707
708/*
709** The following routine is called if the stack overflows.
710*/
711static void yyStackOverflow(yyParser *yypParser){
714#ifndef NDEBUG
715 if( yyTraceFILE ){
716 fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
717 }
718#endif
719 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
720 /* Here code is inserted which will execute if the parser
721 ** stack every overflows */
722/******** Begin %stack_overflow code ******************************************/
723/******** End %stack_overflow code ********************************************/
724 NQParseARG_STORE /* Suppress warning about unused %extra_argument var */
726}
727
728/*
729** Print tracing information for a SHIFT action
730*/
731#ifndef NDEBUG
732static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){
733 if( yyTraceFILE ){
734 if( yyNewState<YYNSTATE ){
735 fprintf(yyTraceFILE,"%s%s '%s', go to state %d\n",
736 yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
737 yyNewState);
738 }else{
739 fprintf(yyTraceFILE,"%s%s '%s', pending reduce %d\n",
740 yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
741 yyNewState - YY_MIN_REDUCE);
742 }
743 }
744}
745#else
746# define yyTraceShift(X,Y,Z)
747#endif
748
749/*
750** Perform a shift action.
751*/
752static void yy_shift(
753 yyParser *yypParser, /* The parser to be shifted */
754 YYACTIONTYPE yyNewState, /* The new state to shift in */
755 YYCODETYPE yyMajor, /* The major token to shift in */
756 NQParseTOKENTYPE yyMinor /* The minor token to shift in */
757){
759 yypParser->yytos++;
760#ifdef YYTRACKMAXSTACKDEPTH
761 if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
762 yypParser->yyhwm++;
763 assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) );
764 }
765#endif
766#if YYSTACKDEPTH>0
767 if( yypParser->yytos>yypParser->yystackEnd ){
768 yypParser->yytos--;
769 yyStackOverflow(yypParser);
770 return;
771 }
772#else
773 if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){
774 if( yyGrowStack(yypParser) ){
775 yypParser->yytos--;
776 yyStackOverflow(yypParser);
777 return;
778 }
779 }
780#endif
781 if( yyNewState > YY_MAX_SHIFT ){
782 yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
783 }
784 yytos = yypParser->yytos;
785 yytos->stateno = yyNewState;
786 yytos->major = yyMajor;
787 yytos->minor.yy0 = yyMinor;
788 yyTraceShift(yypParser, yyNewState, "Shift");
789}
790
791/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
792** of that rule */
793static const YYCODETYPE yyRuleInfoLhs[] = {
794 11, /* (0) statement ::= triple ws DOT */
795 11, /* (1) statement ::= triple ws graphLabel DOT */
796 12, /* (2) triple ::= ws subject ws predicate ws object */
797 8, /* (3) nquadsDoc ::= statements EOF */
798 9, /* (4) statements ::= eol */
799 9, /* (5) statements ::= statement eol */
800 9, /* (6) statements ::= statements statement eol */
801 15, /* (7) subject ::= IRIREF */
802 15, /* (8) subject ::= BNODE */
803 16, /* (9) predicate ::= IRIREF */
804 17, /* (10) object ::= IRIREF */
805 17, /* (11) object ::= BNODE */
806 17, /* (12) object ::= LITERAL */
807 14, /* (13) graphLabel ::= IRIREF */
808 14, /* (14) graphLabel ::= BNODE */
809 10, /* (15) eol ::= EOL */
810 10, /* (16) eol ::= eol EOL */
811 13, /* (17) ws ::= */
812 13, /* (18) ws ::= WS */
813};
814
815/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
816** of symbols on the right-hand side of that rule. */
817static const signed char yyRuleInfoNRhs[] = {
818 -3, /* (0) statement ::= triple ws DOT */
819 -4, /* (1) statement ::= triple ws graphLabel DOT */
820 -6, /* (2) triple ::= ws subject ws predicate ws object */
821 -2, /* (3) nquadsDoc ::= statements EOF */
822 -1, /* (4) statements ::= eol */
823 -2, /* (5) statements ::= statement eol */
824 -3, /* (6) statements ::= statements statement eol */
825 -1, /* (7) subject ::= IRIREF */
826 -1, /* (8) subject ::= BNODE */
827 -1, /* (9) predicate ::= IRIREF */
828 -1, /* (10) object ::= IRIREF */
829 -1, /* (11) object ::= BNODE */
830 -1, /* (12) object ::= LITERAL */
831 -1, /* (13) graphLabel ::= IRIREF */
832 -1, /* (14) graphLabel ::= BNODE */
833 -1, /* (15) eol ::= EOL */
834 -2, /* (16) eol ::= eol EOL */
835 0, /* (17) ws ::= */
836 -1, /* (18) ws ::= WS */
837};
838
839static void yy_accept(yyParser*); /* Forward Declaration */
840
841/*
842** Perform a reduce action and the shift that must immediately
843** follow the reduce.
844**
845** The yyLookahead and yyLookaheadToken parameters provide reduce actions
846** access to the lookahead token (if any). The yyLookahead will be YYNOCODE
847** if the lookahead token has already been consumed. As this procedure is
848** only called from one place, optimizing compilers will in-line it, which
849** means that the extra parameters have no performance impact.
850*/
851static YYACTIONTYPE yy_reduce(
852 yyParser *yypParser, /* The parser */
853 unsigned int yyruleno, /* Number of the rule by which to reduce */
854 int yyLookahead, /* Lookahead token, or YYNOCODE if none */
855 NQParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */
856 NQParseCTX_PDECL /* %extra_context */
857){
858 int yygoto; /* The next state */
859 YYACTIONTYPE yyact; /* The next action */
860 yyStackEntry *yymsp; /* The top of the parser's stack */
861 int yysize; /* Amount to pop the stack */
863 (void)yyLookahead;
864 (void)yyLookaheadToken;
865 yymsp = yypParser->yytos;
866
867 switch( yyruleno ){
868 /* Beginning here are the reduction cases. A typical example
869 ** follows:
870 ** case 0:
871 ** #line <lineno> <grammarfile>
872 ** { ... } // User supplied code
873 ** #line <lineno> <thisfile>
874 ** break;
875 */
876/********** Begin reduce actions **********************************************/
877 case 0: /* statement ::= triple ws DOT */
878#line 31 "grammar_nq.y"
879{
880 VOLK_Graph *gr = VOLK_graph_new (
881 state->ds->store, VOLK_default_ctx->data);
883 VOLK_Triple **trp = calloc (2, sizeof *yymsp[-2].minor.yy22);
884 // TODO error handling.
885 trp[0] = yymsp[-2].minor.yy22;
886 VOLK_graph_add_txn (state->txn, gr, trp, NULL);
887 free (trp);
888 VOLK_graph_free (gr);
889 }
890#line 915 "../../build/grammar_nq.c"
891 break;
892 case 1: /* statement ::= triple ws graphLabel DOT */
893#line 42 "grammar_nq.y"
894{
895 VOLK_Graph *gr = VOLK_graph_new (state->ds->store, yymsp[-1].minor.yy2->data);
897 VOLK_Triple **trp = calloc (2, sizeof *yymsp[-3].minor.yy22);
898 // TODO error handling.
899 trp[0] = yymsp[-3].minor.yy22;
900 VOLK_graph_add_txn (state->txn, gr, trp, NULL);
901 free (trp);
902 VOLK_graph_free (gr);
903 }
904#line 929 "../../build/grammar_nq.c"
905 break;
906 case 2: /* triple ::= ws subject ws predicate ws object */
907#line 55 "grammar_nq.y"
908{
909 yymsp[-5].minor.yy22 = VOLK_triple_new (yymsp[-4].minor.yy2, yymsp[-2].minor.yy2, yymsp[0].minor.yy2);
910 }
911#line 936 "../../build/grammar_nq.c"
912 break;
913 default:
914 /* (3) nquadsDoc ::= statements EOF */ yytestcase(yyruleno==3);
915 /* (4) statements ::= eol */ yytestcase(yyruleno==4);
916 /* (5) statements ::= statement eol */ yytestcase(yyruleno==5);
917 /* (6) statements ::= statements statement eol */ yytestcase(yyruleno==6);
918 /* (7) subject ::= IRIREF */ yytestcase(yyruleno==7);
919 /* (8) subject ::= BNODE */ yytestcase(yyruleno==8);
920 /* (9) predicate ::= IRIREF */ yytestcase(yyruleno==9);
921 /* (10) object ::= IRIREF */ yytestcase(yyruleno==10);
922 /* (11) object ::= BNODE */ yytestcase(yyruleno==11);
923 /* (12) object ::= LITERAL */ yytestcase(yyruleno==12);
924 /* (13) graphLabel ::= IRIREF */ yytestcase(yyruleno==13);
925 /* (14) graphLabel ::= BNODE */ yytestcase(yyruleno==14);
926 /* (15) eol ::= EOL */ yytestcase(yyruleno==15);
927 /* (16) eol ::= eol EOL */ yytestcase(yyruleno==16);
928 /* (17) ws ::= */ yytestcase(yyruleno==17);
929 /* (18) ws ::= WS */ yytestcase(yyruleno==18);
930 break;
931/********** End reduce actions ************************************************/
932 };
933 assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
934 yygoto = yyRuleInfoLhs[yyruleno];
935 yysize = yyRuleInfoNRhs[yyruleno];
936 yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto);
937
938 /* There are no SHIFTREDUCE actions on nonterminals because the table
939 ** generator has simplified them to pure REDUCE actions. */
940 assert( !(yyact>YY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) );
941
942 /* It is not possible for a REDUCE to be followed by an error */
943 assert( yyact!=YY_ERROR_ACTION );
944
945 yymsp += yysize+1;
946 yypParser->yytos = yymsp;
947 yymsp->stateno = (YYACTIONTYPE)yyact;
948 yymsp->major = (YYCODETYPE)yygoto;
949 yyTraceShift(yypParser, yyact, "... then shift");
950 return yyact;
951}
952
953/*
954** The following code executes when the parse fails
955*/
956#ifndef YYNOERRORRECOVERY
957static void yy_parse_failed(
958 yyParser *yypParser /* The parser */
959){
962#ifndef NDEBUG
963 if( yyTraceFILE ){
964 fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
965 }
966#endif
967 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
968 /* Here code is inserted which will be executed whenever the
969 ** parser fails */
970/************ Begin %parse_failure code ***************************************/
971/************ End %parse_failure code *****************************************/
972 NQParseARG_STORE /* Suppress warning about unused %extra_argument variable */
974}
975#endif /* YYNOERRORRECOVERY */
976
977/*
978** The following code executes when a syntax error first occurs.
979*/
980static void yy_syntax_error(
981 yyParser *yypParser, /* The parser */
982 int yymajor, /* The major type of the error token */
983 NQParseTOKENTYPE yyminor /* The minor type of the error token */
984){
987#define TOKEN yyminor
988/************ Begin %syntax_error code ****************************************/
989/************ End %syntax_error code ******************************************/
990 NQParseARG_STORE /* Suppress warning about unused %extra_argument variable */
992}
993
994/*
995** The following is executed when the parser accepts
996*/
997static void yy_accept(
998 yyParser *yypParser /* The parser */
999){
1002#ifndef NDEBUG
1003 if( yyTraceFILE ){
1004 fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
1005 }
1006#endif
1007#ifndef YYNOERRORRECOVERY
1008 yypParser->yyerrcnt = -1;
1009#endif
1010 assert( yypParser->yytos==yypParser->yystack );
1011 /* Here code is inserted which will be executed whenever the
1012 ** parser accepts */
1013/*********** Begin %parse_accept code *****************************************/
1014/*********** End %parse_accept code *******************************************/
1015 NQParseARG_STORE /* Suppress warning about unused %extra_argument variable */
1017}
1018
1019/* The main parser program.
1020** The first argument is a pointer to a structure obtained from
1021** "NQParseAlloc" which describes the current state of the parser.
1022** The second argument is the major token number. The third is
1023** the minor token. The fourth optional argument is whatever the
1024** user wants (and specified in the grammar) and is available for
1025** use by the action routines.
1026**
1027** Inputs:
1028** <ul>
1029** <li> A pointer to the parser (an opaque structure.)
1030** <li> The major token number.
1031** <li> The minor token number.
1032** <li> An option argument of a grammar-specified type.
1033** </ul>
1034**
1035** Outputs:
1036** None.
1037*/
1039 void *yyp, /* The parser */
1040 int yymajor, /* The major token code number */
1041 NQParseTOKENTYPE yyminor /* The value for the token */
1042 NQParseARG_PDECL /* Optional %extra_argument parameter */
1043){
1044 YYMINORTYPE yyminorunion;
1045 YYACTIONTYPE yyact; /* The parser action. */
1046#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
1047 int yyendofinput; /* True if we are at the end of input */
1048#endif
1049#ifdef YYERRORSYMBOL
1050 int yyerrorhit = 0; /* True if yymajor has invoked an error */
1051#endif
1052 yyParser *yypParser = (yyParser*)yyp; /* The parser */
1055
1056 assert( yypParser->yytos!=0 );
1057#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
1058 yyendofinput = (yymajor==0);
1059#endif
1060
1061 yyact = yypParser->yytos->stateno;
1062#ifndef NDEBUG
1063 if( yyTraceFILE ){
1064 if( yyact < YY_MIN_REDUCE ){
1065 fprintf(yyTraceFILE,"%sInput '%s' in state %d\n",
1066 yyTracePrompt,yyTokenName[yymajor],yyact);
1067 }else{
1068 fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
1069 yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE);
1070 }
1071 }
1072#endif
1073
1074 while(1){ /* Exit by "break" */
1075 assert( yypParser->yytos>=yypParser->yystack );
1076 assert( yyact==yypParser->yytos->stateno );
1077 yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact);
1078 if( yyact >= YY_MIN_REDUCE ){
1079 unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */
1080#ifndef NDEBUG
1081 assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) );
1082 if( yyTraceFILE ){
1083 int yysize = yyRuleInfoNRhs[yyruleno];
1084 if( yysize ){
1085 fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
1086 yyTracePrompt,
1087 yyruleno, yyRuleName[yyruleno],
1088 yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action",
1089 yypParser->yytos[yysize].stateno);
1090 }else{
1091 fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n",
1092 yyTracePrompt, yyruleno, yyRuleName[yyruleno],
1093 yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action");
1094 }
1095 }
1096#endif /* NDEBUG */
1097
1098 /* Check that the stack is large enough to grow by a single entry
1099 ** if the RHS of the rule is empty. This ensures that there is room
1100 ** enough on the stack to push the LHS value */
1101 if( yyRuleInfoNRhs[yyruleno]==0 ){
1102#ifdef YYTRACKMAXSTACKDEPTH
1103 if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
1104 yypParser->yyhwm++;
1105 assert( yypParser->yyhwm ==
1106 (int)(yypParser->yytos - yypParser->yystack));
1107 }
1108#endif
1109#if YYSTACKDEPTH>0
1110 if( yypParser->yytos>=yypParser->yystackEnd ){
1111 yyStackOverflow(yypParser);
1112 break;
1113 }
1114#else
1115 if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
1116 if( yyGrowStack(yypParser) ){
1117 yyStackOverflow(yypParser);
1118 break;
1119 }
1120 }
1121#endif
1122 }
1123 yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor NQParseCTX_PARAM);
1124 }else if( yyact <= YY_MAX_SHIFTREDUCE ){
1125 yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor);
1126#ifndef YYNOERRORRECOVERY
1127 yypParser->yyerrcnt--;
1128#endif
1129 break;
1130 }else if( yyact==YY_ACCEPT_ACTION ){
1131 yypParser->yytos--;
1132 yy_accept(yypParser);
1133 return;
1134 }else{
1135 assert( yyact == YY_ERROR_ACTION );
1136 yyminorunion.yy0 = yyminor;
1137#ifdef YYERRORSYMBOL
1138 int yymx;
1139#endif
1140#ifndef NDEBUG
1141 if( yyTraceFILE ){
1142 fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
1143 }
1144#endif
1145#ifdef YYERRORSYMBOL
1146 /* A syntax error has occurred.
1147 ** The response to an error depends upon whether or not the
1148 ** grammar defines an error token "ERROR".
1149 **
1150 ** This is what we do if the grammar does define ERROR:
1151 **
1152 ** * Call the %syntax_error function.
1153 **
1154 ** * Begin popping the stack until we enter a state where
1155 ** it is legal to shift the error symbol, then shift
1156 ** the error symbol.
1157 **
1158 ** * Set the error count to three.
1159 **
1160 ** * Begin accepting and shifting new tokens. No new error
1161 ** processing will occur until three tokens have been
1162 ** shifted successfully.
1163 **
1164 */
1165 if( yypParser->yyerrcnt<0 ){
1166 yy_syntax_error(yypParser,yymajor,yyminor);
1167 }
1168 yymx = yypParser->yytos->major;
1169 if( yymx==YYERRORSYMBOL || yyerrorhit ){
1170#ifndef NDEBUG
1171 if( yyTraceFILE ){
1172 fprintf(yyTraceFILE,"%sDiscard input token %s\n",
1173 yyTracePrompt,yyTokenName[yymajor]);
1174 }
1175#endif
1176 yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
1177 yymajor = YYNOCODE;
1178 }else{
1179 while( yypParser->yytos > yypParser->yystack ){
1180 yyact = yy_find_reduce_action(yypParser->yytos->stateno,
1181 YYERRORSYMBOL);
1182 if( yyact<=YY_MAX_SHIFTREDUCE ) break;
1183 yy_pop_parser_stack(yypParser);
1184 }
1185 if( yypParser->yytos <= yypParser->yystack || yymajor==0 ){
1186 yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
1187 yy_parse_failed(yypParser);
1188#ifndef YYNOERRORRECOVERY
1189 yypParser->yyerrcnt = -1;
1190#endif
1191 yymajor = YYNOCODE;
1192 }else if( yymx!=YYERRORSYMBOL ){
1193 yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor);
1194 }
1195 }
1196 yypParser->yyerrcnt = 3;
1197 yyerrorhit = 1;
1198 if( yymajor==YYNOCODE ) break;
1199 yyact = yypParser->yytos->stateno;
1200#elif defined(YYNOERRORRECOVERY)
1201 /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
1202 ** do any kind of error recovery. Instead, simply invoke the syntax
1203 ** error routine and continue going as if nothing had happened.
1204 **
1205 ** Applications can set this macro (for example inside %include) if
1206 ** they intend to abandon the parse upon the first syntax error seen.
1207 */
1208 yy_syntax_error(yypParser,yymajor, yyminor);
1209 yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
1210 break;
1211#else /* YYERRORSYMBOL is not defined */
1212 /* This is what we do if the grammar does not define ERROR:
1213 **
1214 ** * Report an error message, and throw away the input token.
1215 **
1216 ** * If the input token is $, then fail the parse.
1217 **
1218 ** As before, subsequent error messages are suppressed until
1219 ** three input tokens have been successfully shifted.
1220 */
1221 if( yypParser->yyerrcnt<=0 ){
1222 yy_syntax_error(yypParser,yymajor, yyminor);
1223 }
1224 yypParser->yyerrcnt = 3;
1225 yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
1226 if( yyendofinput ){
1227 yy_parse_failed(yypParser);
1228#ifndef YYNOERRORRECOVERY
1229 yypParser->yyerrcnt = -1;
1230#endif
1231 }
1232 break;
1233#endif
1234 }
1235 }
1236#ifndef NDEBUG
1237 if( yyTraceFILE ){
1238 yyStackEntry *i;
1239 char cDiv = '[';
1240 fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
1241 for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){
1242 fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]);
1243 cDiv = ' ';
1244 }
1245 fprintf(yyTraceFILE,"]\n");
1246 }
1247#endif
1248 return;
1249}
1250
1251/*
1252** Return the fallback token corresponding to canonical token iToken, or
1253** 0 if iToken has no fallback.
1254*/
1255int NQParseFallback(int iToken){
1256#ifdef YYFALLBACK
1257 assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) );
1258 return yyFallback[iToken];
1259#else
1260 (void)iToken;
1261 return 0;
1262#endif
1263}
#define NQParseTOKENTYPE
Definition grammar_nq.c:85
void NQParseInit(void *yypRawParser)
Definition grammar_nq.c:414
#define NQParseARG_FETCH
Definition grammar_nq.c:99
#define YYCODETYPE
Definition grammar_nq.c:82
#define NQParseARG_PDECL
Definition grammar_nq.c:97
#define NQParseCTX_PDECL
Definition grammar_nq.c:102
int NQParseFallback(int iToken)
void NQParseTrace(FILE *TraceFILE, char *zTracePrompt)
Definition grammar_nq.c:310
#define NQParseCTX_FETCH
Definition grammar_nq.c:104
#define YYACTIONTYPE
Definition grammar_nq.c:84
#define YYNOCODE
Definition grammar_nq.c:83
#define YY_MIN_SHIFTREDUCE
Definition grammar_nq.c:111
#define YY_ERROR_ACTION
Definition grammar_nq.c:113
#define YY_NLOOKAHEAD
Definition grammar_nq.c:119
#define YYNSTATE
Definition grammar_nq.c:106
#define YY_ACTTAB_COUNT
Definition grammar_nq.c:184
#define YY_MIN_REDUCE
Definition grammar_nq.c:116
#define NQParseCTX_PARAM
Definition grammar_nq.c:103
void NQParseFinalize(void *p)
Definition grammar_nq.c:537
#define YYMALLOCARGTYPE
Definition grammar_nq.c:409
#define YY_MAX_SHIFT
Definition grammar_nq.c:110
#define YY_SHIFT_COUNT
Definition grammar_nq.c:198
#define YY_REDUCE_COUNT
Definition grammar_nq.c:205
#define YY_ACCEPT_ACTION
Definition grammar_nq.c:114
#define yytestcase(X)
Definition grammar_nq.c:130
#define YYNTOKEN
Definition grammar_nq.c:109
#define NQParseARG_STORE
Definition grammar_nq.c:100
#define YY_MAX_SHIFTREDUCE
Definition grammar_nq.c:112
#define NQParseARG_SDECL
Definition grammar_nq.c:96
#define NQParseCTX_STORE
Definition grammar_nq.c:105
#define YYSTACKDEPTH
Definition grammar_nq.c:94
#define NQParseCTX_SDECL
Definition grammar_nq.c:101
#define YYNRULE_WITH_ACTION
Definition grammar_nq.c:108
#define YYCODETYPE
#define YYACTIONTYPE
#define YYSTACKDEPTH
VOLK_rc VOLK_dataset_add(VOLK_Dataset *ds, const VOLK_Graph *gr)
Add graphs to the dataset.
Definition dataset.h:82
VOLK_Triple * VOLK_triple_new(VOLK_Term *s, VOLK_Term *p, VOLK_Term *o)
Create a new triple from three terms.
Definition term.c:455
void VOLK_term_free(VOLK_Term *term)
Definition term.c:392
VOLK_Term * VOLK_default_ctx
Default context.
Definition term.c:59
void VOLK_triple_free(VOLK_Triple *spo)
Free a triple and all its internal pointers.
Definition term.c:531
void VOLK_graph_free(VOLK_Graph *gr)
Free a graph.
Definition graph.c:263
VOLK_rc VOLK_graph_add_txn(void *txn, VOLK_Graph *gr, VOLK_Triple *const *trp, size_t *ct)
Add triples to a graph.
Definition graph.c:484
VOLK_Graph * VOLK_graph_new(VOLK_Store *store, const char *uri_str)
Create new graph.
Definition graph.c:45
void * NQParseAlloc()
void NQParseFree()
void NQParse()
VOLK_Dataset * ds
Dataset to write to.
Definition parser_nq.h:14
VOLK_Store * store
Definition dataset.h:27
void * data
Opaque back end data.
Definition store.h:68
RDF term.
Definition term.h:61
RDF triple.
Definition term.h:85
yyStackEntry * yytos
Definition grammar_nq.c:265
yyStackEntry * yystackEnd
Definition grammar_nq.c:280
int yyerrcnt
Definition grammar_nq.c:270
NQParserState * state
Definition grammar_nq.c:272
yyStackEntry yystack[100]
Definition grammar_nq.c:279
YYMINORTYPE minor
Definition grammar_nq.c:257
unsigned char stateno
Definition grammar_nq.c:254
unsigned char major
Definition grammar_nq.c:255
VOLK_Term * yy2
Definition grammar_nq.c:89
void * yy25
Definition grammar_nq.c:91
VOLK_Triple * yy22
Definition grammar_nq.c:90
VOLK_Term * yy0
Definition grammar_nq.c:88