Decompiled source of YapBack v0.9.0

GDWeave/mods/Toes.YapBack/YapBack.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using GDWeave;
using GDWeave.Godot;
using GDWeave.Godot.Variants;
using GDWeave.Modding;
using YapBack.util.LexicalTransformer;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("Toes")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("Socks")]
[assembly: AssemblyTitle("YapBack")]
[assembly: AssemblyVersion("0.0.1.0")]
[module: RefSafetyRules(11)]
namespace YapBack
{
	public class Mod : IMod, global::System.IDisposable
	{
		public Mod(IModInterface mi)
		{
			mi.RegisterScriptMod((IScriptMod)(object)new TransformationRuleScriptModBuilder().ForMod(mi).Named("YapBack - Network Patch").Patching("res://Scenes/Singletons/SteamNetwork.gdc")
				.AddRule(new TransformationRuleBuilder().Named("Line number override").Matching(TransformationPatternFactory.CreateGdSnippetPattern("var max_chat_length = 128")).With("+ 3968", 1u))
				.Build());
			mi.RegisterScriptMod((IScriptMod)(object)new TransformationRuleScriptModBuilder().ForMod(mi).Named("YapBackk - PlayerHud Patches").Patching("res://Scenes/HUD/playerhud.gdc")
				.AddRule(new TransformationRuleBuilder().Named("Scroll bar restore").Matching(TransformationPatternFactory.CreateGdSnippetPattern("gamechat.scroll_active = using_chat")).With("\r\ngamechat.scroll_active = chat_timer > 0\r\n", 1u))
				.AddRule(new TransformationRuleBuilder().Named("Auto scroll pause").Matching(TransformationPatternFactory.CreateGdSnippetPattern("chat.placeholder_text = \"Type to chat!\"")).With("\r\ngamechat.scroll_following = false\r\n", 4u))
				.AddRule(new TransformationRuleBuilder().Named("Auto scroll resume").Matching(TransformationPatternFactory.CreateGdSnippetPattern("chat.selecting_enabled = false")).With("\r\ngamechat.scroll_following = true\r\ngamechat.scroll_to_line(gamechat.get_line_count() - 1)\r\n", 1u))
				.Build());
		}

		public void Dispose()
		{
		}
	}
}
namespace YapBack.util
{
	public static class ScriptTokenizer
	{
		[StructLayout(3)]
		[CompilerGenerated]
		private struct <>c__DisplayClass6_0
		{
			public string previous;

			public global::System.Collections.Generic.IEnumerator<string> enumerator;

			public List<Token> finalTokens;

			public List<Token> toFlush;

			public string idName;
		}

		[StructLayout(3)]
		[CompilerGenerated]
		private struct <>c__DisplayClass8_0
		{
			public StringBuilder builder;
		}

		[CompilerGenerated]
		private sealed class <SanitizeInput>d__7 : global::System.Collections.Generic.IEnumerable<string>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<string>, global::System.Collections.IEnumerator, global::System.IDisposable
		{
			private int <>1__state;

			private string <>2__current;

			private int <>l__initialThreadId;

			private global::System.Collections.Generic.IEnumerable<string> tokens;

			public global::System.Collections.Generic.IEnumerable<string> <>3__tokens;

			private global::System.Collections.Generic.IEnumerator<string> <>s__1;

			private string <token>5__2;

			string global::System.Collections.Generic.IEnumerator<string>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object global::System.Collections.IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <SanitizeInput>d__7(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void global::System.IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num != -3 && num != 1)
				{
					return;
				}
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}

