Decompiled source of JSON and CSV Loader Nightly v0.1.5

plugins\Dependencies\Configils-Required-Dependencies\Antlr3.Runtime.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using Antlr.Runtime.Debug;
using Antlr.Runtime.Misc;
using Antlr.Runtime.Tree;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Antlr3.Runtime")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Tunnel Vision Laboratories, LLC")]
[assembly: AssemblyProduct("Antlr3.Runtime")]
[assembly: AssemblyCopyright("Copyright © Sam Harwell 2013")]
[assembly: AssemblyTrademark("")]
[assembly: CLSCompliant(true)]
[assembly: AllowPartiallyTrustedCallers]
[assembly: ComVisible(false)]
[assembly: Guid("7a0b4db7-f127-4cf5-ac2c-e294957efcd6")]
[assembly: AssemblyFileVersion("3.5.1.0")]
[assembly: AssemblyInformationalVersion("3.5.1")]
[assembly: AssemblyVersion("3.5.0.2")]
namespace Antlr.Runtime
{
	[Serializable]
	[FileIOPermission(SecurityAction.Demand, Unrestricted = true)]
	public class ANTLRFileStream : ANTLRStringStream
	{
		protected string fileName;

		public override string SourceName => fileName;

		public ANTLRFileStream(string fileName)
			: this(fileName, null)
		{
		}

		public ANTLRFileStream(string fileName, Encoding encoding)
		{
			this.fileName = fileName;
			Load(fileName, encoding);
		}

		public virtual void Load(string fileName, Encoding encoding)
		{
			if (fileName != null)
			{
				string text = ((encoding != null) ? File.ReadAllText(fileName, encoding) : File.ReadAllText(fileName));
				data = text.ToCharArray();
				n = data.Length;
			}
		}
	}
	[Serializable]
	public class ANTLRInputStream : ANTLRReaderStream
	{
		public ANTLRInputStream(Stream input)
			: this(input, null)
		{
		}

		public ANTLRInputStream(Stream input, int size)
			: this(input, size, null)
		{
		}

		public ANTLRInputStream(Stream input, Encoding encoding)
			: this(input, 1024, encoding)
		{
		}

		public ANTLRInputStream(Stream input, int size, Encoding encoding)
			: this(input, size, 1024, encoding)
		{
		}

		public ANTLRInputStream(Stream input, int size, int readBufferSize, Encoding encoding)
			: base(GetStreamReader(input, encoding), size, readBufferSize)
		{
		}

		private static StreamReader GetStreamReader(Stream input, Encoding encoding)
		{
			if (encoding != null)
			{
				return new StreamReader(input, encoding);
			}
			return new StreamReader(input);
		}
	}
	[Serializable]
	public class ANTLRReaderStream : ANTLRStringStream
	{
		public const int ReadBufferSize = 1024;

		public const int InitialBufferSize = 1024;

		public ANTLRReaderStream(TextReader r)
			: this(r, 1024, 1024)
		{
		}

		public ANTLRReaderStream(TextReader r, int size)
			: this(r, size, 1024)
		{
		}

		public ANTLRReaderStream(TextReader r, int size, int readChunkSize)
		{
			Load(r, size, readChunkSize);
		}

		public virtual void Load(TextReader r, int size, int readChunkSize)
		{
			if (r == null)
			{
				return;
			}
			if (size <= 0)
			{
				size = 1024;
			}
			if (readChunkSize <= 0)
			{
				readChunkSize = 1024;
			}
			try
			{
				data = r.ReadToEnd().ToCharArray();
				n = data.Length;
			}
			finally
			{
				r.Dispose();
			}
		}
	}
	[Serializable]
	public class ANTLRStringStream : ICharStream, IIntStream
	{
		protected char[] data;

		protected int n;

		protected int p;

		private int line = 1;

		private int charPositionInLine;

		protected int markDepth;

		protected IList<CharStreamState> markers;

		protected int lastMarker;

		public string name;

		public virtual int Index => p;

		public virtual int Line
		{
			get
			{
				return line;
			}
			set
			{
				line = value;
			}
		}

		public virtual int CharPositionInLine
		{
			get
			{
				return charPositionInLine;
			}
			set
			{
				charPositionInLine = value;
			}
		}

		public virtual int Count => n;

		public virtual string SourceName => name;

		public ANTLRStringStream(string input)
			: this(input, null)
		{
		}

		public ANTLRStringStream(string input, string sourceName)
			: this(input.ToCharArray(), input.Length, sourceName)
		{
		}

		public ANTLRStringStream(char[] data, int numberOfActualCharsInArray)
			: this(data, numberOfActualCharsInArray, null)
		{
		}

		public ANTLRStringStream(char[] data, int numberOfActualCharsInArray, string sourceName)
		{
			if (data == null)
			{
				throw new ArgumentNullException("data");
			}
			if (numberOfActualCharsInArray < 0)
			{
				throw new ArgumentOutOfRangeException();
			}
			if (numberOfActualCharsInArray > data.Length)
			{
				throw new ArgumentException();
			}
			this.data = data;
			n = numberOfActualCharsInArray;
			name = sourceName;
		}

		protected ANTLRStringStream()
		{
			data = new char[0];
		}

		public virtual void Reset()
		{
			p = 0;
			line = 1;
			charPositionInLine = 0;
			markDepth = 0;
		}

		public virtual void Consume()
		{
			if (p < n)
			{
				charPositionInLine++;
				if (data[p] == '\n')
				{
					line++;
					charPositionInLine = 0;
				}
				p++;
			}
		}

		public virtual int LA(int i)
		{
			if (i == 0)
			{
				return 0;
			}
			if (i < 0)
			{
				i++;
				if (p + i - 1 < 0)
				{
					return -1;
				}
			}
			if (p + i - 1 >= n)
			{
				return -1;
			}
			return data[p + i - 1];
		}

		public virtual int LT(int i)
		{
			return LA(i);
		}

		public virtual int Mark()
		{
			if (markers == null)
			{
				markers = new List<CharStreamState>();
				markers.Add(null);
			}
			markDepth++;
			CharStreamState charStreamState = null;
			if (markDepth >= markers.Count)
			{
				charStreamState = new CharStreamState();
				markers.Add(charStreamState);
			}
			else
			{
				charStreamState = markers[markDepth];
			}
			charStreamState.p = Index;
			charStreamState.line = Line;
			charStreamState.charPositionInLine = CharPositionInLine;
			lastMarker = markDepth;
			return markDepth;
		}

		public virtual void Rewind(int m)
		{
			if (m < 0)
			{
				throw new ArgumentOutOfRangeException();
			}
			CharStreamState charStreamState = markers[m];
			Seek(charStreamState.p);
			line = charStreamState.line;
			charPositionInLine = charStreamState.charPositionInLine;
			Release(m);
		}

		public virtual void Rewind()
		{
			Rewind(lastMarker);
		}

		public virtual void Release(int marker)
		{
			markDepth = marker;
			markDepth--;
		}

		public virtual void Seek(int index)
		{
			if (index <= p)
			{
				p = index;
				return;
			}
			while (p < index)
			{
				Consume();
			}
		}

		public virtual string Substring(int start, int length)
		{
			if (start < 0)
			{
				throw new ArgumentOutOfRangeException();
			}
			if (length < 0)
			{
				throw new ArgumentOutOfRangeException();
			}
			if (start + length > data.Length)
			{
				throw new ArgumentException();
			}
			if (length == 0)
			{
				return string.Empty;
			}
			return new string(data, start, length);
		}

		public override string ToString()
		{
			return new string(data);
		}
	}
	public class AstParserRuleReturnScope<TTree, TToken> : ParserRuleReturnScope<TToken>, IAstRuleReturnScope<TTree>, IAstRuleReturnScope, IRuleReturnScope
	{
		private TTree _tree;

		public TTree Tree
		{
			get
			{
				return _tree;
			}
			set
			{
				_tree = value;
			}
		}

		object IAstRuleReturnScope.Tree => Tree;
	}
	public abstract class BaseRecognizer
	{
		public const int MemoRuleFailed = -2;

		public const int MemoRuleUnknown = -1;

		public const int InitialFollowStackSize = 100;

		public const int DefaultTokenChannel = 0;

		public const int Hidden = 99;

		public const string NextTokenRuleName = "nextToken";

		protected internal RecognizerSharedState state;

		public TextWriter TraceDestination { get; set; }

		public virtual int NumberOfSyntaxErrors => state.syntaxErrors;

		public virtual int BacktrackingLevel
		{
			get
			{
				return state.backtracking;
			}
			set
			{
				state.backtracking = value;
			}
		}

		public virtual bool Failed => state.failed;

		public virtual string[] TokenNames => null;

		public virtual string GrammarFileName => null;

		public abstract string SourceName { get; }

		public virtual IDebugEventListener DebugListener => null;

		public BaseRecognizer()
			: this(new RecognizerSharedState())
		{
		}

		public BaseRecognizer(RecognizerSharedState state)
		{
			if (state == null)
			{
				state = new RecognizerSharedState();
			}
			this.state = state;
			InitDFAs();
		}

		public virtual void SetState(RecognizerSharedState value)
		{
			state = value;
		}

		protected virtual void InitDFAs()
		{
		}

		public virtual void Reset()
		{
			if (state != null)
			{
				state._fsp = -1;
				state.errorRecovery = false;
				state.lastErrorIndex = -1;
				state.failed = false;
				state.syntaxErrors = 0;
				state.backtracking = 0;
				int num = 0;
				while (state.ruleMemo != null && num < state.ruleMemo.Length)
				{
					state.ruleMemo[num] = null;
					num++;
				}
			}
		}

		public virtual object Match(IIntStream input, int ttype, BitSet follow)
		{
			object currentInputSymbol = GetCurrentInputSymbol(input);
			if (input.LA(1) == ttype)
			{
				input.Consume();
				state.errorRecovery = false;
				state.failed = false;
				return currentInputSymbol;
			}
			if (state.backtracking > 0)
			{
				state.failed = true;
				return currentInputSymbol;
			}
			return RecoverFromMismatchedToken(input, ttype, follow);
		}

		public virtual void MatchAny(IIntStream input)
		{
			state.errorRecovery = false;
			state.failed = false;
			input.Consume();
		}

		public virtual bool MismatchIsUnwantedToken(IIntStream input, int ttype)
		{
			return input.LA(2) == ttype;
		}

		public virtual bool MismatchIsMissingToken(IIntStream input, BitSet follow)
		{
			if (follow == null)
			{
				return false;
			}
			if (follow.Member(1))
			{
				BitSet a = ComputeContextSensitiveRuleFOLLOW();
				follow = follow.Or(a);
				if (state._fsp >= 0)
				{
					follow.Remove(1);
				}
			}
			if (follow.Member(input.LA(1)) || follow.Member(1))
			{
				return true;
			}
			return false;
		}

		public virtual void ReportError(RecognitionException e)
		{
			if (!state.errorRecovery)
			{
				state.syntaxErrors++;
				state.errorRecovery = true;
				DisplayRecognitionError(TokenNames, e);
			}
		}

		public virtual void DisplayRecognitionError(string[] tokenNames, RecognitionException e)
		{
			string errorHeader = GetErrorHeader(e);
			string errorMessage = GetErrorMessage(e, tokenNames);
			EmitErrorMessage(errorHeader + " " + errorMessage);
		}

		public virtual string GetErrorMessage(RecognitionException e, string[] tokenNames)
		{
			string result = e.Message;
			if (e is UnwantedTokenException)
			{
				UnwantedTokenException ex = (UnwantedTokenException)e;
				string text = "<unknown>";
				result = string.Concat(str3: (ex.Expecting != -1) ? tokenNames[ex.Expecting] : "EndOfFile", str0: "extraneous input ", str1: GetTokenErrorDisplay(ex.UnexpectedToken), str2: " expecting ");
			}
			else if (e is MissingTokenException)
			{
				MissingTokenException ex2 = (MissingTokenException)e;
				string text2 = "<unknown>";
				text2 = ((ex2.Expecting != -1) ? tokenNames[ex2.Expecting] : "EndOfFile");
				result = "missing " + text2 + " at " + GetTokenErrorDisplay(e.Token);
			}
			else if (e is MismatchedTokenException)
			{
				MismatchedTokenException ex3 = (MismatchedTokenException)e;
				string text3 = "<unknown>";
				result = string.Concat(str3: (ex3.Expecting != -1) ? tokenNames[ex3.Expecting] : "EndOfFile", str0: "mismatched input ", str1: GetTokenErrorDisplay(e.Token), str2: " expecting ");
			}
			else if (e is MismatchedTreeNodeException)
			{
				MismatchedTreeNodeException ex4 = (MismatchedTreeNodeException)e;
				string text4 = "<unknown>";
				text4 = ((ex4.Expecting != -1) ? tokenNames[ex4.Expecting] : "EndOfFile");
				string text5 = ((ex4.Node != null) ? (ex4.Node.ToString() ?? string.Empty) : string.Empty);
				result = "mismatched tree node: " + text5 + " expecting " + text4;
			}
			else if (e is NoViableAltException)
			{
				result = "no viable alternative at input " + GetTokenErrorDisplay(e.Token);
			}
			else if (e is EarlyExitException)
			{
				result = "required (...)+ loop did not match anything at input " + GetTokenErrorDisplay(e.Token);
			}
			else if (e is MismatchedSetException)
			{
				MismatchedSetException ex5 = (MismatchedSetException)e;
				result = "mismatched input " + GetTokenErrorDisplay(e.Token) + " expecting set " + ex5.Expecting;
			}
			else if (e is MismatchedNotSetException)
			{
				MismatchedNotSetException ex6 = (MismatchedNotSetException)e;
				result = "mismatched input " + GetTokenErrorDisplay(e.Token) + " expecting set " + ex6.Expecting;
			}
			else if (e is FailedPredicateException)
			{
				FailedPredicateException ex7 = (FailedPredicateException)e;
				result = "rule " + ex7.RuleName + " failed predicate: {" + ex7.PredicateText + "}?";
			}
			return result;
		}

		public virtual string GetErrorHeader(RecognitionException e)
		{
			string text = SourceName ?? string.Empty;
			if (text.Length > 0)
			{
				text += " ";
			}
			return $"{text}line {e.Line}:{e.CharPositionInLine + 1}";
		}

		public virtual string GetTokenErrorDisplay(IToken t)
		{
			string text = t.Text;
			if (text == null)
			{
				text = ((t.Type != -1) ? ("<" + t.Type + ">") : "<EOF>");
			}
			text = Regex.Replace(text, "\n", "\\\\n");
			text = Regex.Replace(text, "\r", "\\\\r");
			text = Regex.Replace(text, "\t", "\\\\t");
			return "'" + text + "'";
		}

		public virtual void EmitErrorMessage(string msg)
		{
			if (TraceDestination != null)
			{
				TraceDestination.WriteLine(msg);
			}
		}

		public virtual void Recover(IIntStream input, RecognitionException re)
		{
			if (state.lastErrorIndex == input.Index)
			{
				input.Consume();
			}
			state.lastErrorIndex = input.Index;
			BitSet set = ComputeErrorRecoverySet();
			BeginResync();
			ConsumeUntil(input, set);
			EndResync();
		}

		public virtual void BeginResync()
		{
		}

		public virtual void EndResync()
		{
		}

		protected virtual BitSet ComputeErrorRecoverySet()
		{
			return CombineFollows(exact: false);
		}

		protected virtual BitSet ComputeContextSensitiveRuleFOLLOW()
		{
			return CombineFollows(exact: true);
		}

		protected virtual BitSet CombineFollows(bool exact)
		{
			int fsp = state._fsp;
			BitSet bitSet = new BitSet();
			for (int num = fsp; num >= 0; num--)
			{
				BitSet bitSet2 = state.following[num];
				bitSet.OrInPlace(bitSet2);
				if (exact)
				{
					if (!bitSet2.Member(1))
					{
						break;
					}
					if (num > 0)
					{
						bitSet.Remove(1);
					}
				}
			}
			return bitSet;
		}

		protected virtual object RecoverFromMismatchedToken(IIntStream input, int ttype, BitSet follow)
		{
			RecognitionException e = null;
			if (MismatchIsUnwantedToken(input, ttype))
			{
				e = new UnwantedTokenException(ttype, input, TokenNames);
				BeginResync();
				input.Consume();
				EndResync();
				ReportError(e);
				object currentInputSymbol = GetCurrentInputSymbol(input);
				input.Consume();
				return currentInputSymbol;
			}
			if (MismatchIsMissingToken(input, follow))
			{
				object missingSymbol = GetMissingSymbol(input, e, ttype, follow);
				e = new MissingTokenException(ttype, input, missingSymbol);
				ReportError(e);
				return missingSymbol;
			}
			e = new MismatchedTokenException(ttype, input, TokenNames);
			throw e;
		}

		public virtual object RecoverFromMismatchedSet(IIntStream input, RecognitionException e, BitSet follow)
		{
			if (MismatchIsMissingToken(input, follow))
			{
				ReportError(e);
				return GetMissingSymbol(input, e, 0, follow);
			}
			throw e;
		}

		protected virtual object GetCurrentInputSymbol(IIntStream input)
		{
			return null;
		}

		protected virtual object GetMissingSymbol(IIntStream input, RecognitionException e, int expectedTokenType, BitSet follow)
		{
			return null;
		}

		public virtual void ConsumeUntil(IIntStream input, int tokenType)
		{
			int num = input.LA(1);
			while (num != -1 && num != tokenType)
			{
				input.Consume();
				num = input.LA(1);
			}
		}

		public virtual void ConsumeUntil(IIntStream input, BitSet set)
		{
			int num = input.LA(1);
			while (num != -1 && !set.Member(num))
			{
				input.Consume();
				num = input.LA(1);
			}
		}

		protected void PushFollow(BitSet fset)
		{
			if (state._fsp + 1 >= state.following.Length)
			{
				Array.Resize(ref state.following, state.following.Length * 2);
			}
			state.following[++state._fsp] = fset;
		}

		protected void PopFollow()
		{
			state._fsp--;
		}

		public virtual IList<string> GetRuleInvocationStack()
		{
			return GetRuleInvocationStack(new StackTrace(fNeedFileInfo: true));
		}

		public static IList<string> GetRuleInvocationStack(StackTrace trace)
		{
			if (trace == null)
			{
				throw new ArgumentNullException("trace");
			}
			List<string> list = new List<string>();
			StackFrame[] array = trace.GetFrames() ?? new StackFrame[0];
			for (int num = array.Length - 1; num >= 0; num--)
			{
				GrammarRuleAttribute[] array2 = (GrammarRuleAttribute[])array[num].GetMethod().GetCustomAttributes(typeof(GrammarRuleAttribute), inherit: true);
				if (array2 != null && array2.Length != 0)
				{
					list.Add(array2[0].Name);
				}
			}
			return list;
		}

		public virtual List<string> ToStrings(ICollection<IToken> tokens)
		{
			if (tokens == null)
			{
				return null;
			}
			List<string> list = new List<string>(tokens.Count);
			foreach (IToken token in tokens)
			{
				list.Add(token.Text);
			}
			return list;
		}

		public virtual int GetRuleMemoization(int ruleIndex, int ruleStartIndex)
		{
			if (state.ruleMemo[ruleIndex] == null)
			{
				state.ruleMemo[ruleIndex] = new Dictionary<int, int>();
			}
			if (!state.ruleMemo[ruleIndex].TryGetValue(ruleStartIndex, out var value))
			{
				return -1;
			}
			return value;
		}

		public virtual bool AlreadyParsedRule(IIntStream input, int ruleIndex)
		{
			int ruleMemoization = GetRuleMemoization(ruleIndex, input.Index);
			switch (ruleMemoization)
			{
			case -1:
				return false;
			case -2:
				state.failed = true;
				break;
			default:
				input.Seek(ruleMemoization + 1);
				break;
			}
			return true;
		}

		public virtual void Memoize(IIntStream input, int ruleIndex, int ruleStartIndex)
		{
			int value = (state.failed ? (-2) : (input.Index - 1));
			if (state.ruleMemo == null && TraceDestination != null)
			{
				TraceDestination.WriteLine("!!!!!!!!! memo array is null for " + GrammarFileName);
			}
			if (ruleIndex >= state.ruleMemo.Length && TraceDestination != null)
			{
				TraceDestination.WriteLine("!!!!!!!!! memo size is " + state.ruleMemo.Length + ", but rule index is " + ruleIndex);
			}
			if (state.ruleMemo[ruleIndex] != null)
			{
				state.ruleMemo[ruleIndex][ruleStartIndex] = value;
			}
		}

		public virtual int GetRuleMemoizationCacheSize()
		{
			int num = 0;
			int num2 = 0;
			while (state.ruleMemo != null && num2 < state.ruleMemo.Length)
			{
				IDictionary<int, int> dictionary = state.ruleMemo[num2];
				if (dictionary != null)
				{
					num += dictionary.Count;
				}
				num2++;
			}
			return num;
		}

		public virtual void TraceIn(string ruleName, int ruleIndex, object inputSymbol)
		{
			if (TraceDestination != null)
			{
				TraceDestination.Write("enter " + ruleName + " " + inputSymbol);
				if (state.backtracking > 0)
				{
					TraceDestination.Write(" backtracking=" + state.backtracking);
				}
				TraceDestination.WriteLine();
			}
		}

		public virtual void TraceOut(string ruleName, int ruleIndex, object inputSymbol)
		{
			if (TraceDestination == null)
			{
				return;
			}
			TraceDestination.Write("exit " + ruleName + " " + inputSymbol);
			if (state.backtracking > 0)
			{
				TraceDestination.Write(" backtracking=" + state.backtracking);
				if (state.failed)
				{
					TraceDestination.Write(" failed");
				}
				else
				{
					TraceDestination.Write(" succeeded");
				}
			}
			TraceDestination.WriteLine();
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugEnterRule(string grammarFileName, string ruleName)
		{
			DebugListener?.EnterRule(grammarFileName, ruleName);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugExitRule(string grammarFileName, string ruleName)
		{
			DebugListener?.ExitRule(grammarFileName, ruleName);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugEnterSubRule(int decisionNumber)
		{
			DebugListener?.EnterSubRule(decisionNumber);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugExitSubRule(int decisionNumber)
		{
			DebugListener?.ExitSubRule(decisionNumber);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugEnterAlt(int alt)
		{
			DebugListener?.EnterAlt(alt);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugEnterDecision(int decisionNumber, bool couldBacktrack)
		{
			DebugListener?.EnterDecision(decisionNumber, couldBacktrack);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugExitDecision(int decisionNumber)
		{
			DebugListener?.ExitDecision(decisionNumber);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugLocation(int line, int charPositionInLine)
		{
			DebugListener?.Location(line, charPositionInLine);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugSemanticPredicate(bool result, string predicate)
		{
			DebugListener?.SemanticPredicate(result, predicate);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugBeginBacktrack(int level)
		{
			DebugListener?.BeginBacktrack(level);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugEndBacktrack(int level, bool successful)
		{
			DebugListener?.EndBacktrack(level, successful);
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugRecognitionException(RecognitionException ex)
		{
			DebugListener?.RecognitionException(ex);
		}
	}
	[Serializable]
	public sealed class BitSet : ICloneable
	{
		private const int BITS = 64;

		private const int LOG_BITS = 6;

		private const int MOD_MASK = 63;

		private ulong[] _bits;

		public BitSet()
			: this(64)
		{
		}

		[CLSCompliant(false)]
		public BitSet(ulong[] bits)
		{
			_bits = bits;
		}

		public BitSet(IEnumerable<int> items)
			: this()
		{
			foreach (int item in items)
			{
				Add(item);
			}
		}

		public BitSet(int nbits)
		{
			_bits = new ulong[(nbits - 1 >> 6) + 1];
		}

		public static BitSet Of(int el)
		{
			BitSet bitSet = new BitSet(el + 1);
			bitSet.Add(el);
			return bitSet;
		}

		public static BitSet Of(int a, int b)
		{
			BitSet bitSet = new BitSet(Math.Max(a, b) + 1);
			bitSet.Add(a);
			bitSet.Add(b);
			return bitSet;
		}

		public static BitSet Of(int a, int b, int c)
		{
			BitSet bitSet = new BitSet();
			bitSet.Add(a);
			bitSet.Add(b);
			bitSet.Add(c);
			return bitSet;
		}

		public static BitSet Of(int a, int b, int c, int d)
		{
			BitSet bitSet = new BitSet();
			bitSet.Add(a);
			bitSet.Add(b);
			bitSet.Add(c);
			bitSet.Add(d);
			return bitSet;
		}

		public BitSet Or(BitSet a)
		{
			if (a == null)
			{
				return this;
			}
			BitSet obj = (BitSet)Clone();
			obj.OrInPlace(a);
			return obj;
		}

		public void Add(int el)
		{
			int num = WordNumber(el);
			if (num >= _bits.Length)
			{
				GrowToInclude(el);
			}
			_bits[num] |= BitMask(el);
		}

		public void GrowToInclude(int bit)
		{
			int size = Math.Max(_bits.Length << 1, NumWordsToHold(bit));
			SetSize(size);
		}

		public void OrInPlace(BitSet a)
		{
			if (a != null)
			{
				if (a._bits.Length > _bits.Length)
				{
					SetSize(a._bits.Length);
				}
				for (int num = Math.Min(_bits.Length, a._bits.Length) - 1; num >= 0; num--)
				{
					_bits[num] |= a._bits[num];
				}
			}
		}

		private void SetSize(int nwords)
		{
			Array.Resize(ref _bits, nwords);
		}

		private static ulong BitMask(int bitNumber)
		{
			int num = bitNumber & 0x3F;
			return (ulong)(1L << num);
		}

		public object Clone()
		{
			return new BitSet((ulong[])_bits.Clone());
		}

		public int Size()
		{
			int num = 0;
			for (int num2 = _bits.Length - 1; num2 >= 0; num2--)
			{
				ulong num3 = _bits[num2];
				if (num3 != 0L)
				{
					for (int num4 = 63; num4 >= 0; num4--)
					{
						if ((num3 & (ulong)(1L << num4)) != 0L)
						{
							num++;
						}
					}
				}
			}
			return num;
		}

		public override int GetHashCode()
		{
			throw new NotImplementedException();
		}

		public override bool Equals(object other)
		{
			if (other == null || !(other is BitSet))
			{
				return false;
			}
			BitSet bitSet = (BitSet)other;
			int num = Math.Min(_bits.Length, bitSet._bits.Length);
			for (int i = 0; i < num; i++)
			{
				if (_bits[i] != bitSet._bits[i])
				{
					return false;
				}
			}
			if (_bits.Length > num)
			{
				for (int j = num + 1; j < _bits.Length; j++)
				{
					if (_bits[j] != 0L)
					{
						return false;
					}
				}
			}
			else if (bitSet._bits.Length > num)
			{
				for (int k = num + 1; k < bitSet._bits.Length; k++)
				{
					if (bitSet._bits[k] != 0L)
					{
						return false;
					}
				}
			}
			return true;
		}

		public bool Member(int el)
		{
			if (el < 0)
			{
				return false;
			}
			int num = WordNumber(el);
			if (num >= _bits.Length)
			{
				return false;
			}
			return (_bits[num] & BitMask(el)) != 0;
		}

		public void Remove(int el)
		{
			int num = WordNumber(el);
			if (num < _bits.Length)
			{
				_bits[num] &= ~BitMask(el);
			}
		}

		public bool IsNil()
		{
			for (int num = _bits.Length - 1; num >= 0; num--)
			{
				if (_bits[num] != 0L)
				{
					return false;
				}
			}
			return true;
		}

		private static int NumWordsToHold(int el)
		{
			return (el >> 6) + 1;
		}

		public int NumBits()
		{
			return _bits.Length << 6;
		}

		public int LengthInLongWords()
		{
			return _bits.Length;
		}

		public int[] ToArray()
		{
			int[] array = new int[Size()];
			int num = 0;
			for (int i = 0; i < _bits.Length << 6; i++)
			{
				if (Member(i))
				{
					array[num++] = i;
				}
			}
			return array;
		}

		private static int WordNumber(int bit)
		{
			return bit >> 6;
		}

		public override string ToString()
		{
			return ToString(null);
		}

		public string ToString(string[] tokenNames)
		{
			StringBuilder stringBuilder = new StringBuilder();
			string value = ",";
			bool flag = false;
			stringBuilder.Append('{');
			for (int i = 0; i < _bits.Length << 6; i++)
			{
				if (Member(i))
				{
					if (i > 0 && flag)
					{
						stringBuilder.Append(value);
					}
					if (tokenNames != null)
					{
						stringBuilder.Append(tokenNames[i]);
					}
					else
					{
						stringBuilder.Append(i);
					}
					flag = true;
				}
			}
			stringBuilder.Append('}');
			return stringBuilder.ToString();
		}
	}
	[Serializable]
	public class BufferedTokenStream : ITokenStream, IIntStream, ITokenStreamInformation
	{
		private ITokenSource _tokenSource;

		[CLSCompliant(false)]
		protected List<IToken> _tokens = new List<IToken>(100);

		private int _lastMarker;

		[CLSCompliant(false)]
		protected int _p = -1;

		public virtual ITokenSource TokenSource
		{
			get
			{
				return _tokenSource;
			}
			set
			{
				_tokenSource = value;
				_tokens.Clear();
				_p = -1;
			}
		}

		public virtual int Index => _p;

		public virtual int Range { get; protected set; }

		public virtual int Count => _tokens.Count;

		public virtual string SourceName => _tokenSource.SourceName;

		public virtual IToken LastToken => LB(1);

		public virtual IToken LastRealToken
		{
			get
			{
				int num = 0;
				IToken token;
				do
				{
					num++;
					token = LB(num);
				}
				while (token != null && token.Line <= 0);
				return token;
			}
		}

		public virtual int MaxLookBehind => int.MaxValue;

		public BufferedTokenStream()
		{
		}

		public BufferedTokenStream(ITokenSource tokenSource)
		{
			_tokenSource = tokenSource;
		}

		public virtual int Mark()
		{
			if (_p == -1)
			{
				Setup();
			}
			_lastMarker = Index;
			return _lastMarker;
		}

		public virtual void Release(int marker)
		{
		}

		public virtual void Rewind(int marker)
		{
			Seek(marker);
		}

		public virtual void Rewind()
		{
			Seek(_lastMarker);
		}

		public virtual void Reset()
		{
			_p = 0;
			_lastMarker = 0;
		}

		public virtual void Seek(int index)
		{
			_p = index;
		}

		public virtual void Consume()
		{
			if (_p == -1)
			{
				Setup();
			}
			_p++;
			Sync(_p);
		}

		protected virtual void Sync(int i)
		{
			int num = i - _tokens.Count + 1;
			if (num > 0)
			{
				Fetch(num);
			}
		}

		protected virtual void Fetch(int n)
		{
			for (int i = 0; i < n; i++)
			{
				IToken token = TokenSource.NextToken();
				token.TokenIndex = _tokens.Count;
				_tokens.Add(token);
				if (token.Type == -1)
				{
					break;
				}
			}
		}

		public virtual IToken Get(int i)
		{
			if (i < 0 || i >= _tokens.Count)
			{
				throw new IndexOutOfRangeException("token index " + i + " out of range 0.." + (_tokens.Count - 1));
			}
			return _tokens[i];
		}

		public virtual int LA(int i)
		{
			return LT(i).Type;
		}

		protected virtual IToken LB(int k)
		{
			if (_p - k < 0)
			{
				return null;
			}
			return _tokens[_p - k];
		}

		public virtual IToken LT(int k)
		{
			if (_p == -1)
			{
				Setup();
			}
			if (k == 0)
			{
				return null;
			}
			if (k < 0)
			{
				return LB(-k);
			}
			int num = _p + k - 1;
			Sync(num);
			if (num >= _tokens.Count)
			{
				return _tokens[_tokens.Count - 1];
			}
			if (num > Range)
			{
				Range = num;
			}
			return _tokens[_p + k - 1];
		}

		protected virtual void Setup()
		{
			Sync(0);
			_p = 0;
		}

		public virtual List<IToken> GetTokens()
		{
			return _tokens;
		}

		public virtual List<IToken> GetTokens(int start, int stop)
		{
			return GetTokens(start, stop, (BitSet)null);
		}

		public virtual List<IToken> GetTokens(int start, int stop, BitSet types)
		{
			if (_p == -1)
			{
				Setup();
			}
			if (stop >= _tokens.Count)
			{
				stop = _tokens.Count - 1;
			}
			if (start < 0)
			{
				start = 0;
			}
			if (start > stop)
			{
				return null;
			}
			List<IToken> list = new List<IToken>();
			for (int i = start; i <= stop; i++)
			{
				IToken token = _tokens[i];
				if (types == null || types.Member(token.Type))
				{
					list.Add(token);
				}
			}
			if (list.Count == 0)
			{
				list = null;
			}
			return list;
		}

		public virtual List<IToken> GetTokens(int start, int stop, IEnumerable<int> types)
		{
			return GetTokens(start, stop, new BitSet(types));
		}

		public virtual List<IToken> GetTokens(int start, int stop, int ttype)
		{
			return GetTokens(start, stop, BitSet.Of(ttype));
		}

		public override string ToString()
		{
			if (_p == -1)
			{
				Setup();
			}
			Fill();
			return ToString(0, _tokens.Count - 1);
		}

		public virtual string ToString(int start, int stop)
		{
			if (start < 0 || stop < 0)
			{
				return null;
			}
			if (_p == -1)
			{
				Setup();
			}
			if (stop >= _tokens.Count)
			{
				stop = _tokens.Count - 1;
			}
			StringBuilder stringBuilder = new StringBuilder();
			for (int i = start; i <= stop; i++)
			{
				IToken token = _tokens[i];
				if (token.Type == -1)
				{
					break;
				}
				stringBuilder.Append(token.Text);
			}
			return stringBuilder.ToString();
		}

		public virtual string ToString(IToken start, IToken stop)
		{
			if (start != null && stop != null)
			{
				return ToString(start.TokenIndex, stop.TokenIndex);
			}
			return null;
		}

		public virtual void Fill()
		{
			if (_p == -1)
			{
				Setup();
			}
			if (_tokens[_p].Type != -1)
			{
				int num = _p + 1;
				Sync(num);
				while (_tokens[num].Type != -1)
				{
					num++;
					Sync(num);
				}
			}
		}
	}
	public static class CharStreamConstants
	{
		public const int EndOfFile = -1;
	}
	[Serializable]
	public class CharStreamState
	{
		public int p;

		public int line;

		public int charPositionInLine;
	}
	[Serializable]
	public class ClassicToken : IToken
	{
		private string text;

		private int type;

		private int line;

		private int charPositionInLine;

		private int channel;

		private int index;

		public string Text
		{
			get
			{
				return text;
			}
			set
			{
				text = value;
			}
		}

		public int Type
		{
			get
			{
				return type;
			}
			set
			{
				type = value;
			}
		}

		public int Line
		{
			get
			{
				return line;
			}
			set
			{
				line = value;
			}
		}

		public int CharPositionInLine
		{
			get
			{
				return charPositionInLine;
			}
			set
			{
				charPositionInLine = value;
			}
		}

		public int Channel
		{
			get
			{
				return channel;
			}
			set
			{
				channel = value;
			}
		}

		public int StartIndex
		{
			get
			{
				return -1;
			}
			set
			{
			}
		}

		public int StopIndex
		{
			get
			{
				return -1;
			}
			set
			{
			}
		}

		public int TokenIndex
		{
			get
			{
				return index;
			}
			set
			{
				index = value;
			}
		}

		public ICharStream InputStream
		{
			get
			{
				return null;
			}
			set
			{
			}
		}

		public ClassicToken(int type)
		{
			this.type = type;
		}

		public ClassicToken(IToken oldToken)
		{
			text = oldToken.Text;
			type = oldToken.Type;
			line = oldToken.Line;
			charPositionInLine = oldToken.CharPositionInLine;
			channel = oldToken.Channel;
		}

		public ClassicToken(int type, string text)
		{
			this.type = type;
			this.text = text;
		}

		public ClassicToken(int type, string text, int channel)
		{
			this.type = type;
			this.text = text;
			this.channel = channel;
		}

		public override string ToString()
		{
			string text = "";
			if (channel > 0)
			{
				text = ",channel=" + channel;
			}
			string text2 = Text;
			if (text2 != null)
			{
				text2 = text2.Replace("\n", "\\\\n");
				text2 = text2.Replace("\r", "\\\\r");
				text2 = text2.Replace("\t", "\\\\t");
			}
			else
			{
				text2 = "<no text>";
			}
			return "[@" + TokenIndex + ",'" + text2 + "',<" + type + ">" + text + "," + line + ":" + CharPositionInLine + "]";
		}
	}
	[Serializable]
	public class CommonToken : IToken
	{
		private int type;

		private int line;

		private int charPositionInLine = -1;

		private int channel;

		[NonSerialized]
		private ICharStream input;

		private string text;

		private int index = -1;

		private int start;

		private int stop;

		public string Text
		{
			get
			{
				if (text != null)
				{
					return text;
				}
				if (input == null)
				{
					return null;
				}
				if (start <= stop && stop < input.Count)
				{
					return input.Substring(start, stop - start + 1);
				}
				return "<EOF>";
			}
			set
			{
				text = value;
			}
		}

		public int Type
		{
			get
			{
				return type;
			}
			set
			{
				type = value;
			}
		}

		public int Line
		{
			get
			{
				return line;
			}
			set
			{
				line = value;
			}
		}

		public int CharPositionInLine
		{
			get
			{
				return charPositionInLine;
			}
			set
			{
				charPositionInLine = value;
			}
		}

		public int Channel
		{
			get
			{
				return channel;
			}
			set
			{
				channel = value;
			}
		}

		public int StartIndex
		{
			get
			{
				return start;
			}
			set
			{
				start = value;
			}
		}

		public int StopIndex
		{
			get
			{
				return stop;
			}
			set
			{
				stop = value;
			}
		}

		public int TokenIndex
		{
			get
			{
				return index;
			}
			set
			{
				index = value;
			}
		}

		public ICharStream InputStream
		{
			get
			{
				return input;
			}
			set
			{
				input = value;
			}
		}

		public CommonToken()
		{
		}

		public CommonToken(int type)
		{
			this.type = type;
		}

		public CommonToken(ICharStream input, int type, int channel, int start, int stop)
		{
			this.input = input;
			this.type = type;
			this.channel = channel;
			this.start = start;
			this.stop = stop;
		}

		public CommonToken(int type, string text)
		{
			this.type = type;
			channel = 0;
			this.text = text;
		}

		public CommonToken(IToken oldToken)
		{
			text = oldToken.Text;
			type = oldToken.Type;
			line = oldToken.Line;
			index = oldToken.TokenIndex;
			charPositionInLine = oldToken.CharPositionInLine;
			channel = oldToken.Channel;
			input = oldToken.InputStream;
			if (oldToken is CommonToken)
			{
				start = ((CommonToken)oldToken).start;
				stop = ((CommonToken)oldToken).stop;
			}
		}

		public override string ToString()
		{
			string text = "";
			if (channel > 0)
			{
				text = ",channel=" + channel;
			}
			string text2 = Text;
			if (text2 != null)
			{
				text2 = Regex.Replace(text2, "\n", "\\\\n");
				text2 = Regex.Replace(text2, "\r", "\\\\r");
				text2 = Regex.Replace(text2, "\t", "\\\\t");
			}
			else
			{
				text2 = "<no text>";
			}
			return "[@" + TokenIndex + "," + start + ":" + stop + "='" + text2 + "',<" + type + ">" + text + "," + line + ":" + CharPositionInLine + "]";
		}

		[OnSerializing]
		internal void OnSerializing(StreamingContext context)
		{
			if (text == null)
			{
				text = Text;
			}
		}
	}
	[Serializable]
	public class CommonTokenStream : BufferedTokenStream
	{
		private int _channel;

		public int Channel => _channel;

		public override ITokenSource TokenSource
		{
			get
			{
				return base.TokenSource;
			}
			set
			{
				base.TokenSource = value;
				_channel = 0;
			}
		}

		public CommonTokenStream()
		{
		}

		public CommonTokenStream(ITokenSource tokenSource)
			: this(tokenSource, 0)
		{
		}

		public CommonTokenStream(ITokenSource tokenSource, int channel)
			: base(tokenSource)
		{
			_channel = channel;
		}

		public override void Consume()
		{
			if (_p == -1)
			{
				Setup();
			}
			_p++;
			_p = SkipOffTokenChannels(_p);
		}

		protected override IToken LB(int k)
		{
			if (k == 0 || _p - k < 0)
			{
				return null;
			}
			int num = _p;
			for (int i = 1; i <= k; i++)
			{
				num = SkipOffTokenChannelsReverse(num - 1);
			}
			if (num < 0)
			{
				return null;
			}
			return _tokens[num];
		}

		public override IToken LT(int k)
		{
			if (_p == -1)
			{
				Setup();
			}
			if (k == 0)
			{
				return null;
			}
			if (k < 0)
			{
				return LB(-k);
			}
			int num = _p;
			for (int i = 1; i < k; i++)
			{
				num = SkipOffTokenChannels(num + 1);
			}
			if (num > Range)
			{
				Range = num;
			}
			return _tokens[num];
		}

		protected virtual int SkipOffTokenChannels(int i)
		{
			Sync(i);
			while (_tokens[i].Channel != _channel)
			{
				i++;
				Sync(i);
			}
			return i;
		}

		protected virtual int SkipOffTokenChannelsReverse(int i)
		{
			while (i >= 0 && _tokens[i].Channel != _channel)
			{
				i--;
			}
			return i;
		}

		public override void Reset()
		{
			base.Reset();
			_p = SkipOffTokenChannels(0);
		}

		protected override void Setup()
		{
			_p = 0;
			_p = SkipOffTokenChannels(_p);
		}
	}
	public delegate int SpecialStateTransitionHandler(DFA dfa, int s, IIntStream input);
	public class DFA
	{
		protected short[] eot;

		protected short[] eof;

		protected char[] min;

		protected char[] max;

		protected short[] accept;

		protected short[] special;

		protected short[][] transition;

		protected int decisionNumber;

		protected BaseRecognizer recognizer;

		public bool debug;

		public virtual string Description => "n/a";

		public SpecialStateTransitionHandler SpecialStateTransition { get; private set; }

		public DFA()
			: this(SpecialStateTransitionDefault)
		{
		}

		public DFA(SpecialStateTransitionHandler specialStateTransition)
		{
			SpecialStateTransition = specialStateTransition ?? new SpecialStateTransitionHandler(SpecialStateTransitionDefault);
		}

		public virtual int Predict(IIntStream input)
		{
			if (input == null)
			{
				throw new ArgumentNullException("input");
			}
			int marker = input.Mark();
			int num = 0;
			try
			{
				char c;
				while (true)
				{
					int num2 = special[num];
					if (num2 >= 0)
					{
						num = SpecialStateTransition(this, num2, input);
						if (num == -1)
						{
							NoViableAlt(num, input);
							return 0;
						}
						input.Consume();
						continue;
					}
					if (accept[num] >= 1)
					{
						return accept[num];
					}
					c = (char)input.LA(1);
					if (c >= min[num] && c <= max[num])
					{
						int num3 = transition[num][c - min[num]];
						if (num3 < 0)
						{
							if (eot[num] < 0)
							{
								NoViableAlt(num, input);
								return 0;
							}
							num = eot[num];
							input.Consume();
						}
						else
						{
							num = num3;
							input.Consume();
						}
					}
					else
					{
						if (eot[num] < 0)
						{
							break;
						}
						num = eot[num];
						input.Consume();
					}
				}
				if (c == '\uffff' && eof[num] >= 0)
				{
					return accept[eof[num]];
				}
				NoViableAlt(num, input);
				return 0;
			}
			finally
			{
				input.Rewind(marker);
			}
		}

		[Conditional("DEBUG_DFA")]
		private void DfaDebugMessage(string format, params object[] args)
		{
			Console.Error.WriteLine(format, args);
		}

		[Conditional("DEBUG_DFA")]
		private void DfaDebugInvalidSymbol(int s)
		{
			Console.Error.WriteLine("min[{0}]={1}", s, min[s]);
			Console.Error.WriteLine("max[{0}]={1}", s, max[s]);
			Console.Error.WriteLine("eot[{0}]={1}", s, eot[s]);
			Console.Error.WriteLine("eof[{0}]={1}", s, eof[s]);
			for (int i = 0; i < transition[s].Length; i++)
			{
				Console.Error.Write(transition[s][i] + " ");
			}
			Console.Error.WriteLine();
		}

		protected virtual void NoViableAlt(int s, IIntStream input)
		{
			if (recognizer.state.backtracking > 0)
			{
				recognizer.state.failed = true;
				return;
			}
			NoViableAltException ex = new NoViableAltException(Description, decisionNumber, s, input);
			Error(ex);
			throw ex;
		}

		public virtual void Error(NoViableAltException nvae)
		{
		}

		private static int SpecialStateTransitionDefault(DFA dfa, int s, IIntStream input)
		{
			return -1;
		}

		public static short[] UnpackEncodedString(string encodedString)
		{
			int num = 0;
			for (int i = 0; i < encodedString.Length; i += 2)
			{
				num += encodedString[i];
			}
			short[] array = new short[num];
			int num2 = 0;
			for (int j = 0; j < encodedString.Length; j += 2)
			{
				char c = encodedString[j];
				char c2 = encodedString[j + 1];
				for (int k = 1; k <= c; k++)
				{
					array[num2++] = (short)c2;
				}
			}
			return array;
		}

		public static char[] UnpackEncodedStringToUnsignedChars(string encodedString)
		{
			int num = 0;
			for (int i = 0; i < encodedString.Length; i += 2)
			{
				num += encodedString[i];
			}
			char[] array = new char[num];
			int num2 = 0;
			for (int j = 0; j < encodedString.Length; j += 2)
			{
				char c = encodedString[j];
				char c2 = encodedString[j + 1];
				for (int k = 1; k <= c; k++)
				{
					array[num2++] = c2;
				}
			}
			return array;
		}

		[Conditional("ANTLR_DEBUG")]
		protected virtual void DebugRecognitionException(RecognitionException ex)
		{
			recognizer.DebugListener?.RecognitionException(ex);
		}
	}
	[Serializable]
	public class EarlyExitException : RecognitionException
	{
		private readonly int _decisionNumber;

		public int DecisionNumber => _decisionNumber;

		public EarlyExitException()
		{
		}

		public EarlyExitException(string message)
			: base(message)
		{
		}

		public EarlyExitException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public EarlyExitException(int decisionNumber, IIntStream input)
			: base(input)
		{
			_decisionNumber = decisionNumber;
		}

		public EarlyExitException(string message, int decisionNumber, IIntStream input)
			: base(message, input)
		{
			_decisionNumber = decisionNumber;
		}

		public EarlyExitException(string message, int decisionNumber, IIntStream input, Exception innerException)
			: base(message, input, innerException)
		{
			_decisionNumber = decisionNumber;
		}

		protected EarlyExitException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			_decisionNumber = info.GetInt32("DecisionNumber");
		}

		[SecurityCritical]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			base.GetObjectData(info, context);
			info.AddValue("DecisionNumber", DecisionNumber);
		}
	}
	[Serializable]
	public class FailedPredicateException : RecognitionException
	{
		private readonly string _ruleName;

		private readonly string _predicateText;

		public string RuleName => _ruleName;

		public string PredicateText => _predicateText;

		public FailedPredicateException()
		{
		}

		public FailedPredicateException(string message)
			: base(message)
		{
		}

		public FailedPredicateException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public FailedPredicateException(IIntStream input, string ruleName, string predicateText)
			: base(input)
		{
			_ruleName = ruleName;
			_predicateText = predicateText;
		}

		public FailedPredicateException(string message, IIntStream input, string ruleName, string predicateText)
			: base(message, input)
		{
			_ruleName = ruleName;
			_predicateText = predicateText;
		}

		public FailedPredicateException(string message, IIntStream input, string ruleName, string predicateText, Exception innerException)
			: base(message, input, innerException)
		{
			_ruleName = ruleName;
			_predicateText = predicateText;
		}

		protected FailedPredicateException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			_ruleName = info.GetString("RuleName");
			_predicateText = info.GetString("PredicateText");
		}

		[SecurityCritical]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			base.GetObjectData(info, context);
			info.AddValue("RuleName", _ruleName);
			info.AddValue("PredicateText", _predicateText);
		}

		public override string ToString()
		{
			return "FailedPredicateException(" + RuleName + ",{" + PredicateText + "}?)";
		}
	}
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
	public sealed class GrammarRuleAttribute : Attribute
	{
		private readonly string _name;

		public string Name => _name;

		public GrammarRuleAttribute(string name)
		{
			_name = name;
		}
	}
	public interface IAstRuleReturnScope : IRuleReturnScope
	{
		object Tree { get; }
	}
	public interface IAstRuleReturnScope<TAstLabel> : IAstRuleReturnScope, IRuleReturnScope
	{
		new TAstLabel Tree { get; }
	}
	public interface ICharStream : IIntStream
	{
		int Line { get; set; }

		int CharPositionInLine { get; set; }

		string Substring(int start, int length);

		int LT(int i);
	}
	public interface IIntStream
	{
		int Index { get; }

		int Count { get; }

		string SourceName { get; }

		void Consume();

		int LA(int i);

		int Mark();

		void Rewind(int marker);

		void Rewind();

		void Release(int marker);

		void Seek(int index);
	}
	public interface IRuleReturnScope
	{
		object Start { get; }

		object Stop { get; }
	}
	public interface IRuleReturnScope<TLabel> : IRuleReturnScope
	{
		new TLabel Start { get; }

		new TLabel Stop { get; }
	}
	public interface ITemplateRuleReturnScope
	{
		object Template { get; }
	}
	public interface ITemplateRuleReturnScope<TTemplate> : ITemplateRuleReturnScope
	{
		new TTemplate Template { get; }
	}
	public interface IToken
	{
		string Text { get; set; }

		int Type { get; set; }

		int Line { get; set; }

		int CharPositionInLine { get; set; }

		int Channel { get; set; }

		int StartIndex { get; set; }

		int StopIndex { get; set; }

		int TokenIndex { get; set; }

		ICharStream InputStream { get; set; }
	}
	public interface ITokenSource
	{
		string SourceName { get; }

		string[] TokenNames { get; }

		IToken NextToken();
	}
	public interface ITokenStream : IIntStream
	{
		int Range { get; }

		ITokenSource TokenSource { get; }

		IToken LT(int k);

		IToken Get(int i);

		string ToString(int start, int stop);

		string ToString(IToken start, IToken stop);
	}
	public interface ITokenStreamInformation
	{
		IToken LastToken { get; }

		IToken LastRealToken { get; }

		int MaxLookBehind { get; }
	}
	[Serializable]
	public class LegacyCommonTokenStream : ITokenStream, IIntStream
	{
		[NonSerialized]
		private ITokenSource _tokenSource;

		protected List<IToken> tokens;

		protected IDictionary<int, int> channelOverrideMap;

		protected List<int> discardSet;

		protected int channel;

		protected bool discardOffChannelTokens;

		protected int lastMarker;

		protected int p = -1;

		public virtual int Index => p;

		public virtual int Range { get; protected set; }

		public virtual int Count => tokens.Count;

		public virtual ITokenSource TokenSource => _tokenSource;

		public virtual string SourceName => TokenSource.SourceName;

		public LegacyCommonTokenStream()
		{
			tokens = new List<IToken>(500);
		}

		public LegacyCommonTokenStream(ITokenSource tokenSource)
			: this()
		{
			_tokenSource = tokenSource;
		}

		public LegacyCommonTokenStream(ITokenSource tokenSource, int channel)
			: this(tokenSource)
		{
			this.channel = channel;
		}

		public virtual void SetTokenSource(ITokenSource tokenSource)
		{
			_tokenSource = tokenSource;
			tokens.Clear();
			p = -1;
			channel = 0;
		}

		public virtual void FillBuffer()
		{
			if (p != -1)
			{
				return;
			}
			int num = 0;
			IToken token = _tokenSource.NextToken();
			while (token != null && token.Type != -1)
			{
				bool flag = false;
				if (channelOverrideMap != null && channelOverrideMap.TryGetValue(token.Type, out var value))
				{
					token.Channel = value;
				}
				if (discardSet != null && discardSet.Contains(token.Type))
				{
					flag = true;
				}
				else if (discardOffChannelTokens && token.Channel != channel)
				{
					flag = true;
				}
				if (!flag)
				{
					token.TokenIndex = num;
					tokens.Add(token);
					num++;
				}
				token = _tokenSource.NextToken();
			}
			p = 0;
			p = SkipOffTokenChannels(p);
		}

		public virtual void Consume()
		{
			if (p < tokens.Count)
			{
				p++;
				p = SkipOffTokenChannels(p);
			}
		}

		protected virtual int SkipOffTokenChannels(int i)
		{
			int count = tokens.Count;
			while (i < count && tokens[i].Channel != channel)
			{
				i++;
			}
			return i;
		}

		protected virtual int SkipOffTokenChannelsReverse(int i)
		{
			while (i >= 0 && tokens[i].Channel != channel)
			{
				i--;
			}
			return i;
		}

		public virtual void SetTokenTypeChannel(int ttype, int channel)
		{
			if (channelOverrideMap == null)
			{
				channelOverrideMap = new Dictionary<int, int>();
			}
			channelOverrideMap[ttype] = channel;
		}

		public virtual void DiscardTokenType(int ttype)
		{
			if (discardSet == null)
			{
				discardSet = new List<int>();
			}
			discardSet.Add(ttype);
		}

		public virtual void SetDiscardOffChannelTokens(bool discardOffChannelTokens)
		{
			this.discardOffChannelTokens = discardOffChannelTokens;
		}

		public virtual IList<IToken> GetTokens()
		{
			if (p == -1)
			{
				FillBuffer();
			}
			return tokens;
		}

		public virtual IList<IToken> GetTokens(int start, int stop)
		{
			return GetTokens(start, stop, (BitSet)null);
		}

		public virtual IList<IToken> GetTokens(int start, int stop, BitSet types)
		{
			if (p == -1)
			{
				FillBuffer();
			}
			if (stop >= tokens.Count)
			{
				stop = tokens.Count - 1;
			}
			if (start < 0)
			{
				start = 0;
			}
			if (start > stop)
			{
				return null;
			}
			IList<IToken> list = new List<IToken>();
			for (int i = start; i <= stop; i++)
			{
				IToken token = tokens[i];
				if (types == null || types.Member(token.Type))
				{
					list.Add(token);
				}
			}
			if (list.Count == 0)
			{
				list = null;
			}
			return list;
		}

		public virtual IList<IToken> GetTokens(int start, int stop, IList<int> types)
		{
			return GetTokens(start, stop, new BitSet(types));
		}

		public virtual IList<IToken> GetTokens(int start, int stop, int ttype)
		{
			return GetTokens(start, stop, BitSet.Of(ttype));
		}

		public virtual IToken LT(int k)
		{
			if (p == -1)
			{
				FillBuffer();
			}
			if (k == 0)
			{
				return null;
			}
			if (k < 0)
			{
				return LB(-k);
			}
			if (p + k - 1 >= tokens.Count)
			{
				return tokens[tokens.Count - 1];
			}
			int num = p;
			for (int i = 1; i < k; i++)
			{
				num = SkipOffTokenChannels(num + 1);
			}
			if (num >= tokens.Count)
			{
				return tokens[tokens.Count - 1];
			}
			if (num > Range)
			{
				Range = num;
			}
			return tokens[num];
		}

		protected virtual IToken LB(int k)
		{
			if (p == -1)
			{
				FillBuffer();
			}
			if (k == 0)
			{
				return null;
			}
			if (p - k < 0)
			{
				return null;
			}
			int num = p;
			for (int i = 1; i <= k; i++)
			{
				num = SkipOffTokenChannelsReverse(num - 1);
			}
			if (num < 0)
			{
				return null;
			}
			return tokens[num];
		}

		public virtual IToken Get(int i)
		{
			return tokens[i];
		}

		public virtual int LA(int i)
		{
			return LT(i).Type;
		}

		public virtual int Mark()
		{
			if (p == -1)
			{
				FillBuffer();
			}
			lastMarker = Index;
			return lastMarker;
		}

		public virtual void Release(int marker)
		{
		}

		public virtual void Rewind(int marker)
		{
			Seek(marker);
		}

		public virtual void Rewind()
		{
			Seek(lastMarker);
		}

		public virtual void Reset()
		{
			p = 0;
			lastMarker = 0;
		}

		public virtual void Seek(int index)
		{
			p = index;
		}

		public override string ToString()
		{
			if (p == -1)
			{
				throw new InvalidOperationException("Buffer is not yet filled.");
			}
			return ToString(0, tokens.Count - 1);
		}

		public virtual string ToString(int start, int stop)
		{
			if (start < 0 || stop < 0)
			{
				return null;
			}
			if (p == -1)
			{
				throw new InvalidOperationException("Buffer is not yet filled.");
			}
			if (stop >= tokens.Count)
			{
				stop = tokens.Count - 1;
			}
			StringBuilder stringBuilder = new StringBuilder();
			for (int i = start; i <= stop; i++)
			{
				IToken token = tokens[i];
				stringBuilder.Append(token.Text);
			}
			return stringBuilder.ToString();
		}

		public virtual string ToString(IToken start, IToken stop)
		{
			if (start != null && stop != null)
			{
				return ToString(start.TokenIndex, stop.TokenIndex);
			}
			return null;
		}
	}
	public abstract class Lexer : BaseRecognizer, ITokenSource
	{
		protected ICharStream input;

		public string Text
		{
			get
			{
				if (state.text != null)
				{
					return state.text;
				}
				return input.Substring(state.tokenStartCharIndex, CharIndex - state.tokenStartCharIndex);
			}
			set
			{
				state.text = value;
			}
		}

		public int Line
		{
			get
			{
				return input.Line;
			}
			set
			{
				input.Line = value;
			}
		}

		public int CharPositionInLine
		{
			get
			{
				return input.CharPositionInLine;
			}
			set
			{
				input.CharPositionInLine = value;
			}
		}

		public virtual ICharStream CharStream
		{
			get
			{
				return input;
			}
			set
			{
				input = null;
				Reset();
				input = value;
			}
		}

		public override string SourceName => input.SourceName;

		public virtual int CharIndex => input.Index;

		public Lexer()
		{
		}

		public Lexer(ICharStream input)
		{
			this.input = input;
		}

		public Lexer(ICharStream input, RecognizerSharedState state)
			: base(state)
		{
			this.input = input;
		}

		public override void Reset()
		{
			base.Reset();
			if (input != null)
			{
				input.Seek(0);
			}
			if (state != null)
			{
				state.token = null;
				state.type = 0;
				state.channel = 0;
				state.tokenStartCharIndex = -1;
				state.tokenStartCharPositionInLine = -1;
				state.tokenStartLine = -1;
				state.text = null;
			}
		}

		public virtual IToken NextToken()
		{
			while (true)
			{
				state.token = null;
				state.channel = 0;
				state.tokenStartCharIndex = input.Index;
				state.tokenStartCharPositionInLine = input.CharPositionInLine;
				state.tokenStartLine = input.Line;
				state.text = null;
				if (input.LA(1) == -1)
				{
					break;
				}
				try
				{
					ParseNextToken();
					if (state.token == null)
					{
						Emit();
						goto IL_00b0;
					}
					if (state.token != Tokens.Skip)
					{
						goto IL_00b0;
					}
					goto end_IL_007d;
					IL_00b0:
					return state.token;
					end_IL_007d:;
				}
				catch (MismatchedRangeException e)
				{
					ReportError(e);
				}
				catch (MismatchedTokenException e2)
				{
					ReportError(e2);
				}
				catch (RecognitionException ex)
				{
					ReportError(ex);
					Recover(ex);
				}
			}
			return GetEndOfFileToken();
		}

		public virtual IToken GetEndOfFileToken()
		{
			return new CommonToken(input, -1, 0, input.Index, input.Index)
			{
				Line = Line,
				CharPositionInLine = CharPositionInLine
			};
		}

		public virtual void Skip()
		{
			state.token = Tokens.Skip;
		}

		public abstract void mTokens();

		public virtual void Emit(IToken token)
		{
			state.token = token;
		}

		public virtual IToken Emit()
		{
			IToken token = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, CharIndex - 1);
			token.Line = state.tokenStartLine;
			token.Text = state.text;
			token.CharPositionInLine = state.tokenStartCharPositionInLine;
			Emit(token);
			return token;
		}

		public virtual void Match(string s)
		{
			int num = 0;
			while (num < s.Length)
			{
				if (input.LA(1) != s[num])
				{
					if (state.backtracking > 0)
					{
						state.failed = true;
						break;
					}
					MismatchedTokenException ex = new MismatchedTokenException(s[num], input, TokenNames);
					Recover(ex);
					throw ex;
				}
				num++;
				input.Consume();
				state.failed = false;
			}
		}

		public virtual void MatchAny()
		{
			input.Consume();
		}

		public virtual void Match(int c)
		{
			if (input.LA(1) != c)
			{
				if (state.backtracking <= 0)
				{
					MismatchedTokenException ex = new MismatchedTokenException(c, input, TokenNames);
					Recover(ex);
					throw ex;
				}
				state.failed = true;
			}
			else
			{
				input.Consume();
				state.failed = false;
			}
		}

		public virtual void MatchRange(int a, int b)
		{
			if (input.LA(1) < a || input.LA(1) > b)
			{
				if (state.backtracking <= 0)
				{
					MismatchedRangeException ex = new MismatchedRangeException(a, b, input);
					Recover(ex);
					throw ex;
				}
				state.failed = true;
			}
			else
			{
				input.Consume();
				state.failed = false;
			}
		}

		public override void ReportError(RecognitionException e)
		{
			DisplayRecognitionError(TokenNames, e);
		}

		public override string GetErrorMessage(RecognitionException e, string[] tokenNames)
		{
			string text = null;
			if (e is MismatchedTokenException)
			{
				MismatchedTokenException ex = (MismatchedTokenException)e;
				return "mismatched character " + GetCharErrorDisplay(e.Character) + " expecting " + GetCharErrorDisplay(ex.Expecting);
			}
			if (e is NoViableAltException)
			{
				_ = (NoViableAltException)e;
				return "no viable alternative at character " + GetCharErrorDisplay(e.Character);
			}
			if (e is EarlyExitException)
			{
				_ = (EarlyExitException)e;
				return "required (...)+ loop did not match anything at character " + GetCharErrorDisplay(e.Character);
			}
			if (e is MismatchedNotSetException)
			{
				MismatchedNotSetException ex2 = (MismatchedNotSetException)e;
				return "mismatched character " + GetCharErrorDisplay(e.Character) + " expecting set " + ex2.Expecting;
			}
			if (e is MismatchedSetException)
			{
				MismatchedSetException ex3 = (MismatchedSetException)e;
				return "mismatched character " + GetCharErrorDisplay(e.Character) + " expecting set " + ex3.Expecting;
			}
			if (e is MismatchedRangeException)
			{
				MismatchedRangeException ex4 = (MismatchedRangeException)e;
				return "mismatched character " + GetCharErrorDisplay(e.Character) + " expecting set " + GetCharErrorDisplay(ex4.A) + ".." + GetCharErrorDisplay(ex4.B);
			}
			return base.GetErrorMessage(e, tokenNames);
		}

		public virtual string GetCharErrorDisplay(int c)
		{
			string text = ((char)c).ToString();
			switch (c)
			{
			case -1:
				text = "<EOF>";
				break;
			case 10:
				text = "\\n";
				break;
			case 9:
				text = "\\t";
				break;
			case 13:
				text = "\\r";
				break;
			}
			return "'" + text + "'";
		}

		public virtual void Recover(RecognitionException re)
		{
			input.Consume();
		}

		[Conditional("ANTLR_TRACE")]
		public virtual void TraceIn(string ruleName, int ruleIndex)
		{
			string inputSymbol = ((char)input.LT(1)).ToString() + " line=" + Line + ":" + CharPositionInLine;
			base.TraceIn(ruleName, ruleIndex, inputSymbol);
		}

		[Conditional("ANTLR_TRACE")]
		public virtual void TraceOut(string ruleName, int ruleIndex)
		{
			string inputSymbol = ((char)input.LT(1)).ToString() + " line=" + Line + ":" + CharPositionInLine;
			base.TraceOut(ruleName, ruleIndex, inputSymbol);
		}

		protected virtual void ParseNextToken()
		{
			mTokens();
		}
	}
	[Serializable]
	public class MismatchedNotSetException : MismatchedSetException
	{
		public MismatchedNotSetException()
		{
		}

		public MismatchedNotSetException(string message)
			: base(message)
		{
		}

		public MismatchedNotSetException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public MismatchedNotSetException(BitSet expecting, IIntStream input)
			: base(expecting, input)
		{
		}

		public MismatchedNotSetException(string message, BitSet expecting, IIntStream input)
			: base(message, expecting, input)
		{
		}

		public MismatchedNotSetException(string message, BitSet expecting, IIntStream input, Exception innerException)
			: base(message, expecting, input, innerException)
		{
		}

		protected MismatchedNotSetException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public override string ToString()
		{
			return string.Concat("MismatchedNotSetException(", UnexpectedType, "!=", base.Expecting, ")");
		}
	}
	[Serializable]
	public class MismatchedRangeException : RecognitionException
	{
		private readonly int _a;

		private readonly int _b;

		public int A => _a;

		public int B => _b;

		public MismatchedRangeException()
		{
		}

		public MismatchedRangeException(string message)
			: base(message)
		{
		}

		public MismatchedRangeException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public MismatchedRangeException(int a, int b, IIntStream input)
			: base(input)
		{
			_a = a;
			_b = b;
		}

		public MismatchedRangeException(string message, int a, int b, IIntStream input)
			: base(message, input)
		{
			_a = a;
			_b = b;
		}

		public MismatchedRangeException(string message, int a, int b, IIntStream input, Exception innerException)
			: base(message, input, innerException)
		{
			_a = a;
			_b = b;
		}

		protected MismatchedRangeException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			_a = info.GetInt32("A");
			_b = info.GetInt32("B");
		}

		[SecurityCritical]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			base.GetObjectData(info, context);
			info.AddValue("A", _a);
			info.AddValue("B", _b);
		}

		public override string ToString()
		{
			return "MismatchedRangeException(" + UnexpectedType + " not in [" + A + "," + B + "])";
		}
	}
	[Serializable]
	public class MismatchedSetException : RecognitionException
	{
		private readonly BitSet _expecting;

		public BitSet Expecting => _expecting;

		public MismatchedSetException()
		{
		}

		public MismatchedSetException(string message)
			: base(message)
		{
		}

		public MismatchedSetException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public MismatchedSetException(BitSet expecting, IIntStream input)
			: base(input)
		{
			_expecting = expecting;
		}

		public MismatchedSetException(string message, BitSet expecting, IIntStream input)
			: base(message, input)
		{
			_expecting = expecting;
		}

		public MismatchedSetException(string message, BitSet expecting, IIntStream input, Exception innerException)
			: base(message, input, innerException)
		{
			_expecting = expecting;
		}

		protected MismatchedSetException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			_expecting = (BitSet)info.GetValue("Expecting", typeof(BitSet));
		}

		[SecurityCritical]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			base.GetObjectData(info, context);
			info.AddValue("Expecting", _expecting);
		}

		public override string ToString()
		{
			return string.Concat("MismatchedSetException(", UnexpectedType, "!=", Expecting, ")");
		}
	}
	[Serializable]
	public class MismatchedTokenException : RecognitionException
	{
		private readonly int _expecting;

		private readonly ReadOnlyCollection<string> _tokenNames;

		public int Expecting => _expecting;

		public ReadOnlyCollection<string> TokenNames => _tokenNames;

		public MismatchedTokenException()
		{
		}

		public MismatchedTokenException(string message)
			: base(message)
		{
		}

		public MismatchedTokenException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public MismatchedTokenException(int expecting, IIntStream input)
			: this(expecting, input, null)
		{
		}

		public MismatchedTokenException(int expecting, IIntStream input, IList<string> tokenNames)
			: base(input)
		{
			_expecting = expecting;
			if (tokenNames != null)
			{
				_tokenNames = new ReadOnlyCollection<string>(new List<string>(tokenNames));
			}
		}

		public MismatchedTokenException(string message, int expecting, IIntStream input, IList<string> tokenNames)
			: base(message, input)
		{
			_expecting = expecting;
			if (tokenNames != null)
			{
				_tokenNames = new ReadOnlyCollection<string>(new List<string>(tokenNames));
			}
		}

		public MismatchedTokenException(string message, int expecting, IIntStream input, IList<string> tokenNames, Exception innerException)
			: base(message, input, innerException)
		{
			_expecting = expecting;
			if (tokenNames != null)
			{
				_tokenNames = new ReadOnlyCollection<string>(new List<string>(tokenNames));
			}
		}

		protected MismatchedTokenException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			_expecting = info.GetInt32("Expecting");
			_tokenNames = new ReadOnlyCollection<string>((string[])info.GetValue("TokenNames", typeof(string[])));
		}

		[SecurityCritical]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			base.GetObjectData(info, context);
			info.AddValue("Expecting", _expecting);
			info.AddValue("TokenNames", (_tokenNames != null) ? new List<string>(_tokenNames).ToArray() : null);
		}

		public override string ToString()
		{
			int unexpectedType = UnexpectedType;
			string text = ((TokenNames != null && unexpectedType >= 0 && unexpectedType < TokenNames.Count) ? TokenNames[unexpectedType] : unexpectedType.ToString());
			string text2 = ((TokenNames != null && Expecting >= 0 && Expecting < TokenNames.Count) ? TokenNames[Expecting] : Expecting.ToString());
			return "MismatchedTokenException(" + text + "!=" + text2 + ")";
		}
	}
	[Serializable]
	public class MismatchedTreeNodeException : RecognitionException
	{
		private readonly int _expecting;

		public int Expecting => _expecting;

		public MismatchedTreeNodeException()
		{
		}

		public MismatchedTreeNodeException(string message)
			: base(message)
		{
		}

		public MismatchedTreeNodeException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public MismatchedTreeNodeException(int expecting, ITreeNodeStream input)
			: base(input)
		{
			_expecting = expecting;
		}

		public MismatchedTreeNodeException(string message, int expecting, ITreeNodeStream input)
			: base(message, input)
		{
			_expecting = expecting;
		}

		public MismatchedTreeNodeException(string message, int expecting, ITreeNodeStream input, Exception innerException)
			: base(message, input, innerException)
		{
			_expecting = expecting;
		}

		protected MismatchedTreeNodeException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			_expecting = info.GetInt32("Expecting");
		}

		[SecurityCritical]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			base.GetObjectData(info, context);
			info.AddValue("Expecting", _expecting);
		}

		public override string ToString()
		{
			return "MismatchedTreeNodeException(" + UnexpectedType + "!=" + Expecting + ")";
		}
	}
	[Serializable]
	public class MissingTokenException : MismatchedTokenException
	{
		private readonly object _inserted;

		public virtual int MissingType => base.Expecting;

		public MissingTokenException()
		{
		}

		public MissingTokenException(string message)
			: base(message)
		{
		}

		public MissingTokenException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public MissingTokenException(int expecting, IIntStream input, object inserted)
			: this(expecting, input, inserted, null)
		{
		}

		public MissingTokenException(int expecting, IIntStream input, object inserted, IList<string> tokenNames)
			: base(expecting, input, tokenNames)
		{
			_inserted = inserted;
		}

		public MissingTokenException(string message, int expecting, IIntStream input, object inserted, IList<string> tokenNames)
			: base(message, expecting, input, tokenNames)
		{
			_inserted = inserted;
		}

		public MissingTokenException(string message, int expecting, IIntStream input, object inserted, IList<string> tokenNames, Exception innerException)
			: base(message, expecting, input, tokenNames, innerException)
		{
			_inserted = inserted;
		}

		protected MissingTokenException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public override string ToString()
		{
			if (_inserted != null && base.Token != null)
			{
				return string.Concat("MissingTokenException(inserted ", _inserted, " at ", base.Token.Text, ")");
			}
			if (base.Token != null)
			{
				return "MissingTokenException(at " + base.Token.Text + ")";
			}
			return "MissingTokenException";
		}
	}
	[Serializable]
	public class NoViableAltException : RecognitionException
	{
		private readonly string _grammarDecisionDescription;

		private readonly int _decisionNumber;

		private readonly int _stateNumber;

		public int DecisionNumber => _decisionNumber;

		public string GrammarDecisionDescription => _grammarDecisionDescription;

		public int StateNumber => _stateNumber;

		public NoViableAltException()
		{
		}

		public NoViableAltException(string grammarDecisionDescription)
		{
			_grammarDecisionDescription = grammarDecisionDescription;
		}

		public NoViableAltException(string message, string grammarDecisionDescription)
			: base(message)
		{
			_grammarDecisionDescription = grammarDecisionDescription;
		}

		public NoViableAltException(string message, string grammarDecisionDescription, Exception innerException)
			: base(message, innerException)
		{
			_grammarDecisionDescription = grammarDecisionDescription;
		}

		public NoViableAltException(string grammarDecisionDescription, int decisionNumber, int stateNumber, IIntStream input)
			: this(grammarDecisionDescription, decisionNumber, stateNumber, input, 1)
		{
		}

		public NoViableAltException(string grammarDecisionDescription, int decisionNumber, int stateNumber, IIntStream input, int k)
			: base(input, k)
		{
			_grammarDecisionDescription = grammarDecisionDescription;
			_decisionNumber = decisionNumber;
			_stateNumber = stateNumber;
		}

		public NoViableAltException(string message, string grammarDecisionDescription, int decisionNumber, int stateNumber, IIntStream input)
			: this(message, grammarDecisionDescription, decisionNumber, stateNumber, input, 1)
		{
		}

		public NoViableAltException(string message, string grammarDecisionDescription, int decisionNumber, int stateNumber, IIntStream input, int k)
			: base(message, input, k)
		{
			_grammarDecisionDescription = grammarDecisionDescription;
			_decisionNumber = decisionNumber;
			_stateNumber = stateNumber;
		}

		public NoViableAltException(string message, string grammarDecisionDescription, int decisionNumber, int stateNumber, IIntStream input, Exception innerException)
			: this(message, grammarDecisionDescription, decisionNumber, stateNumber, input, 1, innerException)
		{
		}

		public NoViableAltException(string message, string grammarDecisionDescription, int decisionNumber, int stateNumber, IIntStream input, int k, Exception innerException)
			: base(message, input, k, innerException)
		{
			_grammarDecisionDescription = grammarDecisionDescription;
			_decisionNumber = decisionNumber;
			_stateNumber = stateNumber;
		}

		protected NoViableAltException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			_grammarDecisionDescription = info.GetString("GrammarDecisionDescription");
			_decisionNumber = info.GetInt32("DecisionNumber");
			_stateNumber = info.GetInt32("StateNumber");
		}

		[SecurityCritical]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			base.GetObjectData(info, context);
			info.AddValue("GrammarDecisionDescription", _grammarDecisionDescription);
			info.AddValue("DecisionNumber", _decisionNumber);
			info.AddValue("StateNumber", _stateNumber);
		}

		public override string ToString()
		{
			if (base.Input is ICharStream)
			{
				return "NoViableAltException('" + (char)UnexpectedType + "'@[" + GrammarDecisionDescription + "])";
			}
			return "NoViableAltException(" + UnexpectedType + "@[" + GrammarDecisionDescription + "])";
		}
	}
	public class Parser : BaseRecognizer
	{
		public ITokenStream input;

		public virtual ITokenStream TokenStream
		{
			get
			{
				return input;
			}
			set
			{
				input = null;
				Reset();
				input = value;
			}
		}

		public override string SourceName => input.SourceName;

		public Parser(ITokenStream input)
		{
			TokenStream = input;
		}

		public Parser(ITokenStream input, RecognizerSharedState state)
			: base(state)
		{
			this.input = input;
		}

		public override void Reset()
		{
			base.Reset();
			if (input != null)
			{
				input.Seek(0);
			}
		}

		protected override object GetCurrentInputSymbol(IIntStream input)
		{
			return ((ITokenStream)input).LT(1);
		}

		protected override object GetMissingSymbol(IIntStream input, RecognitionException e, int expectedTokenType, BitSet follow)
		{
			string text = null;
			text = ((expectedTokenType != -1) ? ("<missing " + TokenNames[expectedTokenType] + ">") : "<missing EOF>");
			CommonToken commonToken = new CommonToken(expectedTokenType, text);
			IToken token = ((ITokenStream)input).LT(1);
			if (token.Type == -1)
			{
				token = ((ITokenStream)input).LT(-1);
			}
			commonToken.Line = token.Line;
			commonToken.CharPositionInLine = token.CharPositionInLine;
			commonToken.Channel = 0;
			commonToken.InputStream = token.InputStream;
			return commonToken;
		}

		[Conditional("ANTLR_TRACE")]
		public virtual void TraceIn(string ruleName, int ruleIndex)
		{
			base.TraceIn(ruleName, ruleIndex, input.LT(1));
		}

		[Conditional("ANTLR_TRACE")]
		public virtual void TraceOut(string ruleName, int ruleIndex)
		{
			base.TraceOut(ruleName, ruleIndex, input.LT(1));
		}
	}
	public class ParserRuleReturnScope<TToken> : IRuleReturnScope<TToken>, IRuleReturnScope
	{
		private TToken _start;

		private TToken _stop;

		public TToken Start
		{
			get
			{
				return _start;
			}
			set
			{
				_start = value;
			}
		}

		public TToken Stop
		{
			get
			{
				return _stop;
			}
			set
			{
				_stop = value;
			}
		}

		object IRuleReturnScope.Start => Start;

		object IRuleReturnScope.Stop => Stop;
	}
	[Serializable]
	public class RecognitionException : Exception
	{
		private IIntStream _input;

		private int _k;

		private int _index;

		private IToken _token;

		private object _node;

		private int _c;

		private int _line;

		private int _charPositionInLine;

		private bool _approximateLineInfo;

		public virtual int UnexpectedType
		{
			get
			{
				if (_input is ITokenStream)
				{
					return _token.Type;
				}
				if (_input is ITreeNodeStream treeNodeStream)
				{
					return treeNodeStream.TreeAdaptor.GetType(_node);
				}
				return _c;
			}
		}

		public bool ApproximateLineInfo
		{
			get
			{
				return _approximateLineInfo;
			}
			protected set
			{
				_approximateLineInfo = value;
			}
		}

		public IIntStream Input
		{
			get
			{
				return _input;
			}
			protected set
			{
				_input = value;
			}
		}

		public int Lookahead => _k;

		public IToken Token
		{
			get
			{
				return _token;
			}
			set
			{
				_token = value;
			}
		}

		public object Node
		{
			get
			{
				return _node;
			}
			protected set
			{
				_node = value;
			}
		}

		public int Character
		{
			get
			{
				return _c;
			}
			protected set
			{
				_c = value;
			}
		}

		public int Index
		{
			get
			{
				return _index;
			}
			protected set
			{
				_index = value;
			}
		}

		public int Line
		{
			get
			{
				return _line;
			}
			set
			{
				_line = value;
			}
		}

		public int CharPositionInLine
		{
			get
			{
				return _charPositionInLine;
			}
			set
			{
				_charPositionInLine = value;
			}
		}

		public RecognitionException()
			: this("A recognition error occurred.", null, null)
		{
		}

		public RecognitionException(IIntStream input)
			: this("A recognition error occurred.", input, 1, null)
		{
		}

		public RecognitionException(IIntStream input, int k)
			: this("A recognition error occurred.", input, k, null)
		{
		}

		public RecognitionException(string message)
			: this(message, null, null)
		{
		}

		public RecognitionException(string message, IIntStream input)
			: this(message, input, 1, null)
		{
		}

		public RecognitionException(string message, IIntStream input, int k)
			: this(message, input, k, null)
		{
		}

		public RecognitionException(string message, Exception innerException)
			: this(message, null, innerException)
		{
		}

		public RecognitionException(string message, IIntStream input, Exception innerException)
			: this(message, input, 1, innerException)
		{
		}

		public RecognitionException(string message, IIntStream input, int k, Exception innerException)
			: base(message, innerException)
		{
			_input = input;
			_k = k;
			if (input == null)
			{
				return;
			}
			_index = input.Index + k - 1;
			if (input is ITokenStream)
			{
				_token = ((ITokenStream)input).LT(k);
				_line = _token.Line;
				_charPositionInLine = _token.CharPositionInLine;
			}
			if (input is ITreeNodeStream input2)
			{
				ExtractInformationFromTreeNodeStream(input2, k);
				return;
			}
			if (input is ICharStream)
			{
				int marker = input.Mark();
				try
				{
					for (int i = 0; i < k - 1; i++)
					{
						input.Consume();
					}
					_c = input.LA(1);
					_line = ((ICharStream)input).Line;
					_charPositionInLine = ((ICharStream)input).CharPositionInLine;
					return;
				}
				finally
				{
					input.Rewind(marker);
				}
			}
			_c = input.LA(k);
		}

		protected RecognitionException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			_index = info.GetInt32("Index");
			_c = info.GetInt32("C");
			_line = info.GetInt32("Line");
			_charPositionInLine = info.GetInt32("CharPositionInLine");
			_approximateLineInfo = info.GetBoolean("ApproximateLineInfo");
		}

		[SecurityCritical]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			base.GetObjectData(info, context);
			info.AddValue("Index", _index);
			info.AddValue("C", _c);
			info.AddValue("Line", _line);
			info.AddValue("CharPositionInLine", _charPositionInLine);
			info.AddValue("ApproximateLineInfo", _approximateLineInfo);
		}

		protected virtual void ExtractInformationFromTreeNodeStream(ITreeNodeStream input)
		{
			_node = input.LT(1);
			object obj = null;
			if (input is IPositionTrackingStream positionTrackingStream)
			{
				obj = positionTrackingStream.GetKnownPositionElement(allowApproximateLocation: false);
				if (obj == null)
				{
					obj = positionTrackingStream.GetKnownPositionElement(allowApproximateLocation: true);
					_approximateLineInfo = obj != null;
				}
			}
			if (input is ITokenStreamInformation tokenStreamInformation)
			{
				IToken lastToken = tokenStreamInformation.LastToken;
				IToken lastRealToken = tokenStreamInformation.LastRealToken;
				if (lastRealToken != null)
				{
					_token = lastRealToken;
					_line = lastRealToken.Line;
					_charPositionInLine = lastRealToken.CharPositionInLine;
					_approximateLineInfo = lastRealToken.Equals(lastToken);
				}
				return;
			}
			ITreeAdaptor treeAdaptor = input.TreeAdaptor;
			IToken token = treeAdaptor.GetToken(obj ?? _node);
			if (token != null)
			{
				_token = token;
				if (token.Line <= 0)
				{
					int num = -1;
					object obj2 = input.LT(num);
					while (obj2 != null)
					{
						IToken token2 = treeAdaptor.GetToken(obj2);
						if (token2 != null && token2.Line > 0)
						{
							_line = token2.Line;
							_charPositionInLine = token2.CharPositionInLine;
							_approximateLineInfo = true;
							break;
						}
						num--;
						try
						{
							obj2 = input.LT(num);
						}
						catch (NotSupportedException)
						{
							obj2 = null;
						}
					}
				}
				else
				{
					_line = token.Line;
					_charPositionInLine = token.CharPositionInLine;
				}
			}
			else if (_node is ITree)
			{
				_line = ((ITree)_node).Line;
				_charPositionInLine = ((ITree)_node).CharPositionInLine;
				if (_node is CommonTree)
				{
					_token = ((CommonTree)_node).Token;
				}
			}
			else
			{
				int type = treeAdaptor.GetType(_node);
				string text = treeAdaptor.GetText(_node);
				_token = new CommonToken(type, text);
			}
		}

		protected virtual void ExtractInformationFromTreeNodeStream(ITreeNodeStream input, int k)
		{
			int marker = input.Mark();
			try
			{
				for (int i = 0; i < k - 1; i++)
				{
					input.Consume();
				}
				ExtractInformationFromTreeNodeStream(input);
			}
			finally
			{
				input.Rewind(marker);
			}
		}
	}
	public class RecognizerSharedState
	{
		public BitSet[] following;

		[CLSCompliant(false)]
		public int _fsp;

		public bool errorRecovery;

		public int lastErrorIndex;

		public bool failed;

		public int syntaxErrors;

		public int backtracking;

		public IDictionary<int, int>[] ruleMemo;

		public IToken token;

		public int tokenStartCharIndex;

		public int tokenStartLine;

		public int tokenStartCharPositionInLine;

		public int channel;

		public int type;

		public string text;

		public RecognizerSharedState()
		{
			following = new BitSet[100];
			_fsp = -1;
			lastErrorIndex = -1;
			tokenStartCharIndex = -1;
		}

		public RecognizerSharedState(RecognizerSharedState state)
		{
			if (state == null)
			{
				throw new ArgumentNullException("state");
			}
			following = (BitSet[])state.following.Clone();
			_fsp = state._fsp;
			errorRecovery = state.errorRecovery;
			lastErrorIndex = state.lastErrorIndex;
			failed = state.failed;
			syntaxErrors = state.syntaxErrors;
			backtracking = state.backtracking;
			if (state.ruleMemo != null)
			{
				ruleMemo = (IDictionary<int, int>[])state.ruleMemo.Clone();
			}
			token = state.token;
			tokenStartCharIndex = state.tokenStartCharIndex;
			tokenStartCharPositionInLine = state.tokenStartCharPositionInLine;
			channel = state.channel;
			type = state.type;
			text = state.text;
		}
	}
	public class TemplateParserRuleReturnScope<TTemplate, TToken> : ParserRuleReturnScope<TToken>, ITemplateRuleReturnScope<TTemplate>, ITemplateRuleReturnScope
	{
		private TTemplate _template;

		public TTemplate Template
		{
			get
			{
				return _template;
			}
			set
			{
				_template = value;
			}
		}

		object ITemplateRuleReturnScope.Template => Template;
	}
	public static class TokenChannels
	{
		public const int Default = 0;

		public const int Hidden = 99;
	}
	[Serializable]
	[DebuggerDisplay("TODO: TokenRewriteStream debugger display")]
	public class TokenRewriteStream : CommonTokenStream
	{
		protected class RewriteOperation
		{
			public int instructionIndex;

			public int index;

			public object text;

			protected TokenRewriteStream stream;

			protected RewriteOperation(TokenRewriteStream stream, int index)
			{
				this.stream = stream;
				this.index = index;
			}

			protected RewriteOperation(TokenRewriteStream stream, int index, object text)
			{
				this.index = index;
				this.text = text;
				this.stream = stream;
			}

			public virtual int Execute(StringBuilder buf)
			{
				return index;
			}

			public override string ToString()
			{
				string name = GetType().Name;
				int num = name.IndexOf('$');
				name = name.Substring(num + 1);
				return $"<{name}@{stream._tokens[index]}:\"{text}\">";
			}
		}

		private class InsertBeforeOp : RewriteOperation
		{
			public InsertBeforeOp(TokenRewriteStream stream, int index, object text)
				: base(stream, index, text)
			{
			}

			public override int Execute(StringBuilder buf)
			{
				buf.Append(text);
				if (stream._tokens[index].Type != -1)
				{
					buf.Append(stream._tokens[index].Text);
				}
				return index + 1;
			}
		}

		private class ReplaceOp : RewriteOperation
		{
			public int lastIndex;

			public ReplaceOp(TokenRewriteStream stream, int from, int to, object text)
				: base(stream, from, text)
			{
				lastIndex = to;
			}

			public override int Execute(StringBuilder buf)
			{
				if (text != null)
				{
					buf.Append(text);
				}
				return lastIndex + 1;
			}

			public override string ToString()
			{
				if (text == null)
				{
					return $"<DeleteOp@{stream._tokens[index]}..{stream._tokens[lastIndex]}>";
				}
				return $"<ReplaceOp@{stream._tokens[index]}..{stream._tokens[lastIndex]}:\"{text}\">";
			}
		}

		public const string DEFAULT_PROGRAM_NAME = "default";

		public const int PROGRAM_INIT_SIZE = 100;

		public const int MIN_TOKEN_INDEX = 0;

		protected IDictionary<string, IList<RewriteOperation>> programs;

		protected IDictionary<string, int> lastRewriteTokenIndexes;

		public TokenRewriteStream()
		{
			Init();
		}

		protected void Init()
		{
			programs = new Dictionary<string, IList<RewriteOperation>>();
			programs["default"] = new List<RewriteOperation>(100);
			lastRewriteTokenIndexes = new Dictionary<string, int>();
		}

		public TokenRewriteStream(ITokenSource tokenSource)
			: base(tokenSource)
		{
			Init();
		}

		public TokenRewriteStream(ITokenSource tokenSource, int channel)
			: base(tokenSource, channel)
		{
			Init();
		}

		public virtual void Rollback(int instructionIndex)
		{
			Rollback("default", instructionIndex);
		}

		public virtual void Rollback(string programName, int instructionIndex)
		{
			if (programs.TryGetValue(programName, out var value) && value != null)
			{
				List<RewriteOperation> list = new List<RewriteOperation>();
				for (int i = 0; i <= instructionIndex; i++)
				{
					list.Add(value[i]);
				}
				programs[programName] = list;
			}
		}

		public virtual void DeleteProgram()
		{
			DeleteProgram("default");
		}

		public virtual void DeleteProgram(string programName)
		{
			Rollback(programName, 0);
		}

		public virtual void InsertAfter(IToken t, object text)
		{
			InsertAfter("default", t, text);
		}

		public virtual void InsertAfter(int index, object text)
		{
			InsertAfter("default", index, text);
		}

		public virtual void InsertAfter(string programName, IToken t, object text)
		{
			InsertAfter(programName, t.TokenIndex, text);
		}

		public virtual void InsertAfter(string programName, int index, object text)
		{
			InsertBefore(programName, index + 1, text);
		}

		public virtual void InsertBefore(IToken t, object text)
		{
			InsertBefore("default", t, text);
		}

		public virtual void InsertBefore(int index, object text)
		{
			InsertBefore("default", index, text);
		}

		public virtual void InsertBefore(string programName, IToken t, object text)
		{
			InsertBefore(programName, t.TokenIndex, text);
		}

		public virtual void InsertBefore(string programName, int index, object text)
		{
			RewriteOperation rewriteOperation = new InsertBeforeOp(this, index, text);
			IList<RewriteOperation> program = GetProgram(programName);
			rewriteOperation.instructionIndex = program.Count;
			program.Add(rewriteOperation);
		}

		public virtual void Replace(int index, object text)
		{
			Replace("default", index, index, text);
		}

		public virtual void Replace(int from, int to, object text)
		{
			Replace("default", from, to, text);
		}

		public virtual void Replace(IToken indexT, object text)
		{
			Replace("default", indexT, indexT, text);
		}

		public virtual void Replace(IToken from, IToken to, object text)
		{
			Replace("default", from, to, text);
		}

		public virtual void Replace(string programName, int from, int to, object text)
		{
			if (from > to || from < 0 || to < 0 || to >= _tokens.Count)
			{
				throw new ArgumentException("replace: range invalid: " + from + ".." + to + "(size=" + _tokens.Count + ")");
			}
			RewriteOperation rewriteOperation = new ReplaceOp(this, from, to, text);
			IList<RewriteOperation> program = GetProgram(programName);
			rewriteOperation.instructionIndex = program.Count;
			program.Add(rewriteOperation);
		}

		public virtual void Replace(string programName, IToken from, IToken to, object text)
		{
			Replace(programName, from.TokenIndex, to.TokenIndex, text);
		}

		public virtual void Delete(int index)
		{
			Delete("default", index, index);
		}

		public virtual void Delete(int from, int to)
		{
			Delete("default", from, to);
		}

		public virtual void Delete(IToken indexT)
		{
			Delete("default", indexT, indexT);
		}

		public virtual void Delete(IToken from, IToken to)
		{
			Delete("default", from, to);
		}

		public virtual void Delete(string programName, int from, int to)
		{
			Replace(programName, from, to, null);
		}

		public virtual void Delete(string programName, IToken from, IToken to)
		{
			Replace(programName, from, to, null);
		}

		public virtual int GetLastRewriteTokenIndex()
		{
			return GetLastRewriteTokenIndex("default");
		}

		protected virtual int GetLastRewriteTokenIndex(string programName)
		{
			if (lastRewriteTokenIndexes.TryGetValue(programName, out var value))
			{
				return value;
			}
			return -1;
		}

		protected virtual void SetLastRewriteTokenIndex(string programName, int i)
		{
			lastRewriteTokenIndexes[programName] = i;
		}

		protected virtual IList<RewriteOperation> GetProgram(string name)
		{
			if (!programs.TryGetValue(name, out var value) || value == null)
			{
				return InitializeProgram(name);
			}
			return value;
		}

		private IList<RewriteOperation> InitializeProgram(string name)
		{
			IList<RewriteOperation> list = new List<RewriteOperation>(100);
			programs[name] = list;
			return list;
		}

		public virtual string ToOriginalString()
		{
			Fill();
			return ToOriginalString(0, Count - 1);
		}

		public virtual string ToOriginalString(int start, int end)
		{
			StringBuilder stringBuilder = new StringBuilder();
			for (int i = start; i >= 0 && i <= end && i < _tokens.Count; i++)
			{
				if (Get(i).Type != -1)
				{
					stringBuilder.Append(Get(i).Text);
				}
			}
			return stringBuilder.ToString();
		}

		public override string ToString()
		{
			Fill();
			return ToString(0, Count - 1);
		}

		public virtual string ToString(string programName)
		{
			Fill();
			return ToString(programName, 0, Count - 1);
		}

		public override string ToString(int start, int end)
		{
			return ToString("default", start, end);
		}

		public virtual string ToString(string programName, int start, int end)
		{
			if (!programs.TryGetValue(programName, out var value))
			{
				value = null;
			}
			if (end > _tokens.Count - 1)
			{
				end = _tokens.Count - 1;
			}
			if (start < 0)
			{
				start = 0;
			}
			if (value == null || value.Count == 0)
			{
				return ToOriginalString(start, end);
			}
			StringBuilder stringBuilder = new StringBuilder();
			IDictionary<int, RewriteOperation> dictionary = ReduceToSingleOperationPerIndex(value);
			int num = start;
			while (num <= end && num < _tokens.Count)
			{
				RewriteOperation value2;
				bool num2 = dictionary.TryGetValue(num, out value2);
				if (num2)
				{
					dictionary.Remove(num);
				}
				if (!num2 || value2 == null)
				{
					IToken token = _tokens[num];
					if (token.Type != -1)
					{
						stringBuilder.Append(token.Text);
					}
					num++;
				}
				else
				{
					num = value2.Execute(stringBuilder);
				}
			}
			if (end == _tokens.Count - 1)
			{
				foreach (RewriteOperation value3 in dictionary.Values)
				{
					if (value3.index >= _tokens.Count - 1)
					{
						stringBuilder.Append(value3.text);
					}
				}
			}
			return stringBuilder.ToString();
		}

		protected virtual IDictionary<int, RewriteOperation> ReduceToSingleOperationPerIndex(IList<RewriteOperation> rewrites)
		{
			for (int i = 0; i < rewrites.Count; i++)
			{
				RewriteOperation rewriteOperation = rewrites[i];
				if (rewriteOperation == null || !(rewriteOperation is ReplaceOp))
				{
					continue;
				}
				ReplaceOp replaceOp = (ReplaceOp)rewrites[i];
				IList<RewriteOperation> kindOfOps = GetKindOfOps(rewrites, typeof(InsertBeforeOp), i);
				for (int j = 0; j < kindOfOps.Count; j++)
				{
					InsertBeforeOp insertBeforeOp = (InsertBeforeOp)kindOfOps[j];
					if (insertBeforeOp.index == replaceOp.index)
					{
						rewrites[insertBeforeOp.instructionIndex] = null;
						replaceOp.text = insertBeforeOp.text.ToString() + ((replaceOp.text != null) ? replaceOp.text.ToString() : string.Empty);
					}
					else if (insertBeforeOp.index > replaceOp.index && insertBeforeOp.index <= replaceOp.lastIndex)
					{
						rewrites[insertBeforeOp.instructionIndex] = null;
					}
				}
				IList<RewriteOperation> kindOfOps2 = GetKindOfOps(rewrites, typeof(ReplaceOp), i);
				for (int k = 0; k < kindOfOps2.Count; k++)
				{
					ReplaceOp replaceOp2 = (ReplaceOp)kindOfOps2[k];
					if (replaceOp2.index >= replaceOp.index && replaceOp2.lastIndex <= replaceOp.lastIndex)
					{
						rewrites[replaceOp2.instructionIndex] = null;
						continue;
					}
					bool flag = replaceOp2.lastIndex < replaceOp.index || replaceOp2.index > replaceOp.lastIndex;
					bool flag2 = replaceOp2.index == replaceOp.index && replaceOp2.lastIndex == replaceOp.lastIndex;
					if (replaceOp2.text == null && replaceOp.text == null && !flag)
					{
						rewrites[replaceOp2.instructionIndex] = null;
						replaceOp.index = Math.Min(replaceOp2.index, replaceOp.index);
						replaceOp.lastIndex = Math.Max(replaceOp2.lastIndex, replaceOp.lastIndex);
						Console.WriteLine("new rop " + replaceOp);
					}
					else if (!flag && !flag2)
					{
						throw new ArgumentException(string.Concat("replace op boundaries of ", replaceOp, " overlap with previous ", replaceOp2));
					}
				}
			}
			for (int l = 0; l < rewrites.Count; l++)
			{
				RewriteOperation rewriteOperation2 = rewrites[l];
				if (rewriteOperation2 == null || !(rewriteOperation2 is InsertBeforeOp))
				{
					continue;
				}
				InsertBeforeOp insertBeforeOp2 = (InsertBeforeOp)rewrites[l];
				IList<RewriteOperation> kindOfOps3 = GetKindOfOps(rewrites, typeof(InsertBeforeOp), l);
				for (int m = 0; m < kindOfOps3.Count; m++)
				{
					InsertBeforeOp insertBeforeOp3 = (InsertBeforeOp)kindOfOps3[m];
					if (insertBeforeOp3.index == insertBeforeOp2.index)
					{
						insertBeforeOp2.text = CatOpText(insertBeforeOp2.text, insertBeforeOp3.text);
						rewrites[insertBeforeOp3.instructionIndex] = null;
					}
				}
				IList<RewriteOperation> kindOfOps4 = GetKindOfOps(rewrites, typeof(ReplaceOp), l);
				for (int n = 0; n < kindOfOps4.Count; n++)
				{
					ReplaceOp replaceOp3 = (ReplaceOp)kindOfOps4[n];
					if (insertBeforeOp2.index == replaceOp3.index)
					{
						replaceOp3.text = CatOpText(insertBeforeOp2.text, replaceOp3.text);
						rewrites[l] = null;
					}
					else if (insertBeforeOp2.index >= replaceOp3.index && insertBeforeOp2.index <= replaceOp3.lastIndex)
					{
						throw new ArgumentException(string.Concat("insert op ", insertBeforeOp2, " within boundaries of previous ", replaceOp3));
					}
				}
			}
			IDictionary<int, RewriteOperation> dictionary = new Dictionary<int, RewriteOperation>();
			for (int num = 0; num < rewrites.Count; num++)
			{
				RewriteOperation rewriteOperation3 = rewrites[num];
				if (rewriteOperation3 != null)
				{
					if (dictionary.TryGetValue(rewriteOperation3.index, out var value) && value != null)
					{
						throw new Exception("should only be one op per index");
					}
					dictionary[rewriteOperation3.index] = rewriteOperation3;
				}
			}
			return dictionary;
		}

		protected virtual string CatOpText(object a, object b)
		{
			return string.Concat(a, b);
		}

		protected virtual IList<RewriteOperation> GetKindOfOps(IList<RewriteOperation> rewrites, Type kind)
		{
			return GetKindOfOps(rewrites, kind, rewrites.Count);
		}

		protected virtual IList<RewriteOperation> GetKindOfOps(IList<RewriteOperation> rewrites, Type kind, int before)
		{
			IList<RewriteOperation> list = new List<RewriteOperation>();
			for (int i = 0; i < before && i < rewrites.Count; i++)
			{
				RewriteOperation rewriteOperation = rewrites[i];
				if (rewriteOperation != null && (object)rewriteOperation.GetType() == kind)
				{
					list.Add(rewriteOperation);
				}
			}
			return list;
		}

		public virtual string ToDebugString()
		{
			return ToDebugString(0, Count - 1);
		}

		public virtual string ToDebugString(int start, int end)
		{
			StringBuilder stringBuilder = new StringBuilder();
			for (int i = start; i >= 0 && i <= end && i < _tokens.Count; i++)
			{
				stringBuilder.Append(Get(i));
			}
			return stringBuilder.ToString();
		}
	}
	public static class Tokens
	{
		public static readonly IToken Skip = new CommonToken(0);
	}
	public static class TokenTypes
	{
		public const int EndOfFile = -1;

		public const int Invalid = 0;

		public const int EndOfRule = 1;

		public const int Down = 2;

		public const int Up = 3;

		public const int Min = 4;
	}
	public class UnbufferedTokenStream : LookaheadStream<IToken>, ITokenStream, IIntStream, ITokenStreamInformation
	{
		[CLSCompliant(false)]
		protected ITokenSource tokenSource;

		protected int tokenIndex;

		protected int channel;

		private readonly ListStack<IToken> _realTokens = new ListStack<IToken> { null };

		public ITokenSource TokenSource => tokenSource;

		public string SourceName => TokenSource.SourceName;

		public IToken LastToken => LB(1);

		public IToken LastRealToken => _realTokens.Peek();

		public int MaxLookBehind => 1;

		public UnbufferedTokenStream(ITokenSource tokenSource)
		{
			this.tokenSource = tokenSource;
		}

		public override int Mark()
		{
			_realTokens.Push(_realTokens.Peek());
			return base.Mark();
		}

		public override void Release(int marker)
		{
			base.Release(marker);
			_realTokens.Pop();
		}

		public override void Clear()
		{
			_realTokens.Clear();
			_realTokens.Push(null);
		}

		public override void Consume()
		{
			base.Consume();
			if (base.PreviousElement != null && base.PreviousElement.Line > 0)
			{
				_realTokens[_realTokens.Count - 1] = base.PreviousElement;
			}
		}

		public override IToken NextElement()
		{
			IToken token = tokenSource.NextToken();
			token.TokenIndex = tokenIndex++;
			return token;
		}

		public override bool IsEndOfFile(IToken o)
		{
			return o.Type == -1;
		}

		public IToken Get(int i)
		{
			throw new NotSupportedException("Absolute token indexes are meaningless in an unbuffered stream");
		}

		public int LA(int i)
		{
			return LT(i).Type;
		}

		public string ToString(int start, int stop)
		{
			return "n/a";
		}

		public string ToString(IToken start, IToken stop)
		{
			return "n/a";
		}
	}
	[Serializable]
	public class UnwantedTokenException : MismatchedTokenException
	{
		public virtual IToken UnexpectedToken => base.Token;

		public UnwantedTokenException()
		{
		}

		public UnwantedTokenException(string message)
			: base(message)
		{
		}

		public UnwantedTokenException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public UnwantedTokenException(int expecting, IIntStream input)
			: base(expecting, input)
		{
		}

		public UnwantedTokenException(int expecting, IIntStream input, IList<string> tokenNames)
			: base(expecting, input, tokenNames)
		{
		}

		public UnwantedTokenException(string message, int expecting, IIntStream input, IList<string> tokenNames)
			: base(message, expecting, input, tokenNames)
		{
		}

		public UnwantedTokenException(string message, int expecting, IIntStream input, IList<string> tokenNames, Exception innerException)
			: base(message, expecting, input, tokenNames, innerE

plugins\Dependencies\Configils-Required-Dependencies\NCalc.dll

Decompiled a month ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using Antlr.Runtime;
using Antlr.Runtime.Tree;
using NCalc.Domain;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyFileVersion("3.5.0.4")]
[assembly: AssemblyInformationalVersion("3.5.0+cbc3cfcd0b")]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("https://github.com/ncalc")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Sebastien Ros and contributors")]
[assembly: AssemblyDescription("NCalc is a mathematical expressions evaluator in .NET. NCalc can parse any expression and evaluate the result, including static or dynamic parameters and custom functions. This version targets .NET Standard 2.0 framework.")]
[assembly: AssemblyProduct("NCalc")]
[assembly: AssemblyTitle("NCalc")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ncalc/ncalc.git")]
[assembly: AssemblyVersion("3.5.0.0")]
[GeneratedCode("Nerdbank.GitVersioning.Tasks", "3.4.244.2758")]
[ExcludeFromCodeCoverage]
internal static class ThisAssembly
{
	internal const string AssemblyConfiguration = "Release";

	internal const string AssemblyFileVersion = "3.5.0.4";

	internal const string AssemblyInformationalVersion = "3.5.0+cbc3cfcd0b";

	internal const string AssemblyName = "NCalc";

	internal const string AssemblyTitle = "NCalc";

	internal const string AssemblyVersion = "3.5.0.0";

	internal static readonly DateTime GitCommitDate = new DateTime(637904536960000000L, DateTimeKind.Utc);

	internal const string GitCommitId = "cbc3cfcd0b440d3378cde3ecdf0183064ab15f85";

	internal const bool IsPrerelease = false;

	internal const bool IsPublicRelease = true;

	internal const string RootNamespace = "NCalc";
}
namespace NCalc
{
	public delegate void EvaluateFunctionHandler(string name, FunctionArgs args);
	public delegate void EvaluateParameterHandler(string name, ParameterArgs args);
	public class EvaluationException : ApplicationException
	{
		public EvaluationException(string message)
			: base(message)
		{
		}

		public EvaluationException(string message, Exception innerException)
			: base(message, innerException)
		{
		}
	}
	[Flags]
	public enum EvaluateOptions
	{
		None = 1,
		IgnoreCase = 2,
		NoCache = 4,
		IterateParameters = 8,
		RoundAwayFromZero = 0x10
	}
	public class Expression
	{
		protected string OriginalExpression;

		protected CultureInfo CultureInfo;

		private static bool _cacheEnabled = true;

		private static Dictionary<string, WeakReference> _compiledExpressions = new Dictionary<string, WeakReference>();

		private static readonly ReaderWriterLock Rwl = new ReaderWriterLock();

		protected Dictionary<string, IEnumerator> ParameterEnumerators;

		protected Dictionary<string, object> ParametersBackup;

		private Dictionary<string, object> _parameters;

		public EvaluateOptions Options { get; set; }

		public static bool CacheEnabled
		{
			get
			{
				return _cacheEnabled;
			}
			set
			{
				_cacheEnabled = value;
				if (!CacheEnabled)
				{
					_compiledExpressions = new Dictionary<string, WeakReference>();
				}
			}
		}

		public string Error { get; private set; }

		public LogicalExpression ParsedExpression { get; private set; }

		public Dictionary<string, object> Parameters
		{
			get
			{
				return _parameters ?? (_parameters = new Dictionary<string, object>());
			}
			set
			{
				_parameters = value;
			}
		}

		public event EvaluateFunctionHandler EvaluateFunction;

		public event EvaluateParameterHandler EvaluateParameter;

		public Expression(string expression)
			: this(expression, EvaluateOptions.None, CultureInfo.CurrentCulture)
		{
		}

		public Expression(string expression, CultureInfo cultureInfo)
			: this(expression, EvaluateOptions.None, cultureInfo)
		{
		}

		public Expression(string expression, EvaluateOptions options)
			: this(expression, options, CultureInfo.CurrentCulture)
		{
		}

		public Expression(string expression, EvaluateOptions options, CultureInfo cultureInfo)
		{
			if (string.IsNullOrEmpty(expression))
			{
				throw new ArgumentException("Expression can't be empty", "expression");
			}
			OriginalExpression = expression;
			Options = options;
			CultureInfo = cultureInfo;
		}

		public Expression(LogicalExpression expression)
			: this(expression, EvaluateOptions.None, CultureInfo.CurrentCulture)
		{
		}

		public Expression(LogicalExpression expression, EvaluateOptions options, CultureInfo cultureInfo)
		{
			if (expression == null)
			{
				throw new ArgumentException("Expression can't be null", "expression");
			}
			ParsedExpression = expression;
			Options = options;
			CultureInfo = cultureInfo;
		}

		private static void CleanCache()
		{
			List<string> list = new List<string>();
			try
			{
				Rwl.AcquireWriterLock(-1);
				foreach (KeyValuePair<string, WeakReference> compiledExpression in _compiledExpressions)
				{
					if (!compiledExpression.Value.IsAlive)
					{
						list.Add(compiledExpression.Key);
					}
				}
				foreach (string item in list)
				{
					_compiledExpressions.Remove(item);
				}
			}
			finally
			{
				Rwl.ReleaseReaderLock();
			}
		}

		public static LogicalExpression Compile(string expression, bool nocache)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			LogicalExpression logicalExpression = null;
			if (_cacheEnabled && !nocache)
			{
				try
				{
					Rwl.AcquireReaderLock(-1);
					if (_compiledExpressions.ContainsKey(expression))
					{
						WeakReference weakReference = _compiledExpressions[expression];
						logicalExpression = weakReference.Target as LogicalExpression;
						if (weakReference.IsAlive && logicalExpression != null)
						{
							return logicalExpression;
						}
					}
				}
				finally
				{
					Rwl.ReleaseReaderLock();
				}
			}
			if (logicalExpression == null)
			{
				NCalcParser nCalcParser = new NCalcParser((ITokenStream)new CommonTokenStream((ITokenSource)(object)new NCalcLexer((ICharStream)new ANTLRStringStream(expression))));
				logicalExpression = nCalcParser.GetExpression();
				if (nCalcParser.Errors != null && nCalcParser.Errors.Count > 0)
				{
					throw new EvaluationException(string.Join(Environment.NewLine, nCalcParser.Errors.ToArray()));
				}
				if (_cacheEnabled && !nocache)
				{
					try
					{
						Rwl.AcquireWriterLock(-1);
						_compiledExpressions[expression] = new WeakReference(logicalExpression);
					}
					finally
					{
						Rwl.ReleaseWriterLock();
					}
					CleanCache();
				}
			}
			return logicalExpression;
		}

		public bool HasErrors()
		{
			try
			{
				if (ParsedExpression == null)
				{
					ParsedExpression = Compile(OriginalExpression, (Options & EvaluateOptions.NoCache) == EvaluateOptions.NoCache);
				}
				return ParsedExpression != null && Error != null;
			}
			catch (Exception ex)
			{
				Error = ex.Message;
				return true;
			}
		}

		public object Evaluate()
		{
			if (HasErrors())
			{
				throw new EvaluationException(Error);
			}
			if (ParsedExpression == null)
			{
				ParsedExpression = Compile(OriginalExpression, (Options & EvaluateOptions.NoCache) == EvaluateOptions.NoCache);
			}
			EvaluationVisitor evaluationVisitor = new EvaluationVisitor(Options, CultureInfo);
			evaluationVisitor.EvaluateFunction += this.EvaluateFunction;
			evaluationVisitor.EvaluateParameter += this.EvaluateParameter;
			evaluationVisitor.Parameters = Parameters;
			if ((Options & EvaluateOptions.IterateParameters) == EvaluateOptions.IterateParameters)
			{
				int num = -1;
				ParametersBackup = new Dictionary<string, object>();
				foreach (string key in Parameters.Keys)
				{
					ParametersBackup.Add(key, Parameters[key]);
				}
				ParameterEnumerators = new Dictionary<string, IEnumerator>();
				foreach (object value in Parameters.Values)
				{
					if (!(value is IEnumerable))
					{
						continue;
					}
					int num2 = 0;
					foreach (object item in (IEnumerable)value)
					{
						_ = item;
						num2++;
					}
					if (num == -1)
					{
						num = num2;
					}
					else if (num2 != num)
					{
						throw new EvaluationException("When IterateParameters option is used, IEnumerable parameters must have the same number of items");
					}
				}
				foreach (string key2 in Parameters.Keys)
				{
					if (Parameters[key2] is IEnumerable enumerable)
					{
						ParameterEnumerators.Add(key2, enumerable.GetEnumerator());
					}
				}
				List<object> list = new List<object>();
				for (int i = 0; i < num; i++)
				{
					foreach (string key3 in ParameterEnumerators.Keys)
					{
						IEnumerator enumerator5 = ParameterEnumerators[key3];
						enumerator5.MoveNext();
						Parameters[key3] = enumerator5.Current;
					}
					ParsedExpression.Accept(evaluationVisitor);
					list.Add(evaluationVisitor.Result);
				}
				return list;
			}
			ParsedExpression.Accept(evaluationVisitor);
			return evaluationVisitor.Result;
		}
	}
	public class FunctionArgs : EventArgs
	{
		private object _result;

		private Expression[] _parameters = new Expression[0];

		public object Result
		{
			get
			{
				return _result;
			}
			set
			{
				_result = value;
				HasResult = true;
			}
		}

		public bool HasResult { get; set; }

		public Expression[] Parameters
		{
			get
			{
				return _parameters;
			}
			set
			{
				_parameters = value;
			}
		}

		public object[] EvaluateParameters()
		{
			object[] array = new object[_parameters.Length];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = _parameters[i].Evaluate();
			}
			return array;
		}
	}
	[GeneratedCode("ANTLR", "3.5.0.2")]
	[CLSCompliant(false)]
	public class NCalcLexer : Lexer
	{
		private class DFA10 : DFA
		{
			private const string DFA10_eotS = "\u0003\uffff\u0001\u0006\u0003\uffff";

			private const string DFA10_eofS = "\a\uffff";

			private const string DFA10_minS = "\u0002.\u0001\uffff\u00010\u0003\uffff";

			private const string DFA10_maxS = "\u00019\u0001e\u0001\uffff\u00019\u0003\uffff";

			private const string DFA10_acceptS = "\u0002\uffff\u0001\u0001\u0001\uffff\u0001\u0003\u0001\u0001\u0001\u0002";

			private const string DFA10_specialS = "\a\uffff}>";

			private static readonly string[] DFA10_transitionS;

			private static readonly short[] DFA10_eot;

			private static readonly short[] DFA10_eof;

			private static readonly char[] DFA10_min;

			private static readonly char[] DFA10_max;

			private static readonly short[] DFA10_accept;

			private static readonly short[] DFA10_special;

			private static readonly short[][] DFA10_transition;

			public override string Description => "262:1: FLOAT : ( ( DIGIT )* '.' ( DIGIT )+ ( EXPONENT )? | ( DIGIT )+ '.' ( DIGIT )* ( EXPONENT )? | ( DIGIT )+ EXPONENT );";

			static DFA10()
			{
				DFA10_transitionS = new string[7] { "\u0001\u0002\u0001\uffff\n\u0001", "\u0001\u0003\u0001\uffff\n\u0001\v\uffff\u0001\u0004\u001f\uffff\u0001\u0004", "", "\n\u0005", "", "", "" };
				DFA10_eot = DFA.UnpackEncodedString("\u0003\uffff\u0001\u0006\u0003\uffff");
				DFA10_eof = DFA.UnpackEncodedString("\a\uffff");
				DFA10_min = DFA.UnpackEncodedStringToUnsignedChars("\u0002.\u0001\uffff\u00010\u0003\uffff");
				DFA10_max = DFA.UnpackEncodedStringToUnsignedChars("\u00019\u0001e\u0001\uffff\u00019\u0003\uffff");
				DFA10_accept = DFA.UnpackEncodedString("\u0002\uffff\u0001\u0001\u0001\uffff\u0001\u0003\u0001\u0001\u0001\u0002");
				DFA10_special = DFA.UnpackEncodedString("\a\uffff}>");
				int num = DFA10_transitionS.Length;
				DFA10_transition = new short[num][];
				for (int i = 0; i < num; i++)
				{
					DFA10_transition[i] = DFA.UnpackEncodedString(DFA10_transitionS[i]);
				}
			}

			public DFA10(BaseRecognizer recognizer)
			{
				base.recognizer = recognizer;
				base.decisionNumber = 10;
				base.eot = DFA10_eot;
				base.eof = DFA10_eof;
				base.min = DFA10_min;
				base.max = DFA10_max;
				base.accept = DFA10_accept;
				base.special = DFA10_special;
				base.transition = DFA10_transition;
			}

			public override void Error(NoViableAltException nvae)
			{
			}
		}

		private class DFA17 : DFA
		{
			private const string DFA17_eotS = "\u0001\uffff\u0001!\u0001\uffff\u0001#\u0002\uffff\u0001%\u0005\uffff\u0001)\u0001+\u0001.\u0002\uffff\u00010\u0001\uffff\u0006\u001e\u00018\u0017\uffff\u0003\u001e\u0001<\u0002\u001e\u0002\uffff\u0002\u001e\u0001@\u0001\uffff\u0001A\u0001B\u0001\u001e\u0003\uffff\u0001D\u0001\uffff";

			private const string DFA17_eofS = "E\uffff";

			private const string DFA17_minS = "\u0001\t\u0001=\u0001\uffff\u0001&\u0002\uffff\u0001*\u0005\uffff\u0001<\u0002=\u0002\uffff\u0001|\u0001\uffff\u0001R\u0001A\u0001N\u0001R\u0001O\u0001+\u0001.\u0017\uffff\u0001U\u0001L\u0001D\u00010\u0001T\u00010\u0002\uffff\u0001E\u0001S\u00010\u0001\uffff\u00020\u0001E\u0003\uffff\u00010\u0001\uffff";

			private const string DFA17_maxS = "\u0001~\u0001=\u0001\uffff\u0001&\u0002\uffff\u0001*\u0005\uffff\u0001>\u0001=\u0001>\u0002\uffff\u0001|\u0001\uffff\u0001r\u0001a\u0001n\u0001r\u0001o\u00019\u0001e\u0017\uffff\u0001u\u0001l\u0001d\u0001z\u0001t\u00019\u0002\uffff\u0001e\u0001s\u0001z\u0001\uffff\u0002z\u0001e\u0003\uffff\u0001z\u0001\uffff";

			private const string DFA17_acceptS = "\u0002\uffff\u0001\u0003\u0001\uffff\u0001\u0006\u0001\a\u0001\uffff\u0001\n\u0001\v\u0001\f\u0001\r\u0001\u000e\u0003\uffff\u0001\u0018\u0001\u0019\u0001\uffff\u0001\u001c\a\uffff\u0001$\u0001%\u0001&\u0001'\u0001\"\u0001)\u0001\u0002\u0001\u0001\u0001\u0004\u0001\u0005\u0001\t\u0001\b\u0001\u0010\u0001\u0011\u0001\u0012\u0001\u000f\u0001\u0014\u0001\u0013\u0001\u0016\u0001\u0017\u0001\u0015\u0001\u001b\u0001\u001a\u0006\uffff\u0001(\u0001#\u0003\uffff\u0001 \u0003\uffff\u0001\u001f\u0001!\u0001\u001d\u0001\uffff\u0001\u001e";

			private const string DFA17_specialS = "E\uffff}>";

			private static readonly string[] DFA17_transitionS;

			private static readonly short[] DFA17_eot;

			private static readonly short[] DFA17_eof;

			private static readonly char[] DFA17_min;

			private static readonly char[] DFA17_max;

			private static readonly short[] DFA17_accept;

			private static readonly short[] DFA17_special;

			private static readonly short[][] DFA17_transition;

			public override string Description => "1:1: Tokens : ( T__48 | T__49 | T__50 | T__51 | T__52 | T__53 | T__54 | T__55 | T__56 | T__57 | T__58 | T__59 | T__60 | T__61 | T__62 | T__63 | T__64 | T__65 | T__66 | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | T__73 | T__74 | T__75 | TRUE | FALSE | AND | OR | NOT | ID | INTEGER | FLOAT | STRING | DATETIME | NAME | EXPONENT | WS );";

			static DFA17()
			{
				DFA17_transitionS = new string[69]
				{
					"\u0002\u001f\u0001\uffff\u0002\u001f\u0012\uffff\u0001\u001f\u0001\u0001\u0001\uffff\u0001\u001c\u0001\uffff\u0001\u0002\u0001\u0003\u0001\u001b\u0001\u0004\u0001\u0005\u0001\u0006\u0001\a\u0001\b\u0001\t\u0001\u001a\u0001\n\n\u0019\u0001\v\u0001\uffff\u0001\f\u0001\r\u0001\u000e\u0001\u000f\u0001\uffff\u0001\u0015\u0003\u001e\u0001\u0018\u0001\u0014\a\u001e\u0001\u0017\u0001\u0016\u0004\u001e\u0001\u0013\u0006\u001e\u0001\u001d\u0002\uffff\u0001\u0010\u0001\u001e\u0001\uffff\u0001\u0015\u0003\u001e\u0001\u0018\u0001\u0014\a\u001e\u0001\u0017\u0001\u0016\u0004\u001e\u0001\u0013\u0006\u001e\u0001\uffff\u0001\u0011\u0001\uffff\u0001\u0012", "\u0001 ", "", "\u0001\"", "", "", "\u0001$", "", "", "",
					"", "", "\u0001&\u0001'\u0001(", "\u0001*", "\u0001,\u0001-", "", "", "\u0001/", "", "\u00011\u001f\uffff\u00011",
					"\u00012\u001f\uffff\u00012", "\u00013\u001f\uffff\u00013", "\u00014\u001f\uffff\u00014", "\u00015\u001f\uffff\u00015", "\u00017\u0001\uffff\u00017\u0002\uffff\n6", "\u0001\u001a\u0001\uffff\n\u0019\v\uffff\u0001\u001a\u001f\uffff\u0001\u001a", "", "", "", "",
					"", "", "", "", "", "", "", "", "", "",
					"", "", "", "", "", "", "", "", "", "\u00019\u001f\uffff\u00019",
					"\u0001:\u001f\uffff\u0001:", "\u0001;\u001f\uffff\u0001;", "\n\u001e\a\uffff\u001a\u001e\u0004\uffff\u0001\u001e\u0001\uffff\u001a\u001e", "\u0001=\u001f\uffff\u0001=", "\n6", "", "", "\u0001>\u001f\uffff\u0001>", "\u0001?\u001f\uffff\u0001?", "\n\u001e\a\uffff\u001a\u001e\u0004\uffff\u0001\u001e\u0001\uffff\u001a\u001e",
					"", "\n\u001e\a\uffff\u001a\u001e\u0004\uffff\u0001\u001e\u0001\uffff\u001a\u001e", "\n\u001e\a\uffff\u001a\u001e\u0004\uffff\u0001\u001e\u0001\uffff\u001a\u001e", "\u0001C\u001f\uffff\u0001C", "", "", "", "\n\u001e\a\uffff\u001a\u001e\u0004\uffff\u0001\u001e\u0001\uffff\u001a\u001e", ""
				};
				DFA17_eot = DFA.UnpackEncodedString("\u0001\uffff\u0001!\u0001\uffff\u0001#\u0002\uffff\u0001%\u0005\uffff\u0001)\u0001+\u0001.\u0002\uffff\u00010\u0001\uffff\u0006\u001e\u00018\u0017\uffff\u0003\u001e\u0001<\u0002\u001e\u0002\uffff\u0002\u001e\u0001@\u0001\uffff\u0001A\u0001B\u0001\u001e\u0003\uffff\u0001D\u0001\uffff");
				DFA17_eof = DFA.UnpackEncodedString("E\uffff");
				DFA17_min = DFA.UnpackEncodedStringToUnsignedChars("\u0001\t\u0001=\u0001\uffff\u0001&\u0002\uffff\u0001*\u0005\uffff\u0001<\u0002=\u0002\uffff\u0001|\u0001\uffff\u0001R\u0001A\u0001N\u0001R\u0001O\u0001+\u0001.\u0017\uffff\u0001U\u0001L\u0001D\u00010\u0001T\u00010\u0002\uffff\u0001E\u0001S\u00010\u0001\uffff\u00020\u0001E\u0003\uffff\u00010\u0001\uffff");
				DFA17_max = DFA.UnpackEncodedStringToUnsignedChars("\u0001~\u0001=\u0001\uffff\u0001&\u0002\uffff\u0001*\u0005\uffff\u0001>\u0001=\u0001>\u0002\uffff\u0001|\u0001\uffff\u0001r\u0001a\u0001n\u0001r\u0001o\u00019\u0001e\u0017\uffff\u0001u\u0001l\u0001d\u0001z\u0001t\u00019\u0002\uffff\u0001e\u0001s\u0001z\u0001\uffff\u0002z\u0001e\u0003\uffff\u0001z\u0001\uffff");
				DFA17_accept = DFA.UnpackEncodedString("\u0002\uffff\u0001\u0003\u0001\uffff\u0001\u0006\u0001\a\u0001\uffff\u0001\n\u0001\v\u0001\f\u0001\r\u0001\u000e\u0003\uffff\u0001\u0018\u0001\u0019\u0001\uffff\u0001\u001c\a\uffff\u0001$\u0001%\u0001&\u0001'\u0001\"\u0001)\u0001\u0002\u0001\u0001\u0001\u0004\u0001\u0005\u0001\t\u0001\b\u0001\u0010\u0001\u0011\u0001\u0012\u0001\u000f\u0001\u0014\u0001\u0013\u0001\u0016\u0001\u0017\u0001\u0015\u0001\u001b\u0001\u001a\u0006\uffff\u0001(\u0001#\u0003\uffff\u0001 \u0003\uffff\u0001\u001f\u0001!\u0001\u001d\u0001\uffff\u0001\u001e");
				DFA17_special = DFA.UnpackEncodedString("E\uffff}>");
				int num = DFA17_transitionS.Length;
				DFA17_transition = new short[num][];
				for (int i = 0; i < num; i++)
				{
					DFA17_transition[i] = DFA.UnpackEncodedString(DFA17_transitionS[i]);
				}
			}

			public DFA17(BaseRecognizer recognizer)
			{
				base.recognizer = recognizer;
				base.decisionNumber = 17;
				base.eot = DFA17_eot;
				base.eof = DFA17_eof;
				base.min = DFA17_min;
				base.max = DFA17_max;
				base.accept = DFA17_accept;
				base.special = DFA17_special;
				base.transition = DFA17_transition;
			}

			public override void Error(NoViableAltException nvae)
			{
			}
		}

		public const int EOF = -1;

		public const int A = 4;

		public const int AND = 5;

		public const int B = 6;

		public const int C = 7;

		public const int D = 8;

		public const int DATETIME = 9;

		public const int DIGIT = 10;

		public const int E = 11;

		public const int EXPONENT = 12;

		public const int EscapeSequence = 13;

		public const int F = 14;

		public const int FALSE = 15;

		public const int FLOAT = 16;

		public const int G = 17;

		public const int H = 18;

		public const int HexDigit = 19;

		public const int I = 20;

		public const int ID = 21;

		public const int INTEGER = 22;

		public const int J = 23;

		public const int K = 24;

		public const int L = 25;

		public const int LETTER = 26;

		public const int M = 27;

		public const int N = 28;

		public const int NAME = 29;

		public const int NOT = 30;

		public const int O = 31;

		public const int OR = 32;

		public const int P = 33;

		public const int Q = 34;

		public const int R = 35;

		public const int S = 36;

		public const int STRING = 37;

		public const int T = 38;

		public const int TRUE = 39;

		public const int U = 40;

		public const int UnicodeEscape = 41;

		public const int V = 42;

		public const int W = 43;

		public const int WS = 44;

		public const int X = 45;

		public const int Y = 46;

		public const int Z = 47;

		public const int T__48 = 48;

		public const int T__49 = 49;

		public const int T__50 = 50;

		public const int T__51 = 51;

		public const int T__52 = 52;

		public const int T__53 = 53;

		public const int T__54 = 54;

		public const int T__55 = 55;

		public const int T__56 = 56;

		public const int T__57 = 57;

		public const int T__58 = 58;

		public const int T__59 = 59;

		public const int T__60 = 60;

		public const int T__61 = 61;

		public const int T__62 = 62;

		public const int T__63 = 63;

		public const int T__64 = 64;

		public const int T__65 = 65;

		public const int T__66 = 66;

		public const int T__67 = 67;

		public const int T__68 = 68;

		public const int T__69 = 69;

		public const int T__70 = 70;

		public const int T__71 = 71;

		public const int T__72 = 72;

		public const int T__73 = 73;

		public const int T__74 = 74;

		public const int T__75 = 75;

		private DFA10 dfa10;

		private DFA17 dfa17;

		public override string GrammarFileName => "NCalc.g";

		public NCalcLexer()
		{
		}

		public NCalcLexer(ICharStream input)
			: this(input, new RecognizerSharedState())
		{
		}//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown


		public NCalcLexer(ICharStream input, RecognizerSharedState state)
			: base(input, state)
		{
		}

		[GrammarRule("T__48")]
		private void mT__48()
		{
			try
			{
				int type = 48;
				int channel = 0;
				((Lexer)this).Match(33);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__49")]
		private void mT__49()
		{
			try
			{
				int type = 49;
				int channel = 0;
				((Lexer)this).Match("!=");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__50")]
		private void mT__50()
		{
			try
			{
				int type = 50;
				int channel = 0;
				((Lexer)this).Match(37);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__51")]
		private void mT__51()
		{
			try
			{
				int type = 51;
				int channel = 0;
				((Lexer)this).Match("&&");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__52")]
		private void mT__52()
		{
			try
			{
				int type = 52;
				int channel = 0;
				((Lexer)this).Match(38);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__53")]
		private void mT__53()
		{
			try
			{
				int type = 53;
				int channel = 0;
				((Lexer)this).Match(40);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__54")]
		private void mT__54()
		{
			try
			{
				int type = 54;
				int channel = 0;
				((Lexer)this).Match(41);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__55")]
		private void mT__55()
		{
			try
			{
				int type = 55;
				int channel = 0;
				((Lexer)this).Match(42);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__56")]
		private void mT__56()
		{
			try
			{
				int type = 56;
				int channel = 0;
				((Lexer)this).Match("**");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__57")]
		private void mT__57()
		{
			try
			{
				int type = 57;
				int channel = 0;
				((Lexer)this).Match(43);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__58")]
		private void mT__58()
		{
			try
			{
				int type = 58;
				int channel = 0;
				((Lexer)this).Match(44);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__59")]
		private void mT__59()
		{
			try
			{
				int type = 59;
				int channel = 0;
				((Lexer)this).Match(45);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__60")]
		private void mT__60()
		{
			try
			{
				int type = 60;
				int channel = 0;
				((Lexer)this).Match(47);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__61")]
		private void mT__61()
		{
			try
			{
				int type = 61;
				int channel = 0;
				((Lexer)this).Match(58);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__62")]
		private void mT__62()
		{
			try
			{
				int type = 62;
				int channel = 0;
				((Lexer)this).Match(60);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__63")]
		private void mT__63()
		{
			try
			{
				int type = 63;
				int channel = 0;
				((Lexer)this).Match("<<");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__64")]
		private void mT__64()
		{
			try
			{
				int type = 64;
				int channel = 0;
				((Lexer)this).Match("<=");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__65")]
		private void mT__65()
		{
			try
			{
				int type = 65;
				int channel = 0;
				((Lexer)this).Match("<>");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__66")]
		private void mT__66()
		{
			try
			{
				int type = 66;
				int channel = 0;
				((Lexer)this).Match(61);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__67")]
		private void mT__67()
		{
			try
			{
				int type = 67;
				int channel = 0;
				((Lexer)this).Match("==");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__68")]
		private void mT__68()
		{
			try
			{
				int type = 68;
				int channel = 0;
				((Lexer)this).Match(62);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__69")]
		private void mT__69()
		{
			try
			{
				int type = 69;
				int channel = 0;
				((Lexer)this).Match(">=");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__70")]
		private void mT__70()
		{
			try
			{
				int type = 70;
				int channel = 0;
				((Lexer)this).Match(">>");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__71")]
		private void mT__71()
		{
			try
			{
				int type = 71;
				int channel = 0;
				((Lexer)this).Match(63);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__72")]
		private void mT__72()
		{
			try
			{
				int type = 72;
				int channel = 0;
				((Lexer)this).Match(94);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__73")]
		private void mT__73()
		{
			try
			{
				int type = 73;
				int channel = 0;
				((Lexer)this).Match(124);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__74")]
		private void mT__74()
		{
			try
			{
				int type = 74;
				int channel = 0;
				((Lexer)this).Match("||");
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("T__75")]
		private void mT__75()
		{
			try
			{
				int type = 75;
				int channel = 0;
				((Lexer)this).Match(126);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("TRUE")]
		private void mTRUE()
		{
			try
			{
				int type = 39;
				int channel = 0;
				mT();
				mR();
				mU();
				mE();
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("FALSE")]
		private void mFALSE()
		{
			try
			{
				int type = 15;
				int channel = 0;
				mF();
				mA();
				mL();
				mS();
				mE();
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("AND")]
		private void mAND()
		{
			try
			{
				int type = 5;
				int channel = 0;
				mA();
				mN();
				mD();
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("OR")]
		private void mOR()
		{
			try
			{
				int type = 32;
				int channel = 0;
				mO();
				mR();
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("NOT")]
		private void mNOT()
		{
			try
			{
				int type = 30;
				int channel = 0;
				mN();
				mO();
				mT();
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("ID")]
		private void mID()
		{
			try
			{
				int type = 21;
				int channel = 0;
				mLETTER();
				try
				{
					while (true)
					{
						int num = 2;
						try
						{
							int num2 = ((IIntStream)base.input).LA(1);
							if ((num2 < 48 || num2 > 57) && (num2 < 65 || num2 > 90))
							{
								switch (num2)
								{
								case 95:
								case 97:
								case 98:
								case 99:
								case 100:
								case 101:
								case 102:
								case 103:
								case 104:
								case 105:
								case 106:
								case 107:
								case 108:
								case 109:
								case 110:
								case 111:
								case 112:
								case 113:
								case 114:
								case 115:
								case 116:
								case 117:
								case 118:
								case 119:
								case 120:
								case 121:
								case 122:
									break;
								default:
									goto end_IL_000d;
								}
							}
							num = 1;
							end_IL_000d:;
						}
						finally
						{
						}
						if (num != 1)
						{
							break;
						}
						((IIntStream)base.input).Consume();
					}
				}
				finally
				{
				}
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("INTEGER")]
		private void mINTEGER()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				int type = 22;
				int channel = 0;
				int num = 0;
				try
				{
					while (true)
					{
						int num2 = 2;
						try
						{
							int num3 = ((IIntStream)base.input).LA(1);
							if (num3 >= 48 && num3 <= 57)
							{
								num2 = 1;
							}
						}
						finally
						{
						}
						if (num2 != 1)
						{
							break;
						}
						((IIntStream)base.input).Consume();
						num++;
					}
					if (num < 1)
					{
						throw new EarlyExitException(2, (IIntStream)(object)base.input);
					}
				}
				finally
				{
				}
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("FLOAT")]
		private void mFLOAT()
		{
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				int type = 16;
				int channel = 0;
				int num = 3;
				try
				{
					num = ((DFA)dfa10).Predict((IIntStream)(object)base.input);
				}
				catch (NoViableAltException)
				{
					throw;
				}
				finally
				{
				}
				switch (num)
				{
				case 1:
				{
					try
					{
						while (true)
						{
							int num5 = 2;
							try
							{
								int num6 = ((IIntStream)base.input).LA(1);
								if (num6 >= 48 && num6 <= 57)
								{
									num5 = 1;
								}
							}
							finally
							{
							}
							if (num5 != 1)
							{
								break;
							}
							((IIntStream)base.input).Consume();
						}
					}
					finally
					{
					}
					((Lexer)this).Match(46);
					int num7 = 0;
					try
					{
						while (true)
						{
							int num8 = 2;
							try
							{
								int num9 = ((IIntStream)base.input).LA(1);
								if (num9 >= 48 && num9 <= 57)
								{
									num8 = 1;
								}
							}
							finally
							{
							}
							if (num8 != 1)
							{
								break;
							}
							((IIntStream)base.input).Consume();
							num7++;
						}
						if (num7 < 1)
						{
							throw new EarlyExitException(4, (IIntStream)(object)base.input);
						}
					}
					finally
					{
					}
					int num10 = 2;
					try
					{
						try
						{
							int num11 = ((IIntStream)base.input).LA(1);
							if (num11 == 69 || num11 == 101)
							{
								num10 = 1;
							}
						}
						finally
						{
						}
						if (num10 == 1)
						{
							mEXPONENT();
						}
					}
					finally
					{
					}
					break;
				}
				case 2:
				{
					int num12 = 0;
					try
					{
						while (true)
						{
							int num13 = 2;
							try
							{
								int num14 = ((IIntStream)base.input).LA(1);
								if (num14 >= 48 && num14 <= 57)
								{
									num13 = 1;
								}
							}
							finally
							{
							}
							if (num13 != 1)
							{
								break;
							}
							((IIntStream)base.input).Consume();
							num12++;
						}
						if (num12 < 1)
						{
							throw new EarlyExitException(6, (IIntStream)(object)base.input);
						}
					}
					finally
					{
					}
					((Lexer)this).Match(46);
					try
					{
						while (true)
						{
							int num15 = 2;
							try
							{
								int num16 = ((IIntStream)base.input).LA(1);
								if (num16 >= 48 && num16 <= 57)
								{
									num15 = 1;
								}
							}
							finally
							{
							}
							if (num15 != 1)
							{
								break;
							}
							((IIntStream)base.input).Consume();
						}
					}
					finally
					{
					}
					int num17 = 2;
					try
					{
						try
						{
							int num18 = ((IIntStream)base.input).LA(1);
							if (num18 == 69 || num18 == 101)
							{
								num17 = 1;
							}
						}
						finally
						{
						}
						if (num17 == 1)
						{
							mEXPONENT();
						}
					}
					finally
					{
					}
					break;
				}
				case 3:
				{
					int num2 = 0;
					try
					{
						while (true)
						{
							int num3 = 2;
							try
							{
								int num4 = ((IIntStream)base.input).LA(1);
								if (num4 >= 48 && num4 <= 57)
								{
									num3 = 1;
								}
							}
							finally
							{
							}
							if (num3 != 1)
							{
								break;
							}
							((IIntStream)base.input).Consume();
							num2++;
						}
						if (num2 < 1)
						{
							throw new EarlyExitException(9, (IIntStream)(object)base.input);
						}
					}
					finally
					{
					}
					mEXPONENT();
					break;
				}
				}
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("STRING")]
		private void mSTRING()
		{
			try
			{
				int type = 37;
				int channel = 0;
				((Lexer)this).Match(39);
				try
				{
					while (true)
					{
						int num = 3;
						try
						{
							int num2 = ((IIntStream)base.input).LA(1);
							switch (num2)
							{
							case 92:
								num = 1;
								goto end_IL_000f;
							default:
								if ((num2 >= 40 && num2 <= 91) || (num2 >= 93 && num2 <= 65535))
								{
									break;
								}
								goto end_IL_000f;
							case 32:
							case 33:
							case 34:
							case 35:
							case 36:
							case 37:
							case 38:
								break;
							}
							num = 2;
							end_IL_000f:;
						}
						finally
						{
						}
						switch (num)
						{
						case 1:
							mEscapeSequence();
							continue;
						case 2:
							((IIntStream)base.input).Consume();
							continue;
						}
						break;
					}
				}
				finally
				{
				}
				((Lexer)this).Match(39);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("DATETIME")]
		private void mDATETIME()
		{
			try
			{
				int type = 9;
				int channel = 0;
				((Lexer)this).Match(35);
				try
				{
					while (true)
					{
						int num = 2;
						try
						{
							int num2 = ((IIntStream)base.input).LA(1);
							if ((num2 >= 0 && num2 <= 34) || (num2 >= 36 && num2 <= 65535))
							{
								num = 1;
							}
						}
						finally
						{
						}
						if (num != 1)
						{
							break;
						}
						((IIntStream)base.input).Consume();
					}
				}
				finally
				{
				}
				((Lexer)this).Match(35);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("NAME")]
		private void mNAME()
		{
			try
			{
				int type = 29;
				int channel = 0;
				((Lexer)this).Match(91);
				try
				{
					while (true)
					{
						int num = 2;
						try
						{
							int num2 = ((IIntStream)base.input).LA(1);
							if ((num2 >= 0 && num2 <= 92) || (num2 >= 94 && num2 <= 65535))
							{
								num = 1;
							}
						}
						finally
						{
						}
						if (num != 1)
						{
							break;
						}
						((IIntStream)base.input).Consume();
					}
				}
				finally
				{
				}
				((Lexer)this).Match(93);
				((BaseRecognizer)this).state.type = type;
				((BaseRecognizer)this).state.channel = channel;
			}
			finally
			{
			}
		}

		[GrammarRule("EXPONENT")]
		private void mEXPONENT()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				int type = 12;
				int channel = 0;
				if (((IIntStream)base.input).LA(1) == 69 || ((IIntStream)base.input).LA(1) == 101)
				{
					((IIntStream)base.input).Consume();
					int num = 2;
					try
					{
						try
						{
							int num2 = ((IIntStream)base.input).LA(1);
							if (num2 == 43 || num2 == 45)
							{
								num = 1;
							}
						}
						finally
						{
						}
						if (num == 1)
						{
							((IIntStream)base.input).Consume();
						}
					}
					finally
					{
					}
					int num3 = 0;
					try
					{
						while (true)
						{
							int num4 = 2;
							try
							{
								int num5 = ((IIntStream)base.input).LA(1);
								if (num5 >= 48 && num5 <= 57)
								{
									num4 = 1;
								}
							}
							finally
							{
							}
							if (num4 != 1)
							{
								break;
							}
							((IIntStream)base.input).Consume();
							num3++;
						}
						if (num3 < 1)
						{
							throw new EarlyExitException(15, (IIntStream)(object)base.input);
						}
					}
					finally
					{
					}
					((BaseRecognizer)this).state.type = type;
					((BaseRecognizer)this).state.channel = channel;
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("LETTER")]
		private void mLETTER()
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			try
			{
				if ((((IIntStream)base.input).LA(1) >= 65 && ((IIntStream)base.input).LA(1) <= 90) || ((IIntStream)base.input).LA(1) == 95 || (((IIntStream)base.input).LA(1) >= 97 && ((IIntStream)base.input).LA(1) <= 122))
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("DIGIT")]
		private void mDIGIT()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) >= 48 && ((IIntStream)base.input).LA(1) <= 57)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("EscapeSequence")]
		private void mEscapeSequence()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				((Lexer)this).Match(92);
				int num = 6;
				try
				{
					try
					{
						num = ((IIntStream)base.input).LA(1) switch
						{
							110 => 1, 
							114 => 2, 
							116 => 3, 
							39 => 4, 
							92 => 5, 
							117 => 6, 
							_ => throw new NoViableAltException("", 16, 0, (IIntStream)(object)base.input, 1), 
						};
					}
					finally
					{
					}
					switch (num)
					{
					case 1:
						((Lexer)this).Match(110);
						break;
					case 2:
						((Lexer)this).Match(114);
						break;
					case 3:
						((Lexer)this).Match(116);
						break;
					case 4:
						((Lexer)this).Match(39);
						break;
					case 5:
						((Lexer)this).Match(92);
						break;
					case 6:
						mUnicodeEscape();
						break;
					}
				}
				finally
				{
				}
			}
			finally
			{
			}
		}

		[GrammarRule("HexDigit")]
		private void mHexDigit()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			try
			{
				if ((((IIntStream)base.input).LA(1) >= 48 && ((IIntStream)base.input).LA(1) <= 57) || (((IIntStream)base.input).LA(1) >= 65 && ((IIntStream)base.input).LA(1) <= 70) || (((IIntStream)base.input).LA(1) >= 97 && ((IIntStream)base.input).LA(1) <= 102))
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("UnicodeEscape")]
		private void mUnicodeEscape()
		{
			try
			{
				((Lexer)this).Match(117);
				mHexDigit();
				mHexDigit();
				mHexDigit();
				mHexDigit();
			}
			finally
			{
			}
		}

		[GrammarRule("WS")]
		private void mWS()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			try
			{
				int type = 44;
				int num = 0;
				if ((((IIntStream)base.input).LA(1) >= 9 && ((IIntStream)base.input).LA(1) <= 10) || (((IIntStream)base.input).LA(1) >= 12 && ((IIntStream)base.input).LA(1) <= 13) || ((IIntStream)base.input).LA(1) == 32)
				{
					((IIntStream)base.input).Consume();
					num = 99;
					((BaseRecognizer)this).state.type = type;
					((BaseRecognizer)this).state.channel = num;
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("A")]
		private void mA()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 65 || ((IIntStream)base.input).LA(1) == 97)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("B")]
		private void mB()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 66 || ((IIntStream)base.input).LA(1) == 98)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("C")]
		private void mC()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 67 || ((IIntStream)base.input).LA(1) == 99)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("D")]
		private void mD()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 68 || ((IIntStream)base.input).LA(1) == 100)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("E")]
		private void mE()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 69 || ((IIntStream)base.input).LA(1) == 101)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("F")]
		private void mF()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 70 || ((IIntStream)base.input).LA(1) == 102)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("G")]
		private void mG()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 71 || ((IIntStream)base.input).LA(1) == 103)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("H")]
		private void mH()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 72 || ((IIntStream)base.input).LA(1) == 104)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("I")]
		private void mI()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 73 || ((IIntStream)base.input).LA(1) == 105)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("J")]
		private void mJ()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 74 || ((IIntStream)base.input).LA(1) == 106)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("K")]
		private void mK()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 75 || ((IIntStream)base.input).LA(1) == 107)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("L")]
		private void mL()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 76 || ((IIntStream)base.input).LA(1) == 108)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("M")]
		private void mM()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 77 || ((IIntStream)base.input).LA(1) == 109)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("N")]
		private void mN()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 78 || ((IIntStream)base.input).LA(1) == 110)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("O")]
		private void mO()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 79 || ((IIntStream)base.input).LA(1) == 111)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("P")]
		private void mP()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 80 || ((IIntStream)base.input).LA(1) == 112)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("Q")]
		private void mQ()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 81 || ((IIntStream)base.input).LA(1) == 113)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("R")]
		private void mR()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 82 || ((IIntStream)base.input).LA(1) == 114)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("S")]
		private void mS()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 83 || ((IIntStream)base.input).LA(1) == 115)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("T")]
		private void mT()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 84 || ((IIntStream)base.input).LA(1) == 116)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("U")]
		private void mU()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 85 || ((IIntStream)base.input).LA(1) == 117)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("V")]
		private void mV()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 86 || ((IIntStream)base.input).LA(1) == 118)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("W")]
		private void mW()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 87 || ((IIntStream)base.input).LA(1) == 119)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("X")]
		private void mX()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 88 || ((IIntStream)base.input).LA(1) == 120)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("Y")]
		private void mY()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 89 || ((IIntStream)base.input).LA(1) == 121)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		[GrammarRule("Z")]
		private void mZ()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			try
			{
				if (((IIntStream)base.input).LA(1) == 90 || ((IIntStream)base.input).LA(1) == 122)
				{
					((IIntStream)base.input).Consume();
					return;
				}
				MismatchedSetException val = new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
				((Lexer)this).Recover((RecognitionException)(object)val);
				throw val;
			}
			finally
			{
			}
		}

		public override void mTokens()
		{
			int num = 41;
			try
			{
				num = ((DFA)dfa17).Predict((IIntStream)(object)base.input);
			}
			catch (NoViableAltException)
			{
				throw;
			}
			finally
			{
			}
			switch (num)
			{
			case 1:
				mT__48();
				break;
			case 2:
				mT__49();
				break;
			case 3:
				mT__50();
				break;
			case 4:
				mT__51();
				break;
			case 5:
				mT__52();
				break;
			case 6:
				mT__53();
				break;
			case 7:
				mT__54();
				break;
			case 8:
				mT__55();
				break;
			case 9:
				mT__56();
				break;
			case 10:
				mT__57();
				break;
			case 11:
				mT__58();
				break;
			case 12:
				mT__59();
				break;
			case 13:
				mT__60();
				break;
			case 14:
				mT__61();
				break;
			case 15:
				mT__62();
				break;
			case 16:
				mT__63();
				break;
			case 17:
				mT__64();
				break;
			case 18:
				mT__65();
				break;
			case 19:
				mT__66();
				break;
			case 20:
				mT__67();
				break;
			case 21:
				mT__68();
				break;
			case 22:
				mT__69();
				break;
			case 23:
				mT__70();
				break;
			case 24:
				mT__71();
				break;
			case 25:
				mT__72();
				break;
			case 26:
				mT__73();
				break;
			case 27:
				mT__74();
				break;
			case 28:
				mT__75();
				break;
			case 29:
				mTRUE();
				break;
			case 30:
				mFALSE();
				break;
			case 31:
				mAND();
				break;
			case 32:
				mOR();
				break;
			case 33:
				mNOT();
				break;
			case 34:
				mID();
				break;
			case 35:
				mINTEGER();
				break;
			case 36:
				mFLOAT();
				break;
			case 37:
				mSTRING();
				break;
			case 38:
				mDATETIME();
				break;
			case 39:
				mNAME();
				break;
			case 40:
				mEXPONENT();
				break;
			case 41:
				mWS();
				break;
			}
		}

		protected override void InitDFAs()
		{
			((BaseRecognizer)this).InitDFAs();
			dfa10 = new DFA10((BaseRecognizer)(object)this);
			dfa17 = new DFA17((BaseRecognizer)(object)this);
		}

		public override void EmitErrorMessage(string msg)
		{
			throw new EvaluationException(msg);
		}
	}
	[GeneratedCode("ANTLR", "3.5.0.2")]
	[CLSCompliant(false)]
	public class NCalcParser : Parser
	{
		private sealed class ncalcExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public ncalcExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class logicalExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public logicalExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class conditionalExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public conditionalExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class booleanAndExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public booleanAndExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class bitwiseOrExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public bitwiseOrExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class bitwiseXOrExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public bitwiseXOrExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class bitwiseAndExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public bitwiseAndExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class equalityExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public equalityExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class relationalExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public relationalExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class shiftExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public shiftExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class additiveExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public additiveExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class multiplicativeExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public multiplicativeExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class unaryExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public unaryExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class exponentialExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public exponentialExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class primaryExpression_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public LogicalExpression value;

			public primaryExpression_return(NCalcParser grammar)
			{
			}
		}

		private sealed class value_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public ValueExpression value;

			public value_return(NCalcParser grammar)
			{
			}
		}

		private sealed class identifier_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public Identifier value;

			public identifier_return(NCalcParser grammar)
			{
			}
		}

		private sealed class expressionList_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public List<LogicalExpression> value;

			public expressionList_return(NCalcParser grammar)
			{
			}
		}

		private sealed class arguments_return : AstParserRuleReturnScope<CommonTree, IToken>
		{
			public List<LogicalExpression> value;

			public arguments_return(NCalcParser grammar)
			{
			}
		}

		private static class Follow
		{
			public static readonly BitSet _logicalExpression_in_ncalcExpression73 = new BitSet(new ulong[1]);

			public static readonly BitSet _EOF_in_ncalcExpression75 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _conditionalExpression_in_logicalExpression95 = new BitSet(new ulong[2] { 2uL, 128uL });

			public static readonly BitSet _71_in_logicalExpression101 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _conditionalExpression_in_logicalExpression105 = new BitSet(new ulong[1] { 2305843009213693952uL });

			public static readonly BitSet _61_in_logicalExpression107 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _conditionalExpression_in_logicalExpression111 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _booleanAndExpression_in_conditionalExpression138 = new BitSet(new ulong[2] { 4294967298uL, 1024uL });

			public static readonly BitSet _set_in_conditionalExpression147 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _conditionalExpression_in_conditionalExpression163 = new BitSet(new ulong[2] { 4294967298uL, 1024uL });

			public static readonly BitSet _bitwiseOrExpression_in_booleanAndExpression197 = new BitSet(new ulong[1] { 2251799813685282uL });

			public static readonly BitSet _set_in_booleanAndExpression206 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _bitwiseOrExpression_in_booleanAndExpression222 = new BitSet(new ulong[1] { 2251799813685282uL });

			public static readonly BitSet _bitwiseXOrExpression_in_bitwiseOrExpression254 = new BitSet(new ulong[2] { 2uL, 512uL });

			public static readonly BitSet _73_in_bitwiseOrExpression263 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _bitwiseOrExpression_in_bitwiseOrExpression273 = new BitSet(new ulong[2] { 2uL, 512uL });

			public static readonly BitSet _bitwiseAndExpression_in_bitwiseXOrExpression307 = new BitSet(new ulong[2] { 2uL, 256uL });

			public static readonly BitSet _72_in_bitwiseXOrExpression316 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _bitwiseAndExpression_in_bitwiseXOrExpression326 = new BitSet(new ulong[2] { 2uL, 256uL });

			public static readonly BitSet _equalityExpression_in_bitwiseAndExpression358 = new BitSet(new ulong[1] { 4503599627370498uL });

			public static readonly BitSet _52_in_bitwiseAndExpression367 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _equalityExpression_in_bitwiseAndExpression377 = new BitSet(new ulong[1] { 4503599627370498uL });

			public static readonly BitSet _relationalExpression_in_equalityExpression411 = new BitSet(new ulong[2] { 562949953421314uL, 14uL });

			public static readonly BitSet _set_in_equalityExpression422 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _set_in_equalityExpression439 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _relationalExpression_in_equalityExpression458 = new BitSet(new ulong[2] { 562949953421314uL, 14uL });

			public static readonly BitSet _shiftExpression_in_relationalExpression491 = new BitSet(new ulong[2] { 4611686018427387906uL, 49uL });

			public static readonly BitSet _62_in_relationalExpression502 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _64_in_relationalExpression512 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _68_in_relationalExpression523 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _69_in_relationalExpression533 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _shiftExpression_in_relationalExpression545 = new BitSet(new ulong[2] { 4611686018427387906uL, 49uL });

			public static readonly BitSet _additiveExpression_in_shiftExpression577 = new BitSet(new ulong[2] { 9223372036854775810uL, 64uL });

			public static readonly BitSet _63_in_shiftExpression588 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _70_in_shiftExpression598 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _additiveExpression_in_shiftExpression610 = new BitSet(new ulong[2] { 9223372036854775810uL, 64uL });

			public static readonly BitSet _multiplicativeExpression_in_additiveExpression642 = new BitSet(new ulong[1] { 720575940379279362uL });

			public static readonly BitSet _57_in_additiveExpression653 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _59_in_additiveExpression663 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _multiplicativeExpression_in_additiveExpression675 = new BitSet(new ulong[1] { 720575940379279362uL });

			public static readonly BitSet _unaryExpression_in_multiplicativeExpression707 = new BitSet(new ulong[1] { 1190076201532653570uL });

			public static readonly BitSet _55_in_multiplicativeExpression718 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _60_in_multiplicativeExpression728 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _50_in_multiplicativeExpression738 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _unaryExpression_in_multiplicativeExpression750 = new BitSet(new ulong[1] { 1190076201532653570uL });

			public static readonly BitSet _exponentialExpression_in_unaryExpression776 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _set_in_unaryExpression786 = new BitSet(new ulong[1] { 9007886992769536uL });

			public static readonly BitSet _exponentialExpression_in_unaryExpression794 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _75_in_unaryExpression805 = new BitSet(new ulong[1] { 9007886992769536uL });

			public static readonly BitSet _exponentialExpression_in_unaryExpression808 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _59_in_unaryExpression818 = new BitSet(new ulong[1] { 9007886992769536uL });

			public static readonly BitSet _exponentialExpression_in_unaryExpression820 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _57_in_unaryExpression830 = new BitSet(new ulong[1] { 9007886992769536uL });

			public static readonly BitSet _exponentialExpression_in_unaryExpression832 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _primaryExpression_in_exponentialExpression857 = new BitSet(new ulong[1] { 72057594037927938uL });

			public static readonly BitSet _56_in_exponentialExpression866 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _unaryExpression_in_exponentialExpression870 = new BitSet(new ulong[1] { 72057594037927938uL });

			public static readonly BitSet _53_in_primaryExpression893 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _logicalExpression_in_primaryExpression895 = new BitSet(new ulong[1] { 18014398509481984uL });

			public static readonly BitSet _54_in_primaryExpression897 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _value_in_primaryExpression907 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _identifier_in_primaryExpression915 = new BitSet(new ulong[1] { 9007199254740994uL });

			public static readonly BitSet _arguments_in_primaryExpression920 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _INTEGER_in_value940 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _FLOAT_in_value948 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _STRING_in_value956 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _DATETIME_in_value965 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _TRUE_in_value972 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _FALSE_in_value980 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _ID_in_identifier998 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _NAME_in_identifier1006 = new BitSet(new ulong[1] { 2uL });

			public static readonly BitSet _logicalExpression_in_expressionList1030 = new BitSet(new ulong[1] { 288230376151711746uL });

			public static readonly BitSet _58_in_expressionList1037 = new BitSet(new ulong[2] { 729865303422501376uL, 2048uL });

			public static readonly BitSet _logicalExpression_in_expressionList1041 = new BitSet(new ulong[1] { 288230376151711746uL });

			public static readonly BitSet _53_in_arguments1070 = new BitSet(new ulong[2] { 747879701931983360uL, 2048uL });

			public static readonly BitSet _expressionList_in_arguments1074 = new BitSet(new ulong[1] { 18014398509481984uL });

			public static readonly BitSet _54_in_arguments1081 = new BitSet(new ulong[1] { 2uL });
		}

		internal static readonly string[] tokenNames = new string[76]
		{
			"<invalid>", "<EOR>", "<DOWN>", "<UP>", "A", "AND", "B", "C", "D", "DATETIME",
			"DIGIT", "E", "EXPONENT", "EscapeSequence", "F", "FALSE", "FLOAT", "G", "H", "HexDigit",
			"I", "ID", "INTEGER", "J", "K", "L", "LETTER", "M", "N", "NAME",
			"NOT", "O", "OR", "P", "Q", "R", "S", "STRING", "T", "TRUE",
			"U", "UnicodeEscape", "V", "W", "WS", "X", "Y", "Z", "'!'", "'!='",
			"'%'", "'&&'", "'&'", "'('", "')'", "'*'", "'**'", "'+'", "','", "'-'",
			"'/'", "':'", "'<'", "'<<'", "'<='", "'<>'", "'='", "'=='", "'>'", "'>='",
			"'>>'", "'?'", "'^'", "'|'", "'||'", "'~'"
		};

		public const int EOF = -1;

		public const int A = 4;

		public const int AND = 5;

		public const int B = 6;

		public const int C = 7;

		public const int D = 8;

		public const int DATETIME = 9;

		public const int DIGIT = 10;

		public const int E = 11;

		public const int EXPONENT = 12;

		public const int EscapeSequence = 13;

		public const int F = 14;

		public const int FALSE = 15;

		public const int FLOAT = 16;

		public const int G = 17;

		public const int H = 18;

		public const int HexDigit = 19;

		public const int I = 20;

		public const int ID = 21;

		public const int INTEGER = 22;

		public const int J = 23;

		public const int K = 24;

		public const int L = 25;

		public const int LETTER = 26;

		public const int M = 27;

		public const int N = 28;

		public const int NAME = 29;

		public const int NOT = 30;

		public const int O = 31;

		public const int OR = 32;

		public const int P = 33;

		public const int Q = 34;

		public const int R = 35;

		public const int S = 36;

		public const int STRING = 37;

		public const int T = 38;

		public const int TRUE = 39;

		public const int U = 40;

		public const int UnicodeEscape = 41;

		public const int V = 42;

		public const int W = 43;

		public const int WS = 44;

		public const int X = 45;

		public const int Y = 46;

		public const int Z = 47;

		public const int T__48 = 48;

		public const int T__49 = 49;

		public const int T__50 = 50;

		public const int T__51 = 51;

		public const int T__52 = 52;

		public const int T__53 = 53;

		public const int T__54 = 54;

		public const int T__55 = 55;

		public const int T__56 = 56;

		public const int T__57 = 57;

		public const int T__58 = 58;

		public const int T__59 = 59;

		public const int T__60 = 60;

		public const int T__61 = 61;

		public const int T__62 = 62;

		public const int T__63 = 63;

		public const int T__64 = 64;

		public const int T__65 = 65;

		public const int T__66 = 66;

		public const int T__67 = 67;

		public const int T__68 = 68;

		public const int T__69 = 69;

		public const int T__70 = 70;

		public const int T__71 = 71;

		public const int T__72 = 72;

		public const int T__73 = 73;

		public const int T__74 = 74;

		public const int T__75 = 75;

		private ITreeAdaptor adaptor;

		private const char BS = '\\';

		private static NumberFormatInfo numberFormatInfo = new NumberFormatInfo();

		public ITreeAdaptor TreeAdaptor
		{
			get
			{
				return adaptor;
			}
			set
			{
				adaptor = value;
			}
		}

		public override string[] TokenNames => tokenNames;

		public override string GrammarFileName => "NCalc.g";

		public List<string> Errors { get; private set; }

		public NCalcParser(ITokenStream input)
			: this(input, new RecognizerSharedState())
		{
		}//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown


		public NCalcParser(ITokenStream input, RecognizerSharedState state)
			: base(input, state)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			ITreeAdaptor val = null;
			TreeAdaptor = (ITreeAdaptor)(((object)val) ?? ((object)new CommonTreeAdaptor()));
		}

		private string extractString(string text)
		{
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			StringBuilder stringBuilder = new StringBuilder(text);
			int startIndex = 1;
			int num = -1;
			while ((num = stringBuilder.ToString().IndexOf('\\', startIndex)) != -1)
			{
				char c = stringBuilder[num + 1];
				switch (c)
				{
				case 'u':
				{
					string text2 = string.Concat(stringBuilder[num + 4], stringBuilder[num + 5]);
					string text3 = string.Concat(stringBuilder[num + 2], stringBuilder[num + 3]);
					char c2 = Encoding.Unicode.GetChars(new byte[2]
					{
						Convert.ToByte(text2, 16),
						Convert.ToByte(text3, 16)
					})[0];
					stringBuilder.Remove(num, 6).Insert(num, c2);
					break;
				}
				case 'n':
					stringBuilder.Remove(num, 2).Insert(num, '\n');
					break;
				case 'r':
					stringBuilder.Remove(num, 2).Insert(num, '\r');
					break;
				case 't':
					stringBuilder.Remove(num, 2).Insert(num, '\t');
					break;
				case '\'':
					stringBuilder.Remove(num, 2).Insert(num, '\'');
					break;
				case '\\':
					stringBuilder.Remove(num, 2).Insert(num, '\\');
					break;
				default:
					throw new RecognitionException("Unvalid escape sequence: \\" + c);
				}
				startIndex = num + 1;
			}
			stringBuilder.Remove(0, 1);
			stringBuilder.Remove(stringBuilder.Length - 1, 1);
			return stringBuilder.ToString();
		}

		public override void DisplayRecognitionError(string[] tokenNames, RecognitionException e)
		{
			((BaseRecognizer)this).DisplayRecognitionError(tokenNames, e);
			if (Errors == null)
			{
				Errors = new List<string>();
			}
			string errorHeader = ((BaseRecognizer)this).GetErrorHeader(e);
			string errorMessage = ((BaseRecognizer)this).GetErrorMessage(e, tokenNames);
			Errors.Add(errorMessage + " at " + errorHeader);
		}

		public LogicalExpression GetExpression()
		{
			return ncalcExpression().value;
		}

		[GrammarRule("ncalcExpression")]
		private ncalcExpression_return ncalcExpression()
		{
			//IL_00d0: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			ncalcExpression_return ncalcExpression_return = new ncalcExpression_return(this);
			((ParserRuleReturnScope<IToken>)(object)ncalcExpression_return).Start = base.input.LT(1);
			CommonTree val = null;
			AstParserRuleReturnScope<CommonTree, IToken> val2 = null;
			try
			{
				try
				{
					val = (CommonTree)adaptor.Nil();
					((BaseRecognizer)this).PushFollow(Follow._logicalExpression_in_ncalcExpression73);
					val2 = logicalExpression();
					((BaseRecognizer)this).PopFollow();
					adaptor.AddChild((object)val, (object)val2.Tree);
					_ = (IToken)((BaseRecognizer)this).Match((IIntStream)(object)base.input, -1, Follow._EOF_in_ncalcExpression75);
					ncalcExpression_return.value = ((val2 != null) ? ((logicalExpression_return)val2).value : null);
					((ParserRuleReturnScope<IToken>)(object)ncalcExpression_return).Stop = base.input.LT(-1);
					((AstParserRuleReturnScope<CommonTree, IToken>)ncalcExpression_return).Tree = (CommonTree)adaptor.RulePostProcessing((object)val);
					adaptor.SetTokenBoundaries((object)((AstParserRuleReturnScope<CommonTree, IToken>)ncalcExpression_return).Tree, ((ParserRuleReturnScope<IToken>)(object)ncalcExpression_return).Start, ((ParserRuleReturnScope<IToken>)(object)ncalcExpression_return).Stop);
				}
				catch (RecognitionException val3)
				{
					RecognitionException val4 = val3;
					((BaseRecognizer)this).ReportError(val4);
					((BaseRecognizer)this).Recover((IIntStream)(object)base.input, val4);
					((AstParserRuleReturnScope<CommonTree, IToken>)ncalcExpression_return).Tree = (CommonTree)adaptor.ErrorNode(base.input, ((ParserRuleReturnScope<IToken>)(object)ncalcExpression_return).Start, base.input.LT(-1), val4);
				}
				finally
				{
				}
			}
			finally
			{
			}
			return ncalcExpression_return;
		}

		[GrammarRule("logicalExpression")]
		private logicalExpression_return logicalExpression()
		{
			//IL_0202: Expected O, but got Unknown
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Expected O, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Expected O, but got Unknown
			logicalExpression_return logicalExpression_return = new logicalExpression_return(this);
			((ParserRuleReturnScope<IToken>)(object)logicalExpression_return).Start = base.input.LT(1);
			CommonTree val = null;
			IToken val2 = null;
			IToken val3 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val4 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val5 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val6 = null;
			CommonTree val7 = null;
			CommonTree val8 = null;
			try
			{
				try
				{
					val = (CommonTree)adaptor.Nil();
					((BaseRecognizer)this).PushFollow(Follow._conditionalExpression_in_logicalExpression95);
					val4 = conditionalExpression();
					((BaseRecognizer)this).PopFollow();
					adaptor.AddChild((object)val, (object)val4.Tree);
					logicalExpression_return.value = ((val4 != null) ? ((conditionalExpression_return)val4).value : null);
					int num = 2;
					try
					{
						try
						{
							if (((IIntStream)base.input).LA(1) == 71)
							{
								num = 1;
							}
						}
						finally
						{
						}
						if (num == 1)
						{
							val2 = (IToken)((BaseRecognizer)this).Match((IIntStream)(object)base.input, 71, Follow._71_in_logicalExpression101);
							val7 = (CommonTree)adaptor.Create(val2);
							adaptor.AddChild((object)val, (object)val7);
							((BaseRecognizer)this).PushFollow(Follow._conditionalExpression_in_logicalExpression105);
							val5 = conditionalExpression();
							((BaseRecognizer)this).PopFollow();
							adaptor.AddChild((object)val, (object)val5.Tree);
							val3 = (IToken)((BaseRecognizer)this).Match((IIntStream)(object)base.input, 61, Follow._61_in_logicalExpression107);
							val8 = (CommonTree)adaptor.Create(val3);
							adaptor.AddChild((object)val, (object)val8);
							((BaseRecognizer)this).PushFollow(Follow._conditionalExpression_in_logicalExpression111);
							val6 = conditionalExpression();
							((BaseRecognizer)this).PopFollow();
							adaptor.AddChild((object)val, (object)val6.Tree);
							logicalExpression_return.value = new TernaryExpression((val4 != null) ? ((conditionalExpression_return)val4).value : null, (val5 != null) ? ((conditionalExpression_return)val5).value : null, (val6 != null) ? ((conditionalExpression_return)val6).value : null);
						}
					}
					finally
					{
					}
					((ParserRuleReturnScope<IToken>)(object)logicalExpression_return).Stop = base.input.LT(-1);
					((AstParserRuleReturnScope<CommonTree, IToken>)logicalExpression_return).Tree = (CommonTree)adaptor.RulePostProcessing((object)val);
					adaptor.SetTokenBoundaries((object)((AstParserRuleReturnScope<CommonTree, IToken>)logicalExpression_return).Tree, ((ParserRuleReturnScope<IToken>)(object)logicalExpression_return).Start, ((ParserRuleReturnScope<IToken>)(object)logicalExpression_return).Stop);
				}
				catch (RecognitionException val9)
				{
					RecognitionException val10 = val9;
					((BaseRecognizer)this).ReportError(val10);
					((BaseRecognizer)this).Recover((IIntStream)(object)base.input, val10);
					((AstParserRuleReturnScope<CommonTree, IToken>)logicalExpression_return).Tree = (CommonTree)adaptor.ErrorNode(base.input, ((ParserRuleReturnScope<IToken>)(object)logicalExpression_return).Start, base.input.LT(-1), val10);
				}
				finally
				{
				}
			}
			finally
			{
			}
			return logicalExpression_return;
		}

		[GrammarRule("conditionalExpression")]
		private conditionalExpression_return conditionalExpression()
		{
			//IL_01ba: Expected O, but got Unknown
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Expected O, but got Unknown
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			conditionalExpression_return conditionalExpression_return = new conditionalExpression_return(this);
			((ParserRuleReturnScope<IToken>)(object)conditionalExpression_return).Start = base.input.LT(1);
			CommonTree val = null;
			IToken val2 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val3 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val4 = null;
			BinaryExpressionType binaryExpressionType = BinaryExpressionType.Unknown;
			try
			{
				try
				{
					val = (CommonTree)adaptor.Nil();
					((BaseRecognizer)this).PushFollow(Follow._booleanAndExpression_in_conditionalExpression138);
					val3 = booleanAndExpression();
					((BaseRecognizer)this).PopFollow();
					adaptor.AddChild((object)val, (object)val3.Tree);
					conditionalExpression_return.value = ((val3 != null) ? ((booleanAndExpression_return)val3).value : null);
					try
					{
						while (true)
						{
							int num = 2;
							try
							{
								int num2 = ((IIntStream)base.input).LA(1);
								if (num2 == 32 || num2 == 74)
								{
									num = 1;
								}
							}
							finally
							{
							}
							if (num == 1)
							{
								val2 = base.input.LT(1);
								if (((IIntStream)base.input).LA(1) == 32 || ((IIntStream)base.input).LA(1) == 74)
								{
									((IIntStream)base.input).Consume();
									adaptor.AddChild((object)val, (object)(CommonTree)adaptor.Create(val2));
									((BaseRecognizer)this).state.errorRecovery = false;
									binaryExpressionType = BinaryExpressionType.Or;
									((BaseRecognizer)this).PushFollow(Follow._conditionalExpression_in_conditionalExpression163);
									val4 = conditionalExpression();
									((BaseRecognizer)this).PopFollow();
									adaptor.AddChild((object)val, (object)val4.Tree);
									conditionalExpression_return.value = new BinaryExpression(binaryExpressionType, conditionalExpression_return.value, (val4 != null) ? ((conditionalExpression_return)val4).value : null);
									continue;
								}
								throw new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
							}
							break;
						}
					}
					finally
					{
					}
					((ParserRuleReturnScope<IToken>)(object)conditionalExpression_return).Stop = base.input.LT(-1);
					((AstParserRuleReturnScope<CommonTree, IToken>)conditionalExpression_return).Tree = (CommonTree)adaptor.RulePostProcessing((object)val);
					adaptor.SetTokenBoundaries((object)((AstParserRuleReturnScope<CommonTree, IToken>)conditionalExpression_return).Tree, ((ParserRuleReturnScope<IToken>)(object)conditionalExpression_return).Start, ((ParserRuleReturnScope<IToken>)(object)conditionalExpression_return).Stop);
				}
				catch (RecognitionException val5)
				{
					RecognitionException val6 = val5;
					((BaseRecognizer)this).ReportError(val6);
					((BaseRecognizer)this).Recover((IIntStream)(object)base.input, val6);
					((AstParserRuleReturnScope<CommonTree, IToken>)conditionalExpression_return).Tree = (CommonTree)adaptor.ErrorNode(base.input, ((ParserRuleReturnScope<IToken>)(object)conditionalExpression_return).Start, base.input.LT(-1), val6);
				}
				finally
				{
				}
			}
			finally
			{
			}
			return conditionalExpression_return;
		}

		[GrammarRule("booleanAndExpression")]
		private booleanAndExpression_return booleanAndExpression()
		{
			//IL_01b8: Expected O, but got Unknown
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			booleanAndExpression_return booleanAndExpression_return = new booleanAndExpression_return(this);
			((ParserRuleReturnScope<IToken>)(object)booleanAndExpression_return).Start = base.input.LT(1);
			CommonTree val = null;
			IToken val2 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val3 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val4 = null;
			BinaryExpressionType binaryExpressionType = BinaryExpressionType.Unknown;
			try
			{
				try
				{
					val = (CommonTree)adaptor.Nil();
					((BaseRecognizer)this).PushFollow(Follow._bitwiseOrExpression_in_booleanAndExpression197);
					val3 = bitwiseOrExpression();
					((BaseRecognizer)this).PopFollow();
					adaptor.AddChild((object)val, (object)val3.Tree);
					booleanAndExpression_return.value = ((val3 != null) ? ((bitwiseOrExpression_return)val3).value : null);
					try
					{
						while (true)
						{
							int num = 2;
							try
							{
								int num2 = ((IIntStream)base.input).LA(1);
								if (num2 == 5 || num2 == 51)
								{
									num = 1;
								}
							}
							finally
							{
							}
							if (num == 1)
							{
								val2 = base.input.LT(1);
								if (((IIntStream)base.input).LA(1) == 5 || ((IIntStream)base.input).LA(1) == 51)
								{
									((IIntStream)base.input).Consume();
									adaptor.AddChild((object)val, (object)(CommonTree)adaptor.Create(val2));
									((BaseRecognizer)this).state.errorRecovery = false;
									binaryExpressionType = BinaryExpressionType.And;
									((BaseRecognizer)this).PushFollow(Follow._bitwiseOrExpression_in_booleanAndExpression222);
									val4 = bitwiseOrExpression();
									((BaseRecognizer)this).PopFollow();
									adaptor.AddChild((object)val, (object)val4.Tree);
									booleanAndExpression_return.value = new BinaryExpression(binaryExpressionType, booleanAndExpression_return.value, (val4 != null) ? ((bitwiseOrExpression_return)val4).value : null);
									continue;
								}
								throw new MismatchedSetException((BitSet)null, (IIntStream)(object)base.input);
							}
							break;
						}
					}
					finally
					{
					}
					((ParserRuleReturnScope<IToken>)(object)booleanAndExpression_return).Stop = base.input.LT(-1);
					((AstParserRuleReturnScope<CommonTree, IToken>)booleanAndExpression_return).Tree = (CommonTree)adaptor.RulePostProcessing((object)val);
					adaptor.SetTokenBoundaries((object)((AstParserRuleReturnScope<CommonTree, IToken>)booleanAndExpression_return).Tree, ((ParserRuleReturnScope<IToken>)(object)booleanAndExpression_return).Start, ((ParserRuleReturnScope<IToken>)(object)booleanAndExpression_return).Stop);
				}
				catch (RecognitionException val5)
				{
					RecognitionException val6 = val5;
					((BaseRecognizer)this).ReportError(val6);
					((BaseRecognizer)this).Recover((IIntStream)(object)base.input, val6);
					((AstParserRuleReturnScope<CommonTree, IToken>)booleanAndExpression_return).Tree = (CommonTree)adaptor.ErrorNode(base.input, ((ParserRuleReturnScope<IToken>)(object)booleanAndExpression_return).Start, base.input.LT(-1), val6);
				}
				finally
				{
				}
			}
			finally
			{
			}
			return booleanAndExpression_return;
		}

		[GrammarRule("bitwiseOrExpression")]
		private bitwiseOrExpression_return bitwiseOrExpression()
		{
			//IL_017e: Expected O, but got Unknown
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			bitwiseOrExpression_return bitwiseOrExpression_return = new bitwiseOrExpression_return(this);
			((ParserRuleReturnScope<IToken>)(object)bitwiseOrExpression_return).Start = base.input.LT(1);
			CommonTree val = null;
			IToken val2 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val3 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val4 = null;
			CommonTree val5 = null;
			BinaryExpressionType binaryExpressionType = BinaryExpressionType.Unknown;
			try
			{
				try
				{
					val = (CommonTree)adaptor.Nil();
					((BaseRecognizer)this).PushFollow(Follow._bitwiseXOrExpression_in_bitwiseOrExpression254);
					val3 = bitwiseXOrExpression();
					((BaseRecognizer)this).PopFollow();
					adaptor.AddChild((object)val, (object)val3.Tree);
					bitwiseOrExpression_return.value = ((val3 != null) ? ((bitwiseXOrExpression_return)val3).value : null);
					try
					{
						while (true)
						{
							int num = 2;
							try
							{
								if (((IIntStream)base.input).LA(1) == 73)
								{
									num = 1;
								}
							}
							finally
							{
							}
							if (num == 1)
							{
								val2 = (IToken)((BaseRecognizer)this).Match((IIntStream)(object)base.input, 73, Follow._73_in_bitwiseOrExpression263);
								val5 = (CommonTree)adaptor.Create(val2);
								adaptor.AddChild((object)val, (object)val5);
								binaryExpressionType = BinaryExpressionType.BitwiseOr;
								((BaseRecognizer)this).PushFollow(Follow._bitwiseOrExpression_in_bitwiseOrExpression273);
								val4 = bitwiseOrExpression();
								((BaseRecognizer)this).PopFollow();
								adaptor.AddChild((object)val, (object)val4.Tree);
								bitwiseOrExpression_return.value = new BinaryExpression(binaryExpressionType, bitwiseOrExpression_return.value, (val4 != null) ? ((bitwiseOrExpression_return)val4).value : null);
								continue;
							}
							break;
						}
					}
					finally
					{
					}
					((ParserRuleReturnScope<IToken>)(object)bitwiseOrExpression_return).Stop = base.input.LT(-1);
					((AstParserRuleReturnScope<CommonTree, IToken>)bitwiseOrExpression_return).Tree = (CommonTree)adaptor.RulePostProcessing((object)val);
					adaptor.SetTokenBoundaries((object)((AstParserRuleReturnScope<CommonTree, IToken>)bitwiseOrExpression_return).Tree, ((ParserRuleReturnScope<IToken>)(object)bitwiseOrExpression_return).Start, ((ParserRuleReturnScope<IToken>)(object)bitwiseOrExpression_return).Stop);
				}
				catch (RecognitionException val6)
				{
					RecognitionException val7 = val6;
					((BaseRecognizer)this).ReportError(val7);
					((BaseRecognizer)this).Recover((IIntStream)(object)base.input, val7);
					((AstParserRuleReturnScope<CommonTree, IToken>)bitwiseOrExpression_return).Tree = (CommonTree)adaptor.ErrorNode(base.input, ((ParserRuleReturnScope<IToken>)(object)bitwiseOrExpression_return).Start, base.input.LT(-1), val7);
				}
				finally
				{
				}
			}
			finally
			{
			}
			return bitwiseOrExpression_return;
		}

		[GrammarRule("bitwiseXOrExpression")]
		private bitwiseXOrExpression_return bitwiseXOrExpression()
		{
			//IL_017e: Expected O, but got Unknown
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			bitwiseXOrExpression_return bitwiseXOrExpression_return = new bitwiseXOrExpression_return(this);
			((ParserRuleReturnScope<IToken>)(object)bitwiseXOrExpression_return).Start = base.input.LT(1);
			CommonTree val = null;
			IToken val2 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val3 = null;
			AstParserRuleReturnScope<CommonTree, IToken> val4 = null;
			CommonTree val5 = null;
			BinaryExpressionType binaryExpressionType = BinaryExpressionType.Unknown;
			try
			{
				try
				{
					val = (CommonTree)adaptor.Nil();
					((BaseRecognizer)this).PushFollow(Follow._bitwiseAndExpression_in_bitwiseXOrExpression307);
					val3 = bitwiseAndExpression();
					((BaseRecognizer)this).PopFollow();
					adaptor.AddChild((object)val, (object)val3.Tree);
					bitwiseXOrExpression_return.value = ((val3 != null) ? ((bitwiseAndExpression_return)val3).value : null);
					try
					{
						while (true)
						{
							int num = 2;
							try
							{
								if (((IIntStream)base.input).LA(1) == 72)
								{
									num = 1;
								}
							}
							finally
							{
							}
							if (num == 1)
							{
								val2 = (IToken)((BaseRecognizer)this).Match((IIntStream)(object)base.input, 72, Follow._72_in_bitwiseXOrExpression316);
								val5 = (CommonTree)adaptor.Create(val2);
								adaptor.AddChild((object)val, (object)val5);
								binaryExpressionType = BinaryExpressionType.BitwiseXOr;
								((BaseRecognizer)this).PushFollow(Follow._bitwiseAndExpression_in_bitwiseXOrExpression326);
								val4 = bitwiseAndExpression();
								((BaseRecognizer)this).PopFollow();
								adaptor.AddChild((object)val, (object)val4.Tree);
								bitwiseXOrExpression_return.value = new BinaryExpression(binaryExpressionType, bitwiseXOrExpression_return.value, (val4 != null) ? ((bitwiseAndExpression_return)val4).value : null);
								continue;
							}
							break;
						}
					}
					finally
					{
					}
					((ParserRuleReturnScope<IToken>)(object)bitwiseXOrExpression_return).Stop = base.input.LT(-1);
					((AstParserRuleReturnScope<CommonTree, IToken>)bitwiseXOrExpression_return).Tree = (CommonTree)adaptor.RulePostProcessing((object)val);
					adaptor.SetTokenBoundaries((object)((AstParserRuleReturnScope<CommonTree, IToken>)bitwiseXOrExpression_return).Tree, ((ParserRuleReturnScope<IToken>)(object)bitwiseXOrExpression_return).Start, ((ParserRuleReturnScope<IToken>)(object)bitwiseXOrExpression_return).Stop);
				}
				catch (RecognitionException val6)
				{
					RecognitionException val7 = val6;
					((BaseRecognizer)this).ReportError(val7);
					((BaseRecognizer)this).Recover((IIntStream)(object)base.input, val7);
					((AstParserRuleReturnScope<CommonTree, IToken>)bitwiseXOrExpression_return).Tree = (CommonTree)adaptor.ErrorNode(base.input, ((ParserRuleReturnScope<IToken>)(object)bit

plugins\Dependencies\Configils-Required-Dependencies\PanoramicData.NCalcExtensions.dll

Decompiled a month ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using Microsoft.CodeAnalysis;
using NCalc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PanoramicData.NCalcExtensions.Exceptions;
using PanoramicData.NCalcExtensions.Extensions;
using PanoramicData.NCalcExtensions.Helpers;
using TimeZoneConverter;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyFileVersion("1.20.127.34203")]
[assembly: AssemblyInformationalVersion("1.20.127+859b0ed46e")]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Panoramic Data Limited")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Panoramic Data Limited 2019-2023")]
[assembly: AssemblyDescription("Extensions for NCalc")]
[assembly: AssemblyProduct("PanoramicData.NCalcExtensions")]
[assembly: AssemblyTitle("PanoramicData.NCalcExtensions")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/panoramicdata/PanoramicData.NCalcExtensions")]
[assembly: InternalsVisibleTo("PanoramicData.NCalcExtensions.Test")]
[assembly: AssemblyVersion("1.20.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[GeneratedCode("Nerdbank.GitVersioning.Tasks", "3.5.119.9565")]
[ExcludeFromCodeCoverage]
internal static class ThisAssembly
{
	internal const string AssemblyConfiguration = "Release";

	internal const string AssemblyFileVersion = "1.20.127.34203";

	internal const string AssemblyInformationalVersion = "1.20.127+859b0ed46e";

	internal const string AssemblyName = "PanoramicData.NCalcExtensions";

	internal const string AssemblyTitle = "PanoramicData.NCalcExtensions";

	internal const string AssemblyVersion = "1.20.0.0";

	internal static readonly DateTime GitCommitDate = new DateTime(638332475000000000L, DateTimeKind.Utc);

	internal const string GitCommitId = "859b0ed46eb79975f879772d7edd6b08e2ec9a3c";

	internal const bool IsPrerelease = false;

	internal const bool IsPublicRelease = true;

	internal const string RootNamespace = "PanoramicData.NCalcExtensions";
}
namespace PanoramicData.NCalcExtensions
{
	public class ExtendedExpression : Expression
	{
		private readonly Dictionary<string, object?> _storageDictionary = new Dictionary<string, object>();

		internal const string StorageDictionaryParameterName = "__storageDictionary";

		public ExtendedExpression(string expression)
			: base(expression)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			((Expression)this).Parameters["__storageDictionary"] = _storageDictionary;
			((Expression)this).EvaluateFunction += new EvaluateFunctionHandler(Extend);
			Expression.CacheEnabled = false;
			if (((Expression)this).Parameters.ContainsKey("null"))
			{
				throw new InvalidOperationException("You may not set a parameter called 'null', as it is a reserved keyword.");
			}
			((Expression)this).Parameters["null"] = null;
			if (((Expression)this).Parameters.ContainsKey("True"))
			{
				throw new InvalidOperationException("You may not set a parameter called 'True', as it is a reserved keyword.");
			}
			((Expression)this).Parameters["True"] = true;
			if (((Expression)this).Parameters.ContainsKey("False"))
			{
				throw new InvalidOperationException("You may not set a parameter called 'False', as it is a reserved keyword.");
			}
			((Expression)this).Parameters["False"] = false;
		}

		internal static void CheckParameterCount(string functionName, FunctionArgs functionArgs, int? minPropertyCount, int? maxPropertyCount)
		{
			if (minPropertyCount.HasValue && functionArgs.Parameters.Length < minPropertyCount)
			{
				throw new FormatException(string.Format("{0}: At least {1} parameter{2} required.", functionName, minPropertyCount, (minPropertyCount == 1) ? "" : "s"));
			}
			if (maxPropertyCount.HasValue && functionArgs.Parameters.Length > maxPropertyCount)
			{
				throw new FormatException(string.Format("{0}: No more than {1} parameter{2} permitted.", functionName, maxPropertyCount, (maxPropertyCount == 1) ? "" : "s"));
			}
		}

		internal void Extend(string functionName, FunctionArgs functionArgs)
		{
			if (functionArgs == null)
			{
				throw new ArgumentNullException("functionArgs");
			}
			if (functionName == null)
			{
				return;
			}
			switch (functionName.Length)
			{
			case 3:
				switch (functionName[1])
				{
				case 'l':
					if (functionName == "all")
					{
						All.Evaluate(functionArgs);
					}
					break;
				case 'n':
					if (functionName == "any")
					{
						Any.Evaluate(functionArgs);
					}
					break;
				case 'a':
					if (functionName == "max")
					{
						Max.Evaluate(functionArgs);
					}
					break;
				case 'i':
					if (functionName == "min")
					{
						Min.Evaluate(functionArgs);
					}
					break;
				case 'u':
					if (functionName == "sum")
					{
						Sum.Evaluate(functionArgs);
					}
					break;
				case 'r':
					if (functionName == "try")
					{
						Try.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 11:
				switch (functionName[0])
				{
				case 'c':
					if (functionName == "canEvaluate")
					{
						CanEvaluate.Evaluate(functionArgs);
					}
					break;
				case 'g':
					if (functionName == "getProperty")
					{
						GetProperty.Evaluate(functionArgs);
					}
					break;
				case 'i':
					if (functionName == "itemAtIndex")
					{
						ItemAtIndex.Evaluate(functionArgs);
					}
					break;
				case 'l':
					if (functionName == "lastIndexOf")
					{
						LastIndexOf.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 10:
				switch (functionName[0])
				{
				case 'c':
					if (functionName == "capitalise" || functionName == "capitalize")
					{
						Capitalize.Evaluate(functionArgs);
					}
					break;
				case 'd':
					if (functionName == "dictionary")
					{
						Dictionary.Evaluate(functionArgs);
					}
					break;
				case 'i':
					if (functionName == "isInfinite")
					{
						IsInfinite.Evaluate(functionArgs);
					}
					break;
				case 'r':
					if (functionName == "regexGroup")
					{
						RegexGroup.Evaluate(functionArgs);
					}
					break;
				case 's':
					if (functionName == "startsWith")
					{
						StartsWith.Evaluate(functionArgs);
					}
					break;
				case 't':
					if (functionName == "toDateTime")
					{
						ToDateTime.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 4:
				switch (functionName[0])
				{
				case 'c':
					if (functionName == "cast")
					{
						Cast.Evaluate(functionArgs);
					}
					break;
				case 'j':
					if (functionName == "join")
					{
						Join.Evaluate(functionArgs);
					}
					break;
				case 'l':
					if (functionName == "list")
					{
						List.Evaluate(functionArgs);
					}
					break;
				case 's':
					if (!(functionName == "skip"))
					{
						if (functionName == "sort")
						{
							Sort.Evaluate(functionArgs);
						}
					}
					else
					{
						Skip.Evaluate(functionArgs);
					}
					break;
				case 't':
					if (functionName == "take")
					{
						Take.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 14:
				switch (functionName[0])
				{
				case 'c':
					if (functionName == "changeTimeZone")
					{
						ChangeTimeZone.Evaluate(functionArgs);
					}
					break;
				case 'f':
					if (functionName == "firstOrDefault")
					{
						FirstOrDefault.Evaluate(functionArgs);
					}
					break;
				case 's':
					if (functionName == "selectDistinct")
					{
						SelectDistinct.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 6:
				switch (functionName[2])
				{
				case 'n':
					if (!(functionName == "concat"))
					{
						if (functionName == "length")
						{
							Length.Evaluate(functionArgs);
						}
					}
					else
					{
						Concat.Evaluate(functionArgs);
					}
					break;
				case 't':
					if (functionName == "extend")
					{
						ExtendObject.Evaluate(functionArgs);
					}
					break;
				case 'r':
					if (functionName == "format")
					{
						Format.Evaluate(functionArgs);
					}
					break;
				case 'G':
					if (functionName == "isGuid")
					{
						IsGuid.Evaluate(functionArgs);
					}
					break;
				case 'N':
					if (functionName == "isNull")
					{
						IsNull.Evaluate(functionArgs);
					}
					break;
				case 's':
					if (functionName == "listOf")
					{
						ListOf.Evaluate(functionArgs);
					}
					break;
				case 'l':
					if (functionName == "select")
					{
						Select.Evaluate(functionArgs);
					}
					break;
				case 'i':
					if (functionName == "switch")
					{
						PanoramicData.NCalcExtensions.Extensions.Switch.Evaluate(functionArgs);
					}
					break;
				case 'p':
					if (functionName == "typeOf")
					{
						TypeOf.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 8:
				switch (functionName[2])
				{
				case 'n':
					if (!(functionName == "contains"))
					{
						if (functionName == "minValue")
						{
							MinValue.Evaluate(functionArgs);
						}
					}
					else
					{
						Contains.Evaluate(functionArgs);
					}
					break;
				case 't':
					if (!(functionName == "dateTime"))
					{
						if (functionName == "retrieve")
						{
							Retrieve.Evaluate(functionArgs);
						}
					}
					else
					{
						DateTimeMethods.Evaluate(functionArgs);
					}
					break;
				case 's':
					if (functionName == "distinct")
					{
						Distinct.Evaluate(functionArgs);
					}
					break;
				case 'd':
					if (functionName == "endsWith")
					{
						EndsWith.Evaluate(functionArgs);
					}
					break;
				case 'm':
					switch (functionName)
					{
					case "humanise":
					case "humanize":
						Humanize.Evaluate(functionArgs);
						break;
					case "timespan":
					case "timeSpan":
						PanoramicData.NCalcExtensions.Extensions.TimeSpan.Evaluate(functionArgs);
						break;
					}
					break;
				case 'x':
					if (functionName == "maxValue")
					{
						MaxValue.Evaluate(functionArgs);
					}
					break;
				case 'r':
					if (functionName == "parseInt")
					{
						ParseInt.Evaluate(functionArgs);
					}
					break;
				case 'S':
					if (functionName == "toString")
					{
						ToString.Evaluate(functionArgs);
					}
					break;
				case 'y':
					if (functionName == "tryParse")
					{
						TryParse.Evaluate(functionArgs, _storageDictionary);
					}
					break;
				}
				break;
			case 7:
				switch (functionName[0])
				{
				case 'c':
					if (functionName == "convert")
					{
						ConvertFunction.Evaluate(functionArgs);
					}
					break;
				case 'i':
					if (functionName == "indexOf")
					{
						IndexOf.Evaluate(functionArgs);
					}
					break;
				case 'j':
					if (functionName == "jObject")
					{
						NewJObject.Evaluate(functionArgs);
					}
					break;
				case 'o':
					if (functionName == "orderBy")
					{
						OrderBy.Evaluate(functionArgs);
					}
					break;
				case 'p':
					if (functionName == "padLeft")
					{
						PadLeft.Evaluate(functionArgs);
					}
					break;
				case 'r':
					if (functionName == "replace")
					{
						Replace.Evaluate(functionArgs);
					}
					break;
				case 't':
					if (!(functionName == "toLower"))
					{
						if (functionName == "toUpper")
						{
							ToUpper.Evaluate(functionArgs);
						}
					}
					else
					{
						ToLower.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 5:
				switch (functionName[2])
				{
				case 'u':
					if (functionName == "count")
					{
						Count.Evaluate(functionArgs);
					}
					break;
				case 'r':
					switch (functionName)
					{
					case "first":
						First.Evaluate(functionArgs);
						break;
					case "parse":
						Parse.Evaluate(functionArgs);
						break;
					case "throw":
						throw Throw.Evaluate(functionArgs);
					}
					break;
				case 'N':
					if (functionName == "isNaN")
					{
						IsNaN.Evaluate(functionArgs);
					}
					break;
				case 'S':
					if (functionName == "isSet")
					{
						IsSet.Evaluate(functionArgs);
					}
					break;
				case 'a':
					if (functionName == "jPath")
					{
						JPath.Evaluate(functionArgs);
					}
					break;
				case 'l':
					if (functionName == "split")
					{
						Split.Evaluate(functionArgs);
					}
					break;
				case 'o':
					if (functionName == "store")
					{
						Store.Evaluate(functionArgs);
					}
					break;
				case 'e':
					if (functionName == "where")
					{
						Where.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 2:
				switch (functionName[1])
				{
				case 'n':
					if (functionName == "in")
					{
						In.Evaluate(functionArgs);
					}
					break;
				case 'f':
					if (functionName == "if")
					{
						If.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 13:
				switch (functionName[0])
				{
				case 'i':
					if (functionName == "isNullOrEmpty")
					{
						IsNullOrEmpty.Evaluate(functionArgs);
					}
					break;
				case 's':
					if (functionName == "setProperties")
					{
						SetProperties.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 12:
				switch (functionName[0])
				{
				case 'n':
					if (functionName == "nullCoalesce")
					{
						NullCoalesce.Evaluate(functionArgs);
					}
					break;
				case 'r':
					if (functionName == "regexIsMatch")
					{
						RegexIsMatch.Evaluate(functionArgs);
					}
					break;
				}
				break;
			case 17:
				if (functionName == "dateTimeAsEpochMs")
				{
					DateTimeAsEpochMs.Evaluate(functionArgs);
				}
				break;
			case 18:
				if (functionName == "isNullOrWhiteSpace")
				{
					IsNullOrWhiteSpace.Evaluate(functionArgs);
				}
				break;
			case 9:
				if (functionName == "substring")
				{
					Substring.Evaluate(functionArgs);
				}
				break;
			case 15:
			case 16:
				break;
			}
		}
	}
	public static class ExtensionFunction
	{
		public const string All = "all";

		public const string Any = "any";

		public const string CanEvaluate = "canEvaluate";

		public const string Capitalise = "capitalise";

		public const string Capitalize = "capitalize";

		public const string Cast = "cast";

		public const string ChangeTimeZone = "changeTimeZone";

		public const string Concat = "concat";

		public const string Contains = "contains";

		public const string Convert = "convert";

		public const string Count = "count";

		public const string DateTime = "dateTime";

		public const string DateTimeAsEpochMs = "dateTimeAsEpochMs";

		public const string Dictionary = "dictionary";

		public const string Distinct = "distinct";

		public const string EndsWith = "endsWith";

		public const string Extend = "extend";

		public const string First = "first";

		public const string FirstOrDefault = "firstOrDefault";

		public const string Format = "format";

		public const string GetProperty = "getProperty";

		public const string Humanise = "humanise";

		public const string Humanize = "humanize";

		public const string If = "if";

		public const string In = "in";

		public const string IndexOf = "indexOf";

		public const string IsGuid = "isGuid";

		public const string IsInfinite = "isInfinite";

		public const string IsNaN = "isNaN";

		public const string IsNull = "isNull";

		public const string IsNullOrWhiteSpace = "isNullOrWhiteSpace";

		public const string IsNullOrEmpty = "isNullOrEmpty";

		public const string IsSet = "isSet";

		public const string ItemAtIndex = "itemAtIndex";

		public const string Join = "join";

		public const string JPath = "jPath";

		public const string LastIndexOf = "lastIndexOf";

		public const string Length = "length";

		public const string List = "list";

		public const string ListOf = "listOf";

		public const string Max = "max";

		public const string MaxValue = "maxValue";

		public const string Min = "min";

		public const string MinValue = "minValue";

		public const string NewJObject = "jObject";

		public const string NullCoalesce = "nullCoalesce";

		public const string OrderBy = "orderBy";

		public const string PadLeft = "padLeft";

		public const string Parse = "parse";

		public const string ParseInt = "parseInt";

		public const string RegexGroup = "regexGroup";

		public const string RegexIsMatch = "regexIsMatch";

		public const string Replace = "replace";

		public const string Retrieve = "retrieve";

		public const string Select = "select";

		public const string SelectDistinct = "selectDistinct";

		public const string SetProperties = "setProperties";

		public const string Skip = "skip";

		public const string Sort = "sort";

		public const string Split = "split";

		public const string StartsWith = "startsWith";

		public const string Store = "store";

		public const string Substring = "substring";

		public const string Sum = "sum";

		public const string Switch = "switch";

		public const string Take = "take";

		public const string Throw = "throw";

		public const string TimeSpan = "timespan";

		public const string TimeSpanCamel = "timeSpan";

		public const string ToDateTime = "toDateTime";

		public const string ToLower = "toLower";

		public new const string ToString = "toString";

		public const string ToUpper = "toUpper";

		public const string Try = "try";

		public const string TryParse = "tryParse";

		public const string TypeOf = "typeOf";

		public const string Where = "where";
	}
	public class Lambda
	{
		private readonly string predicate;

		private readonly string nCalcString;

		private readonly Dictionary<string, object?> parameters;

		public Lambda(string predicate, string nCalcString, Dictionary<string, object?> parameters)
		{
			this.predicate = predicate;
			this.nCalcString = nCalcString;
			this.parameters = parameters;
		}

		public object? Evaluate<T>(T value)
		{
			parameters.Remove(predicate);
			parameters.Add(predicate, value);
			ExtendedExpression extendedExpression = new ExtendedExpression(nCalcString);
			((Expression)extendedExpression).Parameters = parameters;
			ExtendedExpression extendedExpression2 = extendedExpression;
			return ((Expression)extendedExpression2).Evaluate();
		}
	}
	public static class NCalcExtensions
	{
	}
	public enum TimeUnit
	{
		Milliseconds,
		Seconds,
		Minutes,
		Hours,
		Days,
		Weeks,
		Years
	}
}
namespace PanoramicData.NCalcExtensions.Helpers
{
	internal static class StringExtensions
	{
		internal static string UpperCaseFirst(this string s)
		{
			if (s == null)
			{
				throw new ArgumentNullException("s");
			}
			return s.Substring(0, 1).ToUpperInvariant() + s.Substring(1);
		}
	}
	internal static class TimeSpanExtensions
	{
		internal static string Humanise(this System.TimeSpan t)
		{
			string text = ((t.Days >= 1) ? string.Format("{0} day{1}", t.Days, (t.Days > 1) ? "s" : "") : "");
			if (t.Hours >= 1)
			{
				text += string.Format(" {0} hour{1}", t.Hours, (t.Hours > 1) ? "s" : "");
			}
			if (t.Minutes >= 1)
			{
				text += string.Format(" {0} minute{1}", t.Minutes, (t.Minutes > 1) ? "s" : "");
			}
			if (t.Seconds >= 1)
			{
				text += string.Format(" {0} second{1}", t.Seconds, (t.Seconds > 1) ? "s" : "");
			}
			return text.Trim();
		}
	}
	internal static class TypeHelper
	{
		internal static string AsHumanString<T>()
		{
			if (typeof(T).IsGenericType)
			{
				return typeof(T).GetGenericTypeDefinition().Name + "<" + string.Join(",", from t in typeof(T).GetGenericArguments()
					select t.Name) + ">";
			}
			return typeof(T).Name;
		}
	}
}
namespace PanoramicData.NCalcExtensions.Extensions
{
	internal static class All
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			IEnumerable<object> source = (functionArgs.Parameters[0].Evaluate() as IEnumerable<object>) ?? throw new FormatException("First all parameter must be an IEnumerable.");
			string predicate = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new FormatException("Second all parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new FormatException("Third all parameter must be a string.");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			functionArgs.Result = source.All((object value) => lambda.Evaluate(value) as bool? == true);
		}
	}
	internal static class Any
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			IEnumerable<object> source = (functionArgs.Parameters[0].Evaluate() as IEnumerable<object>) ?? throw new FormatException("First any parameter must be an IEnumerable.");
			string predicate = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new FormatException("Second any parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new FormatException("Third any parameter must be a string.");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			functionArgs.Result = source.Any((object value) => lambda.Evaluate(value) as bool? == true);
		}
	}
	internal static class CanEvaluate
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			try
			{
				Expression[] parameters = functionArgs.Parameters;
				foreach (Expression val in parameters)
				{
					val.Evaluate();
				}
				functionArgs.Result = true;
			}
			catch
			{
				functionArgs.Result = false;
			}
		}
	}
	internal static class Capitalize
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			string text;
			try
			{
				text = (string)functionArgs.Parameters[0].Evaluate();
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("capitalize function -  requires one string parameter.");
			}
			functionArgs.Result = text.ToLowerInvariant().UpperCaseFirst();
		}
	}
	internal static class Cast
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 2)
			{
				throw new ArgumentException(string.Format("{0} function - Expected {1} arguments", "cast", 2));
			}
			object value = functionArgs.Parameters[0].Evaluate();
			if (!(functionArgs.Parameters[1].Evaluate() is string typeName))
			{
				throw new ArgumentException("cast function - Expected second argument to be a string.");
			}
			Type conversionType = Type.GetType(typeName) ?? throw new ArgumentException("cast function - Expected second argument to be a valid .NET type e.g. System.Decimal.");
			object result = Convert.ChangeType(value, conversionType, CultureInfo.InvariantCulture);
			functionArgs.Result = result;
		}
	}
	internal static class ChangeTimeZone
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 3)
			{
				throw new ArgumentException("changeTimeZone function - Expected 3 arguments");
			}
			DateTime parsedDateTime = (functionArgs.Parameters[0].Evaluate() as DateTime?) ?? throw new ArgumentException("changeTimeZone function - parameter 1 should be a DateTime");
			string sourceTimeZoneName = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new ArgumentException("changeTimeZone function - parameter 2 should be a string");
			string destinationTimeZoneName = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new ArgumentException("changeTimeZone function - parameter 3 should be a string");
			functionArgs.Result = ToDateTime.ConvertTimeZone(parsedDateTime, sourceTimeZoneName, destinationTimeZoneName);
		}
	}
	internal static class Concat
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			List<object> list = new List<object>();
			Expression[] parameters = functionArgs.Parameters;
			foreach (Expression val in parameters)
			{
				object obj = val.Evaluate();
				if (obj is IList list2)
				{
					foreach (object item in list2)
					{
						list.Add(item);
					}
				}
				else
				{
					list.Add(obj);
				}
			}
			functionArgs.Result = list;
		}
	}
	internal static class Contains
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			try
			{
				string text = (string)functionArgs.Parameters[0].Evaluate();
				string value = (string)functionArgs.Parameters[1].Evaluate();
				functionArgs.Result = text.IndexOf(value, StringComparison.InvariantCulture) >= 0;
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("contains() requires two string parameters.");
			}
		}
	}
	internal static class ConvertFunction
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 2)
			{
				throw new FormatException("convert() requires two parameters.");
			}
			object value = functionArgs.Parameters[0].Evaluate();
			functionArgs.Parameters[1].Parameters["value"] = value;
			functionArgs.Result = functionArgs.Parameters[1].Evaluate();
		}
	}
	internal static class Count
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			object obj = functionArgs.Parameters[0].Evaluate();
			IEnumerable<object> enumerable = obj as IEnumerable<object>;
			if (functionArgs.Parameters.Length == 1)
			{
				if (obj is string text)
				{
					functionArgs.Result = text.Length;
					return;
				}
				if (enumerable == null)
				{
					throw new FormatException("count() requires IEnumerable parameter.");
				}
				functionArgs.Result = enumerable.Count();
				return;
			}
			if (enumerable == null)
			{
				throw new FormatException("count() requires IEnumerable parameter.");
			}
			string predicate = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new FormatException("Second count parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new FormatException("Third count parameter must be a string.");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			functionArgs.Result = enumerable.Count((object value) => lambda.Evaluate(value) as bool? == true);
		}
	}
	internal static class DateTimeAsEpochMs
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			functionArgs.Result = DateTimeOffset.ParseExact(functionArgs.Parameters[0].Evaluate() as string, functionArgs.Parameters[1].Evaluate() as string, CultureInfo.InvariantCulture.DateTimeFormat, DateTimeStyles.AssumeUniversal).ToUnixTimeMilliseconds();
		}
	}
	internal static class DateTimeMethods
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 0)
			{
				if (!(functionArgs.Parameters[0].Evaluate() is string text))
				{
					throw new FormatException("dateTime function - The first argument should be a string, e.g. 'UTC'");
				}
				if (text != "UTC")
				{
					throw new FormatException("dateTime function - Only UTC timeZone is currently supported.");
				}
			}
			string text2 = ((functionArgs.Parameters.Length > 1) ? (functionArgs.Parameters[1].Evaluate() as string) : "yyyy-MM-dd HH:mm:ss");
			double days = 0.0;
			if (functionArgs.Parameters.Length > 2)
			{
				double? nullableDouble = GetNullableDouble(functionArgs.Parameters[2]);
				if (!nullableDouble.HasValue)
				{
					throw new FormatException("dateTime function - Days to add must be a number.");
				}
				days = nullableDouble.Value;
			}
			double hours = 0.0;
			if (functionArgs.Parameters.Length > 3)
			{
				double? nullableDouble2 = GetNullableDouble(functionArgs.Parameters[3]);
				if (!nullableDouble2.HasValue)
				{
					throw new FormatException("dateTime function - Hours to add must be a number.");
				}
				hours = nullableDouble2.Value;
			}
			double minutes = 0.0;
			if (functionArgs.Parameters.Length > 4)
			{
				double? nullableDouble3 = GetNullableDouble(functionArgs.Parameters[4]);
				if (!nullableDouble3.HasValue)
				{
					throw new FormatException("dateTime function - Minutes to add must be a number.");
				}
				minutes = nullableDouble3.Value;
			}
			double seconds = 0.0;
			if (functionArgs.Parameters.Length > 5)
			{
				double? nullableDouble4 = GetNullableDouble(functionArgs.Parameters[5]);
				if (!nullableDouble4.HasValue)
				{
					throw new FormatException("dateTime function - Seconds to add must be a number.");
				}
				seconds = nullableDouble4.Value;
			}
			functionArgs.Result = DateTimeOffset.UtcNow.AddDays(days).AddHours(hours).AddMinutes(minutes)
				.AddSeconds(seconds)
				.ToString(text2, CultureInfo.InvariantCulture);
		}

		private static double? GetNullableDouble(Expression expression)
		{
			object obj = expression.Evaluate();
			if (!(obj is double value))
			{
				if (obj is int num)
				{
					return num;
				}
				return null;
			}
			return value;
		}

		internal static string BetterToString(this DateTime dateTime, string format)
		{
			return format switch
			{
				"dayOfYear" => dateTime.DayOfYear.ToString(), 
				"weekOfMonth" => dateTime.WeekOfMonth().ToString(), 
				"weekOfMonthText" => GetWeekText(dateTime.WeekOfMonth()), 
				"weekDayOfMonth" => dateTime.WeekDayOfMonth().ToString(), 
				"weekDayOfMonthText" => GetWeekText(dateTime.WeekDayOfMonth()), 
				_ => dateTime.ToString(format, CultureInfo.InvariantCulture), 
			};
		}

		private static string GetWeekText(int weekOfMonth)
		{
			return weekOfMonth switch
			{
				1 => "first", 
				2 => "second", 
				3 => "third", 
				4 => "fourth", 
				_ => "last", 
			};
		}

		public static int WeekOfMonth(this DateTime dateTime)
		{
			DateTime date = dateTime.Date;
			DateTime dateTime2 = new DateTime(date.Year, date.Month, 1);
			return (date - dateTime2.AddDays(0 - dateTime2.DayOfWeek)).Days / 7 + 1;
		}

		public static int WeekDayOfMonth(this DateTime dateTime)
		{
			return (dateTime.Day - 1) / 7 + 1;
		}

		internal static string ToDateTimeInTargetTimeZone(this DateTime dateTime, string formatFormat, string timeZoneString)
		{
			TimeZoneInfo timeZoneInfo = TZConvert.GetTimeZoneInfo(timeZoneString);
			return new DateTimeOffset(dateTime, -timeZoneInfo.GetUtcOffset(dateTime)).UtcDateTime.BetterToString(formatFormat);
		}
	}
	internal static class Dictionary
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			ExtendedExpression.CheckParameterCount("dictionary", functionArgs, 2, 2147483646);
			if (functionArgs.Parameters.Length % 2 != 0)
			{
				throw new FormatException("dictionary: An even number of parameters must be provided.");
			}
			string key = null;
			Dictionary<string, object> dictionary = new Dictionary<string, object>();
			for (int i = 0; i < functionArgs.Parameters.Length; i++)
			{
				object obj = functionArgs.Parameters[i].Evaluate();
				if (i % 2 == 0)
				{
					if (!(obj is string))
					{
						throw new FormatException(string.Format("{0}: parameter {1} must be a string.", "dictionary", i));
					}
					key = (string)obj;
				}
				else
				{
					dictionary[key] = obj;
				}
			}
			functionArgs.Result = dictionary;
		}
	}
	internal static class Distinct
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			IEnumerable<object> source = (functionArgs.Parameters[0].Evaluate() as IEnumerable<object>) ?? throw new FormatException("First distinct parameter must be an IEnumerable.");
			functionArgs.Result = source.Distinct().ToList();
		}
	}
	internal static class EndsWith
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			try
			{
				string text = (string)functionArgs.Parameters[0].Evaluate();
				string value = (string)functionArgs.Parameters[1].Evaluate();
				functionArgs.Result = text.EndsWith(value, StringComparison.InvariantCulture);
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("endsWith function requires two string parameters.");
			}
		}
	}
	internal static class ExtendObject
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			var (obj2, list2) = Parameters.GetParameters<object, List<object>>(functionArgs, "Evaluate");
			if (list2.Count % 2 != 0)
			{
				throw new FormatException("Extension object list must have an even number of parameters, in the form string propertyName1, object value1, propertyName2, object value2, ...");
			}
			JObject val = JObject.FromObject(obj2);
			for (int i = 0; i < list2.Count; i += 2)
			{
				string text = (list2[i] as string) ?? throw new FormatException("Property name must be a string");
				object obj3 = list2[i + 1];
				val[text] = JToken.FromObject(obj3);
			}
			functionArgs.Result = val;
		}
	}
	internal static class First
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			IList list = (functionArgs.Parameters[0].Evaluate() as IList) ?? throw new FormatException("First first parameter must be an IEnumerable.");
			string predicate = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new FormatException("Second first parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new FormatException("Third first parameter must be a string.");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			foreach (object item in list)
			{
				if (lambda.Evaluate(item) as bool? == true)
				{
					functionArgs.Result = item;
					return;
				}
			}
			throw new FormatException("No matching element found.");
		}
	}
	internal static class FirstOrDefault
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			IList list = (functionArgs.Parameters[0].Evaluate() as IList) ?? throw new FormatException("First firstOrDefault parameter must be an IEnumerable.");
			string predicate = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new FormatException("Second firstOrDefault parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new FormatException("Third firstOrDefault parameter must be a string.");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			foreach (object item in list)
			{
				if (lambda.Evaluate(item) as bool? == true)
				{
					functionArgs.Result = item;
					return;
				}
			}
			functionArgs.Result = null;
		}
	}
	internal static class Format
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length < 2 || functionArgs.Parameters.Length > 3)
			{
				throw new ArgumentException(string.Format("{0} function - expected between {1} and {2} arguments", "format", 2, 3));
			}
			object obj = functionArgs.Parameters[0].Evaluate();
			if (!(functionArgs.Parameters[1].Evaluate() is string text))
			{
				throw new ArgumentException("format function - expected second argument to be a format string");
			}
			int num = functionArgs.Parameters.Length;
			object result;
			if (obj is int num2)
			{
				if (num != 2)
				{
					goto IL_013f;
				}
				result = num2.ToString(text, CultureInfo.InvariantCulture);
			}
			else if (obj is double num3)
			{
				if (num != 2)
				{
					goto IL_013f;
				}
				result = num3.ToString(text, CultureInfo.InvariantCulture);
			}
			else if (obj is DateTime dateTime)
			{
				if (num != 2)
				{
					if (num != 3)
					{
						goto IL_013f;
					}
					DateTime dateTime2 = dateTime;
					result = dateTime2.ToDateTimeInTargetTimeZone(text, (functionArgs.Parameters[2].Evaluate() as string) ?? throw new ArgumentException("format function - expected third argument to be a TimeZone string"));
				}
				else
				{
					result = dateTime.BetterToString(text);
				}
			}
			else
			{
				if (!(obj is string inputString) || num != 2)
				{
					goto IL_013f;
				}
				result = GetThing(inputString, text);
			}
			functionArgs.Result = result;
			return;
			IL_013f:
			throw new NotSupportedException("Unsupported input type " + obj.GetType().Name + " or incorrect number of parameters.");
		}

		private static object GetThing(string inputString, string formatFormat)
		{
			if (long.TryParse(inputString, out var result))
			{
				return result.ToString(formatFormat, CultureInfo.InvariantCulture);
			}
			if (double.TryParse(inputString, out var result2))
			{
				return result2.ToString(formatFormat, CultureInfo.InvariantCulture);
			}
			if (DateTimeOffset.TryParse(inputString, CultureInfo.InvariantCulture.DateTimeFormat, DateTimeStyles.AssumeUniversal, out var result3))
			{
				return result3.UtcDateTime.BetterToString(formatFormat);
			}
			throw new FormatException("Could not parse '" + inputString + "' as a number or date.");
		}
	}
	internal static class GetProperty
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected I4, but got Unknown
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			object obj;
			string text;
			try
			{
				obj = functionArgs.Parameters[0].Evaluate();
				text = (string)functionArgs.Parameters[1].Evaluate();
			}
			catch (Exception innerException)
			{
				throw new FormatException("getProperty() requires two parameters.", innerException);
			}
			JObject val = (JObject)((obj is JObject) ? obj : null);
			if (val != null)
			{
				JToken val2 = val[text];
				object result;
				switch ((val2 != null) ? new JTokenType?(val2.Type) : null)
				{
				case null:
				case 9L:
				case 10L:
					result = null;
					break;
				case 0L:
					result = val2.ToObject<JObject>();
					break;
				case 1L:
					result = val2.ToObject<JArray>();
					break;
				case 2L:
					result = val2.ToObject<JConstructor>();
					break;
				case 3L:
					result = val2.ToObject<JProperty>();
					break;
				case 4L:
					result = val2.ToObject<JValue>();
					break;
				case 5L:
					result = val2.ToObject<int>();
					break;
				case 6L:
					result = val2.ToObject<float>();
					break;
				case 7L:
					result = val2.ToObject<string>();
					break;
				case 8L:
					result = val2.ToObject<bool>();
					break;
				case 11L:
					result = val2.ToObject<DateTime>();
					break;
				case 12L:
				case 13L:
					result = val2.ToObject<JValue>();
					break;
				case 14L:
					result = val2.ToObject<Guid>();
					break;
				default:
				{
					JTokenType type = val2.Type;
					throw new NotSupportedException("Unsupported JTokenType: " + ((object)(JTokenType)(ref type)).ToString());
				}
				}
				functionArgs.Result = result;
			}
			else
			{
				Type type2 = obj.GetType();
				PropertyInfo propertyInfo = type2.GetProperty(text) ?? throw new FormatException("Could not find property " + text + " on type " + type2.Name);
				functionArgs.Result = propertyInfo.GetValue(obj);
			}
		}
	}
	internal static class Humanize
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			double param1Double;
			string value;
			try
			{
				if (!double.TryParse(functionArgs.Parameters[0].Evaluate().ToString(), out var result))
				{
					throw new Exception();
				}
				param1Double = result;
				value = (string)functionArgs.Parameters[1].Evaluate();
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("humanize function - The first number should be a valid floating-point number and the second should be a time unit (" + string.Join(", ", Enum.GetNames(typeof(TimeUnit))) + ").");
			}
			if (!Enum.TryParse<TimeUnit>(value, ignoreCase: true, out var result2))
			{
				throw new FormatException("humanize function - Parameter 2 must be a time unit - one of " + string.Join(", ", from n in Enum.GetNames(typeof(TimeUnit))
					select "'" + n + "'") + ".");
			}
			functionArgs.Result = Humanise(param1Double, result2);
		}

		private static string Humanise(double param1Double, TimeUnit timeUnit)
		{
			try
			{
				return timeUnit switch
				{
					TimeUnit.Milliseconds => System.TimeSpan.FromMilliseconds(param1Double).Humanise(), 
					TimeUnit.Seconds => System.TimeSpan.FromSeconds(param1Double).Humanise(), 
					TimeUnit.Minutes => System.TimeSpan.FromMinutes(param1Double).Humanise(), 
					TimeUnit.Hours => System.TimeSpan.FromHours(param1Double).Humanise(), 
					TimeUnit.Days => System.TimeSpan.FromDays(param1Double).Humanise(), 
					TimeUnit.Weeks => System.TimeSpan.FromDays(param1Double * 7.0).Humanise(), 
					TimeUnit.Years => System.TimeSpan.FromDays(param1Double * 365.25).Humanise(), 
					_ => throw new FormatException($"{timeUnit} is not a supported time unit for humanization."), 
				};
			}
			catch (OverflowException)
			{
				throw new FormatException("The value is too big to use humanize. It must be a double (a 64-bit, floating point number)");
			}
		}
	}
	internal static class If
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 3)
			{
				throw new FormatException("if() requires three parameters.");
			}
			bool flag;
			try
			{
				flag = (bool)functionArgs.Parameters[0].Evaluate();
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException(string.Format("Could not evaluate {0} function parameter 1 '{1}'.", "if", functionArgs.Parameters[0].ParsedExpression));
			}
			if (flag)
			{
				try
				{
					functionArgs.Result = functionArgs.Parameters[1].Evaluate();
					return;
				}
				catch (Exception ex2) when (!(ex2 is NCalcExtensionsException))
				{
					throw new FormatException(string.Format("Could not evaluate {0} function parameter 2 '{1}' due to {2}.", "if", functionArgs.Parameters[1].ParsedExpression, ex2.Message), ex2);
				}
			}
			try
			{
				functionArgs.Result = functionArgs.Parameters[2].Evaluate();
			}
			catch (Exception ex3) when (!(ex3 is NCalcExtensionsException))
			{
				throw new FormatException(string.Format("Could not evaluate {0} function parameter 3 '{1}' due to {2}.", "if", functionArgs.Parameters[2].ParsedExpression, ex3.Message), ex3);
			}
		}
	}
	internal static class In
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length < 2)
			{
				throw new FormatException("in() requires at least two parameters.");
			}
			try
			{
				object item = functionArgs.Parameters[0].Evaluate();
				List<object> list = (from p in functionArgs.Parameters.Skip(1)
					select p.Evaluate()).ToList();
				functionArgs.Result = list.Contains(item);
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("in() parameters malformed.");
			}
		}
	}
	internal static class IndexOf
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			try
			{
				string text = (string)functionArgs.Parameters[0].Evaluate();
				string value = (string)functionArgs.Parameters[1].Evaluate();
				functionArgs.Result = text.IndexOf(value, StringComparison.InvariantCulture);
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("indexOf() requires two string parameters.");
			}
		}
	}
	internal static class IsGuid
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("isGuid() requires one parameter.");
			}
			object obj = functionArgs.Parameters[0].Evaluate();
			functionArgs.Result = obj is Guid || (obj is string && Guid.TryParse(obj.ToString(), out var _));
		}
	}
	internal static class IsInfinite
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("isInfinite() requires one parameter.");
			}
			try
			{
				functionArgs.Result = functionArgs.Parameters[0].Evaluate() is double d && (double.IsPositiveInfinity(d) || double.IsNegativeInfinity(d));
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException(ex.Message);
			}
		}
	}
	internal static class IsNaN
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("isNaN() requires one parameter.");
			}
			try
			{
				object obj = functionArgs.Parameters[0].Evaluate();
				bool flag = ((obj is double d) ? double.IsNaN(d) : ((obj is float f) ? float.IsNaN(f) : ((!(obj is int) && !(obj is long) && !(obj is short) && !(obj is byte) && !(obj is sbyte) && !(obj is uint) && !(obj is ulong) && !(obj is ushort) && !(obj is decimal)) ? true : false)));
				functionArgs.Result = flag;
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException(ex.Message);
			}
		}
	}
	internal static class IsNull
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("isNull() requires one parameter.");
			}
			try
			{
				object obj = functionArgs.Parameters[0].Evaluate();
				int num;
				if (obj != null)
				{
					JToken val = (JToken)((obj is JToken) ? obj : null);
					num = ((val != null && (int)val.Type == 10) ? 1 : 0);
				}
				else
				{
					num = 1;
				}
				functionArgs.Result = (byte)num != 0;
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException(ex.Message);
			}
		}
	}
	internal static class IsNullOrEmpty
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("isNullOrEmpty() requires one parameter.");
			}
			try
			{
				object obj = functionArgs.Parameters[0].Evaluate();
				int num;
				if (obj != null)
				{
					JToken val = (JToken)((obj is JToken) ? obj : null);
					if (val == null || (int)val.Type != 10)
					{
						num = ((obj is string text && text == string.Empty) ? 1 : 0);
						goto IL_0058;
					}
				}
				num = 1;
				goto IL_0058;
				IL_0058:
				functionArgs.Result = (byte)num != 0;
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException(ex.Message);
			}
		}
	}
	internal static class IsNullOrWhiteSpace
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("isNullOrWhiteSpace() requires one parameter.");
			}
			try
			{
				object obj = functionArgs.Parameters[0].Evaluate();
				int num;
				if (obj != null)
				{
					JToken val = (JToken)((obj is JToken) ? obj : null);
					if (val == null || (int)val.Type != 10)
					{
						num = ((obj is string value && string.IsNullOrWhiteSpace(value)) ? 1 : 0);
						goto IL_0053;
					}
				}
				num = 1;
				goto IL_0053;
				IL_0053:
				functionArgs.Result = (byte)num != 0;
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException(ex.Message);
			}
		}
	}
	internal static class IsSet
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			FunctionArgs functionArgs2 = functionArgs;
			if (functionArgs2.Parameters.Length != 1)
			{
				throw new FormatException("isSet() requires one parameter.");
			}
			functionArgs2.Result = functionArgs2.Parameters[0].Parameters.Keys.Any((string p) => p == functionArgs2.Parameters[0].Evaluate() as string);
		}
	}
	internal static class ItemAtIndex
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			IList list;
			int num;
			try
			{
				list = (IList)functionArgs.Parameters[0].Evaluate();
				num = (int)functionArgs.Parameters[1].Evaluate();
				if (num < 0)
				{
					throw new Exception();
				}
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("itemAtIndex() requires two parameters.  The first should be an IList and the second should be a non-negative integer.");
			}
			functionArgs.Result = list[num];
		}
	}
	internal static class Join
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			List<string> values;
			string separator;
			try
			{
				object obj = functionArgs.Parameters[0].Evaluate();
				values = ((obj == null) ? new List<string>() : ((!(obj is List<object> source)) ? (obj as IEnumerable<string>).ToList() : source.Select((object u) => u?.ToString() ?? string.Empty).ToList()));
				separator = (string)functionArgs.Parameters[1].Evaluate();
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("join() requires that the first parameter is a list or enumerable and that the second parameter is a string.");
			}
			functionArgs.Result = string.Join(separator, values);
		}
	}
	internal static class JPath
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			bool flag = false;
			if (functionArgs.Parameters.Length > 3)
			{
				throw new FormatException("jPath function - first parameter should be an object capable of being converted to a JObject and second a string jPath expression with optional third parameter returnNullIfNotFound.");
			}
			JObject val2;
			string text;
			try
			{
				object obj = functionArgs.Parameters[0].Evaluate() ?? throw new NCalcExtensionsException("jPath function - parameter 1 should not be null.");
				JObject val = (JObject)((obj is JObject) ? obj : null);
				val2 = ((val == null) ? JObject.FromObject(obj) : val);
				text = (string)functionArgs.Parameters[1].Evaluate();
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("jPath function - first parameter should be an object capable of being converted to a JObject and second a string jPath expression with optional third parameter returnNullIfNotFound. ... " + ex.Message);
			}
			if (functionArgs.Parameters.Length >= 3)
			{
				try
				{
					flag = (bool)functionArgs.Parameters[2].Evaluate();
				}
				catch (Exception)
				{
					throw new FormatException("jPath function - parameter 3 should be a bool.");
				}
			}
			JToken val3;
			try
			{
				val3 = ((JToken)val2).SelectToken(text);
			}
			catch (Exception ex3)
			{
				throw new NCalcExtensionsException("jPath function - An unknown issue occurred while trying to select jPathExpression value: " + ex3.Message);
			}
			if (val3 == null)
			{
				if (flag)
				{
					functionArgs.Result = null;
					return;
				}
				throw new NCalcExtensionsException("jPath function - jPath expression did not result in a match.");
			}
			JValue val4 = (JValue)(object)((val3 is JValue) ? val3 : null);
			object result;
			if (val4 == null)
			{
				JArray val5 = (JArray)(object)((val3 is JArray) ? val3 : null);
				result = ((val5 == null) ? ((object)JObject.FromObject((object)val3)) : ((object)val5));
			}
			else
			{
				result = val4.Value;
			}
			functionArgs.Result = result;
		}
	}
	internal static class LambdaFunction
	{
		internal static void Evaluate(FunctionArgs functionArgs, Dictionary<string, object?> storageDictionary)
		{
			string predicate;
			string nCalcString;
			try
			{
				predicate = (string)functionArgs.Parameters[0].Evaluate();
				nCalcString = (string)functionArgs.Parameters[1].Evaluate();
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("store() requires two parameters.");
			}
			functionArgs.Result = new Lambda(predicate, nCalcString, storageDictionary);
		}
	}
	internal static class LastIndexOf
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			try
			{
				string text = (string)functionArgs.Parameters[0].Evaluate();
				string value = (string)functionArgs.Parameters[1].Evaluate();
				functionArgs.Result = text.LastIndexOf(value, StringComparison.InvariantCulture);
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("lastIndexOf() requires two string parameters.");
			}
		}
	}
	internal static class Length
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			try
			{
				object obj = functionArgs.Parameters[0].Evaluate();
				if (obj is string text)
				{
					functionArgs.Result = text.Length;
				}
				else
				{
					functionArgs.Result = GetLength(obj);
				}
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("length() requires one string or IList parameter.");
			}
		}

		private static int GetLength(object value)
		{
			if (value is IList list)
			{
				return list.Count;
			}
			throw new FormatException("length() requires one string or IList parameter.");
		}
	}
	internal static class List
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			functionArgs.Result = functionArgs.Parameters.Select((Expression p) => p.Evaluate()).ToList();
		}
	}
	internal static class ListHelpers
	{
		internal static List<object?> Collapse(this List<object?> value)
		{
			while (value.All((object v) => v?.GetType() == typeof(List<object>)))
			{
				if (value.Count == 0)
				{
					return new List<object>();
				}
				value = value.SelectMany((object v) => v as List<object>).ToList();
			}
			return value;
		}
	}
	internal static class ListOf
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			string text = (functionArgs.Parameters[0].Evaluate() as string) ?? throw new FormatException("First listOf parameter must be a string.");
			Expression[] remainingParameters = functionArgs.Parameters.Skip(1).ToArray();
			switch (text)
			{
			case "byte":
				functionArgs.Result = GetListOf<byte>(remainingParameters);
				break;
			case "byte?":
				functionArgs.Result = GetListOf<byte?>(remainingParameters);
				break;
			case "short":
				functionArgs.Result = GetListOf<short>(remainingParameters);
				break;
			case "short?":
				functionArgs.Result = GetListOf<short?>(remainingParameters);
				break;
			case "int":
				functionArgs.Result = GetListOf<int>(remainingParameters);
				break;
			case "int?":
				functionArgs.Result = GetListOf<int?>(remainingParameters);
				break;
			case "long":
				functionArgs.Result = GetListOf<long>(remainingParameters);
				break;
			case "long?":
				functionArgs.Result = GetListOf<long?>(remainingParameters);
				break;
			case "float":
				functionArgs.Result = GetListOf<float>(remainingParameters);
				break;
			case "float?":
				functionArgs.Result = GetListOf<float?>(remainingParameters);
				break;
			case "double":
				functionArgs.Result = GetListOf<double>(remainingParameters);
				break;
			case "double?":
				functionArgs.Result = GetListOf<double?>(remainingParameters);
				break;
			case "decimal":
				functionArgs.Result = GetListOf<decimal>(remainingParameters);
				break;
			case "decimal?":
				functionArgs.Result = GetListOf<decimal?>(remainingParameters);
				break;
			case "string":
				functionArgs.Result = GetListOf<string>(remainingParameters);
				break;
			case "string?":
				functionArgs.Result = GetListOf<string>(remainingParameters);
				break;
			case "object":
				functionArgs.Result = GetListOf<object>(remainingParameters);
				break;
			case "object?":
				functionArgs.Result = GetListOf<object>(remainingParameters);
				break;
			default:
				throw new FormatException("First listOf parameter must be a string of a numeric or string type.");
			}
		}

		private static List<T> GetListOf<T>(Expression[] remainingParameters)
		{
			List<T> list = new List<T>();
			foreach (Expression val in remainingParameters)
			{
				object obj = val.Evaluate();
				if (typeof(T) == typeof(object))
				{
					list.Add((T)obj);
				}
				else if (Nullable.GetUnderlyingType(typeof(T)) != null && obj == null)
				{
					list.Add(default(T));
				}
				else if (Nullable.GetUnderlyingType(typeof(T)) != null && obj != null)
				{
					Type underlyingType = Nullable.GetUnderlyingType(typeof(T));
					if (underlyingType != null)
					{
						object obj2 = Convert.ChangeType(obj, underlyingType);
						list.Add((T)obj2);
					}
				}
				else if (obj is T item)
				{
					list.Add(item);
				}
				else
				{
					if (!(Convert.ChangeType(obj, typeof(T)) is T item2))
					{
						throw new FormatException("Parameter must be of type " + TypeHelper.AsHumanString<T>() + ".");
					}
					list.Add(item2);
				}
			}
			return list;
		}
	}
	internal static class Max
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			object obj = functionArgs.Parameters[0].Evaluate();
			object result;
			if (functionArgs.Parameters.Length == 1)
			{
				object obj2 = obj;
				if (obj2 != null)
				{
					if (!(obj2 is IEnumerable<byte> source))
					{
						if (!(obj2 is IEnumerable<byte?> source2))
						{
							if (!(obj2 is IEnumerable<short> source3))
							{
								if (!(obj2 is IEnumerable<short?> source4))
								{
									if (!(obj2 is IEnumerable<int> source5))
									{
										if (!(obj2 is IEnumerable<int?> source6))
										{
											if (!(obj2 is IEnumerable<long> source7))
											{
												if (!(obj2 is IEnumerable<long?> source8))
												{
													if (!(obj2 is IEnumerable<float> source9))
													{
														if (!(obj2 is IEnumerable<float?> source10))
														{
															if (!(obj2 is IEnumerable<double> source11))
															{
																if (!(obj2 is IEnumerable<double?> source12))
																{
																	if (!(obj2 is IEnumerable<decimal> source13))
																	{
																		if (!(obj2 is IEnumerable<decimal?> source14))
																		{
																			if (!(obj2 is IEnumerable<string> source15))
																			{
																				if (!(obj2 is IEnumerable<object> enumerable))
																				{
																					throw new FormatException("First max parameter must be an IEnumerable of a numeric or string type if only on parameter is present.");
																				}
																				if (enumerable.All((object x) => (x is string || x == null) ? true : false))
																				{
																					result = enumerable.DefaultIfEmpty(null).Max((object x) => x as string);
																				}
																				else
																				{
																					IEnumerable<object> objectList = enumerable;
																					result = GetMax(objectList);
																				}
																			}
																			else
																			{
																				result = source15.DefaultIfEmpty(null).Max();
																			}
																		}
																		else
																		{
																			result = source14.DefaultIfEmpty(null).Max();
																		}
																	}
																	else
																	{
																		result = source13.Max();
																	}
																}
																else
																{
																	result = source12.DefaultIfEmpty(null).Max();
																}
															}
															else
															{
																result = source11.Max();
															}
														}
														else
														{
															result = source10.DefaultIfEmpty(null).Max();
														}
													}
													else
													{
														result = source9.Max();
													}
												}
												else
												{
													result = source8.DefaultIfEmpty(null).Max();
												}
											}
											else
											{
												result = source7.Max();
											}
										}
										else
										{
											result = source6.DefaultIfEmpty(null).Max();
										}
									}
									else
									{
										result = source5.Max();
									}
								}
								else
								{
									result = source4.DefaultIfEmpty(null).Max();
								}
							}
							else
							{
								result = source3.Cast<int>().Max();
							}
						}
						else
						{
							result = source2.DefaultIfEmpty(null).Max();
						}
					}
					else
					{
						result = source.Cast<int>().Max();
					}
				}
				else
				{
					result = null;
				}
				functionArgs.Result = result;
				return;
			}
			string predicate = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new FormatException("Second max parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new FormatException("Third max parameter must be a string.");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			if (!(obj is IEnumerable<byte> source16))
			{
				if (!(obj is IEnumerable<byte?> source17))
				{
					if (!(obj is IEnumerable<short> source18))
					{
						if (!(obj is IEnumerable<short?> source19))
						{
							if (!(obj is IEnumerable<int> source20))
							{
								if (!(obj is IEnumerable<int?> source21))
								{
									if (!(obj is IEnumerable<long> source22))
									{
										if (!(obj is IEnumerable<long?> source23))
										{
											if (!(obj is IEnumerable<float> source24))
											{
												if (!(obj is IEnumerable<float?> source25))
												{
													if (!(obj is IEnumerable<double> source26))
													{
														if (!(obj is IEnumerable<double?> source27))
														{
															if (!(obj is IEnumerable<decimal> source28))
															{
																if (!(obj is IEnumerable<decimal?> source29))
																{
																	if (!(obj is IEnumerable<string> source30))
																	{
																		throw new FormatException("First max parameter must be an IEnumerable of a numeric type.");
																	}
																	result = source30.Max((string value) => (string)lambda.Evaluate(value));
																}
																else
																{
																	result = source29.Max((decimal? value) => (decimal?)lambda.Evaluate(value));
																}
															}
															else
															{
																result = source28.Max((decimal value) => (decimal?)lambda.Evaluate(value));
															}
														}
														else
														{
															result = source27.Max((double? value) => (double?)lambda.Evaluate(value));
														}
													}
													else
													{
														result = source26.Max((double value) => (double?)lambda.Evaluate(value));
													}
												}
												else
												{
													result = source25.Max((float? value) => (float?)lambda.Evaluate(value));
												}
											}
											else
											{
												result = source24.Max((float value) => (float?)lambda.Evaluate(value));
											}
										}
										else
										{
											result = source23.Max((long? value) => (long?)lambda.Evaluate(value));
										}
									}
									else
									{
										result = source22.Max((long value) => (long?)lambda.Evaluate(value));
									}
								}
								else
								{
									result = source21.Max((int? value) => (int?)lambda.Evaluate(value));
								}
							}
							else
							{
								result = source20.Max((int value) => (int?)lambda.Evaluate(value));
							}
						}
						else
						{
							result = source19.Cast<int>().Max((int value) => (int?)lambda.Evaluate(value));
						}
					}
					else
					{
						result = source18.Cast<int>().Max((int value) => (int?)lambda.Evaluate(value));
					}
				}
				else
				{
					result = source17.Cast<int>().Max((int value) => (int?)lambda.Evaluate(value));
				}
			}
			else
			{
				result = source16.Cast<int>().Max((int value) => (int?)lambda.Evaluate(value));
			}
			functionArgs.Result = result;
		}

		private static double GetMax(IEnumerable<object?> objectList)
		{
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Invalid comparison between Unknown and I4
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Invalid comparison between Unknown and I4
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			double num = 0.0;
			foreach (object @object in objectList)
			{
				double num8;
				if (!(@object is byte b))
				{
					if (!(@object is short num2))
					{
						if (!(@object is int num3))
						{
							if (!(@object is long num4))
							{
								if (!(@object is float num5))
								{
									if (!(@object is double num6))
									{
										if (!(@object is decimal num7))
										{
											JValue val = (JValue)((@object is JValue) ? @object : null);
											if (val == null)
											{
												if (@object != null)
												{
													throw new FormatException("Found unsupported type '" + @object?.GetType().Name + "' when completing sum.");
												}
												num8 = 0.0;
											}
											else
											{
												JTokenType type = ((JToken)val).Type;
												float num9;
												if ((int)type != 6)
												{
													if ((int)type != 7)
													{
														throw new FormatException($"Found unsupported JToken type '{((JToken)val).Type}' when completing sum.");
													}
													num9 = Extensions.Value<float>((IEnumerable<JToken>)val);
												}
												else
												{
													num9 = Extensions.Value<int>((IEnumerable<JToken>)val);
												}
												num8 = num9;
											}
										}
										else
										{
											num8 = (double)num7;
										}
									}
									else
									{
										num8 = num6;
									}
								}
								else
								{
									num8 = num5;
								}
							}
							else
							{
								num8 = num4;
							}
						}
						else
						{
							num8 = num3;
						}
					}
					else
					{
						num8 = num2;
					}
				}
				else
				{
					num8 = (int)b;
				}
				double num10 = num8;
				if (num10 < num)
				{
					num = num10;
				}
			}
			return num;
		}
	}
	internal static class MaxValue
	{
		private const string ErrorMessage = "maxValue takes exactly one string parameter, which must be one of 'sbyte', 'byte', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'float', 'double' or 'decimal'.";

		internal static void Evaluate(FunctionArgs functionArgs)
		{
			object obj = functionArgs.Parameters[0].Evaluate();
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("maxValue takes exactly one string parameter, which must be one of 'sbyte', 'byte', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'float', 'double' or 'decimal'.");
			}
			functionArgs.Result = (obj as string) switch
			{
				"sbyte" => sbyte.MaxValue, 
				"byte" => byte.MaxValue, 
				"short" => short.MaxValue, 
				"ushort" => ushort.MaxValue, 
				"int" => int.MaxValue, 
				"uint" => uint.MaxValue, 
				"long" => long.MaxValue, 
				"ulong" => ulong.MaxValue, 
				"float" => float.MaxValue, 
				"double" => double.MaxValue, 
				"decimal" => decimal.MaxValue, 
				_ => throw new FormatException("maxValue takes exactly one string parameter, which must be one of 'sbyte', 'byte', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'float', 'double' or 'decimal'."), 
			};
		}
	}
	internal static class Min
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			object obj = functionArgs.Parameters[0].Evaluate();
			object result;
			if (functionArgs.Parameters.Length == 1)
			{
				object obj2 = obj;
				if (obj2 != null)
				{
					if (!(obj2 is IEnumerable<byte> source))
					{
						if (!(obj2 is IEnumerable<byte?> source2))
						{
							if (!(obj2 is IEnumerable<short> source3))
							{
								if (!(obj2 is IEnumerable<short?> source4))
								{
									if (!(obj2 is IEnumerable<int> source5))
									{
										if (!(obj2 is IEnumerable<int?> source6))
										{
											if (!(obj2 is IEnumerable<long> source7))
											{
												if (!(obj2 is IEnumerable<long?> source8))
												{
													if (!(obj2 is IEnumerable<float> source9))
													{
														if (!(obj2 is IEnumerable<float?> source10))
														{
															if (!(obj2 is IEnumerable<double> source11))
															{
																if (!(obj2 is IEnumerable<double?> source12))
																{
																	if (!(obj2 is IEnumerable<decimal> source13))
																	{
																		if (!(obj2 is IEnumerable<decimal?> source14))
																		{
																			if (!(obj2 is IEnumerable<string> source15))
																			{
																				if (!(obj2 is IEnumerable<object> enumerable))
																				{
																					throw new FormatException("First min parameter must be an IEnumerable of a numeric or string type if only one parameter is present.");
																				}
																				if (enumerable.All((object x) => (x is string || x == null) ? true : false))
																				{
																					result = enumerable.DefaultIfEmpty(null).Min((object x) => x as string);
																				}
																				else
																				{
																					IEnumerable<object> objectList = enumerable;
																					result = GetMin(objectList);
																				}
																			}
																			else
																			{
																				result = source15.DefaultIfEmpty(null).Min();
																			}
																		}
																		else
																		{
																			result = source14.DefaultIfEmpty(null).Min();
																		}
																	}
																	else
																	{
																		result = source13.Min();
																	}
																}
																else
																{
																	result = source12.DefaultIfEmpty(null).Min();
																}
															}
															else
															{
																result = source11.Min();
															}
														}
														else
														{
															result = source10.DefaultIfEmpty(null).Min();
														}
													}
													else
													{
														result = source9.Min();
													}
												}
												else
												{
													result = source8.DefaultIfEmpty(null).Min();
												}
											}
											else
											{
												result = source7.Min();
											}
										}
										else
										{
											result = source6.DefaultIfEmpty(null).Min();
										}
									}
									else
									{
										result = source5.Min();
									}
								}
								else
								{
									result = source4.DefaultIfEmpty(null).Min();
								}
							}
							else
							{
								result = source3.Cast<int>().Min();
							}
						}
						else
						{
							result = source2.DefaultIfEmpty(null).Min();
						}
					}
					else
					{
						result = source.Cast<int>().Min();
					}
				}
				else
				{
					result = null;
				}
				functionArgs.Result = result;
				return;
			}
			string predicate = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new FormatException("Second min parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new FormatException("Third min parameter must be a string.");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			if (!(obj is IEnumerable<byte> source16))
			{
				if (!(obj is IEnumerable<byte?> source17))
				{
					if (!(obj is IEnumerable<short> source18))
					{
						if (!(obj is IEnumerable<short?> source19))
						{
							if (!(obj is IEnumerable<int> source20))
							{
								if (!(obj is IEnumerable<int?> source21))
								{
									if (!(obj is IEnumerable<long> source22))
									{
										if (!(obj is IEnumerable<long?> source23))
										{
											if (!(obj is IEnumerable<float> source24))
											{
												if (!(obj is IEnumerable<float?> source25))
												{
													if (!(obj is IEnumerable<double> source26))
													{
														if (!(obj is IEnumerable<double?> source27))
														{
															if (!(obj is IEnumerable<decimal> source28))
															{
																if (!(obj is IEnumerable<decimal?> source29))
																{
																	if (!(obj is IEnumerable<string> source30))
																	{
																		throw new FormatException("First min parameter must be an IEnumerable of a numeric type.");
																	}
																	result = source30.Min((string value) => (string)lambda.Evaluate(value));
																}
																else
																{
																	result = source29.Min((decimal? value) => (decimal?)lambda.Evaluate(value));
																}
															}
															else
															{
																result = source28.Min((decimal value) => (decimal?)lambda.Evaluate(value));
															}
														}
														else
														{
															result = source27.Min((double? value) => (double?)lambda.Evaluate(value));
														}
													}
													else
													{
														result = source26.Min((double value) => (double?)lambda.Evaluate(value));
													}
												}
												else
												{
													result = source25.Min((float? value) => (float?)lambda.Evaluate(value));
												}
											}
											else
											{
												result = source24.Min((float value) => (float?)lambda.Evaluate(value));
											}
										}
										else
										{
											result = source23.Min((long? value) => (long?)lambda.Evaluate(value));
										}
									}
									else
									{
										result = source22.Min((long value) => (long?)lambda.Evaluate(value));
									}
								}
								else
								{
									result = source21.Min((int? value) => (int?)lambda.Evaluate(value));
								}
							}
							else
							{
								result = source20.Min((int value) => (int?)lambda.Evaluate(value));
							}
						}
						else
						{
							result = source19.Cast<int>().Min((int value) => (int?)lambda.Evaluate(value));
						}
					}
					else
					{
						result = source18.Cast<int>().Min((int value) => (int?)lambda.Evaluate(value));
					}
				}
				else
				{
					result = source17.Cast<int>().Min((int value) => (int?)lambda.Evaluate(value));
				}
			}
			else
			{
				result = source16.Cast<int>().Min((int value) => (int?)lambda.Evaluate(value));
			}
			functionArgs.Result = result;
		}

		private static double GetMin(IEnumerable<object?> objectList)
		{
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Invalid comparison between Unknown and I4
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Invalid comparison between Unknown and I4
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			double num = 0.0;
			foreach (object @object in objectList)
			{
				double num8;
				if (!(@object is byte b))
				{
					if (!(@object is short num2))
					{
						if (!(@object is int num3))
						{
							if (!(@object is long num4))
							{
								if (!(@object is float num5))
								{
									if (!(@object is double num6))
									{
										if (!(@object is decimal num7))
										{
											JValue val = (JValue)((@object is JValue) ? @object : null);
											if (val == null)
											{
												if (@object != null)
												{
													throw new FormatException("Found unsupported type '" + @object?.GetType().Name + "' when completing sum.");
												}
												num8 = 0.0;
											}
											else
											{
												JTokenType type = ((JToken)val).Type;
												float num9;
												if ((int)type != 6)
												{
													if ((int)type != 7)
													{
														throw new FormatException($"Found unsupported JToken type '{((JToken)val).Type}' when completing sum.");
													}
													num9 = Extensions.Value<float>((IEnumerable<JToken>)val);
												}
												else
												{
													num9 = Extensions.Value<int>((IEnumerable<JToken>)val);
												}
												num8 = num9;
											}
										}
										else
										{
											num8 = (double)num7;
										}
									}
									else
									{
										num8 = num6;
									}
								}
								else
								{
									num8 = num5;
								}
							}
							else
							{
								num8 = num4;
							}
						}
						else
						{
							num8 = num3;
						}
					}
					else
					{
						num8 = num2;
					}
				}
				else
				{
					num8 = (int)b;
				}
				double num10 = num8;
				if (num10 < num)
				{
					num = num10;
				}
			}
			return num;
		}
	}
	internal static class MinValue
	{
		private const string ErrorMessage = "minValue takes exactly one string parameter, which must be one of 'sbyte', 'byte', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'float', 'double' or 'decimal'.";

		internal static void Evaluate(FunctionArgs functionArgs)
		{
			object obj = functionArgs.Parameters[0].Evaluate();
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("minValue takes exactly one string parameter, which must be one of 'sbyte', 'byte', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'float', 'double' or 'decimal'.");
			}
			functionArgs.Result = (obj as string) switch
			{
				"sbyte" => sbyte.MinValue, 
				"byte" => (byte)0, 
				"short" => short.MinValue, 
				"ushort" => (ushort)0, 
				"int" => int.MinValue, 
				"uint" => 0u, 
				"long" => long.MinValue, 
				"ulong" => 0uL, 
				"float" => float.MinValue, 
				"double" => double.MinValue, 
				"decimal" => decimal.MinValue, 
				_ => throw new FormatException("minValue takes exactly one string parameter, which must be one of 'sbyte', 'byte', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'float', 'double' or 'decimal'."), 
			};
		}
	}
	internal static class NewJObject
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			if (functionArgs.Parameters.Length % 2 != 0)
			{
				throw new FormatException("jObject() requires an even number of parameters.");
			}
			int num = 0;
			JObject val = new JObject();
			while (num < functionArgs.Parameters.Length)
			{
				if (!(functionArgs.Parameters[num++].Evaluate() is string text))
				{
					throw new FormatException("jObject() requires a string key.");
				}
				if (val.ContainsKey(text))
				{
					throw new FormatException("jObject() can only define property " + text + " once.");
				}
				object obj = functionArgs.Parameters[num++].Evaluate();
				val.Add(text, (JToken)((obj == null) ? ((object)JValue.CreateNull()) : ((object)JToken.FromObject(obj))));
			}
			functionArgs.Result = val;
		}
	}
	internal static class SetProperties
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length % 2 != 1)
			{
				throw new FormatException("setProperties() requires an odd number of parameters.");
			}
			int num = 0;
			object obj = functionArgs.Parameters[num++].Evaluate();
			JObject val = (JObject)((obj is JObject) ? obj : null);
			JObject val2 = ((val == null) ? JObject.FromObject(obj) : val);
			while (num < functionArgs.Parameters.Length)
			{
				if (!(functionArgs.Parameters[num++].Evaluate() is string text))
				{
					throw new FormatException("setProperties() requires a string key.");
				}
				if (val2.ContainsKey(text))
				{
					throw new FormatException("setProperties() can only define property " + text + " once.");
				}
				object obj2 = functionArgs.Parameters[num++].Evaluate();
				val2.Add(text, (JToken)((obj2 == null) ? ((object)JValue.CreateNull()) : ((object)JToken.FromObject(obj2))));
			}
			functionArgs.Result = val2;
		}
	}
	internal static class NullCoalesce
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			Expression[] parameters = functionArgs.Parameters;
			foreach (Expression val in parameters)
			{
				object obj = val.Evaluate();
				if (obj != null)
				{
					functionArgs.Result = obj;
					return;
				}
			}
			functionArgs.Result = null;
		}
	}
	internal static class OrderBy
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			int num = 0;
			IEnumerable<object> source = (functionArgs.Parameters[num++].Evaluate() as IEnumerable<object>) ?? throw new FormatException("First orderBy parameter must be an IEnumerable.");
			string predicate = (functionArgs.Parameters[num++].Evaluate() as string) ?? throw new FormatException("Second orderBy parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[num++].Evaluate() as string) ?? throw new FormatException("Third orderBy parameter must be a string.");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			IOrderedEnumerable<object> source2 = source.OrderBy((object value) => lambda.Evaluate(value));
			int num2 = functionArgs.Parameters.Length;
			while (num < num2)
			{
				nCalcString = (functionArgs.Parameters[num++].Evaluate() as string) ?? throw new FormatException(string.Format("{0} parameter {1} must be a string.", "orderBy", num + 1));
				lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
				source2 = source2.ThenBy((object value) => lambda.Evaluate(value));
			}
			functionArgs.Result = source2.ToList();
		}
	}
	internal static class PadLeft
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			string text;
			int num;
			char paddingChar;
			try
			{
				text = (string)functionArgs.Parameters[0].Evaluate();
				num = (int)functionArgs.Parameters[1].Evaluate();
				if (num < 1)
				{
					throw new NCalcExtensionsException("padLeft() requires a DesiredStringLength for parameter 2 that is >= 1.");
				}
				string text2 = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new NCalcExtensionsException("padLeft() requires that parameter 3 be a string.");
				if (text2.Length != 1)
				{
					throw new NCalcExtensionsException("padLeft() requires a single character string for parameter 3.");
				}
				paddingChar = text2[0];
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("padLeft() requires a string Input, an integer DesiredStringLength, and a single Padding character.");
			}
			functionArgs.Result = text.PadLeft(num, paddingChar);
		}
	}
	internal static class Parameters
	{
		internal static T1 GetParameter<T1>(FunctionArgs args, [CallerMemberName] string callerName = "")
		{
			CheckParameterCount(1, 1, args.Parameters, callerName);
			T1 val = (T1)args.Parameters[0].Evaluate();
			if (val == null)
			{
				throw new FormatException(callerName + " argument should be a " + typeof(T1).Name + ".");
			}
			return val;
		}

		internal static Tuple<T1, T2> GetParameters<T1, T2>(FunctionArgs args, [CallerMemberName] string callerName = "")
		{
			CheckParameterCount(2, 2, args.Parameters, callerName);
			int num = 0;
			T1 val = (T1)args.Parameters[num++].Evaluate();
			if (val == null)
			{
				throw new FormatException(callerName + " first argument should be a " + typeof(T1).Name + ".");
			}
			T2 val2 = (T2)args.Parameters[num++].Evaluate();
			if (val2 == null)
			{
				throw new FormatException(callerName + " second argument should be a " + typeof(T2).Name + ".");
			}
			return new Tuple<T1, T2>(val, val2);
		}

		internal static Tuple<T1, T2, T3> GetParameters<T1, T2, T3>(FunctionArgs args, [CallerMemberName] string callerName = "")
		{
			CheckParameterCount(3, 3, args.Parameters, callerName);
			int num = 0;
			T1 val = (T1)args.Parameters[num++].Evaluate();
			if (val == null)
			{
				throw new FormatException(callerName + " first argument should be a " + typeof(T1).Name + ".");
			}
			T2 val2 = (T2)args.Parameters[num++].Evaluate();
			if (val2 == null)
			{
				throw new FormatException(callerName + " second argument should be a " + typeof(T2).Name + ".");
			}
			T3 val3 = (T3)args.Parameters[num++].Evaluate();
			if (val3 == null)
			{
				throw new FormatException(callerName + " third argument should be a " + typeof(T3).Name + ".");
			}
			return new Tuple<T1, T2, T3>(val, val2, val3);
		}

		internal static Tuple<T1, T2, T3, T4> GetParameters<T1, T2, T3, T4>(FunctionArgs args, [CallerMemberName] string callerName = "")
		{
			CheckParameterCount(4, 4, args.Parameters, callerName);
			int num = 0;
			T1 val = (T1)args.Parameters[num++].Evaluate();
			if (val == null)
			{
				throw new FormatException(callerName + " first argument should be a " + typeof(T1).Name + ".");
			}
			T2 val2 = (T2)args.Parameters[num++].Evaluate();
			if (val2 == null)
			{
				throw new FormatException(callerName + " second argument should be a " + typeof(T2).Name + ".");
			}
			T3 val3 = (T3)args.Parameters[num++].Evaluate();
			if (val3 == null)
			{
				throw new FormatException(callerName + " third argument should be a " + typeof(T3).Name + ".");
			}
			T4 val4 = (T4)args.Parameters[num++].Evaluate();
			if (val4 == null)
			{
				throw new FormatException(callerName + " fourth argument should be a " + typeof(T4).Name + ".");
			}
			return new Tuple<T1, T2, T3, T4>(val, val2, val3, val4);
		}

		internal static Tuple<T1, T2, T3, T4, T5> GetParameters<T1, T2, T3, T4, T5>(FunctionArgs args, [CallerMemberName] string callerName = "")
		{
			CheckParameterCount(5, 5, args.Parameters, callerName);
			int num = 0;
			T1 val = (T1)args.Parameters[num++].Evaluate();
			if (val == null)
			{
				throw new FormatException(callerName + " first argument should be a " + typeof(T1).Name + ".");
			}
			T2 val2 = (T2)args.Parameters[num++].Evaluate();
			if (val2 == null)
			{
				throw new FormatException(callerName + " second argument should be a " + typeof(T2).Name + ".");
			}
			T3 val3 = (T3)args.Parameters[num++].Evaluate();
			if (val3 == null)
			{
				throw new FormatException(callerName + " third argument should be a " + typeof(T3).Name + ".");
			}
			T4 val4 = (T4)args.Parameters[num++].Evaluate();
			if (val4 == null)
			{
				throw new FormatException(callerName + " fourth argument should be a " + typeof(T4).Name + ".");
			}
			T5 val5 = (T5)args.Parameters[num++].Evaluate();
			if (val5 == null)
			{
				throw new FormatException(callerName + " fifth argument should be a " + typeof(T5).Name + ".");
			}
			return new Tuple<T1, T2, T3, T4, T5>(val, val2, val3, val4, val5);
		}

		internal static Tuple<T1, T2, T3, T4, T5, T6> GetParameters<T1, T2, T3, T4, T5, T6>(FunctionArgs args, [CallerMemberName] string callerName = "")
		{
			CheckParameterCount(6, 6, args.Parameters, callerName);
			int num = 0;
			T1 val = (T1)args.Parameters[num++].Evaluate();
			if (val == null)
			{
				throw new FormatException(callerName + " first argument should be a " + typeof(T1).Name + ".");
			}
			T2 val2 = (T2)args.Parameters[num++].Evaluate();
			if (val2 == null)
			{
				throw new FormatException(callerName + " second argument should be a " + typeof(T2).Name + ".");
			}
			T3 val3 = (T3)args.Parameters[num++].Evaluate();
			if (val3 == null)
			{
				throw new FormatException(callerName + " third argument should be a " + typeof(T3).Name + ".");
			}
			T4 val4 = (T4)args.Parameters[num++].Evaluate();
			if (val4 == null)
			{
				throw new FormatException(callerName + " fourth argument should be a " + typeof(T4).Name + ".");
			}
			T5 val5 = (T5)args.Parameters[num++].Evaluate();
			if (val5 == null)
			{
				throw new FormatException(callerName + " fifth argument should be a " + typeof(T5).Name + ".");
			}
			T6 val6 = (T6)args.Parameters[num++].Evaluate();
			if (val6 == null)
			{
				throw new FormatException(callerName + " sixth argument should be a " + typeof(T6).Name + ".");
			}
			return new Tuple<T1, T2, T3, T4, T5, T6>(val, val2, val3, val4, val5, val6);
		}

		internal static Tuple<T1, T2, T3, T4, T5, T6, T7> GetParameters<T1, T2, T3, T4, T5, T6, T7>(FunctionArgs args, [CallerMemberName] string callerName = "")
		{
			CheckParameterCount(7, 7, args.Parameters, callerName);
			int num = 0;
			T1 val = (T1)args.Parameters[num++].Evaluate();
			if (val == null)
			{
				throw new FormatException(callerName + " first argument should be a " + typeof(T1).Name + ".");
			}
			T2 val2 = (T2)args.Parameters[num++].Evaluate();
			if (val2 == null)
			{
				throw new FormatException(callerName + " second argument should be a " + typeof(T2).Name + ".");
			}
			T3 val3 = (T3)args.Parameters[num++].Evaluate();
			if (val3 == null)
			{
				throw new FormatException(callerName + " third argument should be a " + typeof(T3).Name + ".");
			}
			T4 val4 = (T4)args.Parameters[num++].Evaluate();
			if (val4 == null)
			{
				throw new FormatException(callerName + " fourth argument should be a " + typeof(T4).Name + ".");
			}
			T5 val5 = (T5)args.Parameters[num++].Evaluate();
			if (val5 == null)
			{
				throw new FormatException(callerName + " fifth argument should be a " + typeof(T5).Name + ".");
			}
			T6 val6 = (T6)args.Parameters[num++].Evaluate();
			if (val6 == null)
			{
				throw new FormatException(callerName + " sixth argument should be a " + typeof(T6).Name + ".");
			}
			T7 val7 = (T7)args.Parameters[num++].Evaluate();
			if (val7 == null)
			{
				throw new FormatException(callerName + " seventh argument should be a " + typeof(T7).Name + ".");
			}
			return new Tuple<T1, T2, T3, T4, T5, T6, T7>(val, val2, val3, val4, val5, val6, val7);
		}

		internal static void CheckParameterCount(int? minCount, int? maxCount, Expression[] parameters, [CallerMemberName] string callerName = "")
		{
			if (minCount.HasValue && parameters.Length < minCount.Value)
			{
				throw new FormatException($"{callerName} requires at least {minCount} parameters.");
			}
			if (maxCount.HasValue && parameters.Length > maxCount.Value)
			{
				throw new FormatException($"{callerName} requires at most {maxCount} parameters.");
			}
		}
	}
	internal static class Parse
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length < 2)
			{
				throw new FormatException("parse function - requires at least two string parameters.");
			}
			int num = 0;
			string text = (functionArgs.Parameters[num++].Evaluate() as string) ?? throw new FormatException("parse function - first parameter should be a string.");
			string text2 = (functionArgs.Parameters[num++].Evaluate() as string) ?? throw new FormatException("parse function - second parameter should be a string.");
			try
			{
				object result;
				switch (text)
				{
				case "bool":
				{
					if (!bool.TryParse(text2, out var result12))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result12;
					break;
				}
				case "sbyte":
				{
					if (!sbyte.TryParse(text2, out var result7))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result7;
					break;
				}
				case "byte":
				{
					if (!byte.TryParse(text2, out var result13))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result13;
					break;
				}
				case "short":
				{
					if (!short.TryParse(text2, out var result4))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result4;
					break;
				}
				case "ushort":
				{
					if (!ushort.TryParse(text2, out var result9))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result9;
					break;
				}
				case "int":
				{
					if (!int.TryParse(text2, out var result3))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result3;
					break;
				}
				case "uint":
				{
					if (!uint.TryParse(text2, out var result10))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result10;
					break;
				}
				case "long":
				{
					if (!long.TryParse(text2, out var result6))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result6;
					break;
				}
				case "ulong":
				{
					if (!ulong.TryParse(text2, out var result14))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result14;
					break;
				}
				case "double":
				{
					if (!double.TryParse(text2, out var result11))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result11;
					break;
				}
				case "float":
				{
					if (!float.TryParse(text2, out var result8))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result8;
					break;
				}
				case "decimal":
				{
					if (!decimal.TryParse(text2, out var result5))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result5;
					break;
				}
				case "Guid":
				{
					if (!Guid.TryParse(text2, out var result2))
					{
						throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.");
					}
					result = result2;
					break;
				}
				case "JObject":
				case "jObject":
					result = ParseJObject(text2);
					break;
				case "jArray":
				case "JArray":
					result = ParseJArray(text2);
					break;
				default:
					throw new FormatException("type '" + text + "' not supported.");
				}
				functionArgs.Result = result;
			}
			catch (FormatException innerException)
			{
				if (functionArgs.Parameters.Length >= 3)
				{
					functionArgs.Result = functionArgs.Parameters[num].Evaluate();
					return;
				}
				throw new FormatException("parse function - parameter '" + text2 + "' could not be parsed to type '" + text + "'.", innerException);
			}
		}

		private static JObject ParseJObject(string text)
		{
			try
			{
				return JObject.Parse(text);
			}
			catch (JsonReaderException)
			{
				throw new FormatException("parse function - parameter '" + text + "' could not be parsed to type 'JObject'.");
			}
		}

		private static JArray ParseJArray(string text)
		{
			try
			{
				return JArray.Parse(text);
			}
			catch (JsonReaderException)
			{
				throw new FormatException("parse function - parameter '" + text + "' could not be parsed to type 'JArray'.");
			}
		}
	}
	internal static class ParseInt
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			if (functionArgs.Parameters.Length != 1)
			{
				throw new FormatException("parseInt function - requires one string parameter.");
			}
			string s = (functionArgs.Parameters[0].Evaluate() as string) ?? throw new FormatException("parseInt function - requires one string parameter.");
			if (!int.TryParse(s, out var result))
			{
				throw new FormatException("parseInt function - parameter could not be parsed to an integer.");
			}
			functionArgs.Result = result;
		}
	}
	internal static class RegexGroup
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			try
			{
				string input = (string)functionArgs.Parameters[0].Evaluate();
				string pattern = (string)functionArgs.Parameters[1].Evaluate();
				int num = ((functionArgs.Parameters.Length == 3) ? ((int)functionArgs.Parameters[2].Evaluate()) : 0);
				Regex regex = new Regex(pattern);
				if (!regex.IsMatch(input))
				{
					functionArgs.Result = null;
					return;
				}
				Group group = regex.Match(input).Groups[1];
				functionArgs.Result = ((num >= group.Captures.Count) ? null : group.Captures[num].Value);
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("replace() requires three string parameters.");
			}
		}
	}
	internal static class RegexIsMatch
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			object obj = functionArgs.Parameters[0].Evaluate();
			object obj2 = functionArgs.Parameters[1].Evaluate();
			if (!(obj is string input))
			{
				throw new FormatException("regexIsMatch function - first parameter should be a string.");
			}
			if (!(obj2 is string pattern))
			{
				throw new FormatException("regexIsMatch function - second parameter should be a string.");
			}
			Regex regex = new Regex(pattern);
			functionArgs.Result = regex.IsMatch(input);
		}
	}
	internal static class Replace
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			try
			{
				string text = (string)functionArgs.Parameters[0].Evaluate();
				string oldValue = (string)functionArgs.Parameters[1].Evaluate();
				string newValue = (string)functionArgs.Parameters[2].Evaluate();
				functionArgs.Result = text.Replace(oldValue, newValue);
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("replace() requires three string parameters.");
			}
		}
	}
	internal static class Retrieve
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			string key;
			try
			{
				key = (string)functionArgs.Parameters[0].Evaluate();
			}
			catch (Exception ex) when (!(ex is NCalcExtensionsException))
			{
				throw new FormatException("retrieve() requires one string parameter.");
			}
			Dictionary<string, object> dictionary = (functionArgs.Parameters[0].Parameters["__storageDictionary"] as Dictionary<string, object>) ?? throw new FormatException("retrieve() requires a storage dictionary.");
			if (!dictionary.TryGetValue(key, out var value))
			{
				throw new FormatException("Key not found");
			}
			functionArgs.Result = value;
		}
	}
	internal static class Select
	{
		internal static void Evaluate(FunctionArgs functionArgs)
		{
			IList list = (functionArgs.Parameters[0].Evaluate() as IList) ?? throw new FormatException("First select parameter must be an IList.");
			string predicate = (functionArgs.Parameters[1].Evaluate() as string) ?? throw new FormatException("Second select parameter must be a string.");
			string nCalcString = (functionArgs.Parameters[2].Evaluate() as string) ?? throw new FormatException("Third select parameter must be a string.");
			string text = ((functionArgs.Parameters.Length == 4) ? ((functionArgs.Parameters[3].Evaluate() as string) ?? throw new FormatException("Fourth select parameter must be a string.")) : "object");
			Lambda lambda = new Lambda(predicate, nCalcString, functionArgs.Parameters[0].Parameters);
			if (!(text == "object"))
			{
				if (text == "JObject")
				{
					List<JObject> list2 = new List<JObject>();
					foreach (object item2 in list)
					{
						object obj = lambda.Evaluate(item2);
						JObject val2;
						if (obj != null)
						{
							JObject val = (JObject)((obj is JObject) ? obj : null);
							val2 = ((val == null) ? JObject.FromObject(item2) : val);
						}
						else
						{
							val2 = null;
						}
						JObject item = val2;
						list2.Add(item);
					}
					functionArgs.Result = list2;
					return;
				}
				throw new FormatException("Fourth select parameter must be either 'object' (default) or 'JObject'.");
			}
			List<object> list3 = new List<object>();
			foreach (object i

plugins\Dependencies\ConfigilsV1\ConfigilsV1.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp.APIPatcher.mm")]
[assembly: IgnoresAccessChecksTo("InscryptionAPI")]
[assembly: IgnoresAccessChecksTo("InscryptionCommunityPatch")]
[assembly: IgnoresAccessChecksTo("NCalc")]
[assembly: IgnoresAccessChecksTo("PanoramicData.NCalcExtensions")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("Chaosyr, MADH95, JamesVeug, LilySylvee, kbmackenzie, divisionbyz0rro, IngoHHacks, Khaomi, vladdeSV, TVFLabs, UwUMacaroniTime, Windows10CE")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("This is the ConfigilsV1 Sector of JSONLoader Nightly. It's purposefully its own DLL.")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyInformationalVersion("3.0.0-Nightly-0.1.4+efff0b8cbc359d10a2c2345eaf086c8a25af7238")]
[assembly: AssemblyProduct("ConfigilsV1")]
[assembly: AssemblyTitle("ConfigilsV1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

plugins\Dependencies\OldJSONLoader Shell\JSONLoader.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("MADH95, JamesVeug, LilySylvee, kbmackenzie, Chaosyr, divisionbyz0rro, IngoHHacks, Khaomi, vladdeSV, TVFLabs, UwUMacaroniTime, Windows10CE")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("This is the DLL File that handles JSON Loading for Inscryption Mods, originally created by MadH95 with the help of several AMAZING Contributors!!")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyInformationalVersion("3.0.0+f0f87a950b4eba69d2ecd4e0e2628a60aba7025f")]
[assembly: AssemblyProduct("JSONLoader")]
[assembly: AssemblyTitle("JSONLoader")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace JLPlugin
{
	[BepInPlugin("MADH.inscryption.JSONLoader", "JSONLoader", "3.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "MADH.inscryption.JSONLoader";

		public const string PluginName = "JSONLoader";

		public const string PluginVersion = "3.0.0";

		public void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Hey we are writing this to inform you that the OLD JSONLoader will not load while you have Nightly Installed.");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "JSONLoader";

		public const string PLUGIN_NAME = "JSONLoader";

		public const string PLUGIN_VERSION = "3.0.0";
	}
}

JSON Loader v3.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Cecil_Libraries.ANSI_Utils.Objects;
using DiskCardGame;
using InscryptionAPI.Ascension;
using InscryptionAPI.Card;
using InscryptionAPI.Guid;
using InscryptionAPI.Helpers;
using JSONLoader3.Cores.JSONLoaderV1Support.Objects;
using JSONLoader3.Cores.JSONLoaderV1Support.Schemas;
using JSONLoader3.Cores.JSONLoaderV1Support.Utilities;
using JSONLoader3.Cores.JSONLoaderV2Support.Objects;
using JSONLoader3.Cores.JSONLoaderV2Support.Schemas;
using JSONLoader3.Cores.JSONLoaderV2Support.Utilities;
using JSONLoader3.Peripheral.FILE_Loader;
using JSONLoader3.Peripheral.ImageHandling;
using JSONLoader3.Peripheral.JSON_LINT;
using JSONLoader3.Peripheral.JSON_SCHEMA;
using JSONLoader3.Peripheral.Tooltip_Parser;
using JSONLoader3.Peripheral.XML_Parser;
using JSONLoader3.Subperipheral.JSONLoaderConfiguration;
using JSONLoader3.Subperipheral.JSONLoaderStartupPhase;
using Microsoft.CodeAnalysis;
using Sirenix.Utilities;
using UnityEngine;
using UnityEngine.LowLevel;
using UnityEngine.PlayerLoop;
using UnityEngine.UIElements;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp.APIPatcher.mm")]
[assembly: IgnoresAccessChecksTo("ConfigilsV1")]
[assembly: IgnoresAccessChecksTo("InscryptionAPI")]
[assembly: IgnoresAccessChecksTo("InscryptionCommunityPatch")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("Chaosyr, MADH95, JamesVeug, LilySylvee, kbmackenzie, divisionbyz0rro, IngoHHacks, Khaomi, vladdeSV, TVFLabs, UwUMacaroniTime, Windows10CE")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("This is the new Modulated and API Based system in which JSONLoader will run off of (and maybe a CSV loader too)")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyInformationalVersion("3.0.0-Nightly-0.1.5+e640fca83f84a707d53da5ca5db61c78dd917914")]
[assembly: AssemblyProduct("JSON Loader v3")]
[assembly: AssemblyTitle("JSON Loader v3")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class IsUnmanagedAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace JSONLoader3
{
	[BepInPlugin("Chaosyr.MADH95.Inscryption.JSON.CSVLoader", "JSON_and_CSV_Loader", "3.0.0.00001005")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class JSONLoader3 : BaseUnityPlugin
	{
		public const string PluginGuid = "Chaosyr.MADH95.Inscryption.JSON.CSVLoader";

		public const string PluginName = "JSON_and_CSV_Loader";

		public const string PluginVersion = "3.0.0.00001005";

		private static Color Error = new Color("Doubleline", "Red", false, true, false);

		private static Color Warning = new Color("Underlined", "Yellow", false, true, false);

		private static Color256 Information = new Color256("Bold", 230, false, false);

		private static Color256 Verbose = new Color256("Highlight", 248, false, false);

		private static Color256 Debug = new Color256("Dulled", 248, false, false);

		private static Color256 ExtendedInformation = new Color256("Italic", 228, false, false);

		private static Color256 SummaryInformation = new Color256("Framed", 219, false, false);

		private static ManualLogSource BepInExLogger;

		public void Awake()
		{
			BepInExLogger = ((BaseUnityPlugin)this).Logger;
			AddJSONLoaderStartupPhase.OnStartupPhaseExecuted = JSONLoaderStartupPhase;
			AddJSONLoaderStartupPhase.Install();
			FormatLogger("info", "Initialization for JSONLoader3 and CSVLoader", "JSONLoader3 startup phase armed.");
			DefineConfiguration.DefineConfigs(((BaseUnityPlugin)this).Config);
			FormatLogger("info", "Initialization for JSONLoader3 and CSVLoader", "Finished Creating JSONLoader3 and CSVLoader Configuration");
			FormatLogger("info", "Initialization for JSONLoader3 and CSVLoader", "If you find the errors unhelpful, toggle on AdditionalInformation in: " + ((BaseUnityPlugin)this).Config.ConfigFilePath);
		}

		public void JSONLoaderStartupPhase()
		{
			FindFiles.FindFilesToLoad();
			LoadFiles.LoadFoundFiles();
			foreach (CardInfo item in global::JSONLoader3.Cores.JSONLoaderV1Support.Utilities.CardUtils.allJLDRCardsPublic)
			{
				FormatLogger("info", "Initialization for JSONLoader3 and CSVLoader", "Successfully Loaded JSONLoaderV1 " + typeof(global::JSONLoader3.Cores.JSONLoaderV1Support.Schemas.Card).Name + ": " + ((Object)item).name);
			}
			foreach (CardInfo item2 in global::JSONLoader3.Cores.JSONLoaderV2Support.Utilities.CardUtils.allJLDR2CardsPublic)
			{
				FormatLogger("info", "Initialization for JSONLoader3 and CSVLoader", "Successfully Loaded JSONLoaderV2 " + typeof(global::JSONLoader3.Cores.JSONLoaderV2Support.Schemas.Card).Name + ": " + ((Object)item2).name);
			}
			FormatLogger("info", "Initialization for JSONLoader3 and CSVLoader", "Finished Loading JSONLoader, JSONLoader2, JSONLoader3 and CSVLoader.");
		}

		public static void FormatLogger(string level, string source, string message)
		{
			if (level.ToLower() == "error")
			{
				Console.WriteLine(((ColorBase)Error).Format() + "[(" + source + ") Error]: " + message + "\u001b[0m");
				LogToBepInExFile((LogLevel)2, source, message);
			}
			else if (level.ToLower() == "warning")
			{
				Console.WriteLine(((ColorBase)Warning).Format() + "[(" + source + ") Warning]: " + message + "\u001b[0m");
				LogToBepInExFile((LogLevel)4, source, message);
			}
			else if (level.ToLower() == "info" || level.ToLower() == "information")
			{
				Console.WriteLine(((ColorBase)Information).Format() + "[(" + source + ") Information]: " + message + "\u001b[0m");
				LogToBepInExFile((LogLevel)16, source, message);
			}
			else if (level.ToLower() == "debug" && DefineConfiguration.ShowDebugLogging.Value)
			{
				Console.WriteLine(((ColorBase)Debug).Format() + "[(" + source + ") Debug]: " + message + "\u001b[0m");
				LogToBepInExFile((LogLevel)32, source, message);
			}
			else if ((level.ToLower() == "additionalinfo" || level.ToLower() == "additionalinformation") && DefineConfiguration.ShowAdditionalInformation.Value)
			{
				Console.WriteLine(((ColorBase)ExtendedInformation).Format() + "[(" + source + ") Additional Information]: " + message + "\u001b[0m");
				LogToBepInExFile((LogLevel)8, source, message);
			}
			else if (level.ToLower() == "summary" && DefineConfiguration.ShowSummary.Value)
			{
				Console.WriteLine(((ColorBase)SummaryInformation).Format() + "[(" + source + ") Summary Information]: " + message + "\u001b[0m");
				LogToBepInExFile((LogLevel)8, source, message);
			}
			else if (level.ToLower() == "verbose" && DefineConfiguration.ShowVerboseLogging.Value)
			{
				Console.WriteLine(((ColorBase)Verbose).Format() + "[(" + source + ") Verbose Logging]: " + message + "\u001b[0m");
				LogToBepInExFile((LogLevel)8, source, message);
			}
		}

		private static void LogToBepInExFile(LogLevel level, string source, string message)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			ManualLogSource val = new ManualLogSource("Chaosyr.MADH95.Inscryption.JSON.CSVLoader");
			LogEventArgs e = new LogEventArgs((object)$"[({source}) {level}]: {message}", level, (ILogSource)(object)val);
			foreach (ILogListener listener in Logger.Listeners)
			{
				if (listener is DiskLogListener)
				{
					listener.LogEvent((object)typeof(JSONLoader3), e);
				}
			}
		}
	}
}
namespace JSONLoader3.Subperipheral.JSONLoaderStartupPhase
{
	public static class AddJSONLoaderStartupPhase
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static UpdateFunction <0>__ExecuteStartupPhase;
		}

		private static bool hasPhaseExecuted;

		public static Action OnStartupPhaseExecuted { get; set; }

		public static void Install()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PlayerLoopSystem root = PlayerLoop.GetCurrentPlayerLoop();
				PlayerLoopSystem val = new PlayerLoopSystem
				{
					type = typeof(AddJSONLoaderStartupPhase)
				};
				object obj = <>O.<0>__ExecuteStartupPhase;
				if (obj == null)
				{
					UpdateFunction val2 = ExecuteStartupPhase;
					<>O.<0>__ExecuteStartupPhase = val2;
					obj = (object)val2;
				}
				val.updateDelegate = (UpdateFunction)obj;
				PlayerLoopSystem newSystem = val;
				if (!InsertAfter(ref root, typeof(Initialization), newSystem))
				{
					JSONLoader3.FormatLogger("error", "Startup Phase for JSONLoader3 and CSVLoader", "Failed to install the startup phase into the Unity PlayerLoop.");
					return;
				}
				PlayerLoop.SetPlayerLoop(root);
				JSONLoader3.FormatLogger("info", "Startup Phase for JSONLoader3 and CSVLoader", "Successfully installed startup phase into the Unity PlayerLoop.");
			}
			catch (Exception arg)
			{
				JSONLoader3.FormatLogger("error", "Startup Phase for JSONLoader3 and CSVLoader", $"Exception while installing startup phase: {arg}");
			}
		}

		private static void ExecuteStartupPhase()
		{
			if (hasPhaseExecuted)
			{
				return;
			}
			hasPhaseExecuted = true;
			JSONLoader3.FormatLogger("info", "Startup Phase for JSONLoader3 and CSVLoader", "Executing JSONLoader3 startup phase.");
			if (OnStartupPhaseExecuted == null)
			{
				JSONLoader3.FormatLogger("error", "Startup Phase for JSONLoader3 and CSVLoader", "Startup phase was triggered, but no callback was assigned.");
				return;
			}
			try
			{
				OnStartupPhaseExecuted();
				JSONLoader3.FormatLogger("info", "Startup Phase for JSONLoader3 and CSVLoader", "JSONLoader3 startup phase completed successfully.");
			}
			catch (Exception arg)
			{
				JSONLoader3.FormatLogger("error", "Startup Phase for JSONLoader3 and CSVLoader", $"Exception during startup phase: {arg}");
			}
		}

		private static bool InsertAfter(ref PlayerLoopSystem root, Type targetType, PlayerLoopSystem newSystem)
		{
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			if (root.subSystemList == null)
			{
				return false;
			}
			for (int i = 0; i < root.subSystemList.Length; i++)
			{
				if (root.subSystemList[i].type == targetType)
				{
					PlayerLoopSystem[] subSystemList = root.subSystemList;
					PlayerLoopSystem[] array = (PlayerLoopSystem[])(object)new PlayerLoopSystem[subSystemList.Length + 1];
					for (int j = 0; j <= i; j++)
					{
						array[j] = subSystemList[j];
					}
					array[i + 1] = newSystem;
					for (int k = i + 1; k < subSystemList.Length; k++)
					{
						array[k + 1] = subSystemList[k];
					}
					root.subSystemList = array;
					return true;
				}
				PlayerLoopSystem root2 = root.subSystemList[i];
				if (InsertAfter(ref root2, targetType, newSystem))
				{
					root.subSystemList[i] = root2;
					return true;
				}
			}
			return false;
		}
	}
}
namespace JSONLoader3.Subperipheral.JSONLoaderConfiguration
{
	public class DefineConfiguration
	{
		public static ConfigEntry<string> JSONLoadingPaths;

		public static ConfigEntry<string> CSVLoadingPaths;

		public static ConfigEntry<string> SchemaSavePath;

		public static ConfigEntry<bool> ShowDebugLogging;

		public static ConfigEntry<bool> ShowVerboseLogging;

		public static ConfigEntry<bool> ShowAdditionalInformation;

		public static ConfigEntry<bool> ShowSummary;

		public static ConfigEntry<bool> HideValidationAnyOfErrors;

		public static ConfigEntry<bool> toggleRecursiveOnPlugin;

		private static ConfigFile configFile;

		public static void DefineConfigs(ConfigFile config)
		{
			configFile = config;
			JSONLoadingPaths = configFile.Bind<string>("Configuration", "JSON Loading Origination Path", "Scripts, Plugins/Scripts, Cards, Plugins/Cards", "These paths are case insensitive, and determine where JSON Scripts may be sourced from in order to load. If your a mod maker shipping mods, make a 'plugins' folder in your mods folder, and put a folder in there called 'scripts', this is where your JSON scripts should reside. If you need another path, you can override this value with your mod, we'll provide a system for you to do so.");
			CSVLoadingPaths = configFile.Bind<string>("Configuration", "CSV Loading Origination Path", "Sheets, Plugins/Sheets", "These paths are case insensitive, and determine where CSV Sheets may be sourced from in order to load. If your a mod maker shipping mods, make a 'plugins' folder in your mods folder, and put a folder in there called 'sheets', this is where your CSV Sheets should reside. If you need another path, you can override this value with your mod, we'll provide a system for you to do so.");
			SchemaSavePath = configFile.Bind<string>("Configuration", "Schema Save Path", "/Schemas", "This determines where JSON Schemas will be saved to as we create them, this path will be localized to the DLL's folder. You can use '../' to mean go up a folder.");
			JSONLoader3.FormatLogger("info", "Configuration", "Finished adding configuration for the Loading Paths associated with this mod.");
			ShowDebugLogging = configFile.Bind<bool>("Logging", "Show Debug Logging", false, "While this value is set to true, this API will show what is happening when its happening.");
			ShowVerboseLogging = configFile.Bind<bool>("Logging", "Show Verbose Logging", false, "While this value is set to true, this API will output the Verbose building of your JSONs/CSVs.");
			ShowAdditionalInformation = configFile.Bind<bool>("Logging", "Show Additional Information", false, "While this value is set to true, this API will show a more in depth lense as to what went wrong, and try to help explain why its wrong with links to references.");
			ShowSummary = configFile.Bind<bool>("Logging", "Show Summary Information", false, "While this value is set to true, this API will show the Summary for each property being verified by the Linter and some Additional Debug Information.");
			HideValidationAnyOfErrors = configFile.Bind<bool>("Logging", "Hide AnyOf Validation Errors", true, "When this is true the Linter will not output all errors occuring during Validating an AnyOf, namely, all Validator Paths that may error, meaning its not necessarily an error. Setting this to false is useful when all ValidationPaths for a property have failed.");
			JSONLoader3.FormatLogger("info", "Configuration", "Finished adding configuration for the Logging associated with this mod.");
			toggleRecursiveOnPlugin = configFile.Bind<bool>("Compatibility", "Recursively Scan At Plugin Level", false, "While this value is set to true, this API will recursively scan for JSONs and CSVs from the Plugins level, rather than the set folders. This is defaulted to false for the purposes of keeping Load Times fast, but if you have a mod that isn't structured for this toggle this setting on.");
			JSONLoader3.FormatLogger("info", "Configuration", "Finished adding configuration for the Compatibility associated with this mod.");
		}
	}
}
namespace JSONLoader3.Peripheral.XML_Parser
{
	public class ReadDocumentationFile
	{
		private static Assembly assembly = Assembly.GetExecutingAssembly();

		internal static string DLLPath = Path.GetDirectoryName(assembly.Location);

		internal static string DLLName = Path.GetFileNameWithoutExtension(assembly.Location);

		internal static List<string> DocFileXML = new List<string>();

		public static void FetchDocFile()
		{
			string dLLPath = DLLPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			if (File.Exists(dLLPath + directorySeparatorChar + DLLName + ".xml"))
			{
				string dLLPath2 = DLLPath;
				directorySeparatorChar = Path.DirectorySeparatorChar;
				StreamReader streamReader = new StreamReader(dLLPath2 + directorySeparatorChar + DLLName + ".xml");
				while (streamReader.Peek() >= 0)
				{
					DocFileXML.Add(streamReader.ReadLine());
				}
			}
		}

		public static List<string> FetchItemSummary((string Namespace, string className, string ItemName) tup)
		{
			if (DocFileXML.Count == 0)
			{
				return null;
			}
			int num = DocFileXML.FindIndex((string x) => x.Contains("F:" + tup.Namespace + "." + tup.className + "." + tup.ItemName));
			List<string> list = new List<string>();
			for (int num2 = num + 1; num2 < DocFileXML.FindIndex(num, (string x) => x.Trim() == "</summary>"); num2++)
			{
				if (!(DocFileXML[num2].Trim() == "</summary>") && !(DocFileXML[num2].Trim() == "<summary>"))
				{
					list.Add(DocFileXML[num2]);
				}
			}
			return list;
		}

		public static string GetJSONSummary((string Namespace, string className, string ItemName) tup)
		{
			List<string> list = FetchItemSummary((Namespace: tup.Namespace, className: tup.className, ItemName: tup.ItemName));
			string text = "";
			foreach (string item in list)
			{
				text = text + item.Trim() + " ";
			}
			return text.Trim();
		}

		public static (string Namespace, string className, string ItemName) GetInfo<Class>(string ItemName)
		{
			string item = typeof(Class).Namespace;
			string name = typeof(Class).Name;
			return (Namespace: item, className: name, ItemName: ItemName);
		}

		public static (string Namespace, string className, string ItemName) GetInfo(string ItemName, Type Class)
		{
			string item = Class.Namespace;
			string name = Class.Name;
			return (Namespace: item, className: name, ItemName: ItemName);
		}

		public static string EscapeJSON(string value)
		{
			return value.Replace("\\", "\\\\").Replace("\"", "\\\"");
		}
	}
}
namespace JSONLoader3.Peripheral.Tooltip_Parser
{
	public class TooltipDisector
	{
		public static List<string> GetTooltipProperties(FieldInfo field)
		{
			List<string> list = new List<string>();
			TooltipAttribute customAttribute = ((MemberInfo)field).GetCustomAttribute<TooltipAttribute>();
			if (customAttribute == null)
			{
				return list;
			}
			string[] array = customAttribute.tooltip.Split(new char[1] { '|' });
			foreach (string text in array)
			{
				StringBuilder stringBuilder = new StringBuilder();
				int num = 0;
				string tooltip = customAttribute.tooltip;
				foreach (char c in tooltip)
				{
					if (c == '(')
					{
						num++;
					}
					if (c == ')')
					{
						num--;
					}
					if (c == '|' && num == 0)
					{
						list.Add(stringBuilder.ToString().Trim());
						stringBuilder.Clear();
					}
					else
					{
						stringBuilder.Append(c);
					}
				}
				if (stringBuilder.Length > 0)
				{
					list.Add(stringBuilder.ToString().Trim());
				}
			}
			return list;
		}
	}
}
namespace JSONLoader3.Peripheral.JSON_SCHEMA
{
	public class LoadSchema
	{
		public static string SchemaFolder;

		public static List<string> FindAndLoadSchema<Class>(string LoaderName)
		{
			string fullSchemaPath = GetFullSchemaPath<Class>(LoaderName);
			FileStream stream = File.OpenRead(fullSchemaPath);
			StreamReader streamReader = new StreamReader(stream);
			List<string> list = new List<string>();
			while (streamReader.Peek() >= 0)
			{
				string item = streamReader.ReadLine();
				list.Add(item);
			}
			streamReader.Dispose();
			return list;
		}

		public static string GetFullSchemaPath<Class>(string LoaderName)
		{
			string[] obj = new string[8] { SchemaFolder, null, null, null, null, null, null, null };
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[1] = directorySeparatorChar.ToString();
			obj[2] = LoaderName;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[3] = directorySeparatorChar.ToString();
			obj[4] = LoaderName;
			obj[5] = "_";
			obj[6] = typeof(Class).Name;
			obj[7] = "_Schema.json";
			return string.Concat(obj);
		}

		static LoadSchema()
		{
			string dLLPath = FindFiles.DLLPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			SchemaFolder = dLLPath + directorySeparatorChar + DefineConfiguration.SchemaSavePath.Value;
		}
	}
	public class WriteSchema
	{
		public static string SchemaFolder;

		public static void CreateSchemaDirectors(string LoaderName)
		{
			if (!Directory.Exists(SchemaFolder))
			{
				Directory.CreateDirectory(SchemaFolder);
			}
			string schemaFolder = SchemaFolder;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			if (!Directory.Exists(schemaFolder + directorySeparatorChar + LoaderName))
			{
				string schemaFolder2 = SchemaFolder;
				directorySeparatorChar = Path.DirectorySeparatorChar;
				Directory.CreateDirectory(schemaFolder2 + directorySeparatorChar + LoaderName);
			}
		}

		public static StreamWriter CreateAndOpenSchema<Class>(string LoaderName)
		{
			string[] obj = new string[8] { SchemaFolder, null, null, null, null, null, null, null };
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[1] = directorySeparatorChar.ToString();
			obj[2] = LoaderName;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[3] = directorySeparatorChar.ToString();
			obj[4] = LoaderName;
			obj[5] = "_";
			obj[6] = typeof(Class).Name;
			obj[7] = "_Schema.json";
			string path = string.Concat(obj);
			FileStream stream = File.Create(path);
			return new StreamWriter(stream);
		}

		public static void CloseWriterAndFile(StreamWriter Writer)
		{
			Writer.Dispose();
		}

		public static List<(FieldInfo field, List<string> tooltips)> GetToolTips(List<FieldInfo> fields)
		{
			List<(FieldInfo, List<string>)> list = new List<(FieldInfo, List<string>)>();
			foreach (FieldInfo field in fields)
			{
				list.Add((field, TooltipDisector.GetTooltipProperties(field)));
			}
			return list;
		}

		public static List<string> GetRequired(List<(FieldInfo field, List<string> tooltips)> fieldTooltipList)
		{
			return (from x in fieldTooltipList
				where x.tooltips.Contains<string>("REQUIRED", StringComparer.Ordinal) && !x.tooltips.Contains<string>("EXCLUDED", StringComparer.Ordinal) && !x.tooltips.Contains<string>("ALTERNATIVES", StringComparer.Ordinal)
				select "\"" + x.field.Name + "\"").ToList();
		}

		public static List<List<string>> GetAllOfRequired(List<(FieldInfo field, List<string> tooltips)> fieldTooltipList)
		{
			List<List<string>> list = new List<List<string>>();
			List<(FieldInfo, List<string>)> list2 = fieldTooltipList.Where(((FieldInfo field, List<string> tooltips) x) => x.tooltips.Contains<string>("REQUIRED", StringComparer.Ordinal) && !x.tooltips.Contains<string>("EXCLUDED", StringComparer.Ordinal) && x.tooltips.Contains<string>("ALTERNATIVES", StringComparer.Ordinal)).ToList();
			foreach (var item3 in list2)
			{
				FieldInfo item = item3.Item1;
				List<string> item2 = item3.Item2;
				List<string> list3 = new List<string>();
				string text = item2.FirstOrDefault((string x) => x.StartsWith("AlternativeNames(", StringComparison.Ordinal));
				if (!StringExtensions.IsNullOrWhitespace(text))
				{
					text = text.Substring(text.IndexOf('(') + 1, text.LastIndexOf(')') - text.IndexOf('(') - 1);
					list3.AddRange(from x in text.Split(new char[1] { ',' })
						select x.Trim());
				}
				list3.Add(item.Name);
				list.Add(list3);
			}
			return list;
		}

		public static List<List<string>> GetAnyOfAlternativeNames(List<(FieldInfo field, List<string> tooltips)> fieldTooltipList)
		{
			List<List<string>> list = new List<List<string>>();
			List<(FieldInfo, List<string>)> list2 = fieldTooltipList.Where(((FieldInfo field, List<string> tooltips) x) => !x.tooltips.Contains<string>("REQUIRED", StringComparer.Ordinal) && !x.tooltips.Contains<string>("EXCLUDED", StringComparer.Ordinal) && x.tooltips.Contains<string>("ALTERNATIVES", StringComparer.Ordinal)).ToList();
			foreach (var item3 in list2)
			{
				FieldInfo item = item3.Item1;
				List<string> item2 = item3.Item2;
				List<string> list3 = new List<string>();
				string text = item2.FirstOrDefault((string x) => x.StartsWith("AlternativeNames(", StringComparison.Ordinal));
				if (!StringExtensions.IsNullOrWhitespace(text))
				{
					text = text.Substring(text.IndexOf('(') + 1, text.LastIndexOf(')') - text.IndexOf('(') - 1);
					list3.AddRange(from x in text.Split(new char[1] { ',' })
						select x.Trim());
				}
				list3.Add(item.Name);
				list.Add(list3);
			}
			return list;
		}

		public static List<(FieldInfo field, List<string> tooltips)> GetWritable(List<(FieldInfo field, List<string> tooltips)> fieldTooltipList)
		{
			return fieldTooltipList.Where(((FieldInfo field, List<string> tooltips) x) => !x.tooltips.Contains<string>("EXCLUDED", StringComparer.Ordinal)).ToList();
		}

		public static List<(FieldInfo field, List<string> tooltips)> GetWritableExtended(List<(FieldInfo field, List<string> tooltips)> fieldTooltipList)
		{
			List<(FieldInfo, List<string>)> list = new List<(FieldInfo, List<string>)>();
			foreach (var (fieldInfo, list2) in GetWritable(fieldTooltipList))
			{
				if (IsExtends(list2))
				{
					if (fieldInfo.FieldType.IsClass && fieldInfo.FieldType != typeof(string))
					{
						List<(FieldInfo, List<string>)> toolTips = GetToolTips(fieldInfo.FieldType.GetFields().ToList());
						list.AddRange(GetWritableExtended(toolTips));
					}
				}
				else
				{
					list.Add((fieldInfo, list2));
				}
			}
			return list;
		}

		public static bool IsExtends(List<string> tooltips)
		{
			return tooltips.Contains<string>("EXTENDS", StringComparer.Ordinal);
		}

		public static string HandleAllOf(List<List<string>> allOf, List<List<string>> anyOfAlternates, int Indentation)
		{
			string text = "";
			text = text + "\r\n    " + new string(' ', Indentation * 4) + "\"allOf\": [";
			foreach (List<string> item in allOf)
			{
				text = text + "\r\n        " + new string(' ', Indentation * 4) + "{\r\n            " + new string(' ', Indentation * 4) + "\"oneOf\": [";
				foreach (string item2 in item)
				{
					text = text + "\r\n                " + new string(' ', Indentation * 4) + "{\r\n                    " + new string(' ', Indentation * 4) + "\"required\": [\r\n                        " + new string(' ', Indentation * 4) + "\"" + item2 + "\"\r\n                    " + new string(' ', Indentation * 4) + "]\r\n                " + new string(' ', Indentation * 4) + "},";
				}
				text = text.TrimEnd(Array.Empty<char>());
				text = text.TrimEnd(new char[1] { ',' });
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "]\r\n        " + new string(' ', Indentation * 4) + "},";
			}
			foreach (List<string> anyOfAlternate in anyOfAlternates)
			{
				for (int i = 0; i < anyOfAlternate.Count; i++)
				{
					for (int j = i + 1; j < anyOfAlternate.Count; j++)
					{
						text = text + "\r\n        " + new string(' ', Indentation * 4) + "{\r\n            " + new string(' ', Indentation * 4) + "\"not\": {\r\n                " + new string(' ', Indentation * 4) + "\"required\": [\r\n                    " + new string(' ', Indentation * 4) + "\"" + anyOfAlternate[i] + "\",\r\n                    " + new string(' ', Indentation * 4) + "\"" + anyOfAlternate[j] + "\"\r\n                " + new string(' ', Indentation * 4) + "]\r\n            " + new string(' ', Indentation * 4) + "}\r\n        " + new string(' ', Indentation * 4) + "},";
					}
				}
			}
			text = text.TrimEnd(Array.Empty<char>());
			text = text.TrimEnd(new char[1] { ',' });
			return text + "\r\n    " + new string(' ', Indentation * 4) + "]";
		}

		public static string HandleAnyOf(string anyOf, int Indentation)
		{
			string text = "";
			List<string> list = anyOf.Replace('(', ' ').Replace(')', ' ').Split(new char[1] { ';' })
				.ToList();
			foreach (string item in list)
			{
				text = text + "\r\n                " + new string(' ', Indentation * 4) + "{";
				List<string> list2 = item.Replace('[', ' ').Replace(']', ' ').Split(new char[1] { ',' })
					.ToList();
				List<(string, string)> list3 = new List<(string, string)>();
				foreach (string item2 in list2)
				{
					int num = item2.IndexOf(':');
					if (num >= 0)
					{
						list3.Add((item2.Substring(0, num).Trim(), item2.Substring(num + 1).Trim()));
					}
				}
				(string, string) tuple = list3.FirstOrDefault<(string, string)>(((string field, string value) x) => x.field == "Title");
				text = text + "\r\n                    " + new string(' ', Indentation * 4) + "\"title\": \"" + tuple.Item2 + "\",";
				(string, string) tuple2 = list3.FirstOrDefault<(string, string)>(((string field, string value) x) => x.field == "Description");
				text = text + "\r\n                    " + new string(' ', Indentation * 4) + "\"description\": \"" + tuple2.Item2 + "\",";
				(string, string) tuple3 = list3.FirstOrDefault<(string, string)>(((string field, string value) x) => x.field == "Type");
				text = text + "\r\n                    " + new string(' ', Indentation * 4) + "\"type\": \"" + tuple3.Item2.ToLower() + "\",";
				if (tuple3.Item2 == "string")
				{
					(string, string) tuple4 = list3.FirstOrDefault<(string, string)>(((string field, string value) x) => x.field == "Enums");
					(string, string) tuple5 = tuple4;
					if (tuple5.Item1 != null || tuple5.Item2 != null)
					{
						text = text + "\r\n                    " + new string(' ', Indentation * 4) + "\"enum\": [\r\n                        " + new string(' ', Indentation * 4) + string.Join(", " + Environment.NewLine + "                        " + new string(' ', Indentation * 4), from x in tuple4.Item2.Split(new char[1] { '>' })
							select "\"" + x.Trim() + "\"") + "\r\n                    " + new string(' ', Indentation * 4) + "],";
					}
				}
				text = text.TrimEnd(Array.Empty<char>());
				text = text.TrimEnd(new char[1] { ',' });
				text = text + "\r\n                " + new string(' ', Indentation * 4) + "},";
			}
			text = text.TrimEnd(Array.Empty<char>());
			return text.TrimEnd(new char[1] { ',' });
		}

		public static string HandleString(List<(FieldInfo field, List<string> tooltips, string propertyName)> writableFields, FieldInfo field, List<string> tooltips, int Indentation, Type Class, string propertyName = null)
		{
			string text = "";
			string text2 = propertyName ?? field.Name;
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "\"" + text2 + "\": {\r\n            " + new string(' ', Indentation * 4) + "\"type\": \"string\",\r\n            " + new string(' ', Indentation * 4) + "\"description\": \"" + ReadDocumentationFile.EscapeJSON(ReadDocumentationFile.GetJSONSummary(ReadDocumentationFile.GetInfo(field.Name, Class))) + "\",";
			string text3 = tooltips.FirstOrDefault((string x) => x.StartsWith("MinimumLength(", StringComparison.Ordinal));
			if (text3 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"minLength\": " + text3.Split(new char[1] { '(' }).Last().Trim('(', ')') + ",";
			}
			string text4 = tooltips.FirstOrDefault((string x) => x.StartsWith("Pattern(", StringComparison.Ordinal));
			if (text4 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"pattern\": \"" + ReadDocumentationFile.EscapeJSON(text4.Substring(text4.IndexOf('(') + 1, text4.LastIndexOf(')') - text4.IndexOf('(') - 1)) + "\",";
			}
			string text5 = tooltips.FirstOrDefault((string x) => x.StartsWith("Default(", StringComparison.Ordinal));
			if (text5 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"default\": \"" + text5.Split(new char[1] { '(' }).Last().Trim('(', ')') + "\",";
			}
			string text6 = tooltips.FirstOrDefault((string x) => x.StartsWith("Enums(", StringComparison.Ordinal));
			if (text6 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"enum\": [\r\n                " + new string(' ', Indentation * 4) + string.Join(", " + Environment.NewLine + "                " + new string(' ', Indentation * 4), from x in text6.Split(new char[1] { '(' }).Last().Trim('(', ')')
						.Split(new char[1] { ',' })
					select "\"" + x.Trim() + "\"") + "\r\n            " + new string(' ', Indentation * 4) + "],";
			}
			string text7 = tooltips.FirstOrDefault((string x) => x.StartsWith("AnyOf(", StringComparison.Ordinal));
			if (text7 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"anyOf\": [";
				text += HandleAnyOf(text7, Indentation);
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "],";
			}
			text = text.TrimEnd(Array.Empty<char>());
			text = text.TrimEnd(new char[1] { ',' });
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "}";
			if (writableFields.IndexOf((field, tooltips, propertyName)) != writableFields.Count - 1)
			{
				text += ",";
			}
			return text;
		}

		public static string HandleInt(List<(FieldInfo field, List<string> tooltips, string propertyName)> writableFields, FieldInfo field, List<string> tooltips, int Indentation, Type Class, string propertyName = null)
		{
			string text = "";
			string text2 = propertyName ?? field.Name;
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "\"" + text2 + "\": {\r\n            " + new string(' ', Indentation * 4) + "\"type\": \"integer\",\r\n            " + new string(' ', Indentation * 4) + "\"description\": \"" + ReadDocumentationFile.EscapeJSON(ReadDocumentationFile.GetJSONSummary(ReadDocumentationFile.GetInfo(field.Name, Class))) + "\",";
			string text3 = tooltips.FirstOrDefault((string x) => x.StartsWith("Default(", StringComparison.Ordinal));
			if (text3 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"default\": " + text3.Split(new char[1] { '(' }).Last().Trim('(', ')') + ",";
			}
			string text4 = tooltips.FirstOrDefault((string x) => x.StartsWith("Minimum(", StringComparison.Ordinal));
			if (text4 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"minimum\": " + text4.Split(new char[1] { '(' }).Last().Trim('(', ')') + ",";
			}
			string text5 = tooltips.FirstOrDefault((string x) => x.StartsWith("Maximum(", StringComparison.Ordinal));
			if (text5 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"maximum\": " + text5.Split(new char[1] { '(' }).Last().Trim('(', ')') + ",";
			}
			text = text.TrimEnd(Array.Empty<char>());
			text = text.TrimEnd(new char[1] { ',' });
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "}";
			if (writableFields.IndexOf((field, tooltips, propertyName)) != writableFields.Count - 1)
			{
				text += ",";
			}
			return text;
		}

		public static string HandleBoolean(List<(FieldInfo field, List<string> tooltips, string propertyName)> writableFields, FieldInfo field, List<string> tooltips, int Indentation, Type Class, string propertyName = null)
		{
			string text = "";
			string text2 = propertyName ?? field.Name;
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "\"" + text2 + "\": {\r\n            " + new string(' ', Indentation * 4) + "\"type\": \"boolean\",\r\n            " + new string(' ', Indentation * 4) + "\"description\": \"" + ReadDocumentationFile.EscapeJSON(ReadDocumentationFile.GetJSONSummary(ReadDocumentationFile.GetInfo(field.Name, Class))) + "\",";
			string text3 = tooltips.FirstOrDefault((string x) => x.StartsWith("Default(", StringComparison.Ordinal));
			if (text3 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"default\": " + text3.Split(new char[1] { '(' }).Last().Trim('(', ')')
					.ToLower() + ",";
			}
			text = text.TrimEnd(Array.Empty<char>());
			text = text.TrimEnd(new char[1] { ',' });
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "}";
			if (writableFields.IndexOf((field, tooltips, propertyName)) != writableFields.Count - 1)
			{
				text += ",";
			}
			return text;
		}

		public static string HandleStringArray(List<(FieldInfo field, List<string> tooltips, string propertyName)> writableFields, FieldInfo field, List<string> tooltips, int Indentation, Type Class, string propertyName = null)
		{
			string text = "";
			string text2 = propertyName ?? field.Name;
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "\"" + text2 + "\": {\r\n            " + new string(' ', Indentation * 4) + "\"type\": \"array\",\r\n            " + new string(' ', Indentation * 4) + "\"description\": \"" + ReadDocumentationFile.EscapeJSON(ReadDocumentationFile.GetJSONSummary(ReadDocumentationFile.GetInfo(field.Name, Class))) + "\",";
			string text3 = tooltips.FirstOrDefault((string x) => x.StartsWith("Items(", StringComparison.Ordinal));
			if (text3 != null && text3.Split(new char[1] { '(' }).Last().Trim('(', ')')
				.ToLower() == "true")
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"items\": {";
				string text4 = tooltips.FirstOrDefault((string x) => x.StartsWith("ItemType(", StringComparison.Ordinal));
				if (text4 != null)
				{
					text = text + "\r\n                " + new string(' ', Indentation * 4) + "\"type\": \"" + text4.Split(new char[1] { '(' }).Last().Trim('(', ')')
						.ToLower() + "\",";
				}
				string text5 = tooltips.FirstOrDefault((string x) => x.StartsWith("Pattern(", StringComparison.Ordinal));
				if (text5 != null)
				{
					text = text + "\r\n                " + new string(' ', Indentation * 4) + "\"pattern\": \"" + ReadDocumentationFile.EscapeJSON(text5.Substring(text5.IndexOf('(') + 1, text5.LastIndexOf(')') - text5.IndexOf('(') - 1)) + "\",";
				}
				string text6 = tooltips.FirstOrDefault((string x) => x.StartsWith("Enums(", StringComparison.Ordinal));
				if (text6 != null)
				{
					text = text + "\r\n                " + new string(' ', Indentation * 4) + "\"enum\": [\r\n                    " + new string(' ', Indentation * 4) + string.Join(", " + Environment.NewLine + "                    " + new string(' ', Indentation * 4), from x in text6.Split(new char[1] { '(' }).Last().Trim('(', ')')
							.Split(new char[1] { ',' })
						select "\"" + x.Trim() + "\"") + "\r\n                " + new string(' ', Indentation * 4) + "],";
				}
				string text7 = tooltips.FirstOrDefault((string x) => x.StartsWith("AnyOf(", StringComparison.Ordinal));
				if (text7 != null)
				{
					text = text + "\r\n                " + new string(' ', Indentation * 4) + "\"anyOf\": [";
					text += HandleAnyOf(text7, Indentation + 1);
					text = text + "\r\n                " + new string(' ', Indentation * 4) + "],";
				}
				text = text.TrimEnd(Array.Empty<char>());
				text = text.TrimEnd(new char[1] { ',' });
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "},";
			}
			string text8 = tooltips.FirstOrDefault((string x) => x.StartsWith("UniqueItems(", StringComparison.Ordinal));
			if (text8 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"uniqueItems\": " + text8.Split(new char[1] { '(' }).Last().Trim('(', ')')
					.ToLower() + ",";
			}
			text = text.TrimEnd(Array.Empty<char>());
			text = text.TrimEnd(new char[1] { ',' });
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "}";
			if (writableFields.IndexOf((field, tooltips, propertyName)) != writableFields.Count - 1)
			{
				text += ",";
			}
			return text;
		}

		public static string HandleObjectArray(List<(FieldInfo field, List<string> tooltips, string propertyName)> writableFields, FieldInfo field, List<string> tooltips, int Indentation, Type Class, string propertyName = null)
		{
			Type type = field.FieldType.GetGenericArguments()[0];
			string text = "";
			string text2 = propertyName ?? field.Name;
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "\"" + text2 + "\": {\r\n            " + new string(' ', Indentation * 4) + "\"type\": \"array\",\r\n            " + new string(' ', Indentation * 4) + "\"description\": \"" + ReadDocumentationFile.EscapeJSON(ReadDocumentationFile.GetJSONSummary(ReadDocumentationFile.GetInfo(field.Name, Class))) + "\",";
			string text3 = tooltips.FirstOrDefault((string x) => x.StartsWith("Items(", StringComparison.Ordinal));
			if (text3 != null && text3.Split(new char[1] { '(' }).Last().Trim('(', ')')
				.ToLower() == "true")
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"items\": {";
				string text4 = tooltips.FirstOrDefault((string x) => x.StartsWith("ItemType(", StringComparison.Ordinal));
				if (text4 != null)
				{
					text = text + "\r\n                " + new string(' ', Indentation * 4) + "\"type\": \"" + text4.Split(new char[1] { '(' }).Last().Trim('(', ')')
						.ToLower() + "\",";
				}
				string text5 = tooltips.FirstOrDefault((string x) => x.StartsWith("AdditionalProperties(", StringComparison.Ordinal));
				if (text5 != null)
				{
					string text6 = text5.Split(new char[1] { '(' }).Last().Trim('(', ')')
						.ToLower();
					text = ((!(text6 == "true") && !(text6 == "false")) ? (text + "\r\n            " + new string(' ', Indentation * 4) + "\"additionalProperties\": {\r\n                " + new string(' ', Indentation * 4) + "\"type\": \"" + text6.ToLower() + "\"\r\n            " + new string(' ', Indentation * 4) + "},") : (text + "\r\n            " + new string(' ', Indentation * 4) + "\"additionalProperties\": " + text6.ToLower() + ","));
				}
				if (type != typeof(object))
				{
					string text7 = RecursiveWrite(type, Indentation + 3);
					text += text7;
				}
				text = text.TrimEnd(Array.Empty<char>());
				text = text.TrimEnd(new char[1] { ',' });
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "},";
			}
			string text8 = tooltips.FirstOrDefault((string x) => x.StartsWith("UniqueItems(", StringComparison.Ordinal));
			if (text8 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"uniqueItems\": " + text8.Split(new char[1] { '(' }).Last().Trim('(', ')')
					.ToLower() + ",";
			}
			text = text.TrimEnd(Array.Empty<char>());
			text = text.TrimEnd(new char[1] { ',' });
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "}";
			if (writableFields.IndexOf((field, tooltips, propertyName)) != writableFields.Count - 1)
			{
				text += ",";
			}
			return text;
		}

		public static string HandleObject(List<(FieldInfo field, List<string> tooltips, string propertyName)> writableFields, FieldInfo field, List<string> tooltips, int Indentation, Type Class, string propertyName = null)
		{
			string text = "";
			string text2 = propertyName ?? field.Name;
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "\"" + text2 + "\": {\r\n            " + new string(' ', Indentation * 4) + "\"type\": \"object\",\r\n            " + new string(' ', Indentation * 4) + "\"description\": \"" + ReadDocumentationFile.EscapeJSON(ReadDocumentationFile.GetJSONSummary(ReadDocumentationFile.GetInfo(field.Name, Class))) + "\",";
			string text3 = tooltips.FirstOrDefault((string x) => x.StartsWith("AdditionalProperties(", StringComparison.Ordinal));
			if (text3 != null)
			{
				string text4 = text3.Split(new char[1] { '(' }).Last().Trim('(', ')')
					.ToLower();
				text = ((!(text4 == "true") && !(text4 == "false")) ? (text + "\r\n            " + new string(' ', Indentation * 4) + "\"additionalProperties\": {\r\n                " + new string(' ', Indentation * 4) + "\"type\": \"" + text4.ToLower() + "\"\r\n            " + new string(' ', Indentation * 4) + "},") : (text + "\r\n            " + new string(' ', Indentation * 4) + "\"additionalProperties\": " + text4.ToLower() + ","));
			}
			if (field.FieldType != typeof(object))
			{
				string text5 = RecursiveWrite(field.FieldType, Indentation + 2);
				text += text5;
			}
			text = text.TrimEnd(Array.Empty<char>());
			text = text.TrimEnd(new char[1] { ',' });
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "}";
			if (writableFields.IndexOf((field, tooltips, propertyName)) != writableFields.Count - 1)
			{
				text += ",";
			}
			return text;
		}

		public static List<(FieldInfo field, List<string> tooltips, string propertyName)> GetWritableWithAlternates(List<(FieldInfo field, List<string> tooltips)> writableCurrent)
		{
			List<(FieldInfo, List<string>, string)> list = new List<(FieldInfo, List<string>, string)>();
			foreach (var (fieldInfo, list2) in writableCurrent)
			{
				list.Add((fieldInfo, list2, fieldInfo.Name));
				if (!list2.Contains<string>("ALTERNATIVES", StringComparer.Ordinal))
				{
					continue;
				}
				string text = list2.FirstOrDefault((string x) => x.StartsWith("AlternativeNames(", StringComparison.Ordinal));
				if (StringExtensions.IsNullOrWhitespace(text))
				{
					continue;
				}
				text = text.Substring(text.IndexOf('(') + 1, text.LastIndexOf(')') - text.IndexOf('(') - 1);
				foreach (string item in from x in text.Split(new char[1] { ',' })
					select x.Trim())
				{
					if (!StringExtensions.IsNullOrWhitespace(item))
					{
						list.Add((fieldInfo, list2, item));
					}
				}
			}
			return list;
		}

		public static void WriteJSONSchema<Class>(string LoaderName)
		{
			CreateSchemaDirectors(LoaderName);
			StreamWriter streamWriter = CreateAndOpenSchema<Class>(LoaderName);
			streamWriter.Write("{\r\n    \"$schema\": \"http://json-schema.org/draft-04/schema#\",\r\n    \"$id\": \"https://github.com/MADH95/JSONLoader\",\r\n    \"title\": \"New " + LoaderName + " " + typeof(Class).Name + "\",\r\n    \"description\": \"Schema to verify the input data for a new " + LoaderName + " " + typeof(Class).Name + ".\",\r\n    \"type\": \"object\",\r\n    \"additionalProperties\": false,");
			List<(FieldInfo, List<string>)> toolTips = GetToolTips(typeof(Class).GetFields().ToList());
			List<(FieldInfo, List<string>)> writableExtended = GetWritableExtended(toolTips);
			List<(FieldInfo, List<string>, string)> writableWithAlternates = GetWritableWithAlternates(writableExtended);
			List<string> required = GetRequired(writableExtended);
			if (!LinqExtensions.IsNullOrEmpty<string>((IList<string>)required))
			{
				streamWriter.Write("\r\n    \"required\": [\r\n        " + string.Join("," + Environment.NewLine + "        ", required) + "\r\n    ],");
			}
			List<List<string>> allOfRequired = GetAllOfRequired(writableExtended);
			List<List<string>> anyOfAlternativeNames = GetAnyOfAlternativeNames(writableExtended);
			if (!LinqExtensions.IsNullOrEmpty<List<string>>((IList<List<string>>)allOfRequired) || !LinqExtensions.IsNullOrEmpty<List<string>>((IList<List<string>>)anyOfAlternativeNames))
			{
				streamWriter.Write(HandleAllOf(allOfRequired, anyOfAlternativeNames, 0));
				streamWriter.Write(",");
			}
			streamWriter.Write("\r\n    \"properties\": {");
			foreach (var (fieldInfo, tooltips, propertyName) in writableWithAlternates)
			{
				if (fieldInfo.FieldType == typeof(string))
				{
					streamWriter.Write(HandleString(writableWithAlternates, fieldInfo, tooltips, 0, fieldInfo.DeclaringType, propertyName));
				}
				else if (fieldInfo.FieldType == typeof(int))
				{
					streamWriter.Write(HandleInt(writableWithAlternates, fieldInfo, tooltips, 0, fieldInfo.DeclaringType, propertyName));
				}
				else if (fieldInfo.FieldType == typeof(bool))
				{
					streamWriter.Write(HandleBoolean(writableWithAlternates, fieldInfo, tooltips, 0, fieldInfo.DeclaringType, propertyName));
				}
				else if (fieldInfo.FieldType == typeof(List<string>))
				{
					streamWriter.Write(HandleStringArray(writableWithAlternates, fieldInfo, tooltips, 0, fieldInfo.DeclaringType, propertyName));
				}
				else if (fieldInfo.FieldType.IsGenericType && fieldInfo.FieldType.GetGenericTypeDefinition() == typeof(List<>))
				{
					streamWriter.Write(HandleObjectArray(writableWithAlternates, fieldInfo, tooltips, 0, fieldInfo.DeclaringType, propertyName));
				}
				else if (fieldInfo.FieldType.IsClass)
				{
					streamWriter.Write(HandleObject(writableWithAlternates, fieldInfo, tooltips, 0, fieldInfo.DeclaringType, propertyName));
				}
			}
			streamWriter.Write("\r\n    }\r\n}");
			CloseWriterAndFile(streamWriter);
		}

		public static string RecursiveWrite(Type Class, int Indentation)
		{
			string text = "";
			List<FieldInfo> fields = Class.GetFields().ToList();
			List<(FieldInfo, List<string>)> toolTips = GetToolTips(fields);
			List<(FieldInfo, List<string>)> writableExtended = GetWritableExtended(toolTips);
			List<(FieldInfo, List<string>, string)> writableWithAlternates = GetWritableWithAlternates(writableExtended);
			List<string> required = GetRequired(writableExtended);
			if (!LinqExtensions.IsNullOrEmpty<string>((IList<string>)required))
			{
				text = text + "\r\n    " + new string(' ', Indentation * 4) + "\"required\": [\r\n        " + new string(' ', Indentation * 4) + string.Join("," + Environment.NewLine + "        " + new string(' ', Indentation * 4), required) + "\r\n    " + new string(' ', Indentation * 4) + "],";
			}
			List<List<string>> allOfRequired = GetAllOfRequired(writableExtended);
			List<List<string>> anyOfAlternativeNames = GetAnyOfAlternativeNames(writableExtended);
			if (!LinqExtensions.IsNullOrEmpty<List<string>>((IList<List<string>>)allOfRequired) || !LinqExtensions.IsNullOrEmpty<List<string>>((IList<List<string>>)anyOfAlternativeNames))
			{
				text += HandleAllOf(allOfRequired, anyOfAlternativeNames, 0);
				text += ",";
			}
			text = text + "\r\n    " + new string(' ', Indentation * 4) + "\"properties\": {";
			foreach (var (fieldInfo, tooltips, propertyName) in writableWithAlternates)
			{
				if (fieldInfo.FieldType == typeof(string))
				{
					text += HandleString(writableWithAlternates, fieldInfo, tooltips, Indentation, fieldInfo.DeclaringType, propertyName);
				}
				else if (fieldInfo.FieldType == typeof(int))
				{
					text += HandleInt(writableWithAlternates, fieldInfo, tooltips, Indentation, fieldInfo.DeclaringType, propertyName);
				}
				else if (fieldInfo.FieldType == typeof(bool))
				{
					text += HandleBoolean(writableWithAlternates, fieldInfo, tooltips, Indentation, fieldInfo.DeclaringType, propertyName);
				}
				else if (fieldInfo.FieldType == typeof(List<string>))
				{
					text += HandleStringArray(writableWithAlternates, fieldInfo, tooltips, Indentation, fieldInfo.DeclaringType, propertyName);
				}
				else if (fieldInfo.FieldType.IsGenericType && fieldInfo.FieldType.GetGenericTypeDefinition() == typeof(List<>))
				{
					text += HandleObjectArray(writableWithAlternates, fieldInfo, tooltips, Indentation, fieldInfo.DeclaringType, propertyName);
				}
				else if (fieldInfo.FieldType.IsClass)
				{
					text += HandleObject(writableWithAlternates, fieldInfo, tooltips, Indentation, fieldInfo.DeclaringType, propertyName);
				}
			}
			return text + "\r\n    " + new string(' ', Indentation * 4) + "},";
		}

		static WriteSchema()
		{
			string dLLPath = FindFiles.DLLPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			SchemaFolder = dLLPath + directorySeparatorChar + DefineConfiguration.SchemaSavePath.Value;
		}
	}
}
namespace JSONLoader3.Peripheral.JSON_LINT
{
	public class LintingTools
	{
		public static (List<(int depth, string propertyName, string propertyValue)> validatedJSON, bool check) LintAgainstSchema<Class>(string file, List<string> JSONSchema, string LoaderName)
		{
			List<string> list = LoadInJSONItem(file);
			foreach (string item3 in list)
			{
				int num = list.IndexOf(item3);
				if (num != list.Count - 1 && (list[num + 1].Trim().StartsWith("}") || list[num + 1].Trim().EndsWith("}")) && list[num].EndsWith(","))
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "Trailing Comma Detected on the Last Line of the JSON.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "This error occurs when the last Key in the JSON has a comma at the end prior to closing a brace.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", $"To fix it just remove the comma at the end of line {num}.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				}
			}
			List<(int, string, string)> list2 = DisectedJSON(list);
			List<(int, string, string)> jSONSchemaProperties = DisectedJSON(JSONSchema);
			List<string> requiredFromSchema = GetRequiredFromSchema(JSONSchema);
			List<List<string>> allOf = GetAllOf(JSONSchema);
			List<List<string>> alternativeNot = GetAlternativeNot(JSONSchema);
			List<(string, bool)> list3 = new List<(string, bool)>();
			List<(string, bool)> list4 = new List<(string, bool)>();
			foreach (string item4 in requiredFromSchema)
			{
				list4.Add((item4, false));
			}
			foreach (List<string> item5 in allOf)
			{
				foreach (string item6 in item5)
				{
					list3.Add((item6, false));
				}
			}
			JSONLoader3.FormatLogger("Debug", "LintingTools", "Required Fields: " + string.Join(", ", requiredFromSchema));
			foreach (List<string> item7 in allOf)
			{
				JSONLoader3.FormatLogger("Debug", "LintingTools", "Having one of the following is also required: " + string.Join(", ", item7));
			}
			foreach (List<string> item8 in alternativeNot)
			{
				JSONLoader3.FormatLogger("Debug", "LintingTools", "The following fields are mutually exclusive but optional: " + string.Join(", ", item8));
			}
			foreach (var item9 in list2.Where<(int, string, string)>(((int depth, string propertyName, string propertyValue) x) => x.depth == 1))
			{
				string traversalPath = GetTraversalPath(jSONSchemaProperties, item9, 2);
				if (traversalPath == string.Empty)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "Something went wrong while doing PathTraversal for " + item9.Item2 + " the following should help identify what you did wrong.");
					if (GetTraversalPath(jSONSchemaProperties, (depth: item9.Item1, propertyName: StringUtilsExtensions.ToCamelCase(item9.Item2), propertyValue: item9.Item3), 2) != string.Empty)
					{
						JSONLoader3.FormatLogger("ERROR", "LintingTools", "The casing of " + item9.Item2 + " within " + Path.GetFileNameWithoutExtension(file) + " is not correct, it should be in camelCase.");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Basically the Property needs to follow the correct convention which is first word in Lowercase, and the rest of the words first letters Capitalized.");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "likeThis");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "In the JSON the KVP would look like: \"likeThis\": false");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
						return (validatedJSON: list2, check: false);
					}
					char directorySeparatorChar;
					if (!AllowExtraFieldsCheck(JSONSchema))
					{
						JSONLoader3.FormatLogger("ERROR", "LintingTools", "The Property of " + item9.Item2 + " is not apart of the JSON Schema, please remove it from the JSON entitled " + Path.GetFileNameWithoutExtension(file) + ".");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "If you want to stop seeing these when you make your jsons, just cross check the JSON against the Schema saving it.");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Theres a nifty site called JSONEditor that you may find useful, theres a guide in the README.");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Additionally you can cross-reference against the Property List we provide in our API's documentation and WIKI's.");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
						string[] obj = new string[8]
						{
							LoadSchema.SchemaFolder,
							null,
							null,
							null,
							null,
							null,
							null,
							null
						};
						directorySeparatorChar = Path.DirectorySeparatorChar;
						obj[1] = directorySeparatorChar.ToString();
						obj[2] = LoaderName;
						directorySeparatorChar = Path.DirectorySeparatorChar;
						obj[3] = directorySeparatorChar.ToString();
						obj[4] = LoaderName;
						obj[5] = "_";
						obj[6] = typeof(Class).Name;
						obj[7] = "_Schema.json";
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "You can also find the full Schema here: " + Path.GetFullPath(string.Concat(obj)));
						return (validatedJSON: list2, check: false);
					}
					JSONLoader3.FormatLogger("Warning", "LintingTools", "The Property of " + item9.Item2 + " is not apart of the JSON Schema, please remove it from the JSON entitled " + Path.GetFileNameWithoutExtension(file) + ".");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
					string[] obj2 = new string[8]
					{
						LoadSchema.SchemaFolder,
						null,
						null,
						null,
						null,
						null,
						null,
						null
					};
					directorySeparatorChar = Path.DirectorySeparatorChar;
					obj2[1] = directorySeparatorChar.ToString();
					obj2[2] = LoaderName;
					directorySeparatorChar = Path.DirectorySeparatorChar;
					obj2[3] = directorySeparatorChar.ToString();
					obj2[4] = LoaderName;
					obj2[5] = "_";
					obj2[6] = typeof(Class).Name;
					obj2[7] = "_Schema.json";
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "You can also find the full Schema here: " + Path.GetFullPath(string.Concat(obj2)));
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "This is a warning because additionalProperties was enabled for this Object thus we're letting it slide.");
				}
				if (requiredFromSchema.Contains(item9.Item2))
				{
					for (int num2 = 0; num2 < list4.Count; num2++)
					{
						if (list4[num2].Item1 == item9.Item2)
						{
							list4[num2] = (item9.Item2, true);
							JSONLoader3.FormatLogger("Debug", "LintingTools", "Ticked \"" + item9.Item2 + "\" as checked for the Required Properties.");
							break;
						}
					}
				}
				foreach (List<string> item10 in allOf)
				{
					if (!item10.Contains(item9.Item2))
					{
						continue;
					}
					for (int num3 = 0; num3 < list3.Count; num3++)
					{
						if (list3[num3].Item1 == item9.Item2)
						{
							list3[num3] = (item9.Item2, true);
							JSONLoader3.FormatLogger("Debug", "LintingTools", "Ticked \"" + item9.Item2 + "\" as checked for the Required Properties.");
						}
					}
				}
				if (traversalPath != string.Empty)
				{
					List<string> jSONSchemaProperty = GetJSONSchemaProperty(traversalPath, JSONSchema);
					string item = item9.Item2;
					string item2 = item9.Item3;
					string[] obj3 = new string[8]
					{
						LoadSchema.SchemaFolder,
						null,
						null,
						null,
						null,
						null,
						null,
						null
					};
					char directorySeparatorChar = Path.DirectorySeparatorChar;
					obj3[1] = directorySeparatorChar.ToString();
					obj3[2] = LoaderName;
					directorySeparatorChar = Path.DirectorySeparatorChar;
					obj3[3] = directorySeparatorChar.ToString();
					obj3[4] = LoaderName;
					obj3[5] = "_";
					obj3[6] = typeof(Class).Name;
					obj3[7] = "_Schema.json";
					if (!ValidatePropertyAgainstSchema(item, item2, jSONSchemaProperty, file, Path.GetFullPath(string.Concat(obj3))))
					{
						return (validatedJSON: list2, check: false);
					}
				}
			}
			foreach (var item11 in list4)
			{
				var (text, _) = item11;
				if (!item11.Item2)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "Missing Required Field: " + text + " within " + Path.GetFileNameWithoutExtension(file) + ".");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To Fix this, simply add the field mentioned in the error to the json with the appropriate value.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
					return (validatedJSON: list2, check: false);
				}
			}
			foreach (List<string> item12 in allOf)
			{
				bool flag = false;
				foreach (string field in item12)
				{
					if (list3.Any<(string, bool)>(((string field, bool checkedField) x) => x.field == field && x.checkedField))
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "Missing one of the required fields: " + string.Join(", ", item12) + " within " + Path.GetFileNameWithoutExtension(file) + ".");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "At least one of the following fields must be present: " + string.Join(", ", item12) + ".");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
					return (validatedJSON: list2, check: false);
				}
			}
			foreach (List<string> alternatives in alternativeNot)
			{
				List<string> list5 = (from x in list2
					where alternatives.Contains(x.propertyName)
					select x.propertyName).Distinct().ToList();
				if (list5.Count > 1)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "Multiple mutually exclusive fields were found: " + string.Join(", ", list5) + " within " + Path.GetFileNameWithoutExtension(file) + ".");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Only one of the following fields may be present at a time: " + string.Join(", ", alternatives) + ".");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
					return (validatedJSON: list2, check: false);
				}
			}
			return (validatedJSON: list2, check: true);
		}

		private static string GetTraversalPath(List<(int depth, string propertyName, string propertyValue)> JSONSchemaProperties, (int depth, string propertyName, string propertyValue) JSON, int spelunkingDepth)
		{
			List<string> list = new List<string>();
			int num = JSONSchemaProperties.FindIndex(((int depth, string propertyName, string propertyValue) x) => x.propertyName == JSON.propertyName && x.depth == JSON.depth * spelunkingDepth);
			if (num == -1)
			{
				return string.Empty;
			}
			list.Add(JSONSchemaProperties[num].propertyName);
			int item = JSONSchemaProperties[num].depth;
			for (int num2 = num - 1; num2 >= 0; num2--)
			{
				if (JSONSchemaProperties[num2].depth < item)
				{
					list.Insert(0, JSONSchemaProperties[num2].propertyName);
					item = JSONSchemaProperties[num2].depth;
				}
			}
			return string.Join("/", list);
		}

		private static List<(int depth, string propertyName, string propertyValue)> DisectedJSON(List<string> JSONFile)
		{
			List<(int, string, string)> list = new List<(int, string, string)>();
			int num = 0;
			foreach (string item2 in JSONFile)
			{
				int item = num;
				string text = item2.Trim();
				foreach (char c in text)
				{
					if (c == '{' || c == '[')
					{
						num++;
					}
					else if (c == '}' || c == ']')
					{
						num--;
					}
				}
				if (!item2.Trim().StartsWith("{") && !item2.Trim().StartsWith("}") && !item2.Trim().StartsWith("[") && !item2.Trim().StartsWith("]") && item2.Trim().Contains(":"))
				{
					list.Add((item, item2.Trim().Substring(0, item2.Trim().IndexOf(":")).Trim()
						.Trim(new char[1] { '"' }), item2.Trim().Substring(item2.Trim().IndexOf(":") + 1).Trim()
						.TrimEnd(new char[1] { ',' })));
				}
			}
			return list;
		}

		private static List<string> LoadInJSONItem(string file)
		{
			FileStream stream = File.OpenRead(file);
			StreamReader streamReader = new StreamReader(stream);
			List<string> list = new List<string>();
			while (streamReader.Peek() >= 0)
			{
				string item = streamReader.ReadLine();
				list.Add(item);
			}
			streamReader.Dispose();
			return list;
		}

		private static List<string> GetJSONSchemaProperty(string propertyPath, List<string> JSONSchema)
		{
			List<string> list = (from x in propertyPath.Split(new char[1] { '/' })
				where !string.IsNullOrWhiteSpace(x)
				select x).ToList();
			List<string> list2 = JSONSchema;
			foreach (string item in list)
			{
				list2 = DigThroughSchemaFindRelevant(item, list2);
				if (list2.Count == 0)
				{
					break;
				}
			}
			return list2;
		}

		private static List<string> GetRequiredFromSchema(List<string> JSONSchema)
		{
			List<string> list = new List<string>();
			int num = -1;
			int num2 = -1;
			int num3 = -1;
			int num4 = -1;
			int num5 = 0;
			for (int i = 0; i < JSONSchema.Count; i++)
			{
				string text = JSONSchema[i].Trim();
				if (text.StartsWith("\"required\": [") && num4 == -1 && num3 == -1)
				{
					num = i + 1;
					break;
				}
				if (text.StartsWith("\"allOf\": ["))
				{
					num4 = num5;
				}
				else if (text.StartsWith("\"oneOf\": ["))
				{
					num3 = num5;
				}
				string text2 = text;
				foreach (char c in text2)
				{
					if (c == '{' || c == '[')
					{
						num5++;
					}
					else if (c == '}' || c == ']')
					{
						num5--;
					}
				}
				if (num4 != -1 && num5 <= num4)
				{
					num4 = -1;
				}
				if (num3 != -1 && num5 <= num3)
				{
					num3 = -1;
				}
			}
			if (num == -1)
			{
				return list;
			}
			for (int k = num; k < JSONSchema.Count; k++)
			{
				if (JSONSchema[k].Trim().TrimEnd(new char[1] { ',' }) == "]")
				{
					num2 = k;
					break;
				}
			}
			if (num2 == -1)
			{
				return list;
			}
			for (int l = num; l < num2; l++)
			{
				string text3 = JSONSchema[l].Trim().Trim('"', ',');
				if (!StringExtensions.IsNullOrWhitespace(text3) && !list.Contains(text3))
				{
					list.Add(text3);
				}
			}
			return list;
		}

		private static List<List<string>> GetAllOf(List<string> JSONSchema)
		{
			List<List<string>> list = new List<List<string>>();
			int num = 0;
			int num2 = -1;
			int num3 = -1;
			List<string> list2 = null;
			for (int i = 0; i < JSONSchema.Count; i++)
			{
				string text = JSONSchema[i].Trim();
				if (text.StartsWith("\"allOf\": ["))
				{
					num2 = num;
				}
				else if (text.StartsWith("\"oneOf\": [") && num2 != -1)
				{
					num3 = num;
					list2 = new List<string>();
				}
				else if (text.StartsWith("\"required\": [") && num3 != -1)
				{
					for (int j = i + 1; j < JSONSchema.Count; j++)
					{
						string text2 = JSONSchema[j].Trim();
						if (text2.TrimEnd(new char[1] { ',' }) == "]")
						{
							break;
						}
						string text3 = text2.Trim('"', ',');
						if (!StringExtensions.IsNullOrWhitespace(text3))
						{
							list2?.Add(text3);
						}
					}
				}
				string text4 = text;
				foreach (char c in text4)
				{
					if (c == '{' || c == '[')
					{
						num++;
					}
					else if (c == '}' || c == ']')
					{
						num--;
					}
				}
				if (num3 != -1 && num <= num3)
				{
					if (list2 != null && list2.Count > 0)
					{
						list.Add(list2);
					}
					list2 = null;
					num3 = -1;
				}
				if (num2 != -1 && num <= num2)
				{
					num2 = -1;
				}
			}
			return list;
		}

		private static List<List<string>> GetAlternativeNot(List<string> JSONSchema)
		{
			List<List<string>> list = new List<List<string>>();
			int num = 0;
			int num2 = -1;
			int num3 = -1;
			List<string> list2 = null;
			for (int i = 0; i < JSONSchema.Count; i++)
			{
				string text = JSONSchema[i].Trim();
				if (text.StartsWith("\"allOf\": ["))
				{
					num2 = num;
				}
				else if (text.StartsWith("\"not\": {") && num2 != -1)
				{
					num3 = num;
					list2 = new List<string>();
				}
				else if (text.StartsWith("\"required\": [") && num3 != -1)
				{
					for (int j = i + 1; j < JSONSchema.Count; j++)
					{
						string text2 = JSONSchema[j].Trim();
						if (text2.TrimEnd(new char[1] { ',' }) == "]")
						{
							break;
						}
						string text3 = text2.Trim('"', ',');
						if (!StringExtensions.IsNullOrWhitespace(text3))
						{
							list2?.Add(text3);
						}
					}
				}
				string text4 = text;
				foreach (char c in text4)
				{
					if (c == '{' || c == '[')
					{
						num++;
					}
					else if (c == '}' || c == ']')
					{
						num--;
					}
				}
				if (num3 != -1 && num <= num3)
				{
					if (list2 != null && list2.Count > 0)
					{
						list.Add(list2);
					}
					list2 = null;
					num3 = -1;
				}
				if (num2 != -1 && num <= num2)
				{
					num2 = -1;
				}
			}
			return list;
		}

		private static bool AllowExtraFieldsCheck(List<string> JSONSchema)
		{
			bool result = true;
			foreach (string item in JSONSchema)
			{
				if (item.Contains("\"additionalProperties\": "))
				{
					string text = item.Trim().Replace("\"additionalProperties\": ", "").Trim();
					if (text.StartsWith("{"))
					{
						return true;
					}
					result = bool.Parse(text.Trim('"', ','));
					break;
				}
			}
			return result;
		}

		private static List<string> GetAdditionalPropertiesSchema(List<string> JSONSchema)
		{
			int num = JSONSchema.FindIndex((string x) => x.Trim().StartsWith("\"additionalProperties\": {"));
			if (num == -1)
			{
				return new List<string>();
			}
			List<string> list = new List<string>();
			int num2 = 0;
			bool flag = false;
			for (int num3 = num; num3 < JSONSchema.Count; num3++)
			{
				string text = JSONSchema[num3];
				if (num3 > num)
				{
					list.Add(text);
				}
				string text2 = text;
				for (int num4 = 0; num4 < text2.Length; num4++)
				{
					switch (text2[num4])
					{
					case '{':
						num2++;
						flag = true;
						break;
					case '}':
						num2--;
						break;
					}
				}
				if (flag && num2 == 0)
				{
					break;
				}
			}
			return list;
		}

		private static List<string> DigThroughArrayFindRelevant(string jsonArray)
		{
			if (!jsonArray.Trim().StartsWith("[") || !jsonArray.Trim().EndsWith("]"))
			{
				return new List<string>();
			}
			string text = jsonArray.Trim().Substring(1, jsonArray.Trim().Length - 2).Trim();
			List<string> list = new List<string>();
			int num = 0;
			int num2 = 0;
			for (int i = 0; i < text.Length; i++)
			{
				if (text[i] == '{' || text[i] == '[')
				{
					num2++;
				}
				else if (text[i] == '}' || text[i] == ']')
				{
					num2--;
				}
				if (text[i] == ',' && num2 == 0)
				{
					list.Add(text.Substring(num, i - num).Trim());
					num = i + 1;
				}
			}
			if (num < text.Length)
			{
				list.Add(text.Substring(num).Trim());
			}
			return list;
		}

		private static List<string> DigThroughSchemaFindRelevant(string propertyToFind, List<string> JSONSchema)
		{
			int num = -1;
			foreach (string item in JSONSchema)
			{
				if (item.Trim().StartsWith("\"" + propertyToFind + "\": {"))
				{
					num = JSONSchema.IndexOf(item);
					break;
				}
			}
			List<string> list = new List<string>();
			if (num == -1)
			{
				JSONLoader3.FormatLogger("Warning", "LintingTools", "Could not find " + propertyToFind + " in Schema.");
				return list;
			}
			int num2 = 0;
			bool flag = false;
			for (int i = num; i < JSONSchema.Count; i++)
			{
				string text = JSONSchema[i];
				list.Add(text);
				string text2 = text;
				for (int j = 0; j < text2.Length; j++)
				{
					switch (text2[j])
					{
					case '{':
						num2++;
						flag = true;
						break;
					case '}':
						num2--;
						break;
					}
				}
				if (flag && num2 == 0)
				{
					break;
				}
			}
			return list;
		}

		internal static List<(int depth, string propertyName, string propertyValue)> GetObjectProperties(string jsonObject)
		{
			List<string> list = new List<string> { "{" };
			list.AddRange(jsonObject.Trim().Split(new char[1] { '\n' }));
			list.Add("}");
			List<(int, string, string)> list2 = DisectedJSON(list);
			if (list2.Count == 0)
			{
				return new List<(int, string, string)>();
			}
			int objectDepth = list2[0].Item1;
			return list2.Where<(int, string, string)>(((int depth, string propertyName, string propertyValue) x) => x.depth == objectDepth).ToList();
		}

		internal static List<(int depth, string propertyName, string propertyValue)> GetObjectProperties(string jsonObject, string propertyToFind, string file)
		{
			if (jsonObject.Trim() != "{")
			{
				return GetObjectProperties(jsonObject);
			}
			List<string> list = File.ReadAllLines(file).ToList();
			int num = list.FindIndex((string x) => x.Trim().StartsWith("\"" + propertyToFind + "\":"));
			if (num == -1)
			{
				return new List<(int, string, string)>();
			}
			string text = list[num].Substring(list[num].IndexOf(":") + 1).Trim();
			int num2 = 0;
			string text2 = text;
			for (int num3 = 0; num3 < text2.Length; num3++)
			{
				switch (text2[num3])
				{
				case '{':
					num2++;
					break;
				case '}':
					num2--;
					break;
				}
			}
			while (num2 > 0 && num + 1 < list.Count)
			{
				num++;
				string text3 = list[num].Trim();
				text = text + "\n" + text3;
				string text4 = text3;
				for (int num4 = 0; num4 < text4.Length; num4++)
				{
					switch (text4[num4])
					{
					case '{':
						num2++;
						break;
					case '}':
						num2--;
						break;
					}
				}
			}
			return GetObjectProperties(text.TrimEnd(new char[1] { ',' }));
		}

		internal static List<string> GetArrayItems(string jsonArray, string propertyName, string file)
		{
			if (jsonArray.Trim() != "[")
			{
				return DigThroughArrayFindRelevant(jsonArray);
			}
			List<string> list = File.ReadAllLines(file).ToList();
			int num = list.FindIndex((string x) => x.Trim().StartsWith("\"" + propertyName + "\":"));
			if (num == -1)
			{
				return new List<string>();
			}
			string text = list[num].Substring(list[num].IndexOf(":") + 1).Trim();
			int num2 = 0;
			string text2 = text;
			for (int num3 = 0; num3 < text2.Length; num3++)
			{
				switch (text2[num3])
				{
				case '[':
					num2++;
					break;
				case ']':
					num2--;
					break;
				}
			}
			while (num2 > 0 && num + 1 < list.Count)
			{
				num++;
				string text3 = list[num].Trim();
				text = text + "\n" + text3;
				string text4 = text3;
				for (int num4 = 0; num4 < text4.Length; num4++)
				{
					switch (text4[num4])
					{
					case '[':
						num2++;
						break;
					case ']':
						num2--;
						break;
					}
				}
			}
			return DigThroughArrayFindRelevant(text.TrimEnd(new char[1] { ',' }));
		}

		private static List<List<string>> GetAnyOfSchemas(List<string> JSONSchema)
		{
			List<List<string>> list = new List<List<string>>();
			int num = JSONSchema.FindIndex((string x) => x.Trim().StartsWith("\"anyOf\": ["));
			if (num == -1)
			{
				return list;
			}
			List<string> list2 = null;
			int num2 = 0;
			for (int num3 = num + 1; num3 < JSONSchema.Count; num3++)
			{
				string text = JSONSchema[num3];
				if (text.Trim().StartsWith("{"))
				{
					if (num2 == 0)
					{
						list2 = new List<string>();
					}
					num2++;
				}
				list2?.Add(text);
				if (text.Trim().StartsWith("}"))
				{
					num2--;
					if (num2 == 0 && list2 != null)
					{
						list.Add(list2);
						list2 = null;
					}
				}
				if (text.Trim() == "]" && num2 == 0)
				{
					break;
				}
			}
			return list;
		}

		internal static List<string> GetArrayItems(string jsonArray)
		{
			return DigThroughArrayFindRelevant(jsonArray);
		}

		private static bool ValidatePropertyAgainstSchema(string jsonPropertyName, string jsonPropertyValue, List<string> PropertySchema, string file, string schemaFile, bool validateAnyOf = false)
		{
			string text = "";
			string text2 = "";
			bool flag = false;
			bool flag2 = false;
			List<string> list = new List<string>(PropertySchema);
			foreach (string item in PropertySchema)
			{
				if (PropertySchema.IndexOf(item) == 0)
				{
					list.RemoveAt(0);
				}
				if (item.Contains("\"type\": \"") && !flag)
				{
					text = item.Trim().Replace("\"type\": \"", "").Trim('"', ',');
					list.Remove(item);
					flag = true;
				}
				if (item.Contains("\"description\": \"") && !flag2)
				{
					text2 = item.Trim().Replace("\"description\": \"", "").Trim('"', ',');
					list.Remove(item);
					flag2 = true;
				}
			}
			JSONLoader3.FormatLogger("Summary", "LintingTools", "Property Description for " + jsonPropertyName + " for ease of access.");
			foreach (string item2 in text2.Split(new char[1] { '|' }).ToList())
			{
				JSONLoader3.FormatLogger("Summary", "LintingTools", item2.Trim().Replace("\\\"", "\""));
			}
			if (text == "string" && PropertySchema.Any((string x) => x.Trim().StartsWith("\"anyOf\": [")))
			{
				return ValidateAnyOf(jsonPropertyName, jsonPropertyValue, PropertySchema, file, schemaFile, validateAnyOf);
			}
			switch (text)
			{
			case "string":
				return ValidateString(jsonPropertyName, jsonPropertyValue, list, file, schemaFile, validateAnyOf);
			case "integer":
				return ValidateInteger(jsonPropertyName, jsonPropertyValue, list, file, schemaFile, validateAnyOf);
			case "boolean":
				return ValidateBoolean(jsonPropertyName, jsonPropertyValue, list, file, schemaFile, validateAnyOf);
			case "object":
				return ValidateObject(jsonPropertyName, jsonPropertyValue, list, file, schemaFile, validateAnyOf);
			case "array":
				return ValidateArray(jsonPropertyName, jsonPropertyValue, list, file, schemaFile, validateAnyOf);
			default:
				JSONLoader3.FormatLogger("Warning", "LintingTools", "Could not find " + text + " support for validating " + jsonPropertyName + " within this Item Type for validating against the Schema, notify a maintainer if this is not intentional.");
				return true;
			}
		}

		private static bool ValidateAnyOf(string jsonPropertyName, string jsonPropertyValue, List<string> PropertySchema, string file, string schemaFile, bool validateAnyOf = false)
		{
			List<List<string>> anyOfSchemas = GetAnyOfSchemas(PropertySchema);
			JSONLoader3.FormatLogger("Debug", "LintingTools", $"Found {anyOfSchemas.Count} Branches worth of Validators for validating {jsonPropertyName}. Attempting to validate against all of them, only one needs to pass to succeed.");
			foreach (List<string> item in anyOfSchemas)
			{
				if (ValidatePropertyAgainstSchema(jsonPropertyName, jsonPropertyValue, item, file, schemaFile, DefineConfiguration.HideValidationAnyOfErrors.Value))
				{
					JSONLoader3.FormatLogger("Debug", "LintingTools", "This Validator has succeeded in validating " + jsonPropertyName + " with value of (" + jsonPropertyValue + ")");
					return true;
				}
				JSONLoader3.FormatLogger("Debug", "LintingTools", "This Validator has failed in validating " + jsonPropertyName + " with value of (" + jsonPropertyValue + ")");
			}
			if (!validateAnyOf)
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", "We could not validate " + jsonPropertyName + " against any of the Validators available for " + jsonPropertyName + " ensure your value is valid. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "This error triggers when none of the validators for " + jsonPropertyName + " returned errorless.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "If you want to fix this, check how the Schema is trying to validate " + jsonPropertyName + " and ensure (" + jsonPropertyValue + " is valid against at least one of them.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "You can also find the full Schema here: " + schemaFile);
			}
			return false;
		}

		private static bool ValidateString(string jsonPropertyName, string jsonPropertyValue, List<string> PropertySchema, string file, string schemaFile, bool validateAnyOf = false)
		{
			int num = -1;
			Regex regex = null;
			string text = "";
			List<string> list = new List<string>();
			for (int i = 0; i < PropertySchema.Count; i++)
			{
				string text2 = PropertySchema[i];
				if (text2.Contains("\"minLength\": "))
				{
					num = int.Parse(text2.Trim().Replace("\"minLength\": ", "").Trim('"', ','));
				}
				if (text2.Contains("\"pattern\": \""))
				{
					regex = new Regex(Regex.Unescape(text2.Trim().Replace("\"pattern\": \"", "").Trim('"', ',')));
				}
				if (text2.Contains("\"default\": \""))
				{
					text = text2.Trim().Replace("\"default\": \"", "").Replace(" ", "D")
						.Trim('"', ',');
				}
				if (!text2.Contains("\"enum\": ["))
				{
					continue;
				}
				int num2 = i + 1;
				for (int j = num2; j < PropertySchema.Count; j++)
				{
					string text3 = PropertySchema[j].Trim();
					if (text3.TrimEnd(new char[1] { ',' }) == "]")
					{
						break;
					}
					string text4 = text3.Trim('"', ',');
					if (!StringExtensions.IsNullOrWhitespace(text4))
					{
						list.Add(text4);
					}
				}
				break;
			}
			if (!jsonPropertyValue.StartsWith("\"") || !jsonPropertyValue.EndsWith("\""))
			{
				if (!validateAnyOf)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "Invalid String was Found. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this ensure the Value for this item is properly encases in Quotation marks.");
				}
				return false;
			}
			if (num != -1 && jsonPropertyValue.Trim(new char[1] { '"' }).Length < num)
			{
				if (!validateAnyOf)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", $"The string is shorter than the Minimum Length ({num}) for {jsonPropertyName} according to the Schema for this Item. The JSON this error occured in: {Path.GetFileNameWithoutExtension(file)}");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", $"To fix this just simply extend the length of {jsonPropertyValue} above {num}.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				}
				return false;
			}
			if (regex != null && !regex.IsMatch(jsonPropertyValue.Trim(new char[1] { '"' })))
			{
				if (!validateAnyOf)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", $"The string value for {jsonPropertyName} is invalid based on the Regex specified by the Schema for this item ({regex}). The JSON this error occured in: {Path.GetFileNameWithoutExtension(file)}");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this copy the regex shown above and paste it into the expression box of https://regexr.com/.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Now take your value (" + jsonPropertyValue + ") and put it in the Text Box below it.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "The Regex will be described under tools, so now just edit your value for " + jsonPropertyName + " until it is valid.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Now just paste that value back into your JSON Key associated with " + jsonPropertyName + ", than your set for the next boot.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Keep in mind if it was an image, ensure the image matches that exact name. P.S. If your trying to route folders use '/' after the folders name to go in, and '../' to go in.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				}
				return false;
			}
			if (StringExtensions.IsNullOrWhitespace(text) && StringExtensions.IsNullOrWhitespace(jsonPropertyValue.Trim(new char[1] { '"' })))
			{
				if (!validateAnyOf)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "The string is empty and there is no default value for " + jsonPropertyName + " either define it or remove it. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this simply as the error states remove the KVP for " + jsonPropertyName);
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Alternatively define a value for " + jsonPropertyName + " you can toggle on Summary in The Config to show the Properties Description for further Information about it..");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				}
				return false;
			}
			if (list.Count > 0 && !list.Any((string enumValue) => string.Equals(enumValue.Trim(), jsonPropertyValue.Trim().Trim(new char[1] { '"' }), StringComparison.Ordinal)))
			{
				if (!validateAnyOf)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "The string does not match any of the required Enums for " + jsonPropertyName + " according to the Schema. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this just ensure the " + jsonPropertyName + " matches the actual Enums applicable for this field.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Look at the Description for " + jsonPropertyName + " for a list of possible values for this field.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				}
				return false;
			}
			return true;
		}

		private static bool ValidateInteger(string jsonPropertyName, string jsonPropertyValue, List<string> PropertySchema, string file, string schemaFile, bool validateAnyOf = false)
		{
			int num = -1;
			int num2 = -1;
			int num3 = -1;
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			foreach (string item in PropertySchema)
			{
				if (item.Contains("\"minimum\": "))
				{
					num = int.Parse(item.Trim().Replace("\"minimum\": ", "").Trim('"', ','));
					flag = true;
				}
				if (item.Contains("\"maximum\": "))
				{
					num2 = int.Parse(item.Trim().Replace("\"maximum\": ", "").Trim('"', ','));
					flag2 = true;
				}
				if (item.Contains("\"default\": "))
				{
					num3 = int.Parse(item.Trim().Replace("\"default\": ", "").Trim('"', ','));
					flag3 = true;
				}
			}
			if (jsonPropertyValue.StartsWith("\"") && jsonPropertyValue.EndsWith("\""))
			{
				if (!validateAnyOf)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "Invalid Int was Found. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this ensure the Value for this item is NOT encased in Quotation marks.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				}
				return false;
			}
			if (StringExtensions.IsNullOrWhitespace(jsonPropertyValue) && !flag3)
			{
				if (!validateAnyOf)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "The value is empty and there is no default value for " + jsonPropertyName + " either define it or remove it. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this simply as the error states remove the KVP for " + jsonPropertyName);
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Alternatively define a value for " + jsonPropertyName + " you can toggle on Summary in The Config to show the Properties Description for further Information about it..");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				}
				return false;
			}
			if (!int.TryParse(jsonPropertyValue, out var result))
			{
				if (!validateAnyOf)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "The Value passed in with " + jsonPropertyName + " is not a valid Integer. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "The value associated with " + jsonPropertyName + " did not parse correctly as an Integer, the value being (" + jsonPropertyValue + ")");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				}
				return false;
			}
			if (result > num2 && flag2)
			{
				if (!validateAnyOf)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", $"The value of {jsonPropertyName} is Greater than the Maximum allowed by the Schema for this item, the maximum being {num2}. The JSON this error occured in: {Path.GetFileNameWithoutExtension(file)}");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", $"To fix this simply set the value of {jsonPropertyName} to a Integer less than {num2}.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				}
				return false;
			}
			if (result < num && flag)
			{
				if (!validateAnyOf)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", $"The value of {jsonPropertyName} is Less than the Minimum allowed by the Schema for this item, the minimum being {num}. The JSON this error occured in: {Path.GetFileNameWithoutExtension(file)}");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", $"To fix this simply set the value of {jsonPropertyName} to a Integer greater than {num}.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				}
				return false;
			}
			return true;
		}

		private static bool ValidateBoolean(string jsonPropertyName, string jsonPropertyValue, List<string> PropertySchema, string file, string schemaFile, bool validateAnyOf = false)
		{
			bool flag = false;
			bool flag2 = false;
			foreach (string item in PropertySchema)
			{
				if (item.Contains("\"default\": "))
				{
					flag = bool.Parse(item.Trim().Replace("\"default\": ", "").Trim('"', ','));
					flag2 = true;
				}
			}
			if (jsonPropertyValue.StartsWith("\"") && jsonPropertyValue.EndsWith("\""))
			{
				if (!validateAnyOf)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "Invalid Boolean was Found. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this ensure the Value for this item is NOT encased in Quotation marks.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				}
				return false;
			}
			if (StringExtensions.IsNullOrWhitespace(jsonPropertyValue) && !flag2)
			{
				if (!validateAnyOf)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "The value is empty and there is no default value for " + jsonPropertyName + " either define it or remove it. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this simply as the error states remove the KVP for " + jsonPropertyName);
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Alternatively define a value for " + jsonPropertyName + " you can toggle on Summary in The Config to show the Properties Description for further Information about it..");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				}
				return false;
			}
			if (!bool.TryParse(jsonPropertyValue, out var _))
			{
				if (!validateAnyOf)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "The Value passed in with " + jsonPropertyName + " is not a valid Boolean. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "The value associated with " + jsonPropertyName + " did not parse correctly as an Boolean, the value being (" + jsonPropertyValue + ")");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				}
				return false;
			}
			if (jsonPropertyValue != jsonPropertyValue.ToLower())
			{
				if (!validateAnyOf)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "The Value passed in with " + jsonPropertyName + " did not have the correct casing, the Value (" + jsonPropertyValue + ") must be all lowercase. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this just make sure the value associated with " + jsonPropertyName + " is in full lowercase.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				}
				return false;
			}
			return true;
		}

		private static bool ValidateObject(string jsonPropertyName, string jsonPropertyValue, List<string> PropertySchema, string file, string schemaFile, bool validateAnyOf = false)
		{
			List<(int, string, string)> list;
			if (jsonPropertyValue.Trim() == "{")
			{
				list = GetObjectProperties(jsonPropertyValue, jsonPropertyName, file);
			}
			else if (jsonPropertyValue.Trim().StartsWith("{"))
			{
				List<string> list2 = new List<string>();
				list2.Add("{");
				list2.AddRange(jsonPropertyValue.Trim().Split(new char[1] { '\n' }));
				list2.Add("}");
				list = DisectedJSON(list2);
			}
			else
			{
				List<string> list3 = new List<string>();
				list3.Add("{");
				list3.Add("\"" + jsonPropertyName + "\": " + jsonPropertyValue);
				list3.Add("}");
				list = DisectedJSON(list3);
			}
			if (list.Count == 0)
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", "Could not dissect object for " + jsonPropertyName + ". The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
				return false;
			}
			int item = list[0].Item1;
			if (!jsonPropertyValue.Trim().StartsWith("{"))
			{
				list = list.Where<(int, string, string)>(((int depth, string propertyName, string propertyValue) x) => x.propertyName != jsonPropertyName).ToList();
			}
			List<(int, string, string)> jSONSchemaProperties = DisectedJSON(PropertySchema);
			List<string> requiredFromSchema = GetRequiredFromSchema(PropertySchema);
			List<List<string>> allOf = GetAllOf(PropertySchema);
			List<List<string>> alternativeNot = GetAlternativeNot(PropertySchema);
			List<(string, bool)> list4 = new List<(string, bool)>();
			List<(string, bool)> list5 = new List<(string, bool)>();
			foreach (string item3 in requiredFromSchema)
			{
				list5.Add((item3, false));
			}
			foreach (List<string> item4 in allOf)
			{
				foreach (string item5 in item4)
				{
					list4.Add((item5, false));
				}
			}
			JSONLoader3.FormatLogger("Debug", "LintingTools", "Required Fields: " + string.Join(", ", requiredFromSchema));
			foreach (List<string> item6 in allOf)
			{
				JSONLoader3.FormatLogger("Debug