~ubuntu-branches/ubuntu/natty/raptor/natty-updates

« back to all changes in this revision

Viewing changes to src/n3_parser.c

  • Committer: Bazaar Package Importer
  • Author(s): Dave Beckett
  • Date: 2006-10-22 21:15:07 UTC
  • mfrom: (1.1.5 upstream) (2.1.2 etch)
  • Revision ID: james.westby@ubuntu.com-20061022211507-c93p7f5mhapszeom
Tags: 1.4.13-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* A Bison parser, made by GNU Bison 2.1.  */
2
 
 
3
 
/* Skeleton parser for Yacc-like parsing with Bison,
4
 
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
1
/* A Bison parser, made by GNU Bison 2.3.  */
 
2
 
 
3
/* Skeleton implementation for Bison's Yacc-like parsers in C
 
4
 
 
5
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
 
6
   Free Software Foundation, Inc.
5
7
 
6
8
   This program is free software; you can redistribute it and/or modify
7
9
   it under the terms of the GNU General Public License as published by
18
20
   Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
21
   Boston, MA 02110-1301, USA.  */
20
22
 
21
 
/* As a special exception, when this file is copied by Bison into a
22
 
   Bison output file, you may use that output file without restriction.
23
 
   This special exception was added by the Free Software Foundation
24
 
   in version 1.24 of Bison.  */
25
 
 
26
 
/* Written by Richard Stallman by simplifying the original so called
27
 
   ``semantic'' parser.  */
 
23
/* As a special exception, you may create a larger work that contains
 
24
   part or all of the Bison parser skeleton and distribute that work
 
25
   under terms of your choice, so long as that work isn't itself a
 
26
   parser generator using the skeleton or a modified version thereof
 
27
   as a parser skeleton.  Alternatively, if you modify or redistribute
 
28
   the parser skeleton itself, you may (at your option) remove this
 
29
   special exception, which will cause the skeleton and the resulting
 
30
   Bison output files to be licensed under the GNU General Public
 
31
   License without this special exception.
 
32
 
 
33
   This special exception was added by the Free Software Foundation in
 
34
   version 2.2 of Bison.  */
 
35
 
 
36
/* C LALR(1) parser skeleton written by Richard Stallman, by
 
37
   simplifying the original so-called "semantic" parser.  */
28
38
 
29
39
/* All symbols defined below should begin with yy or YY, to avoid
30
40
   infringing on user name space.  This should be done even for local
37
47
#define YYBISON 1
38
48
 
39
49
/* Bison version.  */
40
 
#define YYBISON_VERSION "2.1"
 
50
#define YYBISON_VERSION "2.3"
41
51
 
42
52
/* Skeleton name.  */
43
53
#define YYSKELETON_NAME "yacc.c"
64
74
   /* Put the tokens into the symbol table, so that GDB and other debuggers
65
75
      know about them.  */
66
76
   enum yytokentype {
67
 
     PREFIX = 258,
68
 
     A = 259,
69
 
     AT = 260,
70
 
     HAT = 261,
71
 
     DOT = 262,
72
 
     COMMA = 263,
73
 
     SEMICOLON = 264,
74
 
     LEFT_SQUARE = 265,
75
 
     RIGHT_SQUARE = 266,
76
 
     LEFT_ROUND = 267,
77
 
     RIGHT_ROUND = 268,
78
 
     STRING_LITERAL = 269,
79
 
     URI_LITERAL = 270,
80
 
     BLANK_LITERAL = 271,
81
 
     QNAME_LITERAL = 272,
 
77
     A = 258,
 
78
     AT = 259,
 
79
     HAT = 260,
 
80
     DOT = 261,
 
81
     COMMA = 262,
 
82
     SEMICOLON = 263,
 
83
     LEFT_SQUARE = 264,
 
84
     RIGHT_SQUARE = 265,
 
85
     LEFT_ROUND = 266,
 
86
     RIGHT_ROUND = 267,
 
87
     STRING_LITERAL = 268,
 
88
     URI_LITERAL = 269,
 
89
     BLANK_LITERAL = 270,
 
90
     QNAME_LITERAL = 271,
 
91
     PREFIX = 272,
82
92
     IDENTIFIER = 273,
83
93
     INTEGER_LITERAL = 274,
84
94
     FLOATING_LITERAL = 275,
87
97
   };
88
98
#endif
89
99
/* Tokens.  */
90
 
#define PREFIX 258
91
 
#define A 259
92
 
#define AT 260
93
 
#define HAT 261
94
 
#define DOT 262
95
 
#define COMMA 263
96
 
#define SEMICOLON 264
97
 
#define LEFT_SQUARE 265
98
 
#define RIGHT_SQUARE 266
99
 
#define LEFT_ROUND 267
100
 
#define RIGHT_ROUND 268
101
 
#define STRING_LITERAL 269
102
 
#define URI_LITERAL 270
103
 
#define BLANK_LITERAL 271
104
 
#define QNAME_LITERAL 272
 
100
#define A 258
 
101
#define AT 259
 
102
#define HAT 260
 
103
#define DOT 261
 
104
#define COMMA 262
 
105
#define SEMICOLON 263
 
106
#define LEFT_SQUARE 264
 
107
#define RIGHT_SQUARE 265
 
108
#define LEFT_ROUND 266
 
109
#define RIGHT_ROUND 267
 
110
#define STRING_LITERAL 268
 
111
#define URI_LITERAL 269
 
112
#define BLANK_LITERAL 270
 
113
#define QNAME_LITERAL 271
 
114
#define PREFIX 272
105
115
#define IDENTIFIER 273
106
116
#define INTEGER_LITERAL 274
107
117
#define FLOATING_LITERAL 275
214
224
# define YYTOKEN_TABLE 0
215
225
#endif
216
226
 
217
 
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 
227
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 
228
typedef union YYSTYPE
218
229
#line 119 "./n3_parser.y"
219
 
typedef union YYSTYPE {
 
230
{
220
231
  unsigned char *string;
221
232
  raptor_identifier *identifier;
222
233
  raptor_sequence *sequence;
223
234
  raptor_uri *uri;
224
235
  int integer; /* 0+ for a xsd:integer datatyped RDF literal */
225
236
  double floating;
226
 
} YYSTYPE;
227
 
/* Line 196 of yacc.c.  */
228
 
#line 229 "n3_parser.c"
 
237
}
 
238
/* Line 193 of yacc.c.  */
 
239
#line 240 "n3_parser.c"
 
240
        YYSTYPE;
229
241
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
230
242
# define YYSTYPE_IS_DECLARED 1
231
243
# define YYSTYPE_IS_TRIVIAL 1
236
248
/* Copy the second part of user declarations.  */
237
249
 
238
250
 
239
 
/* Line 219 of yacc.c.  */
240
 
#line 241 "n3_parser.c"
241
 
 
242
 
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
243
 
# define YYSIZE_T __SIZE_TYPE__
244
 
#endif
245
 
#if ! defined (YYSIZE_T) && defined (size_t)
246
 
# define YYSIZE_T size_t
247
 
#endif
248
 
#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
249
 
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
250
 
# define YYSIZE_T size_t
251
 
#endif
252
 
#if ! defined (YYSIZE_T)
253
 
# define YYSIZE_T unsigned int
254
 
#endif
 
251
/* Line 216 of yacc.c.  */
 
252
#line 253 "n3_parser.c"
 
253
 
 
254
#ifdef short
 
255
# undef short
 
256
#endif
 
257
 
 
258
#ifdef YYTYPE_UINT8
 
259
typedef YYTYPE_UINT8 yytype_uint8;
 
260
#else
 
261
typedef unsigned char yytype_uint8;
 
262
#endif
 
263
 
 
264
#ifdef YYTYPE_INT8
 
265
typedef YYTYPE_INT8 yytype_int8;
 
266
#elif (defined __STDC__ || defined __C99__FUNC__ \
 
267
     || defined __cplusplus || defined _MSC_VER)
 
268
typedef signed char yytype_int8;
 
269
#else
 
270
typedef short int yytype_int8;
 
271
#endif
 
272
 
 
273
#ifdef YYTYPE_UINT16
 
274
typedef YYTYPE_UINT16 yytype_uint16;
 
275
#else
 
276
typedef unsigned short int yytype_uint16;
 
277
#endif
 
278
 
 
279
#ifdef YYTYPE_INT16
 
280
typedef YYTYPE_INT16 yytype_int16;
 
281
#else
 
282
typedef short int yytype_int16;
 
283
#endif
 
284
 
 
285
#ifndef YYSIZE_T
 
286
# ifdef __SIZE_TYPE__
 
287
#  define YYSIZE_T __SIZE_TYPE__
 
288
# elif defined size_t
 
289
#  define YYSIZE_T size_t
 
290
# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
 
291
     || defined __cplusplus || defined _MSC_VER)
 
292
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
 
293
#  define YYSIZE_T size_t
 
294
# else
 
295
#  define YYSIZE_T unsigned int
 
296
# endif
 
297
#endif
 
298
 
 
299
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
255
300
 
256
301
#ifndef YY_
257
302
# if YYENABLE_NLS
265
310
# endif
266
311
#endif
267
312
 
268
 
#if ! defined (yyoverflow) || YYERROR_VERBOSE
 
313
/* Suppress unused-variable warnings by "using" E.  */
 
314
#if ! defined lint || defined __GNUC__
 
315
# define YYUSE(e) ((void) (e))
 
316
#else
 
317
# define YYUSE(e) /* empty */
 
318
#endif
 
319
 
 
320
/* Identity function, used to suppress warnings about constant conditions.  */
 
321
#ifndef lint
 
322
# define YYID(n) (n)
 
323
#else
 
324
#if (defined __STDC__ || defined __C99__FUNC__ \
 
325
     || defined __cplusplus || defined _MSC_VER)
 
326
static int
 
327
YYID (int i)
 
328
#else
 
329
static int
 
330
YYID (i)
 
331
    int i;
 
332
#endif
 
333
{
 
334
  return i;
 
335
}
 
336
#endif
 
337
 
 
338
#if ! defined yyoverflow || YYERROR_VERBOSE
269
339
 
270
340
/* The parser invokes alloca or malloc; define the necessary symbols.  */
271
341
 
273
343
#  if YYSTACK_USE_ALLOCA
274
344
#   ifdef __GNUC__
275
345
#    define YYSTACK_ALLOC __builtin_alloca
 
346
#   elif defined __BUILTIN_VA_ARG_INCR
 
347
#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
 
348
#   elif defined _AIX
 
349
#    define YYSTACK_ALLOC __alloca
 
350
#   elif defined _MSC_VER
 
351
#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
 
352
#    define alloca _alloca
276
353
#   else
277
354
#    define YYSTACK_ALLOC alloca
278
 
#    if defined (__STDC__) || defined (__cplusplus)
 
355
#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
 
356
     || defined __cplusplus || defined _MSC_VER)
279
357
#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
280
 
#     define YYINCLUDED_STDLIB_H
 
358
#     ifndef _STDLIB_H
 
359
#      define _STDLIB_H 1
 
360
#     endif
281
361
#    endif
282
362
#   endif
283
363
#  endif
284
364
# endif
285
365
 
286
366
# ifdef YYSTACK_ALLOC
287
 
   /* Pacify GCC's `empty if-body' warning. */
288
 
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
 
367
   /* Pacify GCC's `empty if-body' warning.  */
 
368
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
289
369
#  ifndef YYSTACK_ALLOC_MAXIMUM
290
370
    /* The OS might guarantee only one guard page at the bottom of the stack,
291
371
       and a page size can be as small as 4096 bytes.  So we cannot safely
292
372
       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
293
373
       to allow for a few compiler-allocated temporary stack slots.  */
294
 
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
 
374
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
295
375
#  endif
296
376
# else
297
377
#  define YYSTACK_ALLOC YYMALLOC
298
378
#  define YYSTACK_FREE YYFREE
299
379
#  ifndef YYSTACK_ALLOC_MAXIMUM
300
 
#   define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
 
380
#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
301
381
#  endif
302
 
#  ifdef __cplusplus
303
 
extern "C" {
 
382
#  if (defined __cplusplus && ! defined _STDLIB_H \
 
383
       && ! ((defined YYMALLOC || defined malloc) \
 
384
             && (defined YYFREE || defined free)))
 
385
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
 
386
#   ifndef _STDLIB_H
 
387
#    define _STDLIB_H 1
 
388
#   endif
304
389
#  endif
305
390
#  ifndef YYMALLOC
306
391
#   define YYMALLOC malloc
307
 
#   if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
308
 
        && (defined (__STDC__) || defined (__cplusplus)))
 
392
#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
 
393
     || defined __cplusplus || defined _MSC_VER)
309
394
#   endif
310
395
#  endif
311
396
#  ifndef YYFREE
312
397
#   define YYFREE free
313
 
#   if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
314
 
        && (defined (__STDC__) || defined (__cplusplus)))
 
398
#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
 
399
     || defined __cplusplus || defined _MSC_VER)
315
400
#   endif
316
401
#  endif
317
 
#  ifdef __cplusplus
318
 
}
319
 
#  endif
320
402
# endif
321
 
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
322
 
 
323
 
 
324
 
#if (! defined (yyoverflow) \
325
 
     && (! defined (__cplusplus) \
326
 
         || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
 
403
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
 
404
 
 
405
 
 
406
#if (! defined yyoverflow \
 
407
     && (! defined __cplusplus \
 
408
         || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
327
409
 
328
410
/* A type that is properly aligned for any stack member.  */
329
411
union yyalloc
330
412
{
331
 
  short int yyss;
 
413
  yytype_int16 yyss;
332
414
  YYSTYPE yyvs;
333
415
  };
334
416
 
338
420
/* The size of an array large to enough to hold all stacks, each with
339
421
   N elements.  */
340
422
# define YYSTACK_BYTES(N) \
341
 
     ((N) * (sizeof (short int) + sizeof (YYSTYPE))                     \
 
423
     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
342
424
      + YYSTACK_GAP_MAXIMUM)
343
425
 
344
426
/* Copy COUNT objects from FROM to TO.  The source and destination do
345
427
   not overlap.  */
346
428
# ifndef YYCOPY
347
 
#  if defined (__GNUC__) && 1 < __GNUC__
 
429
#  if defined __GNUC__ && 1 < __GNUC__
348
430
#   define YYCOPY(To, From, Count) \
349
431
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
350
432
#  else
355
437
          for (yyi = 0; yyi < (Count); yyi++)   \
356
438
            (To)[yyi] = (From)[yyi];            \
357
439
        }                                       \
358
 
      while (0)
 
440
      while (YYID (0))
359
441
#  endif
360
442
# endif
361
443
 
373
455
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
374
456
        yyptr += yynewbytes / sizeof (*yyptr);                          \
375
457
      }                                                                 \
