Exemplo n.º 1
0
		private YamlDocument ParseExplicitDocument(out bool success)
		{
			YamlDocument yamlDocument = new YamlDocument();
			int start_position = position;

			currentDocument = yamlDocument; currentIndent = -1;
			while (true)
			{
				Directive directive = ParseDirective(out success);
				if (success) { yamlDocument.Directives.Add(directive); }
				else { break; }
			}
			success = true;

			MatchTerminalString("---", out success);
			if (!success)
			{
				Error("Failed to parse '---' of ExplicitDocument.");
				position = start_position;
				return yamlDocument;
			}

			yamlDocument.Root = ParseSeparatedBlockNode(out success);
			if (!success)
			{
				Error("Failed to parse Root of ExplicitDocument.");
				position = start_position;
				return yamlDocument;
			}

			ParseEndOfDocument(out success);
			success = true;

			return yamlDocument;
		}
Exemplo n.º 2
0
		private YamlDocument ParseImplicitDocument(out bool success)
		{
			YamlDocument yamlDocument = new YamlDocument();
			int start_position = position;

			currentDocument = yamlDocument; currentIndent = -1;
			yamlDocument.Root = ParseIndentedBlockNode(out success);
			if (!success)
			{
				Error("Failed to parse Root of ImplicitDocument.");
				position = start_position;
				return yamlDocument;
			}

			ParseEndOfDocument(out success);
			success = true;

			return yamlDocument;
		}