summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-29 23:33:10 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-29 23:33:10 +0000
commit43863331673e73278f9223a284522c81a05cad55 (patch)
tree26a0794e612989e8f2f8a02e69a1d651702c8d12
parenta15c46b97917845d212a1132c732993605d6ba77 (diff)
downloadruby-43863331673e73278f9223a284522c81a05cad55.tar.gz
ruby-43863331673e73278f9223a284522c81a05cad55.tar.xz
ruby-43863331673e73278f9223a284522c81a05cad55.zip
* ext/syck/handler.c, ext/syck/syck.h: removed syck_fold_format().
* ext/syck/gram.c: flexibility for aliases and anchors. * ext/syck/token.c: folding now handled in the tokenizer. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog10
-rw-r--r--ext/syck/gram.c387
-rw-r--r--ext/syck/handler.c101
-rw-r--r--ext/syck/syck.h3
-rw-r--r--ext/syck/token.c537
5 files changed, 477 insertions, 561 deletions
diff --git a/ChangeLog b/ChangeLog
index b4a60a540..ee952e5d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Thu May 29 23:41:34 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/handler.c, ext/syck/syck.h: removed syck_fold_format().
+
+ * ext/syck/gram.c: flexibility for aliases and anchors.
+
+ * ext/syck/token.c: folding now handled in the tokenizer.
+
Fri May 30 06:21:18 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* variable.c (rb_autoload_load): should delete autoloaded
@@ -111,7 +119,7 @@ Fri May 23 14:19:29 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
Thu May 22 18:07:46 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
- * lib/token.c: single- and double-quoted root-level fix.
+ * ext/syck/token.c: single- and double-quoted root-level fix.
* lib/yaml.rb (YAML::object_maker): can create object attributes (such as
found in Exception class)
diff --git a/ext/syck/gram.c b/ext/syck/gram.c
index 8b52d62a6..898413cb1 100644
--- a/ext/syck/gram.c
+++ b/ext/syck/gram.c
@@ -228,17 +228,17 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 33
-#define YYLAST 196
+#define YYFINAL 34
+#define YYLAST 217
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 23
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 22
+#define YYNNTS 23
/* YYNRULES -- Number of rules. */
-#define YYNRULES 51
+#define YYNRULES 54
/* YYNRULES -- Number of states. */
-#define YYNSTATES 84
+#define YYNSTATES 88
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -284,43 +284,44 @@ static const unsigned char yytranslate[] =
YYRHS. */
static const unsigned char yyprhs[] =
{
- 0, 0, 3, 5, 8, 9, 11, 13, 16, 18,
- 22, 24, 25, 27, 30, 32, 34, 36, 39, 42,
- 45, 47, 49, 52, 54, 56, 58, 60, 62, 66,
- 72, 75, 77, 81, 84, 88, 91, 93, 97, 101,
- 107, 111, 113, 119, 121, 125, 129, 132, 136, 140,
- 143, 145
+ 0, 0, 3, 5, 8, 9, 11, 13, 15, 18,
+ 22, 26, 28, 29, 31, 34, 36, 38, 40, 43,
+ 46, 49, 52, 54, 56, 58, 61, 63, 65, 67,
+ 69, 71, 75, 81, 84, 86, 90, 93, 97, 100,
+ 102, 106, 110, 116, 120, 122, 128, 130, 134, 138,
+ 141, 145, 149, 152, 154
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yysigned_char yyrhs[] =
{
- 24, 0, -1, 32, -1, 10, 26, -1, -1, 31,
- -1, 32, -1, 3, 25, -1, 4, -1, 27, 25,
- 30, -1, 25, -1, -1, 11, -1, 27, 12, -1,
- 13, -1, 12, -1, 13, -1, 29, 30, -1, 5,
- 31, -1, 6, 31, -1, 7, -1, 8, -1, 5,
- 32, -1, 9, -1, 33, -1, 36, -1, 38, -1,
- 43, -1, 27, 35, 28, -1, 27, 5, 29, 35,
- 28, -1, 14, 26, -1, 34, -1, 35, 29, 34,
- -1, 35, 29, -1, 17, 37, 18, -1, 17, 18,
- -1, 25, -1, 37, 21, 25, -1, 27, 41, 28,
- -1, 27, 5, 29, 41, 28, -1, 31, 15, 26,
- -1, 39, -1, 22, 25, 29, 15, 26, -1, 40,
- -1, 41, 29, 34, -1, 41, 29, 40, -1, 41,
- 29, -1, 25, 15, 26, -1, 19, 44, 20, -1,
- 19, 20, -1, 42, -1, 44, 21, 42, -1
+ 24, 0, -1, 33, -1, 10, 27, -1, -1, 32,
+ -1, 26, -1, 33, -1, 3, 26, -1, 28, 32,
+ 31, -1, 28, 26, 31, -1, 25, -1, -1, 11,
+ -1, 28, 12, -1, 13, -1, 12, -1, 13, -1,
+ 30, 31, -1, 5, 32, -1, 6, 32, -1, 3,
+ 32, -1, 4, -1, 7, -1, 8, -1, 5, 33,
+ -1, 9, -1, 34, -1, 37, -1, 39, -1, 44,
+ -1, 28, 36, 29, -1, 28, 5, 30, 36, 29,
+ -1, 14, 27, -1, 35, -1, 36, 30, 35, -1,
+ 36, 30, -1, 17, 38, 18, -1, 17, 18, -1,
+ 25, -1, 38, 21, 25, -1, 28, 42, 29, -1,
+ 28, 5, 30, 42, 29, -1, 32, 15, 27, -1,
+ 40, -1, 22, 25, 30, 15, 27, -1, 41, -1,
+ 42, 30, 35, -1, 42, 30, 41, -1, 42, 30,
+ -1, 25, 15, 27, -1, 19, 45, 20, -1, 19,
+ 20, -1, 43, -1, 45, 21, 43, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const unsigned short yyrline[] =
{
- 0, 44, 44, 48, 52, 58, 59, 60, 69, 77,
- 83, 84, 102, 103, 106, 109, 112, 113, 121, 126,
- 134, 147, 154, 159, 160, 161, 162, 163, 169, 173,
- 180, 186, 190, 195, 204, 208, 214, 218, 228, 233,
- 241, 256, 257, 265, 266, 278, 285, 294, 302, 306,
- 312, 313
+ 0, 44, 44, 48, 52, 58, 59, 62, 63, 72,
+ 76, 82, 83, 101, 102, 105, 108, 111, 112, 120,
+ 125, 133, 137, 145, 158, 165, 170, 171, 172, 173,
+ 174, 180, 184, 191, 197, 201, 206, 215, 219, 225,
+ 229, 239, 244, 252, 267, 268, 276, 277, 289, 296,
+ 305, 313, 317, 323, 324
};
#endif
@@ -332,7 +333,7 @@ static const char *const yytname[] =
"$end", "error", "$undefined", "ANCHOR", "ALIAS", "TRANSFER", "ITRANSFER",
"WORD", "PLAIN", "BLOCK", "DOCSEP", "IOPEN", "INDENT", "IEND", "'-'",
"':'", "'+'", "'['", "']'", "'{'", "'}'", "','", "'?'", "$accept",
- "doc", "atom", "atom_or_empty", "indent_open", "indent_end",
+ "doc", "atom", "ind_rep", "atom_or_empty", "indent_open", "indent_end",
"indent_sep", "indent_flex_end", "word_rep", "struct_rep",
"implicit_seq", "basic_seq", "in_implicit_seq", "inline_seq",
"in_inline_seq", "implicit_map", "basic_mapping", "complex_mapping",
@@ -354,23 +355,23 @@ static const unsigned short yytoknum[] =
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const unsigned char yyr1[] =
{
- 0, 23, 24, 24, 24, 25, 25, 25, 25, 25,
- 26, 26, 27, 27, 28, 29, 30, 30, 31, 31,
- 31, 31, 32, 32, 32, 32, 32, 32, 33, 33,
- 34, 35, 35, 35, 36, 36, 37, 37, 38, 38,
- 39, 40, 40, 41, 41, 41, 41, 42, 43, 43,
- 44, 44
+ 0, 23, 24, 24, 24, 25, 25, 26, 26, 26,
+ 26, 27, 27, 28, 28, 29, 30, 31, 31, 32,
+ 32, 32, 32, 32, 32, 33, 33, 33, 33, 33,
+ 33, 34, 34, 35, 36, 36, 36, 37, 37, 38,
+ 38, 39, 39, 40, 41, 41, 42, 42, 42, 42,
+ 43, 44, 44, 45, 45
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const unsigned char yyr2[] =
{
- 0, 2, 1, 2, 0, 1, 1, 2, 1, 3,
- 1, 0, 1, 2, 1, 1, 1, 2, 2, 2,
- 1, 1, 2, 1, 1, 1, 1, 1, 3, 5,
- 2, 1, 3, 2, 3, 2, 1, 3, 3, 5,
- 3, 1, 5, 1, 3, 3, 2, 3, 3, 2,
- 1, 3
+ 0, 2, 1, 2, 0, 1, 1, 1, 2, 3,
+ 3, 1, 0, 1, 2, 1, 1, 1, 2, 2,
+ 2, 2, 1, 1, 1, 2, 1, 1, 1, 1,
+ 1, 3, 5, 2, 1, 3, 2, 3, 2, 1,
+ 3, 3, 5, 3, 1, 5, 1, 3, 3, 2,
+ 3, 3, 2, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -378,47 +379,47 @@ static const unsigned char yyr2[] =
means the default is an error. */
static const unsigned char yydefact[] =
{
- 4, 0, 23, 11, 12, 0, 0, 0, 0, 2,
- 24, 25, 26, 27, 22, 0, 8, 0, 0, 20,
- 21, 10, 3, 0, 5, 6, 35, 36, 0, 49,
- 0, 50, 0, 1, 0, 13, 11, 0, 0, 31,
- 0, 41, 43, 0, 7, 18, 0, 19, 0, 0,
- 5, 34, 0, 11, 48, 0, 15, 0, 30, 0,
- 11, 14, 28, 33, 38, 46, 16, 0, 9, 37,
- 47, 51, 0, 0, 0, 40, 32, 44, 45, 17,
- 29, 39, 11, 42
+ 4, 0, 26, 12, 13, 0, 0, 0, 0, 2,
+ 27, 28, 29, 30, 25, 0, 22, 0, 0, 23,
+ 24, 11, 6, 3, 0, 5, 7, 38, 39, 0,
+ 52, 0, 53, 0, 1, 0, 0, 14, 12, 0,
+ 0, 34, 0, 44, 46, 0, 8, 21, 19, 0,
+ 20, 0, 0, 0, 37, 0, 12, 51, 0, 16,
+ 0, 33, 0, 12, 15, 31, 36, 41, 49, 17,
+ 0, 10, 9, 40, 50, 54, 0, 0, 0, 43,
+ 35, 47, 48, 18, 32, 42, 12, 45
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yysigned_char yydefgoto[] =
{
- -1, 7, 21, 22, 23, 62, 57, 68, 24, 25,
- 10, 39, 40, 11, 28, 12, 41, 42, 43, 31,
- 13, 32
+ -1, 7, 21, 22, 23, 24, 65, 70, 71, 25,
+ 26, 10, 41, 42, 11, 29, 12, 43, 44, 45,
+ 32, 13, 33
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -50
+#define YYPACT_NINF -51
static const short yypact[] =
{
- 169, 13, -50, 134, -50, 117, 79, 3, 95, -50,
- -50, -50, -50, -50, -50, 134, -50, 164, 86, -50,
- -50, -50, -50, 59, -50, -50, -50, -50, -1, -50,
- -7, -50, 14, -50, 184, -50, 134, 134, 10, -50,
- 32, -50, -50, 32, -50, -50, 86, -50, 149, 62,
- 10, -50, 134, 134, -50, 134, -50, 105, -50, 15,
- 134, -50, -50, 25, -50, 105, -50, 62, -50, -50,
- -50, -50, 32, 32, 26, -50, -50, -50, -50, -50,
- -50, -50, 134, -50
+ 13, 188, -51, 166, -51, 132, 114, 19, 90, -51,
+ -51, -51, -51, -51, -51, 166, -51, 183, 61, -51,
+ -51, -51, -51, -51, 70, -51, -51, -51, -51, -7,
+ -51, 10, -51, 18, -51, 61, 205, -51, 166, 166,
+ 27, -51, 46, -51, -51, 46, -51, -51, -51, 61,
+ -51, 149, 49, 32, -51, 166, 166, -51, 166, -51,
+ 102, -51, 38, 166, -51, -51, 39, -51, 102, -51,
+ 49, -51, -51, -51, -51, -51, 46, 46, 55, -51,
+ -51, -51, -51, -51, -51, -51, 166, -51
};
/* YYPGOTO[NTERM-NUM]. */
static const yysigned_char yypgoto[] =
{
- -50, -50, -4, -24, 4, -30, -12, -21, -8, 6,
- -50, -49, 2, -50, -50, -50, -50, -15, 12, -2,
- -50, -50
+ -51, -51, -4, -9, -30, 4, -28, -5, -50, -8,
+ 12, -51, -32, 20, -51, -51, -51, -51, 15, 25,
+ 28, -51, -51
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -428,65 +429,69 @@ static const yysigned_char yypgoto[] =
#define YYTABLE_NINF -1
static const unsigned char yytable[] =
{
- 38, 27, 30, 33, 8, 8, 9, 14, 53, 45,
- 47, 44, 58, 64, 76, 50, 77, 51, 1, 49,
- 52, 8, 2, 14, 4, 60, 45, 56, 63, 70,
- 5, 65, 6, 59, 54, 55, 75, 67, 45, 36,
- 45, 82, 80, 81, 56, 61, 79, 74, 69, 38,
- 78, 30, 8, 71, 14, 67, 0, 38, 83, 72,
- 63, 65, 15, 16, 48, 18, 19, 20, 2, 73,
- 4, 35, 0, 36, 56, 66, 5, 0, 6, 0,
- 0, 37, 15, 16, 17, 18, 19, 20, 2, 0,
- 4, 46, 18, 19, 20, 0, 5, 0, 6, 29,
- 34, 18, 19, 20, 0, 0, 0, 35, 0, 36,
- 46, 18, 19, 20, 0, 0, 0, 37, 0, 36,
- 15, 16, 17, 18, 19, 20, 2, 37, 4, 0,
- 0, 0, 0, 0, 5, 26, 6, 15, 16, 17,
- 18, 19, 20, 2, 0, 4, 0, 0, 0, 0,
- 0, 5, 0, 6, 17, 18, 19, 20, 2, 0,
- 4, 56, 0, 0, 0, 0, 5, 0, 6, 17,
- 18, 19, 20, 2, 1, 4, 0, 0, 2, 3,
- 4, 5, 0, 6, 0, 0, 5, 0, 6, 46,
- 18, 19, 20, 0, 0, 0, 56
+ 40, 28, 31, 72, 8, 8, 46, 47, 61, 48,
+ 50, 54, 9, 14, 55, 52, 53, 67, 1, 34,
+ 83, 8, 2, 3, 4, 56, 74, 47, 48, 14,
+ 5, 60, 6, 79, 80, 62, 81, 66, 57, 58,
+ 68, 48, 63, 48, 59, 69, 60, 63, 84, 85,
+ 59, 73, 40, 38, 31, 8, 87, 78, 59, 64,
+ 40, 59, 69, 14, 35, 16, 49, 18, 19, 20,
+ 86, 66, 68, 15, 16, 51, 18, 19, 20, 2,
+ 76, 4, 37, 82, 38, 77, 75, 5, 0, 6,
+ 0, 0, 39, 35, 16, 36, 18, 19, 20, 0,
+ 0, 0, 37, 0, 38, 35, 16, 49, 18, 19,
+ 20, 0, 39, 0, 0, 0, 38, 15, 16, 17,
+ 18, 19, 20, 2, 39, 4, 0, 0, 0, 0,
+ 0, 5, 0, 6, 30, 15, 16, 17, 18, 19,
+ 20, 2, 0, 4, 0, 0, 0, 0, 0, 5,
+ 27, 6, 35, 16, 17, 18, 19, 20, 2, 0,
+ 4, 59, 0, 0, 0, 0, 5, 0, 6, 15,
+ 16, 17, 18, 19, 20, 2, 0, 4, 0, 0,
+ 0, 0, 0, 5, 0, 6, 35, 16, 17, 18,
+ 19, 20, 2, 1, 4, 0, 0, 2, 0, 4,
+ 5, 0, 6, 0, 0, 5, 0, 6, 35, 16,
+ 49, 18, 19, 20, 0, 0, 0, 59
};
static const yysigned_char yycheck[] =
{
- 8, 5, 6, 0, 0, 1, 0, 1, 15, 17,
- 18, 15, 36, 43, 63, 23, 65, 18, 5, 23,
- 21, 17, 9, 17, 11, 15, 34, 12, 40, 53,
- 17, 43, 19, 37, 20, 21, 60, 49, 46, 14,
- 48, 15, 72, 73, 12, 13, 67, 59, 52, 57,
- 65, 55, 48, 55, 48, 67, -1, 65, 82, 57,
- 72, 73, 3, 4, 5, 6, 7, 8, 9, 57,
- 11, 12, -1, 14, 12, 13, 17, -1, 19, -1,
- -1, 22, 3, 4, 5, 6, 7, 8, 9, -1,
- 11, 5, 6, 7, 8, -1, 17, -1, 19, 20,
- 5, 6, 7, 8, -1, -1, -1, 12, -1, 14,
- 5, 6, 7, 8, -1, -1, -1, 22, -1, 14,
- 3, 4, 5, 6, 7, 8, 9, 22, 11, -1,
- -1, -1, -1, -1, 17, 18, 19, 3, 4, 5,
- 6, 7, 8, 9, -1, 11, -1, -1, -1, -1,
- -1, 17, -1, 19, 5, 6, 7, 8, 9, -1,
- 11, 12, -1, -1, -1, -1, 17, -1, 19, 5,
- 6, 7, 8, 9, 5, 11, -1, -1, 9, 10,
- 11, 17, -1, 19, -1, -1, 17, -1, 19, 5,
- 6, 7, 8, -1, -1, -1, 12
+ 8, 5, 6, 53, 0, 1, 15, 15, 38, 17,
+ 18, 18, 0, 1, 21, 24, 24, 45, 5, 0,
+ 70, 17, 9, 10, 11, 15, 56, 35, 36, 17,
+ 17, 36, 19, 63, 66, 39, 68, 42, 20, 21,
+ 45, 49, 15, 51, 12, 13, 51, 15, 76, 77,
+ 12, 55, 60, 14, 58, 51, 86, 62, 12, 13,
+ 68, 12, 13, 51, 3, 4, 5, 6, 7, 8,
+ 15, 76, 77, 3, 4, 5, 6, 7, 8, 9,
+ 60, 11, 12, 68, 14, 60, 58, 17, -1, 19,
+ -1, -1, 22, 3, 4, 5, 6, 7, 8, -1,
+ -1, -1, 12, -1, 14, 3, 4, 5, 6, 7,
+ 8, -1, 22, -1, -1, -1, 14, 3, 4, 5,
+ 6, 7, 8, 9, 22, 11, -1, -1, -1, -1,
+ -1, 17, -1, 19, 20, 3, 4, 5, 6, 7,
+ 8, 9, -1, 11, -1, -1, -1, -1, -1, 17,
+ 18, 19, 3, 4, 5, 6, 7, 8, 9, -1,
+ 11, 12, -1, -1, -1, -1, 17, -1, 19, 3,
+ 4, 5, 6, 7, 8, 9, -1, 11, -1, -1,
+ -1, -1, -1, 17, -1, 19, 3, 4, 5, 6,
+ 7, 8, 9, 5, 11, -1, -1, 9, -1, 11,
+ 17, -1, 19, -1, -1, 17, -1, 19, 3, 4,
+ 5, 6, 7, 8, -1, -1, -1, 12
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const unsigned char yystos[] =
{
- 0, 5, 9, 10, 11, 17, 19, 24, 27, 32,
- 33, 36, 38, 43, 32, 3, 4, 5, 6, 7,
- 8, 25, 26, 27, 31, 32, 18, 25, 37, 20,
- 25, 42, 44, 0, 5, 12, 14, 22, 31, 34,
- 35, 39, 40, 41, 25, 31, 5, 31, 5, 25,
- 31, 18, 21, 15, 20, 21, 12, 29, 26, 25,
- 15, 13, 28, 29, 28, 29, 13, 29, 30, 25,
- 26, 42, 35, 41, 29, 26, 34, 34, 40, 30,
- 28, 28, 15, 26
+ 0, 5, 9, 10, 11, 17, 19, 24, 28, 33,
+ 34, 37, 39, 44, 33, 3, 4, 5, 6, 7,
+ 8, 25, 26, 27, 28, 32, 33, 18, 25, 38,
+ 20, 25, 43, 45, 0, 3, 5, 12, 14, 22,
+ 32, 35, 36, 40, 41, 42, 26, 32, 32, 5,
+ 32, 5, 26, 32, 18, 21, 15, 20, 21, 12,
+ 30, 27, 25, 15, 13, 29, 30, 29, 30, 13,
+ 30, 31, 31, 25, 27, 43, 36, 42, 30, 27,
+ 35, 35, 41, 31, 29, 29, 15, 27
};
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
@@ -1061,8 +1066,8 @@ yyreduce:
}
break;
- case 7:
-#line 61 "gram.y"
+ case 8:
+#line 64 "gram.y"
{
/*
* _Anchors_: The language binding must keep a separate symbol table
@@ -1073,26 +1078,22 @@ yyreduce:
}
break;
- case 8:
-#line 70 "gram.y"
+ case 9:
+#line 73 "gram.y"
{
- /*
- * _Aliases_: The anchor symbol table is scanned for the anchor name.
- * The anchor's ID in the language's symbol table is returned.
- */
- yyval.nodeData = syck_hdlr_add_alias( (SyckParser *)parser, yyvsp[0].name );
+ yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 9:
-#line 78 "gram.y"
+ case 10:
+#line 77 "gram.y"
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 11:
-#line 85 "gram.y"
+ case 12:
+#line 84 "gram.y"
{
SyckNode *n = syck_new_str( "" );
if ( ((SyckParser *)parser)->taguri_expansion == 1 )
@@ -1107,16 +1108,16 @@ yyreduce:
}
break;
- case 18:
-#line 122 "gram.y"
+ case 19:
+#line 121 "gram.y"
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[0].nodeData;
}
break;
- case 19:
-#line 127 "gram.y"
+ case 20:
+#line 126 "gram.y"
{
if ( ((SyckParser *)parser)->implicit_typing == 1 )
{
@@ -1126,8 +1127,26 @@ yyreduce:
}
break;
- case 20:
-#line 135 "gram.y"
+ case 21:
+#line 134 "gram.y"
+ {
+ yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
+ }
+ break;
+
+ case 22:
+#line 138 "gram.y"
+ {
+ /*
+ * _Aliases_: The anchor symbol table is scanned for the anchor name.
+ * The anchor's ID in the language's symbol table is returned.
+ */
+ yyval.nodeData = syck_hdlr_add_alias( (SyckParser *)parser, yyvsp[0].name );
+ }
+ break;
+
+ case 23:
+#line 146 "gram.y"
{
SyckNode *n = yyvsp[0].nodeData;
if ( ((SyckParser *)parser)->taguri_expansion == 1 )
@@ -1142,97 +1161,97 @@ yyreduce:
}
break;
- case 22:
-#line 155 "gram.y"
+ case 25:
+#line 166 "gram.y"
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[0].nodeData;
}
break;
- case 28:
-#line 170 "gram.y"
+ case 31:
+#line 181 "gram.y"
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 29:
-#line 174 "gram.y"
+ case 32:
+#line 185 "gram.y"
{
syck_add_transfer( yyvsp[-3].name, yyvsp[-1].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 30:
-#line 181 "gram.y"
+ case 33:
+#line 192 "gram.y"
{
yyval.nodeId = syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData );
}
break;
- case 31:
-#line 187 "gram.y"
+ case 34:
+#line 198 "gram.y"
{
yyval.nodeData = syck_new_seq( yyvsp[0].nodeId );
}
break;
- case 32:
-#line 191 "gram.y"
+ case 35:
+#line 202 "gram.y"
{
syck_seq_add( yyvsp[-2].nodeData, yyvsp[0].nodeId );
yyval.nodeData = yyvsp[-2].nodeData;
}
break;
- case 33:
-#line 196 "gram.y"
+ case 36:
+#line 207 "gram.y"
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 34:
-#line 205 "gram.y"
+ case 37:
+#line 216 "gram.y"
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 35:
-#line 209 "gram.y"
+ case 38:
+#line 220 "gram.y"
{
yyval.nodeData = syck_alloc_seq();
}
break;
- case 36:
-#line 215 "gram.y"
+ case 39:
+#line 226 "gram.y"
{
yyval.nodeData = syck_new_seq( syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
}
break;
- case 37:
-#line 219 "gram.y"
+ case 40:
+#line 230 "gram.y"
{
syck_seq_add( yyvsp[-2].nodeData, syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
yyval.nodeData = yyvsp[-2].nodeData;
}
break;
- case 38:
-#line 229 "gram.y"
+ case 41:
+#line 240 "gram.y"
{
apply_seq_in_map( (SyckParser *)parser, yyvsp[-1].nodeData );
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 39:
-#line 234 "gram.y"
+ case 42:
+#line 245 "gram.y"
{
apply_seq_in_map( (SyckParser *)parser, yyvsp[-1].nodeData );
syck_add_transfer( yyvsp[-3].name, yyvsp[-1].nodeData, ((SyckParser *)parser)->taguri_expansion );
@@ -1240,8 +1259,8 @@ yyreduce:
}
break;
- case 40:
-#line 242 "gram.y"
+ case 43:
+#line 253 "gram.y"
{
yyval.nodeData = syck_new_map(
syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
@@ -1249,8 +1268,8 @@ yyreduce:
}
break;
- case 42:
-#line 258 "gram.y"
+ case 45:
+#line 269 "gram.y"
{
yyval.nodeData = syck_new_map(
syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-3].nodeData ),
@@ -1258,8 +1277,8 @@ yyreduce:
}
break;
- case 44:
-#line 267 "gram.y"
+ case 47:
+#line 278 "gram.y"
{
if ( yyvsp[-2].nodeData->shortcut == NULL )
{
@@ -1273,8 +1292,8 @@ yyreduce:
}
break;
- case 45:
-#line 279 "gram.y"
+ case 48:
+#line 290 "gram.y"
{
apply_seq_in_map( (SyckParser *)parser, yyvsp[-2].nodeData );
syck_map_update( yyvsp[-2].nodeData, yyvsp[0].nodeData );
@@ -1283,15 +1302,15 @@ yyreduce:
}
break;
- case 46:
-#line 286 "gram.y"
+ case 49:
+#line 297 "gram.y"
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 47:
-#line 295 "gram.y"
+ case 50:
+#line 306 "gram.y"
{
yyval.nodeData = syck_new_map(
syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
@@ -1299,22 +1318,22 @@ yyreduce:
}
break;
- case 48:
-#line 303 "gram.y"
+ case 51:
+#line 314 "gram.y"
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 49:
-#line 307 "gram.y"
+ case 52:
+#line 318 "gram.y"
{
yyval.nodeData = syck_alloc_map();
}
break;
- case 51:
-#line 314 "gram.y"
+ case 54:
+#line 325 "gram.y"
{
syck_map_update( yyvsp[-2].nodeData, yyvsp[0].nodeData );
syck_free_node( yyvsp[0].nodeData );
@@ -1326,7 +1345,7 @@ yyreduce:
}
/* Line 1016 of /usr/local/share/bison/yacc.c. */
-#line 1330 "y.tab.c"
+#line 1349 "y.tab.c"
yyvsp -= yylen;
yyssp -= yylen;
@@ -1545,7 +1564,7 @@ yyreturn:
}
-#line 321 "gram.y"
+#line 332 "gram.y"
void
diff --git a/ext/syck/handler.c b/ext/syck/handler.c
index 0a03596a5..f2e387a92 100644
--- a/ext/syck/handler.c
+++ b/ext/syck/handler.c
@@ -13,6 +13,7 @@ SYMID
syck_hdlr_add_node( SyckParser *p, SyckNode *n )
{
SYMID id;
+
if ( ! n->id )
{
n->id = (p->handler)( p, n );
@@ -44,6 +45,9 @@ syck_hdlr_add_alias( SyckParser *p, char *a )
return n;
}
+ //
+ // FIXME: Return an InvalidAnchor object
+ //
return syck_new_str( "..." );
}
@@ -97,100 +101,3 @@ syck_try_implicit( SyckNode *n )
return 1;
}
-void
-syck_fold_format( struct SyckStr *n, int blockType, int indt_len, int nlDisp )
-{
- char *spc;
- char *eol = NULL;
- char *first_nl = NULL;
- char *fc = n->ptr;
- int keep_nl = 0;
- int nl_count = 0;
-
- //
- // Scan the sucker for newlines and strip indent
- //
- while ( fc < n->ptr + n->len )
- {
- if ( *fc == '\n' )
- {
- spc = fc;
- while ( *(++spc) == ' ' )
- {
- if ( blockType != BLOCK_PLAIN && spc - fc > indt_len )
- break;
- }
-
- if ( blockType != BLOCK_LIT && *spc != ' ' )
- {
- if ( eol != NULL ) fc = eol;
- if ( first_nl == NULL && keep_nl == 1 )
- {
- first_nl = fc;
- *first_nl = ' ';
- }
- if ( nl_count == 1 )
- {
- *first_nl = '\n';
- keep_nl = 0;
- }
- }
-
- fc += keep_nl;
- if ( fc != spc && ( n->len - ( spc - n->ptr ) ) > 0 )
- {
- S_MEMMOVE( fc, spc, char, n->len - ( spc - n->ptr ) );
- }
-
- n->len -= spc - fc;
- keep_nl = 1;
- eol = NULL;
- nl_count++;
- }
- else
- {
- //
- // eol tracks the last space on a line
- //
- if ( *fc == ' ' )
- {
- if ( eol == NULL ) eol = fc;
- }
- else
- {
- eol = NULL;
- }
- first_nl = NULL;
- nl_count = 0;
- fc++;
- }
- }
-
- n->ptr[n->len] = '\n';
-
- //
- // Chomp or keep?
- //
- if ( nlDisp != NL_KEEP )
- {
- fc = n->ptr + n->len - 1;
- while ( *fc == '\n' )
- fc--;
-
- if ( nlDisp != NL_CHOMP )
- fc += 1;
-
- n->len = fc - n->ptr + 1;
- }
- else
- {
- //
- // Force last line break which I gave back
- // to the tokenizer.
- //
- n->len++;
- n->ptr[n->len] = '\n';
- }
- n->ptr[ n->len ] = '\0';
-}
-
diff --git a/ext/syck/syck.h b/ext/syck/syck.h
index 6d10cab71..e74b4338c 100644
--- a/ext/syck/syck.h
+++ b/ext/syck/syck.h
@@ -10,7 +10,7 @@
#ifndef SYCK_H
#define SYCK_H
-#define SYCK_VERSION "0.29"
+#define SYCK_VERSION "0.32"
#define YAML_DOMAIN "yaml.org,2002"
#include <stdio.h>
@@ -202,7 +202,6 @@ int syck_add_sym( SyckParser *, char * );
int syck_lookup_sym( SyckParser *, SYMID, char ** );
int syck_try_implicit( SyckNode * );
char *syck_type_id_to_uri( char * );
-void syck_fold_format( struct SyckStr *, int, int, int );
void try_tag_implicit( SyckNode *, int );
char *syck_match_implicit( char *, size_t );
diff --git a/ext/syck/token.c b/ext/syck/token.c
index 0a3f08fda..e6bb1015f 100644
--- a/ext/syck/token.c
+++ b/ext/syck/token.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.5 on Thu May 22 07:19:06 2003 */
+/* Generated by re2c 0.5 on Thu May 29 17:33:02 2003 */
#line 1 "token.re"
/*
* token.re
@@ -99,18 +99,30 @@
s[i] = '\0'; \
}
+#define QUOTECATS(s, c, i, cs, cl) \
+ { \
+ while ( i + cl >= c ) \
+ { \
+ c += QUOTELEN; \
+ S_REALLOC_N( s, char, c ); \
+ } \
+ S_MEMCPY( s + i, cs, char, cl ); \
+ i += cl; \
+ s[i] = '\0'; \
+ }
+
/*
* Tags a plain scalar with a transfer method
* * Use only in "Plain" section *
*/
-#define RETURN_IMPLICIT(fold) \
+#define RETURN_IMPLICIT() \
{ \
SyckLevel *i_lvl = CURRENT_LEVEL(); \
+ SyckNode *n = syck_alloc_str(); \
YYCURSOR = YYTOKTMP; \
- yylval->nodeData = syck_new_str2( YYTOKEN, YYCURSOR - YYTOKEN ); \
- if ( fold ) { \
- syck_fold_format( yylval->nodeData->data.str, BLOCK_PLAIN, i_lvl->spaces, NL_CHOMP ); \
- } \
+ n->data.str->ptr = qstr; \
+ n->data.str->len = qidx; \
+ yylval->nodeData = n; \
if ( parser->implicit_typing == 1 ) \
{ \
try_tag_implicit( yylval->nodeData, parser->taguri_expansion ); \
@@ -119,6 +131,35 @@
}
/*
+ * Keep or chomp block?
+ * * Use only in "ScalarBlock" section *
+ */
+#define RETURN_BLOCK() \
+ { \
+ SyckNode *n = syck_alloc_str(); \
+ n->data.str->ptr = qstr; \
+ n->data.str->len = qidx; \
+ if ( qidx > 0 ) \
+ { \
+ if ( nlDoWhat != NL_KEEP ) \
+ { \
+ char *fc = n->data.str->ptr + n->data.str->len - 1; \
+ while ( *fc == '\n' ) fc--; \
+ if ( nlDoWhat != NL_CHOMP ) \
+ fc += 1; \
+ n->data.str->len = fc - n->data.str->ptr + 1; \
+ } \
+ else \
+ { \
+ n->data.str->ptr[n->data.str->len] = '\n'; \
+ n->data.str->len++; \
+ } \
+ } \
+ yylval->nodeData = n; \
+ return BLOCK; \
+ }
+
+/*
* Handles newlines, calculates indent
*/
#define GOBBLE_UP_INDENT( ict, start ) \
@@ -190,7 +231,7 @@ yylex( YYSTYPE *yylval, SyckParser *parser )
return t;
}
-#line 206
+#line 247
if ( YYLINEPTR != YYCURSOR )
@@ -224,19 +265,19 @@ yy2: yyaccept = 0;
default: goto yy3;
}
yy3:
-#line 247
+#line 288
{ YYPOS(0);
goto Document;
}
yy4: yych = *++YYCURSOR;
yy5:
-#line 233
+#line 274
{ eat_comments( parser );
goto Header;
}
yy6: yych = *++YYCURSOR;
yy7:
-#line 237
+#line 278
{ SyckLevel *lvl = CURRENT_LEVEL();
ENSURE_IEND(lvl, -1);
return 0;
@@ -244,7 +285,7 @@ yy7:
yy8: yych = *++YYCURSOR;
goto yy12;
yy9:
-#line 242
+#line 283
{ int indt_len;
GOBBLE_UP_INDENT( indt_len, YYTOKEN );
goto Header;
@@ -289,7 +330,7 @@ yy19: switch(yych){
default: goto yy20;
}
yy20:
-#line 219
+#line 260
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
@@ -311,7 +352,7 @@ yy22: switch(yych){
default: goto yy20;
}
}
-#line 251
+#line 292
Document:
@@ -352,7 +393,7 @@ yy23:
yy25: yych = *++YYCURSOR;
goto yy77;
yy26:
-#line 265
+#line 306
{ // Isolate spaces
int indt_len;
GOBBLE_UP_INDENT( indt_len, YYTOKEN );
@@ -369,7 +410,7 @@ yy26:
}
yy27: yych = *++YYCURSOR;
yy28:
-#line 280
+#line 321
{ ENSURE_IOPEN(lvl, 0, 1);
lvl = CURRENT_LEVEL();
ADD_LEVEL(lvl->spaces + 1, syck_lvl_inline);
@@ -377,7 +418,7 @@ yy28:
}
yy29: yych = *++YYCURSOR;
yy30:
-#line 286
+#line 327
{ POP_LEVEL();
return YYTOKEN[0];
}
@@ -388,7 +429,7 @@ yy31: yych = *++YYCURSOR;
default: goto yy32;
}
yy32:
-#line 338
+#line 385
{ ENSURE_IOPEN(lvl, 0, 1);
goto Plain;
}
@@ -400,9 +441,7 @@ yy33: yych = *++YYCURSOR;
}
yy34: yych = *++YYCURSOR;
switch(yych){
- case '.':
- case '/':
- case '0':
+ case '-': case '0':
case '1':
case '2':
case '3':
@@ -411,15 +450,7 @@ yy34: yych = *++YYCURSOR;
case '6':
case '7':
case '8':
- case '9':
- case ':':
- case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
+ case '9': case 'A':
case 'B':
case 'C':
case 'D':
@@ -444,12 +475,7 @@ yy34: yych = *++YYCURSOR;
case 'W':
case 'X':
case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
+ case 'Z': case '_': case 'a':
case 'b':
case 'c':
case 'd':
@@ -479,9 +505,7 @@ yy34: yych = *++YYCURSOR;
}
yy35: yych = *++YYCURSOR;
switch(yych){
- case '.':
- case '/':
- case '0':
+ case '-': case '0':
case '1':
case '2':
case '3':
@@ -490,15 +514,7 @@ yy35: yych = *++YYCURSOR;
case '6':
case '7':
case '8':
- case '9':
- case ':':
- case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
+ case '9': case 'A':
case 'B':
case 'C':
case 'D':
@@ -523,12 +539,7 @@ yy35: yych = *++YYCURSOR;
case 'W':
case 'X':
case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
+ case 'Z': case '_': case 'a':
case 'b':
case 'c':
case 'd':
@@ -558,17 +569,17 @@ yy35: yych = *++YYCURSOR;
}
yy36: yych = *++YYCURSOR;
yy37:
-#line 312
+#line 359
{ ENSURE_IOPEN(lvl, 0, 1);
goto TransferMethod; }
yy38: yych = *++YYCURSOR;
yy39:
-#line 315
+#line 362
{ ENSURE_IOPEN(lvl, 0, 1);
goto SingleQuote; }
yy40: yych = *++YYCURSOR;
yy41:
-#line 318
+#line 365
{ ENSURE_IOPEN(lvl, 0, 1);
goto DoubleQuote; }
yy42: yyaccept = 0;
@@ -590,18 +601,18 @@ yy42: yyaccept = 0;
}
yy43: yych = *++YYCURSOR;
yy44:
-#line 328
+#line 375
{ eat_comments( parser );
goto Document;
}
yy45: yych = *++YYCURSOR;
goto yy51;
yy46:
-#line 332
+#line 379
{ goto Document; }
yy47: yych = *++YYCURSOR;
yy48:
-#line 334
+#line 381
{ ENSURE_IEND(lvl, -1);
return 0;
}
@@ -644,7 +655,7 @@ yy56: switch(yych){
default: goto yy57;
}
yy57:
-#line 321
+#line 368
{ if ( *( YYCURSOR - 1 ) == '\n' )
{
YYCURSOR--;
@@ -662,9 +673,7 @@ yy60: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy61: switch(yych){
- case '.':
- case '/':
- case '0':
+ case '-': case '0':
case '1':
case '2':
case '3':
@@ -673,15 +682,7 @@ yy61: switch(yych){
case '6':
case '7':
case '8':
- case '9':
- case ':':
- case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
+ case '9': case 'A':
case 'B':
case 'C':
case 'D':
@@ -706,12 +707,7 @@ yy61: switch(yych){
case 'W':
case 'X':
case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
+ case 'Z': case '_': case 'a':
case 'b':
case 'c':
case 'd':
@@ -740,17 +736,16 @@ yy61: switch(yych){
default: goto yy62;
}
yy62:
-#line 308
- { yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
+#line 354
+ { ENSURE_IOPEN(lvl, 0, 1);
+ yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
return ALIAS;
}
yy63: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy64: switch(yych){
- case '.':
- case '/':
- case '0':
+ case '-': case '0':
case '1':
case '2':
case '3':
@@ -759,15 +754,7 @@ yy64: switch(yych){
case '6':
case '7':
case '8':
- case '9':
- case ':':
- case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
+ case '9': case 'A':
case 'B':
case 'C':
case 'D':
@@ -792,12 +779,7 @@ yy64: switch(yych){
case 'W':
case 'X':
case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
+ case 'Z': case '_': case 'a':
case 'b':
case 'c':
case 'd':
@@ -826,8 +808,9 @@ yy64: switch(yych){
default: goto yy65;
}
yy65:
-#line 304
- { yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
+#line 349
+ { ENSURE_IOPEN(lvl, 0, 1);
+ yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
return ANCHOR;
}
yy66: ++YYCURSOR;
@@ -838,14 +821,18 @@ yy67: switch(yych){
default: goto yy68;
}
yy68:
-#line 294
+#line 335
{ ENSURE_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1);
FORCE_NEXT_TOKEN(IOPEN);
- if ( *( YYCURSOR - 1 ) == '\n' )
+ if ( *YYCURSOR == '\n' || *( YYCURSOR - 1 ) == '\n' )
{
YYCURSOR--;
+ ADD_LEVEL((YYTOKEN + 1) - YYLINEPTR, syck_lvl_doc);
+ }
+ else
+ {
+ ADD_LEVEL(YYCURSOR - YYLINEPTR, syck_lvl_doc);
}
- ADD_LEVEL(YYCURSOR - YYLINEPTR, syck_lvl_doc);
return YYTOKEN[0];
}
yy69: ++YYCURSOR;
@@ -863,7 +850,7 @@ yy72: switch(yych){
default: goto yy73;
}
yy73:
-#line 290
+#line 331
{ YYPOS(1);
return YYTOKEN[0];
}
@@ -890,7 +877,7 @@ yy79: switch(yych){
default: goto yy26;
}
}
-#line 342
+#line 389
}
@@ -919,9 +906,7 @@ yy82: YYCURSOR = YYMARKER;
yy83: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case '.':
- case '/':
- case '0':
+ case '-': case '0':
case '1':
case '2':
case '3':
@@ -930,15 +915,7 @@ yy83: yyaccept = 0;
case '6':
case '7':
case '8':
- case '9':
- case ':':
- case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
+ case '9': case 'A':
case 'B':
case 'C':
case 'D':
@@ -963,12 +940,7 @@ yy83: yyaccept = 0;
case 'W':
case 'X':
case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
+ case 'Z': case '_': case 'a':
case 'b':
case 'c':
case 'd':
@@ -997,14 +969,14 @@ yy83: yyaccept = 0;
default: goto yy84;
}
yy84:
-#line 355
+#line 402
{ YYCURSOR = YYTOKTMP;
return DOCSEP;
}
yy85: yych = *++YYCURSOR;
goto yy89;
yy86:
-#line 353
+#line 400
{ goto Directive; }
yy87: yych = *++YYCURSOR;
goto yy84;
@@ -1019,9 +991,7 @@ yy90: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy91: switch(yych){
- case '.':
- case '/':
- case '0':
+ case '-': case '0':
case '1':
case '2':
case '3':
@@ -1030,13 +1000,7 @@ yy91: switch(yych){
case '6':
case '7':
case '8':
- case '9': case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
+ case '9': case 'A':
case 'B':
case 'C':
case 'D':
@@ -1061,12 +1025,7 @@ yy91: switch(yych){
case 'W':
case 'X':
case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
+ case 'Z': case '_': case 'a':
case 'b':
case 'c':
case 'd':
@@ -1097,9 +1056,7 @@ yy91: switch(yych){
}
yy92: yych = *++YYCURSOR;
switch(yych){
- case '.':
- case '/':
- case '0':
+ case '-': case '0':
case '1':
case '2':
case '3':
@@ -1108,15 +1065,7 @@ yy92: yych = *++YYCURSOR;
case '6':
case '7':
case '8':
- case '9':
- case ':':
- case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
+ case '9': case 'A':
case 'B':
case 'C':
case 'D':
@@ -1141,12 +1090,7 @@ yy92: yych = *++YYCURSOR;
case 'W':
case 'X':
case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
+ case 'Z': case '_': case 'a':
case 'b':
case 'c':
case 'd':
@@ -1178,9 +1122,7 @@ yy93: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy94: switch(yych){
- case '.':
- case '/':
- case '0':
+ case '-': case '0':
case '1':
case '2':
case '3':
@@ -1189,15 +1131,7 @@ yy94: switch(yych){
case '6':
case '7':
case '8':
- case '9':
- case ':':
- case ';':
- case '<':
- case '=':
- case '>':
- case '?':
- case '@':
- case 'A':
+ case '9': case 'A':
case 'B':
case 'C':
case 'D':
@@ -1222,12 +1156,7 @@ yy94: switch(yych){
case 'W':
case 'X':
case 'Y':
- case 'Z':
- case '[':
- case '\\':
- case ']':
- case '^':
- case '_': case 'a':
+ case 'Z': case '_': case 'a':
case 'b':
case 'c':
case 'd':
@@ -1256,19 +1185,22 @@ yy94: switch(yych){
default: goto yy95;
}
yy95:
-#line 351
+#line 398
{ goto Directive; }
}
-#line 358
+#line 405
}
Plain:
{
+ int qidx = 0;
+ int qcapa = 100;
+ char *qstr = S_ALLOC_N( char, qcapa );
SyckLevel *plvl;
int parentIndent;
- int multiLine = 0;
+
YYCURSOR = YYTOKEN;
plvl = CURRENT_LEVEL();
GET_TRUE_INDENT(parentIndent);
@@ -1287,9 +1219,9 @@ yy96:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy105;
+ case '\000': goto yy107;
case '\n': goto yy98;
- case ' ': goto yy107;
+ case ' ': goto yy105;
case ',': goto yy104;
case ':': goto yy100;
case ']': case '}': goto yy102;
@@ -1298,8 +1230,8 @@ yy96:
yy98: yych = *++YYCURSOR;
goto yy122;
yy99:
-#line 378
- { int indt_len;
+#line 428
+ { int indt_len, nl_count = 0;
SyckLevel *lvl;
char *tok = YYTOKTMP;
GOBBLE_UP_INDENT( indt_len, tok );
@@ -1307,10 +1239,27 @@ yy99:
if ( indt_len <= parentIndent )
{
- RETURN_IMPLICIT(multiLine);
+ RETURN_IMPLICIT();
+ }
+
+ while ( YYTOKTMP < YYCURSOR )
+ {
+ if ( *YYTOKTMP++ == '\n' )
+ nl_count++;
+ }
+ if ( nl_count <= 1 )
+ {
+ QUOTECAT(qstr, qcapa, qidx, ' ');
+ }
+ else
+ {
+ int i;
+ for ( i = 0; i < nl_count - 1; i++ )
+ {
+ QUOTECAT(qstr, qcapa, qidx, '\n');
+ }
}
- multiLine = 1;
goto Plain2;
}
yy100: yych = *++YYCURSOR;
@@ -1320,13 +1269,20 @@ yy100: yych = *++YYCURSOR;
default: goto yy101;
}
yy101:
-#line 407
- { goto Plain2; }
+#line 479
+ { QUOTECATS(qstr, qcapa, qidx, YYTOKTMP, YYCURSOR - YYTOKTMP);
+ goto Plain2;
+ }
yy102: yych = *++YYCURSOR;
yy103:
-#line 395
- { if ( plvl->status != syck_lvl_inline ) goto Plain2;
- RETURN_IMPLICIT(multiLine);
+#line 462
+ { if ( plvl->status != syck_lvl_inline )
+ {
+ YYCURSOR--;
+ QUOTECATS(qstr, qcapa, qidx, YYTOKTMP, YYCURSOR - YYTOKTMP);
+ goto Plain2;
+ }
+ RETURN_IMPLICIT();
}
yy104: yych = *++YYCURSOR;
switch(yych){
@@ -1335,24 +1291,24 @@ yy104: yych = *++YYCURSOR;
default: goto yy101;
}
yy105: yych = *++YYCURSOR;
-yy106:
-#line 399
- { RETURN_IMPLICIT(multiLine); }
-yy107: yych = *++YYCURSOR;
switch(yych){
case '#': goto yy110;
- default: goto yy108;
+ default: goto yy106;
}
-yy108:
-#line 405
+yy106:
+#line 477
{ goto Plain3; }
+yy107: yych = *++YYCURSOR;
+yy108:
+#line 475
+ { RETURN_IMPLICIT(); }
yy109: yych = *++YYCURSOR;
goto yy101;
yy110: yych = *++YYCURSOR;
yy111:
-#line 401
+#line 471
{ eat_comments( parser );
- RETURN_IMPLICIT(multiLine);
+ RETURN_IMPLICIT();
}
yy112: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -1376,8 +1332,8 @@ yy117: switch(yych){
default: goto yy118;
}
yy118:
-#line 393
- { RETURN_IMPLICIT(multiLine); }
+#line 460
+ { RETURN_IMPLICIT(); }
yy119: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -1401,7 +1357,7 @@ yy124: switch(yych){
default: goto yy99;
}
}
-#line 409
+#line 483
}
@@ -1431,7 +1387,7 @@ yy125:
yy127: yych = *++YYCURSOR;
goto yy137;
yy128:
-#line 423
+#line 497
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1473,7 +1429,7 @@ yy129: yych = *++YYCURSOR;
default: goto yy130;
}
yy130:
-#line 463
+#line 537
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1491,13 +1447,13 @@ yy131: yych = *++YYCURSOR;
goto yy130;
yy132: yych = *++YYCURSOR;
yy133:
-#line 477
+#line 551
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto SingleQuote2;
}
yy134: yych = *++YYCURSOR;
yy135:
-#line 459
+#line 533
{ QUOTECAT(qstr, qcapa, qidx, '\'');
goto SingleQuote2;
}
@@ -1517,7 +1473,7 @@ yy139: switch(yych){
default: goto yy128;
}
}
-#line 481
+#line 555
}
@@ -1552,7 +1508,7 @@ yy140:
yy142: yych = *++YYCURSOR;
goto yy158;
yy143:
-#line 499
+#line 573
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1603,13 +1559,13 @@ yy144: yyaccept = 0;
default: goto yy145;
}
yy145:
-#line 574
+#line 648
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto DoubleQuote2;
}
yy146: yych = *++YYCURSOR;
yy147:
-#line 560
+#line 634
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1641,15 +1597,15 @@ yy152: YYCURSOR = YYMARKER;
}
yy153: yych = *++YYCURSOR;
yy154:
-#line 555
+#line 629
{ keep_nl = 0;
YYCURSOR--;
goto DoubleQuote2;
}
yy155: yych = *++YYCURSOR;
yy156:
-#line 539
- { char ch = *( YYCURSOR - 1 );
+#line 613
+ { char ch = *( YYCURSOR - 1 );
switch ( ch )
{
case 'a': ch = 7; break;
@@ -1680,7 +1636,7 @@ yy160: switch(yych){
default: goto yy143;
}
}
-#line 578
+#line 652
}
@@ -1705,7 +1661,7 @@ yy161:
yy163:yy164: yych = *++YYCURSOR;
goto yy172;
yy165:
-#line 587
+#line 661
{ SyckLevel *lvl;
YYCURSOR = YYTOKTMP;
if ( YYCURSOR == YYTOKEN + 1 )
@@ -1755,7 +1711,7 @@ yy166: yych = *++YYCURSOR;
goto yy170;
yy167: yych = *++YYCURSOR;
yy168:
-#line 633
+#line 707
{ goto TransferMethod; }
yy169: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -1772,14 +1728,19 @@ yy172: switch(yych){
default: goto yy165;
}
}
-#line 635
+#line 709
}
ScalarBlock:
{
+ int keep_nl = 1;
+ int qidx = 0;
+ int qcapa = 100;
+ char *qstr = S_ALLOC_N( char, qcapa );
int blockType = 0;
int nlDoWhat = 0;
+ int lastIndent = 0;
int forceIndent = -1;
char *yyt = YYTOKEN;
SyckLevel *lvl = CURRENT_LEVEL();
@@ -1808,6 +1769,7 @@ ScalarBlock:
}
}
+ qstr[0] = '\0';
YYTOKEN = YYCURSOR;
ScalarBlock2:
@@ -1824,85 +1786,106 @@ yy173:
switch(yych){
case '\000': goto yy177;
case '\n': goto yy175;
- case '#': goto yy179;
- default: goto yy181;
+ default: goto yy179;
}
yy175: yych = *++YYCURSOR;
- goto yy184;
+ goto yy182;
yy176:
-#line 677
- { int indt_len;
- GOBBLE_UP_INDENT( indt_len, YYTOKTMP );
+#line 757
+ { char *pacer;
+ char *tok = YYTOKTMP;
+ int indt_len = 0, nl_count = 0, fold_nl = 0;
+ GOBBLE_UP_INDENT( indt_len, tok );
lvl = CURRENT_LEVEL();
if ( indt_len > parentIndent && lvl->status != syck_lvl_block )
{
ADD_LEVEL( forceIndent > 0 ? forceIndent : indt_len, syck_lvl_block );
+ goto ScalarBlock2;
}
lvl = CURRENT_LEVEL();
if ( lvl->status != syck_lvl_block )
{
- yylval->nodeData = syck_new_str2( YYTOKEN, 0 );
YYCURSOR = YYTOKTMP;
- return BLOCK;
+ RETURN_BLOCK();
}
- else if ( indt_len < lvl->spaces )
+
+ //
+ // Fold only in the event of two lines being on the leftmost
+ // indentation.
+ //
+ if ( blockType == BLOCK_FOLD && lastIndent == 0 && ( indt_len - lvl->spaces ) == 0 )
{
- YYCURSOR--;
- yylval->nodeData = syck_new_str2( YYTOKEN, YYCURSOR - YYTOKEN );
- syck_fold_format( yylval->nodeData->data.str, blockType, lvl->spaces, nlDoWhat );
- if ( lvl->status == syck_lvl_block )
+ fold_nl = 1;
+ }
+
+ pacer = YYTOKTMP;
+ while ( pacer < YYCURSOR )
+ {
+ if ( *pacer++ == '\n' )
+ nl_count++;
+ }
+
+ if ( fold_nl == 1 )
+ {
+ nl_count--;
+ }
+
+ if ( nl_count < 1 )
+ {
+ QUOTECAT(qstr, qcapa, qidx, ' ');
+ }
+ else
+ {
+ int i;
+ for ( i = 0; i < nl_count; i++ )
{
- POP_LEVEL();
+ QUOTECAT(qstr, qcapa, qidx, '\n');
}
+ }
+
+ lastIndent = indt_len - lvl->spaces;
+ YYCURSOR -= lastIndent;
+
+ if ( indt_len < lvl->spaces )
+ {
+ POP_LEVEL();
YYCURSOR = YYTOKTMP;
- return BLOCK;
+ RETURN_BLOCK();
}
goto ScalarBlock2;
}
yy177: yych = *++YYCURSOR;
yy178:
-#line 709
- { lvl = CURRENT_LEVEL();
- YYCURSOR--;
- yylval->nodeData = syck_new_str2( YYTOKEN, YYCURSOR - YYTOKEN );
- syck_fold_format( yylval->nodeData->data.str, blockType, lvl->spaces, nlDoWhat );
+#line 823
+ { YYCURSOR--;
POP_LEVEL();
- return BLOCK;
+ RETURN_BLOCK();
}
yy179: yych = *++YYCURSOR;
yy180:
-#line 717
- { lvl = CURRENT_LEVEL();
- if ( lvl->status != syck_lvl_block )
- {
- eat_comments( parser );
- YYTOKEN = YYCURSOR;
- }
+#line 828
+ { QUOTECAT(qstr, qcapa, qidx, *YYTOKTMP);
goto ScalarBlock2;
}
-yy181: yych = *++YYCURSOR;
-yy182:
-#line 726
- { goto ScalarBlock2; }
-yy183: ++YYCURSOR;
+yy181: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy184: switch(yych){
- case '\n': goto yy183;
- case ' ': goto yy185;
+yy182: switch(yych){
+ case '\n': goto yy181;
+ case ' ': goto yy183;
default: goto yy176;
}
-yy185: ++YYCURSOR;
+yy183: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy186: switch(yych){
- case '\n': case ' ': goto yy185;
+yy184: switch(yych){
+ case '\n': case ' ': goto yy183;
default: goto yy176;
}
}
-#line 728
+#line 833
}
@@ -1920,39 +1903,39 @@ Comment:
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy187;
-yy188: ++YYCURSOR;
-yy187:
+ goto yy185;
+yy186: ++YYCURSOR;
+yy185:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy189;
- case '\n': goto yy191;
- default: goto yy192;
+ case '\000': goto yy187;
+ case '\n': goto yy189;
+ default: goto yy190;
}
-yy189: yych = *++YYCURSOR;
-yy190:
-#line 744
+yy187: yych = *++YYCURSOR;
+yy188:
+#line 849
{ SyckLevel *lvl = CURRENT_LEVEL();
YYCURSOR = tok;
return;
}
-yy191: yych = *++YYCURSOR;
- goto yy195;
-yy192: yych = *++YYCURSOR;
-yy193:
-#line 749
+yy189: yych = *++YYCURSOR;
+ goto yy193;
+yy190: yych = *++YYCURSOR;
+yy191:
+#line 854
{ goto Comment;
}
-yy194: ++YYCURSOR;
+yy192: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy195: switch(yych){
- case '\n': goto yy194;
- default: goto yy190;
+yy193: switch(yych){
+ case '\n': goto yy192;
+ default: goto yy188;
}
}
-#line 752
+#line 857
}