376
 
    while (0)
377
 
 
378
 
#endif
379
 
 
380
 
#if defined (__STDC__) || defined (__cplusplus)
381
 
   typedef signed char yysigned_char;
382
 
#else
383
 
   typedef short int yysigned_char;
384
 
#endif
385
 
 
386
 
/* YYFINAL -- State number of the termination state. */
 
458
    while (YYID (0))
 
459
 
 
460
#endif
 
461
 
 
462
/* YYFINAL -- State number of the termination state.  */
387
463
#define YYFINAL  3
388
464
/* YYLAST -- Last index in YYTABLE.  */
389
 
#define YYLAST   68
 
465
#define YYLAST   76
390
466
 
391
 
/* YYNTOKENS -- Number of terminals. */
 
467
/* YYNTOKENS -- Number of terminals.  */
392
468
#define YYNTOKENS  23
393
 
/* YYNNTS -- Number of nonterminals. */
 
469
/* YYNNTS -- Number of nonterminals.  */
394
470
#define YYNNTS  16
395
 
/* YYNRULES -- Number of rules. */
 
471
/* YYNRULES -- Number of rules.  */
396
472
#define YYNRULES  40
397
 
/* YYNRULES -- Number of states. */
 
473
/* YYNRULES -- Number of states.  */
398
474
#define YYNSTATES  56
399
475
 
400
476
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
405
481
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
406
482
 
407
483
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
408
 
static const unsigned char yytranslate[] =
 
484
static const yytype_uint8 yytranslate[] =
409
485
{
410
486
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
411
487
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
440
516
#if YYDEBUG
441
517
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
442
518
   YYRHS.  */
443
 
static const unsigned char yyprhs[] =
 
519
static const yytype_uint8 yyprhs[] =
444
520
{
445
521
       0,     0,     3,     5,     8,     9,    11,    15,    18,    22,
446
522
      24,    27,    29,    31,    33,    38,    41,    42,    45,    50,
449
525
     110
450
526
};
451
527
 
452
 
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
453
 
static const yysigned_char yyrhs[] =
 
528
/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
 
529
static const yytype_int8 yyrhs[] =
454
530
{
455
531
      24,     0,    -1,    25,    -1,    25,    26,    -1,    -1,    31,
456
 
      -1,    32,    30,     7,    -1,     1,     7,    -1,    27,     8,
 
532
      -1,    32,    30,     6,    -1,     1,     6,    -1,    27,     7,
457
533
      34,    -1,    34,    -1,    28,    34,    -1,    34,    -1,    33,
458
 
      -1,     4,    -1,    30,     9,    29,    27,    -1,    29,    27,
459
 
      -1,    -1,    30,     9,    -1,     3,    18,    15,     7,    -1,
 
534
      -1,     3,    -1,    30,     8,    29,    27,    -1,    29,    27,
 
535
      -1,    -1,    30,     8,    -1,    17,    18,    14,     6,    -1,
460
536
      36,    -1,    37,    -1,    36,    -1,    36,    -1,    37,    -1,
461
 
      35,    -1,    14,     5,    18,    -1,    14,     5,    18,     6,
462
 
      15,    -1,    14,     5,    18,     6,    17,    -1,    14,     6,
463
 
      15,    -1,    14,     6,    17,    -1,    14,    -1,    19,    -1,
464
 
      20,    -1,    21,    -1,    15,    -1,    17,    -1,    16,    -1,
465
 
      10,    30,    11,    -1,    38,    -1,    12,    28,    13,    -1,
466
 
      12,    13,    -1
 
537
      35,    -1,    13,     4,    18,    -1,    13,     4,    18,     5,
 
538
      14,    -1,    13,     4,    18,     5,    16,    -1,    13,     5,
 
539
      14,    -1,    13,     5,    16,    -1,    13,    -1,    19,    -1,
 
540
      20,    -1,    21,    -1,    14,    -1,    16,    -1,    15,    -1,
 
541
       9,    30,    10,    -1,    38,    -1,    11,    28,    12,    -1,
 
542
      11,    12,    -1
467
543
};
468
544
 
469
545
/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
470
 
static const unsigned short int yyrline[] =
 
546
static const yytype_uint16 yyrline[] =
471
547
{
472
 
       0,   160,   160,   163,   164,   167,   168,   212,   216,   249,
473
 
     283,   316,   350,   360,   374,   435,   471,   477,   488,   522,
474
 
     526,   533,   540,   544,   548,   561,   569,   581,   593,   605,
475
 
     616,   624,   636,   643,   655,   666,   681,   691,   732,   739,
476
 
     805
 
548
       0,   167,   167,   170,   171,   174,   175,   219,   223,   256,
 
549
     290,   323,   357,   367,   381,   442,   478,   484,   495,   533,
 
550
     537,   544,   551,   555,   559,   572,   580,   592,   604,   616,
 
551
     627,   635,   647,   654,   666,   677,   692,   702,   743,   750,
 
552
     816
477
553
};
478
554
#endif
479
555
 
480
556
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
481
557
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
482
 
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
 
558
   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
483
559
static const char *const yytname[] =
484
560
{
485
 
  "$end", "error", "$undefined", "PREFIX", "A", "AT", "HAT", "DOT",
486
 
  "COMMA", "SEMICOLON", "LEFT_SQUARE", "RIGHT_SQUARE", "LEFT_ROUND",
487
 
  "RIGHT_ROUND", "STRING_LITERAL", "URI_LITERAL", "BLANK_LITERAL",
488
 
  "QNAME_LITERAL", "IDENTIFIER", "INTEGER_LITERAL", "FLOATING_LITERAL",
489
 
  "DECIMAL_LITERAL", "ERROR_TOKEN", "$accept", "Document", "statementList",
490
 
  "statement", "objectList", "itemList", "verb", "propertyList",
491
 
  "directive", "subject", "predicate", "object", "literal", "resource",
492
 
  "blank", "collection", 0
 
561
  "$end", "error", "$undefined", "\"a\"", "\"@\"", "\"^\"", "\".\"",
 
562
  "\",\"", "\";\"", "\"[\"", "\"]\"", "\"(\"", "\")\"",
 
563
  "\"string literal\"", "\"URI literal\"", "\"blank node\"", "\"QName\"",
 
564
  "\"@prefix\"", "\"identifier\"", "\"integer literal\"",
 
565
  "\"floating point literal\"", "\"decimal literal\"", "ERROR_TOKEN",
 
566
  "$accept", "Document", "statementList", "statement", "objectList",
 
567
  "itemList", "verb", "propertyList", "directive", "subject", "predicate",
 
568
  "object", "literal", "resource", "blank", "collection", 0
493
569
};
494
570
#endif
495
571
 
496
572
# ifdef YYPRINT
497
573
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
498
574
   token YYLEX-NUM.  */
499
 
static const unsigned short int yytoknum[] =
 
575
static const yytype_uint16 yytoknum[] =
500
576
{
501
577
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
502
578
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
505
581
# endif
506
582
 
507
583
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
508
 
static const unsigned char yyr1[] =
 
584
static const yytype_uint8 yyr1[] =
509
585
{
510
586
       0,    23,    24,    25,    25,    26,    26,    26,    27,    27,
511
587
      28,    28,    29,    29,    30,    30,    30,    30,    31,    32,
515
591
};
516
592
 
517
593
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
518
 
static const unsigned char yyr2[] =
 
594
static const yytype_uint8 yyr2[] =
519
595
{
520
596
       0,     2,     1,     2,     0,     1,     3,     2,     3,     1,
521
597
       2,     1,     1,     1,     4,     2,     0,     2,     4,     1,
527
603
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
528
604
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
529
605
   means the default is an error.  */
530
 
static const unsigned char yydefact[] =
 
606
static const yytype_uint8 yydefact[] =
531
607
{
532
 
       4,     0,     0,     1,     0,     0,    16,     0,    34,    36,
533
 
      35,     3,     5,    16,    19,    20,    38,     7,     0,    13,
534
 
       0,     0,    12,    21,    40,    30,    31,    32,    33,     0,
535
 
      11,    24,    22,    23,     0,     0,    15,     9,    17,    37,
536
 
       0,     0,    39,    10,     6,    18,     0,     0,    25,    28,
537
 
      29,     8,    14,     0,    26,    27
 
608
       4,     0,     0,     1,     0,    16,     0,    34,    36,    35,
 
609
       0,     3,     5,    16,    19,    20,    38,     7,    13,     0,
 
610
       0,    12,    21,    40,    30,    31,    32,    33,     0,    11,
 
611
      24,    22,    23,     0,     0,    15,     9,    17,    37,     0,
 
612
       0,    39,    10,     0,     6,     0,     0,    25,    28,    29,
 
613
      18,     8,    14,     0,    26,    27
538
614
};
539
615
 
540
 
/* YYDEFGOTO[NTERM-NUM]. */
541
 
static const yysigned_char yydefgoto[] =
 
616
/* YYDEFGOTO[NTERM-NUM].  */
 
617
static const yytype_int8 yydefgoto[] =
542
618
{
543
 
      -1,     1,     2,    11,    36,    29,    20,    21,    12,    13,
544
 
      22,    37,    31,    32,    33,    16
 
619
      -1,     1,     2,    11,    35,    28,    19,    20,    12,    13,
 
620
      21,    36,    30,    31,    32,    16
545
621
};
546
622
 
547
623
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
548
624
   STATE-NUM.  */
549
 
#define YYPACT_NINF -8
550
 
static const yysigned_char yypact[] =
 
625
#define YYPACT_NINF -13
 
626
static const yytype_int8 yypact[] =
551
627
{
552
 
      -8,     2,     3,    -8,     1,    18,     6,    14,    -8,    -8,
553
 
      -8,    -8,    -8,     6,    -8,    -8,    -8,    -8,    -4,    -8,
554
 
      40,    -2,    -8,    -8,    -8,    60,    -8,    -8,    -8,    28,
555
 
      -8,    -8,    -8,    -8,     7,    10,    17,    -8,     6,    -8,
556
 
      45,    36,    -8,    -8,    -8,    -8,    40,    40,    26,    -8,
557
 
      -8,    -8,    17,    47,    -8,    -8
 
628
     -13,     9,     2,   -13,     8,     7,    29,   -13,   -13,   -13,
 
629
      12,   -13,   -13,     7,   -13,   -13,   -13,   -13,   -13,    55,
 
630
      -3,   -13,   -13,   -13,    24,   -13,   -13,   -13,    42,   -13,
 
631
     -13,   -13,   -13,     1,     0,    13,   -13,     7,   -13,    14,
 
632
      10,   -13,   -13,    25,   -13,    55,    55,    28,   -13,   -13,
 
633
     -13,   -13,    13,    11,   -13,   -13
558
634
};
559
635
 
560
636
/* YYPGOTO[NTERM-NUM].  */
561
 
static const yysigned_char yypgoto[] =
 
637
static const yytype_int8 yypgoto[] =
562
638
{
563
 
      -8,    -8,    -8,    -8,    11,    -8,     8,    54,    -8,    -8,
564
 
      -8,    -7,    -8,    -1,    66,    -8
 
639
     -13,   -13,   -13,   -13,   -12,   -13,    -2,    33,   -13,   -13,
 
640
     -13,    -6,   -13,    -1,    35,   -13
565
641
};
566
642
 
567
643
/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
569
645
   number is the opposite.  If zero, do what YYDEFACT says.
570
646
   If YYTABLE_NINF, syntax error.  */
571
647
#define YYTABLE_NINF -3
572
 
static const yysigned_char yytable[] =
 
648
static const yytype_int8 yytable[] =
573
649
{
574
 
      30,    14,     3,    -2,     4,    23,     5,    38,    17,    39,
575
 
      19,    35,    23,     6,    44,     7,    38,    45,     8,     9,
576
 
      10,     8,    43,    10,     6,    46,     7,    24,    25,     8,
577
 
       9,    10,    53,    26,    27,    28,    18,    23,     6,    51,
578
 
       7,    42,    25,     8,     9,    10,    47,    26,    27,    28,
579
 
       6,    49,     7,    50,    25,     8,     9,    10,    52,    26,
580
 
      27,    28,    54,    48,    55,    40,    41,    34,    15
 
650
      29,    14,    -2,     4,    22,    37,    44,    38,    37,     3,
 
651
      18,     5,    22,     6,    17,    43,     7,     8,     9,    10,
 
652
      45,     7,    42,     9,    48,    54,    49,    55,    39,    40,
 
653
      33,    50,    47,    53,    52,    46,    22,    15,     5,    51,
 
654
       6,    23,    24,     7,     8,     9,    34,     0,    25,    26,
 
655
      27,     5,     0,     6,    41,    24,     7,     8,     9,     0,
 
656
       0,    25,    26,    27,     5,     0,     6,     0,    24,     7,
 
657
       8,     9,     0,     0,    25,    26,    27
581
658
};
582
659
 
583
 
static const unsigned char yycheck[] =
 
660
static const yytype_int8 yycheck[] =
584
661
{
585
 
       7,     2,     0,     0,     1,     6,     3,     9,     7,    11,
586
 
       4,    15,    13,    10,     7,    12,     9,     7,    15,    16,
587
 
      17,    15,    29,    17,    10,     8,    12,    13,    14,    15,
588
 
      16,    17,     6,    19,    20,    21,    18,    38,    10,    46,
589
 
      12,    13,    14,    15,    16,    17,    38,    19,    20,    21,
590
 
      10,    15,    12,    17,    14,    15,    16,    17,    47,    19,
591
 
      20,    21,    15,    18,    17,     5,     6,    13,     2
 
662
       6,     2,     0,     1,     5,     8,     6,    10,     8,     0,
 
663
       3,     9,    13,    11,     6,    14,    14,    15,    16,    17,
 
664
       7,    14,    28,    16,    14,    14,    16,    16,     4,     5,
 
665
      18,     6,    18,     5,    46,    37,    37,     2,     9,    45,
 
666
      11,    12,    13,    14,    15,    16,    13,    -1,    19,    20,
 
667
      21,     9,    -1,    11,    12,    13,    14,    15,    16,    -1,
 
668
      -1,    19,    20,    21,     9,    -1,    11,    -1,    13,    14,
 
669
      15,    16,    -1,    -1,    19,    20,    21
592
670
};
593
671
 
594
672
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
595
673
   symbol of state STATE-NUM.  */
596
 
static const unsigned char yystos[] =
 
674
static const yytype_uint8 yystos[] =
597
675
{
598
 
       0,    24,    25,     0,     1,     3,    10,    12,    15,    16,
599
 
      17,    26,    31,    32,    36,    37,    38,     7,    18,     4,
600
 
      29,    30,    33,    36,    13,    14,    19,    20,    21,    28,
601
 
      34,    35,    36,    37,    30,    15,    27,    34,     9,    11,
602
 
       5,     6,    13,    34,     7,     7,     8,    29,    18,    15,
603
 
      17,    34,    27,     6,    15,    17
 
676
       0,    24,    25,     0,     1,     9,    11,    14,    15,    16,
 
677
      17,    26,    31,    32,    36,    37,    38,     6,     3,    29,
 
678
      30,    33,    36,    12,    13,    19,    20,    21,    28,    34,
 
679
      35,    36,    37,    18,    30,    27,    34,     8,    10,     4,
 
680
       5,    12,    34,    14,     6,     7,    29,    18,    14,    16,
 
681
       6,    34,    27,     5,    14,    16
604
682
};
605
683
 
606
684
#define yyerrok         (yyerrstatus = 0)
628
706
      yychar = (Token);                                         \
629
707
      yylval = (Value);                                         \
630
708
      yytoken = YYTRANSLATE (yychar);                           \
631
 
      YYPOPSTACK;                                               \
 
709
      YYPOPSTACK (1);                                           \
632
710
      goto yybackup;                                            \
633
711
    }                                                           \
634
712
  else                                                          \
636
714
      yyerror (YY_("syntax error: cannot back up")); \
637
715
      YYERROR;                                                  \
638
716
    }                                                           \
639
 
while (0)
 
717
while (YYID (0))
640
718
 
641
719
 
642
720
#define YYTERROR        1
651
729
#ifndef YYLLOC_DEFAULT
652
730
# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
653
731
    do                                                                  \
654
 
      if (N)                                                            \
 
732
      if (YYID (N))                                                    \
655
733
        {                                                               \
656
734
          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
657
735
          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
665
743
          (Current).first_column = (Current).last_column =              \
666
744
            YYRHSLOC (Rhs, 0).last_column;                              \
667
745
        }                                                               \
668
 
    while (0)
 
746
    while (YYID (0))
669
747
#endif
670
748
 
671
749
 
677
755
# if YYLTYPE_IS_TRIVIAL
678
756
#  define YY_LOCATION_PRINT(File, Loc)                  \
679
757
     fprintf (File, "%d.%d-%d.%d",                      \
680
 
              (Loc).first_line, (Loc).first_column,     \
681
 
              (Loc).last_line,  (Loc).last_column)
 
758
              (Loc).first_line, (Loc).first_column,     \
 
759
              (Loc).last_line,  (Loc).last_column)
