Permalink
Browse files

Remove a bunch of useless #region blocks.

  • Loading branch information...
nrk committed Jul 17, 2010
1 parent 7c9cf61 commit 3c8b60dc032dbbcb8dc77e8d716f7b4ca5304bf2
Showing with 19 additions and 54 deletions.
  1. +19 −50 src/HpricotScanner.cs
  2. +0 −4 src/ScannerState.cs
View
@@ -14,7 +14,7 @@ namespace IronRuby.Hpricot {
using RubyIOReadCallSite = CallSite<Func<CallSite, Object, Object, Object>>;
public class HpricotScanner {
- #region fields - miscellaneous
+ #region fields
private static readonly String NO_WAY_SERIOUSLY = "*** This should not happen, please send a bug report with the HTML you're parsing to why@whytheluckystiff.net. So sorry!";
private static readonly RubyRegex _procInsParse = new RubyRegex(MutableString.CreateAscii(@"\A<\?(\S+)\s+(.+)"), RubyRegexOptions.Multiline);
@@ -26,10 +26,6 @@ public class HpricotScanner {
private ScannerState _state;
- #endregion
-
- #region fields - hpricot symbols
-
private RubySymbol sym_xmldecl;
private RubySymbol sym_doctype;
private RubySymbol sym_procins;
@@ -51,7 +47,7 @@ public class HpricotScanner {
#endregion
- #region fields - used by the ragel-generated code
+ #region fields used by the ragel-generated code
private const int DEFAULT_BUFFER_SIZE = 32768;
@@ -69,7 +65,7 @@ public class HpricotScanner {
#endregion
- #region fields - code generated by ragel
+ #region fields generated by ragel
static readonly sbyte[] _hpricot_scan_actions = new sbyte[] {
0, 1, 1, 1, 2, 1, 4, 1,
@@ -971,9 +967,6 @@ public class HpricotScanner {
#endregion
-
- #region constructors
-
public HpricotScanner(ConversionStorage<MutableString>/*!*/ toMutableString, BinaryOpStorage/*!*/ readIOStorage, BlockParam block) {
_context = toMutableString.Context;
_toMutableString = toMutableString;
@@ -983,6 +976,8 @@ public class HpricotScanner {
InitializeHpricotSymbols(_context);
}
+ #region InitializeHpricotSymbols
+
private void InitializeHpricotSymbols(RubyContext context) {
sym_xmldecl = context.CreateAsciiSymbol("xmldecl");
sym_doctype = context.CreateAsciiSymbol("doctype");
@@ -1006,16 +1001,23 @@ public class HpricotScanner {
#endregion
-
- #region static properties
-
public static RubyRegex ProcInsParse {
get { return _procInsParse; }
}
-
- #endregion
- #region mimic a few ruby core APIs
+ private static int GetBufferSize(RubyContext context) {
+ RubyModule hpricotModule;
+ if (!context.TryGetModule(typeof(Hpricot), out hpricotModule)) {
+ RubyExceptions.CreateNameError("Cannot find module Hpricot");
+ }
+
+ Object bufferSize;
+ if (hpricotModule.TryGetClassVariable("@@buffer_size", out bufferSize)) {
+ return (int)bufferSize;
+ }
+
+ return DEFAULT_BUFFER_SIZE;
+ }
private static Object rb_hash_lookup(Hash hash, Object key) {
Object value;
@@ -1027,10 +1029,6 @@ public class HpricotScanner {
return hash.TryGetValue(key, out value) ? value : hash.DefaultValue;
}
- #endregion
-
- #region miscellaneous methods
-
private static bool OPT(Hash opts, RubySymbol key) {
if (opts != null) {
Object value;
@@ -1094,25 +1092,6 @@ public class HpricotScanner {
he2.Parent = focus;
}
- private static int GetBufferSize(RubyContext context) {
- RubyModule hpricotModule;
- if (!context.TryGetModule(typeof(Hpricot), out hpricotModule)) {
- RubyExceptions.CreateNameError("Cannot find module Hpricot");
- }
-
- Object bufferSize;
- if (hpricotModule.TryGetClassVariable("@@buffer_size", out bufferSize)) {
- return (int)bufferSize;
- }
-
- return DEFAULT_BUFFER_SIZE;
- }
-
- #endregion
-
-
- #region methods for the parser logic
-
private void rb_yield_tokens(Object sym, Object tag, Object attr, Object raw, bool taint) {
if (sym_text.Equals(sym)) {
raw = tag;
@@ -1323,10 +1302,6 @@ public class HpricotScanner {
}
}
- #endregion
-
- #region parser callbacks
-
private void ELE(Object N) {
if (te > ts || text) {
int raw = -1;
@@ -1468,11 +1443,7 @@ public class HpricotScanner {
CAT(tag, p - T + 1);
ELE(N);
}
-
- #endregion
-
- #region main parser entry point
-
+
public Object Scan(Object/*!*/ source, Hash/*!*/ options, Hash/*!*/ elementContent) {
tag = new Object[1];
akey = new Object[1];
@@ -1855,7 +1826,5 @@ public class HpricotScanner {
return 0;
}
-
- #endregion
}
}
View
@@ -4,8 +4,6 @@
namespace IronRuby.Hpricot {
public class ScannerState {
- #region fields
-
private RubyContext _context;
private IHpricotDataContainer _doc;
private IHpricotDataContainer _focus;
@@ -15,8 +13,6 @@ public class ScannerState {
private bool _strict;
private bool _fixup;
- #endregion
-
public ScannerState(RubyContext context) {
_context = context;
}

0 comments on commit 3c8b60d

Please sign in to comment.