1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
why 2003-05-15 21:46:47 +00:00
parent d8bd0ea32e
commit c601cf5318
6 changed files with 197 additions and 172 deletions

View file

@ -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;