Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Big code layout reorganization with a bit of refactoring.

  • Loading branch information...
commit 7c9cf61f7d5de5a3acd0dd605c8a530c2cf01561 1 parent c4d1580
@nrk authored
View
2  src/BuildHpricotInitializers.cmd
@@ -1 +1 @@
-..\..\..\..\..\Main\bin\Debug\ClassInitGenerator.exe ..\..\..\..\..\Main\bin\Debug\IronRuby.Libraries.Hpricot.dll -libraries:IronRuby.Libraries.Hpricot -out:Initializers.Generated.cs
+..\deps\ClassInitGenerator.exe ..\bin\Debug\IronRuby.Hpricot.dll -libraries:IronRuby.Hpricot -out:Initializers.Generated.cs
View
19 src/Data/AttributeData.cs
@@ -0,0 +1,19 @@
+using System;
+using IronRuby.Builtins;
+
+namespace IronRuby.Hpricot {
+ public class AttributeData : BasicData {
+ // TODO: Hash or MutableString?
+ private Object _attr;
+
+ public Object Attr {
+ get { return _attr; }
+ set { _attr = value; }
+ }
+
+ // TODO: this smells, will fix later
+ public bool AttrIsNull {
+ get { return _attr == null; }
+ }
+ }
+}
View
19 src/Data/BasicData.cs
@@ -0,0 +1,19 @@
+using System;
+using IronRuby.Builtins;
+
+namespace IronRuby.Hpricot {
+ public class BasicData {
+ private Object _tag;
+ private Object _parent;
+
+ public Object Tag {
+ get { return _tag; }
+ set { _tag = value; }
+ }
+
+ public Object Parent {
+ get { return _parent; }
+ set { _parent = value; }
+ }
+ }
+}
View
38 src/Data/ElementData.cs
@@ -0,0 +1,38 @@
+using System;
+using IronRuby.Builtins;
+
+namespace IronRuby.Hpricot {
+ public class ElementData : AttributeData {
+ // TODO: RubyArray
+ private Object _children;
+ private Object _etag;
+ private Object _raw;
+ private Object _ec;
+ private Int32 _name;
+
+ public Object Children {
+ get { return _children; }
+ set { _children = value; }
+ }
+
+ public Object ETag {
+ get { return _etag; }
+ set { _etag = value; }
+ }
+
+ public Object Raw {
+ get { return _raw; }
+ set { _raw = value; }
+ }
+
+ public Object EC {
+ get { return _ec; }
+ set { _ec = value; }
+ }
+
+ public Int32 Name {
+ get { return _name; }
+ set { _name = value; }
+ }
+ }
+}
View
56 src/Elements/BaseEle.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Text;
+using IronRuby.Builtins;
+using IronRuby.Runtime;
+using Microsoft.Scripting;
+using Microsoft.Scripting.Runtime;
+
+namespace IronRuby.Hpricot {
+ [RubyClass("BaseEle", DefineIn=typeof(Hpricot))]
+ public abstract class BaseElement : IHpricotDataContainer {
+ protected RubyContext _context;
+ protected BasicData _data;
+
+ public BaseElement(ScannerState state)
+ : this(state.Context, new BasicData()) {
+ }
+
+ public BaseElement(ScannerState state, BasicData data)
+ : this(state.Context, data) {
+ }
+
+ public BaseElement(RubyContext context)
+ : this(context, new BasicData()) {
+ }
+
+ public BaseElement(RubyContext context, BasicData data) {
+ _context = context;
+ _data = data;
+ }
+
+ public T GetData<T>() where T : BasicData {
+ return _data as T;
+ }
+
+ protected virtual MutableString RawString {
+ get {
+ return _data.Tag != null ? _data.Tag as MutableString : MutableString.CreateEmpty();
+ }
+ }
+
+ [RubyMethod("raw_string")]
+ public static MutableString GetRawString(BaseElement/*!*/ self) {
+ return self.RawString;
+ }
+
+ [RubyMethod("parent")]
+ public static Object GetParent(BaseElement/*!*/ self) {
+ return self._data.Parent;
+ }
+
+ [RubyMethod("parent=")]
+ public static void SetParent(BaseElement/*!*/ self, Object/*!*/ parent) {
+ self._data.Parent = parent;
+ }
+ }
+}
View
25 src/Elements/BogusETag.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Text;
+using System.Diagnostics;
+using IronRuby.Builtins;
+using IronRuby.Runtime;
+using Microsoft.Scripting;
+using Microsoft.Scripting.Runtime;
+
+namespace IronRuby.Hpricot {
+ [RubyClass("BogusETag", Inherits = typeof(ETag), DefineIn = typeof(Hpricot))]
+ public class BogusETag : ETag {
+ public BogusETag(ScannerState state)
+ : this(state.Context) {
+ }
+
+ public BogusETag(RubyContext context)
+ : base(context) {
+ }
+
+ [RubyConstructor]
+ public static new BogusETag Allocator(RubyClass/*!*/ self) {
+ return new BogusETag(self.Context);
+ }
+ }
+}
View
40 src/Elements/CData.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Text;
+using IronRuby.Builtins;
+using IronRuby.Runtime;
+using Microsoft.Scripting;
+using Microsoft.Scripting.Runtime;
+
+namespace IronRuby.Hpricot {
+ [RubyClass("CData", Inherits = typeof(BaseElement), DefineIn = typeof(Hpricot))]
+ public class CData : BaseElement {
+ public CData(ScannerState state)
+ : this(state.Context) {
+ }
+
+ public CData(RubyContext context)
+ : base(context) {
+ }
+
+ [RubyConstructor]
+ public static CData Allocator(RubyClass/*!*/ self) {
+ return new CData(self.Context);
+ }
+
+ protected override MutableString RawString {
+ get {
+ return MutableString.CreateAscii(String.Format("<![CDATA[{0}]]>", GetContent(this)));
+ }
+ }
+
+ [RubyMethod("content")]
+ public static MutableString GetContent(CData/*!*/ self) {
+ return self._data.Tag as MutableString;
+ }
+
+ [RubyMethod("content=")]
+ public static void SetContent(CData/*!*/ self, Object/*!*/ content) {
+ self._data.Tag = content;
+ }
+ }
+}
View
40 src/Elements/Comment.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Text;
+using IronRuby.Builtins;
+using IronRuby.Runtime;
+using Microsoft.Scripting;
+using Microsoft.Scripting.Runtime;
+
+namespace IronRuby.Hpricot {
+ [RubyClass("Comment", Inherits = typeof(BaseElement), DefineIn = typeof(Hpricot))]
+ public class Comment : BaseElement {
+ public Comment(ScannerState state)
+ : this(state.Context) {
+ }
+
+ public Comment(RubyContext context)
+ : base(context) {
+ }
+
+ [RubyConstructor]
+ public static Comment Allocator(RubyClass/*!*/ self) {
+ return new Comment(self.Context);
+ }
+
+ protected override MutableString RawString {
+ get {
+ return MutableString.CreateAscii(String.Format("<!--{0}-->", GetContent(this)));
+ }
+ }
+
+ [RubyMethod("content")]
+ public static MutableString GetContent(Comment/*!*/ self) {
+ return self._data.Tag as MutableString;
+ }
+
+ [RubyMethod("content=")]
+ public static void SetContent(Comment/*!*/ self, Object/*!*/ content) {
+ self._data.Tag = content;
+ }
+ }
+}
View
46 src/Elements/Document.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Text;
+using IronRuby.Builtins;
+using IronRuby.Runtime;
+using Microsoft.Scripting;
+using Microsoft.Scripting.Runtime;
+
+namespace IronRuby.Hpricot {
+ [RubyClass("Doc", DefineIn = typeof(Hpricot))]
+ public class Document : IHpricotDataContainer {
+ private RubyContext _context;
+ private ElementData _data;
+
+ public Document(ScannerState state)
+ : this(state.Context) {
+ }
+
+ public Document(RubyContext context)
+ : this(context, new ElementData()) {
+ }
+
+ public Document(RubyContext context, ElementData data) {
+ _context = context;
+ _data = data;
+ }
+
+ public T GetData<T>() where T : BasicData {
+ return _data as T;
+ }
+
+ [RubyConstructor]
+ public static Document Allocator(RubyClass/*!*/ self) {
+ return new Document(self.Context);
+ }
+
+ [RubyMethod("children")]
+ public static Object GetChildren(Document/*!*/ self) {
+ return self._data.Children;
+ }
+
+ [RubyMethod("children=")]
+ public static void SetChildren(Document/*!*/ self, Object/*!*/ children) {
+ self._data.Children = children;
+ }
+ }
+}
View
103 src/Elements/DocumentType.cs
@@ -0,0 +1,103 @@
+using System;
+using System.Text;
+using IronRuby.Builtins;
+using IronRuby.Runtime;
+using Microsoft.Scripting;
+using Microsoft.Scripting.Runtime;
+
+namespace IronRuby.Hpricot {
+ [RubyClass("DocType", Inherits = typeof(BaseElement), DefineIn=typeof(Hpricot))]
+ public class DocumentType : BaseElement {
+ private RubySymbol _systemId;
+ private RubySymbol _publicId;
+
+ public DocumentType(ScannerState state)
+ : this(state.Context) {
+ }
+
+ public DocumentType(RubyContext context)
+ : base(context, new AttributeData()) {
+
+ _systemId = context.CreateAsciiSymbol("system_id");
+ _publicId = context.CreateAsciiSymbol("public_id");
+ }
+
+ [RubyConstructor]
+ public static DocumentType Allocator(RubyClass/*!*/ self) {
+ return new DocumentType(self.Context);
+ }
+
+ protected override MutableString RawString {
+ get {
+ MutableString doctype = MutableString.CreateEmpty();
+ doctype.AppendFormat("<!DOCTYPE {0} ", GetTarget(this));
+
+ AttributeData data = _data as AttributeData;
+ if (!data.AttrIsNull) {
+ object publicId = GetPublicId(this);
+ doctype.Append(publicId != null ? String.Format("PUBLIC \"{0}\"", publicId) : "SYSTEM");
+
+ object systemId = GetSystemId(this);
+ if (systemId != null) {
+ doctype.AppendFormat(" \"{0}\"", systemId.ToString().Replace("\"", "\\\""));
+ }
+ }
+
+ doctype.Append(">");
+ return doctype;
+ }
+ }
+
+ [RubyMethod("target")]
+ public static Object GetTarget(DocumentType/*!*/ self) {
+ return self._data.Tag;
+ }
+
+ [RubyMethod("target=")]
+ public static void SetTarget(DocumentType/*!*/ self, Object/*!*/ target) {
+ self._data.Tag = target;
+ }
+
+ [RubyMethod("public_id")]
+ public static Object GetPublicId(DocumentType/*!*/ self) {
+ AttributeData data = self._data as AttributeData;
+ if (data.AttrIsNull) {
+ return null;
+ }
+
+ Object value;
+ (data.Attr as Hash).TryGetValue(self._publicId, out value);
+ return value;
+ }
+
+ [RubyMethod("public_id=")]
+ public static void SetPublicId(RubyContext context/*!*/, DocumentType/*!*/ self, Object/*!*/ publicId) {
+ AttributeData data = self._data as AttributeData;
+ if (data.AttrIsNull) {
+ data.Attr = new Hash(context);
+ }
+ (data.Attr as Hash)[self._publicId] = publicId;
+ }
+
+ [RubyMethod("system_id")]
+ public static Object GetSystemId(DocumentType/*!*/ self) {
+ AttributeData data = self._data as AttributeData;
+ if (data.AttrIsNull) {
+ return null;
+ }
+
+ Object value;
+ (data.Attr as Hash).TryGetValue(self._systemId, out value);
+ return value;
+ }
+
+ [RubyMethod("system_id=")]
+ public static void SetSystemId(RubyContext context/*!*/, DocumentType/*!*/ self, Object/*!*/ systemId) {
+ AttributeData data = self._data as AttributeData;
+ if (data.AttrIsNull) {
+ data.Attr = new Hash(context);
+ }
+ (data.Attr as Hash)[self._systemId] = systemId;
+ }
+ }
+}
View
48 src/Elements/ETag.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Text;
+using System.Diagnostics;
+using IronRuby.Builtins;
+using IronRuby.Runtime;
+using Microsoft.Scripting;
+using Microsoft.Scripting.Runtime;
+
+namespace IronRuby.Hpricot {
+ [RubyClass("ETag", Inherits = typeof(BaseElement), DefineIn = typeof(Hpricot))]
+ public class ETag : BaseElement {
+ public ETag(ScannerState state)
+ : this(state.Context) {
+ }
+
+ public ETag(RubyContext context)
+ : base(context, new AttributeData()) {
+ }
+
+ [RubyConstructor]
+ public static ETag Allocator(RubyClass/*!*/ self) {
+ return new ETag(self.Context);
+ }
+
+ [RubyMethod("raw_string")]
+ public static MutableString GetRawString(ETag/*!*/ self) {
+ Debug.Assert(self._data is AttributeData, "self._data is not an instance of AttributeData");
+ return (self._data as AttributeData).Attr as MutableString;
+ }
+
+ [RubyMethod("clear_raw")]
+ public static bool ClearRaw(ETag/*!*/ self) {
+ Debug.Assert(self._data is AttributeData, "self._data is not an instance of AttributeData");
+ (self._data as AttributeData).Attr = null;
+ return true;
+ }
+
+ [RubyMethod("name")]
+ public static Object GetName(ETag/*!*/ self) {
+ return self._data.Tag;
+ }
+
+ [RubyMethod("name=")]
+ public static void SetName(ETag/*!*/ self, Object/*!*/ name) {
+ self._data.Tag = name;
+ }
+ }
+}
View
75 src/Elements/Element.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Text;
+using IronRuby.Builtins;
+using IronRuby.Runtime;
+using Microsoft.Scripting;
+using Microsoft.Scripting.Runtime;
+
+namespace IronRuby.Hpricot {
+ [RubyClass("Elem", Inherits = typeof(BaseElement), DefineIn = typeof(Hpricot))]
+ public class Element : BaseElement {
+ public Element(ScannerState state)
+ : this(state.Context) {
+ }
+
+ public Element(RubyContext context)
+ : base(context, new ElementData()) {
+ }
+
+ [RubyConstructor]
+ public static Element Allocator(RubyClass/*!*/ self) {
+ return new Element(self.Context);
+ }
+
+ [RubyMethod("raw_string")]
+ public static Object GetRawString(Element/*!*/ self) {
+ return (self._data as ElementData).Raw;
+ }
+
+ [RubyMethod("clear_raw")]
+ public static bool ClearRaw(Element/*!*/ self) {
+ (self._data as ElementData).Raw = null;
+ return true;
+ }
+
+ [RubyMethod("raw_attributes")]
+ public static Object GetRawAttributes(Element/*!*/ self) {
+ return (self._data as ElementData).Attr;
+ }
+
+ [RubyMethod("raw_attributes=")]
+ public static void SetRawAttributes(Element/*!*/ self, Object/*!*/ rawAttributes) {
+ (self._data as ElementData).Attr = rawAttributes;
+ }
+
+ [RubyMethod("children")]
+ public static Object GetChildren(Element/*!*/ self) {
+ return (self._data as ElementData).Children;
+ }
+
+ [RubyMethod("children=")]
+ public static void SetChildren(Element/*!*/ self, Object/*!*/ children) {
+ (self._data as ElementData).Children = children;
+ }
+
+ [RubyMethod("etag")]
+ public static Object GetEtag(Element/*!*/ self) {
+ return (self._data as ElementData).ETag;
+ }
+
+ [RubyMethod("etag=")]
+ public static void SetEtag(Element/*!*/ self, Object/*!*/ etag) {
+ (self._data as ElementData).ETag = etag;
+ }
+
+ [RubyMethod("name")]
+ public static Object GetName(Element/*!*/ self) {
+ return self._data.Tag;
+ }
+
+ [RubyMethod("name=")]
+ public static void SetName(Element/*!*/ self, Object/*!*/ name) {
+ self._data.Tag = name;
+ }
+ }
+}
View
7 src/Elements/IHpricotDataContainer.cs
@@ -0,0 +1,7 @@
+using System;
+
+namespace IronRuby.Hpricot {
+ public interface IHpricotDataContainer {
+ T GetData<T>() where T : BasicData;
+ }
+}
View
51 src/Elements/ProcedureInstruction.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Text;
+using System.Diagnostics;
+using IronRuby.Builtins;
+using IronRuby.Runtime;
+using Microsoft.Scripting;
+using Microsoft.Scripting.Runtime;
+
+namespace IronRuby.Hpricot {
+ [RubyClass("ProcIns", Inherits = typeof(BaseElement), DefineIn = typeof(Hpricot))]
+ public class ProcedureInstruction : BaseElement {
+ public ProcedureInstruction(ScannerState state)
+ : this(state.Context) {
+ }
+
+ public ProcedureInstruction(RubyContext context)
+ : base(context, new AttributeData()) {
+ }
+
+ [RubyConstructor]
+ public static ProcedureInstruction Allocator(RubyClass/*!*/ self) {
+ return new ProcedureInstruction(self.Context);
+ }
+
+ protected override MutableString RawString {
+ get {
+ return MutableString.CreateAscii(String.Format("<!--{0}-->", GetContent(this)));
+ }
+ }
+
+ [RubyMethod("content")]
+ public static MutableString GetContent(ProcedureInstruction/*!*/ self) {
+ return (self._data as AttributeData).Attr as MutableString;
+ }
+
+ [RubyMethod("content=")]
+ public static void SetContent(ProcedureInstruction/*!*/ self, Object/*!*/ content) {
+ (self._data as AttributeData).Attr = content;
+ }
+
+ [RubyMethod("target")]
+ public static Object GetTarget(ProcedureInstruction/*!*/ self) {
+ return self._data.Tag;
+ }
+
+ [RubyMethod("target=")]
+ public static void SetTarget(ProcedureInstruction/*!*/ self, Object/*!*/ target) {
+ self._data.Tag = target;
+ }
+ }
+}
View
35 src/Elements/Text.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Text;
+using System.Diagnostics;
+using IronRuby.Builtins;
+using IronRuby.Runtime;
+using Microsoft.Scripting;
+using Microsoft.Scripting.Runtime;
+
+namespace IronRuby.Hpricot {
+ [RubyClass("Text", Inherits = typeof(BaseElement), DefineIn = typeof(Hpricot))]
+ public class Text : BaseElement {
+ public Text(ScannerState state)
+ : this(state.Context) {
+ }
+
+ public Text(RubyContext context)
+ : base(context) {
+ }
+
+ [RubyConstructor]
+ public static Text Allocator(RubyClass/*!*/ self) {
+ return new Text(self.Context);
+ }
+
+ [RubyMethod("content")]
+ public static MutableString GetContent(Text/*!*/ self) {
+ return self._data.Tag as MutableString;
+ }
+
+ [RubyMethod("content=")]
+ public static void SetContent(Text/*!*/ self, Object/*!*/ content) {
+ self._data.Tag = content;
+ }
+ }
+}
View
119 src/Elements/XmlDeclaration.cs
@@ -0,0 +1,119 @@
+using System;
+using System.Text;
+using System.Diagnostics;
+using IronRuby.Builtins;
+using IronRuby.Runtime;
+using Microsoft.Scripting;
+using Microsoft.Scripting.Runtime;
+
+namespace IronRuby.Hpricot {
+ [RubyClass("XMLDecl", Inherits = typeof(BaseElement), DefineIn = typeof(Hpricot))]
+ public class XmlDeclaration : BaseElement {
+ private RubySymbol _encoding;
+ private RubySymbol _standalone;
+ private RubySymbol _version;
+
+ public XmlDeclaration(ScannerState state)
+ : this(state.Context) {
+ }
+
+ public XmlDeclaration(RubyContext context)
+ : base(context, new AttributeData()) {
+
+ _encoding = context.CreateAsciiSymbol("encoding");
+ _standalone = context.CreateAsciiSymbol("standalone");
+ _version = context.CreateAsciiSymbol("version");
+ }
+
+ [RubyConstructor]
+ public static XmlDeclaration Allocator(RubyClass/*!*/ self) {
+ return new XmlDeclaration(self.Context);
+ }
+
+ protected override MutableString RawString {
+ get {
+ MutableString xmldecl = MutableString.CreateEmpty();
+ xmldecl.AppendFormat("<?xml version=\"{0}\"", GetVersion(this));
+
+ AttributeData data = _data as AttributeData;
+ if (!data.AttrIsNull) {
+ object encoding = GetEncoding(this);
+ if (encoding != null) {
+ xmldecl.AppendFormat(" encoding=\"{0}\"", encoding);
+ }
+
+ object standalone = GetStandalone(this);
+ if (standalone != null) {
+ xmldecl.AppendFormat(" standalone=\"{0}\"", standalone);
+ }
+ }
+
+ xmldecl.Append("?>");
+ return xmldecl;
+ }
+ }
+
+ [RubyMethod("encoding")]
+ public static Object GetEncoding(XmlDeclaration/*!*/ self) {
+ AttributeData data = self._data as AttributeData;
+ if (data.AttrIsNull) {
+ return null;
+ }
+
+ Object value;
+ (data.Attr as Hash).TryGetValue(self._encoding, out value);
+ return value;
+ }
+
+ [RubyMethod("encoding=")]
+ public static void SetEncoding(RubyContext/*!*/ context, XmlDeclaration/*!*/ self, Object/*!*/ encoding) {
+ AttributeData data = self._data as AttributeData;
+ if (data.AttrIsNull) {
+ data.Attr = new Hash(context);
+ }
+ (data.Attr as Hash)[self._encoding] = encoding;
+ }
+
+ [RubyMethod("standalone")]
+ public static Object GetStandalone(XmlDeclaration/*!*/ self) {
+ AttributeData data = self._data as AttributeData;
+ if (data.AttrIsNull) {
+ return null;
+ }
+
+ Object value;
+ (data.Attr as Hash).TryGetValue(self._standalone, out value);
+ return value;
+ }
+
+ [RubyMethod("standalone=")]
+ public static void SetStandalone(RubyContext/*!*/ context, XmlDeclaration/*!*/ self, Object/*!*/ standalone) {
+ AttributeData data = self._data as AttributeData;
+ if (data.AttrIsNull) {
+ data.Attr = new Hash(context);
+ }
+ (data.Attr as Hash)[self._standalone] = standalone;
+ }
+
+ [RubyMethod("version")]
+ public static Object GetVersion(XmlDeclaration/*!*/ self) {
+ AttributeData data = self._data as AttributeData;
+ if (data.AttrIsNull) {
+ return null;
+ }
+
+ Object value;
+ (data.Attr as Hash).TryGetValue(self._version, out value);
+ return value;
+ }
+
+ [RubyMethod("version=")]
+ public static void SetVersion(RubyContext/*!*/ context, XmlDeclaration/*!*/ self, Object/*!*/ version) {
+ AttributeData data = self._data as AttributeData;
+ if (data.AttrIsNull) {
+ data.Attr = new Hash(context);
+ }
+ (data.Attr as Hash)[self._version] = version;
+ }
+ }
+}
View
2  src/FastXs/BuiltinsOps.cs
@@ -5,7 +5,7 @@
using Microsoft.Scripting;
using Microsoft.Scripting.Runtime;
-namespace IronRuby.FastXs {
+namespace IronRuby.Hpricot.FastXs {
[RubyModule(Extends = typeof(MutableString))]
public static class MutableStringOps {
[RubyMethod("fast_xs")]
View
2  src/FastXs/EntityMap.cs
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
-namespace IronRuby.FastXs {
+namespace IronRuby.Hpricot.FastXs {
/// <summary>
///
/// </summary>
View
2  src/FastXs/FastXs.cs
@@ -6,7 +6,7 @@
using Microsoft.Scripting;
using Microsoft.Scripting.Runtime;
-namespace IronRuby.FastXs {
+namespace IronRuby.Hpricot.FastXs {
public class Entities {
#region fields
/// <summary>
View
618 src/Hpricot.cs
@@ -1,27 +1,13 @@
using System;
using System.Text;
-using System.Diagnostics;
using IronRuby.Builtins;
using IronRuby.Runtime;
using Microsoft.Scripting;
using Microsoft.Scripting.Runtime;
namespace IronRuby.Hpricot {
-
- #region IHpricotDataContainer
-
- public interface IHpricotDataContainer {
- T GetData<T>() where T : BasicData;
- }
-
- #endregion
-
[RubyModule("Hpricot")]
public static class Hpricot {
- #region Hpricot
-
- // TODO: ProcInsParse seems to be actually unused in ruby code. I'll leave it here for now,
- // but I think it is safe to remove it.
[RubyConstant("ProcInsParse")]
public static readonly RubyRegex ProcInsParse = HpricotScanner.ProcInsParse;
@@ -55,609 +41,5 @@ public static class Hpricot {
public static void SetBufferSize(RubyModule/*!*/ self, Int32 bufferSize) {
self.SetClassVariable("@@buffer_size", bufferSize);
}
-
- #endregion
-
-
- #region Hpricot::Doc
-
- [RubyClass("Doc")]
- public class Document : IHpricotDataContainer {
- private RubyContext _context;
- private ElementData _data;
-
- public Document(ScannerState state)
- : this(state.Context) {
- }
-
- public Document(RubyContext context)
- : this(context, new ElementData()) {
- }
-
- public Document(RubyContext context, ElementData data) {
- _context = context;
- _data = data;
- }
-
- public T GetData<T>() where T : BasicData {
- return _data as T;
- }
-
- [RubyConstructor]
- public static Document Allocator(RubyClass/*!*/ self) {
- return new Document(self.Context);
- }
-
- [RubyMethod("children")]
- public static Object GetChildren(Document/*!*/ self) {
- return self._data.Children;
- }
-
- [RubyMethod("children=")]
- public static void SetChildren(Document/*!*/ self, Object/*!*/ children) {
- self._data.Children = children;
- }
- }
-
- #endregion
-
- #region Hpricot::BaseEle
-
- [RubyClass("BaseEle")]
- public abstract class BaseElement : IHpricotDataContainer {
- protected RubyContext _context;
- protected BasicData _data;
-
- public BaseElement(ScannerState state)
- : this(state.Context, new BasicData()) {
- }
-
- public BaseElement(ScannerState state, BasicData data)
- : this(state.Context, data) {
- }
-
- public BaseElement(RubyContext context)
- : this(context, new BasicData()) {
- }
-
- public BaseElement(RubyContext context, BasicData data) {
- _context = context;
- _data = data;
- }
-
- public T GetData<T>() where T : BasicData {
- return _data as T;
- }
-
- protected virtual MutableString RawString {
- get {
- return _data.Tag != null ? _data.Tag as MutableString : MutableString.CreateEmpty();
- }
- }
-
- [RubyMethod("raw_string")]
- public static MutableString GetRawString(BaseElement/*!*/ self) {
- return self.RawString;
- }
-
- [RubyMethod("parent")]
- public static Object GetParent(BaseElement/*!*/ self) {
- return self._data.Parent;
- }
-
- [RubyMethod("parent=")]
- public static void SetParent(BaseElement/*!*/ self, Object/*!*/ parent) {
- self._data.Parent = parent;
- }
- }
-
- #endregion
-
- #region Hpricot::CData
-
- [RubyClass("CData", Inherits = typeof(BaseElement))]
- public class CData : BaseElement {
- public CData(ScannerState state)
- : this(state.Context) {
- }
-
- public CData(RubyContext context)
- : base(context) {
- }
-
- [RubyConstructor]
- public static CData Allocator(RubyClass/*!*/ self) {
- return new CData(self.Context);
- }
-
- protected override MutableString RawString {
- get {
- return MutableString.CreateAscii(String.Format("<![CDATA[{0}]]>", GetContent(this)));
- }
- }
-
- [RubyMethod("content")]
- public static MutableString GetContent(CData/*!*/ self) {
- return self._data.Tag as MutableString;
- }
-
- [RubyMethod("content=")]
- public static void SetContent(CData/*!*/ self, Object/*!*/ content) {
- self._data.Tag = content;
- }
- }
-
- #endregion
-
- #region Hpricot::Comment
-
- [RubyClass("Comment", Inherits = typeof(BaseElement))]
- public class Comment : BaseElement {
- public Comment(ScannerState state)
- : this(state.Context) {
- }
-
- public Comment(RubyContext context)
- : base(context) {
- }
-
- [RubyConstructor]
- public static Comment Allocator(RubyClass/*!*/ self) {
- return new Comment(self.Context);
- }
-
- protected override MutableString RawString {
- get {
- return MutableString.CreateAscii(String.Format("<!--{0}-->", GetContent(this)));
- }
- }
-
- [RubyMethod("content")]
- public static MutableString GetContent(Comment/*!*/ self) {
- return self._data.Tag as MutableString;
- }
-
- [RubyMethod("content=")]
- public static void SetContent(Comment/*!*/ self, Object/*!*/ content) {
- self._data.Tag = content;
- }
- }
-
- #endregion
-
- #region Hpricot::DocType
-
- [RubyClass("DocType", Inherits = typeof(BaseElement))]
- public class DocumentType : BaseElement {
- private RubySymbol _systemId;
- private RubySymbol _publicId;
-
- public DocumentType(ScannerState state)
- : this(state.Context) {
- }
-
- public DocumentType(RubyContext context)
- : base(context, new AttributeData()) {
-
- _systemId = context.CreateAsciiSymbol("system_id");
- _publicId = context.CreateAsciiSymbol("public_id");
- }
-
- [RubyConstructor]
- public static DocumentType Allocator(RubyClass/*!*/ self) {
- return new DocumentType(self.Context);
- }
-
- protected override MutableString RawString {
- get {
- MutableString doctype = MutableString.CreateEmpty();
- doctype.AppendFormat("<!DOCTYPE {0} ", GetTarget(this));
-
- AttributeData data = _data as AttributeData;
- if (!data.AttrIsNull) {
- object publicId = GetPublicId(this);
- doctype.Append(publicId != null ? String.Format("PUBLIC \"{0}\"", publicId) : "SYSTEM");
-
- object systemId = GetSystemId(this);
- if (systemId != null) {
- doctype.AppendFormat(" \"{0}\"", systemId.ToString().Replace("\"", "\\\""));
- }
- }
-
- doctype.Append(">");
- return doctype;
- }
- }
-
- [RubyMethod("target")]
- public static Object GetTarget(DocumentType/*!*/ self) {
- return self._data.Tag;
- }
-
- [RubyMethod("target=")]
- public static void SetTarget(DocumentType/*!*/ self, Object/*!*/ target) {
- self._data.Tag = target;
- }
-
- [RubyMethod("public_id")]
- public static Object GetPublicId(DocumentType/*!*/ self) {
- AttributeData data = self._data as AttributeData;
- if (data.AttrIsNull) {
- return null;
- }
-
- Object value;
- (data.Attr as Hash).TryGetValue(self._publicId, out value);
- return value;
- }
-
- [RubyMethod("public_id=")]
- public static void SetPublicId(RubyContext context/*!*/, DocumentType/*!*/ self, Object/*!*/ publicId) {
- AttributeData data = self._data as AttributeData;
- if (data.AttrIsNull) {
- data.Attr = new Hash(context);
- }
- (data.Attr as Hash)[self._publicId] = publicId;
- }
-
- [RubyMethod("system_id")]
- public static Object GetSystemId(DocumentType/*!*/ self) {
- AttributeData data = self._data as AttributeData;
- if (data.AttrIsNull) {
- return null;
- }
-
- Object value;
- (data.Attr as Hash).TryGetValue(self._systemId, out value);
- return value;
- }
-
- [RubyMethod("system_id=")]
- public static void SetSystemId(RubyContext context/*!*/, DocumentType/*!*/ self, Object/*!*/ systemId) {
- AttributeData data = self._data as AttributeData;
- if (data.AttrIsNull) {
- data.Attr = new Hash(context);
- }
- (data.Attr as Hash)[self._systemId] = systemId;
- }
- }
-
- #endregion
-
- #region Hpricot::Elem
-
- [RubyClass("Elem", Inherits = typeof(BaseElement))]
- public class Element : BaseElement {
- public Element(ScannerState state)
- : this(state.Context) {
- }
-
- public Element(RubyContext context)
- : base(context, new ElementData()) {
- }
-
- [RubyConstructor]
- public static Element Allocator(RubyClass/*!*/ self) {
- return new Element(self.Context);
- }
-
- [RubyMethod("raw_string")]
- public static Object GetRawString(Element/*!*/ self) {
- return (self._data as ElementData).Raw;
- }
-
- [RubyMethod("clear_raw")]
- public static bool ClearRaw(Element/*!*/ self) {
- (self._data as ElementData).Raw = null;
- return true;
- }
-
- [RubyMethod("raw_attributes")]
- public static Object GetRawAttributes(Element/*!*/ self) {
- return (self._data as ElementData).Attr;
- }
-
- [RubyMethod("raw_attributes=")]
- public static void SetRawAttributes(Element/*!*/ self, Object/*!*/ rawAttributes) {
- (self._data as ElementData).Attr = rawAttributes;
- }
-
- [RubyMethod("children")]
- public static Object GetChildren(Element/*!*/ self) {
- return (self._data as ElementData).Children;
- }
-
- [RubyMethod("children=")]
- public static void SetChildren(Element/*!*/ self, Object/*!*/ children) {
- (self._data as ElementData).Children = children;
- }
-
- [RubyMethod("etag")]
- public static Object GetEtag(Element/*!*/ self) {
- return (self._data as ElementData).ETag;
- }
-
- [RubyMethod("etag=")]
- public static void SetEtag(Element/*!*/ self, Object/*!*/ etag) {
- (self._data as ElementData).ETag = etag;
- }
-
- [RubyMethod("name")]
- public static Object GetName(Element/*!*/ self) {
- return self._data.Tag;
- }
-
- [RubyMethod("name=")]
- public static void SetName(Element/*!*/ self, Object/*!*/ name) {
- self._data.Tag = name;
- }
- }
-
- #endregion
-
- #region Hpricot::ETag
-
- [RubyClass("ETag", Inherits = typeof(BaseElement))]
- public class ETag : BaseElement {
- public ETag(ScannerState state)
- : this(state.Context) {
- }
-
- public ETag(RubyContext context)
- : base(context, new AttributeData()) {
- }
-
- [RubyConstructor]
- public static ETag Allocator(RubyClass/*!*/ self) {
- return new ETag(self.Context);
- }
-
- [RubyMethod("raw_string")]
- public static MutableString GetRawString(ETag/*!*/ self) {
- Debug.Assert(self._data is AttributeData, "self._data is not an instance of AttributeData");
- return (self._data as AttributeData).Attr as MutableString;
- }
-
- [RubyMethod("clear_raw")]
- public static bool ClearRaw(ETag/*!*/ self) {
- Debug.Assert(self._data is AttributeData, "self._data is not an instance of AttributeData");
- (self._data as AttributeData).Attr = null;
- return true;
- }
-
- [RubyMethod("name")]
- public static Object GetName(ETag/*!*/ self) {
- return self._data.Tag;
- }
-
- [RubyMethod("name=")]
- public static void SetName(ETag/*!*/ self, Object/*!*/ name) {
- self._data.Tag = name;
- }
- }
-
- #endregion
-
- #region Hpricot::BogusETag
-
- [RubyClass("BogusETag", Inherits = typeof(ETag))]
- public class BogusETag : ETag {
- public BogusETag(ScannerState state)
- : this(state.Context) {
- }
-
- public BogusETag(RubyContext context)
- : base(context) {
- }
-
- [RubyConstructor]
- public static new BogusETag Allocator(RubyClass/*!*/ self) {
- return new BogusETag(self.Context);
- }
- }
-
- #endregion
-
- #region Hpricot::Text
-
- [RubyClass("Text", Inherits = typeof(BaseElement))]
- public class Text : BaseElement {
- public Text(ScannerState state)
- : this(state.Context) {
- }
-
- public Text(RubyContext context)
- : base(context) {
- }
-
- [RubyConstructor]
- public static Text Allocator(RubyClass/*!*/ self) {
- return new Text(self.Context);
- }
-
- [RubyMethod("content")]
- public static MutableString GetContent(Text/*!*/ self) {
- return self._data.Tag as MutableString;
- }
-
- [RubyMethod("content=")]
- public static void SetContent(Text/*!*/ self, Object/*!*/ content) {
- self._data.Tag = content;
- }
- }
-
- #endregion
-
- #region Hpricot::XMLDecl
-
- [RubyClass("XMLDecl", Inherits = typeof(BaseElement))]
- public class XmlDeclaration : BaseElement {
- private RubySymbol _encoding;
- private RubySymbol _standalone;
- private RubySymbol _version;
-
- public XmlDeclaration(ScannerState state)
- : this(state.Context) {
- }
-
- public XmlDeclaration(RubyContext context)
- : base(context, new AttributeData()) {
-
- _encoding = context.CreateAsciiSymbol("encoding");
- _standalone = context.CreateAsciiSymbol("standalone");
- _version = context.CreateAsciiSymbol("version");
- }
-
- [RubyConstructor]
- public static XmlDeclaration Allocator(RubyClass/*!*/ self) {
- return new XmlDeclaration(self.Context);
- }
-
- protected override MutableString RawString {
- get {
- MutableString xmldecl = MutableString.CreateEmpty();
- xmldecl.AppendFormat("<?xml version=\"{0}\"", GetVersion(this));
-
- AttributeData data = _data as AttributeData;
- if (!data.AttrIsNull) {
- object encoding = GetEncoding(this);
- if (encoding != null) {
- xmldecl.AppendFormat(" encoding=\"{0}\"", encoding);
- }
-
- object standalone = GetStandalone(this);
- if (standalone != null) {
- xmldecl.AppendFormat(" standalone=\"{0}\"", standalone);
- }
- }
-
- xmldecl.Append("?>");
- return xmldecl;
- }
- }
-
- [RubyMethod("encoding")]
- public static Object GetEncoding(XmlDeclaration/*!*/ self) {
- AttributeData data = self._data as AttributeData;
- if (data.AttrIsNull) {
- return null;
- }
-
- Object value;
- (data.Attr as Hash).TryGetValue(self._encoding, out value);
- return value;
- }
-
- [RubyMethod("encoding=")]
- public static void SetEncoding(RubyContext/*!*/ context, XmlDeclaration/*!*/ self, Object/*!*/ encoding) {
- AttributeData data = self._data as AttributeData;
- if (data.AttrIsNull) {
- data.Attr = new Hash(context);
- }
- (data.Attr as Hash)[self._encoding] = encoding;
- }
-
- [RubyMethod("standalone")]
- public static Object GetStandalone(XmlDeclaration/*!*/ self) {
- AttributeData data = self._data as AttributeData;
- if (data.AttrIsNull) {
- return null;
- }
-
- Object value;
- (data.Attr as Hash).TryGetValue(self._standalone, out value);
- return value;
- }
-
- [RubyMethod("standalone=")]
- public static void SetStandalone(RubyContext/*!*/ context, XmlDeclaration/*!*/ self, Object/*!*/ standalone) {
- AttributeData data = self._data as AttributeData;
- if (data.AttrIsNull) {
- data.Attr = new Hash(context);
- }
- (data.Attr as Hash)[self._standalone] = standalone;
- }
-
- [RubyMethod("version")]
- public static Object GetVersion(XmlDeclaration/*!*/ self) {
- AttributeData data = self._data as AttributeData;
- if (data.AttrIsNull) {
- return null;
- }
-
- Object value;
- (data.Attr as Hash).TryGetValue(self._version, out value);
- return value;
- }
-
- [RubyMethod("version=")]
- public static void SetVersion(RubyContext/*!*/ context, XmlDeclaration/*!*/ self, Object/*!*/ version) {
- AttributeData data = self._data as AttributeData;
- if (data.AttrIsNull) {
- data.Attr = new Hash(context);
- }
- (data.Attr as Hash)[self._version] = version;
- }
- }
-
- #endregion
-
- #region Hpricot::ProcIns
-
- [RubyClass("ProcIns", Inherits = typeof(BaseElement))]
- public class ProcedureInstruction : BaseElement {
- public ProcedureInstruction(ScannerState state)
- : this(state.Context) {
- }
-
- public ProcedureInstruction(RubyContext context)
- : base(context, new AttributeData()) {
- }
-
- [RubyConstructor]
- public static ProcedureInstruction Allocator(RubyClass/*!*/ self) {
- return new ProcedureInstruction(self.Context);
- }
-
- protected override MutableString RawString {
- get {
- return MutableString.CreateAscii(String.Format("<!--{0}-->", GetContent(this)));
- }
- }
-
- [RubyMethod("content")]
- public static MutableString GetContent(ProcedureInstruction/*!*/ self) {
- return (self._data as AttributeData).Attr as MutableString;
- }
-
- [RubyMethod("content=")]
- public static void SetContent(ProcedureInstruction/*!*/ self, Object/*!*/ content) {
- (self._data as AttributeData).Attr = content;
- }
-
- [RubyMethod("target")]
- public static Object GetTarget(ProcedureInstruction/*!*/ self) {
- return self._data.Tag;
- }
-
- [RubyMethod("target=")]
- public static void SetTarget(ProcedureInstruction/*!*/ self, Object/*!*/ target) {
- self._data.Tag = target;
- }
- }
-
- #endregion
-
-
- #region Hpricot::ParseError
-
- [RubyClass("ParseError")]
- public class ParserException : SystemException {
- public ParserException(String message) :
- base(message) {
- }
- }
-
- #endregion
}
}
View
80 src/HpricotObjects.cs
@@ -1,80 +0,0 @@
-using System;
-using IronRuby.Builtins;
-
-namespace IronRuby.Hpricot {
- #region BasicData
-
- public class BasicData {
- private Object _tag;
- private Object _parent;
-
- public Object Tag {
- get { return _tag; }
- set { _tag = value; }
- }
-
- public Object Parent {
- get { return _parent; }
- set { _parent = value; }
- }
- }
-
- #endregion
-
- #region AttributeData
-
- public class AttributeData : BasicData {
- // TODO: Hash or MutableString?
- private Object _attr;
-
- public Object Attr {
- get { return _attr; }
- set { _attr = value; }
- }
-
- // TODO: this smells, will fix later
- public bool AttrIsNull {
- get { return _attr == null; }
- }
- }
-
- #endregion
-
- #region ElementData
-
- public class ElementData : AttributeData {
- // TODO: RubyArray
- private Object _children;
- private Object _etag;
- private Object _raw;
- private Object _ec;
- private Int32 _name;
-
- public Object Children {
- get { return _children; }
- set { _children = value; }
- }
-
- public Object ETag {
- get { return _etag; }
- set { _etag = value; }
- }
-
- public Object Raw {
- get { return _raw; }
- set { _raw = value; }
- }
-
- public Object EC {
- get { return _ec; }
- set { _ec = value; }
- }
-
- public Int32 Name {
- get { return _name; }
- set { _name = value; }
- }
- }
-
- #endregion
-}
View
32 src/HpricotScanner.cs
@@ -1047,7 +1047,7 @@ public class HpricotScanner {
}
private IHpricotDataContainer H_ELE(IHpricotDataContainer ele, ScannerState state, Object sym, Object tag, Object attr, Object ec, Int32 raw, Int32 rawlen) {
- if (ele is Hpricot.Element) {
+ if (ele is Element) {
ElementData he = ele.GetData<ElementData>();
he.Name = 0;
@@ -1059,11 +1059,11 @@ public class HpricotScanner {
he.Raw = MutableString.Create(new String(buf, raw, rawlen), RubyEncoding.Binary);
}
}
- else if (ele is Hpricot.DocumentType || ele is Hpricot.ProcedureInstruction || ele is Hpricot.XmlDeclaration || ele is Hpricot.ETag || ele is Hpricot.BogusETag) {
+ else if (ele is DocumentType || ele is ProcedureInstruction || ele is XmlDeclaration || ele is ETag || ele is BogusETag) {
AttributeData ha = ele.GetData<AttributeData>();
ha.Tag = tag;
- if (ele is Hpricot.ETag || ele is Hpricot.BogusETag) {
+ if (ele is ETag || ele is BogusETag) {
if (raw > -1) {
ha.Attr = MutableString.Create(new String(buf, raw, rawlen), RubyEncoding.Binary);
}
@@ -1175,7 +1175,7 @@ public class HpricotScanner {
}
if (sym_emptytag.Equals(sym) || sym_stag.Equals(sym)) {
- var ele = H_ELE(new Hpricot.Element(state), state, sym, tag, attr, ec, raw, rawlen);
+ var ele = H_ELE(new Element(state), state, sym, tag, attr, ec, raw, rawlen);
var he = ele.GetData<ElementData>();
he.Name = tag.GetHashCode();
@@ -1263,12 +1263,12 @@ public class HpricotScanner {
}
if (match == null) {
- rb_hpricot_add(state.Focus, H_ELE(new Hpricot.BogusETag(state), state, sym, tag, attr, ec, raw, rawlen));
+ rb_hpricot_add(state.Focus, H_ELE(new BogusETag(state), state, sym, tag, attr, ec, raw, rawlen));
}
else {
- var ele = H_ELE(new Hpricot.ETag(state), state, sym, tag, attr, ec, raw, rawlen);
+ var ele = H_ELE(new ETag(state), state, sym, tag, attr, ec, raw, rawlen);
Debug.Assert(match is IHpricotDataContainer, "match is not an instance of IHpricotDataContainer");
- ElementData he = (match as Hpricot.Element).GetData<ElementData>();
+ ElementData he = (match as Element).GetData<ElementData>();
// TODO: couldn't find this in the original implementation but it still sounds right.
he.ETag = ele;
@@ -1280,10 +1280,10 @@ public class HpricotScanner {
}
else if (sym_cdata.Equals(sym)) {
- rb_hpricot_add(state.Focus, H_ELE(new Hpricot.CData(state), state, sym, tag, attr, ec, raw, rawlen));
+ rb_hpricot_add(state.Focus, H_ELE(new CData(state), state, sym, tag, attr, ec, raw, rawlen));
}
else if (sym_comment.Equals(sym)) {
- rb_hpricot_add(state.Focus, H_ELE(new Hpricot.Comment(state), state, sym, tag, attr, ec, raw, rawlen));
+ rb_hpricot_add(state.Focus, H_ELE(new Comment(state), state, sym, tag, attr, ec, raw, rawlen));
}
else if (sym_doctype.Equals(sym)) {
if (state.Strict) {
@@ -1292,7 +1292,7 @@ public class HpricotScanner {
(attr as Hash).Add(state.Context.CreateAsciiSymbol("system_id"), MutableString.CreateAscii("http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"));
(attr as Hash).Add(state.Context.CreateAsciiSymbol("public_id"), MutableString.CreateAscii("-//W3C//DTD XHTML 1.0 Strict//EN"));
}
- rb_hpricot_add(state.Focus, H_ELE(new Hpricot.DocumentType(state), state, sym, tag, attr, ec, raw, rawlen));
+ rb_hpricot_add(state.Focus, H_ELE(new DocumentType(state), state, sym, tag, attr, ec, raw, rawlen));
}
else if (sym_procins.Equals(sym)) {
Debug.Assert(tag is MutableString, "tag is not an instance of MutableString");
@@ -1302,11 +1302,11 @@ public class HpricotScanner {
tag = match.GetGroupValue(1);
attr = match.GetGroupValue(2);
- rb_hpricot_add(state.Focus, H_ELE(new Hpricot.ProcedureInstruction(state), state, sym, tag, attr, ec, raw, rawlen));
+ rb_hpricot_add(state.Focus, H_ELE(new ProcedureInstruction(state), state, sym, tag, attr, ec, raw, rawlen));
}
else if (sym_text.Equals(sym)) {
// TODO: add raw_string as well?
- if (state.Last != null && state.Last is Hpricot.Text) {
+ if (state.Last != null && state.Last is Text) {
BasicData he = (state.Last as IHpricotDataContainer).GetData<BasicData>();
Debug.Assert(tag is MutableString, "tag is not an instance of MutableString");
@@ -1315,11 +1315,11 @@ public class HpricotScanner {
(he.Tag as MutableString).Append(tag as MutableString);
}
else {
- rb_hpricot_add(state.Focus, H_ELE(new Hpricot.Text(state), state, sym, tag, attr, ec, raw, rawlen));
+ rb_hpricot_add(state.Focus, H_ELE(new Text(state), state, sym, tag, attr, ec, raw, rawlen));
}
}
else if (sym_xmldecl.Equals(sym)) {
- rb_hpricot_add(state.Focus, H_ELE(new Hpricot.XmlDeclaration(state), state, sym, tag, attr, ec, raw, rawlen));
+ rb_hpricot_add(state.Focus, H_ELE(new XmlDeclaration(state), state, sym, tag, attr, ec, raw, rawlen));
}
}
@@ -1495,7 +1495,7 @@ public class HpricotScanner {
if (_blockParam == null) {
var state = new ScannerState(_context);
- state.Doc = new Hpricot.Document(state);
+ state.Doc = new Document(state);
state.Focus = state.Doc as IHpricotDataContainer;
state.Xml = OPT(options, _optXml);
state.Strict = OPT(options, _optXhtmlStrict);
@@ -1810,7 +1810,7 @@ public class HpricotScanner {
else {
exceptionMessage = String.Format("parse error on line {0}.\n{1}", curline, NO_WAY_SERIOUSLY);
}
- throw new Hpricot.ParserException(exceptionMessage);
+ throw new ParserException(exceptionMessage);
}
if (done && ele_open) {
View
131 src/Initializers.Generated.cs
@@ -12,38 +12,38 @@ public sealed class HpricotLibraryInitializer : IronRuby.Builtins.LibraryInitial
IronRuby.Builtins.RubyModule def1 = DefineGlobalModule("Hpricot", typeof(IronRuby.Hpricot.Hpricot), 0x00000008, null, LoadHpricot_Class, LoadHpricot_Constants, IronRuby.Builtins.RubyModule.EmptyArray);
- IronRuby.Builtins.RubyClass def2 = DefineClass("Hpricot::BaseEle", typeof(IronRuby.Hpricot.Hpricot.BaseElement), 0x00000008, classRef0, LoadHpricot__BaseEle_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray);
- IronRuby.Builtins.RubyClass def6 = DefineClass("Hpricot::Doc", typeof(IronRuby.Hpricot.Hpricot.Document), 0x00000008, classRef0, LoadHpricot__Doc_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
- new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.Hpricot.Document>(IronRuby.Hpricot.Hpricot.Document.Allocator)
+ IronRuby.Builtins.RubyClass def2 = DefineClass("Hpricot::BaseEle", typeof(IronRuby.Hpricot.BaseElement), 0x00000008, classRef0, LoadHpricot__BaseEle_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray);
+ IronRuby.Builtins.RubyClass def6 = DefineClass("Hpricot::Doc", typeof(IronRuby.Hpricot.Document), 0x00000008, classRef0, LoadHpricot__Doc_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
+ new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.Document>(IronRuby.Hpricot.Document.Allocator)
);
- IronRuby.Builtins.RubyClass def10 = DefineClass("Hpricot::ParseError", typeof(IronRuby.Hpricot.Hpricot.ParserException), 0x00000008, classRef1, null, null, null, IronRuby.Builtins.RubyModule.EmptyArray);
+ IronRuby.Builtins.RubyClass def10 = DefineClass("Hpricot::ParseError", typeof(IronRuby.Hpricot.ParserException), 0x00000008, classRef1, null, null, null, IronRuby.Builtins.RubyModule.EmptyArray);
ExtendModule(typeof(IronRuby.Builtins.MutableString), 0x00000000, LoadIronRuby__Builtins__MutableString_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray);
- IronRuby.Builtins.RubyClass def4 = DefineClass("Hpricot::CData", typeof(IronRuby.Hpricot.Hpricot.CData), 0x00000008, def2, LoadHpricot__CData_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
- new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.Hpricot.CData>(IronRuby.Hpricot.Hpricot.CData.Allocator)
+ IronRuby.Builtins.RubyClass def4 = DefineClass("Hpricot::CData", typeof(IronRuby.Hpricot.CData), 0x00000008, def2, LoadHpricot__CData_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
+ new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.CData>(IronRuby.Hpricot.CData.Allocator)
);
- IronRuby.Builtins.RubyClass def5 = DefineClass("Hpricot::Comment", typeof(IronRuby.Hpricot.Hpricot.Comment), 0x00000008, def2, LoadHpricot__Comment_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
- new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.Hpricot.Comment>(IronRuby.Hpricot.Hpricot.Comment.Allocator)
+ IronRuby.Builtins.RubyClass def5 = DefineClass("Hpricot::Comment", typeof(IronRuby.Hpricot.Comment), 0x00000008, def2, LoadHpricot__Comment_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
+ new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.Comment>(IronRuby.Hpricot.Comment.Allocator)
);
- IronRuby.Builtins.RubyClass def7 = DefineClass("Hpricot::DocType", typeof(IronRuby.Hpricot.Hpricot.DocumentType), 0x00000008, def2, LoadHpricot__DocType_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
- new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.Hpricot.DocumentType>(IronRuby.Hpricot.Hpricot.DocumentType.Allocator)
+ IronRuby.Builtins.RubyClass def7 = DefineClass("Hpricot::DocType", typeof(IronRuby.Hpricot.DocumentType), 0x00000008, def2, LoadHpricot__DocType_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
+ new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.DocumentType>(IronRuby.Hpricot.DocumentType.Allocator)
);
- IronRuby.Builtins.RubyClass def8 = DefineClass("Hpricot::Elem", typeof(IronRuby.Hpricot.Hpricot.Element), 0x00000008, def2, LoadHpricot__Elem_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
- new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.Hpricot.Element>(IronRuby.Hpricot.Hpricot.Element.Allocator)
+ IronRuby.Builtins.RubyClass def8 = DefineClass("Hpricot::Elem", typeof(IronRuby.Hpricot.Element), 0x00000008, def2, LoadHpricot__Elem_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
+ new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.Element>(IronRuby.Hpricot.Element.Allocator)
);
- IronRuby.Builtins.RubyClass def9 = DefineClass("Hpricot::ETag", typeof(IronRuby.Hpricot.Hpricot.ETag), 0x00000008, def2, LoadHpricot__ETag_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
- new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.Hpricot.ETag>(IronRuby.Hpricot.Hpricot.ETag.Allocator)
+ IronRuby.Builtins.RubyClass def9 = DefineClass("Hpricot::ETag", typeof(IronRuby.Hpricot.ETag), 0x00000008, def2, LoadHpricot__ETag_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
+ new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.ETag>(IronRuby.Hpricot.ETag.Allocator)
);
- IronRuby.Builtins.RubyClass def11 = DefineClass("Hpricot::ProcIns", typeof(IronRuby.Hpricot.Hpricot.ProcedureInstruction), 0x00000008, def2, LoadHpricot__ProcIns_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
- new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.Hpricot.ProcedureInstruction>(IronRuby.Hpricot.Hpricot.ProcedureInstruction.Allocator)
+ IronRuby.Builtins.RubyClass def11 = DefineClass("Hpricot::ProcIns", typeof(IronRuby.Hpricot.ProcedureInstruction), 0x00000008, def2, LoadHpricot__ProcIns_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
+ new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.ProcedureInstruction>(IronRuby.Hpricot.ProcedureInstruction.Allocator)
);
- IronRuby.Builtins.RubyClass def12 = DefineClass("Hpricot::Text", typeof(IronRuby.Hpricot.Hpricot.Text), 0x00000008, def2, LoadHpricot__Text_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
- new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.Hpricot.Text>(IronRuby.Hpricot.Hpricot.Text.Allocator)
+ IronRuby.Builtins.RubyClass def12 = DefineClass("Hpricot::Text", typeof(IronRuby.Hpricot.Text), 0x00000008, def2, LoadHpricot__Text_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
+ new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.Text>(IronRuby.Hpricot.Text.Allocator)
);
- IronRuby.Builtins.RubyClass def13 = DefineClass("Hpricot::XMLDecl", typeof(IronRuby.Hpricot.Hpricot.XmlDeclaration), 0x00000008, def2, LoadHpricot__XMLDecl_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
- new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.Hpricot.XmlDeclaration>(IronRuby.Hpricot.Hpricot.XmlDeclaration.Allocator)
+ IronRuby.Builtins.RubyClass def13 = DefineClass("Hpricot::XMLDecl", typeof(IronRuby.Hpricot.XmlDeclaration), 0x00000008, def2, LoadHpricot__XMLDecl_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
+ new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.XmlDeclaration>(IronRuby.Hpricot.XmlDeclaration.Allocator)
);
- IronRuby.Builtins.RubyClass def3 = DefineClass("Hpricot::BogusETag", typeof(IronRuby.Hpricot.Hpricot.BogusETag), 0x00000008, def9, null, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
- new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.Hpricot.BogusETag>(IronRuby.Hpricot.Hpricot.BogusETag.Allocator)
+ IronRuby.Builtins.RubyClass def3 = DefineClass("Hpricot::BogusETag", typeof(IronRuby.Hpricot.BogusETag), 0x00000008, def9, null, null, null, IronRuby.Builtins.RubyModule.EmptyArray,
+ new Func<IronRuby.Builtins.RubyClass, IronRuby.Hpricot.BogusETag>(IronRuby.Hpricot.BogusETag.Allocator)
);
SetConstant(def1, "BaseEle", def2);
SetConstant(def1, "Doc", def6);
@@ -90,17 +90,17 @@ public sealed class HpricotLibraryInitializer : IronRuby.Builtins.LibraryInitial
private static void LoadHpricot__BaseEle_Instance(IronRuby.Builtins.RubyModule/*!*/ module) {
DefineLibraryMethod(module, "parent", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.BaseElement, System.Object>(IronRuby.Hpricot.Hpricot.BaseElement.GetParent)
+ new Func<IronRuby.Hpricot.BaseElement, System.Object>(IronRuby.Hpricot.BaseElement.GetParent)
);
DefineLibraryMethod(module, "parent=", 0x11,
0x00000000U,
- new Action<IronRuby.Hpricot.Hpricot.BaseElement, System.Object>(IronRuby.Hpricot.Hpricot.BaseElement.SetParent)
+ new Action<IronRuby.Hpricot.BaseElement, System.Object>(IronRuby.Hpricot.BaseElement.SetParent)
);
DefineLibraryMethod(module, "raw_string", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.BaseElement, IronRuby.Builtins.MutableString>(IronRuby.Hpricot.Hpricot.BaseElement.GetRawString)
+ new Func<IronRuby.Hpricot.BaseElement, IronRuby.Builtins.MutableString>(IronRuby.Hpricot.BaseElement.GetRawString)
);
}
@@ -108,12 +108,12 @@ public sealed class HpricotLibraryInitializer : IronRuby.Builtins.LibraryInitial
private static void LoadHpricot__CData_Instance(IronRuby.Builtins.RubyModule/*!*/ module) {
DefineLibraryMethod(module, "content", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.CData, IronRuby.Builtins.MutableString>(IronRuby.Hpricot.Hpricot.CData.GetContent)
+ new Func<IronRuby.Hpricot.CData, IronRuby.Builtins.MutableString>(IronRuby.Hpricot.CData.GetContent)
);
DefineLibraryMethod(module, "content=", 0x11,
0x00000000U,
- new Action<IronRuby.Hpricot.Hpricot.CData, System.Object>(IronRuby.Hpricot.Hpricot.CData.SetContent)
+ new Action<IronRuby.Hpricot.CData, System.Object>(IronRuby.Hpricot.CData.SetContent)
);
}
@@ -121,12 +121,12 @@ public sealed class HpricotLibraryInitializer : IronRuby.Builtins.LibraryInitial
private static void LoadHpricot__Comment_Instance(IronRuby.Builtins.RubyModule/*!*/ module) {
DefineLibraryMethod(module, "content", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.Comment, IronRuby.Builtins.MutableString>(IronRuby.Hpricot.Hpricot.Comment.GetContent)
+ new Func<IronRuby.Hpricot.Comment, IronRuby.Builtins.MutableString>(IronRuby.Hpricot.Comment.GetContent)
);
DefineLibraryMethod(module, "content=", 0x11,
0x00000000U,
- new Action<IronRuby.Hpricot.Hpricot.Comment, System.Object>(IronRuby.Hpricot.Hpricot.Comment.SetContent)
+ new Action<IronRuby.Hpricot.Comment, System.Object>(IronRuby.Hpricot.Comment.SetContent)
);
}
@@ -134,12 +134,12 @@ public sealed class HpricotLibraryInitializer : IronRuby.Builtins.LibraryInitial
private static void LoadHpricot__Doc_Instance(IronRuby.Builtins.RubyModule/*!*/ module) {
DefineLibraryMethod(module, "children", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.Document, System.Object>(IronRuby.Hpricot.Hpricot.Document.GetChildren)
+ new Func<IronRuby.Hpricot.Document, System.Object>(IronRuby.Hpricot.Document.GetChildren)
);
DefineLibraryMethod(module, "children=", 0x11,
0x00000000U,
- new Action<IronRuby.Hpricot.Hpricot.Document, System.Object>(IronRuby.Hpricot.Hpricot.Document.SetChildren)
+ new Action<IronRuby.Hpricot.Document, System.Object>(IronRuby.Hpricot.Document.SetChildren)
);
}
@@ -147,32 +147,32 @@ public sealed class HpricotLibraryInitializer : IronRuby.Builtins.LibraryInitial
private static void LoadHpricot__DocType_Instance(IronRuby.Builtins.RubyModule/*!*/ module) {
DefineLibraryMethod(module, "public_id", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.DocumentType, System.Object>(IronRuby.Hpricot.Hpricot.DocumentType.GetPublicId)
+ new Func<IronRuby.Hpricot.DocumentType, System.Object>(IronRuby.Hpricot.DocumentType.GetPublicId)
);
DefineLibraryMethod(module, "public_id=", 0x11,
0x00000000U,
- new Action<IronRuby.Runtime.RubyContext, IronRuby.Hpricot.Hpricot.DocumentType, System.Object>(IronRuby.Hpricot.Hpricot.DocumentType.SetPublicId)
+ new Action<IronRuby.Runtime.RubyContext, IronRuby.Hpricot.DocumentType, System.Object>(IronRuby.Hpricot.DocumentType.SetPublicId)
);
DefineLibraryMethod(module, "system_id", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.DocumentType, System.Object>(IronRuby.Hpricot.Hpricot.DocumentType.GetSystemId)
+ new Func<IronRuby.Hpricot.DocumentType, System.Object>(IronRuby.Hpricot.DocumentType.GetSystemId)
);
DefineLibraryMethod(module, "system_id=", 0x11,
0x00000000U,
- new Action<IronRuby.Runtime.RubyContext, IronRuby.Hpricot.Hpricot.DocumentType, System.Object>(IronRuby.Hpricot.Hpricot.DocumentType.SetSystemId)
+ new Action<IronRuby.Runtime.RubyContext, IronRuby.Hpricot.DocumentType, System.Object>(IronRuby.Hpricot.DocumentType.SetSystemId)
);
DefineLibraryMethod(module, "target", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.DocumentType, System.Object>(IronRuby.Hpricot.Hpricot.DocumentType.GetTarget)
+ new Func<IronRuby.Hpricot.DocumentType, System.Object>(IronRuby.Hpricot.DocumentType.GetTarget)
);
DefineLibraryMethod(module, "target=", 0x11,
0x00000000U,
- new Action<IronRuby.Hpricot.Hpricot.DocumentType, System.Object>(IronRuby.Hpricot.Hpricot.DocumentType.SetTarget)
+ new Action<IronRuby.Hpricot.DocumentType, System.Object>(IronRuby.Hpricot.DocumentType.SetTarget)
);
}
@@ -180,52 +180,52 @@ public sealed class HpricotLibraryInitializer : IronRuby.Builtins.LibraryInitial
private static void LoadHpricot__Elem_Instance(IronRuby.Builtins.RubyModule/*!*/ module) {
DefineLibraryMethod(module, "children", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.Element, System.Object>(IronRuby.Hpricot.Hpricot.Element.GetChildren)
+ new Func<IronRuby.Hpricot.Element, System.Object>(IronRuby.Hpricot.Element.GetChildren)
);
DefineLibraryMethod(module, "children=", 0x11,
0x00000000U,
- new Action<IronRuby.Hpricot.Hpricot.Element, System.Object>(IronRuby.Hpricot.Hpricot.Element.SetChildren)
+ new Action<IronRuby.Hpricot.Element, System.Object>(IronRuby.Hpricot.Element.SetChildren)
);
DefineLibraryMethod(module, "clear_raw", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.Element, System.Boolean>(IronRuby.Hpricot.Hpricot.Element.ClearRaw)
+ new Func<IronRuby.Hpricot.Element, System.Boolean>(IronRuby.Hpricot.Element.ClearRaw)
);
DefineLibraryMethod(module, "etag", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.Element, System.Object>(IronRuby.Hpricot.Hpricot.Element.GetEtag)
+ new Func<IronRuby.Hpricot.Element, System.Object>(IronRuby.Hpricot.Element.GetEtag)
);
DefineLibraryMethod(module, "etag=", 0x11,
0x00000000U,
- new Action<IronRuby.Hpricot.Hpricot.Element, System.Object>(IronRuby.Hpricot.Hpricot.Element.SetEtag)
+ new Action<IronRuby.Hpricot.Element, System.Object>(IronRuby.Hpricot.Element.SetEtag)
);
DefineLibraryMethod(module, "name", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.Element, System.Object>(IronRuby.Hpricot.Hpricot.Element.GetName)
+ new Func<IronRuby.Hpricot.Element, System.Object>(IronRuby.Hpricot.Element.GetName)
);
DefineLibraryMethod(module, "name=", 0x11,
0x00000000U,
- new Action<IronRuby.Hpricot.Hpricot.Element, System.Object>(IronRuby.Hpricot.Hpricot.Element.SetName)
+ new Action<IronRuby.Hpricot.Element, System.Object>(IronRuby.Hpricot.Element.SetName)
);
DefineLibraryMethod(module, "raw_attributes", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.Element, System.Object>(IronRuby.Hpricot.Hpricot.Element.GetRawAttributes)
+ new Func<IronRuby.Hpricot.Element, System.Object>(IronRuby.Hpricot.Element.GetRawAttributes)
);
DefineLibraryMethod(module, "raw_attributes=", 0x11,
0x00000000U,
- new Action<IronRuby.Hpricot.Hpricot.Element, System.Object>(IronRuby.Hpricot.Hpricot.Element.SetRawAttributes)
+ new Action<IronRuby.Hpricot.Element, System.Object>(IronRuby.Hpricot.Element.SetRawAttributes)
);
DefineLibraryMethod(module, "raw_string", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.Element, System.Object>(IronRuby.Hpricot.Hpricot.Element.GetRawString)
+ new Func<IronRuby.Hpricot.Element, System.Object>(IronRuby.Hpricot.Element.GetRawString)
);
}
@@ -233,22 +233,22 @@ public sealed class HpricotLibraryInitializer : IronRuby.Builtins.LibraryInitial
private static void LoadHpricot__ETag_Instance(IronRuby.Builtins.RubyModule/*!*/ module) {
DefineLibraryMethod(module, "clear_raw", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.ETag, System.Boolean>(IronRuby.Hpricot.Hpricot.ETag.ClearRaw)
+ new Func<IronRuby.Hpricot.ETag, System.Boolean>(IronRuby.Hpricot.ETag.ClearRaw)
);
DefineLibraryMethod(module, "name", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.ETag, System.Object>(IronRuby.Hpricot.Hpricot.ETag.GetName)
+ new Func<IronRuby.Hpricot.ETag, System.Object>(IronRuby.Hpricot.ETag.GetName)
);
DefineLibraryMethod(module, "name=", 0x11,
0x00000000U,
- new Action<IronRuby.Hpricot.Hpricot.ETag, System.Object>(IronRuby.Hpricot.Hpricot.ETag.SetName)
+ new Action<IronRuby.Hpricot.ETag, System.Object>(IronRuby.Hpricot.ETag.SetName)
);
DefineLibraryMethod(module, "raw_string", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.ETag, IronRuby.Builtins.MutableString>(IronRuby.Hpricot.Hpricot.ETag.GetRawString)
+ new Func<IronRuby.Hpricot.ETag, IronRuby.Builtins.MutableString>(IronRuby.Hpricot.ETag.GetRawString)
);
}
@@ -256,22 +256,22 @@ public sealed class HpricotLibraryInitializer : IronRuby.Builtins.LibraryInitial
private static void LoadHpricot__ProcIns_Instance(IronRuby.Builtins.RubyModule/*!*/ module) {
DefineLibraryMethod(module, "content", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.ProcedureInstruction, IronRuby.Builtins.MutableString>(IronRuby.Hpricot.Hpricot.ProcedureInstruction.GetContent)
+ new Func<IronRuby.Hpricot.ProcedureInstruction, IronRuby.Builtins.MutableString>(IronRuby.Hpricot.ProcedureInstruction.GetContent)
);
DefineLibraryMethod(module, "content=", 0x11,
0x00000000U,
- new Action<IronRuby.Hpricot.Hpricot.ProcedureInstruction, System.Object>(IronRuby.Hpricot.Hpricot.ProcedureInstruction.SetContent)
+ new Action<IronRuby.Hpricot.ProcedureInstruction, System.Object>(IronRuby.Hpricot.ProcedureInstruction.SetContent)
);
DefineLibraryMethod(module, "target", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.ProcedureInstruction, System.Object>(IronRuby.Hpricot.Hpricot.ProcedureInstruction.GetTarget)
+ new Func<IronRuby.Hpricot.ProcedureInstruction, System.Object>(IronRuby.Hpricot.ProcedureInstruction.GetTarget)
);
DefineLibraryMethod(module, "target=", 0x11,
0x00000000U,
- new Action<IronRuby.Hpricot.Hpricot.ProcedureInstruction, System.Object>(IronRuby.Hpricot.Hpricot.ProcedureInstruction.SetTarget)
+ new Action<IronRuby.Hpricot.ProcedureInstruction, System.Object>(IronRuby.Hpricot.ProcedureInstruction.SetTarget)
);
}
@@ -279,12 +279,12 @@ public sealed class HpricotLibraryInitializer : IronRuby.Builtins.LibraryInitial
private static void LoadHpricot__Text_Instance(IronRuby.Builtins.RubyModule/*!*/ module) {
DefineLibraryMethod(module, "content", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.Text, IronRuby.Builtins.MutableString>(IronRuby.Hpricot.Hpricot.Text.GetContent)
+ new Func<IronRuby.Hpricot.Text, IronRuby.Builtins.MutableString>(IronRuby.Hpricot.Text.GetContent)
);
DefineLibraryMethod(module, "content=", 0x11,
0x00000000U,
- new Action<IronRuby.Hpricot.Hpricot.Text, System.Object>(IronRuby.Hpricot.Hpricot.Text.SetContent)
+ new Action<IronRuby.Hpricot.Text, System.Object>(IronRuby.Hpricot.Text.SetContent)
);
}
@@ -292,32 +292,32 @@ public sealed class HpricotLibraryInitializer : IronRuby.Builtins.LibraryInitial
private static void LoadHpricot__XMLDecl_Instance(IronRuby.Builtins.RubyModule/*!*/ module) {
DefineLibraryMethod(module, "encoding", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.XmlDeclaration, System.Object>(IronRuby.Hpricot.Hpricot.XmlDeclaration.GetEncoding)
+ new Func<IronRuby.Hpricot.XmlDeclaration, System.Object>(IronRuby.Hpricot.XmlDeclaration.GetEncoding)
);
DefineLibraryMethod(module, "encoding=", 0x11,
0x00000000U,
- new Action<IronRuby.Runtime.RubyContext, IronRuby.Hpricot.Hpricot.XmlDeclaration, System.Object>(IronRuby.Hpricot.Hpricot.XmlDeclaration.SetEncoding)
+ new Action<IronRuby.Runtime.RubyContext, IronRuby.Hpricot.XmlDeclaration, System.Object>(IronRuby.Hpricot.XmlDeclaration.SetEncoding)
);
DefineLibraryMethod(module, "standalone", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.XmlDeclaration, System.Object>(IronRuby.Hpricot.Hpricot.XmlDeclaration.GetStandalone)
+ new Func<IronRuby.Hpricot.XmlDeclaration, System.Object>(IronRuby.Hpricot.XmlDeclaration.GetStandalone)
);
DefineLibraryMethod(module, "standalone=", 0x11,
0x00000000U,
- new Action<IronRuby.Runtime.RubyContext, IronRuby.Hpricot.Hpricot.XmlDeclaration, System.Object>(IronRuby.Hpricot.Hpricot.XmlDeclaration.SetStandalone)
+ new Action<IronRuby.Runtime.RubyContext, IronRuby.Hpricot.XmlDeclaration, System.Object>(IronRuby.Hpricot.XmlDeclaration.SetStandalone)
);
DefineLibraryMethod(module, "version", 0x11,
0x00000000U,
- new Func<IronRuby.Hpricot.Hpricot.XmlDeclaration, System.Object>(IronRuby.Hpricot.Hpricot.XmlDeclaration.GetVersion)
+ new Func<IronRuby.Hpricot.XmlDeclaration, System.Object>(IronRuby.Hpricot.XmlDeclaration.GetVersion)
);
DefineLibraryMethod(module, "version=", 0x11,
0x00000000U,
- new Action<IronRuby.Runtime.RubyContext, IronRuby.Hpricot.Hpricot.XmlDeclaration, System.Object>(IronRuby.Hpricot.Hpricot.XmlDeclaration.SetVersion)
+ new Action<IronRuby.Runtime.RubyContext, IronRuby.Hpricot.XmlDeclaration, System.Object>(IronRuby.Hpricot.XmlDeclaration.SetVersion)
);
}
@@ -325,10 +325,11 @@ public sealed class HpricotLibraryInitializer : IronRuby.Builtins.LibraryInitial
private static void LoadIronRuby__Builtins__MutableString_Instance(IronRuby.Builtins.RubyModule/*!*/ module) {
DefineLibraryMethod(module, "fast_xs", 0x11,
0x00000000U,
- new Func<IronRuby.Runtime.RubyContext, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>(IronRuby.FastXs.MutableStringOps.FastXs)
+ new Func<IronRuby.Runtime.RubyContext, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>(IronRuby.Hpricot.FastXs.MutableStringOps.FastXs)
);
}
}
-}
+}
+
View
17 src/IronRuby.Hpricot.csproj
@@ -60,12 +60,27 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Data\AttributeData.cs" />
+ <Compile Include="Data\ElementData.cs" />
+ <Compile Include="Elements\BaseEle.cs" />
+ <Compile Include="Elements\CData.cs" />
+ <Compile Include="Elements\Comment.cs" />
+ <Compile Include="Elements\BogusETag.cs" />
+ <Compile Include="Elements\IHpricotDataContainer.cs" />
+ <Compile Include="Elements\ProcedureInstruction.cs" />
+ <Compile Include="Elements\XmlDeclaration.cs" />
+ <Compile Include="Elements\Text.cs" />
+ <Compile Include="Elements\ETag.cs" />
+ <Compile Include="Elements\Element.cs" />
+ <Compile Include="Elements\DocumentType.cs" />
+ <Compile Include="Elements\Document.cs" />
<Compile Include="FastXs\BuiltinsOps.cs" />
<Compile Include="FastXs\EntityMap.cs" />
<Compile Include="FastXs\FastXs.cs" />
<Compile Include="Hpricot.cs" />
- <Compile Include="HpricotObjects.cs" />
+ <Compile Include="Data\BasicData.cs" />
<Compile Include="HpricotScanner.cs" />
+ <Compile Include="ParserException.cs" />
<Compile Include="ScannerState.cs" />
<Compile Include="Initializers.Generated.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
View
15 src/ParserException.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Text;
+using IronRuby.Builtins;
+using IronRuby.Runtime;
+using Microsoft.Scripting;
+using Microsoft.Scripting.Runtime;
+
+namespace IronRuby.Hpricot {
+ [RubyClass("ParseError", DefineIn = typeof(Hpricot))]
+ public class ParserException : SystemException {
+ public ParserException(String message) :
+ base(message) {
+ }
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.