			private bool MoveNext()
			{
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>s__1 = tokens.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						<token>5__2 = null;
						break;
					}
					while (((global::System.Collections.IEnumerator)<>s__1).MoveNext())
					{
						<token>5__2 = <>s__1.Current;
						if (<token>5__2 != "\n" && string.IsNullOrWhiteSpace(<token>5__2))
						{
							continue;
						}
						<>2__current = <token>5__2;
						<>1__state = 1;
						return true;
					}
					<>m__Finally1();
					<>s__1 = null;
					return false;
				}
				catch
				{
					//try-fault
					((global::System.IDisposable)this).Dispose();
					throw;
				}
			}

			bool global::System.Collections.IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>s__1 != null)
				{
					((global::System.IDisposable)<>s__1).Dispose();
				}
			}

			[DebuggerHidden]
			void global::System.Collections.IEnumerator.Reset()
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			global::System.Collections.Generic.IEnumerator<string> global::System.Collections.Generic.IEnumerable<string>.GetEnumerator()
			{
				<SanitizeInput>d__7 <SanitizeInput>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<SanitizeInput>d__ = this;
				}
				else
				{
					<SanitizeInput>d__ = new <SanitizeInput>d__7(0);
				}
				<SanitizeInput>d__.tokens = <>3__tokens;
				return <SanitizeInput>d__;
			}

			[DebuggerHidden]
			global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
			{
				return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<string>)this).GetEnumerator();
			}
		}

		[CompilerGenerated]
		private sealed class <Tokenize>d__6 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
		{
			private int <>1__state;

			private Token <>2__current;

			private int <>l__initialThreadId;

			private string gdScript;

			public string <>3__gdScript;

			private uint baseIndent;

			public uint <>3__baseIndent;

			private <>c__DisplayClass6_0 <>8__1;

			private global::System.Collections.Generic.IEnumerable<string> <tokens>5__2;

			private bool <reparse>5__3;

			private TokenType <type>5__4;

			private bool <resultB>5__5;

			private string <found>5__6;

			private bool <foundFull>5__7;

			private string <current>5__8;

			private Enumerator<Token> <>s__9;

			private Token <t>5__10;

			Token global::System.Collections.Generic.IEnumerator<Token>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object global::System.Collections.IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Tokenize>d__6(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void global::System.IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num != -3 && num != 1)
				{
					return;
				}
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}

			private bool MoveNext()
			{
				//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0404: Unknown result type (might be due to invalid IL or missing references)
				//IL_0464: Unknown result type (might be due to invalid IL or missing references)
				//IL_0250: Unknown result type (might be due to invalid IL or missing references)
				//IL_025a: Expected O, but got Unknown
				//IL_029f: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b8: Expected O, but got Unknown
				//IL_0322: Unknown result type (might be due to invalid IL or missing references)
				//IL_032c: Expected O, but got Unknown
				//IL_0327: Unknown result type (might be due to invalid IL or missing references)
				//IL_0331: Expected O, but got Unknown
				//IL_0376: Unknown result type (might be due to invalid IL or missing references)
				//IL_0380: Expected O, but got Unknown
				//IL_037b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0385: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>8__1.finalTokens = new List<Token>();
						<tokens>5__2 = SanitizeInput(TokenizeString(gdScript + " "));
						<>8__1.previous = string.Empty;
						<>8__1.idName = string.Empty;
						<>8__1.toFlush = new List<Token>(2);
						<>8__1.enumerator = <tokens>5__2.GetEnumerator();
						<reparse>5__3 = false;
						while (<reparse>5__3 || ((global::System.Collections.IEnumerator)<>8__1.enumerator).MoveNext())
						{
							<reparse>5__3 = false;
							if (<>8__1.enumerator.Current == "\n")
							{
								InsertNewLine(<>8__1.enumerator, baseIndent, <>8__1.toFlush);
								<Tokenize>g__endAndFlushId|6_1(ref <>8__1);
							}
							else if (<>8__1.enumerator.Current == "_")
							{
								BuildIdentifierName(<>8__1.enumerator, <>8__1.toFlush, out <found>5__6);
								if (<found>5__6 == string.Empty)
								{
									<Tokenize>g__endAndFlushId|6_1(ref <>8__1);
									continue;
								}
								<>8__1.idName += <found>5__6;
								<Tokenize>g__end|6_0(ref <>8__1);
							}
							else if (char.IsDigit(<>8__1.enumerator.Current[0]))
							{
								BuildNumber(<>8__1.enumerator, <>8__1.toFlush, out <foundFull>5__7);
								<reparse>5__3 = !<foundFull>5__7;
								<Tokenize>g__endAndFlushId|6_1(ref <>8__1);
							}
							else if (BuiltinFunctions.Contains(<>8__1.enumerator.Current))
							{
								<>8__1.toFlush.Add(new Token((TokenType)5, (uint?)(uint)BuiltinFunctions.IndexOf(<>8__1.enumerator.Current)));
								<Tokenize>g__endAndFlushId|6_1(ref <>8__1);
							}
							else if (Tokens.TryGetValue(<>8__1.enumerator.Current, ref <type>5__4))
							{
								<>8__1.toFlush.Add(new Token(<type>5__4, (uint?)null));
								<Tokenize>g__endAndFlushId|6_1(ref <>8__1);
							}
							else if (<>8__1.enumerator.Current.StartsWith('"'))
							{
								<current>5__8 = <>8__1.enumerator.Current;
								<>8__1.toFlush.Add((Token)new ConstantToken((Variant)new StringVariant(<current>5__8.Substring(1, <current>5__8.Length - 2))));
								<Tokenize>g__endAndFlushId|6_1(ref <>8__1);
							}
							else if (bool.TryParse(<>8__1.enumerator.Current, ref <resultB>5__5))
							{
								<>8__1.toFlush.Add((Token)new ConstantToken((Variant)new BoolVariant(<resultB>5__5)));
								<Tokenize>g__endAndFlushId|6_1(ref <>8__1);
							}
							else
							{
								<>8__1.idName += <>8__1.enumerator.Current;
								<Tokenize>g__end|6_0(ref <>8__1);
							}
						}
						<>s__9 = <>8__1.finalTokens.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						<t>5__10 = null;
						break;
					}
					if (<>s__9.MoveNext())
					{
						<t>5__10 = <>s__9.Current;
						<>2__current = <t>5__10;
						<>1__state = 1;
						return true;
					}
					<>m__Finally1();
					<>s__9 = default(Enumerator<Token>);
					return false;
				}
				catch
				{
					//try-fault
					((global::System.IDisposable)this).Dispose();
					throw;
				}
			}

			bool global::System.Collections.IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				((global::System.IDisposable)<>s__9).Dispose();
			}

			[DebuggerHidden]
			void global::System.Collections.IEnumerator.Reset()
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
			{
				<Tokenize>d__6 <Tokenize>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Tokenize>d__ = this;
				}
				else
				{
					<Tokenize>d__ = new <Tokenize>d__6(0);
				}
				<Tokenize>d__.gdScript = <>3__gdScript;
				<Tokenize>d__.baseIndent = <>3__baseIndent;
				return <Tokenize>d__;
			}

			[DebuggerHidden]
			global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
			{
				return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
			}
		}

		[CompilerGenerated]
		private sealed class <TokenizeString>d__8 : global::System.Collections.Generic.IEnumerable<string>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<string>, global::System.Collections.IEnumerator, global::System.IDisposable
		{
			private int <>1__state;

			private string <>2__current;

			private int <>l__initialThreadId;

			private string text;

			public string <>3__text;

			private <>c__DisplayClass8_0 <>8__1;

			private int <i>5__2;

			private bool <matched>5__3;

			private char <>s__4;

			private int <start>5__5;

			private Enumerator<string> <>s__6;

			private string <delimiter>5__7;

			string global::System.Collections.Generic.IEnumerator<string>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object global::System.Collections.IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <TokenizeString>d__8(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void global::System.IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num != -3 && (uint)(num - 6) > 1u)
				{
					return;
				}
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}

			private bool MoveNext()
			{
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Expected O, but got Unknown
				//IL_0396: Unknown result type (might be due to invalid IL or missing references)
				//IL_02be: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>8__1.builder = new StringBuilder(20);
						<i>5__2 = 0;
						goto IL_0423;
					case 1:
						<>1__state = -1;
						<>8__1.builder.Append('"');
						<i>5__2++;
						while (<i>5__2 < text.Length)
						{
							<>8__1.builder.Append(text[<i>5__2]);
							if (text[<i>5__2] == '"')
							{
								break;
							}
							<i>5__2++;
						}
						<>2__current = <TokenizeString>g__ClearBuilder|8_0(ref <>8__1);
						<>1__state = 2;
						return true;
					case 2:
						<>1__state = -1;
						goto IL_0411;
					case 3:
						<>1__state = -1;
						<start>5__5 = <i>5__2;
						<i>5__2++;
						while (<i>5__2 < text.Length && text[<i>5__2] == '\t')
						{
							<i>5__2++;
						}
						<i>5__2--;
						<>2__current = "\n";
						<>1__state = 4;
						return true;
					case 4:
						<>1__state = -1;
						<>2__current = $"{<i>5__2 - <start>5__5}";
						<>1__state = 5;
						return true;
					case 5:
						<>1__state = -1;
						goto IL_0411;
					case 6:
						<>1__state = -3;
						<>2__current = <delimiter>5__7;
						<>1__state = 7;
						return true;
					case 7:
						<>1__state = -3;
						<i>5__2 += <delimiter>5__7.Length - 1;
						<matched>5__3 = true;
						goto IL_0389;
					case 8:
						<>1__state = -1;
						goto IL_0411;
					case 9:
						{
							<>1__state = -1;
							return false;
						}
						IL_0423:
						if (<i>5__2 < text.Length)
						{
							char c = text[<i>5__2];
							<>s__4 = c;
							switch (<>s__4)
							{
							case '"':
								<>2__current = <TokenizeString>g__ClearBuilder|8_0(ref <>8__1);
								<>1__state = 1;
								return true;
							case '\n':
								<>2__current = <TokenizeString>g__ClearBuilder|8_0(ref <>8__1);
								<>1__state = 3;
								return true;
							}
							<matched>5__3 = false;
							<>s__6 = Symbols.GetEnumerator();
							<>1__state = -3;
							while (<>s__6.MoveNext())
							{
								<delimiter>5__7 = <>s__6.Current;
								if (Match(text, <i>5__2, <delimiter>5__7))
								{
									<>2__current = <TokenizeString>g__ClearBuilder|8_0(ref <>8__1);
									<>1__state = 6;
									return true;
								}
								<delimiter>5__7 = null;
							}
							goto IL_0389;
						}
						<>2__current = "\n";
						<>1__state = 9;
						return true;
						IL_0411:
						<i>5__2++;
						goto IL_0423;
						IL_0389:
						<>m__Finally1();
						<>s__6 = default(Enumerator<string>);
						if (!<matched>5__3)
						{
							if (text[<i>5__2] == ' ')
							{
								<>2__current = <TokenizeString>g__ClearBuilder|8_0(ref <>8__1);
								<>1__state = 8;
								return true;
							}
							<>8__1.builder.Append(text[<i>5__2]);
						}
						goto IL_0411;
					}
				}
				catch
				{
					//try-fault
					((global::System.IDisposable)this).Dispose();
					throw;
				}
			}

			bool global::System.Collections.IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				((global::System.IDisposable)<>s__6).Dispose();
			}

			[DebuggerHidden]
			void global::System.Collections.IEnumerator.Reset()
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			global::System.Collections.Generic.IEnumerator<string> global::System.Collections.Generic.IEnumerable<string>.GetEnumerator()
			{
				<TokenizeString>d__8 <TokenizeString>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<TokenizeString>d__ = this;
				}
				else
				{
					<TokenizeString>d__ = new <TokenizeString>d__8(0);
				}
				<TokenizeString>d__.text = <>3__text;
				return <TokenizeString>d__;
			}

			[DebuggerHidden]
			global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
			{
				return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<string>)this).GetEnumerator();
			}
		}

		private static readonly Dictionary<string, TokenType> Tokens;

		private static readonly HashSet<string> Symbols;

		private static readonly List<string> BuiltinFunctions;

		private static void InsertNewLine(global::System.Collections.Generic.IEnumerator<string> enumerator, uint baseIndent, List<Token> toFlush)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			if (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				uint num = uint.Parse(enumerator.Current);
				toFlush.Add(new Token((TokenType)89, (uint?)(num + baseIndent)));
			}
		}

		private static void BuildIdentifierName(global::System.Collections.Generic.IEnumerator<string> enumerator, List<Token> toFlush, out string? found)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			found = string.Empty;
			if (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				if (enumerator.Current == ":")
				{
					toFlush.Add(new Token((TokenType)92, (uint?)null));
					toFlush.Add(new Token((TokenType)83, (uint?)null));
				}
				else
				{
					found = "_" + enumerator.Current;
				}
			}
		}

		private static void BuildNumber(global::System.Collections.Generic.IEnumerator<string> enumerator, List<Token> toFlush, out bool foundFull)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Expected O, but got Unknown
			foundFull = true;
			int num = 1;
			if (enumerator.Current == "-")
			{
				num = -1;
				if (!((global::System.Collections.IEnumerator)enumerator).MoveNext())
				{
					return;
				}
			}
			long num2 = default(long);
			if (!long.TryParse(enumerator.Current, ref num2))
			{
				toFlush.Add(new Token((TokenType)17, (uint?)null));
				foundFull = false;
			}
			else if (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				long num3 = default(long);
				if (enumerator.Current != ".")
				{
					toFlush.Add((Token)new ConstantToken((Variant)new IntVariant(num2 * num, false)));
					foundFull = false;
				}
				else if (((global::System.Collections.IEnumerator)enumerator).MoveNext() && long.TryParse(enumerator.Current, ref num3))
				{
					double num4 = (double)num2 + (double)num3 / Math.Pow(10.0, (double)num3.ToString().Length);
					toFlush.Add((Token)new ConstantToken((Variant)new RealVariant(num4 * (double)num, false)));
				}
			}
		}

		[IteratorStateMachine(typeof(<Tokenize>d__6))]
		public static global::System.Collections.Generic.IEnumerable<Token> Tokenize(string gdScript, uint baseIndent = 0u)
		{
			List<Token> finalTokens = new List<Token>();
			global::System.Collections.Generic.IEnumerable<string> tokens = SanitizeInput(TokenizeString(gdScript + " "));
			string previous = string.Empty;
			string idName = string.Empty;
			List<Token> toFlush = new List<Token>(2);
			global::System.Collections.Generic.IEnumerator<string> enumerator = tokens.GetEnumerator();
			bool reparse = false;
			TokenType type = default(TokenType);
			bool resultB = default(bool);
			while (reparse || ((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				reparse = false;
				if (enumerator.Current == "\n")
				{
					InsertNewLine(enumerator, baseIndent, toFlush);
					endAndFlushId();
				}
				else if (enumerator.Current == "_")
				{
					BuildIdentifierName(enumerator, toFlush, out string found);
					if (found == string.Empty)
					{
						endAndFlushId();
						continue;
					}
					idName += found;
					end();
				}
				else if (char.IsDigit(enumerator.Current[0]))
				{
					BuildNumber(enumerator, toFlush, out var foundFull);
					reparse = !foundFull;
					endAndFlushId();
				}
				else if (BuiltinFunctions.Contains(enumerator.Current))
				{
					toFlush.Add(new Token((TokenType)5, (uint?)(uint)BuiltinFunctions.IndexOf(enumerator.Current)));
					endAndFlushId();
				}
				else if (Tokens.TryGetValue(enumerator.Current, ref type))
				{
					toFlush.Add(new Token(type, (uint?)null));
					endAndFlushId();
				}
				else if (enumerator.Current.StartsWith('"'))
				{
					string current = enumerator.Current;
					toFlush.Add((Token)new ConstantToken((Variant)new StringVariant(current.Substring(1, current.Length - 2))));
					endAndFlushId();
				}
				else if (bool.TryParse(enumerator.Current, ref resultB))
				{
					toFlush.Add((Token)new ConstantToken((Variant)new BoolVariant(resultB)));
					endAndFlushId();
				}
				else
				{
					idName += enumerator.Current;
					end();
				}
			}
			Enumerator<Token> enumerator2 = finalTokens.GetEnumerator();
			try
			{
				while (enumerator2.MoveNext())
				{
					yield return enumerator2.Current;
				}
			}
			finally
			{
				((global::System.IDisposable)enumerator2).Dispose();
			}
			[CompilerGenerated]
			void end()
			{
				previous = enumerator.Current;
				finalTokens.AddRange((global::System.Collections.Generic.IEnumerable<Token>)toFlush);
				toFlush.Clear();
			}
			[CompilerGenerated]
			void endAndFlushId()
			{
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Expected O, but got Unknown
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Expected O, but got Unknown
				//IL_027a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0284: Expected O, but got Unknown
				//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e0: Expected O, but got Unknown
				//IL_0329: Unknown result type (might be due to invalid IL or missing references)
				//IL_0333: 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_0362: Unknown result type (might be due to invalid IL or missing references)
				//IL_036c: Expected O, but got Unknown
				//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_02fe: Expected O, but got Unknown
				//IL_030e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0318: Expected O, but got Unknown
				//IL_0254: Unknown result type (might be due to invalid IL or missing references)
				//IL_025e: Expected O, but got Unknown
				//IL_0259: Unknown result type (might be due to invalid IL or missing references)
				//IL_0263: Expected O, but got Unknown
				//IL_0344: Unknown result type (might be due to invalid IL or missing references)
				//IL_034e: Expected O, but got Unknown
				//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c3: Expected O, but got Unknown
				//IL_029b: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a5: Expected O, but got Unknown
				if (idName != string.Empty)
				{
					if (idName.Trim() == "return")
					{
						finalTokens.Add(new Token((TokenType)46, (uint?)null));
					}
					else if (idName.Trim() == "self")
					{
						finalTokens.Add(new Token((TokenType)3, (uint?)null));
					}
					else
					{
						string text = idName.Trim();
						string text2 = text;
						switch (<PrivateImplementationDetails>.ComputeStringHash(text2))
						{
						case 372738696u:
							if (text2 == "print")
							{
								finalTokens.Add(new Token((TokenType)5, (uint?)63u));
								break;
							}
							goto default;
						case 1996966820u:
							if (text2 == "null")
							{
								finalTokens.Add((Token)new ConstantToken((Variant)new NilVariant()));
								break;
							}
							goto default;
						case 3378807160u:
							if (text2 == "break")
							{
								finalTokens.Add(new Token((TokenType)43, (uint?)null));
								break;
							}
							goto default;
						case 2116038550u:
							if (text2 == "match")
							{
								finalTokens.Add(new Token((TokenType)47, (uint?)null));
								break;
							}
							goto default;
						case 3853794552u:
							if (text2 == "Color")
							{
								finalTokens.Add(new Token((TokenType)4, (uint?)14u));
								break;
							}
							goto default;
						case 2214621635u:
							if (text2 == "Vector3")
							{
								finalTokens.Add(new Token((TokenType)4, (uint?)7u));
								break;
							}
							goto default;
						case 3383926728u:
							if (text2 == "lerp_angle")
							{
								finalTokens.Add(new Token((TokenType)5, (uint?)31u));
								break;
							}
							goto default;
						case 2515107422u:
							if (text2 == "int")
							{
								finalTokens.Add(new Token((TokenType)4, (uint?)2u));
								break;
							}
							goto default;
						case 1479764693u:
							if (text2 == "pow")
							{
								finalTokens.Add(new Token((TokenType)5, (uint?)19u));
								break;
							}
							goto default;
						case 709362235u:
							if (text2 == "abs")
							{
								finalTokens.Add(new Token((TokenType)5, (uint?)17u));
								break;
							}
							goto default;
						default:
							finalTokens.Add((Token)new IdentifierToken(idName.Trim()));
							break;
						}
					}
					idName = string.Empty;
				}
				end();
			}
		}

		[IteratorStateMachine(typeof(<SanitizeInput>d__7))]
		private static global::System.Collections.Generic.IEnumerable<string> SanitizeInput(global::System.Collections.Generic.IEnumerable<string> tokens)
		{
			global::System.Collections.Generic.IEnumerator<string> enumerator = tokens.GetEnumerator();
			try
			{
				while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
				{
					string token = enumerator.Current;
					if (!(token != "\n") || !string.IsNullOrWhiteSpace(token))
					{
						yield return token;
					}
				}
			}
			finally
			{
				((global::System.IDisposable)enumerator)?.Dispose();
			}
		}

		[IteratorStateMachine(typeof(<TokenizeString>d__8))]
		private static global::System.Collections.Generic.IEnumerable<string> TokenizeString(string text)
		{
			StringBuilder builder = new StringBuilder(20);
			for (int j = 0; j < text.Length; j++)
			{
				switch (text[j])
				{
				case '"':
					yield return ClearBuilder();
					builder.Append('"');
					for (j++; j < text.Length; j++)
					{
						builder.Append(text[j]);
						if (text[j] == '"')
						{
							break;
						}
					}
					yield return ClearBuilder();
					continue;
				case '\n':
				{
					yield return ClearBuilder();
					int start = j;
					for (j++; j < text.Length && text[j] == '\t'; j++)
					{
					}
					j--;
					yield return "\n";
					yield return $"{j - start}";
					continue;
				}
				}
				bool matched = false;
				Enumerator<string> enumerator = Symbols.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						string delimiter = enumerator.Current;
						if (Match(text, j, delimiter))
						{
							yield return ClearBuilder();
							yield return delimiter;
							j += delimiter.Length - 1;
							matched = true;
							break;
						}
					}
				}
				finally
				{
					((global::System.IDisposable)enumerator).Dispose();
				}
				if (!matched)
				{
					if (text[j] == ' ')
					{
						yield return ClearBuilder();
					}
					else
					{
						builder.Append(text[j]);
					}
				}
			}
			yield return "\n";
			[CompilerGenerated]
			string ClearBuilder()
			{
				string result = ((object)builder).ToString();
				builder.Clear();
				return result;
			}
		}

		private static bool Match(string text, int index, string match)
		{
			if (index + match.Length > text.Length)
			{
				return false;
			}
			for (int i = 0; i < match.Length; i++)
			{
				if (text[index + i] != match[i])
				{
					return false;
				}
			}
			return true;
		}

		static ScriptTokenizer()
		{
			Dictionary<string, TokenType> obj = new Dictionary<string, TokenType>();
			obj.Add("continue", (TokenType)44);
			obj.Add("return", (TokenType)46);
			obj.Add("break", (TokenType)43);
			obj.Add("match", (TokenType)47);
			obj.Add("while", (TokenType)42);
			obj.Add("elif", (TokenType)39);
			obj.Add("else", (TokenType)40);
			obj.Add("pass", (TokenType)45);
			obj.Add("for", (TokenType)41);
			obj.Add("if", (TokenType)38);
			obj.Add("const", (TokenType)58);
			obj.Add("var", (TokenType)59);
			obj.Add("func", (TokenType)48);
			obj.Add("class", (TokenType)49);
			obj.Add("extends", (TokenType)51);
			obj.Add("is", (TokenType)52);
			obj.Add("as", (TokenType)60);
			obj.Add("onready", (TokenType)53);
			obj.Add("@tool", (TokenType)54);
			obj.Add("@export", (TokenType)56);
			obj.Add("yield", (TokenType)65);
			obj.Add("setget", (TokenType)57);
			obj.Add("static", (TokenType)55);
			obj.Add("void", (TokenType)61);
			obj.Add("enum", (TokenType)62);
			obj.Add("preload", (TokenType)63);
			obj.Add("assert", (TokenType)64);
			obj.Add("signal", (TokenType)66);
			obj.Add("breakpoint", (TokenType)67);
			obj.Add("sync", (TokenType)69);
			obj.Add("remote", (TokenType)68);
			obj.Add("master", (TokenType)70);
			obj.Add("slave", (TokenType)71);
			obj.Add("puppet", (TokenType)72);
			obj.Add("remotesync", (TokenType)73);
			obj.Add("mastersync", (TokenType)74);
			obj.Add("puppetsync", (TokenType)75);
			obj.Add("\n", (TokenType)89);
			obj.Add("PI", (TokenType)90);
			obj.Add("TAU", (TokenType)91);
			obj.Add("INF", (TokenType)93);
			obj.Add("NAN", (TokenType)94);
			obj.Add("error", (TokenType)95);
			obj.Add("cursor", (TokenType)97);
			obj.Add("self", (TokenType)3);
			obj.Add("in", (TokenType)6);
			obj.Add("_", (TokenType)92);
			obj.Add("[", (TokenType)76);
			obj.Add("]", (TokenType)77);
			obj.Add("{", (TokenType)78);
			obj.Add("}", (TokenType)79);
			obj.Add("(", (TokenType)80);
			obj.Add(")", (TokenType)81);
			obj.Add(",", (TokenType)82);
			obj.Add(";", (TokenType)83);
			obj.Add(".", (TokenType)84);
			obj.Add("?", (TokenType)85);
			obj.Add(":", (TokenType)86);
			obj.Add("$", (TokenType)87);
			obj.Add("->", (TokenType)88);
			obj.Add(">>=", (TokenType)30);
			obj.Add("<<=", (TokenType)29);
			obj.Add(">>", (TokenType)22);
			obj.Add("<<", (TokenType)21);
			obj.Add("==", (TokenType)7);
			obj.Add("!=", (TokenType)8);
			obj.Add("&&", (TokenType)13);
			obj.Add("||", (TokenType)14);
			obj.Add("!", (TokenType)15);
			obj.Add("+=", (TokenType)24);
			obj.Add("-=", (TokenType)25);
			obj.Add("*=", (TokenType)26);
			obj.Add("/=", (TokenType)27);
			obj.Add("%=", (TokenType)28);
			obj.Add("&=", (TokenType)31);
			obj.Add("|=", (TokenType)32);
			obj.Add("^=", (TokenType)33);
			obj.Add("+", (TokenType)16);
			obj.Add("-", (TokenType)17);
			obj.Add("*", (TokenType)18);
			obj.Add("/", (TokenType)19);
			obj.Add("%", (TokenType)20);
			obj.Add("~", (TokenType)37);
			obj.Add("&", (TokenType)34);
			obj.Add("|", (TokenType)35);
			obj.Add("^", (TokenType)36);
			obj.Add("<=", (TokenType)10);
			obj.Add(">=", (TokenType)12);
			obj.Add("<", (TokenType)9);
			obj.Add(">", (TokenType)11);
			obj.Add("=", (TokenType)23);
			Tokens = obj;
			HashSet<string> obj2 = new HashSet<string>();
			obj2.Add("->");
			obj2.Add(">>=");
			obj2.Add("<<=");
			obj2.Add(">>");
			obj2.Add("<<");
			obj2.Add("==");
			obj2.Add("!=");
			obj2.Add("&&");
			obj2.Add("||");
			obj2.Add("!");
			obj2.Add("+=");
			obj2.Add("-=");
			obj2.Add("*=");
			obj2.Add("/=");
			obj2.Add("%=");
			obj2.Add("&=");
			obj2.Add("|=");
			obj2.Add("^=");
			obj2.Add("_");
			obj2.Add("[");
			obj2.Add("]");
			obj2.Add("{");
			obj2.Add("}");
			obj2.Add("(");
			obj2.Add(")");
			obj2.Add(",");
			obj2.Add(";");
			obj2.Add(".");
			obj2.Add("?");
			obj2.Add(":");
			obj2.Add("$");
			obj2.Add("+");
			obj2.Add("-");
			obj2.Add("*");
			obj2.Add("/");
			obj2.Add("%");
			obj2.Add("~");
			obj2.Add("&");
			obj2.Add("|");
			obj2.Add("^");
			obj2.Add("<=");
			obj2.Add(">=");
			obj2.Add("<");
			obj2.Add(">");
			obj2.Add("=");
			Symbols = obj2;
			BuiltinFunctions = Enumerable.ToList<string>((global::System.Collections.Generic.IEnumerable<string>)global::System.Enum.GetNames<BuiltinFunction>());
		}

		[CompilerGenerated]
		internal static void <Tokenize>g__end|6_0(ref <>c__DisplayClass6_0 P_0)
		{
			P_0.previous = P_0.enumerator.Current;
			P_0.finalTokens.AddRange((global::System.Collections.Generic.IEnumerable<Token>)P_0.toFlush);
			P_0.toFlush.Clear();
		}

		[CompilerGenerated]
		internal static void <Tokenize>g__endAndFlushId|6_1(ref <>c__DisplayClass6_0 P_0)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Expected O, but got Unknown
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Expected O, but got Unknown
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: 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_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Expected O, but got Unknown
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Expected O, but got Unknown
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Expected O, but got Unknown
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Expected O, but got Unknown
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Expected O, but got Unknown
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Expected O, but got Unknown
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Expected O, but got Unknown
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Expected O, but got Unknown
			if (P_0.idName != string.Empty)
			{
				if (P_0.idName.Trim() == "return")
				{
					P_0.finalTokens.Add(new Token((TokenType)46, (uint?)null));
				}
				else if (P_0.idName.Trim() == "self")
				{
					P_0.finalTokens.Add(new Token((TokenType)3, (uint?)null));
				}
				else
				{
					string text = P_0.idName.Trim();
					string text2 = text;
					switch (<PrivateImplementationDetails>.ComputeStringHash(text2))
					{
					case 372738696u:
						if (!(text2 == "print"))
						{
							goto default;
						}
						P_0.finalTokens.Add(new Token((TokenType)5, (uint?)63u));
						break;
					case 1996966820u:
						if (!(text2 == "null"))
						{
							goto default;
						}
						P_0.finalTokens.Add((Token)new ConstantToken((Variant)new NilVariant()));
						break;
					case 3378807160u:
						if (!(text2 == "break"))
						{
							goto default;
						}
						P_0.finalTokens.Add(new Token((TokenType)43, (uint?)null));
						break;
					case 2116038550u:
						if (!(text2 == "match"))
						{
							goto default;
						}
						P_0.finalTokens.Add(new Token((TokenType)47, (uint?)null));
						break;
					case 3853794552u:
						if (!(text2 == "Color"))
						{
							goto default;
						}
						P_0.finalTokens.Add(new Token((TokenType)4, (uint?)14u));
						break;
					case 2214621635u:
						if (!(text2 == "Vector3"))
						{
							goto default;
						}
						P_0.finalTokens.Add(new Token((TokenType)4, (uint?)7u));
						break;
					case 3383926728u:
						if (!(text2 == "lerp_angle"))
						{
							goto default;
						}
						P_0.finalTokens.Add(new Token((TokenType)5, (uint?)31u));
						break;
					case 2515107422u:
						if (!(text2 == "int"))
						{
							goto default;
						}
						P_0.finalTokens.Add(new Token((TokenType)4, (uint?)2u));
						break;
					case 1479764693u:
						if (!(text2 == "pow"))
						{
							goto default;
						}
						P_0.finalTokens.Add(new Token((TokenType)5, (uint?)19u));
						break;
					case 709362235u:
						if (!(text2 == "abs"))
						{
							goto default;
						}
						P_0.finalTokens.Add(new Token((TokenType)5, (uint?)17u));
						break;
					default:
						P_0.finalTokens.Add((Token)new IdentifierToken(P_0.idName.Trim()));
						break;
					}
				}
				P_0.idName = string.Empty;
			}
			<Tokenize>g__end|6_0(ref P_0);
		}

		[CompilerGenerated]
		internal static string <TokenizeString>g__ClearBuilder|8_0(ref <>c__DisplayClass8_0 P_0)
		{
			string result = ((object)P_0.builder).ToString();
			P_0.builder.Clear();
			return result;
		}
	}
}
namespace YapBack.util.LexicalTransformer
{
	public static class TransformationPatternFactory
	{
		public static Func<Token, bool>[] CreateGlobalsPattern()
		{
			return new Func<Token, bool>[3]
			{
				(Token t) => (int)t.Type == 51,
				(Token t) => (int)t.Type == 1,
				(Token t) => (int)t.Type == 89
			};
		}

