summaryrefslogtreecommitdiff
path: root/ext/syck
diff options
context:
space:
mode:
Diffstat (limited to 'ext/syck')
-rw-r--r--ext/syck/.cvsignore3
-rw-r--r--ext/syck/MANIFEST12
-rw-r--r--ext/syck/emitter.c434
-rw-r--r--ext/syck/extconf.rb5
-rw-r--r--ext/syck/gram.c1702
-rw-r--r--ext/syck/gram.h79
-rw-r--r--ext/syck/handler.c146
-rw-r--r--ext/syck/implicit.c2826
-rw-r--r--ext/syck/node.c324
-rw-r--r--ext/syck/rubyext.c1288
-rw-r--r--ext/syck/syck.c493
-rw-r--r--ext/syck/syck.h378
-rw-r--r--ext/syck/token.c2345
13 files changed, 0 insertions, 10035 deletions
diff --git a/ext/syck/.cvsignore b/ext/syck/.cvsignore
deleted file mode 100644
index 4088712231..0000000000
--- a/ext/syck/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile
-mkmf.log
-*.def
diff --git a/ext/syck/MANIFEST b/ext/syck/MANIFEST
deleted file mode 100644
index 666e9c0465..0000000000
--- a/ext/syck/MANIFEST
+++ /dev/null
@@ -1,12 +0,0 @@
-MANIFEST
-extconf.rb
-gram.c
-gram.h
-handler.c
-implicit.c
-node.c
-rubyext.c
-syck.c
-syck.h
-token.c
-emitter.c
diff --git a/ext/syck/emitter.c b/ext/syck/emitter.c
deleted file mode 100644
index 62f1b57f48..0000000000
--- a/ext/syck/emitter.c
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * emitter.c
- *
- * $Author$
- * $Date$
- *
- * Copyright (C) 2003 why the lucky stiff
- *
- * All Base64 code from Ruby's pack.c.
- * Ruby is Copyright (C) 1993-2003 Yukihiro Matsumoto
- */
-#include <stdio.h>
-#include <string.h>
-
-#include "syck.h"
-#include "ruby.h"
-
-#define DEFAULT_ANCHOR_FORMAT "id%03d"
-
-static char b64_table[] =
-"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-struct adjust_arg {
- /* Position to start adjusting */
- long startpos;
- /* Adjusting by an offset */
- int offset;
-};
-
-/*
- * Built-in base64 (from Ruby's pack.c)
- */
-char *
-syck_base64enc( char *s, long len )
-{
- long i = 0;
- int padding = '=';
- char *buff = S_ALLOCA_N(char, len * 4 / 3 + 6);
-
- while (len >= 3) {
- buff[i++] = b64_table[077 & (*s >> 2)];
- buff[i++] = b64_table[077 & (((*s << 4) & 060) | ((s[1] >> 4) & 017))];
- buff[i++] = b64_table[077 & (((s[1] << 2) & 074) | ((s[2] >> 6) & 03))];
- buff[i++] = b64_table[077 & s[2]];
- s += 3;
- len -= 3;
- }
- if (len == 2) {
- buff[i++] = b64_table[077 & (*s >> 2)];
- buff[i++] = b64_table[077 & (((*s << 4) & 060) | ((s[1] >> 4) & 017))];
- buff[i++] = b64_table[077 & (((s[1] << 2) & 074) | (('\0' >> 6) & 03))];
- buff[i++] = padding;
- }
- else if (len == 1) {
- buff[i++] = b64_table[077 & (*s >> 2)];
- buff[i++] = b64_table[077 & (((*s << 4) & 060) | (('\0' >> 4) & 017))];
- buff[i++] = padding;
- buff[i++] = padding;
- }
- buff[i++] = '\n';
- return buff;
-}
-
-char *
-syck_base64dec( char *s, long len )
-{
- int a = -1,b = -1,c = 0,d;
- static int first = 1;
- static int b64_xtable[256];
- char *ptr = syck_strndup( s, len );
- char *end = ptr;
- char *send = s + len;
-
- if (first) {
- int i;
- first = 0;
-
- for (i = 0; i < 256; i++) {
- b64_xtable[i] = -1;
- }
- for (i = 0; i < 64; i++) {
- b64_xtable[(int)b64_table[i]] = i;
- }
- }
- while (s < send) {
- while (s[0] == '\r' || s[0] == '\n') { s++; }
- if ((a = b64_xtable[(int)s[0]]) == -1) break;
- if ((b = b64_xtable[(int)s[1]]) == -1) break;
- if ((c = b64_xtable[(int)s[2]]) == -1) break;
- if ((d = b64_xtable[(int)s[3]]) == -1) break;
- *end++ = a << 2 | b >> 4;
- *end++ = b << 4 | c >> 2;
- *end++ = c << 6 | d;
- s += 4;
- }
- if (a != -1 && b != -1) {
- if (s + 2 < send && s[2] == '=')
- *end++ = a << 2 | b >> 4;
- if (c != -1 && s + 3 < send && s[3] == '=') {
- *end++ = a << 2 | b >> 4;
- *end++ = b << 4 | c >> 2;
- }
- }
- *end = '\0';
- //RSTRING(buf)->len = ptr - RSTRING(buf)->ptr;
- return ptr;
-}
-
-/*
- * Allocate an emitter
- */
-SyckEmitter *
-syck_new_emitter()
-{
- SyckEmitter *e;
- e = S_ALLOC( SyckEmitter );
- e->headless = 0;
- e->seq_map = 0;
- e->use_header = 0;
- e->use_version = 0;
- e->sort_keys = 0;
- e->anchor_format = NULL;
- e->explicit_typing = 0;
- e->best_width = 80;
- e->block_style = block_arbitrary;
- e->stage = doc_open;
- e->indent = 2;
- e->level = -1;
- e->ignore_id = 0;
- e->anchors = NULL;
- e->markers = NULL;
- e->bufsize = SYCK_BUFFERSIZE;
- e->buffer = NULL;
- e->marker = NULL;
- e->bufpos = 0;
- e->handler = NULL;
- e->bonus = NULL;
- return e;
-}
-
-int
-syck_st_free_anchors( char *key, char *name, char *arg )
-{
- S_FREE( name );
- return ST_CONTINUE;
-}
-
-int
-syck_st_free_markers( char *key, SyckEmitterNode *n, char *arg )
-{
- S_FREE( n );
- return ST_CONTINUE;
-}
-
-void
-syck_emitter_st_free( SyckEmitter *e )
-{
- /*
- * Free the anchor tables
- */
- if ( e->anchors != NULL )
- {
- st_foreach( e->anchors, syck_st_free_anchors, 0 );
- st_free_table( e->anchors );
- e->anchors = NULL;
- }
-
- /*
- * Free the markers tables
- */
- if ( e->markers != NULL )
- {
- st_foreach( e->markers, syck_st_free_markers, 0 );
- st_free_table( e->markers );
- e->markers = NULL;
- }
-}
-
-void
-syck_emitter_ignore_id( SyckEmitter *e, SYMID id )
-{
- e->ignore_id = id;
-}
-
-void
-syck_emitter_handler( SyckEmitter *e, SyckOutputHandler hdlr )
-{
- e->handler = hdlr;
-}
-
-void
-syck_free_emitter( SyckEmitter *e )
-{
- /*
- * Free tables
- */
- syck_emitter_st_free( e );
- if ( e->buffer != NULL )
- {
- S_FREE( e->buffer );
- }
- S_FREE( e );
-}
-
-void
-syck_emitter_clear( SyckEmitter *e )
-{
- if ( e->buffer == NULL )
- {
- e->buffer = S_ALLOC_N( char, e->bufsize );
- S_MEMZERO( e->buffer, char, e->bufsize );
- }
- e->buffer[0] = '\0';
- e->marker = e->buffer;
- e->bufpos = 0;
-}
-
-/*
- * Raw write to the emitter buffer.
- */
-void
-syck_emitter_write( SyckEmitter *e, char *str, long len )
-{
- long at;
- ASSERT( str != NULL )
- if ( e->buffer == NULL )
- {
- syck_emitter_clear( e );
- }
-
- /*
- * Flush if at end of buffer
- */
- at = e->marker - e->buffer;
- if ( len + at > e->bufsize )
- {
- syck_emitter_flush( e, 0 );
- }
-
- /*
- * Write to buffer
- */
- S_MEMCPY( e->marker, str, char, len );
- e->marker += len;
-}
-
-/*
- * Write a chunk of data out.
- */
-void
-syck_emitter_flush( SyckEmitter *e, long check_room )
-{
- /*
- * Check for enough space in the buffer for check_room length.
- */
- if ( check_room > 0 )
- {
- if ( e->bufsize > ( e->marker - e->buffer ) + check_room )
- {
- return;
- }
- }
- else
- {
- check_room = e->bufsize;
- }
-
- /*
- * Determine headers.
- */
- if ( ( e->stage == doc_open && ( e->headless == 0 || e->use_header == 1 ) ) ||
- e->stage == doc_need_header )
- {
- if ( e->use_version == 1 )
- {
- char *header = S_ALLOC_N( char, 64 );
- S_MEMZERO( header, char, 64 );
- sprintf( header, "--- %%YAML:%d.%d ", SYCK_YAML_MAJOR, SYCK_YAML_MINOR );
- (e->handler)( e, header, strlen( header ) );
- S_FREE( header );
- }
- else
- {
- (e->handler)( e, "--- ", 4 );
- }
- e->stage = doc_processing;
- }
-
- /*
- * Commit buffer.
- */
- if ( check_room > e->marker - e->buffer )
- {
- check_room = e->marker - e->buffer;
- }
- (e->handler)( e, e->buffer, check_room );
- e->bufpos += check_room;
- e->marker -= check_room;
-}
-
-/*
- * Emit a simple, unquoted string.
- */
-void
-syck_emitter_simple( SyckEmitter *e, char *str, long len )
-{
- e->seq_map = 0;
- syck_emitter_write( e, str, len );
-}
-
-/*
- * Shift the offsets of all applicable anchors
- */
-int
-syck_adjust_anchors( char *key, SyckEmitterNode *n, struct adjust_arg *arg )
-{
- if ( arg->startpos < n->pos )
- {
- n->pos += arg->offset;
- }
- return ST_CONTINUE;
-}
-
-/*
- * call on start of an object's marshalling
- * (handles anchors, returns an alias)
- */
-char *
-syck_emitter_start_obj( SyckEmitter *e, SYMID oid )
-{
- SyckEmitterNode *n = NULL;
- char *anchor_name = NULL;
-
- e->level++;
- if ( oid != e->ignore_id )
- {
- /*
- * Look for anchors
- */
- if ( e->markers == NULL )
- {
- e->markers = st_init_numtable();
- }
-
- /*
- * Markers table initially marks the string position of the
- * object. Doesn't yet create an anchor, simply notes the
- * position.
- */
- if ( ! st_lookup( e->markers, (st_data_t)oid, (st_data_t *)&n ) )
- {
- /*
- * Store all markers
- */
- n = S_ALLOC( SyckEmitterNode );
- n->is_shortcut = 0;
- n->indent = e->level * e->indent;
- n->pos = e->bufpos + ( e->marker - e->buffer );
- st_insert( e->markers, (st_data_t)oid, (st_data_t)n );
- }
- else
- {
- if ( e->anchors == NULL )
- {
- e->anchors = st_init_numtable();
- }
-
- if ( ! st_lookup( e->anchors, (st_data_t)oid, (st_data_t *)&anchor_name ) )
- {
- int idx = 0;
- /*
- * Second time hitting this object, let's give it an anchor
- */
- idx = e->anchors->num_entries + 1;
-
- /*
- * Create the anchor tag
- */
- if ( n->pos >= e->bufpos )
- {
- int alen;
- struct adjust_arg *args = S_ALLOC( struct adjust_arg );
- char *start = e->buffer + ( n->pos - e->bufpos );
-
- char *anc = ( e->anchor_format == NULL ? DEFAULT_ANCHOR_FORMAT : e->anchor_format );
- anchor_name = S_ALLOC_N( char, strlen( anc ) + 10 );
- S_MEMZERO( anchor_name, char, strlen( anc ) + 10 );
- sprintf( anchor_name, anc, idx );
-
- /*
- * Need to flush the buffer some, if there is not room for the anchor.
- */
- alen = strlen( anchor_name ) + 2;
- syck_emitter_flush( e, alen );
-
- /*
- * Write the anchor into the buffer
- */
- S_MEMMOVE( start + alen, start, char, e->marker - start );
- S_MEMCPY( start + 1, anchor_name, char, strlen( anchor_name ) );
- start[0] = '&';
- start[alen - 1] = ' ';
- e->marker += alen;
-
- /*
- * Cycle through anchors, modify for the size of the anchor.
- */
- args->startpos = n->pos;
- args->offset = alen;
- st_foreach( e->markers, syck_adjust_anchors, (st_data_t)args );
- S_FREE( args );
-
- /*
- * Insert into anchors table
- */
- st_insert( e->anchors, (st_data_t)oid, (st_data_t)anchor_name );
- }
- }
-
- }
- }
-
- return anchor_name;
-}
-
-/*
- * call on completion of an object's marshalling
- */
-void
-syck_emitter_end_obj( SyckEmitter *e )
-{
- e->level--;
-}
-
diff --git a/ext/syck/extconf.rb b/ext/syck/extconf.rb
deleted file mode 100644
index 6c10448c70..0000000000
--- a/ext/syck/extconf.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'mkmf'
-
-have_header( "st.h" )
-create_makefile( "syck" )
-
diff --git a/ext/syck/gram.c b/ext/syck/gram.c
deleted file mode 100644
index edc6da3a45..0000000000
--- a/ext/syck/gram.c
+++ /dev/null
@@ -1,1702 +0,0 @@
-/* A Bison parser, made from gram.y, by GNU bison 1.75. */
-
-/* Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
-
-/* Written by Richard Stallman by simplifying the original so called
- ``semantic'' parser. */
-
-/* All symbols defined below should begin with yy or YY, to avoid
- infringing on user name space. This should be done even for local
- variables, as they might otherwise be expanded by user macros.
- There are some unavoidable exceptions within include files to
- define necessary library symbols; they are noted "INFRINGES ON
- USER NAME SPACE" below. */
-
-/* Identify Bison output. */
-#define YYBISON 1
-
-/* Pure parsers. */
-#define YYPURE 1
-
-/* Using locations. */
-#define YYLSP_NEEDED 0
-
-/* If NAME_PREFIX is specified substitute the variables and functions
- names. */
-#define yyparse syckparse
-#define yylex sycklex
-#define yyerror syckerror
-#define yylval sycklval
-#define yychar syckchar
-#define yydebug syckdebug
-#define yynerrs sycknerrs
-
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- YAML_ANCHOR = 258,
- YAML_ALIAS = 259,
- YAML_TRANSFER = 260,
- YAML_ITRANSFER = 261,
- YAML_WORD = 262,
- YAML_PLAIN = 263,
- YAML_BLOCK = 264,
- YAML_DOCSEP = 265,
- YAML_IOPEN = 266,
- YAML_INDENT = 267,
- YAML_IEND = 268
- };
-#endif
-#define YAML_ANCHOR 258
-#define YAML_ALIAS 259
-#define YAML_TRANSFER 260
-#define YAML_ITRANSFER 261
-#define YAML_WORD 262
-#define YAML_PLAIN 263
-#define YAML_BLOCK 264
-#define YAML_DOCSEP 265
-#define YAML_IOPEN 266
-#define YAML_INDENT 267
-#define YAML_IEND 268
-
-
-
-
-/* Copy the first part of user declarations. */
-#line 14 "gram.y"
-
-
-#include "syck.h"
-
-#define YYPARSE_PARAM parser
-#define YYLEX_PARAM parser
-
-
-
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 1
-#endif
-
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-#ifndef YYSTYPE
-#line 23 "gram.y"
-typedef union {
- SYMID nodeId;
- SyckNode *nodeData;
- char *name;
-} yystype;
-/* Line 193 of /usr/local/share/bison/yacc.c. */
-#line 123 "y.tab.c"
-# define YYSTYPE yystype
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-
-#ifndef YYLTYPE
-typedef struct yyltype
-{
- int first_line;
- int first_column;
- int last_line;
- int last_column;
-} yyltype;
-# define YYLTYPE yyltype
-# define YYLTYPE_IS_TRIVIAL 1
-#endif
-
-/* Copy the second part of user declarations. */
-int sycklex( YYSTYPE *, SyckParser * );
-
-
-/* Line 213 of /usr/local/share/bison/yacc.c. */
-#line 144 "y.tab.c"
-
-#if ! defined (yyoverflow) || YYERROR_VERBOSE
-
-/* The parser invokes alloca or malloc; define the necessary symbols. */
-
-# if YYSTACK_USE_ALLOCA
-# define YYSTACK_ALLOC alloca
-# else
-# ifndef YYSTACK_USE_ALLOCA
-# if defined (alloca) || defined (_ALLOCA_H)
-# define YYSTACK_ALLOC alloca
-# else
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# endif
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-# else
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
-# define YYSTACK_ALLOC malloc
-# define YYSTACK_FREE free
-# endif
-#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
-
-
-#if (! defined (yyoverflow) \
- && (! defined (__cplusplus) \
- || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member. */
-union yyalloc
-{
- short yyss;
- YYSTYPE yyvs;
- };
-
-/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
- N elements. */
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
- + YYSTACK_GAP_MAX)
-
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- register YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (0)
-# endif
-# endif
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (0)
-
-#endif
-
-#if defined (__STDC__) || defined (__cplusplus)
- typedef signed char yysigned_char;
-#else
- typedef short yysigned_char;
-#endif
-
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 35
-#define YYLAST 333
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 23
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 25
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 63
-/* YYNRULES -- Number of states. */
-#define YYNSTATES 106
-
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
-#define YYUNDEFTOK 2
-#define YYMAXUTOK 268
-
-#define YYTRANSLATE(X) \
- ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
-
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
-static const unsigned char yytranslate[] =
-{
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 16, 21, 14, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 15, 2,
- 2, 2, 2, 22, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 17, 2, 18, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 19, 2, 20, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13
-};
-
-#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const unsigned char yyprhs[] =
-{
- 0, 0, 3, 5, 8, 9, 11, 13, 15, 18,
- 22, 26, 28, 31, 32, 34, 37, 39, 41, 43,
- 46, 49, 52, 55, 57, 59, 61, 64, 66, 68,
- 70, 72, 74, 78, 81, 83, 87, 90, 94, 97,
- 99, 103, 106, 110, 113, 115, 119, 123, 127, 131,
- 134, 138, 141, 145, 147, 153, 155, 159, 163, 166,
- 170, 174, 177, 179
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yysigned_char yyrhs[] =
-{
- 24, 0, -1, 33, -1, 10, 27, -1, -1, 32,
- -1, 26, -1, 33, -1, 3, 26, -1, 28, 32,
- 31, -1, 28, 26, 31, -1, 25, -1, 28, 29,
- -1, -1, 11, -1, 28, 12, -1, 13, -1, 12,
- -1, 13, -1, 30, 31, -1, 5, 32, -1, 6,
- 32, -1, 3, 32, -1, 4, -1, 7, -1, 8,
- -1, 5, 33, -1, 9, -1, 34, -1, 38, -1,
- 40, -1, 46, -1, 28, 36, 29, -1, 14, 27,
- -1, 37, -1, 5, 30, 36, -1, 5, 36, -1,
- 3, 30, 36, -1, 3, 36, -1, 35, -1, 37,
- 30, 35, -1, 37, 30, -1, 17, 39, 18, -1,
- 17, 18, -1, 25, -1, 39, 21, 25, -1, 28,
- 41, 29, -1, 28, 44, 29, -1, 5, 30, 44,
- -1, 5, 41, -1, 3, 30, 44, -1, 3, 41,
- -1, 32, 15, 27, -1, 42, -1, 22, 25, 30,
- 15, 27, -1, 43, -1, 44, 30, 35, -1, 44,
- 30, 43, -1, 44, 30, -1, 25, 15, 27, -1,
- 19, 47, 20, -1, 19, 20, -1, 45, -1, 47,
- 21, 45, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const unsigned short yyrline[] =
-{
- 0, 44, 44, 48, 52, 58, 59, 62, 63, 72,
- 76, 82, 83, 96, 114, 115, 118, 121, 124, 125,
- 133, 138, 146, 150, 158, 171, 178, 183, 184, 185,
- 186, 187, 193, 199, 205, 206, 211, 216, 220, 226,
- 230, 235, 244, 248, 254, 258, 268, 273, 280, 285,
- 290, 294, 300, 315, 316, 324, 325, 337, 344, 353,
- 361, 365, 371, 372
-};
-#endif
-
-#if YYDEBUG || YYERROR_VERBOSE
-/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
-static const char *const yytname[] =
-{
- "$end", "error", "$undefined", "YAML_ANCHOR", "YAML_ALIAS",
- "YAML_TRANSFER", "YAML_ITRANSFER", "YAML_WORD", "YAML_PLAIN",
- "YAML_BLOCK", "YAML_DOCSEP", "YAML_IOPEN", "YAML_INDENT", "YAML_IEND",
- "'-'", "':'", "'+'", "'['", "']'", "'{'", "'}'", "','", "'?'",
- "$accept", "doc", "atom", "ind_rep", "atom_or_empty", "indent_open",
- "indent_end", "indent_sep", "indent_flex_end", "word_rep", "struct_rep",
- "implicit_seq", "basic_seq", "top_imp_seq", "in_implicit_seq",
- "inline_seq", "in_inline_seq", "implicit_map", "top_imp_map",
- "basic_mapping", "complex_mapping", "in_implicit_map", "basic_mapping2",
- "inline_map", "in_inline_map", 0
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
-static const unsigned short yytoknum[] =
-{
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 45, 58, 43, 91, 93, 123,
- 125, 44, 63
-};
-# endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const unsigned char yyr1[] =
-{
- 0, 23, 24, 24, 24, 25, 25, 26, 26, 26,
- 26, 27, 27, 27, 28, 28, 29, 30, 31, 31,
- 32, 32, 32, 32, 32, 32, 33, 33, 33, 33,
- 33, 33, 34, 35, 36, 36, 36, 36, 36, 37,
- 37, 37, 38, 38, 39, 39, 40, 40, 41, 41,
- 41, 41, 42, 43, 43, 44, 44, 44, 44, 45,
- 46, 46, 47, 47
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const unsigned char yyr2[] =
-{
- 0, 2, 1, 2, 0, 1, 1, 1, 2, 3,
- 3, 1, 2, 0, 1, 2, 1, 1, 1, 2,
- 2, 2, 2, 1, 1, 1, 2, 1, 1, 1,
- 1, 1, 3, 2, 1, 3, 2, 3, 2, 1,
- 3, 2, 3, 2, 1, 3, 3, 3, 3, 2,
- 3, 2, 3, 1, 5, 1, 3, 3, 2, 3,
- 3, 2, 1, 3
-};
-
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
-static const unsigned char yydefact[] =
-{
- 4, 0, 27, 13, 14, 0, 0, 0, 0, 2,
- 28, 29, 30, 31, 26, 0, 23, 0, 0, 24,
- 25, 11, 6, 3, 0, 5, 7, 43, 44, 0,
- 0, 61, 0, 62, 0, 1, 0, 0, 15, 13,
- 0, 0, 39, 0, 34, 0, 53, 55, 0, 8,
- 22, 0, 20, 0, 21, 0, 0, 16, 0, 12,
- 0, 42, 0, 13, 60, 0, 17, 0, 38, 51,
- 0, 36, 49, 33, 0, 13, 32, 41, 46, 47,
- 58, 18, 0, 10, 9, 45, 59, 63, 0, 0,
- 37, 50, 35, 48, 0, 52, 40, 56, 57, 19,
- 0, 0, 13, 0, 0, 54
-};
-
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yysigned_char yydefgoto[] =
-{
- -1, 7, 21, 22, 23, 29, 59, 80, 83, 25,
- 26, 10, 42, 68, 44, 11, 30, 12, 45, 46,
- 47, 48, 33, 13, 34
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -54
-static const short yypact[] =
-{
- 267, 278, -54, 245, -54, 228, 176, 8, 140, -54,
- -54, -54, -54, -54, -54, 245, -54, 262, 325, -54,
- -54, -54, -54, -54, 100, -54, -54, -54, -54, 120,
- 48, -54, -5, -54, 52, -54, 295, 295, -54, 245,
- 245, -3, -54, 13, 9, 13, -54, -54, 76, -54,
- -54, 325, -54, 325, -54, 194, 211, -54, 108, -54,
- 103, -54, 245, 245, -54, 245, -54, 152, -54, -54,
- 152, -54, -54, -54, 9, 245, -54, 24, -54, -54,
- 164, -54, 108, -54, -54, -54, -54, -54, 307, 307,
- -54, 9, -54, 9, 32, -54, -54, -54, -54, -54,
- 6, 6, 245, 313, 313, -54
-};
-
-/* YYPGOTO[NTERM-NUM]. */
-static const yysigned_char yypgoto[] =
-{
- -54, -54, 31, -10, -35, 0, 12, -12, -53, -2,
- 41, -54, -47, -6, -54, -54, -54, -54, 44, -54,
- -28, 15, 14, -54, -54
-};
-
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, parse error. */
-#define YYTABLE_NINF -1
-static const unsigned char yytable[] =
-{
- 8, 8, 43, 24, 73, 49, 41, 84, 35, 103,
- 63, 104, 75, 50, 58, 52, 54, 8, 43, 58,
- 39, 66, 60, 43, 67, 70, 57, 60, 86, 99,
- 96, 71, 77, 97, 50, 52, 28, 32, 39, 24,
- 95, 9, 14, 67, 70, 49, 82, 102, 82, 50,
- 71, 52, 98, 50, 52, 76, 8, 78, 14, 0,
- 79, 90, 94, 24, 92, 41, 61, 105, 41, 62,
- 82, 74, 64, 65, 0, 24, 100, 101, 41, 87,
- 69, 72, 91, 71, 0, 93, 50, 52, 66, 57,
- 0, 100, 101, 85, 90, 92, 32, 14, 71, 69,
- 72, 0, 24, 55, 16, 56, 18, 19, 20, 2,
- 0, 4, 38, 57, 39, 66, 81, 5, 75, 6,
- 66, 81, 40, 55, 16, 56, 18, 19, 20, 2,
- 0, 4, 38, 0, 39, 0, 0, 5, 0, 6,
- 0, 0, 40, 36, 16, 37, 18, 19, 20, 0,
- 0, 0, 38, 0, 39, 88, 16, 89, 18, 19,
- 20, 0, 40, 0, 0, 0, 39, 51, 16, 53,
- 18, 19, 20, 0, 40, 0, 0, 0, 39, 15,
- 16, 17, 18, 19, 20, 2, 40, 4, 0, 0,
- 0, 0, 0, 5, 0, 6, 31, 55, 16, 56,
- 18, 19, 20, 2, 0, 4, 66, 0, 39, 0,
- 0, 5, 0, 6, 36, 16, 56, 18, 19, 20,
- 2, 0, 4, 66, 0, 39, 0, 0, 5, 0,
- 6, 15, 16, 17, 18, 19, 20, 2, 0, 4,
- 0, 0, 0, 0, 0, 5, 27, 6, 15, 16,
- 17, 18, 19, 20, 2, 0, 4, 0, 0, 0,
- 0, 0, 5, 0, 6, 51, 16, 17, 18, 19,
- 20, 2, 1, 4, 0, 0, 2, 3, 4, 5,
- 0, 6, 0, 1, 5, 0, 6, 2, 0, 4,
- 0, 0, 0, 0, 0, 5, 0, 6, 36, 16,
- 37, 18, 19, 20, 0, 0, 0, 66, 0, 39,
- 88, 16, 89, 18, 19, 20, 103, 0, 104, 66,
- 0, 39, 0, 0, 0, 66, 0, 39, 51, 16,
- 53, 18, 19, 20
-};
-
-static const yysigned_char yycheck[] =
-{
- 0, 1, 8, 3, 39, 15, 8, 60, 0, 3,
- 15, 5, 15, 15, 24, 17, 18, 17, 24, 29,
- 14, 12, 24, 29, 36, 37, 13, 29, 63, 82,
- 77, 37, 44, 80, 36, 37, 5, 6, 14, 39,
- 75, 0, 1, 55, 56, 55, 58, 15, 60, 51,
- 56, 53, 80, 55, 56, 43, 56, 45, 17, -1,
- 48, 67, 74, 63, 70, 67, 18, 102, 70, 21,
- 82, 40, 20, 21, -1, 75, 88, 89, 80, 65,
- 36, 37, 67, 89, -1, 70, 88, 89, 12, 13,
- -1, 103, 104, 62, 100, 101, 65, 56, 104, 55,
- 56, -1, 102, 3, 4, 5, 6, 7, 8, 9,
- -1, 11, 12, 13, 14, 12, 13, 17, 15, 19,
- 12, 13, 22, 3, 4, 5, 6, 7, 8, 9,
- -1, 11, 12, -1, 14, -1, -1, 17, -1, 19,
- -1, -1, 22, 3, 4, 5, 6, 7, 8, -1,
- -1, -1, 12, -1, 14, 3, 4, 5, 6, 7,
- 8, -1, 22, -1, -1, -1, 14, 3, 4, 5,
- 6, 7, 8, -1, 22, -1, -1, -1, 14, 3,
- 4, 5, 6, 7, 8, 9, 22, 11, -1, -1,
- -1, -1, -1, 17, -1, 19, 20, 3, 4, 5,
- 6, 7, 8, 9, -1, 11, 12, -1, 14, -1,
- -1, 17, -1, 19, 3, 4, 5, 6, 7, 8,
- 9, -1, 11, 12, -1, 14, -1, -1, 17, -1,
- 19, 3, 4, 5, 6, 7, 8, 9, -1, 11,
- -1, -1, -1, -1, -1, 17, 18, 19, 3, 4,
- 5, 6, 7, 8, 9, -1, 11, -1, -1, -1,
- -1, -1, 17, -1, 19, 3, 4, 5, 6, 7,
- 8, 9, 5, 11, -1, -1, 9, 10, 11, 17,
- -1, 19, -1, 5, 17, -1, 19, 9, -1, 11,
- -1, -1, -1, -1, -1, 17, -1, 19, 3, 4,
- 5, 6, 7, 8, -1, -1, -1, 12, -1, 14,
- 3, 4, 5, 6, 7, 8, 3, -1, 5, 12,
- -1, 14, -1, -1, -1, 12, -1, 14, 3, 4,
- 5, 6, 7, 8
-};
-
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const unsigned char yystos[] =
-{
- 0, 5, 9, 10, 11, 17, 19, 24, 28, 33,
- 34, 38, 40, 46, 33, 3, 4, 5, 6, 7,
- 8, 25, 26, 27, 28, 32, 33, 18, 25, 28,
- 39, 20, 25, 45, 47, 0, 3, 5, 12, 14,
- 22, 32, 35, 36, 37, 41, 42, 43, 44, 26,
- 32, 3, 32, 5, 32, 3, 5, 13, 26, 29,
- 32, 18, 21, 15, 20, 21, 12, 30, 36, 41,
- 30, 36, 41, 27, 25, 15, 29, 30, 29, 29,
- 30, 13, 30, 31, 31, 25, 27, 45, 3, 5,
- 36, 44, 36, 44, 30, 27, 35, 35, 43, 31,
- 30, 30, 15, 3, 5, 27
-};
-
-#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
-# define YYSIZE_T __SIZE_TYPE__
-#endif
-#if ! defined (YYSIZE_T) && defined (size_t)
-# define YYSIZE_T size_t
-#endif
-#if ! defined (YYSIZE_T)
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
-#endif
-#if ! defined (YYSIZE_T)
-# define YYSIZE_T unsigned int
-#endif
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY -2
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrlab1
-
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
-
-#define YYFAIL goto yyerrlab
-
-#define YYRECOVERING() (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- yychar1 = YYTRANSLATE (yychar); \
- YYPOPSTACK; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror ("syntax error: cannot back up"); \
- YYERROR; \
- } \
-while (0)
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-/* YYLLOC_DEFAULT -- Compute the default location (before the actions
- are run). */
-
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- Current.first_line = Rhs[1].first_line; \
- Current.first_column = Rhs[1].first_column; \
- Current.last_line = Rhs[N].last_line; \
- Current.last_column = Rhs[N].last_column;
-#endif
-
-/* YYLEX -- calling `yylex' with the right arguments. */
-
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&yylval)
-#endif
-
-/* Enable debugging if requested. */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (0)
-# define YYDSYMPRINT(Args) \
-do { \
- if (yydebug) \
- yysymprint Args; \
-} while (0)
-/* Nonzero means print parse trace. It is left uninitialized so that
- multiple parsers can coexist. */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YYDSYMPRINT(Args)
-#endif /* !YYDEBUG */
-
-/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
- if the built-in stack extension method is used).
-
- Do not make this value too large; the results are undefined if
- SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
- evaluated with infinite-precision integer arithmetic. */
-
-#if YYMAXDEPTH == 0
-# undef YYMAXDEPTH
-#endif
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-# if defined (__GLIBC__) && defined (_STRING_H)
-# define yystrlen strlen
-# else
-/* Return the length of YYSTR. */
-static YYSIZE_T
-# if defined (__STDC__) || defined (__cplusplus)
-yystrlen (const char *yystr)
-# else
-yystrlen (yystr)
- const char *yystr;
-# endif
-{
- register const char *yys = yystr;
-
- while (*yys++ != '\0')
- continue;
-
- return yys - yystr - 1;
-}
-# endif
-# endif
-
-# ifndef yystpcpy
-# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
-# define yystpcpy stpcpy
-# else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
- YYDEST. */
-static char *
-# if defined (__STDC__) || defined (__cplusplus)
-yystpcpy (char *yydest, const char *yysrc)
-# else
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-# endif
-{
- register char *yyd = yydest;
- register const char *yys = yysrc;
-
- while ((*yyd++ = *yys++) != '\0')
- continue;
-
- return yyd - 1;
-}
-# endif
-# endif
-
-#endif /* !YYERROR_VERBOSE */
-
-
-
-#if YYDEBUG
-/*-----------------------------.
-| Print this symbol on YYOUT. |
-`-----------------------------*/
-
-static void
-#if defined (__STDC__) || defined (__cplusplus)
-yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue)
-#else
-yysymprint (yyout, yytype, yyvalue)
- FILE* yyout;
- int yytype;
- YYSTYPE yyvalue;
-#endif
-{
- /* Pacify ``unused variable'' warnings. */
- (void) yyvalue;
-
- if (yytype < YYNTOKENS)
- {
- YYFPRINTF (yyout, "token %s (", yytname[yytype]);
-# ifdef YYPRINT
- YYPRINT (yyout, yytoknum[yytype], yyvalue);
-# endif
- }
- else
- YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);
-
- switch (yytype)
- {
- default:
- break;
- }
- YYFPRINTF (yyout, ")");
-}
-#endif /* YYDEBUG. */
-
-
-/*-----------------------------------------------.
-| Release the memory associated to this symbol. |
-`-----------------------------------------------*/
-
-static void
-#if defined (__STDC__) || defined (__cplusplus)
-yydestruct (int yytype, YYSTYPE yyvalue)
-#else
-yydestruct (yytype, yyvalue)
- int yytype;
- YYSTYPE yyvalue;
-#endif
-{
- /* Pacify ``unused variable'' warnings. */
- (void) yyvalue;
-
- switch (yytype)
- {
- default:
- break;
- }
-}
-
-
-
-/* The user can define YYPARSE_PARAM as the name of an argument to be passed
- into yyparse. The argument should have type void *.
- It should actually point to an object.
- Grammar actions can access the variable by casting it
- to the proper pointer type. */
-
-#ifdef YYPARSE_PARAM
-# if defined (__STDC__) || defined (__cplusplus)
-# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
-# define YYPARSE_PARAM_DECL
-# else
-# define YYPARSE_PARAM_ARG YYPARSE_PARAM
-# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
-# endif
-#else /* !YYPARSE_PARAM */
-# define YYPARSE_PARAM_ARG
-# define YYPARSE_PARAM_DECL
-#endif /* !YYPARSE_PARAM */
-
-/* Prevent warning if -Wstrict-prototypes. */
-#ifdef __GNUC__
-# ifdef YYPARSE_PARAM
-int yyparse (void *);
-# else
-int yyparse (void);
-# endif
-#endif
-
-
-
-
-int
-yyparse (YYPARSE_PARAM_ARG)
- YYPARSE_PARAM_DECL
-{
- /* The lookahead symbol. */
-int yychar;
-
-/* The semantic value of the lookahead symbol. */
-YYSTYPE yylval;
-
-/* Number of parse errors so far. */
-int yynerrs;
-
- register int yystate;
- register int yyn;
- int yyresult;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* Lookahead token as an internal (translated) token number. */
- int yychar1 = 0;
-
- /* Three stacks and their tools:
- `yyss': related to states,
- `yyvs': related to semantic values,
- `yyls': related to locations.
-
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
-
- /* The state stack. */
- short yyssa[YYINITDEPTH];
- short *yyss = yyssa;
- register short *yyssp;
-
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- register YYSTYPE *yyvsp;
-
-
-
-#define YYPOPSTACK (yyvsp--, yyssp--)
-
- YYSIZE_T yystacksize = YYINITDEPTH;
-
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
-
-
- /* When reducing, the number of symbols on the RHS of the reduced
- rule. */
- int yylen;
-
- YYDPRINTF ((stderr, "Starting parse\n"));
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
-
- yyssp = yyss;
- yyvsp = yyvs;
-
- goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
-`------------------------------------------------------------*/
- yynewstate:
- /* In all cases, when you get here, the value and location stacks
- have just been pushed. so pushing a state here evens the stacks.
- */
- yyssp++;
-
- yysetstate:
- *yyssp = yystate;
-
- if (yyssp >= yyss + yystacksize - 1)
- {
- /* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- {
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- short *yyss1 = yyss;
-
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow ("parser stack overflow",
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
-
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
- }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyoverflowlab;
-# else
- /* Extend the stack our own way. */
- if (yystacksize >= YYMAXDEPTH)
- goto yyoverflowlab;
- yystacksize *= 2;
- if (yystacksize > YYMAXDEPTH)
- yystacksize = YYMAXDEPTH;
-
- {
- short *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyoverflowlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
-
-# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
- }
-# endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + yysize - 1;
- yyvsp = yyvs + yysize - 1;
-
-
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
-
- if (yyssp >= yyss + yystacksize - 1)
- YYABORT;
- }
-
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
- goto yybackup;
-
-/*-----------.
-| yybackup. |
-`-----------*/
-yybackup:
-
-/* Do appropriate processing given the current state. */
-/* Read a lookahead token if we need one and don't already have one. */
-/* yyresume: */
-
- /* First try to decide what to do without reference to lookahead token. */
-
- yyn = yypact[yystate];
- if (yyn == YYPACT_NINF)
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* yychar is either YYEMPTY or YYEOF
- or a valid token in external form. */
-
- if (yychar == YYEMPTY)
- {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
- }
-
- /* Convert token to internal form (in yychar1) for indexing tables with. */
-
- if (yychar <= 0) /* This means end of input. */
- {
- yychar1 = 0;
- yychar = YYEOF; /* Don't call YYLEX any more. */
-
- YYDPRINTF ((stderr, "Now at end of input.\n"));
- }
- else
- {
- yychar1 = YYTRANSLATE (yychar);
-
- /* We have to keep this `#if YYDEBUG', since we use variables
- which are defined only if `YYDEBUG' is set. */
- YYDPRINTF ((stderr, "Next token is "));
- YYDSYMPRINT ((stderr, yychar1, yylval));
- YYDPRINTF ((stderr, "\n"));
- }
-
- /* If the proper action on seeing token YYCHAR1 is to reduce or to
- detect an error, take that action. */
- yyn += yychar1;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1)
- goto yydefault;
- yyn = yytable[yyn];
- if (yyn <= 0)
- {
- if (yyn == 0 || yyn == YYTABLE_NINF)
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- /* Shift the lookahead token. */
- YYDPRINTF ((stderr, "Shifting token %d (%s), ",
- yychar, yytname[yychar1]));
-
- /* Discard the token being shifted unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
-
- *++yyvsp = yylval;
-
-
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state. |
-`-----------------------------------------------------------*/
-yydefault:
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction. |
-`-----------------------------*/
-yyreduce:
- /* yyn is the number of a rule to reduce with. */
- yylen = yyr2[yyn];
-
- /* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
-
- Otherwise, the following line sets YYVAL to garbage.
- This behavior is undocumented and Bison
- users should not rely upon it. Assigning to YYVAL
- unconditionally makes the parser a bit smaller, and it avoids a
- GCC warning that YYVAL may be used uninitialized. */
- yyval = yyvsp[1-yylen];
-
-
-
-#if YYDEBUG
- /* We have to keep this `#if YYDEBUG', since we use variables which
- are defined only if `YYDEBUG' is set. */
- if (yydebug)
- {
- int yyi;
-
- YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
- yyn - 1, yyrline[yyn]);
-
- /* Print the symbols being reduced, and their result. */
- for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
- YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
- YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
- }
-#endif
- switch (yyn)
- {
- case 2:
-#line 45 "gram.y"
- {
- ((SyckParser *)parser)->root = syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData );
- }
- break;
-
- case 3:
-#line 49 "gram.y"
- {
- ((SyckParser *)parser)->root = syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData );
- }
- break;
-
- case 4:
-#line 53 "gram.y"
- {
- ((SyckParser *)parser)->eof = 1;
- }
- break;
-
- case 8:
-#line 64 "gram.y"
- {
- /*
- * _Anchors_: The language binding must keep a separate symbol table
- * for anchors. The actual ID in the symbol table is returned to the
- * higher nodes, though.
- */
- yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
- }
- break;
-
- case 9:
-#line 73 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 10:
-#line 77 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 12:
-#line 84 "gram.y"
- {
- SyckNode *n = syck_new_str( "" );
- if ( ((SyckParser *)parser)->taguri_expansion == 1 )
- {
- n->type_id = syck_taguri( YAML_DOMAIN, "null", 4 );
- }
- else
- {
- n->type_id = syck_strndup( "null", 4 );
- }
- yyval.nodeData = n;
- }
- break;
-
- case 13:
-#line 97 "gram.y"
- {
- SyckNode *n = syck_new_str( "" );
- if ( ((SyckParser *)parser)->taguri_expansion == 1 )
- {
- n->type_id = syck_taguri( YAML_DOMAIN, "null", 4 );
- }
- else
- {
- n->type_id = syck_strndup( "null", 4 );
- }
- yyval.nodeData = n;
- }
- break;
-
- case 20:
-#line 134 "gram.y"
- {
- syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 21:
-#line 139 "gram.y"
- {
- if ( ((SyckParser *)parser)->implicit_typing == 1 )
- {
- try_tag_implicit( yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- }
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 22:
-#line 147 "gram.y"
- {
- yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
- }
- break;
-
- case 23:
-#line 151 "gram.y"
- {
- /*
- * _Aliases_: The anchor symbol table is scanned for the anchor name.
- * The anchor's ID in the language's symbol table is returned.
- */
- yyval.nodeData = syck_hdlr_get_anchor( (SyckParser *)parser, yyvsp[0].name );
- }
- break;
-
- case 24:
-#line 159 "gram.y"
- {
- SyckNode *n = yyvsp[0].nodeData;
- if ( ((SyckParser *)parser)->taguri_expansion == 1 )
- {
- n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 );
- }
- else
- {
- n->type_id = syck_strndup( "str", 3 );
- }
- yyval.nodeData = n;
- }
- break;
-
- case 26:
-#line 179 "gram.y"
- {
- syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 32:
-#line 194 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 33:
-#line 200 "gram.y"
- {
- yyval.nodeId = syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData );
- }
- break;
-
- case 35:
-#line 207 "gram.y"
- {
- syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 36:
-#line 212 "gram.y"
- {
- syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 37:
-#line 217 "gram.y"
- {
- yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-2].name, yyvsp[0].nodeData );
- }
- break;
-
- case 38:
-#line 221 "gram.y"
- {
- yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
- }
- break;
-
- case 39:
-#line 227 "gram.y"
- {
- yyval.nodeData = syck_new_seq( yyvsp[0].nodeId );
- }
- break;
-
- case 40:
-#line 231 "gram.y"
- {
- syck_seq_add( yyvsp[-2].nodeData, yyvsp[0].nodeId );
- yyval.nodeData = yyvsp[-2].nodeData;
- }
- break;
-
- case 41:
-#line 236 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 42:
-#line 245 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 43:
-#line 249 "gram.y"
- {
- yyval.nodeData = syck_alloc_seq();
- }
- break;
-
- case 44:
-#line 255 "gram.y"
- {
- yyval.nodeData = syck_new_seq( syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
- }
- break;
-
- case 45:
-#line 259 "gram.y"
- {
- syck_seq_add( yyvsp[-2].nodeData, syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
- yyval.nodeData = yyvsp[-2].nodeData;
- }
- break;
-
- case 46:
-#line 269 "gram.y"
- {
- apply_seq_in_map( (SyckParser *)parser, yyvsp[-1].nodeData );
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 47:
-#line 274 "gram.y"
- {
- apply_seq_in_map( (SyckParser *)parser, yyvsp[-1].nodeData );
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 48:
-#line 281 "gram.y"
- {
- syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 49:
-#line 286 "gram.y"
- {
- syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 50:
-#line 291 "gram.y"
- {
- yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-2].name, yyvsp[0].nodeData );
- }
- break;
-
- case 51:
-#line 295 "gram.y"
- {
- yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
- }
- break;
-
- case 52:
-#line 301 "gram.y"
- {
- yyval.nodeData = syck_new_map(
- syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
- syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
- }
- break;
-
- case 54:
-#line 317 "gram.y"
- {
- yyval.nodeData = syck_new_map(
- syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-3].nodeData ),
- syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
- }
- break;
-
- case 56:
-#line 326 "gram.y"
- {
- if ( yyvsp[-2].nodeData->shortcut == NULL )
- {
- yyvsp[-2].nodeData->shortcut = syck_new_seq( yyvsp[0].nodeId );
- }
- else
- {
- syck_seq_add( yyvsp[-2].nodeData->shortcut, yyvsp[0].nodeId );
- }
- yyval.nodeData = yyvsp[-2].nodeData;
- }
- break;
-
- case 57:
-#line 338 "gram.y"
- {
- apply_seq_in_map( (SyckParser *)parser, yyvsp[-2].nodeData );
- syck_map_update( yyvsp[-2].nodeData, yyvsp[0].nodeData );
- syck_free_node( yyvsp[0].nodeData );
- yyval.nodeData = yyvsp[-2].nodeData;
- }
- break;
-
- case 58:
-#line 345 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 59:
-#line 354 "gram.y"
- {
- yyval.nodeData = syck_new_map(
- syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
- syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
- }
- break;
-
- case 60:
-#line 362 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 61:
-#line 366 "gram.y"
- {
- yyval.nodeData = syck_alloc_map();
- }
- break;
-
- case 63:
-#line 373 "gram.y"
- {
- syck_map_update( yyvsp[-2].nodeData, yyvsp[0].nodeData );
- syck_free_node( yyvsp[0].nodeData );
- yyval.nodeData = yyvsp[-2].nodeData;
- }
- break;
-
-
- }
-
-/* Line 1016 of /usr/local/share/bison/yacc.c. */
-#line 1464 "y.tab.c"
-
- yyvsp -= yylen;
- yyssp -= yylen;
-
-
-#if YYDEBUG
- if (yydebug)
- {
- short *yyssp1 = yyss - 1;
- YYFPRINTF (stderr, "state stack now");
- while (yyssp1 != yyssp)
- YYFPRINTF (stderr, " %d", *++yyssp1);
- YYFPRINTF (stderr, "\n");
- }
-#endif
-
- *++yyvsp = yyval;
-
-
- /* Now `shift' the result of the reduction. Determine what state
- that goes to, based on the state we popped back to and the rule
- number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
-
- goto yynewstate;
-
-
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
-yyerrlab:
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus)
- {
- ++yynerrs;
-#if YYERROR_VERBOSE
- yyn = yypact[yystate];
-
- if (YYPACT_NINF < yyn && yyn < YYLAST)
- {
- YYSIZE_T yysize = 0;
- int yytype = YYTRANSLATE (yychar);
- char *yymsg;
- int yyx, yycount;
-
- yycount = 0;
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- for (yyx = yyn < 0 ? -yyn : 0;
- yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- yysize += yystrlen (yytname[yyx]) + 15, yycount++;
- yysize += yystrlen ("parse error, unexpected ") + 1;
- yysize += yystrlen (yytname[yytype]);
- yymsg = (char *) YYSTACK_ALLOC (yysize);
- if (yymsg != 0)
- {
- char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
- yyp = yystpcpy (yyp, yytname[yytype]);
-
- if (yycount < 5)
- {
- yycount = 0;
- for (yyx = yyn < 0 ? -yyn : 0;
- yyx < (int) (sizeof (yytname) / sizeof (char *));
- yyx++)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- const char *yyq = ! yycount ? ", expecting " : " or ";
- yyp = yystpcpy (yyp, yyq);
- yyp = yystpcpy (yyp, yytname[yyx]);
- yycount++;
- }
- }
- yyerror (yymsg);
- YYSTACK_FREE (yymsg);
- }
- else
- yyerror ("parse error; also virtual memory exhausted");
- }
- else
-#endif /* YYERROR_VERBOSE */
- yyerror ("parse error");
- }
- goto yyerrlab1;
-
-
-/*----------------------------------------------------.
-| yyerrlab1 -- error raised explicitly by an action. |
-`----------------------------------------------------*/
-yyerrlab1:
- if (yyerrstatus == 3)
- {
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
-
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- {
- /* Pop the error token. */
- YYPOPSTACK;
- /* Pop the rest of the stack. */
- while (yyssp > yyss)
- {
- YYDPRINTF ((stderr, "Error: popping "));
- YYDSYMPRINT ((stderr,
- yystos[*yyssp],
- *yyvsp));
- YYDPRINTF ((stderr, "\n"));
- yydestruct (yystos[*yyssp], *yyvsp);
- YYPOPSTACK;
- }
- YYABORT;
- }
-
- YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
- yychar, yytname[yychar1]));
- yydestruct (yychar1, yylval);
- yychar = YYEMPTY;
- }
-
- /* Else will try to reuse lookahead token after shifting the error
- token. */
-
- yyerrstatus = 3; /* Each real token shifted decrements this. */
-
- for (;;)
- {
- yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
-
- /* Pop the current state because it cannot handle the error token. */
- if (yyssp == yyss)
- YYABORT;
-
- YYDPRINTF ((stderr, "Error: popping "));
- YYDSYMPRINT ((stderr,
- yystos[*yyssp], *yyvsp));
- YYDPRINTF ((stderr, "\n"));
-
- yydestruct (yystos[yystate], *yyvsp);
- yyvsp--;
- yystate = *--yyssp;
-
-
-#if YYDEBUG
- if (yydebug)
- {
- short *yyssp1 = yyss - 1;
- YYFPRINTF (stderr, "Error: state stack now");
- while (yyssp1 != yyssp)
- YYFPRINTF (stderr, " %d", *++yyssp1);
- YYFPRINTF (stderr, "\n");
- }
-#endif
- }
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- YYDPRINTF ((stderr, "Shifting error token, "));
-
- *++yyvsp = yylval;
-
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here. |
-`-------------------------------------*/
-yyacceptlab:
- yyresult = 0;
- goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here. |
-`-----------------------------------*/
-yyabortlab:
- yyresult = 1;
- goto yyreturn;
-
-#ifndef yyoverflow
-/*----------------------------------------------.
-| yyoverflowlab -- parser overflow comes here. |
-`----------------------------------------------*/
-yyoverflowlab:
- yyerror ("parser stack overflow");
- yyresult = 2;
- /* Fall through. */
-#endif
-
-yyreturn:
-#ifndef yyoverflow
- if (yyss != yyssa)
- YYSTACK_FREE (yyss);
-#endif
- return yyresult;
-}
-
-
-#line 380 "gram.y"
-
-
-void
-apply_seq_in_map( SyckParser *parser, SyckNode *n )
-{
- long map_len;
- if ( n->shortcut == NULL )
- {
- return;
- }
-
- map_len = syck_map_count( n );
- syck_map_assign( n, map_value, map_len - 1,
- syck_hdlr_add_node( parser, n->shortcut ) );
-
- n->shortcut = NULL;
-}
-
-
diff --git a/ext/syck/gram.h b/ext/syck/gram.h
deleted file mode 100644
index f21796a64d..0000000000
--- a/ext/syck/gram.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* A Bison parser, made from gram.y, by GNU bison 1.75. */
-
-/* Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
-
-#ifndef BISON_Y_TAB_H
-# define BISON_Y_TAB_H
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- YAML_ANCHOR = 258,
- YAML_ALIAS = 259,
- YAML_TRANSFER = 260,
- YAML_ITRANSFER = 261,
- YAML_WORD = 262,
- YAML_PLAIN = 263,
- YAML_BLOCK = 264,
- YAML_DOCSEP = 265,
- YAML_IOPEN = 266,
- YAML_INDENT = 267,
- YAML_IEND = 268
- };
-#endif
-#define YAML_ANCHOR 258
-#define YAML_ALIAS 259
-#define YAML_TRANSFER 260
-#define YAML_ITRANSFER 261
-#define YAML_WORD 262
-#define YAML_PLAIN 263
-#define YAML_BLOCK 264
-#define YAML_DOCSEP 265
-#define YAML_IOPEN 266
-#define YAML_INDENT 267
-#define YAML_IEND 268
-
-
-
-
-#ifndef YYSTYPE
-#line 23 "gram.y"
-typedef union {
- SYMID nodeId;
- SyckNode *nodeData;
- char *name;
-} yystype;
-/* Line 1281 of /usr/local/share/bison/yacc.c. */
-#line 72 "y.tab.h"
-# define YYSTYPE yystype
-#endif
-
-
-
-
-#endif /* not BISON_Y_TAB_H */
-
diff --git a/ext/syck/handler.c b/ext/syck/handler.c
deleted file mode 100644
index 0a7ee8c10f..0000000000
--- a/ext/syck/handler.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * handler.h
- *
- * $Author$
- * $Date$
- *
- * Copyright (C) 2003 why the lucky stiff
- */
-
-#include "syck.h"
-#include "ruby.h"
-
-SYMID
-syck_hdlr_add_node( SyckParser *p, SyckNode *n )
-{
- SYMID id;
-
- if ( ! n->id )
- {
- n->id = (p->handler)( p, n );
- }
- id = n->id;
-
- if ( n->anchor == NULL )
- {
- syck_free_node( n );
- }
- return id;
-}
-
-SyckNode *
-syck_hdlr_add_anchor( SyckParser *p, char *a, SyckNode *n )
-{
- n->anchor = a;
- if ( p->bad_anchors != NULL )
- {
- SyckNode *bad;
- if ( st_lookup( p->bad_anchors, (st_data_t)a, (st_data_t *)&bad ) )
- {
- if ( n->kind != syck_str_kind )
- {
- n->id = bad->id;
- (p->handler)( p, n );
- }
- }
- }
- if ( p->anchors == NULL )
- {
- p->anchors = st_init_strtable();
- }
- st_insert( p->anchors, (st_data_t)a, (st_data_t)n );
- return n;
-}
-
-void
-syck_hdlr_remove_anchor( SyckParser *p, char *a )
-{
- if ( p->anchors == NULL )
- {
- p->anchors = st_init_strtable();
- }
- st_insert( p->anchors, (st_data_t)a, (st_data_t)1 );
-}
-
-SyckNode *
-syck_hdlr_get_anchor( SyckParser *p, char *a )
-{
- SyckNode *n = NULL;
-
- if ( p->anchors != NULL )
- {
- if ( st_lookup( p->anchors, (st_data_t)a, (st_data_t *)&n ) )
- {
- if ( n != (void *)1 )
- {
- return n;
- }
- else
- {
- if ( p->bad_anchors == NULL )
- {
- p->bad_anchors = st_init_strtable();
- }
- if ( ! st_lookup( p->bad_anchors, (st_data_t)a, (st_data_t *)&n ) )
- {
- n = (p->bad_anchor_handler)( p, a );
- st_insert( p->bad_anchors, (st_data_t)a, (st_data_t)n );
- }
- }
- }
- }
-
- if ( n == NULL )
- {
- n = (p->bad_anchor_handler)( p, a );
- }
- n->anchor = a;
- return n;
-}
-
-void
-syck_add_transfer( char *uri, SyckNode *n, int taguri )
-{
- if ( n->type_id != NULL )
- {
- S_FREE( n->type_id );
- }
-
- if ( taguri == 0 )
- {
- n->type_id = uri;
- return;
- }
-
- n->type_id = syck_type_id_to_uri( uri );
- S_FREE( uri );
-}
-
-char *
-syck_xprivate( char *type_id, int type_len )
-{
- char *uri = S_ALLOC_N( char, type_len + 14 );
- uri[0] = '\0';
- strcat( uri, "x-private:" );
- strncat( uri, type_id, type_len );
- return uri;
-}
-
-char *
-syck_taguri( char *domain, char *type_id, int type_len )
-{
- char *uri = S_ALLOC_N( char, strlen( domain ) + type_len + 14 );
- uri[0] = '\0';
- strcat( uri, "taguri:" );
- strcat( uri, domain );
- strcat( uri, ":" );
- strncat( uri, type_id, type_len );
- return uri;
-}
-
-int
-syck_try_implicit( SyckNode *n )
-{
- return 1;
-}
-
diff --git a/ext/syck/implicit.c b/ext/syck/implicit.c
deleted file mode 100644
index 4ab61c5539..0000000000
--- a/ext/syck/implicit.c
+++ /dev/null
@@ -1,2826 +0,0 @@
-/* Generated by re2c 0.5 on Mon Jul 28 11:21:48 2003 */
-#line 1 "implicit.re"
-/*
- * implicit.re
- *
- * $Author$
- * $Date$
- *
- * Copyright (C) 2003 why the lucky stiff
- */
-
-#include "syck.h"
-#include "ruby.h"
-
-#define YYCTYPE char
-#define YYCURSOR cursor
-#define YYMARKER marker
-#define YYLIMIT limit
-#define YYFILL(n)
-
-void
-try_tag_implicit( SyckNode *n, int taguri )
-{
- char *tid = "";
- switch ( n->kind )
- {
- case syck_str_kind:
- tid = syck_match_implicit( n->data.str->ptr, n->data.str->len );
- break;
-
- case syck_seq_kind:
- tid = "seq";
- break;
-
- case syck_map_kind:
- tid = "map";
- break;
- }
- if ( taguri == 1 )
- {
- n->type_id = syck_taguri( YAML_DOMAIN, tid, strlen( tid ) );
- } else {
- n->type_id = syck_strndup( tid, strlen( tid ) );
- }
-}
-
-char *syck_match_implicit( char *str, size_t len )
-{
- char *cursor, *limit, *marker;
- cursor = str;
- limit = str + len;
-
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy0;
-yy1: ++YYCURSOR;
-yy0:
- if((YYLIMIT - YYCURSOR) < 26) YYFILL(26);
- yych = *YYCURSOR;
- switch(yych){
- case '\000': goto yy2;
- case '+': goto yy15;
- case '-': goto yy16;
- case '.': goto yy19;
- case '0': goto yy17;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy18;
- case '<': goto yy21;
- case '=': goto yy20;
- case 'F': goto yy14;
- case 'N': goto yy6;
- case 'O': goto yy12;
- case 'T': goto yy8;
- case 'Y': goto yy10;
- case 'f': goto yy13;
- case 'n': goto yy5;
- case 'o': goto yy11;
- case 't': goto yy7;
- case 'y': goto yy9;
- case '~': goto yy3;
- default: goto yy22;
- }
-yy2: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy4;
- }
-yy3: yych = *++YYCURSOR;
- if(yych <= '\000') goto yy188;
-yy4:
-#line 116
- { return "str"; }
-yy5: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'o': goto yy161;
- case 'u': goto yy191;
- default: goto yy4;
- }
-yy6: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'O': case 'o': goto yy161;
- case 'U': goto yy184;
- case 'u': goto yy185;
- default: goto yy4;
- }
-yy7: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'r': goto yy182;
- default: goto yy4;
- }
-yy8: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'R': goto yy178;
- case 'r': goto yy179;
- default: goto yy4;
- }
-yy9: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'e': goto yy177;
- default: goto yy4;
- }
-yy10: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'E': goto yy175;
- case 'e': goto yy176;
- default: goto yy4;
- }
-yy11: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'f': goto yy174;
- case 'n': goto yy171;
- default: goto yy4;
- }
-yy12: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'F': goto yy169;
- case 'N': case 'n': goto yy171;
- case 'f': goto yy170;
- default: goto yy4;
- }
-yy13: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'a': goto yy166;
- default: goto yy4;
- }
-yy14: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'A': goto yy157;
- case 'a': goto yy158;
- default: goto yy4;
- }
-yy15: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '.': goto yy156;
- case '0': goto yy147;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy45;
- default: goto yy4;
- }
-yy16: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '.': goto yy146;
- case '0': goto yy147;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy45;
- default: goto yy4;
- }
-yy17: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '\000': goto yy49;
- case ',': goto yy131;
- case '.': goto yy47;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7': goto yy129;
- case '8':
- case '9': goto yy130;
- case 'x': goto yy133;
- default: goto yy4;
- }
-yy18: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '\000': goto yy49;
- case ',': goto yy45;
- case '.': goto yy47;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy44;
- default: goto yy4;
- }
-yy19: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'I': goto yy31;
- case 'N': goto yy29;
- case 'i': goto yy30;
- case 'n': goto yy28;
- default: goto yy4;
- }
-yy20: yych = *++YYCURSOR;
- if(yych <= '\000') goto yy26;
- goto yy4;
-yy21: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '<': goto yy23;
- default: goto yy4;
- }
-yy22: yych = *++YYCURSOR;
- goto yy4;
-yy23: yych = *++YYCURSOR;
- if(yych >= '\001') goto yy2;
-yy24: yych = *++YYCURSOR;
-yy25:
-#line 114
- { return "merge"; }
-yy26: yych = *++YYCURSOR;
-yy27:
-#line 112
- { return "default"; }
-yy28: yych = *++YYCURSOR;
- switch(yych){
- case 'a': goto yy43;
- default: goto yy2;
- }
-yy29: yych = *++YYCURSOR;
- switch(yych){
- case 'A': goto yy38;
- case 'a': goto yy39;
- default: goto yy2;
- }
-yy30: yych = *++YYCURSOR;
- switch(yych){
- case 'n': goto yy37;
- default: goto yy2;
- }
-yy31: yych = *++YYCURSOR;
- switch(yych){
- case 'N': goto yy32;
- case 'n': goto yy33;
- default: goto yy2;
- }
-yy32: yych = *++YYCURSOR;
- switch(yych){
- case 'F': goto yy34;
- default: goto yy2;
- }
-yy33: yych = *++YYCURSOR;
- switch(yych){
- case 'f': goto yy34;
- default: goto yy2;
- }
-yy34: yych = *++YYCURSOR;
- if(yych >= '\001') goto yy2;
-yy35: yych = *++YYCURSOR;
-yy36:
-#line 98
- { return "float#inf"; }
-yy37: yych = *++YYCURSOR;
- switch(yych){
- case 'f': goto yy34;
- default: goto yy2;
- }
-yy38: yych = *++YYCURSOR;
- switch(yych){
- case 'N': goto yy40;
- default: goto yy2;
- }
-yy39: yych = *++YYCURSOR;
- switch(yych){
- case 'N': goto yy40;
- default: goto yy2;
- }
-yy40: yych = *++YYCURSOR;
- if(yych >= '\001') goto yy2;
-yy41: yych = *++YYCURSOR;
-yy42:
-#line 102
- { return "float#nan"; }
-yy43: yych = *++YYCURSOR;
- switch(yych){
- case 'n': goto yy40;
- default: goto yy2;
- }
-yy44: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy63;
- default: goto yy46;
- }
-yy45: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy46: switch(yych){
- case '\000': goto yy49;
- case ',': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy45;
- case '.': goto yy47;
- default: goto yy2;
- }
-yy47: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy48: switch(yych){
- case '\000': goto yy53;
- case ',': goto yy51;
- case '.': goto yy55;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy47;
- case 'E': case 'e': goto yy57;
- default: goto yy2;
- }
-yy49: yych = *++YYCURSOR;
-yy50:
-#line 92
- { return "int"; }
-yy51: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy52: switch(yych){
- case '\000': goto yy53;
- case ',': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy51;
- default: goto yy2;
- }
-yy53: yych = *++YYCURSOR;
-yy54:
-#line 94
- { return "float#fix"; }
-yy55: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy56: switch(yych){
- case '.': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy55;
- case 'E': case 'e': goto yy57;
- default: goto yy2;
- }
-yy57: yych = *++YYCURSOR;
- switch(yych){
- case '+': case '-': goto yy58;
- default: goto yy2;
- }
-yy58: yych = *++YYCURSOR;
- if(yych <= '\000') goto yy2;
- goto yy60;
-yy59: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy60: switch(yych){
- case '\000': goto yy61;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy59;
- default: goto yy2;
- }
-yy61: yych = *++YYCURSOR;
-yy62:
-#line 96
- { return "float#exp"; }
-yy63: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy64;
- default: goto yy46;
- }
-yy64: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy65;
- default: goto yy46;
- }
-yy65: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy66;
- default: goto yy2;
- }
-yy66: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy67;
- default: goto yy2;
- }
-yy67: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy68;
- default: goto yy2;
- }
-yy68: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy69;
- default: goto yy2;
- }
-yy69: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy70;
- default: goto yy2;
- }
-yy70: yych = *++YYCURSOR;
- switch(yych){
- case '\000': goto yy71;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy2;
- case 'T': goto yy73;
- case 't': goto yy74;
- default: goto yy76;
- }
-yy71: yych = *++YYCURSOR;
-yy72:
-#line 104
- { return "timestamp#ymd"; }
-yy73: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy115;
- default: goto yy2;
- }
-yy74: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy97;
- default: goto yy2;
- }
-yy75: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy76: switch(yych){
- case '\t': case ' ': goto yy75;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy77;
- default: goto yy2;
- }
-yy77: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy78;
- default: goto yy2;
- }
-yy78: yych = *++YYCURSOR;
- switch(yych){
- case ':': goto yy79;
- default: goto yy2;
- }
-yy79: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy80;
- default: goto yy2;
- }
-yy80: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy81;
- default: goto yy2;
- }
-yy81: yych = *++YYCURSOR;
- switch(yych){
- case ':': goto yy82;
- default: goto yy2;
- }
-yy82: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy83;
- default: goto yy2;
- }
-yy83: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy84;
- default: goto yy2;
- }
-yy84: yych = *++YYCURSOR;
- switch(yych){
- case '\t': case ' ': goto yy87;
- case '.': goto yy85;
- default: goto yy2;
- }
-yy85: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy86: switch(yych){
- case '\t': case ' ': goto yy87;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy85;
- default: goto yy2;
- }
-yy87: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy88: switch(yych){
- case '\t': case ' ': goto yy87;
- case '+': case '-': goto yy90;
- case 'Z': goto yy89;
- default: goto yy2;
- }
-yy89: yych = *++YYCURSOR;
- if(yych <= '\000') goto yy94;
- goto yy2;
-yy90: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy91;
- default: goto yy2;
- }
-yy91: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy92;
- default: goto yy2;
- }
-yy92: yych = *++YYCURSOR;
- switch(yych){
- case '\000': goto yy94;
- case ':': goto yy93;
- default: goto yy2;
- }
-yy93: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy96;
- default: goto yy2;
- }
-yy94: yych = *++YYCURSOR;
-yy95:
-#line 108
- { return "timestamp#spaced"; }
-yy96: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy89;
- default: goto yy2;
- }
-yy97: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy98;
- default: goto yy2;
- }
-yy98: yych = *++YYCURSOR;
- switch(yych){
- case ':': goto yy99;
- default: goto yy2;
- }
-yy99: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy100;
- default: goto yy2;
- }
-yy100: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy101;
- default: goto yy2;
- }
-yy101: yych = *++YYCURSOR;
- switch(yych){
- case ':': goto yy102;
- default: goto yy2;
- }
-yy102: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy103;
- default: goto yy2;
- }
-yy103: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy104;
- default: goto yy2;
- }
-yy104: yych = *++YYCURSOR;
- switch(yych){
- case '.': goto yy105;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy2;
- default: goto yy106;
- }
-yy105: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy106: switch(yych){
- case '+': case '-': goto yy108;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy105;
- case 'Z': goto yy107;
- default: goto yy2;
- }
-yy107: yych = *++YYCURSOR;
- if(yych <= '\000') goto yy112;
- goto yy2;
-yy108: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy109;
- default: goto yy2;
- }
-yy109: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy110;
- default: goto yy2;
- }
-yy110: yych = *++YYCURSOR;
- switch(yych){
- case '\000': goto yy112;
- case ':': goto yy111;
- default: goto yy2;
- }
-yy111: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy114;
- default: goto yy2;
- }
-yy112: yych = *++YYCURSOR;
-yy113:
-#line 106
- { return "timestamp#iso8601"; }
-yy114: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy107;
- default: goto yy2;
- }
-yy115: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy116;
- default: goto yy2;
- }
-yy116: yych = *++YYCURSOR;
- switch(yych){
- case ':': goto yy117;
- default: goto yy2;
- }
-yy117: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy118;
- default: goto yy2;
- }
-yy118: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy119;
- default: goto yy2;
- }
-yy119: yych = *++YYCURSOR;
- switch(yych){
- case ':': goto yy120;
- default: goto yy2;
- }
-yy120: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy121;
- default: goto yy2;
- }
-yy121: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy122;
- default: goto yy2;
- }
-yy122: yych = *++YYCURSOR;
- switch(yych){
- case '.': goto yy123;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy2;
- case 'Z': goto yy125;
- default: goto yy124;
- }
-yy123: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
- yych = *YYCURSOR;
-yy124: switch(yych){
- case '+': case '-': goto yy108;
- case '0': goto yy123;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy127;
- case 'Z': goto yy107;
- default: goto yy2;
- }
-yy125: yych = *++YYCURSOR;
- if(yych >= '\001') goto yy2;
-yy126: yych = *++YYCURSOR;
- goto yy113;
-yy127: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
- yych = *YYCURSOR;
-yy128: switch(yych){
- case '+': case '-': goto yy108;
- case '0': goto yy123;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy127;
- case 'Z': goto yy125;
- default: goto yy2;
- }
-yy129: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7': goto yy144;
- case '8':
- case '9': goto yy142;
- default: goto yy132;
- }
-yy130: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy142;
- default: goto yy141;
- }
-yy131: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy132: switch(yych){
- case '\000': goto yy138;
- case ',': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7': goto yy131;
- case '.': goto yy47;
- case '8':
- case '9': goto yy140;
- default: goto yy2;
- }
-yy133: yych = *++YYCURSOR;
- if(yych <= '\000') goto yy2;
- goto yy135;
-yy134: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy135: switch(yych){
- case '\000': goto yy136;
- case ',': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f': goto yy134;
- default: goto yy2;
- }
-yy136: yych = *++YYCURSOR;
-yy137:
-#line 88
- { return "int#hex"; }
-yy138: yych = *++YYCURSOR;
-yy139:
-#line 90
- { return "int#oct"; }
-yy140: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy141: switch(yych){
- case ',': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy140;
- case '.': goto yy47;
- default: goto yy2;
- }
-yy142: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy143;
- default: goto yy141;
- }
-yy143: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy65;
- default: goto yy141;
- }
-yy144: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7': goto yy145;
- case '8':
- case '9': goto yy143;
- default: goto yy132;
- }
-yy145: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy65;
- default: goto yy132;
- }
-yy146: yych = *++YYCURSOR;
- switch(yych){
- case 'I': goto yy149;
- case 'i': goto yy148;
- default: goto yy2;
- }
-yy147: yych = *++YYCURSOR;
- switch(yych){
- case '\000': goto yy49;
- case 'x': goto yy133;
- default: goto yy132;
- }
-yy148: yych = *++YYCURSOR;
- switch(yych){
- case 'n': goto yy155;
- default: goto yy2;
- }
-yy149: yych = *++YYCURSOR;
- switch(yych){
- case 'N': goto yy150;
- case 'n': goto yy151;
- default: goto yy2;
- }
-yy150: yych = *++YYCURSOR;
- switch(yych){
- case 'F': goto yy152;
- default: goto yy2;
- }
-yy151: yych = *++YYCURSOR;
- switch(yych){
- case 'f': goto yy152;
- default: goto yy2;
- }
-yy152: yych = *++YYCURSOR;
- if(yych >= '\001') goto yy2;
-yy153: yych = *++YYCURSOR;
-yy154:
-#line 100
- { return "float#neginf"; }
-yy155: yych = *++YYCURSOR;
- switch(yych){
- case 'f': goto yy152;
- default: goto yy2;
- }
-yy156: yych = *++YYCURSOR;
- switch(yych){
- case 'I': goto yy31;
- case 'i': goto yy30;
- default: goto yy2;
- }
-yy157: yych = *++YYCURSOR;
- switch(yych){
- case 'L': goto yy164;
- default: goto yy2;
- }
-yy158: yych = *++YYCURSOR;
- switch(yych){
- case 'l': goto yy159;
- default: goto yy2;
- }
-yy159: yych = *++YYCURSOR;
- switch(yych){
- case 's': goto yy160;
- default: goto yy2;
- }
-yy160: yych = *++YYCURSOR;
- switch(yych){
- case 'e': goto yy161;
- default: goto yy2;
- }
-yy161: yych = *++YYCURSOR;
- if(yych >= '\001') goto yy2;
-yy162: yych = *++YYCURSOR;
-yy163:
-#line 86
- { return "bool#no"; }
-yy164: yych = *++YYCURSOR;
- switch(yych){
- case 'S': goto yy165;
- default: goto yy2;
- }
-yy165: yych = *++YYCURSOR;
- switch(yych){
- case 'E': goto yy161;
- default: goto yy2;
- }
-yy166: yych = *++YYCURSOR;
- switch(yych){
- case 'l': goto yy167;
- default: goto yy2;
- }
-yy167: yych = *++YYCURSOR;
- switch(yych){
- case 's': goto yy168;
- default: goto yy2;
- }
-yy168: yych = *++YYCURSOR;
- switch(yych){
- case 'e': goto yy161;
- default: goto yy2;
- }
-yy169: yych = *++YYCURSOR;
- switch(yych){
- case 'F': goto yy161;
- default: goto yy2;
- }
-yy170: yych = *++YYCURSOR;
- switch(yych){
- case 'f': goto yy161;
- default: goto yy2;
- }
-yy171: yych = *++YYCURSOR;
- if(yych >= '\001') goto yy2;
-yy172: yych = *++YYCURSOR;
-yy173:
-#line 84
- { return "bool#yes"; }
-yy174: yych = *++YYCURSOR;
- switch(yych){
- case 'f': goto yy161;
- default: goto yy2;
- }
-yy175: yych = *++YYCURSOR;
- switch(yych){
- case 'S': goto yy171;
- default: goto yy2;
- }
-yy176: yych = *++YYCURSOR;
- switch(yych){
- case 's': goto yy171;
- default: goto yy2;
- }
-yy177: yych = *++YYCURSOR;
- switch(yych){
- case 's': goto yy171;
- default: goto yy2;
- }
-yy178: yych = *++YYCURSOR;
- switch(yych){
- case 'U': goto yy181;
- default: goto yy2;
- }
-yy179: yych = *++YYCURSOR;
- switch(yych){
- case 'u': goto yy180;
- default: goto yy2;
- }
-yy180: yych = *++YYCURSOR;
- switch(yych){
- case 'e': goto yy171;
- default: goto yy2;
- }
-yy181: yych = *++YYCURSOR;
- switch(yych){
- case 'E': goto yy171;
- default: goto yy2;
- }
-yy182: yych = *++YYCURSOR;
- switch(yych){
- case 'u': goto yy183;
- default: goto yy2;
- }
-yy183: yych = *++YYCURSOR;
- switch(yych){
- case 'e': goto yy171;
- default: goto yy2;
- }
-yy184: yych = *++YYCURSOR;
- switch(yych){
- case 'L': goto yy190;
- default: goto yy2;
- }
-yy185: yych = *++YYCURSOR;
- switch(yych){
- case 'l': goto yy186;
- default: goto yy2;
- }
-yy186: yych = *++YYCURSOR;
- switch(yych){
- case 'l': goto yy187;
- default: goto yy2;
- }
-yy187: yych = *++YYCURSOR;
- if(yych >= '\001') goto yy2;
-yy188: yych = *++YYCURSOR;
-yy189:
-#line 82
- { return "null"; }
-yy190: yych = *++YYCURSOR;
- switch(yych){
- case 'L': goto yy187;
- default: goto yy2;
- }
-yy191: yych = *++YYCURSOR;
- switch(yych){
- case 'l': goto yy192;
- default: goto yy2;
- }
-yy192: yych = *++YYCURSOR;
- switch(yych){
- case 'l': goto yy187;
- default: goto yy2;
- }
-}
-#line 118
-
-
-}
-
-char *
-syck_type_id_to_uri( char *type_id )
-{
- char *cursor, *limit, *marker;
-
- cursor = type_id;
- limit = type_id + strlen( type_id );
-
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy193;
-yy194: ++YYCURSOR;
-yy193:
- if((YYLIMIT - YYCURSOR) < 20) YYFILL(20);
- yych = *YYCURSOR;
- switch(yych){
- case '\000': goto yy195;
- case '!': goto yy199;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's': case 'u':
- case 'v':
- case 'w': case 'y':
- case 'z': goto yy201;
- case 't': goto yy196;
- case 'x': goto yy198;
- default: goto yy202;
- }
-yy195: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy197;
- }
-yy196: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case ',': goto yy207;
- case '-': goto yy203;
- case '.': goto yy208;
- case '/': goto yy209;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy205;
- case 'a': goto yy236;
- default: goto yy197;
- }
-yy197:
-#line 170
- { return syck_taguri( YAML_DOMAIN, type_id, strlen( type_id ) ); }
-yy198: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case ',': goto yy207;
- case '-': goto yy203;
- case '.': goto yy208;
- case '/': goto yy209;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o': case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy205;
- case 'p': goto yy227;
- default: goto yy197;
- }
-yy199: yych = *++YYCURSOR;
-yy200:
-#line 144
- { return syck_xprivate( type_id + 1, strlen( type_id ) - 1 ); }
-yy201: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case ',': goto yy207;
- case '-': goto yy203;
- case '.': goto yy208;
- case '/': goto yy209;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy205;
- default: goto yy197;
- }
-yy202: yych = *++YYCURSOR;
- goto yy197;
-yy203: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy204: switch(yych){
- case '-': goto yy203;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy205;
- default: goto yy195;
- }
-yy205: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy206: switch(yych){
- case ',': goto yy207;
- case '-': goto yy203;
- case '.': goto yy208;
- case '/': goto yy209;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy205;
- default: goto yy195;
- }
-yy207: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy215;
- default: goto yy195;
- }
-yy208: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy211;
- default: goto yy195;
- }
-yy209: yych = *++YYCURSOR;
-yy210:
-#line 146
- { char *domain = S_ALLOC_N( char, ( YYCURSOR - type_id ) + 15 );
- char *uri;
-
- domain[0] = '\0';
- strncat( domain, type_id, ( YYCURSOR - type_id ) - 1 );
- strcat( domain, "." );
- strcat( domain, YAML_DOMAIN );
- uri = syck_taguri( domain, YYCURSOR, YYLIMIT - YYCURSOR );
-
- S_FREE( domain );
- return uri;
- }
-yy211: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
-yy212: switch(yych){
- case ',': goto yy207;
- case '-': goto yy213;
- case '.': goto yy208;
- case '/': goto yy209;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy211;
- default: goto yy195;
- }
-yy213: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy214: switch(yych){
- case '-': goto yy213;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy211;
- default: goto yy195;
- }
-yy215: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy216;
- default: goto yy195;
- }
-yy216: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy217;
- default: goto yy195;
- }
-yy217: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy218;
- default: goto yy195;
- }
-yy218: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy219;
- case '/': goto yy220;
- default: goto yy195;
- }
-yy219: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy222;
- default: goto yy195;
- }
-yy220: yych = *++YYCURSOR;
-yy221:
-#line 159
- { char *domain = S_ALLOC_N( char, YYCURSOR - type_id );
- char *uri;
-
- domain[0] = '\0';
- strncat( domain, type_id, ( YYCURSOR - type_id ) - 1 );
- uri = syck_taguri( domain, YYCURSOR, YYLIMIT - YYCURSOR );
-
- S_FREE( domain );
- return uri;
- }
-yy222: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy223;
- default: goto yy195;
- }
-yy223: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy224;
- case '/': goto yy220;
- default: goto yy195;
- }
-yy224: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy225;
- default: goto yy195;
- }
-yy225: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy226;
- default: goto yy195;
- }
-yy226: yych = *++YYCURSOR;
- switch(yych){
- case '/': goto yy220;
- default: goto yy195;
- }
-yy227: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy207;
- case '.': goto yy208;
- case '/': goto yy209;
- case 'r': goto yy228;
- default: goto yy204;
- }
-yy228: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy207;
- case '.': goto yy208;
- case '/': goto yy209;
- case 'i': goto yy229;
- default: goto yy204;
- }
-yy229: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy207;
- case '.': goto yy208;
- case '/': goto yy209;
- case 'v': goto yy230;
- default: goto yy204;
- }
-yy230: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy207;
- case '.': goto yy208;
- case '/': goto yy209;
- case 'a': goto yy231;
- default: goto yy204;
- }
-yy231: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy207;
- case '.': goto yy208;
- case '/': goto yy209;
- case 't': goto yy232;
- default: goto yy204;
- }
-yy232: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy207;
- case '.': goto yy208;
- case '/': goto yy209;
- case 'e': goto yy233;
- default: goto yy204;
- }
-yy233: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy207;
- case '.': goto yy208;
- case '/': goto yy209;
- case ':': goto yy234;
- default: goto yy204;
- }
-yy234: yych = *++YYCURSOR;
-yy235:
-#line 142
- { return type_id; }
-yy236: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy207;
- case '.': goto yy208;
- case '/': goto yy209;
- case 'g': goto yy237;
- default: goto yy204;
- }
-yy237: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy207;
- case '.': goto yy208;
- case '/': goto yy209;
- case 'u': goto yy238;
- default: goto yy204;
- }
-yy238: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy207;
- case '.': goto yy208;
- case '/': goto yy209;
- case 'r': goto yy239;
- default: goto yy204;
- }
-yy239: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy207;
- case '.': goto yy208;
- case '/': goto yy209;
- case 'i': goto yy240;
- default: goto yy204;
- }
-yy240: yych = *++YYCURSOR;
- switch(yych){
- case ',': goto yy207;
- case '.': goto yy208;
- case '/': goto yy209;
- case ':': goto yy241;
- default: goto yy204;
- }
-yy241: yych = *++YYCURSOR;
- switch(yych){
- case ',':
- case '-':
- case '.': goto yy195;
- default: goto yy243;
- }
-yy242: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy243: switch(yych){
- case ',': goto yy246;
- case '-': goto yy244;
- case '.': goto yy247;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy242;
- default: goto yy195;
- }
-yy244: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy245: switch(yych){
- case '-': goto yy244;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy242;
- default: goto yy195;
- }
-yy246: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy252;
- default: goto yy195;
- }
-yy247: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy248;
- default: goto yy195;
- }
-yy248: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
-yy249: switch(yych){
- case ',': goto yy246;
- case '-': goto yy250;
- case '.': goto yy247;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy248;
- default: goto yy195;
- }
-yy250: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy251: switch(yych){
- case '-': goto yy250;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy248;
- default: goto yy195;
- }
-yy252: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy253;
- default: goto yy195;
- }
-yy253: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy254;
- default: goto yy195;
- }
-yy254: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy255;
- default: goto yy195;
- }
-yy255: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy256;
- case ':': goto yy257;
- default: goto yy195;
- }
-yy256: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy259;
- default: goto yy195;
- }
-yy257: yych = *++YYCURSOR;
-yy258:
-#line 140
- { return type_id; }
-yy259: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy260;
- default: goto yy195;
- }
-yy260: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy261;
- case ':': goto yy257;
- default: goto yy195;
- }
-yy261: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy262;
- default: goto yy195;
- }
-yy262: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy263;
- default: goto yy195;
- }
-yy263: yych = *++YYCURSOR;
- switch(yych){
- case ':': goto yy257;
- default: goto yy195;
- }
-}
-#line 172
-
-
-}
-
diff --git a/ext/syck/node.c b/ext/syck/node.c
deleted file mode 100644
index f999700554..0000000000
--- a/ext/syck/node.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * node.c
- *
- * $Author$
- * $Date$
- *
- * Copyright (C) 2003 why the lucky stiff
- */
-
-#include "syck.h"
-#include "ruby.h"
-
-/*
- * Node allocation functions
- */
-SyckNode *
-syck_alloc_node( enum syck_kind_tag type )
-{
- SyckNode *s;
-
- s = S_ALLOC( SyckNode );
- s->kind = type;
- s->id = 0;
- s->type_id = NULL;
- s->anchor = NULL;
- s->shortcut = NULL;
-
- return s;
-}
-
-void
-syck_free_node( SyckNode *n )
-{
- syck_free_members( n );
- if ( n->type_id != NULL )
- S_FREE( n->type_id );
- if ( n->anchor != NULL )
- S_FREE( n->anchor );
- S_FREE( n );
-}
-
-SyckNode *
-syck_alloc_map()
-{
- SyckNode *n;
- struct SyckMap *m;
-
- m = S_ALLOC( struct SyckMap );
- m->idx = 0;
- m->capa = ALLOC_CT;
- m->keys = S_ALLOC_N( SYMID, m->capa );
- m->values = S_ALLOC_N( SYMID, m->capa );
-
- n = syck_alloc_node( syck_map_kind );
- n->data.pairs = m;
-
- return n;
-}
-
-SyckNode *
-syck_alloc_seq()
-{
- SyckNode *n;
- struct SyckSeq *s;
-
- s = S_ALLOC( struct SyckSeq );
- s->idx = 0;
- s->capa = ALLOC_CT;
- s->items = S_ALLOC_N( SYMID, s->capa );
-
- n = syck_alloc_node( syck_seq_kind );
- n->data.list = s;
-
- return n;
-}
-
-SyckNode *
-syck_alloc_str()
-{
- SyckNode *n;
- struct SyckStr *s;
-
- s = S_ALLOC( struct SyckStr );
- s->len = 0;
- s->ptr = NULL;
-
- n = syck_alloc_node( syck_str_kind );
- n->data.str = s;
-
- return n;
-}
-
-SyckNode *
-syck_new_str( char *str )
-{
- return syck_new_str2( str, strlen( str ) );
-}
-
-SyckNode *
-syck_new_str2( char *str, long len )
-{
- SyckNode *n;
-
- n = syck_alloc_str();
- n->data.str->ptr = S_ALLOC_N( char, len + 1 );
- n->data.str->len = len;
- memcpy( n->data.str->ptr, str, len );
- n->data.str->ptr[len] = '\0';
-
- return n;
-}
-
-void
-syck_str_blow_away_commas( SyckNode *n )
-{
- char *go, *end;
-
- go = n->data.str->ptr;
- end = go + n->data.str->len;
- while ( *(++go) != '\0' )
- {
- if ( *go == ',' )
- {
- n->data.str->len -= 1;
- memmove( go, go + 1, end - go );
- end -= 1;
- }
- }
-}
-
-char *
-syck_str_read( SyckNode *n )
-{
- ASSERT( n != NULL );
- return n->data.str->ptr;
-}
-
-SyckNode *
-syck_new_map( SYMID key, SYMID value )
-{
- SyckNode *n;
-
- n = syck_alloc_map();
- syck_map_add( n, key, value );
-
- return n;
-}
-
-void
-syck_map_add( SyckNode *map, SYMID key, SYMID value )
-{
- struct SyckMap *m;
- long idx;
-
- ASSERT( map != NULL );
- ASSERT( map->data.pairs != NULL );
-
- m = map->data.pairs;
- idx = m->idx;
- m->idx += 1;
- if ( m->idx > m->capa )
- {
- m->capa += ALLOC_CT;
- S_REALLOC_N( m->keys, SYMID, m->capa );
- S_REALLOC_N( m->values, SYMID, m->capa );
- }
- m->keys[idx] = key;
- m->values[idx] = value;
-}
-
-void
-syck_map_update( SyckNode *map1, SyckNode *map2 )
-{
- struct SyckMap *m1, *m2;
- long new_idx, new_capa;
- ASSERT( map1 != NULL );
- ASSERT( map2 != NULL );
-
- m1 = map1->data.pairs;
- m2 = map2->data.pairs;
- if ( m2->idx < 1 ) return;
-
- new_idx = m1->idx;
- new_idx += m2->idx;
- new_capa = m1->capa;
- while ( new_idx > new_capa )
- {
- new_capa += ALLOC_CT;
- }
- if ( new_capa > m1->capa )
- {
- m1->capa = new_capa;
- S_REALLOC_N( m1->keys, SYMID, m1->capa );
- S_REALLOC_N( m1->values, SYMID, m1->capa );
- }
- for ( new_idx = 0; new_idx < m2->idx; m1->idx++, new_idx++ )
- {
- m1->keys[m1->idx] = m2->keys[new_idx];
- m1->values[m1->idx] = m2->values[new_idx];
- }
-}
-
-long
-syck_map_count( SyckNode *map )
-{
- ASSERT( map != NULL );
- ASSERT( map->data.pairs != NULL );
- return map->data.pairs->idx;
-}
-
-void
-syck_map_assign( SyckNode *map, enum map_part p, long idx, SYMID id )
-{
- struct SyckMap *m;
-
- ASSERT( map != NULL );
- m = map->data.pairs;
- ASSERT( m != NULL );
- if ( p == map_key )
- {
- m->keys[idx] = id;
- }
- else
- {
- m->values[idx] = id;
- }
-}
-
-SYMID
-syck_map_read( SyckNode *map, enum map_part p, long idx )
-{
- struct SyckMap *m;
-
- ASSERT( map != NULL );
- m = map->data.pairs;
- ASSERT( m != NULL );
- if ( p == map_key )
- {
- return m->keys[idx];
- }
- else
- {
- return m->values[idx];
- }
-}
-
-SyckNode *
-syck_new_seq( SYMID value )
-{
- SyckNode *n;
-
- n = syck_alloc_seq();
- syck_seq_add( n, value );
-
- return n;
-}
-
-void
-syck_seq_add( SyckNode *arr, SYMID value )
-{
- struct SyckSeq *s;
- long idx;
-
- ASSERT( arr != NULL );
- ASSERT( arr->data.list != NULL );
-
- s = arr->data.list;
- idx = s->idx;
- s->idx += 1;
- if ( s->idx > s->capa )
- {
- s->capa += ALLOC_CT;
- S_REALLOC_N( s->items, SYMID, s->capa );
- }
- s->items[idx] = value;
-}
-
-long
-syck_seq_count( SyckNode *seq )
-{
- ASSERT( seq != NULL );
- ASSERT( seq->data.list != NULL );
- return seq->data.list->idx;
-}
-
-SYMID
-syck_seq_read( SyckNode *seq, long idx )
-{
- struct SyckSeq *s;
-
- ASSERT( seq != NULL );
- s = seq->data.list;
- ASSERT( s != NULL );
- return s->items[idx];
-}
-
-void
-syck_free_members( SyckNode *n )
-{
- switch ( n->kind )
- {
- case syck_str_kind:
- if ( n->data.str->ptr != NULL )
- {
- S_FREE( n->data.str->ptr );
- n->data.str->ptr = NULL;
- n->data.str->len = 0;
- S_FREE( n->data.str );
- }
- break;
-
- case syck_seq_kind:
- S_FREE( n->data.list->items );
- S_FREE( n->data.list );
- break;
-
- case syck_map_kind:
- S_FREE( n->data.pairs->keys );
- S_FREE( n->data.pairs->values );
- S_FREE( n->data.pairs );
- break;
- }
-}
-
diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c
deleted file mode 100644
index cdef3a089a..0000000000
--- a/ext/syck/rubyext.c
+++ /dev/null
@@ -1,1288 +0,0 @@
-/*
- * rubyext.c
- *
- * $Author$
- * $Date$
- *
- * Copyright (C) 2003 why the lucky stiff
- */
-
-#include "ruby.h"
-#include "syck.h"
-#include <sys/types.h>
-#include <time.h>
-
-typedef struct RVALUE {
- union {
-#if 0
- struct {
- unsigned long flags; /* always 0 for freed obj */
- struct RVALUE *next;
- } free;
-#endif
- struct RBasic basic;
- struct RObject object;
- struct RClass klass;
- /*struct RFloat flonum;*/
- /*struct RString string;*/
- struct RArray array;
- /*struct RRegexp regexp;*/
- struct RHash hash;
- /*struct RData data;*/
- struct RStruct rstruct;
- /*struct RBignum bignum;*/
- /*struct RFile file;*/
- } as;
-} RVALUE;
-
-#define RUBY_DOMAIN "ruby.yaml.org,2002"
-
-/*
- * symbols and constants
- */
-static ID s_new, s_utc, s_at, s_to_f, s_read, s_binmode, s_call, s_transfer, s_update, s_dup, s_match;
-static VALUE sym_model, sym_generic;
-static VALUE sym_scalar, sym_seq, sym_map;
-VALUE cDate, cParser, cLoader, cNode, cPrivateType, cDomainType, cBadAlias, cMergeKey, cEmitter;
-VALUE oDefaultLoader;
-
-/*
- * my private collection of numerical oddities.
- */
-static double S_zero() { return 0.0; }
-static double S_one() { return 1.0; }
-static double S_inf() { return S_one() / S_zero(); }
-static double S_nan() { return S_zero() / S_zero(); }
-
-static VALUE syck_node_transform( VALUE );
-
-/*
- * handler prototypes
- */
-SYMID rb_syck_parse_handler _((SyckParser *, SyckNode *));
-SYMID rb_syck_load_handler _((SyckParser *, SyckNode *));
-void rb_syck_err_handler _((SyckParser *, char *));
-SyckNode * rb_syck_bad_anchor_handler _((SyckParser *, char *));
-void rb_syck_output_handler _((SyckEmitter *, char *, long));
-
-struct parser_xtra {
- VALUE data; /* Borrowed this idea from marshal.c to fix [ruby-core:8067] problem */
- VALUE proc;
-};
-
-/*
- * read from io.
- */
-long
-rb_syck_io_str_read( char *buf, SyckIoStr *str, long max_size, long skip )
-{
- long len = 0;
-
- ASSERT( str != NULL );
- max_size -= skip;
- if ( max_size < 0 ) max_size = 0;
-
- if ( max_size > 0 )
- {
- /*
- * call io#read.
- */
- VALUE src = (VALUE)str->ptr;
- VALUE n = LONG2NUM(max_size);
- VALUE str = rb_funcall2(src, s_read, 1, &n);
- if (!NIL_P(str))
- {
- len = RSTRING(str)->len;
- memcpy( buf + skip, RSTRING(str)->ptr, len );
- }
- }
- len += skip;
- buf[len] = '\0';
- return len;
-}
-
-/*
- * determine: are we reading from a string or io?
- */
-void
-syck_parser_assign_io(parser, port)
- SyckParser *parser;
- VALUE port;
-{
- if (rb_respond_to(port, rb_intern("to_str"))) {
-#if 0
- arg.taint = OBJ_TAINTED(port); /* original taintedness */
- StringValue(port); /* possible conversion */
-#endif
- syck_parser_str( parser, RSTRING(port)->ptr, RSTRING(port)->len, NULL );
- }
- else if (rb_respond_to(port, s_read)) {
- if (rb_respond_to(port, s_binmode)) {
- rb_funcall2(port, s_binmode, 0, 0);
- }
-#if 0
- arg.taint = Qfalse;
-#endif
- syck_parser_str( parser, (char *)port, 0, rb_syck_io_str_read );
- }
- else {
- rb_raise(rb_eTypeError, "instance of IO needed");
- }
-}
-
-/*
- * Get value in hash by key, forcing an empty hash if nil.
- */
-VALUE
-syck_get_hash_aref(hsh, key)
- VALUE hsh, key;
-{
- VALUE val = rb_hash_aref( hsh, key );
- if ( NIL_P( val ) )
- {
- val = rb_hash_new();
- rb_hash_aset(hsh, key, val);
- }
- return val;
-}
-
-/*
- * creating timestamps
- */
-SYMID
-rb_syck_mktime(str)
- char *str;
-{
- VALUE time;
- char *ptr = str;
- VALUE year, mon, day, hour, min, sec, usec;
-
- /* Year*/
- ptr[4] = '\0';
- year = INT2FIX(strtol(ptr, NULL, 10));
-
- /* Month*/
- ptr += 4;
- while ( !isdigit( *ptr ) ) ptr++;
- mon = INT2FIX(strtol(ptr, NULL, 10));
-
- /* Day*/
- ptr += 2;
- while ( !isdigit( *ptr ) ) ptr++;
- day = INT2FIX(strtol(ptr, NULL, 10));
-
- /* Hour*/
- ptr += 2;
- while ( !isdigit( *ptr ) ) ptr++;
- hour = INT2FIX(strtol(ptr, NULL, 10));
-
- /* Minute */
- ptr += 2;
- while ( !isdigit( *ptr ) ) ptr++;
- min = INT2FIX(strtol(ptr, NULL, 10));
-
- /* Second */
- ptr += 2;
- while ( !isdigit( *ptr ) ) ptr++;
- sec = INT2FIX(strtol(ptr, NULL, 10));
-
- /* Millisecond */
- ptr += 2;
- if ( *ptr == '.' )
- {
- usec = INT2FIX( strtod( ptr, NULL ) * 1000000 );
- }
- else
- {
- usec = INT2FIX( 0 );
- }
-
- /* Make UTC time*/
- time = rb_funcall(rb_cTime, s_utc, 7, year, mon, day, hour, min, sec, usec);
-
- /* Time Zone*/
- while ( *ptr != 'Z' && *ptr != '+' && *ptr != '-' && *ptr != '\0' ) ptr++;
- if ( *ptr == '-' || *ptr == '+' )
- {
- double tz_offset = 0;
- double utc_time = 0;
- tz_offset += strtod(ptr, NULL) * 3600;
-
- while ( *ptr != ':' && *ptr != '\0' ) ptr++;
- if ( *ptr == ':' )
- {
- ptr += 1;
- if ( tz_offset < 0 )
- {
- tz_offset -= strtod(ptr, NULL) * 60;
- }
- else
- {
- tz_offset += strtod(ptr, NULL) * 60;
- }
- }
-
- /* Make TZ time*/
- utc_time = NUM2DBL(rb_funcall(time, s_to_f, 0));
- utc_time -= tz_offset;
- time = rb_funcall(rb_cTime, s_at, 1, rb_float_new(utc_time));
- }
-
- return time;
-}
-
-/*
- * {generic mode} node handler
- * - Loads data into Node classes
- */
-SYMID
-rb_syck_parse_handler(p, n)
- SyckParser *p;
- SyckNode *n;
-{
- VALUE t, obj, v = Qnil;
- int i;
- struct parser_xtra *bonus;
-
- obj = rb_obj_alloc(cNode);
- if ( n->type_id != NULL )
- {
- t = rb_str_new2(n->type_id);
- rb_iv_set(obj, "@type_id", t);
- }
-
- switch (n->kind)
- {
- case syck_str_kind:
- rb_iv_set(obj, "@kind", sym_scalar);
- v = rb_str_new( n->data.str->ptr, n->data.str->len );
- break;
-
- case syck_seq_kind:
- rb_iv_set(obj, "@kind", sym_seq);
- v = rb_ary_new2( n->data.list->idx );
- for ( i = 0; i < n->data.list->idx; i++ )
- {
- rb_ary_store( v, i, syck_seq_read( n, i ) );
- }
- break;
-
- case syck_map_kind:
- rb_iv_set(obj, "@kind", sym_map);
- v = rb_hash_new();
- for ( i = 0; i < n->data.pairs->idx; i++ )
- {
- VALUE key = syck_node_transform( syck_map_read( n, map_key, i ) );
- VALUE val = rb_ary_new();
- rb_ary_push(val, syck_map_read( n, map_key, i ));
- rb_ary_push(val, syck_map_read( n, map_value, i ));
-
- rb_hash_aset( v, key, val );
- }
- break;
- }
-
- bonus = (struct parser_xtra *)p->bonus;
- if ( bonus->proc != 0 )
- {
- rb_funcall(bonus->proc, s_call, 1, v);
- }
-
- rb_iv_set(obj, "@value", v);
- rb_hash_aset(bonus->data, INT2FIX(RHASH(bonus->data)->tbl->num_entries), obj);
- return obj;
-}
-
-/*
- * handles merging of an array of hashes
- * (see http://www.yaml.org/type/merge/)
- */
-VALUE
-syck_merge_i( entry, hsh )
- VALUE entry, hsh;
-{
- if ( rb_obj_is_kind_of( entry, rb_cHash ) )
- {
- rb_funcall( hsh, s_update, 1, entry );
- }
- return Qnil;
-}
-
-/*
- * {native mode} node handler
- * - Converts data into native Ruby types
- */
-SYMID
-rb_syck_load_handler(p, n)
- SyckParser *p;
- SyckNode *n;
-{
- VALUE obj = Qnil;
- long i;
- int check_transfers = 0;
- struct parser_xtra *bonus;
-
- switch (n->kind)
- {
- case syck_str_kind:
- if ( n->type_id == NULL || strcmp( n->type_id, "str" ) == 0 )
- {
- obj = rb_str_new( n->data.str->ptr, n->data.str->len );
- }
- else if ( strcmp( n->type_id, "null" ) == 0 )
- {
- obj = Qnil;
- }
- else if ( strcmp( n->type_id, "bool#yes" ) == 0 )
- {
- obj = Qtrue;
- }
- else if ( strcmp( n->type_id, "bool#no" ) == 0 )
- {
- obj = Qfalse;
- }
- else if ( strcmp( n->type_id, "int#hex" ) == 0 )
- {
- obj = rb_cstr2inum( n->data.str->ptr, 16 );
- }
- else if ( strcmp( n->type_id, "int#oct" ) == 0 )
- {
- obj = rb_cstr2inum( n->data.str->ptr, 8 );
- }
- else if ( strncmp( n->type_id, "int", 3 ) == 0 )
- {
- syck_str_blow_away_commas( n );
- obj = rb_cstr2inum( n->data.str->ptr, 10 );
- }
- else if ( strcmp( n->type_id, "float#nan" ) == 0 )
- {
- obj = rb_float_new( S_nan() );
- }
- else if ( strcmp( n->type_id, "float#inf" ) == 0 )
- {
- obj = rb_float_new( S_inf() );
- }
- else if ( strcmp( n->type_id, "float#neginf" ) == 0 )
- {
- obj = rb_float_new( -S_inf() );
- }
- else if ( strncmp( n->type_id, "float", 5 ) == 0 )
- {
- double f;
- syck_str_blow_away_commas( n );
- f = strtod( n->data.str->ptr, NULL );
- obj = rb_float_new( f );
- }
- else if ( strcmp( n->type_id, "timestamp#iso8601" ) == 0 )
- {
- obj = rb_syck_mktime( n->data.str->ptr );
- }
- else if ( strcmp( n->type_id, "timestamp#spaced" ) == 0 )
- {
- obj = rb_syck_mktime( n->data.str->ptr );
- }
- else if ( strcmp( n->type_id, "timestamp#ymd" ) == 0 )
- {
- char *ptr = n->data.str->ptr;
- VALUE year, mon, day;
-
- /* Year*/
- ptr[4] = '\0';
- year = INT2FIX(strtol(ptr, NULL, 10));
-
- /* Month*/
- ptr += 4;
- while ( !isdigit( *ptr ) ) ptr++;
- mon = INT2FIX(strtol(ptr, NULL, 10));
-
- /* Day*/
- ptr += 2;
- while ( !isdigit( *ptr ) ) ptr++;
- day = INT2FIX(strtol(ptr, NULL, 10));
-
- obj = rb_funcall( cDate, s_new, 3, year, mon, day );
- }
- else if ( strncmp( n->type_id, "timestamp", 9 ) == 0 )
- {
- obj = rb_syck_mktime( n->data.str->ptr );
- }
- else if ( strncmp( n->type_id, "merge", 5 ) == 0 )
- {
- obj = rb_funcall( cMergeKey, s_new, 0 );
- }
- else
- {
- check_transfers = 1;
- obj = rb_str_new( n->data.str->ptr, n->data.str->len );
- }
- break;
-
- case syck_seq_kind:
- obj = rb_ary_new2( n->data.list->idx );
- for ( i = 0; i < n->data.list->idx; i++ )
- {
- rb_ary_store( obj, i, syck_seq_read( n, i ) );
- }
- check_transfers = 1;
- break;
-
- case syck_map_kind:
- obj = rb_hash_new();
- for ( i = 0; i < n->data.pairs->idx; i++ )
- {
- VALUE k = syck_map_read( n, map_key, i );
- VALUE v = syck_map_read( n, map_value, i );
- int merge_key = 0;
-
- /*
- * Handle merge keys
- */
- if ( rb_obj_is_kind_of( k, cMergeKey ) )
- {
- if ( rb_obj_is_kind_of( v, rb_cHash ) )
- {
- VALUE dup = rb_funcall( v, s_dup, 0 );
- rb_funcall( dup, s_update, 1, obj );
- obj = dup;
- merge_key = 1;
- }
- else if ( rb_obj_is_kind_of( v, rb_cArray ) )
- {
- VALUE end = rb_ary_pop( v );
- if ( rb_obj_is_kind_of( end, rb_cHash ) )
- {
- VALUE dup = rb_funcall( end, s_dup, 0 );
- v = rb_ary_reverse( v );
- rb_ary_push( v, obj );
- rb_iterate( rb_each, v, syck_merge_i, dup );
- obj = dup;
- merge_key = 1;
- }
- }
- }
-
- if ( ! merge_key )
- {
- rb_hash_aset( obj, k, v );
- }
- }
- check_transfers = 1;
- break;
- }
-
- /*
- * ID already set, let's alter the symbol table to accept the new object
- */
- if (n->id > 0)
- {
- MEMCPY((void *)n->id, (void *)obj, RVALUE, 1);
- MEMZERO((void *)obj, RVALUE, 1);
- obj = n->id;
- }
-
- bonus = (struct parser_xtra *)p->bonus;
- if ( bonus->proc != 0 )
- {
- rb_funcall(bonus->proc, s_call, 1, obj);
- }
-
- if ( check_transfers == 1 && n->type_id != NULL )
- {
- obj = rb_funcall( oDefaultLoader, s_transfer, 2, rb_str_new2( n->type_id ), obj );
- }
-
- rb_hash_aset(bonus->data, INT2FIX(RHASH(bonus->data)->tbl->num_entries), obj);
- return obj;
-}
-
-/*
- * friendly errors.
- */
-void
-rb_syck_err_handler(p, msg)
- SyckParser *p;
- char *msg;
-{
- char *endl = p->cursor;
-
- while ( *endl != '\0' && *endl != '\n' )
- endl++;
-
- endl[0] = '\0';
- rb_raise(rb_eArgError, "%s on line %d, col %d: `%s'",
- msg,
- p->linect,
- p->cursor - p->lineptr,
- p->lineptr);
-}
-
-/*
- * provide bad anchor object to the parser.
- */
-SyckNode *
-rb_syck_bad_anchor_handler(p, a)
- SyckParser *p;
- char *a;
-{
- SyckNode *badanc = syck_new_map( rb_str_new2( "name" ), rb_str_new2( a ) );
- badanc->type_id = syck_strndup( "taguri:ruby.yaml.org,2002:object:YAML::Syck::BadAlias", 53 );
- return badanc;
-}
-
-/*
- * data loaded based on the model requested.
- */
-void
-syck_set_model( parser, model )
- SyckParser *parser;
- VALUE model;
-{
- if ( model == sym_generic )
- {
- syck_parser_handler( parser, rb_syck_parse_handler );
- syck_parser_implicit_typing( parser, 1 );
- syck_parser_taguri_expansion( parser, 1 );
- }
- else
- {
- syck_parser_handler( parser, rb_syck_load_handler );
- syck_parser_implicit_typing( parser, 1 );
- syck_parser_taguri_expansion( parser, 0 );
- }
- syck_parser_error_handler( parser, rb_syck_err_handler );
- syck_parser_bad_anchor_handler( parser, rb_syck_bad_anchor_handler );
-}
-
-/*
- * mark parser nodes
- */
-static void
-syck_mark_parser(parser)
- SyckParser *parser;
-{
- rb_gc_mark(parser->root);
- rb_gc_mark(parser->root_on_error);
-}
-
-/*
- * YAML::Syck::Parser.new
- */
-VALUE
-syck_parser_new(argc, argv, class)
- int argc;
- VALUE *argv;
- VALUE class;
-{
- VALUE pobj, options, init_argv[1];
- SyckParser *parser = syck_new_parser();
-
- rb_scan_args(argc, argv, "01", &options);
- pobj = Data_Wrap_Struct( class, syck_mark_parser, syck_free_parser, parser );
-
- syck_parser_set_root_on_error( parser, Qnil );
-
- if ( ! rb_obj_is_instance_of( options, rb_cHash ) )
- {
- options = rb_hash_new();
- }
- init_argv[0] = options;
- rb_obj_call_init(pobj, 1, init_argv);
- return pobj;
-}
-
-/*
- * YAML::Syck::Parser.initialize( options )
- */
-static VALUE
-syck_parser_initialize( self, options )
- VALUE self, options;
-{
- rb_iv_set(self, "@options", options);
- return self;
-}
-
-/*
- * YAML::Syck::Parser.load( IO or String )
- */
-VALUE
-syck_parser_load(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
-{
- VALUE port, proc, model;
- SyckParser *parser;
- struct parser_xtra bonus;
- volatile VALUE hash; /* protect from GC */
-
- rb_scan_args(argc, argv, "11", &port, &proc);
- Data_Get_Struct(self, SyckParser, parser);
- syck_parser_assign_io(parser, port);
-
- model = rb_hash_aref( rb_iv_get( self, "@options" ), sym_model );
- syck_set_model( parser, model );
-
- bonus.data = hash = rb_hash_new();
- if ( NIL_P( proc ) ) bonus.proc = 0;
- else bonus.proc = proc;
-
- parser->bonus = (void *)&bonus;
-
- return syck_parse( parser );
-}
-
-/*
- * YAML::Syck::Parser.load_documents( IO or String ) { |doc| }
- */
-VALUE
-syck_parser_load_documents(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
-{
- VALUE port, proc, v, model;
- SyckParser *parser;
- struct parser_xtra bonus;
- volatile VALUE hash;
-
- rb_scan_args(argc, argv, "1&", &port, &proc);
- Data_Get_Struct(self, SyckParser, parser);
- syck_parser_assign_io(parser, port);
-
- model = rb_hash_aref( rb_iv_get( self, "@options" ), sym_model );
- syck_set_model( parser, model );
-
- while ( 1 )
- {
- /* Reset hash for tracking nodes */
- bonus.data = hash = rb_hash_new();
- bonus.proc = 0;
- parser->bonus = (void *)&bonus;
-
- /* Parse a document */
- v = syck_parse( parser );
- if ( parser->eof == 1 )
- {
- break;
- }
-
- /* Pass document to block */
- rb_funcall( proc, s_call, 1, v );
- }
-
- return Qnil;
-}
-
-/*
- * YAML::Syck::Loader.initialize
- */
-static VALUE
-syck_loader_initialize( self )
- VALUE self;
-{
- VALUE families;
-
- rb_iv_set(self, "@families", rb_hash_new() );
- rb_iv_set(self, "@private_types", rb_hash_new() );
- families = rb_iv_get(self, "@families");
-
- rb_hash_aset(families, rb_str_new2( YAML_DOMAIN ), rb_hash_new());
- rb_hash_aset(families, rb_str_new2( RUBY_DOMAIN ), rb_hash_new());
-
- return self;
-}
-
-/*
- * Add type family, used by add_*_type methods.
- */
-VALUE
-syck_loader_add_type_family( self, domain, type_re, proc )
- VALUE self, domain, type_re, proc;
-{
- VALUE families, domain_types;
-
- families = rb_iv_get(self, "@families");
- domain_types = syck_get_hash_aref(families, domain);
- rb_hash_aset( domain_types, type_re, proc );
- return Qnil;
-}
-
-/*
- * YAML::Syck::Loader.add_domain_type
- */
-VALUE
-syck_loader_add_domain_type( argc, argv, self )
- int argc;
- VALUE *argv;
- VALUE self;
-{
- VALUE domain, type_re, proc;
-
- rb_scan_args(argc, argv, "2&", &domain, &type_re, &proc);
- syck_loader_add_type_family( self, domain, type_re, proc );
- return Qnil;
-}
-
-
-/*
- * YAML::Syck::Loader.add_builtin_type
- */
-VALUE
-syck_loader_add_builtin_type( argc, argv, self )
- int argc;
- VALUE *argv;
- VALUE self;
-{
- VALUE type_re, proc;
-
- rb_scan_args(argc, argv, "1&", &type_re, &proc);
- syck_loader_add_type_family( self, rb_str_new2( YAML_DOMAIN ), type_re, proc );
- return Qnil;
-}
-
-/*
- * YAML::Syck::Loader.add_ruby_type
- */
-VALUE
-syck_loader_add_ruby_type( argc, argv, self )
- int argc;
- VALUE *argv;
- VALUE self;
-{
- VALUE type_re, proc;
-
- rb_scan_args(argc, argv, "1&", &type_re, &proc);
- syck_loader_add_type_family( self, rb_str_new2( RUBY_DOMAIN ), type_re, proc );
- return Qnil;
-}
-
-/*
- * YAML::Syck::Loader.add_private_type
- */
-VALUE
-syck_loader_add_private_type( argc, argv, self )
- int argc;
- VALUE *argv;
- VALUE self;
-{
- VALUE type_re, proc, priv_types;
-
- rb_scan_args(argc, argv, "1&", &type_re, &proc);
-
- priv_types = rb_iv_get(self, "@private_types");
- rb_hash_aset( priv_types, type_re, proc );
- return Qnil;
-}
-
-/*
- * YAML::Syck::Loader#detect
- */
-VALUE
-syck_loader_detect_implicit( self, val )
- VALUE self, val;
-{
- char *type_id;
-
- if ( TYPE(val) == T_STRING )
- {
- type_id = syck_match_implicit( RSTRING(val)->ptr, RSTRING(val)->len );
- return rb_str_new2( type_id );
- }
-
- return rb_str_new2( "" );
-}
-
-/*
- * iterator to search a type hash for a match.
- */
-static VALUE
-transfer_find_i(entry, col)
- VALUE entry, col;
-{
- VALUE key = rb_ary_entry( entry, 0 );
- VALUE tid = rb_ary_entry( col, 0 );
- if ( rb_respond_to( key, s_match ) )
- {
- VALUE match = rb_funcall( key, rb_intern("match"), 1, tid );
- if ( ! NIL_P( match ) )
- {
- rb_ary_push( col, rb_ary_entry( entry, 1 ) );
- rb_iter_break();
- }
- }
- return Qnil;
-}
-
-/*
- * YAML::Syck::Loader#transfer
- */
-VALUE
-syck_loader_transfer( self, type, val )
- VALUE self, type, val;
-{
- char *taguri = NULL;
-
-#if 0
- rb_p(rb_str_new2( "-- TYPE --" ));
- rb_p(type);
-#endif
- if (NIL_P(type) || !RSTRING(type)->ptr || RSTRING(type)->len == 0)
- {
- /*
- * Empty transfer, detect type
- */
- if ( TYPE(val) == T_STRING )
- {
- taguri = syck_match_implicit( RSTRING(val)->ptr, RSTRING(val)->len );
- taguri = syck_taguri( YAML_DOMAIN, taguri, strlen( taguri ) );
- }
- }
- else
- {
- taguri = syck_type_id_to_uri( RSTRING(type)->ptr );
- }
-
- if ( taguri != NULL )
- {
- VALUE scheme, name, type_hash, domain = Qnil, type_proc = Qnil;
- VALUE type_uri = rb_str_new2( taguri );
- VALUE str_taguri = rb_str_new2("taguri");
- VALUE str_xprivate = rb_str_new2("x-private");
- VALUE parts = rb_str_split( type_uri, ":" );
-#if 0
- rb_p(parts);
-#endif
-
- scheme = rb_ary_shift( parts );
-
- if ( rb_str_cmp( scheme, str_xprivate ) == 0 )
- {
- name = rb_ary_join( parts, rb_str_new2( ":" ) );
- type_hash = rb_iv_get(self, "@private_types");
- }
- else if ( rb_str_cmp( scheme, str_taguri ) == 0 )
- {
- domain = rb_ary_shift( parts );
- name = rb_ary_join( parts, rb_str_new2( ":" ) );
- type_hash = rb_iv_get(self, "@families");
- type_hash = rb_hash_aref(type_hash, domain);
- }
- else
- {
- rb_raise(rb_eTypeError, "invalid typing scheme: %s given",
- scheme);
- }
-
- if ( rb_obj_is_instance_of( type_hash, rb_cHash ) )
- {
- type_proc = rb_hash_aref( type_hash, name );
- if ( NIL_P( type_proc ) )
- {
- VALUE col = rb_ary_new();
- rb_ary_push( col, name );
- rb_iterate(rb_each, type_hash, transfer_find_i, col );
- name = rb_ary_shift( col );
- type_proc = rb_ary_shift( col );
- }
-#if 0
- rb_p(name);
- rb_p(type_proc);
-#endif
- }
-
- if ( rb_respond_to( type_proc, s_call ) )
- {
- val = rb_funcall(type_proc, s_call, 2, type_uri, val);
- }
- else if ( rb_str_cmp( scheme, str_xprivate ) == 0 )
- {
- val = rb_funcall(cPrivateType, s_new, 2, name, val);
- }
- else
- {
- val = rb_funcall(cDomainType, s_new, 3, domain, name, val);
- }
- }
-
- return val;
-}
-
-/*
- * YAML::Syck::BadAlias.initialize
- */
-VALUE
-syck_badalias_initialize( self, val )
- VALUE self, val;
-{
- rb_iv_set( self, "@name", val );
- return self;
-}
-
-/*
- * YAML::Syck::DomainType.initialize
- */
-VALUE
-syck_domaintype_initialize( self, domain, type_id, val )
- VALUE self, type_id, val;
-{
- rb_iv_set( self, "@domain", domain );
- rb_iv_set( self, "@type_id", type_id );
- rb_iv_set( self, "@value", val );
- return self;
-}
-
-/*
- * YAML::Syck::PrivateType.initialize
- */
-VALUE
-syck_privatetype_initialize( self, type_id, val )
- VALUE self, type_id, val;
-{
- rb_iv_set( self, "@type_id", type_id );
- rb_iv_set( self, "@value", val );
- return self;
-}
-
-/*
- * YAML::Syck::Node.initialize
- */
-VALUE
-syck_node_initialize( self, type_id, val )
- VALUE self, type_id, val;
-{
- rb_iv_set( self, "@type_id", type_id );
- rb_iv_set( self, "@value", val );
- return self;
-}
-
-VALUE
-syck_node_thash( entry, t )
- VALUE entry, t;
-{
- VALUE key, val;
- key = rb_ary_entry( entry, 0 );
- val = syck_node_transform( rb_ary_entry( rb_ary_entry( entry, 1 ), 1 ) );
- rb_hash_aset( t, key, val );
- return Qnil;
-}
-
-VALUE
-syck_node_ahash( entry, t )
- VALUE entry, t;
-{
- VALUE val = syck_node_transform( entry );
- rb_ary_push( t, val );
- return Qnil;
-}
-
-/*
- * YAML::Syck::Node.transform
- */
-VALUE
-syck_node_transform( self )
- VALUE self;
-{
- VALUE t = Qnil;
- VALUE type_id = rb_iv_get( self, "@type_id" );
- VALUE val = rb_iv_get( self, "@value" );
- if ( rb_obj_is_instance_of( val, rb_cHash ) )
- {
- t = rb_hash_new();
- rb_iterate( rb_each, val, syck_node_thash, t );
- }
- else if ( rb_obj_is_instance_of( val, rb_cArray ) )
- {
- t = rb_ary_new();
- rb_iterate( rb_each, val, syck_node_ahash, t );
- }
- else
- {
- t = val;
- }
- return rb_funcall( oDefaultLoader, s_transfer, 2, type_id, t );
-}
-
-/*
- * Handle output from the emitter
- */
-void
-rb_syck_output_handler( emitter, str, len )
- SyckEmitter *emitter;
- char *str;
- long len;
-{
- VALUE dest = (VALUE)emitter->bonus;
- if ( rb_respond_to( dest, rb_intern("to_str") ) ) {
- rb_str_cat( dest, str, len );
- } else {
- rb_io_write( dest, rb_str_new( str, len ) );
- }
-}
-
-/*
- * Mark emitter values.
- */
-static void
-syck_mark_emitter(emitter)
- SyckEmitter *emitter;
-{
- rb_gc_mark(emitter->ignore_id);
- if ( emitter->bonus != NULL )
- {
- rb_gc_mark( (VALUE)emitter->bonus );
- }
-}
-
-/*
- * YAML::Syck::Emitter.new
- */
-VALUE
-syck_emitter_new(argc, argv, class)
- int argc;
- VALUE *argv;
- VALUE class;
-{
- VALUE pobj, options, init_argv[1];
- SyckEmitter *emitter = syck_new_emitter();
- syck_emitter_ignore_id( emitter, Qnil );
- syck_emitter_handler( emitter, rb_syck_output_handler );
-
- emitter->bonus = (void *)rb_str_new2( "" );
-
- rb_scan_args(argc, argv, "01", &options);
- pobj = Data_Wrap_Struct( class, syck_mark_emitter, syck_free_emitter, emitter );
-
- if ( ! rb_obj_is_instance_of( options, rb_cHash ) )
- {
- options = rb_hash_new();
- }
- init_argv[0] = options;
- rb_obj_call_init(pobj, 1, init_argv);
- return pobj;
-}
-
-/*
- * YAML::Syck::Emitter.initialize( options )
- */
-static VALUE
-syck_emitter_initialize( self, options )
- VALUE self, options;
-{
- rb_iv_set(self, "@options", options);
- return self;
-}
-
-/*
- * YAML::Syck::Emitter.level
- */
-VALUE
-syck_emitter_level_m( self )
- VALUE self;
-{
- SyckEmitter *emitter;
-
- Data_Get_Struct(self, SyckEmitter, emitter);
- return LONG2NUM( emitter->level );
-}
-
-/*
- * YAML::Syck::Emitter.flush
- */
-VALUE
-syck_emitter_flush_m( self )
- VALUE self;
-{
- SyckEmitter *emitter;
-
- Data_Get_Struct(self, SyckEmitter, emitter);
- syck_emitter_flush( emitter, 0 );
- return self;
-}
-
-/*
- * YAML::Syck::Emitter.write( str )
- */
-VALUE
-syck_emitter_write_m( self, str )
- VALUE str;
-{
- SyckEmitter *emitter;
-
- Data_Get_Struct(self, SyckEmitter, emitter);
- syck_emitter_write( emitter, RSTRING(str)->ptr, RSTRING(str)->len );
- return self;
-}
-
-/*
- * YAML::Syck::Emitter.simple( str )
- */
-VALUE
-syck_emitter_simple_write( self, str )
- VALUE str;
-{
- SyckEmitter *emitter;
-
- Data_Get_Struct(self, SyckEmitter, emitter);
- syck_emitter_simple( emitter, RSTRING(str)->ptr, RSTRING(str)->len );
- return self;
-}
-
-/*
- * YAML::Syck::Emitter.start_object( object_id )
- */
-VALUE
-syck_emitter_start_object( self, oid )
- VALUE self, oid;
-{
- char *anchor_name;
- SyckEmitter *emitter;
-
- Data_Get_Struct(self, SyckEmitter, emitter);
- anchor_name = syck_emitter_start_obj( emitter, oid );
-
- if ( anchor_name == NULL )
- {
- return Qnil;
- }
-
- return rb_str_new2( anchor_name );
-}
-
-/*
- * YAML::Syck::Emitter.end_object( object_id )
- */
-VALUE
-syck_emitter_end_object( self, oid )
- VALUE self, oid;
-{
- SyckEmitter *emitter;
-
- Data_Get_Struct(self, SyckEmitter, emitter);
- syck_emitter_end_obj( emitter );
-
- if ( emitter->level < 0 )
- {
- syck_emitter_flush( emitter, 0 );
- }
- return (VALUE)emitter->bonus;
-}
-
-/*
- * Initialize Syck extension
- */
-void
-Init_syck()
-{
- VALUE rb_yaml = rb_define_module( "YAML" );
- VALUE rb_syck = rb_define_module_under( rb_yaml, "Syck" );
- rb_define_const( rb_syck, "VERSION", rb_str_new2( SYCK_VERSION ) );
-
- /*
- * Global symbols
- */
- s_new = rb_intern("new");
- s_utc = rb_intern("utc");
- s_at = rb_intern("at");
- s_to_f = rb_intern("to_f");
- s_read = rb_intern("read");
- s_binmode = rb_intern("binmode");
- s_transfer = rb_intern("transfer");
- s_call = rb_intern("call");
- s_update = rb_intern("update");
- s_dup = rb_intern("dup");
- s_match = rb_intern("match");
-
- sym_model = ID2SYM(rb_intern("Model"));
- sym_generic = ID2SYM(rb_intern("Generic"));
- sym_map = ID2SYM(rb_intern("map"));
- sym_scalar = ID2SYM(rb_intern("scalar"));
- sym_seq = ID2SYM(rb_intern("seq"));
-
- /*
- * Load Date module
- */
- rb_require( "date" );
- cDate = rb_funcall( rb_cObject, rb_intern("const_get"), 1, rb_str_new2("Date") );
-
- /*
- * Define YAML::Syck::Loader class
- */
- cLoader = rb_define_class_under( rb_syck, "Loader", rb_cObject );
- rb_define_attr( cLoader, "families", 1, 1 );
- rb_define_attr( cLoader, "private_types", 1, 1 );
- rb_define_method( cLoader, "initialize", syck_loader_initialize, 0 );
- rb_define_method( cLoader, "add_domain_type", syck_loader_add_domain_type, -1 );
- rb_define_method( cLoader, "add_builtin_type", syck_loader_add_builtin_type, -1 );
- rb_define_method( cLoader, "add_ruby_type", syck_loader_add_ruby_type, -1 );
- rb_define_method( cLoader, "add_private_type", syck_loader_add_private_type, -1 );
- rb_define_method( cLoader, "detect_implicit", syck_loader_detect_implicit, 1 );
- rb_define_method( cLoader, "transfer", syck_loader_transfer, 2 );
-
- oDefaultLoader = rb_funcall( cLoader, rb_intern( "new" ), 0 );
- rb_define_const( rb_syck, "DefaultLoader", oDefaultLoader );
-
- /*
- * Define YAML::Syck::Parser class
- */
- cParser = rb_define_class_under( rb_syck, "Parser", rb_cObject );
- rb_define_attr( cParser, "options", 1, 1 );
- rb_define_singleton_method( cParser, "new", syck_parser_new, -1 );
- rb_define_method(cParser, "initialize", syck_parser_initialize, 1);
- rb_define_method(cParser, "load", syck_parser_load, -1);
- rb_define_method(cParser, "load_documents", syck_parser_load_documents, -1);
-
- /*
- * Define YAML::Syck::Node class
- */
- cNode = rb_define_class_under( rb_syck, "Node", rb_cObject );
- rb_define_attr( cNode, "kind", 1, 1 );
- rb_define_attr( cNode, "type_id", 1, 1 );
- rb_define_attr( cNode, "value", 1, 1 );
- rb_define_attr( cNode, "anchor", 1, 1 );
- rb_define_method( cNode, "initialize", syck_node_initialize, 2);
- rb_define_method( cNode, "transform", syck_node_transform, 0);
-
- /*
- * Define YAML::Syck::PrivateType class
- */
- cPrivateType = rb_define_class_under( rb_syck, "PrivateType", rb_cObject );
- rb_define_attr( cPrivateType, "type_id", 1, 1 );
- rb_define_attr( cPrivateType, "value", 1, 1 );
- rb_define_method( cPrivateType, "initialize", syck_privatetype_initialize, 2);
-
- /*
- * Define YAML::Syck::DomainType class
- */
- cDomainType = rb_define_class_under( rb_syck, "DomainType", rb_cObject );
- rb_define_attr( cDomainType, "domain", 1, 1 );
- rb_define_attr( cDomainType, "type_id", 1, 1 );
- rb_define_attr( cDomainType, "value", 1, 1 );
- rb_define_method( cDomainType, "initialize", syck_domaintype_initialize, 3);
-
- /*
- * Define YAML::Syck::BadAlias class
- */
- cBadAlias = rb_define_class_under( rb_syck, "BadAlias", rb_cObject );
- rb_define_attr( cBadAlias, "name", 1, 1 );
- rb_define_method( cBadAlias, "initialize", syck_badalias_initialize, 1);
-
- /*
- * Define YAML::Syck::MergeKey class
- */
- cMergeKey = rb_define_class_under( rb_syck, "MergeKey", rb_cObject );
-
- /*
- * Define YAML::Syck::Emitter class
- */
- cEmitter = rb_define_class_under( rb_syck, "Emitter", rb_cObject );
- rb_define_singleton_method( cEmitter, "new", syck_emitter_new, -1 );
- rb_define_method( cEmitter, "initialize", syck_emitter_initialize, 1 );
- rb_define_method( cEmitter, "level", syck_emitter_level_m, 0 );
- rb_define_method( cEmitter, "write", syck_emitter_write_m, 1 );
- rb_define_method( cEmitter, "<<", syck_emitter_write_m, 1 );
- rb_define_method( cEmitter, "simple", syck_emitter_simple_write, 1 );
- rb_define_method( cEmitter, "flush", syck_emitter_flush_m, 0 );
- rb_define_method( cEmitter, "start_object", syck_emitter_start_object, 1 );
- rb_define_method( cEmitter, "end_object", syck_emitter_end_object, 0 );
-}
-
diff --git a/ext/syck/syck.c b/ext/syck/syck.c
deleted file mode 100644
index 42b70573bc..0000000000
--- a/ext/syck/syck.c
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
- * syck.c
- *
- * $Author$
- * $Date$
- *
- * Copyright (C) 2003 why the lucky stiff
- */
-#include <stdio.h>
-#include <string.h>
-
-#include "syck.h"
-#include "ruby.h"
-
-void syck_parser_pop_level( SyckParser * );
-
-/*
- * Custom assert
- */
-void
-syck_assert( char *file_name, unsigned line_num )
-{
- fflush( NULL );
- fprintf( stderr, "\nAssertion failed: %s, line %u\n",
- file_name, line_num );
- fflush( stderr );
- abort();
-}
-
-/*
- * Allocates and copies a string
- */
-char *
-syck_strndup( char *buf, long len )
-{
- char *new = S_ALLOC_N( char, len + 1 );
- S_MEMZERO( new, char, len + 1 );
- S_MEMCPY( new, buf, char, len );
- return new;
-}
-
-/*
- * Default FILE IO function
- */
-long
-syck_io_file_read( char *buf, SyckIoFile *file, long max_size, long skip )
-{
- long len = 0;
-
- ASSERT( file != NULL );
-
- max_size -= skip;
- len = fread( buf + skip, max_size, sizeof( char ), file->ptr );
- len += skip;
- buf[len] = '\0';
-
- return len;
-}
-
-/*
- * Default string IO function
- */
-long
-syck_io_str_read( char *buf, SyckIoStr *str, long max_size, long skip )
-{
- char *beg;
- long len = 0;
-
- ASSERT( str != NULL );
- beg = str->ptr;
- if ( max_size >= 0 )
- {
- max_size -= skip;
- if ( max_size < 0 ) max_size = 0;
-
- str->ptr += max_size;
- if ( str->ptr > str->end )
- {
- str->ptr = str->end;
- }
- }
- else
- {
- /* Use exact string length */
- while ( str->ptr < str->end ) {
- if (*(str->ptr++) == '\n') break;
- }
- }
- if ( beg < str->ptr )
- {
- len = str->ptr - beg;
- S_MEMCPY( buf + skip, beg, char, len );
- }
- len += skip;
- buf[len] = '\0';
-
- return len;
-}
-
-void
-syck_parser_reset_levels( SyckParser *p )
-{
- while ( p->lvl_idx > 1 )
- {
- syck_parser_pop_level( p );
- }
-
- if ( p->lvl_idx < 1 )
- {
- p->lvl_idx = 1;
- p->levels[0].spaces = -1;
- p->levels[0].domain = syck_strndup( "", 0 );
- }
- p->levels[0].status = syck_lvl_header;
-}
-
-void
-syck_parser_reset_cursor( SyckParser *p )
-{
- if ( p->buffer == NULL )
- {
- p->buffer = S_ALLOC_N( char, p->bufsize );
- S_MEMZERO( p->buffer, char, p->bufsize );
- }
- p->buffer[0] = '\0';
-
- p->cursor = NULL;
- p->lineptr = NULL;
- p->linectptr = NULL;
- p->token = NULL;
- p->toktmp = NULL;
- p->marker = NULL;
- p->limit = NULL;
-
- p->root = 0;
- p->root_on_error = 0;
- p->linect = 0;
- p->eof = 0;
- p->last_token = 0;
- p->force_token = 0;
-}
-
-/*
- * Value to return on a parse error
- */
-void
-syck_parser_set_root_on_error( SyckParser *p, SYMID roer )
-{
- p->root_on_error = roer;
-}
-
-/*
- * Allocate the parser
- */
-SyckParser *
-syck_new_parser()
-{
- SyckParser *p;
- p = S_ALLOC( SyckParser );
- p->lvl_capa = ALLOC_CT;
- p->levels = S_ALLOC_N( SyckLevel, p->lvl_capa );
- p->io_type = syck_io_str;
- p->io.str = NULL;
- p->syms = NULL;
- p->anchors = NULL;
- p->bad_anchors = NULL;
- p->implicit_typing = 1;
- p->taguri_expansion = 0;
- p->bufsize = SYCK_BUFFERSIZE;
- p->buffer = NULL;
- p->lvl_idx = 0;
- syck_parser_reset_levels( p );
- return p;
-}
-
-int
-syck_add_sym( SyckParser *p, char *data )
-{
- SYMID id = 0;
- if ( p->syms == NULL )
- {
- p->syms = st_init_numtable();
- }
- id = p->syms->num_entries;
- st_insert( p->syms, id, (st_data_t)data );
- return id;
-}
-
-int
-syck_lookup_sym( SyckParser *p, SYMID id, char **data )
-{
- if ( p->syms == NULL ) return 0;
- return st_lookup( p->syms, id, (st_data_t *)data );
-}
-
-int
-syck_st_free_nodes( char *key, SyckNode *n, char *arg )
-{
- syck_free_node( n );
- return ST_CONTINUE;
-}
-
-void
-syck_st_free( SyckParser *p )
-{
- /*
- * Free the adhoc symbol table
- */
- if ( p->syms != NULL )
- {
- st_free_table( p->syms );
- p->syms = NULL;
- }
-
- /*
- * Free the anchor tables
- */
- if ( p->anchors != NULL )
- {
- st_foreach( p->anchors, syck_st_free_nodes, 0 );
- st_free_table( p->anchors );
- p->anchors = NULL;
- }
-
- if ( p->bad_anchors != NULL )
- {
- st_foreach( p->bad_anchors, syck_st_free_nodes, 0 );
- st_free_table( p->bad_anchors );
- p->bad_anchors = NULL;
- }
-}
-
-void
-syck_free_parser( SyckParser *p )
-{
- /*
- * Free tables, levels
- */
- syck_st_free( p );
- syck_parser_reset_levels( p );
- S_FREE( p->levels[0].domain );
- S_FREE( p->levels );
-
- if ( p->buffer != NULL )
- {
- S_FREE( p->buffer );
- }
- free_any_io( p );
- S_FREE( p );
-}
-
-void
-syck_parser_handler( SyckParser *p, SyckNodeHandler hdlr )
-{
- ASSERT( p != NULL );
- p->handler = hdlr;
-}
-
-void
-syck_parser_implicit_typing( SyckParser *p, int flag )
-{
- p->implicit_typing = ( flag == 0 ? 0 : 1 );
-}
-
-void
-syck_parser_taguri_expansion( SyckParser *p, int flag )
-{
- p->taguri_expansion = ( flag == 0 ? 0 : 1 );
-}
-
-void
-syck_parser_error_handler( SyckParser *p, SyckErrorHandler hdlr )
-{
- ASSERT( p != NULL );
- p->error_handler = hdlr;
-}
-
-void
-syck_parser_bad_anchor_handler( SyckParser *p, SyckBadAnchorHandler hdlr )
-{
- ASSERT( p != NULL );
- p->bad_anchor_handler = hdlr;
-}
-
-void
-syck_parser_file( SyckParser *p, FILE *fp, SyckIoFileRead read )
-{
- ASSERT( p != NULL );
- free_any_io( p );
- syck_parser_reset_cursor( p );
- p->io_type = syck_io_file;
- p->io.file = S_ALLOC( SyckIoFile );
- p->io.file->ptr = fp;
- if ( read != NULL )
- {
- p->io.file->read = read;
- }
- else
- {
- p->io.file->read = syck_io_file_read;
- }
-}
-
-void
-syck_parser_str( SyckParser *p, char *ptr, long len, SyckIoStrRead read )
-{
- ASSERT( p != NULL );
- free_any_io( p );
- syck_parser_reset_cursor( p );
- p->io_type = syck_io_str;
- p->io.str = S_ALLOC( SyckIoStr );
- p->io.str->beg = ptr;
- p->io.str->ptr = ptr;
- p->io.str->end = ptr + len;
- if ( read != NULL )
- {
- p->io.str->read = read;
- }
- else
- {
- p->io.str->read = syck_io_str_read;
- }
-}
-
-void
-syck_parser_str_auto( SyckParser *p, char *ptr, SyckIoStrRead read )
-{
- syck_parser_str( p, ptr, strlen( ptr ), read );
-}
-
-SyckLevel *
-syck_parser_current_level( SyckParser *p )
-{
- return &p->levels[p->lvl_idx-1];
-}
-
-void
-syck_parser_pop_level( SyckParser *p )
-{
- ASSERT( p != NULL );
-
- /* The root level should never be popped */
- if ( p->lvl_idx <= 1 ) return;
-
- p->lvl_idx -= 1;
- free( p->levels[p->lvl_idx].domain );
-}
-
-void
-syck_parser_add_level( SyckParser *p, int len, enum syck_level_status status )
-{
- ASSERT( p != NULL );
- if ( p->lvl_idx + 1 > p->lvl_capa )
- {
- p->lvl_capa += ALLOC_CT;
- S_REALLOC_N( p->levels, SyckLevel, p->lvl_capa );
- }
-
- ASSERT( len > p->levels[p->lvl_idx-1].spaces );
- p->levels[p->lvl_idx].spaces = len;
- p->levels[p->lvl_idx].domain = syck_strndup( p->levels[p->lvl_idx-1].domain, strlen( p->levels[p->lvl_idx-1].domain ) );
- p->levels[p->lvl_idx].status = status;
- p->lvl_idx += 1;
-}
-
-void
-free_any_io( SyckParser *p )
-{
- ASSERT( p != NULL );
- switch ( p->io_type )
- {
- case syck_io_str:
- if ( p->io.str != NULL )
- {
- S_FREE( p->io.str );
- p->io.str = NULL;
- }
- break;
-
- case syck_io_file:
- if ( p->io.file != NULL )
- {
- S_FREE( p->io.file );
- p->io.file = NULL;
- }
- break;
- }
-}
-
-long
-syck_move_tokens( SyckParser *p )
-{
- long count, skip;
- ASSERT( p->buffer != NULL );
-
- if ( p->token == NULL )
- return 0;
-
- skip = p->limit - p->token;
- if ( skip < 1 )
- return 0;
-
- if ( ( count = p->token - p->buffer ) )
- {
- S_MEMMOVE( p->buffer, p->token, char, skip );
- p->token = p->buffer;
- p->marker -= count;
- p->cursor -= count;
- p->toktmp -= count;
- p->limit -= count;
- p->lineptr -= count;
- p->linectptr -= count;
- }
- return skip;
-}
-
-void
-syck_check_limit( SyckParser *p, long len )
-{
- if ( p->cursor == NULL )
- {
- p->cursor = p->buffer;
- p->lineptr = p->buffer;
- p->linectptr = p->buffer;
- p->marker = p->buffer;
- }
- p->limit = p->buffer + len;
-}
-
-long
-syck_parser_read( SyckParser *p )
-{
- long len = 0;
- long skip = 0;
- ASSERT( p != NULL );
- switch ( p->io_type )
- {
- case syck_io_str:
- skip = syck_move_tokens( p );
- len = (p->io.str->read)( p->buffer, p->io.str, SYCK_BUFFERSIZE - 1, skip );
- break;
-
- case syck_io_file:
- skip = syck_move_tokens( p );
- len = (p->io.file->read)( p->buffer, p->io.file, SYCK_BUFFERSIZE - 1, skip );
- break;
- }
- syck_check_limit( p, len );
- return len;
-}
-
-long
-syck_parser_readlen( SyckParser *p, long max_size )
-{
- long len = 0;
- long skip = 0;
- ASSERT( p != NULL );
- switch ( p->io_type )
- {
- case syck_io_str:
- skip = syck_move_tokens( p );
- len = (p->io.str->read)( p->buffer, p->io.str, max_size, skip );
- break;
-
- case syck_io_file:
- skip = syck_move_tokens( p );
- len = (p->io.file->read)( p->buffer, p->io.file, max_size, skip );
- break;
- }
- syck_check_limit( p, len );
- return len;
-}
-
-SYMID
-syck_parse( SyckParser *p )
-{
- ASSERT( p != NULL );
-
- syck_st_free( p );
- syck_parser_reset_levels( p );
- syckparse( p );
- return p->root;
-}
-
-void
-syck_default_error_handler( SyckParser *p, char *msg )
-{
- printf( "Error at [Line %d, Col %d]: %s\n",
- p->linect,
- p->cursor - p->lineptr,
- msg );
-}
-
diff --git a/ext/syck/syck.h b/ext/syck/syck.h
deleted file mode 100644
index 124e6c5d4e..0000000000
--- a/ext/syck/syck.h
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * syck.h
- *
- * $Author$
- * $Date$
- *
- * Copyright (C) 2003 why the lucky stiff
- */
-
-#ifndef SYCK_H
-#define SYCK_H
-
-#define SYCK_YAML_MAJOR 1
-#define SYCK_YAML_MINOR 0
-
-#define SYCK_VERSION "0.38"
-#define YAML_DOMAIN "yaml.org,2002"
-
-#include <stdio.h>
-#include <ctype.h>
-#include "st.h"
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-/*
- * Memory Allocation
- */
-#if defined(HAVE_ALLOCA_H) && !defined(__GNUC__)
-#include <alloca.h>
-#endif
-
-#if DEBUG
- void syck_assert( char *, unsigned );
-# define ASSERT(f) \
- if ( f ) \
- {} \
- else \
- syck_assert( __FILE__, __LINE__ )
-#else
-# define ASSERT(f)
-#endif
-
-#ifndef NULL
-# define NULL (void *)0
-#endif
-
-#define ALLOC_CT 8
-#define SYCK_BUFFERSIZE 262144
-#define S_ALLOC_N(type,n) (type*)malloc(sizeof(type)*(n))
-#define S_ALLOC(type) (type*)malloc(sizeof(type))
-#define S_REALLOC_N(var,type,n) (var)=(type*)realloc((char*)(var),sizeof(type)*(n))
-#define S_FREE(n) free(n); n = NULL;
-
-#define S_ALLOCA_N(type,n) (type*)alloca(sizeof(type)*(n))
-
-#define S_MEMZERO(p,type,n) memset((p), 0, sizeof(type)*(n))
-#define S_MEMCPY(p1,p2,type,n) memcpy((p1), (p2), sizeof(type)*(n))
-#define S_MEMMOVE(p1,p2,type,n) memmove((p1), (p2), sizeof(type)*(n))
-#define S_MEMCMP(p1,p2,type,n) memcmp((p1), (p2), sizeof(type)*(n))
-
-#define BLOCK_FOLD 10
-#define BLOCK_LIT 20
-#define BLOCK_PLAIN 30
-#define NL_CHOMP 130
-#define NL_KEEP 140
-
-/*
- * Node definitions
- */
-#define SYMID unsigned long
-
-typedef struct _syck_node SyckNode;
-
-enum syck_kind_tag {
- syck_map_kind,
- syck_seq_kind,
- syck_str_kind
-};
-
-enum map_part {
- map_key,
- map_value
-};
-
-/*
- * Node metadata struct
- */
-struct _syck_node {
- /* Symbol table ID */
- SYMID id;
- /* Underlying kind */
- enum syck_kind_tag kind;
- /* Fully qualified tag-uri for type */
- char *type_id;
- /* Anchor name */
- char *anchor;
- union {
- /* Storage for map data */
- struct SyckMap {
- SYMID *keys;
- SYMID *values;
- long capa;
- long idx;
- } *pairs;
- /* Storage for sequence data */
- struct SyckSeq {
- SYMID *items;
- long capa;
- long idx;
- } *list;
- /* Storage for string data */
- struct SyckStr {
- char *ptr;
- long len;
- } *str;
- } data;
- /* Shortcut node */
- void *shortcut;
-};
-
-/*
- * Parser definitions
- */
-typedef struct _syck_parser SyckParser;
-typedef struct _syck_file SyckIoFile;
-typedef struct _syck_str SyckIoStr;
-typedef struct _syck_level SyckLevel;
-
-typedef SYMID (*SyckNodeHandler)(SyckParser *, SyckNode *);
-typedef void (*SyckErrorHandler)(SyckParser *, char *);
-typedef SyckNode * (*SyckBadAnchorHandler)(SyckParser *, char *);
-typedef long (*SyckIoFileRead)(char *, SyckIoFile *, long, long);
-typedef long (*SyckIoStrRead)(char *, SyckIoStr *, long, long);
-
-enum syck_io_type {
- syck_io_str,
- syck_io_file
-};
-
-enum syck_level_status {
- syck_lvl_header,
- syck_lvl_doc,
- syck_lvl_seq,
- syck_lvl_map,
- syck_lvl_block,
- syck_lvl_str,
- syck_lvl_inline,
- syck_lvl_end,
- syck_lvl_pause
-};
-
-/*
- * Parser struct
- */
-struct _syck_parser {
- /* Root node */
- SYMID root, root_on_error;
- /* Implicit typing flag */
- int implicit_typing, taguri_expansion;
- /* Scripting language function to handle nodes */
- SyckNodeHandler handler;
- /* Error handler */
- SyckErrorHandler error_handler;
- /* InvalidAnchor handler */
- SyckBadAnchorHandler bad_anchor_handler;
- /* IO type */
- enum syck_io_type io_type;
- /* Custom buffer size */
- size_t bufsize;
- /* Buffer pointers */
- char *buffer, *linectptr, *lineptr, *toktmp, *token, *cursor, *marker, *limit;
- /* Line counter */
- int linect;
- /* Last token from yylex() */
- int last_token;
- /* Force a token upon next call to yylex() */
- int force_token;
- /* EOF flag */
- int eof;
- union {
- struct _syck_file {
- FILE *ptr;
- SyckIoFileRead read;
- } *file;
- struct _syck_str {
- char *beg, *ptr, *end;
- SyckIoStrRead read;
- } *str;
- } io;
- /* Symbol table for anchors */
- st_table *anchors, *bad_anchors;
- /* Optional symbol table for SYMIDs */
- st_table *syms;
- /* Levels of indentation */
- struct _syck_level {
- int spaces;
- char *domain;
- enum syck_level_status status;
- } *levels;
- int lvl_idx;
- int lvl_capa;
- void *bonus;
-};
-
-/*
- * Emitter definitions
- */
-typedef struct _syck_emitter SyckEmitter;
-typedef struct _syck_emitter_node SyckEmitterNode;
-
-typedef void (*SyckOutputHandler)(SyckEmitter *, char *, long);
-
-enum doc_stage {
- doc_open,
- doc_need_header,
- doc_processing
-};
-
-enum block_styles {
- block_arbitrary,
- block_fold,
- block_literal
-};
-
-/*
- * Emitter struct
- */
-struct _syck_emitter {
- /* Headerless doc flag */
- int headless;
- /* Sequence map shortcut flag */
- int seq_map;
- /* Force header? */
- int use_header;
- /* Force version? */
- int use_version;
- /* Sort hash keys */
- int sort_keys;
- /* Anchor format */
- char *anchor_format;
- /* Explicit typing on all collections? */
- int explicit_typing;
- /* Best width on folded scalars */
- int best_width;
- /* Use literal[1] or folded[2] blocks on all text? */
- enum block_styles block_style;
- /* Stage of written document */
- enum doc_stage stage;
- /* Level counter */
- int level;
- /* Default indentation */
- int indent;
- /* Object ignore ID */
- SYMID ignore_id;
- /* Symbol table for anchors */
- st_table *markers, *anchors;
- /* Custom buffer size */
- size_t bufsize;
- /* Buffer */
- char *buffer, *marker;
- /* Absolute position of the buffer */
- long bufpos;
- /* Handler for output */
- SyckOutputHandler handler;
- /* Pointer for extension's use */
- void *bonus;
-};
-
-/*
- * Emitter node metadata struct
- */
-struct _syck_emitter_node {
- /* Node buffer position */
- long pos;
- /* Current indent */
- long indent;
- /* Collection? */
- int is_shortcut;
-};
-
-/*
- * Handler prototypes
- */
-SYMID syck_hdlr_add_node( SyckParser *, SyckNode * );
-SyckNode *syck_hdlr_add_anchor( SyckParser *, char *, SyckNode * );
-void syck_hdlr_remove_anchor( SyckParser *, char * );
-SyckNode *syck_hdlr_get_anchor( SyckParser *, char * );
-void syck_add_transfer( char *, SyckNode *, int );
-char *syck_xprivate( char *, int );
-char *syck_taguri( char *, char *, int );
-int syck_add_sym( SyckParser *, char * );
-int syck_lookup_sym( SyckParser *, SYMID, char ** );
-int syck_try_implicit( SyckNode * );
-char *syck_type_id_to_uri( char * );
-void try_tag_implicit( SyckNode *, int );
-char *syck_match_implicit( char *, size_t );
-
-/*
- * API prototypes
- */
-char *syck_strndup( char *, long );
-long syck_io_file_read( char *, SyckIoFile *, long, long );
-long syck_io_str_read( char *, SyckIoStr *, long, long );
-char *syck_base64enc( char *, long );
-char *syck_base64dec( char *, long );
-SyckEmitter *syck_new_emitter();
-void syck_emitter_ignore_id( SyckEmitter *, SYMID );
-void syck_emitter_handler( SyckEmitter *, SyckOutputHandler );
-void syck_free_emitter( SyckEmitter * );
-void syck_emitter_clear( SyckEmitter * );
-void syck_emitter_simple( SyckEmitter *, char *, long );
-void syck_emitter_write( SyckEmitter *, char *, long );
-void syck_emitter_flush( SyckEmitter *, long );
-char *syck_emitter_start_obj( SyckEmitter *, SYMID );
-void syck_emitter_end_obj( SyckEmitter * );
-SyckParser *syck_new_parser();
-void syck_free_parser( SyckParser * );
-void syck_parser_set_root_on_error( SyckParser *, SYMID );
-void syck_parser_implicit_typing( SyckParser *, int );
-void syck_parser_taguri_expansion( SyckParser *, int );
-void syck_parser_handler( SyckParser *, SyckNodeHandler );
-void syck_parser_error_handler( SyckParser *, SyckErrorHandler );
-void syck_parser_bad_anchor_handler( SyckParser *, SyckBadAnchorHandler );
-void syck_parser_file( SyckParser *, FILE *, SyckIoFileRead );
-void syck_parser_str( SyckParser *, char *, long, SyckIoStrRead );
-void syck_parser_str_auto( SyckParser *, char *, SyckIoStrRead );
-SyckLevel *syck_parser_current_level( SyckParser * );
-void syck_parser_add_level( SyckParser *, int, enum syck_level_status );
-void syck_parser_pop_level( SyckParser * );
-void free_any_io( SyckParser * );
-long syck_parser_read( SyckParser * );
-long syck_parser_readlen( SyckParser *, long );
-void syck_parser_init( SyckParser *, int );
-SYMID syck_parse( SyckParser * );
-void syck_default_error_handler( SyckParser *, char * );
-
-/*
- * Allocation prototypes
- */
-SyckNode *syck_alloc_map();
-SyckNode *syck_alloc_seq();
-SyckNode *syck_alloc_str();
-void syck_free_node( SyckNode * );
-void syck_free_members( SyckNode * );
-SyckNode *syck_new_str( char * );
-SyckNode *syck_new_str2( char *, long );
-void syck_str_blow_away_commas( SyckNode * );
-char *syck_str_read( SyckNode * );
-SyckNode *syck_new_map( SYMID, SYMID );
-void syck_map_add( SyckNode *, SYMID, SYMID );
-SYMID syck_map_read( SyckNode *, enum map_part, long );
-void syck_map_assign( SyckNode *, enum map_part, long, SYMID );
-long syck_map_count( SyckNode * );
-void syck_map_update( SyckNode *, SyckNode * );
-SyckNode *syck_new_seq( SYMID );
-void syck_seq_add( SyckNode *, SYMID );
-SYMID syck_seq_read( SyckNode *, long );
-long syck_seq_count( SyckNode * );
-
-void apply_seq_in_map( SyckParser *, SyckNode * );
-
-/*
- * Lexer prototypes
- */
-int syckparse( void * );
-void syckerror( char *msg );
-
-#ifndef ST_DATA_T_DEFINED
-typedef long st_data_t;
-#endif
-
-#if defined(__cplusplus)
-} /* extern "C" { */
-#endif
-
-#endif /* ifndef SYCK_H */
diff --git a/ext/syck/token.c b/ext/syck/token.c
deleted file mode 100644
index 1fc274c590..0000000000
--- a/ext/syck/token.c
+++ /dev/null
@@ -1,2345 +0,0 @@
-/* Generated by re2c 0.5 on Mon Jul 28 21:10:39 2003 */
-#line 1 "token.re"
-/*
- * token.re
- *
- * $Author$
- * $Date$
- *
- * Copyright (C) 2003 why the lucky stiff
- */
-#include "syck.h"
-#include "ruby.h"
-#include "gram.h"
-
-/*
- * Allocate quoted strings in chunks
- */
-#define QUOTELEN 1024
-
-/*
- * They do my bidding...
- */
-#define YYCTYPE char
-#define YYCURSOR parser->cursor
-#define YYMARKER parser->marker
-#define YYLIMIT parser->limit
-#define YYTOKEN parser->token
-#define YYTOKTMP parser->toktmp
-#define YYLINEPTR parser->lineptr
-#define YYLINECTPTR parser->linectptr
-#define YYLINE parser->linect
-#define YYFILL(n) syck_parser_read(parser)
-
-/*
- * Repositions the cursor at `n' offset from the token start.
- * Only works in `Header' and `Document' sections.
- */
-#define YYPOS(n) YYCURSOR = YYTOKEN + n
-
-/*
- * Track line numbers
- */
-#define NEWLINE(ptr) YYLINEPTR = ptr + 1; if ( YYLINEPTR > YYLINECTPTR ) { YYLINE++; YYLINECTPTR = YYLINEPTR; }
-
-/*
- * I like seeing the level operations as macros...
- */
-#define ADD_LEVEL(len, status) syck_parser_add_level( parser, len, status )
-#define POP_LEVEL() syck_parser_pop_level( parser )
-#define CURRENT_LEVEL() syck_parser_current_level( parser )
-
-/*
- * Force a token next time around sycklex()
- */
-#define FORCE_NEXT_TOKEN(tok) parser->force_token = tok;
-
-/*
- * Nice little macro to ensure we're YAML_IOPENed to the current level.
- * * Only use this macro in the "Document" section *
- */
-#define ENSURE_YAML_IOPEN(last_lvl, to_len, reset) \
- if ( last_lvl->spaces < to_len ) \
- { \
- if ( last_lvl->status == syck_lvl_inline ) \
- { \
- goto Document; \
- } \
- else \
- { \
- ADD_LEVEL( to_len, syck_lvl_doc ); \
- if ( reset == 1 ) YYPOS(0); \
- return YAML_IOPEN; \
- } \
- }
-
-/*
- * Nice little macro to ensure closure of levels.
- * * Only use this macro in the "Document" section *
- */
-#define ENSURE_YAML_IEND(last_lvl, to_len) \
- if ( last_lvl->spaces > to_len ) \
- { \
- syck_parser_pop_level( parser ); \
- YYPOS(0); \
- return YAML_IEND; \
- }
-
-/*
- * Concatenates quoted string items and manages allocation
- * to the quoted string
- */
-#define QUOTECAT(s, c, i, l) \
- { \
- if ( i + 1 >= c ) \
- { \
- c += QUOTELEN; \
- S_REALLOC_N( s, char, c ); \
- } \
- s[i++] = l; \
- s[i] = '\0'; \
- }
-
-#define QUOTECATS(s, c, i, cs, cl) \
- { \
- while ( i + cl >= c ) \
- { \
- c += QUOTELEN; \
- S_REALLOC_N( s, char, c ); \
- } \
- S_MEMCPY( s + i, cs, char, cl ); \
- i += cl; \
- s[i] = '\0'; \
- }
-
-/*
- * Tags a plain scalar with a transfer method
- * * Use only in "Plain" section *
- */
-#define RETURN_IMPLICIT() \
- { \
- SyckNode *n = syck_alloc_str(); \
- YYCURSOR = YYTOKTMP; \
- n->data.str->ptr = qstr; \
- n->data.str->len = qidx; \
- sycklval->nodeData = n; \
- if ( parser->implicit_typing == 1 ) \
- { \
- try_tag_implicit( sycklval->nodeData, parser->taguri_expansion ); \
- } \
- return YAML_PLAIN; \
- }
-
-/*
- * Keep or chomp block?
- * * Use only in "ScalarBlock" section *
- */
-#define RETURN_YAML_BLOCK() \
- { \
- SyckNode *n = syck_alloc_str(); \
- n->data.str->ptr = qstr; \
- n->data.str->len = qidx; \
- if ( qidx > 0 ) \
- { \
- if ( nlDoWhat != NL_KEEP ) \
- { \
- char *fc = n->data.str->ptr + n->data.str->len - 1; \
- while ( is_newline( fc ) ) fc--; \
- if ( nlDoWhat != NL_CHOMP ) \
- fc += 1; \
- n->data.str->len = fc - n->data.str->ptr + 1; \
- } \
- } \
- sycklval->nodeData = n; \
- return YAML_BLOCK; \
- }
-
-/*
- * Handles newlines, calculates indent
- */
-#define GOBBLE_UP_YAML_INDENT( ict, start ) \
- char *indent = start; \
- NEWLINE(indent); \
- while ( indent < YYCURSOR ) \
- { \
- if ( is_newline( ++indent ) ) \
- { \
- NEWLINE(indent); \
- } \
- } \
- ict = 0; \
- if ( *YYCURSOR == '\0' ) \
- { \
- ict = -1; \
- start = YYCURSOR - 1; \
- } \
- else if ( *YYLINEPTR == ' ' ) \
- { \
- ict = YYCURSOR - YYLINEPTR; \
- }
-
-/*
- * If an indent exists at the current level, back up.
- */
-#define GET_TRUE_YAML_INDENT(indt_len) \
- { \
- SyckLevel *lvl_deep = CURRENT_LEVEL(); \
- indt_len = lvl_deep->spaces; \
- if ( indt_len == YYTOKEN - YYLINEPTR ) \
- { \
- SyckLevel *lvl_over; \
- parser->lvl_idx--; \
- lvl_over = CURRENT_LEVEL(); \
- indt_len = lvl_over->spaces; \
- parser->lvl_idx++; \
- } \
- }
-
-/*
- * Argjh! I hate globals! Here for syckerror() only!
- */
-SyckParser *syck_parser_ptr = NULL;
-
-/*
- * Accessory funcs later in this file.
- */
-void eat_comments( SyckParser * );
-int is_newline( char *ptr );
-int yywrap();
-
-/*
- * My own re-entrant sycklex() using re2c.
- * You really get used to the limited regexp.
- * It's really nice to not rely on backtracking and such.
- */
-int
-sycklex( YYSTYPE *sycklval, SyckParser *parser )
-{
- syck_parser_ptr = parser;
- if ( YYCURSOR == NULL )
- {
- syck_parser_read( parser );
- }
-
- if ( parser->force_token != 0 )
- {
- int t = parser->force_token;
- parser->force_token = 0;
- return t;
- }
-
-#line 246
-
-
- if ( YYLINEPTR != YYCURSOR )
- {
- goto Document;
- }
-
-Header:
-
- YYTOKEN = YYCURSOR;
-
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy0;
-yy1: ++YYCURSOR;
-yy0:
- if((YYLIMIT - YYCURSOR) < 5) YYFILL(5);
- yych = *YYCURSOR;
- switch(yych){
- case '\000': goto yy7;
- case '\n': goto yy9;
- case '\r': goto yy11;
- case '#': goto yy5;
- case '-': goto yy2;
- case '.': goto yy4;
- default: goto yy12;
- }
-yy2: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '-': goto yy24;
- default: goto yy3;
- }
-yy3:
-#line 302
- { YYPOS(0);
- goto Document;
- }
-yy4: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '.': goto yy17;
- default: goto yy3;
- }
-yy5: yych = *++YYCURSOR;
-yy6:
-#line 287
- { eat_comments( parser );
- goto Header;
- }
-yy7: yych = *++YYCURSOR;
-yy8:
-#line 291
- { SyckLevel *lvl = CURRENT_LEVEL();
- ENSURE_YAML_IEND(lvl, -1);
- YYPOS(0);
- return 0;
- }
-yy9: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy14;
-yy10:
-#line 297
- { int indt_len;
- GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
- goto Header;
- }
-yy11: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy13;
- default: goto yy3;
- }
-yy12: yych = *++YYCURSOR;
- goto yy3;
-yy13: yyaccept = 1;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy14: switch(yych){
- case '\n': case ' ': goto yy13;
- case '\r': goto yy15;
- default: goto yy10;
- }
-yy15: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case '\n': goto yy13;
- default: goto yy16;
- }
-yy16: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 1: goto yy10;
- case 0: goto yy3;
- }
-yy17: yych = *++YYCURSOR;
- switch(yych){
- case '.': goto yy18;
- default: goto yy16;
- }
-yy18: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy19;
- case '\r': goto yy23;
- case ' ': goto yy21;
- default: goto yy16;
- }
-yy19: yych = *++YYCURSOR;
-yy20:
-#line 273
- { SyckLevel *lvl = CURRENT_LEVEL();
- if ( lvl->status == syck_lvl_header )
- {
- goto Header;
- }
- else
- {
- ENSURE_YAML_IEND(lvl, -1);
- YYPOS(0);
- return 0;
- }
- return 0;
- }
-yy21: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy22: switch(yych){
- case ' ': goto yy21;
- default: goto yy20;
- }
-yy23: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy19;
- default: goto yy16;
- }
-yy24: yych = *++YYCURSOR;
- switch(yych){
- case '-': goto yy25;
- default: goto yy16;
- }
-yy25: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy26;
- case '\r': goto yy30;
- case ' ': goto yy28;
- default: goto yy16;
- }
-yy26: yych = *++YYCURSOR;
-yy27:
-#line 259
- { SyckLevel *lvl = CURRENT_LEVEL();
- if ( lvl->status == syck_lvl_header )
- {
- YYPOS(3);
- goto Directive;
- }
- else
- {
- ENSURE_YAML_IEND(lvl, -1);
- YYPOS(0);
- return 0;
- }
- }
-yy28: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy29: switch(yych){
- case ' ': goto yy28;
- default: goto yy27;
- }
-yy30: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy26;
- default: goto yy16;
- }
-}
-#line 306
-
-
-Document:
- {
- SyckLevel *lvl = CURRENT_LEVEL();
- if ( lvl->status == syck_lvl_header )
- {
- lvl->status = syck_lvl_doc;
- }
-
- YYTOKEN = YYCURSOR;
-
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy31;
-yy32: ++YYCURSOR;
-yy31:
- if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
- yych = *YYCURSOR;
- switch(yych){
- case '\000': goto yy56;
- case '\n': goto yy33;
- case '\r': goto yy35;
- case ' ': goto yy54;
- case '!': goto yy45;
- case '"': goto yy49;
- case '#': goto yy52;
- case '&': goto yy43;
- case '\'': goto yy47;
- case '*': goto yy44;
- case ',': case ':': goto yy41;
- case '-': case '?': goto yy42;
- case '>': case '|': goto yy51;
- case '[': case '{': goto yy37;
- case ']': case '}': goto yy39;
- default: goto yy58;
- }
-yy33: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy86;
-yy34:
-#line 320
- { /* Isolate spaces */
- int indt_len;
- GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
- lvl = CURRENT_LEVEL();
-
- /* Check for open indent */
- ENSURE_YAML_IEND(lvl, indt_len);
- ENSURE_YAML_IOPEN(lvl, indt_len, 0);
- if ( indt_len == -1 )
- {
- return 0;
- }
- return YAML_INDENT;
- }
-yy35: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy85;
- default: goto yy36;
- }
-yy36:
-#line 407
- { ENSURE_YAML_IOPEN(lvl, 0, 1);
- goto Plain;
- }
-yy37: yych = *++YYCURSOR;
-yy38:
-#line 335
- { ENSURE_YAML_IOPEN(lvl, 0, 1);
- lvl = CURRENT_LEVEL();
- ADD_LEVEL(lvl->spaces + 1, syck_lvl_inline);
- return YYTOKEN[0];
- }
-yy39: yych = *++YYCURSOR;
-yy40:
-#line 341
- { POP_LEVEL();
- return YYTOKEN[0];
- }
-yy41: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '\n': goto yy80;
- case '\r': goto yy84;
- case ' ': goto yy82;
- default: goto yy36;
- }
-yy42: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '\n': goto yy75;
- case '\r': goto yy79;
- case ' ': goto yy77;
- default: goto yy36;
- }
-yy43: yych = *++YYCURSOR;
- switch(yych){
- case '-': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy72;
- default: goto yy36;
- }
-yy44: yych = *++YYCURSOR;
- switch(yych){
- case '-': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy69;
- default: goto yy36;
- }
-yy45: yych = *++YYCURSOR;
-yy46:
-#line 380
- { ENSURE_YAML_IOPEN(lvl, 0, 1);
- goto TransferMethod; }
-yy47: yych = *++YYCURSOR;
-yy48:
-#line 383
- { ENSURE_YAML_IOPEN(lvl, 0, 1);
- goto SingleQuote; }
-yy49: yych = *++YYCURSOR;
-yy50:
-#line 386
- { ENSURE_YAML_IOPEN(lvl, 0, 1);
- goto DoubleQuote; }
-yy51: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '\n': goto yy64;
- case '\r': goto yy68;
- case ' ': goto yy66;
- case '+': case '-': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy61;
- default: goto yy36;
- }
-yy52: yych = *++YYCURSOR;
-yy53:
-#line 396
- { eat_comments( parser );
- goto Document;
- }
-yy54: yych = *++YYCURSOR;
- goto yy60;
-yy55:
-#line 400
- { goto Document; }
-yy56: yych = *++YYCURSOR;
-yy57:
-#line 402
- { ENSURE_YAML_IEND(lvl, -1);
- YYPOS(0);
- return 0;
- }
-yy58: yych = *++YYCURSOR;
- goto yy36;
-yy59: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy60: switch(yych){
- case ' ': goto yy59;
- default: goto yy55;
- }
-yy61: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy62: switch(yych){
- case '\n': goto yy64;
- case '\r': goto yy68;
- case ' ': goto yy66;
- case '+': case '-': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy61;
- default: goto yy63;
- }
-yy63: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy34;
- case 1: goto yy36;
- }
-yy64: yych = *++YYCURSOR;
-yy65:
-#line 389
- { if ( is_newline( YYCURSOR - 1 ) )
- {
- YYCURSOR--;
- }
- goto ScalarBlock;
- }
-yy66: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy67: switch(yych){
- case ' ': goto yy66;
- default: goto yy65;
- }
-yy68: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy64;
- default: goto yy63;
- }
-yy69: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy70: switch(yych){
- case '-': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy69;
- default: goto yy71;
- }
-yy71:
-#line 375
- { ENSURE_YAML_IOPEN(lvl, 0, 1);
- sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
- return YAML_ALIAS;
- }
-yy72: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy73: switch(yych){
- case '-': case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z': case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy72;
- default: goto yy74;
- }
-yy74:
-#line 363
- { ENSURE_YAML_IOPEN(lvl, 0, 1);
- sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
-
- /*
- * Remove previous anchors of the same name. Since the parser will likely
- * construct deeper nodes first, we want those nodes to be placed in the
- * queue for matching at a higher level of indentation.
- */
- syck_hdlr_remove_anchor(parser, sycklval->name);
- return YAML_ANCHOR;
- }
-yy75: yych = *++YYCURSOR;
-yy76:
-#line 349
- { ENSURE_YAML_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1);
- FORCE_NEXT_TOKEN(YAML_IOPEN);
- if ( is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) )
- {
- YYCURSOR--;
- ADD_LEVEL((YYTOKEN + 1) - YYLINEPTR, syck_lvl_doc);
- }
- else
- {
- ADD_LEVEL(YYCURSOR - YYLINEPTR, syck_lvl_doc);
- }
- return YYTOKEN[0];
- }
-yy77: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy78: switch(yych){
- case ' ': goto yy77;
- default: goto yy76;
- }
-yy79: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy75;
- default: goto yy63;
- }
-yy80: yych = *++YYCURSOR;
-yy81:
-#line 345
- { YYPOS(1);
- return YYTOKEN[0];
- }
-yy82: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy83: switch(yych){
- case ' ': goto yy82;
- default: goto yy81;
- }
-yy84: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy80;
- default: goto yy63;
- }
-yy85: yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy86: switch(yych){
- case '\n': case ' ': goto yy85;
- case '\r': goto yy87;
- default: goto yy34;
- }
-yy87: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case '\n': goto yy85;
- default: goto yy63;
- }
-}
-#line 411
-
- }
-
-Directive:
- {
- YYTOKTMP = YYCURSOR;
-
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy88;
-yy89: ++YYCURSOR;
-yy88:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- switch(yych){
- case '\000': goto yy90;
- case ' ': goto yy93;
- case '%': goto yy91;
- default: goto yy95;
- }
-yy90: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy92;
- }
-yy91: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '.':
- case '/':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case ':':
- case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy98;
- default: goto yy92;
- }
-yy92:
-#line 424
- { YYCURSOR = YYTOKTMP;
- return YAML_DOCSEP;
- }
-yy93: yych = *++YYCURSOR;
- goto yy97;
-yy94:
-#line 422
- { goto Directive; }
-yy95: yych = *++YYCURSOR;
- goto yy92;
-yy96: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy97: switch(yych){
- case ' ': goto yy96;
- default: goto yy94;
- }
-yy98: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy99: switch(yych){
- case '.':
- case '/':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy98;
- case ':': goto yy100;
- default: goto yy90;
- }
-yy100: yych = *++YYCURSOR;
- switch(yych){
- case '.':
- case '/':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case ':':
- case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy101;
- default: goto yy90;
- }
-yy101: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy102: switch(yych){
- case '.':
- case '/':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case ':':
- case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'n':
- case 'o':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 't':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'y':
- case 'z': goto yy101;
- default: goto yy103;
- }
-yy103:
-#line 420
- { goto Directive; }
-}
-#line 427
-
-
- }
-
-Plain:
- {
- int qidx = 0;
- int qcapa = 100;
- char *qstr = S_ALLOC_N( char, qcapa );
- SyckLevel *plvl;
- int parentIndent;
-
- YYCURSOR = YYTOKEN;
- plvl = CURRENT_LEVEL();
- GET_TRUE_YAML_INDENT(parentIndent);
-
-Plain2:
- YYTOKTMP = YYCURSOR;
-
-Plain3:
-
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy104;
-yy105: ++YYCURSOR;
-yy104:
- if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
- yych = *YYCURSOR;
- switch(yych){
- case '\000': goto yy116;
- case '\n': goto yy106;
- case '\r': goto yy108;
- case ' ': goto yy114;
- case ',': goto yy113;
- case ':': goto yy110;
- case ']': case '}': goto yy111;
- default: goto yy118;
- }
-yy106: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy132;
-yy107:
-#line 450
- { int indt_len, nl_count = 0;
- SyckLevel *lvl;
- char *tok = YYTOKTMP;
- GOBBLE_UP_YAML_INDENT( indt_len, tok );
- lvl = CURRENT_LEVEL();
-
- if ( indt_len <= parentIndent )
- {
- RETURN_IMPLICIT();
- }
-
- while ( YYTOKTMP < YYCURSOR )
- {
- if ( is_newline( YYTOKTMP++ ) )
- nl_count++;
- }
- if ( nl_count <= 1 )
- {
- QUOTECAT(qstr, qcapa, qidx, ' ');
- }
- else
- {
- int i;
- for ( i = 0; i < nl_count - 1; i++ )
- {
- QUOTECAT(qstr, qcapa, qidx, '\n');
- }
- }
-
- goto Plain2;
- }
-yy108: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy131;
- default: goto yy109;
- }
-yy109:
-#line 504
- { QUOTECATS(qstr, qcapa, qidx, YYTOKTMP, YYCURSOR - YYTOKTMP);
- goto Plain2;
- }
-yy110: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '\n': goto yy126;
- case '\r': goto yy130;
- case ' ': goto yy128;
- default: goto yy109;
- }
-yy111: yych = *++YYCURSOR;
-yy112:
-#line 484
- { if ( plvl->status != syck_lvl_inline )
- {
- if ( *(YYCURSOR - 1) == ' ' || is_newline( YYCURSOR - 1 ) )
- {
- YYCURSOR--;
- }
- QUOTECATS(qstr, qcapa, qidx, YYTOKTMP, YYCURSOR - YYTOKTMP);
- goto Plain2;
- }
- RETURN_IMPLICIT();
- }
-yy113: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '\n': goto yy121;
- case '\r': goto yy124;
- case ' ': goto yy122;
- default: goto yy109;
- }
-yy114: yych = *++YYCURSOR;
- switch(yych){
- case '#': goto yy119;
- default: goto yy115;
- }
-yy115:
-#line 502
- { goto Plain3; }
-yy116: yych = *++YYCURSOR;
-yy117:
-#line 500
- { RETURN_IMPLICIT(); }
-yy118: yych = *++YYCURSOR;
- goto yy109;
-yy119: yych = *++YYCURSOR;
-yy120:
-#line 496
- { eat_comments( parser );
- RETURN_IMPLICIT();
- }
-yy121: yych = *++YYCURSOR;
- goto yy112;
-yy122: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy123: switch(yych){
- case ' ': goto yy122;
- default: goto yy112;
- }
-yy124: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy121;
- default: goto yy125;
- }
-yy125: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy107;
- case 1: goto yy109;
- }
-yy126: yych = *++YYCURSOR;
-yy127:
-#line 482
- { RETURN_IMPLICIT(); }
-yy128: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy129: switch(yych){
- case ' ': goto yy128;
- default: goto yy127;
- }
-yy130: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy126;
- default: goto yy125;
- }
-yy131: yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy132: switch(yych){
- case '\n': case ' ': goto yy131;
- case '\r': goto yy133;
- default: goto yy107;
- }
-yy133: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case '\n': goto yy131;
- default: goto yy125;
- }
-}
-#line 508
-
- }
-
-SingleQuote:
- {
- int qidx = 0;
- int qcapa = 100;
- char *qstr = S_ALLOC_N( char, qcapa );
-
-SingleQuote2:
- YYTOKTMP = YYCURSOR;
-
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy134;
-yy135: ++YYCURSOR;
-yy134:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- switch(yych){
- case '\000': goto yy142;
- case '\n': goto yy136;
- case '\r': goto yy138;
- case '\'': goto yy140;
- default: goto yy143;
- }
-yy136: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy147;
-yy137:
-#line 522
- { int indt_len;
- int nl_count = 0;
- SyckLevel *lvl;
- GOBBLE_UP_YAML_INDENT( indt_len, YYTOKTMP );
- lvl = CURRENT_LEVEL();
-
- if ( lvl->status != syck_lvl_str )
- {
- ADD_LEVEL( indt_len, syck_lvl_str );
- }
- else if ( indt_len < lvl->spaces )
- {
- /* Error! */
- }
-
- while ( YYTOKTMP < YYCURSOR )
- {
- if ( is_newline( YYTOKTMP++ ) )
- nl_count++;
- }
- if ( nl_count <= 1 )
- {
- QUOTECAT(qstr, qcapa, qidx, ' ');
- }
- else
- {
- int i;
- for ( i = 0; i < nl_count - 1; i++ )
- {
- QUOTECAT(qstr, qcapa, qidx, '\n');
- }
- }
-
- goto SingleQuote2;
- }
-yy138: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy146;
- default: goto yy139;
- }
-yy139:
-#line 576
- { QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
- goto SingleQuote2;
- }
-yy140: yych = *++YYCURSOR;
- switch(yych){
- case '\'': goto yy144;
- default: goto yy141;
- }
-yy141:
-#line 562
- { SyckLevel *lvl;
- SyckNode *n = syck_alloc_str();
- lvl = CURRENT_LEVEL();
-
- if ( lvl->status == syck_lvl_str )
- {
- POP_LEVEL();
- }
- n->data.str->ptr = qstr;
- n->data.str->len = qidx;
- sycklval->nodeData = n;
- return YAML_PLAIN;
- }
-yy142: yych = *++YYCURSOR;
- goto yy141;
-yy143: yych = *++YYCURSOR;
- goto yy139;
-yy144: yych = *++YYCURSOR;
-yy145:
-#line 558
- { QUOTECAT(qstr, qcapa, qidx, '\'');
- goto SingleQuote2;
- }
-yy146: yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy147: switch(yych){
- case '\n': case ' ': goto yy146;
- case '\r': goto yy148;
- default: goto yy137;
- }
-yy148: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case '\n': goto yy146;
- default: goto yy149;
- }
-yy149: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy137;
- }
-}
-#line 580
-
-
- }
-
-
-DoubleQuote:
- {
- int keep_nl = 1;
- int qidx = 0;
- int qcapa = 100;
- char *qstr = S_ALLOC_N( char, qcapa );
-
-DoubleQuote2:
- YYTOKTMP = YYCURSOR;
-
-
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy150;
-yy151: ++YYCURSOR;
-yy150:
- if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
- yych = *YYCURSOR;
- switch(yych){
- case '\000': goto yy157;
- case '\n': goto yy152;
- case '\r': goto yy154;
- case '"': goto yy159;
- case '\\': goto yy156;
- default: goto yy160;
- }
-yy152: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy174;
-yy153:
-#line 598
- { int indt_len;
- int nl_count = 0;
- SyckLevel *lvl;
- GOBBLE_UP_YAML_INDENT( indt_len, YYTOKTMP );
- lvl = CURRENT_LEVEL();
-
- if ( lvl->status != syck_lvl_str )
- {
- ADD_LEVEL( indt_len, syck_lvl_str );
- }
- else if ( indt_len < lvl->spaces )
- {
- /* FIXME */
- }
-
- if ( keep_nl == 1 )
- {
- while ( YYTOKTMP < YYCURSOR )
- {
- if ( is_newline( YYTOKTMP++ ) )
- nl_count++;
- }
- if ( nl_count <= 1 )
- {
- QUOTECAT(qstr, qcapa, qidx, ' ');
- }
- else
- {
- int i;
- for ( i = 0; i < nl_count - 1; i++ )
- {
- QUOTECAT(qstr, qcapa, qidx, '\n');
- }
- }
- }
-
- keep_nl = 1;
- goto DoubleQuote2;
- }
-yy154: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy173;
- default: goto yy155;
- }
-yy155:
-#line 682
- { QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
- goto DoubleQuote2;
- }
-yy156: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case '\n': goto yy164;
- case '\r': goto yy166;
- case ' ': goto yy161;
- case '"': case '\\': case 'a':
- case 'b': case 'e':
- case 'f': case 'n': case 'r': case 't': case 'v': goto yy168;
- case 'x': goto yy167;
- default: goto yy155;
- }
-yy157: yych = *++YYCURSOR;
-yy158:
-#line 668
- { SyckLevel *lvl;
- SyckNode *n = syck_alloc_str();
- lvl = CURRENT_LEVEL();
-
- if ( lvl->status == syck_lvl_str )
- {
- POP_LEVEL();
- }
- n->data.str->ptr = qstr;
- n->data.str->len = qidx;
- sycklval->nodeData = n;
- return YAML_PLAIN;
- }
-yy159: yych = *++YYCURSOR;
- goto yy158;
-yy160: yych = *++YYCURSOR;
- goto yy155;
-yy161: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy162: switch(yych){
- case '\n': goto yy164;
- case '\r': goto yy166;
- case ' ': goto yy161;
- default: goto yy163;
- }
-yy163: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy153;
- case 1: goto yy155;
- }
-yy164: yych = *++YYCURSOR;
-yy165:
-#line 663
- { keep_nl = 0;
- YYCURSOR--;
- goto DoubleQuote2;
- }
-yy166: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy164;
- default: goto yy163;
- }
-yy167: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f': goto yy170;
- default: goto yy163;
- }
-yy168: yych = *++YYCURSOR;
-yy169:
-#line 638
- { char ch = *( YYCURSOR - 1 );
- switch ( ch )
- {
- case 'a': ch = 7; break;
- case 'b': ch = '\010'; break;
- case 'e': ch = '\033'; break;
- case 'f': ch = '\014'; break;
- case 'n': ch = '\n'; break;
- case 'r': ch = '\015'; break;
- case 't': ch = '\t'; break;
- case 'v': ch = '\013'; break;
- }
- QUOTECAT(qstr, qcapa, qidx, ch);
- goto DoubleQuote2;
- }
-yy170: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f': goto yy171;
- default: goto yy163;
- }
-yy171: yych = *++YYCURSOR;
-yy172:
-#line 654
- { long ch;
- char *chr_text = syck_strndup( YYTOKTMP, 4 );
- chr_text[0] = '0';
- ch = strtol( chr_text, NULL, 16 );
- free( chr_text );
- QUOTECAT(qstr, qcapa, qidx, ch);
- goto DoubleQuote2;
- }
-yy173: yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy174: switch(yych){
- case '\n': case ' ': goto yy173;
- case '\r': goto yy175;
- default: goto yy153;
- }
-yy175: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case '\n': goto yy173;
- default: goto yy163;
- }
-}
-#line 686
-
- }
-
-TransferMethod:
- {
- int qidx = 0;
- int qcapa = 100;
- char *qstr = S_ALLOC_N( char, qcapa );
-
-TransferMethod2:
- YYTOKTMP = YYCURSOR;
-
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy176;
-yy177: ++YYCURSOR;
-yy176:
- if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
- yych = *YYCURSOR;
- switch(yych){
- case '\000': goto yy178;
- case '\n': goto yy179;
- case '\r': goto yy182;
- case ' ': goto yy181;
- case '\\': goto yy184;
- default: goto yy185;
- }
-yy178: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy183;
- }
-yy179: yych = *++YYCURSOR;
-yy180:
-#line 700
- { SyckLevel *lvl;
- YYCURSOR = YYTOKTMP;
- if ( YYCURSOR == YYTOKEN + 1 )
- {
- free( qstr );
- return YAML_ITRANSFER;
- }
-
- lvl = CURRENT_LEVEL();
-
- /*
- * URL Prefixing
- */
- if ( *qstr == '^' )
- {
- sycklval->name = S_ALLOC_N( char, qidx + strlen( lvl->domain ) );
- sycklval->name[0] = '\0';
- strcat( sycklval->name, lvl->domain );
- strncat( sycklval->name, qstr + 1, qidx - 1 );
- free( qstr );
- }
- else
- {
- char *carat = qstr;
- char *qend = qstr + qidx;
- while ( (++carat) < qend )
- {
- if ( *carat == '^' )
- break;
- }
-
- if ( carat < qend )
- {
- free( lvl->domain );
- lvl->domain = syck_strndup( qstr, carat - qstr );
- sycklval->name = S_ALLOC_N( char, ( qend - carat ) + strlen( lvl->domain ) );
- sycklval->name[0] = '\0';
- strcat( sycklval->name, lvl->domain );
- strncat( sycklval->name, carat + 1, ( qend - carat ) - 1 );
- free( qstr );
- }
- else
- {
- sycklval->name = qstr;
- }
- }
-
- return YAML_TRANSFER;
- }
-yy181: yych = *++YYCURSOR;
- goto yy192;
-yy182: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy190;
- default: goto yy183;
- }
-yy183:
-#line 762
- { QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
- goto TransferMethod2;
- }
-yy184: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 'x': goto yy186;
- default: goto yy183;
- }
-yy185: yych = *++YYCURSOR;
- goto yy183;
-yy186: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f': goto yy187;
- default: goto yy178;
- }
-yy187: yych = *++YYCURSOR;
- switch(yych){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F': case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f': goto yy188;
- default: goto yy178;
- }
-yy188: yych = *++YYCURSOR;
-yy189:
-#line 753
- { long ch;
- char *chr_text = syck_strndup( YYTOKTMP, 4 );
- chr_text[0] = '0';
- ch = strtol( chr_text, NULL, 16 );
- free( chr_text );
- QUOTECAT(qstr, qcapa, qidx, ch);
- goto TransferMethod2;
- }
-yy190: yych = *++YYCURSOR;
- goto yy180;
-yy191: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy192: switch(yych){
- case ' ': goto yy191;
- default: goto yy180;
- }
-}
-#line 767
-
- }
-
-ScalarBlock:
- {
- int qidx = 0;
- int qcapa = 100;
- char *qstr = S_ALLOC_N( char, qcapa );
- int blockType = 0;
- int nlDoWhat = 0;
- int lastIndent = 0;
- int forceIndent = -1;
- char *yyt = YYTOKEN;
- SyckLevel *lvl = CURRENT_LEVEL();
- int parentIndent;
- GET_TRUE_YAML_INDENT(parentIndent);
-
- switch ( *yyt )
- {
- case '|': blockType = BLOCK_LIT; break;
- case '>': blockType = BLOCK_FOLD; break;
- }
-
- while ( ++yyt <= YYCURSOR )
- {
- if ( *yyt == '-' )
- {
- nlDoWhat = NL_CHOMP;
- }
- else if ( *yyt == '+' )
- {
- nlDoWhat = NL_KEEP;
- }
- else if ( isdigit( *yyt ) )
- {
- forceIndent = strtol( yyt, NULL, 10 ) + parentIndent;
- }
- }
-
- qstr[0] = '\0';
- YYTOKEN = YYCURSOR;
-
-ScalarBlock2:
- YYTOKTMP = YYCURSOR;
-
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy193;
-yy194: ++YYCURSOR;
-yy193:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- switch(yych){
- case '\000': goto yy201;
- case '\n': goto yy195;
- case '\r': goto yy197;
- case '#': goto yy199;
- default: goto yy203;
- }
-yy195: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy205;
-yy196:
-#line 814
- { char *pacer;
- char *tok = YYTOKTMP;
- int indt_len = 0, nl_count = 0, fold_nl = 0, nl_begin = 0;
- GOBBLE_UP_YAML_INDENT( indt_len, tok );
- lvl = CURRENT_LEVEL();
-
- if ( indt_len > parentIndent && lvl->status != syck_lvl_block )
- {
- int new_spaces = forceIndent > 0 ? forceIndent : indt_len;
- ADD_LEVEL( new_spaces, syck_lvl_block );
- lastIndent = indt_len - new_spaces;
- nl_begin = 1;
- lvl = CURRENT_LEVEL();
- }
- else if ( lvl->status != syck_lvl_block )
- {
- YYCURSOR = YYTOKTMP;
- RETURN_YAML_BLOCK();
- }
-
- /*
- * Fold only in the event of two lines being on the leftmost
- * indentation.
- */
- if ( blockType == BLOCK_FOLD && lastIndent == 0 && ( indt_len - lvl->spaces ) == 0 )
- {
- fold_nl = 1;
- }
-
- pacer = YYTOKTMP;
- while ( pacer < YYCURSOR )
- {
- if ( is_newline( pacer++ ) )
- nl_count++;
- }
-
- if ( fold_nl == 1 || nl_begin == 1 )
- {
- nl_count--;
- }
-
- if ( nl_count < 1 && nl_begin == 0 )
- {
- QUOTECAT(qstr, qcapa, qidx, ' ');
- }
- else
- {
- int i;
- for ( i = 0; i < nl_count; i++ )
- {
- QUOTECAT(qstr, qcapa, qidx, '\n');
- }
- }
-
- lastIndent = indt_len - lvl->spaces;
- YYCURSOR -= lastIndent;
-
- if ( indt_len < lvl->spaces )
- {
- POP_LEVEL();
- YYCURSOR = YYTOKTMP;
- RETURN_YAML_BLOCK();
- }
- goto ScalarBlock2;
- }
-yy197: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy204;
- default: goto yy198;
- }
-yy198:
-#line 900
- { QUOTECAT(qstr, qcapa, qidx, *YYTOKTMP);
- goto ScalarBlock2;
- }
-yy199: yych = *++YYCURSOR;
-yy200:
-#line 881
- { lvl = CURRENT_LEVEL();
- if ( lvl->status != syck_lvl_block )
- {
- eat_comments( parser );
- YYTOKTMP = YYCURSOR;
- }
- else
- {
- QUOTECAT(qstr, qcapa, qidx, *YYTOKTMP);
- }
- goto ScalarBlock2;
- }
-yy201: yych = *++YYCURSOR;
-yy202:
-#line 895
- { YYCURSOR--;
- POP_LEVEL();
- RETURN_YAML_BLOCK();
- }
-yy203: yych = *++YYCURSOR;
- goto yy198;
-yy204: yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy205: switch(yych){
- case '\n': case ' ': goto yy204;
- case '\r': goto yy206;
- default: goto yy196;
- }
-yy206: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case '\n': goto yy204;
- default: goto yy207;
- }
-yy207: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy196;
- }
-}
-#line 905
-
- }
-
- return 0;
-
-}
-
-void
-eat_comments( SyckParser *parser )
-{
- char *tok;
-
-Comment:
- {
- tok = YYCURSOR;
-
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy208;
-yy209: ++YYCURSOR;
-yy208:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- switch(yych){
- case '\000': goto yy210;
- case '\n': goto yy212;
- case '\r': goto yy213;
- default: goto yy215;
- }
-yy210: yych = *++YYCURSOR;
-yy211:
-#line 923
- { YYCURSOR = tok;
- return;
- }
-yy212: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy217;
-yy213: yych = *++YYCURSOR;
- switch(yych){
- case '\n': goto yy216;
- default: goto yy214;
- }
-yy214:
-#line 927
- { goto Comment;
- }
-yy215: yych = *++YYCURSOR;
- goto yy214;
-yy216: yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy217: switch(yych){
- case '\n': goto yy216;
- case '\r': goto yy218;
- default: goto yy211;
- }
-yy218: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- switch(yych){
- case '\n': goto yy216;
- default: goto yy219;
- }
-yy219: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy211;
- }
-}
-#line 930
-
-
- }
-
-}
-
-int
-is_newline( char *ptr )
-{
- if ( *ptr == '\n' )
- return 1;
-
- if ( *ptr == '\r' && *( ptr + 1 ) == '\n' )
- return 1;
-
- return 0;
-}
-
-int
-syckwrap()
-{
- return 1;
-}
-
-void
-syckerror( char *msg )
-{
- if ( syck_parser_ptr->error_handler == NULL )
- syck_parser_ptr->error_handler = syck_default_error_handler;
-
- syck_parser_ptr->root = syck_parser_ptr->root_on_error;
- (syck_parser_ptr->error_handler)(syck_parser_ptr, msg);
-}
-