682
760
# else
683
761
#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
684
762
# endif
705
783
do {                                            \
706
784
  if (yydebug)                                  \
707
785
    YYFPRINTF Args;                             \
708
 
} while (0)
709
 
 
710
 
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)          \
711
 
do {                                                            \
712
 
  if (yydebug)                                                  \
713
 
    {                                                           \
714
 
      YYFPRINTF (stderr, "%s ", Title);                         \
715
 
      yysymprint (stderr,                                       \
716
 
                  Type, Value); \
717
 
      YYFPRINTF (stderr, "\n");                                 \
718
 
    }                                                           \
719
 
} while (0)
 
786
} while (YYID (0))
 
787
 
 
788
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
 
789
do {                                                                      \
 
790
  if (yydebug)                                                            \
 
791
    {                                                                     \
 
792
      YYFPRINTF (stderr, "%s ", Title);                                   \
 
793
      yy_symbol_print (stderr,                                            \
 
794
                  Type, Value); \
 
795
      YYFPRINTF (stderr, "\n");                                           \
 
796
    }                                                                     \
 
797
} while (YYID (0))
 
798
 
 
799
 
 
800
/*--------------------------------.
 
801
| Print this symbol on YYOUTPUT.  |
 
802
`--------------------------------*/
 
803
 
 
804
/*ARGSUSED*/
 
805
#if (defined __STDC__ || defined __C99__FUNC__ \
 
806
     || defined __cplusplus || defined _MSC_VER)
 
807
static void
 
808
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
 
809
#else
 
810
static void
 
811
yy_symbol_value_print (yyoutput, yytype, yyvaluep)
 
812
    FILE *yyoutput;
 
813
    int yytype;
 
814
    YYSTYPE const * const yyvaluep;
 
815
#endif
 
816
{
 
817
  if (!yyvaluep)
 
818
    return;
 
819
# ifdef YYPRINT
 
820
  if (yytype < YYNTOKENS)
 
821
    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
 
822
# else
 
823
  YYUSE (yyoutput);
 
824
# endif
 
825
  switch (yytype)
 
826
    {
 
827
      default:
 
828
        break;
 
829
    }
 
830
}
 
831
 
 
832
 
 
833
/*--------------------------------.
 
834
| Print this symbol on YYOUTPUT.  |
 
835
`--------------------------------*/
 
836
 
 
837
#if (defined __STDC__ || defined __C99__FUNC__ \
 
838
     || defined __cplusplus || defined _MSC_VER)
 
839
static void
 
840
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
 
841
#else
 
842
static void
 
843
yy_symbol_print (yyoutput, yytype, yyvaluep)
 
844
    FILE *yyoutput;
 
845
    int yytype;
 
846
    YYSTYPE const * const yyvaluep;
 
847
#endif
 
848
{
 
849
  if (yytype < YYNTOKENS)
 
850
    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
 
851
  else
 
852
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
 
853
 
 
854
  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
 
855
  YYFPRINTF (yyoutput, ")");
 
856
}
720
857
 
721
858
/*------------------------------------------------------------------.
722
859
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
723
860
| TOP (included).                                                   |
724
861
`------------------------------------------------------------------*/
725
862
 
726
 
#if defined (__STDC__) || defined (__cplusplus)
 
863
#if (defined __STDC__ || defined __C99__FUNC__ \
 
864
     || defined __cplusplus || defined _MSC_VER)
727
865
static void
728
 
yy_stack_print (short int *bottom, short int *top)
 
866
yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
729
867
#else
730
868
static void
731
869
yy_stack_print (bottom, top)
732
 
    short int *bottom;
733
 
    short int *top;
 
870
    yytype_int16 *bottom;
 
871
    yytype_int16 *top;
734
872
#endif
735
873
{
736
874
  YYFPRINTF (stderr, "Stack now");
737
 
  for (/* Nothing. */; bottom <= top; ++bottom)
 
875
  for (; bottom <= top; ++bottom)
738
876
    YYFPRINTF (stderr, " %d", *bottom);
739
877
  YYFPRINTF (stderr, "\n");
740
878
}
743
881
do {                                                            \
744
882
  if (yydebug)                                                  \
745
883
    yy_stack_print ((Bottom), (Top));                           \
746
 
} while (0)
 
884
} while (YYID (0))
747
885
 
748
886
 
749
887
/*------------------------------------------------.
750
888
| Report that the YYRULE is going to be reduced.  |
751
889
`------------------------------------------------*/
752
890
 
753
 
#if defined (__STDC__) || defined (__cplusplus)
 
891
#if (defined __STDC__ || defined __C99__FUNC__ \
 
892
     || defined __cplusplus || defined _MSC_VER)
754
893
static void
755
 
yy_reduce_print (int yyrule)
 
894
yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
756
895
#else
757
896
static void
758
 
yy_reduce_print (yyrule)
 
897
yy_reduce_print (yyvsp, yyrule)
 
898
    YYSTYPE *yyvsp;
759
899
    int yyrule;
760
900
#endif
761
901
{
 
902
  int yynrhs = yyr2[yyrule];
762
903
  int yyi;
763
904
  unsigned long int yylno = yyrline[yyrule];
764
 
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
765
 
             yyrule - 1, yylno);
766
 
  /* Print the symbols being reduced, and their result.  */
767
 
  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
768
 
    YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
769
 
  YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
 
905
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
 
906
             yyrule - 1, yylno);
 
907
  /* The symbols being reduced.  */
 
908
  for (yyi = 0; yyi < yynrhs; yyi++)
 
909
    {
 
910
      fprintf (stderr, "   $%d = ", yyi + 1);
 
911
      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
 
912
                       &(yyvsp[(yyi + 1) - (yynrhs)])
 
913
                                       );
 
914
      fprintf (stderr, "\n");
 
915
    }
770
916
}
771
917
 
772
918
# define YY_REDUCE_PRINT(Rule)          \
773
919
do {                                    \
774
920
  if (yydebug)                          \
775
 
    yy_reduce_print (Rule);             \
776
 
} while (0)
 
921
    yy_reduce_print (yyvsp, Rule); \
 
922
} while (YYID (0))
777
923
 
778
924
/* Nonzero means print parse trace.  It is left uninitialized so that
779
925
   multiple parsers can coexist.  */
807
953
#if YYERROR_VERBOSE
808
954
 
809
955
# ifndef yystrlen
810
 
#  if defined (__GLIBC__) && defined (_STRING_H)
 
956
#  if defined __GLIBC__ && defined _STRING_H
811
957
#   define yystrlen strlen
812
958
#  else
813
959
/* Return the length of YYSTR.  */
 
960
#if (defined __STDC__ || defined __C99__FUNC__ \
 
961
     || defined __cplusplus || defined _MSC_VER)
814
962
static YYSIZE_T
815
 
#   if defined (__STDC__) || defined (__cplusplus)
816
963
yystrlen (const char *yystr)
817
 
#   else
 
964
#else
 
965
static YYSIZE_T
818
966
yystrlen (yystr)
819
 
     const char *yystr;
820
 
#   endif
 
967
    const char *yystr;
 
968
#endif
821
969
{
822
 
  const char *yys = yystr;
823
 
 
824
 
  while (*yys++ != '\0')
 
970
  YYSIZE_T yylen;
 
971
  for (yylen = 0; yystr[yylen]; yylen++)
825
972
    continue;
826
 
 
827
 
  return yys - yystr - 1;
 
973
  return yylen;
828
974
}
829
975
#  endif
830
976
# endif
831
977
 
832
978
# ifndef yystpcpy
833
 
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
 
979
#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
834
980
#   define yystpcpy stpcpy
835
981
#  else
836
982
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
837
983
   YYDEST.  */
 
984
#if (defined __STDC__ || defined __C99__FUNC__ \
 
985
     || defined __cplusplus || defined _MSC_VER)
838
986
static char *
839
 
#   if defined (__STDC__) || defined (__cplusplus)
840
987
yystpcpy (char *yydest, const char *yysrc)
841
 
#   else
 
988
#else
 
989
static char *
842
990
yystpcpy (yydest, yysrc)
843
 
     char *yydest;
844
 
     const char *yysrc;
845
 
#   endif
 
991
    char *yydest;
 
992
    const char *yysrc;
 
993
#endif
846
994
{
847
995
  char *yyd = yydest;
848
996
  const char *yys = yysrc;
868
1016
{
869
1017
  if (*yystr == '"')
870
1018
    {
871
 
      size_t yyn = 0;
 
1019
      YYSIZE_T yyn = 0;
872
1020
      char const *yyp = yystr;
873
1021
 
874
1022
      for (;;)
903
1051
}
904
1052
# endif
905
1053
 
906
 
#endif /* YYERROR_VERBOSE */
907
 
 
908
 
 
909
 
 
910
 
#if YYDEBUG
911
 
/*--------------------------------.
912
 
| Print this symbol on YYOUTPUT.  |
913
 
`--------------------------------*/
914
 
 
915
 
#if defined (__STDC__) || defined (__cplusplus)
916
 
static void
917
 
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
918
 
#else
919
 
static void
920
 
yysymprint (yyoutput, yytype, yyvaluep)
921
 
    FILE *yyoutput;
922
 
    int yytype;
923
 
    YYSTYPE *yyvaluep;
924
 
#endif
 
1054
/* Copy into YYRESULT an error message about the unexpected token
 
1055
   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
 
1056
   including the terminating null byte.  If YYRESULT is null, do not
 
1057
   copy anything; just return the number of bytes that would be
 
1058
   copied.  As a special case, return 0 if an ordinary "syntax error"
 
1059
   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
 
1060
   size calculation.  */
 
1061
static YYSIZE_T
 
1062
yysyntax_error (char *yyresult, int yystate, int yychar)
925
1063
{
926
 
  /* Pacify ``unused variable'' warnings.  */
927
 
  (void) yyvaluep;
 
1064
  int yyn = yypact[yystate];
928
1065
 
929
 
  if (yytype < YYNTOKENS)
930
 
    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
 
1066
  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
 
1067
    return 0;
931
1068
  else
932
 
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
933
 
 
934
 
 
935
 
# ifdef YYPRINT
936
 
  if (yytype < YYNTOKENS)
937
 
    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
938
 
# endif
939
 
  switch (yytype)
940
1069
    {
941
 
      default:
942
 
        break;
 
1070
      int yytype = YYTRANSLATE (yychar);
 
1071
      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
 
1072
      YYSIZE_T yysize = yysize0;
 
1073
      YYSIZE_T yysize1;
 
1074
      int yysize_overflow = 0;
 
1075
      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
 
1076
      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
 
1077
      int yyx;
 
1078
 
 
1079
# if 0
 
1080
      /* This is so xgettext sees the translatable formats that are
 
1081
         constructed on the fly.  */
 
1082
      YY_("syntax error, unexpected %s");
 
1083
      YY_("syntax error, unexpected %s, expecting %s");
 
1084
      YY_("syntax error, unexpected %s, expecting %s or %s");
 
1085
      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
 
1086
      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
 
1087
# endif
 
1088
      char *yyfmt;
 
1089
      char const *yyf;
 
1090
      static char const yyunexpected[] = "syntax error, unexpected %s";
 
1091
      static char const yyexpecting[] = ", expecting %s";
 
1092
      static char const yyor[] = " or %s";
 
1093
      char yyformat[sizeof yyunexpected
 
1094
                    + sizeof yyexpecting - 1
 
1095
                    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
 
1096
                       * (sizeof yyor - 1))];
 
1097
      char const *yyprefix = yyexpecting;
 
1098
 
 
1099
      /* Start YYX at -YYN if negative to avoid negative indexes in
 
1100
         YYCHECK.  */
 
1101
      int yyxbegin = yyn < 0 ? -yyn : 0;
 
1102
 
 
1103
      /* Stay within bounds of both yycheck and yytname.  */
 
1104
      int yychecklim = YYLAST - yyn + 1;
 
1105
      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
 
1106
      int yycount = 1;
 
1107
 
 
1108
      yyarg[0] = yytname[yytype];
 
1109
      yyfmt = yystpcpy (yyformat, yyunexpected);
 
1110
 
 
1111
      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
 
1112
        if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
 
1113
          {
 
1114
            if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
 
1115
              {
 
1116
                yycount = 1;
 
1117
                yysize = yysize0;
 
1118
                yyformat[sizeof yyunexpected - 1] = '\0';
 
1119
                break;
 
1120
              }
 
1121
            yyarg[yycount++] = yytname[yyx];
 
1122
            yysize1 = yysize + yytnamerr (0, yytname[yyx]);
 
1123
            yysize_overflow |= (yysize1 < yysize);
 
1124
            yysize = yysize1;
 
1125
            yyfmt = yystpcpy (yyfmt, yyprefix);
 
1126
            yyprefix = yyor;
 
1127
          }
 
1128
 
 
1129
      yyf = YY_(yyformat);
 
1130
      yysize1 = yysize + yystrlen (yyf);
 
1131
      yysize_overflow |= (yysize1 < yysize);
 
1132
      yysize = yysize1;
 
1133
 
 
1134
      if (yysize_overflow)
 
1135
        return YYSIZE_MAXIMUM;
 
1136
 
 
1137
      if (yyresult)
 
1138
        {
 
1139
          /* Avoid sprintf, as that infringes on the user's name space.
 
1140
             Don't have undefined behavior even if the translation
 
1141
             produced a string with the wrong number of "%s"s.  */
 
1142
          char *yyp = yyresult;
 
1143
          int yyi = 0;
 
1144
          while ((*yyp = *yyf) != '\0')
 
1145
            {
 
1146
              if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
 
1147
                {
 
1148
                  yyp += yytnamerr (yyp, yyarg[yyi++]);
 
1149
                  yyf += 2;
 
1150
                }
 
1151
              else
 
1152
                {
 
1153
                  yyp++;
 
1154
                  yyf++;
 
1155
                }
 
1156
            }
 
1157
        }
 
1158
      return yysize;
943
1159
    }
944
 
  YYFPRINTF (yyoutput, ")");
945
1160
}
 
1161
#endif /* YYERROR_VERBOSE */
 
1162
 
946
1163
 
947
 
#endif /* ! YYDEBUG */
948
1164
/*-----------------------------------------------.
949
1165
| Release the memory associated to this symbol.  |
950
1166
`-----------------------------------------------*/
951
1167
 
952
 
#if defined (__STDC__) || defined (__cplusplus)
 
1168
/*ARGSUSED*/
 
1169
#if (defined __STDC__ || defined __C99__FUNC__ \
 
1170
     || defined __cplusplus || defined _MSC_VER)