		public static Func<Token, bool>[] CreateFunctionDefinitionPattern(string name, string[]? args = null)
		{
			string name2 = name;
			List<Func<Token, bool>> val = new List<Func<Token, bool>>();
			val.Add((Func<Token, bool>)((Token t) => (int)t.Type == 48));
			val.Add((Func<Token, bool>)delegate(Token t)
			{
				IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val3 != null && val3.Name == name2;
			});
			val.Add((Func<Token, bool>)((Token t) => (int)t.Type == 80));
			if (args != null && args.Length > 0)
			{
				foreach (string arg in args)
				{
					val.Add((Func<Token, bool>)delegate(Token t)
					{
						IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
						return val2 != null && val2.Name == arg;
					});
					val.Add((Func<Token, bool>)((Token t) => (int)t.Type == 82));
				}
				val.RemoveAt(val.Count - 1);
			}
			val.Add((Func<Token, bool>)((Token t) => (int)t.Type == 81));
			val.Add((Func<Token, bool>)((Token t) => (int)t.Type == 86));
			return val.ToArray();
		}

		public static Func<Token, bool>[] CreateGdSnippetPattern(string snippet, uint indent = 0u)
		{
			global::System.Collections.Generic.IEnumerable<Token> enumerable = ScriptTokenizer.Tokenize(snippet, indent);
			return Enumerable.ToArray<Func<Token, bool>>(Enumerable.Select<Token, Func<Token, bool>>(enumerable, (Func<Token, Func<Token, bool>>)((Token snippetToken) => delegate(Token t)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Invalid comparison between Unknown and I4
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Invalid comparison between Unknown and I4
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				int result;
				if ((int)t.Type == 1)
				{
					Token obj = snippetToken;
					IdentifierToken val = (IdentifierToken)(object)((obj is IdentifierToken) ? obj : null);
					if (val != null)
					{
						IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
						if (val2 != null)
						{
							result = ((val.Name == val2.Name) ? 1 : 0);
							goto IL_003c;
						}
					}
					result = 0;
					goto IL_003c;
				}
				if ((int)t.Type != 2)
				{
					return t.Type == snippetToken.Type;
				}
				Token obj2 = snippetToken;
				ConstantToken val3 = (ConstantToken)(object)((obj2 is ConstantToken) ? obj2 : null);
				int result2;
				if (val3 != null)
				{
					ConstantToken val4 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
					if (val4 != null)
					{
						result2 = (val3.Value.Equals(val4.Value) ? 1 : 0);
						goto IL_0082;
					}
				}
				result2 = 0;
				goto IL_0082;
				IL_0082:
				return (byte)result2 != 0;
				IL_003c:
				return (byte)result != 0;
			})));
		}
	}
	public enum Operation
	{
		None,
		ReplaceAll,
		ReplaceLast,
		Append,
		Prepend
	}
	public static class OperationExtensions
	{
		public static bool RequiresBuffer(this Operation operation)
		{
			if (operation == Operation.ReplaceAll || operation == Operation.Prepend)
			{
				return true;
			}
			return false;
		}

		public static bool YieldTokenBeforeOperation(this Operation operation)
		{
			if (operation == Operation.None || operation == Operation.Append)
			{
				return true;
			}
			return false;
		}

		public static bool YieldTokenAfterOperation(this Operation operation)
		{
			return !operation.RequiresBuffer() && !operation.YieldTokenBeforeOperation() && operation != Operation.ReplaceLast;
		}
	}
	public record TransformationRule(string Name, Func<Token, bool>[] Pattern, Func<Token, bool>[] ScopePattern, global::System.Collections.Generic.IEnumerable<Token> Tokens, Operation Operation, uint Times, Func<bool> Predicate)
	{
		[CompilerGenerated]
		protected virtual global::System.Type EqualityContract
		{
			[CompilerGenerated]
			get
			{
				return typeof(TransformationRule);
			}
		}

		public MultiTokenWaiter CreateMultiTokenWaiter()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			return new MultiTokenWaiter(Pattern, false, false);
		}

		public MultiTokenWaiter CreateMultiTokenWaiterForScope()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			return new MultiTokenWaiter(ScopePattern, false, false);
		}

		[CompilerGenerated]
		public override string ToString()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			StringBuilder val = new StringBuilder();
			val.Append("TransformationRule");
			val.Append(" { ");
			if (PrintMembers(val))
			{
				val.Append(' ');
			}
			val.Append('}');
			return ((object)val).ToString();
		}

		[CompilerGenerated]
		protected virtual bool PrintMembers(StringBuilder builder)
		{
			RuntimeHelpers.EnsureSufficientExecutionStack();
			builder.Append("Name = ");
			builder.Append((object)Name);
			builder.Append(", Pattern = ");
			builder.Append((object)Pattern);
			builder.Append(", ScopePattern = ");
			builder.Append((object)ScopePattern);
			builder.Append(", Tokens = ");
			builder.Append((object)Tokens);
			builder.Append(", Operation = ");
			builder.Append(((object)Operation).ToString());
			builder.Append(", Times = ");
			builder.Append(((object)Times).ToString());
			builder.Append(", Predicate = ");
			builder.Append((object)Predicate);
			return true;
		}

		[CompilerGenerated]
		public virtual bool Equals(TransformationRule? other)
		{
			return (object)this == other || ((object)other != null && EqualityContract == other.EqualityContract && EqualityComparer<string>.Default.Equals(Name, other.Name) && EqualityComparer<Func<Token, bool>[]>.Default.Equals(Pattern, other.Pattern) && EqualityComparer<Func<Token, bool>[]>.Default.Equals(ScopePattern, other.ScopePattern) && EqualityComparer<global::System.Collections.Generic.IEnumerable<Token>>.Default.Equals(Tokens, other.Tokens) && EqualityComparer<Operation>.Default.Equals(Operation, other.Operation) && EqualityComparer<uint>.Default.Equals(Times, other.Times) && EqualityComparer<Func<bool>>.Default.Equals(Predicate, other.Predicate));
		}
	}
	public class TransformationRuleBuilder
	{
		private string? _name;

		private Func<Token, bool>[]? _pattern;

		private Func<Token, bool>[] _scopePattern = global::System.Array.Empty<Func<Token, bool>>();

		private global::System.Collections.Generic.IEnumerable<Token>? _tokens;

		private uint _times = 1u;

		private Operation _operation = Operation.Append;

		private Func<bool> _predicate = () => true;

		public TransformationRuleBuilder Named(string name)
		{
			_name = name;
			return this;
		}

		public TransformationRuleBuilder Matching(Func<Token, bool>[] pattern)
		{
			_pattern = pattern;
			return this;
		}

		public TransformationRuleBuilder With(global::System.Collections.Generic.IEnumerable<Token> tokens)
		{
			_tokens = tokens;
			return this;
		}

		public TransformationRuleBuilder With(Token token)
		{
			_tokens = new <>z__ReadOnlySingleElementList<Token>(token);
			return this;
		}

		public TransformationRuleBuilder With(string snippet, uint indent = 0u)
		{
			_tokens = ScriptTokenizer.Tokenize(snippet, indent);
			return this;
		}

		public TransformationRuleBuilder Do(Operation operation)
		{
			_operation = operation;
			return this;
		}

		public TransformationRuleBuilder ExpectTimes(uint times)
		{
			_times = times;
			return this;
		}

		public TransformationRuleBuilder ScopedTo(Func<Token, bool>[] scopePattern)
		{
			_scopePattern = scopePattern;
			return this;
		}

		public TransformationRuleBuilder When(Func<bool> predicate)
		{
			_predicate = predicate;
			return this;
		}

		public TransformationRuleBuilder When(bool eligible)
		{
			_predicate = () => eligible;
			return this;
		}

		public TransformationRule Build()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(_name))
			{
				throw new ArgumentNullException("_name", "Name cannot be null or empty");
			}
			if (_pattern == null)
			{
				throw new ArgumentNullException("_pattern", "Pattern cannot be null");
			}
			if (_tokens == null)
			{
				throw new ArgumentNullException("_tokens", "Tokens cannot be null");
			}
			return new TransformationRule(_name, _pattern, _scopePattern, _tokens, _operation, _times, _predicate);
		}
	}
	public class TransformationRuleScriptMod : IScriptMod
	{
		[CompilerGenerated]
		[DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		private IModInterface <mod>P;

		[CompilerGenerated]
		[DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		private string <name>P;

		[CompilerGenerated]
		[DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		private string <scriptPath>P;

		[CompilerGenerated]
		[DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		private Func<bool> <predicate>P;

		[CompilerGenerated]
		[DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		private TransformationRule[] <rules>P;

		public TransformationRuleScriptMod(IModInterface mod, string name, string scriptPath, Func<bool> predicate, TransformationRule[] rules)
		{
			<mod>P = mod;
			<name>P = name;
			<scriptPath>P = scriptPath;
			<predicate>P = predicate;
			<rules>P = rules;
			base..ctor();
		}

		public bool ShouldRun(string path)
		{
			if (path != <scriptPath>P)
			{
				return false;
			}
			if (!<predicate>P.Invoke())
			{
				<mod>P.Logger.Warning(string.Concat(Enumerable.Repeat<string>("!", 15)));
				<mod>P.Logger.Warning("[" + <name>P + "] Predicate failed!!!!!!, not patching.");
				<mod>P.Logger.Warning(string.Concat(Enumerable.Repeat<string>("!", 15)));
				return false;
			}
			return true;
		}

		public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
		{
			//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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Invalid comparison between Unknown and I4
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Invalid comparison between Unknown and I4
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			List<TransformationRule> val = Enumerable.ToList<TransformationRule>(Enumerable.Where<TransformationRule>((global::System.Collections.Generic.IEnumerable<TransformationRule>)<rules>P, (Func<TransformationRule, bool>)([CompilerGenerated] (TransformationRule rule) =>
			{
				bool flag4 = rule.Predicate.Invoke();
				if (!flag4)
				{
					<mod>P.Logger.Information($"[{<name>P}] Skipping patch {rule.Name}...");
				}
				return flag4;
			})));
			List<ValueTuple<TransformationRule, MultiTokenWaiter, List<Token>>> val2 = Enumerable.ToList<ValueTuple<TransformationRule, MultiTokenWaiter, List<Token>>>(Enumerable.Select<TransformationRule, ValueTuple<TransformationRule, MultiTokenWaiter, List<Token>>>((global::System.Collections.Generic.IEnumerable<TransformationRule>)val, (Func<TransformationRule, ValueTuple<TransformationRule, MultiTokenWaiter, List<Token>>>)((TransformationRule rule) => new ValueTuple<TransformationRule, MultiTokenWaiter, List<Token>>(rule, rule.CreateMultiTokenWaiter(), new List<Token>()))));
			<mod>P.Logger.Information("[" + <name>P + "] Patching " + path);
			Dictionary<string, ValueTuple<int, uint>> val3 = Enumerable.ToDictionary<TransformationRule, string, ValueTuple<int, uint>>((global::System.Collections.Generic.IEnumerable<TransformationRule>)val, (Func<TransformationRule, string>)((TransformationRule r) => r.Name), (Func<TransformationRule, ValueTuple<int, uint>>)((TransformationRule r) => new ValueTuple<int, uint>(0, r.Times)));
			bool flag = true;
			List<Token> val4 = new List<Token>();
			val4.AddRange(tokens);
			List<Token> val5 = new List<Token>();
			Enumerator<ValueTuple<TransformationRule, MultiTokenWaiter, List<Token>>> enumerator = val2.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					ValueTuple<TransformationRule, MultiTokenWaiter, List<Token>> current = enumerator.Current;
					bool flag2 = current.Item1.ScopePattern.Length != 0;
					bool flag3 = !flag2;
					uint? num = null;
					MultiTokenWaiter val6 = current.Item1.CreateMultiTokenWaiterForScope();
					Enumerator<Token> enumerator2 = val4.GetEnumerator();
					try
					{
						while (enumerator2.MoveNext())
						{
							Token current2 = enumerator2.Current;
							if (flag3 && flag2)
							{
								if (!num.HasValue && (int)current2.Type == 89)
								{
									num = current2.AssociatedData.GetValueOrDefault();
								}
								else if (num.HasValue && (int)current2.Type == 89)
								{
									flag3 = current2.AssociatedData.GetValueOrDefault() >= num;
								}
							}
							else if (flag2 && val6.Check(current2))
							{
								val6.Reset();
								flag3 = true;
							}
							if (!flag3)
							{
								val5.Add(current2);
								continue;
							}
							current.Item2.Check(current2);
							if (current.Item2.Step == 0)
							{
								val5.AddRange((global::System.Collections.Generic.IEnumerable<Token>)current.Item3);
								current.Item3.Clear();
							}
							else
							{
								if (current.Item1.Operation.RequiresBuffer())
								{
									current.Item3.Add(current2);
									flag = false;
								}
								if (current.Item2.Matched)
								{
									current.Item2.Reset();
									if (current.Item1.Operation.YieldTokenBeforeOperation())
									{
										val5.Add(current2);
										flag = false;
									}
									else
									{
										flag = current.Item1.Operation.YieldTokenAfterOperation();
									}
									switch (current.Item1.Operation)
									{
									case Operation.Prepend:
										val5.AddRange(current.Item1.Tokens);
										val5.AddRange((global::System.Collections.Generic.IEnumerable<Token>)current.Item3);
										current.Item3.Clear();
										break;
									case Operation.ReplaceAll:
									case Operation.ReplaceLast:
									case Operation.Append:
										current.Item3.Clear();
										val5.AddRange(current.Item1.Tokens);
										break;
									}
									<mod>P.Logger.Information($"[{<name>P}] Patch {current.Item1.Name} OK!");
									string name = current.Item1.Name;
									ValueTuple<int, uint> val7 = val3[current.Item1.Name];
									val7.Item1 = val3[current.Item1.Name].Item1 + 1;
									val3[name] = val7;
								}
							}
							if (flag)
							{
								val5.Add(current2);
							}
							else
							{
								flag = true;
							}
						}
					}
					finally
					{
						((global::System.IDisposable)enumerator2).Dispose();
					}
					val4.Clear();
					val4.AddRange((global::System.Collections.Generic.IEnumerable<Token>)val5);
					val5.Clear();
				}
			}
			finally
			{
				((global::System.IDisposable)enumerator).Dispose();
			}
			global::System.Collections.Generic.IEnumerator<KeyValuePair<string, ValueTuple<int, uint>>> enumerator3 = Enumerable.Where<KeyValuePair<string, ValueTuple<int, uint>>>((global::System.Collections.Generic.IEnumerable<KeyValuePair<string, ValueTuple<int, uint>>>)val3, (Func<KeyValuePair<string, ValueTuple<int, uint>>, bool>)((KeyValuePair<string, ValueTuple<int, uint>> result) => result.Value.Item1 != result.Value.Item2)).GetEnumerator();
			try
			{
				while (((global::System.Collections.IEnumerator)enumerator3).MoveNext())
				{
					KeyValuePair<string, ValueTuple<int, uint>> current3 = enumerator3.Current;
					<mod>P.Logger.Error($"[{<name>P}] Patch {current3.Key} FAILED!!!!!!! Times expected={current3.Value.Item2}, actual={current3.Value.Item1}");
				}
			}
			finally
			{
				((global::System.IDisposable)enumerator3)?.Dispose();
			}
			return (global::System.Collections.Generic.IEnumerable<Token>)val4;
		}
	}
	public class TransformationRuleScriptModBuilder
	{
		private IModInterface? _mod;

		private string? _name;

		private string? _scriptPath;

		private Func<bool> _predicate = () => true;

		private List<TransformationRule> _rules = new List<TransformationRule>();

		public TransformationRuleScriptModBuilder ForMod(IModInterface mod)
		{
			_mod = mod;
			return this;
		}

		public TransformationRuleScriptModBuilder When(Func<bool> predicate)
		{
			_predicate = predicate;
			return this;
		}

		public TransformationRuleScriptModBuilder Named(string name)
		{
			_name = name;
			return this;
		}

		public TransformationRuleScriptModBuilder Patching(string scriptPath)
		{
			_scriptPath = scriptPath;
			return this;
		}

		public TransformationRuleScriptModBuilder AddRule(TransformationRule rule)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			if (Enumerable.Contains<string>(Enumerable.Select<TransformationRule, string>((global::System.Collections.Generic.IEnumerable<TransformationRule>)_rules, (Func<TransformationRule, string>)((TransformationRule r) => r.Name)), rule.Name))
			{
				throw new InvalidOperationException("Another rule with the name '" + rule.Name + "' already exists!");
			}
			_rules.Add(rule);
			return this;
		}

		public TransformationRuleScriptModBuilder AddRule(TransformationRuleBuilder rule)
		{
			return AddRule(rule.Build());
		}

		public TransformationRuleScriptMod Build()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (_mod == null)
			{
				throw new ArgumentNullException("_mod", "Mod cannot be null");
			}
			if (string.IsNullOrEmpty(_name))
			{
				throw new ArgumentNullException("_name", "Name cannot be null or empty");
			}
			if (string.IsNullOrEmpty(_scriptPath))
			{
				throw new ArgumentNullException("_scriptPath", "Script path cannot be null or empty");
			}
			return new TransformationRuleScriptMod(_mod, _name, _scriptPath, _predicate, _rules.ToArray());
		}
	}
}
namespace YapBack.Patches
{
	public class PlayerTokensMod : IScriptMod
	{
		[CompilerGenerated]
		private sealed class <Modify>d__3 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
		{
			private int <>1__state;

