зеркало из https://github.com/stride3d/SharpYaml.git
Added projects for Visual Studio 2005.
Added XML comments to YamlDotNet.Core.
This commit is contained in:
Родитель
82c98a5b40
Коммит
9d10f703f7
|
@ -0,0 +1,40 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
#if DEBUG
|
||||
[assembly: AssemblyConfiguration("Debug")]
|
||||
#else
|
||||
[assembly: AssemblyConfiguration("Release")]
|
||||
#endif
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("YamlDotNet")]
|
||||
[assembly: AssemblyCopyright("Copyright © Antoine Aubry 2008")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("eb49cd18-fe25-4b2e-b47e-9deb9449c106")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
[assembly: CLSCompliant(true)]
|
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичные данные
Help/YamlDotNet.chm
Двоичные данные
Help/YamlDotNet.chm
Двоичный файл не отображается.
|
@ -1,24 +0,0 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("YamlDotNet.Core")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// If the build and revision are set to '*' they will be updated automatically.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
[assembly: AssemblyDelaySign(false)]
|
|
@ -1,15 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
public class Alias : Event
|
||||
{
|
||||
public Alias(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
|
||||
public Alias() {
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +1,27 @@
|
|||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
public class DocumentEnd : Event
|
||||
{
|
||||
public DocumentEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
|
||||
public DocumentEnd() {
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a document end event.
|
||||
/// </summary>
|
||||
public class DocumentEnd : ParsingEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocumentEnd"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public DocumentEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocumentEnd"/> class.
|
||||
/// </summary>
|
||||
public DocumentEnd()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,44 +1,80 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using YamlDotNet.Core.Tokens;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
public class DocumentStart : Event
|
||||
{
|
||||
private readonly IList<TagDirective> tags;
|
||||
private readonly VersionDirective version;
|
||||
|
||||
public IList<TagDirective> Tags {
|
||||
get {
|
||||
return tags;
|
||||
}
|
||||
}
|
||||
|
||||
public VersionDirective Version {
|
||||
get {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
public DocumentStart(Tokens.VersionDirective version, IList<Tokens.TagDirective> tags, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.version = version;
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public DocumentStart(Tokens.VersionDirective version, IList<Tokens.TagDirective> tags)
|
||||
: this(version, tags, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public DocumentStart(Mark start, Mark end)
|
||||
: this(null, null, start, end)
|
||||
{
|
||||
}
|
||||
|
||||
public DocumentStart() {
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using YamlDotNet.Core.Tokens;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a document start event.
|
||||
/// </summary>
|
||||
public class DocumentStart : ParsingEvent
|
||||
{
|
||||
private readonly IList<TagDirective> tags;
|
||||
private readonly VersionDirective version;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tags.
|
||||
/// </summary>
|
||||
/// <value>The tags.</value>
|
||||
public IList<TagDirective> Tags
|
||||
{
|
||||
get
|
||||
{
|
||||
return tags;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version.
|
||||
/// </summary>
|
||||
/// <value>The version.</value>
|
||||
public VersionDirective Version
|
||||
{
|
||||
get
|
||||
{
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocumentStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="version">The version.</param>
|
||||
/// <param name="tags">The tags.</param>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public DocumentStart(Tokens.VersionDirective version, IList<Tokens.TagDirective> tags, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.version = version;
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocumentStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="version">The version.</param>
|
||||
/// <param name="tags">The tags.</param>
|
||||
public DocumentStart(Tokens.VersionDirective version, IList<Tokens.TagDirective> tags)
|
||||
: this(version, tags, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocumentStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public DocumentStart(Mark start, Mark end)
|
||||
: this(null, null, start, end)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocumentStart"/> class.
|
||||
/// </summary>
|
||||
public DocumentStart()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
public abstract class Event
|
||||
{
|
||||
private Mark start;
|
||||
|
||||
public Mark Start {
|
||||
get {
|
||||
return start;
|
||||
}
|
||||
}
|
||||
|
||||
private Mark end;
|
||||
|
||||
public Mark End {
|
||||
get {
|
||||
return end;
|
||||
}
|
||||
}
|
||||
|
||||
public Event() {
|
||||
}
|
||||
|
||||
public Event(Mark start, Mark end) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +1,27 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
public interface INodeEvent
|
||||
{
|
||||
string Anchor {
|
||||
get;
|
||||
}
|
||||
|
||||
string Tag {
|
||||
get;
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the interface that the events related to YAML nodes must implement.
|
||||
/// </summary>
|
||||
public interface INodeEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the anchor.
|
||||
/// </summary>
|
||||
string Anchor
|
||||
{
|
||||
get;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tag.
|
||||
/// </summary>
|
||||
string Tag
|
||||
{
|
||||
get;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +1,27 @@
|
|||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
public class MappingEnd : Event
|
||||
{
|
||||
public MappingEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
|
||||
public MappingEnd() {
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a mapping end event.
|
||||
/// </summary>
|
||||
public class MappingEnd : ParsingEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MappingEnd"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public MappingEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MappingEnd"/> class.
|
||||
/// </summary>
|
||||
public MappingEnd()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,33 +1,59 @@
|
|||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
public class MappingStart : Event, INodeEvent
|
||||
{
|
||||
private string anchor;
|
||||
|
||||
public string Anchor {
|
||||
get {
|
||||
return anchor;
|
||||
}
|
||||
}
|
||||
|
||||
private string tag;
|
||||
|
||||
public string Tag {
|
||||
get {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
|
||||
public MappingStart(string anchor, string tag, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.anchor = anchor;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public MappingStart() {
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a mapping start event.
|
||||
/// </summary>
|
||||
public class MappingStart : ParsingEvent, INodeEvent
|
||||
{
|
||||
private string anchor;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the anchor.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string Anchor
|
||||
{
|
||||
get
|
||||
{
|
||||
return anchor;
|
||||
}
|
||||
}
|
||||
|
||||
private string tag;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tag.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string Tag
|
||||
{
|
||||
get
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MappingStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="anchor">The anchor.</param>
|
||||
/// <param name="tag">The tag.</param>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public MappingStart(string anchor, string tag, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.anchor = anchor;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MappingStart"/> class.
|
||||
/// </summary>
|
||||
public MappingStart()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,38 +1,69 @@
|
|||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
public class Scalar : Event, INodeEvent
|
||||
{
|
||||
private string anchor;
|
||||
|
||||
public string Anchor {
|
||||
get {
|
||||
return anchor;
|
||||
}
|
||||
}
|
||||
|
||||
private string tag;
|
||||
|
||||
public string Tag {
|
||||
get {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
|
||||
public Scalar(string anchor, string tag, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.anchor = anchor;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public Scalar(string anchor, string tag)
|
||||
: this(anchor, tag, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public Scalar() {
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a scalar event.
|
||||
/// </summary>
|
||||
public class Scalar : ParsingEvent, INodeEvent
|
||||
{
|
||||
private string anchor;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the anchor.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string Anchor
|
||||
{
|
||||
get
|
||||
{
|
||||
return anchor;
|
||||
}
|
||||
}
|
||||
|
||||
private string tag;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tag.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string Tag
|
||||
{
|
||||
get
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Scalar"/> class.
|
||||
/// </summary>
|
||||
/// <param name="anchor">The anchor.</param>
|
||||
/// <param name="tag">The tag.</param>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public Scalar(string anchor, string tag, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.anchor = anchor;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Scalar"/> class.
|
||||
/// </summary>
|
||||
/// <param name="anchor">The anchor.</param>
|
||||
/// <param name="tag">The tag.</param>
|
||||
public Scalar(string anchor, string tag)
|
||||
: this(anchor, tag, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Scalar"/> class.
|
||||
/// </summary>
|
||||
public Scalar()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,27 @@
|
|||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
public class SequenceEnd : Event
|
||||
{
|
||||
public SequenceEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
|
||||
public SequenceEnd() {
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a sequence end event.
|
||||
/// </summary>
|
||||
public class SequenceEnd : ParsingEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SequenceEnd"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public SequenceEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SequenceEnd"/> class.
|
||||
/// </summary>
|
||||
public SequenceEnd()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,33 +1,59 @@
|
|||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
public class SequenceStart : Event, INodeEvent
|
||||
{
|
||||
private string anchor;
|
||||
|
||||
public string Anchor {
|
||||
get {
|
||||
return anchor;
|
||||
}
|
||||
}
|
||||
|
||||
private string tag;
|
||||
|
||||
public string Tag {
|
||||
get {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
|
||||
public SequenceStart(string anchor, string tag, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.anchor = anchor;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public SequenceStart() {
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a sequence start event.
|
||||
/// </summary>
|
||||
public class SequenceStart : ParsingEvent, INodeEvent
|
||||
{
|
||||
private string anchor;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the anchor.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string Anchor
|
||||
{
|
||||
get
|
||||
{
|
||||
return anchor;
|
||||
}
|
||||
}
|
||||
|
||||
private string tag;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tag.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string Tag
|
||||
{
|
||||
get
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SequenceStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="anchor">The anchor.</param>
|
||||
/// <param name="tag">The tag.</param>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public SequenceStart(string anchor, string tag, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.anchor = anchor;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SequenceStart"/> class.
|
||||
/// </summary>
|
||||
public SequenceStart()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +1,27 @@
|
|||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
public class StreamEnd : Event
|
||||
{
|
||||
public StreamEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
|
||||
public StreamEnd() {
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a stream end event.
|
||||
/// </summary>
|
||||
public class StreamEnd : ParsingEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StreamEnd"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public StreamEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StreamEnd"/> class.
|
||||
/// </summary>
|
||||
public StreamEnd()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,28 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
public class StreamStart : Event
|
||||
{
|
||||
public StreamStart() {
|
||||
}
|
||||
|
||||
public StreamStart(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a stream start event.
|
||||
/// </summary>
|
||||
public class StreamStart : ParsingEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StreamStart"/> class.
|
||||
/// </summary>
|
||||
public StreamStart()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StreamStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public StreamStart(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,39 +1,61 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Generic queue on which items may be inserted
|
||||
/// </summary>
|
||||
public class InsertionQueue<T>
|
||||
{
|
||||
// TODO: Use a more efficient data structure
|
||||
|
||||
private IList<T> items = new List<T>();
|
||||
|
||||
public int Count {
|
||||
get {
|
||||
return items.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public void Enqueue(T item) {
|
||||
items.Add(item);
|
||||
}
|
||||
|
||||
public T Dequeue() {
|
||||
if(Count == 0) {
|
||||
throw new InvalidOperationException("The queue is empty");
|
||||
}
|
||||
|
||||
T item = items[0];
|
||||
items.RemoveAt(0);
|
||||
return item;
|
||||
}
|
||||
|
||||
public void Insert(int index, T item) {
|
||||
items.Insert(index, item);
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Generic queue on which items may be inserted
|
||||
/// </summary>
|
||||
public class InsertionQueue<T>
|
||||
{
|
||||
// TODO: Use a more efficient data structure
|
||||
|
||||
private IList<T> items = new List<T>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of items that are contained by the queue.
|
||||
/// </summary>
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return items.Count;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enqueues the specified item.
|
||||
/// </summary>
|
||||
/// <param name="item">The item to be enqueued.</param>
|
||||
public void Enqueue(T item)
|
||||
{
|
||||
items.Add(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dequeues an item.
|
||||
/// </summary>
|
||||
/// <returns>Returns the item that been dequeued.</returns>
|
||||
public T Dequeue()
|
||||
{
|
||||
if (Count == 0)
|
||||
{
|
||||
throw new InvalidOperationException("The queue is empty");
|
||||
}
|
||||
|
||||
T item = items[0];
|
||||
items.RemoveAt(0);
|
||||
return item;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item at the specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">The index where to insert the item.</param>
|
||||
/// <param name="item">The item to be inserted.</param>
|
||||
public void Insert(int index, T item)
|
||||
{
|
||||
items.Insert(index, item);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,103 +1,126 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides access to a stream and allows to peek at the next characters,
|
||||
/// up to the buffer's capacity.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This class implements a circular buffer with a fixed capacity.
|
||||
/// </remarks>
|
||||
public class LookAheadBuffer
|
||||
{
|
||||
private readonly TextReader input;
|
||||
private readonly char[] buffer;
|
||||
private int firstIndex;
|
||||
private int count;
|
||||
private bool endOfInput;
|
||||
|
||||
public LookAheadBuffer(TextReader input, int capacity)
|
||||
{
|
||||
if(input == null) {
|
||||
throw new ArgumentNullException("input");
|
||||
}
|
||||
if(capacity < 1) {
|
||||
throw new ArgumentOutOfRangeException("capacity", "The capacity must be positive.");
|
||||
}
|
||||
|
||||
this.input = input;
|
||||
buffer = new char[capacity];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the end of the input reader has been reached.
|
||||
/// </summary>
|
||||
public bool EndOfInput {
|
||||
get {
|
||||
return endOfInput && count == 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the index of the character for the specified offset.
|
||||
/// </summary>
|
||||
private int GetIndexForOffset(int offset) {
|
||||
int index = firstIndex + offset;
|
||||
if(index >= buffer.Length) {
|
||||
index -= buffer.Length;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the character at thhe specified offset.
|
||||
/// </summary>
|
||||
public char Peek(int offset) {
|
||||
if(offset < 0 || offset >= buffer.Length) {
|
||||
throw new ArgumentOutOfRangeException("offset", "The offset must be betwwen zero and the capacity of the buffer.");
|
||||
}
|
||||
|
||||
Cache(offset);
|
||||
|
||||
if(offset < count) {
|
||||
return buffer[GetIndexForOffset(offset)];
|
||||
} else {
|
||||
return '\0';
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads characters until at least <paramref name="length"/> characters are in the buffer.
|
||||
/// </summary>
|
||||
/// <param name="length">
|
||||
/// Number of characters to cache.
|
||||
/// </param>
|
||||
public void Cache(int length) {
|
||||
while(length >= count) {
|
||||
int nextChar = input.Read();
|
||||
if(nextChar >= 0) {
|
||||
int lastIndex = GetIndexForOffset(count);
|
||||
buffer[lastIndex] = (char)nextChar;
|
||||
++count;
|
||||
} else {
|
||||
endOfInput = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Skips the next <paramref name="length"/> characters. Those characters must have been
|
||||
/// obtained first by calling the <see cref="Peek"/> or <see cref="Cache"/> methods.
|
||||
/// </summary>
|
||||
public void Skip(int length) {
|
||||
if(length < 1 || length > count) {
|
||||
throw new ArgumentOutOfRangeException("length", "The length must be between 1 and the number of characters in the buffer. Use the Peek() and / or Cache() methods to fill the buffer.");
|
||||
}
|
||||
firstIndex = GetIndexForOffset(length);
|
||||
count -= length;
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides access to a stream and allows to peek at the next characters,
|
||||
/// up to the buffer's capacity.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This class implements a circular buffer with a fixed capacity.
|
||||
/// </remarks>
|
||||
public class LookAheadBuffer
|
||||
{
|
||||
private readonly TextReader input;
|
||||
private readonly char[] buffer;
|
||||
private int firstIndex;
|
||||
private int count;
|
||||
private bool endOfInput;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LookAheadBuffer"/> class.
|
||||
/// </summary>
|
||||
/// <param name="input">The input.</param>
|
||||
/// <param name="capacity">The capacity.</param>
|
||||
public LookAheadBuffer(TextReader input, int capacity)
|
||||
{
|
||||
if (input == null)
|
||||
{
|
||||
throw new ArgumentNullException("input");
|
||||
}
|
||||
if (capacity < 1)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("capacity", "The capacity must be positive.");
|
||||
}
|
||||
|
||||
this.input = input;
|
||||
buffer = new char[capacity];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the end of the input reader has been reached.
|
||||
/// </summary>
|
||||
public bool EndOfInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return endOfInput && count == 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the index of the character for the specified offset.
|
||||
/// </summary>
|
||||
private int GetIndexForOffset(int offset)
|
||||
{
|
||||
int index = firstIndex + offset;
|
||||
if (index >= buffer.Length)
|
||||
{
|
||||
index -= buffer.Length;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the character at thhe specified offset.
|
||||
/// </summary>
|
||||
public char Peek(int offset)
|
||||
{
|
||||
if (offset < 0 || offset >= buffer.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "The offset must be betwwen zero and the capacity of the buffer.");
|
||||
}
|
||||
|
||||
Cache(offset);
|
||||
|
||||
if (offset < count)
|
||||
{
|
||||
return buffer[GetIndexForOffset(offset)];
|
||||
}
|
||||
else
|
||||
{
|
||||
return '\0';
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads characters until at least <paramref name="length"/> characters are in the buffer.
|
||||
/// </summary>
|
||||
/// <param name="length">
|
||||
/// Number of characters to cache.
|
||||
/// </param>
|
||||
public void Cache(int length)
|
||||
{
|
||||
while (length >= count)
|
||||
{
|
||||
int nextChar = input.Read();
|
||||
if (nextChar >= 0)
|
||||
{
|
||||
int lastIndex = GetIndexForOffset(count);
|
||||
buffer[lastIndex] = (char)nextChar;
|
||||
++count;
|
||||
}
|
||||
else
|
||||
{
|
||||
endOfInput = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Skips the next <paramref name="length"/> characters. Those characters must have been
|
||||
/// obtained first by calling the <see cref="Peek"/> or <see cref="Cache"/> methods.
|
||||
/// </summary>
|
||||
public void Skip(int length)
|
||||
{
|
||||
if (length < 1 || length > count)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("length", "The length must be between 1 and the number of characters in the buffer. Use the Peek() and / or Cache() methods to fill the buffer.");
|
||||
}
|
||||
firstIndex = GetIndexForOffset(length);
|
||||
count -= length;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,61 +1,77 @@
|
|||
using System;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a location inside a file
|
||||
/// </summary>
|
||||
public struct Mark
|
||||
{
|
||||
private int index;
|
||||
private int line;
|
||||
private int column;
|
||||
|
||||
/// <summary>
|
||||
/// Gets / sets the absolute offset in the file
|
||||
/// </summary>
|
||||
public int Index {
|
||||
get {
|
||||
return index;
|
||||
}
|
||||
set {
|
||||
if(value < 0) {
|
||||
throw new ArgumentOutOfRangeException("Index", "Index must be greater than or equal to zero.");
|
||||
}
|
||||
index = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets / sets the number of the line
|
||||
/// </summary>
|
||||
public int Line {
|
||||
get {
|
||||
return line;
|
||||
}
|
||||
set {
|
||||
if(value < 0) {
|
||||
throw new ArgumentOutOfRangeException("Line", "Line must be greater than or equal to zero.");
|
||||
}
|
||||
line = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets / sets the index of the column
|
||||
/// </summary>
|
||||
public int Column {
|
||||
get {
|
||||
return column;
|
||||
}
|
||||
set {
|
||||
if(value < 0) {
|
||||
throw new ArgumentOutOfRangeException("Column", "Column must be greater than or equal to zero.");
|
||||
}
|
||||
column = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly Mark Empty = new Mark();
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a location inside a file
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public struct Mark
|
||||
{
|
||||
private int index;
|
||||
private int line;
|
||||
private int column;
|
||||
|
||||
/// <summary>
|
||||
/// Gets / sets the absolute offset in the file
|
||||
/// </summary>
|
||||
public int Index
|
||||
{
|
||||
get
|
||||
{
|
||||
return index;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", "Index must be greater than or equal to zero.");
|
||||
}
|
||||
index = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets / sets the number of the line
|
||||
/// </summary>
|
||||
public int Line
|
||||
{
|
||||
get
|
||||
{
|
||||
return line;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", "Line must be greater than or equal to zero.");
|
||||
}
|
||||
line = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets / sets the index of the column
|
||||
/// </summary>
|
||||
public int Column
|
||||
{
|
||||
get
|
||||
{
|
||||
return column;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", "Column must be greater than or equal to zero.");
|
||||
}
|
||||
column = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Mark"/> with empty values.
|
||||
/// </summary>
|
||||
public static readonly Mark Empty = new Mark();
|
||||
}
|
||||
}
|
|
@ -1,344 +1,387 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using YamlDotNet.Core.Tokens;
|
||||
using Event = YamlDotNet.Core.Events.Event;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
public class Parser
|
||||
{
|
||||
private class TagDirectiveCollection : KeyedCollection<string, TagDirective> {
|
||||
protected override string GetKeyForItem(TagDirective item)
|
||||
{
|
||||
return item.Handle;
|
||||
}
|
||||
}
|
||||
|
||||
private Stack<ParserState> states = new Stack<ParserState>();
|
||||
private Stack<Mark> marks = new Stack<Mark>();
|
||||
private TagDirectiveCollection tagDirectives = new TagDirectiveCollection();
|
||||
private ParserState state;
|
||||
|
||||
private readonly Scanner scanner;
|
||||
private Event current = null;
|
||||
|
||||
public Parser(TextReader input) {
|
||||
scanner = new Scanner(input);
|
||||
}
|
||||
|
||||
public Event Current {
|
||||
get {
|
||||
return current;
|
||||
}
|
||||
}
|
||||
|
||||
public bool MoveNext() {
|
||||
/* No events after the end of the stream or error. */
|
||||
if (state == ParserState.YAML_PARSE_END_STATE) {
|
||||
current = null;
|
||||
return false;
|
||||
} else {
|
||||
/* Generate the next event. */
|
||||
current = yaml_parser_state_machine();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Event yaml_parser_state_machine()
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case ParserState.YAML_PARSE_STREAM_START_STATE:
|
||||
return yaml_parser_parse_stream_start();
|
||||
|
||||
case ParserState.YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE:
|
||||
return yaml_parser_parse_document_start(true);
|
||||
|
||||
case ParserState.YAML_PARSE_DOCUMENT_START_STATE:
|
||||
return yaml_parser_parse_document_start(false);
|
||||
|
||||
case ParserState.YAML_PARSE_DOCUMENT_CONTENT_STATE:
|
||||
return yaml_parser_parse_document_content();
|
||||
|
||||
case ParserState.YAML_PARSE_DOCUMENT_END_STATE:
|
||||
return yaml_parser_parse_document_end();
|
||||
|
||||
case ParserState.YAML_PARSE_BLOCK_NODE_STATE:
|
||||
return yaml_parser_parse_node(true, false);
|
||||
|
||||
case ParserState.YAML_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE:
|
||||
return yaml_parser_parse_node(true, true);
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_NODE_STATE:
|
||||
return yaml_parser_parse_node(false, false);
|
||||
|
||||
case ParserState.YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE:
|
||||
return yaml_parser_parse_block_sequence_entry(true);
|
||||
|
||||
case ParserState.YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE:
|
||||
return yaml_parser_parse_block_sequence_entry(false);
|
||||
|
||||
case ParserState.YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE:
|
||||
return yaml_parser_parse_indentless_sequence_entry();
|
||||
|
||||
case ParserState.YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE:
|
||||
return yaml_parser_parse_block_mapping_key(true);
|
||||
|
||||
case ParserState.YAML_PARSE_BLOCK_MAPPING_KEY_STATE:
|
||||
return yaml_parser_parse_block_mapping_key(false);
|
||||
|
||||
case ParserState.YAML_PARSE_BLOCK_MAPPING_VALUE_STATE:
|
||||
return yaml_parser_parse_block_mapping_value();
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE:
|
||||
return yaml_parser_parse_flow_sequence_entry(true);
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE:
|
||||
return yaml_parser_parse_flow_sequence_entry(false);
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE:
|
||||
return yaml_parser_parse_flow_sequence_entry_mapping_key();
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE:
|
||||
return yaml_parser_parse_flow_sequence_entry_mapping_value();
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE:
|
||||
return yaml_parser_parse_flow_sequence_entry_mapping_end();
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE:
|
||||
return yaml_parser_parse_flow_mapping_key(true);
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_MAPPING_KEY_STATE:
|
||||
return yaml_parser_parse_flow_mapping_key(false);
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_MAPPING_VALUE_STATE:
|
||||
return yaml_parser_parse_flow_mapping_value(false);
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE:
|
||||
return yaml_parser_parse_flow_mapping_value(true);
|
||||
|
||||
default:
|
||||
Debug.Assert(false, "Invalid state"); /* Invalid state. */
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
private T Expect<T>() where T : Token {
|
||||
Token token = scanner.Current;
|
||||
T t = token as T;
|
||||
if(t == null) {
|
||||
throw new ParserException(string.Format(CultureInfo.InvariantCulture, "Did not found expected {0}.", typeof(T).Name), token.Start);
|
||||
} else {
|
||||
scanner.MoveNext();
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
private void Skip() {
|
||||
if(!scanner.MoveNext()) {
|
||||
throw new InvalidOperationException("The scanner should contain more token.");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the production:
|
||||
* stream ::= STREAM-START implicit_document? explicit_document* STREAM-END
|
||||
* ************
|
||||
*/
|
||||
|
||||
private Event yaml_parser_parse_stream_start() {
|
||||
Skip();
|
||||
|
||||
Tokens.StreamStart token = Expect<Tokens.StreamStart>();
|
||||
|
||||
state = ParserState.YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE;
|
||||
return new Events.StreamStart(token.Start, token.End);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the productions:
|
||||
* implicit_document ::= block_node DOCUMENT-END*
|
||||
* *
|
||||
* explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
|
||||
* *************************
|
||||
*/
|
||||
|
||||
private Event yaml_parser_parse_document_start(bool isImplicit)
|
||||
{
|
||||
/* Parse extra document end indicators. */
|
||||
|
||||
if (!isImplicit)
|
||||
{
|
||||
while (scanner.Current is Tokens.DocumentEnd) {
|
||||
Skip();
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse an isImplicit document. */
|
||||
|
||||
if (isImplicit && !(scanner.Current is VersionDirective || scanner.Current is TagDirective || scanner.Current is DocumentStart || scanner.Current is StreamEnd))
|
||||
{
|
||||
yaml_parser_process_directives(null);
|
||||
|
||||
states.Push(ParserState.YAML_PARSE_DOCUMENT_END_STATE);
|
||||
|
||||
state = ParserState.YAML_PARSE_BLOCK_NODE_STATE;
|
||||
|
||||
return new Events.DocumentStart(scanner.Current.Start, scanner.Current.End);
|
||||
}
|
||||
|
||||
/* Parse an explicit document. */
|
||||
|
||||
else if (!(scanner.Current is StreamEnd))
|
||||
{
|
||||
Mark start = scanner.Current.Start;
|
||||
List<TagDirective> tagDirectives = new List<TagDirective>();
|
||||
VersionDirective versionDirective = yaml_parser_process_directives(tagDirectives);
|
||||
|
||||
if(!(scanner.Current is DocumentStart)) {
|
||||
throw new ParserException("Did not found expected <document start>.", scanner.Current.Start);
|
||||
}
|
||||
|
||||
states.Push(ParserState.YAML_PARSE_DOCUMENT_END_STATE);
|
||||
|
||||
state = ParserState.YAML_PARSE_DOCUMENT_CONTENT_STATE;
|
||||
|
||||
Event evt = new Events.DocumentStart(versionDirective, tagDirectives, start, scanner.Current.End);
|
||||
Skip();
|
||||
return evt;
|
||||
}
|
||||
|
||||
/* Parse the stream end. */
|
||||
|
||||
else
|
||||
{
|
||||
state = ParserState.YAML_PARSE_END_STATE;
|
||||
|
||||
Event evt = new Events.StreamEnd(scanner.Current.Start, scanner.Current.End);
|
||||
// Do not call skip here because that would throw an exception
|
||||
if(scanner.MoveNext()) {
|
||||
throw new InvalidOperationException("The scanner should contain no more tokens.");
|
||||
}
|
||||
return evt;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse directives.
|
||||
*/
|
||||
|
||||
private VersionDirective yaml_parser_process_directives(IList<TagDirective> tags)
|
||||
{
|
||||
VersionDirective version = null;
|
||||
|
||||
while(true)
|
||||
{
|
||||
VersionDirective currentVersion;
|
||||
TagDirective tag;
|
||||
|
||||
if((currentVersion = scanner.Current as VersionDirective) != null) {
|
||||
if(version != null) {
|
||||
throw new ParserException("Found duplicate %YAML directive.", currentVersion.Start);
|
||||
}
|
||||
|
||||
if(currentVersion.Version.Major != 1 || currentVersion.Version.Minor != 1) {
|
||||
throw new ParserException("Found incompatible YAML document.", currentVersion.Start);
|
||||
}
|
||||
|
||||
version = currentVersion;
|
||||
} else if((tag = scanner.Current as TagDirective) != null) {
|
||||
if (tagDirectives.Contains(tag.Handle)) {
|
||||
throw new ParserException("Found duplicate %TAG directive.", tag.Start);
|
||||
}
|
||||
tagDirectives.Add(tag);
|
||||
if(tags != null) {
|
||||
tags.Add(tag);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
Skip();
|
||||
}
|
||||
|
||||
if(!tagDirectives.Contains("!")) {
|
||||
tagDirectives.Add(new TagDirective("!", "!"));
|
||||
}
|
||||
|
||||
if(!tagDirectives.Contains("!!")) {
|
||||
tagDirectives.Add(new TagDirective("!!", "tag:yaml.org,2002:"));
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_document_content()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_document_end()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_node(bool isBlock, bool isIndentlessSequence)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_block_sequence_entry(bool isFirst)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_indentless_sequence_entry()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_block_mapping_key(bool isFirst)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_block_mapping_value()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_flow_sequence_entry(bool isFirst)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_flow_sequence_entry_mapping_key()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_flow_sequence_entry_mapping_value()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_flow_sequence_entry_mapping_end()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_flow_mapping_key(bool isFirst)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_flow_mapping_value(bool isEmpty)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using YamlDotNet.Core.Tokens;
|
||||
using Event = YamlDotNet.Core.Events.ParsingEvent;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Parses YAML streams.
|
||||
/// </summary>
|
||||
public class Parser
|
||||
{
|
||||
private class TagDirectiveCollection : KeyedCollection<string, TagDirective>
|
||||
{
|
||||
protected override string GetKeyForItem(TagDirective item)
|
||||
{
|
||||
return item.Handle;
|
||||
}
|
||||
}
|
||||
|
||||
private Stack<ParserState> states = new Stack<ParserState>();
|
||||
private Stack<Mark> marks = new Stack<Mark>();
|
||||
private TagDirectiveCollection tagDirectives = new TagDirectiveCollection();
|
||||
private ParserState state;
|
||||
|
||||
private readonly Scanner scanner;
|
||||
private Event current;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Parser"/> class.
|
||||
/// </summary>
|
||||
/// <param name="input">The input where the YAML stream is to be read.</param>
|
||||
public Parser(TextReader input)
|
||||
{
|
||||
scanner = new Scanner(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current event.
|
||||
/// </summary>
|
||||
public Event Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return current;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves to the next event.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if there are more events available, otherwise returns false.</returns>
|
||||
public bool MoveNext()
|
||||
{
|
||||
/* No events after the end of the stream or error. */
|
||||
if (state == ParserState.YAML_PARSE_END_STATE)
|
||||
{
|
||||
current = null;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Generate the next event. */
|
||||
current = yaml_parser_state_machine();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Event yaml_parser_state_machine()
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case ParserState.YAML_PARSE_STREAM_START_STATE:
|
||||
return yaml_parser_parse_stream_start();
|
||||
|
||||
case ParserState.YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE:
|
||||
return yaml_parser_parse_document_start(true);
|
||||
|
||||
case ParserState.YAML_PARSE_DOCUMENT_START_STATE:
|
||||
return yaml_parser_parse_document_start(false);
|
||||
|
||||
case ParserState.YAML_PARSE_DOCUMENT_CONTENT_STATE:
|
||||
return yaml_parser_parse_document_content();
|
||||
|
||||
case ParserState.YAML_PARSE_DOCUMENT_END_STATE:
|
||||
return yaml_parser_parse_document_end();
|
||||
|
||||
case ParserState.YAML_PARSE_BLOCK_NODE_STATE:
|
||||
return yaml_parser_parse_node(true, false);
|
||||
|
||||
case ParserState.YAML_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE:
|
||||
return yaml_parser_parse_node(true, true);
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_NODE_STATE:
|
||||
return yaml_parser_parse_node(false, false);
|
||||
|
||||
case ParserState.YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE:
|
||||
return yaml_parser_parse_block_sequence_entry(true);
|
||||
|
||||
case ParserState.YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE:
|
||||
return yaml_parser_parse_block_sequence_entry(false);
|
||||
|
||||
case ParserState.YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE:
|
||||
return yaml_parser_parse_indentless_sequence_entry();
|
||||
|
||||
case ParserState.YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE:
|
||||
return yaml_parser_parse_block_mapping_key(true);
|
||||
|
||||
case ParserState.YAML_PARSE_BLOCK_MAPPING_KEY_STATE:
|
||||
return yaml_parser_parse_block_mapping_key(false);
|
||||
|
||||
case ParserState.YAML_PARSE_BLOCK_MAPPING_VALUE_STATE:
|
||||
return yaml_parser_parse_block_mapping_value();
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE:
|
||||
return yaml_parser_parse_flow_sequence_entry(true);
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE:
|
||||
return yaml_parser_parse_flow_sequence_entry(false);
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE:
|
||||
return yaml_parser_parse_flow_sequence_entry_mapping_key();
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE:
|
||||
return yaml_parser_parse_flow_sequence_entry_mapping_value();
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE:
|
||||
return yaml_parser_parse_flow_sequence_entry_mapping_end();
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE:
|
||||
return yaml_parser_parse_flow_mapping_key(true);
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_MAPPING_KEY_STATE:
|
||||
return yaml_parser_parse_flow_mapping_key(false);
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_MAPPING_VALUE_STATE:
|
||||
return yaml_parser_parse_flow_mapping_value(false);
|
||||
|
||||
case ParserState.YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE:
|
||||
return yaml_parser_parse_flow_mapping_value(true);
|
||||
|
||||
default:
|
||||
Debug.Assert(false, "Invalid state"); /* Invalid state. */
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
private T Expect<T>() where T : Token
|
||||
{
|
||||
Token token = scanner.Current;
|
||||
T t = token as T;
|
||||
if (t == null)
|
||||
{
|
||||
throw new ParserException(string.Format(CultureInfo.InvariantCulture, "Did not found expected {0}.", typeof(T).Name), token.Start);
|
||||
}
|
||||
else
|
||||
{
|
||||
scanner.MoveNext();
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
private void Skip()
|
||||
{
|
||||
if (!scanner.MoveNext())
|
||||
{
|
||||
throw new InvalidOperationException("The scanner should contain more token.");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the production:
|
||||
* stream ::= STREAM-START implicit_document? explicit_document* STREAM-END
|
||||
* ************
|
||||
*/
|
||||
|
||||
private Event yaml_parser_parse_stream_start()
|
||||
{
|
||||
Skip();
|
||||
|
||||
Tokens.StreamStart token = Expect<Tokens.StreamStart>();
|
||||
|
||||
state = ParserState.YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE;
|
||||
return new Events.StreamStart(token.Start, token.End);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the productions:
|
||||
* implicit_document ::= block_node DOCUMENT-END*
|
||||
* *
|
||||
* explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
|
||||
* *************************
|
||||
*/
|
||||
|
||||
private Event yaml_parser_parse_document_start(bool isImplicit)
|
||||
{
|
||||
/* Parse extra document end indicators. */
|
||||
|
||||
if (!isImplicit)
|
||||
{
|
||||
while (scanner.Current is Tokens.DocumentEnd)
|
||||
{
|
||||
Skip();
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse an isImplicit document. */
|
||||
|
||||
if (isImplicit && !(scanner.Current is VersionDirective || scanner.Current is TagDirective || scanner.Current is DocumentStart || scanner.Current is StreamEnd))
|
||||
{
|
||||
yaml_parser_process_directives(null);
|
||||
|
||||
states.Push(ParserState.YAML_PARSE_DOCUMENT_END_STATE);
|
||||
|
||||
state = ParserState.YAML_PARSE_BLOCK_NODE_STATE;
|
||||
|
||||
return new Events.DocumentStart(scanner.Current.Start, scanner.Current.End);
|
||||
}
|
||||
|
||||
/* Parse an explicit document. */
|
||||
|
||||
else if (!(scanner.Current is StreamEnd))
|
||||
{
|
||||
Mark start = scanner.Current.Start;
|
||||
List<TagDirective> tagDirectives = new List<TagDirective>();
|
||||
VersionDirective versionDirective = yaml_parser_process_directives(tagDirectives);
|
||||
|
||||
if (!(scanner.Current is DocumentStart))
|
||||
{
|
||||
throw new ParserException("Did not found expected <document start>.", scanner.Current.Start);
|
||||
}
|
||||
|
||||
states.Push(ParserState.YAML_PARSE_DOCUMENT_END_STATE);
|
||||
|
||||
state = ParserState.YAML_PARSE_DOCUMENT_CONTENT_STATE;
|
||||
|
||||
Event evt = new Events.DocumentStart(versionDirective, tagDirectives, start, scanner.Current.End);
|
||||
Skip();
|
||||
return evt;
|
||||
}
|
||||
|
||||
/* Parse the stream end. */
|
||||
|
||||
else
|
||||
{
|
||||
state = ParserState.YAML_PARSE_END_STATE;
|
||||
|
||||
Event evt = new Events.StreamEnd(scanner.Current.Start, scanner.Current.End);
|
||||
// Do not call skip here because that would throw an exception
|
||||
if (scanner.MoveNext())
|
||||
{
|
||||
throw new InvalidOperationException("The scanner should contain no more tokens.");
|
||||
}
|
||||
return evt;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse directives.
|
||||
*/
|
||||
|
||||
private VersionDirective yaml_parser_process_directives(IList<TagDirective> tags)
|
||||
{
|
||||
VersionDirective version = null;
|
||||
|
||||
while (true)
|
||||
{
|
||||
VersionDirective currentVersion;
|
||||
TagDirective tag;
|
||||
|
||||
if ((currentVersion = scanner.Current as VersionDirective) != null)
|
||||
{
|
||||
if (version != null)
|
||||
{
|
||||
throw new ParserException("Found duplicate %YAML directive.", currentVersion.Start);
|
||||
}
|
||||
|
||||
if (currentVersion.Version.Major != 1 || currentVersion.Version.Minor != 1)
|
||||
{
|
||||
throw new ParserException("Found incompatible YAML document.", currentVersion.Start);
|
||||
}
|
||||
|
||||
version = currentVersion;
|
||||
}
|
||||
else if ((tag = scanner.Current as TagDirective) != null)
|
||||
{
|
||||
if (tagDirectives.Contains(tag.Handle))
|
||||
{
|
||||
throw new ParserException("Found duplicate %TAG directive.", tag.Start);
|
||||
}
|
||||
tagDirectives.Add(tag);
|
||||
if (tags != null)
|
||||
{
|
||||
tags.Add(tag);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Skip();
|
||||
}
|
||||
|
||||
if (!tagDirectives.Contains("!"))
|
||||
{
|
||||
tagDirectives.Add(new TagDirective("!", "!"));
|
||||
}
|
||||
|
||||
if (!tagDirectives.Contains("!!"))
|
||||
{
|
||||
tagDirectives.Add(new TagDirective("!!", "tag:yaml.org,2002:"));
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_document_content()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_document_end()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_node(bool isBlock, bool isIndentlessSequence)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_block_sequence_entry(bool isFirst)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_indentless_sequence_entry()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_block_mapping_key(bool isFirst)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_block_mapping_value()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_flow_sequence_entry(bool isFirst)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_flow_sequence_entry_mapping_key()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_flow_sequence_entry_mapping_value()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_flow_sequence_entry_mapping_end()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_flow_mapping_key(bool isFirst)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Event yaml_parser_parse_flow_mapping_value(bool isEmpty)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +1,97 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
|
||||
|
||||
public class ParserException : Exception
|
||||
{
|
||||
|
||||
public ParserException(string description, Mark location)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Globalization;
|
||||
using System.Security.Permissions;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Exception that is thrown when the YAML parser encounters a problem.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class ParserException : Exception
|
||||
{
|
||||
private readonly Mark location;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the location where the exception has occured.
|
||||
/// </summary>
|
||||
/// <value>The location.</value>
|
||||
public Mark Location
|
||||
{
|
||||
get
|
||||
{
|
||||
return location;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ParserException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="description">The description.</param>
|
||||
/// <param name="location">The location where the exception occured.</param>
|
||||
public ParserException(string description, Mark location)
|
||||
: base(string.Format(CultureInfo.InvariantCulture, "({0}, {1}): {2}", location.Line, location.Column, description))
|
||||
{
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ParserException"/> class.
|
||||
/// </summary>
|
||||
public ParserException()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ParserException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
public ParserException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ParserException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="inner">The inner.</param>
|
||||
public ParserException(string message, Exception inner)
|
||||
: base(message, inner)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ParserException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
|
||||
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
|
||||
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
|
||||
protected ParserException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
location = (Mark)info.GetValue("location", typeof(Mark));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When overridden in a derived class, sets the <see cref="T:System.Runtime.Serialization.SerializationInfo"/> with information about the exception.
|
||||
/// </summary>
|
||||
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
|
||||
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is a null reference (Nothing in Visual Basic). </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*"/>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter"/>
|
||||
/// </PermissionSet>
|
||||
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
|
||||
public override void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
base.GetObjectData(info, context);
|
||||
info.AddValue("location", location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,57 +1,131 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
public enum ParserState
|
||||
{
|
||||
/** Expect STREAM-START. */
|
||||
YAML_PARSE_STREAM_START_STATE,
|
||||
/** Expect the beginning of an implicit document. */
|
||||
YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE,
|
||||
/** Expect DOCUMENT-START. */
|
||||
YAML_PARSE_DOCUMENT_START_STATE,
|
||||
/** Expect the content of a document. */
|
||||
YAML_PARSE_DOCUMENT_CONTENT_STATE,
|
||||
/** Expect DOCUMENT-END. */
|
||||
YAML_PARSE_DOCUMENT_END_STATE,
|
||||
/** Expect a block node. */
|
||||
YAML_PARSE_BLOCK_NODE_STATE,
|
||||
/** Expect a block node or indentless sequence. */
|
||||
YAML_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE,
|
||||
/** Expect a flow node. */
|
||||
YAML_PARSE_FLOW_NODE_STATE,
|
||||
/** Expect the first entry of a block sequence. */
|
||||
YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE,
|
||||
/** Expect an entry of a block sequence. */
|
||||
YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE,
|
||||
/** Expect an entry of an indentless sequence. */
|
||||
YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE,
|
||||
/** Expect the first key of a block mapping. */
|
||||
YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE,
|
||||
/** Expect a block mapping key. */
|
||||
YAML_PARSE_BLOCK_MAPPING_KEY_STATE,
|
||||
/** Expect a block mapping value. */
|
||||
YAML_PARSE_BLOCK_MAPPING_VALUE_STATE,
|
||||
/** Expect the first entry of a flow sequence. */
|
||||
YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE,
|
||||
/** Expect an entry of a flow sequence. */
|
||||
YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE,
|
||||
/** Expect a key of an ordered mapping. */
|
||||
YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE,
|
||||
/** Expect a value of an ordered mapping. */
|
||||
YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE,
|
||||
/** Expect the and of an ordered mapping entry. */
|
||||
YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE,
|
||||
/** Expect the first key of a flow mapping. */
|
||||
YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE,
|
||||
/** Expect a key of a flow mapping. */
|
||||
YAML_PARSE_FLOW_MAPPING_KEY_STATE,
|
||||
/** Expect a value of a flow mapping. */
|
||||
YAML_PARSE_FLOW_MAPPING_VALUE_STATE,
|
||||
/** Expect an empty value of a flow mapping. */
|
||||
YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE,
|
||||
/** Expect nothing. */
|
||||
YAML_PARSE_END_STATE
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the YAML parser's state.
|
||||
/// </summary>
|
||||
internal enum ParserState
|
||||
{
|
||||
/// <summary>
|
||||
/// Expect STREAM-START.
|
||||
/// </summary>
|
||||
YAML_PARSE_STREAM_START_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect the beginning of an implicit document.
|
||||
/// </summary>
|
||||
YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect DOCUMENT-START.
|
||||
/// </summary>
|
||||
YAML_PARSE_DOCUMENT_START_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect the content of a document.
|
||||
/// </summary>
|
||||
YAML_PARSE_DOCUMENT_CONTENT_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect DOCUMENT-END.
|
||||
/// </summary>
|
||||
YAML_PARSE_DOCUMENT_END_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect a block node.
|
||||
/// </summary>
|
||||
YAML_PARSE_BLOCK_NODE_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect a block node or indentless sequence.
|
||||
/// </summary>
|
||||
YAML_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect a flow node.
|
||||
/// </summary>
|
||||
YAML_PARSE_FLOW_NODE_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect the first entry of a block sequence.
|
||||
/// </summary>
|
||||
YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect an entry of a block sequence.
|
||||
/// </summary>
|
||||
YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect an entry of an indentless sequence.
|
||||
/// </summary>
|
||||
YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect the first key of a block mapping.
|
||||
/// </summary>
|
||||
YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect a block mapping key.
|
||||
/// </summary>
|
||||
YAML_PARSE_BLOCK_MAPPING_KEY_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect a block mapping value.
|
||||
/// </summary>
|
||||
YAML_PARSE_BLOCK_MAPPING_VALUE_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect the first entry of a flow sequence.
|
||||
/// </summary>
|
||||
YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect an entry of a flow sequence.
|
||||
/// </summary>
|
||||
YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect a key of an ordered mapping.
|
||||
/// </summary>
|
||||
YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect a value of an ordered mapping.
|
||||
/// </summary>
|
||||
YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect the and of an ordered mapping entry.
|
||||
/// </summary>
|
||||
YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect the first key of a flow mapping.
|
||||
/// </summary>
|
||||
YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect a key of a flow mapping.
|
||||
/// </summary>
|
||||
YAML_PARSE_FLOW_MAPPING_KEY_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect a value of a flow mapping.
|
||||
/// </summary>
|
||||
YAML_PARSE_FLOW_MAPPING_VALUE_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect an empty value of a flow mapping.
|
||||
/// </summary>
|
||||
YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE,
|
||||
|
||||
/// <summary>
|
||||
/// Expect nothing.
|
||||
/// </summary>
|
||||
YAML_PARSE_END_STATE
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyTitle("YamlDotNet.Core")]
|
||||
[assembly: AssemblyDescription("The core YamlDotNet library, which contains the implementation of the parser and the emitter.")]
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,58 +1,89 @@
|
|||
using System;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
public class SimpleKey
|
||||
{
|
||||
private bool isPossible;
|
||||
private bool isRequired;
|
||||
private int tokenNumber;
|
||||
private Mark mark;
|
||||
|
||||
public bool IsPossible {
|
||||
get {
|
||||
return isPossible;
|
||||
}
|
||||
set {
|
||||
isPossible = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsRequired {
|
||||
get {
|
||||
return isRequired;
|
||||
}
|
||||
set {
|
||||
isRequired = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int TokenNumber {
|
||||
get {
|
||||
return tokenNumber;
|
||||
}
|
||||
set {
|
||||
tokenNumber = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Mark Mark {
|
||||
get {
|
||||
return mark;
|
||||
}
|
||||
set {
|
||||
mark = value;
|
||||
}
|
||||
}
|
||||
|
||||
public SimpleKey() {
|
||||
}
|
||||
|
||||
public SimpleKey(bool isPossible, bool isRequired, int tokenNumber, Mark mark) {
|
||||
this.isPossible = isPossible;
|
||||
this.isRequired = isRequired;
|
||||
this.tokenNumber = tokenNumber;
|
||||
this.mark = mark;
|
||||
}
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a simple key.
|
||||
/// </summary>
|
||||
internal class SimpleKey
|
||||
{
|
||||
private bool isPossible;
|
||||
private readonly bool isRequired;
|
||||
private readonly int tokenNumber;
|
||||
private readonly Mark mark;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is possible.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if this instance is possible; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
public bool IsPossible
|
||||
{
|
||||
get
|
||||
{
|
||||
return isPossible;
|
||||
}
|
||||
set
|
||||
{
|
||||
isPossible = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is required.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if this instance is required; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
public bool IsRequired
|
||||
{
|
||||
get
|
||||
{
|
||||
return isRequired;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the token number.
|
||||
/// </summary>
|
||||
/// <value>The token number.</value>
|
||||
public int TokenNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return tokenNumber;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the mark that indicates the location of the simple key.
|
||||
/// </summary>
|
||||
/// <value>The mark.</value>
|
||||
public Mark Mark
|
||||
{
|
||||
get
|
||||
{
|
||||
return mark;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SimpleKey"/> class.
|
||||
/// </summary>
|
||||
public SimpleKey()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SimpleKey"/> class.
|
||||
/// </summary>
|
||||
public SimpleKey(bool isPossible, bool isRequired, int tokenNumber, Mark mark)
|
||||
{
|
||||
this.isPossible = isPossible;
|
||||
this.isRequired = isRequired;
|
||||
this.tokenNumber = tokenNumber;
|
||||
this.mark = mark;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,14 +1,95 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
public class SyntaxErrorException : Exception
|
||||
{
|
||||
|
||||
public SyntaxErrorException(string description, Mark location)
|
||||
: base(string.Format(CultureInfo.InvariantCulture, "{0} On line {1}, column {2}", description, location.Line + 1, location.Column + 1))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Exception that is thrown when a syntax error is detected on a YAML stream.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class SyntaxErrorException : Exception
|
||||
{
|
||||
private readonly Mark location;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the location where the exception has occured.
|
||||
/// </summary>
|
||||
/// <value>The location.</value>
|
||||
public Mark Location
|
||||
{
|
||||
get
|
||||
{
|
||||
return location;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SyntaxErrorException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="description">The description.</param>
|
||||
/// <param name="location">The location where the exception has occured.</param>
|
||||
public SyntaxErrorException(string description, Mark location)
|
||||
: base(string.Format(CultureInfo.InvariantCulture, "({0}, {1}): {2}", location.Line + 1, location.Column + 1, description))
|
||||
{
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SyntaxErrorException"/> class.
|
||||
/// </summary>
|
||||
public SyntaxErrorException()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SyntaxErrorException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
public SyntaxErrorException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SyntaxErrorException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="inner">The inner.</param>
|
||||
public SyntaxErrorException(string message, Exception inner)
|
||||
: base(message, inner)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SyntaxErrorException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
|
||||
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
|
||||
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
|
||||
protected SyntaxErrorException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
location = (Mark)info.GetValue("location", typeof(Mark));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When overridden in a derived class, sets the <see cref="T:System.Runtime.Serialization.SerializationInfo"/> with information about the exception.
|
||||
/// </summary>
|
||||
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
|
||||
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is a null reference (Nothing in Visual Basic). </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*"/>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter"/>
|
||||
/// </PermissionSet>
|
||||
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
|
||||
public override void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
base.GetObjectData(info, context);
|
||||
info.AddValue("location", location);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class Alias : Token {
|
||||
private string value;
|
||||
|
||||
public string Value {
|
||||
get {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
public Alias(string value)
|
||||
: this(value, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public Alias(string value, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,26 +1,46 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class Anchor : Token {
|
||||
private string value;
|
||||
|
||||
public string Value {
|
||||
get {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
public Anchor(string value)
|
||||
: this(value, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public Anchor(string value, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an anchor token.
|
||||
/// </summary>
|
||||
public class Anchor : Token
|
||||
{
|
||||
private string value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public string Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Anchor"/> class.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
public Anchor(string value)
|
||||
: this(value, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Anchor"/> class.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public Anchor(string value, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,29 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class BlockEnd : Token {
|
||||
public BlockEnd()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public BlockEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a block end token.
|
||||
/// </summary>
|
||||
public class BlockEnd : Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockEnd"/> class.
|
||||
/// </summary>
|
||||
public BlockEnd()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockEnd"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public BlockEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,29 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class BlockEntry : Token {
|
||||
public BlockEntry()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public BlockEntry(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a block entry event.
|
||||
/// </summary>
|
||||
public class BlockEntry : Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockEntry"/> class.
|
||||
/// </summary>
|
||||
public BlockEntry()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockEntry"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public BlockEntry(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,29 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class BlockMappingStart : Token {
|
||||
public BlockMappingStart()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public BlockMappingStart(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a block mapping start token.
|
||||
/// </summary>
|
||||
public class BlockMappingStart : Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockMappingStart"/> class.
|
||||
/// </summary>
|
||||
public BlockMappingStart()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockMappingStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public BlockMappingStart(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,29 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class BlockSequenceStart : Token {
|
||||
public BlockSequenceStart()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public BlockSequenceStart(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a block sequence start token.
|
||||
/// </summary>
|
||||
public class BlockSequenceStart : Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockSequenceStart"/> class.
|
||||
/// </summary>
|
||||
public BlockSequenceStart()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockSequenceStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public BlockSequenceStart(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,29 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class DocumentEnd : Token {
|
||||
public DocumentEnd()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public DocumentEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a document end token.
|
||||
/// </summary>
|
||||
public class DocumentEnd : Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocumentEnd"/> class.
|
||||
/// </summary>
|
||||
public DocumentEnd()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocumentEnd"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public DocumentEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,29 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class DocumentStart : Token {
|
||||
public DocumentStart()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public DocumentStart(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a document start token.
|
||||
/// </summary>
|
||||
public class DocumentStart : Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocumentStart"/> class.
|
||||
/// </summary>
|
||||
public DocumentStart()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocumentStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public DocumentStart(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,29 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class FlowEntry : Token {
|
||||
public FlowEntry()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public FlowEntry(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a flow entry event.
|
||||
/// </summary>
|
||||
public class FlowEntry : Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FlowEntry"/> class.
|
||||
/// </summary>
|
||||
public FlowEntry()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FlowEntry"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public FlowEntry(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,29 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class FlowMappingEnd : Token {
|
||||
public FlowMappingEnd()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public FlowMappingEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a flow mapping end token.
|
||||
/// </summary>
|
||||
public class FlowMappingEnd : Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FlowMappingEnd"/> class.
|
||||
/// </summary>
|
||||
public FlowMappingEnd()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FlowMappingEnd"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public FlowMappingEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,29 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class FlowMappingStart : Token {
|
||||
public FlowMappingStart()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public FlowMappingStart(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a flow mapping start token.
|
||||
/// </summary>
|
||||
public class FlowMappingStart : Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FlowMappingStart"/> class.
|
||||
/// </summary>
|
||||
public FlowMappingStart()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FlowMappingStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public FlowMappingStart(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,29 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class FlowSequenceEnd : Token {
|
||||
public FlowSequenceEnd()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public FlowSequenceEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a flow sequence end token.
|
||||
/// </summary>
|
||||
public class FlowSequenceEnd : Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FlowSequenceEnd"/> class.
|
||||
/// </summary>
|
||||
public FlowSequenceEnd()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FlowSequenceEnd"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public FlowSequenceEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,29 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class FlowSequenceStart : Token {
|
||||
public FlowSequenceStart()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public FlowSequenceStart(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a flow sequence start token.
|
||||
/// </summary>
|
||||
public class FlowSequenceStart : Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FlowSequenceStart"/> class.
|
||||
/// </summary>
|
||||
public FlowSequenceStart()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FlowSequenceStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public FlowSequenceStart(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,29 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class Key : Token {
|
||||
public Key()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public Key(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a key token.
|
||||
/// </summary>
|
||||
public class Key : Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Key"/> class.
|
||||
/// </summary>
|
||||
public Key()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Key"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public Key(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,40 +1,72 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class Scalar : Token {
|
||||
private string value;
|
||||
|
||||
public string Value {
|
||||
get {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
public ScalarStyle Style {
|
||||
get {
|
||||
return style;
|
||||
}
|
||||
}
|
||||
|
||||
private ScalarStyle style;
|
||||
|
||||
public Scalar(string value)
|
||||
: this(value, ScalarStyle.Any)
|
||||
{
|
||||
}
|
||||
|
||||
public Scalar(string value, ScalarStyle style)
|
||||
: this(value, style, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public Scalar(string value, ScalarStyle style, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.value = value;
|
||||
this.style = style;
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a scalar token.
|
||||
/// </summary>
|
||||
public class Scalar : Token
|
||||
{
|
||||
private string value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public string Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the style.
|
||||
/// </summary>
|
||||
/// <value>The style.</value>
|
||||
public ScalarStyle Style
|
||||
{
|
||||
get
|
||||
{
|
||||
return style;
|
||||
}
|
||||
}
|
||||
|
||||
private ScalarStyle style;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Scalar"/> class.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
public Scalar(string value)
|
||||
: this(value, ScalarStyle.Any)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Scalar"/> class.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="style">The style.</param>
|
||||
public Scalar(string value, ScalarStyle style)
|
||||
: this(value, style, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Scalar"/> class.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="style">The style.</param>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public Scalar(string value, ScalarStyle style, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.value = value;
|
||||
this.style = style;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,10 @@
|
|||
using System;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the style of a YAML scalar.
|
||||
/// </summary>
|
||||
public enum ScalarStyle
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,17 +1,29 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class StreamEnd : Token {
|
||||
public StreamEnd()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public StreamEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a stream end event.
|
||||
/// </summary>
|
||||
public class StreamEnd : Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StreamEnd"/> class.
|
||||
/// </summary>
|
||||
public StreamEnd()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StreamEnd"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public StreamEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,29 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class StreamStart : Token {
|
||||
public StreamStart()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public StreamStart(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a stream start token.
|
||||
/// </summary>
|
||||
public class StreamStart : Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StreamStart"/> class.
|
||||
/// </summary>
|
||||
public StreamStart()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StreamStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public StreamStart(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,33 +1,61 @@
|
|||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class Tag : Token {
|
||||
private string handle;
|
||||
private string suffix;
|
||||
|
||||
public string Handle {
|
||||
get {
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
public string Suffix {
|
||||
get {
|
||||
return suffix;
|
||||
}
|
||||
}
|
||||
|
||||
public Tag(string handle, string suffix)
|
||||
: this(handle, suffix, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public Tag(string handle, string suffix, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.handle = handle;
|
||||
this.suffix = suffix;
|
||||
}
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a tag token.
|
||||
/// </summary>
|
||||
public class Tag : Token
|
||||
{
|
||||
private string handle;
|
||||
private string suffix;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the handle.
|
||||
/// </summary>
|
||||
/// <value>The handle.</value>
|
||||
public string Handle
|
||||
{
|
||||
get
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the suffix.
|
||||
/// </summary>
|
||||
/// <value>The suffix.</value>
|
||||
public string Suffix
|
||||
{
|
||||
get
|
||||
{
|
||||
return suffix;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Tag"/> class.
|
||||
/// </summary>
|
||||
/// <param name="handle">The handle.</param>
|
||||
/// <param name="suffix">The suffix.</param>
|
||||
public Tag(string handle, string suffix)
|
||||
: this(handle, suffix, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Tag"/> class.
|
||||
/// </summary>
|
||||
/// <param name="handle">The handle.</param>
|
||||
/// <param name="suffix">The suffix.</param>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public Tag(string handle, string suffix, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.handle = handle;
|
||||
this.suffix = suffix;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,45 +1,86 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class TagDirective : Token {
|
||||
private readonly string handle;
|
||||
private readonly string prefix;
|
||||
|
||||
public string Handle {
|
||||
get {
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
public string Prefix {
|
||||
get {
|
||||
return prefix;
|
||||
}
|
||||
}
|
||||
|
||||
public TagDirective(string handle, string prefix)
|
||||
: this(handle, prefix, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public TagDirective(string handle, string prefix, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.handle = handle;
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public override bool Equals (object o)
|
||||
{
|
||||
TagDirective other = o as TagDirective;
|
||||
return other != null && handle.Equals(other.handle) && prefix.Equals(other.prefix);
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
return handle.GetHashCode() ^ prefix.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a tag directive token.
|
||||
/// </summary>
|
||||
public class TagDirective : Token
|
||||
{
|
||||
private readonly string handle;
|
||||
private readonly string prefix;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the handle.
|
||||
/// </summary>
|
||||
/// <value>The handle.</value>
|
||||
public string Handle
|
||||
{
|
||||
get
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the prefix.
|
||||
/// </summary>
|
||||
/// <value>The prefix.</value>
|
||||
public string Prefix
|
||||
{
|
||||
get
|
||||
{
|
||||
return prefix;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TagDirective"/> class.
|
||||
/// </summary>
|
||||
/// <param name="handle">The handle.</param>
|
||||
/// <param name="prefix">The prefix.</param>
|
||||
public TagDirective(string handle, string prefix)
|
||||
: this(handle, prefix, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TagDirective"/> class.
|
||||
/// </summary>
|
||||
/// <param name="handle">The handle.</param>
|
||||
/// <param name="prefix">The prefix.</param>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public TagDirective(string handle, string prefix, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.handle = handle;
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified System.Object is equal to the current System.Object.
|
||||
/// </summary>
|
||||
/// <param name="obj">The System.Object to compare with the current System.Object.</param>
|
||||
/// <returns>
|
||||
/// true if the specified System.Object is equal to the current System.Object; otherwise, false.
|
||||
/// </returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
TagDirective other = obj as TagDirective;
|
||||
return other != null && handle.Equals(other.handle) && prefix.Equals(other.prefix);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serves as a hash function for a particular type.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A hash code for the current <see cref="T:System.Object"/>.
|
||||
/// </returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return handle.GetHashCode() ^ prefix.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,28 +1,47 @@
|
|||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public abstract class Token
|
||||
{
|
||||
private Mark start;
|
||||
|
||||
public Mark Start {
|
||||
get {
|
||||
return start;
|
||||
}
|
||||
}
|
||||
|
||||
private Mark end;
|
||||
|
||||
public Mark End {
|
||||
get {
|
||||
return end;
|
||||
}
|
||||
}
|
||||
|
||||
public Token(Mark start, Mark end) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
}
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for YAML tokens.
|
||||
/// </summary>
|
||||
public abstract class Token
|
||||
{
|
||||
private Mark start;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the start of the token in the input stream.
|
||||
/// </summary>
|
||||
public Mark Start
|
||||
{
|
||||
get
|
||||
{
|
||||
return start;
|
||||
}
|
||||
}
|
||||
|
||||
private Mark end;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the end of the token in the input stream.
|
||||
/// </summary>
|
||||
public Mark End
|
||||
{
|
||||
get
|
||||
{
|
||||
return end;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Token"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
protected Token(Mark start, Mark end)
|
||||
{
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,29 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class Value : Token {
|
||||
public Value()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public Value(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a value token.
|
||||
/// </summary>
|
||||
public class Value : Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Value"/> class.
|
||||
/// </summary>
|
||||
public Value()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Value"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public Value(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,37 +1,69 @@
|
|||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
public class VersionDirective : Token {
|
||||
private readonly Version version;
|
||||
|
||||
public Version Version {
|
||||
get {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
public VersionDirective(Version version)
|
||||
: this(version, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public VersionDirective(Version version, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
|
||||
public override bool Equals (object o)
|
||||
{
|
||||
VersionDirective other = o as VersionDirective;
|
||||
return other != null && version.Equals(other.version);
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
return version.GetHashCode();
|
||||
}
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core.Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a version directive token.
|
||||
/// </summary>
|
||||
public class VersionDirective : Token
|
||||
{
|
||||
private readonly Version version;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version.
|
||||
/// </summary>
|
||||
/// <value>The version.</value>
|
||||
public Version Version
|
||||
{
|
||||
get
|
||||
{
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="VersionDirective"/> class.
|
||||
/// </summary>
|
||||
/// <param name="version">The version.</param>
|
||||
public VersionDirective(Version version)
|
||||
: this(version, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="VersionDirective"/> class.
|
||||
/// </summary>
|
||||
/// <param name="version">The version.</param>
|
||||
/// <param name="start">The start position of the token.</param>
|
||||
/// <param name="end">The end position of the token.</param>
|
||||
public VersionDirective(Version version, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified System.Object is equal to the current System.Object.
|
||||
/// </summary>
|
||||
/// <param name="obj">The System.Object to compare with the current System.Object.</param>
|
||||
/// <returns>
|
||||
/// true if the specified System.Object is equal to the current System.Object; otherwise, false.
|
||||
/// </returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
VersionDirective other = obj as VersionDirective;
|
||||
return other != null && version.Equals(other.version);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serves as a hash function for a particular type.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A hash code for the current <see cref="T:System.Object"/>.
|
||||
/// </returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return version.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,41 +1,71 @@
|
|||
using System;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
public class Version
|
||||
{
|
||||
private readonly int major;
|
||||
|
||||
public int Major {
|
||||
get {
|
||||
return major;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly int minor;
|
||||
|
||||
public int Minor {
|
||||
get {
|
||||
return minor;
|
||||
}
|
||||
}
|
||||
|
||||
public Version(int major, int minor)
|
||||
{
|
||||
this.major = major;
|
||||
this.minor = minor;
|
||||
}
|
||||
|
||||
public override bool Equals (object o)
|
||||
{
|
||||
Version other = o as Version;
|
||||
return other != null && major == other.major && minor == other.minor;
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
return major.GetHashCode() ^ minor.GetHashCode();
|
||||
}
|
||||
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the version of the YAML language.
|
||||
/// </summary>
|
||||
public class Version
|
||||
{
|
||||
private readonly int major;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the major version number.
|
||||
/// </summary>
|
||||
public int Major
|
||||
{
|
||||
get
|
||||
{
|
||||
return major;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly int minor;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the minor version number.
|
||||
/// </summary>
|
||||
public int Minor
|
||||
{
|
||||
get
|
||||
{
|
||||
return minor;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Version"/> class.
|
||||
/// </summary>
|
||||
/// <param name="major">The the major version number.</param>
|
||||
/// <param name="minor">The the minor version number.</param>
|
||||
public Version(int major, int minor)
|
||||
{
|
||||
this.major = major;
|
||||
this.minor = minor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified System.Object is equal to the current System.Object.
|
||||
/// </summary>
|
||||
/// <param name="obj">The System.Object to compare with the current System.Object.</param>
|
||||
/// <returns>
|
||||
/// true if the specified System.Object is equal to the current System.Object; otherwise, false.
|
||||
/// </returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
Version other = obj as Version;
|
||||
return other != null && major == other.major && minor == other.minor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serves as a hash function for a particular type.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A hash code for the current <see cref="T:System.Object"/>.
|
||||
/// </returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return major.GetHashCode() ^ minor.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{BF32DE1B-6276-4341-B212-F8862ADBBA7A}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>YamlDotNet.Core</RootNamespace>
|
||||
<AssemblyName>YamlDotNet.Core</AssemblyName>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\YamlDotNet.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Debug\YamlDotNet.Core.XML</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\CommonAssemblyInfo.cs">
|
||||
<Link>CommonAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Events\AnchorAlias.cs" />
|
||||
<Compile Include="Events\DocumentEnd.cs" />
|
||||
<Compile Include="Events\DocumentStart.cs" />
|
||||
<Compile Include="Events\ParsingEvent.cs" />
|
||||
<Compile Include="Events\INodeEvent.cs" />
|
||||
<Compile Include="Events\MappingEnd.cs" />
|
||||
<Compile Include="Events\MappingStart.cs" />
|
||||
<Compile Include="Events\Scalar.cs" />
|
||||
<Compile Include="Events\SequenceEnd.cs" />
|
||||
<Compile Include="Events\SequenceStart.cs" />
|
||||
<Compile Include="Events\StreamEnd.cs" />
|
||||
<Compile Include="Events\StreamStart.cs" />
|
||||
<Compile Include="InsertionQueue.cs" />
|
||||
<Compile Include="LookAheadBuffer.cs" />
|
||||
<Compile Include="Mark.cs" />
|
||||
<Compile Include="Parser.cs" />
|
||||
<Compile Include="ParserException.cs" />
|
||||
<Compile Include="ParserState.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Scanner.cs" />
|
||||
<Compile Include="SimpleKey.cs" />
|
||||
<Compile Include="SyntaxErrorException.cs" />
|
||||
<Compile Include="Tokens\AnchorAlias.cs" />
|
||||
<Compile Include="Tokens\Anchor.cs" />
|
||||
<Compile Include="Tokens\BlockEnd.cs" />
|
||||
<Compile Include="Tokens\BlockEntry.cs" />
|
||||
<Compile Include="Tokens\BlockMappingStart.cs" />
|
||||
<Compile Include="Tokens\BlockSequenceStart.cs" />
|
||||
<Compile Include="Tokens\DocumentEnd.cs" />
|
||||
<Compile Include="Tokens\DocumentStart.cs" />
|
||||
<Compile Include="Tokens\FlowEntry.cs" />
|
||||
<Compile Include="Tokens\FlowMappingEnd.cs" />
|
||||
<Compile Include="Tokens\FlowMappingStart.cs" />
|
||||
<Compile Include="Tokens\FlowSequenceEnd.cs" />
|
||||
<Compile Include="Tokens\FlowSequenceStart.cs" />
|
||||
<Compile Include="Tokens\Key.cs" />
|
||||
<Compile Include="Tokens\Scalar.cs" />
|
||||
<Compile Include="Tokens\ScalarStyle.cs" />
|
||||
<Compile Include="Tokens\StreamEnd.cs" />
|
||||
<Compile Include="Tokens\StreamStart.cs" />
|
||||
<Compile Include="Tokens\Tag.cs" />
|
||||
<Compile Include="Tokens\TagDirective.cs" />
|
||||
<Compile Include="Tokens\Token.cs" />
|
||||
<Compile Include="Tokens\Value.cs" />
|
||||
<Compile Include="Tokens\VersionDirective.cs" />
|
||||
<Compile Include="Version.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -1,29 +0,0 @@
|
|||
// AssemblyInfo.cs created with MonoDevelop
|
||||
// User: aaubry at 10:18 PM 8/21/2008
|
||||
//
|
||||
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
|
||||
//
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("YamlDotNet.RepresentationModel")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// If the build and revision are set to '*' they will be updated automatically.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
[assembly: AssemblyDelaySign(false)]
|
|
@ -1,41 +1,4 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Reflection;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("YamlDotNet.RepresentationModel")]
|
||||
[assembly: AssemblyDescription("A library for parsing and emitting YAML.")]
|
||||
#if DEBUG
|
||||
[assembly: AssemblyConfiguration("Debug")]
|
||||
#else
|
||||
[assembly: AssemblyConfiguration("Release")]
|
||||
#endif
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("YamlDotNet")]
|
||||
[assembly: AssemblyCopyright("Copyright © Antoine Aubry 2008")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: CLSCompliant(true)]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("4b528a2f-c319-4e95-a765-4abff5159822")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("0.1.*")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyDescription("The representation model YamlDotNet library, which provides an object model for manipulation YAML streams, as well as serialization from and to YAML.")]
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{21CA0077-E15C-446D-9C43-F6D3F9D09687}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>YamlDotNet.RepresentationModel</RootNamespace>
|
||||
<AssemblyName>YamlDotNet.RepresentationModel</AssemblyName>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\YamlDotNet.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Debug\YamlDotNet.RepresentationModel.XML</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\CommonAssemblyInfo.cs">
|
||||
<Link>CommonAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\YamlDotNet.Core\YamlDotNet.Core.csproj">
|
||||
<Project>{BF32DE1B-6276-4341-B212-F8862ADBBA7A}</Project>
|
||||
<Name>YamlDotNet.Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -25,7 +25,7 @@ namespace YamlDotNet.UnitTests
|
|||
Assert.IsFalse(parser.MoveNext(), "The parser should not contain more events.");
|
||||
}
|
||||
|
||||
private void AssertCurrent(Parser parser, Event expected) {
|
||||
private void AssertCurrent(Parser parser, ParsingEvent expected) {
|
||||
Console.WriteLine(expected.GetType().Name);
|
||||
Assert.IsInstanceOfType(expected.GetType(), parser.Current, "The event is not of the expected type.");
|
||||
|
||||
|
@ -62,7 +62,7 @@ namespace YamlDotNet.UnitTests
|
|||
}
|
||||
}
|
||||
|
||||
private void AssertNext(Parser parser, Event expected) {
|
||||
private void AssertNext(Parser parser, ParsingEvent expected) {
|
||||
AssertHasNext(parser);
|
||||
AssertCurrent(parser, expected);
|
||||
}
|
||||
|
|
|
@ -1,35 +1,4 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("YamlDotNet.UnitTests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("YamlDotNet.UnitTests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2008")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("15489aa9-3fd2-4971-990c-1e84fbc2d054")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyDescription("The unit tests for the YamlDotNet library.")]
|
||||
|
|
|
@ -134,7 +134,7 @@ namespace YamlDotNet.UnitTests
|
|||
AssertNext(scanner, new StreamStart());
|
||||
AssertNext(scanner, new Anchor("A"));
|
||||
AssertNext(scanner, new FlowSequenceStart());
|
||||
AssertNext(scanner, new Alias("A"));
|
||||
AssertNext(scanner, new AnchorAlias("A"));
|
||||
AssertNext(scanner, new FlowSequenceEnd());
|
||||
AssertNext(scanner, new StreamEnd());
|
||||
AssertDoesNotHaveNext(scanner);
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{894DA4C7-9FA7-4126-AFE1-B9769BEE7D43}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>YamlDotNet.UnitTests</RootNamespace>
|
||||
<AssemblyName>YamlDotNet.UnitTests</AssemblyName>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\YamlDotNet.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Dependencies\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\CommonAssemblyInfo.cs">
|
||||
<Link>CommonAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="InsertionQueueTests.cs" />
|
||||
<Compile Include="LookAheadBufferTests.cs" />
|
||||
<Compile Include="ParserTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ScannerTests.cs" />
|
||||
<Compile Include="YamlTest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\YamlDotNet.Core\YamlDotNet.Core.csproj">
|
||||
<Project>{BF32DE1B-6276-4341-B212-F8862ADBBA7A}</Project>
|
||||
<Name>YamlDotNet.Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,7 @@
|
|||
<NUnitProject>
|
||||
<Settings activeconfig="Debug" />
|
||||
<Config name="Debug" binpathtype="Auto">
|
||||
<assembly path="bin\Debug\YamlDotNet.UnitTests.dll" />
|
||||
</Config>
|
||||
<Config name="Release" binpathtype="Auto" />
|
||||
</NUnitProject>
|
|
@ -1,29 +1,24 @@
|
|||
<Combine name="YamlDotNet" fileversion="2.0">
|
||||
<Configurations active="Debug|Any CPU">
|
||||
<Configuration name="Debug|Any CPU" ctype="CombineConfiguration">
|
||||
<Entry build="True" name="YamlDotNet.UnitTests" configuration="Debug" />
|
||||
<Configurations active="Debug">
|
||||
<Configuration name="Debug" ctype="CombineConfiguration">
|
||||
<Entry build="True" name="YamlDotNet.CoreCs" configuration="Debug" />
|
||||
<Entry build="True" name="YamlDotNet.UnitTests" configuration="Debug|Any CPU" />
|
||||
<Entry build="True" name="Test" configuration="Debug" />
|
||||
<Entry build="True" name="YamlDotNet.Core" configuration="Debug" />
|
||||
<Entry build="True" name="YamlDotNet.RepresentationModel" configuration="Debug" />
|
||||
</Configuration>
|
||||
<Configuration name="Release|Any CPU" ctype="CombineConfiguration">
|
||||
<Entry build="True" name="YamlDotNet.UnitTests" configuration="Debug" />
|
||||
<Entry build="True" name="Test" configuration="Debug" />
|
||||
<Entry build="True" name="YamlDotNet.Core" configuration="Debug" />
|
||||
<Entry build="True" name="YamlDotNet.RepresentationModel" configuration="Debug" />
|
||||
<Configuration name="Release" ctype="CombineConfiguration">
|
||||
<Entry build="True" name="YamlDotNet.CoreCs" configuration="Release" />
|
||||
<Entry build="True" name="YamlDotNet.UnitTests" configuration="Debug|Any CPU" />
|
||||
<Entry build="True" name="Test" configuration="Release" />
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<StartMode startupentry="YamlDotNet.UnitTests" single="True">
|
||||
<Execute type="None" entry="YamlDotNet.Core" />
|
||||
<StartMode startupentry="YamlDotNet.CoreCs" single="True">
|
||||
<Execute type="None" entry="YamlDotNet.CoreCs" />
|
||||
<Execute type="None" entry="YamlDotNet.UnitTests" />
|
||||
<Execute type="None" entry="Test" />
|
||||
<Execute type="None" entry="YamlDotNet.Core" />
|
||||
<Execute type="None" entry="YamlDotNet.RepresentationModel" />
|
||||
</StartMode>
|
||||
<Entries>
|
||||
<Entry filename="YamlDotNet.UnitTests/YamlDotNet.UnitTests.mdp" />
|
||||
<Entry filename="Test/Test.mdp" />
|
||||
<Entry filename="YamlDotNet.Core/YamlDotNet.Core.mdp" />
|
||||
<Entry filename="YamlDotNet.RepresentationModel/YamlDotNet.RepresentationModel.mdp" />
|
||||
<Entry filename="./YamlDotNet.CoreCs/YamlDotNet.CoreCs.mdp" />
|
||||
<Entry filename="./YamlDotNet.UnitTests/YamlDotNet.UnitTests.csproj" />
|
||||
<Entry filename="./test/Test.mdp" />
|
||||
</Entries>
|
||||
</Combine>
|
|
@ -0,0 +1,42 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YamlDotNet.Core", "YamlDotNet.Core\YamlDotNet.Core.csproj", "{BF32DE1B-6276-4341-B212-F8862ADBBA7A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YamlDotNet.UnitTests", "YamlDotNet.UnitTests\YamlDotNet.UnitTests.csproj", "{894DA4C7-9FA7-4126-AFE1-B9769BEE7D43}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dependencies", "Dependencies", "{7BB532F1-A667-41E6-9CE7-4006046C1AA5}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Dependencies\nunit.framework.dll = Dependencies\nunit.framework.dll
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{69EE9636-55BA-49C2-827E-D5684221C345}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
YamlDotNet.snk = YamlDotNet.snk
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YamlDotNet.RepresentationModel", "YamlDotNet.RepresentationModel\YamlDotNet.RepresentationModel.csproj", "{21CA0077-E15C-446D-9C43-F6D3F9D09687}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{BF32DE1B-6276-4341-B212-F8862ADBBA7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BF32DE1B-6276-4341-B212-F8862ADBBA7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BF32DE1B-6276-4341-B212-F8862ADBBA7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BF32DE1B-6276-4341-B212-F8862ADBBA7A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{894DA4C7-9FA7-4126-AFE1-B9769BEE7D43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{894DA4C7-9FA7-4126-AFE1-B9769BEE7D43}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{894DA4C7-9FA7-4126-AFE1-B9769BEE7D43}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{894DA4C7-9FA7-4126-AFE1-B9769BEE7D43}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{21CA0077-E15C-446D-9C43-F6D3F9D09687}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{21CA0077-E15C-446D-9C43-F6D3F9D09687}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{21CA0077-E15C-446D-9C43-F6D3F9D09687}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{21CA0077-E15C-446D-9C43-F6D3F9D09687}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Загрузка…
Ссылка в новой задаче