Volksdata 1.0b7
RDF library
Loading...
Searching...
No Matches
parser_nt.c
Go to the documentation of this file.
1/* Generated by re2c 4.5.1 on Fri Apr 24 21:46:29 2026 */
2#line 1 "lexer_nt.re"
5
6#line 1 "../../include/volksdata/codec/parser_common.h"
12#ifndef VOLK_PARSER_COMMON_H
13#define VOLK_PARSER_COMMON_H
14
16
17
25#define YYCTYPE uint8_t
26#define YYCURSOR it->cur
27#define YYMARKER it->mar
28#define YYLIMIT it->lim
29#define YYFILL fill(it) == 0
30
31
32typedef struct parse_it_t {
33 FILE * fh;
34 const char * sh;
35 size_t buf_size;
37 * lim,
39 * cur,
40 * mar,
41 * tok,
42 * bol;
44 unsigned line;
45 unsigned ct;
46 bool eof;
47
48#line 49 "parser_nt.c"
50#line 41 "../../include/volksdata/codec/parser_common.h"
51
53
54
55static inline void newline (ParseIterator *it) {
56 it->line ++;
57 it->bol = YYCURSOR;
58 log_trace ("New line: #%u.", it->line);
59}
60
61
62static int fill(ParseIterator *it);
63
64
74static void parse_init (ParseIterator *it, FILE *fh, const char *sh)
75{
76 if(fh) {
77 // Stream handling. It engages YYFILL and reads by chunks.
78 it->fh = fh;
79 it->sh = NULL;
80 it->buf_size = CHUNK_SIZE;
81 it->buf = malloc(it->buf_size);
82 if (!it->buf) log_error ("Error allocating lexer buffer.");
83 it->cur = it->mar = it->tok = it->lim = it->buf + it->buf_size - 1;
84 it->bol = it->buf;
85 it->eof = false;
86 it->lim[0] = 0;
87 } else {
88 // String handling. Uses the provided string as the buffer.
89 it->fh = NULL;
90 it->sh = sh;
91 it->buf_size = strlen(sh) + 1;
92 it->buf = NULL;
93 it->cur = it->tok = (YYCTYPE*)it->sh;
94 it->lim = it->mar = it->cur + it->buf_size - 1;
95 it->bol = it->cur;
96 it->eof = true;
97 }
98 it->line = 1;
99 it->ct = 0;
100
101#line 102 "parser_nt.c"
102it->yyt1 = NULL; it->yyt2 = NULL; it->yyt3 = NULL;
103#line 90 "../../include/volksdata/codec/parser_common.h"
104
105}
106
107
108int
109fill(ParseIterator *it)
110{
111 log_debug ("Filling codec buffer @ %p.", it->buf);
112 if (it->eof) return 1;
113
114 size_t shift = it->tok - it->buf;
115 size_t used = it->lim - it->tok;
116
117 // If buffer is too small for the lexeme, double the capacity.
118 if (shift < 1) {
119 shift += it->buf_size;
120 it->buf_size *= 2;
121 // Store offsets to reapply to moved buffer.
122 size_t
123 cur_off = it->cur - it->buf,
124 tok_off = it->tok - it->buf,
125 lim_off = it->lim - it->buf,
126 mar_off = it->mar - it->buf;
127
128 log_debug ("Reallocating buffer to %zu bytes.", it->buf_size);
129 YYCTYPE *tmp = realloc (it->buf, it->buf_size);
130 if (!tmp) {
131 log_error ("Memory allocation error.");
132 return -1;
133 }
134 it->buf = tmp;
135 // Move all relative points if address changed.
136 it->cur = it->buf + cur_off;
137 it->tok = it->buf + tok_off;
138 it->lim = it->buf + lim_off;
139 it->mar = it->buf + mar_off;
140 } else {
141 log_debug ("Shifting bytes: %zu", shift);
142 memmove (it->buf, it->tok, used);
143 log_trace ("Limit offset before reading data: %zu", it->lim - it->tok);
144 it->lim -= shift;
145 it->cur -= shift;
146 it->mar -= shift;
147 it->tok -= shift;
148 }
149 it->lim += fread (it->lim, 1, it->buf_size - used - 1, it->fh);
150
151#line 152 "parser_nt.c"
152if (it->yyt1) it->yyt1 -= shift; if (it->yyt2) it->yyt2 -= shift; if (it->yyt3) it->yyt3 -= shift;
153#line 136 "../../include/volksdata/codec/parser_common.h"
154
155 log_trace ("Cursor offset from last token: %zu", it->cur - it->tok);
156 log_trace ("Limit offset from last token: %zu", it->lim - it->tok);
157 it->lim[0] = 0;
158 it->eof = it->lim < it->buf + it->buf_size - 1;
159 return 0;
160}
161
162
163#endif // VOLK_PARSER_COMMON_H
164#line 4 "lexer_nt.re"
165
166
167
168// Parser interface. Required here to silence linters.
170void NTParse();
172#ifdef VOLK_CODEC_DEBUG
173void NTParseTrace();
174#endif
175
176// Lexer.
177
178static int lex (ParseIterator *it, VOLK_Term **term)
179{
180 const YYCTYPE *lit_data_e, *dtype_s, *lang_s;
181 //(void) lit_data_e;
182 //(void) dtype_s;
183 //(void) lang_s;
184
185loop:
186
187 it->tok = it->cur;
188
189 *term = NULL;
190
191
192#line 193 "parser_nt.c"
193{
194 YYCTYPE yych;
195 unsigned int yyaccept = 0;
196yyFillLabel0:
197 yych = *YYCURSOR;
198 switch (yych) {
199 case '\t':
200 case ' ': goto yy3;
201 case '\n':
202 case '\r': goto yy5;
203 case '"': goto yy7;
204 case '#': goto yy8;
205 case '.': goto yy10;
206 case '<': goto yy11;
207 case '_': goto yy12;
208 default:
209 if (YYLIMIT <= YYCURSOR) {
210 if (YYFILL) goto yyFillLabel0;
211 goto yy110;
212 }
213 goto yy1;
214 }
215yy1:
216 ++YYCURSOR;
217yy2:
218#line 162 "lexer_nt.re"
219 {
220 log_error (
221 "Invalid token @ %p: %s (\\x%x)",
222 YYCURSOR - it->buf - 1, it->tok, *it->tok);
223
224 return -1;
225 }
226#line 227 "parser_nt.c"
227yy3:
228 ++YYCURSOR;
229yyFillLabel1:
230 yych = *YYCURSOR;
231 switch (yych) {
232 case '\t':
233 case ' ': goto yy3;
234 default:
235 if (YYLIMIT <= YYCURSOR) {
236 if (YYFILL) goto yyFillLabel1;
237 }
238 goto yy4;
239 }
240yy4:
241#line 145 "lexer_nt.re"
242 {
243 log_debug ("Separator.");
244
245 return T_WS;
246 }
247#line 248 "parser_nt.c"
248yy5:
249 ++YYCURSOR;
250yyFillLabel2:
251 yych = *YYCURSOR;
252 switch (yych) {
253 case '\t' ... '\n':
254 case '\r':
255 case ' ': goto yy5;
256 default:
257 if (YYLIMIT <= YYCURSOR) {
258 if (YYFILL) goto yyFillLabel2;
259 }
260 goto yy6;
261 }
262yy6:
263#line 61 "lexer_nt.re"
264 {
265 it->line ++;
266 it->bol = YYCURSOR;
267 log_debug ("New line: #%u.", it->line);
268 return T_EOL;
269 }
270#line 271 "parser_nt.c"
271yy7:
272 yyaccept = 0;
273 YYMARKER = ++YYCURSOR;
274yyFillLabel3:
275 yych = *YYCURSOR;
276 switch (yych) {
277 case 0x00:
278 if (YYLIMIT <= YYCURSOR) {
279 if (YYFILL) goto yyFillLabel3;
280 goto yy2;
281 }
282 goto yy13;
283 case 0x01 ... '\t':
284 case '\v' ... '\f':
285 case 0x0E ... 0x7F:
286 case 0xC2 ... 0xF4: goto yy14;
287 default: goto yy2;
288 }
289yy8:
290 yyaccept = 1;
291 YYMARKER = ++YYCURSOR;
292yyFillLabel4:
293 yych = *YYCURSOR;
294 switch (yych) {
295 case 0x00:
296 case 0x01 ... '\t':
297 case '\v' ... 0x7F:
298 if (YYLIMIT <= YYCURSOR) {
299 if (YYFILL) goto yyFillLabel4;
300 goto yy9;
301 }
302 goto yy8;
303 case 0xC2 ... 0xDF: goto yy25;
304 case 0xE0: goto yy26;
305 case 0xE1 ... 0xEF: goto yy27;
306 case 0xF0: goto yy28;
307 case 0xF1 ... 0xF3: goto yy29;
308 case 0xF4: goto yy30;
309 default: goto yy9;
310 }
311yy9:
312#line 151 "lexer_nt.re"
313 {
314 size_t size = YYCURSOR - it->tok + 1;
315 YYCTYPE *data = malloc (size);
316 memcpy (data, it->tok, size);
317 data [size - 1] = '\0';
318 log_debug ("Comment: `%s`", data);
319 free (data);
320
321 goto loop;
322 }
323#line 324 "parser_nt.c"
324yy10:
325 ++YYCURSOR;
326#line 138 "lexer_nt.re"
327 {
328 log_debug ("End of triple.");
329 it->ct ++;
330
331 return T_DOT;
332 }
333#line 334 "parser_nt.c"
334yy11:
335 yyaccept = 0;
336 YYMARKER = ++YYCURSOR;
337yyFillLabel5:
338 yych = *YYCURSOR;
339 switch (yych) {
340 case '!':
341 case '#' ... ';':
342 case '=' ... ']':
343 case '_':
344 case 'a' ... 'z':
345 case '~' ... 0x7F:
346 case 0xC2 ... 0xF4: goto yy32;
347 default:
348 if (YYLIMIT <= YYCURSOR) {
349 if (YYFILL) goto yyFillLabel5;
350 }
351 goto yy2;
352 }
353yy12:
354 yyaccept = 0;
355 YYMARKER = ++YYCURSOR;
356yyFillLabel6:
357 yych = *YYCURSOR;
358 switch (yych) {
359 case ':': goto yy41;
360 default:
361 if (YYLIMIT <= YYCURSOR) {
362 if (YYFILL) goto yyFillLabel6;
363 }
364 goto yy2;
365 }
366yy13:
367 ++YYCURSOR;
368yyFillLabel7:
369 yych = *YYCURSOR;
370yy14:
371 switch (yych) {
372 case 0x00:
373 case 0x01 ... '\t':
374 case '\v' ... '\f':
375 case 0x0E ... '!':
376 case '#' ... '[':
377 case ']' ... 0x7F:
378 if (YYLIMIT <= YYCURSOR) {
379 if (YYFILL) goto yyFillLabel7;
380 goto yy15;
381 }
382 goto yy13;
383 case '"': goto yy16;
384 case '\\': goto yy18;
385 case 0xC2 ... 0xDF: goto yy19;
386 case 0xE0: goto yy20;
387 case 0xE1 ... 0xEF: goto yy21;
388 case 0xF0: goto yy22;
389 case 0xF1 ... 0xF3: goto yy23;
390 case 0xF4: goto yy24;
391 default: goto yy15;
392 }
393yy15:
395 switch (yyaccept) {
396 case 0: goto yy2;
397 case 1: goto yy9;
398 case 2:
399 it->yyt1 = YYCURSOR;
400 it->yyt2 = NULL;
401 it->yyt3 = NULL;
402 goto yy17;
403 case 3:
404 it->yyt2 = NULL;
405 it->yyt3 = NULL;
406 goto yy17;
407 case 4: goto yy51;
408 default:
409 it->yyt2 = NULL;
410 goto yy17;
411 }
412yy16:
413 yyaccept = 2;
414 YYMARKER = ++YYCURSOR;
415yyFillLabel8:
416 yych = *YYCURSOR;
417 switch (yych) {
418 case '\t':
419 case ' ':
420 it->yyt1 = YYCURSOR;
421 goto yy42;
422 case '@':
423 it->yyt1 = YYCURSOR;
424 it->yyt3 = YYCURSOR;
425 goto yy43;
426 case '^':
427 it->yyt1 = YYCURSOR;
428 goto yy44;
429 default:
430 if (YYLIMIT <= YYCURSOR) {
431 if (YYFILL) goto yyFillLabel8;
432 }
433 it->yyt1 = YYCURSOR;
434 it->yyt2 = NULL;
435 it->yyt3 = NULL;
436 goto yy17;
437 }
438yy17:
439 lit_data_e = it->yyt1;
440 dtype_s = it->yyt2;
441 lang_s = it->yyt3;
442#line 85 "lexer_nt.re"
443 {
444 // Only unescape Unicode from data.
445 size_t size = lit_data_e - it->tok - 2;
446 YYCTYPE *data = unescape_unicode (it->tok + 1, size);
447 log_trace ("Literal data: %s", data);
448
449 char *metadata = NULL;
450 const YYCTYPE *md_marker;
452
453 if (dtype_s) {
454 md_marker = dtype_s;
455 size = YYCURSOR - md_marker - 1;
456 } else if (lang_s) {
458 md_marker = lang_s;
459 size = YYCURSOR - md_marker;
460 } else md_marker = NULL;
461
462 if (md_marker) {
463 metadata = malloc (size);
464 memcpy (metadata, md_marker + 1, size);
465 metadata [size - 1] = '\0';
466 log_trace ("metadata: %s", metadata);
467 }
468
469 if (type == VOLK_TERM_LITERAL) {
470 VOLK_Term *dtype;
471 dtype = (metadata ? VOLK_iriref_new ((char *) metadata) : NULL);
472
473 *term = VOLK_literal_new ((char *) data, dtype);
474
475 } else *term = VOLK_lt_literal_new ((char *) data, (char *) metadata);
476
477 free (data);
478 free (metadata);
479
480 if (UNLIKELY (!term)) return -1;
481 return T_LITERAL;
482 }
483#line 484 "parser_nt.c"
484yy18:
485 ++YYCURSOR;
486yyFillLabel9:
487 yych = *YYCURSOR;
488 switch (yych) {
489 case '"':
490 case '\'':
491 case '\\':
492 case 'b':
493 case 'f':
494 case 'n':
495 case 'r':
496 case 't': goto yy13;
497 case 'U': goto yy45;
498 case 'u': goto yy46;
499 default:
500 if (YYLIMIT <= YYCURSOR) {
501 if (YYFILL) goto yyFillLabel9;
502 }
503 goto yy15;
504 }
505yy19:
506 ++YYCURSOR;
507yyFillLabel10:
508 yych = *YYCURSOR;
509 switch (yych) {
510 case 0x80 ... 0xBF: goto yy13;
511 default:
512 if (YYLIMIT <= YYCURSOR) {
513 if (YYFILL) goto yyFillLabel10;
514 }
515 goto yy15;
516 }
517yy20:
518 ++YYCURSOR;
519yyFillLabel11:
520 yych = *YYCURSOR;
521 switch (yych) {
522 case 0xA0 ... 0xBF: goto yy19;
523 default:
524 if (YYLIMIT <= YYCURSOR) {
525 if (YYFILL) goto yyFillLabel11;
526 }
527 goto yy15;
528 }
529yy21:
530 ++YYCURSOR;
531yyFillLabel12:
532 yych = *YYCURSOR;
533 switch (yych) {
534 case 0x80 ... 0xBF: goto yy19;
535 default:
536 if (YYLIMIT <= YYCURSOR) {
537 if (YYFILL) goto yyFillLabel12;
538 }
539 goto yy15;
540 }
541yy22:
542 ++YYCURSOR;
543yyFillLabel13:
544 yych = *YYCURSOR;
545 switch (yych) {
546 case 0x90 ... 0xBF: goto yy21;
547 default:
548 if (YYLIMIT <= YYCURSOR) {
549 if (YYFILL) goto yyFillLabel13;
550 }
551 goto yy15;
552 }
553yy23:
554 ++YYCURSOR;
555yyFillLabel14:
556 yych = *YYCURSOR;
557 switch (yych) {
558 case 0x80 ... 0xBF: goto yy21;
559 default:
560 if (YYLIMIT <= YYCURSOR) {
561 if (YYFILL) goto yyFillLabel14;
562 }
563 goto yy15;
564 }
565yy24:
566 ++YYCURSOR;
567yyFillLabel15:
568 yych = *YYCURSOR;
569 switch (yych) {
570 case 0x80 ... 0x8F: goto yy21;
571 default:
572 if (YYLIMIT <= YYCURSOR) {
573 if (YYFILL) goto yyFillLabel15;
574 }
575 goto yy15;
576 }
577yy25:
578 ++YYCURSOR;
579yyFillLabel16:
580 yych = *YYCURSOR;
581 switch (yych) {
582 case 0x80 ... 0xBF: goto yy8;
583 default:
584 if (YYLIMIT <= YYCURSOR) {
585 if (YYFILL) goto yyFillLabel16;
586 }
587 goto yy15;
588 }
589yy26:
590 ++YYCURSOR;
591yyFillLabel17:
592 yych = *YYCURSOR;
593 switch (yych) {
594 case 0xA0 ... 0xBF: goto yy25;
595 default:
596 if (YYLIMIT <= YYCURSOR) {
597 if (YYFILL) goto yyFillLabel17;
598 }
599 goto yy15;
600 }
601yy27:
602 ++YYCURSOR;
603yyFillLabel18:
604 yych = *YYCURSOR;
605 switch (yych) {
606 case 0x80 ... 0xBF: goto yy25;
607 default:
608 if (YYLIMIT <= YYCURSOR) {
609 if (YYFILL) goto yyFillLabel18;
610 }
611 goto yy15;
612 }
613yy28:
614 ++YYCURSOR;
615yyFillLabel19:
616 yych = *YYCURSOR;
617 switch (yych) {
618 case 0x90 ... 0xBF: goto yy27;
619 default:
620 if (YYLIMIT <= YYCURSOR) {
621 if (YYFILL) goto yyFillLabel19;
622 }
623 goto yy15;
624 }
625yy29:
626 ++YYCURSOR;
627yyFillLabel20:
628 yych = *YYCURSOR;
629 switch (yych) {
630 case 0x80 ... 0xBF: goto yy27;
631 default:
632 if (YYLIMIT <= YYCURSOR) {
633 if (YYFILL) goto yyFillLabel20;
634 }
635 goto yy15;
636 }
637yy30:
638 ++YYCURSOR;
639yyFillLabel21:
640 yych = *YYCURSOR;
641 switch (yych) {
642 case 0x80 ... 0x8F: goto yy27;
643 default:
644 if (YYLIMIT <= YYCURSOR) {
645 if (YYFILL) goto yyFillLabel21;
646 }
647 goto yy15;
648 }
649yy31:
650 ++YYCURSOR;
651yyFillLabel22:
652 yych = *YYCURSOR;
653yy32:
654 switch (yych) {
655 case '!':
656 case '#' ... ';':
657 case '=':
658 case '?' ... '[':
659 case ']':
660 case '_':
661 case 'a' ... 'z':
662 case '~' ... 0x7F: goto yy31;
663 case '>': goto yy33;
664 case '\\': goto yy34;
665 case 0xC2 ... 0xDF: goto yy35;
666 case 0xE0: goto yy36;
667 case 0xE1 ... 0xEF: goto yy37;
668 case 0xF0: goto yy38;
669 case 0xF1 ... 0xF3: goto yy39;
670 case 0xF4: goto yy40;
671 default:
672 if (YYLIMIT <= YYCURSOR) {
673 if (YYFILL) goto yyFillLabel22;
674 }
675 goto yy15;
676 }
677yy33:
678 ++YYCURSOR;
679#line 73 "lexer_nt.re"
680 {
681 YYCTYPE *data = unescape_unicode (it->tok + 1, YYCURSOR - it->tok - 2);
682
683 log_debug ("URI data: %s", data);
684
685 *term = VOLK_iriref_new ((char*)data);
686 free (data);
687
688 if (UNLIKELY (!term)) return -1;
689 return T_IRIREF;
690 }
691#line 692 "parser_nt.c"
692yy34:
693 ++YYCURSOR;
694yyFillLabel23:
695 yych = *YYCURSOR;
696 switch (yych) {
697 case 'U': goto yy47;
698 case 'u': goto yy48;
699 default:
700 if (YYLIMIT <= YYCURSOR) {
701 if (YYFILL) goto yyFillLabel23;
702 }
703 goto yy15;
704 }
705yy35:
706 ++YYCURSOR;
707yyFillLabel24:
708 yych = *YYCURSOR;
709 switch (yych) {
710 case 0x80 ... 0xBF: goto yy31;
711 default:
712 if (YYLIMIT <= YYCURSOR) {
713 if (YYFILL) goto yyFillLabel24;
714 }
715 goto yy15;
716 }
717yy36:
718 ++YYCURSOR;
719yyFillLabel25:
720 yych = *YYCURSOR;
721 switch (yych) {
722 case 0xA0 ... 0xBF: goto yy35;
723 default:
724 if (YYLIMIT <= YYCURSOR) {
725 if (YYFILL) goto yyFillLabel25;
726 }
727 goto yy15;
728 }
729yy37:
730 ++YYCURSOR;
731yyFillLabel26:
732 yych = *YYCURSOR;
733 switch (yych) {
734 case 0x80 ... 0xBF: goto yy35;
735 default:
736 if (YYLIMIT <= YYCURSOR) {
737 if (YYFILL) goto yyFillLabel26;
738 }
739 goto yy15;
740 }
741yy38:
742 ++YYCURSOR;
743yyFillLabel27:
744 yych = *YYCURSOR;
745 switch (yych) {
746 case 0x90 ... 0xBF: goto yy37;
747 default:
748 if (YYLIMIT <= YYCURSOR) {
749 if (YYFILL) goto yyFillLabel27;
750 }
751 goto yy15;
752 }
753yy39:
754 ++YYCURSOR;
755yyFillLabel28:
756 yych = *YYCURSOR;
757 switch (yych) {
758 case 0x80 ... 0xBF: goto yy37;
759 default:
760 if (YYLIMIT <= YYCURSOR) {
761 if (YYFILL) goto yyFillLabel28;
762 }
763 goto yy15;
764 }
765yy40:
766 ++YYCURSOR;
767yyFillLabel29:
768 yych = *YYCURSOR;
769 switch (yych) {
770 case 0x80 ... 0x8F: goto yy37;
771 default:
772 if (YYLIMIT <= YYCURSOR) {
773 if (YYFILL) goto yyFillLabel29;
774 }
775 goto yy15;
776 }
777yy41:
778 ++YYCURSOR;
779yyFillLabel30:
780 yych = *YYCURSOR;
781 switch (yych) {
782 case '0' ... ':':
783 case 'A' ... 'Z':
784 case '_':
785 case 'a' ... 'z':
786 case 0xC3 ... 0xCB:
787 case 0xCE ... 0xE1:
788 case 0xE3 ... 0xED:
789 case 0xEF ... 0xF3: goto yy50;
790 case 0xCD: goto yy54;
791 case 0xE2: goto yy57;
792 default:
793 if (YYLIMIT <= YYCURSOR) {
794 if (YYFILL) goto yyFillLabel30;
795 }
796 goto yy15;
797 }
798yy42:
799 yyaccept = 3;
800 YYMARKER = ++YYCURSOR;
801yyFillLabel31:
802 yych = *YYCURSOR;
803 switch (yych) {
804 case '\t':
805 case ' ': goto yy42;
806 case '@':
807 it->yyt3 = YYCURSOR;
808 goto yy43;
809 case '^': goto yy44;
810 default:
811 if (YYLIMIT <= YYCURSOR) {
812 if (YYFILL) goto yyFillLabel31;
813 }
814 it->yyt2 = NULL;
815 it->yyt3 = NULL;
816 goto yy17;
817 }
818yy43:
819 ++YYCURSOR;
820yyFillLabel32:
821 yych = *YYCURSOR;
822 switch (yych) {
823 case 'A' ... 'Z':
824 case 'a' ... 'z': goto yy64;
825 default:
826 if (YYLIMIT <= YYCURSOR) {
827 if (YYFILL) goto yyFillLabel32;
828 }
829 goto yy15;
830 }
831yy44:
832 ++YYCURSOR;
833yyFillLabel33:
834 yych = *YYCURSOR;
835 switch (yych) {
836 case '^': goto yy65;
837 default:
838 if (YYLIMIT <= YYCURSOR) {
839 if (YYFILL) goto yyFillLabel33;
840 }
841 goto yy15;
842 }
843yy45:
844 ++YYCURSOR;
845yyFillLabel34:
846 yych = *YYCURSOR;
847 switch (yych) {
848 case '0' ... '9':
849 case 'A' ... 'F':
850 case 'a' ... 'f': goto yy66;
851 default:
852 if (YYLIMIT <= YYCURSOR) {
853 if (YYFILL) goto yyFillLabel34;
854 }
855 goto yy15;
856 }
857yy46:
858 ++YYCURSOR;
859yyFillLabel35:
860 yych = *YYCURSOR;
861 switch (yych) {
862 case '0' ... '9':
863 case 'A' ... 'F':
864 case 'a' ... 'f': goto yy67;
865 default:
866 if (YYLIMIT <= YYCURSOR) {
867 if (YYFILL) goto yyFillLabel35;
868 }
869 goto yy15;
870 }
871yy47:
872 ++YYCURSOR;
873yyFillLabel36:
874 yych = *YYCURSOR;
875 switch (yych) {
876 case '0' ... '9':
877 case 'A' ... 'F':
878 case 'a' ... 'f': goto yy68;
879 default:
880 if (YYLIMIT <= YYCURSOR) {
881 if (YYFILL) goto yyFillLabel36;
882 }
883 goto yy15;
884 }
885yy48:
886 ++YYCURSOR;
887yyFillLabel37:
888 yych = *YYCURSOR;
889 switch (yych) {
890 case '0' ... '9':
891 case 'A' ... 'F':
892 case 'a' ... 'f': goto yy69;
893 default:
894 if (YYLIMIT <= YYCURSOR) {
895 if (YYFILL) goto yyFillLabel37;
896 }
897 goto yy15;
898 }
899yy49:
900 yyaccept = 4;
901 YYMARKER = ++YYCURSOR;
902yyFillLabel38:
903 yych = *YYCURSOR;
904yy50:
905 switch (yych) {
906 case '-':
907 case '0' ... ':':
908 case 'A' ... 'Z':
909 case '_':
910 case 'a' ... 'z': goto yy49;
911 case '.': goto yy70;
912 case 0xC2: goto yy71;
913 case 0xC3: goto yy52;
914 case 0xC4 ... 0xCC:
915 case 0xCE ... 0xDF: goto yy53;
916 case 0xCD: goto yy72;
917 case 0xE0: goto yy55;
918 case 0xE1:
919 case 0xE4 ... 0xEC: goto yy56;
920 case 0xE2: goto yy73;
921 case 0xE3: goto yy58;
922 case 0xED: goto yy59;
923 case 0xEF: goto yy60;
924 case 0xF0: goto yy61;
925 case 0xF1 ... 0xF2: goto yy62;
926 case 0xF3: goto yy63;
927 default:
928 if (YYLIMIT <= YYCURSOR) {
929 if (YYFILL) goto yyFillLabel38;
930 }
931 goto yy51;
932 }
933yy51:
934#line 126 "lexer_nt.re"
935 {
936 YYCTYPE *data = unescape_unicode (it->tok + 2, YYCURSOR - it->tok - 2);
937
938 log_debug ("BNode data: %s", data);
939
940 *term = VOLK_term_new (VOLK_TERM_BNODE, (char*)data, NULL);
941 free (data);
942
943 if (UNLIKELY (!term)) return -1;
944 return T_BNODE;
945 }
946#line 947 "parser_nt.c"
947yy52:
948 ++YYCURSOR;
949yyFillLabel39:
950 yych = *YYCURSOR;
951 switch (yych) {
952 case 0x80 ... 0x96:
953 case 0x98 ... 0xB6:
954 case 0xB8 ... 0xBF: goto yy49;
955 default:
956 if (YYLIMIT <= YYCURSOR) {
957 if (YYFILL) goto yyFillLabel39;
958 }
959 goto yy15;
960 }
961yy53:
962 ++YYCURSOR;
963yyFillLabel40:
964 yych = *YYCURSOR;
965 switch (yych) {
966 case 0x80 ... 0xBF: goto yy49;
967 default:
968 if (YYLIMIT <= YYCURSOR) {
969 if (YYFILL) goto yyFillLabel40;
970 }
971 goto yy15;
972 }
973yy54:
974 ++YYCURSOR;
975yyFillLabel41:
976 yych = *YYCURSOR;
977 switch (yych) {
978 case 0xB0 ... 0xBD:
979 case 0xBF: goto yy49;
980 default:
981 if (YYLIMIT <= YYCURSOR) {
982 if (YYFILL) goto yyFillLabel41;
983 }
984 goto yy15;
985 }
986yy55:
987 ++YYCURSOR;
988yyFillLabel42:
989 yych = *YYCURSOR;
990 switch (yych) {
991 case 0xA0 ... 0xBF: goto yy53;
992 default:
993 if (YYLIMIT <= YYCURSOR) {
994 if (YYFILL) goto yyFillLabel42;
995 }
996 goto yy15;
997 }
998yy56:
999 ++YYCURSOR;
1000yyFillLabel43:
1001 yych = *YYCURSOR;
1002 switch (yych) {
1003 case 0x80 ... 0xBF: goto yy53;
1004 default:
1005 if (YYLIMIT <= YYCURSOR) {
1006 if (YYFILL) goto yyFillLabel43;
1007 }
1008 goto yy15;
1009 }
1010yy57:
1011 ++YYCURSOR;
1012yyFillLabel44:
1013 yych = *YYCURSOR;
1014 switch (yych) {
1015 case 0x80: goto yy74;
1016 case 0x81: goto yy75;
1017 case 0x82 ... 0x85:
1018 case 0xB0 ... 0xBE: goto yy53;
1019 case 0x86: goto yy76;
1020 case 0xBF: goto yy77;
1021 default:
1022 if (YYLIMIT <= YYCURSOR) {
1023 if (YYFILL) goto yyFillLabel44;
1024 }
1025 goto yy15;
1026 }
1027yy58:
1028 ++YYCURSOR;
1029yyFillLabel45:
1030 yych = *YYCURSOR;
1031 switch (yych) {
1032 case 0x80: goto yy78;
1033 case 0x81 ... 0xBF: goto yy53;
1034 default:
1035 if (YYLIMIT <= YYCURSOR) {
1036 if (YYFILL) goto yyFillLabel45;
1037 }
1038 goto yy15;
1039 }
1040yy59:
1041 ++YYCURSOR;
1042yyFillLabel46:
1043 yych = *YYCURSOR;
1044 switch (yych) {
1045 case 0x80 ... 0x9F: goto yy53;
1046 default:
1047 if (YYLIMIT <= YYCURSOR) {
1048 if (YYFILL) goto yyFillLabel46;
1049 }
1050 goto yy15;
1051 }
1052yy60:
1053 ++YYCURSOR;
1054yyFillLabel47:
1055 yych = *YYCURSOR;
1056 switch (yych) {
1057 case 0xA4 ... 0xB6:
1058 case 0xB8 ... 0xBE: goto yy53;
1059 case 0xB7: goto yy79;
1060 case 0xBF: goto yy80;
1061 default:
1062 if (YYLIMIT <= YYCURSOR) {
1063 if (YYFILL) goto yyFillLabel47;
1064 }
1065 goto yy15;
1066 }
1067yy61:
1068 ++YYCURSOR;
1069yyFillLabel48:
1070 yych = *YYCURSOR;
1071 switch (yych) {
1072 case 0x90 ... 0xBF: goto yy56;
1073 default:
1074 if (YYLIMIT <= YYCURSOR) {
1075 if (YYFILL) goto yyFillLabel48;
1076 }
1077 goto yy15;
1078 }
1079yy62:
1080 ++YYCURSOR;
1081yyFillLabel49:
1082 yych = *YYCURSOR;
1083 switch (yych) {
1084 case 0x80 ... 0xBF: goto yy56;
1085 default:
1086 if (YYLIMIT <= YYCURSOR) {
1087 if (YYFILL) goto yyFillLabel49;
1088 }
1089 goto yy15;
1090 }
1091yy63:
1092 ++YYCURSOR;
1093yyFillLabel50:
1094 yych = *YYCURSOR;
1095 switch (yych) {
1096 case 0x80 ... 0xAF: goto yy56;
1097 default:
1098 if (YYLIMIT <= YYCURSOR) {
1099 if (YYFILL) goto yyFillLabel50;
1100 }
1101 goto yy15;
1102 }
1103yy64:
1104 yyaccept = 5;
1105 YYMARKER = ++YYCURSOR;
1106yyFillLabel51:
1107 yych = *YYCURSOR;
1108 switch (yych) {
1109 case '-': goto yy81;
1110 case 'A' ... 'Z':
1111 case 'a' ... 'z': goto yy64;
1112 default:
1113 if (YYLIMIT <= YYCURSOR) {
1114 if (YYFILL) goto yyFillLabel51;
1115 }
1116 it->yyt2 = NULL;
1117 goto yy17;
1118 }
1119yy65:
1120 ++YYCURSOR;
1121yyFillLabel52:
1122 yych = *YYCURSOR;
1123 switch (yych) {
1124 case '\t':
1125 case ' ': goto yy65;
1126 case '<':
1127 it->yyt2 = YYCURSOR;
1128 goto yy82;
1129 default:
1130 if (YYLIMIT <= YYCURSOR) {
1131 if (YYFILL) goto yyFillLabel52;
1132 }
1133 goto yy15;
1134 }
1135yy66:
1136 ++YYCURSOR;
1137yyFillLabel53:
1138 yych = *YYCURSOR;
1139 switch (yych) {
1140 case '0' ... '9':
1141 case 'A' ... 'F':
1142 case 'a' ... 'f': goto yy83;
1143 default:
1144 if (YYLIMIT <= YYCURSOR) {
1145 if (YYFILL) goto yyFillLabel53;
1146 }
1147 goto yy15;
1148 }
1149yy67:
1150 ++YYCURSOR;
1151yyFillLabel54:
1152 yych = *YYCURSOR;
1153 switch (yych) {
1154 case '0' ... '9':
1155 case 'A' ... 'F':
1156 case 'a' ... 'f': goto yy84;
1157 default:
1158 if (YYLIMIT <= YYCURSOR) {
1159 if (YYFILL) goto yyFillLabel54;
1160 }
1161 goto yy15;
1162 }
1163yy68:
1164 ++YYCURSOR;
1165yyFillLabel55:
1166 yych = *YYCURSOR;
1167 switch (yych) {
1168 case '0' ... '9':
1169 case 'A' ... 'F':
1170 case 'a' ... 'f': goto yy85;
1171 default:
1172 if (YYLIMIT <= YYCURSOR) {
1173 if (YYFILL) goto yyFillLabel55;
1174 }
1175 goto yy15;
1176 }
1177yy69:
1178 ++YYCURSOR;
1179yyFillLabel56:
1180 yych = *YYCURSOR;
1181 switch (yych) {
1182 case '0' ... '9':
1183 case 'A' ... 'F':
1184 case 'a' ... 'f': goto yy86;
1185 default:
1186 if (YYLIMIT <= YYCURSOR) {
1187 if (YYFILL) goto yyFillLabel56;
1188 }
1189 goto yy15;
1190 }
1191yy70:
1192 ++YYCURSOR;
1193yyFillLabel57:
1194 yych = *YYCURSOR;
1195 switch (yych) {
1196 case '-':
1197 case '0' ... ':':
1198 case 'A' ... 'Z':
1199 case '_':
1200 case 'a' ... 'z': goto yy49;
1201 case '.': goto yy70;
1202 case 0xC2: goto yy71;
1203 case 0xC3: goto yy52;
1204 case 0xC4 ... 0xCC:
1205 case 0xCE ... 0xDF: goto yy53;
1206 case 0xCD: goto yy72;
1207 case 0xE0: goto yy55;
1208 case 0xE1:
1209 case 0xE4 ... 0xEC: goto yy56;
1210 case 0xE2: goto yy73;
1211 case 0xE3: goto yy58;
1212 case 0xED: goto yy59;
1213 case 0xEF: goto yy60;
1214 case 0xF0: goto yy61;
1215 case 0xF1 ... 0xF2: goto yy62;
1216 case 0xF3: goto yy63;
1217 default:
1218 if (YYLIMIT <= YYCURSOR) {
1219 if (YYFILL) goto yyFillLabel57;
1220 }
1221 goto yy15;
1222 }
1223yy71:
1224 ++YYCURSOR;
1225yyFillLabel58:
1226 yych = *YYCURSOR;
1227 switch (yych) {
1228 case 0xB7: goto yy49;
1229 default:
1230 if (YYLIMIT <= YYCURSOR) {
1231 if (YYFILL) goto yyFillLabel58;
1232 }
1233 goto yy15;
1234 }
1235yy72:
1236 ++YYCURSOR;
1237yyFillLabel59:
1238 yych = *YYCURSOR;
1239 switch (yych) {
1240 case 0x80 ... 0xBD:
1241 case 0xBF: goto yy49;
1242 default:
1243 if (YYLIMIT <= YYCURSOR) {
1244 if (YYFILL) goto yyFillLabel59;
1245 }
1246 goto yy15;
1247 }
1248yy73:
1249 ++YYCURSOR;
1250yyFillLabel60:
1251 yych = *YYCURSOR;
1252 switch (yych) {
1253 case 0x80: goto yy87;
1254 case 0x81: goto yy88;
1255 case 0x82 ... 0x85:
1256 case 0xB0 ... 0xBE: goto yy53;
1257 case 0x86: goto yy76;
1258 case 0xBF: goto yy77;
1259 default:
1260 if (YYLIMIT <= YYCURSOR) {
1261 if (YYFILL) goto yyFillLabel60;
1262 }
1263 goto yy15;
1264 }
1265yy74:
1266 ++YYCURSOR;
1267yyFillLabel61:
1268 yych = *YYCURSOR;
1269 switch (yych) {
1270 case 0x8C ... 0x8D: goto yy49;
1271 default:
1272 if (YYLIMIT <= YYCURSOR) {
1273 if (YYFILL) goto yyFillLabel61;
1274 }
1275 goto yy15;
1276 }
1277yy75:
1278 ++YYCURSOR;
1279yyFillLabel62:
1280 yych = *YYCURSOR;
1281 switch (yych) {
1282 case 0xB0 ... 0xBF: goto yy49;
1283 default:
1284 if (YYLIMIT <= YYCURSOR) {
1285 if (YYFILL) goto yyFillLabel62;
1286 }
1287 goto yy15;
1288 }
1289yy76:
1290 ++YYCURSOR;
1291yyFillLabel63:
1292 yych = *YYCURSOR;
1293 switch (yych) {
1294 case 0x80 ... 0x8F: goto yy49;
1295 default:
1296 if (YYLIMIT <= YYCURSOR) {
1297 if (YYFILL) goto yyFillLabel63;
1298 }
1299 goto yy15;
1300 }
1301yy77:
1302 ++YYCURSOR;
1303yyFillLabel64:
1304 yych = *YYCURSOR;
1305 switch (yych) {
1306 case 0x80 ... 0xAF: goto yy49;
1307 default:
1308 if (YYLIMIT <= YYCURSOR) {
1309 if (YYFILL) goto yyFillLabel64;
1310 }
1311 goto yy15;
1312 }
1313yy78:
1314 ++YYCURSOR;
1315yyFillLabel65:
1316 yych = *YYCURSOR;
1317 switch (yych) {
1318 case 0x81 ... 0xBF: goto yy49;
1319 default:
1320 if (YYLIMIT <= YYCURSOR) {
1321 if (YYFILL) goto yyFillLabel65;
1322 }
1323 goto yy15;
1324 }
1325yy79:
1326 ++YYCURSOR;
1327yyFillLabel66:
1328 yych = *YYCURSOR;
1329 switch (yych) {
1330 case 0x80 ... 0x8F:
1331 case 0xB0 ... 0xBF: goto yy49;
1332 default:
1333 if (YYLIMIT <= YYCURSOR) {
1334 if (YYFILL) goto yyFillLabel66;
1335 }
1336 goto yy15;
1337 }
1338yy80:
1339 ++YYCURSOR;
1340yyFillLabel67:
1341 yych = *YYCURSOR;
1342 switch (yych) {
1343 case 0x80 ... 0xBD: goto yy49;
1344 default:
1345 if (YYLIMIT <= YYCURSOR) {
1346 if (YYFILL) goto yyFillLabel67;
1347 }
1348 goto yy15;
1349 }
1350yy81:
1351 ++YYCURSOR;
1352yyFillLabel68:
1353 yych = *YYCURSOR;
1354 switch (yych) {
1355 case '0' ... '9':
1356 case 'A' ... 'Z':
1357 case 'a' ... 'z': goto yy89;
1358 default:
1359 if (YYLIMIT <= YYCURSOR) {
1360 if (YYFILL) goto yyFillLabel68;
1361 }
1362 goto yy15;
1363 }
1364yy82:
1365 ++YYCURSOR;
1366yyFillLabel69:
1367 yych = *YYCURSOR;
1368 switch (yych) {
1369 case '!':
1370 case '#' ... ';':
1371 case '=':
1372 case '?' ... '[':
1373 case ']':
1374 case '_':
1375 case 'a' ... 'z':
1376 case '~' ... 0x7F: goto yy82;
1377 case '>': goto yy90;
1378 case '\\': goto yy91;
1379 case 0xC2 ... 0xDF: goto yy92;
1380 case 0xE0: goto yy93;
1381 case 0xE1 ... 0xEF: goto yy94;
1382 case 0xF0: goto yy95;
1383 case 0xF1 ... 0xF3: goto yy96;
1384 case 0xF4: goto yy97;
1385 default:
1386 if (YYLIMIT <= YYCURSOR) {
1387 if (YYFILL) goto yyFillLabel69;
1388 }
1389 goto yy15;
1390 }
1391yy83:
1392 ++YYCURSOR;
1393yyFillLabel70:
1394 yych = *YYCURSOR;
1395 switch (yych) {
1396 case '0' ... '9':
1397 case 'A' ... 'F':
1398 case 'a' ... 'f': goto yy98;
1399 default:
1400 if (YYLIMIT <= YYCURSOR) {
1401 if (YYFILL) goto yyFillLabel70;
1402 }
1403 goto yy15;
1404 }
1405yy84:
1406 ++YYCURSOR;
1407yyFillLabel71:
1408 yych = *YYCURSOR;
1409 switch (yych) {
1410 case '0' ... '9':
1411 case 'A' ... 'F':
1412 case 'a' ... 'f': goto yy99;
1413 default:
1414 if (YYLIMIT <= YYCURSOR) {
1415 if (YYFILL) goto yyFillLabel71;
1416 }
1417 goto yy15;
1418 }
1419yy85:
1420 ++YYCURSOR;
1421yyFillLabel72:
1422 yych = *YYCURSOR;
1423 switch (yych) {
1424 case '0' ... '9':
1425 case 'A' ... 'F':
1426 case 'a' ... 'f': goto yy100;
1427 default:
1428 if (YYLIMIT <= YYCURSOR) {
1429 if (YYFILL) goto yyFillLabel72;
1430 }
1431 goto yy15;
1432 }
1433yy86:
1434 ++YYCURSOR;
1435yyFillLabel73:
1436 yych = *YYCURSOR;
1437 switch (yych) {
1438 case '0' ... '9':
1439 case 'A' ... 'F':
1440 case 'a' ... 'f': goto yy101;
1441 default:
1442 if (YYLIMIT <= YYCURSOR) {
1443 if (YYFILL) goto yyFillLabel73;
1444 }
1445 goto yy15;
1446 }
1447yy87:
1448 ++YYCURSOR;
1449yyFillLabel74:
1450 yych = *YYCURSOR;
1451 switch (yych) {
1452 case 0x8C ... 0x8D:
1453 case 0xBF: goto yy49;
1454 default:
1455 if (YYLIMIT <= YYCURSOR) {
1456 if (YYFILL) goto yyFillLabel74;
1457 }
1458 goto yy15;
1459 }
1460yy88:
1461 ++YYCURSOR;
1462yyFillLabel75:
1463 yych = *YYCURSOR;
1464 switch (yych) {
1465 case 0x80:
1466 case 0xB0 ... 0xBF: goto yy49;
1467 default:
1468 if (YYLIMIT <= YYCURSOR) {
1469 if (YYFILL) goto yyFillLabel75;
1470 }
1471 goto yy15;
1472 }
1473yy89:
1474 yyaccept = 5;
1475 YYMARKER = ++YYCURSOR;
1476yyFillLabel76:
1477 yych = *YYCURSOR;
1478 switch (yych) {
1479 case '-': goto yy81;
1480 case '0' ... '9':
1481 case 'A' ... 'Z':
1482 case 'a' ... 'z': goto yy89;
1483 default:
1484 if (YYLIMIT <= YYCURSOR) {
1485 if (YYFILL) goto yyFillLabel76;
1486 }
1487 it->yyt2 = NULL;
1488 goto yy17;
1489 }
1490yy90:
1491 ++YYCURSOR;
1492 it->yyt3 = NULL;
1493 goto yy17;
1494yy91:
1495 ++YYCURSOR;
1496yyFillLabel77:
1497 yych = *YYCURSOR;
1498 switch (yych) {
1499 case 'U': goto yy102;
1500 case 'u': goto yy103;
1501 default:
1502 if (YYLIMIT <= YYCURSOR) {
1503 if (YYFILL) goto yyFillLabel77;
1504 }
1505 goto yy15;
1506 }
1507yy92:
1508 ++YYCURSOR;
1509yyFillLabel78:
1510 yych = *YYCURSOR;
1511 switch (yych) {
1512 case 0x80 ... 0xBF: goto yy82;
1513 default:
1514 if (YYLIMIT <= YYCURSOR) {
1515 if (YYFILL) goto yyFillLabel78;
1516 }
1517 goto yy15;
1518 }
1519yy93:
1520 ++YYCURSOR;
1521yyFillLabel79:
1522 yych = *YYCURSOR;
1523 switch (yych) {
1524 case 0xA0 ... 0xBF: goto yy92;
1525 default:
1526 if (YYLIMIT <= YYCURSOR) {
1527 if (YYFILL) goto yyFillLabel79;
1528 }
1529 goto yy15;
1530 }
1531yy94:
1532 ++YYCURSOR;
1533yyFillLabel80:
1534 yych = *YYCURSOR;
1535 switch (yych) {
1536 case 0x80 ... 0xBF: goto yy92;
1537 default:
1538 if (YYLIMIT <= YYCURSOR) {
1539 if (YYFILL) goto yyFillLabel80;
1540 }
1541 goto yy15;
1542 }
1543yy95:
1544 ++YYCURSOR;
1545yyFillLabel81:
1546 yych = *YYCURSOR;
1547 switch (yych) {
1548 case 0x90 ... 0xBF: goto yy94;
1549 default:
1550 if (YYLIMIT <= YYCURSOR) {
1551 if (YYFILL) goto yyFillLabel81;
1552 }
1553 goto yy15;
1554 }
1555yy96:
1556 ++YYCURSOR;
1557yyFillLabel82:
1558 yych = *YYCURSOR;
1559 switch (yych) {
1560 case 0x80 ... 0xBF: goto yy94;
1561 default:
1562 if (YYLIMIT <= YYCURSOR) {
1563 if (YYFILL) goto yyFillLabel82;
1564 }
1565 goto yy15;
1566 }
1567yy97:
1568 ++YYCURSOR;
1569yyFillLabel83:
1570 yych = *YYCURSOR;
1571 switch (yych) {
1572 case 0x80 ... 0x8F: goto yy94;
1573 default:
1574 if (YYLIMIT <= YYCURSOR) {
1575 if (YYFILL) goto yyFillLabel83;
1576 }
1577 goto yy15;
1578 }
1579yy98:
1580 ++YYCURSOR;
1581yyFillLabel84:
1582 yych = *YYCURSOR;
1583 switch (yych) {
1584 case '0' ... '9':
1585 case 'A' ... 'F':
1586 case 'a' ... 'f': goto yy46;
1587 default:
1588 if (YYLIMIT <= YYCURSOR) {
1589 if (YYFILL) goto yyFillLabel84;
1590 }
1591 goto yy15;
1592 }
1593yy99:
1594 ++YYCURSOR;
1595yyFillLabel85:
1596 yych = *YYCURSOR;
1597 switch (yych) {
1598 case '0' ... '9':
1599 case 'A' ... 'F':
1600 case 'a' ... 'f': goto yy13;
1601 default:
1602 if (YYLIMIT <= YYCURSOR) {
1603 if (YYFILL) goto yyFillLabel85;
1604 }
1605 goto yy15;
1606 }
1607yy100:
1608 ++YYCURSOR;
1609yyFillLabel86:
1610 yych = *YYCURSOR;
1611 switch (yych) {
1612 case '0' ... '9':
1613 case 'A' ... 'F':
1614 case 'a' ... 'f': goto yy48;
1615 default:
1616 if (YYLIMIT <= YYCURSOR) {
1617 if (YYFILL) goto yyFillLabel86;
1618 }
1619 goto yy15;
1620 }
1621yy101:
1622 ++YYCURSOR;
1623yyFillLabel87:
1624 yych = *YYCURSOR;
1625 switch (yych) {
1626 case '0' ... '9':
1627 case 'A' ... 'F':
1628 case 'a' ... 'f': goto yy31;
1629 default:
1630 if (YYLIMIT <= YYCURSOR) {
1631 if (YYFILL) goto yyFillLabel87;
1632 }
1633 goto yy15;
1634 }
1635yy102:
1636 ++YYCURSOR;
1637yyFillLabel88:
1638 yych = *YYCURSOR;
1639 switch (yych) {
1640 case '0' ... '9':
1641 case 'A' ... 'F':
1642 case 'a' ... 'f': goto yy104;
1643 default:
1644 if (YYLIMIT <= YYCURSOR) {
1645 if (YYFILL) goto yyFillLabel88;
1646 }
1647 goto yy15;
1648 }
1649yy103:
1650 ++YYCURSOR;
1651yyFillLabel89:
1652 yych = *YYCURSOR;
1653 switch (yych) {
1654 case '0' ... '9':
1655 case 'A' ... 'F':
1656 case 'a' ... 'f': goto yy105;
1657 default:
1658 if (YYLIMIT <= YYCURSOR) {
1659 if (YYFILL) goto yyFillLabel89;
1660 }
1661 goto yy15;
1662 }
1663yy104:
1664 ++YYCURSOR;
1665yyFillLabel90:
1666 yych = *YYCURSOR;
1667 switch (yych) {
1668 case '0' ... '9':
1669 case 'A' ... 'F':
1670 case 'a' ... 'f': goto yy106;
1671 default:
1672 if (YYLIMIT <= YYCURSOR) {
1673 if (YYFILL) goto yyFillLabel90;
1674 }
1675 goto yy15;
1676 }
1677yy105:
1678 ++YYCURSOR;
1679yyFillLabel91:
1680 yych = *YYCURSOR;
1681 switch (yych) {
1682 case '0' ... '9':
1683 case 'A' ... 'F':
1684 case 'a' ... 'f': goto yy107;
1685 default:
1686 if (YYLIMIT <= YYCURSOR) {
1687 if (YYFILL) goto yyFillLabel91;
1688 }
1689 goto yy15;
1690 }
1691yy106:
1692 ++YYCURSOR;
1693yyFillLabel92:
1694 yych = *YYCURSOR;
1695 switch (yych) {
1696 case '0' ... '9':
1697 case 'A' ... 'F':
1698 case 'a' ... 'f': goto yy108;
1699 default:
1700 if (YYLIMIT <= YYCURSOR) {
1701 if (YYFILL) goto yyFillLabel92;
1702 }
1703 goto yy15;
1704 }
1705yy107:
1706 ++YYCURSOR;
1707yyFillLabel93:
1708 yych = *YYCURSOR;
1709 switch (yych) {
1710 case '0' ... '9':
1711 case 'A' ... 'F':
1712 case 'a' ... 'f': goto yy109;
1713 default:
1714 if (YYLIMIT <= YYCURSOR) {
1715 if (YYFILL) goto yyFillLabel93;
1716 }
1717 goto yy15;
1718 }
1719yy108:
1720 ++YYCURSOR;
1721yyFillLabel94:
1722 yych = *YYCURSOR;
1723 switch (yych) {
1724 case '0' ... '9':
1725 case 'A' ... 'F':
1726 case 'a' ... 'f': goto yy103;
1727 default:
1728 if (YYLIMIT <= YYCURSOR) {
1729 if (YYFILL) goto yyFillLabel94;
1730 }
1731 goto yy15;
1732 }
1733yy109:
1734 ++YYCURSOR;
1735yyFillLabel95:
1736 yych = *YYCURSOR;
1737 switch (yych) {
1738 case '0' ... '9':
1739 case 'A' ... 'F':
1740 case 'a' ... 'f': goto yy82;
1741 default:
1742 if (YYLIMIT <= YYCURSOR) {
1743 if (YYFILL) goto yyFillLabel95;
1744 }
1745 goto yy15;
1746 }
1747yy110:
1748#line 68 "lexer_nt.re"
1749 {
1750 log_debug ("End of buffer.");
1751 return T_EOF;
1752 }
1753#line 1754 "parser_nt.c"
1754}
1755#line 170 "lexer_nt.re"
1756
1757}
1758
1759
1760VOLK_rc
1761nt_parse_term (const char *rep, VOLK_Term **term)
1762{
1763 ParseIterator it;
1764 parse_init (&it, NULL, rep);
1765
1766 int ttype = lex (&it, term);
1767
1768 free (it.buf);
1769
1770 switch (ttype) {
1771 case T_IRIREF:
1772 case T_LITERAL:
1773 case T_BNODE:
1774 return VOLK_OK;
1775 default:
1776 return VOLK_PARSE_ERR;
1777 }
1778}
1779
1780VOLK_rc
1782 FILE *fh, const char *sh, VOLK_Graph *gr, size_t *ct, char **err_p)
1783{
1784 *err_p = NULL;
1785
1786 if (!fh && !sh) {
1787 log_error ("Neither file handle nor string input provided.");
1788 return VOLK_VALUE_ERR;
1789 }
1790
1791 ParseIterator parse_it;
1792 parse_init (&parse_it, fh, sh);
1793
1794#ifdef VOLK_CODEC_DEBUG
1795 NTParseTrace (stderr, "NT Parser > ");
1796#endif
1797
1798 void *parser = NTParseAlloc (malloc);
1799
1800 VOLK_rc rc;
1801
1802 VOLK_GraphIterator *it = VOLK_graph_add_init (gr);
1803 if (UNLIKELY (!it)) {
1804 VOLK_graph_free (gr);
1805 return VOLK_MEM_ERR;
1806 }
1807
1808 VOLK_Term *term = NULL;
1809
1810 for (;;) {
1811 int ttype = lex (&parse_it, &term);
1812
1813 if (ttype == -1) {
1814 char token[16] = {};
1815 strncpy (token, (const char *)parse_it.tok, 15);
1816
1817 char *err_start = "Parse error near token `";
1818
1819 char err_info [64];
1820 sprintf(
1821 err_info, "[...]' at line %u, character %ld.\n",
1822 parse_it.line, parse_it.cur - parse_it.bol);
1823
1824 size_t err_size = strlen (err_start) + 16 + strlen(err_info);
1825 char *err_str = malloc (err_size);
1826 sprintf (err_str, "%s%s%s", err_start, token, err_info);
1827
1828 rc = VOLK_PARSE_ERR;
1829 *err_p = err_str;
1830 log_error (err_str);
1831
1832 goto finally;
1833 }
1834
1835 NTParse (parser, ttype, term, it);
1836
1837 if (ttype == T_EOF) break;
1838 };
1839
1840 if (ct) *ct = parse_it.ct;
1841
1842 log_info ("Parsed %u triples.", parse_it.ct);
1843 log_debug ("Graph size: %lu", VOLK_graph_size (gr));
1844
1845 rc = parse_it.ct > 0 ? VOLK_OK : VOLK_NORESULT;
1846
1847finally: ;
1848 NTParse (parser, 0, NULL, it);
1849 NTParseFree (parser, free);
1850
1851 free (parse_it.buf);
1852
1854 VOLK_term_free (term);
1855
1856 return rc;
1857}
1858
Codec interface definition and basic elements common to all codecs.
#define UNLIKELY(x)
Definition core.h:39
#define T_IRIREF
Definition grammar_nt.c:19
#define T_EOF
Lemon parser grammar for N-Triples.
Definition grammar_nt.c:17
void NTParseTrace(FILE *TraceFILE, char *zTracePrompt)
Definition grammar_nt.c:308
#define T_WS
Definition grammar_nt.c:23
#define T_LITERAL
Definition grammar_nt.c:21
#define T_BNODE
Definition grammar_nt.c:20
#define T_EOL
Definition grammar_nt.c:22
#define T_DOT
Definition grammar_nt.c:18
#define CHUNK_SIZE
uint8_t * unescape_unicode(const uint8_t *esc_str, size_t size)
Replace \uxxxx and \Uxxxxxxxx with Unicode bytes.
#define VOLK_graph_add_init(...)
Non-transactional version of VOLK_graph_add_init_txn().
Definition graph.h:320
void VOLK_graph_free(VOLK_Graph *gr)
Free a graph.
Definition graph.c:246
#define VOLK_graph_size(...)
Non-transactional version of VOLK_graph_size_txn().
Definition graph.h:285
void VOLK_graph_iter_free(VOLK_GraphIterator *it)
Free a graph iterator.
Definition graph.c:605
#define log_debug(...)
Definition core.h:273
#define log_trace(...)
Definition core.h:275
#define VOLK_VALUE_ERR
An invalid input value was provided.
Definition core.h:129
#define VOLK_MEM_ERR
Memory allocation error.
Definition core.h:144
#define VOLK_NORESULT
No result yielded.
Definition core.h:100
#define VOLK_OK
Generic success return code.
Definition core.h:83
#define VOLK_PARSE_ERR
Codec parser error.
Definition core.h:126
int VOLK_rc
Definition core.h:79
VOLK_Term * VOLK_lt_literal_new(const char *data, char *lang)
Shortcut to create a language-tagged literal term.
Definition term.h:317
VOLK_Term * VOLK_iriref_new(const char *data)
Create an IRI reference.
Definition term.h:192
VOLK_TermType
Term type.
Definition term.h:31
VOLK_Term * VOLK_literal_new(const char *data, VOLK_Term *datatype)
Shortcut to create a literal term.
Definition term.h:266
void VOLK_term_free(VOLK_Term *term)
Definition term.c:387
VOLK_Term * VOLK_term_new(VOLK_TermType type, const char *data, void *metadata)
Create a new term.
Definition term.c:157
@ VOLK_TERM_LT_LITERAL
Language-tagged string literal.
Definition term.h:37
@ VOLK_TERM_LITERAL
Literal without language tag.
Definition term.h:36
@ VOLK_TERM_BNODE
Blank node.
Definition term.h:38
#define YYCTYPE
TTL is UTF-8 encoded.
#define YYCURSOR
Definition parser_nt.c:26
VOLK_rc nt_parse_doc(FILE *fh, const char *sh, VOLK_Graph *gr, size_t *ct, char **err_p)
Parse an RDF document in N-Triples format.
Definition parser_nt.c:1781
#define YYLIMIT
Definition parser_nt.c:28
#define YYFILL
Definition parser_nt.c:29
void NTParse()
#define YYMARKER
Definition parser_nt.c:27
#define YYCTYPE
TTL is UTF-8 encoded.
Definition parser_nt.c:25
void NTParseFree()
void * NTParseAlloc()
VOLK_rc nt_parse_term(const char *rep, VOLK_Term **term)
Parse a single term.
Definition parser_nt.c:1761
FILE * fh
Input file handle.
Definition parser_nt.c:33
size_t buf_size
Initial allocation for buffer.
Definition parser_nt.c:35
unsigned line
Current line no. (for debugging).
Definition parser_nt.c:44
YYCTYPE * cur
Next input character to be read (YYCURSOR).
Definition parser_nt.c:39
YYCTYPE * yyt1
Definition parser_nt.c:49
const char * sh
Input string. Exclusive with fh.
Definition parser_nt.c:34
bool eof
if we have reached EOF.
Definition parser_nt.c:46
YYCTYPE * buf
Start of buffer.
Definition parser_nt.c:36
YYCTYPE * bol
Definition parser_nt.c:42
YYCTYPE * lim
Definition parser_nt.c:38
unsigned ct
Number of statements parsed.
Definition parser_nt.c:45
YYCTYPE * yyt3
Definition parser_nt.c:49
YYCTYPE * mar
Most recent match (YYMARKER).
Definition parser_nt.c:40
YYCTYPE * yyt2
Definition parser_nt.c:49
YYCTYPE * tok
Start of current token.
Definition parser_nt.c:41
RDF term.
Definition term.h:62