953
1171
static void
954
1172
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
955
1173
#else
960
1178
    YYSTYPE *yyvaluep;
961
1179
#endif
962
1180
{
963
 
  /* Pacify ``unused variable'' warnings.  */
964
 
  (void) yyvaluep;
 
1181
  YYUSE (yyvaluep);
965
1182
 
966
1183
  if (!yymsg)
967
1184
    yymsg = "Deleting";
969
1186
 
970
1187
  switch (yytype)
971
1188
    {
 
1189
      case 13: /* "\"string literal\"" */
 
1190
#line 159 "./n3_parser.y"
 
1191
        { RAPTOR_FREE(cstring, (yyvaluep->string)); };
 
1192
#line 1195 "n3_parser.c"
 
1193
        break;
 
1194
      case 14: /* "\"URI literal\"" */
 
1195
#line 160 "./n3_parser.y"
 
1196
        { raptor_free_uri((yyvaluep->uri)); };
 
1197
#line 1200 "n3_parser.c"
 
1198
        break;
 
1199
      case 15: /* "\"blank node\"" */
 
1200
#line 159 "./n3_parser.y"
 
1201
        { RAPTOR_FREE(cstring, (yyvaluep->string)); };
 
1202
#line 1205 "n3_parser.c"
 
1203
        break;
 
1204
      case 16: /* "\"QName\"" */
 
1205
#line 160 "./n3_parser.y"
 
1206
        { raptor_free_uri((yyvaluep->uri)); };
 
1207
#line 1210 "n3_parser.c"
 
1208
        break;
 
1209
      case 18: /* "\"identifier\"" */
 
1210
#line 159 "./n3_parser.y"
 
1211
        { RAPTOR_FREE(cstring, (yyvaluep->string)); };
 
1212
#line 1215 "n3_parser.c"
 
1213
        break;
 
1214
      case 21: /* "\"decimal literal\"" */
 
1215
#line 159 "./n3_parser.y"
 
1216
        { RAPTOR_FREE(cstring, (yyvaluep->string)); };
 
1217
#line 1220 "n3_parser.c"
 
1218
        break;
972
1219
 
973
1220
      default:
974
 
        break;
 
1221
        break;
975
1222
    }
976
1223
}
977
1224
 
979
1226
/* Prevent warnings from -Wmissing-prototypes.  */
980
1227
 
981
1228
#ifdef YYPARSE_PARAM
982
 
# if defined (__STDC__) || defined (__cplusplus)
 
1229
#if defined __STDC__ || defined __cplusplus
983
1230
int yyparse (void *YYPARSE_PARAM);
984
 
# else
 
1231
#else
985
1232
int yyparse ();
986
 
# endif
 
1233
#endif
987
1234
#else /* ! YYPARSE_PARAM */
988
 
#if defined (__STDC__) || defined (__cplusplus)
 
1235
#if defined __STDC__ || defined __cplusplus
989
1236
int yyparse (void);
990
1237
#else
991
1238
int yyparse ();
1002
1249
`----------*/
1003
1250
 
1004
1251
#ifdef YYPARSE_PARAM
1005
 
# if defined (__STDC__) || defined (__cplusplus)
1006
 
int yyparse (void *YYPARSE_PARAM)
1007
 
# else
1008
 
int yyparse (YYPARSE_PARAM)
1009
 
  void *YYPARSE_PARAM;
1010
 
# endif
 
1252
#if (defined __STDC__ || defined __C99__FUNC__ \
 
1253
     || defined __cplusplus || defined _MSC_VER)
 
1254
int
 
1255
yyparse (void *YYPARSE_PARAM)
 
1256
#else
 
1257
int
 
1258
yyparse (YYPARSE_PARAM)
 
1259
    void *YYPARSE_PARAM;
 
1260
#endif
1011
1261
#else /* ! YYPARSE_PARAM */
1012
 
#if defined (__STDC__) || defined (__cplusplus)
 
1262
#if (defined __STDC__ || defined __C99__FUNC__ \
 
1263
     || defined __cplusplus || defined _MSC_VER)
1013
1264
int
1014
1265
yyparse (void)
1015
1266
#else
1016
1267
int
1017
1268
yyparse ()
1018
 
    ;
 
1269
 
1019
1270
#endif
1020
1271
#endif
1021
1272
{
1035
1286
  int yyerrstatus;
1036
1287
  /* Look-ahead token as an internal (translated) token number.  */
1037
1288
  int yytoken = 0;
 
1289
#if YYERROR_VERBOSE
 
1290
  /* Buffer for error messages, and its allocated size.  */
 
1291
  char yymsgbuf[128];
 
1292
  char *yymsg = yymsgbuf;
 
1293
  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
 
1294
#endif
1038
1295
 
1039
1296
  /* Three stacks and their tools:
1040
1297
     `yyss': related to states,
1045
1302
     to reallocate them elsewhere.  */
1046
1303
 
1047
1304
  /* The state stack.  */
1048
 
  short int yyssa[YYINITDEPTH];
1049
 
  short int *yyss = yyssa;
1050
 
  short int *yyssp;
 
1305
  yytype_int16 yyssa[YYINITDEPTH];
 
1306
  yytype_int16 *yyss = yyssa;
 
1307
  yytype_int16 *yyssp;
1051
1308
 
1052
1309
  /* The semantic value stack.  */
1053
1310
  YYSTYPE yyvsa[YYINITDEPTH];
1056
1313
 
1057
1314
 
1058
1315
 
1059
 
#define YYPOPSTACK   (yyvsp--, yyssp--)
 
1316
#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1060
1317
 
1061
1318
  YYSIZE_T yystacksize = YYINITDEPTH;
1062
1319
 
1065
1322
  YYSTYPE yyval;
1066
1323
 
1067
1324
 
1068
 
  /* When reducing, the number of symbols on the RHS of the reduced
1069
 
     rule.  */
1070
 
  int yylen;
 
1325
  /* The number of symbols on the RHS of the reduced rule.
 
1326
     Keep to zero when no symbol should be popped.  */
 
1327
  int yylen = 0;
1071
1328
 
1072
1329
  YYDPRINTF ((stderr, "Starting parse\n"));
1073
1330
 
1091
1348
`------------------------------------------------------------*/
1092
1349
 yynewstate:
1093
1350
  /* In all cases, when you get here, the value and location stacks
1094
 
     have just been pushed. so pushing a state here evens the stacks.
1095
 
     */
 
1351
     have just been pushed.  So pushing a state here evens the stacks.  */
1096
1352
  yyssp++;
1097
1353
 
1098
1354
 yysetstate:
1105
1361
 
1106
1362
#ifdef yyoverflow
1107
1363
      {
1108
 
        /* Give user a chance to reallocate the stack. Use copies of
 
1364
        /* Give user a chance to reallocate the stack.  Use copies of
1109
1365
           these so that the &'s don't force the real ones into
1110
1366
           memory.  */
1111
1367
        YYSTYPE *yyvs1 = yyvs;
1112
 
        short int *yyss1 = yyss;
 
1368
        yytype_int16 *yyss1 = yyss;
1113
1369
 
1114
1370
 
1115
1371
        /* Each stack pointer address is followed by the size of the
1137
1393
        yystacksize = YYMAXDEPTH;
1138
1394
 
1139
1395
      {
1140
 
        short int *yyss1 = yyss;
 
1396
        yytype_int16 *yyss1 = yyss;
1141
1397
        union yyalloc *yyptr =
1142
1398
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1143
1399
        if (! yyptr)
1172
1428
`-----------*/
1173
1429
yybackup:
1174
1430
 
1175
 
/* Do appropriate processing given the current state.  */
1176
 
/* Read a look-ahead token if we need one and don't already have one.  */
1177
 
/* yyresume: */
 
1431
  /* Do appropriate processing given the current state.  Read a
 
1432
     look-ahead token if we need one and don't already have one.  */
1178
1433
 
1179
1434
  /* First try to decide what to do without reference to look-ahead token.  */
1180
 
 
1181
1435
  yyn = yypact[yystate];
1182
1436
  if (yyn == YYPACT_NINF)
1183
1437
    goto yydefault;
1219
1473
  if (yyn == YYFINAL)
1220
1474
    YYACCEPT;
1221
1475
 
 
1476
  /* Count tokens shifted since error; after three, turn off error
 
1477
     status.  */
 
1478
  if (yyerrstatus)
 
1479
    yyerrstatus--;
 
1480
 
1222
1481
  /* Shift the look-ahead token.  */
1223
1482
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1224
1483
 
1225
 
  /* Discard the token being shifted unless it is eof.  */
 
1484
  /* Discard the shifted token unless it is eof.  */
1226
1485
  if (yychar != YYEOF)
1227
1486
    yychar = YYEMPTY;
1228
1487
 
 
1488
  yystate = yyn;
1229
1489
  *++yyvsp = yylval;
1230
1490
 
1231
 
 
1232
 
  /* Count tokens shifted since error; after three, turn off error
1233
 
     status.  */
1234
 
  if (yyerrstatus)
1235
 
    yyerrstatus--;
1236
 
 
1237
 
  yystate = yyn;
1238
1491
  goto yynewstate;
1239
1492
 
1240
1493
 
1270
1523
  switch (yyn)
