summaryrefslogtreecommitdiff
path: root/ext/syck
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-28 19:27:42 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-28 19:27:42 +0000
commit0a75581a37b360542d05fc6560c8a9567b642955 (patch)
treec269f65ebba51395164a4e45bcc740665ed2152d /ext/syck
parentea837fc6feab1b2f1b5400b79b87879aa160f42b (diff)
* ext/syck/syck.h: Added 'syck' yacc prefixes.
* ext/syck/gram.c: ditto. * ext/syck/token.c: ditto. * ext/syck: Added ruby.h reference to source files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/syck')
-rw-r--r--ext/syck/emitter.c83
-rw-r--r--ext/syck/gram.c17
-rw-r--r--ext/syck/handler.c5
-rw-r--r--ext/syck/implicit.c5
-rw-r--r--ext/syck/node.c2
-rw-r--r--ext/syck/rubyext.c48
-rw-r--r--ext/syck/syck.c9
-rw-r--r--ext/syck/syck.h10
-rw-r--r--ext/syck/token.c168
9 files changed, 215 insertions, 132 deletions
diff --git a/ext/syck/emitter.c b/ext/syck/emitter.c
index ed47260..62f1b57 100644
--- a/ext/syck/emitter.c
+++ b/ext/syck/emitter.c
@@ -13,9 +13,13 @@
#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;
@@ -24,6 +28,85 @@ struct adjust_arg {
};
/*
+ * 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 *
diff --git a/ext/syck/gram.c b/ext/syck/gram.c
index 69a21b6..df915e5 100644
--- a/ext/syck/gram.c
+++ b/ext/syck/gram.c
@@ -42,6 +42,15 @@
/* 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. */
@@ -88,7 +97,6 @@
#define YYLEX_PARAM parser
-
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 1
@@ -110,7 +118,7 @@ typedef union {
char *name;
} yystype;
/* Line 193 of /usr/local/share/bison/yacc.c. */
-#line 114 "y.tab.c"
+#line 123 "y.tab.c"
# define YYSTYPE yystype
# define YYSTYPE_IS_TRIVIAL 1
#endif
@@ -128,10 +136,11 @@ typedef struct yyltype
#endif
/* Copy the second part of user declarations. */
+int sycklex( YYSTYPE *, SyckParser * );
/* Line 213 of /usr/local/share/bison/yacc.c. */
-#line 135 "y.tab.c"
+#line 144 "y.tab.c"
#if ! defined (yyoverflow) || YYERROR_VERBOSE
@@ -1450,7 +1459,7 @@ yyreduce:
}
/* Line 1016 of /usr/local/share/bison/yacc.c. */
-#line 1454 "y.tab.c"
+#line 1463 "y.tab.c"
yyvsp -= yylen;
yyssp -= yylen;
diff --git a/ext/syck/handler.c b/ext/syck/handler.c
index aba6a62..0a7ee8c 100644
--- a/ext/syck/handler.c
+++ b/ext/syck/handler.c
@@ -8,6 +8,7 @@
*/
#include "syck.h"
+#include "ruby.h"
SYMID
syck_hdlr_add_node( SyckParser *p, SyckNode *n )
@@ -100,10 +101,6 @@ syck_hdlr_get_anchor( SyckParser *p, char *a )
void
syck_add_transfer( char *uri, SyckNode *n, int taguri )
{
- char *comma = NULL;
- char *slash = uri;
- char *domain = NULL;
-
if ( n->type_id != NULL )
{
S_FREE( n->type_id );
diff --git a/ext/syck/implicit.c b/ext/syck/implicit.c
index c7716ba..4ab61c5 100644
--- a/ext/syck/implicit.c
+++ b/ext/syck/implicit.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.5 on Mon Jun 9 18:21:19 2003 */
+/* Generated by re2c 0.5 on Mon Jul 28 11:21:48 2003 */
#line 1 "implicit.re"
/*
* implicit.re
@@ -10,6 +10,7 @@
*/
#include "syck.h"
+#include "ruby.h"
#define YYCTYPE char
#define YYCURSOR cursor
@@ -20,7 +21,7 @@
void
try_tag_implicit( SyckNode *n, int taguri )
{
- char *tid;
+ char *tid = "";
switch ( n->kind )
{
case syck_str_kind:
diff --git a/ext/syck/node.c b/ext/syck/node.c
index eb2bbc2..f999700 100644
--- a/ext/syck/node.c
+++ b/ext/syck/node.c
@@ -8,6 +8,7 @@
*/
#include "syck.h"
+#include "ruby.h"
/*
* Node allocation functions
@@ -296,7 +297,6 @@ syck_seq_read( SyckNode *seq, long idx )
void
syck_free_members( SyckNode *n )
{
- int i;
switch ( n->kind )
{
case syck_str_kind:
diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c
index a87edad..cdef3a0 100644
--- a/ext/syck/rubyext.c
+++ b/ext/syck/rubyext.c
@@ -37,6 +37,9 @@ typedef struct 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;
@@ -53,6 +56,9 @@ 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 *));
@@ -234,7 +240,7 @@ rb_syck_parse_handler(p, n)
SyckParser *p;
SyckNode *n;
{
- VALUE t, v, obj;
+ VALUE t, obj, v = Qnil;
int i;
struct parser_xtra *bonus;
@@ -311,9 +317,8 @@ rb_syck_load_handler(p, n)
SyckParser *p;
SyckNode *n;
{
- VALUE obj;
+ VALUE obj = Qnil;
long i;
- int str = 0;
int check_transfers = 0;
struct parser_xtra *bonus;
@@ -511,6 +516,9 @@ rb_syck_err_handler(p, msg)
p->lineptr);
}
+/*
+ * provide bad anchor object to the parser.
+ */
SyckNode *
rb_syck_bad_anchor_handler(p, a)
SyckParser *p;
@@ -546,26 +554,8 @@ syck_set_model( parser, model )
}
/*
- * wrap syck_parse().
- */
-static VALUE
-rb_run_syck_parse(parser)
- SyckParser *parser;
-{
- return syck_parse(parser);
-}
-
-/*
- * free parser.
+ * mark parser nodes
*/
-static VALUE
-rb_syck_ensure(parser)
- SyckParser *parser;
-{
- syck_free_parser( parser );
- return 0;
-}
-
static void
syck_mark_parser(parser)
SyckParser *parser;
@@ -620,7 +610,7 @@ syck_parser_load(argc, argv, self)
VALUE *argv;
VALUE self;
{
- VALUE port, proc, v, model;
+ VALUE port, proc, model;
SyckParser *parser;
struct parser_xtra bonus;
volatile VALUE hash; /* protect from GC */
@@ -638,10 +628,6 @@ syck_parser_load(argc, argv, self)
parser->bonus = (void *)&bonus;
-#if 0
- v = rb_ensure(rb_run_syck_parse, (VALUE)&parser, rb_syck_ensure, (VALUE)&parser);
-#endif
-
return syck_parse( parser );
}
@@ -730,7 +716,7 @@ syck_loader_add_domain_type( argc, argv, self )
VALUE *argv;
VALUE self;
{
- VALUE domain, type_re, proc, families, ruby_yaml_org, domain_types;
+ 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 );
@@ -747,7 +733,7 @@ syck_loader_add_builtin_type( argc, argv, self )
VALUE *argv;
VALUE self;
{
- VALUE type_re, proc, families, ruby_yaml_org, domain_types;
+ 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 );
@@ -763,7 +749,7 @@ syck_loader_add_ruby_type( argc, argv, self )
VALUE *argv;
VALUE self;
{
- VALUE type_re, proc, families, ruby_yaml_org, domain_types;
+ 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 );
@@ -858,7 +844,7 @@ syck_loader_transfer( self, type, val )
if ( taguri != NULL )
{
- VALUE scheme, domain, name, type_hash, type_proc = Qnil;
+ 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");
diff --git a/ext/syck/syck.c b/ext/syck/syck.c
index 4b7be32..42b7057 100644
--- a/ext/syck/syck.c
+++ b/ext/syck/syck.c
@@ -10,6 +10,7 @@
#include <string.h>
#include "syck.h"
+#include "ruby.h"
void syck_parser_pop_level( SyckParser * );
@@ -44,7 +45,6 @@ syck_strndup( char *buf, long len )
long
syck_io_file_read( char *buf, SyckIoFile *file, long max_size, long skip )
{
- char *beg;
long len = 0;
ASSERT( file != NULL );
@@ -233,9 +233,6 @@ syck_st_free( SyckParser *p )
void
syck_free_parser( SyckParser *p )
{
- char *key;
- SyckNode *node;
-
/*
* Free tables, levels
*/
@@ -477,13 +474,11 @@ syck_parser_readlen( SyckParser *p, long max_size )
SYMID
syck_parse( SyckParser *p )
{
- char *line;
-
ASSERT( p != NULL );
syck_st_free( p );
syck_parser_reset_levels( p );
- yyparse( p );
+ syckparse( p );
return p->root;
}
diff --git a/ext/syck/syck.h b/ext/syck/syck.h
index cace70b..124e6c5 100644
--- a/ext/syck/syck.h
+++ b/ext/syck/syck.h
@@ -17,6 +17,7 @@
#define YAML_DOMAIN "yaml.org,2002"
#include <stdio.h>
+#include <ctype.h>
#include "st.h"
#if defined(__cplusplus)
@@ -302,11 +303,14 @@ char *syck_match_implicit( char *, size_t );
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 );
@@ -357,6 +361,12 @@ 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
diff --git a/ext/syck/token.c b/ext/syck/token.c
index bec1e7b..8cdb787 100644
--- a/ext/syck/token.c
+++ b/ext/syck/token.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.5 on Thu Jul 24 10:01:15 2003 */
+/* Generated by re2c 0.5 on Mon Jul 28 11:21:46 2003 */
#line 1 "token.re"
/*
* token.re
@@ -9,6 +9,7 @@
* Copyright (C) 2003 why the lucky stiff
*/
#include "syck.h"
+#include "ruby.h"
#include "gram.h"
/*
@@ -49,7 +50,7 @@
#define CURRENT_LEVEL() syck_parser_current_level( parser )
/*
- * Force a token next time around yylex()
+ * Force a token next time around sycklex()
*/
#define FORCE_NEXT_TOKEN(tok) parser->force_token = tok;
@@ -117,15 +118,14 @@
*/
#define RETURN_IMPLICIT() \
{ \
- SyckLevel *i_lvl = CURRENT_LEVEL(); \
SyckNode *n = syck_alloc_str(); \
YYCURSOR = YYTOKTMP; \
n->data.str->ptr = qstr; \
n->data.str->len = qidx; \
- yylval->nodeData = n; \
+ sycklval->nodeData = n; \
if ( parser->implicit_typing == 1 ) \
{ \
- try_tag_implicit( yylval->nodeData, parser->taguri_expansion ); \
+ try_tag_implicit( sycklval->nodeData, parser->taguri_expansion ); \
} \
return PLAIN; \
}
@@ -150,7 +150,7 @@
n->data.str->len = fc - n->data.str->ptr + 1; \
} \
} \
- yylval->nodeData = n; \
+ sycklval->nodeData = n; \
return BLOCK; \
}
@@ -196,7 +196,7 @@
}
/*
- * Argjh! I hate globals! Here for yyerror() only!
+ * Argjh! I hate globals! Here for syckerror() only!
*/
SyckParser *syck_parser_ptr = NULL;
@@ -204,14 +204,16 @@ 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 yylex() using re2c.
+ * 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
-yylex( YYSTYPE *yylval, SyckParser *parser )
+sycklex( YYSTYPE *sycklval, SyckParser *parser )
{
syck_parser_ptr = parser;
if ( YYCURSOR == NULL )
@@ -226,7 +228,7 @@ yylex( YYSTYPE *yylval, SyckParser *parser )
return t;
}
-#line 245
+#line 246
if ( YYLINEPTR != YYCURSOR )
@@ -262,7 +264,7 @@ yy2: yyaccept = 0;
default: goto yy3;
}
yy3:
-#line 301
+#line 302
{ YYPOS(0);
goto Document;
}
@@ -274,13 +276,13 @@ yy4: yyaccept = 0;
}
yy5: yych = *++YYCURSOR;
yy6:
-#line 286
+#line 287
{ eat_comments( parser );
goto Header;
}
yy7: yych = *++YYCURSOR;
yy8:
-#line 290
+#line 291
{ SyckLevel *lvl = CURRENT_LEVEL();
ENSURE_IEND(lvl, -1);
YYPOS(0);
@@ -290,7 +292,7 @@ yy9: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
goto yy14;
yy10:
-#line 296
+#line 297
{ int indt_len;
GOBBLE_UP_INDENT( indt_len, YYTOKEN );
goto Header;
@@ -337,7 +339,7 @@ yy18: yych = *++YYCURSOR;
}
yy19: yych = *++YYCURSOR;
yy20:
-#line 272
+#line 273
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
@@ -377,7 +379,7 @@ yy25: yych = *++YYCURSOR;
}
yy26: yych = *++YYCURSOR;
yy27:
-#line 258
+#line 259
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
@@ -404,7 +406,7 @@ yy30: yych = *++YYCURSOR;
default: goto yy16;
}
}
-#line 305
+#line 306
Document:
@@ -447,7 +449,7 @@ yy33: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy86;
yy34:
-#line 319
+#line 320
{ /* Isolate spaces */
int indt_len;
GOBBLE_UP_INDENT( indt_len, YYTOKEN );
@@ -468,13 +470,13 @@ yy35: yych = *++YYCURSOR;
default: goto yy36;
}
yy36:
-#line 406
+#line 407
{ ENSURE_IOPEN(lvl, 0, 1);
goto Plain;
}
yy37: yych = *++YYCURSOR;
yy38:
-#line 334
+#line 335
{ ENSURE_IOPEN(lvl, 0, 1);
lvl = CURRENT_LEVEL();
ADD_LEVEL(lvl->spaces + 1, syck_lvl_inline);
@@ -482,7 +484,7 @@ yy38:
}
yy39: yych = *++YYCURSOR;
yy40:
-#line 340
+#line 341
{ POP_LEVEL();
return YYTOKEN[0];
}
@@ -632,17 +634,17 @@ yy44: yych = *++YYCURSOR;
}
yy45: yych = *++YYCURSOR;
yy46:
-#line 379
+#line 380
{ ENSURE_IOPEN(lvl, 0, 1);
goto TransferMethod; }
yy47: yych = *++YYCURSOR;
yy48:
-#line 382
+#line 383
{ ENSURE_IOPEN(lvl, 0, 1);
goto SingleQuote; }
yy49: yych = *++YYCURSOR;
yy50:
-#line 385
+#line 386
{ ENSURE_IOPEN(lvl, 0, 1);
goto DoubleQuote; }
yy51: yyaccept = 1;
@@ -665,18 +667,18 @@ yy51: yyaccept = 1;
}
yy52: yych = *++YYCURSOR;
yy53:
-#line 395
+#line 396
{ eat_comments( parser );
goto Document;
}
yy54: yych = *++YYCURSOR;
goto yy60;
yy55:
-#line 399
+#line 400
{ goto Document; }
yy56: yych = *++YYCURSOR;
yy57:
-#line 401
+#line 402
{ ENSURE_IEND(lvl, -1);
YYPOS(0);
return 0;
@@ -716,7 +718,7 @@ yy63: YYCURSOR = YYMARKER;
}
yy64: yych = *++YYCURSOR;
yy65:
-#line 388
+#line 389
{ if ( is_newline( YYCURSOR - 1 ) )
{
YYCURSOR--;
@@ -802,9 +804,9 @@ yy70: switch(yych){
default: goto yy71;
}
yy71:
-#line 374
+#line 375
{ ENSURE_IOPEN(lvl, 0, 1);
- yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
+ sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
return ALIAS;
}
yy72: ++YYCURSOR;
@@ -874,21 +876,21 @@ yy73: switch(yych){
default: goto yy74;
}
yy74:
-#line 362
+#line 363
{ ENSURE_IOPEN(lvl, 0, 1);
- yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 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, yylval->name);
+ syck_hdlr_remove_anchor(parser, sycklval->name);
return ANCHOR;
}
yy75: yych = *++YYCURSOR;
yy76:
-#line 348
+#line 349
{ ENSURE_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1);
FORCE_NEXT_TOKEN(IOPEN);
if ( is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) )
@@ -916,7 +918,7 @@ yy79: yych = *++YYCURSOR;
}
yy80: yych = *++YYCURSOR;
yy81:
-#line 344
+#line 345
{ YYPOS(1);
return YYTOKEN[0];
}
@@ -949,7 +951,7 @@ yy87: ++YYCURSOR;
default: goto yy63;
}
}
-#line 410
+#line 411
}
@@ -1056,14 +1058,14 @@ yy91: yyaccept = 0;
default: goto yy92;
}
yy92:
-#line 423
+#line 424
{ YYCURSOR = YYTOKTMP;
return DOCSEP;
}
yy93: yych = *++YYCURSOR;
goto yy97;
yy94:
-#line 421
+#line 422
{ goto Directive; }
yy95: yych = *++YYCURSOR;
goto yy92;
@@ -1315,10 +1317,10 @@ yy102: switch(yych){
default: goto yy103;
}
yy103:
-#line 419
+#line 420
{ goto Directive; }
}
-#line 426
+#line 427
}
@@ -1362,7 +1364,7 @@ yy106: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy132;
yy107:
-#line 449
+#line 450
{ int indt_len, nl_count = 0;
SyckLevel *lvl;
char *tok = YYTOKTMP;
@@ -1400,7 +1402,7 @@ yy108: yych = *++YYCURSOR;
default: goto yy109;
}
yy109:
-#line 503
+#line 504
{ QUOTECATS(qstr, qcapa, qidx, YYTOKTMP, YYCURSOR - YYTOKTMP);
goto Plain2;
}
@@ -1414,7 +1416,7 @@ yy110: yyaccept = 1;
}
yy111: yych = *++YYCURSOR;
yy112:
-#line 483
+#line 484
{ if ( plvl->status != syck_lvl_inline )
{
if ( *(YYCURSOR - 1) == ' ' || is_newline( YYCURSOR - 1 ) )
@@ -1440,17 +1442,17 @@ yy114: yych = *++YYCURSOR;
default: goto yy115;
}
yy115:
-#line 501
+#line 502
{ goto Plain3; }
yy116: yych = *++YYCURSOR;
yy117:
-#line 499
+#line 500
{ RETURN_IMPLICIT(); }
yy118: yych = *++YYCURSOR;
goto yy109;
yy119: yych = *++YYCURSOR;
yy120:
-#line 495
+#line 496
{ eat_comments( parser );
RETURN_IMPLICIT();
}
@@ -1475,7 +1477,7 @@ yy125: YYCURSOR = YYMARKER;
}
yy126: yych = *++YYCURSOR;
yy127:
-#line 481
+#line 482
{ RETURN_IMPLICIT(); }
yy128: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -1506,7 +1508,7 @@ yy133: ++YYCURSOR;
default: goto yy125;
}
}
-#line 507
+#line 508
}
@@ -1538,7 +1540,7 @@ yy136: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy147;
yy137:
-#line 521
+#line 522
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1580,7 +1582,7 @@ yy138: yych = *++YYCURSOR;
default: goto yy139;
}
yy139:
-#line 575
+#line 576
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto SingleQuote2;
}
@@ -1590,7 +1592,7 @@ yy140: yych = *++YYCURSOR;
default: goto yy141;
}
yy141:
-#line 561
+#line 562
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1601,7 +1603,7 @@ yy141:
}
n->data.str->ptr = qstr;
n->data.str->len = qidx;
- yylval->nodeData = n;
+ sycklval->nodeData = n;
return PLAIN;
}
yy142: yych = *++YYCURSOR;
@@ -1610,7 +1612,7 @@ yy143: yych = *++YYCURSOR;
goto yy139;
yy144: yych = *++YYCURSOR;
yy145:
-#line 557
+#line 558
{ QUOTECAT(qstr, qcapa, qidx, '\'');
goto SingleQuote2;
}
@@ -1635,7 +1637,7 @@ yy149: YYCURSOR = YYMARKER;
case 0: goto yy137;
}
}
-#line 579
+#line 580
}
@@ -1672,7 +1674,7 @@ yy152: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy174;
yy153:
-#line 597
+#line 598
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1718,7 +1720,7 @@ yy154: yych = *++YYCURSOR;
default: goto yy155;
}
yy155:
-#line 681
+#line 682
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto DoubleQuote2;
}
@@ -1736,7 +1738,7 @@ yy156: yyaccept = 1;
}
yy157: yych = *++YYCURSOR;
yy158:
-#line 667
+#line 668
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1747,7 +1749,7 @@ yy158:
}
n->data.str->ptr = qstr;
n->data.str->len = qidx;
- yylval->nodeData = n;
+ sycklval->nodeData = n;
return PLAIN;
}
yy159: yych = *++YYCURSOR;
@@ -1770,7 +1772,7 @@ yy163: YYCURSOR = YYMARKER;
}
yy164: yych = *++YYCURSOR;
yy165:
-#line 662
+#line 663
{ keep_nl = 0;
YYCURSOR--;
goto DoubleQuote2;
@@ -1806,7 +1808,7 @@ yy167: yych = *++YYCURSOR;
}
yy168: yych = *++YYCURSOR;
yy169:
-#line 637
+#line 638
{ char ch = *( YYCURSOR - 1 );
switch ( ch )
{
@@ -1848,7 +1850,7 @@ yy170: yych = *++YYCURSOR;
}
yy171: yych = *++YYCURSOR;
yy172:
-#line 653
+#line 654
{ long ch;
char *chr_text = syck_strndup( YYTOKTMP, 4 );
chr_text[0] = '0';
@@ -1874,7 +1876,7 @@ yy175: ++YYCURSOR;
default: goto yy163;
}
}
-#line 685
+#line 686
}
@@ -1909,7 +1911,7 @@ yy178: YYCURSOR = YYMARKER;
}
yy179: yych = *++YYCURSOR;
yy180:
-#line 699
+#line 700
{ SyckLevel *lvl;
YYCURSOR = YYTOKTMP;
if ( YYCURSOR == YYTOKEN + 1 )
@@ -1925,10 +1927,10 @@ yy180:
*/
if ( *qstr == '^' )
{
- yylval->name = S_ALLOC_N( char, qidx + strlen( lvl->domain ) );
- yylval->name[0] = '\0';
- strcat( yylval->name, lvl->domain );
- strncat( yylval->name, qstr + 1, qidx - 1 );
+ 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
@@ -1945,15 +1947,15 @@ yy180:
{
free( lvl->domain );
lvl->domain = syck_strndup( qstr, carat - qstr );
- yylval->name = S_ALLOC_N( char, ( qend - carat ) + strlen( lvl->domain ) );
- yylval->name[0] = '\0';
- strcat( yylval->name, lvl->domain );
- strncat( yylval->name, carat + 1, ( qend - carat ) - 1 );
+ 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
{
- yylval->name = qstr;
+ sycklval->name = qstr;
}
}
@@ -1967,7 +1969,7 @@ yy182: yych = *++YYCURSOR;
default: goto yy183;
}
yy183:
-#line 761
+#line 762
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto TransferMethod2;
}
@@ -2029,7 +2031,7 @@ yy187: yych = *++YYCURSOR;
}
yy188: yych = *++YYCURSOR;
yy189:
-#line 752
+#line 753
{ long ch;
char *chr_text = syck_strndup( YYTOKTMP, 4 );
chr_text[0] = '0';
@@ -2048,13 +2050,12 @@ yy192: switch(yych){
default: goto yy180;
}
}
-#line 766
+#line 767
}
ScalarBlock:
{
- int keep_nl = 1;
int qidx = 0;
int qcapa = 100;
char *qstr = S_ALLOC_N( char, qcapa );
@@ -2239,6 +2240,8 @@ yy207: YYCURSOR = YYMARKER;
}
+ return 0;
+
}
void
@@ -2266,9 +2269,8 @@ yy208:
}
yy210: yych = *++YYCURSOR;
yy211:
-#line 921
- { SyckLevel *lvl = CURRENT_LEVEL();
- YYCURSOR = tok;
+#line 923
+ { YYCURSOR = tok;
return;
}
yy212: yyaccept = 0;
@@ -2280,7 +2282,7 @@ yy213: yych = *++YYCURSOR;
default: goto yy214;
}
yy214:
-#line 926
+#line 927
{ goto Comment;
}
yy215: yych = *++YYCURSOR;
@@ -2306,7 +2308,7 @@ yy219: YYCURSOR = YYMARKER;
case 0: goto yy211;
}
}
-#line 929
+#line 930
}
@@ -2326,13 +2328,13 @@ is_newline( char *ptr )
}
int
-yywrap()
+syckwrap()
{
return 1;
}
void
-yyerror( char *msg )
+syckerror( char *msg )
{
if ( syck_parser_ptr->error_handler == NULL )
syck_parser_ptr->error_handler = syck_default_error_handler;