Ruby 1.9.3p327(2012-11-10revision37606)
|
00001 /* Generated by re2c 0.9.10 on Tue Sep 20 17:46:17 2005 */ 00002 #line 1 "token.re" 00003 /* 00004 * token.re 00005 * 00006 * $Author: naruse $ 00007 * 00008 * Copyright (C) 2003 why the lucky stiff 00009 */ 00010 #include "ruby/ruby.h" 00011 #include "syck.h" 00012 #include "gram.h" 00013 00014 /* 00015 * Allocate quoted strings in chunks 00016 */ 00017 #define QUOTELEN 1024 00018 00019 /* 00020 * They do my bidding... 00021 */ 00022 #define YYCTYPE char 00023 #define YYCURSOR parser->cursor 00024 #define YYMARKER parser->marker 00025 #define YYLIMIT parser->limit 00026 #define YYTOKEN parser->token 00027 #define YYTOKTMP parser->toktmp 00028 #define YYLINEPTR parser->lineptr 00029 #define YYLINECTPTR parser->linectptr 00030 #define YYLINE parser->linect 00031 #define YYFILL(n) syck_parser_read(parser) 00032 00033 /* 00034 * Repositions the cursor at `n' offset from the token start. 00035 * Only works in `Header' and `Document' sections. 00036 */ 00037 #define YYPOS(n) YYCURSOR = YYTOKEN + n 00038 00039 /* 00040 * Track line numbers 00041 */ 00042 #define NEWLINE(ptr) YYLINEPTR = ptr + newline_len(ptr); if ( YYLINEPTR > YYLINECTPTR ) { YYLINE++; YYLINECTPTR = YYLINEPTR; } 00043 00044 /* 00045 * I like seeing the level operations as macros... 00046 */ 00047 #define ADD_LEVEL(len, status) syck_parser_add_level( parser, len, status ) 00048 #define POP_LEVEL() syck_parser_pop_level( parser ) 00049 #define CURRENT_LEVEL() syck_parser_current_level( parser ) 00050 00051 /* 00052 * Force a token next time around sycklex() 00053 */ 00054 #define FORCE_NEXT_TOKEN(tok) parser->force_token = tok; 00055 00056 /* 00057 * Nice little macro to ensure we're YAML_IOPENed to the current level. 00058 * * Only use this macro in the "Document" section * 00059 */ 00060 #define ENSURE_YAML_IOPEN(last_lvl, to_len, reset) \ 00061 if ( last_lvl->spaces < to_len ) \ 00062 { \ 00063 if ( last_lvl->status == syck_lvl_iseq || last_lvl->status == syck_lvl_imap ) \ 00064 { \ 00065 goto Document; \ 00066 } \ 00067 else \ 00068 { \ 00069 ADD_LEVEL( to_len, syck_lvl_doc ); \ 00070 if ( reset == 1 ) YYPOS(0); \ 00071 return YAML_IOPEN; \ 00072 } \ 00073 } 00074 00075 /* 00076 * Nice little macro to ensure closure of levels. 00077 * * Only use this macro in the "Document" section * 00078 */ 00079 #define ENSURE_YAML_IEND(last_lvl, to_len) \ 00080 if ( last_lvl->spaces > to_len ) \ 00081 { \ 00082 syck_parser_pop_level( parser ); \ 00083 YYPOS(0); \ 00084 return YAML_IEND; \ 00085 } 00086 00087 /* 00088 * Concatenates quoted string items and manages allocation 00089 * to the quoted string 00090 */ 00091 #define QUOTECAT(s, c, i, l) \ 00092 { \ 00093 if ( i + 1 >= c ) \ 00094 { \ 00095 c += QUOTELEN; \ 00096 S_REALLOC_N( s, char, c ); \ 00097 } \ 00098 s[i++] = l; \ 00099 s[i] = '\0'; \ 00100 } 00101 00102 #define QUOTECATS(s, c, i, cs, cl) \ 00103 { \ 00104 while ( i + cl >= c ) \ 00105 { \ 00106 c += QUOTELEN; \ 00107 S_REALLOC_N( s, char, c ); \ 00108 } \ 00109 S_MEMCPY( s + i, cs, char, cl ); \ 00110 i += cl; \ 00111 s[i] = '\0'; \ 00112 } 00113 00114 /* 00115 * Tags a plain scalar with a transfer method 00116 * * Use only in "Plain" section * 00117 */ 00118 #define RETURN_IMPLICIT() \ 00119 { \ 00120 SyckNode *n = syck_alloc_str(); \ 00121 YYCURSOR = YYTOKEN; \ 00122 n->data.str->ptr = qstr; \ 00123 n->data.str->len = qidx; \ 00124 n->data.str->style = scalar_plain; \ 00125 sycklval->nodeData = n; \ 00126 if ( parser->implicit_typing == 1 ) \ 00127 { \ 00128 try_tag_implicit( sycklval->nodeData, parser->taguri_expansion ); \ 00129 } \ 00130 return YAML_PLAIN; \ 00131 } 00132 00133 /* concat the inline characters to the plain scalar */ 00134 #define PLAIN_NOT_INL() \ 00135 if ( *(YYCURSOR - 1) == ' ' || is_newline( YYCURSOR - 1 ) ) \ 00136 { \ 00137 YYCURSOR--; \ 00138 } \ 00139 QUOTECATS(qstr, qcapa, qidx, YYTOKEN, YYCURSOR - YYTOKEN); \ 00140 goto Plain2; 00141 00142 /* trim spaces off the end in case of indent */ 00143 #define PLAIN_IS_INL() \ 00144 char *walker = qstr + qidx - 1; \ 00145 while ( walker > qstr && ( *walker == '\n' || *walker == ' ' || *walker == '\t' ) ) \ 00146 { \ 00147 qidx--; \ 00148 walker[0] = '\0'; \ 00149 walker--; \ 00150 } 00151 00152 /* 00153 * Keep or chomp block? 00154 * * Use only in "ScalarBlock" section * 00155 */ 00156 #define RETURN_YAML_BLOCK() \ 00157 { \ 00158 SyckNode *n = syck_alloc_str(); \ 00159 if ( ((SyckParser *)parser)->taguri_expansion == 1 ) \ 00160 { \ 00161 n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 ); \ 00162 } \ 00163 else \ 00164 { \ 00165 n->type_id = syck_strndup( "str", 3 ); \ 00166 } \ 00167 n->data.str->ptr = qstr; \ 00168 n->data.str->len = qidx; \ 00169 if ( blockType == BLOCK_LIT ) { \ 00170 n->data.str->style = scalar_literal; \ 00171 } else { \ 00172 n->data.str->style = scalar_fold; \ 00173 } \ 00174 if ( qidx > 0 ) \ 00175 { \ 00176 if ( nlDoWhat != NL_KEEP ) \ 00177 { \ 00178 char *fc = n->data.str->ptr + n->data.str->len - 1; \ 00179 while ( is_newline( fc ) ) fc--; \ 00180 if ( nlDoWhat != NL_CHOMP && fc < n->data.str->ptr + n->data.str->len - 1 ) \ 00181 fc += 1; \ 00182 n->data.str->len = fc - n->data.str->ptr + 1; \ 00183 } \ 00184 } \ 00185 sycklval->nodeData = n; \ 00186 return YAML_BLOCK; \ 00187 } 00188 00189 /* 00190 * Handles newlines, calculates indent 00191 */ 00192 #define GOBBLE_UP_YAML_INDENT( ict, start ) \ 00193 char *indent = start; \ 00194 NEWLINE(indent); \ 00195 while ( indent < YYCURSOR ) \ 00196 { \ 00197 if ( is_newline( ++indent ) ) \ 00198 { \ 00199 NEWLINE(indent); \ 00200 } \ 00201 } \ 00202 ict = 0; \ 00203 if ( *YYCURSOR == '\0' ) \ 00204 { \ 00205 ict = -1; \ 00206 start = YYCURSOR - 1; \ 00207 } \ 00208 else if ( *YYLINEPTR == ' ' ) \ 00209 { \ 00210 ict = (int)(YYCURSOR - YYLINEPTR); \ 00211 } 00212 00213 /* 00214 * If an indent exists at the current level, back up. 00215 */ 00216 #define GET_TRUE_YAML_INDENT(indt_len) \ 00217 { \ 00218 SyckLevel *lvl_deep = CURRENT_LEVEL(); \ 00219 indt_len = lvl_deep->spaces; \ 00220 if ( lvl_deep->status == syck_lvl_seq || ( indt_len == YYCURSOR - YYLINEPTR && lvl_deep->status != syck_lvl_map ) ) \ 00221 { \ 00222 SyckLevel *lvl_over; \ 00223 parser->lvl_idx--; \ 00224 lvl_over = CURRENT_LEVEL(); \ 00225 indt_len = lvl_over->spaces; \ 00226 parser->lvl_idx++; \ 00227 } \ 00228 } 00229 00230 /* 00231 * Argjh! I hate globals! Here for syckerror() only! 00232 */ 00233 SyckParser *syck_parser_ptr = NULL; 00234 00235 /* 00236 * Accessory funcs later in this file. 00237 */ 00238 void eat_comments( SyckParser * ); 00239 char escape_seq( char ); 00240 int is_newline( char *ptr ); 00241 int newline_len( char *ptr ); 00242 int sycklex_yaml_utf8( YYSTYPE *, SyckParser * ); 00243 int sycklex_bytecode_utf8( YYSTYPE *, SyckParser * ); 00244 int syckwrap(); 00245 00246 /* 00247 * My own re-entrant sycklex() using re2c. 00248 * You really get used to the limited regexp. 00249 * It's really nice to not rely on backtracking and such. 00250 */ 00251 int 00252 sycklex( YYSTYPE *sycklval, SyckParser *parser ) 00253 { 00254 switch ( parser->input_type ) 00255 { 00256 case syck_yaml_utf8: 00257 return sycklex_yaml_utf8( sycklval, parser ); 00258 00259 case syck_yaml_utf16: 00260 syckerror( "UTF-16 is not currently supported in Syck.\nPlease contribute code to help this happen!" ); 00261 break; 00262 00263 case syck_yaml_utf32: 00264 syckerror( "UTF-32 is not currently supported in Syck.\nPlease contribute code to help this happen!" ); 00265 break; 00266 00267 case syck_bytecode_utf8: 00268 return sycklex_bytecode_utf8( sycklval, parser ); 00269 } 00270 return YAML_DOCSEP; 00271 } 00272 00273 /* 00274 * Parser for standard YAML [UTF-8] 00275 */ 00276 int 00277 sycklex_yaml_utf8( YYSTYPE *sycklval, SyckParser *parser ) 00278 { 00279 int doc_level = 0; 00280 syck_parser_ptr = parser; 00281 if ( YYCURSOR == NULL ) 00282 { 00283 syck_parser_read( parser ); 00284 } 00285 00286 if ( parser->force_token != 0 ) 00287 { 00288 int t = parser->force_token; 00289 parser->force_token = 0; 00290 return t; 00291 } 00292 00293 #line 315 "token.re" 00294 00295 00296 if ( YYLINEPTR != YYCURSOR ) 00297 { 00298 goto Document; 00299 } 00300 00301 Header: 00302 00303 YYTOKEN = YYCURSOR; 00304 00305 00306 #line 307 "<stdout>" 00307 { 00308 YYCTYPE yych; 00309 unsigned int yyaccept; 00310 goto yy0; 00311 ++YYCURSOR; 00312 yy0: 00313 if((YYLIMIT - YYCURSOR) < 5) YYFILL(5); 00314 yych = *YYCURSOR; 00315 switch(yych){ 00316 case 0x00: goto yy7; 00317 case 0x09: case ' ': goto yy12; 00318 case 0x0A: goto yy9; 00319 case 0x0D: goto yy11; 00320 case '#': goto yy5; 00321 case '-': goto yy2; 00322 case '.': goto yy4; 00323 default: goto yy14; 00324 } 00325 yy2: yyaccept = 0; 00326 yych = *(YYMARKER = ++YYCURSOR); 00327 switch(yych){ 00328 case '-': goto yy28; 00329 default: goto yy3; 00330 } 00331 yy3: 00332 #line 374 "token.re" 00333 { YYPOS(0); 00334 goto Document; 00335 } 00336 #line 337 "<stdout>" 00337 yy4: yyaccept = 0; 00338 yych = *(YYMARKER = ++YYCURSOR); 00339 switch(yych){ 00340 case '.': goto yy21; 00341 default: goto yy3; 00342 } 00343 yy5: ++YYCURSOR; 00344 goto yy6; 00345 yy6: 00346 #line 356 "token.re" 00347 { eat_comments( parser ); 00348 goto Header; 00349 } 00350 #line 351 "<stdout>" 00351 yy7: ++YYCURSOR; 00352 goto yy8; 00353 yy8: 00354 #line 360 "token.re" 00355 { SyckLevel *lvl = CURRENT_LEVEL(); 00356 ENSURE_YAML_IEND(lvl, -1); 00357 YYPOS(0); 00358 return 0; 00359 } 00360 #line 361 "<stdout>" 00361 yy9: yyaccept = 1; 00362 yych = *(YYMARKER = ++YYCURSOR); 00363 goto yy18; 00364 yy10: 00365 #line 366 "token.re" 00366 { GOBBLE_UP_YAML_INDENT( doc_level, YYTOKEN ); 00367 goto Header; 00368 } 00369 #line 370 "<stdout>" 00370 yy11: yych = *++YYCURSOR; 00371 switch(yych){ 00372 case 0x0A: goto yy17; 00373 default: goto yy3; 00374 } 00375 yy12: ++YYCURSOR; 00376 yych = *YYCURSOR; 00377 goto yy16; 00378 yy13: 00379 #line 370 "token.re" 00380 { doc_level = (int)(YYCURSOR - YYLINEPTR); 00381 goto Header; 00382 } 00383 #line 384 "<stdout>" 00384 yy14: yych = *++YYCURSOR; 00385 goto yy3; 00386 yy15: ++YYCURSOR; 00387 if(YYLIMIT == YYCURSOR) YYFILL(1); 00388 yych = *YYCURSOR; 00389 goto yy16; 00390 yy16: switch(yych){ 00391 case 0x09: case ' ': goto yy15; 00392 default: goto yy13; 00393 } 00394 yy17: yyaccept = 1; 00395 YYMARKER = ++YYCURSOR; 00396 if(YYLIMIT == YYCURSOR) YYFILL(1); 00397 yych = *YYCURSOR; 00398 goto yy18; 00399 yy18: switch(yych){ 00400 case 0x0A: case ' ': goto yy17; 00401 case 0x0D: goto yy19; 00402 default: goto yy10; 00403 } 00404 yy19: ++YYCURSOR; 00405 if(YYLIMIT == YYCURSOR) YYFILL(1); 00406 yych = *YYCURSOR; 00407 switch(yych){ 00408 case 0x0A: goto yy17; 00409 default: goto yy20; 00410 } 00411 yy20: YYCURSOR = YYMARKER; 00412 switch(yyaccept){ 00413 case 1: goto yy10; 00414 case 0: goto yy3; 00415 } 00416 yy21: yych = *++YYCURSOR; 00417 switch(yych){ 00418 case '.': goto yy22; 00419 default: goto yy20; 00420 } 00421 yy22: yych = *++YYCURSOR; 00422 switch(yych){ 00423 case 0x0A: goto yy23; 00424 case 0x0D: goto yy27; 00425 case ' ': goto yy25; 00426 default: goto yy20; 00427 } 00428 yy23: ++YYCURSOR; 00429 goto yy24; 00430 yy24: 00431 #line 342 "token.re" 00432 { SyckLevel *lvl = CURRENT_LEVEL(); 00433 if ( lvl->status == syck_lvl_header ) 00434 { 00435 goto Header; 00436 } 00437 else 00438 { 00439 ENSURE_YAML_IEND(lvl, -1); 00440 YYPOS(0); 00441 return 0; 00442 } 00443 return 0; 00444 } 00445 #line 446 "<stdout>" 00446 yy25: ++YYCURSOR; 00447 if(YYLIMIT == YYCURSOR) YYFILL(1); 00448 yych = *YYCURSOR; 00449 goto yy26; 00450 yy26: switch(yych){ 00451 case ' ': goto yy25; 00452 default: goto yy24; 00453 } 00454 yy27: yych = *++YYCURSOR; 00455 switch(yych){ 00456 case 0x0A: goto yy23; 00457 default: goto yy20; 00458 } 00459 yy28: yych = *++YYCURSOR; 00460 switch(yych){ 00461 case '-': goto yy29; 00462 default: goto yy20; 00463 } 00464 yy29: yych = *++YYCURSOR; 00465 switch(yych){ 00466 case 0x0A: goto yy30; 00467 case 0x0D: goto yy34; 00468 case ' ': goto yy32; 00469 default: goto yy20; 00470 } 00471 yy30: ++YYCURSOR; 00472 goto yy31; 00473 yy31: 00474 #line 328 "token.re" 00475 { SyckLevel *lvl = CURRENT_LEVEL(); 00476 if ( lvl->status == syck_lvl_header ) 00477 { 00478 YYPOS(3); 00479 goto Directive; 00480 } 00481 else 00482 { 00483 ENSURE_YAML_IEND(lvl, -1); 00484 YYPOS(0); 00485 return 0; 00486 } 00487 } 00488 #line 489 "<stdout>" 00489 yy32: ++YYCURSOR; 00490 if(YYLIMIT == YYCURSOR) YYFILL(1); 00491 yych = *YYCURSOR; 00492 goto yy33; 00493 yy33: switch(yych){ 00494 case ' ': goto yy32; 00495 default: goto yy31; 00496 } 00497 yy34: ++YYCURSOR; 00498 switch((yych = *YYCURSOR)) { 00499 case 0x0A: goto yy30; 00500 default: goto yy20; 00501 } 00502 } 00503 #line 378 "token.re" 00504 00505 00506 Document: 00507 { 00508 SyckLevel *lvl = CURRENT_LEVEL(); 00509 if ( lvl->status == syck_lvl_header ) 00510 { 00511 lvl->status = syck_lvl_doc; 00512 } 00513 00514 YYTOKEN = YYCURSOR; 00515 00516 00517 #line 518 "<stdout>" 00518 { 00519 YYCTYPE yych; 00520 unsigned int yyaccept; 00521 goto yy35; 00522 ++YYCURSOR; 00523 yy35: 00524 if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); 00525 yych = *YYCURSOR; 00526 switch(yych){ 00527 case 0x00: goto yy62; 00528 case 0x09: case ' ': goto yy60; 00529 case 0x0A: goto yy37; 00530 case 0x0D: goto yy39; 00531 case '!': goto yy51; 00532 case '"': goto yy55; 00533 case '#': goto yy58; 00534 case '&': goto yy49; 00535 case '\'': goto yy53; 00536 case '*': goto yy50; 00537 case ',': case ':': goto yy47; 00538 case '-': case '?': goto yy48; 00539 case '>': case '|': goto yy57; 00540 case '[': goto yy41; 00541 case ']': case '}': goto yy45; 00542 case '{': goto yy43; 00543 default: goto yy64; 00544 } 00545 yy37: yyaccept = 0; 00546 yych = *(YYMARKER = ++YYCURSOR); 00547 goto yy92; 00548 yy38: 00549 #line 392 "token.re" 00550 { /* Isolate spaces */ 00551 int indt_len; 00552 GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN ); 00553 lvl = CURRENT_LEVEL(); 00554 doc_level = 0; 00555 00556 /* XXX: Comment lookahead */ 00557 if ( *YYCURSOR == '#' ) 00558 { 00559 goto Document; 00560 } 00561 00562 /* Ignore indentation inside inlines */ 00563 if ( lvl->status == syck_lvl_iseq || lvl->status == syck_lvl_imap ) 00564 { 00565 goto Document; 00566 } 00567 00568 /* Check for open indent */ 00569 ENSURE_YAML_IEND(lvl, indt_len); 00570 ENSURE_YAML_IOPEN(lvl, indt_len, 0); 00571 if ( indt_len == -1 ) 00572 { 00573 return 0; 00574 } 00575 return YAML_INDENT; 00576 } 00577 #line 578 "<stdout>" 00578 yy39: ++YYCURSOR; 00579 switch((yych = *YYCURSOR)) { 00580 case 0x0A: goto yy91; 00581 default: goto yy40; 00582 } 00583 yy40: 00584 #line 497 "token.re" 00585 { ENSURE_YAML_IOPEN(lvl, doc_level, 1); 00586 goto Plain; 00587 } 00588 #line 589 "<stdout>" 00589 yy41: ++YYCURSOR; 00590 goto yy42; 00591 yy42: 00592 #line 420 "token.re" 00593 { ENSURE_YAML_IOPEN(lvl, doc_level, 1); 00594 lvl = CURRENT_LEVEL(); 00595 ADD_LEVEL(lvl->spaces + 1, syck_lvl_iseq); 00596 return YYTOKEN[0]; 00597 } 00598 #line 599 "<stdout>" 00599 yy43: ++YYCURSOR; 00600 goto yy44; 00601 yy44: 00602 #line 426 "token.re" 00603 { ENSURE_YAML_IOPEN(lvl, doc_level, 1); 00604 lvl = CURRENT_LEVEL(); 00605 ADD_LEVEL(lvl->spaces + 1, syck_lvl_imap); 00606 return YYTOKEN[0]; 00607 } 00608 #line 609 "<stdout>" 00609 yy45: ++YYCURSOR; 00610 goto yy46; 00611 yy46: 00612 #line 432 "token.re" 00613 { POP_LEVEL(); 00614 return YYTOKEN[0]; 00615 } 00616 #line 617 "<stdout>" 00617 yy47: yyaccept = 1; 00618 yych = *(YYMARKER = ++YYCURSOR); 00619 switch(yych){ 00620 case 0x0A: goto yy86; 00621 case 0x0D: goto yy90; 00622 case ' ': goto yy88; 00623 default: goto yy40; 00624 } 00625 yy48: yyaccept = 1; 00626 yych = *(YYMARKER = ++YYCURSOR); 00627 switch(yych){ 00628 case 0x0A: goto yy81; 00629 case 0x0D: goto yy85; 00630 case ' ': goto yy83; 00631 default: goto yy40; 00632 } 00633 yy49: yych = *++YYCURSOR; 00634 switch(yych){ 00635 case '-': case '0': 00636 case '1': 00637 case '2': 00638 case '3': 00639 case '4': 00640 case '5': 00641 case '6': 00642 case '7': 00643 case '8': 00644 case '9': case 'A': 00645 case 'B': 00646 case 'C': 00647 case 'D': 00648 case 'E': 00649 case 'F': 00650 case 'G': 00651 case 'H': 00652 case 'I': 00653 case 'J': 00654 case 'K': 00655 case 'L': 00656 case 'M': 00657 case 'N': 00658 case 'O': 00659 case 'P': 00660 case 'Q': 00661 case 'R': 00662 case 'S': 00663 case 'T': 00664 case 'U': 00665 case 'V': 00666 case 'W': 00667 case 'X': 00668 case 'Y': 00669 case 'Z': case '_': case 'a': 00670 case 'b': 00671 case 'c': 00672 case 'd': 00673 case 'e': 00674 case 'f': 00675 case 'g': 00676 case 'h': 00677 case 'i': 00678 case 'j': 00679 case 'k': 00680 case 'l': 00681 case 'm': 00682 case 'n': 00683 case 'o': 00684 case 'p': 00685 case 'q': 00686 case 'r': 00687 case 's': 00688 case 't': 00689 case 'u': 00690 case 'v': 00691 case 'w': 00692 case 'x': 00693 case 'y': 00694 case 'z': goto yy78; 00695 default: goto yy40; 00696 } 00697 yy50: yych = *++YYCURSOR; 00698 switch(yych){ 00699 case '-': case '0': 00700 case '1': 00701 case '2': 00702 case '3': 00703 case '4': 00704 case '5': 00705 case '6': 00706 case '7': 00707 case '8': 00708 case '9': case 'A': 00709 case 'B': 00710 case 'C': 00711 case 'D': 00712 case 'E': 00713 case 'F': 00714 case 'G': 00715 case 'H': 00716 case 'I': 00717 case 'J': 00718 case 'K': 00719 case 'L': 00720 case 'M': 00721 case 'N': 00722 case 'O': 00723 case 'P': 00724 case 'Q': 00725 case 'R': 00726 case 'S': 00727 case 'T': 00728 case 'U': 00729 case 'V': 00730 case 'W': 00731 case 'X': 00732 case 'Y': 00733 case 'Z': case '_': case 'a': 00734 case 'b': 00735 case 'c': 00736 case 'd': 00737 case 'e': 00738 case 'f': 00739 case 'g': 00740 case 'h': 00741 case 'i': 00742 case 'j': 00743 case 'k': 00744 case 'l': 00745 case 'm': 00746 case 'n': 00747 case 'o': 00748 case 'p': 00749 case 'q': 00750 case 'r': 00751 case 's': 00752 case 't': 00753 case 'u': 00754 case 'v': 00755 case 'w': 00756 case 'x': 00757 case 'y': 00758 case 'z': goto yy75; 00759 default: goto yy40; 00760 } 00761 yy51: ++YYCURSOR; 00762 goto yy52; 00763 yy52: 00764 #line 471 "token.re" 00765 { goto TransferMethod; } 00766 #line 767 "<stdout>" 00767 yy53: ++YYCURSOR; 00768 goto yy54; 00769 yy54: 00770 #line 473 "token.re" 00771 { ENSURE_YAML_IOPEN(lvl, doc_level, 1); 00772 goto SingleQuote; } 00773 #line 774 "<stdout>" 00774 yy55: ++YYCURSOR; 00775 goto yy56; 00776 yy56: 00777 #line 476 "token.re" 00778 { ENSURE_YAML_IOPEN(lvl, doc_level, 1); 00779 goto DoubleQuote; } 00780 #line 781 "<stdout>" 00781 yy57: yyaccept = 1; 00782 yych = *(YYMARKER = ++YYCURSOR); 00783 switch(yych){ 00784 case 0x0A: goto yy70; 00785 case 0x0D: goto yy74; 00786 case ' ': goto yy72; 00787 case '+': case '-': case '0': 00788 case '1': 00789 case '2': 00790 case '3': 00791 case '4': 00792 case '5': 00793 case '6': 00794 case '7': 00795 case '8': 00796 case '9': goto yy67; 00797 default: goto yy40; 00798 } 00799 yy58: ++YYCURSOR; 00800 goto yy59; 00801 yy59: 00802 #line 486 "token.re" 00803 { eat_comments( parser ); 00804 goto Document; 00805 } 00806 #line 807 "<stdout>" 00807 yy60: ++YYCURSOR; 00808 yych = *YYCURSOR; 00809 goto yy66; 00810 yy61: 00811 #line 490 "token.re" 00812 { goto Document; } 00813 #line 814 "<stdout>" 00814 yy62: ++YYCURSOR; 00815 goto yy63; 00816 yy63: 00817 #line 492 "token.re" 00818 { ENSURE_YAML_IEND(lvl, -1); 00819 YYPOS(0); 00820 return 0; 00821 } 00822 #line 823 "<stdout>" 00823 yy64: yych = *++YYCURSOR; 00824 goto yy40; 00825 yy65: ++YYCURSOR; 00826 if(YYLIMIT == YYCURSOR) YYFILL(1); 00827 yych = *YYCURSOR; 00828 goto yy66; 00829 yy66: switch(yych){ 00830 case 0x09: case ' ': goto yy65; 00831 default: goto yy61; 00832 } 00833 yy67: ++YYCURSOR; 00834 if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); 00835 yych = *YYCURSOR; 00836 goto yy68; 00837 yy68: switch(yych){ 00838 case 0x0A: goto yy70; 00839 case 0x0D: goto yy74; 00840 case ' ': goto yy72; 00841 case '+': case '-': case '0': 00842 case '1': 00843 case '2': 00844 case '3': 00845 case '4': 00846 case '5': 00847 case '6': 00848 case '7': 00849 case '8': 00850 case '9': goto yy67; 00851 default: goto yy69; 00852 } 00853 yy69: YYCURSOR = YYMARKER; 00854 switch(yyaccept){ 00855 case 0: goto yy38; 00856 case 1: goto yy40; 00857 } 00858 yy70: ++YYCURSOR; 00859 goto yy71; 00860 yy71: 00861 #line 479 "token.re" 00862 { if ( is_newline( YYCURSOR - 1 ) ) 00863 { 00864 YYCURSOR--; 00865 } 00866 goto ScalarBlock; 00867 } 00868 #line 869 "<stdout>" 00869 yy72: ++YYCURSOR; 00870 if(YYLIMIT == YYCURSOR) YYFILL(1); 00871 yych = *YYCURSOR; 00872 goto yy73; 00873 yy73: switch(yych){ 00874 case ' ': goto yy72; 00875 default: goto yy71; 00876 } 00877 yy74: yych = *++YYCURSOR; 00878 switch(yych){ 00879 case 0x0A: goto yy70; 00880 default: goto yy69; 00881 } 00882 yy75: ++YYCURSOR; 00883 if(YYLIMIT == YYCURSOR) YYFILL(1); 00884 yych = *YYCURSOR; 00885 goto yy76; 00886 yy76: switch(yych){ 00887 case '-': case '0': 00888 case '1': 00889 case '2': 00890 case '3': 00891 case '4': 00892 case '5': 00893 case '6': 00894 case '7': 00895 case '8': 00896 case '9': case 'A': 00897 case 'B': 00898 case 'C': 00899 case 'D': 00900 case 'E': 00901 case 'F': 00902 case 'G': 00903 case 'H': 00904 case 'I': 00905 case 'J': 00906 case 'K': 00907 case 'L': 00908 case 'M': 00909 case 'N': 00910 case 'O': 00911 case 'P': 00912 case 'Q': 00913 case 'R': 00914 case 'S': 00915 case 'T': 00916 case 'U': 00917 case 'V': 00918 case 'W': 00919 case 'X': 00920 case 'Y': 00921 case 'Z': case '_': case 'a': 00922 case 'b': 00923 case 'c': 00924 case 'd': 00925 case 'e': 00926 case 'f': 00927 case 'g': 00928 case 'h': 00929 case 'i': 00930 case 'j': 00931 case 'k': 00932 case 'l': 00933 case 'm': 00934 case 'n': 00935 case 'o': 00936 case 'p': 00937 case 'q': 00938 case 'r': 00939 case 's': 00940 case 't': 00941 case 'u': 00942 case 'v': 00943 case 'w': 00944 case 'x': 00945 case 'y': 00946 case 'z': goto yy75; 00947 default: goto yy77; 00948 } 00949 yy77: 00950 #line 466 "token.re" 00951 { ENSURE_YAML_IOPEN(lvl, doc_level, 1); 00952 sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 ); 00953 return YAML_ALIAS; 00954 } 00955 #line 956 "<stdout>" 00956 yy78: ++YYCURSOR; 00957 if(YYLIMIT == YYCURSOR) YYFILL(1); 00958 yych = *YYCURSOR; 00959 goto yy79; 00960 yy79: switch(yych){ 00961 case '-': case '0': 00962 case '1': 00963 case '2': 00964 case '3': 00965 case '4': 00966 case '5': 00967 case '6': 00968 case '7': 00969 case '8': 00970 case '9': case 'A': 00971 case 'B': 00972 case 'C': 00973 case 'D': 00974 case 'E': 00975 case 'F': 00976 case 'G': 00977 case 'H': 00978 case 'I': 00979 case 'J': 00980 case 'K': 00981 case 'L': 00982 case 'M': 00983 case 'N': 00984 case 'O': 00985 case 'P': 00986 case 'Q': 00987 case 'R': 00988 case 'S': 00989 case 'T': 00990 case 'U': 00991 case 'V': 00992 case 'W': 00993 case 'X': 00994 case 'Y': 00995 case 'Z': case '_': case 'a': 00996 case 'b': 00997 case 'c': 00998 case 'd': 00999 case 'e': 01000 case 'f': 01001 case 'g': 01002 case 'h': 01003 case 'i': 01004 case 'j': 01005 case 'k': 01006 case 'l': 01007 case 'm': 01008 case 'n': 01009 case 'o': 01010 case 'p': 01011 case 'q': 01012 case 'r': 01013 case 's': 01014 case 't': 01015 case 'u': 01016 case 'v': 01017 case 'w': 01018 case 'x': 01019 case 'y': 01020 case 'z': goto yy78; 01021 default: goto yy80; 01022 } 01023 yy80: 01024 #line 455 "token.re" 01025 { sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 ); 01026 01027 /* 01028 * Remove previous anchors of the same name. Since the parser will likely 01029 * construct deeper nodes first, we want those nodes to be placed in the 01030 * queue for matching at a higher level of indentation. 01031 */ 01032 syck_hdlr_remove_anchor(parser, sycklval->name); 01033 return YAML_ANCHOR; 01034 } 01035 #line 1036 "<stdout>" 01036 yy81: ++YYCURSOR; 01037 goto yy82; 01038 yy82: 01039 #line 441 "token.re" 01040 { ENSURE_YAML_IOPEN(lvl, (int)(YYTOKEN - YYLINEPTR), 1); 01041 FORCE_NEXT_TOKEN(YAML_IOPEN); 01042 if ( *YYCURSOR == '#' || is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) ) 01043 { 01044 YYCURSOR--; 01045 ADD_LEVEL((int)((YYTOKEN + 1) - YYLINEPTR), syck_lvl_seq); 01046 } 01047 else /* spaces followed by content uses the space as indentation */ 01048 { 01049 ADD_LEVEL((int)(YYCURSOR - YYLINEPTR), syck_lvl_seq); 01050 } 01051 return YYTOKEN[0]; 01052 } 01053 #line 1054 "<stdout>" 01054 yy83: ++YYCURSOR; 01055 if(YYLIMIT == YYCURSOR) YYFILL(1); 01056 yych = *YYCURSOR; 01057 goto yy84; 01058 yy84: switch(yych){ 01059 case ' ': goto yy83; 01060 default: goto yy82; 01061 } 01062 yy85: yych = *++YYCURSOR; 01063 switch(yych){ 01064 case 0x0A: goto yy81; 01065 default: goto yy69; 01066 } 01067 yy86: ++YYCURSOR; 01068 goto yy87; 01069 yy87: 01070 #line 436 "token.re" 01071 { if ( *YYTOKEN == ':' && lvl->status != syck_lvl_imap ) lvl->status = syck_lvl_map; 01072 YYPOS(1); 01073 return YYTOKEN[0]; 01074 } 01075 #line 1076 "<stdout>" 01076 yy88: ++YYCURSOR; 01077 if(YYLIMIT == YYCURSOR) YYFILL(1); 01078 yych = *YYCURSOR; 01079 goto yy89; 01080 yy89: switch(yych){ 01081 case ' ': goto yy88; 01082 default: goto yy87; 01083 } 01084 yy90: yych = *++YYCURSOR; 01085 switch(yych){ 01086 case 0x0A: goto yy86; 01087 default: goto yy69; 01088 } 01089 yy91: yyaccept = 0; 01090 YYMARKER = ++YYCURSOR; 01091 if(YYLIMIT == YYCURSOR) YYFILL(1); 01092 yych = *YYCURSOR; 01093 goto yy92; 01094 yy92: switch(yych){ 01095 case 0x0A: case ' ': goto yy91; 01096 case 0x0D: goto yy93; 01097 default: goto yy38; 01098 } 01099 yy93: ++YYCURSOR; 01100 if(YYLIMIT == YYCURSOR) YYFILL(1); 01101 yych = *YYCURSOR; 01102 switch(yych){ 01103 case 0x0A: goto yy91; 01104 default: goto yy69; 01105 } 01106 } 01107 #line 501 "token.re" 01108 01109 } 01110 01111 Directive: 01112 { 01113 YYTOKTMP = YYCURSOR; 01114 01115 01116 #line 1117 "<stdout>" 01117 { 01118 YYCTYPE yych; 01119 unsigned int yyaccept = 0; 01120 goto yy94; 01121 ++YYCURSOR; 01122 yy94: 01123 if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); 01124 yych = *YYCURSOR; 01125 switch(yych){ 01126 case 0x00: goto yy96; 01127 case 0x09: case ' ': goto yy99; 01128 case '%': goto yy97; 01129 default: goto yy101; 01130 } 01131 yy96: YYCURSOR = YYMARKER; 01132 switch(yyaccept){ 01133 case 0: goto yy98; 01134 } 01135 yy97: yyaccept = 0; 01136 yych = *(YYMARKER = ++YYCURSOR); 01137 switch(yych){ 01138 case '.': 01139 case '/': 01140 case '0': 01141 case '1': 01142 case '2': 01143 case '3': 01144 case '4': 01145 case '5': 01146 case '6': 01147 case '7': 01148 case '8': 01149 case '9': 01150 case ':': 01151 case ';': 01152 case '<': 01153 case '=': 01154 case '>': 01155 case '?': 01156 case '@': 01157 case 'A': 01158 case 'B': 01159 case 'C': 01160 case 'D': 01161 case 'E': 01162 case 'F': 01163 case 'G': 01164 case 'H': 01165 case 'I': 01166 case 'J': 01167 case 'K': 01168 case 'L': 01169 case 'M': 01170 case 'N': 01171 case 'O': 01172 case 'P': 01173 case 'Q': 01174 case 'R': 01175 case 'S': 01176 case 'T': 01177 case 'U': 01178 case 'V': 01179 case 'W': 01180 case 'X': 01181 case 'Y': 01182 case 'Z': 01183 case '[': 01184 case '\\': 01185 case ']': 01186 case '^': 01187 case '_': case 'a': 01188 case 'b': 01189 case 'c': 01190 case 'd': 01191 case 'e': 01192 case 'f': 01193 case 'g': 01194 case 'h': 01195 case 'i': 01196 case 'j': 01197 case 'k': 01198 case 'l': 01199 case 'm': 01200 case 'n': 01201 case 'o': 01202 case 'p': 01203 case 'q': 01204 case 'r': 01205 case 's': 01206 case 't': 01207 case 'u': 01208 case 'v': 01209 case 'w': 01210 case 'x': 01211 case 'y': 01212 case 'z': goto yy104; 01213 default: goto yy98; 01214 } 01215 yy98: 01216 #line 514 "token.re" 01217 { YYCURSOR = YYTOKTMP; 01218 return YAML_DOCSEP; 01219 } 01220 #line 1221 "<stdout>" 01221 yy99: ++YYCURSOR; 01222 yych = *YYCURSOR; 01223 goto yy103; 01224 yy100: 01225 #line 512 "token.re" 01226 { goto Directive; } 01227 #line 1228 "<stdout>" 01228 yy101: yych = *++YYCURSOR; 01229 goto yy98; 01230 yy102: ++YYCURSOR; 01231 if(YYLIMIT == YYCURSOR) YYFILL(1); 01232 yych = *YYCURSOR; 01233 goto yy103; 01234 yy103: switch(yych){ 01235 case 0x09: case ' ': goto yy102; 01236 default: goto yy100; 01237 } 01238 yy104: ++YYCURSOR; 01239 if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); 01240 yych = *YYCURSOR; 01241 goto yy105; 01242 yy105: switch(yych){ 01243 case '.': 01244 case '/': 01245 case '0': 01246 case '1': 01247 case '2': 01248 case '3': 01249 case '4': 01250 case '5': 01251 case '6': 01252 case '7': 01253 case '8': 01254 case '9': case ';': 01255 case '<': 01256 case '=': 01257 case '>': 01258 case '?': 01259 case '@': 01260 case 'A': 01261 case 'B': 01262 case 'C': 01263 case 'D': 01264 case 'E': 01265 case 'F': 01266 case 'G': 01267 case 'H': 01268 case 'I': 01269 case 'J': 01270 case 'K': 01271 case 'L': 01272 case 'M': 01273 case 'N': 01274 case 'O': 01275 case 'P': 01276 case 'Q': 01277 case 'R': 01278 case 'S': 01279 case 'T': 01280 case 'U': 01281 case 'V': 01282 case 'W': 01283 case 'X': 01284 case 'Y': 01285 case 'Z': 01286 case '[': 01287 case '\\': 01288 case ']': 01289 case '^': 01290 case '_': case 'a': 01291 case 'b': 01292 case 'c': 01293 case 'd': 01294 case 'e': 01295 case 'f': 01296 case 'g': 01297 case 'h': 01298 case 'i': 01299 case 'j': 01300 case 'k': 01301 case 'l': 01302 case 'm': 01303 case 'n': 01304 case 'o': 01305 case 'p': 01306 case 'q': 01307 case 'r': 01308 case 's': 01309 case 't': 01310 case 'u': 01311 case 'v': 01312 case 'w': 01313 case 'x': 01314 case 'y': 01315 case 'z': goto yy104; 01316 case ':': goto yy106; 01317 default: goto yy96; 01318 } 01319 yy106: yych = *++YYCURSOR; 01320 switch(yych){ 01321 case '.': 01322 case '/': 01323 case '0': 01324 case '1': 01325 case '2': 01326 case '3': 01327 case '4': 01328 case '5': 01329 case '6': 01330 case '7': 01331 case '8': 01332 case '9': 01333 case ':': 01334 case ';': 01335 case '<': 01336 case '=': 01337 case '>': 01338 case '?': 01339 case '@': 01340 case 'A': 01341 case 'B': 01342 case 'C': 01343 case 'D': 01344 case 'E': 01345 case 'F': 01346 case 'G': 01347 case 'H': 01348 case 'I': 01349 case 'J': 01350 case 'K': 01351 case 'L': 01352 case 'M': 01353 case 'N': 01354 case 'O': 01355 case 'P': 01356 case 'Q': 01357 case 'R': 01358 case 'S': 01359 case 'T': 01360 case 'U': 01361 case 'V': 01362 case 'W': 01363 case 'X': 01364 case 'Y': 01365 case 'Z': 01366 case '[': 01367 case '\\': 01368 case ']': 01369 case '^': 01370 case '_': case 'a': 01371 case 'b': 01372 case 'c': 01373 case 'd': 01374 case 'e': 01375 case 'f': 01376 case 'g': 01377 case 'h': 01378 case 'i': 01379 case 'j': 01380 case 'k': 01381 case 'l': 01382 case 'm': 01383 case 'n': 01384 case 'o': 01385 case 'p': 01386 case 'q': 01387 case 'r': 01388 case 's': 01389 case 't': 01390 case 'u': 01391 case 'v': 01392 case 'w': 01393 case 'x': 01394 case 'y': 01395 case 'z': goto yy107; 01396 default: goto yy96; 01397 } 01398 yy107: ++YYCURSOR; 01399 if(YYLIMIT == YYCURSOR) YYFILL(1); 01400 yych = *YYCURSOR; 01401 goto yy108; 01402 yy108: switch(yych){ 01403 case '.': 01404 case '/': 01405 case '0': 01406 case '1': 01407 case '2': 01408 case '3': 01409 case '4': 01410 case '5': 01411 case '6': 01412 case '7': 01413 case '8': 01414 case '9': 01415 case ':': 01416 case ';': 01417 case '<': 01418 case '=': 01419 case '>': 01420 case '?': 01421 case '@': 01422 case 'A': 01423 case 'B': 01424 case 'C': 01425 case 'D': 01426 case 'E': 01427 case 'F': 01428 case 'G': 01429 case 'H': 01430 case 'I': 01431 case 'J': 01432 case 'K': 01433 case 'L': 01434 case 'M': 01435 case 'N': 01436 case 'O': 01437 case 'P': 01438 case 'Q': 01439 case 'R': 01440 case 'S': 01441 case 'T': 01442 case 'U': 01443 case 'V': 01444 case 'W': 01445 case 'X': 01446 case 'Y': 01447 case 'Z': 01448 case '[': 01449 case '\\': 01450 case ']': 01451 case '^': 01452 case '_': case 'a': 01453 case 'b': 01454 case 'c': 01455 case 'd': 01456 case 'e': 01457 case 'f': 01458 case 'g': 01459 case 'h': 01460 case 'i': 01461 case 'j': 01462 case 'k': 01463 case 'l': 01464 case 'm': 01465 case 'n': 01466 case 'o': 01467 case 'p': 01468 case 'q': 01469 case 'r': 01470 case 's': 01471 case 't': 01472 case 'u': 01473 case 'v': 01474 case 'w': 01475 case 'x': 01476 case 'y': 01477 case 'z': goto yy107; 01478 default: goto yy109; 01479 } 01480 yy109: 01481 #line 510 "token.re" 01482 { goto Directive; } 01483 #line 1484 "<stdout>" 01484 } 01485 #line 517 "token.re" 01486 01487 01488 } 01489 01490 Plain: 01491 { 01492 int qidx = 0; 01493 int qcapa = 100; 01494 char *qstr = S_ALLOC_N( char, qcapa ); 01495 SyckLevel *plvl; 01496 int parentIndent; 01497 01498 YYCURSOR = YYTOKEN; 01499 plvl = CURRENT_LEVEL(); 01500 GET_TRUE_YAML_INDENT(parentIndent); 01501 01502 Plain2: 01503 YYTOKEN = YYCURSOR; 01504 01505 Plain3: 01506 01507 01508 #line 1509 "<stdout>" 01509 { 01510 YYCTYPE yych; 01511 unsigned int yyaccept; 01512 goto yy110; 01513 ++YYCURSOR; 01514 yy110: 01515 if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); 01516 yych = *YYCURSOR; 01517 switch(yych){ 01518 case 0x00: goto yy124; 01519 case 0x09: goto yy126; 01520 case 0x0A: goto yy112; 01521 case 0x0D: goto yy114; 01522 case ' ': goto yy122; 01523 case ',': goto yy117; 01524 case ':': goto yy116; 01525 case ']': goto yy120; 01526 case '}': goto yy118; 01527 default: goto yy127; 01528 } 01529 yy112: yyaccept = 0; 01530 yych = *(YYMARKER = ++YYCURSOR); 01531 goto yy142; 01532 yy113: 01533 #line 540 "token.re" 01534 { int indt_len, nl_count = 0; 01535 SyckLevel *lvl; 01536 char *tok = YYTOKEN; 01537 GOBBLE_UP_YAML_INDENT( indt_len, tok ); 01538 lvl = CURRENT_LEVEL(); 01539 01540 if ( indt_len <= parentIndent ) 01541 { 01542 RETURN_IMPLICIT(); 01543 } 01544 01545 while ( YYTOKEN < YYCURSOR ) 01546 { 01547 int nl_len = newline_len( YYTOKEN++ ); 01548 if ( nl_len ) 01549 { 01550 nl_count++; 01551 YYTOKEN += nl_len - 1; 01552 } 01553 } 01554 if ( nl_count <= 1 ) 01555 { 01556 QUOTECAT(qstr, qcapa, qidx, ' '); 01557 } 01558 else 01559 { 01560 int i; 01561 for ( i = 0; i < nl_count - 1; i++ ) 01562 { 01563 QUOTECAT(qstr, qcapa, qidx, '\n'); 01564 } 01565 } 01566 01567 goto Plain2; 01568 } 01569 #line 1570 "<stdout>" 01570 yy114: ++YYCURSOR; 01571 switch((yych = *YYCURSOR)) { 01572 case 0x0A: goto yy141; 01573 default: goto yy115; 01574 } 01575 yy115: 01576 #line 627 "token.re" 01577 { QUOTECATS(qstr, qcapa, qidx, YYTOKEN, YYCURSOR - YYTOKEN); 01578 goto Plain2; 01579 } 01580 #line 1581 "<stdout>" 01581 yy116: yyaccept = 1; 01582 yych = *(YYMARKER = ++YYCURSOR); 01583 switch(yych){ 01584 case 0x0A: goto yy136; 01585 case 0x0D: goto yy140; 01586 case ' ': goto yy138; 01587 default: goto yy115; 01588 } 01589 yy117: yyaccept = 1; 01590 yych = *(YYMARKER = ++YYCURSOR); 01591 switch(yych){ 01592 case 0x0A: goto yy130; 01593 case 0x0D: goto yy134; 01594 case ' ': goto yy132; 01595 default: goto yy115; 01596 } 01597 yy118: ++YYCURSOR; 01598 goto yy119; 01599 yy119: 01600 #line 589 "token.re" 01601 { if ( plvl->status != syck_lvl_imap ) 01602 { 01603 PLAIN_NOT_INL(); 01604 } 01605 else 01606 { 01607 PLAIN_IS_INL(); 01608 } 01609 RETURN_IMPLICIT(); 01610 } 01611 #line 1612 "<stdout>" 01612 yy120: ++YYCURSOR; 01613 goto yy121; 01614 yy121: 01615 #line 600 "token.re" 01616 { if ( plvl->status != syck_lvl_iseq ) 01617 { 01618 PLAIN_NOT_INL(); 01619 } 01620 else 01621 { 01622 PLAIN_IS_INL(); 01623 } 01624 RETURN_IMPLICIT(); 01625 } 01626 #line 1627 "<stdout>" 01627 yy122: ++YYCURSOR; 01628 switch((yych = *YYCURSOR)) { 01629 case '#': goto yy128; 01630 default: goto yy123; 01631 } 01632 yy123: 01633 #line 617 "token.re" 01634 { if ( qidx == 0 ) 01635 { 01636 goto Plain2; 01637 } 01638 else 01639 { 01640 goto Plain3; 01641 } 01642 } 01643 #line 1644 "<stdout>" 01644 yy124: ++YYCURSOR; 01645 goto yy125; 01646 yy125: 01647 #line 615 "token.re" 01648 { RETURN_IMPLICIT(); } 01649 #line 1650 "<stdout>" 01650 yy126: yych = *++YYCURSOR; 01651 goto yy123; 01652 yy127: yych = *++YYCURSOR; 01653 goto yy115; 01654 yy128: ++YYCURSOR; 01655 goto yy129; 01656 yy129: 01657 #line 611 "token.re" 01658 { eat_comments( parser ); 01659 RETURN_IMPLICIT(); 01660 } 01661 #line 1662 "<stdout>" 01662 yy130: ++YYCURSOR; 01663 goto yy131; 01664 yy131: 01665 #line 578 "token.re" 01666 { if ( plvl->status != syck_lvl_iseq && plvl->status != syck_lvl_imap ) 01667 { 01668 PLAIN_NOT_INL(); 01669 } 01670 else 01671 { 01672 PLAIN_IS_INL(); 01673 } 01674 RETURN_IMPLICIT(); 01675 } 01676 #line 1677 "<stdout>" 01677 yy132: ++YYCURSOR; 01678 if(YYLIMIT == YYCURSOR) YYFILL(1); 01679 yych = *YYCURSOR; 01680 goto yy133; 01681 yy133: switch(yych){ 01682 case ' ': goto yy132; 01683 default: goto yy131; 01684 } 01685 yy134: yych = *++YYCURSOR; 01686 switch(yych){ 01687 case 0x0A: goto yy130; 01688 default: goto yy135; 01689 } 01690 yy135: YYCURSOR = YYMARKER; 01691 switch(yyaccept){ 01692 case 0: goto yy113; 01693 case 1: goto yy115; 01694 } 01695 yy136: ++YYCURSOR; 01696 goto yy137; 01697 yy137: 01698 #line 576 "token.re" 01699 { RETURN_IMPLICIT(); } 01700 #line 1701 "<stdout>" 01701 yy138: ++YYCURSOR; 01702 if(YYLIMIT == YYCURSOR) YYFILL(1); 01703 yych = *YYCURSOR; 01704 goto yy139; 01705 yy139: switch(yych){ 01706 case ' ': goto yy138; 01707 default: goto yy137; 01708 } 01709 yy140: yych = *++YYCURSOR; 01710 switch(yych){ 01711 case 0x0A: goto yy136; 01712 default: goto yy135; 01713 } 01714 yy141: yyaccept = 0; 01715 YYMARKER = ++YYCURSOR; 01716 if(YYLIMIT == YYCURSOR) YYFILL(1); 01717 yych = *YYCURSOR; 01718 goto yy142; 01719 yy142: switch(yych){ 01720 case 0x0A: case ' ': goto yy141; 01721 case 0x0D: goto yy143; 01722 default: goto yy113; 01723 } 01724 yy143: ++YYCURSOR; 01725 if(YYLIMIT == YYCURSOR) YYFILL(1); 01726 yych = *YYCURSOR; 01727 switch(yych){ 01728 case 0x0A: goto yy141; 01729 default: goto yy135; 01730 } 01731 } 01732 #line 631 "token.re" 01733 01734 } 01735 01736 SingleQuote: 01737 { 01738 int qidx = 0; 01739 int qcapa = 100; 01740 char *qstr = S_ALLOC_N( char, qcapa ); 01741 01742 SingleQuote2: 01743 YYTOKEN = YYCURSOR; 01744 01745 01746 #line 1747 "<stdout>" 01747 { 01748 YYCTYPE yych; 01749 unsigned int yyaccept; 01750 goto yy144; 01751 ++YYCURSOR; 01752 yy144: 01753 if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); 01754 yych = *YYCURSOR; 01755 switch(yych){ 01756 case 0x00: goto yy152; 01757 case 0x0A: goto yy146; 01758 case 0x0D: goto yy148; 01759 case '\'': goto yy150; 01760 default: goto yy153; 01761 } 01762 yy146: yyaccept = 0; 01763 yych = *(YYMARKER = ++YYCURSOR); 01764 goto yy157; 01765 yy147: 01766 #line 645 "token.re" 01767 { int indt_len; 01768 int nl_count = 0; 01769 SyckLevel *lvl; 01770 GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN ); 01771 lvl = CURRENT_LEVEL(); 01772 01773 if ( lvl->status != syck_lvl_str ) 01774 { 01775 ADD_LEVEL( indt_len, syck_lvl_str ); 01776 } 01777 else if ( indt_len < lvl->spaces ) 01778 { 01779 /* Error! */ 01780 } 01781 01782 while ( YYTOKEN < YYCURSOR ) 01783 { 01784 int nl_len = newline_len( YYTOKEN++ ); 01785 if ( nl_len ) 01786 { 01787 nl_count++; 01788 YYTOKEN += nl_len - 1; 01789 } 01790 } 01791 if ( nl_count <= 1 ) 01792 { 01793 QUOTECAT(qstr, qcapa, qidx, ' '); 01794 } 01795 else 01796 { 01797 int i; 01798 for ( i = 0; i < nl_count - 1; i++ ) 01799 { 01800 QUOTECAT(qstr, qcapa, qidx, '\n'); 01801 } 01802 } 01803 01804 goto SingleQuote2; 01805 } 01806 #line 1807 "<stdout>" 01807 yy148: ++YYCURSOR; 01808 switch((yych = *YYCURSOR)) { 01809 case 0x0A: goto yy156; 01810 default: goto yy149; 01811 } 01812 yy149: 01813 #line 712 "token.re" 01814 { QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1)); 01815 goto SingleQuote2; 01816 } 01817 #line 1818 "<stdout>" 01818 yy150: ++YYCURSOR; 01819 switch((yych = *YYCURSOR)) { 01820 case '\'': goto yy154; 01821 default: goto yy151; 01822 } 01823 yy151: 01824 #line 689 "token.re" 01825 { SyckLevel *lvl; 01826 SyckNode *n = syck_alloc_str(); 01827 lvl = CURRENT_LEVEL(); 01828 01829 if ( lvl->status == syck_lvl_str ) 01830 { 01831 POP_LEVEL(); 01832 } 01833 if ( ((SyckParser *)parser)->taguri_expansion == 1 ) 01834 { 01835 n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 ); 01836 } 01837 else 01838 { 01839 n->type_id = syck_strndup( "str", 3 ); 01840 } 01841 n->data.str->ptr = qstr; 01842 n->data.str->len = qidx; 01843 n->data.str->style = scalar_1quote; 01844 sycklval->nodeData = n; 01845 return YAML_PLAIN; 01846 } 01847 #line 1848 "<stdout>" 01848 yy152: yych = *++YYCURSOR; 01849 goto yy151; 01850 yy153: yych = *++YYCURSOR; 01851 goto yy149; 01852 yy154: ++YYCURSOR; 01853 goto yy155; 01854 yy155: 01855 #line 685 "token.re" 01856 { QUOTECAT(qstr, qcapa, qidx, '\''); 01857 goto SingleQuote2; 01858 } 01859 #line 1860 "<stdout>" 01860 yy156: yyaccept = 0; 01861 YYMARKER = ++YYCURSOR; 01862 if(YYLIMIT == YYCURSOR) YYFILL(1); 01863 yych = *YYCURSOR; 01864 goto yy157; 01865 yy157: switch(yych){ 01866 case 0x0A: case ' ': goto yy156; 01867 case 0x0D: goto yy158; 01868 default: goto yy147; 01869 } 01870 yy158: ++YYCURSOR; 01871 if(YYLIMIT == YYCURSOR) YYFILL(1); 01872 yych = *YYCURSOR; 01873 switch(yych){ 01874 case 0x0A: goto yy156; 01875 default: goto yy159; 01876 } 01877 yy159: YYCURSOR = YYMARKER; 01878 switch(yyaccept){ 01879 case 0: goto yy147; 01880 } 01881 } 01882 #line 716 "token.re" 01883 01884 01885 } 01886 01887 01888 DoubleQuote: 01889 { 01890 int keep_nl = 1; 01891 int qidx = 0; 01892 int qcapa = 100; 01893 char *qstr = S_ALLOC_N( char, qcapa ); 01894 01895 DoubleQuote2: 01896 YYTOKEN = YYCURSOR; 01897 01898 01899 01900 #line 1901 "<stdout>" 01901 { 01902 YYCTYPE yych; 01903 unsigned int yyaccept; 01904 goto yy160; 01905 ++YYCURSOR; 01906 yy160: 01907 if((YYLIMIT - YYCURSOR) < 4) YYFILL(4); 01908 yych = *YYCURSOR; 01909 switch(yych){ 01910 case 0x00: goto yy167; 01911 case 0x0A: goto yy162; 01912 case 0x0D: goto yy164; 01913 case '"': goto yy169; 01914 case '\\': goto yy166; 01915 default: goto yy170; 01916 } 01917 yy162: yyaccept = 0; 01918 yych = *(YYMARKER = ++YYCURSOR); 01919 goto yy184; 01920 yy163: 01921 #line 734 "token.re" 01922 { int indt_len; 01923 int nl_count = 0; 01924 SyckLevel *lvl; 01925 GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN ); 01926 lvl = CURRENT_LEVEL(); 01927 01928 if ( lvl->status != syck_lvl_str ) 01929 { 01930 ADD_LEVEL( indt_len, syck_lvl_str ); 01931 } 01932 else if ( indt_len < lvl->spaces ) 01933 { 01934 /* FIXME */ 01935 } 01936 01937 if ( keep_nl == 1 ) 01938 { 01939 while ( YYTOKEN < YYCURSOR ) 01940 { 01941 int nl_len = newline_len( YYTOKEN++ ); 01942 if ( nl_len ) 01943 { 01944 nl_count++; 01945 YYTOKEN += nl_len - 1; 01946 } 01947 } 01948 if ( nl_count <= 1 ) 01949 { 01950 QUOTECAT(qstr, qcapa, qidx, ' '); 01951 } 01952 else 01953 { 01954 int i; 01955 for ( i = 0; i < nl_count - 1; i++ ) 01956 { 01957 QUOTECAT(qstr, qcapa, qidx, '\n'); 01958 } 01959 } 01960 } 01961 01962 keep_nl = 1; 01963 goto DoubleQuote2; 01964 } 01965 #line 1966 "<stdout>" 01966 yy164: ++YYCURSOR; 01967 switch((yych = *YYCURSOR)) { 01968 case 0x0A: goto yy183; 01969 default: goto yy165; 01970 } 01971 yy165: 01972 #line 820 "token.re" 01973 { QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1)); 01974 goto DoubleQuote2; 01975 } 01976 #line 1977 "<stdout>" 01977 yy166: yyaccept = 1; 01978 yych = *(YYMARKER = ++YYCURSOR); 01979 switch(yych){ 01980 case 0x0A: goto yy174; 01981 case 0x0D: goto yy176; 01982 case ' ': goto yy171; 01983 case '"': case '0': case '\\': case 'a': 01984 case 'b': case 'e': 01985 case 'f': case 'n': case 'r': case 't': case 'v': goto yy178; 01986 case 'x': goto yy177; 01987 default: goto yy165; 01988 } 01989 yy167: ++YYCURSOR; 01990 goto yy168; 01991 yy168: 01992 #line 797 "token.re" 01993 { SyckLevel *lvl; 01994 SyckNode *n = syck_alloc_str(); 01995 lvl = CURRENT_LEVEL(); 01996 01997 if ( lvl->status == syck_lvl_str ) 01998 { 01999 POP_LEVEL(); 02000 } 02001 if ( ((SyckParser *)parser)->taguri_expansion == 1 ) 02002 { 02003 n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 ); 02004 } 02005 else 02006 { 02007 n->type_id = syck_strndup( "str", 3 ); 02008 } 02009 n->data.str->ptr = qstr; 02010 n->data.str->len = qidx; 02011 n->data.str->style = scalar_2quote; 02012 sycklval->nodeData = n; 02013 return YAML_PLAIN; 02014 } 02015 #line 2016 "<stdout>" 02016 yy169: yych = *++YYCURSOR; 02017 goto yy168; 02018 yy170: yych = *++YYCURSOR; 02019 goto yy165; 02020 yy171: ++YYCURSOR; 02021 if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); 02022 yych = *YYCURSOR; 02023 goto yy172; 02024 yy172: switch(yych){ 02025 case 0x0A: goto yy174; 02026 case 0x0D: goto yy176; 02027 case ' ': goto yy171; 02028 default: goto yy173; 02029 } 02030 yy173: YYCURSOR = YYMARKER; 02031 switch(yyaccept){ 02032 case 0: goto yy163; 02033 case 1: goto yy165; 02034 } 02035 yy174: ++YYCURSOR; 02036 goto yy175; 02037 yy175: 02038 #line 792 "token.re" 02039 { keep_nl = 0; 02040 YYCURSOR--; 02041 goto DoubleQuote2; 02042 } 02043 #line 2044 "<stdout>" 02044 yy176: yych = *++YYCURSOR; 02045 switch(yych){ 02046 case 0x0A: goto yy174; 02047 default: goto yy173; 02048 } 02049 yy177: yych = *++YYCURSOR; 02050 switch(yych){ 02051 case '0': 02052 case '1': 02053 case '2': 02054 case '3': 02055 case '4': 02056 case '5': 02057 case '6': 02058 case '7': 02059 case '8': 02060 case '9': case 'A': 02061 case 'B': 02062 case 'C': 02063 case 'D': 02064 case 'E': 02065 case 'F': case 'a': 02066 case 'b': 02067 case 'c': 02068 case 'd': 02069 case 'e': 02070 case 'f': goto yy180; 02071 default: goto yy173; 02072 } 02073 yy178: ++YYCURSOR; 02074 goto yy179; 02075 yy179: 02076 #line 778 "token.re" 02077 { char ch = *( YYCURSOR - 1 ); 02078 QUOTECAT(qstr, qcapa, qidx, escape_seq( ch )); 02079 goto DoubleQuote2; 02080 } 02081 #line 2082 "<stdout>" 02082 yy180: yych = *++YYCURSOR; 02083 switch(yych){ 02084 case '0': 02085 case '1': 02086 case '2': 02087 case '3': 02088 case '4': 02089 case '5': 02090 case '6': 02091 case '7': 02092 case '8': 02093 case '9': case 'A': 02094 case 'B': 02095 case 'C': 02096 case 'D': 02097 case 'E': 02098 case 'F': case 'a': 02099 case 'b': 02100 case 'c': 02101 case 'd': 02102 case 'e': 02103 case 'f': goto yy181; 02104 default: goto yy173; 02105 } 02106 yy181: ++YYCURSOR; 02107 goto yy182; 02108 yy182: 02109 #line 783 "token.re" 02110 { long ch; 02111 char *chr_text = syck_strndup( YYTOKEN, 4 ); 02112 chr_text[0] = '0'; 02113 ch = strtol( chr_text, NULL, 16 ); 02114 free( chr_text ); 02115 QUOTECAT(qstr, qcapa, qidx, ch); 02116 goto DoubleQuote2; 02117 } 02118 #line 2119 "<stdout>" 02119 yy183: yyaccept = 0; 02120 YYMARKER = ++YYCURSOR; 02121 if(YYLIMIT == YYCURSOR) YYFILL(1); 02122 yych = *YYCURSOR; 02123 goto yy184; 02124 yy184: switch(yych){ 02125 case 0x0A: case ' ': goto yy183; 02126 case 0x0D: goto yy185; 02127 default: goto yy163; 02128 } 02129 yy185: ++YYCURSOR; 02130 if(YYLIMIT == YYCURSOR) YYFILL(1); 02131 yych = *YYCURSOR; 02132 switch(yych){ 02133 case 0x0A: goto yy183; 02134 default: goto yy173; 02135 } 02136 } 02137 #line 824 "token.re" 02138 02139 } 02140 02141 TransferMethod: 02142 { 02143 int qidx = 0; 02144 int qcapa = 100; 02145 char *qstr = S_ALLOC_N( char, qcapa ); 02146 02147 TransferMethod2: 02148 YYTOKTMP = YYCURSOR; 02149 02150 02151 #line 2152 "<stdout>" 02152 { 02153 YYCTYPE yych; 02154 unsigned int yyaccept; 02155 goto yy186; 02156 ++YYCURSOR; 02157 yy186: 02158 if((YYLIMIT - YYCURSOR) < 4) YYFILL(4); 02159 yych = *YYCURSOR; 02160 switch(yych){ 02161 case 0x00: goto yy188; 02162 case 0x0A: goto yy190; 02163 case 0x0D: goto yy192; 02164 case ' ': goto yy191; 02165 case '\\': goto yy194; 02166 default: goto yy195; 02167 } 02168 yy188: ++YYCURSOR; 02169 goto yy189; 02170 yy189: 02171 #line 838 "token.re" 02172 { SyckLevel *lvl; 02173 YYCURSOR = YYTOKTMP; 02174 if ( YYCURSOR == YYTOKEN + 1 ) 02175 { 02176 free( qstr ); 02177 return YAML_ITRANSFER; 02178 } 02179 02180 lvl = CURRENT_LEVEL(); 02181 02182 /* 02183 * URL Prefixing 02184 */ 02185 if ( *qstr == '^' ) 02186 { 02187 sycklval->name = S_ALLOC_N( char, qidx + strlen( lvl->domain ) ); 02188 sycklval->name[0] = '\0'; 02189 strcat( sycklval->name, lvl->domain ); 02190 strncat( sycklval->name, qstr + 1, qidx - 1 ); 02191 free( qstr ); 02192 } 02193 else 02194 { 02195 char *carat = qstr; 02196 char *qend = qstr + qidx; 02197 while ( (++carat) < qend ) 02198 { 02199 if ( *carat == '^' ) 02200 break; 02201 } 02202 02203 if ( carat < qend ) 02204 { 02205 free( lvl->domain ); 02206 lvl->domain = syck_strndup( qstr, carat - qstr ); 02207 sycklval->name = S_ALLOC_N( char, ( qend - carat ) + strlen( lvl->domain ) ); 02208 sycklval->name[0] = '\0'; 02209 strcat( sycklval->name, lvl->domain ); 02210 strncat( sycklval->name, carat + 1, ( qend - carat ) - 1 ); 02211 free( qstr ); 02212 } 02213 else 02214 { 02215 sycklval->name = qstr; 02216 } 02217 } 02218 02219 return YAML_TRANSFER; 02220 } 02221 #line 2222 "<stdout>" 02222 yy190: yych = *++YYCURSOR; 02223 goto yy189; 02224 yy191: yych = *++YYCURSOR; 02225 goto yy204; 02226 yy192: ++YYCURSOR; 02227 switch((yych = *YYCURSOR)) { 02228 case 0x0A: goto yy188; 02229 default: goto yy193; 02230 } 02231 yy193: 02232 #line 905 "token.re" 02233 { QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1)); 02234 goto TransferMethod2; 02235 } 02236 #line 2237 "<stdout>" 02237 yy194: yyaccept = 0; 02238 yych = *(YYMARKER = ++YYCURSOR); 02239 switch(yych){ 02240 case '"': case '0': case '\\': case 'a': 02241 case 'b': case 'e': 02242 case 'f': case 'n': case 'r': case 't': case 'v': goto yy198; 02243 case 'x': goto yy196; 02244 default: goto yy193; 02245 } 02246 yy195: yych = *++YYCURSOR; 02247 goto yy193; 02248 yy196: yych = *++YYCURSOR; 02249 switch(yych){ 02250 case '0': 02251 case '1': 02252 case '2': 02253 case '3': 02254 case '4': 02255 case '5': 02256 case '6': 02257 case '7': 02258 case '8': 02259 case '9': case 'A': 02260 case 'B': 02261 case 'C': 02262 case 'D': 02263 case 'E': 02264 case 'F': case 'a': 02265 case 'b': 02266 case 'c': 02267 case 'd': 02268 case 'e': 02269 case 'f': goto yy200; 02270 default: goto yy197; 02271 } 02272 yy197: YYCURSOR = YYMARKER; 02273 switch(yyaccept){ 02274 case 0: goto yy193; 02275 } 02276 yy198: ++YYCURSOR; 02277 goto yy199; 02278 yy199: 02279 #line 891 "token.re" 02280 { char ch = *( YYCURSOR - 1 ); 02281 QUOTECAT(qstr, qcapa, qidx, escape_seq( ch )); 02282 goto TransferMethod2; 02283 } 02284 #line 2285 "<stdout>" 02285 yy200: yych = *++YYCURSOR; 02286 switch(yych){ 02287 case '0': 02288 case '1': 02289 case '2': 02290 case '3': 02291 case '4': 02292 case '5': 02293 case '6': 02294 case '7': 02295 case '8': 02296 case '9': case 'A': 02297 case 'B': 02298 case 'C': 02299 case 'D': 02300 case 'E': 02301 case 'F': case 'a': 02302 case 'b': 02303 case 'c': 02304 case 'd': 02305 case 'e': 02306 case 'f': goto yy201; 02307 default: goto yy197; 02308 } 02309 yy201: ++YYCURSOR; 02310 goto yy202; 02311 yy202: 02312 #line 896 "token.re" 02313 { long ch; 02314 char *chr_text = syck_strndup( YYTOKTMP, 4 ); 02315 chr_text[0] = '0'; 02316 ch = strtol( chr_text, NULL, 16 ); 02317 free( chr_text ); 02318 QUOTECAT(qstr, qcapa, qidx, ch); 02319 goto TransferMethod2; 02320 } 02321 #line 2322 "<stdout>" 02322 yy203: ++YYCURSOR; 02323 if(YYLIMIT == YYCURSOR) YYFILL(1); 02324 yych = *YYCURSOR; 02325 goto yy204; 02326 yy204: switch(yych){ 02327 case ' ': goto yy203; 02328 default: goto yy189; 02329 } 02330 } 02331 #line 910 "token.re" 02332 02333 } 02334 02335 ScalarBlock: 02336 { 02337 int qidx = 0; 02338 int qcapa = 100; 02339 char *qstr = S_ALLOC_N( char, qcapa ); 02340 int blockType = 0; 02341 int nlDoWhat = 0; 02342 int lastIndent = 0; 02343 int forceIndent = -1; 02344 char *yyt = YYTOKEN; 02345 SyckLevel *lvl = CURRENT_LEVEL(); 02346 int parentIndent = -1; 02347 02348 switch ( *yyt ) 02349 { 02350 case '|': blockType = BLOCK_LIT; break; 02351 case '>': blockType = BLOCK_FOLD; break; 02352 } 02353 02354 while ( ++yyt <= YYCURSOR ) 02355 { 02356 if ( *yyt == '-' ) 02357 { 02358 nlDoWhat = NL_CHOMP; 02359 } 02360 else if ( *yyt == '+' ) 02361 { 02362 nlDoWhat = NL_KEEP; 02363 } 02364 else if ( isdigit( *yyt ) ) 02365 { 02366 forceIndent = rb_long2int(strtol( yyt, NULL, 10 )); 02367 } 02368 } 02369 02370 qstr[0] = '\0'; 02371 YYTOKEN = YYCURSOR; 02372 02373 ScalarBlock2: 02374 YYTOKEN = YYCURSOR; 02375 02376 02377 #line 2378 "<stdout>" 02378 { 02379 YYCTYPE yych; 02380 unsigned int yyaccept; 02381 goto yy205; 02382 ++YYCURSOR; 02383 yy205: 02384 if((YYLIMIT - YYCURSOR) < 5) YYFILL(5); 02385 yych = *YYCURSOR; 02386 switch(yych){ 02387 case 0x00: goto yy213; 02388 case 0x0A: goto yy207; 02389 case 0x0D: goto yy209; 02390 case '#': goto yy211; 02391 case '-': goto yy215; 02392 default: goto yy216; 02393 } 02394 yy207: yyaccept = 0; 02395 yych = *(YYMARKER = ++YYCURSOR); 02396 goto yy226; 02397 yy208: 02398 #line 956 "token.re" 02399 { char *pacer; 02400 char *tok = YYTOKEN; 02401 int indt_len = 0, nl_count = 0, fold_nl = 0, nl_begin = 0; 02402 GOBBLE_UP_YAML_INDENT( indt_len, tok ); 02403 lvl = CURRENT_LEVEL(); 02404 02405 if ( lvl->status != syck_lvl_block ) 02406 { 02407 GET_TRUE_YAML_INDENT(parentIndent); 02408 if ( forceIndent > 0 ) forceIndent += parentIndent; 02409 if ( indt_len > parentIndent ) 02410 { 02411 int new_spaces = forceIndent > 0 ? forceIndent : indt_len; 02412 ADD_LEVEL( new_spaces, syck_lvl_block ); 02413 lastIndent = indt_len - new_spaces; 02414 nl_begin = 1; 02415 lvl = CURRENT_LEVEL(); 02416 } 02417 else 02418 { 02419 YYCURSOR = YYTOKEN; 02420 RETURN_YAML_BLOCK(); 02421 } 02422 } 02423 02424 /* 02425 * Fold only in the event of two lines being on the leftmost 02426 * indentation. 02427 */ 02428 if ( blockType == BLOCK_FOLD && lastIndent == 0 && ( indt_len - lvl->spaces ) == 0 ) 02429 { 02430 fold_nl = 1; 02431 } 02432 02433 pacer = YYTOKEN; 02434 while ( pacer < YYCURSOR ) 02435 { 02436 int nl_len = newline_len( pacer++ ); 02437 if ( nl_len ) 02438 { 02439 nl_count++; 02440 pacer += nl_len - 1; 02441 } 02442 } 02443 02444 if ( fold_nl == 1 || nl_begin == 1 ) 02445 { 02446 nl_count--; 02447 } 02448 02449 if ( nl_count < 1 && nl_begin == 0 ) 02450 { 02451 QUOTECAT(qstr, qcapa, qidx, ' '); 02452 } 02453 else 02454 { 02455 int i; 02456 for ( i = 0; i < nl_count; i++ ) 02457 { 02458 QUOTECAT(qstr, qcapa, qidx, '\n'); 02459 } 02460 } 02461 02462 lastIndent = indt_len - lvl->spaces; 02463 YYCURSOR -= lastIndent; 02464 02465 if ( indt_len < lvl->spaces ) 02466 { 02467 POP_LEVEL(); 02468 YYCURSOR = YYTOKEN; 02469 RETURN_YAML_BLOCK(); 02470 } 02471 goto ScalarBlock2; 02472 } 02473 #line 2474 "<stdout>" 02474 yy209: ++YYCURSOR; 02475 switch((yych = *YYCURSOR)) { 02476 case 0x0A: goto yy225; 02477 default: goto yy210; 02478 } 02479 yy210: 02480 #line 1070 "token.re" 02481 { QUOTECAT(qstr, qcapa, qidx, *YYTOKEN); 02482 goto ScalarBlock2; 02483 } 02484 #line 2485 "<stdout>" 02485 yy211: ++YYCURSOR; 02486 goto yy212; 02487 yy212: 02488 #line 1032 "token.re" 02489 { lvl = CURRENT_LEVEL(); 02490 if ( lvl->status != syck_lvl_block ) 02491 { 02492 eat_comments( parser ); 02493 YYTOKEN = YYCURSOR; 02494 } 02495 else 02496 { 02497 QUOTECAT(qstr, qcapa, qidx, *YYTOKEN); 02498 } 02499 goto ScalarBlock2; 02500 } 02501 #line 2502 "<stdout>" 02502 yy213: ++YYCURSOR; 02503 goto yy214; 02504 yy214: 02505 #line 1046 "token.re" 02506 { YYCURSOR--; 02507 POP_LEVEL(); 02508 RETURN_YAML_BLOCK(); 02509 } 02510 #line 2511 "<stdout>" 02511 yy215: yyaccept = 1; 02512 yych = *(YYMARKER = ++YYCURSOR); 02513 switch(yych){ 02514 case '-': goto yy217; 02515 default: goto yy210; 02516 } 02517 yy216: yych = *++YYCURSOR; 02518 goto yy210; 02519 yy217: yych = *++YYCURSOR; 02520 switch(yych){ 02521 case '-': goto yy219; 02522 default: goto yy218; 02523 } 02524 yy218: YYCURSOR = YYMARKER; 02525 switch(yyaccept){ 02526 case 0: goto yy208; 02527 case 1: goto yy210; 02528 } 02529 yy219: yych = *++YYCURSOR; 02530 switch(yych){ 02531 case 0x0A: goto yy220; 02532 case 0x0D: goto yy224; 02533 case ' ': goto yy222; 02534 default: goto yy218; 02535 } 02536 yy220: ++YYCURSOR; 02537 goto yy221; 02538 yy221: 02539 #line 1051 "token.re" 02540 { if ( YYTOKEN == YYLINEPTR ) 02541 { 02542 if ( blockType == BLOCK_FOLD && qidx > 0 ) 02543 { 02544 qidx -= 1; 02545 } 02546 QUOTECAT(qstr, qcapa, qidx, '\n'); 02547 POP_LEVEL(); 02548 YYCURSOR = YYTOKEN; 02549 RETURN_YAML_BLOCK(); 02550 } 02551 else 02552 { 02553 QUOTECAT(qstr, qcapa, qidx, *YYTOKEN); 02554 YYCURSOR = YYTOKEN + 1; 02555 goto ScalarBlock2; 02556 } 02557 } 02558 #line 2559 "<stdout>" 02559 yy222: ++YYCURSOR; 02560 if(YYLIMIT == YYCURSOR) YYFILL(1); 02561 yych = *YYCURSOR; 02562 goto yy223; 02563 yy223: switch(yych){ 02564 case ' ': goto yy222; 02565 default: goto yy221; 02566 } 02567 yy224: yych = *++YYCURSOR; 02568 switch(yych){ 02569 case 0x0A: goto yy220; 02570 default: goto yy218; 02571 } 02572 yy225: yyaccept = 0; 02573 YYMARKER = ++YYCURSOR; 02574 if(YYLIMIT == YYCURSOR) YYFILL(1); 02575 yych = *YYCURSOR; 02576 goto yy226; 02577 yy226: switch(yych){ 02578 case 0x0A: case ' ': goto yy225; 02579 case 0x0D: goto yy227; 02580 default: goto yy208; 02581 } 02582 yy227: ++YYCURSOR; 02583 if(YYLIMIT == YYCURSOR) YYFILL(1); 02584 yych = *YYCURSOR; 02585 switch(yych){ 02586 case 0x0A: goto yy225; 02587 default: goto yy218; 02588 } 02589 } 02590 #line 1075 "token.re" 02591 02592 } 02593 02594 return 0; 02595 02596 } 02597 02598 void 02599 eat_comments( SyckParser *parser ) 02600 { 02601 Comment: 02602 { 02603 YYTOKEN = YYCURSOR; 02604 02605 02606 #line 2607 "<stdout>" 02607 { 02608 YYCTYPE yych; 02609 unsigned int yyaccept; 02610 goto yy228; 02611 ++YYCURSOR; 02612 yy228: 02613 if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); 02614 yych = *YYCURSOR; 02615 switch(yych){ 02616 case 0x00: goto yy230; 02617 case 0x0A: goto yy232; 02618 case 0x0D: goto yy233; 02619 default: goto yy235; 02620 } 02621 yy230: ++YYCURSOR; 02622 goto yy231; 02623 yy231: 02624 #line 1091 "token.re" 02625 { YYCURSOR = YYTOKEN; 02626 return; 02627 } 02628 #line 2629 "<stdout>" 02629 yy232: yyaccept = 0; 02630 yych = *(YYMARKER = ++YYCURSOR); 02631 goto yy237; 02632 yy233: ++YYCURSOR; 02633 switch((yych = *YYCURSOR)) { 02634 case 0x0A: goto yy236; 02635 default: goto yy234; 02636 } 02637 yy234: 02638 #line 1095 "token.re" 02639 { goto Comment; 02640 } 02641 #line 2642 "<stdout>" 02642 yy235: yych = *++YYCURSOR; 02643 goto yy234; 02644 yy236: yyaccept = 0; 02645 YYMARKER = ++YYCURSOR; 02646 if(YYLIMIT == YYCURSOR) YYFILL(1); 02647 yych = *YYCURSOR; 02648 goto yy237; 02649 yy237: switch(yych){ 02650 case 0x0A: goto yy236; 02651 case 0x0D: goto yy238; 02652 default: goto yy231; 02653 } 02654 yy238: ++YYCURSOR; 02655 if(YYLIMIT == YYCURSOR) YYFILL(1); 02656 yych = *YYCURSOR; 02657 switch(yych){ 02658 case 0x0A: goto yy236; 02659 default: goto yy239; 02660 } 02661 yy239: YYCURSOR = YYMARKER; 02662 switch(yyaccept){ 02663 case 0: goto yy231; 02664 } 02665 } 02666 #line 1098 "token.re" 02667 02668 02669 } 02670 02671 } 02672 02673 char 02674 escape_seq( char ch ) 02675 { 02676 switch ( ch ) 02677 { 02678 case '0': return '\0'; 02679 case 'a': return 7; 02680 case 'b': return '\010'; 02681 case 'e': return '\033'; 02682 case 'f': return '\014'; 02683 case 'n': return '\n'; 02684 case 'r': return '\015'; 02685 case 't': return '\t'; 02686 case 'v': return '\013'; 02687 default: return ch; 02688 } 02689 } 02690 02691 int 02692 is_newline( char *ptr ) 02693 { 02694 return newline_len( ptr ); 02695 } 02696 02697 int 02698 newline_len( char *ptr ) 02699 { 02700 if ( *ptr == '\n' ) 02701 return 1; 02702 02703 if ( *ptr == '\r' && *( ptr + 1 ) == '\n' ) 02704 return 2; 02705 02706 return 0; 02707 } 02708 02709 int 02710 syckwrap() 02711 { 02712 return 1; 02713 } 02714 02715 void 02716 syckerror( const char *msg ) 02717 { 02718 if ( syck_parser_ptr->error_handler == NULL ) 02719 syck_parser_ptr->error_handler = syck_default_error_handler; 02720 02721 syck_parser_ptr->root = syck_parser_ptr->root_on_error; 02722 (syck_parser_ptr->error_handler)(syck_parser_ptr, msg); 02723 } 02724 02725