summaryrefslogtreecommitdiff
path: root/ext/syck/syck.c
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-15 21:46:47 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-15 21:46:47 +0000
commitc601cf5318c035460250284057a62b7eddcb79fc (patch)
tree65ef3ad8b83ecd970f50ff2c9dc63ed354a0ee33 /ext/syck/syck.c
parentd8bd0ea32ed5952ea4052d48a1142f27e5c1af74 (diff)
* lib/gram.c: fixes to one-line documents and end of stream documents.
* lib/syck.c, lib/syck.h: add root_on_error to parser struct, specifying the symbol to be returned on a parse error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/syck/syck.c')
-rw-r--r--ext/syck/syck.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/syck/syck.c b/ext/syck/syck.c
index 683f4c89994..36e95fd80ae 100644
--- a/ext/syck/syck.c
+++ b/ext/syck/syck.c
@@ -120,8 +120,8 @@ syck_parser_reset_levels( SyckParser *p )
p->lvl_idx = 1;
p->levels[0].spaces = -1;
p->levels[0].domain = syck_strndup( "", 0 );
- p->levels[0].status = syck_lvl_header;
}
+ p->levels[0].status = syck_lvl_header;
}
void
@@ -130,6 +130,7 @@ 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';
@@ -140,12 +141,20 @@ syck_parser_reset_cursor( SyckParser *p )
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;
}
+void
+syck_parser_set_root_on_error( SyckParser *p, SYMID roer )
+{
+ p->root_on_error = roer;
+}
+
/*
* Allocate the parser
*/
@@ -455,7 +464,6 @@ syck_parse( SyckParser *p )
ASSERT( p != NULL );
- p->root = 0;
syck_parser_reset_levels( p );
yyparse( p );
return p->root;