1271
1524
    {
1272
1525
        case 6:
1273
 
#line 169 "./n3_parser.y"
 
1526
#line 176 "./n3_parser.y"
1274
1527
    {
1275
1528
  int i;
1276
1529
 
1277
1530
#if RAPTOR_DEBUG > 1  
1278
1531
  printf("statement 2\n subject=");
1279
 
  if((yyvsp[-2].identifier))
1280
 
    raptor_identifier_print(stdout, (yyvsp[-2].identifier));
 
1532
  if((yyvsp[(1) - (3)].identifier))
 
1533
    raptor_identifier_print(stdout, (yyvsp[(1) - (3)].identifier));
1281
1534
  else
1282
1535
    fputs("NULL", stdout);
1283
 
  if((yyvsp[-1].sequence)) {
 
1536
  if((yyvsp[(2) - (3)].sequence)) {
1284
1537
    printf("\n propertyList (reverse order to syntax)=");
1285
 
    raptor_sequence_print((yyvsp[-1].sequence), stdout);
 
1538
    raptor_sequence_print((yyvsp[(2) - (3)].sequence), stdout);
1286
1539
    printf("\n");
1287
1540
  } else     
1288
1541
    printf("\n and empty propertyList\n");
1289
1542
#endif
1290
1543
 
1291
 
  if((yyvsp[-2].identifier) && (yyvsp[-1].sequence)) {
 
1544
  if((yyvsp[(1) - (3)].identifier) && (yyvsp[(2) - (3)].sequence)) {
1292
1545
    /* have subject and non-empty property list, handle it  */
1293
 
    for(i=0; i<raptor_sequence_size((yyvsp[-1].sequence)); i++) {
1294
 
      raptor_triple* t2=(raptor_triple*)raptor_sequence_get_at((yyvsp[-1].sequence), i);
 
1546
    for(i=0; i<raptor_sequence_size((yyvsp[(2) - (3)].sequence)); i++) {
 
1547
      raptor_triple* t2=(raptor_triple*)raptor_sequence_get_at((yyvsp[(2) - (3)].sequence), i);
1295
1548
      raptor_identifier *i2=(raptor_identifier*)RAPTOR_CALLOC(raptor_identifier, 1, sizeof(raptor_identifier));
1296
 
      raptor_copy_identifier(i2, (yyvsp[-2].identifier));
 
1549
      raptor_copy_identifier(i2, (yyvsp[(1) - (3)].identifier));
1297
1550
      t2->subject=i2;
1298
1551
      t2->subject->is_malloced=1;
1299
1552
    }
1300
1553
#if RAPTOR_DEBUG > 1  
1301
1554
    printf(" after substitution propertyList=");
1302
 
    raptor_sequence_print((yyvsp[-1].sequence), stdout);
 
1555
    raptor_sequence_print((yyvsp[(2) - (3)].sequence), stdout);
1303
1556
    printf("\n\n");
1304
1557
#endif
1305
 
    for(i=0; i<raptor_sequence_size((yyvsp[-1].sequence)); i++) {
1306
 
      raptor_triple* t2=(raptor_triple*)raptor_sequence_get_at((yyvsp[-1].sequence), i);
 
1558
    for(i=0; i<raptor_sequence_size((yyvsp[(2) - (3)].sequence)); i++) {
 
1559
      raptor_triple* t2=(raptor_triple*)raptor_sequence_get_at((yyvsp[(2) - (3)].sequence), i);
1307
1560
      raptor_n3_generate_statement((raptor_parser*)rdf_parser, t2);
1308
1561
    }
1309
1562
  }
1310
1563
 
1311
 
  if((yyvsp[-1].sequence))
1312
 
    raptor_free_sequence((yyvsp[-1].sequence));
 
1564
  if((yyvsp[(2) - (3)].sequence))
 
1565
    raptor_free_sequence((yyvsp[(2) - (3)].sequence));
1313
1566
 
1314
 
  if((yyvsp[-2].identifier))
1315
 
    raptor_free_identifier((yyvsp[-2].identifier));
 
1567
  if((yyvsp[(1) - (3)].identifier))
 
1568
    raptor_free_identifier((yyvsp[(1) - (3)].identifier));
1316
1569
}
1317
1570
    break;
1318
1571
 
1319
1572
  case 8:
1320
 
#line 217 "./n3_parser.y"
 
1573
#line 224 "./n3_parser.y"
1321
1574
    {
1322
1575
  raptor_triple *triple;
1323
1576
 
1324
1577
#if RAPTOR_DEBUG > 1  
1325
1578
  printf("objectList 1\n");
1326
 
  if((yyvsp[0].identifier)) {
 
1579
  if((yyvsp[(3) - (3)].identifier)) {
1327
1580
    printf(" object=\n");
1328
 
    raptor_identifier_print(stdout, (yyvsp[0].identifier));
 
1581
    raptor_identifier_print(stdout, (yyvsp[(3) - (3)].identifier));
1329
1582
    printf("\n");
1330
1583
  } else  
1331
1584
    printf(" and empty object\n");
1332
 
  if((yyvsp[-2].sequence)) {
 
1585
  if((yyvsp[(1) - (3)].sequence)) {
1333
1586
    printf(" objectList=");
1334
 
    raptor_sequence_print((yyvsp[-2].sequence), stdout);
 
1587
    raptor_sequence_print((yyvsp[(1) - (3)].sequence), stdout);
1335
1588
    printf("\n");
1336
1589
  } else
1337
1590
    printf(" and empty objectList\n");
1338
1591
#endif
1339
1592
 
1340
 
  if(!(yyvsp[0].identifier))
 
1593
  if(!(yyvsp[(3) - (3)].identifier))
1341
1594
    (yyval.sequence)=NULL;
1342
1595
  else {
1343
 
    triple=raptor_n3_new_triple(NULL, NULL, (yyvsp[0].identifier));
1344
 
    (yyval.sequence)=(yyvsp[-2].sequence);
 
1596
    triple=raptor_n3_new_triple(NULL, NULL, (yyvsp[(3) - (3)].identifier));
 
1597
    (yyval.sequence)=(yyvsp[(1) - (3)].sequence);
1345
1598
    raptor_sequence_push((yyval.sequence), triple);
1346
1599
#if RAPTOR_DEBUG > 1  
1347
1600
    printf(" objectList is now ");
1353
1606
    break;
1354
1607
 
1355
1608
  case 9:
1356
 
#line 250 "./n3_parser.y"
 
1609
#line 257 "./n3_parser.y"
1357
1610
    {
1358
1611
  raptor_triple *triple;
1359
1612
 
1360
1613
#if RAPTOR_DEBUG > 1  
1361
1614
  printf("objectList 2\n");
1362
 
  if((yyvsp[0].identifier)) {
 
1615
  if((yyvsp[(1) - (1)].identifier)) {
1363
1616
    printf(" object=\n");
1364
 
    raptor_identifier_print(stdout, (yyvsp[0].identifier));
 
1617
    raptor_identifier_print(stdout, (yyvsp[(1) - (1)].identifier));
1365
1618
    printf("\n");
1366
1619
  } else  
1367
1620
    printf(" and empty object\n");
1368
1621
#endif
1369
1622
 
1370
 
  if(!(yyvsp[0].identifier))
 
1623
  if(!(yyvsp[(1) - (1)].identifier))
1371
1624
    (yyval.sequence)=NULL;
1372
1625
  else {
1373
 
    triple=raptor_n3_new_triple(NULL, NULL, (yyvsp[0].identifier));
 
1626
    triple=raptor_n3_new_triple(NULL, NULL, (yyvsp[(1) - (1)].identifier));
1374
1627
#ifdef RAPTOR_DEBUG
1375
1628
    (yyval.sequence)=raptor_new_sequence((raptor_sequence_free_handler*)raptor_n3_free_triple,
1376
1629
                           (raptor_sequence_print_handler*)raptor_triple_print);
1388
1641
    break;
1389
1642
 
1390
1643
  case 10:
1391
 
#line 284 "./n3_parser.y"
 
1644
#line 291 "./n3_parser.y"
1392
1645
    {
1393
1646
  raptor_triple *triple;
1394
1647
 
1395
1648
#if RAPTOR_DEBUG > 1  
1396
1649
  printf("objectList 1\n");
1397
 
  if((yyvsp[0].identifier)) {
 
1650
  if((yyvsp[(2) - (2)].identifier)) {
1398
1651
    printf(" object=\n");
1399
 
    raptor_identifier_print(stdout, (yyvsp[0].identifier));
 
1652
    raptor_identifier_print(stdout, (yyvsp[(2) - (2)].identifier));
1400
1653
    printf("\n");
1401
1654
  } else  
1402
1655
    printf(" and empty object\n");
1403
 
  if((yyvsp[-1].sequence)) {
 
1656
  if((yyvsp[(1) - (2)].sequence)) {
1404
1657
    printf(" objectList=");
1405
 
    raptor_sequence_print((yyvsp[-1].sequence), stdout);
 
1658
    raptor_sequence_print((yyvsp[(1) - (2)].sequence), stdout);
1406
1659
    printf("\n");
1407
1660
  } else
1408
1661
    printf(" and empty objectList\n");
1409
1662
#endif
1410
1663
 
1411
 
  if(!(yyvsp[0].identifier))
 
1664
  if(!(yyvsp[(2) - (2)].identifier))
1412
1665
    (yyval.sequence)=NULL;
1413
1666
  else {
1414
 
    triple=raptor_n3_new_triple(NULL, NULL, (yyvsp[0].identifier));
1415
 
    (yyval.sequence)=(yyvsp[-1].sequence);
 
1667
    triple=raptor_n3_new_triple(NULL, NULL, (yyvsp[(2) - (2)].identifier));
 
1668
    (yyval.sequence)=(yyvsp[(1) - (2)].sequence);
1416
1669
    raptor_sequence_push((yyval.sequence), triple);
1417
1670
#if RAPTOR_DEBUG > 1  
1418
1671
    printf(" objectList is now ");
1424
1677
    break;
1425
1678
 
1426
1679
  case 11:
1427
 
#line 317 "./n3_parser.y"
 
1680
#line 324 "./n3_parser.y"
1428
1681
    {
1429
1682
  raptor_triple *triple;
1430
1683
 
1431
1684
#if RAPTOR_DEBUG > 1  
1432
1685
  printf("objectList 2\n");
1433
 
  if((yyvsp[0].identifier)) {
 
1686
  if((yyvsp[(1) - (1)].identifier)) {
1434
1687
    printf(" object=\n");
1435
 
    raptor_identifier_print(stdout, (yyvsp[0].identifier));
 
1688
    raptor_identifier_print(stdout, (yyvsp[(1) - (1)].identifier));
1436
1689
    printf("\n");
1437
1690
  } else  
1438
1691
    printf(" and empty object\n");
1439
1692
#endif
1440
1693
 
1441
 
  if(!(yyvsp[0].identifier))
 
1694
  if(!(yyvsp[(1) - (1)].identifier))
1442
1695
    (yyval.sequence)=NULL;
1443
1696
  else {
1444
 
    triple=raptor_n3_new_triple(NULL, NULL, (yyvsp[0].identifier));
 
1697
    triple=raptor_n3_new_triple(NULL, NULL, (yyvsp[(1) - (1)].identifier));
1445
1698
#ifdef RAPTOR_DEBUG
1446
1699
    (yyval.sequence)=raptor_new_sequence((raptor_sequence_free_handler*)raptor_n3_free_triple,
1447
1700
                           (raptor_sequence_print_handler*)raptor_triple_print);
1459
1712
    break;
1460
1713
 
1461
1714
  case 12:
1462
 
#line 351 "./n3_parser.y"
 
1715
#line 358 "./n3_parser.y"
1463
1716
    {
1464
1717
#if RAPTOR_DEBUG > 1  
1465
1718
  printf("verb predicate=");
1466
 
  raptor_identifier_print(stdout, (yyvsp[0].identifier));
 
1719
  raptor_identifier_print(stdout, (yyvsp[(1) - (1)].identifier));
1467
1720
  printf("\n");
1468
1721
#endif
1469
1722
 
1470
 
  (yyval.identifier)=(yyvsp[0].identifier);
 
1723
  (yyval.identifier)=(yyvsp[(1) - (1)].identifier);
1471
1724
}
1472
1725
    break;
1473
1726
 
1474
1727
  case 13:
1475
 
#line 361 "./n3_parser.y"
 
1728
#line 368 "./n3_parser.y"
1476
1729
    {
1477
1730
  raptor_uri *uri;
1478
1731
 
1486
1739
    break;
1487
1740
 
1488
1741
  case 14:
1489
 
#line 375 "./n3_parser.y"
 
1742
#line 382 "./n3_parser.y"
1490
1743
    {
1491
1744
  int i;
1492
1745
  
1493
1746
#if RAPTOR_DEBUG > 1  
1494
1747
  printf("propertyList 1\n verb=");
1495
 
  raptor_identifier_print(stdout, (yyvsp[-1].identifier));
 
1748
  raptor_identifier_print(stdout, (yyvsp[(3) - (4)].identifier));
1496
1749
  printf("\n objectList=");
1497
 
  raptor_sequence_print((yyvsp[0].sequence), stdout);
 
1750
  raptor_sequence_print((yyvsp[(4) - (4)].sequence), stdout);
1498
1751
  printf("\n propertyList=");
1499
 
  raptor_sequence_print((yyvsp[-3].sequence), stdout);
 
1752
  raptor_sequence_print((yyvsp[(1) - (4)].sequence), stdout);
1500
1753
  printf("\n\n");
1501
1754
#endif
1502
1755
  
1503
 
  if((yyvsp[0].sequence) == NULL) {
 
1756
  if((yyvsp[(4) - (4)].sequence) == NULL) {
1504
1757
#if RAPTOR_DEBUG > 1  
1505
1758
    printf(" empty objectList not processed\n");
1506
1759
#endif
1507
 
  } else if((yyvsp[-1].identifier) && (yyvsp[0].sequence)) {
 
1760
  } else if((yyvsp[(3) - (4)].identifier) && (yyvsp[(4) - (4)].sequence)) {
1508
1761
    /* non-empty property list, handle it  */
1509
 
    for(i=0; i<raptor_sequence_size((yyvsp[0].sequence)); i++) {
1510
 
      raptor_triple* t2=(raptor_triple*)raptor_sequence_get_at((yyvsp[0].sequence), i);
 
1762
    for(i=0; i<raptor_sequence_size((yyvsp[(4) - (4)].sequence)); i++) {
 
1763
      raptor_triple* t2=(raptor_triple*)raptor_sequence_get_at((yyvsp[(4) - (4)].sequence), i);
1511
1764
      raptor_identifier *i2=(raptor_identifier*)RAPTOR_CALLOC(raptor_identifier, 1, sizeof(raptor_identifier));
1512
 
      raptor_copy_identifier(i2, (yyvsp[-1].identifier));
 
1765
      raptor_copy_identifier(i2, (yyvsp[(3) - (4)].identifier));
1513
1766
      t2->predicate=i2;
1514
1767
      t2->predicate->is_malloced=1;
1515
1768
    }
1516
1769
  
1517
1770
#if RAPTOR_DEBUG > 1  
1518
1771
    printf(" after substitution objectList=");
1519
 
    raptor_sequence_print((yyvsp[0].sequence), stdout);
 
1772
    raptor_sequence_print((yyvsp[(4) - (4)].sequence), stdout);
1520
1773
    printf("\n");
1521
1774
#endif
1522
1775
  }
1523
1776
 
1524
 
  if((yyvsp[-3].sequence) == NULL) {
 
1777
  if((yyvsp[(1) - (4)].sequence) == NULL) {
1525
1778
#if RAPTOR_DEBUG > 1  
1526
1779
    printf(" empty propertyList not copied\n\n");
1527
1780
#endif
1528
 
  } else if ((yyvsp[-1].identifier) && (yyvsp[0].sequence) && (yyvsp[-3].sequence)) {
1529
 
    for(i=0; i<raptor_sequence_size((yyvsp[0].sequence)); i++) {
1530
 
      raptor_triple* t2=(raptor_triple*)raptor_sequence_get_at((yyvsp[0].sequence), i);
1531
 
      raptor_sequence_push((yyvsp[-3].sequence), t2);
 
1781
  } else if ((yyvsp[(3) - (4)].identifier) && (yyvsp[(4) - (4)].sequence) && (yyvsp[(1) - (4)].sequence)) {
 
1782
    for(i=0; i<raptor_sequence_size((yyvsp[(4) - (4)].sequence)); i++) {
 
1783
      raptor_triple* t2=(raptor_triple*)raptor_sequence_get_at((yyvsp[(4) - (4)].sequence), i);
 
1784
      raptor_sequence_push((yyvsp[(1) - (4)].sequence), t2);
1532
1785
    }
1533
 
    while(raptor_sequence_size((yyvsp[0].sequence)))
1534
 
      raptor_sequence_pop((yyvsp[0].sequence));
 
1786
    while(raptor_sequence_size((yyvsp[(4) - (4)].sequence)))
 
1787
      raptor_sequence_pop((yyvsp[(4) - (4)].sequence));
1535
1788
 
1536
1789
#if RAPTOR_DEBUG > 1  
1537
1790
    printf(" after appending objectList (reverse order)=");
1538
 
    raptor_sequence_print((yyvsp[-3].sequence), stdout);
 
1791
    raptor_sequence_print((yyvsp[(1) - (4)].sequence), stdout);
1539
1792
    printf("\n\n");
1540
1793
#endif
1541
1794
 
1542
 
    raptor_free_sequence((yyvsp[0].sequence));
 
1795
    raptor_free_sequence((yyvsp[(4) - (4)].sequence));
1543
1796
  }
1544
1797
 
1545
 
  if((yyvsp[-1].identifier))
1546
 
    raptor_free_identifier((yyvsp[-1].identifier));
 
1798
  if((yyvsp[(3) - (4)].identifier))
 
1799
    raptor_free_identifier((yyvsp[(3) - (4)].identifier));
1547
1800
 
1548
 
  (yyval.sequence)=(yyvsp[-3].sequence);
 
1801
  (yyval.sequence)=(yyvsp[(1) - (4)].sequence);
1549
1802
}
1550
1803
    break;
1551
1804
 
1552
1805
  case 15:
1553
 
#line 436 "./n3_parser.y"
 
1806
#line 443 "./n3_parser.y"
1554
1807
    {
1555
1808
  int i;
1556
1809
#if RAPTOR_DEBUG > 1  
1557
1810
  printf("propertyList 2\n verb=");
1558
 
  raptor_identifier_print(stdout, (yyvsp[-1].identifier));
1559
 
  if((yyvsp[0].sequence)) {
 
1811
  raptor_identifier_print(stdout, (yyvsp[(1) - (2)].identifier));
 
1812
  if((yyvsp[(2) - (2)].sequence)) {
1560
1813
    printf("\n objectList=");
1561
 
    raptor_sequence_print((yyvsp[0].sequence), stdout);
 
1814
    raptor_sequence_print((yyvsp[(2) - (2)].sequence), stdout);
1562
1815
    printf("\n");
1563
1816
  } else
1564
1817
    printf("\n and empty objectList\n");
1565
1818
#endif
1566
1819
 
1567
 
  if((yyvsp[-1].identifier) && (yyvsp[0].sequence)) {
1568
 
    for(i=0; i<raptor_sequence_size((yyvsp[0].sequence)); i++) {
1569
 
      raptor_triple* t2=(raptor_triple*)raptor_sequence_get_at((yyvsp[0].sequence), i);
 
1820
  if((yyvsp[(1) - (2)].identifier) && (yyvsp[(2) - (2)].sequence)) {
 
1821
    for(i=0; i<raptor_sequence_size((yyvsp[(2) - (2)].sequence)); i++) {
 
1822
      raptor_triple* t2=(raptor_triple*)raptor_sequence_get_at((yyvsp[(2) - (2)].sequence), i);
1570
1823
      raptor_identifier *i2=(raptor_identifier*)RAPTOR_CALLOC(raptor_identifier, 1, sizeof(raptor_identifier));
1571
 
      raptor_copy_identifier(i2, (yyvsp[-1].identifier));
 
1824
      raptor_copy_identifier(i2, (yyvsp[(1) - (2)].identifier));
1572
1825
      t2->predicate=i2;
1573
1826
      t2->predicate->is_malloced=1;
1574
1827
    }
1575
1828
 
1576
1829
#if RAPTOR_DEBUG > 1  
1577
1830
    printf(" after substitution objectList=");
1578
 
    raptor_sequence_print((yyvsp[0].sequence), stdout);
 
1831
    raptor_sequence_print((yyvsp[(2) - (2)].sequence), stdout);
1579
1832
    printf("\n\n");
1580
1833
#endif
1581
1834
  }
1582
1835
 
1583
 
  if((yyvsp[-1].identifier))
1584
 
    raptor_free_identifier((yyvsp[-1].identifier));
 
1836
  if((yyvsp[(1) - (2)].identifier))
 
1837
    raptor_free_identifier((yyvsp[(1) - (2)].identifier));
1585
1838
 
1586
 
  (yyval.sequence)=(yyvsp[0].sequence);
 
1839
  (yyval.sequence)=(yyvsp[(2) - (2)].sequence);
1587
1840
}
1588
1841
    break;
1589
1842
 
1590
1843
  case 16:
1591
 
#line 471 "./n3_parser.y"
 
1844
#line 478 "./n3_parser.y"
1592
1845
    {
1593
1846
#if RAPTOR_DEBUG > 1  
1594
1847
  printf("propertyList 4\n empty returning NULL\n\n");
1598
1851
    break;
1599
1852
 
1600
1853
  case 17:
1601
 
#line 478 "./n3_parser.y"
 
1854
#line 485 "./n3_parser.y"
1602
1855
    {
1603
 
  (yyval.sequence)=(yyvsp[-1].sequence);
 
1856
  (yyval.sequence)=(yyvsp[(1) - (2)].sequence);
1604
1857
#if RAPTOR_DEBUG > 1  
1605
1858
  printf("propertyList 5\n trailing semicolon returning existing list ");
1606
1859
  raptor_sequence_print((yyval.sequence), stdout);
1610
1863
    break;
1611
1864
 
1612
1865
  case 18:
1613
 
#line 489 "./n3_parser.y"
 
1866
#line 496 "./n3_parser.y"
1614
1867
    {
1615
 
  unsigned char *prefix=(yyvsp[-2].string);
 
1868
  unsigned char *prefix=(yyvsp[(2) - (4)].string);
1616
1869
  raptor_n3_parser* n3_parser=(raptor_n3_parser*)(((raptor_parser*)rdf_parser)->context);
1617
1870
  raptor_namespace *ns;
1618
1871
 
 
1872
#if 0
 
1873
  Get around bison complaining about not using (yyvsp[(1) - (4)].string)
 
1874
#endif
 
1875
 
1619
1876
#if RAPTOR_DEBUG > 1  
1620
 
  printf("directive @prefix %s %s\n",((yyvsp[-2].string) ? (char*)(yyvsp[-2].string) : "(default)"),raptor_uri_as_string((yyvsp[-1].uri)));
 
1877
  printf("directive @prefix %s %s\n",((yyvsp[(2) - (4)].string) ? (char*)(yyvsp[(2) - (4)].string) : "(default)"),raptor_uri_as_string((yyvsp[(3) - (4)].uri)));
1621
1878
#endif
1622
1879
 
1623
1880
  if(prefix) {
1631
1888
    }
1632
1889
  }
1633
1890
 
1634
 
  ns=raptor_new_namespace_from_uri(&n3_parser->namespaces, prefix, (yyvsp[-1].uri), 0);
 
1891
  ns=raptor_new_namespace_from_uri(&n3_parser->namespaces, prefix, (yyvsp[(3) - (4)].uri), 0);
1635
1892
  if(ns) {
1636
1893
    raptor_namespaces_start_namespace(&n3_parser->namespaces, ns);
1637
1894
    raptor_parser_start_namespace((raptor_parser*)rdf_parser, ns);
1638
1895
  }
1639
1896
 
1640
 
  if((yyvsp[-2].string))
1641
 
    RAPTOR_FREE(cstring, (yyvsp[-2].string));
1642
 
  raptor_free_uri((yyvsp[-1].uri));
 
1897
  if((yyvsp[(2) - (4)].string))
 
1898
    RAPTOR_FREE(cstring, (yyvsp[(2) - (4)].string));
 
1899
  raptor_free_uri((yyvsp[(3) - (4)].uri));
1643
1900
}
1644
1901
    break;
1645
1902
 
1646
1903
  case 19:
1647
 
#line 523 "./n3_parser.y"
 
1904
#line 534 "./n3_parser.y"
1648
1905
    {
1649
 
  (yyval.identifier)=(yyvsp[0].identifier);
 
1906
  (yyval.identifier)=(yyvsp[(1) - (1)].identifier);
1650
1907
}
1651
1908
    break;
1652
1909
 
1653
1910
  case 20:
1654
 
#line 527 "./n3_parser.y"
 
1911
#line 538 "./n3_parser.y"
1655
1912
    {
1656
 
  (yyval.identifier)=(yyvsp[0].identifier);
 
1913
  (yyval.identifier)=(yyvsp[(1) - (1)].identifier);
1657
1914
}
1658
1915
    break;
1659
1916
 
1660
1917
  case 21:
1661
 
#line 534 "./n3_parser.y"
 
1918
#line 545 "./n3_parser.y"
1662
1919
    {
1663
 
  (yyval.identifier)=(yyvsp[0].identifier);
 
1920
  (yyval.identifier)=(yyvsp[(1) - (1)].identifier);
1664
1921
}
1665
1922
    break;
1666
1923
 
1667
1924
  case 22:
1668
 
#line 541 "./n3_parser.y"
 
1925
#line 552 "./n3_parser.y"
1669
1926
    {
1670
 
  (yyval.identifier)=(yyvsp[0].identifier);
 
1927
  (yyval.identifier)=(yyvsp[(1) - (1)].identifier);
1671
1928
}
1672
1929
    break;
1673
1930
 
1674
1931
  case 23:
1675
 
#line 545 "./n3_parser.y"
 
1932
#line 556 "./n3_parser.y"
1676
1933
    {
1677
 
  (yyval.identifier)=(yyvsp[0].identifier);
 
1934
  (yyval.identifier)=(yyvsp[(1) - (1)].identifier);
1678
1935
}
1679
1936
    break;
1680
1937
 
1681
1938
  case 24:
1682
 
#line 549 "./n3_parser.y"
 
1939
#line 560 "./n3_parser.y"
1683
1940
    {
1684
1941
#if RAPTOR_DEBUG > 1  
1685
1942
  printf("object literal=");
1686
 
  raptor_identifier_print(stdout, (yyvsp[0].identifier));
 
1943
  raptor_identifier_print(stdout, (yyvsp[(1) - (1)].identifier));
1687
1944
  printf("\n");
1688
1945
#endif
1689
1946
 
1690
 
  (yyval.identifier)=(yyvsp[0].identifier);
 
1947
  (yyval.identifier)=(yyvsp[(1) - (1)].identifier);
1691
1948
}
1692
1949
    break;
1693
1950
 
1694
1951
  case 25:
1695
 
#line 562 "./n3_parser.y"
 
1952
#line 573 "./n3_parser.y"
1696
1953
    {
1697
1954
#if RAPTOR_DEBUG > 1  
1698
 
  printf("literal + language string=\"%s\"\n", (yyvsp[-2].string));
 
1955
  printf("literal + language string=\"%s\"\n", (yyvsp[(1) - (3)].string));
1699
1956
#endif
1700
1957
 
1701
 
  (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_LITERAL, NULL, RAPTOR_URI_SOURCE_ELEMENT, NULL, (yyvsp[-2].string), NULL, (yyvsp[0].string));
 
1958
  (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_LITERAL, NULL, RAPTOR_URI_SOURCE_ELEMENT, NULL, (yyvsp[(1) - (3)].string), NULL, (yyvsp[(3) - (3)].string));
1702
1959
}
1703
1960
    break;
1704
1961
 
1705
1962
  case 26:
1706
 
#line 570 "./n3_parser.y"
 
1963
#line 581 "./n3_parser.y"
1707
1964
    {
1708
1965
#if RAPTOR_DEBUG > 1  
1709
 
  printf("literal + language=\"%s\" datatype string=\"%s\" uri=\"%s\"\n", (yyvsp[-4].string), (yyvsp[-2].string), raptor_uri_as_string((yyvsp[0].uri)));
 
1966
  printf("literal + language=\"%s\" datatype string=\"%s\" uri=\"%s\"\n", (yyvsp[(1) - (5)].string), (yyvsp[(3) - (5)].string), raptor_uri_as_string((yyvsp[(5) - (5)].uri)));
1710
1967
#endif
1711
1968
 
1712
 
  if((yyvsp[0].uri))
1713
 
    (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_LITERAL, NULL, RAPTOR_URI_SOURCE_ELEMENT, NULL, (yyvsp[-4].string), (yyvsp[0].uri), (yyvsp[-2].string));
 
1969
  if((yyvsp[(5) - (5)].uri))
 
1970
    (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_LITERAL, NULL, RAPTOR_URI_SOURCE_ELEMENT, NULL, (yyvsp[(1) - (5)].string), (yyvsp[(5) - (5)].uri), (yyvsp[(3) - (5)].string));
1714
1971
  else
1715
1972
    (yyval.identifier)=NULL;
1716
1973
    
1718
1975
    break;
1719
1976
 
1720
1977
  case 27:
1721
 
#line 582 "./n3_parser.y"
 
1978
#line 593 "./n3_parser.y"
1722
1979
    {
1723
1980
#if RAPTOR_DEBUG > 1  
1724
 
  printf("literal + language=\"%s\" datatype string=\"%s\" qname URI=<%s>\n", (yyvsp[-4].string), (yyvsp[-2].string), raptor_uri_as_string((yyvsp[0].uri)));
 
1981
  printf("literal + language=\"%s\" datatype string=\"%s\" qname URI=<%s>\n", (yyvsp[(1) - (5)].string), (yyvsp[(3) - (5)].string), raptor_uri_as_string((yyvsp[(5) - (5)].uri)));
1725
1982
#endif
1726
1983
 
1727
 
  if((yyvsp[0].uri))
1728
 
    (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_LITERAL, NULL, RAPTOR_URI_SOURCE_ELEMENT, NULL, (const unsigned char*)(yyvsp[-4].string), (yyvsp[0].uri), (yyvsp[-2].string));
 
1984
  if((yyvsp[(5) - (5)].uri))
 
1985
    (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_LITERAL, NULL, RAPTOR_URI_SOURCE_ELEMENT, NULL, (const unsigned char*)(yyvsp[(1) - (5)].string), (yyvsp[(5) - (5)].uri), (yyvsp[(3) - (5)].string));
1729
1986
  else
1730
1987
    (yyval.identifier)=NULL;
1731
1988
 
1733
1990
    break;
1734
1991
 
1735
1992
  case 28:
1736
 
#line 594 "./n3_parser.y"
 
1993
#line 605 "./n3_parser.y"
1737
1994
    {
1738
1995
#if RAPTOR_DEBUG > 1  
1739
 
  printf("literal + datatype string=\"%s\" uri=\"%s\"\n", (yyvsp[-2].string), raptor_uri_as_string((yyvsp[0].uri)));
 
1996
  printf("literal + datatype string=\"%s\" uri=\"%s\"\n", (yyvsp[(1) - (3)].string), raptor_uri_as_string((yyvsp[(3) - (3)].uri)));
1740
1997
#endif
1741
1998
 
1742
 
  if((yyvsp[0].uri))
1743
 
    (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_LITERAL, NULL, RAPTOR_URI_SOURCE_ELEMENT, NULL, (yyvsp[-2].string), (yyvsp[0].uri), NULL);
 
1999
  if((yyvsp[(3) - (3)].uri))
 
2000
    (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_LITERAL, NULL, RAPTOR_URI_SOURCE_ELEMENT, NULL, (yyvsp[(1) - (3)].string), (yyvsp[(3) - (3)].uri), NULL);
1744
2001
  else
1745
2002
    (yyval.identifier)=NULL;
1746
2003
    
1748
2005
    break;
1749
2006
 
1750
2007
  case 29:
1751
 
#line 606 "./n3_parser.y"
 
2008
#line 617 "./n3_parser.y"
1752
2009
    {
1753
2010
#if RAPTOR_DEBUG > 1  
1754
 
  printf("literal + datatype string=\"%s\" qname URI=<%s>\n", (yyvsp[-2].string), raptor_uri_as_string((yyvsp[0].uri)));
 
2011
  printf("literal + datatype string=\"%s\" qname URI=<%s>\n", (yyvsp[(1) - (3)].string), raptor_uri_as_string((yyvsp[(3) - (3)].uri)));
1755
2012
#endif
1756
2013
 
1757
 
  if((yyvsp[0].uri)) {
1758
 
    (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_LITERAL, NULL, RAPTOR_URI_SOURCE_ELEMENT, NULL, (yyvsp[-2].string), (yyvsp[0].uri), NULL);
 
2014
  if((yyvsp[(3) - (3)].uri)) {
 
2015
    (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_LITERAL, NULL, RAPTOR_URI_SOURCE_ELEMENT, NULL, (yyvsp[(1) - (3)].string), (yyvsp[(3) - (3)].uri), NULL);
1759
2016
  } else
1760
2017
    (yyval.identifier)=NULL;
1761
2018
}
1762
2019
    break;
1763
2020
 
1764
2021
  case 30:
1765
 
#line 617 "./n3_parser.y"
 
2022
#line 628 "./n3_parser.y"
1766
2023
    {
1767
2024
#if RAPTOR_DEBUG > 1  
1768
 
  printf("literal string=\"%s\"\n", (yyvsp[0].string));
 
2025
  printf("literal string=\"%s\"\n", (yyvsp[(1) - (1)].string));
1769
2026
#endif
1770
2027
 
1771
 
  (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_LITERAL, NULL, RAPTOR_URI_SOURCE_ELEMENT, NULL, (yyvsp[0].string), NULL, NULL);
 
2028
  (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_LITERAL, NULL, RAPTOR_URI_SOURCE_ELEMENT, NULL, (yyvsp[(1) - (1)].string), NULL, NULL);
1772
2029
}
1773
2030
    break;
1774
2031
 
1775
2032
  case 31:
1776
 
#line 625 "./n3_parser.y"
 
2033
#line 636 "./n3_parser.y"
1777
2034
    {
1778
2035
  unsigned char *string;
1779
2036
  raptor_uri *uri;
1780
2037
#if RAPTOR_DEBUG > 1  
1781
 
  printf("resource integer=%d\n", (yyvsp[0].integer));
 
2038
  printf("resource integer=%d\n", (yyvsp[(1) - (1)].integer));
1782
2039
#endif
1783
2040
  string=(unsigned char*)RAPTOR_MALLOC(cstring, 32); /* FIXME */
1784
 
  sprintf((char*)string, "%d", (yyvsp[0].integer));
 
2041
  sprintf((char*)string, "%d", (yyvsp[(1) - (1)].integer));
1785
2042
  uri=raptor_new_uri((const unsigned char*)"http://www.w3.org/2001/XMLSchema#integer");
1786
2043
  (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_LITERAL, NULL, RAPTOR_URI_SOURCE_ELEMENT, NULL, string, uri, NULL);
1787
2044
}
1788
2045
    break;
1789
2046
 
1790
2047
  case 32:
1791
 
#line 637 "./n3_parser.y"
 
2048
#line 648 "./n3_parser.y"
1792
2049
    {
1793
2050
#if RAPTOR_DEBUG > 1  
1794
 
  printf("resource double=%1g\n", (yyvsp[0].floating));
 
2051
  printf("resource double=%1g\n", (yyvsp[(1) - (1)].floating));
1795
2052
#endif
1796
 
  (yyval.identifier)=raptor_new_identifier_from_double((yyvsp[0].floating));
 
2053
  (yyval.identifier)=raptor_new_identifier_from_double((yyvsp[(1) - (1)].floating));
1797
2054
}
1798
2055
    break;
1799
2056
 
1800
2057
  case 33:
1801
 
#line 644 "./n3_parser.y"
 
2058
#line 655 "./n3_parser.y"
1802
2059
    {
1803
2060
  raptor_uri *uri;
1804
2061
#if RAPTOR_DEBUG > 1  
1805
 
  printf("resource decimal=%s\n", (yyvsp[0].string));
 
2062
  printf("resource decimal=%s\n", (yyvsp[(1) - (1)].string));
1806
2063
#endif
1807
2064
  uri=raptor_new_uri((const unsigned char*)"http://www.w3.org/2001/XMLSchema#decimal");
1808
 
  (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_LITERAL, NULL, RAPTOR_URI_SOURCE_ELEMENT, NULL, (yyvsp[0].string), uri, NULL);
 
2065
  (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_LITERAL, NULL, RAPTOR_URI_SOURCE_ELEMENT, NULL, (yyvsp[(1) - (1)].string), uri, NULL);
1809
2066
}
1810
2067
    break;
1811
2068
 
1812
2069
  case 34:
1813
 
#line 656 "./n3_parser.y"
 
2070
#line 667 "./n3_parser.y"
1814
2071
    {
1815
2072
#if RAPTOR_DEBUG > 1  
1816
 
  printf("resource URI=<%s>\n", raptor_uri_as_string((yyvsp[0].uri)));
 
2073
  printf("resource URI=<%s>\n", raptor_uri_as_string((yyvsp[(1) - (1)].uri)));
1817
2074
#endif
1818
2075
 
1819
 
  if((yyvsp[0].uri))
1820
 
    (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_RESOURCE, (yyvsp[0].uri), RAPTOR_URI_SOURCE_URI, NULL, NULL, NULL, NULL);
 
2076
  if((yyvsp[(1) - (1)].uri))
 
2077
    (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_RESOURCE, (yyvsp[(1) - (1)].uri), RAPTOR_URI_SOURCE_URI, NULL, NULL, NULL, NULL);
1821
2078
  else
1822
2079
    (yyval.identifier)=NULL;
1823
2080
}
1824
2081
    break;
1825
2082
 
1826
2083
  case 35:
1827
 
#line 667 "./n3_parser.y"
 
2084
#line 678 "./n3_parser.y"
1828
2085
    {
1829
2086
#if RAPTOR_DEBUG > 1  
1830
 
  printf("resource qname URI=<%s>\n", raptor_uri_as_string((yyvsp[0].uri)));
 
2087
  printf("resource qname URI=<%s>\n", raptor_uri_as_string((yyvsp[(1) - (1)].uri)));
1831
2088
#endif
1832
2089
 
1833
 
  if((yyvsp[0].uri))
1834
 
    (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_RESOURCE, (yyvsp[0].uri), RAPTOR_URI_SOURCE_ELEMENT, NULL, NULL, NULL, NULL);
 
2090
  if((yyvsp[(1) - (1)].uri))
 
2091
    (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_RESOURCE, (yyvsp[(1) - (1)].uri), RAPTOR_URI_SOURCE_ELEMENT, NULL, NULL, NULL, NULL);
1835
2092
  else
1836
2093
    (yyval.identifier)=NULL;
1837
2094
}
1838
2095
    break;
1839
2096
 
1840
2097
  case 36:
1841
 
#line 682 "./n3_parser.y"
 
2098
#line 693 "./n3_parser.y"
1842
2099
    {
1843
2100
  const unsigned char *id;
1844
2101
#if RAPTOR_DEBUG > 1  
1845
 
  printf("subject blank=\"%s\"\n", (yyvsp[0].string));
 
2102
  printf("subject blank=\"%s\"\n", (yyvsp[(1) - (1)].string));
1846
2103
#endif
1847
 
  id=raptor_generate_id((raptor_parser*)rdf_parser, 0, (yyvsp[0].string));
 
2104
  id=raptor_generate_id((raptor_parser*)rdf_parser, 0, (yyvsp[(1) - (1)].string));
1848
2105
 
1849
2106
  (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_ANONYMOUS, NULL, RAPTOR_URI_SOURCE_BLANK_ID, id, NULL, NULL, NULL);
1850
2107
}
1851
2108
    break;
1852
2109
 
1853
2110
  case 37:
1854
 
#line 692 "./n3_parser.y"
 
2111
#line 703 "./n3_parser.y"
1855
2112
    {
1856
2113
  int i;
1857
2114
  const unsigned char *id=raptor_generate_id((raptor_parser*)rdf_parser, 0, NULL);
1858
2115
  
1859
2116
  (yyval.identifier)=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_ANONYMOUS, NULL, RAPTOR_URI_SOURCE_GENERATED, id, NULL, NULL, NULL);
1860
2117
 
1861
 
  if((yyvsp[-1].sequence) == NULL) {
 
2118
  if((yyvsp[(2) - (3)].sequence) == NULL) {
1862
2119
#if RAPTOR_DEBUG > 1  
1863
2120
    printf("resource\n propertyList=");
1864
2121
    raptor_identifier_print(stdout, (yyval.identifier));
1868
2125
    /* non-empty property list, handle it  */
1869
2126
#if RAPTOR_DEBUG > 1  
1870
2127
    printf("resource\n propertyList=");
1871
 
    raptor_sequence_print((yyvsp[-1].sequence), stdout);
 
2128
    raptor_sequence_print((yyvsp[(2) - (3)].sequence), stdout);
1872
2129
    printf("\n");
1873
2130
#endif
1874
2131
 
1875
 
    for(i=0; i<raptor_sequence_size((yyvsp[-1].sequence)); i++) {
1876
 
      raptor_triple* t2=(raptor_triple*)raptor_sequence_get_at((yyvsp[-1].sequence), i);
 
2132
    for(i=0; i<raptor_sequence_size((yyvsp[(2) - (3)].sequence)); i++) {
 
2133
      raptor_triple* t2=(raptor_triple*)raptor_sequence_get_at((yyvsp[(2) - (3)].sequence), i);
1877
2134
      raptor_identifier *i2=(raptor_identifier*)RAPTOR_CALLOC(raptor_identifier, 1, sizeof(raptor_identifier));
1878
2135
      raptor_copy_identifier(i2, (yyval.identifier));
1879
2136
      t2->subject=i2;
1883
2140
 
1884
2141
#if RAPTOR_DEBUG > 1
1885
2142
    printf(" after substitution objectList=");
1886
 
    raptor_sequence_print((yyvsp[-1].sequence), stdout);
 
2143
    raptor_sequence_print((yyvsp[(2) - (3)].sequence), stdout);
1887
2144
    printf("\n\n");
1888
2145
#endif
1889
2146
 
1890
 
    raptor_free_sequence((yyvsp[-1].sequence));
 
2147
    raptor_free_sequence((yyvsp[(2) - (3)].sequence));
1891
2148
 
1892
2149
  }
1893
2150
  
1895
2152
    break;
1896
2153
 
1897
2154
  case 38:
1898
 
#line 733 "./n3_parser.y"
 
2155
#line 744 "./n3_parser.y"
1899
2156
    {
1900
 
  (yyval.identifier)=(yyvsp[0].identifier);
 
2157
  (yyval.identifier)=(yyvsp[(1) - (1)].identifier);
1901
2158
}
1902
2159
    break;
1903
2160
 
1904
2161
  case 39:
1905
 
#line 740 "./n3_parser.y"
 
2162
#line 751 "./n3_parser.y"
1906
2163
    {
1907
2164
  int i;
1908
2165
  raptor_n3_parser* n3_parser=(raptor_n3_parser*)(((raptor_parser*)rdf_parser)->context);
1912
2169
 
1913
2170
#if RAPTOR_DEBUG > 1  
1914
2171
  printf("collection\n objectList=");
1915
 
  raptor_sequence_print((yyvsp[-1].sequence), stdout);
 
2172
  raptor_sequence_print((yyvsp[(2) - (3)].sequence), stdout);
1916
2173
  printf("\n");
1917
2174
#endif
1918
2175
 
1922
2179
  /* non-empty property list, handle it  */
1923
2180
#if RAPTOR_DEBUG > 1  
1924
2181
  printf("resource\n propertyList=");
1925
 
  raptor_sequence_print((yyvsp[-1].sequence), stdout);
 
2182
  raptor_sequence_print((yyvsp[(2) - (3)].sequence), stdout);
1926
2183
  printf("\n");
1927
2184
#endif
1928
2185
 
1929
2186
  object=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_RESOURCE, raptor_uri_copy(n3_parser->nil_uri), RAPTOR_URI_SOURCE_URI, NULL, NULL, NULL, NULL);
1930
2187
 
1931
 
  for(i=raptor_sequence_size((yyvsp[-1].sequence))-1; i>=0; i--) {
1932
 
    raptor_triple* t2=(raptor_triple*)raptor_sequence_get_at((yyvsp[-1].sequence), i);
 
2188
  for(i=raptor_sequence_size((yyvsp[(2) - (3)].sequence))-1; i>=0; i--) {
 
2189
    raptor_triple* t2=(raptor_triple*)raptor_sequence_get_at((yyvsp[(2) - (3)].sequence), i);
1933
2190
    const unsigned char *blank_id=raptor_generate_id((raptor_parser*)rdf_parser, 0, NULL);
1934
2191
    raptor_identifier* blank=raptor_new_identifier(RAPTOR_IDENTIFIER_TYPE_ANONYMOUS, NULL, RAPTOR_URI_SOURCE_GENERATED, blank_id, NULL, NULL, NULL);
1935
2192
    raptor_identifier* temp;
1957
2214
  
1958
2215
#if RAPTOR_DEBUG > 1
1959
2216
  printf(" after substitution objectList=");
1960
 
  raptor_sequence_print((yyvsp[-1].sequence), stdout);
 
2217
  raptor_sequence_print((yyvsp[(2) - (3)].sequence), stdout);
1961
2218
  printf("\n\n");
1962
2219
#endif
1963
2220
 
1964
 
  raptor_free_sequence((yyvsp[-1].sequence));
 
2221
  raptor_free_sequence((yyvsp[(2) - (3)].sequence));
1965
2222
 
1966
2223
  raptor_free_identifier(first_identifier);
1967
2224
  raptor_free_identifier(rest_identifier);
1971
2228
    break;
1972
2229
 
1973
2230
  case 40:
1974
 
#line 806 "./n3_parser.y"
 
2231
#line 817 "./n3_parser.y"
1975
2232
    {
1976
2233
  raptor_n3_parser* n3_parser=(raptor_n3_parser*)(((raptor_parser*)rdf_parser)->context);
1977
2234
 
1984
2241
    break;
1985
2242
 
1986
2243
 
 
2244
/* Line 1267 of yacc.c.  */
 
2245
#line 2248 "n3_parser.c"
1987
2246
      default: break;
1988
2247
    }
1989
 
 
1990
 
/* Line 1126 of yacc.c.  */
1991
 
#line 1994 "n3_parser.c"
1992
 
 
1993
 
  yyvsp -= yylen;
1994
 
  yyssp -= yylen;
1995
 
 
1996
 
 
 
2248
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
 
2249
 
 
2250
  YYPOPSTACK (yylen);
 
2251
  yylen = 0;
1997
2252
  YY_STACK_PRINT (yyss, yyssp);
1998
2253
 
1999
2254
  *++yyvsp = yyval;
2022
2277
  if (!yyerrstatus)
2023
2278
    {
2024
2279
      ++yynerrs;
2025
 
#if YYERROR_VERBOSE
2026
 
      yyn = yypact[yystate];
2027
 
 
2028
 
      if (YYPACT_NINF < yyn && yyn < YYLAST)
2029
 
        {
2030
 
          int yytype = YYTRANSLATE (yychar);
2031
 
          YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
2032
 
          YYSIZE_T yysize = yysize0;
2033
 
          YYSIZE_T yysize1;
2034
 
          int yysize_overflow = 0;
2035
 
          char *yymsg = 0;
2036
 
#         define YYERROR_VERBOSE_ARGS_MAXIMUM 5
2037
 
          char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
2038
 
          int yyx;
2039
 
 
2040
 
#if 0
2041
 
          /* This is so xgettext sees the translatable formats that are
2042
 
             constructed on the fly.  */
2043
 
          YY_("syntax error, unexpected %s");
2044
 
          YY_("syntax error, unexpected %s, expecting %s");
2045
 
          YY_("syntax error, unexpected %s, expecting %s or %s");
2046
 
          YY_("syntax error, unexpected %s, expecting %s or %s or %s");
2047
 
          YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
2048
 
#endif
2049
 
          char *yyfmt;
2050
 
          char const *yyf;
2051
 
          static char const yyunexpected[] = "syntax error, unexpected %s";
2052
 
          static char const yyexpecting[] = ", expecting %s";
2053
 
          static char const yyor[] = " or %s";
2054
 
          char yyformat[sizeof yyunexpected
2055
 
                        + sizeof yyexpecting - 1
2056
 
                        + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
2057
 
                           * (sizeof yyor - 1))];
2058
 
          char const *yyprefix = yyexpecting;
2059
 
 
2060
 
          /* Start YYX at -YYN if negative to avoid negative indexes in
2061
 
             YYCHECK.  */
2062
 
          int yyxbegin = yyn < 0 ? -yyn : 0;
2063
 
 
2064
 
          /* Stay within bounds of both yycheck and yytname.  */
2065
 
          int yychecklim = YYLAST - yyn;
2066
 
          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2067
 
          int yycount = 1;
2068
 
 
2069
 
          yyarg[0] = yytname[yytype];
2070
 
          yyfmt = yystpcpy (yyformat, yyunexpected);
2071
 
 
2072
 
          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2073
 
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2074
 
              {
2075
 
                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
2076
 
                  {
2077
 
                    yycount = 1;
2078
 
                    yysize = yysize0;
2079
 
                    yyformat[sizeof yyunexpected - 1] = '\0';
2080
 
                    break;
2081
 
                  }
2082
 
                yyarg[yycount++] = yytname[yyx];
2083
 
                yysize1 = yysize + yytnamerr (0, yytname[yyx]);
2084
 
                yysize_overflow |= yysize1 < yysize;
2085
 
                yysize = yysize1;
2086
 
                yyfmt = yystpcpy (yyfmt, yyprefix);
2087
 
                yyprefix = yyor;
2088
 
              }
2089
 
 
2090
 
          yyf = YY_(yyformat);
2091
 
          yysize1 = yysize + yystrlen (yyf);
2092
 
          yysize_overflow |= yysize1 < yysize;
2093
 
          yysize = yysize1;
2094
 
 
2095
 
          if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
2096
 
            yymsg = (char *) YYSTACK_ALLOC (yysize);
2097
 
          if (yymsg)
2098
 
            {
2099
 
              /* Avoid sprintf, as that infringes on the user's name space.
2100
 
                 Don't have undefined behavior even if the translation
2101
 
                 produced a string with the wrong number of "%s"s.  */
2102
 
              char *yyp = yymsg;
2103
 
              int yyi = 0;
2104
 
              while ((*yyp = *yyf))
2105
 
                {
2106
 
                  if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
2107
 
                    {
2108
 
                      yyp += yytnamerr (yyp, yyarg[yyi++]);
2109
 
                      yyf += 2;
2110
 
                    }
2111
 
                  else
2112
 
                    {
2113
 
                      yyp++;
2114
 
                      yyf++;
2115
 
                    }
2116
 
                }
2117
 
              yyerror (yymsg);
 
2280
#if ! YYERROR_VERBOSE
 
2281
      yyerror (YY_("syntax error"));
 
2282
#else
 
2283
      {
 
2284
        YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
 
2285
        if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
 
2286
          {
 
2287
            YYSIZE_T yyalloc = 2 * yysize;
 
2288
            if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
 
2289
              yyalloc = YYSTACK_ALLOC_MAXIMUM;
 
2290
            if (yymsg != yymsgbuf)
2118
2291
              YYSTACK_FREE (yymsg);
2119
 
            }
2120
 
          else
2121
 
            {
2122
 
              yyerror (YY_("syntax error"));
 
2292
            yymsg = (char *) YYSTACK_ALLOC (yyalloc);
 
2293
            if (yymsg)
 
2294
              yymsg_alloc = yyalloc;
 
2295
            else
 
2296
              {
 
2297
                yymsg = yymsgbuf;
 
2298
                yymsg_alloc = sizeof yymsgbuf;
 
2299
              }
 
2300
          }
 
2301
 
 
2302
        if (0 < yysize && yysize <= yymsg_alloc)
 
2303
          {
 
2304
            (void) yysyntax_error (yymsg, yystate, yychar);
 
2305
            yyerror (yymsg);
 
2306
          }
 
2307
        else
 
2308
          {
 
2309
            yyerror (YY_("syntax error"));
 
2310
            if (yysize != 0)
2123
2311
              goto yyexhaustedlab;
2124
 
            }
2125
 
        }
2126
 
      else
2127
 
#endif /* YYERROR_VERBOSE */
2128
 
        yyerror (YY_("syntax error"));
 
2312
          }
 
2313
      }
 
2314
#endif
2129
2315
    }
2130
2316
 
2131
2317
 
2136
2322
         error, discard it.  */
2137
2323
 
2138
2324
      if (yychar <= YYEOF)
2139
 
        {
 
2325
        {
2140
2326
          /* Return failure if at end of input.  */
2141
2327
          if (yychar == YYEOF)
2142
2328
            YYABORT;
2143
 
        }
 
2329
        }
2144
2330
      else
2145
2331
        {
2146
 
          yydestruct ("Error: discarding", yytoken, &yylval);
 
2332
          yydestruct ("Error: discarding",
 
2333
                      yytoken, &yylval);
2147
2334
          yychar = YYEMPTY;
2148
2335
        }
2149
2336
    }
2161
2348
  /* Pacify compilers like GCC when the user code never invokes
2162
2349
     YYERROR and the label yyerrorlab therefore never appears in user
2163
2350
     code.  */
2164
 
  if (0)
 
2351
  if (/*CONSTCOND*/ 0)
2165
2352
     goto yyerrorlab;
2166
2353
 
2167
 
yyvsp -= yylen;
2168
 
  yyssp -= yylen;
 
2354
  /* Do not reclaim the symbols of the rule which action triggered
 
2355
     this YYERROR.  */
 
2356
  YYPOPSTACK (yylen);
 
2357
  yylen = 0;
 
2358
  YY_STACK_PRINT (yyss, yyssp);
2169
2359
  yystate = *yyssp;
2170
2360
  goto yyerrlab1;
2171
2361
 
2195
2385
        YYABORT;
2196
2386
 
2197
2387
 
2198
 
      yydestruct ("Error: popping", yystos[yystate], yyvsp);
2199
 
      YYPOPSTACK;
 
2388
      yydestruct ("Error: popping",
 
2389
                  yystos[yystate], yyvsp);
 
2390
      YYPOPSTACK (1);
2200
2391
      yystate = *yyssp;
2201
2392
      YY_STACK_PRINT (yyss, yyssp);
2202
2393
    }
2207
2398
  *++yyvsp = yylval;
2208
2399
 
2209
2400
 
2210
 
  /* Shift the error token. */
 
2401
  /* Shift the error token.  */
2211
2402
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2212
2403
 
2213
2404
  yystate = yyn;
2242
2433
  if (yychar != YYEOF && yychar != YYEMPTY)
2243
2434
     yydestruct ("Cleanup: discarding lookahead",
2244
2435
                 yytoken, &yylval);
 
2436
  /* Do not reclaim the symbols of the rule which action triggered
 
2437
     this YYABORT or YYACCEPT.  */
 
2438
  YYPOPSTACK (yylen);
 
2439
  YY_STACK_PRINT (yyss, yyssp);
2245
2440
  while (yyssp != yyss)
2246
2441
    {
2247
2442
      yydestruct ("Cleanup: popping",
2248
2443
                  yystos[*yyssp], yyvsp);
2249
 
      YYPOPSTACK;
 
2444
      YYPOPSTACK (1);
2250
2445
    }
2251
2446
#ifndef yyoverflow
2252
2447
  if (yyss != yyssa)
2253
2448
    YYSTACK_FREE (yyss);
2254
2449
#endif
2255
 
  return yyresult;
 
2450
#if YYERROR_VERBOSE
 
2451
  if (yymsg != yymsgbuf)
 
2452
    YYSTACK_FREE (yymsg);
 
2453
#endif
 
2454
  /* Make sure YYID is used.  */
 
2455
  return YYID (yyresult);
2256
2456
}
2257
2457
 
2258
2458
 
2259
 
#line 818 "./n3_parser.y"
 
2459
#line 829 "./n3_parser.y"
2260
2460
 
2261
2461
 
2262
2462
 
2362
2562
 
2363
2563
  return raptor_qname_string_to_uri(&n3_parser->namespaces,
2364
2564
                                    name, name_len,
2365
 
                                    raptor_parser_simple_error, rdf_parser);
 
2565
                                    (raptor_simple_message_handler)raptor_parser_simple_error, rdf_parser);
2366
2566
}
2367
2567
 
2368
2568
 
2406
2606
 
2407
2607
  raptor_namespaces_init(&n3_parser->namespaces,
2408
2608
                         uri_handler, uri_context,
2409
 
                         raptor_parser_simple_error, rdf_parser, 
 
2609
                         (raptor_simple_message_handler)raptor_parser_simple_error, rdf_parser, 
2410
2610
                         0);
2411
2611
 
2412
2612
  n3_parser->nil_uri=raptor_new_uri_for_rdf_concept("nil");
2450
2650
{
2451
2651
  /* raptor_n3_parser *n3_parser=(raptor_n3_parser*)parser->context; */
2452
2652
  raptor_statement *statement=&parser->statement;
2453
 
  int predicate_ordinal=0;
2454
2653
 
2455
2654
  if(!t->subject || !t->predicate || !t->object)
2456
2655
    return;
2466
2665
    statement->subject=t->subject->uri;
2467
2666
  }
2468
2667
 
2469
 
  /* Predicates are URIs, in Raptor some are turned into ordinals */
 
2668
  /* Predicates are URIs but check for bad ordinals */
2470
2669
  if(!strncmp((const char*)raptor_uri_as_string(t->predicate->uri),
2471
2670
              "http://www.w3.org/1999/02/22-rdf-syntax-ns#_", 44)) {
2472
 
    predicate_ordinal=raptor_check_ordinal(raptor_uri_as_string(t->predicate->uri)+44);
2473
 
    if(predicate_ordinal > 0) {
2474
 
      statement->predicate=(void*)&predicate_ordinal;
2475
 
      statement->predicate_type=RAPTOR_IDENTIFIER_TYPE_ORDINAL;
2476
 
    } else {
2477
 
      predicate_ordinal=0;
2478
 
    }
 
2671
    unsigned char* predicate_uri_string=raptor_uri_as_string(t->predicate->uri);
 
2672
    int predicate_ordinal=raptor_check_ordinal(predicate_uri_string+44);
 
2673
    if(predicate_ordinal <= 0)
 
2674
      raptor_parser_error(parser, "Illegal ordinal value %d in property '%s'.", predicate_ordinal, predicate_uri_string);
2479
2675
  }
2480
2676
  
2481
 
  if(!predicate_ordinal) {
2482
 
    statement->predicate_type=RAPTOR_IDENTIFIER_TYPE_RESOURCE;
2483
 
    statement->predicate=t->predicate->uri;
2484
 
  }
 
2677
  statement->predicate_type=RAPTOR_IDENTIFIER_TYPE_RESOURCE;
 
2678
  statement->predicate=t->predicate->uri;
2485
2679
  
2486
2680
 
2487
2681
  /* Three choices for object for N3 */
2572
2766
  raptor_locator *locator=&rdf_parser->locator;
2573
2767
  raptor_n3_parser *n3_parser=(raptor_n3_parser*)rdf_parser->context;
2574
2768
 
 
2769
  /* base URI required for N3 */
 
2770
  if(!rdf_parser->base_uri)
 
2771
    return 1;
 
2772
 
2575
2773
  locator->line=1;
2576
2774
  locator->column= -1; /* No column info */
2577
2775
  locator->byte= -1; /* No bytes info */
2616
2814
{
2617
2815
  factory->context_length     = sizeof(raptor_n3_parser);
2618
2816
  
 
2817
  factory->need_base_uri = 1;
 
2818
  
2619
2819
  factory->init      = raptor_n3_parse_init;
2620
2820
  factory->terminate = raptor_n3_parse_terminate;
2621
2821
  factory->start     = raptor_n3_parse_start;
2622
2822
  factory->chunk     = raptor_n3_parse_chunk;
2623
2823
  factory->recognise_syntax = raptor_n3_parse_recognise_syntax;
 
2824
 
 
2825
  raptor_parser_factory_add_mime_type(factory, "text/n3", 6);
 
2826
  raptor_parser_factory_add_mime_type(factory, "application/rdf+n3", 6);
2624
2827
}
2625
2828
 
2626
2829
 
2627
2830
void
2628
2831
raptor_init_parser_n3(void)
2629
2832
{
2630
 
  raptor_parser_factory* factory;
2631
 
  factory=raptor_parser_register_factory("n3",  "Notation 3",
2632
 
                                         NULL,
2633
 
                                         NULL,
2634
 
                                         &raptor_n3_parser_register_factory);
2635
 
  raptor_parser_factory_add_mime_type(factory, "text/n3", 6);
2636
 
  raptor_parser_factory_add_mime_type(factory, "application/rdf+n3", 6);
 
2833
  raptor_parser_register_factory("n3",  "Notation 3",
 
2834
                                 &raptor_n3_parser_register_factory);
2637
2835
}
2638
2836
 
2639
2837