コード例 #1
0
ファイル: YamlParser.cs プロジェクト: fakedarren/Packager.NET
		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;
		}
コード例 #2
0
ファイル: YamlParser.cs プロジェクト: fakedarren/Packager.NET
		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;
		}