			private Token <>2__current;

			private int <>l__initialThreadId;

			private string path;

			public string <>3__path;

			private global::System.Collections.Generic.IEnumerable<Token> tokens;

			public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;

			public PlayerTokensMod <>4__this;

			private MultiTokenWaiter <waiter>5__1;

			private global::System.Collections.Generic.IEnumerator<Token> <>s__2;

			private Token <token>5__3;

			Token global::System.Collections.Generic.IEnumerator<Token>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object global::System.Collections.IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Modify>d__3(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void global::System.IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num != -3 && (uint)(num - 1) > 3u)
				{
					return;
				}
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}

			private bool MoveNext()
			{
				//IL_0158: Unknown result type (might be due to invalid IL or missing references)
				//IL_0162: Expected O, but got Unknown
				//IL_0180: Unknown result type (might be due to invalid IL or missing references)
				//IL_018a: Expected O, but got Unknown
				//IL_0185: Unknown result type (might be due to invalid IL or missing references)
				//IL_018f: Expected O, but got Unknown
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e3: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<waiter>5__1 = new MultiTokenWaiter(new Func<Token, bool>[4]
						{
							(Token t) => (int)t.Type == 59,
							delegate(Token t)
							{
								IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val3 != null && val3.Name == "max_chat_length";
							},
							(Token t) => (int)t.Type == 23,
							delegate(Token t)
							{
								ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
								int result;
								if (val != null)
								{
									Variant value = val.Value;
									IntVariant val2 = (IntVariant)(object)((value is IntVariant) ? value : null);
									if (val2 != null)
									{
										result = ((val2.Value == 128) ? 1 : 0);
										goto IL_002a;
									}
								}
								result = 0;
								goto IL_002a;
								IL_002a:
								return (byte)result != 0;
							}
						}, false, false);
						<>s__2 = tokens.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						<>2__current = new Token((TokenType)16, (uint?)null);
						<>1__state = 2;
						return true;
					case 2:
						<>1__state = -3;
						<>2__current = (Token)new ConstantToken((Variant)new IntVariant(3968L, false));
						<>1__state = 3;
						return true;
					case 3:
						<>1__state = -3;
						goto IL_01c6;
					case 4:
						{
							<>1__state = -3;
							goto IL_01c6;
						}
						IL_01c6:
						<token>5__3 = null;
						break;
					}
					if (((global::System.Collections.IEnumerator)<>s__2).MoveNext())
					{
						<token>5__3 = <>s__2.Current;
						if (<waiter>5__1.Check(<token>5__3))
						{
							<>2__current = <token>5__3;
							<>1__state = 1;
							return true;
						}
						<>2__current = <token>5__3;
						<>1__state = 4;
						return true;
					}
					<>m__Finally1();
					<>s__2 = null;
					return false;
				}
				catch
				{
					//try-fault
					((global::System.IDisposable)this).Dispose();
					throw;
				}
			}

			bool global::System.Collections.IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>s__2 != null)
				{
					((global::System.IDisposable)<>s__2).Dispose();
				}
			}

			[DebuggerHidden]
			void global::System.Collections.IEnumerator.Reset()
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
			{
				<Modify>d__3 <Modify>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Modify>d__ = this;
				}
				else
				{
					<Modify>d__ = new <Modify>d__3(0)
					{
						<>4__this = <>4__this
					};
				}
				<Modify>d__.path = <>3__path;
				<Modify>d__.tokens = <>3__tokens;
				return <Modify>d__;
			}

			[DebuggerHidden]
			global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
			{
				return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
			}
		}

		private IModInterface mi;

		public PlayerTokensMod(IModInterface mi)
		{
			mi.Logger.Information("incoming");
			this.mi = mi;
		}

		public bool ShouldRun(string path)
		{
			return path == "res://Scenes/Singletons/SteamNetwork.gdc";
		}

		[IteratorStateMachine(typeof(<Modify>d__3))]
		public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
		{
			MultiTokenWaiter waiter = new MultiTokenWaiter(new Func<Token, bool>[4]
			{
				(Token t) => (int)t.Type == 59,
				delegate(Token t)
				{
					IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val3 != null && val3.Name == "max_chat_length";
				},
				(Token t) => (int)t.Type == 23,
				delegate(Token t)
				{
					ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
					int result;
					if (val != null)
					{
						Variant value = val.Value;
						IntVariant val2 = (IntVariant)(object)((value is IntVariant) ? value : null);
						if (val2 != null)
						{
							result = ((val2.Value == 128) ? 1 : 0);
							goto IL_002a;
						}
					}
					result = 0;
					goto IL_002a;
					IL_002a:
					return (byte)result != 0;
				}
			}, false, false);
			global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
			try
			{
				while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
				{
					Token token = enumerator.Current;
					if (waiter.Check(token))
					{
						yield return token;
						yield return new Token((TokenType)16, (uint?)null);
						yield return (Token)new ConstantToken((Variant)new IntVariant(3968L, false));
					}
					else
					{
						yield return token;
					}
				}
			}
			finally
			{
				((global::System.IDisposable)enumerator)?.Dispose();
			}
		}
	}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlySingleElementList<T> : global::System.Collections.IEnumerable, global::System.Collections.ICollection, global::System.Collections.IList, global::System.Collections.Generic.IEnumerable<T>, global::System.Collections.Generic.IReadOnlyCollection<T>, global::System.Collections.Generic.IReadOnlyList<T>, global::System.Collections.Generic.ICollection<T>, global::System.Collections.Generic.IList<T>
{
	private sealed class Enumerator : global::System.IDisposable, global::System.Collections.IEnumerator, global::System.Collections.Generic.IEnumerator<T>
	{
		object global::System.Collections.IEnumerator.Current => _item;

		T global::System.Collections.Generic.IEnumerator<T>.Current => _item;

		public Enumerator(T item)
		{
			_item = item;
		}

		bool global::System.Collections.IEnumerator.MoveNext()
		{
			return !_moveNextCalled && (_moveNextCalled = true);
		}

		void global::System.Collections.IEnumerator.Reset()
		{
			_moveNextCalled = false;
		}

		void global::System.IDisposable.Dispose()
		{
		}
	}

	int global::System.Collections.ICollection.Count => 1;

	bool global::System.Collections.ICollection.IsSynchronized => false;

	object global::System.Collections.ICollection.SyncRoot => this;

	object global::System.Collections.IList.this[int index]
	{
		get
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}
	}

	bool global::System.Collections.IList.IsFixedSize => true;

	bool global::System.Collections.IList.IsReadOnly => true;

	int global::System.Collections.Generic.IReadOnlyCollection<T>.Count => 1;

	T global::System.Collections.Generic.IReadOnlyList<T>.this[int index]
	{
		get
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
	}

	int global::System.Collections.Generic.ICollection<T>.Count => 1;

	bool global::System.Collections.Generic.ICollection<T>.IsReadOnly => true;

	T global::System.Collections.Generic.IList<T>.this[int index]
	{
		get
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlySingleElementList(T item)
	{
		_item = item;
	}

	global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
	{
		return new Enumerator(_item);
	}

	void global::System.Collections.ICollection.CopyTo(global::System.Array array, int index)
	{
		array.SetValue((object)_item, index);
	}

	int global::System.Collections.IList.Add(object? value)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	void global::System.Collections.IList.Clear()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	bool global::System.Collections.IList.Contains(object? value)
	{
		return EqualityComparer<T>.Default.Equals(_item, (T)value);
	}

	int global::System.Collections.IList.IndexOf(object? value)
	{
		return (!EqualityComparer<T>.Default.Equals(_item, (T)value)) ? (-1) : 0;
	}

	void global::System.Collections.IList.Insert(int index, object? value)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	void global::System.Collections.IList.Remove(object? value)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	void global::System.Collections.IList.RemoveAt(int index)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	global::System.Collections.Generic.IEnumerator<T> global::System.Collections.Generic.IEnumerable<T>.GetEnumerator()
	{
		return new Enumerator(_item);
	}

	void global::System.Collections.Generic.ICollection<T>.Add(T item)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	void global::System.Collections.Generic.ICollection<T>.Clear()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	bool global::System.Collections.Generic.ICollection<T>.Contains(T item)
	{
		return EqualityComparer<T>.Default.Equals(_item, item);
	}

	void global::System.Collections.Generic.ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		array[arrayIndex] = _item;
	}

	bool global::System.Collections.Generic.ICollection<T>.Remove(T item)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	int global::System.Collections.Generic.IList<T>.IndexOf(T item)
	{
		return (!EqualityComparer<T>.Default.Equals(_item, item)) ? (-1) : 0;
	}

	void global::System.Collections.Generic.IList<T>.Insert(int index, T item)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	void global::System.Collections.Generic.IList<T>.RemoveAt(int index)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}
}