23 #define YYCURSOR parser->cursor 24 #define YYMARKER parser->marker 25 #define YYLIMIT parser->limit 26 #define YYTOKEN parser->token 27 #define YYTOKTMP parser->toktmp 28 #define YYLINEPTR parser->lineptr 29 #define YYLINECTPTR parser->linectptr 30 #define YYLINE parser->linect 31 #define YYFILL(n) syck_parser_read(parser) 37 #define YYPOS(n) YYCURSOR = YYTOKEN + n 42 #define NEWLINE(ptr) YYLINEPTR = ptr + newline_len(ptr); if ( YYLINEPTR > YYLINECTPTR ) { YYLINE++; YYLINECTPTR = YYLINEPTR; } 47 #define ADD_LEVEL(len, status) syck_parser_add_level( parser, len, status ) 48 #define POP_LEVEL() syck_parser_pop_level( parser ) 49 #define CURRENT_LEVEL() syck_parser_current_level( parser ) 54 #define FORCE_NEXT_TOKEN(tok) parser->force_token = tok; 60 #define ENSURE_YAML_IOPEN(last_lvl, to_len, reset) \ 61 if ( last_lvl->spaces < to_len ) \ 63 if ( last_lvl->status == syck_lvl_iseq || last_lvl->status == syck_lvl_imap ) \ 69 ADD_LEVEL( to_len, syck_lvl_doc ); \ 70 if ( reset == 1 ) YYPOS(0); \ 79 #define ENSURE_YAML_IEND(last_lvl, to_len) \ 80 if ( last_lvl->spaces > to_len ) \ 82 syck_parser_pop_level( parser ); \ 91 #define QUOTECAT(s, c, i, l) \ 96 S_REALLOC_N( s, char, c ); \ 102 #define QUOTECATS(s, c, i, cs, cl) \ 104 while ( i + cl >= c ) \ 107 S_REALLOC_N( s, char, c ); \ 109 S_MEMCPY( s + i, cs, char, cl ); \ 118 #define RETURN_IMPLICIT() \ 120 SyckNode *n = syck_alloc_str(); \ 121 YYCURSOR = YYTOKEN; \ 122 n->data.str->ptr = qstr; \ 123 n->data.str->len = qidx; \ 124 n->data.str->style = scalar_plain; \ 125 sycklval->nodeData = n; \ 126 if ( parser->implicit_typing == 1 ) \ 128 try_tag_implicit( sycklval->nodeData, parser->taguri_expansion ); \ 134 #define PLAIN_NOT_INL() \ 135 if ( *(YYCURSOR - 1) == ' ' || is_newline( YYCURSOR - 1 ) ) \ 139 QUOTECATS(qstr, qcapa, qidx, YYTOKEN, YYCURSOR - YYTOKEN); \ 143 #define PLAIN_IS_INL() \ 144 char *walker = qstr + qidx - 1; \ 145 while ( walker > qstr && ( *walker == '\n' || *walker == ' ' || *walker == '\t' ) ) \ 156 #define RETURN_YAML_BLOCK() \ 158 SyckNode *n = syck_alloc_str(); \ 159 if ( ((SyckParser *)parser)->taguri_expansion == 1 ) \ 161 n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 ); \ 165 n->type_id = syck_strndup( "str", 3 ); \ 167 n->data.str->ptr = qstr; \ 168 n->data.str->len = qidx; \ 169 if ( blockType == BLOCK_LIT ) { \ 170 n->data.str->style = scalar_literal; \ 172 n->data.str->style = scalar_fold; \ 176 if ( nlDoWhat != NL_KEEP ) \ 178 char *fc = n->data.str->ptr + n->data.str->len - 1; \ 179 while ( is_newline( fc ) ) fc--; \ 180 if ( nlDoWhat != NL_CHOMP && fc < n->data.str->ptr + n->data.str->len - 1 ) \ 182 n->data.str->len = fc - n->data.str->ptr + 1; \ 185 sycklval->nodeData = n; \ 192 #define GOBBLE_UP_YAML_INDENT( ict, start ) \ 193 char *indent = start; \ 195 while ( indent < YYCURSOR ) \ 197 if ( is_newline( ++indent ) ) \ 203 if ( *YYCURSOR == '\0' ) \ 206 start = YYCURSOR - 1; \ 208 else if ( *YYLINEPTR == ' ' ) \ 210 ict = (int)(YYCURSOR - YYLINEPTR); \ 216 #define GET_TRUE_YAML_INDENT(indt_len) \ 218 SyckLevel *lvl_deep = CURRENT_LEVEL(); \ 219 indt_len = lvl_deep->spaces; \ 220 if ( lvl_deep->status == syck_lvl_seq || ( indt_len == YYCURSOR - YYLINEPTR && lvl_deep->status != syck_lvl_map ) ) \ 222 SyckLevel *lvl_over; \ 224 lvl_over = CURRENT_LEVEL(); \ 225 indt_len = lvl_over->spaces; \ 260 syckerror(
"UTF-16 is not currently supported in Syck.\nPlease contribute code to help this happen!" );
264 syckerror(
"UTF-32 is not currently supported in Syck.\nPlease contribute code to help this happen!" );
309 unsigned int yyaccept;
317 case 0x09:
case ' ':
goto yy12;
319 case 0x0D:
goto yy11;
372 case 0x0A:
goto yy17;
391 case 0x09:
case ' ':
goto yy15;
400 case 0x0A:
case ' ':
goto yy17;
401 case 0x0D:
goto yy19;
408 case 0x0A:
goto yy17;
423 case 0x0A:
goto yy23;
424 case 0x0D:
goto yy27;
456 case 0x0A:
goto yy23;
466 case 0x0A:
goto yy30;
467 case 0x0D:
goto yy34;
499 case 0x0A:
goto yy30;
520 unsigned int yyaccept;
527 case 0x00:
goto yy62;
528 case 0x09:
case ' ':
goto yy60;
529 case 0x0A:
goto yy37;
530 case 0x0D:
goto yy39;
535 case '\'':
goto yy53;
537 case ',':
case ':':
goto yy47;
538 case '-':
case '?':
goto yy48;
539 case '>':
case '|':
goto yy57;
541 case ']':
case '}':
goto yy45;
571 if ( indt_len == -1 )
580 case 0x0A:
goto yy91;
620 case 0x0A:
goto yy86;
621 case 0x0D:
goto yy90;
628 case 0x0A:
goto yy81;
629 case 0x0D:
goto yy85;
669 case 'Z':
case '_':
case 'a':
733 case 'Z':
case '_':
case 'a':
765 {
goto TransferMethod; }
784 case 0x0A:
goto yy70;
785 case 0x0D:
goto yy74;
787 case '+':
case '-':
case '0':
830 case 0x09:
case ' ':
goto yy65;
838 case 0x0A:
goto yy70;
839 case 0x0D:
goto yy74;
841 case '+':
case '-':
case '0':
879 case 0x0A:
goto yy70;
921 case 'Z':
case '_':
case 'a':
995 case 'Z':
case '_':
case 'a':
1020 case 'z':
goto yy78;
1024 #line 455 "token.re" 1035 #line 1036 "<stdout>" 1039 #line 441 "token.re" 1053 #line 1054 "<stdout>" 1059 case ' ':
goto yy83;
1064 case 0x0A:
goto yy81;
1070 #line 436 "token.re" 1075 #line 1076 "<stdout>" 1081 case ' ':
goto yy88;
1086 case 0x0A:
goto yy86;
1095 case 0x0A:
case ' ':
goto yy91;
1096 case 0x0D:
goto yy93;
1103 case 0x0A:
goto yy91;
1107 #line 501 "token.re" 1116 #line 1117 "<stdout>" 1119 unsigned int yyaccept = 0;
1126 case 0x00:
goto yy96;
1127 case 0x09:
case ' ':
goto yy99;
1128 case '%':
goto yy97;
1129 default:
goto yy101;
1212 case 'z':
goto yy104;
1216 #line 514 "token.re" 1220 #line 1221 "<stdout>" 1225 #line 512 "token.re" 1227 #line 1228 "<stdout>" 1234 yy103:
switch(yych){
1235 case 0x09:
case ' ':
goto yy102;
1236 default:
goto yy100;
1242 yy105:
switch(yych){
1315 case 'z':
goto yy104;
1316 case ':':
goto yy106;
1395 case 'z':
goto yy107;
1402 yy108:
switch(yych){
1477 case 'z':
goto yy107;
1478 default:
goto yy109;
1481 #line 510 "token.re" 1483 #line 1484 "<stdout>" 1485 #line 517 "token.re" 1508 #line 1509 "<stdout>" 1511 unsigned int yyaccept;
1518 case 0x00:
goto yy124;
1519 case 0x09:
goto yy126;
1520 case 0x0A:
goto yy112;
1521 case 0x0D:
goto yy114;
1522 case ' ':
goto yy122;
1523 case ',':
goto yy117;
1524 case ':':
goto yy116;
1525 case ']':
goto yy120;
1526 case '}':
goto yy118;
1527 default:
goto yy127;
1529 yy112: yyaccept = 0;
1533 #line 540 "token.re" 1534 {
int indt_len, nl_count = 0;
1540 if ( indt_len <= parentIndent )
1554 if ( nl_count <= 1 )
1561 for (
i = 0;
i < nl_count - 1;
i++ )
1569 #line 1570 "<stdout>" 1572 case 0x0A:
goto yy141;
1573 default:
goto yy115;
1576 #line 627 "token.re" 1580 #line 1581 "<stdout>" 1581 yy116: yyaccept = 1;
1584 case 0x0A:
goto yy136;
1585 case 0x0D:
goto yy140;
1586 case ' ':
goto yy138;
1587 default:
goto yy115;
1589 yy117: yyaccept = 1;
1592 case 0x0A:
goto yy130;
1593 case 0x0D:
goto yy134;
1594 case ' ':
goto yy132;
1595 default:
goto yy115;
1600 #line 589 "token.re" 1611 #line 1612 "<stdout>" 1615 #line 600 "token.re" 1626 #line 1627 "<stdout>" 1629 case '#':
goto yy128;
1630 default:
goto yy123;
1633 #line 617 "token.re" 1643 #line 1644 "<stdout>" 1647 #line 615 "token.re" 1649 #line 1650 "<stdout>" 1657 #line 611 "token.re" 1661 #line 1662 "<stdout>" 1665 #line 578 "token.re" 1676 #line 1677 "<stdout>" 1681 yy133:
switch(yych){
1682 case ' ':
goto yy132;
1683 default:
goto yy131;
1687 case 0x0A:
goto yy130;
1688 default:
goto yy135;
1698 #line 576 "token.re" 1700 #line 1701 "<stdout>" 1705 yy139:
switch(yych){
1706 case ' ':
goto yy138;
1707 default:
goto yy137;
1711 case 0x0A:
goto yy136;
1712 default:
goto yy135;
1714 yy141: yyaccept = 0;
1719 yy142:
switch(yych){
1720 case 0x0A:
case ' ':
goto yy141;
1721 case 0x0D:
goto yy143;
1722 default:
goto yy113;
1728 case 0x0A:
goto yy141;
1729 default:
goto yy135;
1732 #line 631 "token.re" 1746 #line 1747 "<stdout>" 1749 unsigned int yyaccept;
1756 case 0x00:
goto yy152;
1757 case 0x0A:
goto yy146;
1758 case 0x0D:
goto yy148;
1759 case '\'':
goto yy150;
1760 default:
goto yy153;
1762 yy146: yyaccept = 0;
1766 #line 645 "token.re" 1777 else if ( indt_len < lvl->spaces )
1791 if ( nl_count <= 1 )
1798 for (
i = 0;
i < nl_count - 1;
i++ )
1806 #line 1807 "<stdout>" 1809 case 0x0A:
goto yy156;
1810 default:
goto yy149;
1813 #line 712 "token.re" 1817 #line 1818 "<stdout>" 1820 case '\'':
goto yy154;
1821 default:
goto yy151;
1824 #line 689 "token.re" 1833 if ( ((
SyckParser *)parser)->taguri_expansion == 1 )
1847 #line 1848 "<stdout>" 1855 #line 685 "token.re" 1856 {
QUOTECAT(qstr, qcapa, qidx,
'\'');
1859 #line 1860 "<stdout>" 1860 yy156: yyaccept = 0;
1865 yy157:
switch(yych){
1866 case 0x0A:
case ' ':
goto yy156;
1867 case 0x0D:
goto yy158;
1868 default:
goto yy147;
1874 case 0x0A:
goto yy156;
1875 default:
goto yy159;
1882 #line 716 "token.re" 1900 #line 1901 "<stdout>" 1903 unsigned int yyaccept;
1910 case 0x00:
goto yy167;
1911 case 0x0A:
goto yy162;
1912 case 0x0D:
goto yy164;
1913 case '"':
goto yy169;
1914 case '\\':
goto yy166;
1915 default:
goto yy170;
1917 yy162: yyaccept = 0;
1921 #line 734 "token.re" 1932 else if ( indt_len < lvl->spaces )
1948 if ( nl_count <= 1 )
1955 for (
i = 0;
i < nl_count - 1;
i++ )
1965 #line 1966 "<stdout>" 1968 case 0x0A:
goto yy183;
1969 default:
goto yy165;
1972 #line 820 "token.re" 1976 #line 1977 "<stdout>" 1977 yy166: yyaccept = 1;
1980 case 0x0A:
goto yy174;
1981 case 0x0D:
goto yy176;
1982 case ' ':
goto yy171;
1983 case '"':
case '0':
case '\\':
case 'a':
1985 case 'f':
case 'n':
case 'r':
case 't':
case 'v':
goto yy178;
1986 case 'x':
goto yy177;
1987 default:
goto yy165;
1992 #line 797 "token.re" 2001 if ( ((
SyckParser *)parser)->taguri_expansion == 1 )
2015 #line 2016 "<stdout>" 2024 yy172:
switch(yych){
2025 case 0x0A:
goto yy174;
2026 case 0x0D:
goto yy176;
2027 case ' ':
goto yy171;
2028 default:
goto yy173;
2038 #line 792 "token.re" 2043 #line 2044 "<stdout>" 2046 case 0x0A:
goto yy174;
2047 default:
goto yy173;
2070 case 'f':
goto yy180;
2071 default:
goto yy173;
2076 #line 778 "token.re" 2081 #line 2082 "<stdout>" 2103 case 'f':
goto yy181;
2104 default:
goto yy173;
2109 #line 783 "token.re" 2118 #line 2119 "<stdout>" 2119 yy183: yyaccept = 0;
2124 yy184:
switch(yych){
2125 case 0x0A:
case ' ':
goto yy183;
2126 case 0x0D:
goto yy185;
2127 default:
goto yy163;
2133 case 0x0A:
goto yy183;
2134 default:
goto yy173;
2137 #line 824 "token.re" 2151 #line 2152 "<stdout>" 2154 unsigned int yyaccept;
2161 case 0x00:
goto yy188;
2162 case 0x0A:
goto yy190;
2163 case 0x0D:
goto yy192;
2164 case ' ':
goto yy191;
2165 case '\\':
goto yy194;
2166 default:
goto yy195;
2171 #line 838 "token.re" 2188 sycklval->
name[0] =
'\0';
2190 strncat( sycklval->
name, qstr + 1, qidx - 1 );
2196 char *qend = qstr + qidx;
2197 while ( (++carat) < qend )
2199 if ( *carat ==
'^' )
2208 sycklval->
name[0] =
'\0';
2210 strncat( sycklval->
name, carat + 1, ( qend - carat ) - 1 );
2215 sycklval->
name = qstr;
2221 #line 2222 "<stdout>" 2228 case 0x0A:
goto yy188;
2229 default:
goto yy193;
2232 #line 905 "token.re" 2234 goto TransferMethod2;
2236 #line 2237 "<stdout>" 2237 yy194: yyaccept = 0;
2240 case '"':
case '0':
case '\\':
case 'a':
2242 case 'f':
case 'n':
case 'r':
case 't':
case 'v':
goto yy198;
2243 case 'x':
goto yy196;
2244 default:
goto yy193;
2269 case 'f':
goto yy200;
2270 default:
goto yy197;
2279 #line 891 "token.re" 2282 goto TransferMethod2;
2284 #line 2285 "<stdout>" 2306 case 'f':
goto yy201;
2307 default:
goto yy197;
2312 #line 896 "token.re" 2319 goto TransferMethod2;
2321 #line 2322 "<stdout>" 2326 yy204:
switch(yych){
2327 case ' ':
goto yy203;
2328 default:
goto yy189;
2331 #line 910 "token.re" 2343 int forceIndent = -1;
2346 int parentIndent = -1;
2360 else if ( *yyt ==
'+' )
2364 else if ( isdigit( *yyt ) )
2377 #line 2378 "<stdout>" 2380 unsigned int yyaccept;
2387 case 0x00:
goto yy213;
2388 case 0x0A:
goto yy207;
2389 case 0x0D:
goto yy209;
2390 case '#':
goto yy211;
2391 case '-':
goto yy215;
2392 default:
goto yy216;
2394 yy207: yyaccept = 0;
2398 #line 956 "token.re" 2401 int indt_len = 0, nl_count = 0, fold_nl = 0, nl_begin = 0;
2408 if ( forceIndent > 0 ) forceIndent += parentIndent;
2409 if ( indt_len > parentIndent )
2411 int new_spaces = forceIndent > 0 ? forceIndent : indt_len;
2413 lastIndent = indt_len - new_spaces;
2428 if ( blockType ==
BLOCK_FOLD && lastIndent == 0 && ( indt_len - lvl->
spaces ) == 0 )
2440 pacer += nl_len - 1;
2444 if ( fold_nl == 1 || nl_begin == 1 )
2449 if ( nl_count < 1 && nl_begin == 0 )
2456 for (
i = 0;
i < nl_count;
i++ )
2462 lastIndent = indt_len - lvl->
spaces;
2465 if ( indt_len < lvl->spaces )
2473 #line 2474 "<stdout>" 2476 case 0x0A:
goto yy225;
2477 default:
goto yy210;
2480 #line 1070 "token.re" 2484 #line 2485 "<stdout>" 2488 #line 1032 "token.re" 2501 #line 2502 "<stdout>" 2505 #line 1046 "token.re" 2510 #line 2511 "<stdout>" 2511 yy215: yyaccept = 1;
2514 case '-':
goto yy217;
2515 default:
goto yy210;
2521 case '-':
goto yy219;
2522 default:
goto yy218;
2531 case 0x0A:
goto yy220;
2532 case 0x0D:
goto yy224;
2533 case ' ':
goto yy222;
2534 default:
goto yy218;
2539 #line 1051 "token.re" 2558 #line 2559 "<stdout>" 2563 yy223:
switch(yych){
2564 case ' ':
goto yy222;
2565 default:
goto yy221;
2569 case 0x0A:
goto yy220;
2570 default:
goto yy218;
2572 yy225: yyaccept = 0;
2577 yy226:
switch(yych){
2578 case 0x0A:
case ' ':
goto yy225;
2579 case 0x0D:
goto yy227;
2580 default:
goto yy208;
2586 case 0x0A:
goto yy225;
2587 default:
goto yy218;
2590 #line 1075 "token.re" 2606 #line 2607 "<stdout>" 2609 unsigned int yyaccept;
2616 case 0x00:
goto yy230;
2617 case 0x0A:
goto yy232;
2618 case 0x0D:
goto yy233;
2619 default:
goto yy235;
2624 #line 1091 "token.re" 2628 #line 2629 "<stdout>" 2629 yy232: yyaccept = 0;
2634 case 0x0A:
goto yy236;
2635 default:
goto yy234;
2638 #line 1095 "token.re" 2641 #line 2642 "<stdout>" 2644 yy236: yyaccept = 0;
2649 yy237:
switch(yych){
2650 case 0x0A:
goto yy236;
2651 case 0x0D:
goto yy238;
2652 default:
goto yy231;
2658 case 0x0A:
goto yy236;
2659 default:
goto yy239;
2666 #line 1098 "token.re" 2678 case '0':
return '\0';
2680 case 'b':
return '\010';
2681 case 'e':
return '\033';
2682 case 'f':
return '\014';
2683 case 'n':
return '\n';
2684 case 'r':
return '\015';
2685 case 't':
return '\t';
2686 case 'v':
return '\013';
2703 if ( *ptr ==
'\r' && *( ptr + 1 ) ==
'\n' )
enum syck_level_status status
size_t strlen(const char *)
#define S_ALLOC_N(type, n)
#define ENSURE_YAML_IOPEN(last_lvl, to_len, reset)
#define QUOTECATS(s, c, i, cs, cl)
#define QUOTECAT(s, c, i, l)
void syckerror(const char *msg)
#define RETURN_IMPLICIT()
int sycklex_bytecode_utf8(YYSTYPE *, SyckParser *)
int sycklex_yaml_utf8(YYSTYPE *, SyckParser *)
char * syck_strndup(const char *buf, long len)
enum syck_parser_input input_type
int newline_len(char *ptr)
union _syck_node::@16 data
SyckParser * syck_parser_ptr
void syck_hdlr_remove_anchor(SyckParser *p, char *a)
#define GOBBLE_UP_YAML_INDENT(ict, start)
long syck_parser_read(SyckParser *p)
#define GET_TRUE_YAML_INDENT(indt_len)
#define ADD_LEVEL(len, status)
void syck_default_error_handler(SyckParser *p, const char *msg)
struct _syck_node::@16::SyckStr * str
long strtol(const char *nptr, char **endptr, int base)
#define ENSURE_YAML_IEND(last_lvl, to_len)
int sycklex(YYSTYPE *sycklval, SyckParser *parser)
#define RETURN_YAML_BLOCK()
void eat_comments(SyckParser *)
char * syck_taguri(const char *domain, const char *type_id, int type_len)
SyckNode * syck_alloc_str(void)
SyckErrorHandler error_handler
int is_newline(char *ptr)
#define FORCE_NEXT_TOKEN(tok)