diff --git a/Cottle.Demo/src/DemoForm.cs b/Cottle.Demo/src/DemoForm.cs index af011bb5..9f890695 100644 --- a/Cottle.Demo/src/DemoForm.cs +++ b/Cottle.Demo/src/DemoForm.cs @@ -18,18 +18,18 @@ public partial class DemoForm : Form { #region Constants - private const string AUTOLOAD = "autoload.ctv"; + private const string AUTOLOAD = "autoload.ctv"; #endregion #region Attributes / Instance - private SettingForm.Parameters parameters = new SettingForm.Parameters + private SettingForm.Parameters parameters = new SettingForm.Parameters { - BlockBegin = DefaultSetting.Instance.BlockBegin, - BlockContinue = DefaultSetting.Instance.BlockContinue, - BlockEnd = DefaultSetting.Instance.BlockEnd, - TrimmerIndex = TrimmerCollection.DEFAULT_INDEX + BlockBegin = DefaultSetting.Instance.BlockBegin, + BlockContinue = DefaultSetting.Instance.BlockContinue, + BlockEnd = DefaultSetting.Instance.BlockEnd, + TrimmerIndex = TrimmerCollection.DEFAULT_INDEX }; #endregion @@ -52,8 +52,8 @@ public DemoForm () private void buttonClean_Click (object sender, EventArgs e) { - SimpleDocument document; - ISetting setting; + SimpleDocument document; + ISetting setting; setting = this.SettingCreate (); @@ -71,9 +71,9 @@ private void buttonClean_Click (object sender, EventArgs e) private void buttonEvaluate_Click (object sender, EventArgs e) { - SimpleDocument document; - ISetting setting; - IStore store; + SimpleDocument document; + ISetting setting; + IStore store; setting = this.SettingCreate (); @@ -98,7 +98,7 @@ private void buttonEvaluate_Click (object sender, EventArgs e) private void toolStripMenuItemSetting_Click (object sender, EventArgs e) { - Form form; + Form form; form = new SettingForm ((p) => this.parameters = p, this.parameters); form.ShowDialog (this); @@ -106,7 +106,7 @@ private void toolStripMenuItemSetting_Click (object sender, EventArgs e) private void toolStripMenuItemFileLoad_Click (object sender, EventArgs e) { - OpenFileDialog dialog = new OpenFileDialog (); + OpenFileDialog dialog = new OpenFileDialog (); dialog.Filter = "Cottle values file (*.ctv)|*.ctv|Any file (*.*)|*.*"; @@ -116,7 +116,7 @@ private void toolStripMenuItemFileLoad_Click (object sender, EventArgs e) private void toolStripMenuItemFileSave_Click (object sender, EventArgs e) { - SaveFileDialog dialog = new SaveFileDialog (); + SaveFileDialog dialog = new SaveFileDialog (); dialog.Filter = "Cottle values file (*.ctv)|*.ctv|Any file (*.*)|*.*"; @@ -126,11 +126,11 @@ private void toolStripMenuItemFileSave_Click (object sender, EventArgs e) private void toolStripMenuItemMoveDown_Click (object sender, EventArgs e) { - TreeNodeCollection collection; - int index1; - int index2; - TreeNode node1 = this.contextMenuStripTree.Tag as TreeNode; - TreeNode node2; + TreeNodeCollection collection; + int index1; + int index2; + TreeNode node1 = this.contextMenuStripTree.Tag as TreeNode; + TreeNode node2; if (node1 != null && node1.Parent != null && node1.NextNode != null) { @@ -151,11 +151,11 @@ private void toolStripMenuItemMoveDown_Click (object sender, EventArgs e) private void toolStripMenuItemMoveUp_Click (object sender, EventArgs e) { - TreeNodeCollection collection; - int index1; - int index2; - TreeNode node1 = this.contextMenuStripTree.Tag as TreeNode; - TreeNode node2; + TreeNodeCollection collection; + int index1; + int index2; + TreeNode node1 = this.contextMenuStripTree.Tag as TreeNode; + TreeNode node2; if (node1 != null && node1.Parent != null && node1.PrevNode != null) { @@ -176,7 +176,7 @@ private void toolStripMenuItemMoveUp_Click (object sender, EventArgs e) private void toolStripMenuItemNodeClone_Click (object sender, EventArgs e) { - TreeNode node = this.contextMenuStripTree.Tag as TreeNode; + TreeNode node = this.contextMenuStripTree.Tag as TreeNode; if (node != null && node.Parent != null) node.Parent.Nodes.Insert (node.Index + 1, this.NodeClone (node)); @@ -184,14 +184,14 @@ private void toolStripMenuItemNodeClone_Click (object sender, EventArgs e) private void toolStripMenuItemNodeCreate_Click (object sender, EventArgs e) { - Form form; - TreeNode node = this.contextMenuStripTree.Tag as TreeNode; + Form form; + TreeNode node = this.contextMenuStripTree.Tag as TreeNode; if (node != null) { form = new NodeForm (null, delegate (string key, Value value) { - TreeNode child = this.NodeCreate (key, value); + TreeNode child = this.NodeCreate (key, value); node.Nodes.Add (child); node.Expand (); @@ -203,7 +203,7 @@ private void toolStripMenuItemNodeCreate_Click (object sender, EventArgs e) private void toolStripMenuItemNodeDelete_Click (object sender, EventArgs e) { - TreeNode node = this.contextMenuStripTree.Tag as TreeNode; + TreeNode node = this.contextMenuStripTree.Tag as TreeNode; if (node != null && node.Parent != null) node.Remove (); @@ -211,8 +211,8 @@ private void toolStripMenuItemNodeDelete_Click (object sender, EventArgs e) private void toolStripMenuItemNodeUpdate_Click (object sender, EventArgs e) { - Form form; - TreeNode node = this.contextMenuStripTree.Tag as TreeNode; + Form form; + TreeNode node = this.contextMenuStripTree.Tag as TreeNode; if (node != null) { @@ -233,8 +233,8 @@ private void toolStripMenuItemTreeExpand_Click (object sender, EventArgs e) private void contextMenuStripTree_Opening (object sender, CancelEventArgs e) { - TreeNode node = this.treeViewValue.SelectedNode; - NodeData data = node != null ? node.Tag as NodeData : null; + TreeNode node = this.treeViewValue.SelectedNode; + NodeData data = node != null ? node.Tag as NodeData : null; this.toolStripMenuItemNodeClone.Enabled = node != null && node.Parent != null; this.toolStripMenuItemNodeCreate.Enabled = node != null && node.Parent == null || (data != null && data.Value.Type == ValueContent.Map); @@ -252,7 +252,7 @@ private void contextMenuStripTree_Opening (object sender, CancelEventArgs e) private void DisplayError (ParseException exception) { - int index; + int index; index = this.textBoxInput.GetFirstCharIndexFromLine (exception.Line - 1) + exception.Column; @@ -272,7 +272,7 @@ private void DisplayText (string text) private void NodeAssign (TreeNode node, string key, Value value) { - NodeData data = new NodeData (key, value); + NodeData data = new NodeData (key, value); node.ImageIndex = data.ImageIndex; node.SelectedImageIndex = data.ImageIndex; @@ -294,8 +294,8 @@ private void NodeAssign (TreeNode node, string key, Value value) private TreeNode NodeClone (TreeNode node) { - NodeData data = node.Tag as NodeData; - TreeNode copy; + NodeData data = node.Tag as NodeData; + TreeNode copy; if (data != null) { @@ -317,9 +317,9 @@ private TreeNode NodeClone (TreeNode node) private TreeNode NodeCreate (string key, Value value) { - TreeNode node; - TreeNode[] range; - int i; + TreeNode node; + TreeNode[] range; + int i; node = new TreeNode (); @@ -362,7 +362,7 @@ private TreeNode NodeCreate (string key, Value value) private ISetting SettingCreate () { - CustomSetting setting; + CustomSetting setting; setting = new CustomSetting (); setting.BlockBegin = this.parameters.BlockBegin; @@ -375,9 +375,9 @@ private ISetting SettingCreate () private void StateLoad (string path, bool dialog) { - TreeNode root; - Dictionary values; - int version; + TreeNode root; + Dictionary values; + int version; if (this.treeViewValue.Nodes.Count < 1) return; @@ -407,10 +407,10 @@ private void StateLoad (string path, bool dialog) this.parameters = new SettingForm.Parameters { - BlockBegin = reader.ReadString (), - BlockContinue = reader.ReadString (), - BlockEnd = reader.ReadString (), - TrimmerIndex = version > 1 ? reader.ReadInt32 () : TrimmerCollection.DEFAULT_INDEX + BlockBegin = reader.ReadString (), + BlockContinue = reader.ReadString (), + BlockEnd = reader.ReadString (), + TrimmerIndex = version > 1 ? reader.ReadInt32 () : TrimmerCollection.DEFAULT_INDEX }; this.textBoxInput.Text = reader.ReadString (); @@ -429,7 +429,7 @@ private void StateLoad (string path, bool dialog) private void StateSave (string path) { - Dictionary values = new Dictionary (); + Dictionary values = new Dictionary (); foreach (TreeNode root in this.treeViewValue.Nodes) { @@ -462,8 +462,8 @@ private void StateSave (string path) private List> ValuesBuild (TreeNodeCollection nodes) { - List> collection = new List> (nodes.Count); - NodeData data; + List> collection = new List> (nodes.Count); + NodeData data; foreach (TreeNode node in nodes) { diff --git a/Cottle.Demo/src/NodeData.cs b/Cottle.Demo/src/NodeData.cs index 7e155399..0ee3a495 100644 --- a/Cottle.Demo/src/NodeData.cs +++ b/Cottle.Demo/src/NodeData.cs @@ -6,7 +6,7 @@ public class NodeData { #region Properties - public int ImageIndex + public int ImageIndex { get { @@ -14,7 +14,7 @@ public int ImageIndex } } - public string Key + public string Key { get { @@ -22,7 +22,7 @@ public string Key } } - public Value Value + public Value Value { get { @@ -42,7 +42,7 @@ public Value Value #region Constructors - public NodeData (string key, Value value) + public NodeData (string key, Value value) { this.key = key; this.value = value; diff --git a/Cottle.Demo/src/NodeForm.cs b/Cottle.Demo/src/NodeForm.cs index ea41208a..2ee8e318 100644 --- a/Cottle.Demo/src/NodeForm.cs +++ b/Cottle.Demo/src/NodeForm.cs @@ -10,13 +10,13 @@ public partial class NodeForm : Form { #region Attributes - private NodeAssignDelegate assign; + private NodeAssignDelegate assign; #endregion #region Constructors - public NodeForm (NodeData data, NodeAssignDelegate assign) + public NodeForm (NodeData data, NodeAssignDelegate assign) { this.assign = assign; @@ -65,9 +65,9 @@ public NodeForm (NodeData data, NodeAssignDelegate assign) #region Methods / Listeners - private void buttonAccept_Click (object sender, EventArgs e) + private void buttonAccept_Click (object sender, EventArgs e) { - string key = this.textBoxName.Text; + string key = this.textBoxName.Text; decimal number; if (string.IsNullOrEmpty (key)) @@ -115,12 +115,12 @@ private void buttonAccept_Click (object sender, EventArgs e) this.Close (); } - private void buttonCancel_Click (object sender, EventArgs e) + private void buttonCancel_Click (object sender, EventArgs e) { this.Close (); } - private void radioButtonValue_CheckedChanged (object sender, EventArgs e) + private void radioButtonValue_CheckedChanged (object sender, EventArgs e) { this.ApplyType (); } @@ -129,9 +129,9 @@ private void radioButtonValue_CheckedChanged (object sender, EventArgs e) #region Methods / Private - private ValueContent ApplyType () + private ValueContent ApplyType () { - ValueContent type; + ValueContent type; if (this.radioButtonValueBoolean.Checked) type = ValueContent.Boolean; @@ -155,7 +155,7 @@ private ValueContent ApplyType () #region Types - public delegate void NodeAssignDelegate (string key, Value value); + public delegate void NodeAssignDelegate (string key, Value value); #endregion } diff --git a/Cottle.Demo/src/SettingForm.cs b/Cottle.Demo/src/SettingForm.cs index bf5fc54d..c1011816 100644 --- a/Cottle.Demo/src/SettingForm.cs +++ b/Cottle.Demo/src/SettingForm.cs @@ -13,7 +13,7 @@ public partial class SettingForm : Form #region Constructors - public SettingForm (ApplyCallback apply, Parameters parameters) + public SettingForm (ApplyCallback apply, Parameters parameters) { this.apply = apply; @@ -32,16 +32,16 @@ public SettingForm (ApplyCallback apply, Parameters parameters) #region Methods - private void buttonAccept_Click (object sender, EventArgs e) + private void buttonAccept_Click (object sender, EventArgs e) { - Parameters parameters; + Parameters parameters; parameters = new Parameters { - BlockBegin = this.textBoxBlockBegin.Text, - BlockContinue = this.textBoxBlockContinue.Text, - BlockEnd = this.textBoxBlockEnd.Text, - TrimmerIndex = this.comboBoxTrimmer.SelectedIndex + BlockBegin = this.textBoxBlockBegin.Text, + BlockContinue = this.textBoxBlockContinue.Text, + BlockEnd = this.textBoxBlockEnd.Text, + TrimmerIndex = this.comboBoxTrimmer.SelectedIndex }; this.apply (parameters); @@ -49,7 +49,7 @@ private void buttonAccept_Click (object sender, EventArgs e) this.Close (); } - private void buttonCancel_Click (object sender, EventArgs e) + private void buttonCancel_Click (object sender, EventArgs e) { this.Close (); } @@ -58,14 +58,14 @@ private void buttonCancel_Click (object sender, EventArgs e) #region Types - public delegate void ApplyCallback (Parameters config); + public delegate void ApplyCallback (Parameters config); - public struct Parameters + public struct Parameters { - public string BlockBegin; - public string BlockContinue; - public string BlockEnd; - public int TrimmerIndex; + public string BlockBegin; + public string BlockContinue; + public string BlockEnd; + public int TrimmerIndex; } #endregion diff --git a/Cottle.Demo/src/TrimmerCollection.cs b/Cottle.Demo/src/TrimmerCollection.cs index 6fffda77..b261d92d 100644 --- a/Cottle.Demo/src/TrimmerCollection.cs +++ b/Cottle.Demo/src/TrimmerCollection.cs @@ -9,13 +9,13 @@ public static class TrimmerCollection { #region Constants - public const int DEFAULT_INDEX = 2; + public const int DEFAULT_INDEX = 2; #endregion #region Properties - public static IEnumerable TrimmerNames + public static IEnumerable TrimmerNames { get { @@ -28,7 +28,7 @@ public static IEnumerable TrimmerNames #region Attributes - private static readonly KeyValuePair[] trimmers = new KeyValuePair[] + private static readonly KeyValuePair[] trimmers = new KeyValuePair[] { new KeyValuePair ("Blank characters", BuiltinTrimmers.LeadAndTrailBlankCharacters), new KeyValuePair ("First and last lines", BuiltinTrimmers.FirstAndLastBlankLines), @@ -40,7 +40,7 @@ public static IEnumerable TrimmerNames #region Methods - public static Trimmer GetTrimmer (int index) + public static Trimmer GetTrimmer (int index) { if (index >= 0 && index < TrimmerCollection.trimmers.Length) return TrimmerCollection.trimmers[index].Value; diff --git a/Cottle.Demo/src/ValueAccessor.cs b/Cottle.Demo/src/ValueAccessor.cs index 49cc20dc..caa404e6 100644 --- a/Cottle.Demo/src/ValueAccessor.cs +++ b/Cottle.Demo/src/ValueAccessor.cs @@ -10,11 +10,11 @@ public static class ValueAccessor { #region Methods / Public - public static bool Load (BinaryReader reader, IDictionary values) + public static bool Load (BinaryReader reader, IDictionary values) { - int count; - string key; - Value value; + int count; + string key; + Value value; for (count = reader.ReadInt32 (); count-- > 0; ) { @@ -29,7 +29,7 @@ public static bool Load (BinaryReader reader, IDictionary values) return true; } - public static void Save (BinaryWriter writer, IDictionary values) + public static void Save (BinaryWriter writer, IDictionary values) { writer.Write (values.Count); @@ -47,11 +47,11 @@ public static void Save (BinaryWriter writer, IDictionary values) private static bool Load (BinaryReader reader, out Value value) { - List> array; - Value arrayKey; - Value arrayValue; - int count; - ValueContent type; + List> array; + Value arrayKey; + Value arrayValue; + int count; + ValueContent type; type = (ValueContent)reader.ReadInt32 (); diff --git a/Cottle.Test/src/Builtins/BuiltinFunctionsTester.cs b/Cottle.Test/src/Builtins/BuiltinFunctionsTester.cs index 36f05183..e9e28f49 100644 --- a/Cottle.Test/src/Builtins/BuiltinFunctionsTester.cs +++ b/Cottle.Test/src/Builtins/BuiltinFunctionsTester.cs @@ -112,16 +112,16 @@ public void FunctionType (string template, string expected) private static void AssertEqual (string expression, string expected) { - IDocument document = new SimpleDocument ("{eq(" + expression + ", " + expected + ")}"); - IStore store = new BuiltinStore (); + IDocument document = new SimpleDocument ("{eq(" + expression + ", " + expected + ")}"); + IStore store = new BuiltinStore (); Assert.AreEqual ("true", document.Render (store), "'{0}' doesn't evaluate to '{1}'", expression, expected); } private static void AssertPrint (string expression, string expected) { - IDocument document = new SimpleDocument ("{echo " + expression + "}"); - IStore store = new BuiltinStore (); + IDocument document = new SimpleDocument ("{echo " + expression + "}"); + IStore store = new BuiltinStore (); Assert.AreEqual (expected, document.Render (store), "'{0}' doesn't render to '{1}'", expression, expected); } diff --git a/Cottle.Test/src/Builtins/BuiltinOperatorsTester.cs b/Cottle.Test/src/Builtins/BuiltinOperatorsTester.cs index b46c5a35..29cdc819 100644 --- a/Cottle.Test/src/Builtins/BuiltinOperatorsTester.cs +++ b/Cottle.Test/src/Builtins/BuiltinOperatorsTester.cs @@ -138,8 +138,8 @@ public void Precedence (string expression, string expected) private static void AssertResult (string expression, bool expected) { - IDocument document = new SimpleDocument ("{" + (expected ? "" : "!") + "(" + expression + ")}"); - IStore store = new BuiltinStore (); + IDocument document = new SimpleDocument ("{" + (expected ? "" : "!") + "(" + expression + ")}"); + IStore store = new BuiltinStore (); Assert.AreEqual ("true", document.Render (store)); } diff --git a/Cottle.Test/src/DocumentTester.cs b/Cottle.Test/src/DocumentTester.cs index 294020d7..6ad7c68a 100644 --- a/Cottle.Test/src/DocumentTester.cs +++ b/Cottle.Test/src/DocumentTester.cs @@ -15,7 +15,7 @@ namespace Cottle.Test [TestFixture] public class DocumentTester { - public static readonly Func[] constructors = + public static readonly Func[] constructors = { (source, setting) => new DynamicDocument (source, setting), (source, setting) => new SimpleDocument (source, setting) @@ -158,7 +158,7 @@ public void CommandWhile (string init, string condition, string body, string exp [TestCase ("{\"xxxy\"}", 'x', "xy")] public void EscapeCommand (string input, char escape, string expected) { - CustomSetting setting; + CustomSetting setting; setting = new CustomSetting (); setting.Escape = escape; @@ -173,7 +173,7 @@ public void EscapeCommand (string input, char escape, string expected) [TestCase ("--", '-', "-")] public void EscapeText (string input, char escape, string expected) { - CustomSetting setting; + CustomSetting setting; setting = new CustomSetting (); setting.Escape = escape; @@ -197,7 +197,7 @@ public void EscapeText (string input, char escape, string expected) [TestCase ("ddd", "")] public void ExpressionAccess (string access, string expected) { - Action populate; + Action populate; populate = (scope) => { @@ -235,14 +235,14 @@ public void ExpressionConstant (string constant, string expected) [TestCase ("xyz", "17")] public void ExpressionInvoke (string symbol, string expected) { - Action populate; + Action populate; populate = (scope) => { scope[symbol] = expected; scope["f"] = new NativeFunction ((a, s, o) => { - string value; + string value; value = s[a[0]].AsString; @@ -279,8 +279,8 @@ public void ExpressionMap (string expression, string expected) [TestCase ("x", "missing", "x")] public void ExpressionSymbol (string set, string get, string value) { - string expected; - Action populate; + string expected; + Action populate; expected = (set == get ? (Value)value : VoidValue.Instance).ToString (); populate = (scope) => @@ -294,7 +294,7 @@ public void ExpressionSymbol (string set, string get, string value) [Test] public void OptimizeConstantMap () { - CustomSetting setting; + CustomSetting setting; setting = new CustomSetting (); setting.Optimize = false; @@ -309,7 +309,7 @@ public void OptimizeConstantMap () [Test] public void OptimizeReturn () { - CustomSetting setting; + CustomSetting setting; setting = new CustomSetting (); setting.Optimize = false; @@ -397,7 +397,7 @@ public void SamplePowerOfTwo (string value, string expected) [Test] public void TestAmbiguous () { - CustomSetting setting; + CustomSetting setting; setting = new CustomSetting (); setting.BlockBegin = "<|"; @@ -436,7 +436,7 @@ public void TextLiteral (string expected) [TestCase ("df98gd76dfg5df4g321gh0", "[^0-9]", "", "9876543210")] public void TextTrim (string value, string pattern, string replacement, string expected) { - CustomSetting setting; + CustomSetting setting; setting = new CustomSetting (); setting.Trimmer = (s) => Regex.Replace (s, pattern, replacement); @@ -446,8 +446,8 @@ public void TextTrim (string value, string pattern, string replacement, string e private void AssertRender (string source, string expected, ISetting setting, Action populate, Action listen) { - IDocument document; - IStore store; + IDocument document; + IStore store; foreach (Func constructor in DocumentTester.constructors) { @@ -470,9 +470,9 @@ private void AssertRender (string source, string expected) private void AssertReturn (string source, string expected, ISetting setting, Action populate, Action listen) { - IDocument document; - IStore store; - Value value; + IDocument document; + IStore store; + Value value; foreach (Func constructor in DocumentTester.constructors) { @@ -499,7 +499,7 @@ private Action PopulateScope (params string[] names) { return (s) => { - IFunction function; + IFunction function; foreach (string name in names) { diff --git a/Cottle/src/Builtins/BuiltinFunctions.cs b/Cottle/src/Builtins/BuiltinFunctions.cs index 2d8325ae..1e7feeb9 100644 --- a/Cottle/src/Builtins/BuiltinFunctions.cs +++ b/Cottle/src/Builtins/BuiltinFunctions.cs @@ -13,7 +13,7 @@ public static class BuiltinFunctions { #region Properties - public static IEnumerable> Instances + public static IEnumerable> Instances { get { @@ -25,15 +25,15 @@ public static class BuiltinFunctions #region Attributes - private static readonly DateTime epoch = new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + private static readonly DateTime epoch = new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); - private static readonly IFunction functionAbsolute = new NativeFunction ((v) => Math.Abs (v[0].AsNumber), 1); + private static readonly IFunction functionAbsolute = new NativeFunction ((v) => Math.Abs (v[0].AsNumber), 1); - private static readonly IFunction functionCall = new NativeFunction ((values, scope, output) => + private static readonly IFunction functionCall = new NativeFunction ((values, scope, output) => { - Value[] arguments; - IFunction function; - int i; + Value[] arguments; + IFunction function; + int i; function = values[0].AsFunction; @@ -49,7 +49,7 @@ public static class BuiltinFunctions return function.Execute (arguments, scope, output); }, 2); - private static readonly IFunction functionCast = new NativeFunction ((values) => + private static readonly IFunction functionCast = new NativeFunction ((values) => { switch (values[1].AsString) { @@ -70,10 +70,10 @@ public static class BuiltinFunctions } }, 2); - private static readonly IFunction functionCat = new NativeFunction ((values) => + private static readonly IFunction functionCat = new NativeFunction ((values) => { - StringBuilder builder; - List list; + StringBuilder builder; + List list; if (values[0].Type == ValueContent.Map) { @@ -98,9 +98,9 @@ public static class BuiltinFunctions } }, 1, -1); - private static readonly IFunction functionCeiling = new NativeFunction ((v) => Math.Ceiling (v[0].AsNumber), 1); + private static readonly IFunction functionCeiling = new NativeFunction ((v) => Math.Ceiling (v[0].AsNumber), 1); - private static readonly IFunction functionChar = new NativeFunction ((values) => + private static readonly IFunction functionChar = new NativeFunction ((values) => { try { @@ -112,14 +112,14 @@ public static class BuiltinFunctions } }, 1); - private static readonly IFunction functionCompare = new NativeFunction ((v) => v[0].CompareTo (v[1]), 2); + private static readonly IFunction functionCompare = new NativeFunction ((v) => v[0].CompareTo (v[1]), 2); - private static readonly IFunction functionCosine = new NativeFunction ((v) => Math.Cos ((double)v[0].AsNumber), 1); + private static readonly IFunction functionCosine = new NativeFunction ((v) => Math.Cos ((double)v[0].AsNumber), 1); - private static readonly IFunction functionCross = new NativeFunction ((values) => + private static readonly IFunction functionCross = new NativeFunction ((values) => { - bool insert; - List> pairs; + bool insert; + List> pairs; pairs = new List> (); @@ -144,14 +144,14 @@ public static class BuiltinFunctions return pairs; }, 1, -1); - private static readonly IFunction functionDefault = new NativeFunction ((v) => v[0].AsBoolean ? v[0] : v[1], 2); + private static readonly IFunction functionDefault = new NativeFunction ((v) => v[0].AsBoolean ? v[0] : v[1], 2); - private static readonly IFunction functionDefined = new NativeFunction ((values) => values[0].Type != ValueContent.Void, 1); + private static readonly IFunction functionDefined = new NativeFunction ((values) => values[0].Type != ValueContent.Void, 1); - private static readonly IFunction functionExcept = new NativeFunction ((values) => + private static readonly IFunction functionExcept = new NativeFunction ((values) => { - bool insert; - List> pairs; + bool insert; + List> pairs; pairs = new List> (); @@ -176,11 +176,11 @@ public static class BuiltinFunctions return pairs; }, 1, -1); - private static readonly IFunction functionFilter = new NativeFunction ((values, scope, output) => + private static readonly IFunction functionFilter = new NativeFunction ((values, scope, output) => { - List arguments; - IFunction callback; - List> result; + List arguments; + IFunction callback; + List> result; callback = values[1].AsFunction; @@ -205,12 +205,12 @@ public static class BuiltinFunctions return result; }); - private static readonly IFunction functionFind = new NativeFunction ((values) => + private static readonly IFunction functionFind = new NativeFunction ((values) => { - int index; - int offset; - Value search; - Value source; + int index; + int offset; + Value search; + Value source; offset = values.Count > 2 ? (int)values[2].AsNumber : 0; search = values[1]; @@ -232,10 +232,10 @@ public static class BuiltinFunctions return source.AsString.IndexOf (search.AsString, offset, StringComparison.Ordinal); }, 2, 3); - private static readonly IFunction functionFlip = new NativeFunction ((values) => + private static readonly IFunction functionFlip = new NativeFunction ((values) => { - KeyValuePair[] flip; - int i; + KeyValuePair[] flip; + int i; flip = new KeyValuePair[values[0].Fields.Count]; i = 0; @@ -246,14 +246,14 @@ public static class BuiltinFunctions return flip; }, 1); - private static readonly IFunction functionFloor = new NativeFunction ((v) => Math.Floor (v[0].AsNumber), 1); + private static readonly IFunction functionFloor = new NativeFunction ((v) => Math.Floor (v[0].AsNumber), 1); - private static readonly IFunction functionFormat = new NativeFunction ((values) => + private static readonly IFunction functionFormat = new NativeFunction ((values) => { - CultureInfo culture; - string format; - int index; - object target; + CultureInfo culture; + string format; + int index; + object target; #if CORECLR culture = values.Count > 2 ? new CultureInfo (values[2].AsString) : CultureInfo.CurrentCulture; @@ -329,9 +329,9 @@ public static class BuiltinFunctions return string.Format (culture, "{0:" + format.Substring (index + 1) + "}", target); }, 2, 3); - private static readonly IFunction functionHas = new NativeFunction ((values) => + private static readonly IFunction functionHas = new NativeFunction ((values) => { - Value source; + Value source; source = values[0]; @@ -342,11 +342,11 @@ public static class BuiltinFunctions return true; }, 1, -1); - private static readonly IFunction functionJoin = new NativeFunction ((values) => + private static readonly IFunction functionJoin = new NativeFunction ((values) => { - StringBuilder builder; - bool first; - string split; + StringBuilder builder; + bool first; + string split; if (values.Count > 1) split = values[1].AsString; @@ -369,7 +369,7 @@ public static class BuiltinFunctions return builder.ToString (); }, 1, 2); - private static readonly IFunction functionLength = new NativeFunction ((values) => + private static readonly IFunction functionLength = new NativeFunction ((values) => { if (values[0].Type == ValueContent.Map) return values[0].Fields.Count; @@ -377,14 +377,14 @@ public static class BuiltinFunctions return values[0].AsString.Length; }, 1); - private static readonly IFunction functionLowerCase = new NativeFunction ((v) => v[0].AsString.ToLowerInvariant (), 1); + private static readonly IFunction functionLowerCase = new NativeFunction ((v) => v[0].AsString.ToLowerInvariant (), 1); - private static readonly IFunction functionMap = new NativeFunction ((values, scope, output) => + private static readonly IFunction functionMap = new NativeFunction ((values, scope, output) => { - List arguments; - IFunction callback; - KeyValuePair[] result; - int i; + List arguments; + IFunction callback; + KeyValuePair[] result; + int i; callback = values[1].AsFunction; @@ -409,10 +409,10 @@ public static class BuiltinFunctions return result; }, 2, -1); - private static readonly IFunction functionMatch = new NativeFunction ((values) => + private static readonly IFunction functionMatch = new NativeFunction ((values) => { - List groups; - Match match; + List groups; + Match match; match = Regex.Match (values[0].AsString, values[1].AsString); @@ -427,7 +427,7 @@ public static class BuiltinFunctions return groups; }, 2, 3); - private static readonly IFunction functionMaximum = new NativeFunction ((values) => + private static readonly IFunction functionMaximum = new NativeFunction ((values) => { decimal max; @@ -439,7 +439,7 @@ public static class BuiltinFunctions return max; }, 1, -1); - private static readonly IFunction functionMinimum = new NativeFunction ((values) => + private static readonly IFunction functionMinimum = new NativeFunction ((values) => { decimal min; @@ -451,18 +451,18 @@ public static class BuiltinFunctions return min; }, 1, -1); - private static readonly IFunction functionOrd = new NativeFunction ((values) => + private static readonly IFunction functionOrd = new NativeFunction ((values) => { - string str; + string str; str = values[0].AsString; return str.Length > 0 ? char.ConvertToUtf32 (str, 0) : 0; }, 1); - private static readonly IFunction functionPower = new NativeFunction ((v) => Math.Pow ((double)v[0].AsNumber, (double)v[1].AsNumber), 2); + private static readonly IFunction functionPower = new NativeFunction ((v) => Math.Pow ((double)v[0].AsNumber, (double)v[1].AsNumber), 2); - private static readonly IFunction functionRandom = new NativeFunction ((values) => + private static readonly IFunction functionRandom = new NativeFunction ((values) => { lock (BuiltinFunctions.random) { @@ -480,12 +480,12 @@ public static class BuiltinFunctions } }, 0, 2); - private static readonly IFunction functionRange = new NativeFunction ((values) => + private static readonly IFunction functionRange = new NativeFunction ((values) => { int sign; - int start; - int step; - int stop; + int start; + int step; + int stop; start = values.Count > 1 ? (int)values[0].AsNumber : 0; step = values.Count > 2 ? (int)values[2].AsNumber : 1; @@ -512,7 +512,7 @@ public static class BuiltinFunctions return new MapValue ((i) => start + step * i, (stop - start + step + sign) / step); }, 1, 3); - private static readonly IFunction functionRound = new NativeFunction ((values) => + private static readonly IFunction functionRound = new NativeFunction ((values) => { if (values.Count > 1) return Math.Round (values[0].AsNumber, (int)values[1].AsNumber); @@ -520,17 +520,17 @@ public static class BuiltinFunctions return Math.Round (values[0].AsNumber); }, 1, 2); - private static readonly IFunction functionSine = new NativeFunction ((v) => Math.Sin ((double)v[0].AsNumber), 1); + private static readonly IFunction functionSine = new NativeFunction ((v) => Math.Sin ((double)v[0].AsNumber), 1); - private static readonly IFunction functionSlice = new NativeFunction ((values) => + private static readonly IFunction functionSlice = new NativeFunction ((values) => { - int count; - IEnumerator> enumerator; - int length; - int offset; - Value source; - Value[] target; - int i; + int count; + IEnumerator> enumerator; + int length; + int offset; + Value source; + Value[] target; + int i; source = values[0]; length = source.Type == ValueContent.Map ? source.Fields.Count : source.AsString.Length; @@ -556,10 +556,10 @@ public static class BuiltinFunctions return source.AsString.Substring (offset, count); }, 2, 3); - private static readonly IFunction functionSort = new NativeFunction ((values, scope, output) => + private static readonly IFunction functionSort = new NativeFunction ((values, scope, output) => { - IFunction callback; - List> sorted; + IFunction callback; + List> sorted; callback = values.Count > 1 ? values[1].AsFunction : null; sorted = new List> (values[0].Fields); @@ -572,14 +572,14 @@ public static class BuiltinFunctions return sorted; }, 1, 2); - private static readonly IFunction functionSplit = new NativeFunction ((v) => (v[0].AsString.Split ( new [] {v[1].AsString}, StringSplitOptions.None).Select( (s) => new StringValue (s)).ToArray ()), 2); + private static readonly IFunction functionSplit = new NativeFunction ((v) => (v[0].AsString.Split ( new [] {v[1].AsString}, StringSplitOptions.None).Select( (s) => new StringValue (s)).ToArray ()), 2); - private static readonly IFunction functionToken = new NativeFunction ((values) => + private static readonly IFunction functionToken = new NativeFunction ((values) => { - string search; - string source; - int start; - int stop; + string search; + string source; + int start; + int stop; search = values[1].AsString; source = values[0].AsString; @@ -620,11 +620,11 @@ public static class BuiltinFunctions } }, 3, 4); - private static readonly IFunction functionType = new NativeFunction ((values) => values[0].Type.ToString ().ToLowerInvariant (), 1); + private static readonly IFunction functionType = new NativeFunction ((values) => values[0].Type.ToString ().ToLowerInvariant (), 1); - private static readonly IFunction functionUnion = new NativeFunction ((values) => + private static readonly IFunction functionUnion = new NativeFunction ((values) => { - Dictionary result; + Dictionary result; result = new Dictionary (); @@ -637,9 +637,9 @@ public static class BuiltinFunctions return result; }, 0, -1); - private static readonly IFunction functionUpperCase = new NativeFunction ((v) => v[0].AsString.ToUpperInvariant (), 1); + private static readonly IFunction functionUpperCase = new NativeFunction ((v) => v[0].AsString.ToUpperInvariant (), 1); - private static readonly IFunction functionWhen = new NativeFunction ((values) => + private static readonly IFunction functionWhen = new NativeFunction ((values) => { if (values[0].AsBoolean) return values[1]; @@ -647,7 +647,7 @@ public static class BuiltinFunctions return values.Count > 2 ? values[2] : VoidValue.Instance; }, 2, 3); - private static readonly IFunction functionXor = new NativeFunction ((values) => + private static readonly IFunction functionXor = new NativeFunction ((values) => { int count; @@ -662,13 +662,13 @@ public static class BuiltinFunctions return count == 1; }); - private static readonly IFunction functionZip = new NativeFunction ((values) => + private static readonly IFunction functionZip = new NativeFunction ((values) => { IEnumerator> enumerator1; IEnumerator> enumerator2; - IMap map1; - IMap map2; - List> result; + IMap map1; + IMap map2; + List> result; map1 = values[0].Fields; map2 = values[1].Fields; @@ -683,7 +683,7 @@ public static class BuiltinFunctions return result; }, 2); - private static readonly Dictionary instances = new Dictionary + private static readonly Dictionary instances = new Dictionary { {"abs", BuiltinFunctions.functionAbsolute}, {"add", BuiltinOperators.operatorAdd}, @@ -742,7 +742,7 @@ public static class BuiltinFunctions {"zip", BuiltinFunctions.functionZip} }; - private static readonly Random random = new Random (); + private static readonly Random random = new Random (); #endregion diff --git a/Cottle/src/Builtins/BuiltinOperators.cs b/Cottle/src/Builtins/BuiltinOperators.cs index 1f21c2ee..2e1bb16f 100644 --- a/Cottle/src/Builtins/BuiltinOperators.cs +++ b/Cottle/src/Builtins/BuiltinOperators.cs @@ -6,9 +6,9 @@ namespace Cottle.Builtins { static class BuiltinOperators { - public static readonly IFunction operatorAdd = new NativeFunction ((v) => v[0].AsNumber + v[1].AsNumber, 2); + public static readonly IFunction operatorAdd = new NativeFunction ((v) => v[0].AsNumber + v[1].AsNumber, 2); - public static readonly IFunction operatorAnd = new NativeFunction ((values) => + public static readonly IFunction operatorAnd = new NativeFunction ((values) => { foreach (Value value in values) { @@ -19,7 +19,7 @@ static class BuiltinOperators return true; }); - public static readonly IFunction operatorDiv = new NativeFunction ((values) => + public static readonly IFunction operatorDiv = new NativeFunction ((values) => { decimal denominator; @@ -31,9 +31,9 @@ static class BuiltinOperators return values[0].AsNumber / denominator; }, 2); - public static readonly IFunction operatorEqual = new NativeFunction ((values) => + public static readonly IFunction operatorEqual = new NativeFunction ((values) => { - Value first; + Value first; first = values[0]; @@ -44,15 +44,15 @@ static class BuiltinOperators return true; }, 1, -1); - public static readonly IFunction operatorGreaterEqual = new NativeFunction ((v) => v[0].CompareTo (v[1]) >= 0, 2); + public static readonly IFunction operatorGreaterEqual = new NativeFunction ((v) => v[0].CompareTo (v[1]) >= 0, 2); - public static readonly IFunction operatorGreaterThan = new NativeFunction ((v) => v[0].CompareTo (v[1]) > 0, 2); + public static readonly IFunction operatorGreaterThan = new NativeFunction ((v) => v[0].CompareTo (v[1]) > 0, 2); - public static readonly IFunction operatorLowerEqual = new NativeFunction ((v) => v[0].CompareTo (v[1]) <= 0, 2); + public static readonly IFunction operatorLowerEqual = new NativeFunction ((v) => v[0].CompareTo (v[1]) <= 0, 2); - public static readonly IFunction operatorLowerThan = new NativeFunction ((v) => v[0].CompareTo (v[1]) < 0, 2); + public static readonly IFunction operatorLowerThan = new NativeFunction ((v) => v[0].CompareTo (v[1]) < 0, 2); - public static readonly IFunction operatorMod = new NativeFunction ((values) => + public static readonly IFunction operatorMod = new NativeFunction ((values) => { decimal denominator; @@ -64,13 +64,13 @@ static class BuiltinOperators return values[0].AsNumber % denominator; }, 2); - public static readonly IFunction operatorMul = new NativeFunction ((v) => v[0].AsNumber * v[1].AsNumber, 2); + public static readonly IFunction operatorMul = new NativeFunction ((v) => v[0].AsNumber * v[1].AsNumber, 2); - public static readonly IFunction operatorNot = new NativeFunction ((v) => !v[0].AsBoolean, 1); + public static readonly IFunction operatorNot = new NativeFunction ((v) => !v[0].AsBoolean, 1); - public static readonly IFunction operatorNotEqual = new NativeFunction ((values) => + public static readonly IFunction operatorNotEqual = new NativeFunction ((values) => { - Value first; + Value first; first = values[0]; @@ -81,7 +81,7 @@ static class BuiltinOperators return true; }, 1, -1); - public static readonly IFunction operatorOr = new NativeFunction ((values) => + public static readonly IFunction operatorOr = new NativeFunction ((values) => { foreach (Value value in values) { @@ -92,6 +92,6 @@ static class BuiltinOperators return false; }); - public static readonly IFunction operatorSub = new NativeFunction ((v) => v[0].AsNumber - v[1].AsNumber, 2); + public static readonly IFunction operatorSub = new NativeFunction ((v) => v[0].AsNumber - v[1].AsNumber, 2); } } diff --git a/Cottle/src/Builtins/BuiltinTrimmers.cs b/Cottle/src/Builtins/BuiltinTrimmers.cs index b6bb56c0..a32d67af 100644 --- a/Cottle/src/Builtins/BuiltinTrimmers.cs +++ b/Cottle/src/Builtins/BuiltinTrimmers.cs @@ -7,9 +7,9 @@ public static class BuiltinTrimmers { #region Attributes / Public - public static readonly Trimmer CollapseBlankCharacters = (text) => BuiltinTrimmers.collapseBlankCharacters.Replace (text, " "); + public static readonly Trimmer CollapseBlankCharacters = (text) => BuiltinTrimmers.collapseBlankCharacters.Replace (text, " "); - public static readonly Trimmer FirstAndLastBlankLines = (text) => + public static readonly Trimmer FirstAndLastBlankLines = (text) => { int index; int start; @@ -44,7 +44,7 @@ public static class BuiltinTrimmers return text; }; - public static readonly Trimmer LeadAndTrailBlankCharacters = (text) => + public static readonly Trimmer LeadAndTrailBlankCharacters = (text) => { int index; int start; @@ -73,7 +73,7 @@ public static class BuiltinTrimmers #region Attributes / Private - private static readonly Regex collapseBlankCharacters = new Regex ("\\s{2,}", RegexOptions.Multiline); + private static readonly Regex collapseBlankCharacters = new Regex ("\\s{2,}", RegexOptions.Multiline); #endregion } diff --git a/Cottle/src/Command.cs b/Cottle/src/Command.cs index 88bc5ac1..68f148f4 100644 --- a/Cottle/src/Command.cs +++ b/Cottle/src/Command.cs @@ -12,23 +12,23 @@ class Command #region Attributes / Instance - public string[] Arguments; + public string[] Arguments; - public Command Body; + public Command Body; - public string Key; + public string Key; - public StoreMode Mode; + public StoreMode Mode; - public string Name; + public string Name; - public Command Next; + public Command Next; - public Expression Operand; + public Expression Operand; - public string Text; + public string Text; - public CommandType Type; + public CommandType Type; #endregion } diff --git a/Cottle/src/Documents/AbstractDocument.cs b/Cottle/src/Documents/AbstractDocument.cs index 0690a186..4c87d598 100644 --- a/Cottle/src/Documents/AbstractDocument.cs +++ b/Cottle/src/Documents/AbstractDocument.cs @@ -16,7 +16,7 @@ public abstract class AbstractDocument : IDocument public string Render (IStore store) { - StringWriter writer; + StringWriter writer; writer = new StringWriter (CultureInfo.InvariantCulture); diff --git a/Cottle/src/Documents/Dynamic/Compiler.cs b/Cottle/src/Documents/Dynamic/Compiler.cs index 86464fa2..0ff5790d 100644 --- a/Cottle/src/Documents/Dynamic/Compiler.cs +++ b/Cottle/src/Documents/Dynamic/Compiler.cs @@ -11,19 +11,19 @@ class Compiler { #region Attributes - private readonly ILGenerator generator; + private readonly ILGenerator generator; - private readonly Dictionary> locals; + private readonly Dictionary> locals; - private readonly List stringList; + private readonly List stringList; - private readonly Dictionary stringMap; + private readonly Dictionary stringMap; - private readonly Trimmer trimmer; + private readonly Trimmer trimmer; - private readonly List valueList; + private readonly List valueList; - private readonly Dictionary valueMap; + private readonly Dictionary valueMap; #endregion @@ -46,10 +46,10 @@ public Compiler (ILGenerator generator, Trimmer trimmer) public Storage Compile (IEnumerable arguments, Command command) { - Label assign; - Label copy; - Label exit; - int index; + Label assign; + Label copy; + Label exit; + int index; // Create scope for program execution this.EmitPushScope (); @@ -116,14 +116,14 @@ public Storage Compile (IEnumerable arguments, Command command) private void CompileCommand (Command command, Label exit, int depth, bool isolate) { - LocalBuilder counter; - Label empty; - LocalBuilder enumerator; - LocalBuilder fields; - Label jump; - LocalBuilder operand; - LocalBuilder pair; - Label skip; + LocalBuilder counter; + Label empty; + LocalBuilder enumerator; + LocalBuilder fields; + Label jump; + LocalBuilder operand; + LocalBuilder pair; + Label skip; // Isolate command scope by entering a new scope level if (isolate) @@ -384,14 +384,14 @@ private void CompileCommand (Command command, Label exit, int depth, bool isolat private void CompileExpression (Expression expression) { - LocalBuilder arguments; - ConstructorInfo constructor; - Label failure; - LocalBuilder fields; - LocalBuilder function; - LocalBuilder key; - Label success; - LocalBuilder value; + LocalBuilder arguments; + ConstructorInfo constructor; + Label failure; + LocalBuilder fields; + LocalBuilder function; + LocalBuilder key; + Label success; + LocalBuilder value; switch (expression.Type) { @@ -639,7 +639,7 @@ private void EmitPushScope () private void EmitPushString (string literal) { - int index; + int index; if (!this.stringMap.TryGetValue (literal, out index)) { @@ -658,7 +658,7 @@ private void EmitPushString (string literal) private void EmitPushValue (Value constant) { - int index; + int index; if (!this.valueMap.TryGetValue (constant, out index)) { @@ -682,7 +682,7 @@ private void EmitPushVoid () private void LocalRelease (LocalBuilder local) { - Queue queue; + Queue queue; if (!this.locals.TryGetValue (typeof (T), out queue)) { @@ -696,7 +696,7 @@ private void LocalRelease (LocalBuilder local) private LocalBuilder LocalReserve () { - Queue queue; + Queue queue; if (this.locals.TryGetValue (typeof (T), out queue) && queue.Count > 0) return queue.Dequeue (); diff --git a/Cottle/src/Documents/Dynamic/Function.cs b/Cottle/src/Documents/Dynamic/Function.cs index 8d536be8..9583ec17 100644 --- a/Cottle/src/Documents/Dynamic/Function.cs +++ b/Cottle/src/Documents/Dynamic/Function.cs @@ -10,9 +10,9 @@ class Function : IFunction { #region Attributes - private readonly Renderer renderer; + private readonly Renderer renderer; - private readonly Storage storage; + private readonly Storage storage; #endregion @@ -20,8 +20,8 @@ class Function : IFunction public Function (IEnumerable arguments, Command command, Trimmer trimmer, string name) { - Compiler compiler; - DynamicMethod method; + Compiler compiler; + DynamicMethod method; method = new DynamicMethod (string.Empty, typeof (Value), new [] {typeof (Storage), typeof (IList), typeof (IStore), typeof (TextWriter)}, this.GetType ()); compiler = new Compiler (method.GetILGenerator (), trimmer); @@ -42,14 +42,14 @@ public int CompareTo (IFunction other) return object.ReferenceEquals (this, other) ? 0 : 1; } - public bool Equals (IFunction other) + public bool Equals (IFunction other) { return this.CompareTo (other) == 0; } public override bool Equals (object obj) { - IFunction other = obj as IFunction; + IFunction other = obj as IFunction; return other != null && this.Equals (other); } @@ -75,11 +75,11 @@ public override string ToString () private void Save (IEnumerable arguments, Command command, Trimmer trimmer, string name) { - AssemblyBuilder assembly; - Compiler compiler; - MethodBuilder method; - ModuleBuilder module; - TypeBuilder program; + AssemblyBuilder assembly; + Compiler compiler; + MethodBuilder method; + ModuleBuilder module; + TypeBuilder program; #if CORECLR assembly = AssemblyBuilder.DefineDynamicAssembly (new AssemblyName (name), AssemblyBuilderAccess.Run); module = assembly.DefineDynamicModule (name); diff --git a/Cottle/src/Documents/Dynamic/Resolver.cs b/Cottle/src/Documents/Dynamic/Resolver.cs index c2f169de..f094a9b1 100644 --- a/Cottle/src/Documents/Dynamic/Resolver.cs +++ b/Cottle/src/Documents/Dynamic/Resolver.cs @@ -8,7 +8,7 @@ static class Resolver { public static ConstructorInfo Constructor (Expression lambda) { - NewExpression expression; + NewExpression expression; expression = lambda.Body as NewExpression; @@ -20,7 +20,7 @@ public static ConstructorInfo Constructor (Expression lambda) public static FieldInfo Field (Expression lambda) { - MemberExpression expression; + MemberExpression expression; expression = lambda.Body as MemberExpression; @@ -32,7 +32,7 @@ public static FieldInfo Field (Expression lambda) public static MethodInfo Method (Expression lambda) { - MethodCallExpression expression; + MethodCallExpression expression; expression = lambda.Body as MethodCallExpression; @@ -44,7 +44,7 @@ public static MethodInfo Method (Expression lambda) public static PropertyInfo Property (Expression lambda) { - MemberExpression expression; + MemberExpression expression; expression = lambda.Body as MemberExpression; diff --git a/Cottle/src/Documents/Dynamic/Storage.cs b/Cottle/src/Documents/Dynamic/Storage.cs index d6b5b649..fc06c579 100644 --- a/Cottle/src/Documents/Dynamic/Storage.cs +++ b/Cottle/src/Documents/Dynamic/Storage.cs @@ -6,9 +6,9 @@ namespace Cottle.Documents.Dynamic { struct Storage { - public readonly string[] Strings; + public readonly string[] Strings; - public readonly Value[] Values; + public readonly Value[] Values; public Storage (IEnumerable strings, IEnumerable values) { diff --git a/Cottle/src/Documents/DynamicDocument.cs b/Cottle/src/Documents/DynamicDocument.cs index 13dad629..ff21cb58 100644 --- a/Cottle/src/Documents/DynamicDocument.cs +++ b/Cottle/src/Documents/DynamicDocument.cs @@ -16,7 +16,7 @@ public sealed class DynamicDocument : AbstractDocument { #region Attributes - private readonly Function main; + private readonly Function main; #endregion @@ -24,7 +24,7 @@ public sealed class DynamicDocument : AbstractDocument public DynamicDocument (TextReader reader, ISetting setting) { - IParser parser = ParserFactory.BuildParser (setting); + IParser parser = ParserFactory.BuildParser (setting); this.main = new Function (new string[0], parser.Parse (reader), setting.Trimmer, string.Empty); } diff --git a/Cottle/src/Documents/Simple/Evaluators/AccessEvaluator.cs b/Cottle/src/Documents/Simple/Evaluators/AccessEvaluator.cs index dcb915c5..9f399cf3 100644 --- a/Cottle/src/Documents/Simple/Evaluators/AccessEvaluator.cs +++ b/Cottle/src/Documents/Simple/Evaluators/AccessEvaluator.cs @@ -8,9 +8,9 @@ class AccessEvaluator : IEvaluator { #region Attributes - private readonly IEvaluator source; + private readonly IEvaluator source; - private readonly IEvaluator subscript; + private readonly IEvaluator subscript; #endregion @@ -28,9 +28,9 @@ public AccessEvaluator (IEvaluator source, IEvaluator subscript) public Value Evaluate (IStore store, TextWriter output) { - Value key; - Value map; - Value value; + Value key; + Value map; + Value value; key = this.subscript.Evaluate (store, output); map = this.source.Evaluate (store, output); diff --git a/Cottle/src/Documents/Simple/Evaluators/ConstantEvaluator.cs b/Cottle/src/Documents/Simple/Evaluators/ConstantEvaluator.cs index c12ef74f..c8678efb 100644 --- a/Cottle/src/Documents/Simple/Evaluators/ConstantEvaluator.cs +++ b/Cottle/src/Documents/Simple/Evaluators/ConstantEvaluator.cs @@ -7,7 +7,7 @@ class ConstantEvaluator : IEvaluator { #region Attributes - private readonly Value value; + private readonly Value value; #endregion diff --git a/Cottle/src/Documents/Simple/Evaluators/InvokeEvaluator.cs b/Cottle/src/Documents/Simple/Evaluators/InvokeEvaluator.cs index 873d3b40..e409664a 100644 --- a/Cottle/src/Documents/Simple/Evaluators/InvokeEvaluator.cs +++ b/Cottle/src/Documents/Simple/Evaluators/InvokeEvaluator.cs @@ -11,9 +11,9 @@ class InvokeEvaluator : IEvaluator { #region Attributes - private readonly IEvaluator[] arguments; + private readonly IEvaluator[] arguments; - private readonly IEvaluator caller; + private readonly IEvaluator caller; #endregion @@ -31,9 +31,9 @@ public InvokeEvaluator (IEvaluator caller, IEnumerable arguments) public Value Evaluate (IStore store, TextWriter output) { - IFunction function; - Value source; - Value[] values; + IFunction function; + Value source; + Value[] values; source = this.caller.Evaluate (store, output); function = source.AsFunction; @@ -53,8 +53,8 @@ public Value Evaluate (IStore store, TextWriter output) public override string ToString () { - StringBuilder builder; - bool comma; + StringBuilder builder; + bool comma; builder = new StringBuilder (); builder.Append (this.caller); diff --git a/Cottle/src/Documents/Simple/Evaluators/MapEvaluator.cs b/Cottle/src/Documents/Simple/Evaluators/MapEvaluator.cs index 15e5ee35..2e922b15 100644 --- a/Cottle/src/Documents/Simple/Evaluators/MapEvaluator.cs +++ b/Cottle/src/Documents/Simple/Evaluators/MapEvaluator.cs @@ -11,7 +11,7 @@ class MapEvaluator : IEvaluator { #region Attributes - private KeyValuePair[] elements; + private KeyValuePair[] elements; #endregion @@ -30,8 +30,8 @@ public Value Evaluate (IStore store, TextWriter writer) { return new MapValue (this.elements.Select ( (element) => { - Value key; - Value value; + Value key; + Value value; key = element.Key.Evaluate (store, writer); value = element.Value.Evaluate (store, writer); @@ -42,8 +42,8 @@ public Value Evaluate (IStore store, TextWriter writer) public override string ToString () { - StringBuilder builder; - bool comma; + StringBuilder builder; + bool comma; builder = new StringBuilder (); builder.Append ('['); diff --git a/Cottle/src/Documents/Simple/Evaluators/SymbolEvaluator.cs b/Cottle/src/Documents/Simple/Evaluators/SymbolEvaluator.cs index 16bc1545..d5928cf7 100644 --- a/Cottle/src/Documents/Simple/Evaluators/SymbolEvaluator.cs +++ b/Cottle/src/Documents/Simple/Evaluators/SymbolEvaluator.cs @@ -8,7 +8,7 @@ class SymbolEvaluator : IEvaluator { #region Attributes - private readonly Value symbol; + private readonly Value symbol; #endregion @@ -25,7 +25,7 @@ public SymbolEvaluator (Value symbol) public Value Evaluate (IStore store, TextWriter output) { - Value value; + Value value; if (store.TryGet (this.symbol, out value)) return value; diff --git a/Cottle/src/Documents/Simple/IEvaluator.cs b/Cottle/src/Documents/Simple/IEvaluator.cs index 4a2fa711..29647b32 100644 --- a/Cottle/src/Documents/Simple/IEvaluator.cs +++ b/Cottle/src/Documents/Simple/IEvaluator.cs @@ -7,9 +7,9 @@ interface IEvaluator { #region Methods - Value Evaluate (IStore store, TextWriter output); + Value Evaluate (IStore store, TextWriter output); - string ToString (); + string ToString (); #endregion } diff --git a/Cottle/src/Documents/Simple/INode.cs b/Cottle/src/Documents/Simple/INode.cs index 34ae4a0b..338d2fc6 100644 --- a/Cottle/src/Documents/Simple/INode.cs +++ b/Cottle/src/Documents/Simple/INode.cs @@ -7,9 +7,9 @@ interface INode { #region Methods - bool Render (IStore store, TextWriter output, out Value result); + bool Render (IStore store, TextWriter output, out Value result); - void Source (ISetting setting, TextWriter output); + void Source (ISetting setting, TextWriter output); #endregion } diff --git a/Cottle/src/Documents/Simple/Nodes/AssignFunctionNode.cs b/Cottle/src/Documents/Simple/Nodes/AssignFunctionNode.cs index 338b8bff..49fa4d00 100644 --- a/Cottle/src/Documents/Simple/Nodes/AssignFunctionNode.cs +++ b/Cottle/src/Documents/Simple/Nodes/AssignFunctionNode.cs @@ -10,13 +10,13 @@ class AssignFunctionNode : IFunction, INode { #region Attributes - private readonly string[] arguments; + private readonly string[] arguments; - private readonly INode body; + private readonly INode body; - private readonly StoreMode mode; + private readonly StoreMode mode; - private readonly string name; + private readonly string name; #endregion @@ -39,21 +39,21 @@ public int CompareTo (IFunction other) return object.ReferenceEquals (this, other) ? 0 : 1; } - public bool Equals (IFunction other) + public bool Equals (IFunction other) { return this.CompareTo (other) == 0; } public override bool Equals (object obj) { - IFunction other = obj as IFunction; + IFunction other = obj as IFunction; return other != null && this.Equals (other); } public Value Execute (IList arguments, IStore store, TextWriter output) { - Value result; + Value result; store.Enter (); @@ -89,9 +89,9 @@ public bool Render (IStore store, TextWriter output, out Value result) public void Source (ISetting setting, TextWriter output) { - bool comma; - string keyword; - string link; + bool comma; + string keyword; + string link; switch (this.mode) { diff --git a/Cottle/src/Documents/Simple/Nodes/AssignValueNode.cs b/Cottle/src/Documents/Simple/Nodes/AssignValueNode.cs index c757dd6d..df335064 100644 --- a/Cottle/src/Documents/Simple/Nodes/AssignValueNode.cs +++ b/Cottle/src/Documents/Simple/Nodes/AssignValueNode.cs @@ -8,11 +8,11 @@ class AssignValueNode : INode { #region Attributes - private readonly IEvaluator expression; + private readonly IEvaluator expression; - private readonly StoreMode mode; + private readonly StoreMode mode; - private readonly string name; + private readonly string name; #endregion @@ -40,8 +40,8 @@ public bool Render (IStore store, TextWriter output, out Value result) public void Source (ISetting setting, TextWriter output) { - string keyword; - string link; + string keyword; + string link; switch (this.mode) { diff --git a/Cottle/src/Documents/Simple/Nodes/CompositeNode.cs b/Cottle/src/Documents/Simple/Nodes/CompositeNode.cs index ccc9b67b..a71a36a7 100644 --- a/Cottle/src/Documents/Simple/Nodes/CompositeNode.cs +++ b/Cottle/src/Documents/Simple/Nodes/CompositeNode.cs @@ -10,7 +10,7 @@ class CompositeNode : INode { #region Attributes - private readonly INode[] nodes; + private readonly INode[] nodes; #endregion diff --git a/Cottle/src/Documents/Simple/Nodes/EchoNode.cs b/Cottle/src/Documents/Simple/Nodes/EchoNode.cs index 7d2699ce..2c3f3c4f 100644 --- a/Cottle/src/Documents/Simple/Nodes/EchoNode.cs +++ b/Cottle/src/Documents/Simple/Nodes/EchoNode.cs @@ -8,7 +8,7 @@ class EchoNode : INode { #region Attributes - private readonly IEvaluator expression; + private readonly IEvaluator expression; #endregion @@ -34,7 +34,7 @@ public bool Render (IStore store, TextWriter output, out Value result) public void Source (ISetting setting, TextWriter output) { - string source; + string source; source = this.expression.ToString (); diff --git a/Cottle/src/Documents/Simple/Nodes/ForNode.cs b/Cottle/src/Documents/Simple/Nodes/ForNode.cs index 07f5a91d..1321dd97 100644 --- a/Cottle/src/Documents/Simple/Nodes/ForNode.cs +++ b/Cottle/src/Documents/Simple/Nodes/ForNode.cs @@ -8,15 +8,15 @@ class ForNode : INode { #region Attributes - private readonly INode body; + private readonly INode body; - private readonly INode empty; + private readonly INode empty; - private readonly IEvaluator from; + private readonly IEvaluator from; - private readonly string key; + private readonly string key; - private readonly string value; + private readonly string value; #endregion @@ -37,7 +37,7 @@ public ForNode (IEvaluator from, string key, string value, INode body, INode emp public bool Render (IStore store, TextWriter output, out Value result) { - IMap fields; + IMap fields; fields = this.from.Evaluate (store, output).Fields; diff --git a/Cottle/src/Documents/Simple/Nodes/IfNode.cs b/Cottle/src/Documents/Simple/Nodes/IfNode.cs index 97297e60..3da5d81f 100644 --- a/Cottle/src/Documents/Simple/Nodes/IfNode.cs +++ b/Cottle/src/Documents/Simple/Nodes/IfNode.cs @@ -9,9 +9,9 @@ class IfNode : INode { #region Attributes - private readonly KeyValuePair[] branches; + private readonly KeyValuePair[] branches; - private readonly INode fallback; + private readonly INode fallback; #endregion @@ -29,7 +29,7 @@ public IfNode (IEnumerable> branches, INode fall public bool Render (IStore store, TextWriter output, out Value result) { - bool halt; + bool halt; foreach (KeyValuePair branch in this.branches) { @@ -63,7 +63,7 @@ public bool Render (IStore store, TextWriter output, out Value result) public void Source (ISetting setting, TextWriter output) { - bool first; + bool first; first = true; diff --git a/Cottle/src/Documents/Simple/Nodes/LiteralNode.cs b/Cottle/src/Documents/Simple/Nodes/LiteralNode.cs index 63bd15ee..928cd5e7 100644 --- a/Cottle/src/Documents/Simple/Nodes/LiteralNode.cs +++ b/Cottle/src/Documents/Simple/Nodes/LiteralNode.cs @@ -9,7 +9,7 @@ class LiteralNode : INode { #region Attributes - private readonly string text; + private readonly string text; #endregion @@ -35,7 +35,7 @@ public bool Render (IStore store, TextWriter output, out Value result) public void Source (ISetting setting, TextWriter output) { - StringBuilder builder; + StringBuilder builder; builder = new StringBuilder () .Append (this.text) diff --git a/Cottle/src/Documents/Simple/Nodes/ReturnNode.cs b/Cottle/src/Documents/Simple/Nodes/ReturnNode.cs index af3ad3b4..ab3c3d6c 100644 --- a/Cottle/src/Documents/Simple/Nodes/ReturnNode.cs +++ b/Cottle/src/Documents/Simple/Nodes/ReturnNode.cs @@ -7,7 +7,7 @@ class ReturnNode : INode { #region Attributes - private readonly IEvaluator expression; + private readonly IEvaluator expression; #endregion diff --git a/Cottle/src/Documents/Simple/Nodes/WhileNode.cs b/Cottle/src/Documents/Simple/Nodes/WhileNode.cs index c94bbd99..6dba770f 100644 --- a/Cottle/src/Documents/Simple/Nodes/WhileNode.cs +++ b/Cottle/src/Documents/Simple/Nodes/WhileNode.cs @@ -8,9 +8,9 @@ class WhileNode : INode { #region Attributes - private readonly INode body; + private readonly INode body; - private readonly IEvaluator condition; + private readonly IEvaluator condition; #endregion diff --git a/Cottle/src/Documents/SimpleDocument.cs b/Cottle/src/Documents/SimpleDocument.cs index eef71c12..cebc69fa 100644 --- a/Cottle/src/Documents/SimpleDocument.cs +++ b/Cottle/src/Documents/SimpleDocument.cs @@ -18,9 +18,9 @@ public sealed class SimpleDocument : AbstractDocument { #region Attributes - private readonly INode renderer; + private readonly INode renderer; - private readonly ISetting setting; + private readonly ISetting setting; #endregion @@ -28,8 +28,8 @@ public sealed class SimpleDocument : AbstractDocument public SimpleDocument (TextReader reader, ISetting setting) { - IParser parser = ParserFactory.BuildParser (setting); - Command root = parser.Parse (reader); + IParser parser = ParserFactory.BuildParser (setting); + Command root = parser.Parse (reader); this.renderer = this.CompileCommand (root, setting.Trimmer); this.setting = setting; @@ -56,7 +56,7 @@ public SimpleDocument (TextReader reader, ISetting setting) public override Value Render (IStore store, TextWriter writer) { - Value result; + Value result; store.Enter (); @@ -74,7 +74,7 @@ public void Source (TextWriter writer) public string Source () { - StringWriter writer; + StringWriter writer; writer = new StringWriter (CultureInfo.InvariantCulture); @@ -89,8 +89,8 @@ public string Source () private INode CompileCommand (Command command, Trimmer trimmer) { - List> branches; - List nodes; + List> branches; + List nodes; switch (command.Type) { @@ -143,10 +143,10 @@ private INode CompileCommand (Command command, Trimmer trimmer) private IEvaluator CompileExpression (Expression expression) { - IEvaluator[] arguments; - KeyValuePair[] elements; - IEvaluator key; - IEvaluator value; + IEvaluator[] arguments; + KeyValuePair[] elements; + IEvaluator key; + IEvaluator value; switch (expression.Type) { diff --git a/Cottle/src/Exceptions/ConfigException.cs b/Cottle/src/Exceptions/ConfigException.cs index 2bad2e3f..d4c286de 100644 --- a/Cottle/src/Exceptions/ConfigException.cs +++ b/Cottle/src/Exceptions/ConfigException.cs @@ -7,7 +7,7 @@ public class ConfigException : Exception { #region Properties - public string Name + public string Name { get { @@ -15,7 +15,7 @@ public string Name } } - public string Value + public string Value { get { @@ -27,9 +27,9 @@ public string Value #region Attributes - private readonly string name; + private readonly string name; - private readonly string value; + private readonly string value; #endregion diff --git a/Cottle/src/Exceptions/ParseException.cs b/Cottle/src/Exceptions/ParseException.cs index e3f3bde5..36af9b8e 100644 --- a/Cottle/src/Exceptions/ParseException.cs +++ b/Cottle/src/Exceptions/ParseException.cs @@ -35,11 +35,11 @@ public int Line #region Attributes - private readonly int column; + private readonly int column; - private readonly string lexem; + private readonly string lexem; - private readonly int line; + private readonly int line; #endregion diff --git a/Cottle/src/Expression.cs b/Cottle/src/Expression.cs index 4ac61715..4bb3d6d6 100644 --- a/Cottle/src/Expression.cs +++ b/Cottle/src/Expression.cs @@ -6,25 +6,25 @@ class Expression { #region Attributes / Instance - public Expression[] Arguments; + public Expression[] Arguments; - public ExpressionElement[] Elements; + public ExpressionElement[] Elements; - public Expression Source; + public Expression Source; - public Expression Subscript; + public Expression Subscript; - public ExpressionType Type; + public ExpressionType Type; - public Value Value; + public Value Value; #endregion #region Attributes / Static - public static readonly Expression Empty = new Expression + public static readonly Expression Empty = new Expression { - Type = ExpressionType.Void + Type = ExpressionType.Void }; #endregion diff --git a/Cottle/src/ExpressionElement.cs b/Cottle/src/ExpressionElement.cs index b4dfb518..19bc2c6c 100644 --- a/Cottle/src/ExpressionElement.cs +++ b/Cottle/src/ExpressionElement.cs @@ -6,9 +6,9 @@ struct ExpressionElement { #region Attributes - public Expression Key; + public Expression Key; - public Expression Value; + public Expression Value; #endregion } diff --git a/Cottle/src/Functions/NativeFunction.cs b/Cottle/src/Functions/NativeFunction.cs index 8eb13a22..38e326ad 100644 --- a/Cottle/src/Functions/NativeFunction.cs +++ b/Cottle/src/Functions/NativeFunction.cs @@ -98,14 +98,14 @@ public int CompareTo (IFunction other) return object.ReferenceEquals (this, other) ? 0 : 1; } - public bool Equals (IFunction other) + public bool Equals (IFunction other) { return this.CompareTo (other) == 0; } public override bool Equals (object obj) { - IFunction other = obj as IFunction; + IFunction other = obj as IFunction; return other != null && this.Equals (other); } diff --git a/Cottle/src/IDocument.cs b/Cottle/src/IDocument.cs index bbe22997..1c335f23 100644 --- a/Cottle/src/IDocument.cs +++ b/Cottle/src/IDocument.cs @@ -7,9 +7,9 @@ public interface IDocument { #region Methods - Value Render (IStore store, TextWriter writer); + Value Render (IStore store, TextWriter writer); - string Render (IStore store); + string Render (IStore store); #endregion } diff --git a/Cottle/src/IParser.cs b/Cottle/src/IParser.cs index 8d6a098e..cd3042f1 100644 --- a/Cottle/src/IParser.cs +++ b/Cottle/src/IParser.cs @@ -7,7 +7,7 @@ interface IParser { #region Methods - Command Parse (TextReader reader); + Command Parse (TextReader reader); #endregion } diff --git a/Cottle/src/ISetting.cs b/Cottle/src/ISetting.cs index d824e247..91f74b12 100644 --- a/Cottle/src/ISetting.cs +++ b/Cottle/src/ISetting.cs @@ -6,32 +6,32 @@ public interface ISetting { #region Methods - string BlockBegin + string BlockBegin { get; } - string BlockContinue + string BlockContinue { get; } - string BlockEnd + string BlockEnd { get; } - char Escape + char Escape { get; } - bool Optimize + bool Optimize { get; } - Trimmer Trimmer + Trimmer Trimmer { get; } diff --git a/Cottle/src/Maps/AbstractMap.cs b/Cottle/src/Maps/AbstractMap.cs index 8000529e..4049554b 100644 --- a/Cottle/src/Maps/AbstractMap.cs +++ b/Cottle/src/Maps/AbstractMap.cs @@ -15,7 +15,7 @@ abstract class AbstractMap : IMap public abstract bool Contains (Value key); - public abstract IEnumerator> GetEnumerator (); + public abstract IEnumerator> GetEnumerator (); public abstract bool TryGet (Value key, out Value value); @@ -25,9 +25,9 @@ abstract class AbstractMap : IMap public int CompareTo (IMap other) { - int compare; - IEnumerator> lhs; - IEnumerator> rhs; + int compare; + IEnumerator> lhs; + IEnumerator> rhs; if (other == null) return 1; @@ -56,14 +56,14 @@ public int CompareTo (IMap other) return 0; } - public bool Equals (IMap other) + public bool Equals (IMap other) { return this.CompareTo (other) == 0; } public override bool Equals (object obj) { - IMap other; + IMap other; other = obj as IMap; @@ -77,7 +77,7 @@ IEnumerator IEnumerable.GetEnumerator () public override int GetHashCode () { - int hash; + int hash; hash = 0; diff --git a/Cottle/src/Maps/ArrayMap.cs b/Cottle/src/Maps/ArrayMap.cs index 93b6b14d..949d3af9 100644 --- a/Cottle/src/Maps/ArrayMap.cs +++ b/Cottle/src/Maps/ArrayMap.cs @@ -18,7 +18,7 @@ public override int Count #region Attributes - private readonly List> array; + private readonly List> array; #endregion diff --git a/Cottle/src/Maps/EmptyMap.cs b/Cottle/src/Maps/EmptyMap.cs index 05f602eb..f048e300 100644 --- a/Cottle/src/Maps/EmptyMap.cs +++ b/Cottle/src/Maps/EmptyMap.cs @@ -19,7 +19,7 @@ public override int Count #region Properties / Static - public static EmptyMap Instance + public static EmptyMap Instance { get { @@ -31,9 +31,9 @@ public static EmptyMap Instance #region Attributes - private static readonly EmptyMap instance = new EmptyMap (); + private static readonly EmptyMap instance = new EmptyMap (); - private static readonly IList> pairs = new KeyValuePair[0]; + private static readonly IList> pairs = new KeyValuePair[0]; #endregion diff --git a/Cottle/src/Maps/GeneratorMap.cs b/Cottle/src/Maps/GeneratorMap.cs index d71aa522..32c3dad7 100644 --- a/Cottle/src/Maps/GeneratorMap.cs +++ b/Cottle/src/Maps/GeneratorMap.cs @@ -21,9 +21,9 @@ public override int Count #region Attributes - private readonly int count; + private readonly int count; - private readonly Func generator; + private readonly Func generator; #endregion @@ -105,13 +105,13 @@ object IEnumerator.Current #region Attributes - private readonly int count; + private readonly int count; - private KeyValuePair current; + private KeyValuePair current; - private readonly Func generator; + private readonly Func generator; - private int index; + private int index; #endregion diff --git a/Cottle/src/Maps/HashMap.cs b/Cottle/src/Maps/HashMap.cs index 5c526c0e..08f5c1a8 100644 --- a/Cottle/src/Maps/HashMap.cs +++ b/Cottle/src/Maps/HashMap.cs @@ -18,7 +18,7 @@ public override int Count #region Attributes - private Dictionary hash; + private Dictionary hash; #endregion diff --git a/Cottle/src/Maps/MixMap.cs b/Cottle/src/Maps/MixMap.cs index 58cf8fad..8434b8ef 100644 --- a/Cottle/src/Maps/MixMap.cs +++ b/Cottle/src/Maps/MixMap.cs @@ -18,15 +18,15 @@ public override int Count #region Attributes - private readonly List> array; + private readonly List> array; - private readonly Dictionary hash; + private readonly Dictionary hash; #endregion #region Constructors - public MixMap (IEnumerable> pairs) + public MixMap (IEnumerable> pairs) { this.array = new List> (pairs); this.hash = new Dictionary (); diff --git a/Cottle/src/Parsers/Default/Lexem.cs b/Cottle/src/Parsers/Default/Lexem.cs index 8489b85b..297bb7a3 100644 --- a/Cottle/src/Parsers/Default/Lexem.cs +++ b/Cottle/src/Parsers/Default/Lexem.cs @@ -3,13 +3,13 @@ namespace Cottle.Parsers.Default { - struct Lexem + struct Lexem { #region Attributes - public readonly string Content; + public readonly string Content; - public readonly LexemType Type; + public readonly LexemType Type; #endregion diff --git a/Cottle/src/Parsers/Default/LexemCursor.cs b/Cottle/src/Parsers/Default/LexemCursor.cs index 66f1abe9..adf35a25 100644 --- a/Cottle/src/Parsers/Default/LexemCursor.cs +++ b/Cottle/src/Parsers/Default/LexemCursor.cs @@ -5,9 +5,9 @@ struct LexemCursor { #region Attributes - public readonly char Character; + public readonly char Character; - public LexemState State; + public LexemState State; #endregion diff --git a/Cottle/src/Parsers/Default/LexemState.cs b/Cottle/src/Parsers/Default/LexemState.cs index 7fad5d96..2a3ea556 100644 --- a/Cottle/src/Parsers/Default/LexemState.cs +++ b/Cottle/src/Parsers/Default/LexemState.cs @@ -6,13 +6,13 @@ class LexemState { #region Constants - private const int BRANCH_LIMIT = 256; + private const int BRANCH_LIMIT = 256; #endregion #region Properties - public LexemType Type + public LexemType Type { get { @@ -24,19 +24,19 @@ public LexemType Type #region Attributes - private Dictionary branchesHigh = null; + private Dictionary branchesHigh = null; - private LexemState[] branchesLow = null; + private LexemState[] branchesLow = null; - private LexemType type = LexemType.None; + private LexemType type = LexemType.None; #endregion #region Methods - public LexemState Follow (char character) + public LexemState Follow (char character) { - LexemState state; + LexemState state; if (this.branchesLow != null && character < LexemState.BRANCH_LIMIT) return this.branchesLow[character]; @@ -48,8 +48,8 @@ public LexemState Follow (char character) public bool Store (LexemType type, string content) { - LexemState current; - LexemState next; + LexemState current; + LexemState next; current = this; diff --git a/Cottle/src/Parsers/Default/Lexer.cs b/Cottle/src/Parsers/Default/Lexer.cs index 19a396ca..08428d2d 100644 --- a/Cottle/src/Parsers/Default/Lexer.cs +++ b/Cottle/src/Parsers/Default/Lexer.cs @@ -11,7 +11,7 @@ class Lexer { #region Properties - public int Column + public int Column { get { @@ -19,7 +19,7 @@ public int Column } } - public Lexem Current + public Lexem Current { get { @@ -27,7 +27,7 @@ public Lexem Current } } - public int Line + public int Line { get { @@ -39,25 +39,25 @@ public int Line #region Attributes - private int column; + private int column; - private Lexem current; + private Lexem current; - private readonly List cursors; + private readonly List cursors; - private bool eof; + private bool eof; - private readonly char escape; + private readonly char escape; - private char last; + private char last; - private int line; + private int line; - private readonly Queue pending; + private readonly Queue pending; - private TextReader reader; + private TextReader reader; - private readonly LexemState root; + private readonly LexemState root; #endregion @@ -122,9 +122,9 @@ public bool Reset (TextReader reader) private Lexem NextBlock () { - StringBuilder buffer; - bool dot; - char end; + StringBuilder buffer; + bool dot; + char end; while (true) { @@ -334,7 +334,7 @@ private Lexem NextBlock () private Lexem NextChar (LexemType type) { - Lexem lexem; + Lexem lexem; lexem = new Lexem (type, this.last.ToString ()); @@ -345,13 +345,13 @@ private Lexem NextChar (LexemType type) private Lexem NextRaw () { - StringBuilder buffer; - int copy; - int first; - Lexem lexem; - LexemCursor next; - string text; - StringBuilder token; + StringBuilder buffer; + int copy; + int first; + Lexem lexem; + LexemCursor next; + string text; + StringBuilder token; buffer = new StringBuilder (); diff --git a/Cottle/src/Parsers/Default/Operator.cs b/Cottle/src/Parsers/Default/Operator.cs index 69d7e609..5e0bb544 100644 --- a/Cottle/src/Parsers/Default/Operator.cs +++ b/Cottle/src/Parsers/Default/Operator.cs @@ -4,8 +4,8 @@ namespace Cottle.Parsers.Default { struct Operator { - public IFunction Function; + public IFunction Function; - public int Precedence; + public int Precedence; } } diff --git a/Cottle/src/Parsers/DefaultParser.cs b/Cottle/src/Parsers/DefaultParser.cs index faacd39b..0de8b92b 100644 --- a/Cottle/src/Parsers/DefaultParser.cs +++ b/Cottle/src/Parsers/DefaultParser.cs @@ -13,13 +13,13 @@ class DefaultParser : IParser { #region Attributes / Instance - private readonly Lexer lexer; + private readonly Lexer lexer; #endregion #region Attributes / Static - private static readonly Dictionary> keywords = new Dictionary> + private static readonly Dictionary> keywords = new Dictionary> { {"_", (p) => p.ParseKeywordComment ()}, {"declare", (p) => p.ParseKeywordDeclare ()}, @@ -48,7 +48,7 @@ public DefaultParser (string blockBegin, string blockContinue, string blockEnd, public Command Parse (TextReader reader) { - Command command; + Command command; this.lexer.Reset (reader); this.lexer.Next (LexerMode.Raw); @@ -69,21 +69,21 @@ private Expression BuildOperator (IFunction function, params Expression[] argume { return new Expression { - Arguments = arguments, - Source = new Expression + Arguments = arguments, + Source = new Expression { - Type = ExpressionType.Constant, - Value = new FunctionValue (function) + Type = ExpressionType.Constant, + Value = new FunctionValue (function) }, - Type = ExpressionType.Invoke + Type = ExpressionType.Invoke }; } private Command ParseAssignment (StoreMode mode) { - List arguments; - Func command; - string name; + List arguments; + Func command; + string name; arguments = new List (); name = this.ParseSymbol (); @@ -105,11 +105,11 @@ private Command ParseAssignment (StoreMode mode) command = (m) => new Command { - Arguments = arguments.ToArray (), - Body = this.ParseBody (), - Mode = m, - Name = name, - Type = CommandType.AssignFunction + Arguments = arguments.ToArray (), + Body = this.ParseBody (), + Mode = m, + Name = name, + Type = CommandType.AssignFunction }; break; @@ -117,10 +117,10 @@ private Command ParseAssignment (StoreMode mode) default: command = (m) => new Command { - Mode = m, - Name = name, - Operand = this.ParseOperand (), - Type = CommandType.AssignValue + Mode = m, + Name = name, + Operand = this.ParseOperand (), + Type = CommandType.AssignValue }; break; @@ -153,10 +153,10 @@ private Command ParseAssignment (StoreMode mode) return new Command { - Mode = mode, - Operand = Expression.Empty, - Type = CommandType.AssignValue, - Name = name + Mode = mode, + Operand = Expression.Empty, + Type = CommandType.AssignValue, + Name = name }; } } @@ -173,10 +173,10 @@ private Command ParseBody () private Command ParseCommand () { - Command current; - Command head; - Func parse; - Command tail; + Command current; + Command head; + Func parse; + Command tail; head = null; tail = null; @@ -211,8 +211,8 @@ private Command ParseCommand () case LexemType.Text: current = new Command { - Text = this.lexer.Current.Content, - Type = CommandType.Literal + Text = this.lexer.Current.Content, + Type = CommandType.Literal }; this.lexer.Next (LexerMode.Raw); @@ -232,9 +232,9 @@ private Command ParseCommand () { tail.Next = new Command { - Body = tail.Next, - Next = current, - Type = CommandType.Composite + Body = tail.Next, + Next = current, + Type = CommandType.Composite }; tail = tail.Next; @@ -243,9 +243,9 @@ private Command ParseCommand () { tail = new Command { - Body = head, - Next = current, - Type = CommandType.Composite + Body = head, + Next = current, + Type = CommandType.Composite }; head = tail; @@ -256,8 +256,8 @@ private Command ParseCommand () return head ?? new Command { - Text = string.Empty, - Type = CommandType.Literal + Text = string.Empty, + Type = CommandType.Literal }; } @@ -271,11 +271,11 @@ private void ParseExpected (LexemType type, string value, string expected) private Expression ParseExpression () { - Operator current; - Stack operands; - Stack operators; - Operator other; - Expression value; + Operator current; + Stack operands; + Stack operators; + Operator other; + Expression value; operands = new Stack (); operators = new Stack (); @@ -289,8 +289,8 @@ private Expression ParseExpression () case LexemType.DoubleAmpersand: current = new Operator { - Function = BuiltinOperators.operatorAnd, - Precedence = 0 + Function = BuiltinOperators.operatorAnd, + Precedence = 0 }; break; @@ -298,8 +298,8 @@ private Expression ParseExpression () case LexemType.DoublePipe: current = new Operator { - Function = BuiltinOperators.operatorOr, - Precedence = 0 + Function = BuiltinOperators.operatorOr, + Precedence = 0 }; break; @@ -307,8 +307,8 @@ private Expression ParseExpression () case LexemType.Equal: current = new Operator { - Function = BuiltinOperators.operatorEqual, - Precedence = 1 + Function = BuiltinOperators.operatorEqual, + Precedence = 1 }; break; @@ -316,8 +316,8 @@ private Expression ParseExpression () case LexemType.GreaterEqual: current = new Operator { - Function = BuiltinOperators.operatorGreaterEqual, - Precedence = 1 + Function = BuiltinOperators.operatorGreaterEqual, + Precedence = 1 }; break; @@ -325,8 +325,8 @@ private Expression ParseExpression () case LexemType.GreaterThan: current = new Operator { - Function = BuiltinOperators.operatorGreaterThan, - Precedence = 1 + Function = BuiltinOperators.operatorGreaterThan, + Precedence = 1 }; break; @@ -334,8 +334,8 @@ private Expression ParseExpression () case LexemType.LowerEqual: current = new Operator { - Function = BuiltinOperators.operatorLowerEqual, - Precedence = 1 + Function = BuiltinOperators.operatorLowerEqual, + Precedence = 1 }; break; @@ -343,8 +343,8 @@ private Expression ParseExpression () case LexemType.LowerThan: current = new Operator { - Function = BuiltinOperators.operatorLowerThan, - Precedence = 1 + Function = BuiltinOperators.operatorLowerThan, + Precedence = 1 }; break; @@ -352,8 +352,8 @@ private Expression ParseExpression () case LexemType.Minus: current = new Operator { - Function = BuiltinOperators.operatorSub, - Precedence = 2 + Function = BuiltinOperators.operatorSub, + Precedence = 2 }; break; @@ -361,8 +361,8 @@ private Expression ParseExpression () case LexemType.NotEqual: current = new Operator { - Function = BuiltinOperators.operatorNotEqual, - Precedence = 1 + Function = BuiltinOperators.operatorNotEqual, + Precedence = 1 }; break; @@ -370,8 +370,8 @@ private Expression ParseExpression () case LexemType.Percent: current = new Operator { - Function = BuiltinOperators.operatorMod, - Precedence = 3 + Function = BuiltinOperators.operatorMod, + Precedence = 3 }; break; @@ -379,8 +379,8 @@ private Expression ParseExpression () case LexemType.Plus: current = new Operator { - Function = BuiltinOperators.operatorAdd, - Precedence = 2 + Function = BuiltinOperators.operatorAdd, + Precedence = 2 }; break; @@ -388,8 +388,8 @@ private Expression ParseExpression () case LexemType.Slash: current = new Operator { - Function = BuiltinOperators.operatorDiv, - Precedence = 3 + Function = BuiltinOperators.operatorDiv, + Precedence = 3 }; break; @@ -397,8 +397,8 @@ private Expression ParseExpression () case LexemType.Star: current = new Operator { - Function = BuiltinOperators.operatorMul, - Precedence = 3 + Function = BuiltinOperators.operatorMul, + Precedence = 3 }; break; @@ -449,8 +449,8 @@ private Command ParseKeywordDump () { return new Command { - Operand = this.ParseOperand (), - Type = CommandType.Dump + Operand = this.ParseOperand (), + Type = CommandType.Dump }; } @@ -458,18 +458,18 @@ private Command ParseKeywordEcho () { return new Command { - Operand = this.ParseOperand (), - Type = CommandType.Echo + Operand = this.ParseOperand (), + Type = CommandType.Echo }; } private Command ParseKeywordFor () { - Command body; - Command empty; - Expression from; - string key; - string value; + Command body; + Command empty; + Expression from; + string key; + string value; key = this.ParseSymbol (); @@ -503,27 +503,27 @@ private Command ParseKeywordFor () return new Command { - Body = body, - Key = key, - Name = value, - Next = empty, - Operand = from, - Type = CommandType.For + Body = body, + Key = key, + Name = value, + Next = empty, + Operand = from, + Type = CommandType.For }; } private Command ParseKeywordIf () { - Expression condition; - Command current; - Command result; + Expression condition; + Command current; + Command result; condition = this.ParseExpression (); result = new Command { - Body = this.ParseBody (), - Operand = condition, - Type = CommandType.If + Body = this.ParseBody (), + Operand = condition, + Type = CommandType.If }; current = result; @@ -541,9 +541,9 @@ private Command ParseKeywordIf () current.Next = new Command { - Body = this.ParseBody (), - Operand = condition, - Type = CommandType.If + Body = this.ParseBody (), + Operand = condition, + Type = CommandType.If }; current = current.Next; @@ -569,8 +569,8 @@ private Command ParseKeywordReturn () { return new Command { - Operand = this.ParseOperand (), - Type = CommandType.Return + Operand = this.ParseOperand (), + Type = CommandType.Return }; } @@ -581,23 +581,23 @@ private Command ParseKeywordSet () private Command ParseKeywordWhile () { - Command body; - Expression condition; + Command body; + Expression condition; condition = this.ParseExpression (); body = this.ParseBody (); return new Command { - Body = body, - Operand = condition, - Type = CommandType.While + Body = body, + Operand = condition, + Type = CommandType.While }; } private Expression ParseOperand () { - Expression expression; + Expression expression; expression = this.ParseExpression (); @@ -608,7 +608,7 @@ private Expression ParseOperand () private string ParseSymbol () { - string name; + string name; if (this.lexer.Current.Type != LexemType.Symbol) throw this.Raise ("symbol (variable name)"); @@ -622,13 +622,13 @@ private string ParseSymbol () private Expression ParseValue () { - List arguments; - List elements; - Expression expression; - int index; - Expression key; - decimal number; - Expression value; + List arguments; + List elements; + Expression expression; + int index; + Expression key; + decimal number; + Expression value; switch (this.lexer.Current.Type) { @@ -656,15 +656,15 @@ private Expression ParseValue () value = key; key = new Expression { - Type = ExpressionType.Constant, - Value = index++, + Type = ExpressionType.Constant, + Value = index++, }; } elements.Add (new ExpressionElement { - Key = key, - Value = value + Key = key, + Value = value }); if (this.lexer.Current.Type == LexemType.Comma) @@ -673,8 +673,8 @@ private Expression ParseValue () expression = new Expression { - Elements = elements.ToArray (), - Type = ExpressionType.Map + Elements = elements.ToArray (), + Type = ExpressionType.Map }; this.lexer.Next (LexerMode.Block); @@ -686,8 +686,8 @@ private Expression ParseValue () expression = new Expression { - Type = ExpressionType.Constant, - Value = 0 + Type = ExpressionType.Constant, + Value = 0 }; return this.BuildOperator (BuiltinOperators.operatorSub, expression, this.ParseValue ()); @@ -698,8 +698,8 @@ private Expression ParseValue () expression = new Expression { - Type = ExpressionType.Constant, - Value = number + Type = ExpressionType.Constant, + Value = number }; this.lexer.Next (LexerMode.Block); @@ -726,8 +726,8 @@ private Expression ParseValue () case LexemType.String: expression = new Expression { - Type = ExpressionType.Constant, - Value = this.lexer.Current.Content + Type = ExpressionType.Constant, + Value = this.lexer.Current.Content }; this.lexer.Next (LexerMode.Block); @@ -737,8 +737,8 @@ private Expression ParseValue () case LexemType.Symbol: expression = new Expression { - Type = ExpressionType.Symbol, - Value = this.lexer.Current.Content + Type = ExpressionType.Symbol, + Value = this.lexer.Current.Content }; this.lexer.Next (LexerMode.Block); @@ -765,9 +765,9 @@ private Expression ParseValue () expression = new Expression { - Source = expression, - Subscript = value, - Type = ExpressionType.Access + Source = expression, + Subscript = value, + Type = ExpressionType.Access }; break; @@ -780,13 +780,13 @@ private Expression ParseValue () expression = new Expression { - Source = expression, - Subscript = new Expression + Source = expression, + Subscript = new Expression { - Type = ExpressionType.Constant, - Value = this.lexer.Current.Content + Type = ExpressionType.Constant, + Value = this.lexer.Current.Content }, - Type = ExpressionType.Access + Type = ExpressionType.Access }; this.lexer.Next (LexerMode.Block); @@ -808,9 +808,9 @@ private Expression ParseValue () expression = new Expression { - Arguments = arguments.ToArray (), - Source = expression, - Type = ExpressionType.Invoke + Arguments = arguments.ToArray (), + Source = expression, + Type = ExpressionType.Invoke }; break; diff --git a/Cottle/src/Parsers/Post/IOptimizer.cs b/Cottle/src/Parsers/Post/IOptimizer.cs index fa938594..34d54118 100644 --- a/Cottle/src/Parsers/Post/IOptimizer.cs +++ b/Cottle/src/Parsers/Post/IOptimizer.cs @@ -6,9 +6,9 @@ interface IOptimizer { #region Methods - Command Optimize (Command command); + Command Optimize (Command command); - Expression Optimize (Expression expression); + Expression Optimize (Expression expression); #endregion } diff --git a/Cottle/src/Parsers/Post/Optimizers/ConstantInvokeOptimizer.cs b/Cottle/src/Parsers/Post/Optimizers/ConstantInvokeOptimizer.cs index 4aa62eec..b829a668 100644 --- a/Cottle/src/Parsers/Post/Optimizers/ConstantInvokeOptimizer.cs +++ b/Cottle/src/Parsers/Post/Optimizers/ConstantInvokeOptimizer.cs @@ -36,8 +36,8 @@ public override Expression Optimize (Expression expression) return new Expression { - Type = ExpressionType.Constant, - Value = function.Execute (expression.Arguments.Select( (a) => a.Value).ToList (), new SimpleStore (), new StringWriter ()) + Type = ExpressionType.Constant, + Value = function.Execute (expression.Arguments.Select( (a) => a.Value).ToList (), new SimpleStore (), new StringWriter ()) }; } diff --git a/Cottle/src/Parsers/Post/Optimizers/ConstantMapOptimizer.cs b/Cottle/src/Parsers/Post/Optimizers/ConstantMapOptimizer.cs index 12bc32f7..18904c36 100644 --- a/Cottle/src/Parsers/Post/Optimizers/ConstantMapOptimizer.cs +++ b/Cottle/src/Parsers/Post/Optimizers/ConstantMapOptimizer.cs @@ -16,7 +16,7 @@ class ConstantMapOptimizer : AbstractOptimizer #region Attributes / Instance - private static readonly Predicate constants = (e) => e.Key.Type == ExpressionType.Constant && e.Value.Type == ExpressionType.Constant; + private static readonly Predicate constants = (e) => e.Key.Type == ExpressionType.Constant && e.Value.Type == ExpressionType.Constant; #endregion @@ -24,7 +24,7 @@ class ConstantMapOptimizer : AbstractOptimizer public override Expression Optimize (Expression expression) { - KeyValuePair[] pairs; + KeyValuePair[] pairs; if (expression.Type != ExpressionType.Map || !Array.TrueForAll (expression.Elements, ConstantMapOptimizer.constants)) return expression; @@ -36,8 +36,8 @@ public override Expression Optimize (Expression expression) return new Expression { - Type = ExpressionType.Constant, - Value = pairs + Type = ExpressionType.Constant, + Value = pairs }; } diff --git a/Cottle/src/Parsers/PostParser.cs b/Cottle/src/Parsers/PostParser.cs index 2c232213..d6afcdb6 100644 --- a/Cottle/src/Parsers/PostParser.cs +++ b/Cottle/src/Parsers/PostParser.cs @@ -10,9 +10,9 @@ class PostParser : IParser { #region Attributes - private readonly IOptimizer[] optimizers; + private readonly IOptimizer[] optimizers; - private readonly IParser parser; + private readonly IParser parser; #endregion diff --git a/Cottle/src/Settings/CustomSetting.cs b/Cottle/src/Settings/CustomSetting.cs index 4837a187..3460fcb3 100644 --- a/Cottle/src/Settings/CustomSetting.cs +++ b/Cottle/src/Settings/CustomSetting.cs @@ -6,7 +6,7 @@ public sealed class CustomSetting : ISetting { #region Properties - public string BlockBegin + public string BlockBegin { get { @@ -18,7 +18,7 @@ public string BlockBegin } } - public string BlockContinue + public string BlockContinue { get { @@ -30,7 +30,7 @@ public string BlockContinue } } - public string BlockEnd + public string BlockEnd { get { @@ -42,7 +42,7 @@ public string BlockEnd } } - public char Escape + public char Escape { get { @@ -54,7 +54,7 @@ public char Escape } } - public bool Optimize + public bool Optimize { get { @@ -66,7 +66,7 @@ public bool Optimize } } - public Trimmer Trimmer + public Trimmer Trimmer { get { @@ -82,17 +82,17 @@ public Trimmer Trimmer #region Attributes - private string blockBegin = DefaultSetting.Instance.BlockBegin; + private string blockBegin = DefaultSetting.Instance.BlockBegin; - private string blockContinue = DefaultSetting.Instance.BlockContinue; + private string blockContinue = DefaultSetting.Instance.BlockContinue; - private string blockEnd = DefaultSetting.Instance.BlockEnd; + private string blockEnd = DefaultSetting.Instance.BlockEnd; - private char escape = DefaultSetting.Instance.Escape; + private char escape = DefaultSetting.Instance.Escape; - private bool optimize = DefaultSetting.Instance.Optimize; + private bool optimize = DefaultSetting.Instance.Optimize; - private Trimmer trimmer = DefaultSetting.Instance.Trimmer; + private Trimmer trimmer = DefaultSetting.Instance.Trimmer; #endregion } diff --git a/Cottle/src/Settings/DefaultSetting.cs b/Cottle/src/Settings/DefaultSetting.cs index 4d7066d8..356c05dd 100644 --- a/Cottle/src/Settings/DefaultSetting.cs +++ b/Cottle/src/Settings/DefaultSetting.cs @@ -6,7 +6,7 @@ public sealed class DefaultSetting : ISetting { #region Properties / Instance - public string BlockBegin + public string BlockBegin { get { @@ -14,7 +14,7 @@ public string BlockBegin } } - public string BlockContinue + public string BlockContinue { get { @@ -22,7 +22,7 @@ public string BlockContinue } } - public string BlockEnd + public string BlockEnd { get { @@ -30,7 +30,7 @@ public string BlockEnd } } - public char Escape + public char Escape { get { @@ -38,7 +38,7 @@ public char Escape } } - public bool Optimize + public bool Optimize { get { @@ -46,7 +46,7 @@ public bool Optimize } } - public Trimmer Trimmer + public Trimmer Trimmer { get { @@ -58,7 +58,7 @@ public Trimmer Trimmer #region Properties / Static - public static DefaultSetting Instance + public static DefaultSetting Instance { get { @@ -70,7 +70,7 @@ public static DefaultSetting Instance #region Attributes - private static readonly DefaultSetting instance = new DefaultSetting (); + private static readonly DefaultSetting instance = new DefaultSetting (); #endregion } diff --git a/Cottle/src/Stores/AbstractStore.cs b/Cottle/src/Stores/AbstractStore.cs index 42af98f5..3ebd46f8 100644 --- a/Cottle/src/Stores/AbstractStore.cs +++ b/Cottle/src/Stores/AbstractStore.cs @@ -11,7 +11,7 @@ public abstract class AbstractStore : IStore { get { - Value value; + Value value; if (this.TryGet (symbol, out value)) return value; diff --git a/Cottle/src/Stores/BuiltinStore.cs b/Cottle/src/Stores/BuiltinStore.cs index 0688bc01..12281668 100644 --- a/Cottle/src/Stores/BuiltinStore.cs +++ b/Cottle/src/Stores/BuiltinStore.cs @@ -15,9 +15,9 @@ public sealed class BuiltinStore : AbstractStore #region Attributes / Static - private static volatile IStore constant = null; + private static volatile IStore constant = null; - private static readonly object mutex = new object (); + private static readonly object mutex = new object (); #endregion @@ -58,7 +58,7 @@ public override bool TryGet (Value symbol, out Value value) private static IStore GetConstant () { - IStore store; + IStore store; if (BuiltinStore.constant == null) { diff --git a/Cottle/src/Stores/FallbackStore.cs b/Cottle/src/Stores/FallbackStore.cs index a3619ac4..0c630692 100644 --- a/Cottle/src/Stores/FallbackStore.cs +++ b/Cottle/src/Stores/FallbackStore.cs @@ -26,9 +26,9 @@ public IStore Mutable #region Attributes - private readonly IStore constant; + private readonly IStore constant; - private readonly IStore mutable; + private readonly IStore mutable; #endregion diff --git a/Cottle/src/Stores/SimpleStore.cs b/Cottle/src/Stores/SimpleStore.cs index bd062046..39de1671 100644 --- a/Cottle/src/Stores/SimpleStore.cs +++ b/Cottle/src/Stores/SimpleStore.cs @@ -7,9 +7,9 @@ public sealed class SimpleStore : AbstractStore { #region Attributes - private readonly Stack> levels; + private readonly Stack> levels; - private readonly Dictionary> stacks; + private readonly Dictionary> stacks; #endregion @@ -32,7 +32,7 @@ public override void Enter () public override bool Leave () { - Stack stack; + Stack stack; if (this.levels.Count < 1) return false; @@ -53,7 +53,7 @@ public override bool Leave () public override void Set (Value symbol, Value value, StoreMode mode) { - Stack stack; + Stack stack; if (!this.stacks.TryGetValue (symbol, out stack)) { @@ -82,7 +82,7 @@ public override void Set (Value symbol, Value value, StoreMode mode) public override bool TryGet (Value symbol, out Value value) { - Stack stack; + Stack stack; if (this.stacks.TryGetValue (symbol, out stack) && stack.Count > 0) { diff --git a/Cottle/src/Value.cs b/Cottle/src/Value.cs index 32608c52..b625e3b2 100644 --- a/Cottle/src/Value.cs +++ b/Cottle/src/Value.cs @@ -9,32 +9,32 @@ public abstract class Value : IComparable, IEquatable { #region Properties - public abstract bool AsBoolean + public abstract bool AsBoolean { get; } - public abstract IFunction AsFunction + public abstract IFunction AsFunction { get; } - public abstract decimal AsNumber + public abstract decimal AsNumber { get; } - public abstract string AsString + public abstract string AsString { get; } - public abstract IMap Fields + public abstract IMap Fields { get; } - public abstract ValueContent Type + public abstract ValueContent Type { get; } @@ -225,7 +225,7 @@ public virtual bool Equals (Value other) public override bool Equals (object obj) { - Value other = obj as Value; + Value other = obj as Value; return other != null && this.CompareTo (other) == 0; } diff --git a/Cottle/src/ValueContent.cs b/Cottle/src/ValueContent.cs index 42377f6f..9a6d6177 100644 --- a/Cottle/src/ValueContent.cs +++ b/Cottle/src/ValueContent.cs @@ -4,11 +4,11 @@ namespace Cottle { public enum ValueContent { - Boolean = 1, - Function = 2, - Map = 0, - Number = 3, - String = 4, - Void = 5 + Boolean = 1, + Function = 2, + Map = 0, + Number = 3, + String = 4, + Void = 5 } } diff --git a/Cottle/src/Values/BooleanValue.cs b/Cottle/src/Values/BooleanValue.cs index 1bb4f6d4..35d16165 100644 --- a/Cottle/src/Values/BooleanValue.cs +++ b/Cottle/src/Values/BooleanValue.cs @@ -13,7 +13,7 @@ public sealed class BooleanValue : ScalarValue #region Properties - public override bool AsBoolean + public override bool AsBoolean { get { @@ -21,7 +21,7 @@ public override bool AsBoolean } } - public override decimal AsNumber + public override decimal AsNumber { get { @@ -29,7 +29,7 @@ public override decimal AsNumber } } - public override string AsString + public override string AsString { get { @@ -37,7 +37,7 @@ public override string AsString } } - public override ValueContent Type + public override ValueContent Type { get { @@ -49,7 +49,7 @@ public override ValueContent Type #region Constructors - public BooleanValue (bool value) : + public BooleanValue (bool value) : base (value, (source) => source.AsBoolean) { } @@ -58,7 +58,7 @@ public override ValueContent Type #region Methods - public override string ToString () + public override string ToString () { return this.value ? "" : ""; } diff --git a/Cottle/src/Values/FunctionValue.cs b/Cottle/src/Values/FunctionValue.cs index 278b0069..b88d23e8 100644 --- a/Cottle/src/Values/FunctionValue.cs +++ b/Cottle/src/Values/FunctionValue.cs @@ -6,7 +6,7 @@ public sealed class FunctionValue : Value { #region Properties - public override bool AsBoolean + public override bool AsBoolean { get { @@ -14,7 +14,7 @@ public override bool AsBoolean } } - public override IFunction AsFunction + public override IFunction AsFunction { get { @@ -22,7 +22,7 @@ public override IFunction AsFunction } } - public override decimal AsNumber + public override decimal AsNumber { get { @@ -30,7 +30,7 @@ public override decimal AsNumber } } - public override string AsString + public override string AsString { get { @@ -38,7 +38,7 @@ public override string AsString } } - public override IMap Fields + public override IMap Fields { get { @@ -46,7 +46,7 @@ public override IMap Fields } } - public override ValueContent Type + public override ValueContent Type { get { @@ -58,13 +58,13 @@ public override ValueContent Type #region Attributes - private readonly IFunction function; + private readonly IFunction function; #endregion #region Constructors - public FunctionValue (IFunction function) + public FunctionValue (IFunction function) { this.function = function; } diff --git a/Cottle/src/Values/LazyValue.cs b/Cottle/src/Values/LazyValue.cs index f5c08886..1ab01d8f 100644 --- a/Cottle/src/Values/LazyValue.cs +++ b/Cottle/src/Values/LazyValue.cs @@ -6,7 +6,7 @@ public sealed class LazyValue : ResolveValue { #region Attributes - private readonly Func resolver; + private readonly Func resolver; #endregion diff --git a/Cottle/src/Values/MapValue.cs b/Cottle/src/Values/MapValue.cs index a635e159..9e3a1437 100644 --- a/Cottle/src/Values/MapValue.cs +++ b/Cottle/src/Values/MapValue.cs @@ -10,7 +10,7 @@ public sealed class MapValue : Value { #region Properties / Instance - public override bool AsBoolean + public override bool AsBoolean { get { @@ -18,7 +18,7 @@ public override bool AsBoolean } } - public override IFunction AsFunction + public override IFunction AsFunction { get { @@ -26,7 +26,7 @@ public override IFunction AsFunction } } - public override decimal AsNumber + public override decimal AsNumber { get { @@ -34,7 +34,7 @@ public override decimal AsNumber } } - public override string AsString + public override string AsString { get { @@ -42,7 +42,7 @@ public override string AsString } } - public override IMap Fields + public override IMap Fields { get { @@ -50,7 +50,7 @@ public override IMap Fields } } - public override ValueContent Type + public override ValueContent Type { get { @@ -62,7 +62,7 @@ public override ValueContent Type #region Properties / Static - public static MapValue Empty + public static MapValue Empty { get { @@ -74,13 +74,13 @@ public static MapValue Empty #region Attributes / Instance - private readonly IMap fields; + private readonly IMap fields; #endregion #region Attributes / Static - private static readonly MapValue empty = new MapValue (); + private static readonly MapValue empty = new MapValue (); #endregion @@ -131,10 +131,10 @@ public override int GetHashCode () return this.fields.GetHashCode (); } - public override string ToString () + public override string ToString () { - StringBuilder builder; - bool separator; + StringBuilder builder; + bool separator; builder = new StringBuilder (); builder.Append ('['); diff --git a/Cottle/src/Values/NumberValue.cs b/Cottle/src/Values/NumberValue.cs index 7ed1b828..081483bf 100644 --- a/Cottle/src/Values/NumberValue.cs +++ b/Cottle/src/Values/NumberValue.cs @@ -6,7 +6,7 @@ public sealed class NumberValue : ScalarValue { #region Properties - public override bool AsBoolean + public override bool AsBoolean { get { @@ -14,7 +14,7 @@ public override bool AsBoolean } } - public override decimal AsNumber + public override decimal AsNumber { get { @@ -22,7 +22,7 @@ public override decimal AsNumber } } - public override string AsString + public override string AsString { get { @@ -30,7 +30,7 @@ public override string AsString } } - public override ValueContent Type + public override ValueContent Type { get { @@ -42,37 +42,37 @@ public override ValueContent Type #region Constructors / Public - public NumberValue (byte value) : + public NumberValue (byte value) : this ((decimal)value) { } - public NumberValue (decimal value) : + public NumberValue (decimal value) : base (value, (source) => source.AsNumber) { } - public NumberValue (double value) : + public NumberValue (double value) : this ((decimal)value) { } - public NumberValue (float value) : + public NumberValue (float value) : this ((decimal)value) { } - public NumberValue (int value) : + public NumberValue (int value) : this ((decimal)value) { } - public NumberValue (long value) : + public NumberValue (long value) : this ((decimal)value) { } - public NumberValue (short value) : + public NumberValue (short value) : this ((decimal)value) { } @@ -81,7 +81,7 @@ public override ValueContent Type #region Methods - public override string ToString () + public override string ToString () { return this.value.ToString (CultureInfo.InvariantCulture); } diff --git a/Cottle/src/Values/ReflectionValue.cs b/Cottle/src/Values/ReflectionValue.cs index 5ee45910..f1020e61 100644 --- a/Cottle/src/Values/ReflectionValue.cs +++ b/Cottle/src/Values/ReflectionValue.cs @@ -9,15 +9,15 @@ public sealed class ReflectionValue : ResolveValue { #region Attributes / Instance - private readonly BindingFlags binding; + private readonly BindingFlags binding; - private readonly object source; + private readonly object source; #endregion #region Attributes / Static - private static readonly Dictionary converters = new Dictionary + private static readonly Dictionary converters = new Dictionary { {typeof (bool), (s) => (bool)s}, {typeof (byte), (s) => (byte)s}, @@ -35,13 +35,13 @@ public sealed class ReflectionValue : ResolveValue {typeof (ushort), (s) => (ushort)s} }; - private static readonly Dictionary> readers = new Dictionary> (); + private static readonly Dictionary> readers = new Dictionary> (); #endregion #region Constructors - public ReflectionValue (object source, BindingFlags binding) + public ReflectionValue (object source, BindingFlags binding) { if (source == null) throw new ArgumentNullException ("source"); @@ -50,7 +50,7 @@ public ReflectionValue (object source, BindingFlags binding) this.source = source; } - public ReflectionValue (object source) : + public ReflectionValue (object source) : this (source, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) { } @@ -59,13 +59,13 @@ public ReflectionValue (object source, BindingFlags binding) #region Methods - protected override Value Resolve () + protected override Value Resolve () { - ValueConverter converter; - List elements; - Dictionary fields; - List reader; - Type type; + ValueConverter converter; + List elements; + Dictionary fields; + List reader; + Type type; type = this.source.GetType (); @@ -121,11 +121,11 @@ protected override Value Resolve () #region Types - private struct MemberReader + private struct MemberReader { #region Properties - public string Name + public string Name { get { @@ -137,26 +137,26 @@ public string Name #region Attributes - private readonly BindingFlags binding; + private readonly BindingFlags binding; - private readonly Func extractor; + private readonly Func extractor; - private readonly string name; + private readonly string name; #endregion #region Constructors - public MemberReader (FieldInfo field, BindingFlags binding) + public MemberReader (FieldInfo field, BindingFlags binding) { this.binding = binding; this.extractor = field.GetValue; this.name = field.Name; } - public MemberReader (PropertyInfo property, BindingFlags binding) + public MemberReader (PropertyInfo property, BindingFlags binding) { - MethodInfo method; + MethodInfo method; method = property.GetGetMethod (true); @@ -169,9 +169,9 @@ public MemberReader (PropertyInfo property, BindingFlags binding) #region Methods - public Value Extract (object source) + public Value Extract (object source) { - object value; + object value; value = this.extractor (source); @@ -184,7 +184,7 @@ public Value Extract (object source) #endregion } - private delegate Value ValueConverter (object source); + private delegate Value ValueConverter (object source); #endregion } diff --git a/Cottle/src/Values/ResolveValue.cs b/Cottle/src/Values/ResolveValue.cs index 5e616905..05d6a23b 100644 --- a/Cottle/src/Values/ResolveValue.cs +++ b/Cottle/src/Values/ResolveValue.cs @@ -6,7 +6,7 @@ public abstract class ResolveValue : Value { #region Properties - public override bool AsBoolean + public override bool AsBoolean { get { @@ -14,7 +14,7 @@ public override bool AsBoolean } } - public override IFunction AsFunction + public override IFunction AsFunction { get { @@ -22,7 +22,7 @@ public override IFunction AsFunction } } - public override decimal AsNumber + public override decimal AsNumber { get { @@ -30,7 +30,7 @@ public override decimal AsNumber } } - public override string AsString + public override string AsString { get { @@ -38,7 +38,7 @@ public override string AsString } } - public override IMap Fields + public override IMap Fields { get { @@ -46,7 +46,7 @@ public override IMap Fields } } - public override ValueContent Type + public override ValueContent Type { get { @@ -58,15 +58,15 @@ public override ValueContent Type #region Attributes - private readonly object mutex = new object (); + private readonly object mutex = new object (); - private Value value = null; + private Value value = null; #endregion #region Methods / Abstract - protected abstract Value Resolve (); + protected abstract Value Resolve (); #endregion @@ -82,7 +82,7 @@ public override int GetHashCode () return this.Acquire ().GetHashCode (); } - public override string ToString () + public override string ToString () { return this.Acquire ().ToString (); } diff --git a/Cottle/src/Values/ScalarValue.cs b/Cottle/src/Values/ScalarValue.cs index 766252ec..ca24d6e6 100644 --- a/Cottle/src/Values/ScalarValue.cs +++ b/Cottle/src/Values/ScalarValue.cs @@ -9,7 +9,7 @@ public abstract class ScalarValue : Value where { #region Properties - public override IFunction AsFunction + public override IFunction AsFunction { get { @@ -17,7 +17,7 @@ public override IFunction AsFunction } } - public override IMap Fields + public override IMap Fields { get { @@ -29,9 +29,9 @@ public override IMap Fields #region Attributes - protected readonly Converter converter; + protected readonly Converter converter; - protected readonly T value; + protected readonly T value; #endregion diff --git a/Cottle/src/Values/StringValue.cs b/Cottle/src/Values/StringValue.cs index 50cf67d8..5cb541e6 100644 --- a/Cottle/src/Values/StringValue.cs +++ b/Cottle/src/Values/StringValue.cs @@ -7,7 +7,7 @@ public sealed class StringValue : ScalarValue { #region Properties - public override bool AsBoolean + public override bool AsBoolean { get { @@ -15,7 +15,7 @@ public override bool AsBoolean } } - public override decimal AsNumber + public override decimal AsNumber { get { @@ -25,7 +25,7 @@ public override decimal AsNumber } } - public override string AsString + public override string AsString { get { @@ -33,7 +33,7 @@ public override string AsString } } - public override ValueContent Type + public override ValueContent Type { get { @@ -45,12 +45,12 @@ public override ValueContent Type #region Constructors - public StringValue (string value) : + public StringValue (string value) : base (value, (source) => source.AsString) { } - public StringValue (char value) : + public StringValue (char value) : this (value.ToString ()) { } @@ -59,9 +59,9 @@ public override ValueContent Type #region Methods - public override string ToString () + public override string ToString () { - StringBuilder builder; + StringBuilder builder; builder = new StringBuilder (); builder.Append ('"'); diff --git a/Cottle/src/Values/VoidValue.cs b/Cottle/src/Values/VoidValue.cs index c8793c87..53a4ed6b 100644 --- a/Cottle/src/Values/VoidValue.cs +++ b/Cottle/src/Values/VoidValue.cs @@ -6,7 +6,7 @@ public sealed class VoidValue : Value { #region Properties - public override bool AsBoolean + public override bool AsBoolean { get { @@ -14,7 +14,7 @@ public override bool AsBoolean } } - public override IFunction AsFunction + public override IFunction AsFunction { get { @@ -22,7 +22,7 @@ public override IFunction AsFunction } } - public override decimal AsNumber + public override decimal AsNumber { get { @@ -30,7 +30,7 @@ public override decimal AsNumber } } - public override string AsString + public override string AsString { get { @@ -38,7 +38,7 @@ public override string AsString } } - public override IMap Fields + public override IMap Fields { get { @@ -46,7 +46,7 @@ public override IMap Fields } } - public override ValueContent Type + public override ValueContent Type { get { @@ -58,7 +58,7 @@ public override ValueContent Type #region Properties / Static - public static VoidValue Instance + public static VoidValue Instance { get { @@ -70,7 +70,7 @@ public static VoidValue Instance #region Attributes - private static readonly VoidValue instance = new VoidValue (); + private static readonly VoidValue instance = new VoidValue (); #endregion @@ -92,7 +92,7 @@ public override int GetHashCode () return 0; } - public override string ToString () + public override string ToString () { return ""; }