diff --git a/.editorconfig b/.editorconfig index 90a488a..568cc40 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,3 @@ - [*] # Microsoft .NET properties diff --git a/Benchmarks/Benchmarks.cs b/Benchmarks/Benchmarks.cs new file mode 100644 index 0000000..a07ce1d --- /dev/null +++ b/Benchmarks/Benchmarks.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; +using System.IO; +using BenchmarkDotNet.Attributes; +using Bite.Compiler; +using Bite.Runtime.CodeGen; + +namespace Benchmarks +{ + +public class Benchmarks +{ + private readonly Dictionary < string, BiteProgram > programs = new Dictionary < string, BiteProgram >(); + + #region Public + + public Benchmarks() + { + IEnumerable < string > files = Directory.EnumerateFiles( + ".\\Benchmarks", + "*.bite", + SearchOption.AllDirectories ); + + foreach ( string file in files ) + { + string name = Path.GetFileNameWithoutExtension( file ); + BiteCompiler compiler = new BiteCompiler(); + programs.Add( name, compiler.Compile( new[] { File.ReadAllText( file ) } ) ); + } + } + + [Benchmark] + public void RunFibonacci() + { + programs["Fibonacci"].Run(); + } + + [Benchmark] + public void RunPrime() + { + programs["Prime"].Run(); + } + + #endregion +} + +public class Bar +{ + public int i; + public float f; + public double d; + + public int I { get; set; } + + public float F { get; set; } + + public double D { get; set; } +} + +} diff --git a/Benchmarks/MethodInvocation.cs b/Benchmarks/MethodInvocation.cs new file mode 100644 index 0000000..a34d3c0 --- /dev/null +++ b/Benchmarks/MethodInvocation.cs @@ -0,0 +1,86 @@ +using System; +using System.Reflection; +using BenchmarkDotNet.Attributes; +using Bite.Runtime.Functions.ForeignInterface; +using Bite.Runtime.Functions.Interop; +using Bite.Runtime.Memory; + +namespace Benchmarks +{ + +public class MethodInvocationBenchmarks +{ + private readonly TypeRegistry typeRegistry = new TypeRegistry(); + private readonly ForeignLibraryInterfaceVm fli; + private readonly InteropGetMethod interop; + private readonly MethodInvoker m_MethodInvoker; + private readonly TestClass instance; + private readonly MethodInfo method; + + #region Public + + public MethodInvocationBenchmarks() + { + typeRegistry.RegisterType < TestClass >(); + fli = new ForeignLibraryInterfaceVm( typeRegistry ); + interop = new InteropGetMethod( typeRegistry ); + instance = new TestClass(); + + Type type = Type.GetType( "Benchmarks.TestClass, Benchmarks" ); + method = type.GetMethod( "TestMethod", new[] { typeof( string ), typeof( int ), typeof( float ) } ); + + m_MethodInvoker = ( MethodInvoker ) interop.Call( new DynamicBiteVariable[] + { + new DynamicBiteVariable( "TestClass" ), + new DynamicBiteVariable( "TestMethod" ), + new DynamicBiteVariable( "string" ), + new DynamicBiteVariable( "int" ), + new DynamicBiteVariable( "float" ), + } ); + } + + [Benchmark] + public void RunForeignLibraryInterfaceVm() + { + fli.Call( new DynamicBiteVariable[] + { + new DynamicBiteVariable( instance ), + new DynamicBiteVariable( "TestMethod" ), + new DynamicBiteVariable( "Hello" ), + new DynamicBiteVariable( "string" ), + new DynamicBiteVariable( 1 ), + new DynamicBiteVariable( "int" ), + new DynamicBiteVariable( 2f ), + new DynamicBiteVariable( "float" ), + } ); + } + + [Benchmark] + public void RunReflection() + { + method.Invoke( instance, new object[] { "Hello", 1, 2f } ); + } + + [Benchmark] + public void RunInteropGetMethod() + { + m_MethodInvoker.Call( new DynamicBiteVariable[] + { + new DynamicBiteVariable( instance ), + new DynamicBiteVariable( "Hello" ), + new DynamicBiteVariable( 1 ), + new DynamicBiteVariable( 2f ), + } ); + } + + + [Benchmark] + public void RunNative() + { + instance.TestMethod( "Hello", 1, 2f ); + } + + #endregion +} + +} diff --git a/Benchmarks/Program.cs b/Benchmarks/Program.cs index c258e2d..0267748 100644 --- a/Benchmarks/Program.cs +++ b/Benchmarks/Program.cs @@ -1,50 +1,8 @@ -using System.Collections.Generic; -using System.IO; -using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Running; -using Bite.Compiler; -using Bite.Runtime; -using Bite.Runtime.CodeGen; +using BenchmarkDotNet.Running; namespace Benchmarks { -public class Benchmarks -{ - private readonly Dictionary < string, BiteProgram > programs = new Dictionary < string, BiteProgram >(); - - #region Public - - public Benchmarks() - { - IEnumerable < string > files = Directory.EnumerateFiles( - ".\\Benchmarks", - "*.bite", - SearchOption.AllDirectories ); - - foreach ( string file in files ) - { - string name = Path.GetFileNameWithoutExtension( file ); - BiteCompiler compiler = new BiteCompiler(); - programs.Add( name, compiler.Compile( new[] { File.ReadAllText( file ) } ) ); - } - } - - [Benchmark] - public void RunFibonacci() - { - programs["Fibonacci"].Run(); - } - - [Benchmark] - public void RunPrime() - { - programs["Prime"].Run(); - } - - #endregion -} - internal class Program { #region Private @@ -52,11 +10,15 @@ internal class Program private static void Main( string[] args ) { //var b = new Benchmarks(); - - BenchmarkRunner.Run < Benchmarks >(); + // BenchmarkRunner.Run < Benchmarks >(); + //BenchmarkRunner.Run < TypeRegistryBenchmarks >(); + //BenchmarkRunner.Run < PropertyAccessBenchmarks >(); + BenchmarkRunner.Run < MethodInvocationBenchmarks >(); + //var b = new MethodInvocationBenchmarks(); + //b.RunForeignLibraryInterfaceVm(); } - #endregion -} + #endregion + } } diff --git a/Benchmarks/PropertyAccessBenchmarks.cs b/Benchmarks/PropertyAccessBenchmarks.cs new file mode 100644 index 0000000..db09aca --- /dev/null +++ b/Benchmarks/PropertyAccessBenchmarks.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; +using BenchmarkDotNet.Attributes; +using Bite.Compiler; +using Bite.Runtime.CodeGen; + +namespace Benchmarks +{ + +public class PropertyAccessBenchmarks +{ + private readonly string statements = @"module Main; + + class foo { + var x = 5; + var y = 2; + } + + var a = 1; + var b = new foo(); + + a += 2; + b.x += 2; + b[""y""] += 3; + + bar.i += 1; + bar.f += 2; + bar.d += 3; + + bar.I += 4; + bar.F += 5; + bar.D += 6; + "; + + private readonly BiteProgram program; + + #region Public + + public PropertyAccessBenchmarks() + { + Bar bar = new Bar(); + + BiteCompiler compiler = new BiteCompiler(); + program = compiler.Compile( new[] { statements } ); + } + + [Benchmark] + public void ArithmeticAssignment() + { + program.Run( new Dictionary < string, object > { { "bar", new Bar() } } ); + } + + #endregion +} + +} diff --git a/Benchmarks/TestClass.cs b/Benchmarks/TestClass.cs new file mode 100644 index 0000000..4756bdc --- /dev/null +++ b/Benchmarks/TestClass.cs @@ -0,0 +1,16 @@ +namespace Benchmarks +{ + +public class TestClass +{ + #region Public + + public int TestMethod( string arg1, int arg2, float arg3 ) + { + return arg2; + } + + #endregion +} + +} diff --git a/Benchmarks/TypeRegistryBenchmarks.cs b/Benchmarks/TypeRegistryBenchmarks.cs new file mode 100644 index 0000000..82feb40 --- /dev/null +++ b/Benchmarks/TypeRegistryBenchmarks.cs @@ -0,0 +1,53 @@ +using System; +using System.Reflection; +using BenchmarkDotNet.Attributes; +using Bite.Runtime.Functions.ForeignInterface; + +namespace Benchmarks +{ + +public class TypeRegistryBenchmarks +{ + private readonly TypeRegistry typeRegistry = new TypeRegistry(); + + #region Public + + public TypeRegistryBenchmarks() + { + typeRegistry.RegisterType < TestClass >(); + } + + [Benchmark] + public void RunCachedGetmethod() + { + typeRegistry.TryResolveType( "TestClass", out Type type ); + + MethodInfo method = typeRegistry.GetMethod( + type, + "TestMethod", + new[] { typeof( string ), typeof( int ), typeof( float ) } ); + + TestClass instance = new TestClass(); + method.Invoke( instance, new object[] { "Hello", 1, 2f } ); + } + + [Benchmark] + public void RunGetMethod() + { + Type type = Type.GetType( "Benchmarks.TestClass, Benchmarks" ); + MethodInfo method = type.GetMethod( "TestMethod", new[] { typeof( string ), typeof( int ), typeof( float ) } ); + TestClass instance = new TestClass(); + method.Invoke( instance, new object[] { "Hello", 1, 2f } ); + } + + [Benchmark] + public void RunNative() + { + TestClass instance = new TestClass(); + instance.TestMethod( "Hello", 1, 2f ); + } + + #endregion +} + +} diff --git a/Bite.Cli/Bite.Cli.csproj b/Bite.Cli/Bite.Cli.csproj index 21e0062..a1f47ed 100644 --- a/Bite.Cli/Bite.Cli.csproj +++ b/Bite.Cli/Bite.Cli.csproj @@ -10,14 +10,14 @@ - - + + - False - False + False + False diff --git a/Bite.Cli/CommandLine/CommandLineArgs.cs b/Bite.Cli/CommandLine/CommandLineArgs.cs index dc20a60..f4e0511 100644 --- a/Bite.Cli/CommandLine/CommandLineArgs.cs +++ b/Bite.Cli/CommandLine/CommandLineArgs.cs @@ -9,10 +9,13 @@ namespace Bite.Cli.CommandLine public class CommandLineException : Exception { + #region Public + public CommandLineException( string message ) : base( message ) { - } + + #endregion } /// @@ -36,7 +39,7 @@ public CommandLineArgs( string[] args ) m_Args = args; } - public void Parse( Action < T > success ) where T : new() + public void Parse < T >( Action < T > success ) where T : new() { T options = new T(); @@ -126,7 +129,7 @@ public CommandLineArgs( string[] args ) } else if ( propertyType.IsArray ) { - arrayValues = new List < string >() { arg }; + arrayValues = new List < string > { arg }; state = ArgState.ReadArray; } @@ -139,7 +142,6 @@ public CommandLineArgs( string[] args ) } } - if ( state == ArgState.ReadArray ) { PropertyInfo property = currentPropertyOption.Property; @@ -148,11 +150,10 @@ public CommandLineArgs( string[] args ) success( options ); } - catch (CommandLineException) + catch ( CommandLineException ) { OnFail( propertyOptions ); } - } else { @@ -160,13 +161,11 @@ public CommandLineArgs( string[] args ) } } - - #endregion #region Private - private IEnumerable < PropertyOption > GetPropertyOptions() + private IEnumerable < PropertyOption > GetPropertyOptions < T >() { Type type = typeof( T ); PropertyInfo[] properties = type.GetProperties(); @@ -215,8 +214,6 @@ private void OnFail( IEnumerable < PropertyOption > propertyOptions ) Console.WriteLine( $" -{propertyOption.ShortName} (--{longName}){spaces} : {propertyOption.Description}" ); } - - } #endregion diff --git a/Bite.Cli/ConsoleEx.cs b/Bite.Cli/ConsoleEx.cs index 2107522..039903d 100644 --- a/Bite.Cli/ConsoleEx.cs +++ b/Bite.Cli/ConsoleEx.cs @@ -6,19 +6,22 @@ namespace Bite.Cli public class ConsoleEx { + #region Public + public static string Buffer( bool exitOnEnter, out bool ctrlZPressed ) { - var buffering = true; - var buffer = new StringBuilder(); + bool buffering = true; + StringBuilder buffer = new StringBuilder(); ctrlZPressed = false; while ( buffering ) { - var input = Console.ReadLine(); + string input = Console.ReadLine(); if ( input == null ) { ctrlZPressed = true; + return buffer.ToString(); } @@ -36,6 +39,8 @@ public static string Buffer( bool exitOnEnter, out bool ctrlZPressed ) return buffer.ToString(); } + + #endregion } -} \ No newline at end of file +} diff --git a/Bite.Cli/Options.cs b/Bite.Cli/Options.cs index c562390..b570fae 100644 --- a/Bite.Cli/Options.cs +++ b/Bite.Cli/Options.cs @@ -1,5 +1,4 @@ -using Bite.Ast; -using Bite.Cli.CommandLine; +using Bite.Cli.CommandLine; namespace Bite.Cli { diff --git a/Bite.Cli/Program.cs b/Bite.Cli/Program.cs index be71393..b31a089 100644 --- a/Bite.Cli/Program.cs +++ b/Bite.Cli/Program.cs @@ -4,7 +4,6 @@ using System.Linq; using Bite.Cli.CommandLine; using Bite.Compiler; -using Bite.Runtime; using Bite.Runtime.CodeGen; namespace Bite.Cli diff --git a/Bite.Cli/REPL.cs b/Bite.Cli/REPL.cs index 7a9eb06..8f0dce4 100644 --- a/Bite.Cli/REPL.cs +++ b/Bite.Cli/REPL.cs @@ -1,25 +1,15 @@ using System; -using System.Diagnostics; using Bite.Compiler; +using Bite.Modules.Callables; using Bite.Runtime; using Bite.Runtime.CodeGen; -using Bite.Runtime.Functions; -using Bite.Runtime.Functions.ForeignInterface; namespace Bite.Cli { public class REPL { - private static void PrintModule( string module ) - { - var lines = module.Split( new[] { "\r\n" }, StringSplitOptions.None ); - - foreach ( var line in lines ) - { - Console.WriteLine( $"> {line}" ); - } - } + #region Unity Event Functions public static void Start() { @@ -36,10 +26,8 @@ public static void Start() BiteVm biteVm = new BiteVm(); biteVm.InitVm(); - // TODO: move somewhere else! - biteVm.RegisterCallable( "CSharpInterfaceCall", new ForeignLibraryInterfaceVm() ); - biteVm.RegisterCallable( "Print", new PrintFunctionVm() ); - biteVm.RegisterCallable( "PrintLine", new PrintLineFunctionVm() ); + + biteVm.RegisterSystemModuleCallables(); BiteProgram program = null; @@ -47,6 +35,9 @@ public static void Start() program = compiler.Compile( new[] { module } ); + // Write system chunks to memory + biteVm.Interpret( program ); + bool running = true; bool declaring = false; bool resetting = false; @@ -58,8 +49,7 @@ public static void Start() Console.Write( "> " ); } - var buffer = ConsoleEx.Buffer( !declaring, out bool ctrlZPressed ); - + string buffer = ConsoleEx.Buffer( !declaring, out bool ctrlZPressed ); if ( ctrlZPressed ) { @@ -74,11 +64,9 @@ public static void Start() } } - - if ( !declaring ) { - var bufferString = buffer.ToString(); + string bufferString = buffer; if ( bufferString.Length > 0 ) { @@ -106,7 +94,6 @@ public static void Start() Console.WriteLine( "You are now declaring. Type ^Z and press Enter to end and compile your declaration." ); - } else if ( resetting ) { @@ -123,21 +110,39 @@ public static void Start() try { + //var chunks = program.GetChunks(); program = compiler.CompileStatements( bufferString, program.SymbolTable ); + + //program.RestoreChunks( chunks ); BiteVmInterpretResult result = biteVm.Interpret( program ); } - catch (Exception e) + catch ( Exception e ) { Console.WriteLine( e.Message ); } } } } - } Console.WriteLine( "\r\n\r\nGoodbye!\r\n" ); } + + #endregion + + #region Private + + private static void PrintModule( string module ) + { + string[] lines = module.Split( new[] { "\r\n" }, StringSplitOptions.None ); + + foreach ( string line in lines ) + { + Console.WriteLine( $"> {line}" ); + } + } + + #endregion } } diff --git a/Bite.Cli/TestProgram/CSharpSystemModule.bite b/Bite.Cli/TestProgram/CSharpSystemModule.bite index a086528..f8a43e7 100644 --- a/Bite.Cli/TestProgram/CSharpSystemModule.bite +++ b/Bite.Cli/TestProgram/CSharpSystemModule.bite @@ -2,14 +2,14 @@ module CSharpSystem; import System; using System; -var CSharpInterfaceObject = new CSharpInterface(); +var CSharpInterfaceObject = new NetInterfaceObject(); CSharpInterfaceObject.Type = "System.Console"; -var Console = CSharpInterfaceCall(CSharpInterfaceObject); +var Console = NetLanguageInterface(CSharpInterfaceObject); CSharpInterfaceObject.Type = "System.IO.File"; -var File = CSharpInterfaceCall(CSharpInterfaceObject); +var File = NetLanguageInterface(CSharpInterfaceObject); diff --git a/Bite/AntlrGenerated/AntlrBiteParser/BITELexer.cs b/Bite/AntlrGenerated/AntlrBiteParser/BITELexer.cs index b424a9d..b1eaabd 100644 --- a/Bite/AntlrGenerated/AntlrBiteParser/BITELexer.cs +++ b/Bite/AntlrGenerated/AntlrBiteParser/BITELexer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -// Generated from C:/Language Dev 3/Bite Programming Language/Bite/Grammar\BITELexer.g4 by ANTLR 4.9.2 +// Generated from BITELexer.g4 by ANTLR 4.9.2 // Unreachable code detected #pragma warning disable 0162 @@ -40,21 +40,22 @@ public const int DeclareWhileLoop=13, DeclareStatic=14, DeclareAbstract=15, DeclarePublic=16, DeclarePrivate=17, ControlFlowIf=18, ControlFlowElse=19, FunctionReturn=20, Break=21, NullReference=22, ThisReference=23, UsingDirective=24, ImportDirective=25, - AssignOperator=26, PlusAssignOperator=27, MinusAssignOperator=28, MultiplyAssignOperator=29, - DivideAssignOperator=30, ModuloAssignOperator=31, BitwiseAndAssignOperator=32, - BitwiseOrAssignOperator=33, BitwiseXorAssignOperator=34, BitwiseLeftShiftAssignOperator=35, - BitwiseRightShiftAssignOperator=36, LogicalOrOperator=37, LogicalAndOperator=38, - UnequalOperator=39, EqualOperator=40, GreaterOperator=41, ShiftRightOperator=42, - GreaterEqualOperator=43, SmallerOperator=44, ShiftLeftOperator=45, SmallerEqualOperator=46, - MinusOperator=47, MinusMinusOperator=48, PlusOperator=49, PlusPlusOperator=50, - DivideOperator=51, MultiplyOperator=52, LogicalNegationOperator=53, DotOperator=54, - QuestionMarkOperator=55, ColonOperator=56, ReferenceOperator=57, ModuloOperator=58, - ComplimentOperator=59, BitwiseAndOperator=60, BitwiseXorOperator=61, BitwiseOrOperator=62, - OpeningRoundBracket=63, ClosingRoundBracket=64, SquarebracketLeft=65, - SquarebracketRight=66, CommaSeperator=67, SemicolonSeperator=68, DollarOperator=69, - BooleanLiteral=70, False_=71, True_=72, IntegerLiteral=73, FloatingLiteral=74, - DecimalLiteral=75, Identifier=76, COMMENT=77, WS=78, LINE_COMMENT=79, - DQUOTE=80, CURLY_L=81, CURLY_R=82, TEXT=83, BACKSLASH_PAREN=84, ESCAPE_SEQUENCE=85; + StartStatement=26, UseStatement=27, ThreadStatement=28, SyncKeyword=29, + AssignOperator=30, PlusAssignOperator=31, MinusAssignOperator=32, MultiplyAssignOperator=33, + DivideAssignOperator=34, ModuloAssignOperator=35, BitwiseAndAssignOperator=36, + BitwiseOrAssignOperator=37, BitwiseXorAssignOperator=38, BitwiseLeftShiftAssignOperator=39, + BitwiseRightShiftAssignOperator=40, LogicalOrOperator=41, LogicalAndOperator=42, + UnequalOperator=43, EqualOperator=44, GreaterOperator=45, ShiftRightOperator=46, + GreaterEqualOperator=47, SmallerOperator=48, ShiftLeftOperator=49, SmallerEqualOperator=50, + MinusOperator=51, MinusMinusOperator=52, PlusOperator=53, PlusPlusOperator=54, + DivideOperator=55, MultiplyOperator=56, LogicalNegationOperator=57, DotOperator=58, + QuestionMarkOperator=59, ColonOperator=60, ReferenceOperator=61, ModuloOperator=62, + ComplimentOperator=63, BitwiseAndOperator=64, BitwiseXorOperator=65, BitwiseOrOperator=66, + OpeningRoundBracket=67, ClosingRoundBracket=68, SquareBracketLeft=69, + SquareBracketRight=70, CommaSeparator=71, SemicolonSeparator=72, DollarOperator=73, + BooleanLiteral=74, False_=75, True_=76, IntegerLiteral=77, FloatingLiteral=78, + DecimalLiteral=79, Identifier=80, COMMENT=81, WS=82, LINE_COMMENT=83, + DQUOTE=84, CURLY_L=85, CURLY_R=86, TEXT=87, BACKSLASH_PAREN=88, ESCAPE_SEQUENCE=89; public const int IN_STRING=1; public static string[] channelNames = { @@ -72,7 +73,8 @@ public const int "DeclareWhileLoop", "DeclareStatic", "DeclareAbstract", "DeclarePublic", "DeclarePrivate", "ControlFlowIf", "ControlFlowElse", "FunctionReturn", "Break", "NullReference", "ThisReference", "UsingDirective", "ImportDirective", - "AssignOperator", "PlusAssignOperator", "MinusAssignOperator", "MultiplyAssignOperator", + "StartStatement", "UseStatement", "ThreadStatement", "SyncKeyword", "AssignOperator", + "PlusAssignOperator", "MinusAssignOperator", "MultiplyAssignOperator", "DivideAssignOperator", "ModuloAssignOperator", "BitwiseAndAssignOperator", "BitwiseOrAssignOperator", "BitwiseXorAssignOperator", "BitwiseLeftShiftAssignOperator", "BitwiseRightShiftAssignOperator", "LogicalOrOperator", "LogicalAndOperator", @@ -82,8 +84,8 @@ public const int "DivideOperator", "MultiplyOperator", "LogicalNegationOperator", "DotOperator", "QuestionMarkOperator", "ColonOperator", "ReferenceOperator", "ModuloOperator", "ComplimentOperator", "BitwiseAndOperator", "BitwiseXorOperator", "BitwiseOrOperator", - "OpeningRoundBracket", "ClosingRoundBracket", "SquarebracketLeft", "SquarebracketRight", - "CommaSeperator", "SemicolonSeperator", "DollarOperator", "BooleanLiteral", + "OpeningRoundBracket", "ClosingRoundBracket", "SquareBracketLeft", "SquareBracketRight", + "CommaSeparator", "SemicolonSeparator", "DollarOperator", "BooleanLiteral", "False_", "True_", "IntegerLiteral", "FloatingLiteral", "DIGIT", "DecimalLiteral", "NONZERODIGIT", "Fractionalconstant", "Exponentpart", "SIGN", "Digitsequence", "Identifier", "COMMENT", "WS", "LINE_COMMENT", "DQUOTE", "CURLY_L", "CURLY_R", @@ -107,13 +109,14 @@ public BITELexer(ICharStream input, TextWriter output, TextWriter errorOutput) null, "'module'", "'class'", "'struct'", "'new'", "'as'", "'extern'", "'callable'", "'function'", "'var'", "'get'", "'set'", "'for'", "'while'", "'static'", "'abstract'", "'public'", "'private'", "'if'", "'else'", "'return'", - "'break'", "'null'", "'this'", "'using'", "'import'", "'='", "'+='", "'-='", - "'*='", "'/='", "'%='", "'&='", "'|='", "'^='", "'<<='", "'>>='", "'||'", - "'&&'", "'!='", "'=='", "'>'", "'>>'", "'>='", "'<'", "'<<'", "'<='", - "'-'", "'--'", "'+'", "'++'", "'/'", "'*'", "'!'", "'.'", "'?'", "':'", - "'->'", "'%'", "'~'", "'&'", "'^'", "'|'", "'('", "')'", "'['", "']'", - "','", "';'", "'$'", null, "'false'", "'true'", null, null, null, null, - null, null, null, null, "'{'", "'}'", null, "'${'" + "'break'", "'null'", "'this'", "'using'", "'import'", "'start'", "'use'", + "'thread'", "'sync'", "'='", "'+='", "'-='", "'*='", "'/='", "'%='", "'&='", + "'|='", "'^='", "'<<='", "'>>='", "'||'", "'&&'", "'!='", "'=='", "'>'", + "'>>'", "'>='", "'<'", "'<<'", "'<='", "'-'", "'--'", "'+'", "'++'", "'/'", + "'*'", "'!'", "'.'", "'?'", "':'", "'->'", "'%'", "'~'", "'&'", "'^'", + "'|'", "'('", "')'", "'['", "']'", "','", "';'", "'$'", null, "'false'", + "'true'", null, null, null, null, null, null, null, null, "'{'", "'}'", + null, "'${'" }; private static readonly string[] _SymbolicNames = { null, "DeclareModule", "DeclareClass", "DeclareStruct", "DeclareClassInstance", @@ -122,7 +125,8 @@ public BITELexer(ICharStream input, TextWriter output, TextWriter errorOutput) "DeclareWhileLoop", "DeclareStatic", "DeclareAbstract", "DeclarePublic", "DeclarePrivate", "ControlFlowIf", "ControlFlowElse", "FunctionReturn", "Break", "NullReference", "ThisReference", "UsingDirective", "ImportDirective", - "AssignOperator", "PlusAssignOperator", "MinusAssignOperator", "MultiplyAssignOperator", + "StartStatement", "UseStatement", "ThreadStatement", "SyncKeyword", "AssignOperator", + "PlusAssignOperator", "MinusAssignOperator", "MultiplyAssignOperator", "DivideAssignOperator", "ModuloAssignOperator", "BitwiseAndAssignOperator", "BitwiseOrAssignOperator", "BitwiseXorAssignOperator", "BitwiseLeftShiftAssignOperator", "BitwiseRightShiftAssignOperator", "LogicalOrOperator", "LogicalAndOperator", @@ -132,8 +136,8 @@ public BITELexer(ICharStream input, TextWriter output, TextWriter errorOutput) "DivideOperator", "MultiplyOperator", "LogicalNegationOperator", "DotOperator", "QuestionMarkOperator", "ColonOperator", "ReferenceOperator", "ModuloOperator", "ComplimentOperator", "BitwiseAndOperator", "BitwiseXorOperator", "BitwiseOrOperator", - "OpeningRoundBracket", "ClosingRoundBracket", "SquarebracketLeft", "SquarebracketRight", - "CommaSeperator", "SemicolonSeperator", "DollarOperator", "BooleanLiteral", + "OpeningRoundBracket", "ClosingRoundBracket", "SquareBracketLeft", "SquareBracketRight", + "CommaSeparator", "SemicolonSeparator", "DollarOperator", "BooleanLiteral", "False_", "True_", "IntegerLiteral", "FloatingLiteral", "DecimalLiteral", "Identifier", "COMMENT", "WS", "LINE_COMMENT", "DQUOTE", "CURLY_L", "CURLY_R", "TEXT", "BACKSLASH_PAREN", "ESCAPE_SEQUENCE" @@ -167,7 +171,7 @@ static BITELexer() { } private static char[] _serializedATN = { '\x3', '\x608B', '\xA72A', '\x8133', '\xB9ED', '\x417C', '\x3BE7', '\x7786', - '\x5964', '\x2', 'W', '\x24F', '\b', '\x1', '\b', '\x1', '\x4', '\x2', + '\x5964', '\x2', '[', '\x26D', '\b', '\x1', '\b', '\x1', '\x4', '\x2', '\t', '\x2', '\x4', '\x3', '\t', '\x3', '\x4', '\x4', '\t', '\x4', '\x4', '\x5', '\t', '\x5', '\x4', '\x6', '\t', '\x6', '\x4', '\a', '\t', '\a', '\x4', '\b', '\t', '\b', '\x4', '\t', '\t', '\t', '\x4', '\n', '\t', '\n', @@ -200,465 +204,489 @@ static BITELexer() { '\t', 'T', '\x4', 'U', '\t', 'U', '\x4', 'V', '\t', 'V', '\x4', 'W', '\t', 'W', '\x4', 'X', '\t', 'X', '\x4', 'Y', '\t', 'Y', '\x4', 'Z', '\t', 'Z', '\x4', '[', '\t', '[', '\x4', '\\', '\t', '\\', '\x4', ']', '\t', ']', - '\x3', '\x2', '\x3', '\x2', '\x3', '\x2', '\x3', '\x2', '\x3', '\x2', - '\x3', '\x2', '\x3', '\x2', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', - '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\x4', '\x3', '\x4', - '\x3', '\x4', '\x3', '\x4', '\x3', '\x4', '\x3', '\x4', '\x3', '\x4', - '\x3', '\x5', '\x3', '\x5', '\x3', '\x5', '\x3', '\x5', '\x3', '\x6', - '\x3', '\x6', '\x3', '\x6', '\x3', '\a', '\x3', '\a', '\x3', '\a', '\x3', - '\a', '\x3', '\a', '\x3', '\a', '\x3', '\a', '\x3', '\b', '\x3', '\b', - '\x3', '\b', '\x3', '\b', '\x3', '\b', '\x3', '\b', '\x3', '\b', '\x3', - '\b', '\x3', '\b', '\x3', '\t', '\x3', '\t', '\x3', '\t', '\x3', '\t', - '\x3', '\t', '\x3', '\t', '\x3', '\t', '\x3', '\t', '\x3', '\t', '\x3', - '\n', '\x3', '\n', '\x3', '\n', '\x3', '\n', '\x3', '\v', '\x3', '\v', - '\x3', '\v', '\x3', '\v', '\x3', '\f', '\x3', '\f', '\x3', '\f', '\x3', - '\f', '\x3', '\r', '\x3', '\r', '\x3', '\r', '\x3', '\r', '\x3', '\xE', - '\x3', '\xE', '\x3', '\xE', '\x3', '\xE', '\x3', '\xE', '\x3', '\xE', - '\x3', '\xF', '\x3', '\xF', '\x3', '\xF', '\x3', '\xF', '\x3', '\xF', - '\x3', '\xF', '\x3', '\xF', '\x3', '\x10', '\x3', '\x10', '\x3', '\x10', + '\x4', '^', '\t', '^', '\x4', '_', '\t', '_', '\x4', '`', '\t', '`', '\x4', + '\x61', '\t', '\x61', '\x3', '\x2', '\x3', '\x2', '\x3', '\x2', '\x3', + '\x2', '\x3', '\x2', '\x3', '\x2', '\x3', '\x2', '\x3', '\x3', '\x3', + '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', + '\x4', '\x3', '\x4', '\x3', '\x4', '\x3', '\x4', '\x3', '\x4', '\x3', + '\x4', '\x3', '\x4', '\x3', '\x5', '\x3', '\x5', '\x3', '\x5', '\x3', + '\x5', '\x3', '\x6', '\x3', '\x6', '\x3', '\x6', '\x3', '\a', '\x3', '\a', + '\x3', '\a', '\x3', '\a', '\x3', '\a', '\x3', '\a', '\x3', '\a', '\x3', + '\b', '\x3', '\b', '\x3', '\b', '\x3', '\b', '\x3', '\b', '\x3', '\b', + '\x3', '\b', '\x3', '\b', '\x3', '\b', '\x3', '\t', '\x3', '\t', '\x3', + '\t', '\x3', '\t', '\x3', '\t', '\x3', '\t', '\x3', '\t', '\x3', '\t', + '\x3', '\t', '\x3', '\n', '\x3', '\n', '\x3', '\n', '\x3', '\n', '\x3', + '\v', '\x3', '\v', '\x3', '\v', '\x3', '\v', '\x3', '\f', '\x3', '\f', + '\x3', '\f', '\x3', '\f', '\x3', '\r', '\x3', '\r', '\x3', '\r', '\x3', + '\r', '\x3', '\xE', '\x3', '\xE', '\x3', '\xE', '\x3', '\xE', '\x3', '\xE', + '\x3', '\xE', '\x3', '\xF', '\x3', '\xF', '\x3', '\xF', '\x3', '\xF', + '\x3', '\xF', '\x3', '\xF', '\x3', '\xF', '\x3', '\x10', '\x3', '\x10', '\x3', '\x10', '\x3', '\x10', '\x3', '\x10', '\x3', '\x10', '\x3', '\x10', - '\x3', '\x10', '\x3', '\x11', '\x3', '\x11', '\x3', '\x11', '\x3', '\x11', - '\x3', '\x11', '\x3', '\x11', '\x3', '\x11', '\x3', '\x12', '\x3', '\x12', + '\x3', '\x10', '\x3', '\x10', '\x3', '\x11', '\x3', '\x11', '\x3', '\x11', + '\x3', '\x11', '\x3', '\x11', '\x3', '\x11', '\x3', '\x11', '\x3', '\x12', '\x3', '\x12', '\x3', '\x12', '\x3', '\x12', '\x3', '\x12', '\x3', '\x12', - '\x3', '\x12', '\x3', '\x13', '\x3', '\x13', '\x3', '\x13', '\x3', '\x14', - '\x3', '\x14', '\x3', '\x14', '\x3', '\x14', '\x3', '\x14', '\x3', '\x15', + '\x3', '\x12', '\x3', '\x12', '\x3', '\x13', '\x3', '\x13', '\x3', '\x13', + '\x3', '\x14', '\x3', '\x14', '\x3', '\x14', '\x3', '\x14', '\x3', '\x14', '\x3', '\x15', '\x3', '\x15', '\x3', '\x15', '\x3', '\x15', '\x3', '\x15', - '\x3', '\x15', '\x3', '\x16', '\x3', '\x16', '\x3', '\x16', '\x3', '\x16', - '\x3', '\x16', '\x3', '\x16', '\x3', '\x17', '\x3', '\x17', '\x3', '\x17', - '\x3', '\x17', '\x3', '\x17', '\x3', '\x18', '\x3', '\x18', '\x3', '\x18', - '\x3', '\x18', '\x3', '\x18', '\x3', '\x19', '\x3', '\x19', '\x3', '\x19', - '\x3', '\x19', '\x3', '\x19', '\x3', '\x19', '\x3', '\x1A', '\x3', '\x1A', + '\x3', '\x15', '\x3', '\x15', '\x3', '\x16', '\x3', '\x16', '\x3', '\x16', + '\x3', '\x16', '\x3', '\x16', '\x3', '\x16', '\x3', '\x17', '\x3', '\x17', + '\x3', '\x17', '\x3', '\x17', '\x3', '\x17', '\x3', '\x18', '\x3', '\x18', + '\x3', '\x18', '\x3', '\x18', '\x3', '\x18', '\x3', '\x19', '\x3', '\x19', + '\x3', '\x19', '\x3', '\x19', '\x3', '\x19', '\x3', '\x19', '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', + '\x3', '\x1A', '\x3', '\x1B', '\x3', '\x1B', '\x3', '\x1B', '\x3', '\x1B', '\x3', '\x1B', '\x3', '\x1B', '\x3', '\x1C', '\x3', '\x1C', '\x3', '\x1C', + '\x3', '\x1C', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1E', '\x3', '\x1E', - '\x3', '\x1E', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', ' ', - '\x3', ' ', '\x3', ' ', '\x3', '!', '\x3', '!', '\x3', '!', '\x3', '\"', - '\x3', '\"', '\x3', '\"', '\x3', '#', '\x3', '#', '\x3', '#', '\x3', '$', - '\x3', '$', '\x3', '$', '\x3', '$', '\x3', '%', '\x3', '%', '\x3', '%', - '\x3', '%', '\x3', '&', '\x3', '&', '\x3', '&', '\x3', '\'', '\x3', '\'', - '\x3', '\'', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', ')', '\x3', ')', - '\x3', ')', '\x3', '*', '\x3', '*', '\x3', '+', '\x3', '+', '\x3', '+', - '\x3', ',', '\x3', ',', '\x3', ',', '\x3', '-', '\x3', '-', '\x3', '.', - '\x3', '.', '\x3', '.', '\x3', '/', '\x3', '/', '\x3', '/', '\x3', '\x30', - '\x3', '\x30', '\x3', '\x31', '\x3', '\x31', '\x3', '\x31', '\x3', '\x32', - '\x3', '\x32', '\x3', '\x33', '\x3', '\x33', '\x3', '\x33', '\x3', '\x34', - '\x3', '\x34', '\x3', '\x35', '\x3', '\x35', '\x3', '\x36', '\x3', '\x36', + '\x3', '\x1E', '\x3', '\x1E', '\x3', '\x1E', '\x3', '\x1F', '\x3', '\x1F', + '\x3', ' ', '\x3', ' ', '\x3', ' ', '\x3', '!', '\x3', '!', '\x3', '!', + '\x3', '\"', '\x3', '\"', '\x3', '\"', '\x3', '#', '\x3', '#', '\x3', + '#', '\x3', '$', '\x3', '$', '\x3', '$', '\x3', '%', '\x3', '%', '\x3', + '%', '\x3', '&', '\x3', '&', '\x3', '&', '\x3', '\'', '\x3', '\'', '\x3', + '\'', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', '(', '\x3', ')', '\x3', + ')', '\x3', ')', '\x3', ')', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', + '+', '\x3', '+', '\x3', '+', '\x3', ',', '\x3', ',', '\x3', ',', '\x3', + '-', '\x3', '-', '\x3', '-', '\x3', '.', '\x3', '.', '\x3', '/', '\x3', + '/', '\x3', '/', '\x3', '\x30', '\x3', '\x30', '\x3', '\x30', '\x3', '\x31', + '\x3', '\x31', '\x3', '\x32', '\x3', '\x32', '\x3', '\x32', '\x3', '\x33', + '\x3', '\x33', '\x3', '\x33', '\x3', '\x34', '\x3', '\x34', '\x3', '\x35', + '\x3', '\x35', '\x3', '\x35', '\x3', '\x36', '\x3', '\x36', '\x3', '\x37', '\x3', '\x37', '\x3', '\x37', '\x3', '\x38', '\x3', '\x38', '\x3', '\x39', - '\x3', '\x39', '\x3', ':', '\x3', ':', '\x3', ':', '\x3', ';', '\x3', - ';', '\x3', '<', '\x3', '<', '\x3', '=', '\x3', '=', '\x3', '>', '\x3', + '\x3', '\x39', '\x3', ':', '\x3', ':', '\x3', ';', '\x3', ';', '\x3', + '<', '\x3', '<', '\x3', '=', '\x3', '=', '\x3', '>', '\x3', '>', '\x3', '>', '\x3', '?', '\x3', '?', '\x3', '@', '\x3', '@', '\x3', '\x41', '\x3', '\x41', '\x3', '\x42', '\x3', '\x42', '\x3', '\x43', '\x3', '\x43', '\x3', '\x44', '\x3', '\x44', '\x3', '\x45', '\x3', '\x45', '\x3', '\x46', '\x3', - '\x46', '\x3', 'G', '\x3', 'G', '\x5', 'G', '\x1C3', '\n', 'G', '\x3', - 'H', '\x3', 'H', '\x3', 'H', '\x3', 'H', '\x3', 'H', '\x3', 'H', '\x3', - 'I', '\x3', 'I', '\x3', 'I', '\x3', 'I', '\x3', 'I', '\x3', 'J', '\x3', - 'J', '\x3', 'K', '\x3', 'K', '\x5', 'K', '\x1D4', '\n', 'K', '\x3', 'K', - '\x3', 'K', '\x3', 'K', '\x5', 'K', '\x1D9', '\n', 'K', '\x3', 'L', '\x3', - 'L', '\x3', 'M', '\x6', 'M', '\x1DE', '\n', 'M', '\r', 'M', '\xE', 'M', - '\x1DF', '\x3', 'N', '\x3', 'N', '\x3', 'O', '\x5', 'O', '\x1E5', '\n', - 'O', '\x3', 'O', '\x3', 'O', '\x3', 'O', '\x3', 'O', '\x3', 'O', '\x5', - 'O', '\x1EC', '\n', 'O', '\x3', 'P', '\x3', 'P', '\x5', 'P', '\x1F0', - '\n', 'P', '\x3', 'P', '\x3', 'P', '\x3', 'P', '\x5', 'P', '\x1F5', '\n', - 'P', '\x3', 'P', '\x5', 'P', '\x1F8', '\n', 'P', '\x3', 'Q', '\x3', 'Q', - '\x3', 'R', '\x3', 'R', '\x5', 'R', '\x1FE', '\n', 'R', '\x3', 'R', '\a', - 'R', '\x201', '\n', 'R', '\f', 'R', '\xE', 'R', '\x204', '\v', 'R', '\x3', - 'S', '\x3', 'S', '\a', 'S', '\x208', '\n', 'S', '\f', 'S', '\xE', 'S', - '\x20B', '\v', 'S', '\x3', 'T', '\x3', 'T', '\x3', 'T', '\x3', 'T', '\a', - 'T', '\x211', '\n', 'T', '\f', 'T', '\xE', 'T', '\x214', '\v', 'T', '\x3', - 'T', '\x3', 'T', '\x3', 'T', '\x3', 'T', '\x3', 'T', '\x3', 'U', '\x6', - 'U', '\x21C', '\n', 'U', '\r', 'U', '\xE', 'U', '\x21D', '\x3', 'U', '\x3', - 'U', '\x3', 'V', '\x3', 'V', '\x3', 'V', '\x3', 'V', '\a', 'V', '\x226', - '\n', 'V', '\f', 'V', '\xE', 'V', '\x229', '\v', 'V', '\x3', 'V', '\x5', - 'V', '\x22C', '\n', 'V', '\x3', 'V', '\x3', 'V', '\x3', 'V', '\x3', 'V', - '\x3', 'W', '\x3', 'W', '\x3', 'W', '\x3', 'W', '\x3', 'X', '\x3', 'X', - '\x3', 'X', '\x3', 'X', '\x3', 'Y', '\x3', 'Y', '\x3', 'Y', '\x3', 'Y', - '\x3', 'Z', '\x6', 'Z', '\x23F', '\n', 'Z', '\r', 'Z', '\xE', 'Z', '\x240', - '\x3', '[', '\x3', '[', '\x3', '[', '\x3', '[', '\x3', '[', '\x3', '\\', - '\x3', '\\', '\x3', '\\', '\x3', ']', '\x3', ']', '\x3', ']', '\x3', ']', - '\x3', ']', '\x3', '\x212', '\x2', '^', '\x4', '\x3', '\x6', '\x4', '\b', - '\x5', '\n', '\x6', '\f', '\a', '\xE', '\b', '\x10', '\t', '\x12', '\n', - '\x14', '\v', '\x16', '\f', '\x18', '\r', '\x1A', '\xE', '\x1C', '\xF', - '\x1E', '\x10', ' ', '\x11', '\"', '\x12', '$', '\x13', '&', '\x14', '(', - '\x15', '*', '\x16', ',', '\x17', '.', '\x18', '\x30', '\x19', '\x32', - '\x1A', '\x34', '\x1B', '\x36', '\x1C', '\x38', '\x1D', ':', '\x1E', '<', - '\x1F', '>', ' ', '@', '!', '\x42', '\"', '\x44', '#', '\x46', '$', 'H', - '%', 'J', '&', 'L', '\'', 'N', '(', 'P', ')', 'R', '*', 'T', '+', 'V', - ',', 'X', '-', 'Z', '.', '\\', '/', '^', '\x30', '`', '\x31', '\x62', - '\x32', '\x64', '\x33', '\x66', '\x34', 'h', '\x35', 'j', '\x36', 'l', - '\x37', 'n', '\x38', 'p', '\x39', 'r', ':', 't', ';', 'v', '<', 'x', '=', - 'z', '>', '|', '?', '~', '@', '\x80', '\x41', '\x82', '\x42', '\x84', - '\x43', '\x86', '\x44', '\x88', '\x45', '\x8A', '\x46', '\x8C', 'G', '\x8E', - 'H', '\x90', 'I', '\x92', 'J', '\x94', 'K', '\x96', 'L', '\x98', '\x2', - '\x9A', 'M', '\x9C', '\x2', '\x9E', '\x2', '\xA0', '\x2', '\xA2', '\x2', - '\xA4', '\x2', '\xA6', 'N', '\xA8', 'O', '\xAA', 'P', '\xAC', 'Q', '\xAE', - 'R', '\xB0', 'S', '\xB2', 'T', '\xB4', 'U', '\xB6', 'V', '\xB8', 'W', - '\xBA', '\x2', '\x4', '\x2', '\x3', '\n', '\x3', '\x2', '\x32', ';', '\x3', - '\x2', '\x33', ';', '\x4', '\x2', '-', '-', '/', '/', '\x5', '\x2', '\x43', - '\\', '\x61', '\x61', '\x63', '|', '\x6', '\x2', '\x32', ';', '\x43', - '\\', '\x61', '\x61', '\x63', '|', '\x5', '\x2', '\v', '\f', '\xE', '\xF', - '\"', '\"', '\x4', '\x2', '\f', '\f', '\xF', '\xF', '\x5', '\x2', '$', - '$', '&', '&', '^', '^', '\x2', '\x258', '\x2', '\x4', '\x3', '\x2', '\x2', - '\x2', '\x2', '\x6', '\x3', '\x2', '\x2', '\x2', '\x2', '\b', '\x3', '\x2', - '\x2', '\x2', '\x2', '\n', '\x3', '\x2', '\x2', '\x2', '\x2', '\f', '\x3', - '\x2', '\x2', '\x2', '\x2', '\xE', '\x3', '\x2', '\x2', '\x2', '\x2', - '\x10', '\x3', '\x2', '\x2', '\x2', '\x2', '\x12', '\x3', '\x2', '\x2', - '\x2', '\x2', '\x14', '\x3', '\x2', '\x2', '\x2', '\x2', '\x16', '\x3', - '\x2', '\x2', '\x2', '\x2', '\x18', '\x3', '\x2', '\x2', '\x2', '\x2', - '\x1A', '\x3', '\x2', '\x2', '\x2', '\x2', '\x1C', '\x3', '\x2', '\x2', - '\x2', '\x2', '\x1E', '\x3', '\x2', '\x2', '\x2', '\x2', ' ', '\x3', '\x2', - '\x2', '\x2', '\x2', '\"', '\x3', '\x2', '\x2', '\x2', '\x2', '$', '\x3', - '\x2', '\x2', '\x2', '\x2', '&', '\x3', '\x2', '\x2', '\x2', '\x2', '(', - '\x3', '\x2', '\x2', '\x2', '\x2', '*', '\x3', '\x2', '\x2', '\x2', '\x2', - ',', '\x3', '\x2', '\x2', '\x2', '\x2', '.', '\x3', '\x2', '\x2', '\x2', - '\x2', '\x30', '\x3', '\x2', '\x2', '\x2', '\x2', '\x32', '\x3', '\x2', - '\x2', '\x2', '\x2', '\x34', '\x3', '\x2', '\x2', '\x2', '\x2', '\x36', - '\x3', '\x2', '\x2', '\x2', '\x2', '\x38', '\x3', '\x2', '\x2', '\x2', - '\x2', ':', '\x3', '\x2', '\x2', '\x2', '\x2', '<', '\x3', '\x2', '\x2', - '\x2', '\x2', '>', '\x3', '\x2', '\x2', '\x2', '\x2', '@', '\x3', '\x2', - '\x2', '\x2', '\x2', '\x42', '\x3', '\x2', '\x2', '\x2', '\x2', '\x44', - '\x3', '\x2', '\x2', '\x2', '\x2', '\x46', '\x3', '\x2', '\x2', '\x2', - '\x2', 'H', '\x3', '\x2', '\x2', '\x2', '\x2', 'J', '\x3', '\x2', '\x2', - '\x2', '\x2', 'L', '\x3', '\x2', '\x2', '\x2', '\x2', 'N', '\x3', '\x2', - '\x2', '\x2', '\x2', 'P', '\x3', '\x2', '\x2', '\x2', '\x2', 'R', '\x3', - '\x2', '\x2', '\x2', '\x2', 'T', '\x3', '\x2', '\x2', '\x2', '\x2', 'V', - '\x3', '\x2', '\x2', '\x2', '\x2', 'X', '\x3', '\x2', '\x2', '\x2', '\x2', - 'Z', '\x3', '\x2', '\x2', '\x2', '\x2', '\\', '\x3', '\x2', '\x2', '\x2', - '\x2', '^', '\x3', '\x2', '\x2', '\x2', '\x2', '`', '\x3', '\x2', '\x2', - '\x2', '\x2', '\x62', '\x3', '\x2', '\x2', '\x2', '\x2', '\x64', '\x3', - '\x2', '\x2', '\x2', '\x2', '\x66', '\x3', '\x2', '\x2', '\x2', '\x2', - 'h', '\x3', '\x2', '\x2', '\x2', '\x2', 'j', '\x3', '\x2', '\x2', '\x2', - '\x2', 'l', '\x3', '\x2', '\x2', '\x2', '\x2', 'n', '\x3', '\x2', '\x2', - '\x2', '\x2', 'p', '\x3', '\x2', '\x2', '\x2', '\x2', 'r', '\x3', '\x2', - '\x2', '\x2', '\x2', 't', '\x3', '\x2', '\x2', '\x2', '\x2', 'v', '\x3', - '\x2', '\x2', '\x2', '\x2', 'x', '\x3', '\x2', '\x2', '\x2', '\x2', 'z', - '\x3', '\x2', '\x2', '\x2', '\x2', '|', '\x3', '\x2', '\x2', '\x2', '\x2', - '~', '\x3', '\x2', '\x2', '\x2', '\x2', '\x80', '\x3', '\x2', '\x2', '\x2', - '\x2', '\x82', '\x3', '\x2', '\x2', '\x2', '\x2', '\x84', '\x3', '\x2', - '\x2', '\x2', '\x2', '\x86', '\x3', '\x2', '\x2', '\x2', '\x2', '\x88', - '\x3', '\x2', '\x2', '\x2', '\x2', '\x8A', '\x3', '\x2', '\x2', '\x2', - '\x2', '\x8C', '\x3', '\x2', '\x2', '\x2', '\x2', '\x8E', '\x3', '\x2', - '\x2', '\x2', '\x2', '\x90', '\x3', '\x2', '\x2', '\x2', '\x2', '\x92', - '\x3', '\x2', '\x2', '\x2', '\x2', '\x94', '\x3', '\x2', '\x2', '\x2', - '\x2', '\x96', '\x3', '\x2', '\x2', '\x2', '\x2', '\x9A', '\x3', '\x2', - '\x2', '\x2', '\x2', '\xA6', '\x3', '\x2', '\x2', '\x2', '\x2', '\xA8', - '\x3', '\x2', '\x2', '\x2', '\x2', '\xAA', '\x3', '\x2', '\x2', '\x2', - '\x2', '\xAC', '\x3', '\x2', '\x2', '\x2', '\x2', '\xAE', '\x3', '\x2', - '\x2', '\x2', '\x2', '\xB0', '\x3', '\x2', '\x2', '\x2', '\x2', '\xB2', - '\x3', '\x2', '\x2', '\x2', '\x3', '\xB4', '\x3', '\x2', '\x2', '\x2', - '\x3', '\xB6', '\x3', '\x2', '\x2', '\x2', '\x3', '\xB8', '\x3', '\x2', - '\x2', '\x2', '\x3', '\xBA', '\x3', '\x2', '\x2', '\x2', '\x4', '\xBC', - '\x3', '\x2', '\x2', '\x2', '\x6', '\xC3', '\x3', '\x2', '\x2', '\x2', - '\b', '\xC9', '\x3', '\x2', '\x2', '\x2', '\n', '\xD0', '\x3', '\x2', - '\x2', '\x2', '\f', '\xD4', '\x3', '\x2', '\x2', '\x2', '\xE', '\xD7', - '\x3', '\x2', '\x2', '\x2', '\x10', '\xDE', '\x3', '\x2', '\x2', '\x2', - '\x12', '\xE7', '\x3', '\x2', '\x2', '\x2', '\x14', '\xF0', '\x3', '\x2', - '\x2', '\x2', '\x16', '\xF4', '\x3', '\x2', '\x2', '\x2', '\x18', '\xF8', - '\x3', '\x2', '\x2', '\x2', '\x1A', '\xFC', '\x3', '\x2', '\x2', '\x2', - '\x1C', '\x100', '\x3', '\x2', '\x2', '\x2', '\x1E', '\x106', '\x3', '\x2', - '\x2', '\x2', ' ', '\x10D', '\x3', '\x2', '\x2', '\x2', '\"', '\x116', - '\x3', '\x2', '\x2', '\x2', '$', '\x11D', '\x3', '\x2', '\x2', '\x2', - '&', '\x125', '\x3', '\x2', '\x2', '\x2', '(', '\x128', '\x3', '\x2', - '\x2', '\x2', '*', '\x12D', '\x3', '\x2', '\x2', '\x2', ',', '\x134', - '\x3', '\x2', '\x2', '\x2', '.', '\x13A', '\x3', '\x2', '\x2', '\x2', - '\x30', '\x13F', '\x3', '\x2', '\x2', '\x2', '\x32', '\x144', '\x3', '\x2', - '\x2', '\x2', '\x34', '\x14A', '\x3', '\x2', '\x2', '\x2', '\x36', '\x151', - '\x3', '\x2', '\x2', '\x2', '\x38', '\x153', '\x3', '\x2', '\x2', '\x2', - ':', '\x156', '\x3', '\x2', '\x2', '\x2', '<', '\x159', '\x3', '\x2', - '\x2', '\x2', '>', '\x15C', '\x3', '\x2', '\x2', '\x2', '@', '\x15F', - '\x3', '\x2', '\x2', '\x2', '\x42', '\x162', '\x3', '\x2', '\x2', '\x2', - '\x44', '\x165', '\x3', '\x2', '\x2', '\x2', '\x46', '\x168', '\x3', '\x2', - '\x2', '\x2', 'H', '\x16B', '\x3', '\x2', '\x2', '\x2', 'J', '\x16F', - '\x3', '\x2', '\x2', '\x2', 'L', '\x173', '\x3', '\x2', '\x2', '\x2', - 'N', '\x176', '\x3', '\x2', '\x2', '\x2', 'P', '\x179', '\x3', '\x2', - '\x2', '\x2', 'R', '\x17C', '\x3', '\x2', '\x2', '\x2', 'T', '\x17F', - '\x3', '\x2', '\x2', '\x2', 'V', '\x181', '\x3', '\x2', '\x2', '\x2', - 'X', '\x184', '\x3', '\x2', '\x2', '\x2', 'Z', '\x187', '\x3', '\x2', - '\x2', '\x2', '\\', '\x189', '\x3', '\x2', '\x2', '\x2', '^', '\x18C', - '\x3', '\x2', '\x2', '\x2', '`', '\x18F', '\x3', '\x2', '\x2', '\x2', - '\x62', '\x191', '\x3', '\x2', '\x2', '\x2', '\x64', '\x194', '\x3', '\x2', - '\x2', '\x2', '\x66', '\x196', '\x3', '\x2', '\x2', '\x2', 'h', '\x199', - '\x3', '\x2', '\x2', '\x2', 'j', '\x19B', '\x3', '\x2', '\x2', '\x2', - 'l', '\x19D', '\x3', '\x2', '\x2', '\x2', 'n', '\x19F', '\x3', '\x2', - '\x2', '\x2', 'p', '\x1A1', '\x3', '\x2', '\x2', '\x2', 'r', '\x1A3', - '\x3', '\x2', '\x2', '\x2', 't', '\x1A5', '\x3', '\x2', '\x2', '\x2', - 'v', '\x1A8', '\x3', '\x2', '\x2', '\x2', 'x', '\x1AA', '\x3', '\x2', - '\x2', '\x2', 'z', '\x1AC', '\x3', '\x2', '\x2', '\x2', '|', '\x1AE', - '\x3', '\x2', '\x2', '\x2', '~', '\x1B0', '\x3', '\x2', '\x2', '\x2', - '\x80', '\x1B2', '\x3', '\x2', '\x2', '\x2', '\x82', '\x1B4', '\x3', '\x2', - '\x2', '\x2', '\x84', '\x1B6', '\x3', '\x2', '\x2', '\x2', '\x86', '\x1B8', - '\x3', '\x2', '\x2', '\x2', '\x88', '\x1BA', '\x3', '\x2', '\x2', '\x2', - '\x8A', '\x1BC', '\x3', '\x2', '\x2', '\x2', '\x8C', '\x1BE', '\x3', '\x2', - '\x2', '\x2', '\x8E', '\x1C2', '\x3', '\x2', '\x2', '\x2', '\x90', '\x1C4', - '\x3', '\x2', '\x2', '\x2', '\x92', '\x1CA', '\x3', '\x2', '\x2', '\x2', - '\x94', '\x1CF', '\x3', '\x2', '\x2', '\x2', '\x96', '\x1D8', '\x3', '\x2', - '\x2', '\x2', '\x98', '\x1DA', '\x3', '\x2', '\x2', '\x2', '\x9A', '\x1DD', - '\x3', '\x2', '\x2', '\x2', '\x9C', '\x1E1', '\x3', '\x2', '\x2', '\x2', - '\x9E', '\x1EB', '\x3', '\x2', '\x2', '\x2', '\xA0', '\x1F7', '\x3', '\x2', - '\x2', '\x2', '\xA2', '\x1F9', '\x3', '\x2', '\x2', '\x2', '\xA4', '\x1FB', - '\x3', '\x2', '\x2', '\x2', '\xA6', '\x205', '\x3', '\x2', '\x2', '\x2', - '\xA8', '\x20C', '\x3', '\x2', '\x2', '\x2', '\xAA', '\x21B', '\x3', '\x2', - '\x2', '\x2', '\xAC', '\x221', '\x3', '\x2', '\x2', '\x2', '\xAE', '\x231', - '\x3', '\x2', '\x2', '\x2', '\xB0', '\x235', '\x3', '\x2', '\x2', '\x2', - '\xB2', '\x239', '\x3', '\x2', '\x2', '\x2', '\xB4', '\x23E', '\x3', '\x2', - '\x2', '\x2', '\xB6', '\x242', '\x3', '\x2', '\x2', '\x2', '\xB8', '\x247', - '\x3', '\x2', '\x2', '\x2', '\xBA', '\x24A', '\x3', '\x2', '\x2', '\x2', - '\xBC', '\xBD', '\a', 'o', '\x2', '\x2', '\xBD', '\xBE', '\a', 'q', '\x2', - '\x2', '\xBE', '\xBF', '\a', '\x66', '\x2', '\x2', '\xBF', '\xC0', '\a', - 'w', '\x2', '\x2', '\xC0', '\xC1', '\a', 'n', '\x2', '\x2', '\xC1', '\xC2', - '\a', 'g', '\x2', '\x2', '\xC2', '\x5', '\x3', '\x2', '\x2', '\x2', '\xC3', - '\xC4', '\a', '\x65', '\x2', '\x2', '\xC4', '\xC5', '\a', 'n', '\x2', - '\x2', '\xC5', '\xC6', '\a', '\x63', '\x2', '\x2', '\xC6', '\xC7', '\a', - 'u', '\x2', '\x2', '\xC7', '\xC8', '\a', 'u', '\x2', '\x2', '\xC8', '\a', - '\x3', '\x2', '\x2', '\x2', '\xC9', '\xCA', '\a', 'u', '\x2', '\x2', '\xCA', - '\xCB', '\a', 'v', '\x2', '\x2', '\xCB', '\xCC', '\a', 't', '\x2', '\x2', - '\xCC', '\xCD', '\a', 'w', '\x2', '\x2', '\xCD', '\xCE', '\a', '\x65', - '\x2', '\x2', '\xCE', '\xCF', '\a', 'v', '\x2', '\x2', '\xCF', '\t', '\x3', - '\x2', '\x2', '\x2', '\xD0', '\xD1', '\a', 'p', '\x2', '\x2', '\xD1', - '\xD2', '\a', 'g', '\x2', '\x2', '\xD2', '\xD3', '\a', 'y', '\x2', '\x2', - '\xD3', '\v', '\x3', '\x2', '\x2', '\x2', '\xD4', '\xD5', '\a', '\x63', - '\x2', '\x2', '\xD5', '\xD6', '\a', 'u', '\x2', '\x2', '\xD6', '\r', '\x3', - '\x2', '\x2', '\x2', '\xD7', '\xD8', '\a', 'g', '\x2', '\x2', '\xD8', - '\xD9', '\a', 'z', '\x2', '\x2', '\xD9', '\xDA', '\a', 'v', '\x2', '\x2', - '\xDA', '\xDB', '\a', 'g', '\x2', '\x2', '\xDB', '\xDC', '\a', 't', '\x2', - '\x2', '\xDC', '\xDD', '\a', 'p', '\x2', '\x2', '\xDD', '\xF', '\x3', - '\x2', '\x2', '\x2', '\xDE', '\xDF', '\a', '\x65', '\x2', '\x2', '\xDF', - '\xE0', '\a', '\x63', '\x2', '\x2', '\xE0', '\xE1', '\a', 'n', '\x2', - '\x2', '\xE1', '\xE2', '\a', 'n', '\x2', '\x2', '\xE2', '\xE3', '\a', - '\x63', '\x2', '\x2', '\xE3', '\xE4', '\a', '\x64', '\x2', '\x2', '\xE4', - '\xE5', '\a', 'n', '\x2', '\x2', '\xE5', '\xE6', '\a', 'g', '\x2', '\x2', - '\xE6', '\x11', '\x3', '\x2', '\x2', '\x2', '\xE7', '\xE8', '\a', 'h', - '\x2', '\x2', '\xE8', '\xE9', '\a', 'w', '\x2', '\x2', '\xE9', '\xEA', - '\a', 'p', '\x2', '\x2', '\xEA', '\xEB', '\a', '\x65', '\x2', '\x2', '\xEB', - '\xEC', '\a', 'v', '\x2', '\x2', '\xEC', '\xED', '\a', 'k', '\x2', '\x2', - '\xED', '\xEE', '\a', 'q', '\x2', '\x2', '\xEE', '\xEF', '\a', 'p', '\x2', - '\x2', '\xEF', '\x13', '\x3', '\x2', '\x2', '\x2', '\xF0', '\xF1', '\a', - 'x', '\x2', '\x2', '\xF1', '\xF2', '\a', '\x63', '\x2', '\x2', '\xF2', - '\xF3', '\a', 't', '\x2', '\x2', '\xF3', '\x15', '\x3', '\x2', '\x2', - '\x2', '\xF4', '\xF5', '\a', 'i', '\x2', '\x2', '\xF5', '\xF6', '\a', - 'g', '\x2', '\x2', '\xF6', '\xF7', '\a', 'v', '\x2', '\x2', '\xF7', '\x17', - '\x3', '\x2', '\x2', '\x2', '\xF8', '\xF9', '\a', 'u', '\x2', '\x2', '\xF9', - '\xFA', '\a', 'g', '\x2', '\x2', '\xFA', '\xFB', '\a', 'v', '\x2', '\x2', - '\xFB', '\x19', '\x3', '\x2', '\x2', '\x2', '\xFC', '\xFD', '\a', 'h', - '\x2', '\x2', '\xFD', '\xFE', '\a', 'q', '\x2', '\x2', '\xFE', '\xFF', - '\a', 't', '\x2', '\x2', '\xFF', '\x1B', '\x3', '\x2', '\x2', '\x2', '\x100', - '\x101', '\a', 'y', '\x2', '\x2', '\x101', '\x102', '\a', 'j', '\x2', - '\x2', '\x102', '\x103', '\a', 'k', '\x2', '\x2', '\x103', '\x104', '\a', - 'n', '\x2', '\x2', '\x104', '\x105', '\a', 'g', '\x2', '\x2', '\x105', - '\x1D', '\x3', '\x2', '\x2', '\x2', '\x106', '\x107', '\a', 'u', '\x2', - '\x2', '\x107', '\x108', '\a', 'v', '\x2', '\x2', '\x108', '\x109', '\a', - '\x63', '\x2', '\x2', '\x109', '\x10A', '\a', 'v', '\x2', '\x2', '\x10A', - '\x10B', '\a', 'k', '\x2', '\x2', '\x10B', '\x10C', '\a', '\x65', '\x2', - '\x2', '\x10C', '\x1F', '\x3', '\x2', '\x2', '\x2', '\x10D', '\x10E', - '\a', '\x63', '\x2', '\x2', '\x10E', '\x10F', '\a', '\x64', '\x2', '\x2', - '\x10F', '\x110', '\a', 'u', '\x2', '\x2', '\x110', '\x111', '\a', 'v', - '\x2', '\x2', '\x111', '\x112', '\a', 't', '\x2', '\x2', '\x112', '\x113', - '\a', '\x63', '\x2', '\x2', '\x113', '\x114', '\a', '\x65', '\x2', '\x2', - '\x114', '\x115', '\a', 'v', '\x2', '\x2', '\x115', '!', '\x3', '\x2', - '\x2', '\x2', '\x116', '\x117', '\a', 'r', '\x2', '\x2', '\x117', '\x118', - '\a', 'w', '\x2', '\x2', '\x118', '\x119', '\a', '\x64', '\x2', '\x2', - '\x119', '\x11A', '\a', 'n', '\x2', '\x2', '\x11A', '\x11B', '\a', 'k', - '\x2', '\x2', '\x11B', '\x11C', '\a', '\x65', '\x2', '\x2', '\x11C', '#', - '\x3', '\x2', '\x2', '\x2', '\x11D', '\x11E', '\a', 'r', '\x2', '\x2', - '\x11E', '\x11F', '\a', 't', '\x2', '\x2', '\x11F', '\x120', '\a', 'k', - '\x2', '\x2', '\x120', '\x121', '\a', 'x', '\x2', '\x2', '\x121', '\x122', - '\a', '\x63', '\x2', '\x2', '\x122', '\x123', '\a', 'v', '\x2', '\x2', - '\x123', '\x124', '\a', 'g', '\x2', '\x2', '\x124', '%', '\x3', '\x2', - '\x2', '\x2', '\x125', '\x126', '\a', 'k', '\x2', '\x2', '\x126', '\x127', - '\a', 'h', '\x2', '\x2', '\x127', '\'', '\x3', '\x2', '\x2', '\x2', '\x128', - '\x129', '\a', 'g', '\x2', '\x2', '\x129', '\x12A', '\a', 'n', '\x2', - '\x2', '\x12A', '\x12B', '\a', 'u', '\x2', '\x2', '\x12B', '\x12C', '\a', - 'g', '\x2', '\x2', '\x12C', ')', '\x3', '\x2', '\x2', '\x2', '\x12D', - '\x12E', '\a', 't', '\x2', '\x2', '\x12E', '\x12F', '\a', 'g', '\x2', - '\x2', '\x12F', '\x130', '\a', 'v', '\x2', '\x2', '\x130', '\x131', '\a', - 'w', '\x2', '\x2', '\x131', '\x132', '\a', 't', '\x2', '\x2', '\x132', - '\x133', '\a', 'p', '\x2', '\x2', '\x133', '+', '\x3', '\x2', '\x2', '\x2', - '\x134', '\x135', '\a', '\x64', '\x2', '\x2', '\x135', '\x136', '\a', - 't', '\x2', '\x2', '\x136', '\x137', '\a', 'g', '\x2', '\x2', '\x137', - '\x138', '\a', '\x63', '\x2', '\x2', '\x138', '\x139', '\a', 'm', '\x2', - '\x2', '\x139', '-', '\x3', '\x2', '\x2', '\x2', '\x13A', '\x13B', '\a', - 'p', '\x2', '\x2', '\x13B', '\x13C', '\a', 'w', '\x2', '\x2', '\x13C', - '\x13D', '\a', 'n', '\x2', '\x2', '\x13D', '\x13E', '\a', 'n', '\x2', - '\x2', '\x13E', '/', '\x3', '\x2', '\x2', '\x2', '\x13F', '\x140', '\a', - 'v', '\x2', '\x2', '\x140', '\x141', '\a', 'j', '\x2', '\x2', '\x141', - '\x142', '\a', 'k', '\x2', '\x2', '\x142', '\x143', '\a', 'u', '\x2', - '\x2', '\x143', '\x31', '\x3', '\x2', '\x2', '\x2', '\x144', '\x145', - '\a', 'w', '\x2', '\x2', '\x145', '\x146', '\a', 'u', '\x2', '\x2', '\x146', - '\x147', '\a', 'k', '\x2', '\x2', '\x147', '\x148', '\a', 'p', '\x2', - '\x2', '\x148', '\x149', '\a', 'i', '\x2', '\x2', '\x149', '\x33', '\x3', - '\x2', '\x2', '\x2', '\x14A', '\x14B', '\a', 'k', '\x2', '\x2', '\x14B', - '\x14C', '\a', 'o', '\x2', '\x2', '\x14C', '\x14D', '\a', 'r', '\x2', - '\x2', '\x14D', '\x14E', '\a', 'q', '\x2', '\x2', '\x14E', '\x14F', '\a', - 't', '\x2', '\x2', '\x14F', '\x150', '\a', 'v', '\x2', '\x2', '\x150', - '\x35', '\x3', '\x2', '\x2', '\x2', '\x151', '\x152', '\a', '?', '\x2', - '\x2', '\x152', '\x37', '\x3', '\x2', '\x2', '\x2', '\x153', '\x154', - '\a', '-', '\x2', '\x2', '\x154', '\x155', '\a', '?', '\x2', '\x2', '\x155', - '\x39', '\x3', '\x2', '\x2', '\x2', '\x156', '\x157', '\a', '/', '\x2', - '\x2', '\x157', '\x158', '\a', '?', '\x2', '\x2', '\x158', ';', '\x3', - '\x2', '\x2', '\x2', '\x159', '\x15A', '\a', ',', '\x2', '\x2', '\x15A', - '\x15B', '\a', '?', '\x2', '\x2', '\x15B', '=', '\x3', '\x2', '\x2', '\x2', - '\x15C', '\x15D', '\a', '\x31', '\x2', '\x2', '\x15D', '\x15E', '\a', - '?', '\x2', '\x2', '\x15E', '?', '\x3', '\x2', '\x2', '\x2', '\x15F', - '\x160', '\a', '\'', '\x2', '\x2', '\x160', '\x161', '\a', '?', '\x2', - '\x2', '\x161', '\x41', '\x3', '\x2', '\x2', '\x2', '\x162', '\x163', - '\a', '(', '\x2', '\x2', '\x163', '\x164', '\a', '?', '\x2', '\x2', '\x164', - '\x43', '\x3', '\x2', '\x2', '\x2', '\x165', '\x166', '\a', '~', '\x2', - '\x2', '\x166', '\x167', '\a', '?', '\x2', '\x2', '\x167', '\x45', '\x3', - '\x2', '\x2', '\x2', '\x168', '\x169', '\a', '`', '\x2', '\x2', '\x169', - '\x16A', '\a', '?', '\x2', '\x2', '\x16A', 'G', '\x3', '\x2', '\x2', '\x2', - '\x16B', '\x16C', '\a', '>', '\x2', '\x2', '\x16C', '\x16D', '\a', '>', - '\x2', '\x2', '\x16D', '\x16E', '\a', '?', '\x2', '\x2', '\x16E', 'I', - '\x3', '\x2', '\x2', '\x2', '\x16F', '\x170', '\a', '@', '\x2', '\x2', - '\x170', '\x171', '\a', '@', '\x2', '\x2', '\x171', '\x172', '\a', '?', - '\x2', '\x2', '\x172', 'K', '\x3', '\x2', '\x2', '\x2', '\x173', '\x174', - '\a', '~', '\x2', '\x2', '\x174', '\x175', '\a', '~', '\x2', '\x2', '\x175', - 'M', '\x3', '\x2', '\x2', '\x2', '\x176', '\x177', '\a', '(', '\x2', '\x2', - '\x177', '\x178', '\a', '(', '\x2', '\x2', '\x178', 'O', '\x3', '\x2', - '\x2', '\x2', '\x179', '\x17A', '\a', '#', '\x2', '\x2', '\x17A', '\x17B', - '\a', '?', '\x2', '\x2', '\x17B', 'Q', '\x3', '\x2', '\x2', '\x2', '\x17C', - '\x17D', '\a', '?', '\x2', '\x2', '\x17D', '\x17E', '\a', '?', '\x2', - '\x2', '\x17E', 'S', '\x3', '\x2', '\x2', '\x2', '\x17F', '\x180', '\a', - '@', '\x2', '\x2', '\x180', 'U', '\x3', '\x2', '\x2', '\x2', '\x181', - '\x182', '\a', '@', '\x2', '\x2', '\x182', '\x183', '\a', '@', '\x2', - '\x2', '\x183', 'W', '\x3', '\x2', '\x2', '\x2', '\x184', '\x185', '\a', - '@', '\x2', '\x2', '\x185', '\x186', '\a', '?', '\x2', '\x2', '\x186', - 'Y', '\x3', '\x2', '\x2', '\x2', '\x187', '\x188', '\a', '>', '\x2', '\x2', - '\x188', '[', '\x3', '\x2', '\x2', '\x2', '\x189', '\x18A', '\a', '>', - '\x2', '\x2', '\x18A', '\x18B', '\a', '>', '\x2', '\x2', '\x18B', ']', - '\x3', '\x2', '\x2', '\x2', '\x18C', '\x18D', '\a', '>', '\x2', '\x2', - '\x18D', '\x18E', '\a', '?', '\x2', '\x2', '\x18E', '_', '\x3', '\x2', - '\x2', '\x2', '\x18F', '\x190', '\a', '/', '\x2', '\x2', '\x190', '\x61', - '\x3', '\x2', '\x2', '\x2', '\x191', '\x192', '\a', '/', '\x2', '\x2', - '\x192', '\x193', '\a', '/', '\x2', '\x2', '\x193', '\x63', '\x3', '\x2', - '\x2', '\x2', '\x194', '\x195', '\a', '-', '\x2', '\x2', '\x195', '\x65', - '\x3', '\x2', '\x2', '\x2', '\x196', '\x197', '\a', '-', '\x2', '\x2', - '\x197', '\x198', '\a', '-', '\x2', '\x2', '\x198', 'g', '\x3', '\x2', - '\x2', '\x2', '\x199', '\x19A', '\a', '\x31', '\x2', '\x2', '\x19A', 'i', - '\x3', '\x2', '\x2', '\x2', '\x19B', '\x19C', '\a', ',', '\x2', '\x2', - '\x19C', 'k', '\x3', '\x2', '\x2', '\x2', '\x19D', '\x19E', '\a', '#', - '\x2', '\x2', '\x19E', 'm', '\x3', '\x2', '\x2', '\x2', '\x19F', '\x1A0', - '\a', '\x30', '\x2', '\x2', '\x1A0', 'o', '\x3', '\x2', '\x2', '\x2', - '\x1A1', '\x1A2', '\a', '\x41', '\x2', '\x2', '\x1A2', 'q', '\x3', '\x2', - '\x2', '\x2', '\x1A3', '\x1A4', '\a', '<', '\x2', '\x2', '\x1A4', 's', - '\x3', '\x2', '\x2', '\x2', '\x1A5', '\x1A6', '\a', '/', '\x2', '\x2', - '\x1A6', '\x1A7', '\a', '@', '\x2', '\x2', '\x1A7', 'u', '\x3', '\x2', - '\x2', '\x2', '\x1A8', '\x1A9', '\a', '\'', '\x2', '\x2', '\x1A9', 'w', - '\x3', '\x2', '\x2', '\x2', '\x1AA', '\x1AB', '\a', '\x80', '\x2', '\x2', - '\x1AB', 'y', '\x3', '\x2', '\x2', '\x2', '\x1AC', '\x1AD', '\a', '(', - '\x2', '\x2', '\x1AD', '{', '\x3', '\x2', '\x2', '\x2', '\x1AE', '\x1AF', - '\a', '`', '\x2', '\x2', '\x1AF', '}', '\x3', '\x2', '\x2', '\x2', '\x1B0', - '\x1B1', '\a', '~', '\x2', '\x2', '\x1B1', '\x7F', '\x3', '\x2', '\x2', - '\x2', '\x1B2', '\x1B3', '\a', '*', '\x2', '\x2', '\x1B3', '\x81', '\x3', - '\x2', '\x2', '\x2', '\x1B4', '\x1B5', '\a', '+', '\x2', '\x2', '\x1B5', - '\x83', '\x3', '\x2', '\x2', '\x2', '\x1B6', '\x1B7', '\a', ']', '\x2', - '\x2', '\x1B7', '\x85', '\x3', '\x2', '\x2', '\x2', '\x1B8', '\x1B9', - '\a', '_', '\x2', '\x2', '\x1B9', '\x87', '\x3', '\x2', '\x2', '\x2', - '\x1BA', '\x1BB', '\a', '.', '\x2', '\x2', '\x1BB', '\x89', '\x3', '\x2', - '\x2', '\x2', '\x1BC', '\x1BD', '\a', '=', '\x2', '\x2', '\x1BD', '\x8B', - '\x3', '\x2', '\x2', '\x2', '\x1BE', '\x1BF', '\a', '&', '\x2', '\x2', - '\x1BF', '\x8D', '\x3', '\x2', '\x2', '\x2', '\x1C0', '\x1C3', '\x5', - '\x90', 'H', '\x2', '\x1C1', '\x1C3', '\x5', '\x92', 'I', '\x2', '\x1C2', - '\x1C0', '\x3', '\x2', '\x2', '\x2', '\x1C2', '\x1C1', '\x3', '\x2', '\x2', - '\x2', '\x1C3', '\x8F', '\x3', '\x2', '\x2', '\x2', '\x1C4', '\x1C5', - '\a', 'h', '\x2', '\x2', '\x1C5', '\x1C6', '\a', '\x63', '\x2', '\x2', - '\x1C6', '\x1C7', '\a', 'n', '\x2', '\x2', '\x1C7', '\x1C8', '\a', 'u', - '\x2', '\x2', '\x1C8', '\x1C9', '\a', 'g', '\x2', '\x2', '\x1C9', '\x91', - '\x3', '\x2', '\x2', '\x2', '\x1CA', '\x1CB', '\a', 'v', '\x2', '\x2', - '\x1CB', '\x1CC', '\a', 't', '\x2', '\x2', '\x1CC', '\x1CD', '\a', 'w', - '\x2', '\x2', '\x1CD', '\x1CE', '\a', 'g', '\x2', '\x2', '\x1CE', '\x93', - '\x3', '\x2', '\x2', '\x2', '\x1CF', '\x1D0', '\x5', '\x9A', 'M', '\x2', - '\x1D0', '\x95', '\x3', '\x2', '\x2', '\x2', '\x1D1', '\x1D3', '\x5', - '\x9E', 'O', '\x2', '\x1D2', '\x1D4', '\x5', '\xA0', 'P', '\x2', '\x1D3', - '\x1D2', '\x3', '\x2', '\x2', '\x2', '\x1D3', '\x1D4', '\x3', '\x2', '\x2', - '\x2', '\x1D4', '\x1D9', '\x3', '\x2', '\x2', '\x2', '\x1D5', '\x1D6', - '\x5', '\xA4', 'R', '\x2', '\x1D6', '\x1D7', '\x5', '\xA0', 'P', '\x2', - '\x1D7', '\x1D9', '\x3', '\x2', '\x2', '\x2', '\x1D8', '\x1D1', '\x3', - '\x2', '\x2', '\x2', '\x1D8', '\x1D5', '\x3', '\x2', '\x2', '\x2', '\x1D9', - '\x97', '\x3', '\x2', '\x2', '\x2', '\x1DA', '\x1DB', '\t', '\x2', '\x2', - '\x2', '\x1DB', '\x99', '\x3', '\x2', '\x2', '\x2', '\x1DC', '\x1DE', - '\x5', '\x98', 'L', '\x2', '\x1DD', '\x1DC', '\x3', '\x2', '\x2', '\x2', - '\x1DE', '\x1DF', '\x3', '\x2', '\x2', '\x2', '\x1DF', '\x1DD', '\x3', - '\x2', '\x2', '\x2', '\x1DF', '\x1E0', '\x3', '\x2', '\x2', '\x2', '\x1E0', - '\x9B', '\x3', '\x2', '\x2', '\x2', '\x1E1', '\x1E2', '\t', '\x3', '\x2', - '\x2', '\x1E2', '\x9D', '\x3', '\x2', '\x2', '\x2', '\x1E3', '\x1E5', - '\x5', '\xA4', 'R', '\x2', '\x1E4', '\x1E3', '\x3', '\x2', '\x2', '\x2', - '\x1E4', '\x1E5', '\x3', '\x2', '\x2', '\x2', '\x1E5', '\x1E6', '\x3', - '\x2', '\x2', '\x2', '\x1E6', '\x1E7', '\a', '\x30', '\x2', '\x2', '\x1E7', - '\x1EC', '\x5', '\xA4', 'R', '\x2', '\x1E8', '\x1E9', '\x5', '\xA4', 'R', - '\x2', '\x1E9', '\x1EA', '\a', '\x30', '\x2', '\x2', '\x1EA', '\x1EC', - '\x3', '\x2', '\x2', '\x2', '\x1EB', '\x1E4', '\x3', '\x2', '\x2', '\x2', - '\x1EB', '\x1E8', '\x3', '\x2', '\x2', '\x2', '\x1EC', '\x9F', '\x3', - '\x2', '\x2', '\x2', '\x1ED', '\x1EF', '\a', 'g', '\x2', '\x2', '\x1EE', - '\x1F0', '\x5', '\xA2', 'Q', '\x2', '\x1EF', '\x1EE', '\x3', '\x2', '\x2', - '\x2', '\x1EF', '\x1F0', '\x3', '\x2', '\x2', '\x2', '\x1F0', '\x1F1', - '\x3', '\x2', '\x2', '\x2', '\x1F1', '\x1F8', '\x5', '\xA4', 'R', '\x2', - '\x1F2', '\x1F4', '\a', 'G', '\x2', '\x2', '\x1F3', '\x1F5', '\x5', '\xA2', - 'Q', '\x2', '\x1F4', '\x1F3', '\x3', '\x2', '\x2', '\x2', '\x1F4', '\x1F5', - '\x3', '\x2', '\x2', '\x2', '\x1F5', '\x1F6', '\x3', '\x2', '\x2', '\x2', - '\x1F6', '\x1F8', '\x5', '\xA4', 'R', '\x2', '\x1F7', '\x1ED', '\x3', - '\x2', '\x2', '\x2', '\x1F7', '\x1F2', '\x3', '\x2', '\x2', '\x2', '\x1F8', - '\xA1', '\x3', '\x2', '\x2', '\x2', '\x1F9', '\x1FA', '\t', '\x4', '\x2', - '\x2', '\x1FA', '\xA3', '\x3', '\x2', '\x2', '\x2', '\x1FB', '\x202', - '\x5', '\x98', 'L', '\x2', '\x1FC', '\x1FE', '\a', ')', '\x2', '\x2', - '\x1FD', '\x1FC', '\x3', '\x2', '\x2', '\x2', '\x1FD', '\x1FE', '\x3', - '\x2', '\x2', '\x2', '\x1FE', '\x1FF', '\x3', '\x2', '\x2', '\x2', '\x1FF', - '\x201', '\x5', '\x98', 'L', '\x2', '\x200', '\x1FD', '\x3', '\x2', '\x2', - '\x2', '\x201', '\x204', '\x3', '\x2', '\x2', '\x2', '\x202', '\x200', - '\x3', '\x2', '\x2', '\x2', '\x202', '\x203', '\x3', '\x2', '\x2', '\x2', - '\x203', '\xA5', '\x3', '\x2', '\x2', '\x2', '\x204', '\x202', '\x3', - '\x2', '\x2', '\x2', '\x205', '\x209', '\t', '\x5', '\x2', '\x2', '\x206', - '\x208', '\t', '\x6', '\x2', '\x2', '\x207', '\x206', '\x3', '\x2', '\x2', - '\x2', '\x208', '\x20B', '\x3', '\x2', '\x2', '\x2', '\x209', '\x207', - '\x3', '\x2', '\x2', '\x2', '\x209', '\x20A', '\x3', '\x2', '\x2', '\x2', - '\x20A', '\xA7', '\x3', '\x2', '\x2', '\x2', '\x20B', '\x209', '\x3', - '\x2', '\x2', '\x2', '\x20C', '\x20D', '\a', '\x31', '\x2', '\x2', '\x20D', - '\x20E', '\a', ',', '\x2', '\x2', '\x20E', '\x212', '\x3', '\x2', '\x2', - '\x2', '\x20F', '\x211', '\v', '\x2', '\x2', '\x2', '\x210', '\x20F', - '\x3', '\x2', '\x2', '\x2', '\x211', '\x214', '\x3', '\x2', '\x2', '\x2', - '\x212', '\x213', '\x3', '\x2', '\x2', '\x2', '\x212', '\x210', '\x3', - '\x2', '\x2', '\x2', '\x213', '\x215', '\x3', '\x2', '\x2', '\x2', '\x214', - '\x212', '\x3', '\x2', '\x2', '\x2', '\x215', '\x216', '\a', ',', '\x2', - '\x2', '\x216', '\x217', '\a', '\x31', '\x2', '\x2', '\x217', '\x218', - '\x3', '\x2', '\x2', '\x2', '\x218', '\x219', '\b', 'T', '\x2', '\x2', - '\x219', '\xA9', '\x3', '\x2', '\x2', '\x2', '\x21A', '\x21C', '\t', '\a', - '\x2', '\x2', '\x21B', '\x21A', '\x3', '\x2', '\x2', '\x2', '\x21C', '\x21D', - '\x3', '\x2', '\x2', '\x2', '\x21D', '\x21B', '\x3', '\x2', '\x2', '\x2', - '\x21D', '\x21E', '\x3', '\x2', '\x2', '\x2', '\x21E', '\x21F', '\x3', - '\x2', '\x2', '\x2', '\x21F', '\x220', '\b', 'U', '\x2', '\x2', '\x220', - '\xAB', '\x3', '\x2', '\x2', '\x2', '\x221', '\x222', '\a', '\x31', '\x2', - '\x2', '\x222', '\x223', '\a', '\x31', '\x2', '\x2', '\x223', '\x227', - '\x3', '\x2', '\x2', '\x2', '\x224', '\x226', '\n', '\b', '\x2', '\x2', - '\x225', '\x224', '\x3', '\x2', '\x2', '\x2', '\x226', '\x229', '\x3', - '\x2', '\x2', '\x2', '\x227', '\x225', '\x3', '\x2', '\x2', '\x2', '\x227', - '\x228', '\x3', '\x2', '\x2', '\x2', '\x228', '\x22B', '\x3', '\x2', '\x2', - '\x2', '\x229', '\x227', '\x3', '\x2', '\x2', '\x2', '\x22A', '\x22C', - '\a', '\xF', '\x2', '\x2', '\x22B', '\x22A', '\x3', '\x2', '\x2', '\x2', - '\x22B', '\x22C', '\x3', '\x2', '\x2', '\x2', '\x22C', '\x22D', '\x3', - '\x2', '\x2', '\x2', '\x22D', '\x22E', '\a', '\f', '\x2', '\x2', '\x22E', - '\x22F', '\x3', '\x2', '\x2', '\x2', '\x22F', '\x230', '\b', 'V', '\x2', - '\x2', '\x230', '\xAD', '\x3', '\x2', '\x2', '\x2', '\x231', '\x232', - '\a', '$', '\x2', '\x2', '\x232', '\x233', '\x3', '\x2', '\x2', '\x2', - '\x233', '\x234', '\b', 'W', '\x3', '\x2', '\x234', '\xAF', '\x3', '\x2', - '\x2', '\x2', '\x235', '\x236', '\a', '}', '\x2', '\x2', '\x236', '\x237', - '\x3', '\x2', '\x2', '\x2', '\x237', '\x238', '\b', 'X', '\x4', '\x2', - '\x238', '\xB1', '\x3', '\x2', '\x2', '\x2', '\x239', '\x23A', '\a', '\x7F', - '\x2', '\x2', '\x23A', '\x23B', '\x3', '\x2', '\x2', '\x2', '\x23B', '\x23C', - '\b', 'Y', '\x5', '\x2', '\x23C', '\xB3', '\x3', '\x2', '\x2', '\x2', - '\x23D', '\x23F', '\n', '\t', '\x2', '\x2', '\x23E', '\x23D', '\x3', '\x2', - '\x2', '\x2', '\x23F', '\x240', '\x3', '\x2', '\x2', '\x2', '\x240', '\x23E', - '\x3', '\x2', '\x2', '\x2', '\x240', '\x241', '\x3', '\x2', '\x2', '\x2', - '\x241', '\xB5', '\x3', '\x2', '\x2', '\x2', '\x242', '\x243', '\a', '&', - '\x2', '\x2', '\x243', '\x244', '\a', '}', '\x2', '\x2', '\x244', '\x245', - '\x3', '\x2', '\x2', '\x2', '\x245', '\x246', '\b', '[', '\x4', '\x2', - '\x246', '\xB7', '\x3', '\x2', '\x2', '\x2', '\x247', '\x248', '\a', '^', - '\x2', '\x2', '\x248', '\x249', '\v', '\x2', '\x2', '\x2', '\x249', '\xB9', - '\x3', '\x2', '\x2', '\x2', '\x24A', '\x24B', '\a', '$', '\x2', '\x2', - '\x24B', '\x24C', '\x3', '\x2', '\x2', '\x2', '\x24C', '\x24D', '\b', - ']', '\x6', '\x2', '\x24D', '\x24E', '\b', ']', '\x5', '\x2', '\x24E', - '\xBB', '\x3', '\x2', '\x2', '\x2', '\x15', '\x2', '\x3', '\x1C2', '\x1D3', - '\x1D8', '\x1DF', '\x1E4', '\x1EB', '\x1EF', '\x1F4', '\x1F7', '\x1FD', - '\x202', '\x209', '\x212', '\x21D', '\x227', '\x22B', '\x240', '\a', '\b', + '\x46', '\x3', 'G', '\x3', 'G', '\x3', 'H', '\x3', 'H', '\x3', 'I', '\x3', + 'I', '\x3', 'J', '\x3', 'J', '\x3', 'K', '\x3', 'K', '\x5', 'K', '\x1E1', + '\n', 'K', '\x3', 'L', '\x3', 'L', '\x3', 'L', '\x3', 'L', '\x3', 'L', + '\x3', 'L', '\x3', 'M', '\x3', 'M', '\x3', 'M', '\x3', 'M', '\x3', 'M', + '\x3', 'N', '\x3', 'N', '\x3', 'O', '\x3', 'O', '\x5', 'O', '\x1F2', '\n', + 'O', '\x3', 'O', '\x3', 'O', '\x3', 'O', '\x5', 'O', '\x1F7', '\n', 'O', + '\x3', 'P', '\x3', 'P', '\x3', 'Q', '\x6', 'Q', '\x1FC', '\n', 'Q', '\r', + 'Q', '\xE', 'Q', '\x1FD', '\x3', 'R', '\x3', 'R', '\x3', 'S', '\x5', 'S', + '\x203', '\n', 'S', '\x3', 'S', '\x3', 'S', '\x3', 'S', '\x3', 'S', '\x3', + 'S', '\x5', 'S', '\x20A', '\n', 'S', '\x3', 'T', '\x3', 'T', '\x5', 'T', + '\x20E', '\n', 'T', '\x3', 'T', '\x3', 'T', '\x3', 'T', '\x5', 'T', '\x213', + '\n', 'T', '\x3', 'T', '\x5', 'T', '\x216', '\n', 'T', '\x3', 'U', '\x3', + 'U', '\x3', 'V', '\x3', 'V', '\x5', 'V', '\x21C', '\n', 'V', '\x3', 'V', + '\a', 'V', '\x21F', '\n', 'V', '\f', 'V', '\xE', 'V', '\x222', '\v', 'V', + '\x3', 'W', '\x3', 'W', '\a', 'W', '\x226', '\n', 'W', '\f', 'W', '\xE', + 'W', '\x229', '\v', 'W', '\x3', 'X', '\x3', 'X', '\x3', 'X', '\x3', 'X', + '\a', 'X', '\x22F', '\n', 'X', '\f', 'X', '\xE', 'X', '\x232', '\v', 'X', + '\x3', 'X', '\x3', 'X', '\x3', 'X', '\x3', 'X', '\x3', 'X', '\x3', 'Y', + '\x6', 'Y', '\x23A', '\n', 'Y', '\r', 'Y', '\xE', 'Y', '\x23B', '\x3', + 'Y', '\x3', 'Y', '\x3', 'Z', '\x3', 'Z', '\x3', 'Z', '\x3', 'Z', '\a', + 'Z', '\x244', '\n', 'Z', '\f', 'Z', '\xE', 'Z', '\x247', '\v', 'Z', '\x3', + 'Z', '\x5', 'Z', '\x24A', '\n', 'Z', '\x3', 'Z', '\x3', 'Z', '\x3', 'Z', + '\x3', 'Z', '\x3', '[', '\x3', '[', '\x3', '[', '\x3', '[', '\x3', '\\', + '\x3', '\\', '\x3', '\\', '\x3', '\\', '\x3', ']', '\x3', ']', '\x3', + ']', '\x3', ']', '\x3', '^', '\x6', '^', '\x25D', '\n', '^', '\r', '^', + '\xE', '^', '\x25E', '\x3', '_', '\x3', '_', '\x3', '_', '\x3', '_', '\x3', + '_', '\x3', '`', '\x3', '`', '\x3', '`', '\x3', '\x61', '\x3', '\x61', + '\x3', '\x61', '\x3', '\x61', '\x3', '\x61', '\x3', '\x230', '\x2', '\x62', + '\x4', '\x3', '\x6', '\x4', '\b', '\x5', '\n', '\x6', '\f', '\a', '\xE', + '\b', '\x10', '\t', '\x12', '\n', '\x14', '\v', '\x16', '\f', '\x18', + '\r', '\x1A', '\xE', '\x1C', '\xF', '\x1E', '\x10', ' ', '\x11', '\"', + '\x12', '$', '\x13', '&', '\x14', '(', '\x15', '*', '\x16', ',', '\x17', + '.', '\x18', '\x30', '\x19', '\x32', '\x1A', '\x34', '\x1B', '\x36', '\x1C', + '\x38', '\x1D', ':', '\x1E', '<', '\x1F', '>', ' ', '@', '!', '\x42', + '\"', '\x44', '#', '\x46', '$', 'H', '%', 'J', '&', 'L', '\'', 'N', '(', + 'P', ')', 'R', '*', 'T', '+', 'V', ',', 'X', '-', 'Z', '.', '\\', '/', + '^', '\x30', '`', '\x31', '\x62', '\x32', '\x64', '\x33', '\x66', '\x34', + 'h', '\x35', 'j', '\x36', 'l', '\x37', 'n', '\x38', 'p', '\x39', 'r', + ':', 't', ';', 'v', '<', 'x', '=', 'z', '>', '|', '?', '~', '@', '\x80', + '\x41', '\x82', '\x42', '\x84', '\x43', '\x86', '\x44', '\x88', '\x45', + '\x8A', '\x46', '\x8C', 'G', '\x8E', 'H', '\x90', 'I', '\x92', 'J', '\x94', + 'K', '\x96', 'L', '\x98', 'M', '\x9A', 'N', '\x9C', 'O', '\x9E', 'P', + '\xA0', '\x2', '\xA2', 'Q', '\xA4', '\x2', '\xA6', '\x2', '\xA8', '\x2', + '\xAA', '\x2', '\xAC', '\x2', '\xAE', 'R', '\xB0', 'S', '\xB2', 'T', '\xB4', + 'U', '\xB6', 'V', '\xB8', 'W', '\xBA', 'X', '\xBC', 'Y', '\xBE', 'Z', + '\xC0', '[', '\xC2', '\x2', '\x4', '\x2', '\x3', '\n', '\x3', '\x2', '\x32', + ';', '\x3', '\x2', '\x33', ';', '\x4', '\x2', '-', '-', '/', '/', '\x5', + '\x2', '\x43', '\\', '\x61', '\x61', '\x63', '|', '\x6', '\x2', '\x32', + ';', '\x43', '\\', '\x61', '\x61', '\x63', '|', '\x5', '\x2', '\v', '\f', + '\xE', '\xF', '\"', '\"', '\x4', '\x2', '\f', '\f', '\xF', '\xF', '\x5', + '\x2', '$', '$', '&', '&', '^', '^', '\x2', '\x276', '\x2', '\x4', '\x3', + '\x2', '\x2', '\x2', '\x2', '\x6', '\x3', '\x2', '\x2', '\x2', '\x2', + '\b', '\x3', '\x2', '\x2', '\x2', '\x2', '\n', '\x3', '\x2', '\x2', '\x2', + '\x2', '\f', '\x3', '\x2', '\x2', '\x2', '\x2', '\xE', '\x3', '\x2', '\x2', + '\x2', '\x2', '\x10', '\x3', '\x2', '\x2', '\x2', '\x2', '\x12', '\x3', + '\x2', '\x2', '\x2', '\x2', '\x14', '\x3', '\x2', '\x2', '\x2', '\x2', + '\x16', '\x3', '\x2', '\x2', '\x2', '\x2', '\x18', '\x3', '\x2', '\x2', + '\x2', '\x2', '\x1A', '\x3', '\x2', '\x2', '\x2', '\x2', '\x1C', '\x3', + '\x2', '\x2', '\x2', '\x2', '\x1E', '\x3', '\x2', '\x2', '\x2', '\x2', + ' ', '\x3', '\x2', '\x2', '\x2', '\x2', '\"', '\x3', '\x2', '\x2', '\x2', + '\x2', '$', '\x3', '\x2', '\x2', '\x2', '\x2', '&', '\x3', '\x2', '\x2', + '\x2', '\x2', '(', '\x3', '\x2', '\x2', '\x2', '\x2', '*', '\x3', '\x2', + '\x2', '\x2', '\x2', ',', '\x3', '\x2', '\x2', '\x2', '\x2', '.', '\x3', + '\x2', '\x2', '\x2', '\x2', '\x30', '\x3', '\x2', '\x2', '\x2', '\x2', + '\x32', '\x3', '\x2', '\x2', '\x2', '\x2', '\x34', '\x3', '\x2', '\x2', + '\x2', '\x2', '\x36', '\x3', '\x2', '\x2', '\x2', '\x2', '\x38', '\x3', + '\x2', '\x2', '\x2', '\x2', ':', '\x3', '\x2', '\x2', '\x2', '\x2', '<', + '\x3', '\x2', '\x2', '\x2', '\x2', '>', '\x3', '\x2', '\x2', '\x2', '\x2', + '@', '\x3', '\x2', '\x2', '\x2', '\x2', '\x42', '\x3', '\x2', '\x2', '\x2', + '\x2', '\x44', '\x3', '\x2', '\x2', '\x2', '\x2', '\x46', '\x3', '\x2', + '\x2', '\x2', '\x2', 'H', '\x3', '\x2', '\x2', '\x2', '\x2', 'J', '\x3', + '\x2', '\x2', '\x2', '\x2', 'L', '\x3', '\x2', '\x2', '\x2', '\x2', 'N', + '\x3', '\x2', '\x2', '\x2', '\x2', 'P', '\x3', '\x2', '\x2', '\x2', '\x2', + 'R', '\x3', '\x2', '\x2', '\x2', '\x2', 'T', '\x3', '\x2', '\x2', '\x2', + '\x2', 'V', '\x3', '\x2', '\x2', '\x2', '\x2', 'X', '\x3', '\x2', '\x2', + '\x2', '\x2', 'Z', '\x3', '\x2', '\x2', '\x2', '\x2', '\\', '\x3', '\x2', + '\x2', '\x2', '\x2', '^', '\x3', '\x2', '\x2', '\x2', '\x2', '`', '\x3', + '\x2', '\x2', '\x2', '\x2', '\x62', '\x3', '\x2', '\x2', '\x2', '\x2', + '\x64', '\x3', '\x2', '\x2', '\x2', '\x2', '\x66', '\x3', '\x2', '\x2', + '\x2', '\x2', 'h', '\x3', '\x2', '\x2', '\x2', '\x2', 'j', '\x3', '\x2', + '\x2', '\x2', '\x2', 'l', '\x3', '\x2', '\x2', '\x2', '\x2', 'n', '\x3', + '\x2', '\x2', '\x2', '\x2', 'p', '\x3', '\x2', '\x2', '\x2', '\x2', 'r', + '\x3', '\x2', '\x2', '\x2', '\x2', 't', '\x3', '\x2', '\x2', '\x2', '\x2', + 'v', '\x3', '\x2', '\x2', '\x2', '\x2', 'x', '\x3', '\x2', '\x2', '\x2', + '\x2', 'z', '\x3', '\x2', '\x2', '\x2', '\x2', '|', '\x3', '\x2', '\x2', + '\x2', '\x2', '~', '\x3', '\x2', '\x2', '\x2', '\x2', '\x80', '\x3', '\x2', + '\x2', '\x2', '\x2', '\x82', '\x3', '\x2', '\x2', '\x2', '\x2', '\x84', + '\x3', '\x2', '\x2', '\x2', '\x2', '\x86', '\x3', '\x2', '\x2', '\x2', + '\x2', '\x88', '\x3', '\x2', '\x2', '\x2', '\x2', '\x8A', '\x3', '\x2', + '\x2', '\x2', '\x2', '\x8C', '\x3', '\x2', '\x2', '\x2', '\x2', '\x8E', + '\x3', '\x2', '\x2', '\x2', '\x2', '\x90', '\x3', '\x2', '\x2', '\x2', + '\x2', '\x92', '\x3', '\x2', '\x2', '\x2', '\x2', '\x94', '\x3', '\x2', + '\x2', '\x2', '\x2', '\x96', '\x3', '\x2', '\x2', '\x2', '\x2', '\x98', + '\x3', '\x2', '\x2', '\x2', '\x2', '\x9A', '\x3', '\x2', '\x2', '\x2', + '\x2', '\x9C', '\x3', '\x2', '\x2', '\x2', '\x2', '\x9E', '\x3', '\x2', + '\x2', '\x2', '\x2', '\xA2', '\x3', '\x2', '\x2', '\x2', '\x2', '\xAE', + '\x3', '\x2', '\x2', '\x2', '\x2', '\xB0', '\x3', '\x2', '\x2', '\x2', + '\x2', '\xB2', '\x3', '\x2', '\x2', '\x2', '\x2', '\xB4', '\x3', '\x2', + '\x2', '\x2', '\x2', '\xB6', '\x3', '\x2', '\x2', '\x2', '\x2', '\xB8', + '\x3', '\x2', '\x2', '\x2', '\x2', '\xBA', '\x3', '\x2', '\x2', '\x2', + '\x3', '\xBC', '\x3', '\x2', '\x2', '\x2', '\x3', '\xBE', '\x3', '\x2', + '\x2', '\x2', '\x3', '\xC0', '\x3', '\x2', '\x2', '\x2', '\x3', '\xC2', + '\x3', '\x2', '\x2', '\x2', '\x4', '\xC4', '\x3', '\x2', '\x2', '\x2', + '\x6', '\xCB', '\x3', '\x2', '\x2', '\x2', '\b', '\xD1', '\x3', '\x2', + '\x2', '\x2', '\n', '\xD8', '\x3', '\x2', '\x2', '\x2', '\f', '\xDC', + '\x3', '\x2', '\x2', '\x2', '\xE', '\xDF', '\x3', '\x2', '\x2', '\x2', + '\x10', '\xE6', '\x3', '\x2', '\x2', '\x2', '\x12', '\xEF', '\x3', '\x2', + '\x2', '\x2', '\x14', '\xF8', '\x3', '\x2', '\x2', '\x2', '\x16', '\xFC', + '\x3', '\x2', '\x2', '\x2', '\x18', '\x100', '\x3', '\x2', '\x2', '\x2', + '\x1A', '\x104', '\x3', '\x2', '\x2', '\x2', '\x1C', '\x108', '\x3', '\x2', + '\x2', '\x2', '\x1E', '\x10E', '\x3', '\x2', '\x2', '\x2', ' ', '\x115', + '\x3', '\x2', '\x2', '\x2', '\"', '\x11E', '\x3', '\x2', '\x2', '\x2', + '$', '\x125', '\x3', '\x2', '\x2', '\x2', '&', '\x12D', '\x3', '\x2', + '\x2', '\x2', '(', '\x130', '\x3', '\x2', '\x2', '\x2', '*', '\x135', + '\x3', '\x2', '\x2', '\x2', ',', '\x13C', '\x3', '\x2', '\x2', '\x2', + '.', '\x142', '\x3', '\x2', '\x2', '\x2', '\x30', '\x147', '\x3', '\x2', + '\x2', '\x2', '\x32', '\x14C', '\x3', '\x2', '\x2', '\x2', '\x34', '\x152', + '\x3', '\x2', '\x2', '\x2', '\x36', '\x159', '\x3', '\x2', '\x2', '\x2', + '\x38', '\x15F', '\x3', '\x2', '\x2', '\x2', ':', '\x163', '\x3', '\x2', + '\x2', '\x2', '<', '\x16A', '\x3', '\x2', '\x2', '\x2', '>', '\x16F', + '\x3', '\x2', '\x2', '\x2', '@', '\x171', '\x3', '\x2', '\x2', '\x2', + '\x42', '\x174', '\x3', '\x2', '\x2', '\x2', '\x44', '\x177', '\x3', '\x2', + '\x2', '\x2', '\x46', '\x17A', '\x3', '\x2', '\x2', '\x2', 'H', '\x17D', + '\x3', '\x2', '\x2', '\x2', 'J', '\x180', '\x3', '\x2', '\x2', '\x2', + 'L', '\x183', '\x3', '\x2', '\x2', '\x2', 'N', '\x186', '\x3', '\x2', + '\x2', '\x2', 'P', '\x189', '\x3', '\x2', '\x2', '\x2', 'R', '\x18D', + '\x3', '\x2', '\x2', '\x2', 'T', '\x191', '\x3', '\x2', '\x2', '\x2', + 'V', '\x194', '\x3', '\x2', '\x2', '\x2', 'X', '\x197', '\x3', '\x2', + '\x2', '\x2', 'Z', '\x19A', '\x3', '\x2', '\x2', '\x2', '\\', '\x19D', + '\x3', '\x2', '\x2', '\x2', '^', '\x19F', '\x3', '\x2', '\x2', '\x2', + '`', '\x1A2', '\x3', '\x2', '\x2', '\x2', '\x62', '\x1A5', '\x3', '\x2', + '\x2', '\x2', '\x64', '\x1A7', '\x3', '\x2', '\x2', '\x2', '\x66', '\x1AA', + '\x3', '\x2', '\x2', '\x2', 'h', '\x1AD', '\x3', '\x2', '\x2', '\x2', + 'j', '\x1AF', '\x3', '\x2', '\x2', '\x2', 'l', '\x1B2', '\x3', '\x2', + '\x2', '\x2', 'n', '\x1B4', '\x3', '\x2', '\x2', '\x2', 'p', '\x1B7', + '\x3', '\x2', '\x2', '\x2', 'r', '\x1B9', '\x3', '\x2', '\x2', '\x2', + 't', '\x1BB', '\x3', '\x2', '\x2', '\x2', 'v', '\x1BD', '\x3', '\x2', + '\x2', '\x2', 'x', '\x1BF', '\x3', '\x2', '\x2', '\x2', 'z', '\x1C1', + '\x3', '\x2', '\x2', '\x2', '|', '\x1C3', '\x3', '\x2', '\x2', '\x2', + '~', '\x1C6', '\x3', '\x2', '\x2', '\x2', '\x80', '\x1C8', '\x3', '\x2', + '\x2', '\x2', '\x82', '\x1CA', '\x3', '\x2', '\x2', '\x2', '\x84', '\x1CC', + '\x3', '\x2', '\x2', '\x2', '\x86', '\x1CE', '\x3', '\x2', '\x2', '\x2', + '\x88', '\x1D0', '\x3', '\x2', '\x2', '\x2', '\x8A', '\x1D2', '\x3', '\x2', + '\x2', '\x2', '\x8C', '\x1D4', '\x3', '\x2', '\x2', '\x2', '\x8E', '\x1D6', + '\x3', '\x2', '\x2', '\x2', '\x90', '\x1D8', '\x3', '\x2', '\x2', '\x2', + '\x92', '\x1DA', '\x3', '\x2', '\x2', '\x2', '\x94', '\x1DC', '\x3', '\x2', + '\x2', '\x2', '\x96', '\x1E0', '\x3', '\x2', '\x2', '\x2', '\x98', '\x1E2', + '\x3', '\x2', '\x2', '\x2', '\x9A', '\x1E8', '\x3', '\x2', '\x2', '\x2', + '\x9C', '\x1ED', '\x3', '\x2', '\x2', '\x2', '\x9E', '\x1F6', '\x3', '\x2', + '\x2', '\x2', '\xA0', '\x1F8', '\x3', '\x2', '\x2', '\x2', '\xA2', '\x1FB', + '\x3', '\x2', '\x2', '\x2', '\xA4', '\x1FF', '\x3', '\x2', '\x2', '\x2', + '\xA6', '\x209', '\x3', '\x2', '\x2', '\x2', '\xA8', '\x215', '\x3', '\x2', + '\x2', '\x2', '\xAA', '\x217', '\x3', '\x2', '\x2', '\x2', '\xAC', '\x219', + '\x3', '\x2', '\x2', '\x2', '\xAE', '\x223', '\x3', '\x2', '\x2', '\x2', + '\xB0', '\x22A', '\x3', '\x2', '\x2', '\x2', '\xB2', '\x239', '\x3', '\x2', + '\x2', '\x2', '\xB4', '\x23F', '\x3', '\x2', '\x2', '\x2', '\xB6', '\x24F', + '\x3', '\x2', '\x2', '\x2', '\xB8', '\x253', '\x3', '\x2', '\x2', '\x2', + '\xBA', '\x257', '\x3', '\x2', '\x2', '\x2', '\xBC', '\x25C', '\x3', '\x2', + '\x2', '\x2', '\xBE', '\x260', '\x3', '\x2', '\x2', '\x2', '\xC0', '\x265', + '\x3', '\x2', '\x2', '\x2', '\xC2', '\x268', '\x3', '\x2', '\x2', '\x2', + '\xC4', '\xC5', '\a', 'o', '\x2', '\x2', '\xC5', '\xC6', '\a', 'q', '\x2', + '\x2', '\xC6', '\xC7', '\a', '\x66', '\x2', '\x2', '\xC7', '\xC8', '\a', + 'w', '\x2', '\x2', '\xC8', '\xC9', '\a', 'n', '\x2', '\x2', '\xC9', '\xCA', + '\a', 'g', '\x2', '\x2', '\xCA', '\x5', '\x3', '\x2', '\x2', '\x2', '\xCB', + '\xCC', '\a', '\x65', '\x2', '\x2', '\xCC', '\xCD', '\a', 'n', '\x2', + '\x2', '\xCD', '\xCE', '\a', '\x63', '\x2', '\x2', '\xCE', '\xCF', '\a', + 'u', '\x2', '\x2', '\xCF', '\xD0', '\a', 'u', '\x2', '\x2', '\xD0', '\a', + '\x3', '\x2', '\x2', '\x2', '\xD1', '\xD2', '\a', 'u', '\x2', '\x2', '\xD2', + '\xD3', '\a', 'v', '\x2', '\x2', '\xD3', '\xD4', '\a', 't', '\x2', '\x2', + '\xD4', '\xD5', '\a', 'w', '\x2', '\x2', '\xD5', '\xD6', '\a', '\x65', + '\x2', '\x2', '\xD6', '\xD7', '\a', 'v', '\x2', '\x2', '\xD7', '\t', '\x3', + '\x2', '\x2', '\x2', '\xD8', '\xD9', '\a', 'p', '\x2', '\x2', '\xD9', + '\xDA', '\a', 'g', '\x2', '\x2', '\xDA', '\xDB', '\a', 'y', '\x2', '\x2', + '\xDB', '\v', '\x3', '\x2', '\x2', '\x2', '\xDC', '\xDD', '\a', '\x63', + '\x2', '\x2', '\xDD', '\xDE', '\a', 'u', '\x2', '\x2', '\xDE', '\r', '\x3', + '\x2', '\x2', '\x2', '\xDF', '\xE0', '\a', 'g', '\x2', '\x2', '\xE0', + '\xE1', '\a', 'z', '\x2', '\x2', '\xE1', '\xE2', '\a', 'v', '\x2', '\x2', + '\xE2', '\xE3', '\a', 'g', '\x2', '\x2', '\xE3', '\xE4', '\a', 't', '\x2', + '\x2', '\xE4', '\xE5', '\a', 'p', '\x2', '\x2', '\xE5', '\xF', '\x3', + '\x2', '\x2', '\x2', '\xE6', '\xE7', '\a', '\x65', '\x2', '\x2', '\xE7', + '\xE8', '\a', '\x63', '\x2', '\x2', '\xE8', '\xE9', '\a', 'n', '\x2', + '\x2', '\xE9', '\xEA', '\a', 'n', '\x2', '\x2', '\xEA', '\xEB', '\a', + '\x63', '\x2', '\x2', '\xEB', '\xEC', '\a', '\x64', '\x2', '\x2', '\xEC', + '\xED', '\a', 'n', '\x2', '\x2', '\xED', '\xEE', '\a', 'g', '\x2', '\x2', + '\xEE', '\x11', '\x3', '\x2', '\x2', '\x2', '\xEF', '\xF0', '\a', 'h', + '\x2', '\x2', '\xF0', '\xF1', '\a', 'w', '\x2', '\x2', '\xF1', '\xF2', + '\a', 'p', '\x2', '\x2', '\xF2', '\xF3', '\a', '\x65', '\x2', '\x2', '\xF3', + '\xF4', '\a', 'v', '\x2', '\x2', '\xF4', '\xF5', '\a', 'k', '\x2', '\x2', + '\xF5', '\xF6', '\a', 'q', '\x2', '\x2', '\xF6', '\xF7', '\a', 'p', '\x2', + '\x2', '\xF7', '\x13', '\x3', '\x2', '\x2', '\x2', '\xF8', '\xF9', '\a', + 'x', '\x2', '\x2', '\xF9', '\xFA', '\a', '\x63', '\x2', '\x2', '\xFA', + '\xFB', '\a', 't', '\x2', '\x2', '\xFB', '\x15', '\x3', '\x2', '\x2', + '\x2', '\xFC', '\xFD', '\a', 'i', '\x2', '\x2', '\xFD', '\xFE', '\a', + 'g', '\x2', '\x2', '\xFE', '\xFF', '\a', 'v', '\x2', '\x2', '\xFF', '\x17', + '\x3', '\x2', '\x2', '\x2', '\x100', '\x101', '\a', 'u', '\x2', '\x2', + '\x101', '\x102', '\a', 'g', '\x2', '\x2', '\x102', '\x103', '\a', 'v', + '\x2', '\x2', '\x103', '\x19', '\x3', '\x2', '\x2', '\x2', '\x104', '\x105', + '\a', 'h', '\x2', '\x2', '\x105', '\x106', '\a', 'q', '\x2', '\x2', '\x106', + '\x107', '\a', 't', '\x2', '\x2', '\x107', '\x1B', '\x3', '\x2', '\x2', + '\x2', '\x108', '\x109', '\a', 'y', '\x2', '\x2', '\x109', '\x10A', '\a', + 'j', '\x2', '\x2', '\x10A', '\x10B', '\a', 'k', '\x2', '\x2', '\x10B', + '\x10C', '\a', 'n', '\x2', '\x2', '\x10C', '\x10D', '\a', 'g', '\x2', + '\x2', '\x10D', '\x1D', '\x3', '\x2', '\x2', '\x2', '\x10E', '\x10F', + '\a', 'u', '\x2', '\x2', '\x10F', '\x110', '\a', 'v', '\x2', '\x2', '\x110', + '\x111', '\a', '\x63', '\x2', '\x2', '\x111', '\x112', '\a', 'v', '\x2', + '\x2', '\x112', '\x113', '\a', 'k', '\x2', '\x2', '\x113', '\x114', '\a', + '\x65', '\x2', '\x2', '\x114', '\x1F', '\x3', '\x2', '\x2', '\x2', '\x115', + '\x116', '\a', '\x63', '\x2', '\x2', '\x116', '\x117', '\a', '\x64', '\x2', + '\x2', '\x117', '\x118', '\a', 'u', '\x2', '\x2', '\x118', '\x119', '\a', + 'v', '\x2', '\x2', '\x119', '\x11A', '\a', 't', '\x2', '\x2', '\x11A', + '\x11B', '\a', '\x63', '\x2', '\x2', '\x11B', '\x11C', '\a', '\x65', '\x2', + '\x2', '\x11C', '\x11D', '\a', 'v', '\x2', '\x2', '\x11D', '!', '\x3', + '\x2', '\x2', '\x2', '\x11E', '\x11F', '\a', 'r', '\x2', '\x2', '\x11F', + '\x120', '\a', 'w', '\x2', '\x2', '\x120', '\x121', '\a', '\x64', '\x2', + '\x2', '\x121', '\x122', '\a', 'n', '\x2', '\x2', '\x122', '\x123', '\a', + 'k', '\x2', '\x2', '\x123', '\x124', '\a', '\x65', '\x2', '\x2', '\x124', + '#', '\x3', '\x2', '\x2', '\x2', '\x125', '\x126', '\a', 'r', '\x2', '\x2', + '\x126', '\x127', '\a', 't', '\x2', '\x2', '\x127', '\x128', '\a', 'k', + '\x2', '\x2', '\x128', '\x129', '\a', 'x', '\x2', '\x2', '\x129', '\x12A', + '\a', '\x63', '\x2', '\x2', '\x12A', '\x12B', '\a', 'v', '\x2', '\x2', + '\x12B', '\x12C', '\a', 'g', '\x2', '\x2', '\x12C', '%', '\x3', '\x2', + '\x2', '\x2', '\x12D', '\x12E', '\a', 'k', '\x2', '\x2', '\x12E', '\x12F', + '\a', 'h', '\x2', '\x2', '\x12F', '\'', '\x3', '\x2', '\x2', '\x2', '\x130', + '\x131', '\a', 'g', '\x2', '\x2', '\x131', '\x132', '\a', 'n', '\x2', + '\x2', '\x132', '\x133', '\a', 'u', '\x2', '\x2', '\x133', '\x134', '\a', + 'g', '\x2', '\x2', '\x134', ')', '\x3', '\x2', '\x2', '\x2', '\x135', + '\x136', '\a', 't', '\x2', '\x2', '\x136', '\x137', '\a', 'g', '\x2', + '\x2', '\x137', '\x138', '\a', 'v', '\x2', '\x2', '\x138', '\x139', '\a', + 'w', '\x2', '\x2', '\x139', '\x13A', '\a', 't', '\x2', '\x2', '\x13A', + '\x13B', '\a', 'p', '\x2', '\x2', '\x13B', '+', '\x3', '\x2', '\x2', '\x2', + '\x13C', '\x13D', '\a', '\x64', '\x2', '\x2', '\x13D', '\x13E', '\a', + 't', '\x2', '\x2', '\x13E', '\x13F', '\a', 'g', '\x2', '\x2', '\x13F', + '\x140', '\a', '\x63', '\x2', '\x2', '\x140', '\x141', '\a', 'm', '\x2', + '\x2', '\x141', '-', '\x3', '\x2', '\x2', '\x2', '\x142', '\x143', '\a', + 'p', '\x2', '\x2', '\x143', '\x144', '\a', 'w', '\x2', '\x2', '\x144', + '\x145', '\a', 'n', '\x2', '\x2', '\x145', '\x146', '\a', 'n', '\x2', + '\x2', '\x146', '/', '\x3', '\x2', '\x2', '\x2', '\x147', '\x148', '\a', + 'v', '\x2', '\x2', '\x148', '\x149', '\a', 'j', '\x2', '\x2', '\x149', + '\x14A', '\a', 'k', '\x2', '\x2', '\x14A', '\x14B', '\a', 'u', '\x2', + '\x2', '\x14B', '\x31', '\x3', '\x2', '\x2', '\x2', '\x14C', '\x14D', + '\a', 'w', '\x2', '\x2', '\x14D', '\x14E', '\a', 'u', '\x2', '\x2', '\x14E', + '\x14F', '\a', 'k', '\x2', '\x2', '\x14F', '\x150', '\a', 'p', '\x2', + '\x2', '\x150', '\x151', '\a', 'i', '\x2', '\x2', '\x151', '\x33', '\x3', + '\x2', '\x2', '\x2', '\x152', '\x153', '\a', 'k', '\x2', '\x2', '\x153', + '\x154', '\a', 'o', '\x2', '\x2', '\x154', '\x155', '\a', 'r', '\x2', + '\x2', '\x155', '\x156', '\a', 'q', '\x2', '\x2', '\x156', '\x157', '\a', + 't', '\x2', '\x2', '\x157', '\x158', '\a', 'v', '\x2', '\x2', '\x158', + '\x35', '\x3', '\x2', '\x2', '\x2', '\x159', '\x15A', '\a', 'u', '\x2', + '\x2', '\x15A', '\x15B', '\a', 'v', '\x2', '\x2', '\x15B', '\x15C', '\a', + '\x63', '\x2', '\x2', '\x15C', '\x15D', '\a', 't', '\x2', '\x2', '\x15D', + '\x15E', '\a', 'v', '\x2', '\x2', '\x15E', '\x37', '\x3', '\x2', '\x2', + '\x2', '\x15F', '\x160', '\a', 'w', '\x2', '\x2', '\x160', '\x161', '\a', + 'u', '\x2', '\x2', '\x161', '\x162', '\a', 'g', '\x2', '\x2', '\x162', + '\x39', '\x3', '\x2', '\x2', '\x2', '\x163', '\x164', '\a', 'v', '\x2', + '\x2', '\x164', '\x165', '\a', 'j', '\x2', '\x2', '\x165', '\x166', '\a', + 't', '\x2', '\x2', '\x166', '\x167', '\a', 'g', '\x2', '\x2', '\x167', + '\x168', '\a', '\x63', '\x2', '\x2', '\x168', '\x169', '\a', '\x66', '\x2', + '\x2', '\x169', ';', '\x3', '\x2', '\x2', '\x2', '\x16A', '\x16B', '\a', + 'u', '\x2', '\x2', '\x16B', '\x16C', '\a', '{', '\x2', '\x2', '\x16C', + '\x16D', '\a', 'p', '\x2', '\x2', '\x16D', '\x16E', '\a', '\x65', '\x2', + '\x2', '\x16E', '=', '\x3', '\x2', '\x2', '\x2', '\x16F', '\x170', '\a', + '?', '\x2', '\x2', '\x170', '?', '\x3', '\x2', '\x2', '\x2', '\x171', + '\x172', '\a', '-', '\x2', '\x2', '\x172', '\x173', '\a', '?', '\x2', + '\x2', '\x173', '\x41', '\x3', '\x2', '\x2', '\x2', '\x174', '\x175', + '\a', '/', '\x2', '\x2', '\x175', '\x176', '\a', '?', '\x2', '\x2', '\x176', + '\x43', '\x3', '\x2', '\x2', '\x2', '\x177', '\x178', '\a', ',', '\x2', + '\x2', '\x178', '\x179', '\a', '?', '\x2', '\x2', '\x179', '\x45', '\x3', + '\x2', '\x2', '\x2', '\x17A', '\x17B', '\a', '\x31', '\x2', '\x2', '\x17B', + '\x17C', '\a', '?', '\x2', '\x2', '\x17C', 'G', '\x3', '\x2', '\x2', '\x2', + '\x17D', '\x17E', '\a', '\'', '\x2', '\x2', '\x17E', '\x17F', '\a', '?', + '\x2', '\x2', '\x17F', 'I', '\x3', '\x2', '\x2', '\x2', '\x180', '\x181', + '\a', '(', '\x2', '\x2', '\x181', '\x182', '\a', '?', '\x2', '\x2', '\x182', + 'K', '\x3', '\x2', '\x2', '\x2', '\x183', '\x184', '\a', '~', '\x2', '\x2', + '\x184', '\x185', '\a', '?', '\x2', '\x2', '\x185', 'M', '\x3', '\x2', + '\x2', '\x2', '\x186', '\x187', '\a', '`', '\x2', '\x2', '\x187', '\x188', + '\a', '?', '\x2', '\x2', '\x188', 'O', '\x3', '\x2', '\x2', '\x2', '\x189', + '\x18A', '\a', '>', '\x2', '\x2', '\x18A', '\x18B', '\a', '>', '\x2', + '\x2', '\x18B', '\x18C', '\a', '?', '\x2', '\x2', '\x18C', 'Q', '\x3', + '\x2', '\x2', '\x2', '\x18D', '\x18E', '\a', '@', '\x2', '\x2', '\x18E', + '\x18F', '\a', '@', '\x2', '\x2', '\x18F', '\x190', '\a', '?', '\x2', + '\x2', '\x190', 'S', '\x3', '\x2', '\x2', '\x2', '\x191', '\x192', '\a', + '~', '\x2', '\x2', '\x192', '\x193', '\a', '~', '\x2', '\x2', '\x193', + 'U', '\x3', '\x2', '\x2', '\x2', '\x194', '\x195', '\a', '(', '\x2', '\x2', + '\x195', '\x196', '\a', '(', '\x2', '\x2', '\x196', 'W', '\x3', '\x2', + '\x2', '\x2', '\x197', '\x198', '\a', '#', '\x2', '\x2', '\x198', '\x199', + '\a', '?', '\x2', '\x2', '\x199', 'Y', '\x3', '\x2', '\x2', '\x2', '\x19A', + '\x19B', '\a', '?', '\x2', '\x2', '\x19B', '\x19C', '\a', '?', '\x2', + '\x2', '\x19C', '[', '\x3', '\x2', '\x2', '\x2', '\x19D', '\x19E', '\a', + '@', '\x2', '\x2', '\x19E', ']', '\x3', '\x2', '\x2', '\x2', '\x19F', + '\x1A0', '\a', '@', '\x2', '\x2', '\x1A0', '\x1A1', '\a', '@', '\x2', + '\x2', '\x1A1', '_', '\x3', '\x2', '\x2', '\x2', '\x1A2', '\x1A3', '\a', + '@', '\x2', '\x2', '\x1A3', '\x1A4', '\a', '?', '\x2', '\x2', '\x1A4', + '\x61', '\x3', '\x2', '\x2', '\x2', '\x1A5', '\x1A6', '\a', '>', '\x2', + '\x2', '\x1A6', '\x63', '\x3', '\x2', '\x2', '\x2', '\x1A7', '\x1A8', + '\a', '>', '\x2', '\x2', '\x1A8', '\x1A9', '\a', '>', '\x2', '\x2', '\x1A9', + '\x65', '\x3', '\x2', '\x2', '\x2', '\x1AA', '\x1AB', '\a', '>', '\x2', + '\x2', '\x1AB', '\x1AC', '\a', '?', '\x2', '\x2', '\x1AC', 'g', '\x3', + '\x2', '\x2', '\x2', '\x1AD', '\x1AE', '\a', '/', '\x2', '\x2', '\x1AE', + 'i', '\x3', '\x2', '\x2', '\x2', '\x1AF', '\x1B0', '\a', '/', '\x2', '\x2', + '\x1B0', '\x1B1', '\a', '/', '\x2', '\x2', '\x1B1', 'k', '\x3', '\x2', + '\x2', '\x2', '\x1B2', '\x1B3', '\a', '-', '\x2', '\x2', '\x1B3', 'm', + '\x3', '\x2', '\x2', '\x2', '\x1B4', '\x1B5', '\a', '-', '\x2', '\x2', + '\x1B5', '\x1B6', '\a', '-', '\x2', '\x2', '\x1B6', 'o', '\x3', '\x2', + '\x2', '\x2', '\x1B7', '\x1B8', '\a', '\x31', '\x2', '\x2', '\x1B8', 'q', + '\x3', '\x2', '\x2', '\x2', '\x1B9', '\x1BA', '\a', ',', '\x2', '\x2', + '\x1BA', 's', '\x3', '\x2', '\x2', '\x2', '\x1BB', '\x1BC', '\a', '#', + '\x2', '\x2', '\x1BC', 'u', '\x3', '\x2', '\x2', '\x2', '\x1BD', '\x1BE', + '\a', '\x30', '\x2', '\x2', '\x1BE', 'w', '\x3', '\x2', '\x2', '\x2', + '\x1BF', '\x1C0', '\a', '\x41', '\x2', '\x2', '\x1C0', 'y', '\x3', '\x2', + '\x2', '\x2', '\x1C1', '\x1C2', '\a', '<', '\x2', '\x2', '\x1C2', '{', + '\x3', '\x2', '\x2', '\x2', '\x1C3', '\x1C4', '\a', '/', '\x2', '\x2', + '\x1C4', '\x1C5', '\a', '@', '\x2', '\x2', '\x1C5', '}', '\x3', '\x2', + '\x2', '\x2', '\x1C6', '\x1C7', '\a', '\'', '\x2', '\x2', '\x1C7', '\x7F', + '\x3', '\x2', '\x2', '\x2', '\x1C8', '\x1C9', '\a', '\x80', '\x2', '\x2', + '\x1C9', '\x81', '\x3', '\x2', '\x2', '\x2', '\x1CA', '\x1CB', '\a', '(', + '\x2', '\x2', '\x1CB', '\x83', '\x3', '\x2', '\x2', '\x2', '\x1CC', '\x1CD', + '\a', '`', '\x2', '\x2', '\x1CD', '\x85', '\x3', '\x2', '\x2', '\x2', + '\x1CE', '\x1CF', '\a', '~', '\x2', '\x2', '\x1CF', '\x87', '\x3', '\x2', + '\x2', '\x2', '\x1D0', '\x1D1', '\a', '*', '\x2', '\x2', '\x1D1', '\x89', + '\x3', '\x2', '\x2', '\x2', '\x1D2', '\x1D3', '\a', '+', '\x2', '\x2', + '\x1D3', '\x8B', '\x3', '\x2', '\x2', '\x2', '\x1D4', '\x1D5', '\a', ']', + '\x2', '\x2', '\x1D5', '\x8D', '\x3', '\x2', '\x2', '\x2', '\x1D6', '\x1D7', + '\a', '_', '\x2', '\x2', '\x1D7', '\x8F', '\x3', '\x2', '\x2', '\x2', + '\x1D8', '\x1D9', '\a', '.', '\x2', '\x2', '\x1D9', '\x91', '\x3', '\x2', + '\x2', '\x2', '\x1DA', '\x1DB', '\a', '=', '\x2', '\x2', '\x1DB', '\x93', + '\x3', '\x2', '\x2', '\x2', '\x1DC', '\x1DD', '\a', '&', '\x2', '\x2', + '\x1DD', '\x95', '\x3', '\x2', '\x2', '\x2', '\x1DE', '\x1E1', '\x5', + '\x98', 'L', '\x2', '\x1DF', '\x1E1', '\x5', '\x9A', 'M', '\x2', '\x1E0', + '\x1DE', '\x3', '\x2', '\x2', '\x2', '\x1E0', '\x1DF', '\x3', '\x2', '\x2', + '\x2', '\x1E1', '\x97', '\x3', '\x2', '\x2', '\x2', '\x1E2', '\x1E3', + '\a', 'h', '\x2', '\x2', '\x1E3', '\x1E4', '\a', '\x63', '\x2', '\x2', + '\x1E4', '\x1E5', '\a', 'n', '\x2', '\x2', '\x1E5', '\x1E6', '\a', 'u', + '\x2', '\x2', '\x1E6', '\x1E7', '\a', 'g', '\x2', '\x2', '\x1E7', '\x99', + '\x3', '\x2', '\x2', '\x2', '\x1E8', '\x1E9', '\a', 'v', '\x2', '\x2', + '\x1E9', '\x1EA', '\a', 't', '\x2', '\x2', '\x1EA', '\x1EB', '\a', 'w', + '\x2', '\x2', '\x1EB', '\x1EC', '\a', 'g', '\x2', '\x2', '\x1EC', '\x9B', + '\x3', '\x2', '\x2', '\x2', '\x1ED', '\x1EE', '\x5', '\xA2', 'Q', '\x2', + '\x1EE', '\x9D', '\x3', '\x2', '\x2', '\x2', '\x1EF', '\x1F1', '\x5', + '\xA6', 'S', '\x2', '\x1F0', '\x1F2', '\x5', '\xA8', 'T', '\x2', '\x1F1', + '\x1F0', '\x3', '\x2', '\x2', '\x2', '\x1F1', '\x1F2', '\x3', '\x2', '\x2', + '\x2', '\x1F2', '\x1F7', '\x3', '\x2', '\x2', '\x2', '\x1F3', '\x1F4', + '\x5', '\xAC', 'V', '\x2', '\x1F4', '\x1F5', '\x5', '\xA8', 'T', '\x2', + '\x1F5', '\x1F7', '\x3', '\x2', '\x2', '\x2', '\x1F6', '\x1EF', '\x3', + '\x2', '\x2', '\x2', '\x1F6', '\x1F3', '\x3', '\x2', '\x2', '\x2', '\x1F7', + '\x9F', '\x3', '\x2', '\x2', '\x2', '\x1F8', '\x1F9', '\t', '\x2', '\x2', + '\x2', '\x1F9', '\xA1', '\x3', '\x2', '\x2', '\x2', '\x1FA', '\x1FC', + '\x5', '\xA0', 'P', '\x2', '\x1FB', '\x1FA', '\x3', '\x2', '\x2', '\x2', + '\x1FC', '\x1FD', '\x3', '\x2', '\x2', '\x2', '\x1FD', '\x1FB', '\x3', + '\x2', '\x2', '\x2', '\x1FD', '\x1FE', '\x3', '\x2', '\x2', '\x2', '\x1FE', + '\xA3', '\x3', '\x2', '\x2', '\x2', '\x1FF', '\x200', '\t', '\x3', '\x2', + '\x2', '\x200', '\xA5', '\x3', '\x2', '\x2', '\x2', '\x201', '\x203', + '\x5', '\xAC', 'V', '\x2', '\x202', '\x201', '\x3', '\x2', '\x2', '\x2', + '\x202', '\x203', '\x3', '\x2', '\x2', '\x2', '\x203', '\x204', '\x3', + '\x2', '\x2', '\x2', '\x204', '\x205', '\a', '\x30', '\x2', '\x2', '\x205', + '\x20A', '\x5', '\xAC', 'V', '\x2', '\x206', '\x207', '\x5', '\xAC', 'V', + '\x2', '\x207', '\x208', '\a', '\x30', '\x2', '\x2', '\x208', '\x20A', + '\x3', '\x2', '\x2', '\x2', '\x209', '\x202', '\x3', '\x2', '\x2', '\x2', + '\x209', '\x206', '\x3', '\x2', '\x2', '\x2', '\x20A', '\xA7', '\x3', + '\x2', '\x2', '\x2', '\x20B', '\x20D', '\a', 'g', '\x2', '\x2', '\x20C', + '\x20E', '\x5', '\xAA', 'U', '\x2', '\x20D', '\x20C', '\x3', '\x2', '\x2', + '\x2', '\x20D', '\x20E', '\x3', '\x2', '\x2', '\x2', '\x20E', '\x20F', + '\x3', '\x2', '\x2', '\x2', '\x20F', '\x216', '\x5', '\xAC', 'V', '\x2', + '\x210', '\x212', '\a', 'G', '\x2', '\x2', '\x211', '\x213', '\x5', '\xAA', + 'U', '\x2', '\x212', '\x211', '\x3', '\x2', '\x2', '\x2', '\x212', '\x213', + '\x3', '\x2', '\x2', '\x2', '\x213', '\x214', '\x3', '\x2', '\x2', '\x2', + '\x214', '\x216', '\x5', '\xAC', 'V', '\x2', '\x215', '\x20B', '\x3', + '\x2', '\x2', '\x2', '\x215', '\x210', '\x3', '\x2', '\x2', '\x2', '\x216', + '\xA9', '\x3', '\x2', '\x2', '\x2', '\x217', '\x218', '\t', '\x4', '\x2', + '\x2', '\x218', '\xAB', '\x3', '\x2', '\x2', '\x2', '\x219', '\x220', + '\x5', '\xA0', 'P', '\x2', '\x21A', '\x21C', '\a', ')', '\x2', '\x2', + '\x21B', '\x21A', '\x3', '\x2', '\x2', '\x2', '\x21B', '\x21C', '\x3', + '\x2', '\x2', '\x2', '\x21C', '\x21D', '\x3', '\x2', '\x2', '\x2', '\x21D', + '\x21F', '\x5', '\xA0', 'P', '\x2', '\x21E', '\x21B', '\x3', '\x2', '\x2', + '\x2', '\x21F', '\x222', '\x3', '\x2', '\x2', '\x2', '\x220', '\x21E', + '\x3', '\x2', '\x2', '\x2', '\x220', '\x221', '\x3', '\x2', '\x2', '\x2', + '\x221', '\xAD', '\x3', '\x2', '\x2', '\x2', '\x222', '\x220', '\x3', + '\x2', '\x2', '\x2', '\x223', '\x227', '\t', '\x5', '\x2', '\x2', '\x224', + '\x226', '\t', '\x6', '\x2', '\x2', '\x225', '\x224', '\x3', '\x2', '\x2', + '\x2', '\x226', '\x229', '\x3', '\x2', '\x2', '\x2', '\x227', '\x225', + '\x3', '\x2', '\x2', '\x2', '\x227', '\x228', '\x3', '\x2', '\x2', '\x2', + '\x228', '\xAF', '\x3', '\x2', '\x2', '\x2', '\x229', '\x227', '\x3', + '\x2', '\x2', '\x2', '\x22A', '\x22B', '\a', '\x31', '\x2', '\x2', '\x22B', + '\x22C', '\a', ',', '\x2', '\x2', '\x22C', '\x230', '\x3', '\x2', '\x2', + '\x2', '\x22D', '\x22F', '\v', '\x2', '\x2', '\x2', '\x22E', '\x22D', + '\x3', '\x2', '\x2', '\x2', '\x22F', '\x232', '\x3', '\x2', '\x2', '\x2', + '\x230', '\x231', '\x3', '\x2', '\x2', '\x2', '\x230', '\x22E', '\x3', + '\x2', '\x2', '\x2', '\x231', '\x233', '\x3', '\x2', '\x2', '\x2', '\x232', + '\x230', '\x3', '\x2', '\x2', '\x2', '\x233', '\x234', '\a', ',', '\x2', + '\x2', '\x234', '\x235', '\a', '\x31', '\x2', '\x2', '\x235', '\x236', + '\x3', '\x2', '\x2', '\x2', '\x236', '\x237', '\b', 'X', '\x2', '\x2', + '\x237', '\xB1', '\x3', '\x2', '\x2', '\x2', '\x238', '\x23A', '\t', '\a', + '\x2', '\x2', '\x239', '\x238', '\x3', '\x2', '\x2', '\x2', '\x23A', '\x23B', + '\x3', '\x2', '\x2', '\x2', '\x23B', '\x239', '\x3', '\x2', '\x2', '\x2', + '\x23B', '\x23C', '\x3', '\x2', '\x2', '\x2', '\x23C', '\x23D', '\x3', + '\x2', '\x2', '\x2', '\x23D', '\x23E', '\b', 'Y', '\x2', '\x2', '\x23E', + '\xB3', '\x3', '\x2', '\x2', '\x2', '\x23F', '\x240', '\a', '\x31', '\x2', + '\x2', '\x240', '\x241', '\a', '\x31', '\x2', '\x2', '\x241', '\x245', + '\x3', '\x2', '\x2', '\x2', '\x242', '\x244', '\n', '\b', '\x2', '\x2', + '\x243', '\x242', '\x3', '\x2', '\x2', '\x2', '\x244', '\x247', '\x3', + '\x2', '\x2', '\x2', '\x245', '\x243', '\x3', '\x2', '\x2', '\x2', '\x245', + '\x246', '\x3', '\x2', '\x2', '\x2', '\x246', '\x249', '\x3', '\x2', '\x2', + '\x2', '\x247', '\x245', '\x3', '\x2', '\x2', '\x2', '\x248', '\x24A', + '\a', '\xF', '\x2', '\x2', '\x249', '\x248', '\x3', '\x2', '\x2', '\x2', + '\x249', '\x24A', '\x3', '\x2', '\x2', '\x2', '\x24A', '\x24B', '\x3', + '\x2', '\x2', '\x2', '\x24B', '\x24C', '\a', '\f', '\x2', '\x2', '\x24C', + '\x24D', '\x3', '\x2', '\x2', '\x2', '\x24D', '\x24E', '\b', 'Z', '\x2', + '\x2', '\x24E', '\xB5', '\x3', '\x2', '\x2', '\x2', '\x24F', '\x250', + '\a', '$', '\x2', '\x2', '\x250', '\x251', '\x3', '\x2', '\x2', '\x2', + '\x251', '\x252', '\b', '[', '\x3', '\x2', '\x252', '\xB7', '\x3', '\x2', + '\x2', '\x2', '\x253', '\x254', '\a', '}', '\x2', '\x2', '\x254', '\x255', + '\x3', '\x2', '\x2', '\x2', '\x255', '\x256', '\b', '\\', '\x4', '\x2', + '\x256', '\xB9', '\x3', '\x2', '\x2', '\x2', '\x257', '\x258', '\a', '\x7F', + '\x2', '\x2', '\x258', '\x259', '\x3', '\x2', '\x2', '\x2', '\x259', '\x25A', + '\b', ']', '\x5', '\x2', '\x25A', '\xBB', '\x3', '\x2', '\x2', '\x2', + '\x25B', '\x25D', '\n', '\t', '\x2', '\x2', '\x25C', '\x25B', '\x3', '\x2', + '\x2', '\x2', '\x25D', '\x25E', '\x3', '\x2', '\x2', '\x2', '\x25E', '\x25C', + '\x3', '\x2', '\x2', '\x2', '\x25E', '\x25F', '\x3', '\x2', '\x2', '\x2', + '\x25F', '\xBD', '\x3', '\x2', '\x2', '\x2', '\x260', '\x261', '\a', '&', + '\x2', '\x2', '\x261', '\x262', '\a', '}', '\x2', '\x2', '\x262', '\x263', + '\x3', '\x2', '\x2', '\x2', '\x263', '\x264', '\b', '_', '\x4', '\x2', + '\x264', '\xBF', '\x3', '\x2', '\x2', '\x2', '\x265', '\x266', '\a', '^', + '\x2', '\x2', '\x266', '\x267', '\v', '\x2', '\x2', '\x2', '\x267', '\xC1', + '\x3', '\x2', '\x2', '\x2', '\x268', '\x269', '\a', '$', '\x2', '\x2', + '\x269', '\x26A', '\x3', '\x2', '\x2', '\x2', '\x26A', '\x26B', '\b', + '\x61', '\x6', '\x2', '\x26B', '\x26C', '\b', '\x61', '\x5', '\x2', '\x26C', + '\xC3', '\x3', '\x2', '\x2', '\x2', '\x15', '\x2', '\x3', '\x1E0', '\x1F1', + '\x1F6', '\x1FD', '\x202', '\x209', '\x20D', '\x212', '\x215', '\x21B', + '\x220', '\x227', '\x230', '\x23B', '\x245', '\x249', '\x25E', '\a', '\b', '\x2', '\x2', '\a', '\x3', '\x2', '\a', '\x2', '\x2', '\x6', '\x2', '\x2', - '\t', 'R', '\x2', + '\t', 'V', '\x2', }; public static readonly ATN _ATN = diff --git a/Bite/AntlrGenerated/AntlrBiteParser/BITELexer.interp b/Bite/AntlrGenerated/AntlrBiteParser/BITELexer.interp index 236a7b7..04dc5dd 100644 --- a/Bite/AntlrGenerated/AntlrBiteParser/BITELexer.interp +++ b/Bite/AntlrGenerated/AntlrBiteParser/BITELexer.interp @@ -25,6 +25,10 @@ null 'this' 'using' 'import' +'start' +'use' +'thread' +'sync' '=' '+=' '-=' @@ -113,6 +117,10 @@ NullReference ThisReference UsingDirective ImportDirective +StartStatement +UseStatement +ThreadStatement +SyncKeyword AssignOperator PlusAssignOperator MinusAssignOperator @@ -152,10 +160,10 @@ BitwiseXorOperator BitwiseOrOperator OpeningRoundBracket ClosingRoundBracket -SquarebracketLeft -SquarebracketRight -CommaSeperator -SemicolonSeperator +SquareBracketLeft +SquareBracketRight +CommaSeparator +SemicolonSeparator DollarOperator BooleanLiteral False_ @@ -200,6 +208,10 @@ NullReference ThisReference UsingDirective ImportDirective +StartStatement +UseStatement +ThreadStatement +SyncKeyword AssignOperator PlusAssignOperator MinusAssignOperator @@ -239,10 +251,10 @@ BitwiseXorOperator BitwiseOrOperator OpeningRoundBracket ClosingRoundBracket -SquarebracketLeft -SquarebracketRight -CommaSeperator -SemicolonSeperator +SquareBracketLeft +SquareBracketRight +CommaSeparator +SemicolonSeparator DollarOperator BooleanLiteral False_ @@ -277,4 +289,4 @@ DEFAULT_MODE IN_STRING atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 87, 591, 8, 1, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9, 70, 4, 71, 9, 71, 4, 72, 9, 72, 4, 73, 9, 73, 4, 74, 9, 74, 4, 75, 9, 75, 4, 76, 9, 76, 4, 77, 9, 77, 4, 78, 9, 78, 4, 79, 9, 79, 4, 80, 9, 80, 4, 81, 9, 81, 4, 82, 9, 82, 4, 83, 9, 83, 4, 84, 9, 84, 4, 85, 9, 85, 4, 86, 9, 86, 4, 87, 9, 87, 4, 88, 9, 88, 4, 89, 9, 89, 4, 90, 9, 90, 4, 91, 9, 91, 4, 92, 9, 92, 4, 93, 9, 93, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 3, 29, 3, 29, 3, 29, 3, 30, 3, 30, 3, 30, 3, 31, 3, 31, 3, 31, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 34, 3, 34, 3, 34, 3, 35, 3, 35, 3, 35, 3, 36, 3, 36, 3, 36, 3, 36, 3, 37, 3, 37, 3, 37, 3, 37, 3, 38, 3, 38, 3, 38, 3, 39, 3, 39, 3, 39, 3, 40, 3, 40, 3, 40, 3, 41, 3, 41, 3, 41, 3, 42, 3, 42, 3, 43, 3, 43, 3, 43, 3, 44, 3, 44, 3, 44, 3, 45, 3, 45, 3, 46, 3, 46, 3, 46, 3, 47, 3, 47, 3, 47, 3, 48, 3, 48, 3, 49, 3, 49, 3, 49, 3, 50, 3, 50, 3, 51, 3, 51, 3, 51, 3, 52, 3, 52, 3, 53, 3, 53, 3, 54, 3, 54, 3, 55, 3, 55, 3, 56, 3, 56, 3, 57, 3, 57, 3, 58, 3, 58, 3, 58, 3, 59, 3, 59, 3, 60, 3, 60, 3, 61, 3, 61, 3, 62, 3, 62, 3, 63, 3, 63, 3, 64, 3, 64, 3, 65, 3, 65, 3, 66, 3, 66, 3, 67, 3, 67, 3, 68, 3, 68, 3, 69, 3, 69, 3, 70, 3, 70, 3, 71, 3, 71, 5, 71, 451, 10, 71, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 73, 3, 73, 3, 73, 3, 73, 3, 73, 3, 74, 3, 74, 3, 75, 3, 75, 5, 75, 468, 10, 75, 3, 75, 3, 75, 3, 75, 5, 75, 473, 10, 75, 3, 76, 3, 76, 3, 77, 6, 77, 478, 10, 77, 13, 77, 14, 77, 479, 3, 78, 3, 78, 3, 79, 5, 79, 485, 10, 79, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 5, 79, 492, 10, 79, 3, 80, 3, 80, 5, 80, 496, 10, 80, 3, 80, 3, 80, 3, 80, 5, 80, 501, 10, 80, 3, 80, 5, 80, 504, 10, 80, 3, 81, 3, 81, 3, 82, 3, 82, 5, 82, 510, 10, 82, 3, 82, 7, 82, 513, 10, 82, 12, 82, 14, 82, 516, 11, 82, 3, 83, 3, 83, 7, 83, 520, 10, 83, 12, 83, 14, 83, 523, 11, 83, 3, 84, 3, 84, 3, 84, 3, 84, 7, 84, 529, 10, 84, 12, 84, 14, 84, 532, 11, 84, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 3, 85, 6, 85, 540, 10, 85, 13, 85, 14, 85, 541, 3, 85, 3, 85, 3, 86, 3, 86, 3, 86, 3, 86, 7, 86, 550, 10, 86, 12, 86, 14, 86, 553, 11, 86, 3, 86, 5, 86, 556, 10, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 87, 3, 87, 3, 87, 3, 87, 3, 88, 3, 88, 3, 88, 3, 88, 3, 89, 3, 89, 3, 89, 3, 89, 3, 90, 6, 90, 575, 10, 90, 13, 90, 14, 90, 576, 3, 91, 3, 91, 3, 91, 3, 91, 3, 91, 3, 92, 3, 92, 3, 92, 3, 93, 3, 93, 3, 93, 3, 93, 3, 93, 3, 530, 2, 94, 4, 3, 6, 4, 8, 5, 10, 6, 12, 7, 14, 8, 16, 9, 18, 10, 20, 11, 22, 12, 24, 13, 26, 14, 28, 15, 30, 16, 32, 17, 34, 18, 36, 19, 38, 20, 40, 21, 42, 22, 44, 23, 46, 24, 48, 25, 50, 26, 52, 27, 54, 28, 56, 29, 58, 30, 60, 31, 62, 32, 64, 33, 66, 34, 68, 35, 70, 36, 72, 37, 74, 38, 76, 39, 78, 40, 80, 41, 82, 42, 84, 43, 86, 44, 88, 45, 90, 46, 92, 47, 94, 48, 96, 49, 98, 50, 100, 51, 102, 52, 104, 53, 106, 54, 108, 55, 110, 56, 112, 57, 114, 58, 116, 59, 118, 60, 120, 61, 122, 62, 124, 63, 126, 64, 128, 65, 130, 66, 132, 67, 134, 68, 136, 69, 138, 70, 140, 71, 142, 72, 144, 73, 146, 74, 148, 75, 150, 76, 152, 2, 154, 77, 156, 2, 158, 2, 160, 2, 162, 2, 164, 2, 166, 78, 168, 79, 170, 80, 172, 81, 174, 82, 176, 83, 178, 84, 180, 85, 182, 86, 184, 87, 186, 2, 4, 2, 3, 10, 3, 2, 50, 59, 3, 2, 51, 59, 4, 2, 45, 45, 47, 47, 5, 2, 67, 92, 97, 97, 99, 124, 6, 2, 50, 59, 67, 92, 97, 97, 99, 124, 5, 2, 11, 12, 14, 15, 34, 34, 4, 2, 12, 12, 15, 15, 5, 2, 36, 36, 38, 38, 94, 94, 2, 600, 2, 4, 3, 2, 2, 2, 2, 6, 3, 2, 2, 2, 2, 8, 3, 2, 2, 2, 2, 10, 3, 2, 2, 2, 2, 12, 3, 2, 2, 2, 2, 14, 3, 2, 2, 2, 2, 16, 3, 2, 2, 2, 2, 18, 3, 2, 2, 2, 2, 20, 3, 2, 2, 2, 2, 22, 3, 2, 2, 2, 2, 24, 3, 2, 2, 2, 2, 26, 3, 2, 2, 2, 2, 28, 3, 2, 2, 2, 2, 30, 3, 2, 2, 2, 2, 32, 3, 2, 2, 2, 2, 34, 3, 2, 2, 2, 2, 36, 3, 2, 2, 2, 2, 38, 3, 2, 2, 2, 2, 40, 3, 2, 2, 2, 2, 42, 3, 2, 2, 2, 2, 44, 3, 2, 2, 2, 2, 46, 3, 2, 2, 2, 2, 48, 3, 2, 2, 2, 2, 50, 3, 2, 2, 2, 2, 52, 3, 2, 2, 2, 2, 54, 3, 2, 2, 2, 2, 56, 3, 2, 2, 2, 2, 58, 3, 2, 2, 2, 2, 60, 3, 2, 2, 2, 2, 62, 3, 2, 2, 2, 2, 64, 3, 2, 2, 2, 2, 66, 3, 2, 2, 2, 2, 68, 3, 2, 2, 2, 2, 70, 3, 2, 2, 2, 2, 72, 3, 2, 2, 2, 2, 74, 3, 2, 2, 2, 2, 76, 3, 2, 2, 2, 2, 78, 3, 2, 2, 2, 2, 80, 3, 2, 2, 2, 2, 82, 3, 2, 2, 2, 2, 84, 3, 2, 2, 2, 2, 86, 3, 2, 2, 2, 2, 88, 3, 2, 2, 2, 2, 90, 3, 2, 2, 2, 2, 92, 3, 2, 2, 2, 2, 94, 3, 2, 2, 2, 2, 96, 3, 2, 2, 2, 2, 98, 3, 2, 2, 2, 2, 100, 3, 2, 2, 2, 2, 102, 3, 2, 2, 2, 2, 104, 3, 2, 2, 2, 2, 106, 3, 2, 2, 2, 2, 108, 3, 2, 2, 2, 2, 110, 3, 2, 2, 2, 2, 112, 3, 2, 2, 2, 2, 114, 3, 2, 2, 2, 2, 116, 3, 2, 2, 2, 2, 118, 3, 2, 2, 2, 2, 120, 3, 2, 2, 2, 2, 122, 3, 2, 2, 2, 2, 124, 3, 2, 2, 2, 2, 126, 3, 2, 2, 2, 2, 128, 3, 2, 2, 2, 2, 130, 3, 2, 2, 2, 2, 132, 3, 2, 2, 2, 2, 134, 3, 2, 2, 2, 2, 136, 3, 2, 2, 2, 2, 138, 3, 2, 2, 2, 2, 140, 3, 2, 2, 2, 2, 142, 3, 2, 2, 2, 2, 144, 3, 2, 2, 2, 2, 146, 3, 2, 2, 2, 2, 148, 3, 2, 2, 2, 2, 150, 3, 2, 2, 2, 2, 154, 3, 2, 2, 2, 2, 166, 3, 2, 2, 2, 2, 168, 3, 2, 2, 2, 2, 170, 3, 2, 2, 2, 2, 172, 3, 2, 2, 2, 2, 174, 3, 2, 2, 2, 2, 176, 3, 2, 2, 2, 2, 178, 3, 2, 2, 2, 3, 180, 3, 2, 2, 2, 3, 182, 3, 2, 2, 2, 3, 184, 3, 2, 2, 2, 3, 186, 3, 2, 2, 2, 4, 188, 3, 2, 2, 2, 6, 195, 3, 2, 2, 2, 8, 201, 3, 2, 2, 2, 10, 208, 3, 2, 2, 2, 12, 212, 3, 2, 2, 2, 14, 215, 3, 2, 2, 2, 16, 222, 3, 2, 2, 2, 18, 231, 3, 2, 2, 2, 20, 240, 3, 2, 2, 2, 22, 244, 3, 2, 2, 2, 24, 248, 3, 2, 2, 2, 26, 252, 3, 2, 2, 2, 28, 256, 3, 2, 2, 2, 30, 262, 3, 2, 2, 2, 32, 269, 3, 2, 2, 2, 34, 278, 3, 2, 2, 2, 36, 285, 3, 2, 2, 2, 38, 293, 3, 2, 2, 2, 40, 296, 3, 2, 2, 2, 42, 301, 3, 2, 2, 2, 44, 308, 3, 2, 2, 2, 46, 314, 3, 2, 2, 2, 48, 319, 3, 2, 2, 2, 50, 324, 3, 2, 2, 2, 52, 330, 3, 2, 2, 2, 54, 337, 3, 2, 2, 2, 56, 339, 3, 2, 2, 2, 58, 342, 3, 2, 2, 2, 60, 345, 3, 2, 2, 2, 62, 348, 3, 2, 2, 2, 64, 351, 3, 2, 2, 2, 66, 354, 3, 2, 2, 2, 68, 357, 3, 2, 2, 2, 70, 360, 3, 2, 2, 2, 72, 363, 3, 2, 2, 2, 74, 367, 3, 2, 2, 2, 76, 371, 3, 2, 2, 2, 78, 374, 3, 2, 2, 2, 80, 377, 3, 2, 2, 2, 82, 380, 3, 2, 2, 2, 84, 383, 3, 2, 2, 2, 86, 385, 3, 2, 2, 2, 88, 388, 3, 2, 2, 2, 90, 391, 3, 2, 2, 2, 92, 393, 3, 2, 2, 2, 94, 396, 3, 2, 2, 2, 96, 399, 3, 2, 2, 2, 98, 401, 3, 2, 2, 2, 100, 404, 3, 2, 2, 2, 102, 406, 3, 2, 2, 2, 104, 409, 3, 2, 2, 2, 106, 411, 3, 2, 2, 2, 108, 413, 3, 2, 2, 2, 110, 415, 3, 2, 2, 2, 112, 417, 3, 2, 2, 2, 114, 419, 3, 2, 2, 2, 116, 421, 3, 2, 2, 2, 118, 424, 3, 2, 2, 2, 120, 426, 3, 2, 2, 2, 122, 428, 3, 2, 2, 2, 124, 430, 3, 2, 2, 2, 126, 432, 3, 2, 2, 2, 128, 434, 3, 2, 2, 2, 130, 436, 3, 2, 2, 2, 132, 438, 3, 2, 2, 2, 134, 440, 3, 2, 2, 2, 136, 442, 3, 2, 2, 2, 138, 444, 3, 2, 2, 2, 140, 446, 3, 2, 2, 2, 142, 450, 3, 2, 2, 2, 144, 452, 3, 2, 2, 2, 146, 458, 3, 2, 2, 2, 148, 463, 3, 2, 2, 2, 150, 472, 3, 2, 2, 2, 152, 474, 3, 2, 2, 2, 154, 477, 3, 2, 2, 2, 156, 481, 3, 2, 2, 2, 158, 491, 3, 2, 2, 2, 160, 503, 3, 2, 2, 2, 162, 505, 3, 2, 2, 2, 164, 507, 3, 2, 2, 2, 166, 517, 3, 2, 2, 2, 168, 524, 3, 2, 2, 2, 170, 539, 3, 2, 2, 2, 172, 545, 3, 2, 2, 2, 174, 561, 3, 2, 2, 2, 176, 565, 3, 2, 2, 2, 178, 569, 3, 2, 2, 2, 180, 574, 3, 2, 2, 2, 182, 578, 3, 2, 2, 2, 184, 583, 3, 2, 2, 2, 186, 586, 3, 2, 2, 2, 188, 189, 7, 111, 2, 2, 189, 190, 7, 113, 2, 2, 190, 191, 7, 102, 2, 2, 191, 192, 7, 119, 2, 2, 192, 193, 7, 110, 2, 2, 193, 194, 7, 103, 2, 2, 194, 5, 3, 2, 2, 2, 195, 196, 7, 101, 2, 2, 196, 197, 7, 110, 2, 2, 197, 198, 7, 99, 2, 2, 198, 199, 7, 117, 2, 2, 199, 200, 7, 117, 2, 2, 200, 7, 3, 2, 2, 2, 201, 202, 7, 117, 2, 2, 202, 203, 7, 118, 2, 2, 203, 204, 7, 116, 2, 2, 204, 205, 7, 119, 2, 2, 205, 206, 7, 101, 2, 2, 206, 207, 7, 118, 2, 2, 207, 9, 3, 2, 2, 2, 208, 209, 7, 112, 2, 2, 209, 210, 7, 103, 2, 2, 210, 211, 7, 121, 2, 2, 211, 11, 3, 2, 2, 2, 212, 213, 7, 99, 2, 2, 213, 214, 7, 117, 2, 2, 214, 13, 3, 2, 2, 2, 215, 216, 7, 103, 2, 2, 216, 217, 7, 122, 2, 2, 217, 218, 7, 118, 2, 2, 218, 219, 7, 103, 2, 2, 219, 220, 7, 116, 2, 2, 220, 221, 7, 112, 2, 2, 221, 15, 3, 2, 2, 2, 222, 223, 7, 101, 2, 2, 223, 224, 7, 99, 2, 2, 224, 225, 7, 110, 2, 2, 225, 226, 7, 110, 2, 2, 226, 227, 7, 99, 2, 2, 227, 228, 7, 100, 2, 2, 228, 229, 7, 110, 2, 2, 229, 230, 7, 103, 2, 2, 230, 17, 3, 2, 2, 2, 231, 232, 7, 104, 2, 2, 232, 233, 7, 119, 2, 2, 233, 234, 7, 112, 2, 2, 234, 235, 7, 101, 2, 2, 235, 236, 7, 118, 2, 2, 236, 237, 7, 107, 2, 2, 237, 238, 7, 113, 2, 2, 238, 239, 7, 112, 2, 2, 239, 19, 3, 2, 2, 2, 240, 241, 7, 120, 2, 2, 241, 242, 7, 99, 2, 2, 242, 243, 7, 116, 2, 2, 243, 21, 3, 2, 2, 2, 244, 245, 7, 105, 2, 2, 245, 246, 7, 103, 2, 2, 246, 247, 7, 118, 2, 2, 247, 23, 3, 2, 2, 2, 248, 249, 7, 117, 2, 2, 249, 250, 7, 103, 2, 2, 250, 251, 7, 118, 2, 2, 251, 25, 3, 2, 2, 2, 252, 253, 7, 104, 2, 2, 253, 254, 7, 113, 2, 2, 254, 255, 7, 116, 2, 2, 255, 27, 3, 2, 2, 2, 256, 257, 7, 121, 2, 2, 257, 258, 7, 106, 2, 2, 258, 259, 7, 107, 2, 2, 259, 260, 7, 110, 2, 2, 260, 261, 7, 103, 2, 2, 261, 29, 3, 2, 2, 2, 262, 263, 7, 117, 2, 2, 263, 264, 7, 118, 2, 2, 264, 265, 7, 99, 2, 2, 265, 266, 7, 118, 2, 2, 266, 267, 7, 107, 2, 2, 267, 268, 7, 101, 2, 2, 268, 31, 3, 2, 2, 2, 269, 270, 7, 99, 2, 2, 270, 271, 7, 100, 2, 2, 271, 272, 7, 117, 2, 2, 272, 273, 7, 118, 2, 2, 273, 274, 7, 116, 2, 2, 274, 275, 7, 99, 2, 2, 275, 276, 7, 101, 2, 2, 276, 277, 7, 118, 2, 2, 277, 33, 3, 2, 2, 2, 278, 279, 7, 114, 2, 2, 279, 280, 7, 119, 2, 2, 280, 281, 7, 100, 2, 2, 281, 282, 7, 110, 2, 2, 282, 283, 7, 107, 2, 2, 283, 284, 7, 101, 2, 2, 284, 35, 3, 2, 2, 2, 285, 286, 7, 114, 2, 2, 286, 287, 7, 116, 2, 2, 287, 288, 7, 107, 2, 2, 288, 289, 7, 120, 2, 2, 289, 290, 7, 99, 2, 2, 290, 291, 7, 118, 2, 2, 291, 292, 7, 103, 2, 2, 292, 37, 3, 2, 2, 2, 293, 294, 7, 107, 2, 2, 294, 295, 7, 104, 2, 2, 295, 39, 3, 2, 2, 2, 296, 297, 7, 103, 2, 2, 297, 298, 7, 110, 2, 2, 298, 299, 7, 117, 2, 2, 299, 300, 7, 103, 2, 2, 300, 41, 3, 2, 2, 2, 301, 302, 7, 116, 2, 2, 302, 303, 7, 103, 2, 2, 303, 304, 7, 118, 2, 2, 304, 305, 7, 119, 2, 2, 305, 306, 7, 116, 2, 2, 306, 307, 7, 112, 2, 2, 307, 43, 3, 2, 2, 2, 308, 309, 7, 100, 2, 2, 309, 310, 7, 116, 2, 2, 310, 311, 7, 103, 2, 2, 311, 312, 7, 99, 2, 2, 312, 313, 7, 109, 2, 2, 313, 45, 3, 2, 2, 2, 314, 315, 7, 112, 2, 2, 315, 316, 7, 119, 2, 2, 316, 317, 7, 110, 2, 2, 317, 318, 7, 110, 2, 2, 318, 47, 3, 2, 2, 2, 319, 320, 7, 118, 2, 2, 320, 321, 7, 106, 2, 2, 321, 322, 7, 107, 2, 2, 322, 323, 7, 117, 2, 2, 323, 49, 3, 2, 2, 2, 324, 325, 7, 119, 2, 2, 325, 326, 7, 117, 2, 2, 326, 327, 7, 107, 2, 2, 327, 328, 7, 112, 2, 2, 328, 329, 7, 105, 2, 2, 329, 51, 3, 2, 2, 2, 330, 331, 7, 107, 2, 2, 331, 332, 7, 111, 2, 2, 332, 333, 7, 114, 2, 2, 333, 334, 7, 113, 2, 2, 334, 335, 7, 116, 2, 2, 335, 336, 7, 118, 2, 2, 336, 53, 3, 2, 2, 2, 337, 338, 7, 63, 2, 2, 338, 55, 3, 2, 2, 2, 339, 340, 7, 45, 2, 2, 340, 341, 7, 63, 2, 2, 341, 57, 3, 2, 2, 2, 342, 343, 7, 47, 2, 2, 343, 344, 7, 63, 2, 2, 344, 59, 3, 2, 2, 2, 345, 346, 7, 44, 2, 2, 346, 347, 7, 63, 2, 2, 347, 61, 3, 2, 2, 2, 348, 349, 7, 49, 2, 2, 349, 350, 7, 63, 2, 2, 350, 63, 3, 2, 2, 2, 351, 352, 7, 39, 2, 2, 352, 353, 7, 63, 2, 2, 353, 65, 3, 2, 2, 2, 354, 355, 7, 40, 2, 2, 355, 356, 7, 63, 2, 2, 356, 67, 3, 2, 2, 2, 357, 358, 7, 126, 2, 2, 358, 359, 7, 63, 2, 2, 359, 69, 3, 2, 2, 2, 360, 361, 7, 96, 2, 2, 361, 362, 7, 63, 2, 2, 362, 71, 3, 2, 2, 2, 363, 364, 7, 62, 2, 2, 364, 365, 7, 62, 2, 2, 365, 366, 7, 63, 2, 2, 366, 73, 3, 2, 2, 2, 367, 368, 7, 64, 2, 2, 368, 369, 7, 64, 2, 2, 369, 370, 7, 63, 2, 2, 370, 75, 3, 2, 2, 2, 371, 372, 7, 126, 2, 2, 372, 373, 7, 126, 2, 2, 373, 77, 3, 2, 2, 2, 374, 375, 7, 40, 2, 2, 375, 376, 7, 40, 2, 2, 376, 79, 3, 2, 2, 2, 377, 378, 7, 35, 2, 2, 378, 379, 7, 63, 2, 2, 379, 81, 3, 2, 2, 2, 380, 381, 7, 63, 2, 2, 381, 382, 7, 63, 2, 2, 382, 83, 3, 2, 2, 2, 383, 384, 7, 64, 2, 2, 384, 85, 3, 2, 2, 2, 385, 386, 7, 64, 2, 2, 386, 387, 7, 64, 2, 2, 387, 87, 3, 2, 2, 2, 388, 389, 7, 64, 2, 2, 389, 390, 7, 63, 2, 2, 390, 89, 3, 2, 2, 2, 391, 392, 7, 62, 2, 2, 392, 91, 3, 2, 2, 2, 393, 394, 7, 62, 2, 2, 394, 395, 7, 62, 2, 2, 395, 93, 3, 2, 2, 2, 396, 397, 7, 62, 2, 2, 397, 398, 7, 63, 2, 2, 398, 95, 3, 2, 2, 2, 399, 400, 7, 47, 2, 2, 400, 97, 3, 2, 2, 2, 401, 402, 7, 47, 2, 2, 402, 403, 7, 47, 2, 2, 403, 99, 3, 2, 2, 2, 404, 405, 7, 45, 2, 2, 405, 101, 3, 2, 2, 2, 406, 407, 7, 45, 2, 2, 407, 408, 7, 45, 2, 2, 408, 103, 3, 2, 2, 2, 409, 410, 7, 49, 2, 2, 410, 105, 3, 2, 2, 2, 411, 412, 7, 44, 2, 2, 412, 107, 3, 2, 2, 2, 413, 414, 7, 35, 2, 2, 414, 109, 3, 2, 2, 2, 415, 416, 7, 48, 2, 2, 416, 111, 3, 2, 2, 2, 417, 418, 7, 65, 2, 2, 418, 113, 3, 2, 2, 2, 419, 420, 7, 60, 2, 2, 420, 115, 3, 2, 2, 2, 421, 422, 7, 47, 2, 2, 422, 423, 7, 64, 2, 2, 423, 117, 3, 2, 2, 2, 424, 425, 7, 39, 2, 2, 425, 119, 3, 2, 2, 2, 426, 427, 7, 128, 2, 2, 427, 121, 3, 2, 2, 2, 428, 429, 7, 40, 2, 2, 429, 123, 3, 2, 2, 2, 430, 431, 7, 96, 2, 2, 431, 125, 3, 2, 2, 2, 432, 433, 7, 126, 2, 2, 433, 127, 3, 2, 2, 2, 434, 435, 7, 42, 2, 2, 435, 129, 3, 2, 2, 2, 436, 437, 7, 43, 2, 2, 437, 131, 3, 2, 2, 2, 438, 439, 7, 93, 2, 2, 439, 133, 3, 2, 2, 2, 440, 441, 7, 95, 2, 2, 441, 135, 3, 2, 2, 2, 442, 443, 7, 46, 2, 2, 443, 137, 3, 2, 2, 2, 444, 445, 7, 61, 2, 2, 445, 139, 3, 2, 2, 2, 446, 447, 7, 38, 2, 2, 447, 141, 3, 2, 2, 2, 448, 451, 5, 144, 72, 2, 449, 451, 5, 146, 73, 2, 450, 448, 3, 2, 2, 2, 450, 449, 3, 2, 2, 2, 451, 143, 3, 2, 2, 2, 452, 453, 7, 104, 2, 2, 453, 454, 7, 99, 2, 2, 454, 455, 7, 110, 2, 2, 455, 456, 7, 117, 2, 2, 456, 457, 7, 103, 2, 2, 457, 145, 3, 2, 2, 2, 458, 459, 7, 118, 2, 2, 459, 460, 7, 116, 2, 2, 460, 461, 7, 119, 2, 2, 461, 462, 7, 103, 2, 2, 462, 147, 3, 2, 2, 2, 463, 464, 5, 154, 77, 2, 464, 149, 3, 2, 2, 2, 465, 467, 5, 158, 79, 2, 466, 468, 5, 160, 80, 2, 467, 466, 3, 2, 2, 2, 467, 468, 3, 2, 2, 2, 468, 473, 3, 2, 2, 2, 469, 470, 5, 164, 82, 2, 470, 471, 5, 160, 80, 2, 471, 473, 3, 2, 2, 2, 472, 465, 3, 2, 2, 2, 472, 469, 3, 2, 2, 2, 473, 151, 3, 2, 2, 2, 474, 475, 9, 2, 2, 2, 475, 153, 3, 2, 2, 2, 476, 478, 5, 152, 76, 2, 477, 476, 3, 2, 2, 2, 478, 479, 3, 2, 2, 2, 479, 477, 3, 2, 2, 2, 479, 480, 3, 2, 2, 2, 480, 155, 3, 2, 2, 2, 481, 482, 9, 3, 2, 2, 482, 157, 3, 2, 2, 2, 483, 485, 5, 164, 82, 2, 484, 483, 3, 2, 2, 2, 484, 485, 3, 2, 2, 2, 485, 486, 3, 2, 2, 2, 486, 487, 7, 48, 2, 2, 487, 492, 5, 164, 82, 2, 488, 489, 5, 164, 82, 2, 489, 490, 7, 48, 2, 2, 490, 492, 3, 2, 2, 2, 491, 484, 3, 2, 2, 2, 491, 488, 3, 2, 2, 2, 492, 159, 3, 2, 2, 2, 493, 495, 7, 103, 2, 2, 494, 496, 5, 162, 81, 2, 495, 494, 3, 2, 2, 2, 495, 496, 3, 2, 2, 2, 496, 497, 3, 2, 2, 2, 497, 504, 5, 164, 82, 2, 498, 500, 7, 71, 2, 2, 499, 501, 5, 162, 81, 2, 500, 499, 3, 2, 2, 2, 500, 501, 3, 2, 2, 2, 501, 502, 3, 2, 2, 2, 502, 504, 5, 164, 82, 2, 503, 493, 3, 2, 2, 2, 503, 498, 3, 2, 2, 2, 504, 161, 3, 2, 2, 2, 505, 506, 9, 4, 2, 2, 506, 163, 3, 2, 2, 2, 507, 514, 5, 152, 76, 2, 508, 510, 7, 41, 2, 2, 509, 508, 3, 2, 2, 2, 509, 510, 3, 2, 2, 2, 510, 511, 3, 2, 2, 2, 511, 513, 5, 152, 76, 2, 512, 509, 3, 2, 2, 2, 513, 516, 3, 2, 2, 2, 514, 512, 3, 2, 2, 2, 514, 515, 3, 2, 2, 2, 515, 165, 3, 2, 2, 2, 516, 514, 3, 2, 2, 2, 517, 521, 9, 5, 2, 2, 518, 520, 9, 6, 2, 2, 519, 518, 3, 2, 2, 2, 520, 523, 3, 2, 2, 2, 521, 519, 3, 2, 2, 2, 521, 522, 3, 2, 2, 2, 522, 167, 3, 2, 2, 2, 523, 521, 3, 2, 2, 2, 524, 525, 7, 49, 2, 2, 525, 526, 7, 44, 2, 2, 526, 530, 3, 2, 2, 2, 527, 529, 11, 2, 2, 2, 528, 527, 3, 2, 2, 2, 529, 532, 3, 2, 2, 2, 530, 531, 3, 2, 2, 2, 530, 528, 3, 2, 2, 2, 531, 533, 3, 2, 2, 2, 532, 530, 3, 2, 2, 2, 533, 534, 7, 44, 2, 2, 534, 535, 7, 49, 2, 2, 535, 536, 3, 2, 2, 2, 536, 537, 8, 84, 2, 2, 537, 169, 3, 2, 2, 2, 538, 540, 9, 7, 2, 2, 539, 538, 3, 2, 2, 2, 540, 541, 3, 2, 2, 2, 541, 539, 3, 2, 2, 2, 541, 542, 3, 2, 2, 2, 542, 543, 3, 2, 2, 2, 543, 544, 8, 85, 2, 2, 544, 171, 3, 2, 2, 2, 545, 546, 7, 49, 2, 2, 546, 547, 7, 49, 2, 2, 547, 551, 3, 2, 2, 2, 548, 550, 10, 8, 2, 2, 549, 548, 3, 2, 2, 2, 550, 553, 3, 2, 2, 2, 551, 549, 3, 2, 2, 2, 551, 552, 3, 2, 2, 2, 552, 555, 3, 2, 2, 2, 553, 551, 3, 2, 2, 2, 554, 556, 7, 15, 2, 2, 555, 554, 3, 2, 2, 2, 555, 556, 3, 2, 2, 2, 556, 557, 3, 2, 2, 2, 557, 558, 7, 12, 2, 2, 558, 559, 3, 2, 2, 2, 559, 560, 8, 86, 2, 2, 560, 173, 3, 2, 2, 2, 561, 562, 7, 36, 2, 2, 562, 563, 3, 2, 2, 2, 563, 564, 8, 87, 3, 2, 564, 175, 3, 2, 2, 2, 565, 566, 7, 125, 2, 2, 566, 567, 3, 2, 2, 2, 567, 568, 8, 88, 4, 2, 568, 177, 3, 2, 2, 2, 569, 570, 7, 127, 2, 2, 570, 571, 3, 2, 2, 2, 571, 572, 8, 89, 5, 2, 572, 179, 3, 2, 2, 2, 573, 575, 10, 9, 2, 2, 574, 573, 3, 2, 2, 2, 575, 576, 3, 2, 2, 2, 576, 574, 3, 2, 2, 2, 576, 577, 3, 2, 2, 2, 577, 181, 3, 2, 2, 2, 578, 579, 7, 38, 2, 2, 579, 580, 7, 125, 2, 2, 580, 581, 3, 2, 2, 2, 581, 582, 8, 91, 4, 2, 582, 183, 3, 2, 2, 2, 583, 584, 7, 94, 2, 2, 584, 585, 11, 2, 2, 2, 585, 185, 3, 2, 2, 2, 586, 587, 7, 36, 2, 2, 587, 588, 3, 2, 2, 2, 588, 589, 8, 93, 6, 2, 589, 590, 8, 93, 5, 2, 590, 187, 3, 2, 2, 2, 21, 2, 3, 450, 467, 472, 479, 484, 491, 495, 500, 503, 509, 514, 521, 530, 541, 551, 555, 576, 7, 8, 2, 2, 7, 3, 2, 7, 2, 2, 6, 2, 2, 9, 82, 2] \ No newline at end of file +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 91, 621, 8, 1, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9, 70, 4, 71, 9, 71, 4, 72, 9, 72, 4, 73, 9, 73, 4, 74, 9, 74, 4, 75, 9, 75, 4, 76, 9, 76, 4, 77, 9, 77, 4, 78, 9, 78, 4, 79, 9, 79, 4, 80, 9, 80, 4, 81, 9, 81, 4, 82, 9, 82, 4, 83, 9, 83, 4, 84, 9, 84, 4, 85, 9, 85, 4, 86, 9, 86, 4, 87, 9, 87, 4, 88, 9, 88, 4, 89, 9, 89, 4, 90, 9, 90, 4, 91, 9, 91, 4, 92, 9, 92, 4, 93, 9, 93, 4, 94, 9, 94, 4, 95, 9, 95, 4, 96, 9, 96, 4, 97, 9, 97, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 3, 28, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 31, 3, 31, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 34, 3, 34, 3, 34, 3, 35, 3, 35, 3, 35, 3, 36, 3, 36, 3, 36, 3, 37, 3, 37, 3, 37, 3, 38, 3, 38, 3, 38, 3, 39, 3, 39, 3, 39, 3, 40, 3, 40, 3, 40, 3, 40, 3, 41, 3, 41, 3, 41, 3, 41, 3, 42, 3, 42, 3, 42, 3, 43, 3, 43, 3, 43, 3, 44, 3, 44, 3, 44, 3, 45, 3, 45, 3, 45, 3, 46, 3, 46, 3, 47, 3, 47, 3, 47, 3, 48, 3, 48, 3, 48, 3, 49, 3, 49, 3, 50, 3, 50, 3, 50, 3, 51, 3, 51, 3, 51, 3, 52, 3, 52, 3, 53, 3, 53, 3, 53, 3, 54, 3, 54, 3, 55, 3, 55, 3, 55, 3, 56, 3, 56, 3, 57, 3, 57, 3, 58, 3, 58, 3, 59, 3, 59, 3, 60, 3, 60, 3, 61, 3, 61, 3, 62, 3, 62, 3, 62, 3, 63, 3, 63, 3, 64, 3, 64, 3, 65, 3, 65, 3, 66, 3, 66, 3, 67, 3, 67, 3, 68, 3, 68, 3, 69, 3, 69, 3, 70, 3, 70, 3, 71, 3, 71, 3, 72, 3, 72, 3, 73, 3, 73, 3, 74, 3, 74, 3, 75, 3, 75, 5, 75, 481, 10, 75, 3, 76, 3, 76, 3, 76, 3, 76, 3, 76, 3, 76, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 78, 3, 78, 3, 79, 3, 79, 5, 79, 498, 10, 79, 3, 79, 3, 79, 3, 79, 5, 79, 503, 10, 79, 3, 80, 3, 80, 3, 81, 6, 81, 508, 10, 81, 13, 81, 14, 81, 509, 3, 82, 3, 82, 3, 83, 5, 83, 515, 10, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 5, 83, 522, 10, 83, 3, 84, 3, 84, 5, 84, 526, 10, 84, 3, 84, 3, 84, 3, 84, 5, 84, 531, 10, 84, 3, 84, 5, 84, 534, 10, 84, 3, 85, 3, 85, 3, 86, 3, 86, 5, 86, 540, 10, 86, 3, 86, 7, 86, 543, 10, 86, 12, 86, 14, 86, 546, 11, 86, 3, 87, 3, 87, 7, 87, 550, 10, 87, 12, 87, 14, 87, 553, 11, 87, 3, 88, 3, 88, 3, 88, 3, 88, 7, 88, 559, 10, 88, 12, 88, 14, 88, 562, 11, 88, 3, 88, 3, 88, 3, 88, 3, 88, 3, 88, 3, 89, 6, 89, 570, 10, 89, 13, 89, 14, 89, 571, 3, 89, 3, 89, 3, 90, 3, 90, 3, 90, 3, 90, 7, 90, 580, 10, 90, 12, 90, 14, 90, 583, 11, 90, 3, 90, 5, 90, 586, 10, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 91, 3, 91, 3, 91, 3, 91, 3, 92, 3, 92, 3, 92, 3, 92, 3, 93, 3, 93, 3, 93, 3, 93, 3, 94, 6, 94, 605, 10, 94, 13, 94, 14, 94, 606, 3, 95, 3, 95, 3, 95, 3, 95, 3, 95, 3, 96, 3, 96, 3, 96, 3, 97, 3, 97, 3, 97, 3, 97, 3, 97, 3, 560, 2, 98, 4, 3, 6, 4, 8, 5, 10, 6, 12, 7, 14, 8, 16, 9, 18, 10, 20, 11, 22, 12, 24, 13, 26, 14, 28, 15, 30, 16, 32, 17, 34, 18, 36, 19, 38, 20, 40, 21, 42, 22, 44, 23, 46, 24, 48, 25, 50, 26, 52, 27, 54, 28, 56, 29, 58, 30, 60, 31, 62, 32, 64, 33, 66, 34, 68, 35, 70, 36, 72, 37, 74, 38, 76, 39, 78, 40, 80, 41, 82, 42, 84, 43, 86, 44, 88, 45, 90, 46, 92, 47, 94, 48, 96, 49, 98, 50, 100, 51, 102, 52, 104, 53, 106, 54, 108, 55, 110, 56, 112, 57, 114, 58, 116, 59, 118, 60, 120, 61, 122, 62, 124, 63, 126, 64, 128, 65, 130, 66, 132, 67, 134, 68, 136, 69, 138, 70, 140, 71, 142, 72, 144, 73, 146, 74, 148, 75, 150, 76, 152, 77, 154, 78, 156, 79, 158, 80, 160, 2, 162, 81, 164, 2, 166, 2, 168, 2, 170, 2, 172, 2, 174, 82, 176, 83, 178, 84, 180, 85, 182, 86, 184, 87, 186, 88, 188, 89, 190, 90, 192, 91, 194, 2, 4, 2, 3, 10, 3, 2, 50, 59, 3, 2, 51, 59, 4, 2, 45, 45, 47, 47, 5, 2, 67, 92, 97, 97, 99, 124, 6, 2, 50, 59, 67, 92, 97, 97, 99, 124, 5, 2, 11, 12, 14, 15, 34, 34, 4, 2, 12, 12, 15, 15, 5, 2, 36, 36, 38, 38, 94, 94, 2, 630, 2, 4, 3, 2, 2, 2, 2, 6, 3, 2, 2, 2, 2, 8, 3, 2, 2, 2, 2, 10, 3, 2, 2, 2, 2, 12, 3, 2, 2, 2, 2, 14, 3, 2, 2, 2, 2, 16, 3, 2, 2, 2, 2, 18, 3, 2, 2, 2, 2, 20, 3, 2, 2, 2, 2, 22, 3, 2, 2, 2, 2, 24, 3, 2, 2, 2, 2, 26, 3, 2, 2, 2, 2, 28, 3, 2, 2, 2, 2, 30, 3, 2, 2, 2, 2, 32, 3, 2, 2, 2, 2, 34, 3, 2, 2, 2, 2, 36, 3, 2, 2, 2, 2, 38, 3, 2, 2, 2, 2, 40, 3, 2, 2, 2, 2, 42, 3, 2, 2, 2, 2, 44, 3, 2, 2, 2, 2, 46, 3, 2, 2, 2, 2, 48, 3, 2, 2, 2, 2, 50, 3, 2, 2, 2, 2, 52, 3, 2, 2, 2, 2, 54, 3, 2, 2, 2, 2, 56, 3, 2, 2, 2, 2, 58, 3, 2, 2, 2, 2, 60, 3, 2, 2, 2, 2, 62, 3, 2, 2, 2, 2, 64, 3, 2, 2, 2, 2, 66, 3, 2, 2, 2, 2, 68, 3, 2, 2, 2, 2, 70, 3, 2, 2, 2, 2, 72, 3, 2, 2, 2, 2, 74, 3, 2, 2, 2, 2, 76, 3, 2, 2, 2, 2, 78, 3, 2, 2, 2, 2, 80, 3, 2, 2, 2, 2, 82, 3, 2, 2, 2, 2, 84, 3, 2, 2, 2, 2, 86, 3, 2, 2, 2, 2, 88, 3, 2, 2, 2, 2, 90, 3, 2, 2, 2, 2, 92, 3, 2, 2, 2, 2, 94, 3, 2, 2, 2, 2, 96, 3, 2, 2, 2, 2, 98, 3, 2, 2, 2, 2, 100, 3, 2, 2, 2, 2, 102, 3, 2, 2, 2, 2, 104, 3, 2, 2, 2, 2, 106, 3, 2, 2, 2, 2, 108, 3, 2, 2, 2, 2, 110, 3, 2, 2, 2, 2, 112, 3, 2, 2, 2, 2, 114, 3, 2, 2, 2, 2, 116, 3, 2, 2, 2, 2, 118, 3, 2, 2, 2, 2, 120, 3, 2, 2, 2, 2, 122, 3, 2, 2, 2, 2, 124, 3, 2, 2, 2, 2, 126, 3, 2, 2, 2, 2, 128, 3, 2, 2, 2, 2, 130, 3, 2, 2, 2, 2, 132, 3, 2, 2, 2, 2, 134, 3, 2, 2, 2, 2, 136, 3, 2, 2, 2, 2, 138, 3, 2, 2, 2, 2, 140, 3, 2, 2, 2, 2, 142, 3, 2, 2, 2, 2, 144, 3, 2, 2, 2, 2, 146, 3, 2, 2, 2, 2, 148, 3, 2, 2, 2, 2, 150, 3, 2, 2, 2, 2, 152, 3, 2, 2, 2, 2, 154, 3, 2, 2, 2, 2, 156, 3, 2, 2, 2, 2, 158, 3, 2, 2, 2, 2, 162, 3, 2, 2, 2, 2, 174, 3, 2, 2, 2, 2, 176, 3, 2, 2, 2, 2, 178, 3, 2, 2, 2, 2, 180, 3, 2, 2, 2, 2, 182, 3, 2, 2, 2, 2, 184, 3, 2, 2, 2, 2, 186, 3, 2, 2, 2, 3, 188, 3, 2, 2, 2, 3, 190, 3, 2, 2, 2, 3, 192, 3, 2, 2, 2, 3, 194, 3, 2, 2, 2, 4, 196, 3, 2, 2, 2, 6, 203, 3, 2, 2, 2, 8, 209, 3, 2, 2, 2, 10, 216, 3, 2, 2, 2, 12, 220, 3, 2, 2, 2, 14, 223, 3, 2, 2, 2, 16, 230, 3, 2, 2, 2, 18, 239, 3, 2, 2, 2, 20, 248, 3, 2, 2, 2, 22, 252, 3, 2, 2, 2, 24, 256, 3, 2, 2, 2, 26, 260, 3, 2, 2, 2, 28, 264, 3, 2, 2, 2, 30, 270, 3, 2, 2, 2, 32, 277, 3, 2, 2, 2, 34, 286, 3, 2, 2, 2, 36, 293, 3, 2, 2, 2, 38, 301, 3, 2, 2, 2, 40, 304, 3, 2, 2, 2, 42, 309, 3, 2, 2, 2, 44, 316, 3, 2, 2, 2, 46, 322, 3, 2, 2, 2, 48, 327, 3, 2, 2, 2, 50, 332, 3, 2, 2, 2, 52, 338, 3, 2, 2, 2, 54, 345, 3, 2, 2, 2, 56, 351, 3, 2, 2, 2, 58, 355, 3, 2, 2, 2, 60, 362, 3, 2, 2, 2, 62, 367, 3, 2, 2, 2, 64, 369, 3, 2, 2, 2, 66, 372, 3, 2, 2, 2, 68, 375, 3, 2, 2, 2, 70, 378, 3, 2, 2, 2, 72, 381, 3, 2, 2, 2, 74, 384, 3, 2, 2, 2, 76, 387, 3, 2, 2, 2, 78, 390, 3, 2, 2, 2, 80, 393, 3, 2, 2, 2, 82, 397, 3, 2, 2, 2, 84, 401, 3, 2, 2, 2, 86, 404, 3, 2, 2, 2, 88, 407, 3, 2, 2, 2, 90, 410, 3, 2, 2, 2, 92, 413, 3, 2, 2, 2, 94, 415, 3, 2, 2, 2, 96, 418, 3, 2, 2, 2, 98, 421, 3, 2, 2, 2, 100, 423, 3, 2, 2, 2, 102, 426, 3, 2, 2, 2, 104, 429, 3, 2, 2, 2, 106, 431, 3, 2, 2, 2, 108, 434, 3, 2, 2, 2, 110, 436, 3, 2, 2, 2, 112, 439, 3, 2, 2, 2, 114, 441, 3, 2, 2, 2, 116, 443, 3, 2, 2, 2, 118, 445, 3, 2, 2, 2, 120, 447, 3, 2, 2, 2, 122, 449, 3, 2, 2, 2, 124, 451, 3, 2, 2, 2, 126, 454, 3, 2, 2, 2, 128, 456, 3, 2, 2, 2, 130, 458, 3, 2, 2, 2, 132, 460, 3, 2, 2, 2, 134, 462, 3, 2, 2, 2, 136, 464, 3, 2, 2, 2, 138, 466, 3, 2, 2, 2, 140, 468, 3, 2, 2, 2, 142, 470, 3, 2, 2, 2, 144, 472, 3, 2, 2, 2, 146, 474, 3, 2, 2, 2, 148, 476, 3, 2, 2, 2, 150, 480, 3, 2, 2, 2, 152, 482, 3, 2, 2, 2, 154, 488, 3, 2, 2, 2, 156, 493, 3, 2, 2, 2, 158, 502, 3, 2, 2, 2, 160, 504, 3, 2, 2, 2, 162, 507, 3, 2, 2, 2, 164, 511, 3, 2, 2, 2, 166, 521, 3, 2, 2, 2, 168, 533, 3, 2, 2, 2, 170, 535, 3, 2, 2, 2, 172, 537, 3, 2, 2, 2, 174, 547, 3, 2, 2, 2, 176, 554, 3, 2, 2, 2, 178, 569, 3, 2, 2, 2, 180, 575, 3, 2, 2, 2, 182, 591, 3, 2, 2, 2, 184, 595, 3, 2, 2, 2, 186, 599, 3, 2, 2, 2, 188, 604, 3, 2, 2, 2, 190, 608, 3, 2, 2, 2, 192, 613, 3, 2, 2, 2, 194, 616, 3, 2, 2, 2, 196, 197, 7, 111, 2, 2, 197, 198, 7, 113, 2, 2, 198, 199, 7, 102, 2, 2, 199, 200, 7, 119, 2, 2, 200, 201, 7, 110, 2, 2, 201, 202, 7, 103, 2, 2, 202, 5, 3, 2, 2, 2, 203, 204, 7, 101, 2, 2, 204, 205, 7, 110, 2, 2, 205, 206, 7, 99, 2, 2, 206, 207, 7, 117, 2, 2, 207, 208, 7, 117, 2, 2, 208, 7, 3, 2, 2, 2, 209, 210, 7, 117, 2, 2, 210, 211, 7, 118, 2, 2, 211, 212, 7, 116, 2, 2, 212, 213, 7, 119, 2, 2, 213, 214, 7, 101, 2, 2, 214, 215, 7, 118, 2, 2, 215, 9, 3, 2, 2, 2, 216, 217, 7, 112, 2, 2, 217, 218, 7, 103, 2, 2, 218, 219, 7, 121, 2, 2, 219, 11, 3, 2, 2, 2, 220, 221, 7, 99, 2, 2, 221, 222, 7, 117, 2, 2, 222, 13, 3, 2, 2, 2, 223, 224, 7, 103, 2, 2, 224, 225, 7, 122, 2, 2, 225, 226, 7, 118, 2, 2, 226, 227, 7, 103, 2, 2, 227, 228, 7, 116, 2, 2, 228, 229, 7, 112, 2, 2, 229, 15, 3, 2, 2, 2, 230, 231, 7, 101, 2, 2, 231, 232, 7, 99, 2, 2, 232, 233, 7, 110, 2, 2, 233, 234, 7, 110, 2, 2, 234, 235, 7, 99, 2, 2, 235, 236, 7, 100, 2, 2, 236, 237, 7, 110, 2, 2, 237, 238, 7, 103, 2, 2, 238, 17, 3, 2, 2, 2, 239, 240, 7, 104, 2, 2, 240, 241, 7, 119, 2, 2, 241, 242, 7, 112, 2, 2, 242, 243, 7, 101, 2, 2, 243, 244, 7, 118, 2, 2, 244, 245, 7, 107, 2, 2, 245, 246, 7, 113, 2, 2, 246, 247, 7, 112, 2, 2, 247, 19, 3, 2, 2, 2, 248, 249, 7, 120, 2, 2, 249, 250, 7, 99, 2, 2, 250, 251, 7, 116, 2, 2, 251, 21, 3, 2, 2, 2, 252, 253, 7, 105, 2, 2, 253, 254, 7, 103, 2, 2, 254, 255, 7, 118, 2, 2, 255, 23, 3, 2, 2, 2, 256, 257, 7, 117, 2, 2, 257, 258, 7, 103, 2, 2, 258, 259, 7, 118, 2, 2, 259, 25, 3, 2, 2, 2, 260, 261, 7, 104, 2, 2, 261, 262, 7, 113, 2, 2, 262, 263, 7, 116, 2, 2, 263, 27, 3, 2, 2, 2, 264, 265, 7, 121, 2, 2, 265, 266, 7, 106, 2, 2, 266, 267, 7, 107, 2, 2, 267, 268, 7, 110, 2, 2, 268, 269, 7, 103, 2, 2, 269, 29, 3, 2, 2, 2, 270, 271, 7, 117, 2, 2, 271, 272, 7, 118, 2, 2, 272, 273, 7, 99, 2, 2, 273, 274, 7, 118, 2, 2, 274, 275, 7, 107, 2, 2, 275, 276, 7, 101, 2, 2, 276, 31, 3, 2, 2, 2, 277, 278, 7, 99, 2, 2, 278, 279, 7, 100, 2, 2, 279, 280, 7, 117, 2, 2, 280, 281, 7, 118, 2, 2, 281, 282, 7, 116, 2, 2, 282, 283, 7, 99, 2, 2, 283, 284, 7, 101, 2, 2, 284, 285, 7, 118, 2, 2, 285, 33, 3, 2, 2, 2, 286, 287, 7, 114, 2, 2, 287, 288, 7, 119, 2, 2, 288, 289, 7, 100, 2, 2, 289, 290, 7, 110, 2, 2, 290, 291, 7, 107, 2, 2, 291, 292, 7, 101, 2, 2, 292, 35, 3, 2, 2, 2, 293, 294, 7, 114, 2, 2, 294, 295, 7, 116, 2, 2, 295, 296, 7, 107, 2, 2, 296, 297, 7, 120, 2, 2, 297, 298, 7, 99, 2, 2, 298, 299, 7, 118, 2, 2, 299, 300, 7, 103, 2, 2, 300, 37, 3, 2, 2, 2, 301, 302, 7, 107, 2, 2, 302, 303, 7, 104, 2, 2, 303, 39, 3, 2, 2, 2, 304, 305, 7, 103, 2, 2, 305, 306, 7, 110, 2, 2, 306, 307, 7, 117, 2, 2, 307, 308, 7, 103, 2, 2, 308, 41, 3, 2, 2, 2, 309, 310, 7, 116, 2, 2, 310, 311, 7, 103, 2, 2, 311, 312, 7, 118, 2, 2, 312, 313, 7, 119, 2, 2, 313, 314, 7, 116, 2, 2, 314, 315, 7, 112, 2, 2, 315, 43, 3, 2, 2, 2, 316, 317, 7, 100, 2, 2, 317, 318, 7, 116, 2, 2, 318, 319, 7, 103, 2, 2, 319, 320, 7, 99, 2, 2, 320, 321, 7, 109, 2, 2, 321, 45, 3, 2, 2, 2, 322, 323, 7, 112, 2, 2, 323, 324, 7, 119, 2, 2, 324, 325, 7, 110, 2, 2, 325, 326, 7, 110, 2, 2, 326, 47, 3, 2, 2, 2, 327, 328, 7, 118, 2, 2, 328, 329, 7, 106, 2, 2, 329, 330, 7, 107, 2, 2, 330, 331, 7, 117, 2, 2, 331, 49, 3, 2, 2, 2, 332, 333, 7, 119, 2, 2, 333, 334, 7, 117, 2, 2, 334, 335, 7, 107, 2, 2, 335, 336, 7, 112, 2, 2, 336, 337, 7, 105, 2, 2, 337, 51, 3, 2, 2, 2, 338, 339, 7, 107, 2, 2, 339, 340, 7, 111, 2, 2, 340, 341, 7, 114, 2, 2, 341, 342, 7, 113, 2, 2, 342, 343, 7, 116, 2, 2, 343, 344, 7, 118, 2, 2, 344, 53, 3, 2, 2, 2, 345, 346, 7, 117, 2, 2, 346, 347, 7, 118, 2, 2, 347, 348, 7, 99, 2, 2, 348, 349, 7, 116, 2, 2, 349, 350, 7, 118, 2, 2, 350, 55, 3, 2, 2, 2, 351, 352, 7, 119, 2, 2, 352, 353, 7, 117, 2, 2, 353, 354, 7, 103, 2, 2, 354, 57, 3, 2, 2, 2, 355, 356, 7, 118, 2, 2, 356, 357, 7, 106, 2, 2, 357, 358, 7, 116, 2, 2, 358, 359, 7, 103, 2, 2, 359, 360, 7, 99, 2, 2, 360, 361, 7, 102, 2, 2, 361, 59, 3, 2, 2, 2, 362, 363, 7, 117, 2, 2, 363, 364, 7, 123, 2, 2, 364, 365, 7, 112, 2, 2, 365, 366, 7, 101, 2, 2, 366, 61, 3, 2, 2, 2, 367, 368, 7, 63, 2, 2, 368, 63, 3, 2, 2, 2, 369, 370, 7, 45, 2, 2, 370, 371, 7, 63, 2, 2, 371, 65, 3, 2, 2, 2, 372, 373, 7, 47, 2, 2, 373, 374, 7, 63, 2, 2, 374, 67, 3, 2, 2, 2, 375, 376, 7, 44, 2, 2, 376, 377, 7, 63, 2, 2, 377, 69, 3, 2, 2, 2, 378, 379, 7, 49, 2, 2, 379, 380, 7, 63, 2, 2, 380, 71, 3, 2, 2, 2, 381, 382, 7, 39, 2, 2, 382, 383, 7, 63, 2, 2, 383, 73, 3, 2, 2, 2, 384, 385, 7, 40, 2, 2, 385, 386, 7, 63, 2, 2, 386, 75, 3, 2, 2, 2, 387, 388, 7, 126, 2, 2, 388, 389, 7, 63, 2, 2, 389, 77, 3, 2, 2, 2, 390, 391, 7, 96, 2, 2, 391, 392, 7, 63, 2, 2, 392, 79, 3, 2, 2, 2, 393, 394, 7, 62, 2, 2, 394, 395, 7, 62, 2, 2, 395, 396, 7, 63, 2, 2, 396, 81, 3, 2, 2, 2, 397, 398, 7, 64, 2, 2, 398, 399, 7, 64, 2, 2, 399, 400, 7, 63, 2, 2, 400, 83, 3, 2, 2, 2, 401, 402, 7, 126, 2, 2, 402, 403, 7, 126, 2, 2, 403, 85, 3, 2, 2, 2, 404, 405, 7, 40, 2, 2, 405, 406, 7, 40, 2, 2, 406, 87, 3, 2, 2, 2, 407, 408, 7, 35, 2, 2, 408, 409, 7, 63, 2, 2, 409, 89, 3, 2, 2, 2, 410, 411, 7, 63, 2, 2, 411, 412, 7, 63, 2, 2, 412, 91, 3, 2, 2, 2, 413, 414, 7, 64, 2, 2, 414, 93, 3, 2, 2, 2, 415, 416, 7, 64, 2, 2, 416, 417, 7, 64, 2, 2, 417, 95, 3, 2, 2, 2, 418, 419, 7, 64, 2, 2, 419, 420, 7, 63, 2, 2, 420, 97, 3, 2, 2, 2, 421, 422, 7, 62, 2, 2, 422, 99, 3, 2, 2, 2, 423, 424, 7, 62, 2, 2, 424, 425, 7, 62, 2, 2, 425, 101, 3, 2, 2, 2, 426, 427, 7, 62, 2, 2, 427, 428, 7, 63, 2, 2, 428, 103, 3, 2, 2, 2, 429, 430, 7, 47, 2, 2, 430, 105, 3, 2, 2, 2, 431, 432, 7, 47, 2, 2, 432, 433, 7, 47, 2, 2, 433, 107, 3, 2, 2, 2, 434, 435, 7, 45, 2, 2, 435, 109, 3, 2, 2, 2, 436, 437, 7, 45, 2, 2, 437, 438, 7, 45, 2, 2, 438, 111, 3, 2, 2, 2, 439, 440, 7, 49, 2, 2, 440, 113, 3, 2, 2, 2, 441, 442, 7, 44, 2, 2, 442, 115, 3, 2, 2, 2, 443, 444, 7, 35, 2, 2, 444, 117, 3, 2, 2, 2, 445, 446, 7, 48, 2, 2, 446, 119, 3, 2, 2, 2, 447, 448, 7, 65, 2, 2, 448, 121, 3, 2, 2, 2, 449, 450, 7, 60, 2, 2, 450, 123, 3, 2, 2, 2, 451, 452, 7, 47, 2, 2, 452, 453, 7, 64, 2, 2, 453, 125, 3, 2, 2, 2, 454, 455, 7, 39, 2, 2, 455, 127, 3, 2, 2, 2, 456, 457, 7, 128, 2, 2, 457, 129, 3, 2, 2, 2, 458, 459, 7, 40, 2, 2, 459, 131, 3, 2, 2, 2, 460, 461, 7, 96, 2, 2, 461, 133, 3, 2, 2, 2, 462, 463, 7, 126, 2, 2, 463, 135, 3, 2, 2, 2, 464, 465, 7, 42, 2, 2, 465, 137, 3, 2, 2, 2, 466, 467, 7, 43, 2, 2, 467, 139, 3, 2, 2, 2, 468, 469, 7, 93, 2, 2, 469, 141, 3, 2, 2, 2, 470, 471, 7, 95, 2, 2, 471, 143, 3, 2, 2, 2, 472, 473, 7, 46, 2, 2, 473, 145, 3, 2, 2, 2, 474, 475, 7, 61, 2, 2, 475, 147, 3, 2, 2, 2, 476, 477, 7, 38, 2, 2, 477, 149, 3, 2, 2, 2, 478, 481, 5, 152, 76, 2, 479, 481, 5, 154, 77, 2, 480, 478, 3, 2, 2, 2, 480, 479, 3, 2, 2, 2, 481, 151, 3, 2, 2, 2, 482, 483, 7, 104, 2, 2, 483, 484, 7, 99, 2, 2, 484, 485, 7, 110, 2, 2, 485, 486, 7, 117, 2, 2, 486, 487, 7, 103, 2, 2, 487, 153, 3, 2, 2, 2, 488, 489, 7, 118, 2, 2, 489, 490, 7, 116, 2, 2, 490, 491, 7, 119, 2, 2, 491, 492, 7, 103, 2, 2, 492, 155, 3, 2, 2, 2, 493, 494, 5, 162, 81, 2, 494, 157, 3, 2, 2, 2, 495, 497, 5, 166, 83, 2, 496, 498, 5, 168, 84, 2, 497, 496, 3, 2, 2, 2, 497, 498, 3, 2, 2, 2, 498, 503, 3, 2, 2, 2, 499, 500, 5, 172, 86, 2, 500, 501, 5, 168, 84, 2, 501, 503, 3, 2, 2, 2, 502, 495, 3, 2, 2, 2, 502, 499, 3, 2, 2, 2, 503, 159, 3, 2, 2, 2, 504, 505, 9, 2, 2, 2, 505, 161, 3, 2, 2, 2, 506, 508, 5, 160, 80, 2, 507, 506, 3, 2, 2, 2, 508, 509, 3, 2, 2, 2, 509, 507, 3, 2, 2, 2, 509, 510, 3, 2, 2, 2, 510, 163, 3, 2, 2, 2, 511, 512, 9, 3, 2, 2, 512, 165, 3, 2, 2, 2, 513, 515, 5, 172, 86, 2, 514, 513, 3, 2, 2, 2, 514, 515, 3, 2, 2, 2, 515, 516, 3, 2, 2, 2, 516, 517, 7, 48, 2, 2, 517, 522, 5, 172, 86, 2, 518, 519, 5, 172, 86, 2, 519, 520, 7, 48, 2, 2, 520, 522, 3, 2, 2, 2, 521, 514, 3, 2, 2, 2, 521, 518, 3, 2, 2, 2, 522, 167, 3, 2, 2, 2, 523, 525, 7, 103, 2, 2, 524, 526, 5, 170, 85, 2, 525, 524, 3, 2, 2, 2, 525, 526, 3, 2, 2, 2, 526, 527, 3, 2, 2, 2, 527, 534, 5, 172, 86, 2, 528, 530, 7, 71, 2, 2, 529, 531, 5, 170, 85, 2, 530, 529, 3, 2, 2, 2, 530, 531, 3, 2, 2, 2, 531, 532, 3, 2, 2, 2, 532, 534, 5, 172, 86, 2, 533, 523, 3, 2, 2, 2, 533, 528, 3, 2, 2, 2, 534, 169, 3, 2, 2, 2, 535, 536, 9, 4, 2, 2, 536, 171, 3, 2, 2, 2, 537, 544, 5, 160, 80, 2, 538, 540, 7, 41, 2, 2, 539, 538, 3, 2, 2, 2, 539, 540, 3, 2, 2, 2, 540, 541, 3, 2, 2, 2, 541, 543, 5, 160, 80, 2, 542, 539, 3, 2, 2, 2, 543, 546, 3, 2, 2, 2, 544, 542, 3, 2, 2, 2, 544, 545, 3, 2, 2, 2, 545, 173, 3, 2, 2, 2, 546, 544, 3, 2, 2, 2, 547, 551, 9, 5, 2, 2, 548, 550, 9, 6, 2, 2, 549, 548, 3, 2, 2, 2, 550, 553, 3, 2, 2, 2, 551, 549, 3, 2, 2, 2, 551, 552, 3, 2, 2, 2, 552, 175, 3, 2, 2, 2, 553, 551, 3, 2, 2, 2, 554, 555, 7, 49, 2, 2, 555, 556, 7, 44, 2, 2, 556, 560, 3, 2, 2, 2, 557, 559, 11, 2, 2, 2, 558, 557, 3, 2, 2, 2, 559, 562, 3, 2, 2, 2, 560, 561, 3, 2, 2, 2, 560, 558, 3, 2, 2, 2, 561, 563, 3, 2, 2, 2, 562, 560, 3, 2, 2, 2, 563, 564, 7, 44, 2, 2, 564, 565, 7, 49, 2, 2, 565, 566, 3, 2, 2, 2, 566, 567, 8, 88, 2, 2, 567, 177, 3, 2, 2, 2, 568, 570, 9, 7, 2, 2, 569, 568, 3, 2, 2, 2, 570, 571, 3, 2, 2, 2, 571, 569, 3, 2, 2, 2, 571, 572, 3, 2, 2, 2, 572, 573, 3, 2, 2, 2, 573, 574, 8, 89, 2, 2, 574, 179, 3, 2, 2, 2, 575, 576, 7, 49, 2, 2, 576, 577, 7, 49, 2, 2, 577, 581, 3, 2, 2, 2, 578, 580, 10, 8, 2, 2, 579, 578, 3, 2, 2, 2, 580, 583, 3, 2, 2, 2, 581, 579, 3, 2, 2, 2, 581, 582, 3, 2, 2, 2, 582, 585, 3, 2, 2, 2, 583, 581, 3, 2, 2, 2, 584, 586, 7, 15, 2, 2, 585, 584, 3, 2, 2, 2, 585, 586, 3, 2, 2, 2, 586, 587, 3, 2, 2, 2, 587, 588, 7, 12, 2, 2, 588, 589, 3, 2, 2, 2, 589, 590, 8, 90, 2, 2, 590, 181, 3, 2, 2, 2, 591, 592, 7, 36, 2, 2, 592, 593, 3, 2, 2, 2, 593, 594, 8, 91, 3, 2, 594, 183, 3, 2, 2, 2, 595, 596, 7, 125, 2, 2, 596, 597, 3, 2, 2, 2, 597, 598, 8, 92, 4, 2, 598, 185, 3, 2, 2, 2, 599, 600, 7, 127, 2, 2, 600, 601, 3, 2, 2, 2, 601, 602, 8, 93, 5, 2, 602, 187, 3, 2, 2, 2, 603, 605, 10, 9, 2, 2, 604, 603, 3, 2, 2, 2, 605, 606, 3, 2, 2, 2, 606, 604, 3, 2, 2, 2, 606, 607, 3, 2, 2, 2, 607, 189, 3, 2, 2, 2, 608, 609, 7, 38, 2, 2, 609, 610, 7, 125, 2, 2, 610, 611, 3, 2, 2, 2, 611, 612, 8, 95, 4, 2, 612, 191, 3, 2, 2, 2, 613, 614, 7, 94, 2, 2, 614, 615, 11, 2, 2, 2, 615, 193, 3, 2, 2, 2, 616, 617, 7, 36, 2, 2, 617, 618, 3, 2, 2, 2, 618, 619, 8, 97, 6, 2, 619, 620, 8, 97, 5, 2, 620, 195, 3, 2, 2, 2, 21, 2, 3, 480, 497, 502, 509, 514, 521, 525, 530, 533, 539, 544, 551, 560, 571, 581, 585, 606, 7, 8, 2, 2, 7, 3, 2, 7, 2, 2, 6, 2, 2, 9, 86, 2] \ No newline at end of file diff --git a/Bite/AntlrGenerated/AntlrBiteParser/BITELexer.tokens b/Bite/AntlrGenerated/AntlrBiteParser/BITELexer.tokens index 4148fee..9e582cf 100644 --- a/Bite/AntlrGenerated/AntlrBiteParser/BITELexer.tokens +++ b/Bite/AntlrGenerated/AntlrBiteParser/BITELexer.tokens @@ -23,66 +23,70 @@ NullReference=22 ThisReference=23 UsingDirective=24 ImportDirective=25 -AssignOperator=26 -PlusAssignOperator=27 -MinusAssignOperator=28 -MultiplyAssignOperator=29 -DivideAssignOperator=30 -ModuloAssignOperator=31 -BitwiseAndAssignOperator=32 -BitwiseOrAssignOperator=33 -BitwiseXorAssignOperator=34 -BitwiseLeftShiftAssignOperator=35 -BitwiseRightShiftAssignOperator=36 -LogicalOrOperator=37 -LogicalAndOperator=38 -UnequalOperator=39 -EqualOperator=40 -GreaterOperator=41 -ShiftRightOperator=42 -GreaterEqualOperator=43 -SmallerOperator=44 -ShiftLeftOperator=45 -SmallerEqualOperator=46 -MinusOperator=47 -MinusMinusOperator=48 -PlusOperator=49 -PlusPlusOperator=50 -DivideOperator=51 -MultiplyOperator=52 -LogicalNegationOperator=53 -DotOperator=54 -QuestionMarkOperator=55 -ColonOperator=56 -ReferenceOperator=57 -ModuloOperator=58 -ComplimentOperator=59 -BitwiseAndOperator=60 -BitwiseXorOperator=61 -BitwiseOrOperator=62 -OpeningRoundBracket=63 -ClosingRoundBracket=64 -SquarebracketLeft=65 -SquarebracketRight=66 -CommaSeperator=67 -SemicolonSeperator=68 -DollarOperator=69 -BooleanLiteral=70 -False_=71 -True_=72 -IntegerLiteral=73 -FloatingLiteral=74 -DecimalLiteral=75 -Identifier=76 -COMMENT=77 -WS=78 -LINE_COMMENT=79 -DQUOTE=80 -CURLY_L=81 -CURLY_R=82 -TEXT=83 -BACKSLASH_PAREN=84 -ESCAPE_SEQUENCE=85 +StartStatement=26 +UseStatement=27 +ThreadStatement=28 +SyncKeyword=29 +AssignOperator=30 +PlusAssignOperator=31 +MinusAssignOperator=32 +MultiplyAssignOperator=33 +DivideAssignOperator=34 +ModuloAssignOperator=35 +BitwiseAndAssignOperator=36 +BitwiseOrAssignOperator=37 +BitwiseXorAssignOperator=38 +BitwiseLeftShiftAssignOperator=39 +BitwiseRightShiftAssignOperator=40 +LogicalOrOperator=41 +LogicalAndOperator=42 +UnequalOperator=43 +EqualOperator=44 +GreaterOperator=45 +ShiftRightOperator=46 +GreaterEqualOperator=47 +SmallerOperator=48 +ShiftLeftOperator=49 +SmallerEqualOperator=50 +MinusOperator=51 +MinusMinusOperator=52 +PlusOperator=53 +PlusPlusOperator=54 +DivideOperator=55 +MultiplyOperator=56 +LogicalNegationOperator=57 +DotOperator=58 +QuestionMarkOperator=59 +ColonOperator=60 +ReferenceOperator=61 +ModuloOperator=62 +ComplimentOperator=63 +BitwiseAndOperator=64 +BitwiseXorOperator=65 +BitwiseOrOperator=66 +OpeningRoundBracket=67 +ClosingRoundBracket=68 +SquareBracketLeft=69 +SquareBracketRight=70 +CommaSeparator=71 +SemicolonSeparator=72 +DollarOperator=73 +BooleanLiteral=74 +False_=75 +True_=76 +IntegerLiteral=77 +FloatingLiteral=78 +DecimalLiteral=79 +Identifier=80 +COMMENT=81 +WS=82 +LINE_COMMENT=83 +DQUOTE=84 +CURLY_L=85 +CURLY_R=86 +TEXT=87 +BACKSLASH_PAREN=88 +ESCAPE_SEQUENCE=89 'module'=1 'class'=2 'struct'=3 @@ -108,52 +112,56 @@ ESCAPE_SEQUENCE=85 'this'=23 'using'=24 'import'=25 -'='=26 -'+='=27 -'-='=28 -'*='=29 -'/='=30 -'%='=31 -'&='=32 -'|='=33 -'^='=34 -'<<='=35 -'>>='=36 -'||'=37 -'&&'=38 -'!='=39 -'=='=40 -'>'=41 -'>>'=42 -'>='=43 -'<'=44 -'<<'=45 -'<='=46 -'-'=47 -'--'=48 -'+'=49 -'++'=50 -'/'=51 -'*'=52 -'!'=53 -'.'=54 -'?'=55 -':'=56 -'->'=57 -'%'=58 -'~'=59 -'&'=60 -'^'=61 -'|'=62 -'('=63 -')'=64 -'['=65 -']'=66 -','=67 -';'=68 -'$'=69 -'false'=71 -'true'=72 -'{'=81 -'}'=82 -'${'=84 +'start'=26 +'use'=27 +'thread'=28 +'sync'=29 +'='=30 +'+='=31 +'-='=32 +'*='=33 +'/='=34 +'%='=35 +'&='=36 +'|='=37 +'^='=38 +'<<='=39 +'>>='=40 +'||'=41 +'&&'=42 +'!='=43 +'=='=44 +'>'=45 +'>>'=46 +'>='=47 +'<'=48 +'<<'=49 +'<='=50 +'-'=51 +'--'=52 +'+'=53 +'++'=54 +'/'=55 +'*'=56 +'!'=57 +'.'=58 +'?'=59 +':'=60 +'->'=61 +'%'=62 +'~'=63 +'&'=64 +'^'=65 +'|'=66 +'('=67 +')'=68 +'['=69 +']'=70 +','=71 +';'=72 +'$'=73 +'false'=75 +'true'=76 +'{'=85 +'}'=86 +'${'=88 diff --git a/Bite/AntlrGenerated/AntlrBiteParser/BITEParser.cs b/Bite/AntlrGenerated/AntlrBiteParser/BITEParser.cs index d3e7412..c737124 100644 --- a/Bite/AntlrGenerated/AntlrBiteParser/BITEParser.cs +++ b/Bite/AntlrGenerated/AntlrBiteParser/BITEParser.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -// Generated from C:/Language Dev 3/Bite Programming Language/Bite/Grammar\BITEParser.g4 by ANTLR 4.9.2 +// Generated from BITEParser.g4 by ANTLR 4.9.2 // Unreachable code detected #pragma warning disable 0162 @@ -43,21 +43,22 @@ public const int DeclareWhileLoop=13, DeclareStatic=14, DeclareAbstract=15, DeclarePublic=16, DeclarePrivate=17, ControlFlowIf=18, ControlFlowElse=19, FunctionReturn=20, Break=21, NullReference=22, ThisReference=23, UsingDirective=24, ImportDirective=25, - AssignOperator=26, PlusAssignOperator=27, MinusAssignOperator=28, MultiplyAssignOperator=29, - DivideAssignOperator=30, ModuloAssignOperator=31, BitwiseAndAssignOperator=32, - BitwiseOrAssignOperator=33, BitwiseXorAssignOperator=34, BitwiseLeftShiftAssignOperator=35, - BitwiseRightShiftAssignOperator=36, LogicalOrOperator=37, LogicalAndOperator=38, - UnequalOperator=39, EqualOperator=40, GreaterOperator=41, ShiftRightOperator=42, - GreaterEqualOperator=43, SmallerOperator=44, ShiftLeftOperator=45, SmallerEqualOperator=46, - MinusOperator=47, MinusMinusOperator=48, PlusOperator=49, PlusPlusOperator=50, - DivideOperator=51, MultiplyOperator=52, LogicalNegationOperator=53, DotOperator=54, - QuestionMarkOperator=55, ColonOperator=56, ReferenceOperator=57, ModuloOperator=58, - ComplimentOperator=59, BitwiseAndOperator=60, BitwiseXorOperator=61, BitwiseOrOperator=62, - OpeningRoundBracket=63, ClosingRoundBracket=64, SquarebracketLeft=65, - SquarebracketRight=66, CommaSeperator=67, SemicolonSeperator=68, DollarOperator=69, - BooleanLiteral=70, False_=71, True_=72, IntegerLiteral=73, FloatingLiteral=74, - DecimalLiteral=75, Identifier=76, COMMENT=77, WS=78, LINE_COMMENT=79, - DQUOTE=80, CURLY_L=81, CURLY_R=82, TEXT=83, BACKSLASH_PAREN=84, ESCAPE_SEQUENCE=85; + StartStatement=26, UseStatement=27, ThreadStatement=28, SyncKeyword=29, + AssignOperator=30, PlusAssignOperator=31, MinusAssignOperator=32, MultiplyAssignOperator=33, + DivideAssignOperator=34, ModuloAssignOperator=35, BitwiseAndAssignOperator=36, + BitwiseOrAssignOperator=37, BitwiseXorAssignOperator=38, BitwiseLeftShiftAssignOperator=39, + BitwiseRightShiftAssignOperator=40, LogicalOrOperator=41, LogicalAndOperator=42, + UnequalOperator=43, EqualOperator=44, GreaterOperator=45, ShiftRightOperator=46, + GreaterEqualOperator=47, SmallerOperator=48, ShiftLeftOperator=49, SmallerEqualOperator=50, + MinusOperator=51, MinusMinusOperator=52, PlusOperator=53, PlusPlusOperator=54, + DivideOperator=55, MultiplyOperator=56, LogicalNegationOperator=57, DotOperator=58, + QuestionMarkOperator=59, ColonOperator=60, ReferenceOperator=61, ModuloOperator=62, + ComplimentOperator=63, BitwiseAndOperator=64, BitwiseXorOperator=65, BitwiseOrOperator=66, + OpeningRoundBracket=67, ClosingRoundBracket=68, SquareBracketLeft=69, + SquareBracketRight=70, CommaSeparator=71, SemicolonSeparator=72, DollarOperator=73, + BooleanLiteral=74, False_=75, True_=76, IntegerLiteral=77, FloatingLiteral=78, + DecimalLiteral=79, Identifier=80, COMMENT=81, WS=82, LINE_COMMENT=83, + DQUOTE=84, CURLY_L=85, CURLY_R=86, TEXT=87, BACKSLASH_PAREN=88, ESCAPE_SEQUENCE=89; public const int RULE_program = 0, RULE_module = 1, RULE_moduleDeclaration = 2, RULE_importDirective = 3, RULE_usingDirective = 4, RULE_declaration = 5, RULE_classDeclaration = 6, @@ -66,42 +67,48 @@ public const int RULE_statement = 13, RULE_exprStatement = 14, RULE_localVarDeclaration = 15, RULE_localVarInitializer = 16, RULE_forInitializer = 17, RULE_forIterator = 18, RULE_forStatement = 19, RULE_ifStatement = 20, RULE_returnStatement = 21, - RULE_breakStatement = 22, RULE_usingStatement = 23, RULE_whileStatement = 24, - RULE_block = 25, RULE_expression = 26, RULE_assignment = 27, RULE_lambdaExpression = 28, - RULE_ternary = 29, RULE_logicOr = 30, RULE_logicAnd = 31, RULE_bitwiseOr = 32, - RULE_bitwiseXor = 33, RULE_bitwiseAnd = 34, RULE_equality = 35, RULE_relational = 36, - RULE_shift = 37, RULE_additive = 38, RULE_multiplicative = 39, RULE_unary = 40, - RULE_call = 41, RULE_primary = 42, RULE_privateModifier = 43, RULE_publicModifier = 44, - RULE_abstractModifier = 45, RULE_staticModifier = 46, RULE_parameters = 47, - RULE_arguments = 48, RULE_inheritance = 49, RULE_callArguments = 50, RULE_elementAccess = 51, - RULE_elementIdentifier = 52, RULE_argumentExpression = 53, RULE_parametersIdentifier = 54, - RULE_string = 55, RULE_stringPart = 56; + RULE_breakStatement = 22, RULE_usingStatement = 23, RULE_startThreadStatement = 24, + RULE_useThreadStatement = 25, RULE_whileStatement = 26, RULE_syncBlock = 27, + RULE_block = 28, RULE_expression = 29, RULE_assignment = 30, RULE_lambdaExpression = 31, + RULE_ternary = 32, RULE_logicOr = 33, RULE_logicAnd = 34, RULE_bitwiseOr = 35, + RULE_bitwiseXor = 36, RULE_bitwiseAnd = 37, RULE_equality = 38, RULE_relational = 39, + RULE_shift = 40, RULE_additive = 41, RULE_multiplicative = 42, RULE_unary = 43, + RULE_call = 44, RULE_arrayExpression = 45, RULE_elementInitialization = 46, + RULE_dictionaryExpression = 47, RULE_primary = 48, RULE_memberInitialization = 49, + RULE_privateModifier = 50, RULE_publicModifier = 51, RULE_abstractModifier = 52, + RULE_staticModifier = 53, RULE_initializerExpression = 54, RULE_parameters = 55, + RULE_arguments = 56, RULE_inheritance = 57, RULE_callArguments = 58, RULE_elementAccess = 59, + RULE_elementIdentifier = 60, RULE_argumentExpression = 61, RULE_parametersIdentifier = 62, + RULE_string = 63, RULE_stringPart = 64; public static readonly string[] ruleNames = { "program", "module", "moduleDeclaration", "importDirective", "usingDirective", "declaration", "classDeclaration", "structDeclaration", "externalFunctionDeclaration", "functionDeclaration", "classInstanceDeclaration", "variableDeclaration", "statements", "statement", "exprStatement", "localVarDeclaration", "localVarInitializer", "forInitializer", "forIterator", "forStatement", "ifStatement", "returnStatement", - "breakStatement", "usingStatement", "whileStatement", "block", "expression", - "assignment", "lambdaExpression", "ternary", "logicOr", "logicAnd", "bitwiseOr", - "bitwiseXor", "bitwiseAnd", "equality", "relational", "shift", "additive", - "multiplicative", "unary", "call", "primary", "privateModifier", "publicModifier", - "abstractModifier", "staticModifier", "parameters", "arguments", "inheritance", - "callArguments", "elementAccess", "elementIdentifier", "argumentExpression", - "parametersIdentifier", "string", "stringPart" + "breakStatement", "usingStatement", "startThreadStatement", "useThreadStatement", + "whileStatement", "syncBlock", "block", "expression", "assignment", "lambdaExpression", + "ternary", "logicOr", "logicAnd", "bitwiseOr", "bitwiseXor", "bitwiseAnd", + "equality", "relational", "shift", "additive", "multiplicative", "unary", + "call", "arrayExpression", "elementInitialization", "dictionaryExpression", + "primary", "memberInitialization", "privateModifier", "publicModifier", + "abstractModifier", "staticModifier", "initializerExpression", "parameters", + "arguments", "inheritance", "callArguments", "elementAccess", "elementIdentifier", + "argumentExpression", "parametersIdentifier", "string", "stringPart" }; private static readonly string[] _LiteralNames = { null, "'module'", "'class'", "'struct'", "'new'", "'as'", "'extern'", "'callable'", "'function'", "'var'", "'get'", "'set'", "'for'", "'while'", "'static'", "'abstract'", "'public'", "'private'", "'if'", "'else'", "'return'", - "'break'", "'null'", "'this'", "'using'", "'import'", "'='", "'+='", "'-='", - "'*='", "'/='", "'%='", "'&='", "'|='", "'^='", "'<<='", "'>>='", "'||'", - "'&&'", "'!='", "'=='", "'>'", "'>>'", "'>='", "'<'", "'<<'", "'<='", - "'-'", "'--'", "'+'", "'++'", "'/'", "'*'", "'!'", "'.'", "'?'", "':'", - "'->'", "'%'", "'~'", "'&'", "'^'", "'|'", "'('", "')'", "'['", "']'", - "','", "';'", "'$'", null, "'false'", "'true'", null, null, null, null, - null, null, null, null, "'{'", "'}'", null, "'${'" + "'break'", "'null'", "'this'", "'using'", "'import'", "'start'", "'use'", + "'thread'", "'sync'", "'='", "'+='", "'-='", "'*='", "'/='", "'%='", "'&='", + "'|='", "'^='", "'<<='", "'>>='", "'||'", "'&&'", "'!='", "'=='", "'>'", + "'>>'", "'>='", "'<'", "'<<'", "'<='", "'-'", "'--'", "'+'", "'++'", "'/'", + "'*'", "'!'", "'.'", "'?'", "':'", "'->'", "'%'", "'~'", "'&'", "'^'", + "'|'", "'('", "')'", "'['", "']'", "','", "';'", "'$'", null, "'false'", + "'true'", null, null, null, null, null, null, null, null, "'{'", "'}'", + null, "'${'" }; private static readonly string[] _SymbolicNames = { null, "DeclareModule", "DeclareClass", "DeclareStruct", "DeclareClassInstance", @@ -110,7 +117,8 @@ public const int "DeclareWhileLoop", "DeclareStatic", "DeclareAbstract", "DeclarePublic", "DeclarePrivate", "ControlFlowIf", "ControlFlowElse", "FunctionReturn", "Break", "NullReference", "ThisReference", "UsingDirective", "ImportDirective", - "AssignOperator", "PlusAssignOperator", "MinusAssignOperator", "MultiplyAssignOperator", + "StartStatement", "UseStatement", "ThreadStatement", "SyncKeyword", "AssignOperator", + "PlusAssignOperator", "MinusAssignOperator", "MultiplyAssignOperator", "DivideAssignOperator", "ModuloAssignOperator", "BitwiseAndAssignOperator", "BitwiseOrAssignOperator", "BitwiseXorAssignOperator", "BitwiseLeftShiftAssignOperator", "BitwiseRightShiftAssignOperator", "LogicalOrOperator", "LogicalAndOperator", @@ -120,8 +128,8 @@ public const int "DivideOperator", "MultiplyOperator", "LogicalNegationOperator", "DotOperator", "QuestionMarkOperator", "ColonOperator", "ReferenceOperator", "ModuloOperator", "ComplimentOperator", "BitwiseAndOperator", "BitwiseXorOperator", "BitwiseOrOperator", - "OpeningRoundBracket", "ClosingRoundBracket", "SquarebracketLeft", "SquarebracketRight", - "CommaSeperator", "SemicolonSeperator", "DollarOperator", "BooleanLiteral", + "OpeningRoundBracket", "ClosingRoundBracket", "SquareBracketLeft", "SquareBracketRight", + "CommaSeparator", "SemicolonSeparator", "DollarOperator", "BooleanLiteral", "False_", "True_", "IntegerLiteral", "FloatingLiteral", "DecimalLiteral", "Identifier", "COMMENT", "WS", "LINE_COMMENT", "DQUOTE", "CURLY_L", "CURLY_R", "TEXT", "BACKSLASH_PAREN", "ESCAPE_SEQUENCE" @@ -186,17 +194,17 @@ public ProgramContext program() { try { EnterOuterAlt(_localctx, 1); { - State = 117; + State = 133; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==DeclareModule) { { { - State = 114; + State = 130; module(); } } - State = 119; + State = 135; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -258,26 +266,26 @@ public ModuleContext module() { int _alt; EnterOuterAlt(_localctx, 1); { - State = 120; + State = 136; moduleDeclaration(); - State = 125; + State = 141; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream,2,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { - State = 123; + State = 139; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case ImportDirective: { - State = 121; + State = 137; importDirective(); } break; case UsingDirective: { - State = 122; + State = 138; usingDirective(); } break; @@ -286,25 +294,25 @@ public ModuleContext module() { } } } - State = 127; + State = 143; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream,2,Context); } - State = 131; + State = 147; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << DeclareClass) | (1L << DeclareStruct) | (1L << ExternModifier) | (1L << CallableModifier) | (1L << DeclareFunction) | (1L << DeclareVariable) | (1L << DeclareForLoop) | (1L << DeclareWhileLoop) | (1L << DeclareStatic) | (1L << DeclareAbstract) | (1L << DeclarePublic) | (1L << DeclarePrivate) | (1L << ControlFlowIf) | (1L << FunctionReturn) | (1L << Break) | (1L << NullReference) | (1L << ThisReference) | (1L << UsingDirective) | (1L << MinusOperator) | (1L << MinusMinusOperator) | (1L << PlusOperator) | (1L << PlusPlusOperator) | (1L << LogicalNegationOperator) | (1L << ComplimentOperator) | (1L << OpeningRoundBracket))) != 0) || ((((_la - 70)) & ~0x3f) == 0 && ((1L << (_la - 70)) & ((1L << (BooleanLiteral - 70)) | (1L << (IntegerLiteral - 70)) | (1L << (FloatingLiteral - 70)) | (1L << (Identifier - 70)) | (1L << (DQUOTE - 70)) | (1L << (CURLY_L - 70)))) != 0)) { + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << DeclareClass) | (1L << DeclareStruct) | (1L << ExternModifier) | (1L << CallableModifier) | (1L << DeclareFunction) | (1L << DeclareVariable) | (1L << DeclareForLoop) | (1L << DeclareWhileLoop) | (1L << DeclareStatic) | (1L << DeclareAbstract) | (1L << DeclarePublic) | (1L << DeclarePrivate) | (1L << ControlFlowIf) | (1L << FunctionReturn) | (1L << Break) | (1L << NullReference) | (1L << ThisReference) | (1L << UsingDirective) | (1L << StartStatement) | (1L << UseStatement) | (1L << SyncKeyword) | (1L << MinusOperator) | (1L << MinusMinusOperator) | (1L << PlusOperator) | (1L << PlusPlusOperator) | (1L << LogicalNegationOperator) | (1L << ComplimentOperator))) != 0) || ((((_la - 67)) & ~0x3f) == 0 && ((1L << (_la - 67)) & ((1L << (OpeningRoundBracket - 67)) | (1L << (SquareBracketLeft - 67)) | (1L << (BooleanLiteral - 67)) | (1L << (IntegerLiteral - 67)) | (1L << (FloatingLiteral - 67)) | (1L << (Identifier - 67)) | (1L << (DQUOTE - 67)) | (1L << (CURLY_L - 67)))) != 0)) { { { - State = 128; + State = 144; declaration(); } } - State = 133; + State = 149; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 134; + State = 150; Match(Eof); } } @@ -325,7 +333,7 @@ public partial class ModuleDeclarationContext : ParserRuleContext { [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode Identifier(int i) { return GetToken(BITEParser.Identifier, i); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeperator() { return GetToken(BITEParser.SemicolonSeperator, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeparator() { return GetToken(BITEParser.SemicolonSeparator, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] DotOperator() { return GetTokens(BITEParser.DotOperator); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DotOperator(int i) { return GetToken(BITEParser.DotOperator, i); @@ -351,28 +359,28 @@ public ModuleDeclarationContext moduleDeclaration() { try { EnterOuterAlt(_localctx, 1); { - State = 136; + State = 152; Match(DeclareModule); - State = 137; + State = 153; Match(Identifier); - State = 142; + State = 158; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==DotOperator) { { { - State = 138; + State = 154; Match(DotOperator); - State = 139; + State = 155; Match(Identifier); } } - State = 144; + State = 160; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 145; - Match(SemicolonSeperator); + State = 161; + Match(SemicolonSeparator); } } catch (RecognitionException re) { @@ -392,7 +400,7 @@ public partial class ImportDirectiveContext : ParserRuleContext { [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode Identifier(int i) { return GetToken(BITEParser.Identifier, i); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeperator() { return GetToken(BITEParser.SemicolonSeperator, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeparator() { return GetToken(BITEParser.SemicolonSeparator, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] DotOperator() { return GetTokens(BITEParser.DotOperator); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DotOperator(int i) { return GetToken(BITEParser.DotOperator, i); @@ -418,28 +426,28 @@ public ImportDirectiveContext importDirective() { try { EnterOuterAlt(_localctx, 1); { - State = 147; + State = 163; Match(ImportDirective); - State = 148; + State = 164; Match(Identifier); - State = 153; + State = 169; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==DotOperator) { { { - State = 149; + State = 165; Match(DotOperator); - State = 150; + State = 166; Match(Identifier); } } - State = 155; + State = 171; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 156; - Match(SemicolonSeperator); + State = 172; + Match(SemicolonSeparator); } } catch (RecognitionException re) { @@ -459,7 +467,7 @@ public partial class UsingDirectiveContext : ParserRuleContext { [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode Identifier(int i) { return GetToken(BITEParser.Identifier, i); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeperator() { return GetToken(BITEParser.SemicolonSeperator, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeparator() { return GetToken(BITEParser.SemicolonSeparator, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] DotOperator() { return GetTokens(BITEParser.DotOperator); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DotOperator(int i) { return GetToken(BITEParser.DotOperator, i); @@ -485,28 +493,28 @@ public UsingDirectiveContext usingDirective() { try { EnterOuterAlt(_localctx, 1); { - State = 158; + State = 174; Match(UsingDirective); - State = 159; + State = 175; Match(Identifier); - State = 164; + State = 180; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==DotOperator) { { { - State = 160; + State = 176; Match(DotOperator); - State = 161; + State = 177; Match(Identifier); } } - State = 166; + State = 182; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 167; - Match(SemicolonSeperator); + State = 183; + Match(SemicolonSeparator); } } catch (RecognitionException re) { @@ -560,55 +568,55 @@ public DeclarationContext declaration() { DeclarationContext _localctx = new DeclarationContext(Context, State); EnterRule(_localctx, 10, RULE_declaration); try { - State = 176; + State = 192; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,7,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 169; + State = 185; classDeclaration(); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 170; + State = 186; structDeclaration(); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 171; + State = 187; externalFunctionDeclaration(); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 172; + State = 188; functionDeclaration(); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 173; + State = 189; classInstanceDeclaration(); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 174; + State = 190; variableDeclaration(); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 175; + State = 191; statement(); } break; @@ -631,7 +639,7 @@ public partial class ClassDeclarationContext : ParserRuleContext { [System.Diagnostics.DebuggerNonUserCode] public BlockContext block() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeperator() { return GetToken(BITEParser.SemicolonSeperator, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeparator() { return GetToken(BITEParser.SemicolonSeparator, 0); } [System.Diagnostics.DebuggerNonUserCode] public PrivateModifierContext privateModifier() { return GetRuleContext(0); } @@ -669,18 +677,18 @@ public ClassDeclarationContext classDeclaration() { try { EnterOuterAlt(_localctx, 1); { - State = 180; + State = 196; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case DeclarePrivate: { - State = 178; + State = 194; privateModifier(); } break; case DeclarePublic: { - State = 179; + State = 195; publicModifier(); } break; @@ -691,18 +699,18 @@ public ClassDeclarationContext classDeclaration() { default: break; } - State = 184; + State = 200; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case DeclareStatic: { - State = 182; + State = 198; staticModifier(); } break; case DeclareAbstract: { - State = 183; + State = 199; abstractModifier(); } break; @@ -711,35 +719,35 @@ public ClassDeclarationContext classDeclaration() { default: break; } - State = 186; + State = 202; Match(DeclareClass); - State = 187; + State = 203; Match(Identifier); - State = 190; + State = 206; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==ColonOperator) { { - State = 188; + State = 204; Match(ColonOperator); - State = 189; + State = 205; inheritance(); } } - State = 194; + State = 210; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case CURLY_L: { - State = 192; + State = 208; block(); } break; - case SemicolonSeperator: + case SemicolonSeparator: { - State = 193; - Match(SemicolonSeperator); + State = 209; + Match(SemicolonSeparator); } break; default: @@ -764,7 +772,7 @@ public partial class StructDeclarationContext : ParserRuleContext { [System.Diagnostics.DebuggerNonUserCode] public BlockContext block() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeperator() { return GetToken(BITEParser.SemicolonSeperator, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeparator() { return GetToken(BITEParser.SemicolonSeparator, 0); } [System.Diagnostics.DebuggerNonUserCode] public PrivateModifierContext privateModifier() { return GetRuleContext(0); } @@ -791,18 +799,18 @@ public StructDeclarationContext structDeclaration() { try { EnterOuterAlt(_localctx, 1); { - State = 198; + State = 214; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case DeclarePrivate: { - State = 196; + State = 212; privateModifier(); } break; case DeclarePublic: { - State = 197; + State = 213; publicModifier(); } break; @@ -811,23 +819,23 @@ public StructDeclarationContext structDeclaration() { default: break; } - State = 200; + State = 216; Match(DeclareStruct); - State = 201; + State = 217; Match(Identifier); - State = 204; + State = 220; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case CURLY_L: { - State = 202; + State = 218; block(); } break; - case SemicolonSeperator: + case SemicolonSeparator: { - State = 203; - Match(SemicolonSeperator); + State = 219; + Match(SemicolonSeparator); } break; default: @@ -854,7 +862,7 @@ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode Identifier(int i) } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode OpeningRoundBracket() { return GetToken(BITEParser.OpeningRoundBracket, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ClosingRoundBracket() { return GetToken(BITEParser.ClosingRoundBracket, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeperator() { return GetToken(BITEParser.SemicolonSeperator, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeparator() { return GetToken(BITEParser.SemicolonSeparator, 0); } [System.Diagnostics.DebuggerNonUserCode] public PrivateModifierContext privateModifier() { return GetRuleContext(0); } @@ -894,18 +902,18 @@ public ExternalFunctionDeclarationContext externalFunctionDeclaration() { try { EnterOuterAlt(_localctx, 1); { - State = 208; + State = 224; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case DeclarePrivate: { - State = 206; + State = 222; privateModifier(); } break; case DeclarePublic: { - State = 207; + State = 223; publicModifier(); } break; @@ -918,18 +926,18 @@ public ExternalFunctionDeclarationContext externalFunctionDeclaration() { default: break; } - State = 212; + State = 228; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case DeclareStatic: { - State = 210; + State = 226; staticModifier(); } break; case DeclareAbstract: { - State = 211; + State = 227; abstractModifier(); } break; @@ -940,58 +948,58 @@ public ExternalFunctionDeclarationContext externalFunctionDeclaration() { default: break; } - State = 215; + State = 231; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==ExternModifier) { { - State = 214; + State = 230; Match(ExternModifier); } } - State = 218; + State = 234; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==CallableModifier) { { - State = 217; + State = 233; Match(CallableModifier); } } - State = 220; + State = 236; Match(DeclareFunction); - State = 221; + State = 237; Match(Identifier); - State = 224; + State = 240; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==AsKeyword) { { - State = 222; + State = 238; Match(AsKeyword); - State = 223; + State = 239; Match(Identifier); } } - State = 226; + State = 242; Match(OpeningRoundBracket); - State = 228; + State = 244; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==Identifier) { { - State = 227; + State = 243; parameters(); } } - State = 230; + State = 246; Match(ClosingRoundBracket); - State = 231; - Match(SemicolonSeperator); + State = 247; + Match(SemicolonSeparator); } } catch (RecognitionException re) { @@ -1013,7 +1021,7 @@ public partial class FunctionDeclarationContext : ParserRuleContext { [System.Diagnostics.DebuggerNonUserCode] public BlockContext block() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeperator() { return GetToken(BITEParser.SemicolonSeperator, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeparator() { return GetToken(BITEParser.SemicolonSeparator, 0); } [System.Diagnostics.DebuggerNonUserCode] public PrivateModifierContext privateModifier() { return GetRuleContext(0); } @@ -1050,18 +1058,18 @@ public FunctionDeclarationContext functionDeclaration() { try { EnterOuterAlt(_localctx, 1); { - State = 235; + State = 251; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case DeclarePrivate: { - State = 233; + State = 249; privateModifier(); } break; case DeclarePublic: { - State = 234; + State = 250; publicModifier(); } break; @@ -1072,18 +1080,18 @@ public FunctionDeclarationContext functionDeclaration() { default: break; } - State = 239; + State = 255; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case DeclareStatic: { - State = 237; + State = 253; staticModifier(); } break; case DeclareAbstract: { - State = 238; + State = 254; abstractModifier(); } break; @@ -1092,37 +1100,37 @@ public FunctionDeclarationContext functionDeclaration() { default: break; } - State = 241; + State = 257; Match(DeclareFunction); - State = 242; + State = 258; Match(Identifier); - State = 243; + State = 259; Match(OpeningRoundBracket); - State = 245; + State = 261; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==Identifier) { { - State = 244; + State = 260; parameters(); } } - State = 247; + State = 263; Match(ClosingRoundBracket); - State = 250; + State = 266; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case CURLY_L: { - State = 248; + State = 264; block(); } break; - case SemicolonSeperator: + case SemicolonSeparator: { - State = 249; - Match(SemicolonSeperator); + State = 265; + Match(SemicolonSeparator); } break; default: @@ -1151,7 +1159,12 @@ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode Identifier(int i) [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DeclareClassInstance() { return GetToken(BITEParser.DeclareClassInstance, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode OpeningRoundBracket() { return GetToken(BITEParser.OpeningRoundBracket, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ClosingRoundBracket() { return GetToken(BITEParser.ClosingRoundBracket, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeperator() { return GetToken(BITEParser.SemicolonSeperator, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeparator() { return GetToken(BITEParser.SemicolonSeparator, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CURLY_L() { return GetToken(BITEParser.CURLY_L, 0); } + [System.Diagnostics.DebuggerNonUserCode] public InitializerExpressionContext initializerExpression() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CURLY_R() { return GetToken(BITEParser.CURLY_R, 0); } [System.Diagnostics.DebuggerNonUserCode] public PrivateModifierContext privateModifier() { return GetRuleContext(0); } @@ -1187,7 +1200,7 @@ public ClassInstanceDeclarationContext classInstanceDeclaration() { EnterRule(_localctx, 20, RULE_classInstanceDeclaration); int _la; try { - State = 294; + State = 316; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case DeclareVariable: @@ -1196,18 +1209,18 @@ public ClassInstanceDeclarationContext classInstanceDeclaration() { case DeclarePrivate: EnterOuterAlt(_localctx, 1); { - State = 254; + State = 270; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case DeclarePrivate: { - State = 252; + State = 268; privateModifier(); } break; case DeclarePublic: { - State = 253; + State = 269; publicModifier(); } break; @@ -1217,103 +1230,123 @@ public ClassInstanceDeclarationContext classInstanceDeclaration() { default: break; } - State = 257; + State = 273; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==DeclareStatic) { { - State = 256; + State = 272; staticModifier(); } } - State = 259; + State = 275; Match(DeclareVariable); - State = 260; + State = 276; Match(Identifier); - State = 261; + State = 277; Match(AssignOperator); - State = 262; + State = 278; Match(DeclareClassInstance); - State = 263; + State = 279; Match(Identifier); - State = 268; + State = 284; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==DotOperator) { { { - State = 264; + State = 280; Match(DotOperator); - State = 265; + State = 281; Match(Identifier); } } - State = 270; + State = 286; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 271; + State = 287; Match(OpeningRoundBracket); - State = 273; + State = 289; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - if (((((_la - 22)) & ~0x3f) == 0 && ((1L << (_la - 22)) & ((1L << (NullReference - 22)) | (1L << (ThisReference - 22)) | (1L << (MinusOperator - 22)) | (1L << (MinusMinusOperator - 22)) | (1L << (PlusOperator - 22)) | (1L << (PlusPlusOperator - 22)) | (1L << (LogicalNegationOperator - 22)) | (1L << (ReferenceOperator - 22)) | (1L << (ComplimentOperator - 22)) | (1L << (OpeningRoundBracket - 22)) | (1L << (BooleanLiteral - 22)) | (1L << (IntegerLiteral - 22)) | (1L << (FloatingLiteral - 22)) | (1L << (Identifier - 22)) | (1L << (DQUOTE - 22)))) != 0)) { + if (((((_la - 22)) & ~0x3f) == 0 && ((1L << (_la - 22)) & ((1L << (NullReference - 22)) | (1L << (ThisReference - 22)) | (1L << (MinusOperator - 22)) | (1L << (MinusMinusOperator - 22)) | (1L << (PlusOperator - 22)) | (1L << (PlusPlusOperator - 22)) | (1L << (LogicalNegationOperator - 22)) | (1L << (ReferenceOperator - 22)) | (1L << (ComplimentOperator - 22)) | (1L << (OpeningRoundBracket - 22)) | (1L << (SquareBracketLeft - 22)) | (1L << (BooleanLiteral - 22)) | (1L << (IntegerLiteral - 22)) | (1L << (FloatingLiteral - 22)) | (1L << (Identifier - 22)) | (1L << (DQUOTE - 22)) | (1L << (CURLY_L - 22)))) != 0)) { { - State = 272; + State = 288; arguments(); } } - State = 275; + State = 291; Match(ClosingRoundBracket); - State = 276; - Match(SemicolonSeperator); + State = 297; + ErrorHandler.Sync(this); + switch (TokenStream.LA(1)) { + case SemicolonSeparator: + { + State = 292; + Match(SemicolonSeparator); + } + break; + case CURLY_L: + { + State = 293; + Match(CURLY_L); + State = 294; + initializerExpression(); + State = 295; + Match(CURLY_R); + } + break; + default: + throw new NoViableAltException(this); + } } break; case Identifier: EnterOuterAlt(_localctx, 2); { - State = 277; + State = 299; Match(Identifier); - State = 278; + State = 300; Match(AssignOperator); - State = 279; + State = 301; Match(DeclareClassInstance); - State = 280; + State = 302; Match(Identifier); - State = 285; + State = 307; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==DotOperator) { { { - State = 281; + State = 303; Match(DotOperator); - State = 282; + State = 304; Match(Identifier); } } - State = 287; + State = 309; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 288; + State = 310; Match(OpeningRoundBracket); - State = 290; + State = 312; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - if (((((_la - 22)) & ~0x3f) == 0 && ((1L << (_la - 22)) & ((1L << (NullReference - 22)) | (1L << (ThisReference - 22)) | (1L << (MinusOperator - 22)) | (1L << (MinusMinusOperator - 22)) | (1L << (PlusOperator - 22)) | (1L << (PlusPlusOperator - 22)) | (1L << (LogicalNegationOperator - 22)) | (1L << (ReferenceOperator - 22)) | (1L << (ComplimentOperator - 22)) | (1L << (OpeningRoundBracket - 22)) | (1L << (BooleanLiteral - 22)) | (1L << (IntegerLiteral - 22)) | (1L << (FloatingLiteral - 22)) | (1L << (Identifier - 22)) | (1L << (DQUOTE - 22)))) != 0)) { + if (((((_la - 22)) & ~0x3f) == 0 && ((1L << (_la - 22)) & ((1L << (NullReference - 22)) | (1L << (ThisReference - 22)) | (1L << (MinusOperator - 22)) | (1L << (MinusMinusOperator - 22)) | (1L << (PlusOperator - 22)) | (1L << (PlusPlusOperator - 22)) | (1L << (LogicalNegationOperator - 22)) | (1L << (ReferenceOperator - 22)) | (1L << (ComplimentOperator - 22)) | (1L << (OpeningRoundBracket - 22)) | (1L << (SquareBracketLeft - 22)) | (1L << (BooleanLiteral - 22)) | (1L << (IntegerLiteral - 22)) | (1L << (FloatingLiteral - 22)) | (1L << (Identifier - 22)) | (1L << (DQUOTE - 22)) | (1L << (CURLY_L - 22)))) != 0)) { { - State = 289; + State = 311; arguments(); } } - State = 292; + State = 314; Match(ClosingRoundBracket); - State = 293; - Match(SemicolonSeperator); + State = 315; + Match(SemicolonSeparator); } break; default: @@ -1334,7 +1367,7 @@ public ClassInstanceDeclarationContext classInstanceDeclaration() { public partial class VariableDeclarationContext : ParserRuleContext { [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DeclareVariable() { return GetToken(BITEParser.DeclareVariable, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode Identifier() { return GetToken(BITEParser.Identifier, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeperator() { return GetToken(BITEParser.SemicolonSeperator, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeparator() { return GetToken(BITEParser.SemicolonSeparator, 0); } [System.Diagnostics.DebuggerNonUserCode] public PrivateModifierContext privateModifier() { return GetRuleContext(0); } @@ -1369,18 +1402,18 @@ public VariableDeclarationContext variableDeclaration() { try { EnterOuterAlt(_localctx, 1); { - State = 298; + State = 320; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case DeclarePrivate: { - State = 296; + State = 318; privateModifier(); } break; case DeclarePublic: { - State = 297; + State = 319; publicModifier(); } break; @@ -1390,21 +1423,21 @@ public VariableDeclarationContext variableDeclaration() { default: break; } - State = 301; + State = 323; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==DeclareStatic) { { - State = 300; + State = 322; staticModifier(); } } - State = 303; + State = 325; Match(DeclareVariable); - State = 304; + State = 326; Match(Identifier); - State = 310; + State = 332; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case Eof: @@ -1426,6 +1459,9 @@ public VariableDeclarationContext variableDeclaration() { case NullReference: case ThisReference: case UsingDirective: + case StartStatement: + case UseStatement: + case SyncKeyword: case AssignOperator: case MinusOperator: case MinusMinusOperator: @@ -1434,6 +1470,7 @@ public VariableDeclarationContext variableDeclaration() { case LogicalNegationOperator: case ComplimentOperator: case OpeningRoundBracket: + case SquareBracketLeft: case BooleanLiteral: case IntegerLiteral: case FloatingLiteral: @@ -1442,24 +1479,24 @@ public VariableDeclarationContext variableDeclaration() { case CURLY_L: case CURLY_R: { - State = 307; + State = 329; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==AssignOperator) { { - State = 305; + State = 327; Match(AssignOperator); - State = 306; + State = 328; exprStatement(); } } } break; - case SemicolonSeperator: + case SemicolonSeparator: { - State = 309; - Match(SemicolonSeperator); + State = 331; + Match(SemicolonSeparator); } break; default: @@ -1506,19 +1543,19 @@ public StatementsContext statements() { try { EnterOuterAlt(_localctx, 1); { - State = 312; + State = 334; declaration(); - State = 316; + State = 338; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << DeclareClass) | (1L << DeclareStruct) | (1L << ExternModifier) | (1L << CallableModifier) | (1L << DeclareFunction) | (1L << DeclareVariable) | (1L << DeclareForLoop) | (1L << DeclareWhileLoop) | (1L << DeclareStatic) | (1L << DeclareAbstract) | (1L << DeclarePublic) | (1L << DeclarePrivate) | (1L << ControlFlowIf) | (1L << FunctionReturn) | (1L << Break) | (1L << NullReference) | (1L << ThisReference) | (1L << UsingDirective) | (1L << MinusOperator) | (1L << MinusMinusOperator) | (1L << PlusOperator) | (1L << PlusPlusOperator) | (1L << LogicalNegationOperator) | (1L << ComplimentOperator) | (1L << OpeningRoundBracket))) != 0) || ((((_la - 70)) & ~0x3f) == 0 && ((1L << (_la - 70)) & ((1L << (BooleanLiteral - 70)) | (1L << (IntegerLiteral - 70)) | (1L << (FloatingLiteral - 70)) | (1L << (Identifier - 70)) | (1L << (DQUOTE - 70)) | (1L << (CURLY_L - 70)))) != 0)) { + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << DeclareClass) | (1L << DeclareStruct) | (1L << ExternModifier) | (1L << CallableModifier) | (1L << DeclareFunction) | (1L << DeclareVariable) | (1L << DeclareForLoop) | (1L << DeclareWhileLoop) | (1L << DeclareStatic) | (1L << DeclareAbstract) | (1L << DeclarePublic) | (1L << DeclarePrivate) | (1L << ControlFlowIf) | (1L << FunctionReturn) | (1L << Break) | (1L << NullReference) | (1L << ThisReference) | (1L << UsingDirective) | (1L << StartStatement) | (1L << UseStatement) | (1L << SyncKeyword) | (1L << MinusOperator) | (1L << MinusMinusOperator) | (1L << PlusOperator) | (1L << PlusPlusOperator) | (1L << LogicalNegationOperator) | (1L << ComplimentOperator))) != 0) || ((((_la - 67)) & ~0x3f) == 0 && ((1L << (_la - 67)) & ((1L << (OpeningRoundBracket - 67)) | (1L << (SquareBracketLeft - 67)) | (1L << (BooleanLiteral - 67)) | (1L << (IntegerLiteral - 67)) | (1L << (FloatingLiteral - 67)) | (1L << (Identifier - 67)) | (1L << (DQUOTE - 67)) | (1L << (CURLY_L - 67)))) != 0)) { { { - State = 313; + State = 335; declaration(); } } - State = 318; + State = 340; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -1554,9 +1591,18 @@ [System.Diagnostics.DebuggerNonUserCode] public BreakStatementContext breakState [System.Diagnostics.DebuggerNonUserCode] public UsingStatementContext usingStatement() { return GetRuleContext(0); } + [System.Diagnostics.DebuggerNonUserCode] public StartThreadStatementContext startThreadStatement() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public UseThreadStatementContext useThreadStatement() { + return GetRuleContext(0); + } [System.Diagnostics.DebuggerNonUserCode] public WhileStatementContext whileStatement() { return GetRuleContext(0); } + [System.Diagnostics.DebuggerNonUserCode] public SyncBlockContext syncBlock() { + return GetRuleContext(0); + } [System.Diagnostics.DebuggerNonUserCode] public BlockContext block() { return GetRuleContext(0); } @@ -1578,80 +1624,86 @@ public StatementContext statement() { StatementContext _localctx = new StatementContext(Context, State); EnterRule(_localctx, 26, RULE_statement); try { - State = 327; + State = 352; ErrorHandler.Sync(this); - switch (TokenStream.LA(1)) { - case NullReference: - case ThisReference: - case MinusOperator: - case MinusMinusOperator: - case PlusOperator: - case PlusPlusOperator: - case LogicalNegationOperator: - case ComplimentOperator: - case OpeningRoundBracket: - case BooleanLiteral: - case IntegerLiteral: - case FloatingLiteral: - case Identifier: - case DQUOTE: + switch ( Interpreter.AdaptivePredict(TokenStream,37,Context) ) { + case 1: EnterOuterAlt(_localctx, 1); { - State = 319; + State = 341; exprStatement(); } break; - case DeclareForLoop: + case 2: EnterOuterAlt(_localctx, 2); { - State = 320; + State = 342; forStatement(); } break; - case ControlFlowIf: + case 3: EnterOuterAlt(_localctx, 3); { - State = 321; + State = 343; ifStatement(); } break; - case FunctionReturn: + case 4: EnterOuterAlt(_localctx, 4); { - State = 322; + State = 344; returnStatement(); } break; - case Break: + case 5: EnterOuterAlt(_localctx, 5); { - State = 323; + State = 345; breakStatement(); } break; - case UsingDirective: + case 6: EnterOuterAlt(_localctx, 6); { - State = 324; + State = 346; usingStatement(); } break; - case DeclareWhileLoop: + case 7: EnterOuterAlt(_localctx, 7); { - State = 325; - whileStatement(); + State = 347; + startThreadStatement(); } break; - case CURLY_L: + case 8: EnterOuterAlt(_localctx, 8); { - State = 326; + State = 348; + useThreadStatement(); + } + break; + case 9: + EnterOuterAlt(_localctx, 9); + { + State = 349; + whileStatement(); + } + break; + case 10: + EnterOuterAlt(_localctx, 10); + { + State = 350; + syncBlock(); + } + break; + case 11: + EnterOuterAlt(_localctx, 11); + { + State = 351; block(); } break; - default: - throw new NoViableAltException(this); } } catch (RecognitionException re) { @@ -1669,7 +1721,7 @@ public partial class ExprStatementContext : ParserRuleContext { [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext expression() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeperator() { return GetToken(BITEParser.SemicolonSeperator, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeparator() { return GetToken(BITEParser.SemicolonSeparator, 0); } public ExprStatementContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { @@ -1690,10 +1742,10 @@ public ExprStatementContext exprStatement() { try { EnterOuterAlt(_localctx, 1); { - State = 329; + State = 354; expression(); - State = 330; - Match(SemicolonSeperator); + State = 355; + Match(SemicolonSeparator); } } catch (RecognitionException re) { @@ -1734,17 +1786,17 @@ public LocalVarDeclarationContext localVarDeclaration() { try { EnterOuterAlt(_localctx, 1); { - State = 332; + State = 357; Match(Identifier); { - State = 335; + State = 360; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==AssignOperator) { { - State = 333; + State = 358; Match(AssignOperator); - State = 334; + State = 359; expression(); } } @@ -1771,9 +1823,9 @@ [System.Diagnostics.DebuggerNonUserCode] public LocalVarDeclarationContext[] loc [System.Diagnostics.DebuggerNonUserCode] public LocalVarDeclarationContext localVarDeclaration(int i) { return GetRuleContext(i); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] CommaSeperator() { return GetTokens(BITEParser.CommaSeperator); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CommaSeperator(int i) { - return GetToken(BITEParser.CommaSeperator, i); + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] CommaSeparator() { return GetTokens(BITEParser.CommaSeparator); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CommaSeparator(int i) { + return GetToken(BITEParser.CommaSeparator, i); } public LocalVarInitializerContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) @@ -1796,23 +1848,23 @@ public LocalVarInitializerContext localVarInitializer() { try { EnterOuterAlt(_localctx, 1); { - State = 337; + State = 362; Match(DeclareVariable); - State = 338; + State = 363; localVarDeclaration(); - State = 343; + State = 368; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - while (_la==CommaSeperator) { + while (_la==CommaSeparator) { { { - State = 339; - Match(CommaSeperator); - State = 340; + State = 364; + Match(CommaSeparator); + State = 365; localVarDeclaration(); } } - State = 345; + State = 370; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -1839,9 +1891,9 @@ [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext[] expression() [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext expression(int i) { return GetRuleContext(i); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] CommaSeperator() { return GetTokens(BITEParser.CommaSeperator); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CommaSeperator(int i) { - return GetToken(BITEParser.CommaSeperator, i); + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] CommaSeparator() { return GetTokens(BITEParser.CommaSeparator); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CommaSeparator(int i) { + return GetToken(BITEParser.CommaSeparator, i); } public ForInitializerContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) @@ -1862,13 +1914,13 @@ public ForInitializerContext forInitializer() { EnterRule(_localctx, 34, RULE_forInitializer); int _la; try { - State = 355; + State = 380; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case DeclareVariable: EnterOuterAlt(_localctx, 1); { - State = 346; + State = 371; localVarInitializer(); } break; @@ -1881,28 +1933,30 @@ public ForInitializerContext forInitializer() { case LogicalNegationOperator: case ComplimentOperator: case OpeningRoundBracket: + case SquareBracketLeft: case BooleanLiteral: case IntegerLiteral: case FloatingLiteral: case Identifier: case DQUOTE: + case CURLY_L: EnterOuterAlt(_localctx, 2); { - State = 347; + State = 372; expression(); - State = 352; + State = 377; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - while (_la==CommaSeperator) { + while (_la==CommaSeparator) { { { - State = 348; - Match(CommaSeperator); - State = 349; + State = 373; + Match(CommaSeparator); + State = 374; expression(); } } - State = 354; + State = 379; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -1930,9 +1984,9 @@ [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext[] expression() [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext expression(int i) { return GetRuleContext(i); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] CommaSeperator() { return GetTokens(BITEParser.CommaSeperator); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CommaSeperator(int i) { - return GetToken(BITEParser.CommaSeperator, i); + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] CommaSeparator() { return GetTokens(BITEParser.CommaSeparator); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CommaSeparator(int i) { + return GetToken(BITEParser.CommaSeparator, i); } public ForIteratorContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) @@ -1955,21 +2009,21 @@ public ForIteratorContext forIterator() { try { EnterOuterAlt(_localctx, 1); { - State = 357; + State = 382; expression(); - State = 362; + State = 387; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - while (_la==CommaSeperator) { + while (_la==CommaSeparator) { { { - State = 358; - Match(CommaSeperator); - State = 359; + State = 383; + Match(CommaSeparator); + State = 384; expression(); } } - State = 364; + State = 389; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -1990,9 +2044,9 @@ public partial class ForStatementContext : ParserRuleContext { public ExpressionContext condition; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DeclareForLoop() { return GetToken(BITEParser.DeclareForLoop, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode OpeningRoundBracket() { return GetToken(BITEParser.OpeningRoundBracket, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] SemicolonSeperator() { return GetTokens(BITEParser.SemicolonSeperator); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeperator(int i) { - return GetToken(BITEParser.SemicolonSeperator, i); + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] SemicolonSeparator() { return GetTokens(BITEParser.SemicolonSeparator); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeparator(int i) { + return GetToken(BITEParser.SemicolonSeparator, i); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ClosingRoundBracket() { return GetToken(BITEParser.ClosingRoundBracket, 0); } [System.Diagnostics.DebuggerNonUserCode] public ForInitializerContext forInitializer() { @@ -2028,52 +2082,52 @@ public ForStatementContext forStatement() { try { EnterOuterAlt(_localctx, 1); { - State = 365; + State = 390; Match(DeclareForLoop); - State = 366; + State = 391; Match(OpeningRoundBracket); - State = 368; + State = 393; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << DeclareVariable) | (1L << NullReference) | (1L << ThisReference) | (1L << MinusOperator) | (1L << MinusMinusOperator) | (1L << PlusOperator) | (1L << PlusPlusOperator) | (1L << LogicalNegationOperator) | (1L << ComplimentOperator) | (1L << OpeningRoundBracket))) != 0) || ((((_la - 70)) & ~0x3f) == 0 && ((1L << (_la - 70)) & ((1L << (BooleanLiteral - 70)) | (1L << (IntegerLiteral - 70)) | (1L << (FloatingLiteral - 70)) | (1L << (Identifier - 70)) | (1L << (DQUOTE - 70)))) != 0)) { + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << DeclareVariable) | (1L << NullReference) | (1L << ThisReference) | (1L << MinusOperator) | (1L << MinusMinusOperator) | (1L << PlusOperator) | (1L << PlusPlusOperator) | (1L << LogicalNegationOperator) | (1L << ComplimentOperator))) != 0) || ((((_la - 67)) & ~0x3f) == 0 && ((1L << (_la - 67)) & ((1L << (OpeningRoundBracket - 67)) | (1L << (SquareBracketLeft - 67)) | (1L << (BooleanLiteral - 67)) | (1L << (IntegerLiteral - 67)) | (1L << (FloatingLiteral - 67)) | (1L << (Identifier - 67)) | (1L << (DQUOTE - 67)) | (1L << (CURLY_L - 67)))) != 0)) { { - State = 367; + State = 392; forInitializer(); } } - State = 370; - Match(SemicolonSeperator); - State = 372; + State = 395; + Match(SemicolonSeparator); + State = 397; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - if (((((_la - 22)) & ~0x3f) == 0 && ((1L << (_la - 22)) & ((1L << (NullReference - 22)) | (1L << (ThisReference - 22)) | (1L << (MinusOperator - 22)) | (1L << (MinusMinusOperator - 22)) | (1L << (PlusOperator - 22)) | (1L << (PlusPlusOperator - 22)) | (1L << (LogicalNegationOperator - 22)) | (1L << (ComplimentOperator - 22)) | (1L << (OpeningRoundBracket - 22)) | (1L << (BooleanLiteral - 22)) | (1L << (IntegerLiteral - 22)) | (1L << (FloatingLiteral - 22)) | (1L << (Identifier - 22)) | (1L << (DQUOTE - 22)))) != 0)) { + if (((((_la - 22)) & ~0x3f) == 0 && ((1L << (_la - 22)) & ((1L << (NullReference - 22)) | (1L << (ThisReference - 22)) | (1L << (MinusOperator - 22)) | (1L << (MinusMinusOperator - 22)) | (1L << (PlusOperator - 22)) | (1L << (PlusPlusOperator - 22)) | (1L << (LogicalNegationOperator - 22)) | (1L << (ComplimentOperator - 22)) | (1L << (OpeningRoundBracket - 22)) | (1L << (SquareBracketLeft - 22)) | (1L << (BooleanLiteral - 22)) | (1L << (IntegerLiteral - 22)) | (1L << (FloatingLiteral - 22)) | (1L << (Identifier - 22)) | (1L << (DQUOTE - 22)) | (1L << (CURLY_L - 22)))) != 0)) { { - State = 371; + State = 396; _localctx.condition = expression(); } } - State = 374; - Match(SemicolonSeperator); - State = 376; + State = 399; + Match(SemicolonSeparator); + State = 401; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - if (((((_la - 22)) & ~0x3f) == 0 && ((1L << (_la - 22)) & ((1L << (NullReference - 22)) | (1L << (ThisReference - 22)) | (1L << (MinusOperator - 22)) | (1L << (MinusMinusOperator - 22)) | (1L << (PlusOperator - 22)) | (1L << (PlusPlusOperator - 22)) | (1L << (LogicalNegationOperator - 22)) | (1L << (ComplimentOperator - 22)) | (1L << (OpeningRoundBracket - 22)) | (1L << (BooleanLiteral - 22)) | (1L << (IntegerLiteral - 22)) | (1L << (FloatingLiteral - 22)) | (1L << (Identifier - 22)) | (1L << (DQUOTE - 22)))) != 0)) { + if (((((_la - 22)) & ~0x3f) == 0 && ((1L << (_la - 22)) & ((1L << (NullReference - 22)) | (1L << (ThisReference - 22)) | (1L << (MinusOperator - 22)) | (1L << (MinusMinusOperator - 22)) | (1L << (PlusOperator - 22)) | (1L << (PlusPlusOperator - 22)) | (1L << (LogicalNegationOperator - 22)) | (1L << (ComplimentOperator - 22)) | (1L << (OpeningRoundBracket - 22)) | (1L << (SquareBracketLeft - 22)) | (1L << (BooleanLiteral - 22)) | (1L << (IntegerLiteral - 22)) | (1L << (FloatingLiteral - 22)) | (1L << (Identifier - 22)) | (1L << (DQUOTE - 22)) | (1L << (CURLY_L - 22)))) != 0)) { { - State = 375; + State = 400; forIterator(); } } - State = 378; + State = 403; Match(ClosingRoundBracket); - State = 380; + State = 405; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,45,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,46,Context) ) { case 1: { - State = 379; + State = 404; statement(); } break; @@ -2127,24 +2181,24 @@ public IfStatementContext ifStatement() { try { EnterOuterAlt(_localctx, 1); { - State = 382; + State = 407; Match(ControlFlowIf); - State = 383; + State = 408; Match(OpeningRoundBracket); - State = 384; + State = 409; expression(); - State = 385; + State = 410; Match(ClosingRoundBracket); - State = 386; + State = 411; _localctx.trueStatement = statement(); - State = 389; + State = 414; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,46,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,47,Context) ) { case 1: { - State = 387; + State = 412; Match(ControlFlowElse); - State = 388; + State = 413; _localctx.falseStatement = statement(); } break; @@ -2164,7 +2218,7 @@ public IfStatementContext ifStatement() { public partial class ReturnStatementContext : ParserRuleContext { [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FunctionReturn() { return GetToken(BITEParser.FunctionReturn, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeperator() { return GetToken(BITEParser.SemicolonSeperator, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeparator() { return GetToken(BITEParser.SemicolonSeparator, 0); } [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext expression() { return GetRuleContext(0); } @@ -2189,20 +2243,20 @@ public ReturnStatementContext returnStatement() { try { EnterOuterAlt(_localctx, 1); { - State = 391; + State = 416; Match(FunctionReturn); - State = 393; + State = 418; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - if (((((_la - 22)) & ~0x3f) == 0 && ((1L << (_la - 22)) & ((1L << (NullReference - 22)) | (1L << (ThisReference - 22)) | (1L << (MinusOperator - 22)) | (1L << (MinusMinusOperator - 22)) | (1L << (PlusOperator - 22)) | (1L << (PlusPlusOperator - 22)) | (1L << (LogicalNegationOperator - 22)) | (1L << (ComplimentOperator - 22)) | (1L << (OpeningRoundBracket - 22)) | (1L << (BooleanLiteral - 22)) | (1L << (IntegerLiteral - 22)) | (1L << (FloatingLiteral - 22)) | (1L << (Identifier - 22)) | (1L << (DQUOTE - 22)))) != 0)) { + if (((((_la - 22)) & ~0x3f) == 0 && ((1L << (_la - 22)) & ((1L << (NullReference - 22)) | (1L << (ThisReference - 22)) | (1L << (MinusOperator - 22)) | (1L << (MinusMinusOperator - 22)) | (1L << (PlusOperator - 22)) | (1L << (PlusPlusOperator - 22)) | (1L << (LogicalNegationOperator - 22)) | (1L << (ComplimentOperator - 22)) | (1L << (OpeningRoundBracket - 22)) | (1L << (SquareBracketLeft - 22)) | (1L << (BooleanLiteral - 22)) | (1L << (IntegerLiteral - 22)) | (1L << (FloatingLiteral - 22)) | (1L << (Identifier - 22)) | (1L << (DQUOTE - 22)) | (1L << (CURLY_L - 22)))) != 0)) { { - State = 392; + State = 417; expression(); } } - State = 395; - Match(SemicolonSeperator); + State = 420; + Match(SemicolonSeparator); } } catch (RecognitionException re) { @@ -2218,7 +2272,7 @@ public ReturnStatementContext returnStatement() { public partial class BreakStatementContext : ParserRuleContext { [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode Break() { return GetToken(BITEParser.Break, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeperator() { return GetToken(BITEParser.SemicolonSeperator, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SemicolonSeparator() { return GetToken(BITEParser.SemicolonSeparator, 0); } public BreakStatementContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { @@ -2239,10 +2293,10 @@ public BreakStatementContext breakStatement() { try { EnterOuterAlt(_localctx, 1); { - State = 397; + State = 422; Match(Break); - State = 398; - Match(SemicolonSeperator); + State = 423; + Match(SemicolonSeparator); } } catch (RecognitionException re) { @@ -2286,15 +2340,15 @@ public UsingStatementContext usingStatement() { try { EnterOuterAlt(_localctx, 1); { - State = 400; + State = 425; Match(UsingDirective); - State = 401; + State = 426; Match(OpeningRoundBracket); - State = 402; + State = 427; expression(); - State = 403; + State = 428; Match(ClosingRoundBracket); - State = 404; + State = 429; block(); } } @@ -2309,46 +2363,44 @@ public UsingStatementContext usingStatement() { return _localctx; } - public partial class WhileStatementContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DeclareWhileLoop() { return GetToken(BITEParser.DeclareWhileLoop, 0); } + public partial class StartThreadStatementContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode StartStatement() { return GetToken(BITEParser.StartStatement, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ThreadStatement() { return GetToken(BITEParser.ThreadStatement, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode OpeningRoundBracket() { return GetToken(BITEParser.OpeningRoundBracket, 0); } [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext expression() { return GetRuleContext(0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ClosingRoundBracket() { return GetToken(BITEParser.ClosingRoundBracket, 0); } - [System.Diagnostics.DebuggerNonUserCode] public BlockContext block() { - return GetRuleContext(0); - } - public WhileStatementContext(ParserRuleContext parent, int invokingState) + public StartThreadStatementContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_whileStatement; } } + public override int RuleIndex { get { return RULE_startThreadStatement; } } [System.Diagnostics.DebuggerNonUserCode] public override TResult Accept(IParseTreeVisitor visitor) { IBITEParserVisitor typedVisitor = visitor as IBITEParserVisitor; - if (typedVisitor != null) return typedVisitor.VisitWhileStatement(this); + if (typedVisitor != null) return typedVisitor.VisitStartThreadStatement(this); else return visitor.VisitChildren(this); } } [RuleVersion(0)] - public WhileStatementContext whileStatement() { - WhileStatementContext _localctx = new WhileStatementContext(Context, State); - EnterRule(_localctx, 48, RULE_whileStatement); + public StartThreadStatementContext startThreadStatement() { + StartThreadStatementContext _localctx = new StartThreadStatementContext(Context, State); + EnterRule(_localctx, 48, RULE_startThreadStatement); try { EnterOuterAlt(_localctx, 1); { - State = 406; - Match(DeclareWhileLoop); - State = 407; + State = 431; + Match(StartStatement); + State = 432; + Match(ThreadStatement); + State = 433; Match(OpeningRoundBracket); - State = 408; + State = 434; expression(); - State = 409; + State = 435; Match(ClosingRoundBracket); - State = 410; - block(); } } catch (RecognitionException re) { @@ -2362,54 +2414,200 @@ public WhileStatementContext whileStatement() { return _localctx; } - public partial class BlockContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CURLY_L() { return GetToken(BITEParser.CURLY_L, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CURLY_R() { return GetToken(BITEParser.CURLY_R, 0); } - [System.Diagnostics.DebuggerNonUserCode] public DeclarationContext[] declaration() { - return GetRuleContexts(); - } - [System.Diagnostics.DebuggerNonUserCode] public DeclarationContext declaration(int i) { - return GetRuleContext(i); + public partial class UseThreadStatementContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UseStatement() { return GetToken(BITEParser.UseStatement, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ThreadStatement() { return GetToken(BITEParser.ThreadStatement, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode OpeningRoundBracket() { return GetToken(BITEParser.OpeningRoundBracket, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext expression() { + return GetRuleContext(0); } - public BlockContext(ParserRuleContext parent, int invokingState) + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ClosingRoundBracket() { return GetToken(BITEParser.ClosingRoundBracket, 0); } + public UseThreadStatementContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_block; } } + public override int RuleIndex { get { return RULE_useThreadStatement; } } [System.Diagnostics.DebuggerNonUserCode] public override TResult Accept(IParseTreeVisitor visitor) { IBITEParserVisitor typedVisitor = visitor as IBITEParserVisitor; - if (typedVisitor != null) return typedVisitor.VisitBlock(this); + if (typedVisitor != null) return typedVisitor.VisitUseThreadStatement(this); else return visitor.VisitChildren(this); } } [RuleVersion(0)] - public BlockContext block() { - BlockContext _localctx = new BlockContext(Context, State); - EnterRule(_localctx, 50, RULE_block); - int _la; + public UseThreadStatementContext useThreadStatement() { + UseThreadStatementContext _localctx = new UseThreadStatementContext(Context, State); + EnterRule(_localctx, 50, RULE_useThreadStatement); try { EnterOuterAlt(_localctx, 1); { - State = 412; - Match(CURLY_L); - State = 416; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << DeclareClass) | (1L << DeclareStruct) | (1L << ExternModifier) | (1L << CallableModifier) | (1L << DeclareFunction) | (1L << DeclareVariable) | (1L << DeclareForLoop) | (1L << DeclareWhileLoop) | (1L << DeclareStatic) | (1L << DeclareAbstract) | (1L << DeclarePublic) | (1L << DeclarePrivate) | (1L << ControlFlowIf) | (1L << FunctionReturn) | (1L << Break) | (1L << NullReference) | (1L << ThisReference) | (1L << UsingDirective) | (1L << MinusOperator) | (1L << MinusMinusOperator) | (1L << PlusOperator) | (1L << PlusPlusOperator) | (1L << LogicalNegationOperator) | (1L << ComplimentOperator) | (1L << OpeningRoundBracket))) != 0) || ((((_la - 70)) & ~0x3f) == 0 && ((1L << (_la - 70)) & ((1L << (BooleanLiteral - 70)) | (1L << (IntegerLiteral - 70)) | (1L << (FloatingLiteral - 70)) | (1L << (Identifier - 70)) | (1L << (DQUOTE - 70)) | (1L << (CURLY_L - 70)))) != 0)) { - { - { - State = 413; - declaration(); - } - } - State = 418; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - } - State = 419; - Match(CURLY_R); + State = 437; + Match(UseStatement); + State = 438; + Match(ThreadStatement); + State = 439; + Match(OpeningRoundBracket); + State = 440; + expression(); + State = 441; + Match(ClosingRoundBracket); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class WhileStatementContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DeclareWhileLoop() { return GetToken(BITEParser.DeclareWhileLoop, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode OpeningRoundBracket() { return GetToken(BITEParser.OpeningRoundBracket, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext expression() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ClosingRoundBracket() { return GetToken(BITEParser.ClosingRoundBracket, 0); } + [System.Diagnostics.DebuggerNonUserCode] public BlockContext block() { + return GetRuleContext(0); + } + public WhileStatementContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_whileStatement; } } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IBITEParserVisitor typedVisitor = visitor as IBITEParserVisitor; + if (typedVisitor != null) return typedVisitor.VisitWhileStatement(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public WhileStatementContext whileStatement() { + WhileStatementContext _localctx = new WhileStatementContext(Context, State); + EnterRule(_localctx, 52, RULE_whileStatement); + try { + EnterOuterAlt(_localctx, 1); + { + State = 443; + Match(DeclareWhileLoop); + State = 444; + Match(OpeningRoundBracket); + State = 445; + expression(); + State = 446; + Match(ClosingRoundBracket); + State = 447; + block(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class SyncBlockContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SyncKeyword() { return GetToken(BITEParser.SyncKeyword, 0); } + [System.Diagnostics.DebuggerNonUserCode] public BlockContext block() { + return GetRuleContext(0); + } + public SyncBlockContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_syncBlock; } } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IBITEParserVisitor typedVisitor = visitor as IBITEParserVisitor; + if (typedVisitor != null) return typedVisitor.VisitSyncBlock(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public SyncBlockContext syncBlock() { + SyncBlockContext _localctx = new SyncBlockContext(Context, State); + EnterRule(_localctx, 54, RULE_syncBlock); + try { + EnterOuterAlt(_localctx, 1); + { + State = 449; + Match(SyncKeyword); + State = 450; + block(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class BlockContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CURLY_L() { return GetToken(BITEParser.CURLY_L, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CURLY_R() { return GetToken(BITEParser.CURLY_R, 0); } + [System.Diagnostics.DebuggerNonUserCode] public DeclarationContext[] declaration() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public DeclarationContext declaration(int i) { + return GetRuleContext(i); + } + public BlockContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_block; } } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IBITEParserVisitor typedVisitor = visitor as IBITEParserVisitor; + if (typedVisitor != null) return typedVisitor.VisitBlock(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public BlockContext block() { + BlockContext _localctx = new BlockContext(Context, State); + EnterRule(_localctx, 56, RULE_block); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 452; + Match(CURLY_L); + State = 456; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << DeclareClass) | (1L << DeclareStruct) | (1L << ExternModifier) | (1L << CallableModifier) | (1L << DeclareFunction) | (1L << DeclareVariable) | (1L << DeclareForLoop) | (1L << DeclareWhileLoop) | (1L << DeclareStatic) | (1L << DeclareAbstract) | (1L << DeclarePublic) | (1L << DeclarePrivate) | (1L << ControlFlowIf) | (1L << FunctionReturn) | (1L << Break) | (1L << NullReference) | (1L << ThisReference) | (1L << UsingDirective) | (1L << StartStatement) | (1L << UseStatement) | (1L << SyncKeyword) | (1L << MinusOperator) | (1L << MinusMinusOperator) | (1L << PlusOperator) | (1L << PlusPlusOperator) | (1L << LogicalNegationOperator) | (1L << ComplimentOperator))) != 0) || ((((_la - 67)) & ~0x3f) == 0 && ((1L << (_la - 67)) & ((1L << (OpeningRoundBracket - 67)) | (1L << (SquareBracketLeft - 67)) | (1L << (BooleanLiteral - 67)) | (1L << (IntegerLiteral - 67)) | (1L << (FloatingLiteral - 67)) | (1L << (Identifier - 67)) | (1L << (DQUOTE - 67)) | (1L << (CURLY_L - 67)))) != 0)) { + { + { + State = 453; + declaration(); + } + } + State = 458; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } + State = 459; + Match(CURLY_R); } } catch (RecognitionException re) { @@ -2446,22 +2644,22 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public ExpressionContext expression() { ExpressionContext _localctx = new ExpressionContext(Context, State); - EnterRule(_localctx, 52, RULE_expression); + EnterRule(_localctx, 58, RULE_expression); try { - State = 423; + State = 463; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,49,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,50,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 421; + State = 461; assignment(); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 422; + State = 462; lambdaExpression(); } break; @@ -2515,18 +2713,18 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public AssignmentContext assignment() { AssignmentContext _localctx = new AssignmentContext(Context, State); - EnterRule(_localctx, 54, RULE_assignment); + EnterRule(_localctx, 60, RULE_assignment); int _la; try { - State = 430; + State = 470; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,50,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,51,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 425; + State = 465; call(); - State = 426; + State = 466; _la = TokenStream.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << AssignOperator) | (1L << PlusAssignOperator) | (1L << MinusAssignOperator) | (1L << MultiplyAssignOperator) | (1L << DivideAssignOperator) | (1L << ModuloAssignOperator) | (1L << BitwiseAndAssignOperator) | (1L << BitwiseOrAssignOperator) | (1L << BitwiseXorAssignOperator) | (1L << BitwiseLeftShiftAssignOperator) | (1L << BitwiseRightShiftAssignOperator))) != 0)) ) { ErrorHandler.RecoverInline(this); @@ -2535,14 +2733,14 @@ public AssignmentContext assignment() { ErrorHandler.ReportMatch(this); Consume(); } - State = 427; + State = 467; assignment(); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 429; + State = 469; ternary(); } break; @@ -2583,15 +2781,15 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public LambdaExpressionContext lambdaExpression() { LambdaExpressionContext _localctx = new LambdaExpressionContext(Context, State); - EnterRule(_localctx, 56, RULE_lambdaExpression); + EnterRule(_localctx, 62, RULE_lambdaExpression); try { EnterOuterAlt(_localctx, 1); { - State = 432; + State = 472; callArguments(); - State = 433; + State = 473; Match(ReferenceOperator); - State = 434; + State = 474; block(); } } @@ -2637,30 +2835,30 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public TernaryContext ternary() { TernaryContext _localctx = new TernaryContext(Context, State); - EnterRule(_localctx, 58, RULE_ternary); + EnterRule(_localctx, 64, RULE_ternary); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 436; + State = 476; logicOr(); - State = 444; + State = 484; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==QuestionMarkOperator) { { { - State = 437; + State = 477; Match(QuestionMarkOperator); - State = 438; + State = 478; logicOr(); - State = 439; + State = 479; Match(ColonOperator); - State = 440; + State = 480; logicOr(); } } - State = 446; + State = 486; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -2704,26 +2902,26 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public LogicOrContext logicOr() { LogicOrContext _localctx = new LogicOrContext(Context, State); - EnterRule(_localctx, 60, RULE_logicOr); + EnterRule(_localctx, 66, RULE_logicOr); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 447; + State = 487; logicAnd(); - State = 452; + State = 492; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==LogicalOrOperator) { { { - State = 448; + State = 488; Match(LogicalOrOperator); - State = 449; + State = 489; logicAnd(); } } - State = 454; + State = 494; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -2767,26 +2965,26 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public LogicAndContext logicAnd() { LogicAndContext _localctx = new LogicAndContext(Context, State); - EnterRule(_localctx, 62, RULE_logicAnd); + EnterRule(_localctx, 68, RULE_logicAnd); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 455; + State = 495; bitwiseOr(); - State = 460; + State = 500; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==LogicalAndOperator) { { { - State = 456; + State = 496; Match(LogicalAndOperator); - State = 457; + State = 497; bitwiseOr(); } } - State = 462; + State = 502; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -2830,26 +3028,26 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public BitwiseOrContext bitwiseOr() { BitwiseOrContext _localctx = new BitwiseOrContext(Context, State); - EnterRule(_localctx, 64, RULE_bitwiseOr); + EnterRule(_localctx, 70, RULE_bitwiseOr); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 463; + State = 503; bitwiseXor(); - State = 468; + State = 508; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==BitwiseOrOperator) { { { - State = 464; + State = 504; Match(BitwiseOrOperator); - State = 465; + State = 505; bitwiseXor(); } } - State = 470; + State = 510; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -2893,26 +3091,26 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public BitwiseXorContext bitwiseXor() { BitwiseXorContext _localctx = new BitwiseXorContext(Context, State); - EnterRule(_localctx, 66, RULE_bitwiseXor); + EnterRule(_localctx, 72, RULE_bitwiseXor); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 471; + State = 511; bitwiseAnd(); - State = 476; + State = 516; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==BitwiseXorOperator) { { { - State = 472; + State = 512; Match(BitwiseXorOperator); - State = 473; + State = 513; bitwiseAnd(); } } - State = 478; + State = 518; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -2956,26 +3154,26 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public BitwiseAndContext bitwiseAnd() { BitwiseAndContext _localctx = new BitwiseAndContext(Context, State); - EnterRule(_localctx, 68, RULE_bitwiseAnd); + EnterRule(_localctx, 74, RULE_bitwiseAnd); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 479; + State = 519; equality(); - State = 484; + State = 524; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==BitwiseAndOperator) { { { - State = 480; + State = 520; Match(BitwiseAndOperator); - State = 481; + State = 521; equality(); } } - State = 486; + State = 526; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -3023,20 +3221,20 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public EqualityContext equality() { EqualityContext _localctx = new EqualityContext(Context, State); - EnterRule(_localctx, 70, RULE_equality); + EnterRule(_localctx, 76, RULE_equality); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 487; + State = 527; relational(); - State = 492; + State = 532; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==UnequalOperator || _la==EqualOperator) { { { - State = 488; + State = 528; _la = TokenStream.LA(1); if ( !(_la==UnequalOperator || _la==EqualOperator) ) { ErrorHandler.RecoverInline(this); @@ -3045,11 +3243,11 @@ public EqualityContext equality() { ErrorHandler.ReportMatch(this); Consume(); } - State = 489; + State = 529; relational(); } } - State = 494; + State = 534; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -3105,20 +3303,20 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public RelationalContext relational() { RelationalContext _localctx = new RelationalContext(Context, State); - EnterRule(_localctx, 72, RULE_relational); + EnterRule(_localctx, 78, RULE_relational); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 495; + State = 535; shift(); - State = 500; + State = 540; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << GreaterOperator) | (1L << GreaterEqualOperator) | (1L << SmallerOperator) | (1L << SmallerEqualOperator))) != 0)) { { { - State = 496; + State = 536; _la = TokenStream.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << GreaterOperator) | (1L << GreaterEqualOperator) | (1L << SmallerOperator) | (1L << SmallerEqualOperator))) != 0)) ) { ErrorHandler.RecoverInline(this); @@ -3127,11 +3325,11 @@ public RelationalContext relational() { ErrorHandler.ReportMatch(this); Consume(); } - State = 497; + State = 537; shift(); } } - State = 502; + State = 542; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -3179,20 +3377,20 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public ShiftContext shift() { ShiftContext _localctx = new ShiftContext(Context, State); - EnterRule(_localctx, 74, RULE_shift); + EnterRule(_localctx, 80, RULE_shift); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 503; + State = 543; additive(); - State = 508; + State = 548; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==ShiftRightOperator || _la==ShiftLeftOperator) { { { - State = 504; + State = 544; _la = TokenStream.LA(1); if ( !(_la==ShiftRightOperator || _la==ShiftLeftOperator) ) { ErrorHandler.RecoverInline(this); @@ -3201,11 +3399,11 @@ public ShiftContext shift() { ErrorHandler.ReportMatch(this); Consume(); } - State = 505; + State = 545; additive(); } } - State = 510; + State = 550; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -3253,20 +3451,20 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public AdditiveContext additive() { AdditiveContext _localctx = new AdditiveContext(Context, State); - EnterRule(_localctx, 76, RULE_additive); + EnterRule(_localctx, 82, RULE_additive); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 511; + State = 551; multiplicative(); - State = 516; + State = 556; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==MinusOperator || _la==PlusOperator) { { { - State = 512; + State = 552; _la = TokenStream.LA(1); if ( !(_la==MinusOperator || _la==PlusOperator) ) { ErrorHandler.RecoverInline(this); @@ -3275,11 +3473,11 @@ public AdditiveContext additive() { ErrorHandler.ReportMatch(this); Consume(); } - State = 513; + State = 553; multiplicative(); } } - State = 518; + State = 558; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -3331,20 +3529,20 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public MultiplicativeContext multiplicative() { MultiplicativeContext _localctx = new MultiplicativeContext(Context, State); - EnterRule(_localctx, 78, RULE_multiplicative); + EnterRule(_localctx, 84, RULE_multiplicative); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 519; + State = 559; unary(0); - State = 524; + State = 564; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << DivideOperator) | (1L << MultiplyOperator) | (1L << ModuloOperator))) != 0)) { { { - State = 520; + State = 560; _la = TokenStream.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << DivideOperator) | (1L << MultiplyOperator) | (1L << ModuloOperator))) != 0)) ) { ErrorHandler.RecoverInline(this); @@ -3353,11 +3551,11 @@ public MultiplicativeContext multiplicative() { ErrorHandler.ReportMatch(this); Consume(); } - State = 521; + State = 561; unary(0); } } - State = 526; + State = 566; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -3410,14 +3608,14 @@ private UnaryContext unary(int _p) { int _parentState = State; UnaryContext _localctx = new UnaryContext(Context, _parentState); UnaryContext _prevctx = _localctx; - int _startState = 80; - EnterRecursionRule(_localctx, 80, RULE_unary, _p); + int _startState = 86; + EnterRecursionRule(_localctx, 86, RULE_unary, _p); int _la; try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 531; + State = 571; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case MinusOperator: @@ -3427,7 +3625,7 @@ private UnaryContext unary(int _p) { case LogicalNegationOperator: case ComplimentOperator: { - State = 528; + State = 568; _la = TokenStream.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << MinusOperator) | (1L << MinusMinusOperator) | (1L << PlusOperator) | (1L << PlusPlusOperator) | (1L << LogicalNegationOperator) | (1L << ComplimentOperator))) != 0)) ) { ErrorHandler.RecoverInline(this); @@ -3436,20 +3634,22 @@ private UnaryContext unary(int _p) { ErrorHandler.ReportMatch(this); Consume(); } - State = 529; + State = 569; unary(3); } break; case NullReference: case ThisReference: case OpeningRoundBracket: + case SquareBracketLeft: case BooleanLiteral: case IntegerLiteral: case FloatingLiteral: case Identifier: case DQUOTE: + case CURLY_L: { - State = 530; + State = 570; call(); } break; @@ -3457,9 +3657,9 @@ private UnaryContext unary(int _p) { throw new NoViableAltException(this); } Context.Stop = TokenStream.LT(-1); - State = 537; + State = 577; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,63,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,64,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { if ( ParseListeners!=null ) @@ -3469,9 +3669,9 @@ private UnaryContext unary(int _p) { { _localctx = new UnaryContext(_parentctx, _parentState); PushNewRecursionContext(_localctx, _startState, RULE_unary); - State = 533; + State = 573; if (!(Precpred(Context, 1))) throw new FailedPredicateException(this, "Precpred(Context, 1)"); - State = 534; + State = 574; _la = TokenStream.LA(1); if ( !(_la==MinusMinusOperator || _la==PlusPlusOperator) ) { ErrorHandler.RecoverInline(this); @@ -3483,9 +3683,9 @@ private UnaryContext unary(int _p) { } } } - State = 539; + State = 579; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,63,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,64,Context); } } } @@ -3540,39 +3740,39 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public CallContext call() { CallContext _localctx = new CallContext(Context, State); - EnterRule(_localctx, 82, RULE_call); + EnterRule(_localctx, 88, RULE_call); try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 540; + State = 580; primary(); - State = 547; + State = 587; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,65,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,66,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { - State = 545; + State = 585; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case OpeningRoundBracket: { - State = 541; + State = 581; callArguments(); } break; case DotOperator: { - State = 542; + State = 582; Match(DotOperator); - State = 543; + State = 583; Match(Identifier); } break; - case SquarebracketLeft: + case SquareBracketLeft: { - State = 544; + State = 584; elementAccess(); } break; @@ -3581,10 +3781,193 @@ public CallContext call() { } } } - State = 549; + State = 589; + ErrorHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(TokenStream,66,Context); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class ArrayExpressionContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SquareBracketLeft() { return GetToken(BITEParser.SquareBracketLeft, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext[] expression() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext expression(int i) { + return GetRuleContext(i); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SquareBracketRight() { return GetToken(BITEParser.SquareBracketRight, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] CommaSeparator() { return GetTokens(BITEParser.CommaSeparator); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CommaSeparator(int i) { + return GetToken(BITEParser.CommaSeparator, i); + } + public ArrayExpressionContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_arrayExpression; } } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IBITEParserVisitor typedVisitor = visitor as IBITEParserVisitor; + if (typedVisitor != null) return typedVisitor.VisitArrayExpression(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public ArrayExpressionContext arrayExpression() { + ArrayExpressionContext _localctx = new ArrayExpressionContext(Context, State); + EnterRule(_localctx, 90, RULE_arrayExpression); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 590; + Match(SquareBracketLeft); + State = 591; + expression(); + State = 596; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + while (_la==CommaSeparator) { + { + { + State = 592; + Match(CommaSeparator); + State = 593; + expression(); + } + } + State = 598; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } + State = 599; + Match(SquareBracketRight); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class ElementInitializationContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode Identifier() { return GetToken(BITEParser.Identifier, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ColonOperator() { return GetToken(BITEParser.ColonOperator, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext expression() { + return GetRuleContext(0); + } + public ElementInitializationContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_elementInitialization; } } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IBITEParserVisitor typedVisitor = visitor as IBITEParserVisitor; + if (typedVisitor != null) return typedVisitor.VisitElementInitialization(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public ElementInitializationContext elementInitialization() { + ElementInitializationContext _localctx = new ElementInitializationContext(Context, State); + EnterRule(_localctx, 92, RULE_elementInitialization); + try { + EnterOuterAlt(_localctx, 1); + { + State = 601; + Match(Identifier); + State = 602; + Match(ColonOperator); + State = 603; + expression(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class DictionaryExpressionContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CURLY_L() { return GetToken(BITEParser.CURLY_L, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ElementInitializationContext[] elementInitialization() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public ElementInitializationContext elementInitialization(int i) { + return GetRuleContext(i); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CURLY_R() { return GetToken(BITEParser.CURLY_R, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] CommaSeparator() { return GetTokens(BITEParser.CommaSeparator); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CommaSeparator(int i) { + return GetToken(BITEParser.CommaSeparator, i); + } + public DictionaryExpressionContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_dictionaryExpression; } } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IBITEParserVisitor typedVisitor = visitor as IBITEParserVisitor; + if (typedVisitor != null) return typedVisitor.VisitDictionaryExpression(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public DictionaryExpressionContext dictionaryExpression() { + DictionaryExpressionContext _localctx = new DictionaryExpressionContext(Context, State); + EnterRule(_localctx, 94, RULE_dictionaryExpression); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 605; + Match(CURLY_L); + State = 606; + elementInitialization(); + State = 611; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + while (_la==CommaSeparator) { + { + { + State = 607; + Match(CommaSeparator); + State = 608; + elementInitialization(); + } + } + State = 613; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,65,Context); + _la = TokenStream.LA(1); } + State = 614; + Match(CURLY_R); } } catch (RecognitionException re) { @@ -3613,6 +3996,12 @@ [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext expression() { [System.Diagnostics.DebuggerNonUserCode] public StringContext @string() { return GetRuleContext(0); } + [System.Diagnostics.DebuggerNonUserCode] public ArrayExpressionContext arrayExpression() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public DictionaryExpressionContext dictionaryExpression() { + return GetRuleContext(0); + } public PrimaryContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { @@ -3629,71 +4018,85 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public PrimaryContext primary() { PrimaryContext _localctx = new PrimaryContext(Context, State); - EnterRule(_localctx, 84, RULE_primary); + EnterRule(_localctx, 96, RULE_primary); try { - State = 561; + State = 629; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case BooleanLiteral: EnterOuterAlt(_localctx, 1); { - State = 550; + State = 616; Match(BooleanLiteral); } break; case NullReference: EnterOuterAlt(_localctx, 2); { - State = 551; + State = 617; Match(NullReference); } break; case ThisReference: EnterOuterAlt(_localctx, 3); { - State = 552; + State = 618; Match(ThisReference); } break; case IntegerLiteral: EnterOuterAlt(_localctx, 4); { - State = 553; + State = 619; Match(IntegerLiteral); } break; case FloatingLiteral: EnterOuterAlt(_localctx, 5); { - State = 554; + State = 620; Match(FloatingLiteral); } break; case OpeningRoundBracket: EnterOuterAlt(_localctx, 6); { - State = 555; + State = 621; Match(OpeningRoundBracket); - State = 556; + State = 622; expression(); - State = 557; + State = 623; Match(ClosingRoundBracket); } break; case Identifier: EnterOuterAlt(_localctx, 7); { - State = 559; + State = 625; Match(Identifier); } break; case DQUOTE: EnterOuterAlt(_localctx, 8); { - State = 560; + State = 626; @string(); } break; + case SquareBracketLeft: + EnterOuterAlt(_localctx, 9); + { + State = 627; + arrayExpression(); + } + break; + case CURLY_L: + EnterOuterAlt(_localctx, 10); + { + State = 628; + dictionaryExpression(); + } + break; default: throw new NoViableAltException(this); } @@ -3709,6 +4112,51 @@ public PrimaryContext primary() { return _localctx; } + public partial class MemberInitializationContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode Identifier() { return GetToken(BITEParser.Identifier, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode AssignOperator() { return GetToken(BITEParser.AssignOperator, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext expression() { + return GetRuleContext(0); + } + public MemberInitializationContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_memberInitialization; } } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IBITEParserVisitor typedVisitor = visitor as IBITEParserVisitor; + if (typedVisitor != null) return typedVisitor.VisitMemberInitialization(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public MemberInitializationContext memberInitialization() { + MemberInitializationContext _localctx = new MemberInitializationContext(Context, State); + EnterRule(_localctx, 98, RULE_memberInitialization); + try { + EnterOuterAlt(_localctx, 1); + { + State = 631; + Match(Identifier); + State = 632; + Match(AssignOperator); + State = 633; + expression(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + public partial class PrivateModifierContext : ParserRuleContext { [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DeclarePrivate() { return GetToken(BITEParser.DeclarePrivate, 0); } public PrivateModifierContext(ParserRuleContext parent, int invokingState) @@ -3727,11 +4175,11 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public PrivateModifierContext privateModifier() { PrivateModifierContext _localctx = new PrivateModifierContext(Context, State); - EnterRule(_localctx, 86, RULE_privateModifier); + EnterRule(_localctx, 100, RULE_privateModifier); try { EnterOuterAlt(_localctx, 1); { - State = 563; + State = 635; Match(DeclarePrivate); } } @@ -3764,11 +4212,11 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public PublicModifierContext publicModifier() { PublicModifierContext _localctx = new PublicModifierContext(Context, State); - EnterRule(_localctx, 88, RULE_publicModifier); + EnterRule(_localctx, 102, RULE_publicModifier); try { EnterOuterAlt(_localctx, 1); { - State = 565; + State = 637; Match(DeclarePublic); } } @@ -3801,11 +4249,11 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public AbstractModifierContext abstractModifier() { AbstractModifierContext _localctx = new AbstractModifierContext(Context, State); - EnterRule(_localctx, 90, RULE_abstractModifier); + EnterRule(_localctx, 104, RULE_abstractModifier); try { EnterOuterAlt(_localctx, 1); { - State = 567; + State = 639; Match(DeclareAbstract); } } @@ -3838,11 +4286,11 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public StaticModifierContext staticModifier() { StaticModifierContext _localctx = new StaticModifierContext(Context, State); - EnterRule(_localctx, 92, RULE_staticModifier); + EnterRule(_localctx, 106, RULE_staticModifier); try { EnterOuterAlt(_localctx, 1); { - State = 569; + State = 641; Match(DeclareStatic); } } @@ -3857,6 +4305,69 @@ public StaticModifierContext staticModifier() { return _localctx; } + public partial class InitializerExpressionContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public MemberInitializationContext[] memberInitialization() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public MemberInitializationContext memberInitialization(int i) { + return GetRuleContext(i); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] CommaSeparator() { return GetTokens(BITEParser.CommaSeparator); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CommaSeparator(int i) { + return GetToken(BITEParser.CommaSeparator, i); + } + public InitializerExpressionContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_initializerExpression; } } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IBITEParserVisitor typedVisitor = visitor as IBITEParserVisitor; + if (typedVisitor != null) return typedVisitor.VisitInitializerExpression(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public InitializerExpressionContext initializerExpression() { + InitializerExpressionContext _localctx = new InitializerExpressionContext(Context, State); + EnterRule(_localctx, 108, RULE_initializerExpression); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 643; + memberInitialization(); + State = 648; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + while (_la==CommaSeparator) { + { + { + State = 644; + Match(CommaSeparator); + State = 645; + memberInitialization(); + } + } + State = 650; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + public partial class ParametersContext : ParserRuleContext { [System.Diagnostics.DebuggerNonUserCode] public ParametersIdentifierContext[] parametersIdentifier() { return GetRuleContexts(); @@ -3864,9 +4375,9 @@ [System.Diagnostics.DebuggerNonUserCode] public ParametersIdentifierContext[] pa [System.Diagnostics.DebuggerNonUserCode] public ParametersIdentifierContext parametersIdentifier(int i) { return GetRuleContext(i); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] CommaSeperator() { return GetTokens(BITEParser.CommaSeperator); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CommaSeperator(int i) { - return GetToken(BITEParser.CommaSeperator, i); + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] CommaSeparator() { return GetTokens(BITEParser.CommaSeparator); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CommaSeparator(int i) { + return GetToken(BITEParser.CommaSeparator, i); } public ParametersContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) @@ -3884,26 +4395,26 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public ParametersContext parameters() { ParametersContext _localctx = new ParametersContext(Context, State); - EnterRule(_localctx, 94, RULE_parameters); + EnterRule(_localctx, 110, RULE_parameters); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 571; + State = 651; parametersIdentifier(); - State = 576; + State = 656; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - while (_la==CommaSeperator) { + while (_la==CommaSeparator) { { { - State = 572; - Match(CommaSeperator); - State = 573; + State = 652; + Match(CommaSeparator); + State = 653; parametersIdentifier(); } } - State = 578; + State = 658; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -3927,9 +4438,9 @@ [System.Diagnostics.DebuggerNonUserCode] public ArgumentExpressionContext[] argu [System.Diagnostics.DebuggerNonUserCode] public ArgumentExpressionContext argumentExpression(int i) { return GetRuleContext(i); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] CommaSeperator() { return GetTokens(BITEParser.CommaSeperator); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CommaSeperator(int i) { - return GetToken(BITEParser.CommaSeperator, i); + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] CommaSeparator() { return GetTokens(BITEParser.CommaSeparator); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CommaSeparator(int i) { + return GetToken(BITEParser.CommaSeparator, i); } public ArgumentsContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) @@ -3947,26 +4458,26 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public ArgumentsContext arguments() { ArgumentsContext _localctx = new ArgumentsContext(Context, State); - EnterRule(_localctx, 96, RULE_arguments); + EnterRule(_localctx, 112, RULE_arguments); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 579; + State = 659; argumentExpression(); - State = 584; + State = 664; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - while (_la==CommaSeperator) { + while (_la==CommaSeparator) { { { - State = 580; - Match(CommaSeperator); - State = 581; + State = 660; + Match(CommaSeparator); + State = 661; argumentExpression(); } } - State = 586; + State = 666; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -3988,9 +4499,9 @@ public partial class InheritanceContext : ParserRuleContext { [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode Identifier(int i) { return GetToken(BITEParser.Identifier, i); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] CommaSeperator() { return GetTokens(BITEParser.CommaSeperator); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CommaSeperator(int i) { - return GetToken(BITEParser.CommaSeperator, i); + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] CommaSeparator() { return GetTokens(BITEParser.CommaSeparator); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CommaSeparator(int i) { + return GetToken(BITEParser.CommaSeparator, i); } public InheritanceContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) @@ -4008,26 +4519,26 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public InheritanceContext inheritance() { InheritanceContext _localctx = new InheritanceContext(Context, State); - EnterRule(_localctx, 98, RULE_inheritance); + EnterRule(_localctx, 114, RULE_inheritance); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 587; + State = 667; Match(Identifier); - State = 592; + State = 672; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - while (_la==CommaSeperator) { + while (_la==CommaSeparator) { { { - State = 588; - Match(CommaSeperator); - State = 589; + State = 668; + Match(CommaSeparator); + State = 669; Match(Identifier); } } - State = 594; + State = 674; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -4066,24 +4577,24 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public CallArgumentsContext callArguments() { CallArgumentsContext _localctx = new CallArgumentsContext(Context, State); - EnterRule(_localctx, 100, RULE_callArguments); + EnterRule(_localctx, 116, RULE_callArguments); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 595; + State = 675; Match(OpeningRoundBracket); - State = 597; + State = 677; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - if (((((_la - 22)) & ~0x3f) == 0 && ((1L << (_la - 22)) & ((1L << (NullReference - 22)) | (1L << (ThisReference - 22)) | (1L << (MinusOperator - 22)) | (1L << (MinusMinusOperator - 22)) | (1L << (PlusOperator - 22)) | (1L << (PlusPlusOperator - 22)) | (1L << (LogicalNegationOperator - 22)) | (1L << (ReferenceOperator - 22)) | (1L << (ComplimentOperator - 22)) | (1L << (OpeningRoundBracket - 22)) | (1L << (BooleanLiteral - 22)) | (1L << (IntegerLiteral - 22)) | (1L << (FloatingLiteral - 22)) | (1L << (Identifier - 22)) | (1L << (DQUOTE - 22)))) != 0)) { + if (((((_la - 22)) & ~0x3f) == 0 && ((1L << (_la - 22)) & ((1L << (NullReference - 22)) | (1L << (ThisReference - 22)) | (1L << (MinusOperator - 22)) | (1L << (MinusMinusOperator - 22)) | (1L << (PlusOperator - 22)) | (1L << (PlusPlusOperator - 22)) | (1L << (LogicalNegationOperator - 22)) | (1L << (ReferenceOperator - 22)) | (1L << (ComplimentOperator - 22)) | (1L << (OpeningRoundBracket - 22)) | (1L << (SquareBracketLeft - 22)) | (1L << (BooleanLiteral - 22)) | (1L << (IntegerLiteral - 22)) | (1L << (FloatingLiteral - 22)) | (1L << (Identifier - 22)) | (1L << (DQUOTE - 22)) | (1L << (CURLY_L - 22)))) != 0)) { { - State = 596; + State = 676; arguments(); } } - State = 599; + State = 679; Match(ClosingRoundBracket); } } @@ -4099,9 +4610,9 @@ public CallArgumentsContext callArguments() { } public partial class ElementAccessContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] SquarebracketLeft() { return GetTokens(BITEParser.SquarebracketLeft); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SquarebracketLeft(int i) { - return GetToken(BITEParser.SquarebracketLeft, i); + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] SquareBracketLeft() { return GetTokens(BITEParser.SquareBracketLeft); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SquareBracketLeft(int i) { + return GetToken(BITEParser.SquareBracketLeft, i); } [System.Diagnostics.DebuggerNonUserCode] public ElementIdentifierContext[] elementIdentifier() { return GetRuleContexts(); @@ -4109,9 +4620,9 @@ [System.Diagnostics.DebuggerNonUserCode] public ElementIdentifierContext[] eleme [System.Diagnostics.DebuggerNonUserCode] public ElementIdentifierContext elementIdentifier(int i) { return GetRuleContext(i); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] SquarebracketRight() { return GetTokens(BITEParser.SquarebracketRight); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SquarebracketRight(int i) { - return GetToken(BITEParser.SquarebracketRight, i); + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] SquareBracketRight() { return GetTokens(BITEParser.SquareBracketRight); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SquareBracketRight(int i) { + return GetToken(BITEParser.SquareBracketRight, i); } public ElementAccessContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) @@ -4129,12 +4640,12 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public ElementAccessContext elementAccess() { ElementAccessContext _localctx = new ElementAccessContext(Context, State); - EnterRule(_localctx, 102, RULE_elementAccess); + EnterRule(_localctx, 118, RULE_elementAccess); try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 605; + State = 685; ErrorHandler.Sync(this); _alt = 1; do { @@ -4142,21 +4653,21 @@ public ElementAccessContext elementAccess() { case 1: { { - State = 601; - Match(SquarebracketLeft); - State = 602; + State = 681; + Match(SquareBracketLeft); + State = 682; elementIdentifier(); - State = 603; - Match(SquarebracketRight); + State = 683; + Match(SquareBracketRight); } } break; default: throw new NoViableAltException(this); } - State = 607; + State = 687; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,71,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,75,Context); } while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ); } } @@ -4195,28 +4706,28 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public ElementIdentifierContext elementIdentifier() { ElementIdentifierContext _localctx = new ElementIdentifierContext(Context, State); - EnterRule(_localctx, 104, RULE_elementIdentifier); + EnterRule(_localctx, 120, RULE_elementIdentifier); try { EnterOuterAlt(_localctx, 1); { - State = 612; + State = 692; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,72,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,76,Context) ) { case 1: { - State = 609; + State = 689; Match(IntegerLiteral); } break; case 2: { - State = 610; + State = 690; @string(); } break; case 3: { - State = 611; + State = 691; call(); } break; @@ -4255,22 +4766,22 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public ArgumentExpressionContext argumentExpression() { ArgumentExpressionContext _localctx = new ArgumentExpressionContext(Context, State); - EnterRule(_localctx, 106, RULE_argumentExpression); + EnterRule(_localctx, 122, RULE_argumentExpression); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 615; + State = 695; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==ReferenceOperator) { { - State = 614; + State = 694; Match(ReferenceOperator); } } - State = 617; + State = 697; expression(); } } @@ -4303,11 +4814,11 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public ParametersIdentifierContext parametersIdentifier() { ParametersIdentifierContext _localctx = new ParametersIdentifierContext(Context, State); - EnterRule(_localctx, 108, RULE_parametersIdentifier); + EnterRule(_localctx, 124, RULE_parametersIdentifier); try { EnterOuterAlt(_localctx, 1); { - State = 619; + State = 699; Match(Identifier); } } @@ -4349,28 +4860,28 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public StringContext @string() { StringContext _localctx = new StringContext(Context, State); - EnterRule(_localctx, 110, RULE_string); + EnterRule(_localctx, 126, RULE_string); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 621; + State = 701; Match(DQUOTE); - State = 625; + State = 705; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - while (((((_la - 83)) & ~0x3f) == 0 && ((1L << (_la - 83)) & ((1L << (TEXT - 83)) | (1L << (BACKSLASH_PAREN - 83)) | (1L << (ESCAPE_SEQUENCE - 83)))) != 0)) { + while (((((_la - 87)) & ~0x3f) == 0 && ((1L << (_la - 87)) & ((1L << (TEXT - 87)) | (1L << (BACKSLASH_PAREN - 87)) | (1L << (ESCAPE_SEQUENCE - 87)))) != 0)) { { { - State = 622; + State = 702; stringPart(); } } - State = 627; + State = 707; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 628; + State = 708; Match(DQUOTE); } } @@ -4409,33 +4920,33 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public StringPartContext stringPart() { StringPartContext _localctx = new StringPartContext(Context, State); - EnterRule(_localctx, 112, RULE_stringPart); + EnterRule(_localctx, 128, RULE_stringPart); try { - State = 636; + State = 716; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case TEXT: EnterOuterAlt(_localctx, 1); { - State = 630; + State = 710; Match(TEXT); } break; case ESCAPE_SEQUENCE: EnterOuterAlt(_localctx, 2); { - State = 631; + State = 711; Match(ESCAPE_SEQUENCE); } break; case BACKSLASH_PAREN: EnterOuterAlt(_localctx, 3); { - State = 632; + State = 712; Match(BACKSLASH_PAREN); - State = 633; + State = 713; expression(); - State = 634; + State = 714; Match(CURLY_R); } break; @@ -4456,7 +4967,7 @@ public StringPartContext stringPart() { public override bool Sempred(RuleContext _localctx, int ruleIndex, int predIndex) { switch (ruleIndex) { - case 40: return unary_sempred((UnaryContext)_localctx, predIndex); + case 43: return unary_sempred((UnaryContext)_localctx, predIndex); } return true; } @@ -4469,7 +4980,7 @@ private bool unary_sempred(UnaryContext _localctx, int predIndex) { private static char[] _serializedATN = { '\x3', '\x608B', '\xA72A', '\x8133', '\xB9ED', '\x417C', '\x3BE7', '\x7786', - '\x5964', '\x3', 'W', '\x281', '\x4', '\x2', '\t', '\x2', '\x4', '\x3', + '\x5964', '\x3', '[', '\x2D1', '\x4', '\x2', '\t', '\x2', '\x4', '\x3', '\t', '\x3', '\x4', '\x4', '\t', '\x4', '\x4', '\x5', '\t', '\x5', '\x4', '\x6', '\t', '\x6', '\x4', '\a', '\t', '\a', '\x4', '\b', '\t', '\b', '\x4', '\t', '\t', '\t', '\x4', '\n', '\t', '\n', '\x4', '\v', '\t', '\v', @@ -4490,551 +5001,616 @@ private bool unary_sempred(UnaryContext _localctx, int predIndex) { '\t', '\x32', '\x4', '\x33', '\t', '\x33', '\x4', '\x34', '\t', '\x34', '\x4', '\x35', '\t', '\x35', '\x4', '\x36', '\t', '\x36', '\x4', '\x37', '\t', '\x37', '\x4', '\x38', '\t', '\x38', '\x4', '\x39', '\t', '\x39', - '\x4', ':', '\t', ':', '\x3', '\x2', '\a', '\x2', 'v', '\n', '\x2', '\f', - '\x2', '\xE', '\x2', 'y', '\v', '\x2', '\x3', '\x3', '\x3', '\x3', '\x3', - '\x3', '\a', '\x3', '~', '\n', '\x3', '\f', '\x3', '\xE', '\x3', '\x81', - '\v', '\x3', '\x3', '\x3', '\a', '\x3', '\x84', '\n', '\x3', '\f', '\x3', - '\xE', '\x3', '\x87', '\v', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', - '\x4', '\x3', '\x4', '\x3', '\x4', '\x3', '\x4', '\a', '\x4', '\x8F', - '\n', '\x4', '\f', '\x4', '\xE', '\x4', '\x92', '\v', '\x4', '\x3', '\x4', - '\x3', '\x4', '\x3', '\x5', '\x3', '\x5', '\x3', '\x5', '\x3', '\x5', - '\a', '\x5', '\x9A', '\n', '\x5', '\f', '\x5', '\xE', '\x5', '\x9D', '\v', - '\x5', '\x3', '\x5', '\x3', '\x5', '\x3', '\x6', '\x3', '\x6', '\x3', - '\x6', '\x3', '\x6', '\a', '\x6', '\xA5', '\n', '\x6', '\f', '\x6', '\xE', - '\x6', '\xA8', '\v', '\x6', '\x3', '\x6', '\x3', '\x6', '\x3', '\a', '\x3', - '\a', '\x3', '\a', '\x3', '\a', '\x3', '\a', '\x3', '\a', '\x3', '\a', - '\x5', '\a', '\xB3', '\n', '\a', '\x3', '\b', '\x3', '\b', '\x5', '\b', - '\xB7', '\n', '\b', '\x3', '\b', '\x3', '\b', '\x5', '\b', '\xBB', '\n', - '\b', '\x3', '\b', '\x3', '\b', '\x3', '\b', '\x3', '\b', '\x5', '\b', - '\xC1', '\n', '\b', '\x3', '\b', '\x3', '\b', '\x5', '\b', '\xC5', '\n', - '\b', '\x3', '\t', '\x3', '\t', '\x5', '\t', '\xC9', '\n', '\t', '\x3', - '\t', '\x3', '\t', '\x3', '\t', '\x3', '\t', '\x5', '\t', '\xCF', '\n', - '\t', '\x3', '\n', '\x3', '\n', '\x5', '\n', '\xD3', '\n', '\n', '\x3', - '\n', '\x3', '\n', '\x5', '\n', '\xD7', '\n', '\n', '\x3', '\n', '\x5', - '\n', '\xDA', '\n', '\n', '\x3', '\n', '\x5', '\n', '\xDD', '\n', '\n', - '\x3', '\n', '\x3', '\n', '\x3', '\n', '\x3', '\n', '\x5', '\n', '\xE3', - '\n', '\n', '\x3', '\n', '\x3', '\n', '\x5', '\n', '\xE7', '\n', '\n', - '\x3', '\n', '\x3', '\n', '\x3', '\n', '\x3', '\v', '\x3', '\v', '\x5', - '\v', '\xEE', '\n', '\v', '\x3', '\v', '\x3', '\v', '\x5', '\v', '\xF2', - '\n', '\v', '\x3', '\v', '\x3', '\v', '\x3', '\v', '\x3', '\v', '\x5', - '\v', '\xF8', '\n', '\v', '\x3', '\v', '\x3', '\v', '\x3', '\v', '\x5', - '\v', '\xFD', '\n', '\v', '\x3', '\f', '\x3', '\f', '\x5', '\f', '\x101', - '\n', '\f', '\x3', '\f', '\x5', '\f', '\x104', '\n', '\f', '\x3', '\f', - '\x3', '\f', '\x3', '\f', '\x3', '\f', '\x3', '\f', '\x3', '\f', '\x3', - '\f', '\a', '\f', '\x10D', '\n', '\f', '\f', '\f', '\xE', '\f', '\x110', - '\v', '\f', '\x3', '\f', '\x3', '\f', '\x5', '\f', '\x114', '\n', '\f', + '\x4', ':', '\t', ':', '\x4', ';', '\t', ';', '\x4', '<', '\t', '<', '\x4', + '=', '\t', '=', '\x4', '>', '\t', '>', '\x4', '?', '\t', '?', '\x4', '@', + '\t', '@', '\x4', '\x41', '\t', '\x41', '\x4', '\x42', '\t', '\x42', '\x3', + '\x2', '\a', '\x2', '\x86', '\n', '\x2', '\f', '\x2', '\xE', '\x2', '\x89', + '\v', '\x2', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\a', '\x3', '\x8E', + '\n', '\x3', '\f', '\x3', '\xE', '\x3', '\x91', '\v', '\x3', '\x3', '\x3', + '\a', '\x3', '\x94', '\n', '\x3', '\f', '\x3', '\xE', '\x3', '\x97', '\v', + '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\x4', '\x3', '\x4', '\x3', + '\x4', '\x3', '\x4', '\a', '\x4', '\x9F', '\n', '\x4', '\f', '\x4', '\xE', + '\x4', '\xA2', '\v', '\x4', '\x3', '\x4', '\x3', '\x4', '\x3', '\x5', + '\x3', '\x5', '\x3', '\x5', '\x3', '\x5', '\a', '\x5', '\xAA', '\n', '\x5', + '\f', '\x5', '\xE', '\x5', '\xAD', '\v', '\x5', '\x3', '\x5', '\x3', '\x5', + '\x3', '\x6', '\x3', '\x6', '\x3', '\x6', '\x3', '\x6', '\a', '\x6', '\xB5', + '\n', '\x6', '\f', '\x6', '\xE', '\x6', '\xB8', '\v', '\x6', '\x3', '\x6', + '\x3', '\x6', '\x3', '\a', '\x3', '\a', '\x3', '\a', '\x3', '\a', '\x3', + '\a', '\x3', '\a', '\x3', '\a', '\x5', '\a', '\xC3', '\n', '\a', '\x3', + '\b', '\x3', '\b', '\x5', '\b', '\xC7', '\n', '\b', '\x3', '\b', '\x3', + '\b', '\x5', '\b', '\xCB', '\n', '\b', '\x3', '\b', '\x3', '\b', '\x3', + '\b', '\x3', '\b', '\x5', '\b', '\xD1', '\n', '\b', '\x3', '\b', '\x3', + '\b', '\x5', '\b', '\xD5', '\n', '\b', '\x3', '\t', '\x3', '\t', '\x5', + '\t', '\xD9', '\n', '\t', '\x3', '\t', '\x3', '\t', '\x3', '\t', '\x3', + '\t', '\x5', '\t', '\xDF', '\n', '\t', '\x3', '\n', '\x3', '\n', '\x5', + '\n', '\xE3', '\n', '\n', '\x3', '\n', '\x3', '\n', '\x5', '\n', '\xE7', + '\n', '\n', '\x3', '\n', '\x5', '\n', '\xEA', '\n', '\n', '\x3', '\n', + '\x5', '\n', '\xED', '\n', '\n', '\x3', '\n', '\x3', '\n', '\x3', '\n', + '\x3', '\n', '\x5', '\n', '\xF3', '\n', '\n', '\x3', '\n', '\x3', '\n', + '\x5', '\n', '\xF7', '\n', '\n', '\x3', '\n', '\x3', '\n', '\x3', '\n', + '\x3', '\v', '\x3', '\v', '\x5', '\v', '\xFE', '\n', '\v', '\x3', '\v', + '\x3', '\v', '\x5', '\v', '\x102', '\n', '\v', '\x3', '\v', '\x3', '\v', + '\x3', '\v', '\x3', '\v', '\x5', '\v', '\x108', '\n', '\v', '\x3', '\v', + '\x3', '\v', '\x3', '\v', '\x5', '\v', '\x10D', '\n', '\v', '\x3', '\f', + '\x3', '\f', '\x5', '\f', '\x111', '\n', '\f', '\x3', '\f', '\x5', '\f', + '\x114', '\n', '\f', '\x3', '\f', '\x3', '\f', '\x3', '\f', '\x3', '\f', + '\x3', '\f', '\x3', '\f', '\x3', '\f', '\a', '\f', '\x11D', '\n', '\f', + '\f', '\f', '\xE', '\f', '\x120', '\v', '\f', '\x3', '\f', '\x3', '\f', + '\x5', '\f', '\x124', '\n', '\f', '\x3', '\f', '\x3', '\f', '\x3', '\f', + '\x3', '\f', '\x3', '\f', '\x3', '\f', '\x5', '\f', '\x12C', '\n', '\f', '\x3', '\f', '\x3', '\f', '\x3', '\f', '\x3', '\f', '\x3', '\f', '\x3', - '\f', '\x3', '\f', '\x3', '\f', '\a', '\f', '\x11E', '\n', '\f', '\f', - '\f', '\xE', '\f', '\x121', '\v', '\f', '\x3', '\f', '\x3', '\f', '\x5', - '\f', '\x125', '\n', '\f', '\x3', '\f', '\x3', '\f', '\x5', '\f', '\x129', - '\n', '\f', '\x3', '\r', '\x3', '\r', '\x5', '\r', '\x12D', '\n', '\r', - '\x3', '\r', '\x5', '\r', '\x130', '\n', '\r', '\x3', '\r', '\x3', '\r', - '\x3', '\r', '\x3', '\r', '\x5', '\r', '\x136', '\n', '\r', '\x3', '\r', - '\x5', '\r', '\x139', '\n', '\r', '\x3', '\xE', '\x3', '\xE', '\a', '\xE', - '\x13D', '\n', '\xE', '\f', '\xE', '\xE', '\xE', '\x140', '\v', '\xE', + '\f', '\a', '\f', '\x134', '\n', '\f', '\f', '\f', '\xE', '\f', '\x137', + '\v', '\f', '\x3', '\f', '\x3', '\f', '\x5', '\f', '\x13B', '\n', '\f', + '\x3', '\f', '\x3', '\f', '\x5', '\f', '\x13F', '\n', '\f', '\x3', '\r', + '\x3', '\r', '\x5', '\r', '\x143', '\n', '\r', '\x3', '\r', '\x5', '\r', + '\x146', '\n', '\r', '\x3', '\r', '\x3', '\r', '\x3', '\r', '\x3', '\r', + '\x5', '\r', '\x14C', '\n', '\r', '\x3', '\r', '\x5', '\r', '\x14F', '\n', + '\r', '\x3', '\xE', '\x3', '\xE', '\a', '\xE', '\x153', '\n', '\xE', '\f', + '\xE', '\xE', '\xE', '\x156', '\v', '\xE', '\x3', '\xF', '\x3', '\xF', '\x3', '\xF', '\x3', '\xF', '\x3', '\xF', '\x3', '\xF', '\x3', '\xF', - '\x3', '\xF', '\x3', '\xF', '\x3', '\xF', '\x5', '\xF', '\x14A', '\n', - '\xF', '\x3', '\x10', '\x3', '\x10', '\x3', '\x10', '\x3', '\x11', '\x3', - '\x11', '\x3', '\x11', '\x5', '\x11', '\x152', '\n', '\x11', '\x3', '\x12', - '\x3', '\x12', '\x3', '\x12', '\x3', '\x12', '\a', '\x12', '\x158', '\n', - '\x12', '\f', '\x12', '\xE', '\x12', '\x15B', '\v', '\x12', '\x3', '\x13', - '\x3', '\x13', '\x3', '\x13', '\x3', '\x13', '\a', '\x13', '\x161', '\n', - '\x13', '\f', '\x13', '\xE', '\x13', '\x164', '\v', '\x13', '\x5', '\x13', - '\x166', '\n', '\x13', '\x3', '\x14', '\x3', '\x14', '\x3', '\x14', '\a', - '\x14', '\x16B', '\n', '\x14', '\f', '\x14', '\xE', '\x14', '\x16E', '\v', - '\x14', '\x3', '\x15', '\x3', '\x15', '\x3', '\x15', '\x5', '\x15', '\x173', - '\n', '\x15', '\x3', '\x15', '\x3', '\x15', '\x5', '\x15', '\x177', '\n', - '\x15', '\x3', '\x15', '\x3', '\x15', '\x5', '\x15', '\x17B', '\n', '\x15', - '\x3', '\x15', '\x3', '\x15', '\x5', '\x15', '\x17F', '\n', '\x15', '\x3', - '\x16', '\x3', '\x16', '\x3', '\x16', '\x3', '\x16', '\x3', '\x16', '\x3', - '\x16', '\x3', '\x16', '\x5', '\x16', '\x188', '\n', '\x16', '\x3', '\x17', - '\x3', '\x17', '\x5', '\x17', '\x18C', '\n', '\x17', '\x3', '\x17', '\x3', - '\x17', '\x3', '\x18', '\x3', '\x18', '\x3', '\x18', '\x3', '\x19', '\x3', + '\x3', '\xF', '\x3', '\xF', '\x3', '\xF', '\x3', '\xF', '\x5', '\xF', + '\x163', '\n', '\xF', '\x3', '\x10', '\x3', '\x10', '\x3', '\x10', '\x3', + '\x11', '\x3', '\x11', '\x3', '\x11', '\x5', '\x11', '\x16B', '\n', '\x11', + '\x3', '\x12', '\x3', '\x12', '\x3', '\x12', '\x3', '\x12', '\a', '\x12', + '\x171', '\n', '\x12', '\f', '\x12', '\xE', '\x12', '\x174', '\v', '\x12', + '\x3', '\x13', '\x3', '\x13', '\x3', '\x13', '\x3', '\x13', '\a', '\x13', + '\x17A', '\n', '\x13', '\f', '\x13', '\xE', '\x13', '\x17D', '\v', '\x13', + '\x5', '\x13', '\x17F', '\n', '\x13', '\x3', '\x14', '\x3', '\x14', '\x3', + '\x14', '\a', '\x14', '\x184', '\n', '\x14', '\f', '\x14', '\xE', '\x14', + '\x187', '\v', '\x14', '\x3', '\x15', '\x3', '\x15', '\x3', '\x15', '\x5', + '\x15', '\x18C', '\n', '\x15', '\x3', '\x15', '\x3', '\x15', '\x5', '\x15', + '\x190', '\n', '\x15', '\x3', '\x15', '\x3', '\x15', '\x5', '\x15', '\x194', + '\n', '\x15', '\x3', '\x15', '\x3', '\x15', '\x5', '\x15', '\x198', '\n', + '\x15', '\x3', '\x16', '\x3', '\x16', '\x3', '\x16', '\x3', '\x16', '\x3', + '\x16', '\x3', '\x16', '\x3', '\x16', '\x5', '\x16', '\x1A1', '\n', '\x16', + '\x3', '\x17', '\x3', '\x17', '\x5', '\x17', '\x1A5', '\n', '\x17', '\x3', + '\x17', '\x3', '\x17', '\x3', '\x18', '\x3', '\x18', '\x3', '\x18', '\x3', '\x19', '\x3', '\x19', '\x3', '\x19', '\x3', '\x19', '\x3', '\x19', '\x3', - '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', - '\x1A', '\x3', '\x1B', '\x3', '\x1B', '\a', '\x1B', '\x1A1', '\n', '\x1B', - '\f', '\x1B', '\xE', '\x1B', '\x1A4', '\v', '\x1B', '\x3', '\x1B', '\x3', - '\x1B', '\x3', '\x1C', '\x3', '\x1C', '\x5', '\x1C', '\x1AA', '\n', '\x1C', - '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', '\x3', '\x1D', - '\x5', '\x1D', '\x1B1', '\n', '\x1D', '\x3', '\x1E', '\x3', '\x1E', '\x3', - '\x1E', '\x3', '\x1E', '\x3', '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\x3', - '\x1F', '\x3', '\x1F', '\x3', '\x1F', '\a', '\x1F', '\x1BD', '\n', '\x1F', - '\f', '\x1F', '\xE', '\x1F', '\x1C0', '\v', '\x1F', '\x3', ' ', '\x3', - ' ', '\x3', ' ', '\a', ' ', '\x1C5', '\n', ' ', '\f', ' ', '\xE', ' ', - '\x1C8', '\v', ' ', '\x3', '!', '\x3', '!', '\x3', '!', '\a', '!', '\x1CD', - '\n', '!', '\f', '!', '\xE', '!', '\x1D0', '\v', '!', '\x3', '\"', '\x3', - '\"', '\x3', '\"', '\a', '\"', '\x1D5', '\n', '\"', '\f', '\"', '\xE', - '\"', '\x1D8', '\v', '\"', '\x3', '#', '\x3', '#', '\x3', '#', '\a', '#', - '\x1DD', '\n', '#', '\f', '#', '\xE', '#', '\x1E0', '\v', '#', '\x3', - '$', '\x3', '$', '\x3', '$', '\a', '$', '\x1E5', '\n', '$', '\f', '$', - '\xE', '$', '\x1E8', '\v', '$', '\x3', '%', '\x3', '%', '\x3', '%', '\a', - '%', '\x1ED', '\n', '%', '\f', '%', '\xE', '%', '\x1F0', '\v', '%', '\x3', - '&', '\x3', '&', '\x3', '&', '\a', '&', '\x1F5', '\n', '&', '\f', '&', - '\xE', '&', '\x1F8', '\v', '&', '\x3', '\'', '\x3', '\'', '\x3', '\'', - '\a', '\'', '\x1FD', '\n', '\'', '\f', '\'', '\xE', '\'', '\x200', '\v', - '\'', '\x3', '(', '\x3', '(', '\x3', '(', '\a', '(', '\x205', '\n', '(', - '\f', '(', '\xE', '(', '\x208', '\v', '(', '\x3', ')', '\x3', ')', '\x3', - ')', '\a', ')', '\x20D', '\n', ')', '\f', ')', '\xE', ')', '\x210', '\v', - ')', '\x3', '*', '\x3', '*', '\x3', '*', '\x3', '*', '\x5', '*', '\x216', - '\n', '*', '\x3', '*', '\x3', '*', '\a', '*', '\x21A', '\n', '*', '\f', - '*', '\xE', '*', '\x21D', '\v', '*', '\x3', '+', '\x3', '+', '\x3', '+', - '\x3', '+', '\x3', '+', '\a', '+', '\x224', '\n', '+', '\f', '+', '\xE', - '+', '\x227', '\v', '+', '\x3', ',', '\x3', ',', '\x3', ',', '\x3', ',', - '\x3', ',', '\x3', ',', '\x3', ',', '\x3', ',', '\x3', ',', '\x3', ',', - '\x3', ',', '\x5', ',', '\x234', '\n', ',', '\x3', '-', '\x3', '-', '\x3', - '.', '\x3', '.', '\x3', '/', '\x3', '/', '\x3', '\x30', '\x3', '\x30', - '\x3', '\x31', '\x3', '\x31', '\x3', '\x31', '\a', '\x31', '\x241', '\n', - '\x31', '\f', '\x31', '\xE', '\x31', '\x244', '\v', '\x31', '\x3', '\x32', - '\x3', '\x32', '\x3', '\x32', '\a', '\x32', '\x249', '\n', '\x32', '\f', - '\x32', '\xE', '\x32', '\x24C', '\v', '\x32', '\x3', '\x33', '\x3', '\x33', - '\x3', '\x33', '\a', '\x33', '\x251', '\n', '\x33', '\f', '\x33', '\xE', - '\x33', '\x254', '\v', '\x33', '\x3', '\x34', '\x3', '\x34', '\x5', '\x34', - '\x258', '\n', '\x34', '\x3', '\x34', '\x3', '\x34', '\x3', '\x35', '\x3', - '\x35', '\x3', '\x35', '\x3', '\x35', '\x6', '\x35', '\x260', '\n', '\x35', - '\r', '\x35', '\xE', '\x35', '\x261', '\x3', '\x36', '\x3', '\x36', '\x3', - '\x36', '\x5', '\x36', '\x267', '\n', '\x36', '\x3', '\x37', '\x5', '\x37', - '\x26A', '\n', '\x37', '\x3', '\x37', '\x3', '\x37', '\x3', '\x38', '\x3', - '\x38', '\x3', '\x39', '\x3', '\x39', '\a', '\x39', '\x272', '\n', '\x39', - '\f', '\x39', '\xE', '\x39', '\x275', '\v', '\x39', '\x3', '\x39', '\x3', - '\x39', '\x3', ':', '\x3', ':', '\x3', ':', '\x3', ':', '\x3', ':', '\x3', - ':', '\x5', ':', '\x27F', '\n', ':', '\x3', ':', '\x2', '\x3', 'R', ';', - '\x2', '\x4', '\x6', '\b', '\n', '\f', '\xE', '\x10', '\x12', '\x14', - '\x16', '\x18', '\x1A', '\x1C', '\x1E', ' ', '\"', '$', '&', '(', '*', - ',', '.', '\x30', '\x32', '\x34', '\x36', '\x38', ':', '<', '>', '@', - '\x42', '\x44', '\x46', 'H', 'J', 'L', 'N', 'P', 'R', 'T', 'V', 'X', 'Z', - '\\', '^', '`', '\x62', '\x64', '\x66', 'h', 'j', 'l', 'n', 'p', 'r', - '\x2', '\n', '\x3', '\x2', '\x1C', '&', '\x3', '\x2', ')', '*', '\x5', - '\x2', '+', '+', '-', '.', '\x30', '\x30', '\x4', '\x2', ',', ',', '/', - '/', '\x4', '\x2', '\x31', '\x31', '\x33', '\x33', '\x4', '\x2', '\x35', - '\x36', '<', '<', '\x5', '\x2', '\x31', '\x34', '\x37', '\x37', '=', '=', - '\x4', '\x2', '\x32', '\x32', '\x34', '\x34', '\x2', '\x2B0', '\x2', 'w', - '\x3', '\x2', '\x2', '\x2', '\x4', 'z', '\x3', '\x2', '\x2', '\x2', '\x6', - '\x8A', '\x3', '\x2', '\x2', '\x2', '\b', '\x95', '\x3', '\x2', '\x2', - '\x2', '\n', '\xA0', '\x3', '\x2', '\x2', '\x2', '\f', '\xB2', '\x3', - '\x2', '\x2', '\x2', '\xE', '\xB6', '\x3', '\x2', '\x2', '\x2', '\x10', - '\xC8', '\x3', '\x2', '\x2', '\x2', '\x12', '\xD2', '\x3', '\x2', '\x2', - '\x2', '\x14', '\xED', '\x3', '\x2', '\x2', '\x2', '\x16', '\x128', '\x3', - '\x2', '\x2', '\x2', '\x18', '\x12C', '\x3', '\x2', '\x2', '\x2', '\x1A', - '\x13A', '\x3', '\x2', '\x2', '\x2', '\x1C', '\x149', '\x3', '\x2', '\x2', - '\x2', '\x1E', '\x14B', '\x3', '\x2', '\x2', '\x2', ' ', '\x14E', '\x3', - '\x2', '\x2', '\x2', '\"', '\x153', '\x3', '\x2', '\x2', '\x2', '$', '\x165', - '\x3', '\x2', '\x2', '\x2', '&', '\x167', '\x3', '\x2', '\x2', '\x2', - '(', '\x16F', '\x3', '\x2', '\x2', '\x2', '*', '\x180', '\x3', '\x2', - '\x2', '\x2', ',', '\x189', '\x3', '\x2', '\x2', '\x2', '.', '\x18F', - '\x3', '\x2', '\x2', '\x2', '\x30', '\x192', '\x3', '\x2', '\x2', '\x2', - '\x32', '\x198', '\x3', '\x2', '\x2', '\x2', '\x34', '\x19E', '\x3', '\x2', - '\x2', '\x2', '\x36', '\x1A9', '\x3', '\x2', '\x2', '\x2', '\x38', '\x1B0', - '\x3', '\x2', '\x2', '\x2', ':', '\x1B2', '\x3', '\x2', '\x2', '\x2', - '<', '\x1B6', '\x3', '\x2', '\x2', '\x2', '>', '\x1C1', '\x3', '\x2', - '\x2', '\x2', '@', '\x1C9', '\x3', '\x2', '\x2', '\x2', '\x42', '\x1D1', - '\x3', '\x2', '\x2', '\x2', '\x44', '\x1D9', '\x3', '\x2', '\x2', '\x2', - '\x46', '\x1E1', '\x3', '\x2', '\x2', '\x2', 'H', '\x1E9', '\x3', '\x2', - '\x2', '\x2', 'J', '\x1F1', '\x3', '\x2', '\x2', '\x2', 'L', '\x1F9', - '\x3', '\x2', '\x2', '\x2', 'N', '\x201', '\x3', '\x2', '\x2', '\x2', - 'P', '\x209', '\x3', '\x2', '\x2', '\x2', 'R', '\x215', '\x3', '\x2', - '\x2', '\x2', 'T', '\x21E', '\x3', '\x2', '\x2', '\x2', 'V', '\x233', - '\x3', '\x2', '\x2', '\x2', 'X', '\x235', '\x3', '\x2', '\x2', '\x2', - 'Z', '\x237', '\x3', '\x2', '\x2', '\x2', '\\', '\x239', '\x3', '\x2', - '\x2', '\x2', '^', '\x23B', '\x3', '\x2', '\x2', '\x2', '`', '\x23D', - '\x3', '\x2', '\x2', '\x2', '\x62', '\x245', '\x3', '\x2', '\x2', '\x2', - '\x64', '\x24D', '\x3', '\x2', '\x2', '\x2', '\x66', '\x255', '\x3', '\x2', - '\x2', '\x2', 'h', '\x25F', '\x3', '\x2', '\x2', '\x2', 'j', '\x266', - '\x3', '\x2', '\x2', '\x2', 'l', '\x269', '\x3', '\x2', '\x2', '\x2', - 'n', '\x26D', '\x3', '\x2', '\x2', '\x2', 'p', '\x26F', '\x3', '\x2', - '\x2', '\x2', 'r', '\x27E', '\x3', '\x2', '\x2', '\x2', 't', 'v', '\x5', - '\x4', '\x3', '\x2', 'u', 't', '\x3', '\x2', '\x2', '\x2', 'v', 'y', '\x3', - '\x2', '\x2', '\x2', 'w', 'u', '\x3', '\x2', '\x2', '\x2', 'w', 'x', '\x3', - '\x2', '\x2', '\x2', 'x', '\x3', '\x3', '\x2', '\x2', '\x2', 'y', 'w', - '\x3', '\x2', '\x2', '\x2', 'z', '\x7F', '\x5', '\x6', '\x4', '\x2', '{', - '~', '\x5', '\b', '\x5', '\x2', '|', '~', '\x5', '\n', '\x6', '\x2', '}', - '{', '\x3', '\x2', '\x2', '\x2', '}', '|', '\x3', '\x2', '\x2', '\x2', - '~', '\x81', '\x3', '\x2', '\x2', '\x2', '\x7F', '}', '\x3', '\x2', '\x2', - '\x2', '\x7F', '\x80', '\x3', '\x2', '\x2', '\x2', '\x80', '\x85', '\x3', - '\x2', '\x2', '\x2', '\x81', '\x7F', '\x3', '\x2', '\x2', '\x2', '\x82', - '\x84', '\x5', '\f', '\a', '\x2', '\x83', '\x82', '\x3', '\x2', '\x2', - '\x2', '\x84', '\x87', '\x3', '\x2', '\x2', '\x2', '\x85', '\x83', '\x3', - '\x2', '\x2', '\x2', '\x85', '\x86', '\x3', '\x2', '\x2', '\x2', '\x86', - '\x88', '\x3', '\x2', '\x2', '\x2', '\x87', '\x85', '\x3', '\x2', '\x2', - '\x2', '\x88', '\x89', '\a', '\x2', '\x2', '\x3', '\x89', '\x5', '\x3', - '\x2', '\x2', '\x2', '\x8A', '\x8B', '\a', '\x3', '\x2', '\x2', '\x8B', - '\x90', '\a', 'N', '\x2', '\x2', '\x8C', '\x8D', '\a', '\x38', '\x2', - '\x2', '\x8D', '\x8F', '\a', 'N', '\x2', '\x2', '\x8E', '\x8C', '\x3', - '\x2', '\x2', '\x2', '\x8F', '\x92', '\x3', '\x2', '\x2', '\x2', '\x90', - '\x8E', '\x3', '\x2', '\x2', '\x2', '\x90', '\x91', '\x3', '\x2', '\x2', - '\x2', '\x91', '\x93', '\x3', '\x2', '\x2', '\x2', '\x92', '\x90', '\x3', - '\x2', '\x2', '\x2', '\x93', '\x94', '\a', '\x46', '\x2', '\x2', '\x94', - '\a', '\x3', '\x2', '\x2', '\x2', '\x95', '\x96', '\a', '\x1B', '\x2', - '\x2', '\x96', '\x9B', '\a', 'N', '\x2', '\x2', '\x97', '\x98', '\a', - '\x38', '\x2', '\x2', '\x98', '\x9A', '\a', 'N', '\x2', '\x2', '\x99', - '\x97', '\x3', '\x2', '\x2', '\x2', '\x9A', '\x9D', '\x3', '\x2', '\x2', - '\x2', '\x9B', '\x99', '\x3', '\x2', '\x2', '\x2', '\x9B', '\x9C', '\x3', - '\x2', '\x2', '\x2', '\x9C', '\x9E', '\x3', '\x2', '\x2', '\x2', '\x9D', - '\x9B', '\x3', '\x2', '\x2', '\x2', '\x9E', '\x9F', '\a', '\x46', '\x2', - '\x2', '\x9F', '\t', '\x3', '\x2', '\x2', '\x2', '\xA0', '\xA1', '\a', - '\x1A', '\x2', '\x2', '\xA1', '\xA6', '\a', 'N', '\x2', '\x2', '\xA2', - '\xA3', '\a', '\x38', '\x2', '\x2', '\xA3', '\xA5', '\a', 'N', '\x2', - '\x2', '\xA4', '\xA2', '\x3', '\x2', '\x2', '\x2', '\xA5', '\xA8', '\x3', - '\x2', '\x2', '\x2', '\xA6', '\xA4', '\x3', '\x2', '\x2', '\x2', '\xA6', - '\xA7', '\x3', '\x2', '\x2', '\x2', '\xA7', '\xA9', '\x3', '\x2', '\x2', - '\x2', '\xA8', '\xA6', '\x3', '\x2', '\x2', '\x2', '\xA9', '\xAA', '\a', - '\x46', '\x2', '\x2', '\xAA', '\v', '\x3', '\x2', '\x2', '\x2', '\xAB', - '\xB3', '\x5', '\xE', '\b', '\x2', '\xAC', '\xB3', '\x5', '\x10', '\t', - '\x2', '\xAD', '\xB3', '\x5', '\x12', '\n', '\x2', '\xAE', '\xB3', '\x5', - '\x14', '\v', '\x2', '\xAF', '\xB3', '\x5', '\x16', '\f', '\x2', '\xB0', - '\xB3', '\x5', '\x18', '\r', '\x2', '\xB1', '\xB3', '\x5', '\x1C', '\xF', - '\x2', '\xB2', '\xAB', '\x3', '\x2', '\x2', '\x2', '\xB2', '\xAC', '\x3', - '\x2', '\x2', '\x2', '\xB2', '\xAD', '\x3', '\x2', '\x2', '\x2', '\xB2', - '\xAE', '\x3', '\x2', '\x2', '\x2', '\xB2', '\xAF', '\x3', '\x2', '\x2', - '\x2', '\xB2', '\xB0', '\x3', '\x2', '\x2', '\x2', '\xB2', '\xB1', '\x3', - '\x2', '\x2', '\x2', '\xB3', '\r', '\x3', '\x2', '\x2', '\x2', '\xB4', - '\xB7', '\x5', 'X', '-', '\x2', '\xB5', '\xB7', '\x5', 'Z', '.', '\x2', - '\xB6', '\xB4', '\x3', '\x2', '\x2', '\x2', '\xB6', '\xB5', '\x3', '\x2', - '\x2', '\x2', '\xB6', '\xB7', '\x3', '\x2', '\x2', '\x2', '\xB7', '\xBA', - '\x3', '\x2', '\x2', '\x2', '\xB8', '\xBB', '\x5', '^', '\x30', '\x2', - '\xB9', '\xBB', '\x5', '\\', '/', '\x2', '\xBA', '\xB8', '\x3', '\x2', - '\x2', '\x2', '\xBA', '\xB9', '\x3', '\x2', '\x2', '\x2', '\xBA', '\xBB', - '\x3', '\x2', '\x2', '\x2', '\xBB', '\xBC', '\x3', '\x2', '\x2', '\x2', - '\xBC', '\xBD', '\a', '\x4', '\x2', '\x2', '\xBD', '\xC0', '\a', 'N', - '\x2', '\x2', '\xBE', '\xBF', '\a', ':', '\x2', '\x2', '\xBF', '\xC1', - '\x5', '\x64', '\x33', '\x2', '\xC0', '\xBE', '\x3', '\x2', '\x2', '\x2', - '\xC0', '\xC1', '\x3', '\x2', '\x2', '\x2', '\xC1', '\xC4', '\x3', '\x2', - '\x2', '\x2', '\xC2', '\xC5', '\x5', '\x34', '\x1B', '\x2', '\xC3', '\xC5', - '\a', '\x46', '\x2', '\x2', '\xC4', '\xC2', '\x3', '\x2', '\x2', '\x2', - '\xC4', '\xC3', '\x3', '\x2', '\x2', '\x2', '\xC5', '\xF', '\x3', '\x2', - '\x2', '\x2', '\xC6', '\xC9', '\x5', 'X', '-', '\x2', '\xC7', '\xC9', - '\x5', 'Z', '.', '\x2', '\xC8', '\xC6', '\x3', '\x2', '\x2', '\x2', '\xC8', - '\xC7', '\x3', '\x2', '\x2', '\x2', '\xC8', '\xC9', '\x3', '\x2', '\x2', - '\x2', '\xC9', '\xCA', '\x3', '\x2', '\x2', '\x2', '\xCA', '\xCB', '\a', - '\x5', '\x2', '\x2', '\xCB', '\xCE', '\a', 'N', '\x2', '\x2', '\xCC', - '\xCF', '\x5', '\x34', '\x1B', '\x2', '\xCD', '\xCF', '\a', '\x46', '\x2', - '\x2', '\xCE', '\xCC', '\x3', '\x2', '\x2', '\x2', '\xCE', '\xCD', '\x3', - '\x2', '\x2', '\x2', '\xCF', '\x11', '\x3', '\x2', '\x2', '\x2', '\xD0', - '\xD3', '\x5', 'X', '-', '\x2', '\xD1', '\xD3', '\x5', 'Z', '.', '\x2', - '\xD2', '\xD0', '\x3', '\x2', '\x2', '\x2', '\xD2', '\xD1', '\x3', '\x2', - '\x2', '\x2', '\xD2', '\xD3', '\x3', '\x2', '\x2', '\x2', '\xD3', '\xD6', - '\x3', '\x2', '\x2', '\x2', '\xD4', '\xD7', '\x5', '^', '\x30', '\x2', - '\xD5', '\xD7', '\x5', '\\', '/', '\x2', '\xD6', '\xD4', '\x3', '\x2', - '\x2', '\x2', '\xD6', '\xD5', '\x3', '\x2', '\x2', '\x2', '\xD6', '\xD7', - '\x3', '\x2', '\x2', '\x2', '\xD7', '\xD9', '\x3', '\x2', '\x2', '\x2', - '\xD8', '\xDA', '\a', '\b', '\x2', '\x2', '\xD9', '\xD8', '\x3', '\x2', - '\x2', '\x2', '\xD9', '\xDA', '\x3', '\x2', '\x2', '\x2', '\xDA', '\xDC', - '\x3', '\x2', '\x2', '\x2', '\xDB', '\xDD', '\a', '\t', '\x2', '\x2', - '\xDC', '\xDB', '\x3', '\x2', '\x2', '\x2', '\xDC', '\xDD', '\x3', '\x2', - '\x2', '\x2', '\xDD', '\xDE', '\x3', '\x2', '\x2', '\x2', '\xDE', '\xDF', - '\a', '\n', '\x2', '\x2', '\xDF', '\xE2', '\a', 'N', '\x2', '\x2', '\xE0', - '\xE1', '\a', '\a', '\x2', '\x2', '\xE1', '\xE3', '\a', 'N', '\x2', '\x2', - '\xE2', '\xE0', '\x3', '\x2', '\x2', '\x2', '\xE2', '\xE3', '\x3', '\x2', - '\x2', '\x2', '\xE3', '\xE4', '\x3', '\x2', '\x2', '\x2', '\xE4', '\xE6', - '\a', '\x41', '\x2', '\x2', '\xE5', '\xE7', '\x5', '`', '\x31', '\x2', - '\xE6', '\xE5', '\x3', '\x2', '\x2', '\x2', '\xE6', '\xE7', '\x3', '\x2', - '\x2', '\x2', '\xE7', '\xE8', '\x3', '\x2', '\x2', '\x2', '\xE8', '\xE9', - '\a', '\x42', '\x2', '\x2', '\xE9', '\xEA', '\a', '\x46', '\x2', '\x2', - '\xEA', '\x13', '\x3', '\x2', '\x2', '\x2', '\xEB', '\xEE', '\x5', 'X', - '-', '\x2', '\xEC', '\xEE', '\x5', 'Z', '.', '\x2', '\xED', '\xEB', '\x3', - '\x2', '\x2', '\x2', '\xED', '\xEC', '\x3', '\x2', '\x2', '\x2', '\xED', - '\xEE', '\x3', '\x2', '\x2', '\x2', '\xEE', '\xF1', '\x3', '\x2', '\x2', - '\x2', '\xEF', '\xF2', '\x5', '^', '\x30', '\x2', '\xF0', '\xF2', '\x5', - '\\', '/', '\x2', '\xF1', '\xEF', '\x3', '\x2', '\x2', '\x2', '\xF1', - '\xF0', '\x3', '\x2', '\x2', '\x2', '\xF1', '\xF2', '\x3', '\x2', '\x2', - '\x2', '\xF2', '\xF3', '\x3', '\x2', '\x2', '\x2', '\xF3', '\xF4', '\a', - '\n', '\x2', '\x2', '\xF4', '\xF5', '\a', 'N', '\x2', '\x2', '\xF5', '\xF7', - '\a', '\x41', '\x2', '\x2', '\xF6', '\xF8', '\x5', '`', '\x31', '\x2', - '\xF7', '\xF6', '\x3', '\x2', '\x2', '\x2', '\xF7', '\xF8', '\x3', '\x2', - '\x2', '\x2', '\xF8', '\xF9', '\x3', '\x2', '\x2', '\x2', '\xF9', '\xFC', - '\a', '\x42', '\x2', '\x2', '\xFA', '\xFD', '\x5', '\x34', '\x1B', '\x2', - '\xFB', '\xFD', '\a', '\x46', '\x2', '\x2', '\xFC', '\xFA', '\x3', '\x2', - '\x2', '\x2', '\xFC', '\xFB', '\x3', '\x2', '\x2', '\x2', '\xFD', '\x15', - '\x3', '\x2', '\x2', '\x2', '\xFE', '\x101', '\x5', 'X', '-', '\x2', '\xFF', - '\x101', '\x5', 'Z', '.', '\x2', '\x100', '\xFE', '\x3', '\x2', '\x2', - '\x2', '\x100', '\xFF', '\x3', '\x2', '\x2', '\x2', '\x100', '\x101', - '\x3', '\x2', '\x2', '\x2', '\x101', '\x103', '\x3', '\x2', '\x2', '\x2', - '\x102', '\x104', '\x5', '^', '\x30', '\x2', '\x103', '\x102', '\x3', - '\x2', '\x2', '\x2', '\x103', '\x104', '\x3', '\x2', '\x2', '\x2', '\x104', - '\x105', '\x3', '\x2', '\x2', '\x2', '\x105', '\x106', '\a', '\v', '\x2', - '\x2', '\x106', '\x107', '\a', 'N', '\x2', '\x2', '\x107', '\x108', '\a', - '\x1C', '\x2', '\x2', '\x108', '\x109', '\a', '\x6', '\x2', '\x2', '\x109', - '\x10E', '\a', 'N', '\x2', '\x2', '\x10A', '\x10B', '\a', '\x38', '\x2', - '\x2', '\x10B', '\x10D', '\a', 'N', '\x2', '\x2', '\x10C', '\x10A', '\x3', - '\x2', '\x2', '\x2', '\x10D', '\x110', '\x3', '\x2', '\x2', '\x2', '\x10E', - '\x10C', '\x3', '\x2', '\x2', '\x2', '\x10E', '\x10F', '\x3', '\x2', '\x2', - '\x2', '\x10F', '\x111', '\x3', '\x2', '\x2', '\x2', '\x110', '\x10E', - '\x3', '\x2', '\x2', '\x2', '\x111', '\x113', '\a', '\x41', '\x2', '\x2', - '\x112', '\x114', '\x5', '\x62', '\x32', '\x2', '\x113', '\x112', '\x3', - '\x2', '\x2', '\x2', '\x113', '\x114', '\x3', '\x2', '\x2', '\x2', '\x114', - '\x115', '\x3', '\x2', '\x2', '\x2', '\x115', '\x116', '\a', '\x42', '\x2', - '\x2', '\x116', '\x129', '\a', '\x46', '\x2', '\x2', '\x117', '\x118', - '\a', 'N', '\x2', '\x2', '\x118', '\x119', '\a', '\x1C', '\x2', '\x2', - '\x119', '\x11A', '\a', '\x6', '\x2', '\x2', '\x11A', '\x11F', '\a', 'N', - '\x2', '\x2', '\x11B', '\x11C', '\a', '\x38', '\x2', '\x2', '\x11C', '\x11E', - '\a', 'N', '\x2', '\x2', '\x11D', '\x11B', '\x3', '\x2', '\x2', '\x2', - '\x11E', '\x121', '\x3', '\x2', '\x2', '\x2', '\x11F', '\x11D', '\x3', - '\x2', '\x2', '\x2', '\x11F', '\x120', '\x3', '\x2', '\x2', '\x2', '\x120', - '\x122', '\x3', '\x2', '\x2', '\x2', '\x121', '\x11F', '\x3', '\x2', '\x2', - '\x2', '\x122', '\x124', '\a', '\x41', '\x2', '\x2', '\x123', '\x125', - '\x5', '\x62', '\x32', '\x2', '\x124', '\x123', '\x3', '\x2', '\x2', '\x2', - '\x124', '\x125', '\x3', '\x2', '\x2', '\x2', '\x125', '\x126', '\x3', - '\x2', '\x2', '\x2', '\x126', '\x127', '\a', '\x42', '\x2', '\x2', '\x127', - '\x129', '\a', '\x46', '\x2', '\x2', '\x128', '\x100', '\x3', '\x2', '\x2', - '\x2', '\x128', '\x117', '\x3', '\x2', '\x2', '\x2', '\x129', '\x17', - '\x3', '\x2', '\x2', '\x2', '\x12A', '\x12D', '\x5', 'X', '-', '\x2', - '\x12B', '\x12D', '\x5', 'Z', '.', '\x2', '\x12C', '\x12A', '\x3', '\x2', - '\x2', '\x2', '\x12C', '\x12B', '\x3', '\x2', '\x2', '\x2', '\x12C', '\x12D', - '\x3', '\x2', '\x2', '\x2', '\x12D', '\x12F', '\x3', '\x2', '\x2', '\x2', - '\x12E', '\x130', '\x5', '^', '\x30', '\x2', '\x12F', '\x12E', '\x3', - '\x2', '\x2', '\x2', '\x12F', '\x130', '\x3', '\x2', '\x2', '\x2', '\x130', - '\x131', '\x3', '\x2', '\x2', '\x2', '\x131', '\x132', '\a', '\v', '\x2', - '\x2', '\x132', '\x138', '\a', 'N', '\x2', '\x2', '\x133', '\x134', '\a', - '\x1C', '\x2', '\x2', '\x134', '\x136', '\x5', '\x1E', '\x10', '\x2', - '\x135', '\x133', '\x3', '\x2', '\x2', '\x2', '\x135', '\x136', '\x3', - '\x2', '\x2', '\x2', '\x136', '\x139', '\x3', '\x2', '\x2', '\x2', '\x137', - '\x139', '\a', '\x46', '\x2', '\x2', '\x138', '\x135', '\x3', '\x2', '\x2', - '\x2', '\x138', '\x137', '\x3', '\x2', '\x2', '\x2', '\x139', '\x19', - '\x3', '\x2', '\x2', '\x2', '\x13A', '\x13E', '\x5', '\f', '\a', '\x2', - '\x13B', '\x13D', '\x5', '\f', '\a', '\x2', '\x13C', '\x13B', '\x3', '\x2', - '\x2', '\x2', '\x13D', '\x140', '\x3', '\x2', '\x2', '\x2', '\x13E', '\x13C', - '\x3', '\x2', '\x2', '\x2', '\x13E', '\x13F', '\x3', '\x2', '\x2', '\x2', - '\x13F', '\x1B', '\x3', '\x2', '\x2', '\x2', '\x140', '\x13E', '\x3', - '\x2', '\x2', '\x2', '\x141', '\x14A', '\x5', '\x1E', '\x10', '\x2', '\x142', - '\x14A', '\x5', '(', '\x15', '\x2', '\x143', '\x14A', '\x5', '*', '\x16', - '\x2', '\x144', '\x14A', '\x5', ',', '\x17', '\x2', '\x145', '\x14A', - '\x5', '.', '\x18', '\x2', '\x146', '\x14A', '\x5', '\x30', '\x19', '\x2', - '\x147', '\x14A', '\x5', '\x32', '\x1A', '\x2', '\x148', '\x14A', '\x5', - '\x34', '\x1B', '\x2', '\x149', '\x141', '\x3', '\x2', '\x2', '\x2', '\x149', - '\x142', '\x3', '\x2', '\x2', '\x2', '\x149', '\x143', '\x3', '\x2', '\x2', - '\x2', '\x149', '\x144', '\x3', '\x2', '\x2', '\x2', '\x149', '\x145', - '\x3', '\x2', '\x2', '\x2', '\x149', '\x146', '\x3', '\x2', '\x2', '\x2', - '\x149', '\x147', '\x3', '\x2', '\x2', '\x2', '\x149', '\x148', '\x3', - '\x2', '\x2', '\x2', '\x14A', '\x1D', '\x3', '\x2', '\x2', '\x2', '\x14B', - '\x14C', '\x5', '\x36', '\x1C', '\x2', '\x14C', '\x14D', '\a', '\x46', - '\x2', '\x2', '\x14D', '\x1F', '\x3', '\x2', '\x2', '\x2', '\x14E', '\x151', - '\a', 'N', '\x2', '\x2', '\x14F', '\x150', '\a', '\x1C', '\x2', '\x2', - '\x150', '\x152', '\x5', '\x36', '\x1C', '\x2', '\x151', '\x14F', '\x3', - '\x2', '\x2', '\x2', '\x151', '\x152', '\x3', '\x2', '\x2', '\x2', '\x152', - '!', '\x3', '\x2', '\x2', '\x2', '\x153', '\x154', '\a', '\v', '\x2', - '\x2', '\x154', '\x159', '\x5', ' ', '\x11', '\x2', '\x155', '\x156', - '\a', '\x45', '\x2', '\x2', '\x156', '\x158', '\x5', ' ', '\x11', '\x2', - '\x157', '\x155', '\x3', '\x2', '\x2', '\x2', '\x158', '\x15B', '\x3', - '\x2', '\x2', '\x2', '\x159', '\x157', '\x3', '\x2', '\x2', '\x2', '\x159', - '\x15A', '\x3', '\x2', '\x2', '\x2', '\x15A', '#', '\x3', '\x2', '\x2', - '\x2', '\x15B', '\x159', '\x3', '\x2', '\x2', '\x2', '\x15C', '\x166', - '\x5', '\"', '\x12', '\x2', '\x15D', '\x162', '\x5', '\x36', '\x1C', '\x2', - '\x15E', '\x15F', '\a', '\x45', '\x2', '\x2', '\x15F', '\x161', '\x5', - '\x36', '\x1C', '\x2', '\x160', '\x15E', '\x3', '\x2', '\x2', '\x2', '\x161', - '\x164', '\x3', '\x2', '\x2', '\x2', '\x162', '\x160', '\x3', '\x2', '\x2', - '\x2', '\x162', '\x163', '\x3', '\x2', '\x2', '\x2', '\x163', '\x166', - '\x3', '\x2', '\x2', '\x2', '\x164', '\x162', '\x3', '\x2', '\x2', '\x2', - '\x165', '\x15C', '\x3', '\x2', '\x2', '\x2', '\x165', '\x15D', '\x3', - '\x2', '\x2', '\x2', '\x166', '%', '\x3', '\x2', '\x2', '\x2', '\x167', - '\x16C', '\x5', '\x36', '\x1C', '\x2', '\x168', '\x169', '\a', '\x45', - '\x2', '\x2', '\x169', '\x16B', '\x5', '\x36', '\x1C', '\x2', '\x16A', - '\x168', '\x3', '\x2', '\x2', '\x2', '\x16B', '\x16E', '\x3', '\x2', '\x2', - '\x2', '\x16C', '\x16A', '\x3', '\x2', '\x2', '\x2', '\x16C', '\x16D', - '\x3', '\x2', '\x2', '\x2', '\x16D', '\'', '\x3', '\x2', '\x2', '\x2', - '\x16E', '\x16C', '\x3', '\x2', '\x2', '\x2', '\x16F', '\x170', '\a', - '\xE', '\x2', '\x2', '\x170', '\x172', '\a', '\x41', '\x2', '\x2', '\x171', - '\x173', '\x5', '$', '\x13', '\x2', '\x172', '\x171', '\x3', '\x2', '\x2', - '\x2', '\x172', '\x173', '\x3', '\x2', '\x2', '\x2', '\x173', '\x174', - '\x3', '\x2', '\x2', '\x2', '\x174', '\x176', '\a', '\x46', '\x2', '\x2', - '\x175', '\x177', '\x5', '\x36', '\x1C', '\x2', '\x176', '\x175', '\x3', - '\x2', '\x2', '\x2', '\x176', '\x177', '\x3', '\x2', '\x2', '\x2', '\x177', - '\x178', '\x3', '\x2', '\x2', '\x2', '\x178', '\x17A', '\a', '\x46', '\x2', - '\x2', '\x179', '\x17B', '\x5', '&', '\x14', '\x2', '\x17A', '\x179', - '\x3', '\x2', '\x2', '\x2', '\x17A', '\x17B', '\x3', '\x2', '\x2', '\x2', - '\x17B', '\x17C', '\x3', '\x2', '\x2', '\x2', '\x17C', '\x17E', '\a', - '\x42', '\x2', '\x2', '\x17D', '\x17F', '\x5', '\x1C', '\xF', '\x2', '\x17E', - '\x17D', '\x3', '\x2', '\x2', '\x2', '\x17E', '\x17F', '\x3', '\x2', '\x2', - '\x2', '\x17F', ')', '\x3', '\x2', '\x2', '\x2', '\x180', '\x181', '\a', - '\x14', '\x2', '\x2', '\x181', '\x182', '\a', '\x41', '\x2', '\x2', '\x182', - '\x183', '\x5', '\x36', '\x1C', '\x2', '\x183', '\x184', '\a', '\x42', - '\x2', '\x2', '\x184', '\x187', '\x5', '\x1C', '\xF', '\x2', '\x185', - '\x186', '\a', '\x15', '\x2', '\x2', '\x186', '\x188', '\x5', '\x1C', - '\xF', '\x2', '\x187', '\x185', '\x3', '\x2', '\x2', '\x2', '\x187', '\x188', - '\x3', '\x2', '\x2', '\x2', '\x188', '+', '\x3', '\x2', '\x2', '\x2', - '\x189', '\x18B', '\a', '\x16', '\x2', '\x2', '\x18A', '\x18C', '\x5', - '\x36', '\x1C', '\x2', '\x18B', '\x18A', '\x3', '\x2', '\x2', '\x2', '\x18B', - '\x18C', '\x3', '\x2', '\x2', '\x2', '\x18C', '\x18D', '\x3', '\x2', '\x2', - '\x2', '\x18D', '\x18E', '\a', '\x46', '\x2', '\x2', '\x18E', '-', '\x3', - '\x2', '\x2', '\x2', '\x18F', '\x190', '\a', '\x17', '\x2', '\x2', '\x190', - '\x191', '\a', '\x46', '\x2', '\x2', '\x191', '/', '\x3', '\x2', '\x2', - '\x2', '\x192', '\x193', '\a', '\x1A', '\x2', '\x2', '\x193', '\x194', - '\a', '\x41', '\x2', '\x2', '\x194', '\x195', '\x5', '\x36', '\x1C', '\x2', - '\x195', '\x196', '\a', '\x42', '\x2', '\x2', '\x196', '\x197', '\x5', - '\x34', '\x1B', '\x2', '\x197', '\x31', '\x3', '\x2', '\x2', '\x2', '\x198', - '\x199', '\a', '\xF', '\x2', '\x2', '\x199', '\x19A', '\a', '\x41', '\x2', - '\x2', '\x19A', '\x19B', '\x5', '\x36', '\x1C', '\x2', '\x19B', '\x19C', - '\a', '\x42', '\x2', '\x2', '\x19C', '\x19D', '\x5', '\x34', '\x1B', '\x2', - '\x19D', '\x33', '\x3', '\x2', '\x2', '\x2', '\x19E', '\x1A2', '\a', 'S', - '\x2', '\x2', '\x19F', '\x1A1', '\x5', '\f', '\a', '\x2', '\x1A0', '\x19F', - '\x3', '\x2', '\x2', '\x2', '\x1A1', '\x1A4', '\x3', '\x2', '\x2', '\x2', - '\x1A2', '\x1A0', '\x3', '\x2', '\x2', '\x2', '\x1A2', '\x1A3', '\x3', - '\x2', '\x2', '\x2', '\x1A3', '\x1A5', '\x3', '\x2', '\x2', '\x2', '\x1A4', - '\x1A2', '\x3', '\x2', '\x2', '\x2', '\x1A5', '\x1A6', '\a', 'T', '\x2', - '\x2', '\x1A6', '\x35', '\x3', '\x2', '\x2', '\x2', '\x1A7', '\x1AA', - '\x5', '\x38', '\x1D', '\x2', '\x1A8', '\x1AA', '\x5', ':', '\x1E', '\x2', - '\x1A9', '\x1A7', '\x3', '\x2', '\x2', '\x2', '\x1A9', '\x1A8', '\x3', - '\x2', '\x2', '\x2', '\x1AA', '\x37', '\x3', '\x2', '\x2', '\x2', '\x1AB', - '\x1AC', '\x5', 'T', '+', '\x2', '\x1AC', '\x1AD', '\t', '\x2', '\x2', - '\x2', '\x1AD', '\x1AE', '\x5', '\x38', '\x1D', '\x2', '\x1AE', '\x1B1', - '\x3', '\x2', '\x2', '\x2', '\x1AF', '\x1B1', '\x5', '<', '\x1F', '\x2', - '\x1B0', '\x1AB', '\x3', '\x2', '\x2', '\x2', '\x1B0', '\x1AF', '\x3', - '\x2', '\x2', '\x2', '\x1B1', '\x39', '\x3', '\x2', '\x2', '\x2', '\x1B2', - '\x1B3', '\x5', '\x66', '\x34', '\x2', '\x1B3', '\x1B4', '\a', ';', '\x2', - '\x2', '\x1B4', '\x1B5', '\x5', '\x34', '\x1B', '\x2', '\x1B5', ';', '\x3', - '\x2', '\x2', '\x2', '\x1B6', '\x1BE', '\x5', '>', ' ', '\x2', '\x1B7', - '\x1B8', '\a', '\x39', '\x2', '\x2', '\x1B8', '\x1B9', '\x5', '>', ' ', - '\x2', '\x1B9', '\x1BA', '\a', ':', '\x2', '\x2', '\x1BA', '\x1BB', '\x5', - '>', ' ', '\x2', '\x1BB', '\x1BD', '\x3', '\x2', '\x2', '\x2', '\x1BC', - '\x1B7', '\x3', '\x2', '\x2', '\x2', '\x1BD', '\x1C0', '\x3', '\x2', '\x2', - '\x2', '\x1BE', '\x1BC', '\x3', '\x2', '\x2', '\x2', '\x1BE', '\x1BF', - '\x3', '\x2', '\x2', '\x2', '\x1BF', '=', '\x3', '\x2', '\x2', '\x2', - '\x1C0', '\x1BE', '\x3', '\x2', '\x2', '\x2', '\x1C1', '\x1C6', '\x5', - '@', '!', '\x2', '\x1C2', '\x1C3', '\a', '\'', '\x2', '\x2', '\x1C3', - '\x1C5', '\x5', '@', '!', '\x2', '\x1C4', '\x1C2', '\x3', '\x2', '\x2', - '\x2', '\x1C5', '\x1C8', '\x3', '\x2', '\x2', '\x2', '\x1C6', '\x1C4', - '\x3', '\x2', '\x2', '\x2', '\x1C6', '\x1C7', '\x3', '\x2', '\x2', '\x2', - '\x1C7', '?', '\x3', '\x2', '\x2', '\x2', '\x1C8', '\x1C6', '\x3', '\x2', - '\x2', '\x2', '\x1C9', '\x1CE', '\x5', '\x42', '\"', '\x2', '\x1CA', '\x1CB', - '\a', '(', '\x2', '\x2', '\x1CB', '\x1CD', '\x5', '\x42', '\"', '\x2', - '\x1CC', '\x1CA', '\x3', '\x2', '\x2', '\x2', '\x1CD', '\x1D0', '\x3', - '\x2', '\x2', '\x2', '\x1CE', '\x1CC', '\x3', '\x2', '\x2', '\x2', '\x1CE', - '\x1CF', '\x3', '\x2', '\x2', '\x2', '\x1CF', '\x41', '\x3', '\x2', '\x2', - '\x2', '\x1D0', '\x1CE', '\x3', '\x2', '\x2', '\x2', '\x1D1', '\x1D6', - '\x5', '\x44', '#', '\x2', '\x1D2', '\x1D3', '\a', '@', '\x2', '\x2', - '\x1D3', '\x1D5', '\x5', '\x44', '#', '\x2', '\x1D4', '\x1D2', '\x3', - '\x2', '\x2', '\x2', '\x1D5', '\x1D8', '\x3', '\x2', '\x2', '\x2', '\x1D6', - '\x1D4', '\x3', '\x2', '\x2', '\x2', '\x1D6', '\x1D7', '\x3', '\x2', '\x2', - '\x2', '\x1D7', '\x43', '\x3', '\x2', '\x2', '\x2', '\x1D8', '\x1D6', - '\x3', '\x2', '\x2', '\x2', '\x1D9', '\x1DE', '\x5', '\x46', '$', '\x2', - '\x1DA', '\x1DB', '\a', '?', '\x2', '\x2', '\x1DB', '\x1DD', '\x5', '\x46', - '$', '\x2', '\x1DC', '\x1DA', '\x3', '\x2', '\x2', '\x2', '\x1DD', '\x1E0', - '\x3', '\x2', '\x2', '\x2', '\x1DE', '\x1DC', '\x3', '\x2', '\x2', '\x2', - '\x1DE', '\x1DF', '\x3', '\x2', '\x2', '\x2', '\x1DF', '\x45', '\x3', - '\x2', '\x2', '\x2', '\x1E0', '\x1DE', '\x3', '\x2', '\x2', '\x2', '\x1E1', - '\x1E6', '\x5', 'H', '%', '\x2', '\x1E2', '\x1E3', '\a', '>', '\x2', '\x2', - '\x1E3', '\x1E5', '\x5', 'H', '%', '\x2', '\x1E4', '\x1E2', '\x3', '\x2', - '\x2', '\x2', '\x1E5', '\x1E8', '\x3', '\x2', '\x2', '\x2', '\x1E6', '\x1E4', - '\x3', '\x2', '\x2', '\x2', '\x1E6', '\x1E7', '\x3', '\x2', '\x2', '\x2', - '\x1E7', 'G', '\x3', '\x2', '\x2', '\x2', '\x1E8', '\x1E6', '\x3', '\x2', - '\x2', '\x2', '\x1E9', '\x1EE', '\x5', 'J', '&', '\x2', '\x1EA', '\x1EB', - '\t', '\x3', '\x2', '\x2', '\x1EB', '\x1ED', '\x5', 'J', '&', '\x2', '\x1EC', - '\x1EA', '\x3', '\x2', '\x2', '\x2', '\x1ED', '\x1F0', '\x3', '\x2', '\x2', - '\x2', '\x1EE', '\x1EC', '\x3', '\x2', '\x2', '\x2', '\x1EE', '\x1EF', - '\x3', '\x2', '\x2', '\x2', '\x1EF', 'I', '\x3', '\x2', '\x2', '\x2', - '\x1F0', '\x1EE', '\x3', '\x2', '\x2', '\x2', '\x1F1', '\x1F6', '\x5', - 'L', '\'', '\x2', '\x1F2', '\x1F3', '\t', '\x4', '\x2', '\x2', '\x1F3', - '\x1F5', '\x5', 'L', '\'', '\x2', '\x1F4', '\x1F2', '\x3', '\x2', '\x2', - '\x2', '\x1F5', '\x1F8', '\x3', '\x2', '\x2', '\x2', '\x1F6', '\x1F4', - '\x3', '\x2', '\x2', '\x2', '\x1F6', '\x1F7', '\x3', '\x2', '\x2', '\x2', - '\x1F7', 'K', '\x3', '\x2', '\x2', '\x2', '\x1F8', '\x1F6', '\x3', '\x2', - '\x2', '\x2', '\x1F9', '\x1FE', '\x5', 'N', '(', '\x2', '\x1FA', '\x1FB', - '\t', '\x5', '\x2', '\x2', '\x1FB', '\x1FD', '\x5', 'N', '(', '\x2', '\x1FC', - '\x1FA', '\x3', '\x2', '\x2', '\x2', '\x1FD', '\x200', '\x3', '\x2', '\x2', - '\x2', '\x1FE', '\x1FC', '\x3', '\x2', '\x2', '\x2', '\x1FE', '\x1FF', - '\x3', '\x2', '\x2', '\x2', '\x1FF', 'M', '\x3', '\x2', '\x2', '\x2', - '\x200', '\x1FE', '\x3', '\x2', '\x2', '\x2', '\x201', '\x206', '\x5', - 'P', ')', '\x2', '\x202', '\x203', '\t', '\x6', '\x2', '\x2', '\x203', - '\x205', '\x5', 'P', ')', '\x2', '\x204', '\x202', '\x3', '\x2', '\x2', - '\x2', '\x205', '\x208', '\x3', '\x2', '\x2', '\x2', '\x206', '\x204', - '\x3', '\x2', '\x2', '\x2', '\x206', '\x207', '\x3', '\x2', '\x2', '\x2', - '\x207', 'O', '\x3', '\x2', '\x2', '\x2', '\x208', '\x206', '\x3', '\x2', - '\x2', '\x2', '\x209', '\x20E', '\x5', 'R', '*', '\x2', '\x20A', '\x20B', - '\t', '\a', '\x2', '\x2', '\x20B', '\x20D', '\x5', 'R', '*', '\x2', '\x20C', - '\x20A', '\x3', '\x2', '\x2', '\x2', '\x20D', '\x210', '\x3', '\x2', '\x2', - '\x2', '\x20E', '\x20C', '\x3', '\x2', '\x2', '\x2', '\x20E', '\x20F', - '\x3', '\x2', '\x2', '\x2', '\x20F', 'Q', '\x3', '\x2', '\x2', '\x2', - '\x210', '\x20E', '\x3', '\x2', '\x2', '\x2', '\x211', '\x212', '\b', - '*', '\x1', '\x2', '\x212', '\x213', '\t', '\b', '\x2', '\x2', '\x213', - '\x216', '\x5', 'R', '*', '\x5', '\x214', '\x216', '\x5', 'T', '+', '\x2', - '\x215', '\x211', '\x3', '\x2', '\x2', '\x2', '\x215', '\x214', '\x3', - '\x2', '\x2', '\x2', '\x216', '\x21B', '\x3', '\x2', '\x2', '\x2', '\x217', - '\x218', '\f', '\x3', '\x2', '\x2', '\x218', '\x21A', '\t', '\t', '\x2', - '\x2', '\x219', '\x217', '\x3', '\x2', '\x2', '\x2', '\x21A', '\x21D', - '\x3', '\x2', '\x2', '\x2', '\x21B', '\x219', '\x3', '\x2', '\x2', '\x2', - '\x21B', '\x21C', '\x3', '\x2', '\x2', '\x2', '\x21C', 'S', '\x3', '\x2', - '\x2', '\x2', '\x21D', '\x21B', '\x3', '\x2', '\x2', '\x2', '\x21E', '\x225', - '\x5', 'V', ',', '\x2', '\x21F', '\x224', '\x5', '\x66', '\x34', '\x2', - '\x220', '\x221', '\a', '\x38', '\x2', '\x2', '\x221', '\x224', '\a', - 'N', '\x2', '\x2', '\x222', '\x224', '\x5', 'h', '\x35', '\x2', '\x223', - '\x21F', '\x3', '\x2', '\x2', '\x2', '\x223', '\x220', '\x3', '\x2', '\x2', - '\x2', '\x223', '\x222', '\x3', '\x2', '\x2', '\x2', '\x224', '\x227', - '\x3', '\x2', '\x2', '\x2', '\x225', '\x223', '\x3', '\x2', '\x2', '\x2', - '\x225', '\x226', '\x3', '\x2', '\x2', '\x2', '\x226', 'U', '\x3', '\x2', - '\x2', '\x2', '\x227', '\x225', '\x3', '\x2', '\x2', '\x2', '\x228', '\x234', - '\a', 'H', '\x2', '\x2', '\x229', '\x234', '\a', '\x18', '\x2', '\x2', - '\x22A', '\x234', '\a', '\x19', '\x2', '\x2', '\x22B', '\x234', '\a', - 'K', '\x2', '\x2', '\x22C', '\x234', '\a', 'L', '\x2', '\x2', '\x22D', - '\x22E', '\a', '\x41', '\x2', '\x2', '\x22E', '\x22F', '\x5', '\x36', - '\x1C', '\x2', '\x22F', '\x230', '\a', '\x42', '\x2', '\x2', '\x230', - '\x234', '\x3', '\x2', '\x2', '\x2', '\x231', '\x234', '\a', 'N', '\x2', - '\x2', '\x232', '\x234', '\x5', 'p', '\x39', '\x2', '\x233', '\x228', - '\x3', '\x2', '\x2', '\x2', '\x233', '\x229', '\x3', '\x2', '\x2', '\x2', - '\x233', '\x22A', '\x3', '\x2', '\x2', '\x2', '\x233', '\x22B', '\x3', - '\x2', '\x2', '\x2', '\x233', '\x22C', '\x3', '\x2', '\x2', '\x2', '\x233', - '\x22D', '\x3', '\x2', '\x2', '\x2', '\x233', '\x231', '\x3', '\x2', '\x2', - '\x2', '\x233', '\x232', '\x3', '\x2', '\x2', '\x2', '\x234', 'W', '\x3', - '\x2', '\x2', '\x2', '\x235', '\x236', '\a', '\x13', '\x2', '\x2', '\x236', - 'Y', '\x3', '\x2', '\x2', '\x2', '\x237', '\x238', '\a', '\x12', '\x2', - '\x2', '\x238', '[', '\x3', '\x2', '\x2', '\x2', '\x239', '\x23A', '\a', - '\x11', '\x2', '\x2', '\x23A', ']', '\x3', '\x2', '\x2', '\x2', '\x23B', - '\x23C', '\a', '\x10', '\x2', '\x2', '\x23C', '_', '\x3', '\x2', '\x2', - '\x2', '\x23D', '\x242', '\x5', 'n', '\x38', '\x2', '\x23E', '\x23F', - '\a', '\x45', '\x2', '\x2', '\x23F', '\x241', '\x5', 'n', '\x38', '\x2', - '\x240', '\x23E', '\x3', '\x2', '\x2', '\x2', '\x241', '\x244', '\x3', - '\x2', '\x2', '\x2', '\x242', '\x240', '\x3', '\x2', '\x2', '\x2', '\x242', - '\x243', '\x3', '\x2', '\x2', '\x2', '\x243', '\x61', '\x3', '\x2', '\x2', - '\x2', '\x244', '\x242', '\x3', '\x2', '\x2', '\x2', '\x245', '\x24A', - '\x5', 'l', '\x37', '\x2', '\x246', '\x247', '\a', '\x45', '\x2', '\x2', - '\x247', '\x249', '\x5', 'l', '\x37', '\x2', '\x248', '\x246', '\x3', - '\x2', '\x2', '\x2', '\x249', '\x24C', '\x3', '\x2', '\x2', '\x2', '\x24A', - '\x248', '\x3', '\x2', '\x2', '\x2', '\x24A', '\x24B', '\x3', '\x2', '\x2', - '\x2', '\x24B', '\x63', '\x3', '\x2', '\x2', '\x2', '\x24C', '\x24A', - '\x3', '\x2', '\x2', '\x2', '\x24D', '\x252', '\a', 'N', '\x2', '\x2', - '\x24E', '\x24F', '\a', '\x45', '\x2', '\x2', '\x24F', '\x251', '\a', - 'N', '\x2', '\x2', '\x250', '\x24E', '\x3', '\x2', '\x2', '\x2', '\x251', - '\x254', '\x3', '\x2', '\x2', '\x2', '\x252', '\x250', '\x3', '\x2', '\x2', - '\x2', '\x252', '\x253', '\x3', '\x2', '\x2', '\x2', '\x253', '\x65', - '\x3', '\x2', '\x2', '\x2', '\x254', '\x252', '\x3', '\x2', '\x2', '\x2', - '\x255', '\x257', '\a', '\x41', '\x2', '\x2', '\x256', '\x258', '\x5', - '\x62', '\x32', '\x2', '\x257', '\x256', '\x3', '\x2', '\x2', '\x2', '\x257', - '\x258', '\x3', '\x2', '\x2', '\x2', '\x258', '\x259', '\x3', '\x2', '\x2', - '\x2', '\x259', '\x25A', '\a', '\x42', '\x2', '\x2', '\x25A', 'g', '\x3', - '\x2', '\x2', '\x2', '\x25B', '\x25C', '\a', '\x43', '\x2', '\x2', '\x25C', - '\x25D', '\x5', 'j', '\x36', '\x2', '\x25D', '\x25E', '\a', '\x44', '\x2', - '\x2', '\x25E', '\x260', '\x3', '\x2', '\x2', '\x2', '\x25F', '\x25B', - '\x3', '\x2', '\x2', '\x2', '\x260', '\x261', '\x3', '\x2', '\x2', '\x2', - '\x261', '\x25F', '\x3', '\x2', '\x2', '\x2', '\x261', '\x262', '\x3', - '\x2', '\x2', '\x2', '\x262', 'i', '\x3', '\x2', '\x2', '\x2', '\x263', - '\x267', '\a', 'K', '\x2', '\x2', '\x264', '\x267', '\x5', 'p', '\x39', - '\x2', '\x265', '\x267', '\x5', 'T', '+', '\x2', '\x266', '\x263', '\x3', - '\x2', '\x2', '\x2', '\x266', '\x264', '\x3', '\x2', '\x2', '\x2', '\x266', - '\x265', '\x3', '\x2', '\x2', '\x2', '\x267', 'k', '\x3', '\x2', '\x2', - '\x2', '\x268', '\x26A', '\a', ';', '\x2', '\x2', '\x269', '\x268', '\x3', - '\x2', '\x2', '\x2', '\x269', '\x26A', '\x3', '\x2', '\x2', '\x2', '\x26A', - '\x26B', '\x3', '\x2', '\x2', '\x2', '\x26B', '\x26C', '\x5', '\x36', - '\x1C', '\x2', '\x26C', 'm', '\x3', '\x2', '\x2', '\x2', '\x26D', '\x26E', - '\a', 'N', '\x2', '\x2', '\x26E', 'o', '\x3', '\x2', '\x2', '\x2', '\x26F', - '\x273', '\a', 'R', '\x2', '\x2', '\x270', '\x272', '\x5', 'r', ':', '\x2', - '\x271', '\x270', '\x3', '\x2', '\x2', '\x2', '\x272', '\x275', '\x3', - '\x2', '\x2', '\x2', '\x273', '\x271', '\x3', '\x2', '\x2', '\x2', '\x273', - '\x274', '\x3', '\x2', '\x2', '\x2', '\x274', '\x276', '\x3', '\x2', '\x2', - '\x2', '\x275', '\x273', '\x3', '\x2', '\x2', '\x2', '\x276', '\x277', - '\a', 'R', '\x2', '\x2', '\x277', 'q', '\x3', '\x2', '\x2', '\x2', '\x278', - '\x27F', '\a', 'U', '\x2', '\x2', '\x279', '\x27F', '\a', 'W', '\x2', - '\x2', '\x27A', '\x27B', '\a', 'V', '\x2', '\x2', '\x27B', '\x27C', '\x5', - '\x36', '\x1C', '\x2', '\x27C', '\x27D', '\a', 'T', '\x2', '\x2', '\x27D', - '\x27F', '\x3', '\x2', '\x2', '\x2', '\x27E', '\x278', '\x3', '\x2', '\x2', - '\x2', '\x27E', '\x279', '\x3', '\x2', '\x2', '\x2', '\x27E', '\x27A', - '\x3', '\x2', '\x2', '\x2', '\x27F', 's', '\x3', '\x2', '\x2', '\x2', - 'N', 'w', '}', '\x7F', '\x85', '\x90', '\x9B', '\xA6', '\xB2', '\xB6', - '\xBA', '\xC0', '\xC4', '\xC8', '\xCE', '\xD2', '\xD6', '\xD9', '\xDC', - '\xE2', '\xE6', '\xED', '\xF1', '\xF7', '\xFC', '\x100', '\x103', '\x10E', - '\x113', '\x11F', '\x124', '\x128', '\x12C', '\x12F', '\x135', '\x138', - '\x13E', '\x149', '\x151', '\x159', '\x162', '\x165', '\x16C', '\x172', - '\x176', '\x17A', '\x17E', '\x187', '\x18B', '\x1A2', '\x1A9', '\x1B0', - '\x1BE', '\x1C6', '\x1CE', '\x1D6', '\x1DE', '\x1E6', '\x1EE', '\x1F6', - '\x1FE', '\x206', '\x20E', '\x215', '\x21B', '\x223', '\x225', '\x233', - '\x242', '\x24A', '\x252', '\x257', '\x261', '\x266', '\x269', '\x273', - '\x27E', + '\x19', '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', + '\x1A', '\x3', '\x1A', '\x3', '\x1B', '\x3', '\x1B', '\x3', '\x1B', '\x3', + '\x1B', '\x3', '\x1B', '\x3', '\x1B', '\x3', '\x1C', '\x3', '\x1C', '\x3', + '\x1C', '\x3', '\x1C', '\x3', '\x1C', '\x3', '\x1C', '\x3', '\x1D', '\x3', + '\x1D', '\x3', '\x1D', '\x3', '\x1E', '\x3', '\x1E', '\a', '\x1E', '\x1C9', + '\n', '\x1E', '\f', '\x1E', '\xE', '\x1E', '\x1CC', '\v', '\x1E', '\x3', + '\x1E', '\x3', '\x1E', '\x3', '\x1F', '\x3', '\x1F', '\x5', '\x1F', '\x1D2', + '\n', '\x1F', '\x3', ' ', '\x3', ' ', '\x3', ' ', '\x3', ' ', '\x3', ' ', + '\x5', ' ', '\x1D9', '\n', ' ', '\x3', '!', '\x3', '!', '\x3', '!', '\x3', + '!', '\x3', '\"', '\x3', '\"', '\x3', '\"', '\x3', '\"', '\x3', '\"', + '\x3', '\"', '\a', '\"', '\x1E5', '\n', '\"', '\f', '\"', '\xE', '\"', + '\x1E8', '\v', '\"', '\x3', '#', '\x3', '#', '\x3', '#', '\a', '#', '\x1ED', + '\n', '#', '\f', '#', '\xE', '#', '\x1F0', '\v', '#', '\x3', '$', '\x3', + '$', '\x3', '$', '\a', '$', '\x1F5', '\n', '$', '\f', '$', '\xE', '$', + '\x1F8', '\v', '$', '\x3', '%', '\x3', '%', '\x3', '%', '\a', '%', '\x1FD', + '\n', '%', '\f', '%', '\xE', '%', '\x200', '\v', '%', '\x3', '&', '\x3', + '&', '\x3', '&', '\a', '&', '\x205', '\n', '&', '\f', '&', '\xE', '&', + '\x208', '\v', '&', '\x3', '\'', '\x3', '\'', '\x3', '\'', '\a', '\'', + '\x20D', '\n', '\'', '\f', '\'', '\xE', '\'', '\x210', '\v', '\'', '\x3', + '(', '\x3', '(', '\x3', '(', '\a', '(', '\x215', '\n', '(', '\f', '(', + '\xE', '(', '\x218', '\v', '(', '\x3', ')', '\x3', ')', '\x3', ')', '\a', + ')', '\x21D', '\n', ')', '\f', ')', '\xE', ')', '\x220', '\v', ')', '\x3', + '*', '\x3', '*', '\x3', '*', '\a', '*', '\x225', '\n', '*', '\f', '*', + '\xE', '*', '\x228', '\v', '*', '\x3', '+', '\x3', '+', '\x3', '+', '\a', + '+', '\x22D', '\n', '+', '\f', '+', '\xE', '+', '\x230', '\v', '+', '\x3', + ',', '\x3', ',', '\x3', ',', '\a', ',', '\x235', '\n', ',', '\f', ',', + '\xE', ',', '\x238', '\v', ',', '\x3', '-', '\x3', '-', '\x3', '-', '\x3', + '-', '\x5', '-', '\x23E', '\n', '-', '\x3', '-', '\x3', '-', '\a', '-', + '\x242', '\n', '-', '\f', '-', '\xE', '-', '\x245', '\v', '-', '\x3', + '.', '\x3', '.', '\x3', '.', '\x3', '.', '\x3', '.', '\a', '.', '\x24C', + '\n', '.', '\f', '.', '\xE', '.', '\x24F', '\v', '.', '\x3', '/', '\x3', + '/', '\x3', '/', '\x3', '/', '\a', '/', '\x255', '\n', '/', '\f', '/', + '\xE', '/', '\x258', '\v', '/', '\x3', '/', '\x3', '/', '\x3', '\x30', + '\x3', '\x30', '\x3', '\x30', '\x3', '\x30', '\x3', '\x31', '\x3', '\x31', + '\x3', '\x31', '\x3', '\x31', '\a', '\x31', '\x264', '\n', '\x31', '\f', + '\x31', '\xE', '\x31', '\x267', '\v', '\x31', '\x3', '\x31', '\x3', '\x31', + '\x3', '\x32', '\x3', '\x32', '\x3', '\x32', '\x3', '\x32', '\x3', '\x32', + '\x3', '\x32', '\x3', '\x32', '\x3', '\x32', '\x3', '\x32', '\x3', '\x32', + '\x3', '\x32', '\x3', '\x32', '\x3', '\x32', '\x5', '\x32', '\x278', '\n', + '\x32', '\x3', '\x33', '\x3', '\x33', '\x3', '\x33', '\x3', '\x33', '\x3', + '\x34', '\x3', '\x34', '\x3', '\x35', '\x3', '\x35', '\x3', '\x36', '\x3', + '\x36', '\x3', '\x37', '\x3', '\x37', '\x3', '\x38', '\x3', '\x38', '\x3', + '\x38', '\a', '\x38', '\x289', '\n', '\x38', '\f', '\x38', '\xE', '\x38', + '\x28C', '\v', '\x38', '\x3', '\x39', '\x3', '\x39', '\x3', '\x39', '\a', + '\x39', '\x291', '\n', '\x39', '\f', '\x39', '\xE', '\x39', '\x294', '\v', + '\x39', '\x3', ':', '\x3', ':', '\x3', ':', '\a', ':', '\x299', '\n', + ':', '\f', ':', '\xE', ':', '\x29C', '\v', ':', '\x3', ';', '\x3', ';', + '\x3', ';', '\a', ';', '\x2A1', '\n', ';', '\f', ';', '\xE', ';', '\x2A4', + '\v', ';', '\x3', '<', '\x3', '<', '\x5', '<', '\x2A8', '\n', '<', '\x3', + '<', '\x3', '<', '\x3', '=', '\x3', '=', '\x3', '=', '\x3', '=', '\x6', + '=', '\x2B0', '\n', '=', '\r', '=', '\xE', '=', '\x2B1', '\x3', '>', '\x3', + '>', '\x3', '>', '\x5', '>', '\x2B7', '\n', '>', '\x3', '?', '\x5', '?', + '\x2BA', '\n', '?', '\x3', '?', '\x3', '?', '\x3', '@', '\x3', '@', '\x3', + '\x41', '\x3', '\x41', '\a', '\x41', '\x2C2', '\n', '\x41', '\f', '\x41', + '\xE', '\x41', '\x2C5', '\v', '\x41', '\x3', '\x41', '\x3', '\x41', '\x3', + '\x42', '\x3', '\x42', '\x3', '\x42', '\x3', '\x42', '\x3', '\x42', '\x3', + '\x42', '\x5', '\x42', '\x2CF', '\n', '\x42', '\x3', '\x42', '\x2', '\x3', + 'X', '\x43', '\x2', '\x4', '\x6', '\b', '\n', '\f', '\xE', '\x10', '\x12', + '\x14', '\x16', '\x18', '\x1A', '\x1C', '\x1E', ' ', '\"', '$', '&', '(', + '*', ',', '.', '\x30', '\x32', '\x34', '\x36', '\x38', ':', '<', '>', + '@', '\x42', '\x44', '\x46', 'H', 'J', 'L', 'N', 'P', 'R', 'T', 'V', 'X', + 'Z', '\\', '^', '`', '\x62', '\x64', '\x66', 'h', 'j', 'l', 'n', 'p', + 'r', 't', 'v', 'x', 'z', '|', '~', '\x80', '\x82', '\x2', '\n', '\x3', + '\x2', ' ', '*', '\x3', '\x2', '-', '.', '\x5', '\x2', '/', '/', '\x31', + '\x32', '\x34', '\x34', '\x4', '\x2', '\x30', '\x30', '\x33', '\x33', + '\x4', '\x2', '\x35', '\x35', '\x37', '\x37', '\x4', '\x2', '\x39', ':', + '@', '@', '\x5', '\x2', '\x35', '\x38', ';', ';', '\x41', '\x41', '\x4', + '\x2', '\x36', '\x36', '\x38', '\x38', '\x2', '\x301', '\x2', '\x87', + '\x3', '\x2', '\x2', '\x2', '\x4', '\x8A', '\x3', '\x2', '\x2', '\x2', + '\x6', '\x9A', '\x3', '\x2', '\x2', '\x2', '\b', '\xA5', '\x3', '\x2', + '\x2', '\x2', '\n', '\xB0', '\x3', '\x2', '\x2', '\x2', '\f', '\xC2', + '\x3', '\x2', '\x2', '\x2', '\xE', '\xC6', '\x3', '\x2', '\x2', '\x2', + '\x10', '\xD8', '\x3', '\x2', '\x2', '\x2', '\x12', '\xE2', '\x3', '\x2', + '\x2', '\x2', '\x14', '\xFD', '\x3', '\x2', '\x2', '\x2', '\x16', '\x13E', + '\x3', '\x2', '\x2', '\x2', '\x18', '\x142', '\x3', '\x2', '\x2', '\x2', + '\x1A', '\x150', '\x3', '\x2', '\x2', '\x2', '\x1C', '\x162', '\x3', '\x2', + '\x2', '\x2', '\x1E', '\x164', '\x3', '\x2', '\x2', '\x2', ' ', '\x167', + '\x3', '\x2', '\x2', '\x2', '\"', '\x16C', '\x3', '\x2', '\x2', '\x2', + '$', '\x17E', '\x3', '\x2', '\x2', '\x2', '&', '\x180', '\x3', '\x2', + '\x2', '\x2', '(', '\x188', '\x3', '\x2', '\x2', '\x2', '*', '\x199', + '\x3', '\x2', '\x2', '\x2', ',', '\x1A2', '\x3', '\x2', '\x2', '\x2', + '.', '\x1A8', '\x3', '\x2', '\x2', '\x2', '\x30', '\x1AB', '\x3', '\x2', + '\x2', '\x2', '\x32', '\x1B1', '\x3', '\x2', '\x2', '\x2', '\x34', '\x1B7', + '\x3', '\x2', '\x2', '\x2', '\x36', '\x1BD', '\x3', '\x2', '\x2', '\x2', + '\x38', '\x1C3', '\x3', '\x2', '\x2', '\x2', ':', '\x1C6', '\x3', '\x2', + '\x2', '\x2', '<', '\x1D1', '\x3', '\x2', '\x2', '\x2', '>', '\x1D8', + '\x3', '\x2', '\x2', '\x2', '@', '\x1DA', '\x3', '\x2', '\x2', '\x2', + '\x42', '\x1DE', '\x3', '\x2', '\x2', '\x2', '\x44', '\x1E9', '\x3', '\x2', + '\x2', '\x2', '\x46', '\x1F1', '\x3', '\x2', '\x2', '\x2', 'H', '\x1F9', + '\x3', '\x2', '\x2', '\x2', 'J', '\x201', '\x3', '\x2', '\x2', '\x2', + 'L', '\x209', '\x3', '\x2', '\x2', '\x2', 'N', '\x211', '\x3', '\x2', + '\x2', '\x2', 'P', '\x219', '\x3', '\x2', '\x2', '\x2', 'R', '\x221', + '\x3', '\x2', '\x2', '\x2', 'T', '\x229', '\x3', '\x2', '\x2', '\x2', + 'V', '\x231', '\x3', '\x2', '\x2', '\x2', 'X', '\x23D', '\x3', '\x2', + '\x2', '\x2', 'Z', '\x246', '\x3', '\x2', '\x2', '\x2', '\\', '\x250', + '\x3', '\x2', '\x2', '\x2', '^', '\x25B', '\x3', '\x2', '\x2', '\x2', + '`', '\x25F', '\x3', '\x2', '\x2', '\x2', '\x62', '\x277', '\x3', '\x2', + '\x2', '\x2', '\x64', '\x279', '\x3', '\x2', '\x2', '\x2', '\x66', '\x27D', + '\x3', '\x2', '\x2', '\x2', 'h', '\x27F', '\x3', '\x2', '\x2', '\x2', + 'j', '\x281', '\x3', '\x2', '\x2', '\x2', 'l', '\x283', '\x3', '\x2', + '\x2', '\x2', 'n', '\x285', '\x3', '\x2', '\x2', '\x2', 'p', '\x28D', + '\x3', '\x2', '\x2', '\x2', 'r', '\x295', '\x3', '\x2', '\x2', '\x2', + 't', '\x29D', '\x3', '\x2', '\x2', '\x2', 'v', '\x2A5', '\x3', '\x2', + '\x2', '\x2', 'x', '\x2AF', '\x3', '\x2', '\x2', '\x2', 'z', '\x2B6', + '\x3', '\x2', '\x2', '\x2', '|', '\x2B9', '\x3', '\x2', '\x2', '\x2', + '~', '\x2BD', '\x3', '\x2', '\x2', '\x2', '\x80', '\x2BF', '\x3', '\x2', + '\x2', '\x2', '\x82', '\x2CE', '\x3', '\x2', '\x2', '\x2', '\x84', '\x86', + '\x5', '\x4', '\x3', '\x2', '\x85', '\x84', '\x3', '\x2', '\x2', '\x2', + '\x86', '\x89', '\x3', '\x2', '\x2', '\x2', '\x87', '\x85', '\x3', '\x2', + '\x2', '\x2', '\x87', '\x88', '\x3', '\x2', '\x2', '\x2', '\x88', '\x3', + '\x3', '\x2', '\x2', '\x2', '\x89', '\x87', '\x3', '\x2', '\x2', '\x2', + '\x8A', '\x8F', '\x5', '\x6', '\x4', '\x2', '\x8B', '\x8E', '\x5', '\b', + '\x5', '\x2', '\x8C', '\x8E', '\x5', '\n', '\x6', '\x2', '\x8D', '\x8B', + '\x3', '\x2', '\x2', '\x2', '\x8D', '\x8C', '\x3', '\x2', '\x2', '\x2', + '\x8E', '\x91', '\x3', '\x2', '\x2', '\x2', '\x8F', '\x8D', '\x3', '\x2', + '\x2', '\x2', '\x8F', '\x90', '\x3', '\x2', '\x2', '\x2', '\x90', '\x95', + '\x3', '\x2', '\x2', '\x2', '\x91', '\x8F', '\x3', '\x2', '\x2', '\x2', + '\x92', '\x94', '\x5', '\f', '\a', '\x2', '\x93', '\x92', '\x3', '\x2', + '\x2', '\x2', '\x94', '\x97', '\x3', '\x2', '\x2', '\x2', '\x95', '\x93', + '\x3', '\x2', '\x2', '\x2', '\x95', '\x96', '\x3', '\x2', '\x2', '\x2', + '\x96', '\x98', '\x3', '\x2', '\x2', '\x2', '\x97', '\x95', '\x3', '\x2', + '\x2', '\x2', '\x98', '\x99', '\a', '\x2', '\x2', '\x3', '\x99', '\x5', + '\x3', '\x2', '\x2', '\x2', '\x9A', '\x9B', '\a', '\x3', '\x2', '\x2', + '\x9B', '\xA0', '\a', 'R', '\x2', '\x2', '\x9C', '\x9D', '\a', '<', '\x2', + '\x2', '\x9D', '\x9F', '\a', 'R', '\x2', '\x2', '\x9E', '\x9C', '\x3', + '\x2', '\x2', '\x2', '\x9F', '\xA2', '\x3', '\x2', '\x2', '\x2', '\xA0', + '\x9E', '\x3', '\x2', '\x2', '\x2', '\xA0', '\xA1', '\x3', '\x2', '\x2', + '\x2', '\xA1', '\xA3', '\x3', '\x2', '\x2', '\x2', '\xA2', '\xA0', '\x3', + '\x2', '\x2', '\x2', '\xA3', '\xA4', '\a', 'J', '\x2', '\x2', '\xA4', + '\a', '\x3', '\x2', '\x2', '\x2', '\xA5', '\xA6', '\a', '\x1B', '\x2', + '\x2', '\xA6', '\xAB', '\a', 'R', '\x2', '\x2', '\xA7', '\xA8', '\a', + '<', '\x2', '\x2', '\xA8', '\xAA', '\a', 'R', '\x2', '\x2', '\xA9', '\xA7', + '\x3', '\x2', '\x2', '\x2', '\xAA', '\xAD', '\x3', '\x2', '\x2', '\x2', + '\xAB', '\xA9', '\x3', '\x2', '\x2', '\x2', '\xAB', '\xAC', '\x3', '\x2', + '\x2', '\x2', '\xAC', '\xAE', '\x3', '\x2', '\x2', '\x2', '\xAD', '\xAB', + '\x3', '\x2', '\x2', '\x2', '\xAE', '\xAF', '\a', 'J', '\x2', '\x2', '\xAF', + '\t', '\x3', '\x2', '\x2', '\x2', '\xB0', '\xB1', '\a', '\x1A', '\x2', + '\x2', '\xB1', '\xB6', '\a', 'R', '\x2', '\x2', '\xB2', '\xB3', '\a', + '<', '\x2', '\x2', '\xB3', '\xB5', '\a', 'R', '\x2', '\x2', '\xB4', '\xB2', + '\x3', '\x2', '\x2', '\x2', '\xB5', '\xB8', '\x3', '\x2', '\x2', '\x2', + '\xB6', '\xB4', '\x3', '\x2', '\x2', '\x2', '\xB6', '\xB7', '\x3', '\x2', + '\x2', '\x2', '\xB7', '\xB9', '\x3', '\x2', '\x2', '\x2', '\xB8', '\xB6', + '\x3', '\x2', '\x2', '\x2', '\xB9', '\xBA', '\a', 'J', '\x2', '\x2', '\xBA', + '\v', '\x3', '\x2', '\x2', '\x2', '\xBB', '\xC3', '\x5', '\xE', '\b', + '\x2', '\xBC', '\xC3', '\x5', '\x10', '\t', '\x2', '\xBD', '\xC3', '\x5', + '\x12', '\n', '\x2', '\xBE', '\xC3', '\x5', '\x14', '\v', '\x2', '\xBF', + '\xC3', '\x5', '\x16', '\f', '\x2', '\xC0', '\xC3', '\x5', '\x18', '\r', + '\x2', '\xC1', '\xC3', '\x5', '\x1C', '\xF', '\x2', '\xC2', '\xBB', '\x3', + '\x2', '\x2', '\x2', '\xC2', '\xBC', '\x3', '\x2', '\x2', '\x2', '\xC2', + '\xBD', '\x3', '\x2', '\x2', '\x2', '\xC2', '\xBE', '\x3', '\x2', '\x2', + '\x2', '\xC2', '\xBF', '\x3', '\x2', '\x2', '\x2', '\xC2', '\xC0', '\x3', + '\x2', '\x2', '\x2', '\xC2', '\xC1', '\x3', '\x2', '\x2', '\x2', '\xC3', + '\r', '\x3', '\x2', '\x2', '\x2', '\xC4', '\xC7', '\x5', '\x66', '\x34', + '\x2', '\xC5', '\xC7', '\x5', 'h', '\x35', '\x2', '\xC6', '\xC4', '\x3', + '\x2', '\x2', '\x2', '\xC6', '\xC5', '\x3', '\x2', '\x2', '\x2', '\xC6', + '\xC7', '\x3', '\x2', '\x2', '\x2', '\xC7', '\xCA', '\x3', '\x2', '\x2', + '\x2', '\xC8', '\xCB', '\x5', 'l', '\x37', '\x2', '\xC9', '\xCB', '\x5', + 'j', '\x36', '\x2', '\xCA', '\xC8', '\x3', '\x2', '\x2', '\x2', '\xCA', + '\xC9', '\x3', '\x2', '\x2', '\x2', '\xCA', '\xCB', '\x3', '\x2', '\x2', + '\x2', '\xCB', '\xCC', '\x3', '\x2', '\x2', '\x2', '\xCC', '\xCD', '\a', + '\x4', '\x2', '\x2', '\xCD', '\xD0', '\a', 'R', '\x2', '\x2', '\xCE', + '\xCF', '\a', '>', '\x2', '\x2', '\xCF', '\xD1', '\x5', 't', ';', '\x2', + '\xD0', '\xCE', '\x3', '\x2', '\x2', '\x2', '\xD0', '\xD1', '\x3', '\x2', + '\x2', '\x2', '\xD1', '\xD4', '\x3', '\x2', '\x2', '\x2', '\xD2', '\xD5', + '\x5', ':', '\x1E', '\x2', '\xD3', '\xD5', '\a', 'J', '\x2', '\x2', '\xD4', + '\xD2', '\x3', '\x2', '\x2', '\x2', '\xD4', '\xD3', '\x3', '\x2', '\x2', + '\x2', '\xD5', '\xF', '\x3', '\x2', '\x2', '\x2', '\xD6', '\xD9', '\x5', + '\x66', '\x34', '\x2', '\xD7', '\xD9', '\x5', 'h', '\x35', '\x2', '\xD8', + '\xD6', '\x3', '\x2', '\x2', '\x2', '\xD8', '\xD7', '\x3', '\x2', '\x2', + '\x2', '\xD8', '\xD9', '\x3', '\x2', '\x2', '\x2', '\xD9', '\xDA', '\x3', + '\x2', '\x2', '\x2', '\xDA', '\xDB', '\a', '\x5', '\x2', '\x2', '\xDB', + '\xDE', '\a', 'R', '\x2', '\x2', '\xDC', '\xDF', '\x5', ':', '\x1E', '\x2', + '\xDD', '\xDF', '\a', 'J', '\x2', '\x2', '\xDE', '\xDC', '\x3', '\x2', + '\x2', '\x2', '\xDE', '\xDD', '\x3', '\x2', '\x2', '\x2', '\xDF', '\x11', + '\x3', '\x2', '\x2', '\x2', '\xE0', '\xE3', '\x5', '\x66', '\x34', '\x2', + '\xE1', '\xE3', '\x5', 'h', '\x35', '\x2', '\xE2', '\xE0', '\x3', '\x2', + '\x2', '\x2', '\xE2', '\xE1', '\x3', '\x2', '\x2', '\x2', '\xE2', '\xE3', + '\x3', '\x2', '\x2', '\x2', '\xE3', '\xE6', '\x3', '\x2', '\x2', '\x2', + '\xE4', '\xE7', '\x5', 'l', '\x37', '\x2', '\xE5', '\xE7', '\x5', 'j', + '\x36', '\x2', '\xE6', '\xE4', '\x3', '\x2', '\x2', '\x2', '\xE6', '\xE5', + '\x3', '\x2', '\x2', '\x2', '\xE6', '\xE7', '\x3', '\x2', '\x2', '\x2', + '\xE7', '\xE9', '\x3', '\x2', '\x2', '\x2', '\xE8', '\xEA', '\a', '\b', + '\x2', '\x2', '\xE9', '\xE8', '\x3', '\x2', '\x2', '\x2', '\xE9', '\xEA', + '\x3', '\x2', '\x2', '\x2', '\xEA', '\xEC', '\x3', '\x2', '\x2', '\x2', + '\xEB', '\xED', '\a', '\t', '\x2', '\x2', '\xEC', '\xEB', '\x3', '\x2', + '\x2', '\x2', '\xEC', '\xED', '\x3', '\x2', '\x2', '\x2', '\xED', '\xEE', + '\x3', '\x2', '\x2', '\x2', '\xEE', '\xEF', '\a', '\n', '\x2', '\x2', + '\xEF', '\xF2', '\a', 'R', '\x2', '\x2', '\xF0', '\xF1', '\a', '\a', '\x2', + '\x2', '\xF1', '\xF3', '\a', 'R', '\x2', '\x2', '\xF2', '\xF0', '\x3', + '\x2', '\x2', '\x2', '\xF2', '\xF3', '\x3', '\x2', '\x2', '\x2', '\xF3', + '\xF4', '\x3', '\x2', '\x2', '\x2', '\xF4', '\xF6', '\a', '\x45', '\x2', + '\x2', '\xF5', '\xF7', '\x5', 'p', '\x39', '\x2', '\xF6', '\xF5', '\x3', + '\x2', '\x2', '\x2', '\xF6', '\xF7', '\x3', '\x2', '\x2', '\x2', '\xF7', + '\xF8', '\x3', '\x2', '\x2', '\x2', '\xF8', '\xF9', '\a', '\x46', '\x2', + '\x2', '\xF9', '\xFA', '\a', 'J', '\x2', '\x2', '\xFA', '\x13', '\x3', + '\x2', '\x2', '\x2', '\xFB', '\xFE', '\x5', '\x66', '\x34', '\x2', '\xFC', + '\xFE', '\x5', 'h', '\x35', '\x2', '\xFD', '\xFB', '\x3', '\x2', '\x2', + '\x2', '\xFD', '\xFC', '\x3', '\x2', '\x2', '\x2', '\xFD', '\xFE', '\x3', + '\x2', '\x2', '\x2', '\xFE', '\x101', '\x3', '\x2', '\x2', '\x2', '\xFF', + '\x102', '\x5', 'l', '\x37', '\x2', '\x100', '\x102', '\x5', 'j', '\x36', + '\x2', '\x101', '\xFF', '\x3', '\x2', '\x2', '\x2', '\x101', '\x100', + '\x3', '\x2', '\x2', '\x2', '\x101', '\x102', '\x3', '\x2', '\x2', '\x2', + '\x102', '\x103', '\x3', '\x2', '\x2', '\x2', '\x103', '\x104', '\a', + '\n', '\x2', '\x2', '\x104', '\x105', '\a', 'R', '\x2', '\x2', '\x105', + '\x107', '\a', '\x45', '\x2', '\x2', '\x106', '\x108', '\x5', 'p', '\x39', + '\x2', '\x107', '\x106', '\x3', '\x2', '\x2', '\x2', '\x107', '\x108', + '\x3', '\x2', '\x2', '\x2', '\x108', '\x109', '\x3', '\x2', '\x2', '\x2', + '\x109', '\x10C', '\a', '\x46', '\x2', '\x2', '\x10A', '\x10D', '\x5', + ':', '\x1E', '\x2', '\x10B', '\x10D', '\a', 'J', '\x2', '\x2', '\x10C', + '\x10A', '\x3', '\x2', '\x2', '\x2', '\x10C', '\x10B', '\x3', '\x2', '\x2', + '\x2', '\x10D', '\x15', '\x3', '\x2', '\x2', '\x2', '\x10E', '\x111', + '\x5', '\x66', '\x34', '\x2', '\x10F', '\x111', '\x5', 'h', '\x35', '\x2', + '\x110', '\x10E', '\x3', '\x2', '\x2', '\x2', '\x110', '\x10F', '\x3', + '\x2', '\x2', '\x2', '\x110', '\x111', '\x3', '\x2', '\x2', '\x2', '\x111', + '\x113', '\x3', '\x2', '\x2', '\x2', '\x112', '\x114', '\x5', 'l', '\x37', + '\x2', '\x113', '\x112', '\x3', '\x2', '\x2', '\x2', '\x113', '\x114', + '\x3', '\x2', '\x2', '\x2', '\x114', '\x115', '\x3', '\x2', '\x2', '\x2', + '\x115', '\x116', '\a', '\v', '\x2', '\x2', '\x116', '\x117', '\a', 'R', + '\x2', '\x2', '\x117', '\x118', '\a', ' ', '\x2', '\x2', '\x118', '\x119', + '\a', '\x6', '\x2', '\x2', '\x119', '\x11E', '\a', 'R', '\x2', '\x2', + '\x11A', '\x11B', '\a', '<', '\x2', '\x2', '\x11B', '\x11D', '\a', 'R', + '\x2', '\x2', '\x11C', '\x11A', '\x3', '\x2', '\x2', '\x2', '\x11D', '\x120', + '\x3', '\x2', '\x2', '\x2', '\x11E', '\x11C', '\x3', '\x2', '\x2', '\x2', + '\x11E', '\x11F', '\x3', '\x2', '\x2', '\x2', '\x11F', '\x121', '\x3', + '\x2', '\x2', '\x2', '\x120', '\x11E', '\x3', '\x2', '\x2', '\x2', '\x121', + '\x123', '\a', '\x45', '\x2', '\x2', '\x122', '\x124', '\x5', 'r', ':', + '\x2', '\x123', '\x122', '\x3', '\x2', '\x2', '\x2', '\x123', '\x124', + '\x3', '\x2', '\x2', '\x2', '\x124', '\x125', '\x3', '\x2', '\x2', '\x2', + '\x125', '\x12B', '\a', '\x46', '\x2', '\x2', '\x126', '\x12C', '\a', + 'J', '\x2', '\x2', '\x127', '\x128', '\a', 'W', '\x2', '\x2', '\x128', + '\x129', '\x5', 'n', '\x38', '\x2', '\x129', '\x12A', '\a', 'X', '\x2', + '\x2', '\x12A', '\x12C', '\x3', '\x2', '\x2', '\x2', '\x12B', '\x126', + '\x3', '\x2', '\x2', '\x2', '\x12B', '\x127', '\x3', '\x2', '\x2', '\x2', + '\x12C', '\x13F', '\x3', '\x2', '\x2', '\x2', '\x12D', '\x12E', '\a', + 'R', '\x2', '\x2', '\x12E', '\x12F', '\a', ' ', '\x2', '\x2', '\x12F', + '\x130', '\a', '\x6', '\x2', '\x2', '\x130', '\x135', '\a', 'R', '\x2', + '\x2', '\x131', '\x132', '\a', '<', '\x2', '\x2', '\x132', '\x134', '\a', + 'R', '\x2', '\x2', '\x133', '\x131', '\x3', '\x2', '\x2', '\x2', '\x134', + '\x137', '\x3', '\x2', '\x2', '\x2', '\x135', '\x133', '\x3', '\x2', '\x2', + '\x2', '\x135', '\x136', '\x3', '\x2', '\x2', '\x2', '\x136', '\x138', + '\x3', '\x2', '\x2', '\x2', '\x137', '\x135', '\x3', '\x2', '\x2', '\x2', + '\x138', '\x13A', '\a', '\x45', '\x2', '\x2', '\x139', '\x13B', '\x5', + 'r', ':', '\x2', '\x13A', '\x139', '\x3', '\x2', '\x2', '\x2', '\x13A', + '\x13B', '\x3', '\x2', '\x2', '\x2', '\x13B', '\x13C', '\x3', '\x2', '\x2', + '\x2', '\x13C', '\x13D', '\a', '\x46', '\x2', '\x2', '\x13D', '\x13F', + '\a', 'J', '\x2', '\x2', '\x13E', '\x110', '\x3', '\x2', '\x2', '\x2', + '\x13E', '\x12D', '\x3', '\x2', '\x2', '\x2', '\x13F', '\x17', '\x3', + '\x2', '\x2', '\x2', '\x140', '\x143', '\x5', '\x66', '\x34', '\x2', '\x141', + '\x143', '\x5', 'h', '\x35', '\x2', '\x142', '\x140', '\x3', '\x2', '\x2', + '\x2', '\x142', '\x141', '\x3', '\x2', '\x2', '\x2', '\x142', '\x143', + '\x3', '\x2', '\x2', '\x2', '\x143', '\x145', '\x3', '\x2', '\x2', '\x2', + '\x144', '\x146', '\x5', 'l', '\x37', '\x2', '\x145', '\x144', '\x3', + '\x2', '\x2', '\x2', '\x145', '\x146', '\x3', '\x2', '\x2', '\x2', '\x146', + '\x147', '\x3', '\x2', '\x2', '\x2', '\x147', '\x148', '\a', '\v', '\x2', + '\x2', '\x148', '\x14E', '\a', 'R', '\x2', '\x2', '\x149', '\x14A', '\a', + ' ', '\x2', '\x2', '\x14A', '\x14C', '\x5', '\x1E', '\x10', '\x2', '\x14B', + '\x149', '\x3', '\x2', '\x2', '\x2', '\x14B', '\x14C', '\x3', '\x2', '\x2', + '\x2', '\x14C', '\x14F', '\x3', '\x2', '\x2', '\x2', '\x14D', '\x14F', + '\a', 'J', '\x2', '\x2', '\x14E', '\x14B', '\x3', '\x2', '\x2', '\x2', + '\x14E', '\x14D', '\x3', '\x2', '\x2', '\x2', '\x14F', '\x19', '\x3', + '\x2', '\x2', '\x2', '\x150', '\x154', '\x5', '\f', '\a', '\x2', '\x151', + '\x153', '\x5', '\f', '\a', '\x2', '\x152', '\x151', '\x3', '\x2', '\x2', + '\x2', '\x153', '\x156', '\x3', '\x2', '\x2', '\x2', '\x154', '\x152', + '\x3', '\x2', '\x2', '\x2', '\x154', '\x155', '\x3', '\x2', '\x2', '\x2', + '\x155', '\x1B', '\x3', '\x2', '\x2', '\x2', '\x156', '\x154', '\x3', + '\x2', '\x2', '\x2', '\x157', '\x163', '\x5', '\x1E', '\x10', '\x2', '\x158', + '\x163', '\x5', '(', '\x15', '\x2', '\x159', '\x163', '\x5', '*', '\x16', + '\x2', '\x15A', '\x163', '\x5', ',', '\x17', '\x2', '\x15B', '\x163', + '\x5', '.', '\x18', '\x2', '\x15C', '\x163', '\x5', '\x30', '\x19', '\x2', + '\x15D', '\x163', '\x5', '\x32', '\x1A', '\x2', '\x15E', '\x163', '\x5', + '\x34', '\x1B', '\x2', '\x15F', '\x163', '\x5', '\x36', '\x1C', '\x2', + '\x160', '\x163', '\x5', '\x38', '\x1D', '\x2', '\x161', '\x163', '\x5', + ':', '\x1E', '\x2', '\x162', '\x157', '\x3', '\x2', '\x2', '\x2', '\x162', + '\x158', '\x3', '\x2', '\x2', '\x2', '\x162', '\x159', '\x3', '\x2', '\x2', + '\x2', '\x162', '\x15A', '\x3', '\x2', '\x2', '\x2', '\x162', '\x15B', + '\x3', '\x2', '\x2', '\x2', '\x162', '\x15C', '\x3', '\x2', '\x2', '\x2', + '\x162', '\x15D', '\x3', '\x2', '\x2', '\x2', '\x162', '\x15E', '\x3', + '\x2', '\x2', '\x2', '\x162', '\x15F', '\x3', '\x2', '\x2', '\x2', '\x162', + '\x160', '\x3', '\x2', '\x2', '\x2', '\x162', '\x161', '\x3', '\x2', '\x2', + '\x2', '\x163', '\x1D', '\x3', '\x2', '\x2', '\x2', '\x164', '\x165', + '\x5', '<', '\x1F', '\x2', '\x165', '\x166', '\a', 'J', '\x2', '\x2', + '\x166', '\x1F', '\x3', '\x2', '\x2', '\x2', '\x167', '\x16A', '\a', 'R', + '\x2', '\x2', '\x168', '\x169', '\a', ' ', '\x2', '\x2', '\x169', '\x16B', + '\x5', '<', '\x1F', '\x2', '\x16A', '\x168', '\x3', '\x2', '\x2', '\x2', + '\x16A', '\x16B', '\x3', '\x2', '\x2', '\x2', '\x16B', '!', '\x3', '\x2', + '\x2', '\x2', '\x16C', '\x16D', '\a', '\v', '\x2', '\x2', '\x16D', '\x172', + '\x5', ' ', '\x11', '\x2', '\x16E', '\x16F', '\a', 'I', '\x2', '\x2', + '\x16F', '\x171', '\x5', ' ', '\x11', '\x2', '\x170', '\x16E', '\x3', + '\x2', '\x2', '\x2', '\x171', '\x174', '\x3', '\x2', '\x2', '\x2', '\x172', + '\x170', '\x3', '\x2', '\x2', '\x2', '\x172', '\x173', '\x3', '\x2', '\x2', + '\x2', '\x173', '#', '\x3', '\x2', '\x2', '\x2', '\x174', '\x172', '\x3', + '\x2', '\x2', '\x2', '\x175', '\x17F', '\x5', '\"', '\x12', '\x2', '\x176', + '\x17B', '\x5', '<', '\x1F', '\x2', '\x177', '\x178', '\a', 'I', '\x2', + '\x2', '\x178', '\x17A', '\x5', '<', '\x1F', '\x2', '\x179', '\x177', + '\x3', '\x2', '\x2', '\x2', '\x17A', '\x17D', '\x3', '\x2', '\x2', '\x2', + '\x17B', '\x179', '\x3', '\x2', '\x2', '\x2', '\x17B', '\x17C', '\x3', + '\x2', '\x2', '\x2', '\x17C', '\x17F', '\x3', '\x2', '\x2', '\x2', '\x17D', + '\x17B', '\x3', '\x2', '\x2', '\x2', '\x17E', '\x175', '\x3', '\x2', '\x2', + '\x2', '\x17E', '\x176', '\x3', '\x2', '\x2', '\x2', '\x17F', '%', '\x3', + '\x2', '\x2', '\x2', '\x180', '\x185', '\x5', '<', '\x1F', '\x2', '\x181', + '\x182', '\a', 'I', '\x2', '\x2', '\x182', '\x184', '\x5', '<', '\x1F', + '\x2', '\x183', '\x181', '\x3', '\x2', '\x2', '\x2', '\x184', '\x187', + '\x3', '\x2', '\x2', '\x2', '\x185', '\x183', '\x3', '\x2', '\x2', '\x2', + '\x185', '\x186', '\x3', '\x2', '\x2', '\x2', '\x186', '\'', '\x3', '\x2', + '\x2', '\x2', '\x187', '\x185', '\x3', '\x2', '\x2', '\x2', '\x188', '\x189', + '\a', '\xE', '\x2', '\x2', '\x189', '\x18B', '\a', '\x45', '\x2', '\x2', + '\x18A', '\x18C', '\x5', '$', '\x13', '\x2', '\x18B', '\x18A', '\x3', + '\x2', '\x2', '\x2', '\x18B', '\x18C', '\x3', '\x2', '\x2', '\x2', '\x18C', + '\x18D', '\x3', '\x2', '\x2', '\x2', '\x18D', '\x18F', '\a', 'J', '\x2', + '\x2', '\x18E', '\x190', '\x5', '<', '\x1F', '\x2', '\x18F', '\x18E', + '\x3', '\x2', '\x2', '\x2', '\x18F', '\x190', '\x3', '\x2', '\x2', '\x2', + '\x190', '\x191', '\x3', '\x2', '\x2', '\x2', '\x191', '\x193', '\a', + 'J', '\x2', '\x2', '\x192', '\x194', '\x5', '&', '\x14', '\x2', '\x193', + '\x192', '\x3', '\x2', '\x2', '\x2', '\x193', '\x194', '\x3', '\x2', '\x2', + '\x2', '\x194', '\x195', '\x3', '\x2', '\x2', '\x2', '\x195', '\x197', + '\a', '\x46', '\x2', '\x2', '\x196', '\x198', '\x5', '\x1C', '\xF', '\x2', + '\x197', '\x196', '\x3', '\x2', '\x2', '\x2', '\x197', '\x198', '\x3', + '\x2', '\x2', '\x2', '\x198', ')', '\x3', '\x2', '\x2', '\x2', '\x199', + '\x19A', '\a', '\x14', '\x2', '\x2', '\x19A', '\x19B', '\a', '\x45', '\x2', + '\x2', '\x19B', '\x19C', '\x5', '<', '\x1F', '\x2', '\x19C', '\x19D', + '\a', '\x46', '\x2', '\x2', '\x19D', '\x1A0', '\x5', '\x1C', '\xF', '\x2', + '\x19E', '\x19F', '\a', '\x15', '\x2', '\x2', '\x19F', '\x1A1', '\x5', + '\x1C', '\xF', '\x2', '\x1A0', '\x19E', '\x3', '\x2', '\x2', '\x2', '\x1A0', + '\x1A1', '\x3', '\x2', '\x2', '\x2', '\x1A1', '+', '\x3', '\x2', '\x2', + '\x2', '\x1A2', '\x1A4', '\a', '\x16', '\x2', '\x2', '\x1A3', '\x1A5', + '\x5', '<', '\x1F', '\x2', '\x1A4', '\x1A3', '\x3', '\x2', '\x2', '\x2', + '\x1A4', '\x1A5', '\x3', '\x2', '\x2', '\x2', '\x1A5', '\x1A6', '\x3', + '\x2', '\x2', '\x2', '\x1A6', '\x1A7', '\a', 'J', '\x2', '\x2', '\x1A7', + '-', '\x3', '\x2', '\x2', '\x2', '\x1A8', '\x1A9', '\a', '\x17', '\x2', + '\x2', '\x1A9', '\x1AA', '\a', 'J', '\x2', '\x2', '\x1AA', '/', '\x3', + '\x2', '\x2', '\x2', '\x1AB', '\x1AC', '\a', '\x1A', '\x2', '\x2', '\x1AC', + '\x1AD', '\a', '\x45', '\x2', '\x2', '\x1AD', '\x1AE', '\x5', '<', '\x1F', + '\x2', '\x1AE', '\x1AF', '\a', '\x46', '\x2', '\x2', '\x1AF', '\x1B0', + '\x5', ':', '\x1E', '\x2', '\x1B0', '\x31', '\x3', '\x2', '\x2', '\x2', + '\x1B1', '\x1B2', '\a', '\x1C', '\x2', '\x2', '\x1B2', '\x1B3', '\a', + '\x1E', '\x2', '\x2', '\x1B3', '\x1B4', '\a', '\x45', '\x2', '\x2', '\x1B4', + '\x1B5', '\x5', '<', '\x1F', '\x2', '\x1B5', '\x1B6', '\a', '\x46', '\x2', + '\x2', '\x1B6', '\x33', '\x3', '\x2', '\x2', '\x2', '\x1B7', '\x1B8', + '\a', '\x1D', '\x2', '\x2', '\x1B8', '\x1B9', '\a', '\x1E', '\x2', '\x2', + '\x1B9', '\x1BA', '\a', '\x45', '\x2', '\x2', '\x1BA', '\x1BB', '\x5', + '<', '\x1F', '\x2', '\x1BB', '\x1BC', '\a', '\x46', '\x2', '\x2', '\x1BC', + '\x35', '\x3', '\x2', '\x2', '\x2', '\x1BD', '\x1BE', '\a', '\xF', '\x2', + '\x2', '\x1BE', '\x1BF', '\a', '\x45', '\x2', '\x2', '\x1BF', '\x1C0', + '\x5', '<', '\x1F', '\x2', '\x1C0', '\x1C1', '\a', '\x46', '\x2', '\x2', + '\x1C1', '\x1C2', '\x5', ':', '\x1E', '\x2', '\x1C2', '\x37', '\x3', '\x2', + '\x2', '\x2', '\x1C3', '\x1C4', '\a', '\x1F', '\x2', '\x2', '\x1C4', '\x1C5', + '\x5', ':', '\x1E', '\x2', '\x1C5', '\x39', '\x3', '\x2', '\x2', '\x2', + '\x1C6', '\x1CA', '\a', 'W', '\x2', '\x2', '\x1C7', '\x1C9', '\x5', '\f', + '\a', '\x2', '\x1C8', '\x1C7', '\x3', '\x2', '\x2', '\x2', '\x1C9', '\x1CC', + '\x3', '\x2', '\x2', '\x2', '\x1CA', '\x1C8', '\x3', '\x2', '\x2', '\x2', + '\x1CA', '\x1CB', '\x3', '\x2', '\x2', '\x2', '\x1CB', '\x1CD', '\x3', + '\x2', '\x2', '\x2', '\x1CC', '\x1CA', '\x3', '\x2', '\x2', '\x2', '\x1CD', + '\x1CE', '\a', 'X', '\x2', '\x2', '\x1CE', ';', '\x3', '\x2', '\x2', '\x2', + '\x1CF', '\x1D2', '\x5', '>', ' ', '\x2', '\x1D0', '\x1D2', '\x5', '@', + '!', '\x2', '\x1D1', '\x1CF', '\x3', '\x2', '\x2', '\x2', '\x1D1', '\x1D0', + '\x3', '\x2', '\x2', '\x2', '\x1D2', '=', '\x3', '\x2', '\x2', '\x2', + '\x1D3', '\x1D4', '\x5', 'Z', '.', '\x2', '\x1D4', '\x1D5', '\t', '\x2', + '\x2', '\x2', '\x1D5', '\x1D6', '\x5', '>', ' ', '\x2', '\x1D6', '\x1D9', + '\x3', '\x2', '\x2', '\x2', '\x1D7', '\x1D9', '\x5', '\x42', '\"', '\x2', + '\x1D8', '\x1D3', '\x3', '\x2', '\x2', '\x2', '\x1D8', '\x1D7', '\x3', + '\x2', '\x2', '\x2', '\x1D9', '?', '\x3', '\x2', '\x2', '\x2', '\x1DA', + '\x1DB', '\x5', 'v', '<', '\x2', '\x1DB', '\x1DC', '\a', '?', '\x2', '\x2', + '\x1DC', '\x1DD', '\x5', ':', '\x1E', '\x2', '\x1DD', '\x41', '\x3', '\x2', + '\x2', '\x2', '\x1DE', '\x1E6', '\x5', '\x44', '#', '\x2', '\x1DF', '\x1E0', + '\a', '=', '\x2', '\x2', '\x1E0', '\x1E1', '\x5', '\x44', '#', '\x2', + '\x1E1', '\x1E2', '\a', '>', '\x2', '\x2', '\x1E2', '\x1E3', '\x5', '\x44', + '#', '\x2', '\x1E3', '\x1E5', '\x3', '\x2', '\x2', '\x2', '\x1E4', '\x1DF', + '\x3', '\x2', '\x2', '\x2', '\x1E5', '\x1E8', '\x3', '\x2', '\x2', '\x2', + '\x1E6', '\x1E4', '\x3', '\x2', '\x2', '\x2', '\x1E6', '\x1E7', '\x3', + '\x2', '\x2', '\x2', '\x1E7', '\x43', '\x3', '\x2', '\x2', '\x2', '\x1E8', + '\x1E6', '\x3', '\x2', '\x2', '\x2', '\x1E9', '\x1EE', '\x5', '\x46', + '$', '\x2', '\x1EA', '\x1EB', '\a', '+', '\x2', '\x2', '\x1EB', '\x1ED', + '\x5', '\x46', '$', '\x2', '\x1EC', '\x1EA', '\x3', '\x2', '\x2', '\x2', + '\x1ED', '\x1F0', '\x3', '\x2', '\x2', '\x2', '\x1EE', '\x1EC', '\x3', + '\x2', '\x2', '\x2', '\x1EE', '\x1EF', '\x3', '\x2', '\x2', '\x2', '\x1EF', + '\x45', '\x3', '\x2', '\x2', '\x2', '\x1F0', '\x1EE', '\x3', '\x2', '\x2', + '\x2', '\x1F1', '\x1F6', '\x5', 'H', '%', '\x2', '\x1F2', '\x1F3', '\a', + ',', '\x2', '\x2', '\x1F3', '\x1F5', '\x5', 'H', '%', '\x2', '\x1F4', + '\x1F2', '\x3', '\x2', '\x2', '\x2', '\x1F5', '\x1F8', '\x3', '\x2', '\x2', + '\x2', '\x1F6', '\x1F4', '\x3', '\x2', '\x2', '\x2', '\x1F6', '\x1F7', + '\x3', '\x2', '\x2', '\x2', '\x1F7', 'G', '\x3', '\x2', '\x2', '\x2', + '\x1F8', '\x1F6', '\x3', '\x2', '\x2', '\x2', '\x1F9', '\x1FE', '\x5', + 'J', '&', '\x2', '\x1FA', '\x1FB', '\a', '\x44', '\x2', '\x2', '\x1FB', + '\x1FD', '\x5', 'J', '&', '\x2', '\x1FC', '\x1FA', '\x3', '\x2', '\x2', + '\x2', '\x1FD', '\x200', '\x3', '\x2', '\x2', '\x2', '\x1FE', '\x1FC', + '\x3', '\x2', '\x2', '\x2', '\x1FE', '\x1FF', '\x3', '\x2', '\x2', '\x2', + '\x1FF', 'I', '\x3', '\x2', '\x2', '\x2', '\x200', '\x1FE', '\x3', '\x2', + '\x2', '\x2', '\x201', '\x206', '\x5', 'L', '\'', '\x2', '\x202', '\x203', + '\a', '\x43', '\x2', '\x2', '\x203', '\x205', '\x5', 'L', '\'', '\x2', + '\x204', '\x202', '\x3', '\x2', '\x2', '\x2', '\x205', '\x208', '\x3', + '\x2', '\x2', '\x2', '\x206', '\x204', '\x3', '\x2', '\x2', '\x2', '\x206', + '\x207', '\x3', '\x2', '\x2', '\x2', '\x207', 'K', '\x3', '\x2', '\x2', + '\x2', '\x208', '\x206', '\x3', '\x2', '\x2', '\x2', '\x209', '\x20E', + '\x5', 'N', '(', '\x2', '\x20A', '\x20B', '\a', '\x42', '\x2', '\x2', + '\x20B', '\x20D', '\x5', 'N', '(', '\x2', '\x20C', '\x20A', '\x3', '\x2', + '\x2', '\x2', '\x20D', '\x210', '\x3', '\x2', '\x2', '\x2', '\x20E', '\x20C', + '\x3', '\x2', '\x2', '\x2', '\x20E', '\x20F', '\x3', '\x2', '\x2', '\x2', + '\x20F', 'M', '\x3', '\x2', '\x2', '\x2', '\x210', '\x20E', '\x3', '\x2', + '\x2', '\x2', '\x211', '\x216', '\x5', 'P', ')', '\x2', '\x212', '\x213', + '\t', '\x3', '\x2', '\x2', '\x213', '\x215', '\x5', 'P', ')', '\x2', '\x214', + '\x212', '\x3', '\x2', '\x2', '\x2', '\x215', '\x218', '\x3', '\x2', '\x2', + '\x2', '\x216', '\x214', '\x3', '\x2', '\x2', '\x2', '\x216', '\x217', + '\x3', '\x2', '\x2', '\x2', '\x217', 'O', '\x3', '\x2', '\x2', '\x2', + '\x218', '\x216', '\x3', '\x2', '\x2', '\x2', '\x219', '\x21E', '\x5', + 'R', '*', '\x2', '\x21A', '\x21B', '\t', '\x4', '\x2', '\x2', '\x21B', + '\x21D', '\x5', 'R', '*', '\x2', '\x21C', '\x21A', '\x3', '\x2', '\x2', + '\x2', '\x21D', '\x220', '\x3', '\x2', '\x2', '\x2', '\x21E', '\x21C', + '\x3', '\x2', '\x2', '\x2', '\x21E', '\x21F', '\x3', '\x2', '\x2', '\x2', + '\x21F', 'Q', '\x3', '\x2', '\x2', '\x2', '\x220', '\x21E', '\x3', '\x2', + '\x2', '\x2', '\x221', '\x226', '\x5', 'T', '+', '\x2', '\x222', '\x223', + '\t', '\x5', '\x2', '\x2', '\x223', '\x225', '\x5', 'T', '+', '\x2', '\x224', + '\x222', '\x3', '\x2', '\x2', '\x2', '\x225', '\x228', '\x3', '\x2', '\x2', + '\x2', '\x226', '\x224', '\x3', '\x2', '\x2', '\x2', '\x226', '\x227', + '\x3', '\x2', '\x2', '\x2', '\x227', 'S', '\x3', '\x2', '\x2', '\x2', + '\x228', '\x226', '\x3', '\x2', '\x2', '\x2', '\x229', '\x22E', '\x5', + 'V', ',', '\x2', '\x22A', '\x22B', '\t', '\x6', '\x2', '\x2', '\x22B', + '\x22D', '\x5', 'V', ',', '\x2', '\x22C', '\x22A', '\x3', '\x2', '\x2', + '\x2', '\x22D', '\x230', '\x3', '\x2', '\x2', '\x2', '\x22E', '\x22C', + '\x3', '\x2', '\x2', '\x2', '\x22E', '\x22F', '\x3', '\x2', '\x2', '\x2', + '\x22F', 'U', '\x3', '\x2', '\x2', '\x2', '\x230', '\x22E', '\x3', '\x2', + '\x2', '\x2', '\x231', '\x236', '\x5', 'X', '-', '\x2', '\x232', '\x233', + '\t', '\a', '\x2', '\x2', '\x233', '\x235', '\x5', 'X', '-', '\x2', '\x234', + '\x232', '\x3', '\x2', '\x2', '\x2', '\x235', '\x238', '\x3', '\x2', '\x2', + '\x2', '\x236', '\x234', '\x3', '\x2', '\x2', '\x2', '\x236', '\x237', + '\x3', '\x2', '\x2', '\x2', '\x237', 'W', '\x3', '\x2', '\x2', '\x2', + '\x238', '\x236', '\x3', '\x2', '\x2', '\x2', '\x239', '\x23A', '\b', + '-', '\x1', '\x2', '\x23A', '\x23B', '\t', '\b', '\x2', '\x2', '\x23B', + '\x23E', '\x5', 'X', '-', '\x5', '\x23C', '\x23E', '\x5', 'Z', '.', '\x2', + '\x23D', '\x239', '\x3', '\x2', '\x2', '\x2', '\x23D', '\x23C', '\x3', + '\x2', '\x2', '\x2', '\x23E', '\x243', '\x3', '\x2', '\x2', '\x2', '\x23F', + '\x240', '\f', '\x3', '\x2', '\x2', '\x240', '\x242', '\t', '\t', '\x2', + '\x2', '\x241', '\x23F', '\x3', '\x2', '\x2', '\x2', '\x242', '\x245', + '\x3', '\x2', '\x2', '\x2', '\x243', '\x241', '\x3', '\x2', '\x2', '\x2', + '\x243', '\x244', '\x3', '\x2', '\x2', '\x2', '\x244', 'Y', '\x3', '\x2', + '\x2', '\x2', '\x245', '\x243', '\x3', '\x2', '\x2', '\x2', '\x246', '\x24D', + '\x5', '\x62', '\x32', '\x2', '\x247', '\x24C', '\x5', 'v', '<', '\x2', + '\x248', '\x249', '\a', '<', '\x2', '\x2', '\x249', '\x24C', '\a', 'R', + '\x2', '\x2', '\x24A', '\x24C', '\x5', 'x', '=', '\x2', '\x24B', '\x247', + '\x3', '\x2', '\x2', '\x2', '\x24B', '\x248', '\x3', '\x2', '\x2', '\x2', + '\x24B', '\x24A', '\x3', '\x2', '\x2', '\x2', '\x24C', '\x24F', '\x3', + '\x2', '\x2', '\x2', '\x24D', '\x24B', '\x3', '\x2', '\x2', '\x2', '\x24D', + '\x24E', '\x3', '\x2', '\x2', '\x2', '\x24E', '[', '\x3', '\x2', '\x2', + '\x2', '\x24F', '\x24D', '\x3', '\x2', '\x2', '\x2', '\x250', '\x251', + '\a', 'G', '\x2', '\x2', '\x251', '\x256', '\x5', '<', '\x1F', '\x2', + '\x252', '\x253', '\a', 'I', '\x2', '\x2', '\x253', '\x255', '\x5', '<', + '\x1F', '\x2', '\x254', '\x252', '\x3', '\x2', '\x2', '\x2', '\x255', + '\x258', '\x3', '\x2', '\x2', '\x2', '\x256', '\x254', '\x3', '\x2', '\x2', + '\x2', '\x256', '\x257', '\x3', '\x2', '\x2', '\x2', '\x257', '\x259', + '\x3', '\x2', '\x2', '\x2', '\x258', '\x256', '\x3', '\x2', '\x2', '\x2', + '\x259', '\x25A', '\a', 'H', '\x2', '\x2', '\x25A', ']', '\x3', '\x2', + '\x2', '\x2', '\x25B', '\x25C', '\a', 'R', '\x2', '\x2', '\x25C', '\x25D', + '\a', '>', '\x2', '\x2', '\x25D', '\x25E', '\x5', '<', '\x1F', '\x2', + '\x25E', '_', '\x3', '\x2', '\x2', '\x2', '\x25F', '\x260', '\a', 'W', + '\x2', '\x2', '\x260', '\x265', '\x5', '^', '\x30', '\x2', '\x261', '\x262', + '\a', 'I', '\x2', '\x2', '\x262', '\x264', '\x5', '^', '\x30', '\x2', + '\x263', '\x261', '\x3', '\x2', '\x2', '\x2', '\x264', '\x267', '\x3', + '\x2', '\x2', '\x2', '\x265', '\x263', '\x3', '\x2', '\x2', '\x2', '\x265', + '\x266', '\x3', '\x2', '\x2', '\x2', '\x266', '\x268', '\x3', '\x2', '\x2', + '\x2', '\x267', '\x265', '\x3', '\x2', '\x2', '\x2', '\x268', '\x269', + '\a', 'X', '\x2', '\x2', '\x269', '\x61', '\x3', '\x2', '\x2', '\x2', + '\x26A', '\x278', '\a', 'L', '\x2', '\x2', '\x26B', '\x278', '\a', '\x18', + '\x2', '\x2', '\x26C', '\x278', '\a', '\x19', '\x2', '\x2', '\x26D', '\x278', + '\a', 'O', '\x2', '\x2', '\x26E', '\x278', '\a', 'P', '\x2', '\x2', '\x26F', + '\x270', '\a', '\x45', '\x2', '\x2', '\x270', '\x271', '\x5', '<', '\x1F', + '\x2', '\x271', '\x272', '\a', '\x46', '\x2', '\x2', '\x272', '\x278', + '\x3', '\x2', '\x2', '\x2', '\x273', '\x278', '\a', 'R', '\x2', '\x2', + '\x274', '\x278', '\x5', '\x80', '\x41', '\x2', '\x275', '\x278', '\x5', + '\\', '/', '\x2', '\x276', '\x278', '\x5', '`', '\x31', '\x2', '\x277', + '\x26A', '\x3', '\x2', '\x2', '\x2', '\x277', '\x26B', '\x3', '\x2', '\x2', + '\x2', '\x277', '\x26C', '\x3', '\x2', '\x2', '\x2', '\x277', '\x26D', + '\x3', '\x2', '\x2', '\x2', '\x277', '\x26E', '\x3', '\x2', '\x2', '\x2', + '\x277', '\x26F', '\x3', '\x2', '\x2', '\x2', '\x277', '\x273', '\x3', + '\x2', '\x2', '\x2', '\x277', '\x274', '\x3', '\x2', '\x2', '\x2', '\x277', + '\x275', '\x3', '\x2', '\x2', '\x2', '\x277', '\x276', '\x3', '\x2', '\x2', + '\x2', '\x278', '\x63', '\x3', '\x2', '\x2', '\x2', '\x279', '\x27A', + '\a', 'R', '\x2', '\x2', '\x27A', '\x27B', '\a', ' ', '\x2', '\x2', '\x27B', + '\x27C', '\x5', '<', '\x1F', '\x2', '\x27C', '\x65', '\x3', '\x2', '\x2', + '\x2', '\x27D', '\x27E', '\a', '\x13', '\x2', '\x2', '\x27E', 'g', '\x3', + '\x2', '\x2', '\x2', '\x27F', '\x280', '\a', '\x12', '\x2', '\x2', '\x280', + 'i', '\x3', '\x2', '\x2', '\x2', '\x281', '\x282', '\a', '\x11', '\x2', + '\x2', '\x282', 'k', '\x3', '\x2', '\x2', '\x2', '\x283', '\x284', '\a', + '\x10', '\x2', '\x2', '\x284', 'm', '\x3', '\x2', '\x2', '\x2', '\x285', + '\x28A', '\x5', '\x64', '\x33', '\x2', '\x286', '\x287', '\a', 'I', '\x2', + '\x2', '\x287', '\x289', '\x5', '\x64', '\x33', '\x2', '\x288', '\x286', + '\x3', '\x2', '\x2', '\x2', '\x289', '\x28C', '\x3', '\x2', '\x2', '\x2', + '\x28A', '\x288', '\x3', '\x2', '\x2', '\x2', '\x28A', '\x28B', '\x3', + '\x2', '\x2', '\x2', '\x28B', 'o', '\x3', '\x2', '\x2', '\x2', '\x28C', + '\x28A', '\x3', '\x2', '\x2', '\x2', '\x28D', '\x292', '\x5', '~', '@', + '\x2', '\x28E', '\x28F', '\a', 'I', '\x2', '\x2', '\x28F', '\x291', '\x5', + '~', '@', '\x2', '\x290', '\x28E', '\x3', '\x2', '\x2', '\x2', '\x291', + '\x294', '\x3', '\x2', '\x2', '\x2', '\x292', '\x290', '\x3', '\x2', '\x2', + '\x2', '\x292', '\x293', '\x3', '\x2', '\x2', '\x2', '\x293', 'q', '\x3', + '\x2', '\x2', '\x2', '\x294', '\x292', '\x3', '\x2', '\x2', '\x2', '\x295', + '\x29A', '\x5', '|', '?', '\x2', '\x296', '\x297', '\a', 'I', '\x2', '\x2', + '\x297', '\x299', '\x5', '|', '?', '\x2', '\x298', '\x296', '\x3', '\x2', + '\x2', '\x2', '\x299', '\x29C', '\x3', '\x2', '\x2', '\x2', '\x29A', '\x298', + '\x3', '\x2', '\x2', '\x2', '\x29A', '\x29B', '\x3', '\x2', '\x2', '\x2', + '\x29B', 's', '\x3', '\x2', '\x2', '\x2', '\x29C', '\x29A', '\x3', '\x2', + '\x2', '\x2', '\x29D', '\x2A2', '\a', 'R', '\x2', '\x2', '\x29E', '\x29F', + '\a', 'I', '\x2', '\x2', '\x29F', '\x2A1', '\a', 'R', '\x2', '\x2', '\x2A0', + '\x29E', '\x3', '\x2', '\x2', '\x2', '\x2A1', '\x2A4', '\x3', '\x2', '\x2', + '\x2', '\x2A2', '\x2A0', '\x3', '\x2', '\x2', '\x2', '\x2A2', '\x2A3', + '\x3', '\x2', '\x2', '\x2', '\x2A3', 'u', '\x3', '\x2', '\x2', '\x2', + '\x2A4', '\x2A2', '\x3', '\x2', '\x2', '\x2', '\x2A5', '\x2A7', '\a', + '\x45', '\x2', '\x2', '\x2A6', '\x2A8', '\x5', 'r', ':', '\x2', '\x2A7', + '\x2A6', '\x3', '\x2', '\x2', '\x2', '\x2A7', '\x2A8', '\x3', '\x2', '\x2', + '\x2', '\x2A8', '\x2A9', '\x3', '\x2', '\x2', '\x2', '\x2A9', '\x2AA', + '\a', '\x46', '\x2', '\x2', '\x2AA', 'w', '\x3', '\x2', '\x2', '\x2', + '\x2AB', '\x2AC', '\a', 'G', '\x2', '\x2', '\x2AC', '\x2AD', '\x5', 'z', + '>', '\x2', '\x2AD', '\x2AE', '\a', 'H', '\x2', '\x2', '\x2AE', '\x2B0', + '\x3', '\x2', '\x2', '\x2', '\x2AF', '\x2AB', '\x3', '\x2', '\x2', '\x2', + '\x2B0', '\x2B1', '\x3', '\x2', '\x2', '\x2', '\x2B1', '\x2AF', '\x3', + '\x2', '\x2', '\x2', '\x2B1', '\x2B2', '\x3', '\x2', '\x2', '\x2', '\x2B2', + 'y', '\x3', '\x2', '\x2', '\x2', '\x2B3', '\x2B7', '\a', 'O', '\x2', '\x2', + '\x2B4', '\x2B7', '\x5', '\x80', '\x41', '\x2', '\x2B5', '\x2B7', '\x5', + 'Z', '.', '\x2', '\x2B6', '\x2B3', '\x3', '\x2', '\x2', '\x2', '\x2B6', + '\x2B4', '\x3', '\x2', '\x2', '\x2', '\x2B6', '\x2B5', '\x3', '\x2', '\x2', + '\x2', '\x2B7', '{', '\x3', '\x2', '\x2', '\x2', '\x2B8', '\x2BA', '\a', + '?', '\x2', '\x2', '\x2B9', '\x2B8', '\x3', '\x2', '\x2', '\x2', '\x2B9', + '\x2BA', '\x3', '\x2', '\x2', '\x2', '\x2BA', '\x2BB', '\x3', '\x2', '\x2', + '\x2', '\x2BB', '\x2BC', '\x5', '<', '\x1F', '\x2', '\x2BC', '}', '\x3', + '\x2', '\x2', '\x2', '\x2BD', '\x2BE', '\a', 'R', '\x2', '\x2', '\x2BE', + '\x7F', '\x3', '\x2', '\x2', '\x2', '\x2BF', '\x2C3', '\a', 'V', '\x2', + '\x2', '\x2C0', '\x2C2', '\x5', '\x82', '\x42', '\x2', '\x2C1', '\x2C0', + '\x3', '\x2', '\x2', '\x2', '\x2C2', '\x2C5', '\x3', '\x2', '\x2', '\x2', + '\x2C3', '\x2C1', '\x3', '\x2', '\x2', '\x2', '\x2C3', '\x2C4', '\x3', + '\x2', '\x2', '\x2', '\x2C4', '\x2C6', '\x3', '\x2', '\x2', '\x2', '\x2C5', + '\x2C3', '\x3', '\x2', '\x2', '\x2', '\x2C6', '\x2C7', '\a', 'V', '\x2', + '\x2', '\x2C7', '\x81', '\x3', '\x2', '\x2', '\x2', '\x2C8', '\x2CF', + '\a', 'Y', '\x2', '\x2', '\x2C9', '\x2CF', '\a', '[', '\x2', '\x2', '\x2CA', + '\x2CB', '\a', 'Z', '\x2', '\x2', '\x2CB', '\x2CC', '\x5', '<', '\x1F', + '\x2', '\x2CC', '\x2CD', '\a', 'X', '\x2', '\x2', '\x2CD', '\x2CF', '\x3', + '\x2', '\x2', '\x2', '\x2CE', '\x2C8', '\x3', '\x2', '\x2', '\x2', '\x2CE', + '\x2C9', '\x3', '\x2', '\x2', '\x2', '\x2CE', '\x2CA', '\x3', '\x2', '\x2', + '\x2', '\x2CF', '\x83', '\x3', '\x2', '\x2', '\x2', 'R', '\x87', '\x8D', + '\x8F', '\x95', '\xA0', '\xAB', '\xB6', '\xC2', '\xC6', '\xCA', '\xD0', + '\xD4', '\xD8', '\xDE', '\xE2', '\xE6', '\xE9', '\xEC', '\xF2', '\xF6', + '\xFD', '\x101', '\x107', '\x10C', '\x110', '\x113', '\x11E', '\x123', + '\x12B', '\x135', '\x13A', '\x13E', '\x142', '\x145', '\x14B', '\x14E', + '\x154', '\x162', '\x16A', '\x172', '\x17B', '\x17E', '\x185', '\x18B', + '\x18F', '\x193', '\x197', '\x1A0', '\x1A4', '\x1CA', '\x1D1', '\x1D8', + '\x1E6', '\x1EE', '\x1F6', '\x1FE', '\x206', '\x20E', '\x216', '\x21E', + '\x226', '\x22E', '\x236', '\x23D', '\x243', '\x24B', '\x24D', '\x256', + '\x265', '\x277', '\x28A', '\x292', '\x29A', '\x2A2', '\x2A7', '\x2B1', + '\x2B6', '\x2B9', '\x2C3', '\x2CE', }; public static readonly ATN _ATN = diff --git a/Bite/AntlrGenerated/AntlrBiteParser/BITEParser.interp b/Bite/AntlrGenerated/AntlrBiteParser/BITEParser.interp index 87703e3..8f8a258 100644 --- a/Bite/AntlrGenerated/AntlrBiteParser/BITEParser.interp +++ b/Bite/AntlrGenerated/AntlrBiteParser/BITEParser.interp @@ -25,6 +25,10 @@ null 'this' 'using' 'import' +'start' +'use' +'thread' +'sync' '=' '+=' '-=' @@ -113,6 +117,10 @@ NullReference ThisReference UsingDirective ImportDirective +StartStatement +UseStatement +ThreadStatement +SyncKeyword AssignOperator PlusAssignOperator MinusAssignOperator @@ -152,10 +160,10 @@ BitwiseXorOperator BitwiseOrOperator OpeningRoundBracket ClosingRoundBracket -SquarebracketLeft -SquarebracketRight -CommaSeperator -SemicolonSeperator +SquareBracketLeft +SquareBracketRight +CommaSeparator +SemicolonSeparator DollarOperator BooleanLiteral False_ @@ -199,7 +207,10 @@ ifStatement returnStatement breakStatement usingStatement +startThreadStatement +useThreadStatement whileStatement +syncBlock block expression assignment @@ -217,11 +228,16 @@ additive multiplicative unary call +arrayExpression +elementInitialization +dictionaryExpression primary +memberInitialization privateModifier publicModifier abstractModifier staticModifier +initializerExpression parameters arguments inheritance @@ -235,4 +251,4 @@ stringPart atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 87, 641, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 3, 2, 7, 2, 118, 10, 2, 12, 2, 14, 2, 121, 11, 2, 3, 3, 3, 3, 3, 3, 7, 3, 126, 10, 3, 12, 3, 14, 3, 129, 11, 3, 3, 3, 7, 3, 132, 10, 3, 12, 3, 14, 3, 135, 11, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 7, 4, 143, 10, 4, 12, 4, 14, 4, 146, 11, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 7, 5, 154, 10, 5, 12, 5, 14, 5, 157, 11, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 7, 6, 165, 10, 6, 12, 6, 14, 6, 168, 11, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 5, 7, 179, 10, 7, 3, 8, 3, 8, 5, 8, 183, 10, 8, 3, 8, 3, 8, 5, 8, 187, 10, 8, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 193, 10, 8, 3, 8, 3, 8, 5, 8, 197, 10, 8, 3, 9, 3, 9, 5, 9, 201, 10, 9, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 207, 10, 9, 3, 10, 3, 10, 5, 10, 211, 10, 10, 3, 10, 3, 10, 5, 10, 215, 10, 10, 3, 10, 5, 10, 218, 10, 10, 3, 10, 5, 10, 221, 10, 10, 3, 10, 3, 10, 3, 10, 3, 10, 5, 10, 227, 10, 10, 3, 10, 3, 10, 5, 10, 231, 10, 10, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 5, 11, 238, 10, 11, 3, 11, 3, 11, 5, 11, 242, 10, 11, 3, 11, 3, 11, 3, 11, 3, 11, 5, 11, 248, 10, 11, 3, 11, 3, 11, 3, 11, 5, 11, 253, 10, 11, 3, 12, 3, 12, 5, 12, 257, 10, 12, 3, 12, 5, 12, 260, 10, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 7, 12, 269, 10, 12, 12, 12, 14, 12, 272, 11, 12, 3, 12, 3, 12, 5, 12, 276, 10, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 7, 12, 286, 10, 12, 12, 12, 14, 12, 289, 11, 12, 3, 12, 3, 12, 5, 12, 293, 10, 12, 3, 12, 3, 12, 5, 12, 297, 10, 12, 3, 13, 3, 13, 5, 13, 301, 10, 13, 3, 13, 5, 13, 304, 10, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 310, 10, 13, 3, 13, 5, 13, 313, 10, 13, 3, 14, 3, 14, 7, 14, 317, 10, 14, 12, 14, 14, 14, 320, 11, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 5, 15, 330, 10, 15, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 5, 17, 338, 10, 17, 3, 18, 3, 18, 3, 18, 3, 18, 7, 18, 344, 10, 18, 12, 18, 14, 18, 347, 11, 18, 3, 19, 3, 19, 3, 19, 3, 19, 7, 19, 353, 10, 19, 12, 19, 14, 19, 356, 11, 19, 5, 19, 358, 10, 19, 3, 20, 3, 20, 3, 20, 7, 20, 363, 10, 20, 12, 20, 14, 20, 366, 11, 20, 3, 21, 3, 21, 3, 21, 5, 21, 371, 10, 21, 3, 21, 3, 21, 5, 21, 375, 10, 21, 3, 21, 3, 21, 5, 21, 379, 10, 21, 3, 21, 3, 21, 5, 21, 383, 10, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 5, 22, 392, 10, 22, 3, 23, 3, 23, 5, 23, 396, 10, 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 27, 3, 27, 7, 27, 417, 10, 27, 12, 27, 14, 27, 420, 11, 27, 3, 27, 3, 27, 3, 28, 3, 28, 5, 28, 426, 10, 28, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 5, 29, 433, 10, 29, 3, 30, 3, 30, 3, 30, 3, 30, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 7, 31, 445, 10, 31, 12, 31, 14, 31, 448, 11, 31, 3, 32, 3, 32, 3, 32, 7, 32, 453, 10, 32, 12, 32, 14, 32, 456, 11, 32, 3, 33, 3, 33, 3, 33, 7, 33, 461, 10, 33, 12, 33, 14, 33, 464, 11, 33, 3, 34, 3, 34, 3, 34, 7, 34, 469, 10, 34, 12, 34, 14, 34, 472, 11, 34, 3, 35, 3, 35, 3, 35, 7, 35, 477, 10, 35, 12, 35, 14, 35, 480, 11, 35, 3, 36, 3, 36, 3, 36, 7, 36, 485, 10, 36, 12, 36, 14, 36, 488, 11, 36, 3, 37, 3, 37, 3, 37, 7, 37, 493, 10, 37, 12, 37, 14, 37, 496, 11, 37, 3, 38, 3, 38, 3, 38, 7, 38, 501, 10, 38, 12, 38, 14, 38, 504, 11, 38, 3, 39, 3, 39, 3, 39, 7, 39, 509, 10, 39, 12, 39, 14, 39, 512, 11, 39, 3, 40, 3, 40, 3, 40, 7, 40, 517, 10, 40, 12, 40, 14, 40, 520, 11, 40, 3, 41, 3, 41, 3, 41, 7, 41, 525, 10, 41, 12, 41, 14, 41, 528, 11, 41, 3, 42, 3, 42, 3, 42, 3, 42, 5, 42, 534, 10, 42, 3, 42, 3, 42, 7, 42, 538, 10, 42, 12, 42, 14, 42, 541, 11, 42, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 7, 43, 548, 10, 43, 12, 43, 14, 43, 551, 11, 43, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 5, 44, 564, 10, 44, 3, 45, 3, 45, 3, 46, 3, 46, 3, 47, 3, 47, 3, 48, 3, 48, 3, 49, 3, 49, 3, 49, 7, 49, 577, 10, 49, 12, 49, 14, 49, 580, 11, 49, 3, 50, 3, 50, 3, 50, 7, 50, 585, 10, 50, 12, 50, 14, 50, 588, 11, 50, 3, 51, 3, 51, 3, 51, 7, 51, 593, 10, 51, 12, 51, 14, 51, 596, 11, 51, 3, 52, 3, 52, 5, 52, 600, 10, 52, 3, 52, 3, 52, 3, 53, 3, 53, 3, 53, 3, 53, 6, 53, 608, 10, 53, 13, 53, 14, 53, 609, 3, 54, 3, 54, 3, 54, 5, 54, 615, 10, 54, 3, 55, 5, 55, 618, 10, 55, 3, 55, 3, 55, 3, 56, 3, 56, 3, 57, 3, 57, 7, 57, 626, 10, 57, 12, 57, 14, 57, 629, 11, 57, 3, 57, 3, 57, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 5, 58, 639, 10, 58, 3, 58, 2, 3, 82, 59, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 2, 10, 3, 2, 28, 38, 3, 2, 41, 42, 5, 2, 43, 43, 45, 46, 48, 48, 4, 2, 44, 44, 47, 47, 4, 2, 49, 49, 51, 51, 4, 2, 53, 54, 60, 60, 5, 2, 49, 52, 55, 55, 61, 61, 4, 2, 50, 50, 52, 52, 2, 688, 2, 119, 3, 2, 2, 2, 4, 122, 3, 2, 2, 2, 6, 138, 3, 2, 2, 2, 8, 149, 3, 2, 2, 2, 10, 160, 3, 2, 2, 2, 12, 178, 3, 2, 2, 2, 14, 182, 3, 2, 2, 2, 16, 200, 3, 2, 2, 2, 18, 210, 3, 2, 2, 2, 20, 237, 3, 2, 2, 2, 22, 296, 3, 2, 2, 2, 24, 300, 3, 2, 2, 2, 26, 314, 3, 2, 2, 2, 28, 329, 3, 2, 2, 2, 30, 331, 3, 2, 2, 2, 32, 334, 3, 2, 2, 2, 34, 339, 3, 2, 2, 2, 36, 357, 3, 2, 2, 2, 38, 359, 3, 2, 2, 2, 40, 367, 3, 2, 2, 2, 42, 384, 3, 2, 2, 2, 44, 393, 3, 2, 2, 2, 46, 399, 3, 2, 2, 2, 48, 402, 3, 2, 2, 2, 50, 408, 3, 2, 2, 2, 52, 414, 3, 2, 2, 2, 54, 425, 3, 2, 2, 2, 56, 432, 3, 2, 2, 2, 58, 434, 3, 2, 2, 2, 60, 438, 3, 2, 2, 2, 62, 449, 3, 2, 2, 2, 64, 457, 3, 2, 2, 2, 66, 465, 3, 2, 2, 2, 68, 473, 3, 2, 2, 2, 70, 481, 3, 2, 2, 2, 72, 489, 3, 2, 2, 2, 74, 497, 3, 2, 2, 2, 76, 505, 3, 2, 2, 2, 78, 513, 3, 2, 2, 2, 80, 521, 3, 2, 2, 2, 82, 533, 3, 2, 2, 2, 84, 542, 3, 2, 2, 2, 86, 563, 3, 2, 2, 2, 88, 565, 3, 2, 2, 2, 90, 567, 3, 2, 2, 2, 92, 569, 3, 2, 2, 2, 94, 571, 3, 2, 2, 2, 96, 573, 3, 2, 2, 2, 98, 581, 3, 2, 2, 2, 100, 589, 3, 2, 2, 2, 102, 597, 3, 2, 2, 2, 104, 607, 3, 2, 2, 2, 106, 614, 3, 2, 2, 2, 108, 617, 3, 2, 2, 2, 110, 621, 3, 2, 2, 2, 112, 623, 3, 2, 2, 2, 114, 638, 3, 2, 2, 2, 116, 118, 5, 4, 3, 2, 117, 116, 3, 2, 2, 2, 118, 121, 3, 2, 2, 2, 119, 117, 3, 2, 2, 2, 119, 120, 3, 2, 2, 2, 120, 3, 3, 2, 2, 2, 121, 119, 3, 2, 2, 2, 122, 127, 5, 6, 4, 2, 123, 126, 5, 8, 5, 2, 124, 126, 5, 10, 6, 2, 125, 123, 3, 2, 2, 2, 125, 124, 3, 2, 2, 2, 126, 129, 3, 2, 2, 2, 127, 125, 3, 2, 2, 2, 127, 128, 3, 2, 2, 2, 128, 133, 3, 2, 2, 2, 129, 127, 3, 2, 2, 2, 130, 132, 5, 12, 7, 2, 131, 130, 3, 2, 2, 2, 132, 135, 3, 2, 2, 2, 133, 131, 3, 2, 2, 2, 133, 134, 3, 2, 2, 2, 134, 136, 3, 2, 2, 2, 135, 133, 3, 2, 2, 2, 136, 137, 7, 2, 2, 3, 137, 5, 3, 2, 2, 2, 138, 139, 7, 3, 2, 2, 139, 144, 7, 78, 2, 2, 140, 141, 7, 56, 2, 2, 141, 143, 7, 78, 2, 2, 142, 140, 3, 2, 2, 2, 143, 146, 3, 2, 2, 2, 144, 142, 3, 2, 2, 2, 144, 145, 3, 2, 2, 2, 145, 147, 3, 2, 2, 2, 146, 144, 3, 2, 2, 2, 147, 148, 7, 70, 2, 2, 148, 7, 3, 2, 2, 2, 149, 150, 7, 27, 2, 2, 150, 155, 7, 78, 2, 2, 151, 152, 7, 56, 2, 2, 152, 154, 7, 78, 2, 2, 153, 151, 3, 2, 2, 2, 154, 157, 3, 2, 2, 2, 155, 153, 3, 2, 2, 2, 155, 156, 3, 2, 2, 2, 156, 158, 3, 2, 2, 2, 157, 155, 3, 2, 2, 2, 158, 159, 7, 70, 2, 2, 159, 9, 3, 2, 2, 2, 160, 161, 7, 26, 2, 2, 161, 166, 7, 78, 2, 2, 162, 163, 7, 56, 2, 2, 163, 165, 7, 78, 2, 2, 164, 162, 3, 2, 2, 2, 165, 168, 3, 2, 2, 2, 166, 164, 3, 2, 2, 2, 166, 167, 3, 2, 2, 2, 167, 169, 3, 2, 2, 2, 168, 166, 3, 2, 2, 2, 169, 170, 7, 70, 2, 2, 170, 11, 3, 2, 2, 2, 171, 179, 5, 14, 8, 2, 172, 179, 5, 16, 9, 2, 173, 179, 5, 18, 10, 2, 174, 179, 5, 20, 11, 2, 175, 179, 5, 22, 12, 2, 176, 179, 5, 24, 13, 2, 177, 179, 5, 28, 15, 2, 178, 171, 3, 2, 2, 2, 178, 172, 3, 2, 2, 2, 178, 173, 3, 2, 2, 2, 178, 174, 3, 2, 2, 2, 178, 175, 3, 2, 2, 2, 178, 176, 3, 2, 2, 2, 178, 177, 3, 2, 2, 2, 179, 13, 3, 2, 2, 2, 180, 183, 5, 88, 45, 2, 181, 183, 5, 90, 46, 2, 182, 180, 3, 2, 2, 2, 182, 181, 3, 2, 2, 2, 182, 183, 3, 2, 2, 2, 183, 186, 3, 2, 2, 2, 184, 187, 5, 94, 48, 2, 185, 187, 5, 92, 47, 2, 186, 184, 3, 2, 2, 2, 186, 185, 3, 2, 2, 2, 186, 187, 3, 2, 2, 2, 187, 188, 3, 2, 2, 2, 188, 189, 7, 4, 2, 2, 189, 192, 7, 78, 2, 2, 190, 191, 7, 58, 2, 2, 191, 193, 5, 100, 51, 2, 192, 190, 3, 2, 2, 2, 192, 193, 3, 2, 2, 2, 193, 196, 3, 2, 2, 2, 194, 197, 5, 52, 27, 2, 195, 197, 7, 70, 2, 2, 196, 194, 3, 2, 2, 2, 196, 195, 3, 2, 2, 2, 197, 15, 3, 2, 2, 2, 198, 201, 5, 88, 45, 2, 199, 201, 5, 90, 46, 2, 200, 198, 3, 2, 2, 2, 200, 199, 3, 2, 2, 2, 200, 201, 3, 2, 2, 2, 201, 202, 3, 2, 2, 2, 202, 203, 7, 5, 2, 2, 203, 206, 7, 78, 2, 2, 204, 207, 5, 52, 27, 2, 205, 207, 7, 70, 2, 2, 206, 204, 3, 2, 2, 2, 206, 205, 3, 2, 2, 2, 207, 17, 3, 2, 2, 2, 208, 211, 5, 88, 45, 2, 209, 211, 5, 90, 46, 2, 210, 208, 3, 2, 2, 2, 210, 209, 3, 2, 2, 2, 210, 211, 3, 2, 2, 2, 211, 214, 3, 2, 2, 2, 212, 215, 5, 94, 48, 2, 213, 215, 5, 92, 47, 2, 214, 212, 3, 2, 2, 2, 214, 213, 3, 2, 2, 2, 214, 215, 3, 2, 2, 2, 215, 217, 3, 2, 2, 2, 216, 218, 7, 8, 2, 2, 217, 216, 3, 2, 2, 2, 217, 218, 3, 2, 2, 2, 218, 220, 3, 2, 2, 2, 219, 221, 7, 9, 2, 2, 220, 219, 3, 2, 2, 2, 220, 221, 3, 2, 2, 2, 221, 222, 3, 2, 2, 2, 222, 223, 7, 10, 2, 2, 223, 226, 7, 78, 2, 2, 224, 225, 7, 7, 2, 2, 225, 227, 7, 78, 2, 2, 226, 224, 3, 2, 2, 2, 226, 227, 3, 2, 2, 2, 227, 228, 3, 2, 2, 2, 228, 230, 7, 65, 2, 2, 229, 231, 5, 96, 49, 2, 230, 229, 3, 2, 2, 2, 230, 231, 3, 2, 2, 2, 231, 232, 3, 2, 2, 2, 232, 233, 7, 66, 2, 2, 233, 234, 7, 70, 2, 2, 234, 19, 3, 2, 2, 2, 235, 238, 5, 88, 45, 2, 236, 238, 5, 90, 46, 2, 237, 235, 3, 2, 2, 2, 237, 236, 3, 2, 2, 2, 237, 238, 3, 2, 2, 2, 238, 241, 3, 2, 2, 2, 239, 242, 5, 94, 48, 2, 240, 242, 5, 92, 47, 2, 241, 239, 3, 2, 2, 2, 241, 240, 3, 2, 2, 2, 241, 242, 3, 2, 2, 2, 242, 243, 3, 2, 2, 2, 243, 244, 7, 10, 2, 2, 244, 245, 7, 78, 2, 2, 245, 247, 7, 65, 2, 2, 246, 248, 5, 96, 49, 2, 247, 246, 3, 2, 2, 2, 247, 248, 3, 2, 2, 2, 248, 249, 3, 2, 2, 2, 249, 252, 7, 66, 2, 2, 250, 253, 5, 52, 27, 2, 251, 253, 7, 70, 2, 2, 252, 250, 3, 2, 2, 2, 252, 251, 3, 2, 2, 2, 253, 21, 3, 2, 2, 2, 254, 257, 5, 88, 45, 2, 255, 257, 5, 90, 46, 2, 256, 254, 3, 2, 2, 2, 256, 255, 3, 2, 2, 2, 256, 257, 3, 2, 2, 2, 257, 259, 3, 2, 2, 2, 258, 260, 5, 94, 48, 2, 259, 258, 3, 2, 2, 2, 259, 260, 3, 2, 2, 2, 260, 261, 3, 2, 2, 2, 261, 262, 7, 11, 2, 2, 262, 263, 7, 78, 2, 2, 263, 264, 7, 28, 2, 2, 264, 265, 7, 6, 2, 2, 265, 270, 7, 78, 2, 2, 266, 267, 7, 56, 2, 2, 267, 269, 7, 78, 2, 2, 268, 266, 3, 2, 2, 2, 269, 272, 3, 2, 2, 2, 270, 268, 3, 2, 2, 2, 270, 271, 3, 2, 2, 2, 271, 273, 3, 2, 2, 2, 272, 270, 3, 2, 2, 2, 273, 275, 7, 65, 2, 2, 274, 276, 5, 98, 50, 2, 275, 274, 3, 2, 2, 2, 275, 276, 3, 2, 2, 2, 276, 277, 3, 2, 2, 2, 277, 278, 7, 66, 2, 2, 278, 297, 7, 70, 2, 2, 279, 280, 7, 78, 2, 2, 280, 281, 7, 28, 2, 2, 281, 282, 7, 6, 2, 2, 282, 287, 7, 78, 2, 2, 283, 284, 7, 56, 2, 2, 284, 286, 7, 78, 2, 2, 285, 283, 3, 2, 2, 2, 286, 289, 3, 2, 2, 2, 287, 285, 3, 2, 2, 2, 287, 288, 3, 2, 2, 2, 288, 290, 3, 2, 2, 2, 289, 287, 3, 2, 2, 2, 290, 292, 7, 65, 2, 2, 291, 293, 5, 98, 50, 2, 292, 291, 3, 2, 2, 2, 292, 293, 3, 2, 2, 2, 293, 294, 3, 2, 2, 2, 294, 295, 7, 66, 2, 2, 295, 297, 7, 70, 2, 2, 296, 256, 3, 2, 2, 2, 296, 279, 3, 2, 2, 2, 297, 23, 3, 2, 2, 2, 298, 301, 5, 88, 45, 2, 299, 301, 5, 90, 46, 2, 300, 298, 3, 2, 2, 2, 300, 299, 3, 2, 2, 2, 300, 301, 3, 2, 2, 2, 301, 303, 3, 2, 2, 2, 302, 304, 5, 94, 48, 2, 303, 302, 3, 2, 2, 2, 303, 304, 3, 2, 2, 2, 304, 305, 3, 2, 2, 2, 305, 306, 7, 11, 2, 2, 306, 312, 7, 78, 2, 2, 307, 308, 7, 28, 2, 2, 308, 310, 5, 30, 16, 2, 309, 307, 3, 2, 2, 2, 309, 310, 3, 2, 2, 2, 310, 313, 3, 2, 2, 2, 311, 313, 7, 70, 2, 2, 312, 309, 3, 2, 2, 2, 312, 311, 3, 2, 2, 2, 313, 25, 3, 2, 2, 2, 314, 318, 5, 12, 7, 2, 315, 317, 5, 12, 7, 2, 316, 315, 3, 2, 2, 2, 317, 320, 3, 2, 2, 2, 318, 316, 3, 2, 2, 2, 318, 319, 3, 2, 2, 2, 319, 27, 3, 2, 2, 2, 320, 318, 3, 2, 2, 2, 321, 330, 5, 30, 16, 2, 322, 330, 5, 40, 21, 2, 323, 330, 5, 42, 22, 2, 324, 330, 5, 44, 23, 2, 325, 330, 5, 46, 24, 2, 326, 330, 5, 48, 25, 2, 327, 330, 5, 50, 26, 2, 328, 330, 5, 52, 27, 2, 329, 321, 3, 2, 2, 2, 329, 322, 3, 2, 2, 2, 329, 323, 3, 2, 2, 2, 329, 324, 3, 2, 2, 2, 329, 325, 3, 2, 2, 2, 329, 326, 3, 2, 2, 2, 329, 327, 3, 2, 2, 2, 329, 328, 3, 2, 2, 2, 330, 29, 3, 2, 2, 2, 331, 332, 5, 54, 28, 2, 332, 333, 7, 70, 2, 2, 333, 31, 3, 2, 2, 2, 334, 337, 7, 78, 2, 2, 335, 336, 7, 28, 2, 2, 336, 338, 5, 54, 28, 2, 337, 335, 3, 2, 2, 2, 337, 338, 3, 2, 2, 2, 338, 33, 3, 2, 2, 2, 339, 340, 7, 11, 2, 2, 340, 345, 5, 32, 17, 2, 341, 342, 7, 69, 2, 2, 342, 344, 5, 32, 17, 2, 343, 341, 3, 2, 2, 2, 344, 347, 3, 2, 2, 2, 345, 343, 3, 2, 2, 2, 345, 346, 3, 2, 2, 2, 346, 35, 3, 2, 2, 2, 347, 345, 3, 2, 2, 2, 348, 358, 5, 34, 18, 2, 349, 354, 5, 54, 28, 2, 350, 351, 7, 69, 2, 2, 351, 353, 5, 54, 28, 2, 352, 350, 3, 2, 2, 2, 353, 356, 3, 2, 2, 2, 354, 352, 3, 2, 2, 2, 354, 355, 3, 2, 2, 2, 355, 358, 3, 2, 2, 2, 356, 354, 3, 2, 2, 2, 357, 348, 3, 2, 2, 2, 357, 349, 3, 2, 2, 2, 358, 37, 3, 2, 2, 2, 359, 364, 5, 54, 28, 2, 360, 361, 7, 69, 2, 2, 361, 363, 5, 54, 28, 2, 362, 360, 3, 2, 2, 2, 363, 366, 3, 2, 2, 2, 364, 362, 3, 2, 2, 2, 364, 365, 3, 2, 2, 2, 365, 39, 3, 2, 2, 2, 366, 364, 3, 2, 2, 2, 367, 368, 7, 14, 2, 2, 368, 370, 7, 65, 2, 2, 369, 371, 5, 36, 19, 2, 370, 369, 3, 2, 2, 2, 370, 371, 3, 2, 2, 2, 371, 372, 3, 2, 2, 2, 372, 374, 7, 70, 2, 2, 373, 375, 5, 54, 28, 2, 374, 373, 3, 2, 2, 2, 374, 375, 3, 2, 2, 2, 375, 376, 3, 2, 2, 2, 376, 378, 7, 70, 2, 2, 377, 379, 5, 38, 20, 2, 378, 377, 3, 2, 2, 2, 378, 379, 3, 2, 2, 2, 379, 380, 3, 2, 2, 2, 380, 382, 7, 66, 2, 2, 381, 383, 5, 28, 15, 2, 382, 381, 3, 2, 2, 2, 382, 383, 3, 2, 2, 2, 383, 41, 3, 2, 2, 2, 384, 385, 7, 20, 2, 2, 385, 386, 7, 65, 2, 2, 386, 387, 5, 54, 28, 2, 387, 388, 7, 66, 2, 2, 388, 391, 5, 28, 15, 2, 389, 390, 7, 21, 2, 2, 390, 392, 5, 28, 15, 2, 391, 389, 3, 2, 2, 2, 391, 392, 3, 2, 2, 2, 392, 43, 3, 2, 2, 2, 393, 395, 7, 22, 2, 2, 394, 396, 5, 54, 28, 2, 395, 394, 3, 2, 2, 2, 395, 396, 3, 2, 2, 2, 396, 397, 3, 2, 2, 2, 397, 398, 7, 70, 2, 2, 398, 45, 3, 2, 2, 2, 399, 400, 7, 23, 2, 2, 400, 401, 7, 70, 2, 2, 401, 47, 3, 2, 2, 2, 402, 403, 7, 26, 2, 2, 403, 404, 7, 65, 2, 2, 404, 405, 5, 54, 28, 2, 405, 406, 7, 66, 2, 2, 406, 407, 5, 52, 27, 2, 407, 49, 3, 2, 2, 2, 408, 409, 7, 15, 2, 2, 409, 410, 7, 65, 2, 2, 410, 411, 5, 54, 28, 2, 411, 412, 7, 66, 2, 2, 412, 413, 5, 52, 27, 2, 413, 51, 3, 2, 2, 2, 414, 418, 7, 83, 2, 2, 415, 417, 5, 12, 7, 2, 416, 415, 3, 2, 2, 2, 417, 420, 3, 2, 2, 2, 418, 416, 3, 2, 2, 2, 418, 419, 3, 2, 2, 2, 419, 421, 3, 2, 2, 2, 420, 418, 3, 2, 2, 2, 421, 422, 7, 84, 2, 2, 422, 53, 3, 2, 2, 2, 423, 426, 5, 56, 29, 2, 424, 426, 5, 58, 30, 2, 425, 423, 3, 2, 2, 2, 425, 424, 3, 2, 2, 2, 426, 55, 3, 2, 2, 2, 427, 428, 5, 84, 43, 2, 428, 429, 9, 2, 2, 2, 429, 430, 5, 56, 29, 2, 430, 433, 3, 2, 2, 2, 431, 433, 5, 60, 31, 2, 432, 427, 3, 2, 2, 2, 432, 431, 3, 2, 2, 2, 433, 57, 3, 2, 2, 2, 434, 435, 5, 102, 52, 2, 435, 436, 7, 59, 2, 2, 436, 437, 5, 52, 27, 2, 437, 59, 3, 2, 2, 2, 438, 446, 5, 62, 32, 2, 439, 440, 7, 57, 2, 2, 440, 441, 5, 62, 32, 2, 441, 442, 7, 58, 2, 2, 442, 443, 5, 62, 32, 2, 443, 445, 3, 2, 2, 2, 444, 439, 3, 2, 2, 2, 445, 448, 3, 2, 2, 2, 446, 444, 3, 2, 2, 2, 446, 447, 3, 2, 2, 2, 447, 61, 3, 2, 2, 2, 448, 446, 3, 2, 2, 2, 449, 454, 5, 64, 33, 2, 450, 451, 7, 39, 2, 2, 451, 453, 5, 64, 33, 2, 452, 450, 3, 2, 2, 2, 453, 456, 3, 2, 2, 2, 454, 452, 3, 2, 2, 2, 454, 455, 3, 2, 2, 2, 455, 63, 3, 2, 2, 2, 456, 454, 3, 2, 2, 2, 457, 462, 5, 66, 34, 2, 458, 459, 7, 40, 2, 2, 459, 461, 5, 66, 34, 2, 460, 458, 3, 2, 2, 2, 461, 464, 3, 2, 2, 2, 462, 460, 3, 2, 2, 2, 462, 463, 3, 2, 2, 2, 463, 65, 3, 2, 2, 2, 464, 462, 3, 2, 2, 2, 465, 470, 5, 68, 35, 2, 466, 467, 7, 64, 2, 2, 467, 469, 5, 68, 35, 2, 468, 466, 3, 2, 2, 2, 469, 472, 3, 2, 2, 2, 470, 468, 3, 2, 2, 2, 470, 471, 3, 2, 2, 2, 471, 67, 3, 2, 2, 2, 472, 470, 3, 2, 2, 2, 473, 478, 5, 70, 36, 2, 474, 475, 7, 63, 2, 2, 475, 477, 5, 70, 36, 2, 476, 474, 3, 2, 2, 2, 477, 480, 3, 2, 2, 2, 478, 476, 3, 2, 2, 2, 478, 479, 3, 2, 2, 2, 479, 69, 3, 2, 2, 2, 480, 478, 3, 2, 2, 2, 481, 486, 5, 72, 37, 2, 482, 483, 7, 62, 2, 2, 483, 485, 5, 72, 37, 2, 484, 482, 3, 2, 2, 2, 485, 488, 3, 2, 2, 2, 486, 484, 3, 2, 2, 2, 486, 487, 3, 2, 2, 2, 487, 71, 3, 2, 2, 2, 488, 486, 3, 2, 2, 2, 489, 494, 5, 74, 38, 2, 490, 491, 9, 3, 2, 2, 491, 493, 5, 74, 38, 2, 492, 490, 3, 2, 2, 2, 493, 496, 3, 2, 2, 2, 494, 492, 3, 2, 2, 2, 494, 495, 3, 2, 2, 2, 495, 73, 3, 2, 2, 2, 496, 494, 3, 2, 2, 2, 497, 502, 5, 76, 39, 2, 498, 499, 9, 4, 2, 2, 499, 501, 5, 76, 39, 2, 500, 498, 3, 2, 2, 2, 501, 504, 3, 2, 2, 2, 502, 500, 3, 2, 2, 2, 502, 503, 3, 2, 2, 2, 503, 75, 3, 2, 2, 2, 504, 502, 3, 2, 2, 2, 505, 510, 5, 78, 40, 2, 506, 507, 9, 5, 2, 2, 507, 509, 5, 78, 40, 2, 508, 506, 3, 2, 2, 2, 509, 512, 3, 2, 2, 2, 510, 508, 3, 2, 2, 2, 510, 511, 3, 2, 2, 2, 511, 77, 3, 2, 2, 2, 512, 510, 3, 2, 2, 2, 513, 518, 5, 80, 41, 2, 514, 515, 9, 6, 2, 2, 515, 517, 5, 80, 41, 2, 516, 514, 3, 2, 2, 2, 517, 520, 3, 2, 2, 2, 518, 516, 3, 2, 2, 2, 518, 519, 3, 2, 2, 2, 519, 79, 3, 2, 2, 2, 520, 518, 3, 2, 2, 2, 521, 526, 5, 82, 42, 2, 522, 523, 9, 7, 2, 2, 523, 525, 5, 82, 42, 2, 524, 522, 3, 2, 2, 2, 525, 528, 3, 2, 2, 2, 526, 524, 3, 2, 2, 2, 526, 527, 3, 2, 2, 2, 527, 81, 3, 2, 2, 2, 528, 526, 3, 2, 2, 2, 529, 530, 8, 42, 1, 2, 530, 531, 9, 8, 2, 2, 531, 534, 5, 82, 42, 5, 532, 534, 5, 84, 43, 2, 533, 529, 3, 2, 2, 2, 533, 532, 3, 2, 2, 2, 534, 539, 3, 2, 2, 2, 535, 536, 12, 3, 2, 2, 536, 538, 9, 9, 2, 2, 537, 535, 3, 2, 2, 2, 538, 541, 3, 2, 2, 2, 539, 537, 3, 2, 2, 2, 539, 540, 3, 2, 2, 2, 540, 83, 3, 2, 2, 2, 541, 539, 3, 2, 2, 2, 542, 549, 5, 86, 44, 2, 543, 548, 5, 102, 52, 2, 544, 545, 7, 56, 2, 2, 545, 548, 7, 78, 2, 2, 546, 548, 5, 104, 53, 2, 547, 543, 3, 2, 2, 2, 547, 544, 3, 2, 2, 2, 547, 546, 3, 2, 2, 2, 548, 551, 3, 2, 2, 2, 549, 547, 3, 2, 2, 2, 549, 550, 3, 2, 2, 2, 550, 85, 3, 2, 2, 2, 551, 549, 3, 2, 2, 2, 552, 564, 7, 72, 2, 2, 553, 564, 7, 24, 2, 2, 554, 564, 7, 25, 2, 2, 555, 564, 7, 75, 2, 2, 556, 564, 7, 76, 2, 2, 557, 558, 7, 65, 2, 2, 558, 559, 5, 54, 28, 2, 559, 560, 7, 66, 2, 2, 560, 564, 3, 2, 2, 2, 561, 564, 7, 78, 2, 2, 562, 564, 5, 112, 57, 2, 563, 552, 3, 2, 2, 2, 563, 553, 3, 2, 2, 2, 563, 554, 3, 2, 2, 2, 563, 555, 3, 2, 2, 2, 563, 556, 3, 2, 2, 2, 563, 557, 3, 2, 2, 2, 563, 561, 3, 2, 2, 2, 563, 562, 3, 2, 2, 2, 564, 87, 3, 2, 2, 2, 565, 566, 7, 19, 2, 2, 566, 89, 3, 2, 2, 2, 567, 568, 7, 18, 2, 2, 568, 91, 3, 2, 2, 2, 569, 570, 7, 17, 2, 2, 570, 93, 3, 2, 2, 2, 571, 572, 7, 16, 2, 2, 572, 95, 3, 2, 2, 2, 573, 578, 5, 110, 56, 2, 574, 575, 7, 69, 2, 2, 575, 577, 5, 110, 56, 2, 576, 574, 3, 2, 2, 2, 577, 580, 3, 2, 2, 2, 578, 576, 3, 2, 2, 2, 578, 579, 3, 2, 2, 2, 579, 97, 3, 2, 2, 2, 580, 578, 3, 2, 2, 2, 581, 586, 5, 108, 55, 2, 582, 583, 7, 69, 2, 2, 583, 585, 5, 108, 55, 2, 584, 582, 3, 2, 2, 2, 585, 588, 3, 2, 2, 2, 586, 584, 3, 2, 2, 2, 586, 587, 3, 2, 2, 2, 587, 99, 3, 2, 2, 2, 588, 586, 3, 2, 2, 2, 589, 594, 7, 78, 2, 2, 590, 591, 7, 69, 2, 2, 591, 593, 7, 78, 2, 2, 592, 590, 3, 2, 2, 2, 593, 596, 3, 2, 2, 2, 594, 592, 3, 2, 2, 2, 594, 595, 3, 2, 2, 2, 595, 101, 3, 2, 2, 2, 596, 594, 3, 2, 2, 2, 597, 599, 7, 65, 2, 2, 598, 600, 5, 98, 50, 2, 599, 598, 3, 2, 2, 2, 599, 600, 3, 2, 2, 2, 600, 601, 3, 2, 2, 2, 601, 602, 7, 66, 2, 2, 602, 103, 3, 2, 2, 2, 603, 604, 7, 67, 2, 2, 604, 605, 5, 106, 54, 2, 605, 606, 7, 68, 2, 2, 606, 608, 3, 2, 2, 2, 607, 603, 3, 2, 2, 2, 608, 609, 3, 2, 2, 2, 609, 607, 3, 2, 2, 2, 609, 610, 3, 2, 2, 2, 610, 105, 3, 2, 2, 2, 611, 615, 7, 75, 2, 2, 612, 615, 5, 112, 57, 2, 613, 615, 5, 84, 43, 2, 614, 611, 3, 2, 2, 2, 614, 612, 3, 2, 2, 2, 614, 613, 3, 2, 2, 2, 615, 107, 3, 2, 2, 2, 616, 618, 7, 59, 2, 2, 617, 616, 3, 2, 2, 2, 617, 618, 3, 2, 2, 2, 618, 619, 3, 2, 2, 2, 619, 620, 5, 54, 28, 2, 620, 109, 3, 2, 2, 2, 621, 622, 7, 78, 2, 2, 622, 111, 3, 2, 2, 2, 623, 627, 7, 82, 2, 2, 624, 626, 5, 114, 58, 2, 625, 624, 3, 2, 2, 2, 626, 629, 3, 2, 2, 2, 627, 625, 3, 2, 2, 2, 627, 628, 3, 2, 2, 2, 628, 630, 3, 2, 2, 2, 629, 627, 3, 2, 2, 2, 630, 631, 7, 82, 2, 2, 631, 113, 3, 2, 2, 2, 632, 639, 7, 85, 2, 2, 633, 639, 7, 87, 2, 2, 634, 635, 7, 86, 2, 2, 635, 636, 5, 54, 28, 2, 636, 637, 7, 84, 2, 2, 637, 639, 3, 2, 2, 2, 638, 632, 3, 2, 2, 2, 638, 633, 3, 2, 2, 2, 638, 634, 3, 2, 2, 2, 639, 115, 3, 2, 2, 2, 78, 119, 125, 127, 133, 144, 155, 166, 178, 182, 186, 192, 196, 200, 206, 210, 214, 217, 220, 226, 230, 237, 241, 247, 252, 256, 259, 270, 275, 287, 292, 296, 300, 303, 309, 312, 318, 329, 337, 345, 354, 357, 364, 370, 374, 378, 382, 391, 395, 418, 425, 432, 446, 454, 462, 470, 478, 486, 494, 502, 510, 518, 526, 533, 539, 547, 549, 563, 578, 586, 594, 599, 609, 614, 617, 627, 638] \ No newline at end of file +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 91, 721, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, 4, 66, 9, 66, 3, 2, 7, 2, 134, 10, 2, 12, 2, 14, 2, 137, 11, 2, 3, 3, 3, 3, 3, 3, 7, 3, 142, 10, 3, 12, 3, 14, 3, 145, 11, 3, 3, 3, 7, 3, 148, 10, 3, 12, 3, 14, 3, 151, 11, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 7, 4, 159, 10, 4, 12, 4, 14, 4, 162, 11, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 7, 5, 170, 10, 5, 12, 5, 14, 5, 173, 11, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 7, 6, 181, 10, 6, 12, 6, 14, 6, 184, 11, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 5, 7, 195, 10, 7, 3, 8, 3, 8, 5, 8, 199, 10, 8, 3, 8, 3, 8, 5, 8, 203, 10, 8, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 209, 10, 8, 3, 8, 3, 8, 5, 8, 213, 10, 8, 3, 9, 3, 9, 5, 9, 217, 10, 9, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 223, 10, 9, 3, 10, 3, 10, 5, 10, 227, 10, 10, 3, 10, 3, 10, 5, 10, 231, 10, 10, 3, 10, 5, 10, 234, 10, 10, 3, 10, 5, 10, 237, 10, 10, 3, 10, 3, 10, 3, 10, 3, 10, 5, 10, 243, 10, 10, 3, 10, 3, 10, 5, 10, 247, 10, 10, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 5, 11, 254, 10, 11, 3, 11, 3, 11, 5, 11, 258, 10, 11, 3, 11, 3, 11, 3, 11, 3, 11, 5, 11, 264, 10, 11, 3, 11, 3, 11, 3, 11, 5, 11, 269, 10, 11, 3, 12, 3, 12, 5, 12, 273, 10, 12, 3, 12, 5, 12, 276, 10, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 7, 12, 285, 10, 12, 12, 12, 14, 12, 288, 11, 12, 3, 12, 3, 12, 5, 12, 292, 10, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 5, 12, 300, 10, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 7, 12, 308, 10, 12, 12, 12, 14, 12, 311, 11, 12, 3, 12, 3, 12, 5, 12, 315, 10, 12, 3, 12, 3, 12, 5, 12, 319, 10, 12, 3, 13, 3, 13, 5, 13, 323, 10, 13, 3, 13, 5, 13, 326, 10, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 332, 10, 13, 3, 13, 5, 13, 335, 10, 13, 3, 14, 3, 14, 7, 14, 339, 10, 14, 12, 14, 14, 14, 342, 11, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 5, 15, 355, 10, 15, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 5, 17, 363, 10, 17, 3, 18, 3, 18, 3, 18, 3, 18, 7, 18, 369, 10, 18, 12, 18, 14, 18, 372, 11, 18, 3, 19, 3, 19, 3, 19, 3, 19, 7, 19, 378, 10, 19, 12, 19, 14, 19, 381, 11, 19, 5, 19, 383, 10, 19, 3, 20, 3, 20, 3, 20, 7, 20, 388, 10, 20, 12, 20, 14, 20, 391, 11, 20, 3, 21, 3, 21, 3, 21, 5, 21, 396, 10, 21, 3, 21, 3, 21, 5, 21, 400, 10, 21, 3, 21, 3, 21, 5, 21, 404, 10, 21, 3, 21, 3, 21, 5, 21, 408, 10, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 5, 22, 417, 10, 22, 3, 23, 3, 23, 5, 23, 421, 10, 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 29, 3, 29, 3, 29, 3, 30, 3, 30, 7, 30, 457, 10, 30, 12, 30, 14, 30, 460, 11, 30, 3, 30, 3, 30, 3, 31, 3, 31, 5, 31, 466, 10, 31, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 5, 32, 473, 10, 32, 3, 33, 3, 33, 3, 33, 3, 33, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 7, 34, 485, 10, 34, 12, 34, 14, 34, 488, 11, 34, 3, 35, 3, 35, 3, 35, 7, 35, 493, 10, 35, 12, 35, 14, 35, 496, 11, 35, 3, 36, 3, 36, 3, 36, 7, 36, 501, 10, 36, 12, 36, 14, 36, 504, 11, 36, 3, 37, 3, 37, 3, 37, 7, 37, 509, 10, 37, 12, 37, 14, 37, 512, 11, 37, 3, 38, 3, 38, 3, 38, 7, 38, 517, 10, 38, 12, 38, 14, 38, 520, 11, 38, 3, 39, 3, 39, 3, 39, 7, 39, 525, 10, 39, 12, 39, 14, 39, 528, 11, 39, 3, 40, 3, 40, 3, 40, 7, 40, 533, 10, 40, 12, 40, 14, 40, 536, 11, 40, 3, 41, 3, 41, 3, 41, 7, 41, 541, 10, 41, 12, 41, 14, 41, 544, 11, 41, 3, 42, 3, 42, 3, 42, 7, 42, 549, 10, 42, 12, 42, 14, 42, 552, 11, 42, 3, 43, 3, 43, 3, 43, 7, 43, 557, 10, 43, 12, 43, 14, 43, 560, 11, 43, 3, 44, 3, 44, 3, 44, 7, 44, 565, 10, 44, 12, 44, 14, 44, 568, 11, 44, 3, 45, 3, 45, 3, 45, 3, 45, 5, 45, 574, 10, 45, 3, 45, 3, 45, 7, 45, 578, 10, 45, 12, 45, 14, 45, 581, 11, 45, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 7, 46, 588, 10, 46, 12, 46, 14, 46, 591, 11, 46, 3, 47, 3, 47, 3, 47, 3, 47, 7, 47, 597, 10, 47, 12, 47, 14, 47, 600, 11, 47, 3, 47, 3, 47, 3, 48, 3, 48, 3, 48, 3, 48, 3, 49, 3, 49, 3, 49, 3, 49, 7, 49, 612, 10, 49, 12, 49, 14, 49, 615, 11, 49, 3, 49, 3, 49, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 5, 50, 632, 10, 50, 3, 51, 3, 51, 3, 51, 3, 51, 3, 52, 3, 52, 3, 53, 3, 53, 3, 54, 3, 54, 3, 55, 3, 55, 3, 56, 3, 56, 3, 56, 7, 56, 649, 10, 56, 12, 56, 14, 56, 652, 11, 56, 3, 57, 3, 57, 3, 57, 7, 57, 657, 10, 57, 12, 57, 14, 57, 660, 11, 57, 3, 58, 3, 58, 3, 58, 7, 58, 665, 10, 58, 12, 58, 14, 58, 668, 11, 58, 3, 59, 3, 59, 3, 59, 7, 59, 673, 10, 59, 12, 59, 14, 59, 676, 11, 59, 3, 60, 3, 60, 5, 60, 680, 10, 60, 3, 60, 3, 60, 3, 61, 3, 61, 3, 61, 3, 61, 6, 61, 688, 10, 61, 13, 61, 14, 61, 689, 3, 62, 3, 62, 3, 62, 5, 62, 695, 10, 62, 3, 63, 5, 63, 698, 10, 63, 3, 63, 3, 63, 3, 64, 3, 64, 3, 65, 3, 65, 7, 65, 706, 10, 65, 12, 65, 14, 65, 709, 11, 65, 3, 65, 3, 65, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 5, 66, 719, 10, 66, 3, 66, 2, 3, 88, 67, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 2, 10, 3, 2, 32, 42, 3, 2, 45, 46, 5, 2, 47, 47, 49, 50, 52, 52, 4, 2, 48, 48, 51, 51, 4, 2, 53, 53, 55, 55, 4, 2, 57, 58, 64, 64, 5, 2, 53, 56, 59, 59, 65, 65, 4, 2, 54, 54, 56, 56, 2, 769, 2, 135, 3, 2, 2, 2, 4, 138, 3, 2, 2, 2, 6, 154, 3, 2, 2, 2, 8, 165, 3, 2, 2, 2, 10, 176, 3, 2, 2, 2, 12, 194, 3, 2, 2, 2, 14, 198, 3, 2, 2, 2, 16, 216, 3, 2, 2, 2, 18, 226, 3, 2, 2, 2, 20, 253, 3, 2, 2, 2, 22, 318, 3, 2, 2, 2, 24, 322, 3, 2, 2, 2, 26, 336, 3, 2, 2, 2, 28, 354, 3, 2, 2, 2, 30, 356, 3, 2, 2, 2, 32, 359, 3, 2, 2, 2, 34, 364, 3, 2, 2, 2, 36, 382, 3, 2, 2, 2, 38, 384, 3, 2, 2, 2, 40, 392, 3, 2, 2, 2, 42, 409, 3, 2, 2, 2, 44, 418, 3, 2, 2, 2, 46, 424, 3, 2, 2, 2, 48, 427, 3, 2, 2, 2, 50, 433, 3, 2, 2, 2, 52, 439, 3, 2, 2, 2, 54, 445, 3, 2, 2, 2, 56, 451, 3, 2, 2, 2, 58, 454, 3, 2, 2, 2, 60, 465, 3, 2, 2, 2, 62, 472, 3, 2, 2, 2, 64, 474, 3, 2, 2, 2, 66, 478, 3, 2, 2, 2, 68, 489, 3, 2, 2, 2, 70, 497, 3, 2, 2, 2, 72, 505, 3, 2, 2, 2, 74, 513, 3, 2, 2, 2, 76, 521, 3, 2, 2, 2, 78, 529, 3, 2, 2, 2, 80, 537, 3, 2, 2, 2, 82, 545, 3, 2, 2, 2, 84, 553, 3, 2, 2, 2, 86, 561, 3, 2, 2, 2, 88, 573, 3, 2, 2, 2, 90, 582, 3, 2, 2, 2, 92, 592, 3, 2, 2, 2, 94, 603, 3, 2, 2, 2, 96, 607, 3, 2, 2, 2, 98, 631, 3, 2, 2, 2, 100, 633, 3, 2, 2, 2, 102, 637, 3, 2, 2, 2, 104, 639, 3, 2, 2, 2, 106, 641, 3, 2, 2, 2, 108, 643, 3, 2, 2, 2, 110, 645, 3, 2, 2, 2, 112, 653, 3, 2, 2, 2, 114, 661, 3, 2, 2, 2, 116, 669, 3, 2, 2, 2, 118, 677, 3, 2, 2, 2, 120, 687, 3, 2, 2, 2, 122, 694, 3, 2, 2, 2, 124, 697, 3, 2, 2, 2, 126, 701, 3, 2, 2, 2, 128, 703, 3, 2, 2, 2, 130, 718, 3, 2, 2, 2, 132, 134, 5, 4, 3, 2, 133, 132, 3, 2, 2, 2, 134, 137, 3, 2, 2, 2, 135, 133, 3, 2, 2, 2, 135, 136, 3, 2, 2, 2, 136, 3, 3, 2, 2, 2, 137, 135, 3, 2, 2, 2, 138, 143, 5, 6, 4, 2, 139, 142, 5, 8, 5, 2, 140, 142, 5, 10, 6, 2, 141, 139, 3, 2, 2, 2, 141, 140, 3, 2, 2, 2, 142, 145, 3, 2, 2, 2, 143, 141, 3, 2, 2, 2, 143, 144, 3, 2, 2, 2, 144, 149, 3, 2, 2, 2, 145, 143, 3, 2, 2, 2, 146, 148, 5, 12, 7, 2, 147, 146, 3, 2, 2, 2, 148, 151, 3, 2, 2, 2, 149, 147, 3, 2, 2, 2, 149, 150, 3, 2, 2, 2, 150, 152, 3, 2, 2, 2, 151, 149, 3, 2, 2, 2, 152, 153, 7, 2, 2, 3, 153, 5, 3, 2, 2, 2, 154, 155, 7, 3, 2, 2, 155, 160, 7, 82, 2, 2, 156, 157, 7, 60, 2, 2, 157, 159, 7, 82, 2, 2, 158, 156, 3, 2, 2, 2, 159, 162, 3, 2, 2, 2, 160, 158, 3, 2, 2, 2, 160, 161, 3, 2, 2, 2, 161, 163, 3, 2, 2, 2, 162, 160, 3, 2, 2, 2, 163, 164, 7, 74, 2, 2, 164, 7, 3, 2, 2, 2, 165, 166, 7, 27, 2, 2, 166, 171, 7, 82, 2, 2, 167, 168, 7, 60, 2, 2, 168, 170, 7, 82, 2, 2, 169, 167, 3, 2, 2, 2, 170, 173, 3, 2, 2, 2, 171, 169, 3, 2, 2, 2, 171, 172, 3, 2, 2, 2, 172, 174, 3, 2, 2, 2, 173, 171, 3, 2, 2, 2, 174, 175, 7, 74, 2, 2, 175, 9, 3, 2, 2, 2, 176, 177, 7, 26, 2, 2, 177, 182, 7, 82, 2, 2, 178, 179, 7, 60, 2, 2, 179, 181, 7, 82, 2, 2, 180, 178, 3, 2, 2, 2, 181, 184, 3, 2, 2, 2, 182, 180, 3, 2, 2, 2, 182, 183, 3, 2, 2, 2, 183, 185, 3, 2, 2, 2, 184, 182, 3, 2, 2, 2, 185, 186, 7, 74, 2, 2, 186, 11, 3, 2, 2, 2, 187, 195, 5, 14, 8, 2, 188, 195, 5, 16, 9, 2, 189, 195, 5, 18, 10, 2, 190, 195, 5, 20, 11, 2, 191, 195, 5, 22, 12, 2, 192, 195, 5, 24, 13, 2, 193, 195, 5, 28, 15, 2, 194, 187, 3, 2, 2, 2, 194, 188, 3, 2, 2, 2, 194, 189, 3, 2, 2, 2, 194, 190, 3, 2, 2, 2, 194, 191, 3, 2, 2, 2, 194, 192, 3, 2, 2, 2, 194, 193, 3, 2, 2, 2, 195, 13, 3, 2, 2, 2, 196, 199, 5, 102, 52, 2, 197, 199, 5, 104, 53, 2, 198, 196, 3, 2, 2, 2, 198, 197, 3, 2, 2, 2, 198, 199, 3, 2, 2, 2, 199, 202, 3, 2, 2, 2, 200, 203, 5, 108, 55, 2, 201, 203, 5, 106, 54, 2, 202, 200, 3, 2, 2, 2, 202, 201, 3, 2, 2, 2, 202, 203, 3, 2, 2, 2, 203, 204, 3, 2, 2, 2, 204, 205, 7, 4, 2, 2, 205, 208, 7, 82, 2, 2, 206, 207, 7, 62, 2, 2, 207, 209, 5, 116, 59, 2, 208, 206, 3, 2, 2, 2, 208, 209, 3, 2, 2, 2, 209, 212, 3, 2, 2, 2, 210, 213, 5, 58, 30, 2, 211, 213, 7, 74, 2, 2, 212, 210, 3, 2, 2, 2, 212, 211, 3, 2, 2, 2, 213, 15, 3, 2, 2, 2, 214, 217, 5, 102, 52, 2, 215, 217, 5, 104, 53, 2, 216, 214, 3, 2, 2, 2, 216, 215, 3, 2, 2, 2, 216, 217, 3, 2, 2, 2, 217, 218, 3, 2, 2, 2, 218, 219, 7, 5, 2, 2, 219, 222, 7, 82, 2, 2, 220, 223, 5, 58, 30, 2, 221, 223, 7, 74, 2, 2, 222, 220, 3, 2, 2, 2, 222, 221, 3, 2, 2, 2, 223, 17, 3, 2, 2, 2, 224, 227, 5, 102, 52, 2, 225, 227, 5, 104, 53, 2, 226, 224, 3, 2, 2, 2, 226, 225, 3, 2, 2, 2, 226, 227, 3, 2, 2, 2, 227, 230, 3, 2, 2, 2, 228, 231, 5, 108, 55, 2, 229, 231, 5, 106, 54, 2, 230, 228, 3, 2, 2, 2, 230, 229, 3, 2, 2, 2, 230, 231, 3, 2, 2, 2, 231, 233, 3, 2, 2, 2, 232, 234, 7, 8, 2, 2, 233, 232, 3, 2, 2, 2, 233, 234, 3, 2, 2, 2, 234, 236, 3, 2, 2, 2, 235, 237, 7, 9, 2, 2, 236, 235, 3, 2, 2, 2, 236, 237, 3, 2, 2, 2, 237, 238, 3, 2, 2, 2, 238, 239, 7, 10, 2, 2, 239, 242, 7, 82, 2, 2, 240, 241, 7, 7, 2, 2, 241, 243, 7, 82, 2, 2, 242, 240, 3, 2, 2, 2, 242, 243, 3, 2, 2, 2, 243, 244, 3, 2, 2, 2, 244, 246, 7, 69, 2, 2, 245, 247, 5, 112, 57, 2, 246, 245, 3, 2, 2, 2, 246, 247, 3, 2, 2, 2, 247, 248, 3, 2, 2, 2, 248, 249, 7, 70, 2, 2, 249, 250, 7, 74, 2, 2, 250, 19, 3, 2, 2, 2, 251, 254, 5, 102, 52, 2, 252, 254, 5, 104, 53, 2, 253, 251, 3, 2, 2, 2, 253, 252, 3, 2, 2, 2, 253, 254, 3, 2, 2, 2, 254, 257, 3, 2, 2, 2, 255, 258, 5, 108, 55, 2, 256, 258, 5, 106, 54, 2, 257, 255, 3, 2, 2, 2, 257, 256, 3, 2, 2, 2, 257, 258, 3, 2, 2, 2, 258, 259, 3, 2, 2, 2, 259, 260, 7, 10, 2, 2, 260, 261, 7, 82, 2, 2, 261, 263, 7, 69, 2, 2, 262, 264, 5, 112, 57, 2, 263, 262, 3, 2, 2, 2, 263, 264, 3, 2, 2, 2, 264, 265, 3, 2, 2, 2, 265, 268, 7, 70, 2, 2, 266, 269, 5, 58, 30, 2, 267, 269, 7, 74, 2, 2, 268, 266, 3, 2, 2, 2, 268, 267, 3, 2, 2, 2, 269, 21, 3, 2, 2, 2, 270, 273, 5, 102, 52, 2, 271, 273, 5, 104, 53, 2, 272, 270, 3, 2, 2, 2, 272, 271, 3, 2, 2, 2, 272, 273, 3, 2, 2, 2, 273, 275, 3, 2, 2, 2, 274, 276, 5, 108, 55, 2, 275, 274, 3, 2, 2, 2, 275, 276, 3, 2, 2, 2, 276, 277, 3, 2, 2, 2, 277, 278, 7, 11, 2, 2, 278, 279, 7, 82, 2, 2, 279, 280, 7, 32, 2, 2, 280, 281, 7, 6, 2, 2, 281, 286, 7, 82, 2, 2, 282, 283, 7, 60, 2, 2, 283, 285, 7, 82, 2, 2, 284, 282, 3, 2, 2, 2, 285, 288, 3, 2, 2, 2, 286, 284, 3, 2, 2, 2, 286, 287, 3, 2, 2, 2, 287, 289, 3, 2, 2, 2, 288, 286, 3, 2, 2, 2, 289, 291, 7, 69, 2, 2, 290, 292, 5, 114, 58, 2, 291, 290, 3, 2, 2, 2, 291, 292, 3, 2, 2, 2, 292, 293, 3, 2, 2, 2, 293, 299, 7, 70, 2, 2, 294, 300, 7, 74, 2, 2, 295, 296, 7, 87, 2, 2, 296, 297, 5, 110, 56, 2, 297, 298, 7, 88, 2, 2, 298, 300, 3, 2, 2, 2, 299, 294, 3, 2, 2, 2, 299, 295, 3, 2, 2, 2, 300, 319, 3, 2, 2, 2, 301, 302, 7, 82, 2, 2, 302, 303, 7, 32, 2, 2, 303, 304, 7, 6, 2, 2, 304, 309, 7, 82, 2, 2, 305, 306, 7, 60, 2, 2, 306, 308, 7, 82, 2, 2, 307, 305, 3, 2, 2, 2, 308, 311, 3, 2, 2, 2, 309, 307, 3, 2, 2, 2, 309, 310, 3, 2, 2, 2, 310, 312, 3, 2, 2, 2, 311, 309, 3, 2, 2, 2, 312, 314, 7, 69, 2, 2, 313, 315, 5, 114, 58, 2, 314, 313, 3, 2, 2, 2, 314, 315, 3, 2, 2, 2, 315, 316, 3, 2, 2, 2, 316, 317, 7, 70, 2, 2, 317, 319, 7, 74, 2, 2, 318, 272, 3, 2, 2, 2, 318, 301, 3, 2, 2, 2, 319, 23, 3, 2, 2, 2, 320, 323, 5, 102, 52, 2, 321, 323, 5, 104, 53, 2, 322, 320, 3, 2, 2, 2, 322, 321, 3, 2, 2, 2, 322, 323, 3, 2, 2, 2, 323, 325, 3, 2, 2, 2, 324, 326, 5, 108, 55, 2, 325, 324, 3, 2, 2, 2, 325, 326, 3, 2, 2, 2, 326, 327, 3, 2, 2, 2, 327, 328, 7, 11, 2, 2, 328, 334, 7, 82, 2, 2, 329, 330, 7, 32, 2, 2, 330, 332, 5, 30, 16, 2, 331, 329, 3, 2, 2, 2, 331, 332, 3, 2, 2, 2, 332, 335, 3, 2, 2, 2, 333, 335, 7, 74, 2, 2, 334, 331, 3, 2, 2, 2, 334, 333, 3, 2, 2, 2, 335, 25, 3, 2, 2, 2, 336, 340, 5, 12, 7, 2, 337, 339, 5, 12, 7, 2, 338, 337, 3, 2, 2, 2, 339, 342, 3, 2, 2, 2, 340, 338, 3, 2, 2, 2, 340, 341, 3, 2, 2, 2, 341, 27, 3, 2, 2, 2, 342, 340, 3, 2, 2, 2, 343, 355, 5, 30, 16, 2, 344, 355, 5, 40, 21, 2, 345, 355, 5, 42, 22, 2, 346, 355, 5, 44, 23, 2, 347, 355, 5, 46, 24, 2, 348, 355, 5, 48, 25, 2, 349, 355, 5, 50, 26, 2, 350, 355, 5, 52, 27, 2, 351, 355, 5, 54, 28, 2, 352, 355, 5, 56, 29, 2, 353, 355, 5, 58, 30, 2, 354, 343, 3, 2, 2, 2, 354, 344, 3, 2, 2, 2, 354, 345, 3, 2, 2, 2, 354, 346, 3, 2, 2, 2, 354, 347, 3, 2, 2, 2, 354, 348, 3, 2, 2, 2, 354, 349, 3, 2, 2, 2, 354, 350, 3, 2, 2, 2, 354, 351, 3, 2, 2, 2, 354, 352, 3, 2, 2, 2, 354, 353, 3, 2, 2, 2, 355, 29, 3, 2, 2, 2, 356, 357, 5, 60, 31, 2, 357, 358, 7, 74, 2, 2, 358, 31, 3, 2, 2, 2, 359, 362, 7, 82, 2, 2, 360, 361, 7, 32, 2, 2, 361, 363, 5, 60, 31, 2, 362, 360, 3, 2, 2, 2, 362, 363, 3, 2, 2, 2, 363, 33, 3, 2, 2, 2, 364, 365, 7, 11, 2, 2, 365, 370, 5, 32, 17, 2, 366, 367, 7, 73, 2, 2, 367, 369, 5, 32, 17, 2, 368, 366, 3, 2, 2, 2, 369, 372, 3, 2, 2, 2, 370, 368, 3, 2, 2, 2, 370, 371, 3, 2, 2, 2, 371, 35, 3, 2, 2, 2, 372, 370, 3, 2, 2, 2, 373, 383, 5, 34, 18, 2, 374, 379, 5, 60, 31, 2, 375, 376, 7, 73, 2, 2, 376, 378, 5, 60, 31, 2, 377, 375, 3, 2, 2, 2, 378, 381, 3, 2, 2, 2, 379, 377, 3, 2, 2, 2, 379, 380, 3, 2, 2, 2, 380, 383, 3, 2, 2, 2, 381, 379, 3, 2, 2, 2, 382, 373, 3, 2, 2, 2, 382, 374, 3, 2, 2, 2, 383, 37, 3, 2, 2, 2, 384, 389, 5, 60, 31, 2, 385, 386, 7, 73, 2, 2, 386, 388, 5, 60, 31, 2, 387, 385, 3, 2, 2, 2, 388, 391, 3, 2, 2, 2, 389, 387, 3, 2, 2, 2, 389, 390, 3, 2, 2, 2, 390, 39, 3, 2, 2, 2, 391, 389, 3, 2, 2, 2, 392, 393, 7, 14, 2, 2, 393, 395, 7, 69, 2, 2, 394, 396, 5, 36, 19, 2, 395, 394, 3, 2, 2, 2, 395, 396, 3, 2, 2, 2, 396, 397, 3, 2, 2, 2, 397, 399, 7, 74, 2, 2, 398, 400, 5, 60, 31, 2, 399, 398, 3, 2, 2, 2, 399, 400, 3, 2, 2, 2, 400, 401, 3, 2, 2, 2, 401, 403, 7, 74, 2, 2, 402, 404, 5, 38, 20, 2, 403, 402, 3, 2, 2, 2, 403, 404, 3, 2, 2, 2, 404, 405, 3, 2, 2, 2, 405, 407, 7, 70, 2, 2, 406, 408, 5, 28, 15, 2, 407, 406, 3, 2, 2, 2, 407, 408, 3, 2, 2, 2, 408, 41, 3, 2, 2, 2, 409, 410, 7, 20, 2, 2, 410, 411, 7, 69, 2, 2, 411, 412, 5, 60, 31, 2, 412, 413, 7, 70, 2, 2, 413, 416, 5, 28, 15, 2, 414, 415, 7, 21, 2, 2, 415, 417, 5, 28, 15, 2, 416, 414, 3, 2, 2, 2, 416, 417, 3, 2, 2, 2, 417, 43, 3, 2, 2, 2, 418, 420, 7, 22, 2, 2, 419, 421, 5, 60, 31, 2, 420, 419, 3, 2, 2, 2, 420, 421, 3, 2, 2, 2, 421, 422, 3, 2, 2, 2, 422, 423, 7, 74, 2, 2, 423, 45, 3, 2, 2, 2, 424, 425, 7, 23, 2, 2, 425, 426, 7, 74, 2, 2, 426, 47, 3, 2, 2, 2, 427, 428, 7, 26, 2, 2, 428, 429, 7, 69, 2, 2, 429, 430, 5, 60, 31, 2, 430, 431, 7, 70, 2, 2, 431, 432, 5, 58, 30, 2, 432, 49, 3, 2, 2, 2, 433, 434, 7, 28, 2, 2, 434, 435, 7, 30, 2, 2, 435, 436, 7, 69, 2, 2, 436, 437, 5, 60, 31, 2, 437, 438, 7, 70, 2, 2, 438, 51, 3, 2, 2, 2, 439, 440, 7, 29, 2, 2, 440, 441, 7, 30, 2, 2, 441, 442, 7, 69, 2, 2, 442, 443, 5, 60, 31, 2, 443, 444, 7, 70, 2, 2, 444, 53, 3, 2, 2, 2, 445, 446, 7, 15, 2, 2, 446, 447, 7, 69, 2, 2, 447, 448, 5, 60, 31, 2, 448, 449, 7, 70, 2, 2, 449, 450, 5, 58, 30, 2, 450, 55, 3, 2, 2, 2, 451, 452, 7, 31, 2, 2, 452, 453, 5, 58, 30, 2, 453, 57, 3, 2, 2, 2, 454, 458, 7, 87, 2, 2, 455, 457, 5, 12, 7, 2, 456, 455, 3, 2, 2, 2, 457, 460, 3, 2, 2, 2, 458, 456, 3, 2, 2, 2, 458, 459, 3, 2, 2, 2, 459, 461, 3, 2, 2, 2, 460, 458, 3, 2, 2, 2, 461, 462, 7, 88, 2, 2, 462, 59, 3, 2, 2, 2, 463, 466, 5, 62, 32, 2, 464, 466, 5, 64, 33, 2, 465, 463, 3, 2, 2, 2, 465, 464, 3, 2, 2, 2, 466, 61, 3, 2, 2, 2, 467, 468, 5, 90, 46, 2, 468, 469, 9, 2, 2, 2, 469, 470, 5, 62, 32, 2, 470, 473, 3, 2, 2, 2, 471, 473, 5, 66, 34, 2, 472, 467, 3, 2, 2, 2, 472, 471, 3, 2, 2, 2, 473, 63, 3, 2, 2, 2, 474, 475, 5, 118, 60, 2, 475, 476, 7, 63, 2, 2, 476, 477, 5, 58, 30, 2, 477, 65, 3, 2, 2, 2, 478, 486, 5, 68, 35, 2, 479, 480, 7, 61, 2, 2, 480, 481, 5, 68, 35, 2, 481, 482, 7, 62, 2, 2, 482, 483, 5, 68, 35, 2, 483, 485, 3, 2, 2, 2, 484, 479, 3, 2, 2, 2, 485, 488, 3, 2, 2, 2, 486, 484, 3, 2, 2, 2, 486, 487, 3, 2, 2, 2, 487, 67, 3, 2, 2, 2, 488, 486, 3, 2, 2, 2, 489, 494, 5, 70, 36, 2, 490, 491, 7, 43, 2, 2, 491, 493, 5, 70, 36, 2, 492, 490, 3, 2, 2, 2, 493, 496, 3, 2, 2, 2, 494, 492, 3, 2, 2, 2, 494, 495, 3, 2, 2, 2, 495, 69, 3, 2, 2, 2, 496, 494, 3, 2, 2, 2, 497, 502, 5, 72, 37, 2, 498, 499, 7, 44, 2, 2, 499, 501, 5, 72, 37, 2, 500, 498, 3, 2, 2, 2, 501, 504, 3, 2, 2, 2, 502, 500, 3, 2, 2, 2, 502, 503, 3, 2, 2, 2, 503, 71, 3, 2, 2, 2, 504, 502, 3, 2, 2, 2, 505, 510, 5, 74, 38, 2, 506, 507, 7, 68, 2, 2, 507, 509, 5, 74, 38, 2, 508, 506, 3, 2, 2, 2, 509, 512, 3, 2, 2, 2, 510, 508, 3, 2, 2, 2, 510, 511, 3, 2, 2, 2, 511, 73, 3, 2, 2, 2, 512, 510, 3, 2, 2, 2, 513, 518, 5, 76, 39, 2, 514, 515, 7, 67, 2, 2, 515, 517, 5, 76, 39, 2, 516, 514, 3, 2, 2, 2, 517, 520, 3, 2, 2, 2, 518, 516, 3, 2, 2, 2, 518, 519, 3, 2, 2, 2, 519, 75, 3, 2, 2, 2, 520, 518, 3, 2, 2, 2, 521, 526, 5, 78, 40, 2, 522, 523, 7, 66, 2, 2, 523, 525, 5, 78, 40, 2, 524, 522, 3, 2, 2, 2, 525, 528, 3, 2, 2, 2, 526, 524, 3, 2, 2, 2, 526, 527, 3, 2, 2, 2, 527, 77, 3, 2, 2, 2, 528, 526, 3, 2, 2, 2, 529, 534, 5, 80, 41, 2, 530, 531, 9, 3, 2, 2, 531, 533, 5, 80, 41, 2, 532, 530, 3, 2, 2, 2, 533, 536, 3, 2, 2, 2, 534, 532, 3, 2, 2, 2, 534, 535, 3, 2, 2, 2, 535, 79, 3, 2, 2, 2, 536, 534, 3, 2, 2, 2, 537, 542, 5, 82, 42, 2, 538, 539, 9, 4, 2, 2, 539, 541, 5, 82, 42, 2, 540, 538, 3, 2, 2, 2, 541, 544, 3, 2, 2, 2, 542, 540, 3, 2, 2, 2, 542, 543, 3, 2, 2, 2, 543, 81, 3, 2, 2, 2, 544, 542, 3, 2, 2, 2, 545, 550, 5, 84, 43, 2, 546, 547, 9, 5, 2, 2, 547, 549, 5, 84, 43, 2, 548, 546, 3, 2, 2, 2, 549, 552, 3, 2, 2, 2, 550, 548, 3, 2, 2, 2, 550, 551, 3, 2, 2, 2, 551, 83, 3, 2, 2, 2, 552, 550, 3, 2, 2, 2, 553, 558, 5, 86, 44, 2, 554, 555, 9, 6, 2, 2, 555, 557, 5, 86, 44, 2, 556, 554, 3, 2, 2, 2, 557, 560, 3, 2, 2, 2, 558, 556, 3, 2, 2, 2, 558, 559, 3, 2, 2, 2, 559, 85, 3, 2, 2, 2, 560, 558, 3, 2, 2, 2, 561, 566, 5, 88, 45, 2, 562, 563, 9, 7, 2, 2, 563, 565, 5, 88, 45, 2, 564, 562, 3, 2, 2, 2, 565, 568, 3, 2, 2, 2, 566, 564, 3, 2, 2, 2, 566, 567, 3, 2, 2, 2, 567, 87, 3, 2, 2, 2, 568, 566, 3, 2, 2, 2, 569, 570, 8, 45, 1, 2, 570, 571, 9, 8, 2, 2, 571, 574, 5, 88, 45, 5, 572, 574, 5, 90, 46, 2, 573, 569, 3, 2, 2, 2, 573, 572, 3, 2, 2, 2, 574, 579, 3, 2, 2, 2, 575, 576, 12, 3, 2, 2, 576, 578, 9, 9, 2, 2, 577, 575, 3, 2, 2, 2, 578, 581, 3, 2, 2, 2, 579, 577, 3, 2, 2, 2, 579, 580, 3, 2, 2, 2, 580, 89, 3, 2, 2, 2, 581, 579, 3, 2, 2, 2, 582, 589, 5, 98, 50, 2, 583, 588, 5, 118, 60, 2, 584, 585, 7, 60, 2, 2, 585, 588, 7, 82, 2, 2, 586, 588, 5, 120, 61, 2, 587, 583, 3, 2, 2, 2, 587, 584, 3, 2, 2, 2, 587, 586, 3, 2, 2, 2, 588, 591, 3, 2, 2, 2, 589, 587, 3, 2, 2, 2, 589, 590, 3, 2, 2, 2, 590, 91, 3, 2, 2, 2, 591, 589, 3, 2, 2, 2, 592, 593, 7, 71, 2, 2, 593, 598, 5, 60, 31, 2, 594, 595, 7, 73, 2, 2, 595, 597, 5, 60, 31, 2, 596, 594, 3, 2, 2, 2, 597, 600, 3, 2, 2, 2, 598, 596, 3, 2, 2, 2, 598, 599, 3, 2, 2, 2, 599, 601, 3, 2, 2, 2, 600, 598, 3, 2, 2, 2, 601, 602, 7, 72, 2, 2, 602, 93, 3, 2, 2, 2, 603, 604, 7, 82, 2, 2, 604, 605, 7, 62, 2, 2, 605, 606, 5, 60, 31, 2, 606, 95, 3, 2, 2, 2, 607, 608, 7, 87, 2, 2, 608, 613, 5, 94, 48, 2, 609, 610, 7, 73, 2, 2, 610, 612, 5, 94, 48, 2, 611, 609, 3, 2, 2, 2, 612, 615, 3, 2, 2, 2, 613, 611, 3, 2, 2, 2, 613, 614, 3, 2, 2, 2, 614, 616, 3, 2, 2, 2, 615, 613, 3, 2, 2, 2, 616, 617, 7, 88, 2, 2, 617, 97, 3, 2, 2, 2, 618, 632, 7, 76, 2, 2, 619, 632, 7, 24, 2, 2, 620, 632, 7, 25, 2, 2, 621, 632, 7, 79, 2, 2, 622, 632, 7, 80, 2, 2, 623, 624, 7, 69, 2, 2, 624, 625, 5, 60, 31, 2, 625, 626, 7, 70, 2, 2, 626, 632, 3, 2, 2, 2, 627, 632, 7, 82, 2, 2, 628, 632, 5, 128, 65, 2, 629, 632, 5, 92, 47, 2, 630, 632, 5, 96, 49, 2, 631, 618, 3, 2, 2, 2, 631, 619, 3, 2, 2, 2, 631, 620, 3, 2, 2, 2, 631, 621, 3, 2, 2, 2, 631, 622, 3, 2, 2, 2, 631, 623, 3, 2, 2, 2, 631, 627, 3, 2, 2, 2, 631, 628, 3, 2, 2, 2, 631, 629, 3, 2, 2, 2, 631, 630, 3, 2, 2, 2, 632, 99, 3, 2, 2, 2, 633, 634, 7, 82, 2, 2, 634, 635, 7, 32, 2, 2, 635, 636, 5, 60, 31, 2, 636, 101, 3, 2, 2, 2, 637, 638, 7, 19, 2, 2, 638, 103, 3, 2, 2, 2, 639, 640, 7, 18, 2, 2, 640, 105, 3, 2, 2, 2, 641, 642, 7, 17, 2, 2, 642, 107, 3, 2, 2, 2, 643, 644, 7, 16, 2, 2, 644, 109, 3, 2, 2, 2, 645, 650, 5, 100, 51, 2, 646, 647, 7, 73, 2, 2, 647, 649, 5, 100, 51, 2, 648, 646, 3, 2, 2, 2, 649, 652, 3, 2, 2, 2, 650, 648, 3, 2, 2, 2, 650, 651, 3, 2, 2, 2, 651, 111, 3, 2, 2, 2, 652, 650, 3, 2, 2, 2, 653, 658, 5, 126, 64, 2, 654, 655, 7, 73, 2, 2, 655, 657, 5, 126, 64, 2, 656, 654, 3, 2, 2, 2, 657, 660, 3, 2, 2, 2, 658, 656, 3, 2, 2, 2, 658, 659, 3, 2, 2, 2, 659, 113, 3, 2, 2, 2, 660, 658, 3, 2, 2, 2, 661, 666, 5, 124, 63, 2, 662, 663, 7, 73, 2, 2, 663, 665, 5, 124, 63, 2, 664, 662, 3, 2, 2, 2, 665, 668, 3, 2, 2, 2, 666, 664, 3, 2, 2, 2, 666, 667, 3, 2, 2, 2, 667, 115, 3, 2, 2, 2, 668, 666, 3, 2, 2, 2, 669, 674, 7, 82, 2, 2, 670, 671, 7, 73, 2, 2, 671, 673, 7, 82, 2, 2, 672, 670, 3, 2, 2, 2, 673, 676, 3, 2, 2, 2, 674, 672, 3, 2, 2, 2, 674, 675, 3, 2, 2, 2, 675, 117, 3, 2, 2, 2, 676, 674, 3, 2, 2, 2, 677, 679, 7, 69, 2, 2, 678, 680, 5, 114, 58, 2, 679, 678, 3, 2, 2, 2, 679, 680, 3, 2, 2, 2, 680, 681, 3, 2, 2, 2, 681, 682, 7, 70, 2, 2, 682, 119, 3, 2, 2, 2, 683, 684, 7, 71, 2, 2, 684, 685, 5, 122, 62, 2, 685, 686, 7, 72, 2, 2, 686, 688, 3, 2, 2, 2, 687, 683, 3, 2, 2, 2, 688, 689, 3, 2, 2, 2, 689, 687, 3, 2, 2, 2, 689, 690, 3, 2, 2, 2, 690, 121, 3, 2, 2, 2, 691, 695, 7, 79, 2, 2, 692, 695, 5, 128, 65, 2, 693, 695, 5, 90, 46, 2, 694, 691, 3, 2, 2, 2, 694, 692, 3, 2, 2, 2, 694, 693, 3, 2, 2, 2, 695, 123, 3, 2, 2, 2, 696, 698, 7, 63, 2, 2, 697, 696, 3, 2, 2, 2, 697, 698, 3, 2, 2, 2, 698, 699, 3, 2, 2, 2, 699, 700, 5, 60, 31, 2, 700, 125, 3, 2, 2, 2, 701, 702, 7, 82, 2, 2, 702, 127, 3, 2, 2, 2, 703, 707, 7, 86, 2, 2, 704, 706, 5, 130, 66, 2, 705, 704, 3, 2, 2, 2, 706, 709, 3, 2, 2, 2, 707, 705, 3, 2, 2, 2, 707, 708, 3, 2, 2, 2, 708, 710, 3, 2, 2, 2, 709, 707, 3, 2, 2, 2, 710, 711, 7, 86, 2, 2, 711, 129, 3, 2, 2, 2, 712, 719, 7, 89, 2, 2, 713, 719, 7, 91, 2, 2, 714, 715, 7, 90, 2, 2, 715, 716, 5, 60, 31, 2, 716, 717, 7, 88, 2, 2, 717, 719, 3, 2, 2, 2, 718, 712, 3, 2, 2, 2, 718, 713, 3, 2, 2, 2, 718, 714, 3, 2, 2, 2, 719, 131, 3, 2, 2, 2, 82, 135, 141, 143, 149, 160, 171, 182, 194, 198, 202, 208, 212, 216, 222, 226, 230, 233, 236, 242, 246, 253, 257, 263, 268, 272, 275, 286, 291, 299, 309, 314, 318, 322, 325, 331, 334, 340, 354, 362, 370, 379, 382, 389, 395, 399, 403, 407, 416, 420, 458, 465, 472, 486, 494, 502, 510, 518, 526, 534, 542, 550, 558, 566, 573, 579, 587, 589, 598, 613, 631, 650, 658, 666, 674, 679, 689, 694, 697, 707, 718] \ No newline at end of file diff --git a/Bite/AntlrGenerated/AntlrBiteParser/BITEParser.tokens b/Bite/AntlrGenerated/AntlrBiteParser/BITEParser.tokens index 4148fee..9e582cf 100644 --- a/Bite/AntlrGenerated/AntlrBiteParser/BITEParser.tokens +++ b/Bite/AntlrGenerated/AntlrBiteParser/BITEParser.tokens @@ -23,66 +23,70 @@ NullReference=22 ThisReference=23 UsingDirective=24 ImportDirective=25 -AssignOperator=26 -PlusAssignOperator=27 -MinusAssignOperator=28 -MultiplyAssignOperator=29 -DivideAssignOperator=30 -ModuloAssignOperator=31 -BitwiseAndAssignOperator=32 -BitwiseOrAssignOperator=33 -BitwiseXorAssignOperator=34 -BitwiseLeftShiftAssignOperator=35 -BitwiseRightShiftAssignOperator=36 -LogicalOrOperator=37 -LogicalAndOperator=38 -UnequalOperator=39 -EqualOperator=40 -GreaterOperator=41 -ShiftRightOperator=42 -GreaterEqualOperator=43 -SmallerOperator=44 -ShiftLeftOperator=45 -SmallerEqualOperator=46 -MinusOperator=47 -MinusMinusOperator=48 -PlusOperator=49 -PlusPlusOperator=50 -DivideOperator=51 -MultiplyOperator=52 -LogicalNegationOperator=53 -DotOperator=54 -QuestionMarkOperator=55 -ColonOperator=56 -ReferenceOperator=57 -ModuloOperator=58 -ComplimentOperator=59 -BitwiseAndOperator=60 -BitwiseXorOperator=61 -BitwiseOrOperator=62 -OpeningRoundBracket=63 -ClosingRoundBracket=64 -SquarebracketLeft=65 -SquarebracketRight=66 -CommaSeperator=67 -SemicolonSeperator=68 -DollarOperator=69 -BooleanLiteral=70 -False_=71 -True_=72 -IntegerLiteral=73 -FloatingLiteral=74 -DecimalLiteral=75 -Identifier=76 -COMMENT=77 -WS=78 -LINE_COMMENT=79 -DQUOTE=80 -CURLY_L=81 -CURLY_R=82 -TEXT=83 -BACKSLASH_PAREN=84 -ESCAPE_SEQUENCE=85 +StartStatement=26 +UseStatement=27 +ThreadStatement=28 +SyncKeyword=29 +AssignOperator=30 +PlusAssignOperator=31 +MinusAssignOperator=32 +MultiplyAssignOperator=33 +DivideAssignOperator=34 +ModuloAssignOperator=35 +BitwiseAndAssignOperator=36 +BitwiseOrAssignOperator=37 +BitwiseXorAssignOperator=38 +BitwiseLeftShiftAssignOperator=39 +BitwiseRightShiftAssignOperator=40 +LogicalOrOperator=41 +LogicalAndOperator=42 +UnequalOperator=43 +EqualOperator=44 +GreaterOperator=45 +ShiftRightOperator=46 +GreaterEqualOperator=47 +SmallerOperator=48 +ShiftLeftOperator=49 +SmallerEqualOperator=50 +MinusOperator=51 +MinusMinusOperator=52 +PlusOperator=53 +PlusPlusOperator=54 +DivideOperator=55 +MultiplyOperator=56 +LogicalNegationOperator=57 +DotOperator=58 +QuestionMarkOperator=59 +ColonOperator=60 +ReferenceOperator=61 +ModuloOperator=62 +ComplimentOperator=63 +BitwiseAndOperator=64 +BitwiseXorOperator=65 +BitwiseOrOperator=66 +OpeningRoundBracket=67 +ClosingRoundBracket=68 +SquareBracketLeft=69 +SquareBracketRight=70 +CommaSeparator=71 +SemicolonSeparator=72 +DollarOperator=73 +BooleanLiteral=74 +False_=75 +True_=76 +IntegerLiteral=77 +FloatingLiteral=78 +DecimalLiteral=79 +Identifier=80 +COMMENT=81 +WS=82 +LINE_COMMENT=83 +DQUOTE=84 +CURLY_L=85 +CURLY_R=86 +TEXT=87 +BACKSLASH_PAREN=88 +ESCAPE_SEQUENCE=89 'module'=1 'class'=2 'struct'=3 @@ -108,52 +112,56 @@ ESCAPE_SEQUENCE=85 'this'=23 'using'=24 'import'=25 -'='=26 -'+='=27 -'-='=28 -'*='=29 -'/='=30 -'%='=31 -'&='=32 -'|='=33 -'^='=34 -'<<='=35 -'>>='=36 -'||'=37 -'&&'=38 -'!='=39 -'=='=40 -'>'=41 -'>>'=42 -'>='=43 -'<'=44 -'<<'=45 -'<='=46 -'-'=47 -'--'=48 -'+'=49 -'++'=50 -'/'=51 -'*'=52 -'!'=53 -'.'=54 -'?'=55 -':'=56 -'->'=57 -'%'=58 -'~'=59 -'&'=60 -'^'=61 -'|'=62 -'('=63 -')'=64 -'['=65 -']'=66 -','=67 -';'=68 -'$'=69 -'false'=71 -'true'=72 -'{'=81 -'}'=82 -'${'=84 +'start'=26 +'use'=27 +'thread'=28 +'sync'=29 +'='=30 +'+='=31 +'-='=32 +'*='=33 +'/='=34 +'%='=35 +'&='=36 +'|='=37 +'^='=38 +'<<='=39 +'>>='=40 +'||'=41 +'&&'=42 +'!='=43 +'=='=44 +'>'=45 +'>>'=46 +'>='=47 +'<'=48 +'<<'=49 +'<='=50 +'-'=51 +'--'=52 +'+'=53 +'++'=54 +'/'=55 +'*'=56 +'!'=57 +'.'=58 +'?'=59 +':'=60 +'->'=61 +'%'=62 +'~'=63 +'&'=64 +'^'=65 +'|'=66 +'('=67 +')'=68 +'['=69 +']'=70 +','=71 +';'=72 +'$'=73 +'false'=75 +'true'=76 +'{'=85 +'}'=86 +'${'=88 diff --git a/Bite/AntlrGenerated/AntlrBiteParser/BITEParserBaseVisitor.cs b/Bite/AntlrGenerated/AntlrBiteParser/BITEParserBaseVisitor.cs index b425ce0..a8b6482 100644 --- a/Bite/AntlrGenerated/AntlrBiteParser/BITEParserBaseVisitor.cs +++ b/Bite/AntlrGenerated/AntlrBiteParser/BITEParserBaseVisitor.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -// Generated from C:/Language Dev 3/Bite Programming Language/Bite/Grammar\BITEParser.g4 by ANTLR 4.9.2 +// Generated from BITEParser.g4 by ANTLR 4.9.2 // Unreachable code detected #pragma warning disable 0162 @@ -276,6 +276,26 @@ public partial class BITEParserBaseVisitor : AbstractParseTreeVisitorThe visitor result. public virtual Result VisitUsingStatement([NotNull] BITEParser.UsingStatementContext context) { return VisitChildren(context); } /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitStartThreadStatement([NotNull] BITEParser.StartThreadStatementContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitUseThreadStatement([NotNull] BITEParser.UseThreadStatementContext context) { return VisitChildren(context); } + /// /// Visit a parse tree produced by . /// /// The default implementation returns the result of calling @@ -286,6 +306,16 @@ public partial class BITEParserBaseVisitor : AbstractParseTreeVisitorThe visitor result. public virtual Result VisitWhileStatement([NotNull] BITEParser.WhileStatementContext context) { return VisitChildren(context); } /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitSyncBlock([NotNull] BITEParser.SyncBlockContext context) { return VisitChildren(context); } + /// /// Visit a parse tree produced by . /// /// The default implementation returns the result of calling @@ -456,6 +486,36 @@ public partial class BITEParserBaseVisitor : AbstractParseTreeVisitorThe visitor result. public virtual Result VisitCall([NotNull] BITEParser.CallContext context) { return VisitChildren(context); } /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitArrayExpression([NotNull] BITEParser.ArrayExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitElementInitialization([NotNull] BITEParser.ElementInitializationContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitDictionaryExpression([NotNull] BITEParser.DictionaryExpressionContext context) { return VisitChildren(context); } + /// /// Visit a parse tree produced by . /// /// The default implementation returns the result of calling @@ -466,6 +526,16 @@ public partial class BITEParserBaseVisitor : AbstractParseTreeVisitorThe visitor result. public virtual Result VisitPrimary([NotNull] BITEParser.PrimaryContext context) { return VisitChildren(context); } /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitMemberInitialization([NotNull] BITEParser.MemberInitializationContext context) { return VisitChildren(context); } + /// /// Visit a parse tree produced by . /// /// The default implementation returns the result of calling @@ -506,6 +576,16 @@ public partial class BITEParserBaseVisitor : AbstractParseTreeVisitorThe visitor result. public virtual Result VisitStaticModifier([NotNull] BITEParser.StaticModifierContext context) { return VisitChildren(context); } /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitInitializerExpression([NotNull] BITEParser.InitializerExpressionContext context) { return VisitChildren(context); } + /// /// Visit a parse tree produced by . /// /// The default implementation returns the result of calling diff --git a/Bite/AntlrGenerated/AntlrBiteParser/BITEParserVisitor.cs b/Bite/AntlrGenerated/AntlrBiteParser/BITEParserVisitor.cs index 4772251..84dcb9d 100644 --- a/Bite/AntlrGenerated/AntlrBiteParser/BITEParserVisitor.cs +++ b/Bite/AntlrGenerated/AntlrBiteParser/BITEParserVisitor.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -// Generated from C:/Language Dev 3/Bite Programming Language/Bite/Grammar\BITEParser.g4 by ANTLR 4.9.2 +// Generated from BITEParser.g4 by ANTLR 4.9.2 // Unreachable code detected #pragma warning disable 0162 @@ -177,12 +177,30 @@ public interface IBITEParserVisitor : IParseTreeVisitor { /// The visitor result. Result VisitUsingStatement([NotNull] BITEParser.UsingStatementContext context); /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitStartThreadStatement([NotNull] BITEParser.StartThreadStatementContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitUseThreadStatement([NotNull] BITEParser.UseThreadStatementContext context); + /// /// Visit a parse tree produced by . /// /// The parse tree. /// The visitor result. Result VisitWhileStatement([NotNull] BITEParser.WhileStatementContext context); /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitSyncBlock([NotNull] BITEParser.SyncBlockContext context); + /// /// Visit a parse tree produced by . /// /// The parse tree. @@ -285,12 +303,36 @@ public interface IBITEParserVisitor : IParseTreeVisitor { /// The visitor result. Result VisitCall([NotNull] BITEParser.CallContext context); /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitArrayExpression([NotNull] BITEParser.ArrayExpressionContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitElementInitialization([NotNull] BITEParser.ElementInitializationContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitDictionaryExpression([NotNull] BITEParser.DictionaryExpressionContext context); + /// /// Visit a parse tree produced by . /// /// The parse tree. /// The visitor result. Result VisitPrimary([NotNull] BITEParser.PrimaryContext context); /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitMemberInitialization([NotNull] BITEParser.MemberInitializationContext context); + /// /// Visit a parse tree produced by . /// /// The parse tree. @@ -315,6 +357,12 @@ public interface IBITEParserVisitor : IParseTreeVisitor { /// The visitor result. Result VisitStaticModifier([NotNull] BITEParser.StaticModifierContext context); /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitInitializerExpression([NotNull] BITEParser.InitializerExpressionContext context); + /// /// Visit a parse tree produced by . /// /// The parse tree. diff --git a/Bite/Ast/AstGenerator/BiteAstGenerator.cs b/Bite/Ast/AstGenerator/BiteAstGenerator.cs index 6167997..66c3ac8 100644 --- a/Bite/Ast/AstGenerator/BiteAstGenerator.cs +++ b/Bite/Ast/AstGenerator/BiteAstGenerator.cs @@ -10,11 +10,16 @@ namespace MemoizeSharp public class BiteAstGeneratorException : ApplicationException { + public string AstGeneratorExceptionMessage { get; } + + #region Public + public BiteAstGeneratorException( string message ) : base( message ) { AstGeneratorExceptionMessage = message; } - public string AstGeneratorExceptionMessage { get; } + + #endregion } public class BiteAstGenerator : BITEParserBaseVisitor < AstBaseNode > @@ -76,7 +81,8 @@ public override AstBaseNode VisitAdditive( BITEParser.AdditiveContext context ) { if ( context.GetChild( counter ) is BITEParser.MultiplicativeContext rhsContext ) { - currentBinaryOperationBaseNode.RightOperand = ( ExpressionBaseNode ) VisitMultiplicative( rhsContext ); + currentBinaryOperationBaseNode.RightOperand = + ( ExpressionBaseNode ) VisitMultiplicative( rhsContext ); } } @@ -133,6 +139,23 @@ public override AstBaseNode VisitArguments( BITEParser.ArgumentsContext context return argumentsBase; } + public override AstBaseNode VisitArrayExpression( BITEParser.ArrayExpressionContext context ) + { + ArrayExpressionNode initializerNode = new ArrayExpressionNode(); + + if ( context.expression() != null ) + { + initializerNode.Expressions = new List < ExpressionBaseNode >(); + + foreach ( BITEParser.ExpressionContext expression in context.expression() ) + { + initializerNode.Expressions.Add( ( ExpressionBaseNode ) VisitExpression( expression ) ); + } + } + + return initializerNode; + } + public override AstBaseNode VisitAssignment( BITEParser.AssignmentContext context ) { if ( context.call() != null && context.assignment() != null ) @@ -163,6 +186,11 @@ public override AstBaseNode VisitAssignment( BITEParser.AssignmentContext contex assignmentBaseNode.OperatorType = AssignmentOperatorTypes.MultAssign; } + if ( context.ModuloAssignOperator() != null ) + { + assignmentBaseNode.OperatorType = AssignmentOperatorTypes.ModuloAssignOperator; + } + if ( context.PlusAssignOperator() != null ) { assignmentBaseNode.OperatorType = AssignmentOperatorTypes.PlusAssign; @@ -173,6 +201,31 @@ public override AstBaseNode VisitAssignment( BITEParser.AssignmentContext contex assignmentBaseNode.OperatorType = AssignmentOperatorTypes.MinusAssign; } + if ( context.BitwiseAndAssignOperator() != null ) + { + assignmentBaseNode.OperatorType = AssignmentOperatorTypes.BitwiseAndAssignOperator; + } + + if ( context.BitwiseOrAssignOperator() != null ) + { + assignmentBaseNode.OperatorType = AssignmentOperatorTypes.BitwiseOrAssignOperator; + } + + if ( context.BitwiseXorAssignOperator() != null ) + { + assignmentBaseNode.OperatorType = AssignmentOperatorTypes.BitwiseXorAssignOperator; + } + + if ( context.BitwiseLeftShiftAssignOperator() != null ) + { + assignmentBaseNode.OperatorType = AssignmentOperatorTypes.BitwiseLeftShiftAssignOperator; + } + + if ( context.BitwiseRightShiftAssignOperator() != null ) + { + assignmentBaseNode.OperatorType = AssignmentOperatorTypes.BitwiseRightShiftAssignOperator; + } + assignmentBaseNode.AssignmentBase = ( AssignmentBaseNode ) VisitAssignment( context.assignment() ); return assignmentBaseNode; @@ -226,7 +279,7 @@ public override AstBaseNode VisitAssignment( BITEParser.AssignmentContext contex assignmentBaseNode.PrimaryBaseNode = primaryNode; } - if (baseNode is TernaryOperationBaseNode ternaryOperationNode) + if ( baseNode is TernaryOperationBaseNode ternaryOperationNode ) { assignmentBaseNode.Type = AssignmentTypes.Ternary; assignmentBaseNode.Ternary = ternaryOperationNode; @@ -272,7 +325,8 @@ public override AstBaseNode VisitBitwiseAnd( BITEParser.BitwiseAndContext contex { if ( context.GetChild( counter ) is BITEParser.EqualityContext rhsContext ) { - currentBinaryOperationBaseNode.RightOperand = ( ExpressionBaseNode ) VisitEquality( rhsContext ); + currentBinaryOperationBaseNode.RightOperand = + ( ExpressionBaseNode ) VisitEquality( rhsContext ); } } @@ -610,15 +664,20 @@ public override AstBaseNode VisitCall( BITEParser.CallContext context ) if ( elementIdentifierContext.call() != null ) { - callElementEntry.CallBase = ( CallBaseNode ) VisitCall( elementIdentifierContext.call() ); + callElementEntry.CallBase = + ( CallBaseNode ) VisitCall( elementIdentifierContext.call() ); callElementEntry.CallElementType = CallElementTypes.Call; } - if ( elementIdentifierContext.@string() != null && elementIdentifierContext.@string().stringPart(0).TEXT() != null ) + if ( elementIdentifierContext.@string() != null && + elementIdentifierContext.@string().stringPart( 0 ).TEXT() != null ) { - string literal = elementIdentifierContext.@string().stringPart(0).TEXT().Symbol.Text; + string literal = elementIdentifierContext.@string(). + stringPart( 0 ). + TEXT(). + Symbol.Text; callElementEntry.Identifier = literal; @@ -648,7 +707,8 @@ public override AstBaseNode VisitCall( BITEParser.CallContext context ) if ( elementIdentifierContext.call() != null ) { - callElementEntry.CallBase = ( CallBaseNode ) VisitCall( elementIdentifierContext.call() ); + callElementEntry.CallBase = + ( CallBaseNode ) VisitCall( elementIdentifierContext.call() ); callElementEntry.CallElementType = CallElementTypes.Call; @@ -656,7 +716,10 @@ public override AstBaseNode VisitCall( BITEParser.CallContext context ) if ( elementIdentifierContext.@string() != null ) { - string literal = elementIdentifierContext.@string().stringPart(0).TEXT().Symbol.Text; + string literal = elementIdentifierContext.@string(). + stringPart( 0 ). + TEXT(). + Symbol.Text; callElementEntry.Identifier = literal; @@ -802,7 +865,8 @@ public override AstBaseNode VisitClassInstanceDeclaration( BITEParser.ClassInsta if ( context.arguments() != null ) { - classInstanceDeclarationBaseNode.ArgumentsBase = ( ArgumentsBaseNode ) VisitArguments( context.arguments() ); + classInstanceDeclarationBaseNode.ArgumentsBase = + ( ArgumentsBaseNode ) VisitArguments( context.arguments() ); } string accessToken = null; @@ -817,10 +881,23 @@ public override AstBaseNode VisitClassInstanceDeclaration( BITEParser.ClassInsta accessToken = "private"; } - ModifiersBaseNode modifiersBase = new ModifiersBaseNode( accessToken, abstractStaticMod ); classInstanceDeclarationBaseNode.ModifiersBase = modifiersBase; + BITEParser.InitializerExpressionContext initializerExpression = context.initializerExpression(); + + if ( initializerExpression != null ) + { + classInstanceDeclarationBaseNode.Initializers = new List < MemberInitializationNode >(); + + foreach ( BITEParser.MemberInitializationContext initialization in initializerExpression. + memberInitialization() ) + { + classInstanceDeclarationBaseNode.Initializers.Add( + ( MemberInitializationNode ) VisitMemberInitialization( initialization ) ); + } + } + return classInstanceDeclarationBaseNode; } @@ -836,7 +913,7 @@ public override AstBaseNode VisitDeclaration( BITEParser.DeclarationContext cont return VisitStructDeclaration( context.structDeclaration() ); } - if (context.externalFunctionDeclaration() != null) + if ( context.externalFunctionDeclaration() != null ) { return VisitExternalFunctionDeclaration( context.externalFunctionDeclaration() ); } @@ -871,6 +948,26 @@ public override AstBaseNode VisitDeclaration( BITEParser.DeclarationContext cont return null; } + public override AstBaseNode VisitDictionaryExpression( BITEParser.DictionaryExpressionContext context ) + { + DictionaryInitializerNode initializerNode = new DictionaryInitializerNode(); + + if ( context.elementInitialization() != null ) + { + initializerNode.ElementInitializers = new Dictionary < Identifier, ExpressionBaseNode >(); + + foreach ( BITEParser.ElementInitializationContext initialization in context.elementInitialization() ) + { + initializerNode.ElementInitializers.Add( + new Identifier( initialization.Identifier().Symbol.Text ), + ( ExpressionBaseNode ) VisitExpression( initialization.expression() ) + ); + } + } + + return initializerNode; + } + public override AstBaseNode VisitElementAccess( BITEParser.ElementAccessContext context ) { return base.VisitElementAccess( context ); @@ -925,7 +1022,9 @@ public override AstBaseNode VisitEquality( BITEParser.EqualityContext context ) currentBinaryOperationBaseNode.DebugInfoAstNode.ColumnNumberStart = rhsContext.Start.Column; currentBinaryOperationBaseNode.DebugInfoAstNode.ColumnNumberEnd = rhsContext.Stop.Column; - currentBinaryOperationBaseNode.RightOperand = ( ExpressionBaseNode ) VisitRelational( rhsContext ); + + currentBinaryOperationBaseNode.RightOperand = + ( ExpressionBaseNode ) VisitRelational( rhsContext ); } } @@ -975,69 +1074,91 @@ public override AstBaseNode VisitExprStatement( BITEParser.ExprStatementContext return expressionStatementBaseNode; } - public override AstBaseNode VisitLocalVarDeclaration( BITEParser.LocalVarDeclarationContext context ) + public override AstBaseNode VisitExternalFunctionDeclaration( + BITEParser.ExternalFunctionDeclarationContext context ) { - LocalVariableDeclarationBaseNode variableDeclarationBaseNode = new LocalVariableDeclarationBaseNode(); - variableDeclarationBaseNode.VarId = new Identifier( context.Identifier().Symbol.Text ); - variableDeclarationBaseNode.DebugInfoAstNode.LineNumberStart = context.Start.Line; - variableDeclarationBaseNode.DebugInfoAstNode.LineNumberEnd = context.Stop.Line; + FunctionDeclarationBaseNode functionDeclarationBaseNode = new FunctionDeclarationBaseNode(); + functionDeclarationBaseNode.FunctionId = new Identifier(); + functionDeclarationBaseNode.FunctionId.Id = context.Identifier()[0].Symbol.Text; + functionDeclarationBaseNode.DebugInfoAstNode.LineNumberStart = context.Start.Line; + functionDeclarationBaseNode.DebugInfoAstNode.LineNumberEnd = context.Stop.Line; - variableDeclarationBaseNode.DebugInfoAstNode.ColumnNumberStart = context.Start.Column; - variableDeclarationBaseNode.DebugInfoAstNode.ColumnNumberEnd = context.Stop.Column; + functionDeclarationBaseNode.DebugInfoAstNode.ColumnNumberStart = context.Start.Column; + functionDeclarationBaseNode.DebugInfoAstNode.ColumnNumberEnd = context.Stop.Column; - if ( context.expression() != null ) + string accessToken; + string abstractStaticMod = null; + bool isExtern = false; + bool isCallable = false; + + if ( context.publicModifier() != null ) { - variableDeclarationBaseNode.ExpressionBase = ( ExpressionBaseNode ) VisitExpression( context.expression() ); + accessToken = "public"; + } + else + { + accessToken = "private"; } - string accessToken = "private"; - - ModifiersBaseNode modifiersBase = new ModifiersBaseNode( accessToken, null ); - variableDeclarationBaseNode.ModifiersBase = modifiersBase; - - return variableDeclarationBaseNode; - } + if ( context.abstractModifier() != null ) + { + abstractStaticMod = "abstract"; + } + else if ( context.staticModifier() != null ) + { + abstractStaticMod = "static"; + } - public override AstBaseNode VisitLocalVarInitializer( BITEParser.LocalVarInitializerContext context ) - { - LocalVariableInitializerBaseNode localVariableInitializerBaseNode = new LocalVariableInitializerBaseNode(); + if ( context.ExternModifier() != null ) + { + isExtern = true; + } - var variableDeclarationNodes = new List < LocalVariableDeclarationBaseNode >(); + if ( context.CallableModifier() != null ) + { + isCallable = true; - var localVarDeclarations = context.localVarDeclaration(); + // TODO: define callable link name semantics + string linkName = context.Identifier()[0].GetText(); - if ( localVarDeclarations != null ) - { - foreach ( var localVarDeclarationContext in context.localVarDeclaration() ) + if ( context.Identifier().Length > 1 ) { - variableDeclarationNodes.Add( - ( LocalVariableDeclarationBaseNode ) VisitLocalVarDeclaration( localVarDeclarationContext ) ); + linkName = context.Identifier()[0].GetText(); } + + functionDeclarationBaseNode.LinkFunctionId = new Identifier( linkName ); } - localVariableInitializerBaseNode.VariableDeclarations = variableDeclarationNodes; + ModifiersBaseNode modifiersBase = new ModifiersBaseNode( accessToken, abstractStaticMod, isExtern, isCallable ); - return localVariableInitializerBaseNode; + functionDeclarationBaseNode.ModifiersBase = modifiersBase; + + if ( context.parameters() != null ) + { + functionDeclarationBaseNode.ParametersBase = ( ParametersBaseNode ) VisitParameters( context.parameters() ); + } + + return functionDeclarationBaseNode; } public override AstBaseNode VisitForInitializer( BITEParser.ForInitializerContext context ) { ForInitializerBaseNode forInitializerBaseNode = new ForInitializerBaseNode(); - var expressions = context.expression(); + BITEParser.ExpressionContext[] expressions = context.expression(); if ( expressions != null && expressions.Length > 0 ) { forInitializerBaseNode.Expressions = new ExpressionBaseNode[expressions.Length]; int i = 0; - foreach ( var expression in expressions ) + foreach ( BITEParser.ExpressionContext expression in expressions ) { forInitializerBaseNode.Expressions[i++] = ( ExpressionBaseNode ) VisitExpression( expression ); } } - var localVarInitializer = context.localVarInitializer(); + BITEParser.LocalVarInitializerContext localVarInitializer = context.localVarInitializer(); if ( localVarInitializer != null ) { @@ -1057,7 +1178,7 @@ public override AstBaseNode VisitForStatement( BITEParser.ForStatementContext co forStatementBaseNode.DebugInfoAstNode.ColumnNumberStart = context.Start.Column; forStatementBaseNode.DebugInfoAstNode.ColumnNumberEnd = context.Stop.Column; - var initializer = context.forInitializer(); + BITEParser.ForInitializerContext initializer = context.forInitializer(); if ( initializer != null ) { @@ -1069,16 +1190,16 @@ public override AstBaseNode VisitForStatement( BITEParser.ForStatementContext co forStatementBaseNode.Condition = ( ExpressionBaseNode ) VisitExpression( context.condition ); } - var iterators = context.forIterator(); + BITEParser.ForIteratorContext iterators = context.forIterator(); if ( iterators != null ) { - var expressions = iterators.expression(); + BITEParser.ExpressionContext[] expressions = iterators.expression(); forStatementBaseNode.Iterators = new ExpressionBaseNode[expressions.Length]; - var i = 0; + int i = 0; - foreach ( var iterator in expressions ) + foreach ( BITEParser.ExpressionContext iterator in expressions ) { forStatementBaseNode.Iterators[i++] = ( ExpressionBaseNode ) VisitExpression( iterator ); } @@ -1089,69 +1210,6 @@ public override AstBaseNode VisitForStatement( BITEParser.ForStatementContext co return forStatementBaseNode; } - public override AstBaseNode VisitExternalFunctionDeclaration( BITEParser.ExternalFunctionDeclarationContext context ) - { - FunctionDeclarationBaseNode functionDeclarationBaseNode = new FunctionDeclarationBaseNode(); - functionDeclarationBaseNode.FunctionId = new Identifier(); - functionDeclarationBaseNode.FunctionId.Id = context.Identifier()[0].Symbol.Text; - functionDeclarationBaseNode.DebugInfoAstNode.LineNumberStart = context.Start.Line; - functionDeclarationBaseNode.DebugInfoAstNode.LineNumberEnd = context.Stop.Line; - - functionDeclarationBaseNode.DebugInfoAstNode.ColumnNumberStart = context.Start.Column; - functionDeclarationBaseNode.DebugInfoAstNode.ColumnNumberEnd = context.Stop.Column; - - string accessToken; - string abstractStaticMod = null; - bool isExtern = false; - bool isCallable = false; - - if ( context.publicModifier() != null ) - { - accessToken = "public"; - } - else - { - accessToken = "private"; - } - - if ( context.abstractModifier() != null ) - { - abstractStaticMod = "abstract"; - } - else if ( context.staticModifier() != null ) - { - abstractStaticMod = "static"; - } - - if ( context.ExternModifier() != null ) - { - isExtern = true; - } - - if ( context.CallableModifier() != null ) - { - isCallable = true; - // TODO: define callable link name semantics - string linkName = context.Identifier()[0].GetText(); - if ( context.Identifier().Length > 1 ) - { - linkName = context.Identifier()[0].GetText(); - } - functionDeclarationBaseNode.LinkFunctionId = new Identifier( linkName ); - } - - ModifiersBaseNode modifiersBase = new ModifiersBaseNode( accessToken, abstractStaticMod, isExtern, isCallable ); - - functionDeclarationBaseNode.ModifiersBase = modifiersBase; - - if ( context.parameters() != null ) - { - functionDeclarationBaseNode.ParametersBase = ( ParametersBaseNode ) VisitParameters( context.parameters() ); - } - - return functionDeclarationBaseNode; - } - public override AstBaseNode VisitFunctionDeclaration( BITEParser.FunctionDeclarationContext context ) { FunctionDeclarationBaseNode functionDeclarationBaseNode = new FunctionDeclarationBaseNode(); @@ -1234,6 +1292,53 @@ public override AstBaseNode VisitInheritance( BITEParser.InheritanceContext cont return base.VisitInheritance( context ); } + public override AstBaseNode VisitLocalVarDeclaration( BITEParser.LocalVarDeclarationContext context ) + { + LocalVariableDeclarationBaseNode variableDeclarationBaseNode = new LocalVariableDeclarationBaseNode(); + variableDeclarationBaseNode.VarId = new Identifier( context.Identifier().Symbol.Text ); + variableDeclarationBaseNode.DebugInfoAstNode.LineNumberStart = context.Start.Line; + variableDeclarationBaseNode.DebugInfoAstNode.LineNumberEnd = context.Stop.Line; + + variableDeclarationBaseNode.DebugInfoAstNode.ColumnNumberStart = context.Start.Column; + variableDeclarationBaseNode.DebugInfoAstNode.ColumnNumberEnd = context.Stop.Column; + + if ( context.expression() != null ) + { + variableDeclarationBaseNode.ExpressionBase = ( ExpressionBaseNode ) VisitExpression( context.expression() ); + } + + string accessToken = "private"; + + ModifiersBaseNode modifiersBase = new ModifiersBaseNode( accessToken, null ); + variableDeclarationBaseNode.ModifiersBase = modifiersBase; + + return variableDeclarationBaseNode; + } + + public override AstBaseNode VisitLocalVarInitializer( BITEParser.LocalVarInitializerContext context ) + { + LocalVariableInitializerBaseNode localVariableInitializerBaseNode = new LocalVariableInitializerBaseNode(); + + List < LocalVariableDeclarationBaseNode > variableDeclarationNodes = + new List < LocalVariableDeclarationBaseNode >(); + + BITEParser.LocalVarDeclarationContext[] localVarDeclarations = context.localVarDeclaration(); + + if ( localVarDeclarations != null ) + { + foreach ( BITEParser.LocalVarDeclarationContext localVarDeclarationContext in + context.localVarDeclaration() ) + { + variableDeclarationNodes.Add( + ( LocalVariableDeclarationBaseNode ) VisitLocalVarDeclaration( localVarDeclarationContext ) ); + } + } + + localVariableInitializerBaseNode.VariableDeclarations = variableDeclarationNodes; + + return localVariableInitializerBaseNode; + } + public override AstBaseNode VisitLogicAnd( BITEParser.LogicAndContext context ) { if ( context.bitwiseOr().Length > 1 ) @@ -1358,6 +1463,15 @@ public override AstBaseNode VisitLogicOr( BITEParser.LogicOrContext context ) return VisitLogicAnd( context.logicAnd( 0 ) ); } + public override AstBaseNode VisitMemberInitialization( BITEParser.MemberInitializationContext context ) + { + return new MemberInitializationNode + { + Identifier = new Identifier( context.Identifier().Symbol.Text ), + Expression = ( ExpressionBaseNode ) VisitExpression( context.expression() ) + }; + } + public override AstBaseNode VisitModule( BITEParser.ModuleContext context ) { ModuleBaseNode moduleBaseNode = new ModuleBaseNode(); @@ -1366,6 +1480,7 @@ public override AstBaseNode VisitModule( BITEParser.ModuleContext context ) List < ModuleIdentifier > importedModules = new List < ModuleIdentifier >(); List < ModuleIdentifier > usedModules = new List < ModuleIdentifier >(); moduleName = context.moduleDeclaration().Identifier( 0 ).Symbol.Text; + for ( int i = 1; i < context.moduleDeclaration().Identifier().Length; i++ ) { parentModules.Add( moduleName ); @@ -1550,21 +1665,28 @@ public override AstBaseNode VisitPrimary( BITEParser.PrimaryContext context ) if ( context.IntegerLiteral() != null ) { primaryBaseNode.PrimaryType = PrimaryBaseNode.PrimaryTypes.IntegerLiteral; - primaryBaseNode.IntegerLiteral = int.Parse( context.IntegerLiteral().Symbol.Text, NumberFormatInfo.InvariantInfo ); + + primaryBaseNode.IntegerLiteral = int.Parse( + context.IntegerLiteral().Symbol.Text, + NumberFormatInfo.InvariantInfo ); } if ( context.FloatingLiteral() != null ) { primaryBaseNode.PrimaryType = PrimaryBaseNode.PrimaryTypes.FloatLiteral; - primaryBaseNode.FloatLiteral = double.Parse( context.FloatingLiteral().Symbol.Text, NumberFormatInfo.InvariantInfo ); + + primaryBaseNode.FloatLiteral = double.Parse( + context.FloatingLiteral().Symbol.Text, + NumberFormatInfo.InvariantInfo ); } - if(context.@string() != null) + if ( context.@string() != null ) { primaryBaseNode.PrimaryType = PrimaryBaseNode.PrimaryTypes.StringLiteral; - + string lastText = ""; string interPolated = ""; + foreach ( BITEParser.StringPartContext stringContent in context.@string().stringPart() ) { if ( stringContent.expression() != null ) @@ -1575,46 +1697,63 @@ public override AstBaseNode VisitPrimary( BITEParser.PrimaryContext context ) primaryBaseNode.InterpolatedString = new InterpolatedString(); primaryBaseNode.InterpolatedString.StringParts = new List < InterpolatedStringPart >(); } - ExpressionBaseNode expressionBaseNode = ( ExpressionBaseNode ) VisitExpression( stringContent.expression() ); + + ExpressionBaseNode expressionBaseNode = + ( ExpressionBaseNode ) VisitExpression( stringContent.expression() ); + if ( expressionBaseNode != null ) { - primaryBaseNode.InterpolatedString.StringParts.Add( new InterpolatedStringPart( interPolated, expressionBaseNode) ); + primaryBaseNode.InterpolatedString.StringParts.Add( + new InterpolatedStringPart( interPolated, expressionBaseNode ) ); + interPolated = ""; } } - + if ( stringContent.TEXT() != null ) { lastText = stringContent.TEXT().Symbol.Text; - interPolated += lastText; + interPolated += lastText; primaryBaseNode.StringLiteral += lastText; } - + if ( stringContent.ESCAPE_SEQUENCE() != null ) { lastText = stringContent.ESCAPE_SEQUENCE().Symbol.Text; lastText = lastText.Substring( 1, lastText.Length - 1 ); - interPolated += lastText; + interPolated += lastText; primaryBaseNode.StringLiteral += lastText; } - } + if ( primaryBaseNode.PrimaryType == PrimaryBaseNode.PrimaryTypes.InterpolatedString ) { primaryBaseNode.InterpolatedString.TextAfterLastExpression = interPolated; } - } - + /**/ - - + if ( context.Identifier() != null ) { primaryBaseNode.PrimaryType = PrimaryBaseNode.PrimaryTypes.Identifier; primaryBaseNode.PrimaryId = new Identifier( context.Identifier().Symbol.Text ); } + if ( context.arrayExpression() != null ) + { + primaryBaseNode.PrimaryType = PrimaryBaseNode.PrimaryTypes.ArrayExpression; + primaryBaseNode.Expression = ( ArrayExpressionNode ) VisitArrayExpression( context.arrayExpression() ); + } + + if ( context.dictionaryExpression() != null ) + { + primaryBaseNode.PrimaryType = PrimaryBaseNode.PrimaryTypes.DictionaryExpression; + + primaryBaseNode.Expression = + ( DictionaryInitializerNode ) VisitDictionaryExpression( context.dictionaryExpression() ); + } + return primaryBaseNode; } @@ -1673,12 +1812,14 @@ public override AstBaseNode VisitRelational( BITEParser.RelationalContext contex if ( terminalNode.GetText() == ">=" ) { - currentBinaryOperationBaseNode.Operator = BinaryOperationBaseNode.BinaryOperatorType.GreaterOrEqual; + currentBinaryOperationBaseNode.Operator = + BinaryOperationBaseNode.BinaryOperatorType.GreaterOrEqual; } if ( terminalNode.GetText() == "<=" ) { - currentBinaryOperationBaseNode.Operator = BinaryOperationBaseNode.BinaryOperatorType.LessOrEqual; + currentBinaryOperationBaseNode.Operator = + BinaryOperationBaseNode.BinaryOperatorType.LessOrEqual; } } else @@ -1723,7 +1864,9 @@ public override AstBaseNode VisitReturnStatement( BITEParser.ReturnStatementCont returnStatementBaseNode.DebugInfoAstNode.ColumnNumberStart = context.Start.Column; returnStatementBaseNode.DebugInfoAstNode.ColumnNumberEnd = context.Stop.Column; - returnStatementBaseNode.ExpressionStatementBase.ExpressionBase = ( ExpressionBaseNode ) VisitExpression( context.expression() ); + + returnStatementBaseNode.ExpressionStatementBase.ExpressionBase = + ( ExpressionBaseNode ) VisitExpression( context.expression() ); return returnStatementBaseNode; } @@ -1772,7 +1915,9 @@ public override AstBaseNode VisitShift( BITEParser.ShiftContext context ) currentBinaryOperationBaseNode.DebugInfoAstNode.ColumnNumberStart = rhsContext.Start.Column; currentBinaryOperationBaseNode.DebugInfoAstNode.ColumnNumberEnd = rhsContext.Stop.Column; - currentBinaryOperationBaseNode.RightOperand = ( ExpressionBaseNode ) VisitAdditive( rhsContext ); + + currentBinaryOperationBaseNode.RightOperand = + ( ExpressionBaseNode ) VisitAdditive( rhsContext ); } } @@ -1796,26 +1941,6 @@ public override AstBaseNode VisitShift( BITEParser.ShiftContext context ) return VisitAdditive( context.additive( 0 ) ); } - /// - /// This is primarily for unit testing - /// - /// - /// - public override AstBaseNode VisitStatements( BITEParser.StatementsContext context ) - { - DeclarationsBaseNode declarationsBase = new DeclarationsBaseNode() - { - Statements = new List < StatementBaseNode >() - }; - - foreach ( var declaration in context.declaration() ) - { - declarationsBase.Statements.Add( ( StatementBaseNode ) VisitDeclaration( declaration ) ); - } - - return declarationsBase; - } - public override AstBaseNode VisitStatement( BITEParser.StatementContext context ) { if ( context.exprStatement() != null ) @@ -1853,6 +1978,11 @@ public override AstBaseNode VisitStatement( BITEParser.StatementContext context return VisitReturnStatement( context.returnStatement() ); } + if ( context.syncBlock() != null ) + { + return VisitSyncBlock( context.syncBlock() ); + } + if ( context.block() != null ) { return VisitBlock( context.block() ); @@ -1861,6 +1991,26 @@ public override AstBaseNode VisitStatement( BITEParser.StatementContext context return null; } + /// + /// This is primarily for unit testing + /// + /// + /// + public override AstBaseNode VisitStatements( BITEParser.StatementsContext context ) + { + DeclarationsBaseNode declarationsBase = new DeclarationsBaseNode + { + Statements = new List < StatementBaseNode >() + }; + + foreach ( BITEParser.DeclarationContext declaration in context.declaration() ) + { + declarationsBase.Statements.Add( ( StatementBaseNode ) VisitDeclaration( declaration ) ); + } + + return declarationsBase; + } + public override AstBaseNode VisitStructDeclaration( BITEParser.StructDeclarationContext context ) { StructDeclarationBaseNode structDeclarationBaseNode = new StructDeclarationBaseNode(); @@ -1890,6 +2040,23 @@ public override AstBaseNode VisitStructDeclaration( BITEParser.StructDeclaration return structDeclarationBaseNode; } + public override AstBaseNode VisitSyncBlock( BITEParser.SyncBlockContext context ) + { + SyncBlockNode syncBlockNode = new SyncBlockNode(); + syncBlockNode.DebugInfoAstNode.LineNumberStart = context.Start.Line; + syncBlockNode.DebugInfoAstNode.LineNumberEnd = context.Stop.Line; + + if ( context.block() != null ) + { + syncBlockNode.Block = ( BlockStatementBaseNode ) VisitBlock( context.block() ); + } + + syncBlockNode.DebugInfoAstNode.ColumnNumberStart = context.Start.Column; + syncBlockNode.DebugInfoAstNode.ColumnNumberEnd = context.Stop.Column; + + return syncBlockNode; + } + public override AstBaseNode VisitTernary( BITEParser.TernaryContext context ) { if ( context.logicOr().Length > 1 ) @@ -1976,7 +2143,7 @@ public override AstBaseNode VisitUnary( BITEParser.UnaryContext context ) { unaryOperationNode.Operator = UnaryPrefixOperation.UnaryPrefixOperatorType.Compliment; } - + return unaryOperationNode; } } diff --git a/Bite/Ast/AstVisitor.cs b/Bite/Ast/AstVisitor.cs index 13e5cde..736ae82 100644 --- a/Bite/Ast/AstVisitor.cs +++ b/Bite/Ast/AstVisitor.cs @@ -1,14 +1,8 @@ -using System.Collections.Generic; - namespace Bite.Ast { -public abstract class AstVisitor +public abstract class AstVisitor < T > { - public AstVisitor() - { - } - #region Public public abstract T Visit( ProgramBaseNode node ); @@ -47,6 +41,8 @@ public AstVisitor() public abstract T Visit( BlockStatementBaseNode node ); + public abstract T Visit( SyncBlockNode node ); + public abstract T Visit( StatementBaseNode node ); public abstract T Visit( ExpressionStatementBaseNode node ); @@ -80,4 +76,4 @@ public AstVisitor() #endregion } -} \ No newline at end of file +} diff --git a/Bite/Ast/ClassInstanceDeclarationBaseNode.cs b/Bite/Ast/ClassInstanceDeclarationBaseNode.cs index c3ae1f4..ebff993 100644 --- a/Bite/Ast/ClassInstanceDeclarationBaseNode.cs +++ b/Bite/Ast/ClassInstanceDeclarationBaseNode.cs @@ -11,6 +11,7 @@ public class ClassInstanceDeclarationBaseNode : DeclarationBaseNode public Identifier ClassName; public List < Identifier > ClassPath; public bool IsVariableRedeclaration; + public List < MemberInitializationNode > Initializers; #region Public diff --git a/Bite/Ast/ForInitializerBaseNode.cs b/Bite/Ast/ForInitializerBaseNode.cs index f7d4ef6..1a63474 100644 --- a/Bite/Ast/ForInitializerBaseNode.cs +++ b/Bite/Ast/ForInitializerBaseNode.cs @@ -7,10 +7,14 @@ public class ForInitializerBaseNode : AstBaseNode public ExpressionBaseNode[] Expressions { get; set; } + #region Public + public override object Accept( IAstVisitor visitor ) { return visitor.Visit( this ); } + + #endregion } -} \ No newline at end of file +} diff --git a/Bite/Ast/ForStatementBaseNode.cs b/Bite/Ast/ForStatementBaseNode.cs index f6aeee8..459966e 100644 --- a/Bite/Ast/ForStatementBaseNode.cs +++ b/Bite/Ast/ForStatementBaseNode.cs @@ -4,8 +4,11 @@ namespace Bite.Ast public class ForStatementBaseNode : StatementBaseNode { public ForInitializerBaseNode InitializerBase { get; set; } + public ExpressionBaseNode Condition { get; set; } + public ExpressionBaseNode[] Iterators { get; set; } + public StatementBaseNode StatementBase { get; set; } #region Public @@ -18,4 +21,4 @@ public override object Accept( IAstVisitor visitor ) #endregion } -} \ No newline at end of file +} diff --git a/Bite/Ast/IfStatementBaseNode.cs b/Bite/Ast/IfStatementBaseNode.cs index 24edb4e..03abd7b 100644 --- a/Bite/Ast/IfStatementBaseNode.cs +++ b/Bite/Ast/IfStatementBaseNode.cs @@ -1,5 +1,3 @@ -using System.Collections.Generic; - namespace Bite.Ast { @@ -21,4 +19,4 @@ public override object Accept( IAstVisitor visitor ) #endregion } -} \ No newline at end of file +} diff --git a/Bite/Ast/LocalVariableDeclarationBaseNode.cs b/Bite/Ast/LocalVariableDeclarationBaseNode.cs index 8b06578..0cb5896 100644 --- a/Bite/Ast/LocalVariableDeclarationBaseNode.cs +++ b/Bite/Ast/LocalVariableDeclarationBaseNode.cs @@ -9,10 +9,14 @@ public class LocalVariableDeclarationBaseNode : StatementBaseNode public ExpressionBaseNode ExpressionBase { get; set; } + #region Public + public override object Accept( IAstVisitor visitor ) { return visitor.Visit( this ); } + + #endregion } -} \ No newline at end of file +} diff --git a/Bite/Ast/LocalVariableInitializerBaseNode.cs b/Bite/Ast/LocalVariableInitializerBaseNode.cs index 42d775c..c8d8a16 100644 --- a/Bite/Ast/LocalVariableInitializerBaseNode.cs +++ b/Bite/Ast/LocalVariableInitializerBaseNode.cs @@ -7,10 +7,14 @@ public class LocalVariableInitializerBaseNode : StatementBaseNode { public IEnumerable < LocalVariableDeclarationBaseNode > VariableDeclarations { get; set; } + #region Public + public override object Accept( IAstVisitor visitor ) { return visitor.Visit( this ); } + + #endregion } -} \ No newline at end of file +} diff --git a/Bite/Ast/MemberInitializationNode.cs b/Bite/Ast/MemberInitializationNode.cs new file mode 100644 index 0000000..0d86ba6 --- /dev/null +++ b/Bite/Ast/MemberInitializationNode.cs @@ -0,0 +1,21 @@ +using System; + +namespace Bite.Ast +{ + +public class MemberInitializationNode : AstBaseNode +{ + public Identifier Identifier; + public ExpressionBaseNode Expression; + + #region Public + + public override object Accept( IAstVisitor visitor ) + { + throw new NotImplementedException(); + } + + #endregion +} + +} diff --git a/Bite/Ast/ModifiersBaseNode.cs b/Bite/Ast/ModifiersBaseNode.cs index e243e2c..be1cabc 100644 --- a/Bite/Ast/ModifiersBaseNode.cs +++ b/Bite/Ast/ModifiersBaseNode.cs @@ -32,7 +32,7 @@ public ModifiersBaseNode( string accessMod, string staticAbstractMod ) Modifiers.Add( ModifierTypes.DeclarePrivate ); } - if ( staticAbstractMod != null && staticAbstractMod == "static") + if ( staticAbstractMod != null && staticAbstractMod == "static" ) { Modifiers.Add( ModifierTypes.DeclareStatic ); } @@ -40,14 +40,13 @@ public ModifiersBaseNode( string accessMod, string staticAbstractMod ) { Modifiers.Add( ModifierTypes.DeclareAbstract ); } - } public ModifiersBaseNode( string accessMod, string staticAbstractMod, bool isExtern, bool isCallable ) { - Modifiers = new List(); + Modifiers = new List < ModifierTypes >(); - if (accessMod != null && accessMod == "public") + if ( accessMod != null && accessMod == "public" ) { Modifiers.Add( ModifierTypes.DeclarePublic ); } @@ -56,25 +55,24 @@ public ModifiersBaseNode( string accessMod, string staticAbstractMod, bool isExt Modifiers.Add( ModifierTypes.DeclarePrivate ); } - if (staticAbstractMod != null && staticAbstractMod == "static") + if ( staticAbstractMod != null && staticAbstractMod == "static" ) { Modifiers.Add( ModifierTypes.DeclareStatic ); } - else if (staticAbstractMod != null && staticAbstractMod == "abstract") + else if ( staticAbstractMod != null && staticAbstractMod == "abstract" ) { Modifiers.Add( ModifierTypes.DeclareAbstract ); } - if (isExtern) + if ( isExtern ) { Modifiers.Add( ModifierTypes.DeclareExtern ); } - if (isCallable) + if ( isCallable ) { Modifiers.Add( ModifierTypes.DeclareCallable ); } - } public override object Accept( IAstVisitor visitor ) diff --git a/Bite/Ast/PrimaryBaseNode.cs b/Bite/Ast/PrimaryBaseNode.cs index f71db5b..05da6e3 100644 --- a/Bite/Ast/PrimaryBaseNode.cs +++ b/Bite/Ast/PrimaryBaseNode.cs @@ -8,17 +8,33 @@ public class InterpolatedStringPart public string TextBeforeExpression; public ExpressionBaseNode ExpressionBaseNode; + #region Public + public InterpolatedStringPart( string textBeforeExpression, ExpressionBaseNode expressionBaseNode ) { TextBeforeExpression = textBeforeExpression; ExpressionBaseNode = expressionBaseNode; } + + #endregion } + public class InterpolatedString : ExpressionBaseNode { public List < InterpolatedStringPart > StringParts; public string TextAfterLastExpression; } + +public class ArrayExpressionNode : ExpressionBaseNode +{ + public List < ExpressionBaseNode > Expressions; +} + +public class DictionaryInitializerNode : ExpressionBaseNode +{ + public Dictionary < Identifier, ExpressionBaseNode > ElementInitializers; +} + public class PrimaryBaseNode : ExpressionBaseNode { public enum PrimaryTypes @@ -32,7 +48,9 @@ public enum PrimaryTypes InterpolatedString, Expression, NullReference, - ThisReference + ThisReference, + ArrayExpression, + DictionaryExpression } public PrimaryTypes PrimaryType; diff --git a/Bite/Ast/SyncBlockNode.cs b/Bite/Ast/SyncBlockNode.cs new file mode 100644 index 0000000..cb82586 --- /dev/null +++ b/Bite/Ast/SyncBlockNode.cs @@ -0,0 +1,18 @@ +namespace Bite.Ast +{ + +public class SyncBlockNode : StatementBaseNode +{ + public BlockStatementBaseNode Block; + + #region Public + + public override object Accept( IAstVisitor visitor ) + { + return visitor.Visit( this ); + } + + #endregion +} + +} diff --git a/Bite/Bite.csproj b/Bite/Bite.csproj index 5875a47..bb58be7 100644 --- a/Bite/Bite.csproj +++ b/Bite/Bite.csproj @@ -1,35 +1,50 @@  - - net462;netstandard2.0 - Bite - Bite - BiteVm - Maximilian Winter - None - Bite - 0.1 - BiteVm - Copyright (c) Maximilian Winter 2022 - https://github.com/Maximilian-Winter/Bite-Programming-Language/wiki - - https://github.com/Maximilian-Winter/Bite-Programming-Language - LICENSE - - - - - - - - - - - - - - - - + + net462;netstandard2.0 + Bite + Bite + BiteVm + Maximilian Winter + None + Bite + 0.1.5 + BiteVm + Copyright (c) Maximilian Winter 2022 + https://github.com/Maximilian-Winter/Bite-Programming-Language/wiki + + https://github.com/Maximilian-Winter/Bite-Programming-Language + LICENSE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Bite/CodeGenerator/BiteCompilationContext.cs b/Bite/CodeGenerator/BiteCompilationContext.cs new file mode 100644 index 0000000..437f821 --- /dev/null +++ b/Bite/CodeGenerator/BiteCompilationContext.cs @@ -0,0 +1,88 @@ +using System.Collections.Generic; +using Bite.Runtime.Bytecode; +using Bite.Symbols; + +namespace Bite.Runtime.CodeGen +{ + +public class BiteCompilationContext +{ + private readonly Dictionary < string, Chunk > m_CompilingChunks; + private readonly Stack < Chunk > _savedChunks = new Stack < Chunk >(); + private readonly Chunk m_MainChunk; + + internal BaseScope BaseScope { get; } + + internal Chunk CurrentChunk { get; private set; } + + internal Dictionary < string, BinaryChunk > CompiledChunks { get; private set; } + + internal BinaryChunk CompiledMainChunk { get; private set; } + + #region Public + + public BiteCompilationContext( SymbolTable symbolTable ) + { + BaseScope = symbolTable.RootScope; + m_CompilingChunks = new Dictionary < string, Chunk >(); + m_MainChunk = new Chunk(); + CurrentChunk = m_MainChunk; + } + + internal void Build() + { + CompiledChunks = new Dictionary < string, BinaryChunk >(); + + foreach ( KeyValuePair < string, Chunk > compilingChunk in m_CompilingChunks ) + { + CompiledChunks.Add( + compilingChunk.Key, + new BinaryChunk( + compilingChunk.Value.SerializeToBytes(), + compilingChunk.Value.Constants, + compilingChunk.Value.Lines ) ); + } + + CompiledMainChunk = new BinaryChunk( m_MainChunk.SerializeToBytes(), m_MainChunk.Constants, m_MainChunk.Lines ); + } + + internal bool HasChunk( string moduleName ) + { + return m_CompilingChunks.ContainsKey( moduleName ); + } + + internal void NewChunk() + { + CurrentChunk = new Chunk(); + } + + internal void PopChunk() + { + CurrentChunk = _savedChunks.Pop(); + } + + internal void PushChunk() + { + // TODO: this is only ever one depth pushed so maybe we don't need a stack and Push/Pop API? + _savedChunks.Push( CurrentChunk ); + } + + internal void RestoreChunk( string moduleName ) + { + CurrentChunk = m_CompilingChunks[moduleName]; + } + + internal void SaveCurrentChunk( string moduleName ) + { + m_CompilingChunks.Add( moduleName, CurrentChunk ); + } + + internal void SetCurrentChunk( Chunk chunk ) + { + CurrentChunk = chunk; + } + + #endregion +} + +} diff --git a/Bite/CodeGenerator/BiteProgram.cs b/Bite/CodeGenerator/BiteProgram.cs index 6591f9b..ad02e7c 100644 --- a/Bite/CodeGenerator/BiteProgram.cs +++ b/Bite/CodeGenerator/BiteProgram.cs @@ -1,116 +1,91 @@ using System.Collections.Generic; -using Bite.Ast; +using System.Threading; +using System.Threading.Tasks; +using Bite.Modules.Callables; using Bite.Runtime.Bytecode; -using Bite.Runtime.Functions; using Bite.Runtime.Functions.ForeignInterface; using Bite.Symbols; namespace Bite.Runtime.CodeGen { +/// +/// public class BiteProgram { - public SymbolTable SymbolTable { get; } + public TypeRegistry TypeRegistry { get; } = new TypeRegistry(); - private readonly Dictionary < string, Chunk > m_CompilingChunks; - private readonly Stack < Chunk > _savedChunks = new Stack < Chunk >(); - - internal BaseScope BaseScope { get; } - - internal Dictionary < string, BinaryChunk > CompiledChunks { get; } - - internal Chunk MainChunk { get; } + public SymbolTable SymbolTable { get; private set; } internal BinaryChunk CompiledMainChunk { get; private set; } - internal Chunk CurrentChunk { get; private set; } + internal Dictionary < string, BinaryChunk > CompiledChunks { get; private set; } #region Public - public BiteProgram( SymbolTable symbolTable ) + internal BiteProgram() { - SymbolTable = symbolTable; - BaseScope = symbolTable.RootScope; - m_CompilingChunks = new Dictionary < string, Chunk >(); - MainChunk = new Chunk(); - CurrentChunk = MainChunk; - CompiledChunks = new Dictionary < string, BinaryChunk >(); + } + + internal static BiteProgram Create( + SymbolTable symbolTable, + BinaryChunk compiledMainChunk, + Dictionary < string, BinaryChunk > compiledChunks ) + { + return new BiteProgram + { + SymbolTable = symbolTable, CompiledMainChunk = compiledMainChunk, CompiledChunks = compiledChunks + }; } /// - /// Creates a new and executes the + /// Creates a new and executes the current /// /// public BiteResult Run( Dictionary < string, object > externalObjects = null ) { BiteVm biteVm = new BiteVm(); biteVm.InitVm(); - // TODO: move somewhere else! - biteVm.RegisterCallable( "CSharpInterfaceCall", new ForeignLibraryInterfaceVm() ); - biteVm.RegisterCallable( "Print", new PrintFunctionVm() ); - biteVm.RegisterCallable( "PrintLine", new PrintLineFunctionVm() ); - - if ( externalObjects != null ) - { - foreach ( KeyValuePair < string, object > externalCSharpObject in externalObjects ) - { - biteVm.RegisterExternalGlobalObject( externalCSharpObject.Key, externalCSharpObject.Value ); - } - } + biteVm.RegisterSystemModuleCallables( TypeRegistry ); + biteVm.RegisterExternalGlobalObjects( externalObjects ); - BiteVmInterpretResult result = biteVm.Interpret( this ); + BiteVmInterpretResult result = biteVm.Interpret( this, CancellationToken.None ); return new BiteResult { InterpretResult = result, ReturnValue = biteVm.ReturnValue }; } - internal void Build() - { - foreach ( KeyValuePair < string, Chunk > compilingChunk in m_CompilingChunks ) - { - CompiledChunks.Add( - compilingChunk.Key, - new BinaryChunk( - compilingChunk.Value.SerializeToBytes(), - compilingChunk.Value.Constants, - compilingChunk.Value.Lines ) ); - } - - CompiledMainChunk = new BinaryChunk( MainChunk.SerializeToBytes(), MainChunk.Constants, MainChunk.Lines ); - } - - internal bool HasChunk( string moduleName ) + /// + /// Creates a new and executes the current + /// + /// + public BiteResult Run( CancellationToken cancellationToken, Dictionary < string, object > externalObjects = null ) { - return m_CompilingChunks.ContainsKey( moduleName ); - } + BiteVm biteVm = new BiteVm(); + biteVm.InitVm(); + biteVm.RegisterSystemModuleCallables( TypeRegistry ); + biteVm.RegisterExternalGlobalObjects( externalObjects ); - internal void NewChunk() - { - CurrentChunk = new Chunk(); - } - internal void SetCurrentChunk( Chunk chunk ) - { - CurrentChunk = chunk; - } + BiteVmInterpretResult result = biteVm.Interpret( this, cancellationToken ); - internal void PopChunk() - { - CurrentChunk = _savedChunks.Pop(); + return new BiteResult { InterpretResult = result, ReturnValue = biteVm.ReturnValue }; } - internal void PushChunk() + /// + /// Creates a new and executes the current + /// + /// + public async Task < BiteResult > RunAsync( + CancellationToken cancellationToken, + Dictionary < string, object > externalObjects = null ) { - // TODO: this is only ever one depth pushed so maybe we don't need a stack and Push/Pop API? - _savedChunks.Push( CurrentChunk ); - } + BiteVm biteVm = new BiteVm(); + biteVm.InitVm(); + biteVm.RegisterSystemModuleCallables( TypeRegistry ); + biteVm.RegisterExternalGlobalObjects( externalObjects ); - internal void RestoreChunk( string moduleName ) - { - CurrentChunk = m_CompilingChunks[moduleName]; - } + BiteVmInterpretResult result = await biteVm.InterpretAsync( this, cancellationToken ); - internal void SaveCurrentChunk( string moduleName ) - { - m_CompilingChunks.Add( moduleName, CurrentChunk ); + return new BiteResult { InterpretResult = result, ReturnValue = biteVm.ReturnValue }; } #endregion diff --git a/Bite/CodeGenerator/CodeGenerator.cs b/Bite/CodeGenerator/CodeGenerator.cs index d732ead..565f2fc 100644 --- a/Bite/CodeGenerator/CodeGenerator.cs +++ b/Bite/CodeGenerator/CodeGenerator.cs @@ -15,7 +15,7 @@ public class CodeGenerator : AstVisitor < object >, IAstVisitor private bool m_IsCompilingAssignmentLhs = false; private bool m_IsCompilingAssignmentRhs = false; - + private bool m_IsCompilingPostfixOperation = false; private int m_PreviousLoopBlockCount = 0; @@ -23,26 +23,28 @@ public class CodeGenerator : AstVisitor < object >, IAstVisitor private List < int > m_ConstructingOpCodeData; private int m_ConstructingLine; - private BytecodeListStack m_PostfixInstructions = new BytecodeListStack(); - private BiteProgram m_BiteProgram; + private readonly BytecodeListStack m_PostfixInstructions = new BytecodeListStack(); + private readonly BiteCompilationContext m_Context; #region Public - public CodeGenerator( BiteProgram biteProgram ) + public CodeGenerator( BiteCompilationContext context ) { - m_BiteProgram = biteProgram; + m_Context = context; } - public override object Visit( ProgramBaseNode node ) + public void Compile( ProgramBaseNode programBaseNode ) { - m_BiteProgram.PushChunk(); - - //m_BiteProgram.SetCurrentChunk( SystemModuleCodeGenerator.GenerateFrom( node ) ); - - //m_BiteProgram.SaveCurrentChunk( "System.CSharpInterface" ); + programBaseNode.Accept( this ); + } - m_BiteProgram.PopChunk(); + public void Compile( ModuleBaseNode moduleBaseNode ) + { + moduleBaseNode.Accept( this ); + } + public override object Visit( ProgramBaseNode node ) + { foreach ( ModuleBaseNode module in node.GetModulesInDepedencyOrder() ) { Compile( module ); @@ -55,31 +57,31 @@ public override object Visit( ModuleBaseNode node ) { m_CurrentModuleName = node.ModuleIdent.ToString(); - m_BiteProgram.PushChunk(); + m_Context.PushChunk(); int d = 0; ModuleSymbol mod = - m_BiteProgram.BaseScope.resolve( m_CurrentModuleName, out int moduleId, ref d ) as ModuleSymbol; + m_Context.BaseScope.resolve( m_CurrentModuleName, out int moduleId, ref d ) as ModuleSymbol; // TODO: What happens when we encounter a module that has a name that is already in the program? - if ( m_BiteProgram.HasChunk( m_CurrentModuleName ) ) + if ( m_Context.HasChunk( m_CurrentModuleName ) ) { - m_BiteProgram.RestoreChunk( m_CurrentModuleName ); + m_Context.RestoreChunk( m_CurrentModuleName ); } else { - m_BiteProgram.CurrentChunk. - WriteToChunk( - BiteVmOpCodes.OpDefineModule, - new ConstantValue( m_CurrentModuleName ), - mod.NumberOfSymbols, - 0 ); + m_Context.CurrentChunk. + WriteToChunk( + BiteVmOpCodes.OpDefineModule, + new ConstantValue( m_CurrentModuleName ), + mod.NumberOfSymbols, + 0 ); - m_BiteProgram.NewChunk(); + m_Context.NewChunk(); - m_BiteProgram.SaveCurrentChunk( m_CurrentModuleName ); + m_Context.SaveCurrentChunk( m_CurrentModuleName ); } /*foreach ( ModuleIdentifier importedModule in node.ImportedModules ) @@ -123,7 +125,7 @@ public override object Visit( ModuleBaseNode node ) } } - m_BiteProgram.PopChunk(); + m_Context.PopChunk(); ; return null; @@ -141,19 +143,19 @@ public override object Visit( DeclarationBaseNode node ) public override object Visit( UsingStatementBaseNode node ) { - EmitByteCode( BiteVmOpCodes.OpEnterBlock, ( node.AstScopeNode as BaseScope ).NestedSymbolCount, 0 ); + EmitByteCode( BiteVmOpCodes.OpEnterBlock, ( node.AstScopeNode as BaseScope ).NestedSymbolCount, node.DebugInfoAstNode.LineNumberStart ); Compile( node.UsingBaseNode ); - EmitByteCode( BiteVmOpCodes.OpUsingStatmentHead ); + EmitByteCode( BiteVmOpCodes.OpUsingStatmentHead, node.DebugInfoAstNode.LineNumberStart ); Compile( node.UsingBlock ); - EmitByteCode( BiteVmOpCodes.OpUsingStatmentEnd ); - EmitByteCode( BiteVmOpCodes.OpExitBlock ); + EmitByteCode( BiteVmOpCodes.OpUsingStatmentEnd, node.DebugInfoAstNode.LineNumberEnd ); + EmitByteCode( BiteVmOpCodes.OpExitBlock, node.DebugInfoAstNode.LineNumberEnd ); return null; } public override object Visit( DeclarationsBaseNode node ) { - EmitByteCode( BiteVmOpCodes.OpEnterBlock, ( node.AstScopeNode as BaseScope ).NestedSymbolCount, 0 ); + EmitByteCode( BiteVmOpCodes.OpEnterBlock, ( node.AstScopeNode as BaseScope ).NestedSymbolCount, node.DebugInfoAstNode.LineNumberStart ); m_CurrentEnterBlockCount++; @@ -205,7 +207,7 @@ public override object Visit( DeclarationsBaseNode node ) } } - EmitByteCode( BiteVmOpCodes.OpExitBlock ); + EmitByteCode( BiteVmOpCodes.OpExitBlock, node.DebugInfoAstNode.LineNumberEnd ); m_CurrentEnterBlockCount--; return null; @@ -217,20 +219,20 @@ public override object Visit( ClassDeclarationBaseNode node ) ClassSymbol symbol = ( ClassSymbol ) node.AstScopeNode.resolve( node.ClassId.Id, out int moduleId, ref d ); m_CurrentClassName = symbol.QualifiedName; - m_BiteProgram.PushChunk(); + m_Context.PushChunk(); - if ( m_BiteProgram.HasChunk( m_CurrentClassName ) ) + if ( m_Context.HasChunk( m_CurrentClassName ) ) { - m_BiteProgram.RestoreChunk( m_CurrentClassName ); + m_Context.RestoreChunk( m_CurrentClassName ); } else { - EmitByteCode( BiteVmOpCodes.OpDefineClass, new ConstantValue( m_CurrentClassName ) ); + EmitByteCode( BiteVmOpCodes.OpDefineClass, new ConstantValue( m_CurrentClassName ), node.DebugInfoAstNode.LineNumberStart ); //EmitByteCode( symbol.InsertionOrderNumber ); - m_BiteProgram.NewChunk(); - m_BiteProgram.SaveCurrentChunk( m_CurrentClassName ); + m_Context.NewChunk(); + m_Context.SaveCurrentChunk( m_CurrentClassName ); } foreach ( FieldSymbol field in symbol.Fields ) @@ -249,8 +251,7 @@ public override object Visit( ClassDeclarationBaseNode node ) { if ( !field.Name.Equals( "this" ) ) { - EmitByteCode( BiteVmOpCodes.OpDefineVar ); - EmitByteCode( BiteVmOpCodes.OpNone, new ConstantValue( field.Name ) ); + EmitByteCode( BiteVmOpCodes.OpDefineVar, new ConstantValue( field.Name ), node.DebugInfoAstNode.LineNumberStart ); } //EmitByteCode( field.Type ); @@ -265,69 +266,68 @@ public override object Visit( ClassDeclarationBaseNode node ) } else { - EmitByteCode( BiteVmOpCodes.OpDefineMethod, new ConstantValue( method.QualifiedName ) ); + EmitByteCode( BiteVmOpCodes.OpDefineMethod, new ConstantValue( method.QualifiedName ), node.DebugInfoAstNode.LineNumberStart ); //EmitByteCode( method.InsertionOrderNumber ); } } - EmitByteCode( BiteVmOpCodes.OpDefineVar ); - EmitByteCode( BiteVmOpCodes.OpNone, new ConstantValue( "this" ) ); - m_BiteProgram.PopChunk(); + EmitByteCode( BiteVmOpCodes.OpDefineVar,new ConstantValue( "this" ), node.DebugInfoAstNode.LineNumberStart ); + m_Context.PopChunk(); return null; } public override object Visit( FunctionDeclarationBaseNode node ) { - m_BiteProgram.PushChunk(); + m_Context.PushChunk(); int d = 0; FunctionSymbol symbol = node.AstScopeNode.resolve( node.FunctionId.Id, out int moduleId, ref d ) as FunctionSymbol; - EmitConstant( new ConstantValue(node.FunctionId.Id) ); - - if ( m_BiteProgram.HasChunk( symbol.QualifiedName ) ) + EmitConstant( new ConstantValue( node.FunctionId.Id ) ); + + if ( m_Context.HasChunk( symbol.QualifiedName ) ) { - if (symbol.m_IsExtern && symbol.IsCallable) + if ( symbol.m_IsExtern && symbol.IsCallable ) { - EmitByteCode( BiteVmOpCodes.OpDefineCallableMethod, new ConstantValue( symbol.QualifiedName ) ); + EmitByteCode( BiteVmOpCodes.OpDefineCallableMethod, new ConstantValue( symbol.QualifiedName ), node.DebugInfoAstNode.LineNumberStart ); } else { - EmitByteCode( BiteVmOpCodes.OpDefineMethod, new ConstantValue( symbol.QualifiedName ) ); + EmitByteCode( BiteVmOpCodes.OpDefineMethod, new ConstantValue( symbol.QualifiedName ), node.DebugInfoAstNode.LineNumberStart ); } //m_CompilingChunk = CompilingChunks[symbol.QualifiedName]; - m_BiteProgram.RestoreChunk( symbol.QualifiedName ); + m_Context.RestoreChunk( symbol.QualifiedName ); } else { if ( symbol.m_IsExtern && symbol.IsCallable ) { - EmitByteCode( BiteVmOpCodes.OpDefineCallableMethod, new ConstantValue( symbol.QualifiedName ) ); + EmitByteCode( BiteVmOpCodes.OpDefineCallableMethod, new ConstantValue( symbol.QualifiedName ), node.DebugInfoAstNode.LineNumberStart ); } else { - EmitByteCode( BiteVmOpCodes.OpDefineMethod, new ConstantValue( symbol.QualifiedName ) ); + EmitByteCode( BiteVmOpCodes.OpDefineMethod, new ConstantValue( symbol.QualifiedName ), node.DebugInfoAstNode.LineNumberStart ); } //EmitByteCode( symbol.InsertionOrderNumber ); - m_BiteProgram.NewChunk(); - m_BiteProgram.SaveCurrentChunk( symbol.QualifiedName ); + m_Context.NewChunk(); + m_Context.SaveCurrentChunk( symbol.QualifiedName ); } - if ( node.ParametersBase != null && node.ParametersBase.Identifiers != null ) + if ( node.ParametersBase != null && node.ParametersBase.Identifiers != null ) { foreach ( Identifier parametersIdentifier in node.ParametersBase.Identifiers ) { - EmitConstant( new ConstantValue(parametersIdentifier.Id) ); + EmitConstant( new ConstantValue( parametersIdentifier.Id ) ); } - EmitByteCode( BiteVmOpCodes.OpSetFunctionParameterName, node.ParametersBase.Identifiers.Count, 0 ); + EmitByteCode( BiteVmOpCodes.OpSetFunctionParameterName, node.ParametersBase.Identifiers.Count, node.DebugInfoAstNode.LineNumberStart ); } if ( node.FunctionBlock != null ) @@ -335,7 +335,7 @@ public override object Visit( FunctionDeclarationBaseNode node ) Compile( node.FunctionBlock ); } - m_BiteProgram.PopChunk(); + m_Context.PopChunk(); return null; } @@ -353,20 +353,18 @@ public override object Visit( VariableDeclarationBaseNode node ) m_IsCompilingAssignmentRhs = true; Compile( node.InitializerBase ); m_IsCompilingAssignmentRhs = false; - EmitByteCode( BiteVmOpCodes.OpDefineVar ); - EmitByteCode( BiteVmOpCodes.OpNone, new ConstantValue( variableSymbol.Name ) ); - + EmitByteCode( BiteVmOpCodes.OpDefineVar, new ConstantValue( variableSymbol.Name ), node.DebugInfoAstNode.LineNumberStart ); + BytecodeList byteCodes = m_PostfixInstructions.Pop(); foreach ( ByteCode code in byteCodes.ByteCodes ) { - EmitByteCode( code ); + EmitByteCode( code, node.DebugInfoAstNode.LineNumberStart ); } } else { - EmitByteCode( BiteVmOpCodes.OpDeclareVar ); - EmitByteCode( BiteVmOpCodes.OpNone, new ConstantValue( variableSymbol.Name ) ); + EmitByteCode( BiteVmOpCodes.OpDeclareVar,new ConstantValue( variableSymbol.Name ), node.DebugInfoAstNode.LineNumberStart ); } return null; @@ -396,8 +394,7 @@ public override object Visit( ClassInstanceDeclarationBaseNode node ) classSymbol.InsertionOrderNumber, classSymbol.NumberOfSymbols ); - EmitByteCode( byteCode ); - EmitByteCode( BiteVmOpCodes.OpNone, new ConstantValue( variableSymbol.Name ) ); + EmitByteCode( byteCode, node.DebugInfoAstNode.LineNumberStart ); } else { @@ -408,15 +405,16 @@ public override object Visit( ClassInstanceDeclarationBaseNode node ) classSymbol.InsertionOrderNumber, classSymbol.NumberOfSymbols ); - EmitByteCode( byteCode ); - EmitByteCode( BiteVmOpCodes.OpNone, new ConstantValue( variableSymbol.Name ) ); + EmitByteCode( byteCode, node.DebugInfoAstNode.LineNumberStart ); + EmitByteCode( BiteVmOpCodes.OpNone, new ConstantValue( variableSymbol.Name ), node.DebugInfoAstNode.LineNumberStart ); } if ( node.ArgumentsBase != null && node.ArgumentsBase.Expressions.Count > 0 ) { foreach ( MethodSymbol methodSymbol in classSymbol.Methods ) { - if ( methodSymbol.IsConstructor && node.ArgumentsBase.Expressions.Count == methodSymbol.NumberOfParameters ) + if ( methodSymbol.IsConstructor && + node.ArgumentsBase.Expressions.Count == methodSymbol.NumberOfParameters ) { ByteCode byteCode = new ByteCode( BiteVmOpCodes.OpGetVar, @@ -424,27 +422,28 @@ public override object Visit( ClassInstanceDeclarationBaseNode node ) d, -1, variableSymbol.InsertionOrderNumber ); - + ByteCode byteCode2 = new ByteCode( BiteVmOpCodes.OpGetNextVarByRef ); m_PostfixInstructions.Push( new BytecodeList() ); + foreach ( ExpressionBaseNode argument in node.ArgumentsBase.Expressions ) { Compile( argument ); } - - - EmitByteCode( BiteVmOpCodes.OpBindToFunction, node.ArgumentsBase.Expressions.Count, 0 ); + + EmitByteCode( BiteVmOpCodes.OpBindToFunction, node.ArgumentsBase.Expressions.Count, node.DebugInfoAstNode.LineNumberStart ); BytecodeList byteCodes = m_PostfixInstructions.Pop(); foreach ( ByteCode code in byteCodes.ByteCodes ) { - EmitByteCode( code ); + EmitByteCode( code, node.DebugInfoAstNode.LineNumberStart ); } - EmitByteCode( byteCode2 ); - EmitByteCode( byteCode ); - EmitByteCode( BiteVmOpCodes.OpCallMemberFunction, new ConstantValue( methodSymbol.Name ) ); + + EmitByteCode( byteCode2, node.DebugInfoAstNode.LineNumberStart ); + EmitByteCode( byteCode, node.DebugInfoAstNode.LineNumberStart ); + EmitByteCode( BiteVmOpCodes.OpCallMemberFunction, new ConstantValue( methodSymbol.Name ), node.DebugInfoAstNode.LineNumberStart ); } } } @@ -463,9 +462,10 @@ public override object Visit( ClassInstanceDeclarationBaseNode node ) ByteCode byteCode2 = new ByteCode( BiteVmOpCodes.OpGetNextVarByRef ); - EmitByteCode( byteCode2 ); - EmitByteCode( byteCode ); - EmitByteCode( BiteVmOpCodes.OpCallMemberFunction, new ConstantValue( methodSymbol.Name ) ); + + EmitByteCode( byteCode2, node.DebugInfoAstNode.LineNumberStart ); + EmitByteCode( byteCode, node.DebugInfoAstNode.LineNumberStart ); + EmitByteCode( BiteVmOpCodes.OpCallMemberFunction, new ConstantValue( methodSymbol.Name ), node.DebugInfoAstNode.LineNumberStart ); } } } @@ -484,6 +484,52 @@ public override object Visit( ClassInstanceDeclarationBaseNode node ) EmitByteCode( BiteVmOpCodes.OpCallMemberFunction, new ConstantValue( methodSymbol.QualifiedName ) ); } }*/ + + if ( node.Initializers != null ) + { + foreach ( MemberInitializationNode initializer in node.Initializers ) + { + initializer.Expression.AstScopeNode = node.AstScopeNode; + + ExpressionBaseNode assignment = new ExpressionBaseNode + { + AssignmentBase = new AssignmentBaseNode + { + AstScopeNode = node.AstScopeNode, + AssignmentBase = initializer.Expression.AssignmentBase, + CallBase = new CallBaseNode + { + AstScopeNode = node.AstScopeNode, + PrimaryBase = + new PrimaryBaseNode + { + AstScopeNode = node.AstScopeNode, + PrimaryType = PrimaryBaseNode.PrimaryTypes.Identifier, + PrimaryId = node.InstanceId + }, + CallEntries = new List < CallEntry > + { + new CallEntry + { + PrimaryBase = new PrimaryBaseNode + { + AstScopeNode = node.AstScopeNode, + PrimaryType = PrimaryBaseNode.PrimaryTypes.Identifier, + PrimaryId = initializer.Identifier + } + } + }, + CallType = CallTypes.PrimaryCall + }, + OperatorType = AssignmentOperatorTypes.Assign, + Type = AssignmentTypes.Assignment + } + }; + + Visit( assignment ); + } + } + return null; } @@ -492,25 +538,25 @@ public override object Visit( CallBaseNode node ) if ( node.ArgumentsBase != null && node.ArgumentsBase.Expressions != null ) { m_PostfixInstructions.Push( new BytecodeList() ); - + foreach ( ExpressionBaseNode argument in node.ArgumentsBase.Expressions ) { m_IsCompilingAssignmentRhs = true; Compile( argument ); m_IsCompilingAssignmentRhs = false; } - + ByteCode byteCode = new ByteCode( BiteVmOpCodes.OpBindToFunction, node.ArgumentsBase.Expressions.Count ); - EmitByteCode( byteCode ); - + EmitByteCode( byteCode, node.DebugInfoAstNode.LineNumberStart ); + BytecodeList byteCodes = m_PostfixInstructions.Pop(); foreach ( ByteCode code in byteCodes.ByteCodes ) { - EmitByteCode( code ); + EmitByteCode( code, node.DebugInfoAstNode.LineNumberStart ); } } @@ -525,26 +571,37 @@ public override object Visit( CallBaseNode node ) if ( m_IsCompilingAssignmentLhs && ( node.CallEntries == null || node.CallEntries.Count == 0 ) ) { int d2 = 0; - if ( node.AstScopeNode.resolve( node.PrimaryBase.PrimaryId.Id, out int moduleId2, ref d2, false ) != null ) + + if ( node.AstScopeNode.resolve( + node.PrimaryBase.PrimaryId.Id, + out int moduleId2, + ref d2, + false ) != + null ) { - BeginConstuctingByteCodeInstruction( BiteVmOpCodes.OpSetVar ); + BeginConstuctingByteCodeInstruction( BiteVmOpCodes.OpSetVar, node.DebugInfoAstNode.LineNumberStart ); Compile( node.PrimaryBase ); } else { - EmitByteCode( BiteVmOpCodes.OpSetVarExternal, new ConstantValue( node.PrimaryBase.PrimaryId.Id ) ); + EmitByteCode( + BiteVmOpCodes.OpSetVarExternal, + new ConstantValue( node.PrimaryBase.PrimaryId.Id ), node.DebugInfoAstNode.LineNumberStart ); } - - } else { int d2 = 0; - Symbol var = node.AstScopeNode.resolve( node.PrimaryBase.PrimaryId.Id, out int moduleId2, ref d2, false ); + + Symbol var = node.AstScopeNode.resolve( + node.PrimaryBase.PrimaryId.Id, + out int moduleId2, + ref d2, + false ); if ( var is ModuleSymbol m ) { - BeginConstuctingByteCodeInstruction( BiteVmOpCodes.OpGetModule ); + BeginConstuctingByteCodeInstruction( BiteVmOpCodes.OpGetModule, node.DebugInfoAstNode.LineNumberStart ); AddToConstuctingByteCodeInstruction( m.InsertionOrderNumber ); EndConstuctingByteCodeInstruction(); } @@ -552,15 +609,15 @@ public override object Visit( CallBaseNode node ) { if ( var != null ) { - BeginConstuctingByteCodeInstruction( BiteVmOpCodes.OpGetVar ); + BeginConstuctingByteCodeInstruction( BiteVmOpCodes.OpGetVar, node.DebugInfoAstNode.LineNumberStart ); Compile( node.PrimaryBase ); - } else { - EmitByteCode( BiteVmOpCodes.OpGetVarExternal, new ConstantValue( node.PrimaryBase.PrimaryId.Id ) ); + EmitByteCode( + BiteVmOpCodes.OpGetVarExternal, + new ConstantValue( node.PrimaryBase.PrimaryId.Id ), node.DebugInfoAstNode.LineNumberStart ); } - } } } @@ -568,6 +625,7 @@ public override object Visit( CallBaseNode node ) { Compile( node.PrimaryBase ); } + foreach ( CallElementEntry callElementEntry in node.ElementAccess ) { if ( callElementEntry.CallElementType == CallElementTypes.Call ) @@ -586,7 +644,7 @@ public override object Visit( CallBaseNode node ) BiteVmOpCodes.OpSetElement, node.ElementAccess.Count ); - EmitByteCode( byteCode ); + EmitByteCode( byteCode, node.DebugInfoAstNode.LineNumberStart ); } else { @@ -594,7 +652,7 @@ public override object Visit( CallBaseNode node ) BiteVmOpCodes.OpGetElement, node.ElementAccess.Count ); - EmitByteCode( byteCode ); + EmitByteCode( byteCode, node.DebugInfoAstNode.LineNumberStart ); } int dObject = 0; @@ -602,8 +660,9 @@ public override object Visit( CallBaseNode node ) Symbol objectToCall = node.AstScopeNode.resolve( node.PrimaryBase.PrimaryId.Id, out int moduleIdObject, - ref dObject, false ); - + ref dObject, + false ); + ByteCode byteCodeObj = new ByteCode( BiteVmOpCodes.OpGetVar, moduleIdObject, @@ -613,14 +672,15 @@ public override object Visit( CallBaseNode node ) ByteCode byteCode2 = new ByteCode( BiteVmOpCodes.OpGetNextVarByRef ); - EmitByteCode( byteCode2 ); - EmitByteCode( byteCodeObj ); - - EmitByteCode( BiteVmOpCodes.OpCallFunctionFromStack ); + + EmitByteCode( byteCode2, node.DebugInfoAstNode.LineNumberStart ); + EmitByteCode( byteCodeObj, node.DebugInfoAstNode.LineNumberStart ); + + EmitByteCode( BiteVmOpCodes.OpCallFunctionFromStack, node.DebugInfoAstNode.LineNumberStart ); } else { - EmitByteCode( BiteVmOpCodes.OpCallFunctionByName, new ConstantValue( node.PrimaryBase.PrimaryId.Id ) ); + EmitByteCode( BiteVmOpCodes.OpCallFunctionByName, new ConstantValue( node.PrimaryBase.PrimaryId.Id ), node.DebugInfoAstNode.LineNumberStart ); } } else @@ -630,26 +690,33 @@ public override object Visit( CallBaseNode node ) if ( m_IsCompilingAssignmentLhs && ( node.CallEntries == null || node.CallEntries.Count == 0 ) ) { int d = 0; - if ( node.AstScopeNode.resolve( node.PrimaryBase.PrimaryId.Id, out int moduleId, ref d , false) != null ) + + if ( node.AstScopeNode.resolve( node.PrimaryBase.PrimaryId.Id, out int moduleId, ref d, false ) != + null ) { - BeginConstuctingByteCodeInstruction( BiteVmOpCodes.OpSetVar ); + BeginConstuctingByteCodeInstruction( BiteVmOpCodes.OpSetVar, node.DebugInfoAstNode.LineNumberStart ); Compile( node.PrimaryBase ); } else { - EmitByteCode( BiteVmOpCodes.OpSetVarExternal, new ConstantValue( node.PrimaryBase.PrimaryId.Id ) ); + EmitByteCode( + BiteVmOpCodes.OpSetVarExternal, + new ConstantValue( node.PrimaryBase.PrimaryId.Id ), node.DebugInfoAstNode.LineNumberStart ); } - - } else { int d = 0; - Symbol var = node.AstScopeNode.resolve( node.PrimaryBase.PrimaryId.Id, out int moduleId, ref d, false ); + + Symbol var = node.AstScopeNode.resolve( + node.PrimaryBase.PrimaryId.Id, + out int moduleId, + ref d, + false ); if ( var is ModuleSymbol m ) { - BeginConstuctingByteCodeInstruction( BiteVmOpCodes.OpGetModule ); + BeginConstuctingByteCodeInstruction( BiteVmOpCodes.OpGetModule, node.DebugInfoAstNode.LineNumberStart ); AddToConstuctingByteCodeInstruction( m.InsertionOrderNumber ); EndConstuctingByteCodeInstruction(); } @@ -657,15 +724,15 @@ public override object Visit( CallBaseNode node ) { if ( var == null ) { - EmitByteCode( BiteVmOpCodes.OpGetVarExternal, - new ConstantValue( node.PrimaryBase.PrimaryId.Id ) ); + EmitByteCode( + BiteVmOpCodes.OpGetVarExternal, + new ConstantValue( node.PrimaryBase.PrimaryId.Id ), node.DebugInfoAstNode.LineNumberStart ); } else { - BeginConstuctingByteCodeInstruction( BiteVmOpCodes.OpGetVar ); + BeginConstuctingByteCodeInstruction( BiteVmOpCodes.OpGetVar, node.DebugInfoAstNode.LineNumberStart ); Compile( node.PrimaryBase ); } - } } } @@ -673,6 +740,7 @@ public override object Visit( CallBaseNode node ) { Compile( node.PrimaryBase ); } + if ( node.ElementAccess != null ) { foreach ( CallElementEntry callElementEntry in node.ElementAccess ) @@ -683,7 +751,7 @@ public override object Visit( CallBaseNode node ) } else { - EmitConstant( new ConstantValue( callElementEntry.Identifier ) ); + EmitConstant( new ConstantValue( callElementEntry.Identifier ), node.DebugInfoAstNode.LineNumberStart ); } } @@ -693,7 +761,7 @@ public override object Visit( CallBaseNode node ) BiteVmOpCodes.OpSetElement, node.ElementAccess.Count ); - EmitByteCode( byteCode ); + EmitByteCode( byteCode, node.DebugInfoAstNode.LineNumberStart ); } else { @@ -701,13 +769,11 @@ public override object Visit( CallBaseNode node ) BiteVmOpCodes.OpGetElement, node.ElementAccess.Count ); - EmitByteCode( byteCode ); + EmitByteCode( byteCode, node.DebugInfoAstNode.LineNumberStart ); } } } - - if ( node.CallEntries != null ) { int i = 0; @@ -732,7 +798,8 @@ public override object Visit( CallBaseNode node ) node.AstScopeNode.resolve( dynamicVariable.Type.Name, out int moduleId2, - ref d2, false ) as ClassSymbol; + ref d2, + false ) as ClassSymbol; isClassSymbol = classSymbol != null; } @@ -744,25 +811,25 @@ public override object Visit( CallBaseNode node ) { if ( terminalNode.ArgumentsBase != null && terminalNode.ArgumentsBase.Expressions != null ) { - m_PostfixInstructions.Push( new BytecodeList() ); + foreach ( ExpressionBaseNode argumentsExpression in terminalNode.ArgumentsBase.Expressions ) { m_IsCompilingAssignmentRhs = true; Compile( argumentsExpression ); m_IsCompilingAssignmentRhs = false; } - - + ByteCode byteCode = new ByteCode( BiteVmOpCodes.OpBindToFunction, terminalNode.ArgumentsBase.Expressions.Count ); - EmitByteCode( byteCode ); + + EmitByteCode( byteCode, node.DebugInfoAstNode.LineNumberStart ); BytecodeList byteCodes = m_PostfixInstructions.Pop(); foreach ( ByteCode code in byteCodes.ByteCodes ) { - EmitByteCode( code ); + EmitByteCode( code, node.DebugInfoAstNode.LineNumberStart ); } } @@ -770,22 +837,21 @@ public override object Visit( CallBaseNode node ) { if ( isModuleSymbol ) { - EmitByteCode( BiteVmOpCodes.OpCallMemberFunction, - new ConstantValue( terminalNode.PrimaryBase.PrimaryId.Id ) ); + new ConstantValue( terminalNode.PrimaryBase.PrimaryId.Id ), node.DebugInfoAstNode.LineNumberStart ); } else if ( isClassSymbol ) { EmitByteCode( BiteVmOpCodes.OpCallMemberFunction, - new ConstantValue( terminalNode.PrimaryBase.PrimaryId.Id ) ); + new ConstantValue( terminalNode.PrimaryBase.PrimaryId.Id ), node.DebugInfoAstNode.LineNumberStart ); } else { EmitByteCode( BiteVmOpCodes.OpCallMemberFunction, - new ConstantValue( terminalNode.PrimaryBase.PrimaryId.Id ) ); + new ConstantValue( terminalNode.PrimaryBase.PrimaryId.Id ), node.DebugInfoAstNode.LineNumberStart ); } } else @@ -801,13 +867,14 @@ public override object Visit( CallBaseNode node ) Symbol memberSymbol = moduleSymbol.resolve( terminalNode.PrimaryBase.PrimaryId.Id, out int moduleId4, - ref d4,false ); + ref d4, + false ); ByteCode byteCode = new ByteCode( BiteVmOpCodes.OpSetMember, memberSymbol.InsertionOrderNumber ); - EmitByteCode( byteCode ); + EmitByteCode( byteCode, node.DebugInfoAstNode.LineNumberStart ); } else if ( isClassSymbol ) { @@ -816,13 +883,14 @@ public override object Visit( CallBaseNode node ) Symbol memberSymbol = classSymbol.resolve( terminalNode.PrimaryBase.PrimaryId.Id, out int moduleId4, - ref d4, false ); + ref d4, + false ); if ( memberSymbol == null ) { EmitByteCode( BiteVmOpCodes.OpSetMemberWithString, - new ConstantValue( terminalNode.PrimaryBase.PrimaryId.Id ) ); + new ConstantValue( terminalNode.PrimaryBase.PrimaryId.Id ), node.DebugInfoAstNode.LineNumberStart ); } else { @@ -830,14 +898,14 @@ public override object Visit( CallBaseNode node ) BiteVmOpCodes.OpSetMember, memberSymbol.InsertionOrderNumber ); - EmitByteCode( byteCode ); + EmitByteCode( byteCode, node.DebugInfoAstNode.LineNumberStart ); } } else { EmitByteCode( BiteVmOpCodes.OpSetMemberWithString, - new ConstantValue( terminalNode.PrimaryBase.PrimaryId.Id ) ); + new ConstantValue( terminalNode.PrimaryBase.PrimaryId.Id ), node.DebugInfoAstNode.LineNumberStart ); } } else @@ -849,28 +917,30 @@ public override object Visit( CallBaseNode node ) Symbol memberSymbol = moduleSymbol.resolve( terminalNode.PrimaryBase.PrimaryId.Id, out int moduleId4, - ref d4, false ); + ref d4, + false ); ByteCode byteCode = new ByteCode( BiteVmOpCodes.OpGetMember, memberSymbol.InsertionOrderNumber ); - EmitByteCode( byteCode ); + EmitByteCode( byteCode, node.DebugInfoAstNode.LineNumberStart ); } - else if ( isClassSymbol ) + else if ( isClassSymbol ) { int d4 = 0; Symbol memberSymbol = classSymbol.resolve( terminalNode.PrimaryBase.PrimaryId.Id, out int moduleId4, - ref d4, false ); + ref d4, + false ); if ( memberSymbol == null ) { EmitByteCode( BiteVmOpCodes.OpGetMemberWithString, - new ConstantValue( terminalNode.PrimaryBase.PrimaryId.Id ) ); + new ConstantValue( terminalNode.PrimaryBase.PrimaryId.Id ), node.DebugInfoAstNode.LineNumberStart ); } else { @@ -878,14 +948,14 @@ public override object Visit( CallBaseNode node ) BiteVmOpCodes.OpGetMember, memberSymbol.InsertionOrderNumber ); - EmitByteCode( byteCode ); + EmitByteCode( byteCode, node.DebugInfoAstNode.LineNumberStart ); } } else { EmitByteCode( BiteVmOpCodes.OpGetMemberWithString, - new ConstantValue( terminalNode.PrimaryBase.PrimaryId.Id ) ); + new ConstantValue( terminalNode.PrimaryBase.PrimaryId.Id ), node.DebugInfoAstNode.LineNumberStart ); } } } @@ -901,7 +971,7 @@ public override object Visit( CallBaseNode node ) } else { - EmitConstant( new ConstantValue( callElementEntry.Identifier ) ); + EmitConstant( new ConstantValue( callElementEntry.Identifier ), node.DebugInfoAstNode.LineNumberStart ); } } @@ -911,7 +981,7 @@ public override object Visit( CallBaseNode node ) BiteVmOpCodes.OpSetElement, terminalNode.ElementAccess.Count ); - EmitByteCode( byteCode ); + EmitByteCode( byteCode, node.DebugInfoAstNode.LineNumberStart ); } else { @@ -919,7 +989,7 @@ public override object Visit( CallBaseNode node ) BiteVmOpCodes.OpGetElement, terminalNode.ElementAccess.Count ); - EmitByteCode( byteCode ); + EmitByteCode( byteCode, node.DebugInfoAstNode.LineNumberStart ); } } @@ -947,8 +1017,9 @@ public override object Visit( AssignmentBaseNode node ) case AssignmentTypes.Assignment: if ( m_IsCompilingAssignmentRhs ) { - EmitByteCode( BiteVmOpCodes.OpPushNextAssignmentOnStack, 0 ); + EmitByteCode( BiteVmOpCodes.OpPushNextAssignmentOnStack, node.DebugInfoAstNode.LineNumberStart ); } + m_PostfixInstructions.Push( new BytecodeList() ); m_IsCompilingAssignmentRhs = true; Compile( node.AssignmentBase ); @@ -960,57 +1031,57 @@ public override object Visit( AssignmentBaseNode node ) switch ( node.OperatorType ) { case AssignmentOperatorTypes.Assign: - EmitByteCode( BiteVmOpCodes.OpAssign ); + EmitByteCode( BiteVmOpCodes.OpAssign, node.DebugInfoAstNode.LineNumberStart ); break; case AssignmentOperatorTypes.DivAssign: - EmitByteCode( BiteVmOpCodes.OpDivideAssign ); + EmitByteCode( BiteVmOpCodes.OpDivideAssign, node.DebugInfoAstNode.LineNumberStart ); break; case AssignmentOperatorTypes.MultAssign: - EmitByteCode( BiteVmOpCodes.OpMultiplyAssign ); + EmitByteCode( BiteVmOpCodes.OpMultiplyAssign, node.DebugInfoAstNode.LineNumberStart ); break; case AssignmentOperatorTypes.PlusAssign: - EmitByteCode( BiteVmOpCodes.OpPlusAssign ); + EmitByteCode( BiteVmOpCodes.OpPlusAssign, node.DebugInfoAstNode.LineNumberStart ); break; case AssignmentOperatorTypes.MinusAssign: - EmitByteCode( BiteVmOpCodes.OpMinusAssign ); + EmitByteCode( BiteVmOpCodes.OpMinusAssign, node.DebugInfoAstNode.LineNumberStart ); break; case AssignmentOperatorTypes.ModuloAssignOperator: - EmitByteCode( BiteVmOpCodes.OpModuloAssign ); + EmitByteCode( BiteVmOpCodes.OpModuloAssign, node.DebugInfoAstNode.LineNumberStart ); break; case AssignmentOperatorTypes.BitwiseAndAssignOperator: - EmitByteCode( BiteVmOpCodes.OpBitwiseAndAssign ); + EmitByteCode( BiteVmOpCodes.OpBitwiseAndAssign, node.DebugInfoAstNode.LineNumberStart ); break; case AssignmentOperatorTypes.BitwiseOrAssignOperator: - EmitByteCode( BiteVmOpCodes.OpBitwiseOrAssign ); + EmitByteCode( BiteVmOpCodes.OpBitwiseOrAssign, node.DebugInfoAstNode.LineNumberStart ); break; case AssignmentOperatorTypes.BitwiseXorAssignOperator: - EmitByteCode( BiteVmOpCodes.OpBitwiseXorAssign ); + EmitByteCode( BiteVmOpCodes.OpBitwiseXorAssign, node.DebugInfoAstNode.LineNumberStart ); break; case AssignmentOperatorTypes.BitwiseLeftShiftAssignOperator: - EmitByteCode( BiteVmOpCodes.OpBitwiseLeftShiftAssign ); + EmitByteCode( BiteVmOpCodes.OpBitwiseLeftShiftAssign, node.DebugInfoAstNode.LineNumberStart ); break; case AssignmentOperatorTypes.BitwiseRightShiftAssignOperator: - EmitByteCode( BiteVmOpCodes.OpBitwiseRightShiftAssign ); + EmitByteCode( BiteVmOpCodes.OpBitwiseRightShiftAssign, node.DebugInfoAstNode.LineNumberStart ); break; @@ -1022,8 +1093,9 @@ public override object Visit( AssignmentBaseNode node ) foreach ( ByteCode code in byteCodes.ByteCodes ) { - EmitByteCode( code ); + EmitByteCode( code, node.DebugInfoAstNode.LineNumberStart ); } + break; case AssignmentTypes.Binary: @@ -1077,6 +1149,17 @@ public override object Visit( BlockStatementBaseNode node ) return null; } + public override object Visit( SyncBlockNode node ) + { + EmitByteCode( BiteVmOpCodes.OpSwitchContext, node.DebugInfoAstNode.LineNumberStart ); + + Compile( node.Block ); + + EmitByteCode( BiteVmOpCodes.OpReturnContext, node.DebugInfoAstNode.LineNumberStart ); + + return null; + } + public override object Visit( StatementBaseNode node ) { if ( node is ExpressionStatementBaseNode expressionStatementNode ) @@ -1121,6 +1204,13 @@ public override object Visit( StatementBaseNode node ) return null; } + if ( node is SyncBlockNode syncStatementNode ) + { + Compile( syncStatementNode ); + + return null; + } + return null; } @@ -1134,19 +1224,19 @@ public override object Visit( ExpressionStatementBaseNode node ) public override object Visit( IfStatementBaseNode node ) { Compile( node.ExpressionBase ); - int thenJump = EmitByteCode( BiteVmOpCodes.OpNone, 0, 0 ); + int thenJump = EmitByteCode( BiteVmOpCodes.OpNone, 0, node.DebugInfoAstNode.LineNumberStart ); Compile( node.ThenStatementBase ); - int overElseJump = EmitByteCode( BiteVmOpCodes.OpNone, 0, 0 ); + int overElseJump = EmitByteCode( BiteVmOpCodes.OpNone, 0, node.DebugInfoAstNode.LineNumberStart ); - m_BiteProgram.CurrentChunk.Code[thenJump] = new ByteCode( + m_Context.CurrentChunk.Code[thenJump] = new ByteCode( BiteVmOpCodes.OpJumpIfFalse, - m_BiteProgram.CurrentChunk.SerializeToBytes().Length ); + m_Context.CurrentChunk.SerializeToBytes().Length ); Stack < int > endJumpStack = new Stack < int >(); - if (node.ElseStatementBase != null) + if ( node.ElseStatementBase != null ) { - Compile(node.ElseStatementBase); + Compile( node.ElseStatementBase ); } int endJumpStackCount = endJumpStack.Count; @@ -1155,14 +1245,14 @@ public override object Visit( IfStatementBaseNode node ) { int endJump = endJumpStack.Pop(); - m_BiteProgram.CurrentChunk.Code[endJump] = new ByteCode( + m_Context.CurrentChunk.Code[endJump] = new ByteCode( BiteVmOpCodes.OpJump, - m_BiteProgram.CurrentChunk.SerializeToBytes().Length ); + m_Context.CurrentChunk.SerializeToBytes().Length ); } - m_BiteProgram.CurrentChunk.Code[overElseJump] = new ByteCode( + m_Context.CurrentChunk.Code[overElseJump] = new ByteCode( BiteVmOpCodes.OpJump, - m_BiteProgram.CurrentChunk.SerializeToBytes().Length ); + m_Context.CurrentChunk.SerializeToBytes().Length ); return null; } @@ -1171,18 +1261,18 @@ public override object Visit( LocalVariableDeclarationBaseNode node ) { int d = 0; - DynamicVariable variableSymbol = node.AstScopeNode.resolve( node.VarId.Id, out int moduleId, ref d ) as DynamicVariable; + DynamicVariable variableSymbol = + node.AstScopeNode.resolve( node.VarId.Id, out int moduleId, ref d ) as DynamicVariable; Compile( node.ExpressionBase ); - EmitByteCode( BiteVmOpCodes.OpDefineVar ); - EmitByteCode( BiteVmOpCodes.OpNone, new ConstantValue( variableSymbol.Name ) ); + EmitByteCode( BiteVmOpCodes.OpDefineVar, new ConstantValue( variableSymbol.Name ), node.DebugInfoAstNode.LineNumberStart ); return null; } public override object Visit( LocalVariableInitializerBaseNode node ) { - foreach ( var variableDeclaration in node.VariableDeclarations ) + foreach ( LocalVariableDeclarationBaseNode variableDeclaration in node.VariableDeclarations ) { Compile( variableDeclaration ); } @@ -1192,34 +1282,34 @@ public override object Visit( LocalVariableInitializerBaseNode node ) public override object Visit( ForStatementBaseNode node ) { - EmitByteCode( BiteVmOpCodes.OpEnterBlock, ( node.AstScopeNode as BaseScope ).NestedSymbolCount, 0 ); + EmitByteCode( BiteVmOpCodes.OpEnterBlock, ( node.AstScopeNode as BaseScope ).NestedSymbolCount, node.DebugInfoAstNode.LineNumberStart ); m_CurrentEnterBlockCount++; m_PreviousLoopBlockCount = m_CurrentEnterBlockCount; - if (node.InitializerBase != null) + if ( node.InitializerBase != null ) { - if (node.InitializerBase.Expressions != null) + if ( node.InitializerBase.Expressions != null ) { - foreach (var expression in node.InitializerBase.Expressions) + foreach ( ExpressionBaseNode expression in node.InitializerBase.Expressions ) { - Compile(expression); + Compile( expression ); } } - else if (node.InitializerBase.LocalVariableInitializerBase != null) + else if ( node.InitializerBase.LocalVariableInitializerBase != null ) { - Compile(node.InitializerBase.LocalVariableInitializerBase); + Compile( node.InitializerBase.LocalVariableInitializerBase ); } } - int jumpCodeWhileBegin = m_BiteProgram.CurrentChunk.SerializeToBytes().Length; + int jumpCodeWhileBegin = m_Context.CurrentChunk.SerializeToBytes().Length; if ( node.Condition != null ) { - Compile( node.Condition); + Compile( node.Condition ); } else { - EmitConstant( new ConstantValue( true ) ); + EmitConstant( new ConstantValue( true ), node.DebugInfoAstNode.LineNumberStart ); } int toFix = EmitByteCode( BiteVmOpCodes.OpWhileLoop, jumpCodeWhileBegin, 0, 0 ); @@ -1228,10 +1318,10 @@ public override object Visit( ForStatementBaseNode node ) { Compile( node.StatementBase ); } - + if ( node.Iterators != null ) { - foreach ( var iterator in node.Iterators ) + foreach ( ExpressionBaseNode iterator in node.Iterators ) { Compile( iterator ); } @@ -1244,15 +1334,15 @@ public override object Visit( ForStatementBaseNode node ) EmitByteCode( BiteVmOpCodes.OpPopStack ); } }*/ - - m_BiteProgram.CurrentChunk.Code[toFix] = new ByteCode( - BiteVmOpCodes.OpWhileLoop, - jumpCodeWhileBegin, - m_BiteProgram.CurrentChunk.SerializeToBytes().Length ); - - EmitByteCode( BiteVmOpCodes.OpNone, 0, 0 ); - EmitByteCode( BiteVmOpCodes.OpNone, 0, 0 ); - EmitByteCode( BiteVmOpCodes.OpExitBlock ); + + m_Context.CurrentChunk.Code[toFix] = new ByteCode( + BiteVmOpCodes.OpWhileLoop, + jumpCodeWhileBegin, + m_Context.CurrentChunk.SerializeToBytes().Length ); + + EmitByteCode( BiteVmOpCodes.OpNone, 0, node.DebugInfoAstNode.LineNumberStart ); + EmitByteCode( BiteVmOpCodes.OpNone, 0, node.DebugInfoAstNode.LineNumberStart ); + EmitByteCode( BiteVmOpCodes.OpExitBlock, node.DebugInfoAstNode.LineNumberStart ); m_CurrentEnterBlockCount--; return null; @@ -1262,18 +1352,18 @@ public override object Visit( WhileStatementBaseNode node ) { m_PreviousLoopBlockCount = m_CurrentEnterBlockCount; - int jumpCodeWhileBegin = m_BiteProgram.CurrentChunk.SerializeToBytes().Length; + int jumpCodeWhileBegin = m_Context.CurrentChunk.SerializeToBytes().Length; Compile( node.ExpressionBase ); - int toFix = EmitByteCode( BiteVmOpCodes.OpWhileLoop, jumpCodeWhileBegin, 0, 0 ); + int toFix = EmitByteCode( BiteVmOpCodes.OpWhileLoop, jumpCodeWhileBegin, 0, node.DebugInfoAstNode.LineNumberStart ); Compile( node.WhileBlock ); - m_BiteProgram.CurrentChunk.Code[toFix] = new ByteCode( + m_Context.CurrentChunk.Code[toFix] = new ByteCode( BiteVmOpCodes.OpWhileLoop, jumpCodeWhileBegin, - m_BiteProgram.CurrentChunk.SerializeToBytes().Length ); + m_Context.CurrentChunk.SerializeToBytes().Length ); - EmitByteCode( BiteVmOpCodes.OpNone, 0, 0 ); - EmitByteCode( BiteVmOpCodes.OpNone, 0, 0 ); + EmitByteCode( BiteVmOpCodes.OpNone, 0, node.DebugInfoAstNode.LineNumberStart ); + EmitByteCode( BiteVmOpCodes.OpNone, 0, node.DebugInfoAstNode.LineNumberStart ); return null; } @@ -1281,11 +1371,11 @@ public override object Visit( WhileStatementBaseNode node ) public override object Visit( ReturnStatementBaseNode node ) { Compile( node.ExpressionStatementBase ); - EmitByteCode( BiteVmOpCodes.OpKeepLastItemOnStack ); + EmitByteCode( BiteVmOpCodes.OpKeepLastItemOnStack, node.DebugInfoAstNode.LineNumberStart ); for ( int i = 0; i < m_CurrentEnterBlockCount; i++ ) { - EmitByteCode( BiteVmOpCodes.OpExitBlock ); + EmitByteCode( BiteVmOpCodes.OpExitBlock, node.DebugInfoAstNode.LineNumberStart ); } EmitReturn(); @@ -1297,10 +1387,10 @@ public override object Visit( BreakStatementBaseNode node ) { for ( int i = 0; i < m_CurrentEnterBlockCount - m_PreviousLoopBlockCount; i++ ) { - EmitByteCode( BiteVmOpCodes.OpExitBlock ); + EmitByteCode( BiteVmOpCodes.OpExitBlock, node.DebugInfoAstNode.LineNumberStart ); } - EmitByteCode( BiteVmOpCodes.OpBreak ); + EmitByteCode( BiteVmOpCodes.OpBreak, node.DebugInfoAstNode.LineNumberStart ); return null; } @@ -1320,92 +1410,92 @@ public override object Visit( BinaryOperationBaseNode node ) switch ( node.Operator ) { case BinaryOperationBaseNode.BinaryOperatorType.Plus: - EmitByteCode( BiteVmOpCodes.OpAdd ); + EmitByteCode( BiteVmOpCodes.OpAdd, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.Minus: - EmitByteCode( BiteVmOpCodes.OpSubtract ); + EmitByteCode( BiteVmOpCodes.OpSubtract, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.Mult: - EmitByteCode( BiteVmOpCodes.OpMultiply ); + EmitByteCode( BiteVmOpCodes.OpMultiply, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.Div: - EmitByteCode( BiteVmOpCodes.OpDivide ); + EmitByteCode( BiteVmOpCodes.OpDivide, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.Modulo: - EmitByteCode( BiteVmOpCodes.OpModulo ); + EmitByteCode( BiteVmOpCodes.OpModulo, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.Equal: - EmitByteCode( BiteVmOpCodes.OpEqual ); + EmitByteCode( BiteVmOpCodes.OpEqual, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.NotEqual: - EmitByteCode( BiteVmOpCodes.OpNotEqual ); + EmitByteCode( BiteVmOpCodes.OpNotEqual, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.Less: - EmitByteCode( BiteVmOpCodes.OpLess ); + EmitByteCode( BiteVmOpCodes.OpLess, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.LessOrEqual: - EmitByteCode( BiteVmOpCodes.OpLessOrEqual ); + EmitByteCode( BiteVmOpCodes.OpLessOrEqual, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.Greater: - EmitByteCode( BiteVmOpCodes.OpGreater ); + EmitByteCode( BiteVmOpCodes.OpGreater, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.GreaterOrEqual: - EmitByteCode( BiteVmOpCodes.OpGreaterEqual ); + EmitByteCode( BiteVmOpCodes.OpGreaterEqual, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.And: - EmitByteCode( BiteVmOpCodes.OpAnd ); + EmitByteCode( BiteVmOpCodes.OpAnd, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.Or: - EmitByteCode( BiteVmOpCodes.OpOr ); + EmitByteCode( BiteVmOpCodes.OpOr, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.BitwiseOr: - EmitByteCode( BiteVmOpCodes.OpBitwiseOr ); + EmitByteCode( BiteVmOpCodes.OpBitwiseOr, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.BitwiseAnd: - EmitByteCode( BiteVmOpCodes.OpBitwiseAnd ); + EmitByteCode( BiteVmOpCodes.OpBitwiseAnd, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.BitwiseXor: - EmitByteCode( BiteVmOpCodes.OpBitwiseXor ); + EmitByteCode( BiteVmOpCodes.OpBitwiseXor, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.ShiftLeft: - EmitByteCode( BiteVmOpCodes.OpBitwiseLeftShift ); + EmitByteCode( BiteVmOpCodes.OpBitwiseLeftShift, node.DebugInfoAstNode.LineNumberStart ); break; case BinaryOperationBaseNode.BinaryOperatorType.ShiftRight: - EmitByteCode( BiteVmOpCodes.OpBitwiseRightShift ); + EmitByteCode( BiteVmOpCodes.OpBitwiseRightShift, node.DebugInfoAstNode.LineNumberStart ); break; @@ -1421,7 +1511,7 @@ public override object Visit( TernaryOperationBaseNode node ) Compile( node.RightOperand ); Compile( node.MidOperand ); Compile( node.LeftOperand ); - EmitByteCode( BiteVmOpCodes.OpTernary ); + EmitByteCode( BiteVmOpCodes.OpTernary, node.DebugInfoAstNode.LineNumberStart ); return null; } @@ -1440,7 +1530,8 @@ public override object Visit( PrimaryBaseNode node ) if ( symbol == null ) { throw new CompilerException( - $"Failed to resolve symbol '{node.PrimaryId.Id}' in scope '{node.AstScopeNode.Name}'", node ); + $"Failed to resolve symbol '{node.PrimaryId.Id}' in scope '{node.AstScopeNode.Name}'", + node ); } if ( symbol.SymbolScope is ClassSymbol s ) @@ -1454,7 +1545,7 @@ public override object Visit( PrimaryBaseNode node ) AddToConstuctingByteCodeInstruction( symbol.InsertionOrderNumber ); EndConstuctingByteCodeInstruction(); - + return null; } @@ -1469,40 +1560,45 @@ public override object Visit( PrimaryBaseNode node ) return null; case PrimaryBaseNode.PrimaryTypes.BooleanLiteral: - EmitConstant( new ConstantValue( node.BooleanLiteral.Value ) ); + EmitConstant( new ConstantValue( node.BooleanLiteral.Value ), node.DebugInfoAstNode.LineNumberStart ); return null; case PrimaryBaseNode.PrimaryTypes.IntegerLiteral: - EmitConstant( new ConstantValue( node.IntegerLiteral.Value ) ); + EmitConstant( new ConstantValue( node.IntegerLiteral.Value ), node.DebugInfoAstNode.LineNumberStart ); return null; case PrimaryBaseNode.PrimaryTypes.FloatLiteral: - EmitConstant( new ConstantValue( node.FloatLiteral.Value ) ); + EmitConstant( new ConstantValue( node.FloatLiteral.Value ), node.DebugInfoAstNode.LineNumberStart ); return null; case PrimaryBaseNode.PrimaryTypes.StringLiteral: - EmitConstant( new ConstantValue( node.StringLiteral ) ); + EmitConstant( new ConstantValue( node.StringLiteral ), node.DebugInfoAstNode.LineNumberStart ); return null; - + case PrimaryBaseNode.PrimaryTypes.InterpolatedString: int i = 0; + foreach ( InterpolatedStringPart interpolatedStringStringPart in node.InterpolatedString.StringParts ) { - EmitConstant( new ConstantValue( interpolatedStringStringPart.TextBeforeExpression ) ); + EmitConstant( new ConstantValue( interpolatedStringStringPart.TextBeforeExpression ), node.DebugInfoAstNode.LineNumberStart ); + if ( i > 0 ) { - EmitByteCode( BiteVmOpCodes.OpAdd ); + EmitByteCode( BiteVmOpCodes.OpAdd, node.DebugInfoAstNode.LineNumberStart ); } + Compile( interpolatedStringStringPart.ExpressionBaseNode ); - EmitByteCode( BiteVmOpCodes.OpAdd ); + EmitByteCode( BiteVmOpCodes.OpAdd, node.DebugInfoAstNode.LineNumberStart ); i++; } + EmitConstant( new ConstantValue( node.InterpolatedString.TextAfterLastExpression ) ); - EmitByteCode( BiteVmOpCodes.OpAdd ); + EmitByteCode( BiteVmOpCodes.OpAdd, node.DebugInfoAstNode.LineNumberStart ); + return null; case PrimaryBaseNode.PrimaryTypes.Expression: @@ -1511,10 +1607,17 @@ public override object Visit( PrimaryBaseNode node ) return null; case PrimaryBaseNode.PrimaryTypes.NullReference: - EmitConstant( new ConstantValue( null ) ); + object obj = null; + EmitConstant( new ConstantValue(obj), node.DebugInfoAstNode.LineNumberStart ); return null; + case PrimaryBaseNode.PrimaryTypes.ArrayExpression: + throw new NotImplementedException( "TODO" ); + + case PrimaryBaseNode.PrimaryTypes.DictionaryExpression: + throw new NotImplementedException( "TODO" ); + case PrimaryBaseNode.PrimaryTypes.Default: default: throw new ArgumentOutOfRangeException( @@ -1533,27 +1636,28 @@ public override object Visit( UnaryPostfixOperation node ) { m_IsCompilingPostfixOperation = true; int toFix = -1; + if ( m_PostfixInstructions.Count == 0 ) { - toFix = EmitByteCode( BiteVmOpCodes.OpNone ); + toFix = EmitByteCode( BiteVmOpCodes.OpNone, node.DebugInfoAstNode.LineNumberStart ); } - + Compile( node.Primary ); - - if ( toFix >= 0 && m_BiteProgram.CurrentChunk.Code[toFix + 1].OpCode == BiteVmOpCodes.OpGetVar ) + + if ( toFix >= 0 && m_Context.CurrentChunk.Code[toFix + 1].OpCode == BiteVmOpCodes.OpGetVar ) { - m_BiteProgram.CurrentChunk.Code[toFix] = new ByteCode( + m_Context.CurrentChunk.Code[toFix] = new ByteCode( BiteVmOpCodes.OpGetNextVarByRef ); } + m_IsCompilingPostfixOperation = false; - - + switch ( node.Operator ) { case UnaryPostfixOperation.UnaryPostfixOperatorType.PlusPlus: if ( m_PostfixInstructions.Count == 0 ) { - EmitByteCode( BiteVmOpCodes.OpPostfixIncrement ); + EmitByteCode( BiteVmOpCodes.OpPostfixIncrement, node.DebugInfoAstNode.LineNumberStart ); } else { @@ -1562,13 +1666,13 @@ public override object Visit( UnaryPostfixOperation node ) m_PostfixInstructions.Peek().ByteCodes.Add( new ByteCode( BiteVmOpCodes.OpPostfixIncrement ) ); } } - + break; case UnaryPostfixOperation.UnaryPostfixOperatorType.MinusMinus: if ( m_PostfixInstructions.Count == 0 ) { - EmitByteCode( BiteVmOpCodes.OpPostfixDecrement ); + EmitByteCode( BiteVmOpCodes.OpPostfixDecrement, node.DebugInfoAstNode.LineNumberStart ); } else { @@ -1589,38 +1693,37 @@ public override object Visit( UnaryPostfixOperation node ) public override object Visit( UnaryPrefixOperation node ) { - Compile( node.Primary ); switch ( node.Operator ) { case UnaryPrefixOperation.UnaryPrefixOperatorType.Plus: - EmitByteCode( BiteVmOpCodes.OpAffirm ); + EmitByteCode( BiteVmOpCodes.OpAffirm, node.DebugInfoAstNode.LineNumberStart ); break; case UnaryPrefixOperation.UnaryPrefixOperatorType.Compliment: - EmitByteCode( BiteVmOpCodes.OpCompliment ); + EmitByteCode( BiteVmOpCodes.OpCompliment, node.DebugInfoAstNode.LineNumberStart ); break; case UnaryPrefixOperation.UnaryPrefixOperatorType.PlusPlus: - EmitByteCode( BiteVmOpCodes.OpPrefixIncrement ); + EmitByteCode( BiteVmOpCodes.OpPrefixIncrement, node.DebugInfoAstNode.LineNumberStart ); break; case UnaryPrefixOperation.UnaryPrefixOperatorType.MinusMinus: - EmitByteCode( BiteVmOpCodes.OpPrefixDecrement ); + EmitByteCode( BiteVmOpCodes.OpPrefixDecrement, node.DebugInfoAstNode.LineNumberStart ); break; case UnaryPrefixOperation.UnaryPrefixOperatorType.LogicalNot: - EmitByteCode( BiteVmOpCodes.OpNot ); + EmitByteCode( BiteVmOpCodes.OpNot, node.DebugInfoAstNode.LineNumberStart ); break; case UnaryPrefixOperation.UnaryPrefixOperatorType.Negate: - EmitByteCode( BiteVmOpCodes.OpNegate ); + EmitByteCode( BiteVmOpCodes.OpNegate, node.DebugInfoAstNode.LineNumberStart ); break; @@ -1686,6 +1789,9 @@ public override object Visit( AstBaseNode baseNode ) case BlockStatementBaseNode blockStatementNode: return Visit( blockStatementNode ); + case SyncBlockNode syncBlockNode: + return Visit( syncBlockNode ); + case AssignmentBaseNode assignmentNode: return Visit( assignmentNode ); @@ -1740,16 +1846,6 @@ private void BeginConstuctingByteCodeInstruction( BiteVmOpCodes byteCode, int li m_ConstructingLine = line; } - public void Compile( ProgramBaseNode programBaseNode ) - { - programBaseNode.Accept( this ); - } - - public void Compile( ModuleBaseNode moduleBaseNode ) - { - moduleBaseNode.Accept( this ); - } - private object Compile( AstBaseNode astBaseNode ) { return astBaseNode.Accept( this ); @@ -1757,31 +1853,36 @@ private object Compile( AstBaseNode astBaseNode ) private int EmitByteCode( BiteVmOpCodes byteCode, int line = 0 ) { - return m_BiteProgram.CurrentChunk.WriteToChunk( byteCode, line ); + return m_Context.CurrentChunk.WriteToChunk( byteCode, line ); } private int EmitByteCode( BiteVmOpCodes byteCode, int opCodeData, int line ) { ByteCode byCode = new ByteCode( byteCode, opCodeData ); - return m_BiteProgram.CurrentChunk.WriteToChunk( byCode, line ); + return m_Context.CurrentChunk.WriteToChunk( byCode, line ); } private int EmitByteCode( BiteVmOpCodes byteCode, int opCodeData, int opCodeData2, int line ) { ByteCode byCode = new ByteCode( byteCode, opCodeData, opCodeData2 ); - return m_BiteProgram.CurrentChunk.WriteToChunk( byCode, line ); + return m_Context.CurrentChunk.WriteToChunk( byCode, line ); } private int EmitByteCode( ByteCode byteCode, int line = 0 ) { - return m_BiteProgram.CurrentChunk.WriteToChunk( byteCode, line ); + return m_Context.CurrentChunk.WriteToChunk( byteCode, line ); } private int EmitByteCode( BiteVmOpCodes byteCode, ConstantValue constantValue, int line = 0 ) { - return m_BiteProgram.CurrentChunk.WriteToChunk( byteCode, constantValue, line ); + return m_Context.CurrentChunk.WriteToChunk( byteCode, constantValue, line ); + } + + private int EmitByteCode( BiteVmOpCodes byteCode, ConstantValue constantValue, int opCodeData, int line = 0 ) + { + return m_Context.CurrentChunk.WriteToChunk( byteCode, constantValue, opCodeData,line ); } private int EmitConstant( ConstantValue value, int line = 0 ) @@ -1798,20 +1899,24 @@ private void EndConstuctingByteCodeInstruction() { ByteCode byCode = new ByteCode( m_ConstructingOpCode ); byCode.OpCodeData = m_ConstructingOpCodeData.ToArray(); - m_BiteProgram.CurrentChunk.WriteToChunk( byCode, m_ConstructingLine ); - if (m_PostfixInstructions.Count > 0 && m_IsCompilingPostfixOperation) + m_Context.CurrentChunk.WriteToChunk( byCode, m_ConstructingLine ); + + if ( m_PostfixInstructions.Count > 0 && m_IsCompilingPostfixOperation ) { - if (m_ConstructingOpCode == BiteVmOpCodes.OpGetVar) + if ( m_ConstructingOpCode == BiteVmOpCodes.OpGetVar ) { ByteCode byCodeAlt = new ByteCode( BiteVmOpCodes.OpGetNextVarByRef ); m_PostfixInstructions.Peek().ByteCodes.Add( byCodeAlt ); } + m_PostfixInstructions.Peek().ByteCodes.Add( byCode ); } + m_ConstructingOpCodeData = null; m_ConstructingOpCode = BiteVmOpCodes.OpNone; } - #endregion - } + + #endregion +} } diff --git a/Bite/CodeGenerator/CompilerException.cs b/Bite/CodeGenerator/CompilerException.cs index 6d32912..ff52062 100644 --- a/Bite/CodeGenerator/CompilerException.cs +++ b/Bite/CodeGenerator/CompilerException.cs @@ -8,22 +8,17 @@ public class CompilerException : Exception { public AstBaseNode BaseNode { get; } + public override string Message => + base.Message + + $" in column {BaseNode.DebugInfoAstNode.ColumnNumber} on line {BaseNode.DebugInfoAstNode.LineNumber}"; + #region Public - + public CompilerException( string message, AstBaseNode baseNode ) : base( message ) { BaseNode = baseNode; } - public override string Message - { - get - { - return base.Message + - $" in column {BaseNode.DebugInfoAstNode.ColumnNumber} on line {BaseNode.DebugInfoAstNode.LineNumber}"; - } - } - #endregion } diff --git a/Bite/Compiler/BiteCompiler.cs b/Bite/Compiler/BiteCompiler.cs index 1f11be8..9b28930 100644 --- a/Bite/Compiler/BiteCompiler.cs +++ b/Bite/Compiler/BiteCompiler.cs @@ -3,6 +3,7 @@ using Antlr4.Runtime; using AntlrBiteParser; using Bite.Ast; +using Bite.Modules; using Bite.Runtime; using Bite.Runtime.CodeGen; using Bite.Symbols; @@ -13,72 +14,41 @@ namespace Bite.Compiler public class BiteCompiler { - // TODO: Move somewhere else? - /// - /// System Module Declaration - /// - public string SystemModule = @"module System; - -class Object { - -} - -class CSharpInterface { -var Type = new Object(); -var Method = new Object(); -var Arguments = new Object(); -var ConstructorArguments = new Object(); -var ConstructorArgumentsTypes = new Object(); -var ObjectInstance = new Object(); -} - -extern callable function CSharpInterfaceCall ( object ); - -function CreateFromType( typeName, arguments, types ) { - var interface = new CSharpInterface(); - interface.Type = typeName; - interface.ConstructorArguments = arguments; - interface.ConstructorArgumentsTypes = types; - return CSharpInterfaceCall ( interface ); -} - -extern callable function Print ( object ); + private static string m_SystemModule; -extern callable function PrintLine ( object );"; - - #region Public Compilers + #region Public + /// + /// Compiles a set of modules + /// + /// + /// public BiteProgram Compile( IEnumerable < string > modules ) { ProgramBaseNode programBase = ParseModules( modules ); - return CompileProgramInternal( programBase ); - } - - public BiteProgram CompileExpression( string expression ) - { - ExpressionBaseNode expressionBaseNode = ParseExpression( expression ); - - return CompileExpressionInternal( expressionBaseNode ); - } - - public BiteProgram CompileStatements( string statements, SymbolTable symbolTable = null ) - { - IReadOnlyCollection < StatementBaseNode > statementNodes = ParseStatements( statements ); + SymbolTable symbolTable = new SymbolTable(); - return CompileStatementsInternal( statementNodes, symbolTable ); + return CompileProgram( symbolTable, programBase ); } + /// + /// Compiles a set of objects. You only need to use objects if you want to + /// keep a reference + /// to module names and imports in your own code without needing to parse a module string + /// + /// + /// public BiteProgram Compile( IReadOnlyCollection < Module > modules ) { - var moduleStrings = new List < string >(); + List < string > moduleStrings = new List < string >(); - foreach ( var module in modules ) + foreach ( Module module in modules ) { - var moduleBuilder = new StringBuilder(); + StringBuilder moduleBuilder = new StringBuilder(); moduleBuilder.AppendLine( $"module {module.Name};\r\n" ); - foreach ( var import in module.Imports ) + foreach ( string import in module.Imports ) { moduleBuilder.AppendLine( $"import {import};" ); moduleBuilder.AppendLine( $"using {import};" ); @@ -92,87 +62,95 @@ public BiteProgram Compile( IReadOnlyCollection < Module > modules ) ProgramBaseNode programBase = ParseModules( moduleStrings ); - return CompileProgramInternal( programBase ); - } + SymbolTable symbolTable = new SymbolTable(); - #endregion - - #region Parsers + return CompileProgram( symbolTable, programBase ); + } - private ProgramBaseNode ParseModules( IEnumerable < string > modules ) + /// + /// Compiles a single expression. Used for unit tests. + /// + /// + /// + public BiteProgram CompileExpression( string expression ) { - ProgramBaseNode programBase = new ProgramBaseNode(); - - ModuleBaseNode systemModuleBase = ParseModule( SystemModule ); - programBase.AddModule( systemModuleBase ); + ExpressionBaseNode expressionBaseNode = ParseExpression( expression ); - foreach (string biteModule in modules) + ModuleBaseNode moduleBase = new ModuleBaseNode { - ModuleBaseNode moduleBase = ParseModule( biteModule ); - programBase.AddModule( moduleBase ); - } + ModuleIdent = new ModuleIdentifier( "MainModule" ), + Statements = new List < StatementBaseNode > + { + new ExpressionStatementBaseNode { ExpressionBase = expressionBaseNode } + } + }; - return programBase; + SymbolTable symbolTable = new SymbolTable(); + + return CompileModule( symbolTable, moduleBase ); } - private ModuleBaseNode ParseModule( string module ) + /// + /// Compiles a set of statements, with the option to reuse an existing . + /// Primarily used for REPL, where the previous program context should be retained between compilations of new + /// statements + /// + /// + /// + /// + public BiteProgram CompileStatements( string statements, SymbolTable symbolTable = null ) { - BiteAstGenerator gen = new BiteAstGenerator(); - - BITEParser biteParser = CreateBiteParser( module, out var errorListener ); - - BITEParser.ModuleContext tree = biteParser.program().module( 0 ); + IReadOnlyCollection < StatementBaseNode > statementNodes = ParseStatements( statements ); - if ( errorListener.Errors.Count > 0 ) + ModuleBaseNode moduleBase = new ModuleBaseNode { - module = module.Trim(); - int start = module.IndexOf( "module" ) + "module ".Length; - var moduleName = module.Substring( start, module.IndexOf( ';' ) - start ); + ModuleIdent = new ModuleIdentifier( "MainModule" ), Statements = statementNodes + }; - throw new BiteCompilerException( - $"Error occured while parsing module '{moduleName}' .\r\nError Count: {errorListener.Errors.Count}", - errorListener.Errors ); + if ( symbolTable == null ) + { + symbolTable = new SymbolTable(); } - return ( ModuleBaseNode ) gen.VisitModule( tree ); + return CompileModule( symbolTable, moduleBase ); } - private ExpressionBaseNode ParseExpression( string expression ) + #endregion + + #region Private + + private BiteProgram CompileModule( SymbolTable symbolTable, ModuleBaseNode moduleBase ) { - BITEParser biteParser = CreateBiteParser( expression, out var errorListener ); + SymbolTableBuilder symbolTableBuilder = new SymbolTableBuilder( symbolTable ); - BITEParser.ExpressionContext tree = biteParser.expression(); + symbolTableBuilder.BuildModuleSymbolTable( moduleBase ); - if ( errorListener.Errors.Count > 0 ) - { - throw new BiteCompilerException( - $"Error occured while parsing expression.\r\nError Count: {errorListener.Errors.Count}", - errorListener.Errors ); - } + BiteCompilationContext context = new BiteCompilationContext( symbolTable ); - BiteAstGenerator gen = new BiteAstGenerator(); + CodeGenerator generator = new CodeGenerator( context ); - return ( ExpressionBaseNode ) gen.VisitExpression( tree ); + generator.Compile( moduleBase ); + + context.Build(); + + return BiteProgram.Create( symbolTable, context.CompiledMainChunk, context.CompiledChunks ); } - private IReadOnlyCollection < StatementBaseNode > ParseStatements( string statements ) + private BiteProgram CompileProgram( SymbolTable symbolTable, ProgramBaseNode programBase ) { - BITEParser biteParser = CreateBiteParser( statements, out var errorListener ); + SymbolTableBuilder symbolTableBuilder = new SymbolTableBuilder( symbolTable ); - BITEParser.StatementsContext tree = biteParser.statements(); + symbolTableBuilder.BuildProgramSymbolTable( programBase ); - if ( errorListener.Errors.Count > 0 ) - { - throw new BiteCompilerException( - $"Error occured while parsing statement.\r\nError Count: {errorListener.Errors.Count}", - errorListener.Errors ); - } + BiteCompilationContext context = new BiteCompilationContext( symbolTable ); - BiteAstGenerator gen = new BiteAstGenerator(); + CodeGenerator generator = new CodeGenerator( context ); - DeclarationsBaseNode declarationsBase = ( DeclarationsBaseNode ) gen.VisitStatements( tree ); + generator.Compile( programBase ); - return declarationsBase.Statements; + context.Build(); + + return BiteProgram.Create( symbolTable, context.CompiledMainChunk, context.CompiledChunks ); } private BITEParser CreateBiteParser( string input, out BiteCompilerSyntaxErrorListener errorListener ) @@ -188,115 +166,104 @@ private BITEParser CreateBiteParser( string input, out BiteCompilerSyntaxErrorLi return biteParser; } - #endregion - - #region Private Compilers - - private BiteProgram CompileExpressionInternal( ExpressionBaseNode expressionBase ) + private string GetSystemModule() { - ModuleBaseNode moduleBase = new ModuleBaseNode + // Memoize system module so we don't load it from the assembly resource every time we compile + if ( m_SystemModule == null ) { - ModuleIdent = new ModuleIdentifier( "MainModule" ), - Statements = new List < StatementBaseNode > { new ExpressionStatementBaseNode { ExpressionBase = expressionBase } } - }; - - var symbolTable = SymbolTable.Default; + m_SystemModule = ModuleLoader.LoadModule( "System" ); + } - var symbolTableBuilder = new SymbolTableBuilder( symbolTable ); + return m_SystemModule; + } - symbolTableBuilder.BuildModuleSymbolTable( moduleBase ); + private string GetBiteModule( string moduleName ) + { + // Memoize system module so we don't load it from the assembly resource every time we compile + return ModuleLoader.LoadModule( moduleName ); + } - var biteProgram = new BiteProgram( symbolTable ); + private ExpressionBaseNode ParseExpression( string expression ) + { + BITEParser biteParser = CreateBiteParser( expression, out BiteCompilerSyntaxErrorListener errorListener ); - CodeGenerator generator = new CodeGenerator( biteProgram ); + BITEParser.ExpressionContext tree = biteParser.expression(); - generator.Compile( moduleBase ); + if ( errorListener.Errors.Count > 0 ) + { + throw new BiteCompilerException( + $"Error occured while parsing expression.\r\nError Count: {errorListener.Errors.Count}", + errorListener.Errors ); + } - biteProgram.Build(); + BiteAstGenerator gen = new BiteAstGenerator(); - return biteProgram; + return ( ExpressionBaseNode ) gen.VisitExpression( tree ); } - private BiteProgram CompileProgramInternal( ProgramBaseNode programBaseNode ) + private ModuleBaseNode ParseModule( string module ) { - var symbolTable = SymbolTable.Default; - - var symbolTableBuilder = new SymbolTableBuilder( symbolTable ); - - symbolTableBuilder.BuildProgramSymbolTable( programBaseNode ); + BiteAstGenerator gen = new BiteAstGenerator(); - var biteProgram = new BiteProgram( symbolTable ); + BITEParser biteParser = CreateBiteParser( module, out BiteCompilerSyntaxErrorListener errorListener ); - CodeGenerator generator = new CodeGenerator( biteProgram ); + BITEParser.ModuleContext tree = biteParser.program().module( 0 ); - generator.Compile( programBaseNode ); + if ( errorListener.Errors.Count > 0 ) + { + module = module.Trim(); + int start = module.IndexOf( "module" ) + "module ".Length; + string moduleName = module.Substring( start, module.IndexOf( ';' ) - start ); - biteProgram.Build(); + throw new BiteCompilerException( + $"Error occured while parsing module '{moduleName}' .\r\nError Count: {errorListener.Errors.Count}", + errorListener.Errors ); + } - return biteProgram; + return ( ModuleBaseNode ) gen.VisitModule( tree ); } - private BiteProgram CompileStatements( ModuleBaseNode moduleBase, Dictionary < string, object > externalObjects, - List < StatementBaseNode > statements ) + private ProgramBaseNode ParseModules( IEnumerable < string > modules ) { - moduleBase.Statements = statements; - - var symbolTable = SymbolTable.Default; //.WithExternalObjects( externalObjects ); - - var symbolTableBuilder = new SymbolTableBuilder( symbolTable ); - - symbolTableBuilder.BuildModuleSymbolTable( moduleBase ); + ProgramBaseNode programBase = new ProgramBaseNode(); - var biteProgram = new BiteProgram( symbolTable ); + ModuleBaseNode systemModuleBase = ParseModule( GetSystemModule() ); + programBase.AddModule( systemModuleBase ); - CodeGenerator generator = new CodeGenerator( biteProgram ); - generator.Compile( moduleBase ); + ModuleBaseNode interopModuleBase = ParseModule( GetBiteModule( "Interop" ) ); + programBase.AddModule( interopModuleBase ); - biteProgram.Build(); + foreach ( string biteModule in modules ) + { + ModuleBaseNode moduleBase = ParseModule( biteModule ); + programBase.AddModule( moduleBase ); + } - return biteProgram; + return programBase; } - private BiteProgram CompileStatementsInternal( IReadOnlyCollection < StatementBaseNode > statements, SymbolTable symbolTable = null ) + private IReadOnlyCollection < StatementBaseNode > ParseStatements( string statements ) { + BITEParser biteParser = CreateBiteParser( statements, out BiteCompilerSyntaxErrorListener errorListener ); - ModuleBaseNode moduleBase = new ModuleBaseNode - { - ModuleIdent = new ModuleIdentifier( "MainModule" ), - Statements = statements, - }; + BITEParser.StatementsContext tree = biteParser.statements(); - if ( symbolTable == null ) + if ( errorListener.Errors.Count > 0 ) { - symbolTable = SymbolTable.Default; //.WithExternalObjects( externalObjects ); + throw new BiteCompilerException( + $"Error occured while parsing statement.\r\nError Count: {errorListener.Errors.Count}", + errorListener.Errors ); } - var symbolTableBuilder = new SymbolTableBuilder( symbolTable ); - - symbolTableBuilder.BuildModuleSymbolTable( moduleBase ); - - var biteProgram = new BiteProgram( symbolTable ); - - CodeGenerator generator = new CodeGenerator( biteProgram ); - - // TODO: Don't recompile system module everytime? - - //ModuleNode systemModule = ParseModule( SystemModule ); - - //symbolTableBuilder.BuildModuleSymbolTable( systemModule ); - - //generator.Compile( systemModule ); - - generator.Compile( moduleBase ); + BiteAstGenerator gen = new BiteAstGenerator(); - biteProgram.Build(); + DeclarationsBaseNode declarationsBase = ( DeclarationsBaseNode ) gen.VisitStatements( tree ); - return biteProgram; + return declarationsBase.Statements; } #endregion - } -} \ No newline at end of file +} diff --git a/Bite/Compiler/BiteCompilerException.cs b/Bite/Compiler/BiteCompilerException.cs index b253c33..bd77b65 100644 --- a/Bite/Compiler/BiteCompilerException.cs +++ b/Bite/Compiler/BiteCompilerException.cs @@ -7,13 +7,6 @@ namespace Bite.Compiler public class BiteCompilerException : ApplicationException { - public BiteCompilerException( string message, IReadOnlyCollection < BiteCompilerSyntaxError > syntaxErrors ) : - base( message ) - { - BiteCompilerExceptionMessage = message; - SyntaxErrors = syntaxErrors; - } - public string BiteCompilerExceptionMessage { get; } public IReadOnlyCollection < BiteCompilerSyntaxError > SyntaxErrors { get; } @@ -22,13 +15,13 @@ public override string Message { get { - var stringBuilder = new StringBuilder(); + StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append( BiteCompilerExceptionMessage ); stringBuilder.AppendLine(); - foreach ( var syntaxError in SyntaxErrors ) + foreach ( BiteCompilerSyntaxError syntaxError in SyntaxErrors ) { stringBuilder.AppendLine( syntaxError.Message ); } @@ -36,6 +29,17 @@ public override string Message return stringBuilder.ToString(); } } + + #region Public + + public BiteCompilerException( string message, IReadOnlyCollection < BiteCompilerSyntaxError > syntaxErrors ) : + base( message ) + { + BiteCompilerExceptionMessage = message; + SyntaxErrors = syntaxErrors; + } + + #endregion } } diff --git a/Bite/Compiler/BiteCompilerSyntaxError.cs b/Bite/Compiler/BiteCompilerSyntaxError.cs index 1c8e334..e526092 100644 --- a/Bite/Compiler/BiteCompilerSyntaxError.cs +++ b/Bite/Compiler/BiteCompilerSyntaxError.cs @@ -12,8 +12,13 @@ public readonly struct BiteCompilerSyntaxError public readonly string Message; public readonly RecognitionException Exception; - public BiteCompilerSyntaxError(IRecognizer recognizer, IToken offendingSymbol, int line, - int charPositionInLine, string message, RecognitionException exception) + public BiteCompilerSyntaxError( + IRecognizer recognizer, + IToken offendingSymbol, + int line, + int charPositionInLine, + string message, + RecognitionException exception ) { Recognizer = recognizer; OffendingSymbol = offendingSymbol; diff --git a/Bite/Compiler/BiteCompilerSyntaxErrorListener.cs b/Bite/Compiler/BiteCompilerSyntaxErrorListener.cs index 4e570ef..a8489be 100644 --- a/Bite/Compiler/BiteCompilerSyntaxErrorListener.cs +++ b/Bite/Compiler/BiteCompilerSyntaxErrorListener.cs @@ -7,7 +7,9 @@ namespace Bite.Compiler public class BiteCompilerSyntaxErrorListener : BaseErrorListener { - public readonly List Errors = new List(); + public readonly List < BiteCompilerSyntaxError > Errors = new List < BiteCompilerSyntaxError >(); + + #region Public public override void SyntaxError( TextWriter output, @@ -18,8 +20,10 @@ public override void SyntaxError( string msg, RecognitionException e ) { - Errors.Add(new BiteCompilerSyntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e)); + Errors.Add( new BiteCompilerSyntaxError( recognizer, offendingSymbol, line, charPositionInLine, msg, e ) ); } + + #endregion } } diff --git a/Bite/Grammar/BITELexer.g4 b/Bite/Grammar/BITELexer.g4 index 6b79123..9d6535b 100644 --- a/Bite/Grammar/BITELexer.g4 +++ b/Bite/Grammar/BITELexer.g4 @@ -31,6 +31,11 @@ NullReference: 'null'; ThisReference: 'this'; UsingDirective: 'using'; ImportDirective: 'import'; +StartStatement: 'start'; +UseStatement: 'use'; +ThreadStatement: 'thread'; +SyncKeyword: 'sync'; + AssignOperator: '='; PlusAssignOperator: '+='; @@ -81,11 +86,11 @@ BitwiseOrOperator:'|'; OpeningRoundBracket: '('; ClosingRoundBracket: ')'; -SquarebracketLeft : '['; -SquarebracketRight: ']'; +SquareBracketLeft : '['; +SquareBracketRight : ']'; -CommaSeperator: ','; -SemicolonSeperator: ';'; +CommaSeparator: ','; +SemicolonSeparator: ';'; DollarOperator:'$'; diff --git a/Bite/Grammar/BITEParser.g4 b/Bite/Grammar/BITEParser.g4 index 38cb449..6236df6 100644 --- a/Bite/Grammar/BITEParser.g4 +++ b/Bite/Grammar/BITEParser.g4 @@ -88,15 +88,15 @@ module ; moduleDeclaration - : DeclareModule Identifier ( DotOperator Identifier )* SemicolonSeperator + : DeclareModule Identifier ( DotOperator Identifier )* SemicolonSeparator ; importDirective - : ImportDirective Identifier ( DotOperator Identifier )* SemicolonSeperator + : ImportDirective Identifier ( DotOperator Identifier )* SemicolonSeparator ; usingDirective - : UsingDirective Identifier ( DotOperator Identifier )* SemicolonSeperator + : UsingDirective Identifier ( DotOperator Identifier )* SemicolonSeparator ; declaration @@ -111,33 +111,33 @@ declaration classDeclaration : ( privateModifier | publicModifier )? ( staticModifier | abstractModifier )? - DeclareClass Identifier (ColonOperator inheritance)? ( block | SemicolonSeperator ) + DeclareClass Identifier (ColonOperator inheritance)? ( block | SemicolonSeparator ) ; structDeclaration : ( privateModifier | publicModifier )? - DeclareStruct Identifier (block|SemicolonSeperator) + DeclareStruct Identifier (block|SemicolonSeparator) ; externalFunctionDeclaration : ( privateModifier | publicModifier )? ( staticModifier | abstractModifier )? - ExternModifier? CallableModifier? DeclareFunction Identifier ( AsKeyword Identifier )? OpeningRoundBracket parameters? ClosingRoundBracket SemicolonSeperator + ExternModifier? CallableModifier? DeclareFunction Identifier ( AsKeyword Identifier )? OpeningRoundBracket parameters? ClosingRoundBracket SemicolonSeparator ; functionDeclaration : ( privateModifier | publicModifier )? ( staticModifier | abstractModifier )? - DeclareFunction Identifier OpeningRoundBracket parameters? ClosingRoundBracket ( block | SemicolonSeperator ) + DeclareFunction Identifier OpeningRoundBracket parameters? ClosingRoundBracket ( block | SemicolonSeparator ) ; classInstanceDeclaration : ( privateModifier | publicModifier )? ( staticModifier )? - DeclareVariable Identifier AssignOperator DeclareClassInstance Identifier ( DotOperator Identifier )* OpeningRoundBracket arguments? ClosingRoundBracket SemicolonSeperator - | Identifier AssignOperator DeclareClassInstance Identifier ( DotOperator Identifier )* OpeningRoundBracket arguments? ClosingRoundBracket SemicolonSeperator + DeclareVariable Identifier AssignOperator DeclareClassInstance Identifier ( DotOperator Identifier )* OpeningRoundBracket arguments? ClosingRoundBracket (SemicolonSeparator | CURLY_L initializerExpression CURLY_R ) + | Identifier AssignOperator DeclareClassInstance Identifier ( DotOperator Identifier )* OpeningRoundBracket arguments? ClosingRoundBracket SemicolonSeparator ; variableDeclaration : ( privateModifier | publicModifier )? ( staticModifier )? - DeclareVariable Identifier ( ( AssignOperator exprStatement )? | SemicolonSeperator ) + DeclareVariable Identifier ( ( AssignOperator exprStatement )? | SemicolonSeparator ) ; statements @@ -151,12 +151,15 @@ statement | returnStatement | breakStatement | usingStatement + | startThreadStatement + | useThreadStatement | whileStatement + | syncBlock | block ; exprStatement - : expression SemicolonSeperator + : expression SemicolonSeparator ; localVarDeclaration @@ -164,22 +167,22 @@ localVarDeclaration ; localVarInitializer - : DeclareVariable localVarDeclaration ( CommaSeperator localVarDeclaration )* + : DeclareVariable localVarDeclaration ( CommaSeparator localVarDeclaration )* ; forInitializer : localVarInitializer - | expression ( CommaSeperator expression )* + | expression ( CommaSeparator expression )* ; forIterator - : expression ( CommaSeperator expression )* + : expression ( CommaSeparator expression )* ; forStatement : DeclareForLoop OpeningRoundBracket ( forInitializer )? - SemicolonSeperator ( condition = expression )? - SemicolonSeperator ( forIterator )? + SemicolonSeparator ( condition = expression )? + SemicolonSeparator ( forIterator )? ClosingRoundBracket ( statement )? ; @@ -189,21 +192,32 @@ ifStatement ; returnStatement - : FunctionReturn expression? SemicolonSeperator + : FunctionReturn expression? SemicolonSeparator ; breakStatement - : Break SemicolonSeperator + : Break SemicolonSeparator ; usingStatement : UsingDirective OpeningRoundBracket expression ClosingRoundBracket block ; +startThreadStatement + : StartStatement ThreadStatement OpeningRoundBracket expression ClosingRoundBracket + ; + +useThreadStatement + : UseStatement ThreadStatement OpeningRoundBracket expression ClosingRoundBracket + ; + whileStatement : DeclareWhileLoop OpeningRoundBracket expression ClosingRoundBracket block ; +syncBlock + : SyncKeyword block; + block : CURLY_L declaration* CURLY_R ; @@ -279,9 +293,18 @@ unary ; call - : primary (callArguments | DotOperator Identifier| elementAccess )* + : primary ( callArguments | DotOperator Identifier | elementAccess )* ; +arrayExpression + : SquareBracketLeft expression ( CommaSeparator expression )* SquareBracketRight; + +elementInitialization + : Identifier ColonOperator expression; + +dictionaryExpression + : CURLY_L elementInitialization ( CommaSeparator elementInitialization )* CURLY_R; + primary : BooleanLiteral | NullReference @@ -291,19 +314,24 @@ primary | OpeningRoundBracket expression ClosingRoundBracket | Identifier | string + | arrayExpression + | dictionaryExpression ; +memberInitialization : Identifier AssignOperator expression; + privateModifier : DeclarePrivate; publicModifier : DeclarePublic; abstractModifier : DeclareAbstract; -staticModifier : DeclareStatic; -parameters : parametersIdentifier ( CommaSeperator parametersIdentifier )* ; -arguments : argumentExpression ( CommaSeperator argumentExpression )* ; -inheritance : Identifier ( CommaSeperator Identifier )* ; +staticModifier : DeclareStatic; +initializerExpression : memberInitialization ( CommaSeparator memberInitialization )*; +parameters : parametersIdentifier ( CommaSeparator parametersIdentifier )* ; +arguments : argumentExpression ( CommaSeparator argumentExpression )* ; +inheritance : Identifier ( CommaSeparator Identifier )* ; callArguments : OpeningRoundBracket arguments? ClosingRoundBracket; -elementAccess : (SquarebracketLeft elementIdentifier SquarebracketRight)+; -elementIdentifier : (IntegerLiteral|string|call); -argumentExpression : (ReferenceOperator)? expression; +elementAccess : ( SquareBracketLeft elementIdentifier SquareBracketRight )+; +elementIdentifier : ( IntegerLiteral | string | call ); +argumentExpression : ( ReferenceOperator )? expression; parametersIdentifier : Identifier; string: DQUOTE stringPart* DQUOTE; diff --git a/Bite/Modules/Callables/System.cs b/Bite/Modules/Callables/System.cs new file mode 100644 index 0000000..659b3e1 --- /dev/null +++ b/Bite/Modules/Callables/System.cs @@ -0,0 +1,28 @@ +using Bite.Runtime; +using Bite.Runtime.Functions; +using Bite.Runtime.Functions.ForeignInterface; +using Bite.Runtime.Functions.Interop; + +namespace Bite.Modules.Callables +{ + +public static class SystemModule +{ + #region Public + + public static void RegisterSystemModuleCallables( this BiteVm biteVm, TypeRegistry typeRegistry = null ) + { + biteVm.RegisterCallable( "GetConstructor", new InteropGetConstructor( typeRegistry ) ); + biteVm.RegisterCallable( "GetStaticMember", new InteropGetStaticMember( typeRegistry ) ); + biteVm.RegisterCallable( "GetStaticMethod", new InteropGetStaticMethod( typeRegistry ) ); + biteVm.RegisterCallable( "GetMethod", new InteropGetMethod( typeRegistry ) ); + biteVm.RegisterCallable( "GetStaticClass", new InteropGetStaticClass( typeRegistry ) ); + biteVm.RegisterCallable( "GetGenericMethod", new InteropGetGenericMethod( typeRegistry ) ); + biteVm.RegisterCallable( "Print", new PrintFunctionVm() ); + biteVm.RegisterCallable( "PrintLine", new PrintLineFunctionVm() ); + } + + #endregion +} + +} diff --git a/Bite/Modules/Interop.bite b/Bite/Modules/Interop.bite new file mode 100644 index 0000000..44ae520 --- /dev/null +++ b/Bite/Modules/Interop.bite @@ -0,0 +1,21 @@ +// Bite Interop Module + +module Interop; + + +// Linked to ForeignLibraryInterfaceVm + +extern callable function GetConstructor ( type, parameterTypes ); + +extern callable function GetStaticClass ( type ); + +extern callable function GetStaticMethod ( type, parameterTypes ); + +extern callable function GetGenericMethod ( method, genericTypes ); + +extern callable function GetStaticMember ( type, name ); + +extern callable function GetMethod ( type, methodName, parameterTypes ); + +// extern callable function GetPropertyOrField ( type, name ); + diff --git a/Bite/Modules/ModuleLoader.cs b/Bite/Modules/ModuleLoader.cs new file mode 100644 index 0000000..4576dd2 --- /dev/null +++ b/Bite/Modules/ModuleLoader.cs @@ -0,0 +1,24 @@ +using System.IO; + +namespace Bite.Modules +{ + +internal class ModuleLoader +{ + #region Public + + public static string LoadModule( string moduleName ) + { + using ( Stream stream = + typeof( ModuleLoader ).Assembly.GetManifestResourceStream( $"Bite.Modules.{moduleName}.bite" ) ) + { + StreamReader reader = new StreamReader( stream ); + + return reader.ReadToEnd(); + } + } + + #endregion +} + +} diff --git a/Bite/Modules/System.bite b/Bite/Modules/System.bite new file mode 100644 index 0000000..b5ce703 --- /dev/null +++ b/Bite/Modules/System.bite @@ -0,0 +1,16 @@ +// Bite System Module + +module System; +import Interop; + +class Object { + +} + +// Linked to PrintFunctionVm + +extern callable function Print ( object ); + +// Linked to PrintLineFunctionVm + +extern callable function PrintLine ( object ); \ No newline at end of file diff --git a/Bite/Runtime/BiteFunctionCall.cs b/Bite/Runtime/BiteFunctionCall.cs new file mode 100644 index 0000000..17aa808 --- /dev/null +++ b/Bite/Runtime/BiteFunctionCall.cs @@ -0,0 +1,33 @@ +using Bite.Runtime.Memory; + +namespace Bite.Runtime +{ + +public class BiteFunctionCall +{ + public string FunctionName; + public BiteChunkWrapper BiteChunkWrapper = null; + public DynamicBiteVariable[] FunctionArguments; + + #region Public + + public BiteFunctionCall( + string functionName, + DynamicBiteVariable[] functionArguments ) + { + FunctionName = functionName; + FunctionArguments = functionArguments; + } + + public BiteFunctionCall( + BiteChunkWrapper fWrapper, + DynamicBiteVariable[] functionArguments ) + { + BiteChunkWrapper = fWrapper; + FunctionArguments = functionArguments; + } + + #endregion +} + +} diff --git a/Bite/Runtime/BiteVm.cs b/Bite/Runtime/BiteVm.cs index 5a82758..805cf23 100644 --- a/Bite/Runtime/BiteVm.cs +++ b/Bite/Runtime/BiteVm.cs @@ -1,151 +1,419 @@ //#define BITE_VM_DEBUG_TRACE_EXECUTION - +//#define BITE_VM_DEBUG_COUNT_EXECUTION using System; using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; +using System.Threading; +using System.Threading.Tasks; +using Antlr4.Runtime.Dfa; using Bite.Runtime.Bytecode; using Bite.Runtime.CodeGen; using Bite.Runtime.Functions; using Bite.Runtime.Functions.ForeignInterface; using Bite.Runtime.Memory; -using Type = System.Type; namespace Bite.Runtime { - public class BiteVmRuntimeException : ApplicationException +public class BiteVmCallSite +{ + public FastMethodInfo FastMethodInfo; + public Type[] FunctionArgumentTypes; +} + +public class BiteVm +{ + private enum ContextMode { - public BiteVmRuntimeException( string message ) : base( message ) - { - BiteVmRuntimeExceptionMessage = message; - } + CurrentContext, + SynchronizedContext + } - public string BiteVmRuntimeExceptionMessage { get; } + private BinaryChunk m_CurrentChunk; + private int m_CurrentInstructionPointer; + private DynamicBiteVariableStack m_VmStack; + + //private readonly List < DynamicBiteVariable > m_FunctionArguments = new List < DynamicBiteVariable >(); + + private DynamicBiteVariable[] m_FunctionArguments = new DynamicBiteVariable[0]; + public TypeRegistry TypeRegistry; + private ObjectPoolFastMemory m_PoolFastMemoryFastMemory; + private FastGlobalMemorySpace m_GlobalMemorySpace; + private FastMemorySpace m_CurrentMemorySpace; + private FastMemoryStack m_CallStack = new FastMemoryStack(); + private UsingStatementStack m_UsingStatementStack; + + private readonly MethodCache m_CachedMethods = new MethodCache(); + private readonly PropertyCache m_CachedProperties = new PropertyCache(); + public FastPropertyCache FastCachedProperties = new FastPropertyCache(); + private readonly FieldCache m_CachedFields = new FieldCache(); + + private int m_LastGetLocalVarId = -1; + private int m_LastGetLocalVarModuleId = -1; + private int m_LastGetLocalVarDepth = -1; + private int m_LastGetLocalClassId = -1; + private int m_LoopEndJumpCode = -1; + private string m_LastElement = ""; + private bool m_SetElement = false; + private bool m_SetMember = false; + private string m_MemberWithStringToSet = ""; + private bool m_SetMemberWithString = false; + private bool m_KeepLastItemOnStackToReturn = false; + private bool m_SetVarWithExternalName = false; + private string m_SetVarExternalName = ""; + private bool m_GetNextVarByRef = false; + private bool m_PushNextAssignmentOnStack = false; + private BiteVmOpCodes m_CurrentByteCodeInstruction = BiteVmOpCodes.OpNone; + + private Dictionary < string, BinaryChunk > m_CompiledChunks; + + private Dictionary < Tuple < int, BinaryChunk >, BiteVmCallSite > m_CallSites = + new Dictionary < Tuple < int, BinaryChunk >, BiteVmCallSite >(); + + private readonly Dictionary < string, object > m_ExternalObjects = new Dictionary < string, object >(); + private readonly Dictionary < string, IBiteVmCallable > m_Callables = new Dictionary < string, IBiteVmCallable >(); + + private BiteFunctionCall m_CallBack; + + private bool m_CallbackWaiting = false; + private bool m_SpinLockCallingThread = false; + private bool m_SpinLockWorkingThread = false; + private bool m_RunOnCallingThreadThread = false; + private int m_InstructionPointerBeforeExecutingCallback = -1; + + private ContextMode m_ContextMode; + private bool m_ExitRunLoop; + private bool m_Stopping = false; + + private CancellationToken m_CancellationToken; + + private int m_CurrentLineNumberPointer = 0; + + /// + /// Will contain the last value on the stack when the program exits + /// + public DynamicBiteVariable ReturnValue { get; private set; } + + /// + /// Gets or sets the to be used inside a sync block + /// + public SynchronizationContext SynchronizationContext { get; set; } + + #region Public + + public void InitVm() + { + m_VmStack = new DynamicBiteVariableStack(); + m_UsingStatementStack = new UsingStatementStack(); + m_CallStack = new FastMemoryStack(); + m_PoolFastMemoryFastMemory = new ObjectPoolFastMemory(); + + m_GlobalMemorySpace = + new FastGlobalMemorySpace( 10 ); + + m_CompiledChunks = new Dictionary < string, BinaryChunk >(); } - public class BiteVm + /// + /// Executes the specified on the current thread + /// + /// + /// + public BiteVmInterpretResult Interpret( BiteProgram program ) { - private BinaryChunk m_CurrentChunk; - private int m_CurrentInstructionPointer; - private DynamicBiteVariableStack m_VmStack; - - private readonly List m_FunctionArguments = new List(); - private ObjectPoolFastMemory m_PoolFastMemoryFastMemory; - private FastGlobalMemorySpace m_GlobalMemorySpace; - private FastMemorySpace m_CurrentMemorySpace; - private FastMemoryStack m_CallStack = new FastMemoryStack(); - private UsingStatementStack m_UsingStatementStack; - - private readonly Dictionary - m_CachedMethods = new Dictionary(); - - private readonly Dictionary m_CachedProperties = new Dictionary(); - private readonly Dictionary m_CachedFields = new Dictionary(); - private int m_LastGetLocalVarId = -1; - private int m_LastGetLocalVarModuleId = -1; - private int m_LastGetLocalVarDepth = -1; - private int m_LastGetLocalClassId = -1; - private int m_LoopEndJumpCode = -1; - private string m_LastElement = ""; - private bool m_SetElement = false; - private bool m_SetMember = false; - private string m_MemberWithStringToSet = ""; - private bool m_SetMemberWithString = false; - private bool m_KeepLastItemOnStackToReturn = false; - private bool m_SetVarWithExternalName = false; - private string m_SetVarExternalName = ""; - private bool m_GetNextVarByRef = false; - private bool m_PushNextAssignmentOnStack = false; - private BiteVmOpCodes m_CurrentByteCodeInstruction = BiteVmOpCodes.OpNone; - - private readonly Dictionary m_ExternalObjects = new Dictionary(); - private readonly Dictionary m_Callables = new Dictionary(); - - public Dictionary CompiledChunks { get; private set; } - - public DynamicBiteVariable ReturnValue { get; private set; } - - #region Public - - public void InitVm() - { - m_VmStack = new DynamicBiteVariableStack(); - m_UsingStatementStack = new UsingStatementStack(); - m_CallStack = new FastMemoryStack(); - m_PoolFastMemoryFastMemory = new ObjectPoolFastMemory(); + return Interpret( program, new CancellationToken() ); + } - m_GlobalMemorySpace = - new FastGlobalMemorySpace( 1 ); + /// + /// Executes the specified on the current thread + /// + /// + /// + public BiteVmInterpretResult Interpret( BiteProgram program, CancellationToken token ) + { + TypeRegistry = program.TypeRegistry; - } + m_CurrentChunk = program.CompiledMainChunk; + m_CancellationToken = token; + m_Stopping = false; - public BiteVmInterpretResult Interpret( BiteProgram context ) + foreach ( KeyValuePair < string, BinaryChunk > compiledChunk in m_CompiledChunks ) { - m_CurrentChunk = context.CompiledMainChunk; - CompiledChunks = context.CompiledChunks; - m_CurrentInstructionPointer = 0; - return Run(); + if ( !program.CompiledChunks.ContainsKey( compiledChunk.Key ) ) + { + program.CompiledChunks.Add( compiledChunk.Key, compiledChunk.Value ); + } } - public void RegisterExternalGlobalObject( string varName, object data ) + m_CompiledChunks = program.CompiledChunks; + m_CurrentInstructionPointer = 0; + m_CurrentLineNumberPointer = 0; + BiteVmInterpretResult result = BiteVmInterpretResult.Continue; + + // This while loop exists to allow us to switch contexts from within code using the sync keyword + while ( result == BiteVmInterpretResult.Continue && !m_Stopping ) { - m_ExternalObjects.Add( varName, data ); + m_ExitRunLoop = false; + + switch ( m_ContextMode ) + { + // Execute instructions in the current context (thread) + case ContextMode.CurrentContext: + result = Run(); + + break; + + // Execute instructions synchronously in the specified synchronized context (thread) + case ContextMode.SynchronizedContext: + if ( SynchronizationContext == null ) + { + // No context, try to run normally + result = Run(); + } + else + { + SynchronizationContext.Send( o => { result = Run(); }, null ); + } + + break; + } } - public void RegisterCallable( string linkId, IBiteVmCallable callable ) + return result; + } + + /// + /// Executes the specified on new Task via Task.Run + /// + /// + /// + public Task < BiteVmInterpretResult > InterpretAsync( BiteProgram program ) + { + return InterpretAsync( program, CancellationToken.None ); + } + + /// + /// Executes the specified on new Task via Task.Run + /// + /// + /// + public async Task < BiteVmInterpretResult > InterpretAsync( BiteProgram program, CancellationToken token ) + { + return await Task.Run( () => { return Interpret( program, token ); } ); + } + + /// + /// Registers a class as an extern callable method with the specified linkId + /// + /// + /// + public void RegisterCallable( string linkId, IBiteVmCallable callable ) + { + m_Callables.Add( linkId, callable ); + } + + /// + /// Registers an external object as a global variable + /// + /// + /// + public void RegisterExternalGlobalObject( string varName, object data ) + { + m_ExternalObjects.Add( varName, data ); + } + + /// + /// Registers a set of external objects as global variables + /// + /// + public void RegisterExternalGlobalObjects( IDictionary < string, object > externalObjects ) + { + if ( externalObjects != null ) { - m_Callables.Add( linkId, callable ); + foreach ( KeyValuePair < string, object > externalObject in externalObjects ) + { + m_ExternalObjects.Add( externalObject.Key, externalObject.Value ); + } } + } + + public void CallBiteFunction( BiteFunctionCall biteFunctionCall, bool runOnCallingThread = false ) + { + m_CallBack = biteFunctionCall; + m_SpinLockCallingThread = true; + m_CallbackWaiting = true; - public void ResetVm() + if ( runOnCallingThread ) { - m_VmStack = new DynamicBiteVariableStack(); - m_UsingStatementStack = new UsingStatementStack(); - m_CallStack = new FastMemoryStack(); - m_PoolFastMemoryFastMemory = new ObjectPoolFastMemory(); - - m_GlobalMemorySpace = - new FastGlobalMemorySpace( 10 ); + m_RunOnCallingThreadThread = true; + m_SpinLockWorkingThread = true; + } + while ( m_SpinLockCallingThread ) + { + Thread.Sleep( new TimeSpan( 1 ) ); + } + if ( runOnCallingThread ) + { + Run(); } + } + + public void CallBiteFunctionSynchron( BiteFunctionCall biteFunctionCall, bool runOnCallingThread = false) + { + m_CallBack = biteFunctionCall; + m_CallbackWaiting = true; - #endregion + if ( runOnCallingThread ) + { + Run(); + } + } - #region Protected + /// + /// Requests the current to stop execution and exit as soon as the current instruction has + /// completed. + /// If execution is running on a thread, this action will not by synchronous + /// + public void Stop() + { + m_ExitRunLoop = true; + m_Stopping = true; + } #endregion - #region Private + #region Private - private ConstantValue ReadConstant() - { - ConstantValue instruction = - m_CurrentChunk.Constants[m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24)]; + private ConstantValue ReadConstant() + { + ConstantValue instruction = + m_CurrentChunk.Constants[m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 )]; - m_CurrentInstructionPointer += 4; + m_CurrentInstructionPointer += 4; - return instruction; - } + return instruction; + } - private BiteVmOpCodes ReadInstruction() - { - m_CurrentByteCodeInstruction = (BiteVmOpCodes) m_CurrentChunk.Code[m_CurrentInstructionPointer]; - m_CurrentInstructionPointer++; + private BiteVmOpCodes ReadInstruction() + { + m_CurrentByteCodeInstruction = ( BiteVmOpCodes ) m_CurrentChunk.Code[m_CurrentInstructionPointer]; + m_CurrentInstructionPointer++; - return m_CurrentByteCodeInstruction; - } + return m_CurrentByteCodeInstruction; + } - private BiteVmInterpretResult Run() + private BiteVmInterpretResult Run() + { + BiteVmInterpretResult result = BiteVmInterpretResult.Continue; + + while ( !m_ExitRunLoop ) { - while (true) + if ( m_CancellationToken != null && m_CancellationToken.IsCancellationRequested ) + { + return BiteVmInterpretResult.Cancelled; + } + + if ( m_CallbackWaiting && (m_CurrentInstructionPointer != m_InstructionPointerBeforeExecutingCallback || m_CurrentInstructionPointer >= m_CurrentChunk.Code.Length)) { - if (m_CurrentInstructionPointer < m_CurrentChunk.Code.Length) + m_InstructionPointerBeforeExecutingCallback = m_CurrentInstructionPointer; + string method = m_CallBack.FunctionName; + + if ( m_CallBack.BiteChunkWrapper != null ) + { + FastMemorySpace callSpace = m_PoolFastMemoryFastMemory.Get(); + + //callSpace.ResetPropertiesArray( m_FunctionArguments.Count ); + callSpace.m_EnclosingSpace = m_GlobalMemorySpace; + callSpace.CallerChunk = m_CurrentChunk; + callSpace.CallerIntructionPointer = m_CurrentInstructionPointer; + callSpace.CallerLineNumberPointer = m_CurrentLineNumberPointer; + callSpace.StackCountAtBegin = m_VmStack.Count; + callSpace.IsRunningCallback = true; + m_CurrentMemorySpace = callSpace; + m_CallStack.Push( callSpace ); + + for ( int i = 0; i < m_CallBack.FunctionArguments.Length; i++ ) + { + m_CurrentMemorySpace.Define( + m_CallBack.FunctionArguments[i] ); + } + + m_CurrentChunk = m_CallBack.BiteChunkWrapper.ChunkToWrap; + m_CurrentInstructionPointer = 0; + m_CurrentLineNumberPointer = 0; + } + else + { + DynamicBiteVariable call = m_CurrentMemorySpace.Get( method ); + + if ( call.ObjectData is BiteChunkWrapper function ) + { + FastMemorySpace callSpace = m_PoolFastMemoryFastMemory.Get(); + + //callSpace.ResetPropertiesArray( m_FunctionArguments.Count ); + callSpace.m_EnclosingSpace = m_GlobalMemorySpace; + callSpace.CallerChunk = m_CurrentChunk; + callSpace.CallerIntructionPointer = m_CurrentInstructionPointer; + callSpace.CallerLineNumberPointer = m_CurrentLineNumberPointer; + callSpace.StackCountAtBegin = m_VmStack.Count; + callSpace.IsRunningCallback = true; + m_CurrentMemorySpace = callSpace; + m_CallStack.Push( callSpace ); + + for ( int i = 0; i < m_CallBack.FunctionArguments.Length; i++ ) + { + m_CurrentMemorySpace.Define( + m_CallBack.FunctionArguments[i] ); + } + + m_CurrentChunk = function.ChunkToWrap; + m_CurrentInstructionPointer = 0; + m_CurrentLineNumberPointer = 0; + } + else if ( call.ObjectData is IBiteVmCallable callable ) + { + object returnVal = callable.Call( m_FunctionArguments ); + m_FunctionArguments = Array.Empty < DynamicBiteVariable >(); + + if ( returnVal != null ) + { + m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( returnVal ) ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Function " + method + " not found!" ); + } + } + + m_CallbackWaiting = false; + + if ( m_RunOnCallingThreadThread ) { + m_SpinLockCallingThread = false; + while ( m_SpinLockWorkingThread ) + { + Thread.Sleep( new TimeSpan( 1 ) ); + } + + m_RunOnCallingThreadThread = false; + } + } + + if ( m_CurrentInstructionPointer < m_CurrentChunk.Code.Length ) + { + +#if BITE_VM_DEBUG_COUNT_EXECUTION + m_CurrentChunk.CountInstruction( m_CurrentInstructionPointer ); +#endif #if BITE_VM_DEBUG_TRACE_EXECUTION - Console.Write( "Stack: " ); + Console.Write( "Stack: " ); for ( int i = 0; i < m_VmStack.Count; i++ ) { @@ -154,1384 +422,1469 @@ private BiteVmInterpretResult Run() Console.Write( "\n" ); - m_CurrentChunk.DissassembleInstruction( m_CurrentInstructionPointer ); + m_CurrentChunk.DissassembleInstruction( m_CurrentInstructionPointer, m_CurrentLineNumberPointer ); #endif - BiteVmOpCodes instruction = ReadInstruction(); + BiteVmOpCodes instruction = ReadInstruction(); - switch (instruction) + switch ( instruction ) + { + case BiteVmOpCodes.OpSwitchContext: { - case BiteVmOpCodes.OpNone: - { - break; - } + m_ContextMode = ContextMode.SynchronizedContext; + m_ExitRunLoop = true; - case BiteVmOpCodes.OpPopStack: - { - m_VmStack.Pop(); + break; + } - break; - } + case BiteVmOpCodes.OpReturnContext: + { + m_ContextMode = ContextMode.CurrentContext; + m_ExitRunLoop = true; - case BiteVmOpCodes.OpBreak: - { - m_CurrentInstructionPointer = m_LoopEndJumpCode; + break; + } - break; - } + case BiteVmOpCodes.OpNone: + { + break; + } - case BiteVmOpCodes.OpDefineModule: - { - string moduleName = ReadConstant().StringConstantValue; - int depth = 0; + case BiteVmOpCodes.OpPopStack: + { + m_VmStack.Pop(); - int numberOfMembers = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + break; + } - m_CurrentInstructionPointer += 4; - FastMemorySpace fastMemorySpace = m_GlobalMemorySpace.GetModule( $"$module_{moduleName}" ); + case BiteVmOpCodes.OpBreak: + { + m_CurrentInstructionPointer = m_LoopEndJumpCode; - if (fastMemorySpace == null) - { - FastModuleMemorySpace callSpace = new FastModuleMemorySpace( - $"$module_{moduleName}", - m_GlobalMemorySpace, - m_VmStack.Count, - m_CurrentChunk, - m_CurrentInstructionPointer, - numberOfMembers ); - - m_GlobalMemorySpace.AddModule( callSpace ); - m_CurrentChunk = CompiledChunks[moduleName]; - m_CurrentInstructionPointer = 0; - m_CurrentMemorySpace = callSpace; - m_CallStack.Push( callSpace ); - } - else - { - m_CurrentChunk = CompiledChunks[moduleName]; - m_CurrentInstructionPointer = 0; - m_CurrentMemorySpace = fastMemorySpace; - m_CallStack.Push( fastMemorySpace ); - } + break; + } - break; - } + case BiteVmOpCodes.OpDefineModule: + { + string moduleName = ReadConstant().StringConstantValue; + int depth = 0; - case BiteVmOpCodes.OpDefineClass: - { - string className = ReadConstant().StringConstantValue; + int numberOfMembers = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); + + m_CurrentInstructionPointer += 4; + FastMemorySpace fastMemorySpace = m_GlobalMemorySpace.GetModule( $"$module_{moduleName}" ); + + if ( fastMemorySpace == null ) + { + FastModuleMemorySpace callSpace = new FastModuleMemorySpace( + $"$module_{moduleName}", + m_GlobalMemorySpace, + m_VmStack.Count, + m_CurrentChunk, + m_CurrentInstructionPointer, + m_CurrentLineNumberPointer, + numberOfMembers ); + + m_GlobalMemorySpace.AddModule( callSpace ); + m_CurrentChunk = m_CompiledChunks[moduleName]; + m_CurrentInstructionPointer = 0; + m_CurrentLineNumberPointer = 0; + m_CurrentMemorySpace = callSpace; + m_CallStack.Push( callSpace ); + } + else + { + m_CurrentChunk = m_CompiledChunks[moduleName]; + m_CurrentInstructionPointer = 0; + m_CurrentMemorySpace = fastMemorySpace; + m_CallStack.Push( fastMemorySpace ); + } - BiteChunkWrapper chunkWrapper = new BiteChunkWrapper( - CompiledChunks[className] ); + break; + } + + case BiteVmOpCodes.OpDefineClass: + { + string className = ReadConstant().StringConstantValue; - m_CurrentMemorySpace.Define( - DynamicVariableExtension.ToDynamicVariable( chunkWrapper ) ); + BiteChunkWrapper chunkWrapper = new BiteChunkWrapper( + m_CompiledChunks[className] ); - break; + m_CurrentMemorySpace.Define( + DynamicVariableExtension.ToDynamicVariable( chunkWrapper ) ); + + break; + } + + case BiteVmOpCodes.OpDefineMethod: + { + string fullQualifiedMethodName = ReadConstant().StringConstantValue; + + string methodName = m_VmStack.Pop().StringData; + + BiteChunkWrapper chunkWrapper = new BiteChunkWrapper( + m_CompiledChunks[fullQualifiedMethodName] ); + + m_CurrentMemorySpace.Define( + DynamicVariableExtension.ToDynamicVariable( chunkWrapper ), + methodName ); + + break; + } + + case BiteVmOpCodes.OpDefineCallableMethod: + { + string fullQualifiedMethodName = ReadConstant().StringConstantValue; + + string methodName = m_VmStack.Pop().StringData; + + if ( m_Callables.TryGetValue( methodName, out IBiteVmCallable callable ) ) + { + m_CurrentMemorySpace.Define( + DynamicVariableExtension.ToDynamicVariable( callable ), + methodName ); + } + else + { + throw new BiteVmRuntimeException( $"No such Callable {methodName}" ); + } + + break; + } + + case BiteVmOpCodes.OpBindToFunction: + { + int numberOfArguments = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); + + m_CurrentInstructionPointer += 4; + + m_FunctionArguments = new DynamicBiteVariable[numberOfArguments]; + + for ( int i = numberOfArguments - 1; i >= 0; i-- ) + { + m_FunctionArguments[i] = ( m_VmStack.Pop() ); + } + + break; + } + + case BiteVmOpCodes.OpSetFunctionParameterName: + { + int numberOfParameter = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); + + m_CurrentInstructionPointer += 4; + + for ( int i = numberOfParameter; i > 0; i-- ) + { + m_CurrentMemorySpace.SetNameOfVariable( i - 1, m_VmStack.Pop().StringData ); + } + + break; + } + + case BiteVmOpCodes.OpCallFunctionByName: + { + string method = ReadConstant().StringConstantValue; + DynamicBiteVariable call = m_CurrentMemorySpace.Get( method ); + + if ( call.ObjectData is BiteChunkWrapper function ) + { + FastMemorySpace callSpace = m_PoolFastMemoryFastMemory.Get(); + + //callSpace.ResetPropertiesArray( m_FunctionArguments.Count ); + callSpace.m_EnclosingSpace = m_CurrentMemorySpace; + callSpace.CallerChunk = m_CurrentChunk; + callSpace.CallerIntructionPointer = m_CurrentInstructionPointer; + callSpace.CallerLineNumberPointer = m_CurrentLineNumberPointer; + callSpace.StackCountAtBegin = m_VmStack.Count; + m_CurrentMemorySpace = callSpace; + m_CallStack.Push( callSpace ); + + for ( int i = 0; i < m_FunctionArguments.Length; i++ ) + { + m_CurrentMemorySpace.Define( m_FunctionArguments[i] ); } - case BiteVmOpCodes.OpDefineMethod: + m_FunctionArguments = Array.Empty < DynamicBiteVariable >(); + m_CurrentChunk = function.ChunkToWrap; + m_CurrentInstructionPointer = 0; + m_CurrentLineNumberPointer = 0; + } + else if ( call.ObjectData is IBiteVmCallable callable ) + { + object returnVal = callable.Call( m_FunctionArguments ); + m_FunctionArguments = Array.Empty < DynamicBiteVariable >(); + + if ( returnVal != null ) { - string fullQualifiedMethodName = ReadConstant().StringConstantValue; + m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( returnVal ) ); + } + } + else + { + throw new BiteVmRuntimeException( "Runtime Error: Function " + method + " not found!" ); + } - string methodName = m_VmStack.Pop().StringData; + break; + } - BiteChunkWrapper chunkWrapper = new BiteChunkWrapper( - CompiledChunks[fullQualifiedMethodName] ); + case BiteVmOpCodes.OpCallFunctionFromStack: + { + FastMemorySpace fastMemorySpace = m_VmStack.Pop().ObjectData as FastMemorySpace; - m_CurrentMemorySpace.Define( - DynamicVariableExtension.ToDynamicVariable( chunkWrapper ), - methodName ); + m_CurrentMemorySpace = fastMemorySpace; - break; + if ( m_VmStack.Count > 0 && + m_VmStack.Peek().ObjectData is BiteChunkWrapper functionFromStack ) + { + m_VmStack.Pop(); + FastMemorySpace callSpace = m_PoolFastMemoryFastMemory.Get(); + + //callSpace.ResetPropertiesArray( m_FunctionArguments.Count ); + callSpace.m_EnclosingSpace = m_CurrentMemorySpace; + callSpace.CallerChunk = m_CurrentChunk; + callSpace.CallerIntructionPointer = m_CurrentInstructionPointer; + callSpace.CallerLineNumberPointer = m_CurrentLineNumberPointer; + callSpace.StackCountAtBegin = m_VmStack.Count; + m_CurrentMemorySpace = callSpace; + m_CallStack.Push( callSpace ); + + foreach ( DynamicBiteVariable functionArgument in m_FunctionArguments ) + { + m_CurrentMemorySpace.Define( functionArgument ); } - case BiteVmOpCodes.OpDefineCallableMethod: + m_FunctionArguments = Array.Empty < DynamicBiteVariable >(); + m_CurrentChunk = functionFromStack.ChunkToWrap; + m_CurrentInstructionPointer = 0; + m_CurrentLineNumberPointer = 0; + } + else + { + throw new BiteVmRuntimeException( "Runtime Error: Function not found!" ); + } + + break; + } + + case BiteVmOpCodes.OpCallMemberFunction: + { + ConstantValue constant = ReadConstant(); + DynamicBiteVariable dynamicBiteVariable = m_VmStack.Pop(); + + if ( dynamicBiteVariable.ObjectData is StaticWrapper wrapper ) + { + Tuple < int, BinaryChunk > key = new Tuple < int, BinaryChunk >( + m_CurrentInstructionPointer, + m_CurrentChunk ); + + if ( m_CallSites.TryGetValue( key, out BiteVmCallSite biteVmCallSite ) ) { - string fullQualifiedMethodName = ReadConstant().StringConstantValue; + object[] functionArguments = new object[m_FunctionArguments.Length / 2]; - string methodName = m_VmStack.Pop().StringData; + int it = 0; - if (m_Callables.TryGetValue( methodName, out IBiteVmCallable callable )) + for ( int i = 0; i < m_FunctionArguments.Length; i += 2 ) { - m_CurrentMemorySpace.Define( - DynamicVariableExtension.ToDynamicVariable( callable ), - methodName ); + functionArguments[it] = Convert.ChangeType( + m_FunctionArguments[i].ToObject(), + biteVmCallSite.FunctionArgumentTypes[it] ); + + it++; } - else + + object returnVal = biteVmCallSite.FastMethodInfo.Invoke( null, functionArguments ); + m_FunctionArguments = Array.Empty < DynamicBiteVariable >(); + + if ( returnVal != null ) { - throw new BiteVmRuntimeException( $"No such Callable {methodName}" ); + m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( returnVal ) ); } - - - break; } - - case BiteVmOpCodes.OpBindToFunction: + else { - int numberOfArguments = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + string methodName = constant.StringConstantValue; + object[] functionArguments = new object[m_FunctionArguments.Length / 2]; + Type[] functionArgumentTypes = new Type[m_FunctionArguments.Length / 2]; - m_CurrentInstructionPointer += 4; + int it = 0; - for (int i = 0; i < numberOfArguments; i++) + for ( int i = 0; i < m_FunctionArguments.Length; i += 2 ) { - m_FunctionArguments.Add( m_VmStack.Pop() ); + if ( m_FunctionArguments[i + 1].DynamicType == DynamicVariableType.String ) + { + if ( TypeRegistry.TryResolveType( + m_FunctionArguments[i + 1].StringData, + out Type argType ) ) + { + functionArgumentTypes[it] = argType; + + functionArguments[it] = Convert.ChangeType( + m_FunctionArguments[i].ToObject(), + argType ); + } + } + + it++; } - break; - } + if ( m_CachedMethods.TryGetMethod( + wrapper.StaticWrapperType, + functionArgumentTypes, + constant.StringConstantValue, + out FastMethodInfo fastMethodInfo ) ) + { + object returnVal = fastMethodInfo. + Invoke( dynamicBiteVariable.ObjectData, functionArguments ); - case BiteVmOpCodes.OpSetFunctionParameterName: - { - int numberOfParameter = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + m_FunctionArguments = Array.Empty < DynamicBiteVariable >(); - m_CurrentInstructionPointer += 4; + BiteVmCallSite newBiteVmCallSite = new BiteVmCallSite(); + newBiteVmCallSite.FastMethodInfo = fastMethodInfo; + newBiteVmCallSite.FunctionArgumentTypes = functionArgumentTypes; - for (int i = numberOfParameter; i > 0; i--) + m_CallSites.Add( key, newBiteVmCallSite ); + + if ( returnVal != null ) + { + m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( returnVal ) ); + } + } + else { - m_CurrentMemorySpace.SetNameOfVariable( i - 1, m_VmStack.Pop().StringData ); + throw new BiteVmRuntimeException( + "Runtime Error: Function " + constant.StringConstantValue + " not found!" ); } - - break; } + } + else if ( dynamicBiteVariable.ObjectData is ICSharpEvent cSharpEvent ) + { + EventInfo eventInfo = ( EventInfo ) m_VmStack.Pop().ObjectData; + cSharpEvent.Invoke( eventInfo.Name, m_FunctionArguments ); + m_FunctionArguments = Array.Empty < DynamicBiteVariable >(); + } + else if ( dynamicBiteVariable.ObjectData is FastMemorySpace fastMemorySpace ) + { + string methodName = constant.StringConstantValue; + DynamicBiteVariable call = fastMemorySpace.Get( methodName ); - case BiteVmOpCodes.OpCallFunctionByName: + if ( call.ObjectData != null ) { - string method = ReadConstant().StringConstantValue; - DynamicBiteVariable call = m_CurrentMemorySpace.Get( method ); - - if (call.ObjectData is BiteChunkWrapper function) + if ( call.ObjectData is BiteChunkWrapper function ) { + m_CurrentMemorySpace = fastMemorySpace; FastMemorySpace callSpace = m_PoolFastMemoryFastMemory.Get(); - callSpace.ResetPropertiesArray( m_FunctionArguments.Count ); + + //callSpace.ResetPropertiesArray( m_FunctionArguments.Length ); callSpace.m_EnclosingSpace = m_CurrentMemorySpace; callSpace.CallerChunk = m_CurrentChunk; callSpace.CallerIntructionPointer = m_CurrentInstructionPointer; + callSpace.CallerLineNumberPointer = m_CurrentLineNumberPointer; callSpace.StackCountAtBegin = m_VmStack.Count; m_CurrentMemorySpace = callSpace; m_CallStack.Push( callSpace ); - for (int i = 0; i < m_FunctionArguments.Count; i++) + foreach ( DynamicBiteVariable functionArgument in m_FunctionArguments ) { - m_CurrentMemorySpace.Define( m_FunctionArguments[i] ); + m_CurrentMemorySpace.Define( functionArgument ); } - m_FunctionArguments.Clear(); + m_FunctionArguments = Array.Empty < DynamicBiteVariable >(); m_CurrentChunk = function.ChunkToWrap; m_CurrentInstructionPointer = 0; + m_CurrentLineNumberPointer = 0; } - else if (call.ObjectData is IBiteVmCallable callable) + else if ( call.ObjectData is IBiteVmCallable callable ) { object returnVal = callable.Call( m_FunctionArguments ); - m_FunctionArguments.Clear(); + m_FunctionArguments = Array.Empty < DynamicBiteVariable >(); - if (returnVal != null) + if ( returnVal != null ) { m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( returnVal ) ); } } - else - { - throw new BiteVmRuntimeException( "Runtime Error: Function " + method + " not found!" ); - } - - break; } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Function " + constant.StringConstantValue + " not found!" ); + } + } + else if ( dynamicBiteVariable.ObjectData is object obj ) + { + Tuple < int, BinaryChunk > key = new Tuple < int, BinaryChunk >( + m_CurrentInstructionPointer, + m_CurrentChunk ); - case BiteVmOpCodes.OpCallFunctionFromStack: + if ( m_CallSites.TryGetValue( key, out BiteVmCallSite biteVmCallSite ) ) { - FastMemorySpace fastMemorySpace = m_VmStack.Pop().ObjectData as FastMemorySpace; + object[] functionArguments = new object[m_FunctionArguments.Length / 2]; - m_CurrentMemorySpace = fastMemorySpace; + int it = 0; - if (m_VmStack.Count > 0 && - m_VmStack.Peek().ObjectData is BiteChunkWrapper functionFromStack) + for ( int i = 0; i < m_FunctionArguments.Length; i += 2 ) { - m_VmStack.Pop(); - FastMemorySpace callSpace = m_PoolFastMemoryFastMemory.Get(); - callSpace.ResetPropertiesArray( m_FunctionArguments.Count ); - callSpace.m_EnclosingSpace = m_CurrentMemorySpace; - callSpace.CallerChunk = m_CurrentChunk; - callSpace.CallerIntructionPointer = m_CurrentInstructionPointer; - callSpace.StackCountAtBegin = m_VmStack.Count; - m_CurrentMemorySpace = callSpace; - m_CallStack.Push( callSpace ); - - foreach (DynamicBiteVariable functionArgument in m_FunctionArguments) - { - m_CurrentMemorySpace.Define( functionArgument ); - } + functionArguments[it] = Convert.ChangeType( + m_FunctionArguments[i].ToObject(), + biteVmCallSite.FunctionArgumentTypes[it] ); - m_FunctionArguments.Clear(); - m_CurrentChunk = functionFromStack.ChunkToWrap; - m_CurrentInstructionPointer = 0; + it++; } - else + + object returnVal = biteVmCallSite.FastMethodInfo.Invoke( obj, functionArguments ); + + m_FunctionArguments = Array.Empty < DynamicBiteVariable >(); + + if ( returnVal != null ) { - throw new BiteVmRuntimeException( "Runtime Error: Function not found!" ); + m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( returnVal ) ); } - - break; } - - case BiteVmOpCodes.OpCallMemberFunction: + else { - ConstantValue constant = ReadConstant(); - DynamicBiteVariable dynamicBiteVariable = m_VmStack.Pop(); - - if (dynamicBiteVariable.ObjectData is StaticWrapper wrapper) - { - string methodName = constant.StringConstantValue; - object[] functionArguments = new object[m_FunctionArguments.Count]; - Type[] functionArgumentTypes = new Type[m_FunctionArguments.Count]; - int it = 0; - m_FunctionArguments.Reverse(); - - for (int i = 0; i < m_FunctionArguments.Count; i++) - { - functionArguments[it] = m_FunctionArguments[i].ToObject(); - functionArgumentTypes[it] = m_FunctionArguments[i].GetType(); - it++; - } + Type type = obj.GetType(); - object returnVal = wrapper.InvokeMember( - methodName, - functionArguments, - functionArgumentTypes ); + object[] functionArguments = new object[m_FunctionArguments.Length / 2]; + Type[] functionArgumentTypes = new Type[m_FunctionArguments.Length / 2]; - m_FunctionArguments.Clear(); + int it = 0; - if (returnVal != null) + for ( int i = 0; i < m_FunctionArguments.Length; i += 2 ) + { + if ( m_FunctionArguments[i + 1].DynamicType == DynamicVariableType.String ) { - m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( returnVal ) ); + if ( TypeRegistry.TryResolveType( + m_FunctionArguments[i + 1].StringData, + out Type argType ) ) + { + functionArgumentTypes[it] = argType; + + functionArguments[it] = Convert.ChangeType( + m_FunctionArguments[i].ToObject(), + argType ); + } } + + it++; } - else if (dynamicBiteVariable.ObjectData is FastMemorySpace fastMemorySpace) - { - string methodName = constant.StringConstantValue; - DynamicBiteVariable call = fastMemorySpace.Get( methodName ); - m_CurrentMemorySpace = fastMemorySpace; + if ( m_CachedMethods.TryGetMethod( + type, + functionArgumentTypes, + constant.StringConstantValue, + out FastMethodInfo fastMethodInfo ) ) + { + object returnVal = fastMethodInfo. + Invoke( dynamicBiteVariable.ObjectData, functionArguments ); - if (call.ObjectData != null) - { - if (call.ObjectData is BiteChunkWrapper function) - { - FastMemorySpace callSpace = m_PoolFastMemoryFastMemory.Get(); - callSpace.ResetPropertiesArray( m_FunctionArguments.Count ); - callSpace.m_EnclosingSpace = m_CurrentMemorySpace; - callSpace.CallerChunk = m_CurrentChunk; - callSpace.CallerIntructionPointer = m_CurrentInstructionPointer; - callSpace.StackCountAtBegin = m_VmStack.Count; - m_CurrentMemorySpace = callSpace; - m_CallStack.Push( callSpace ); - - foreach (DynamicBiteVariable functionArgument in m_FunctionArguments) - { - m_CurrentMemorySpace.Define( functionArgument ); - } + BiteVmCallSite newBiteVmCallSite = new BiteVmCallSite(); + newBiteVmCallSite.FastMethodInfo = fastMethodInfo; + newBiteVmCallSite.FunctionArgumentTypes = functionArgumentTypes; - m_FunctionArguments.Clear(); - m_CurrentChunk = function.ChunkToWrap; - m_CurrentInstructionPointer = 0; - } + m_CallSites.Add( key, newBiteVmCallSite ); - if (call.ObjectData is IBiteVmCallable callable) - { - object returnVal = callable.Call( m_FunctionArguments ); - m_FunctionArguments.Clear(); + m_FunctionArguments = Array.Empty < DynamicBiteVariable >(); - if (returnVal != null) - { - m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( returnVal ) ); - } - } - } - else + if ( returnVal != null ) { - throw new BiteVmRuntimeException( - "Runtime Error: Function " + constant.StringConstantValue + " not found!" ); + m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( returnVal ) ); } } - else if (dynamicBiteVariable.ObjectData is object obj) + else { - string callString = obj + "." + constant.StringConstantValue; + throw new BiteVmRuntimeException( + "Runtime Error: Function " + constant.StringConstantValue + " not found!" ); + } + } - if (m_CachedMethods.ContainsKey( callString )) - { - object[] functionArguments = new object[m_FunctionArguments.Count]; + //string callString = obj + "." + constant.StringConstantValue; + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Function " + constant.StringConstantValue + " not found!" ); + } - //Type[] functionArgumentTypes = new Type[m_FunctionArguments.Count]; - int it = 0; + break; + } - foreach (DynamicBiteVariable functionArgument in m_FunctionArguments) - { - functionArguments[it] = functionArgument.ToObject(); + case BiteVmOpCodes.OpDefineInstance: + { + int moduleIdClass = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - // functionArgumentTypes[it] = functionArgument.GetType(); - it++; - } + m_CurrentInstructionPointer += 4; - object returnVal = m_CachedMethods[callString]. - Invoke( dynamicBiteVariable.ObjectData, functionArguments ); + int depthClass = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - m_FunctionArguments.Clear(); + m_CurrentInstructionPointer += 4; - if (returnVal != null) - { - m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( returnVal ) ); - } - } - else - { - Type type = obj.GetType(); - object[] functionArguments = new object[m_FunctionArguments.Count]; - Type[] functionArgumentTypes = new Type[m_FunctionArguments.Count]; - int it = 0; + int idClass = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - foreach (DynamicBiteVariable functionArgument in m_FunctionArguments) - { - functionArguments[it] = functionArgument.ToObject(); - functionArgumentTypes[it] = functionArgument.GetType(); - it++; - } + m_CurrentInstructionPointer += 4; - MethodInfo method = type.GetMethod( - constant.StringConstantValue, - functionArgumentTypes ); + int classMemberCount = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - if (method != null) - { - FastMethodInfo fastMethodInfo = new FastMethodInfo( method ); - m_CachedMethods.Add( callString, fastMethodInfo ); + m_CurrentInstructionPointer += 4; - object returnVal = fastMethodInfo.Invoke( - dynamicBiteVariable.ObjectData, - functionArguments ); + BiteVmOpCodes biteVmOpCode = ReadInstruction(); + string instanceName = ReadConstant().StringConstantValue; - if (returnVal != null) - { - m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( returnVal ) ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Function " + constant.StringConstantValue + " not found!" ); - } + if ( m_CurrentMemorySpace.Get( moduleIdClass, depthClass, -1, idClass ).ObjectData is + BiteChunkWrapper classWrapper ) + { + FastClassMemorySpace classInstanceMemorySpace = new FastClassMemorySpace( + $"{moduleIdClass}", + m_CurrentMemorySpace, + m_VmStack.Count + 1, + m_CurrentChunk, + m_CurrentInstructionPointer, + m_CurrentLineNumberPointer, + classMemberCount ); + + m_CurrentMemorySpace.Define( + DynamicVariableExtension.ToDynamicVariable( classInstanceMemorySpace ), + instanceName ); + + m_CurrentMemorySpace = classInstanceMemorySpace; + m_CurrentChunk = classWrapper.ChunkToWrap; + m_CurrentInstructionPointer = 0; + m_CurrentLineNumberPointer = 0; + m_CallStack.Push( m_CurrentMemorySpace ); + m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( classInstanceMemorySpace ) ); + } - m_FunctionArguments.Clear(); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Function " + constant.StringConstantValue + " not found!" ); - } + break; + } - break; - } + case BiteVmOpCodes.OpDefineVar: + { + string instanceName = ReadConstant().StringConstantValue; + m_CurrentMemorySpace.Define( m_VmStack.Pop(), instanceName ); - case BiteVmOpCodes.OpDefineInstance: - { - int moduleIdClass = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + break; + } - m_CurrentInstructionPointer += 4; + case BiteVmOpCodes.OpDeclareVar: + { + string instanceName = ReadConstant().StringConstantValue; + m_CurrentMemorySpace.Define( DynamicVariableExtension.ToDynamicVariable(), instanceName ); - int depthClass = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + break; + } - m_CurrentInstructionPointer += 4; + case BiteVmOpCodes.OpSetInstance: + { + int moduleIdLocalInstance = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - int idClass = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + m_CurrentInstructionPointer += 4; - m_CurrentInstructionPointer += 4; + int depthLocalInstance = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - int classMemberCount = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + m_CurrentInstructionPointer += 4; - m_CurrentInstructionPointer += 4; + int idLocalInstance = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - BiteVmOpCodes biteVmOpCode = ReadInstruction(); - string instanceName = ReadConstant().StringConstantValue; + m_CurrentInstructionPointer += 4; - if (m_CurrentMemorySpace.Get( moduleIdClass, depthClass, -1, idClass ).ObjectData is - BiteChunkWrapper classWrapper) - { - FastClassMemorySpace classInstanceMemorySpace = new FastClassMemorySpace( - $"{moduleIdClass}", - m_CurrentMemorySpace, - m_VmStack.Count + 1, - m_CurrentChunk, - m_CurrentInstructionPointer, - classMemberCount ); - - m_CurrentMemorySpace.Define( - DynamicVariableExtension.ToDynamicVariable( classInstanceMemorySpace ), - instanceName ); - - m_CurrentMemorySpace = classInstanceMemorySpace; - m_CurrentChunk = classWrapper.ChunkToWrap; - m_CurrentInstructionPointer = 0; - m_CallStack.Push( m_CurrentMemorySpace ); - m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( classInstanceMemorySpace ) ); - } + int moduleIdClass = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - break; - } + m_CurrentInstructionPointer += 4; - case BiteVmOpCodes.OpDefineVar: - { - BiteVmOpCodes biteVmOpCode = ReadInstruction(); - string instanceName = ReadConstant().StringConstantValue; - m_CurrentMemorySpace.Define( m_VmStack.Pop(), instanceName ); + int depthClass = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - break; - } + m_CurrentInstructionPointer += 4; - case BiteVmOpCodes.OpDeclareVar: - { - BiteVmOpCodes biteVmOpCode = ReadInstruction(); - string instanceName = ReadConstant().StringConstantValue; - m_CurrentMemorySpace.Define( DynamicVariableExtension.ToDynamicVariable(), instanceName ); + int idClass = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - break; - } + m_CurrentInstructionPointer += 4; - case BiteVmOpCodes.OpSetInstance: - { - int moduleIdLocalInstance = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + int classMemberCount = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - m_CurrentInstructionPointer += 4; + m_CurrentInstructionPointer += 4; - int depthLocalInstance = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + if ( m_CurrentMemorySpace.Get( moduleIdClass, depthClass, -1, idClass ).ObjectData is + BiteChunkWrapper classWrapper ) + { + FastClassMemorySpace classInstanceMemorySpace = new FastClassMemorySpace( + $"{moduleIdClass}", + m_CurrentMemorySpace, + m_VmStack.Count, + m_CurrentChunk, + m_CurrentInstructionPointer, + m_CurrentLineNumberPointer, + classMemberCount ); + + classInstanceMemorySpace.m_EnclosingSpace = m_CurrentMemorySpace; + classInstanceMemorySpace.CallerChunk = m_CurrentChunk; + classInstanceMemorySpace.CallerIntructionPointer = m_CurrentInstructionPointer; + classInstanceMemorySpace.StackCountAtBegin = m_VmStack.Count; + + m_CurrentMemorySpace.Put( + moduleIdLocalInstance, + depthLocalInstance, + -1, + idLocalInstance, + DynamicVariableExtension.ToDynamicVariable( classInstanceMemorySpace ) ); + + m_CurrentMemorySpace = classInstanceMemorySpace; + m_CurrentChunk = classWrapper.ChunkToWrap; + m_CurrentInstructionPointer = 0; + m_CurrentLineNumberPointer = 0; + m_CallStack.Push( classInstanceMemorySpace ); + m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( classInstanceMemorySpace ) ); + } - m_CurrentInstructionPointer += 4; + break; + } - int idLocalInstance = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + case BiteVmOpCodes.OpGetNextVarByRef: + { + BiteVmOpCodes nextOpCode = ReadInstruction(); - m_CurrentInstructionPointer += 4; + if ( nextOpCode == BiteVmOpCodes.OpGetVar ) + { + m_LastGetLocalVarModuleId = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); + + m_CurrentInstructionPointer += 4; + + m_LastGetLocalVarDepth = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); + + m_CurrentInstructionPointer += 4; + + m_LastGetLocalClassId = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); + + m_CurrentInstructionPointer += 4; + + m_LastGetLocalVarId = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); + + m_CurrentInstructionPointer += 4; + + m_VmStack.Push( + m_CurrentMemorySpace.Get( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId ) ); + + } + else + { + m_CurrentInstructionPointer--; + } - int moduleIdClass = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + break; + } - m_CurrentInstructionPointer += 4; + case BiteVmOpCodes.OpGetVar: + { + m_LastGetLocalVarModuleId = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - int depthClass = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + m_CurrentInstructionPointer += 4; - m_CurrentInstructionPointer += 4; + m_LastGetLocalVarDepth = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - int idClass = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + m_CurrentInstructionPointer += 4; - m_CurrentInstructionPointer += 4; + m_LastGetLocalClassId = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - int classMemberCount = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + m_CurrentInstructionPointer += 4; - m_CurrentInstructionPointer += 4; + m_LastGetLocalVarId = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - BiteVmOpCodes biteVmOpCode = ReadInstruction(); - string instanceName = ReadConstant().StringConstantValue; + m_CurrentInstructionPointer += 4; - if (m_CurrentMemorySpace.Get( moduleIdClass, depthClass, -1, idClass ).ObjectData is - BiteChunkWrapper classWrapper) - { - FastClassMemorySpace classInstanceMemorySpace = new FastClassMemorySpace( - $"{moduleIdClass}", - m_CurrentMemorySpace, - m_VmStack.Count, - m_CurrentChunk, - m_CurrentInstructionPointer, - classMemberCount ); - - classInstanceMemorySpace.m_EnclosingSpace = m_CurrentMemorySpace; - classInstanceMemorySpace.CallerChunk = m_CurrentChunk; - classInstanceMemorySpace.CallerIntructionPointer = m_CurrentInstructionPointer; - classInstanceMemorySpace.StackCountAtBegin = m_VmStack.Count; - - m_CurrentMemorySpace.Put( - moduleIdLocalInstance, - depthLocalInstance, - -1, - idLocalInstance, - DynamicVariableExtension.ToDynamicVariable( classInstanceMemorySpace ) ); - - m_CurrentMemorySpace = classInstanceMemorySpace; - m_CurrentChunk = classWrapper.ChunkToWrap; - m_CurrentInstructionPointer = 0; + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + m_CurrentMemorySpace.Get( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId ) ) ); - m_CallStack.Push( classInstanceMemorySpace ); - m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( classInstanceMemorySpace ) ); - } + break; + } - break; - } + case BiteVmOpCodes.OpGetVarExternal: + { + string varName = ReadConstant().StringConstantValue; - case BiteVmOpCodes.OpGetNextVarByRef: - { - m_GetNextVarByRef = true; + if ( m_ExternalObjects.ContainsKey( varName ) ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( m_ExternalObjects[varName] ) ); + } + else + { + throw new BiteVmRuntimeException( $"Runtime Error: External object: {varName} not found!" ); + } - break; - } + break; + } - case BiteVmOpCodes.OpGetVar: - { - m_LastGetLocalVarModuleId = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + case BiteVmOpCodes.OpGetModule: + { + int id = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - m_CurrentInstructionPointer += 4; + m_CurrentInstructionPointer += 4; + FastMemorySpace obj = m_GlobalMemorySpace.GetModule( id ); + m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( obj ) ); - m_LastGetLocalVarDepth = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + break; + } - m_CurrentInstructionPointer += 4; + case BiteVmOpCodes.OpGetMember: + { + int id = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - m_LastGetLocalClassId = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + m_CurrentInstructionPointer += 4; + FastMemorySpace obj = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + m_VmStack.Push( obj.Get( -1, 0, -1, id ) ); - m_CurrentInstructionPointer += 4; + break; + } - m_LastGetLocalVarId = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + case BiteVmOpCodes.OpGetMemberWithString: + { + string member = ReadConstant().StringConstantValue; - m_CurrentInstructionPointer += 4; + if ( m_VmStack.Peek().ObjectData is FastMemorySpace ) + { + FastMemorySpace obj = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + m_VmStack.Push( obj.Get( member ) ); + } + else + { + object obj = m_VmStack.Pop().ObjectData; - if (m_GetNextVarByRef) - { - m_VmStack.Push( - m_CurrentMemorySpace.Get( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId ) ); - - m_GetNextVarByRef = false; - } - else + if ( obj != null ) + { + if ( obj is StaticWrapper wrapper ) { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - m_CurrentMemorySpace.Get( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId ) ) ); + if ( FastCachedProperties.TryGetProperty( + wrapper.StaticWrapperType, + member, + out IFastPropertyInfo fastPropertyInfo ) ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + fastPropertyInfo.InvokeGet( null ) ) ); + } + else if ( m_CachedProperties.TryGetProperty( + wrapper.StaticWrapperType, + member, + out PropertyInfo propertyInfo ) ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + propertyInfo.GetValue( null ) ) ); + } + else if ( m_CachedFields.TryGetField( + wrapper.StaticWrapperType, + member, + out FastFieldInfo fieldInfo ) ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + fieldInfo.GetField( null ) ) ); + } + else + { + throw new BiteVmRuntimeException( + $"Runtime Error: Member: {member} not found!" ); + } } - - break; - } - - case BiteVmOpCodes.OpGetVarExternal: - { - string varName = ReadConstant().StringConstantValue; - - if (m_ExternalObjects.ContainsKey( varName )) + else if ( obj is ICSharpEvent eventWrapper ) { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( m_ExternalObjects[varName] ) ); + if ( eventWrapper.TryGetEventInfo( member, out EventInfo eventInfo ) ) + { + m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( eventInfo ) ); + m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( eventWrapper ) ); + } + else + { + throw new BiteVmRuntimeException( + $"Runtime Error: Member: {member} not found!" ); + } } else { - throw new BiteVmRuntimeException( $"Runtime Error: External object: {varName} not found!" ); - } + Type type = obj.GetType(); - break; + if ( FastCachedProperties.TryGetProperty( + type, + member, + out IFastPropertyInfo fastPropertyInfo ) ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + fastPropertyInfo.InvokeGet( obj ) ) ); + } + else if ( m_CachedProperties.TryGetProperty( + type, + member, + out PropertyInfo propertyInfo ) ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + propertyInfo.GetValue( obj ) ) ); + } + else if ( m_CachedFields.TryGetField( type, member, out FastFieldInfo fieldInfo ) ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + fieldInfo.GetField( obj ) ) ); + } + else + { + throw new BiteVmRuntimeException( + $"Runtime Error: Member: {member} not found!" ); + } + } } - - case BiteVmOpCodes.OpGetModule: + else { - int id = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); - - m_CurrentInstructionPointer += 4; - FastMemorySpace obj = m_GlobalMemorySpace.GetModule( id ); - m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( obj ) ); - - break; + throw new BiteVmRuntimeException( $"Runtime Error: Member: {member} not found!" ); } + } - case BiteVmOpCodes.OpGetMember: - { - int id = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + break; + } - m_CurrentInstructionPointer += 4; - FastMemorySpace obj = (FastMemorySpace) m_VmStack.Pop().ObjectData; - m_VmStack.Push( obj.Get( -1, 0, -1, id ) ); + case BiteVmOpCodes.OpSetMember: + { + int id = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - break; - } + m_CurrentInstructionPointer += 4; + m_SetMember = true; + m_LastGetLocalVarId = id; - case BiteVmOpCodes.OpGetMemberWithString: - { - string member = ReadConstant().StringConstantValue; + break; + } - if (m_VmStack.Peek().ObjectData is FastMemorySpace) - { - FastMemorySpace obj = (FastMemorySpace) m_VmStack.Pop().ObjectData; - m_VmStack.Push( obj.Get( member ) ); - } - else - { - object obj = m_VmStack.Pop().ObjectData; - bool valuePushed = false; + case BiteVmOpCodes.OpSetMemberWithString: + { + m_MemberWithStringToSet = ReadConstant().StringConstantValue; + m_SetMemberWithString = true; - if (obj != null) - { - Type type = obj.GetType(); + break; + } - if (m_CachedProperties.ContainsKey( type )) - { - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == member) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - m_CachedProperties[type][i].GetValue( obj ) ) ); + case BiteVmOpCodes.OpSetVar: + { + int moduleId = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - valuePushed = true; + m_CurrentInstructionPointer += 4; - break; - } - } - } - else - { - m_CachedProperties.Add( type, type.GetProperties() ); + int depth = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == member) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - m_CachedProperties[type][i].GetValue( obj ) ) ); + m_CurrentInstructionPointer += 4; - valuePushed = true; + int classId = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - break; - } - } - } + m_CurrentInstructionPointer += 4; - if (!valuePushed) - { - if (m_CachedFields.ContainsKey( type )) - { - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - if (m_CachedFields[type][i].Name == member) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - m_CachedFields[type][i].GetValue( obj ) ) ); - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedFields.Add( type, type.GetFields() ); + int id = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - if (m_CachedFields[type][i].Name == member) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - m_CachedFields[type][i].GetValue( obj ) ) ); + m_CurrentInstructionPointer += 4; + m_LastGetLocalVarId = id; + m_LastGetLocalVarModuleId = moduleId; + m_LastGetLocalVarDepth = depth; + m_LastGetLocalClassId = classId; - valuePushed = true; + BiteVmOpCodes nextOpCode = ReadInstruction(); - break; - } - } - } - } - } + if ( nextOpCode == BiteVmOpCodes.OpAssign ) + { + m_CurrentMemorySpace.Put( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId, + m_VmStack.Pop() ); + } + else + { + m_VmStack.Push( + m_CurrentMemorySpace.Get( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId ) ); + + m_CurrentInstructionPointer--; + } - if (!valuePushed) - { - throw new BiteVmRuntimeException( $"Runtime Error: Member: {member} not found!" ); - } - } + break; + } - break; - } + case BiteVmOpCodes.OpSetVarExternal: + { + m_SetVarExternalName = ReadConstant().StringConstantValue; + m_SetVarWithExternalName = true; - case BiteVmOpCodes.OpSetMember: - { - int id = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + break; + } + + case BiteVmOpCodes.OpConstant: + { + ConstantValue constantValue = ReadConstant(); - m_CurrentInstructionPointer += 4; - m_SetMember = true; - m_LastGetLocalVarId = id; + switch ( constantValue.ConstantType ) + { + case ConstantValueType.Integer: + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( constantValue.IntegerConstantValue ) ); break; - } - case BiteVmOpCodes.OpSetMemberWithString: - { - m_MemberWithStringToSet = ReadConstant().StringConstantValue; - m_SetMemberWithString = true; + case ConstantValueType.Double: + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( constantValue.DoubleConstantValue ) ); break; - } - case BiteVmOpCodes.OpSetVar: - { - int moduleId = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + case ConstantValueType.String: + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( constantValue.StringConstantValue ) ); - m_CurrentInstructionPointer += 4; + break; - int depth = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + case ConstantValueType.Bool: + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( constantValue.BoolConstantValue ) ); - m_CurrentInstructionPointer += 4; + break; - int classId = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + case ConstantValueType.Null: + DynamicBiteVariable dynamicBiteVariable = new DynamicBiteVariable(); + dynamicBiteVariable.DynamicType = DynamicVariableType.Null; - m_CurrentInstructionPointer += 4; + m_VmStack.Push( + dynamicBiteVariable ); - int id = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); - - m_CurrentInstructionPointer += 4; - m_LastGetLocalVarId = id; - m_LastGetLocalVarModuleId = moduleId; - m_LastGetLocalVarDepth = depth; - m_LastGetLocalClassId = classId; + break; - m_VmStack.Push( m_CurrentMemorySpace.Get( moduleId, depth, classId, id ) ); + default: + throw new BiteVmRuntimeException( + $"Runtime Error: Wrong constant value type: {( int ) constantValue.ConstantType}" ); + } - break; - } + break; + } - case BiteVmOpCodes.OpSetVarExternal: - { - m_SetVarExternalName = ReadConstant().StringConstantValue; - m_SetVarWithExternalName = true; + case BiteVmOpCodes.OpWhileLoop: + { + int jumpCodeHeaderStart = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - break; - } + m_CurrentInstructionPointer += 4; - case BiteVmOpCodes.OpConstant: - { - ConstantValue constantValue = ReadConstant(); + int jumpCodeBodyEnd = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - switch (constantValue.ConstantType) - { - case ConstantValueType.Integer: - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( constantValue.IntegerConstantValue ) ); + m_CurrentInstructionPointer += 4; + ; + m_LoopEndJumpCode = jumpCodeBodyEnd + 10; - break; + if ( m_VmStack.Pop().DynamicType == DynamicVariableType.True ) + { + m_CurrentChunk.Code[jumpCodeBodyEnd] = ( byte ) BiteVmOpCodes.OpJump; + IntByteStruct intByteStruct = new IntByteStruct(); + intByteStruct.integer = jumpCodeHeaderStart; + m_CurrentChunk.Code[jumpCodeBodyEnd + 1] = intByteStruct.byte0; + m_CurrentChunk.Code[jumpCodeBodyEnd + 2] = intByteStruct.byte1; + m_CurrentChunk.Code[jumpCodeBodyEnd + 3] = intByteStruct.byte2; + m_CurrentChunk.Code[jumpCodeBodyEnd + 4] = intByteStruct.byte3; + } + else + { + m_CurrentInstructionPointer = jumpCodeBodyEnd + 10; + m_CurrentChunk.Code[jumpCodeBodyEnd] = 0; + m_CurrentChunk.Code[jumpCodeBodyEnd + 1] = 0; + m_CurrentChunk.Code[jumpCodeBodyEnd + 2] = 0; + m_CurrentChunk.Code[jumpCodeBodyEnd + 3] = 0; + m_CurrentChunk.Code[jumpCodeBodyEnd + 4] = 0; + + m_CurrentChunk.Code[jumpCodeBodyEnd + 5] = 0; + m_CurrentChunk.Code[jumpCodeBodyEnd + 6] = 0; + m_CurrentChunk.Code[jumpCodeBodyEnd + 7] = 0; + m_CurrentChunk.Code[jumpCodeBodyEnd + 8] = 0; + m_CurrentChunk.Code[jumpCodeBodyEnd + 9] = 0; + } - case ConstantValueType.Double: - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( constantValue.DoubleConstantValue ) ); + break; + } - break; + case BiteVmOpCodes.OpJump: + { + int jumpCode = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); - case ConstantValueType.String: - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( constantValue.StringConstantValue ) ); + m_CurrentInstructionPointer += 4; + m_CurrentInstructionPointer = jumpCode; - break; + break; + } - case ConstantValueType.Bool: - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( constantValue.BoolConstantValue ) ); + case BiteVmOpCodes.OpPushNextAssignmentOnStack: + { + m_PushNextAssignmentOnStack = true; - break; + break; + } - default: - throw new BiteVmRuntimeException( - $"Runtime Error: Wrong constant value type: {(int) constantValue.ConstantType}" ); - } + case BiteVmOpCodes.OpAssign: + { + if ( m_SetMember && !m_SetElement ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; - break; + if ( fastMemorySpace.Exist( -1, 0, -1, m_LastGetLocalVarId ) ) + { + fastMemorySpace.Put( -1, 0, -1, m_LastGetLocalVarId, m_VmStack.Pop() ); } - - case BiteVmOpCodes.OpWhileLoop: + else { - int jumpCodeHeaderStart = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + fastMemorySpace.Define( m_VmStack.Pop() ); + } - m_CurrentInstructionPointer += 4; + m_SetMember = false; + } + else if ( m_SetVarWithExternalName ) + { + m_ExternalObjects[m_SetVarExternalName] = m_VmStack.Pop().ToObject(); - int jumpCodeBodyEnd = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + m_SetVarWithExternalName = false; + } + else if ( m_SetElement ) + { + if ( m_SetMember ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; - m_CurrentInstructionPointer += 4; - ; - m_LoopEndJumpCode = jumpCodeBodyEnd + 10; + FastMemorySpace m = + ( FastMemorySpace ) fastMemorySpace.Get( -1, 0, -1, m_LastGetLocalVarId ). + ObjectData; - if (m_VmStack.Pop().DynamicType == DynamicVariableType.True) + if ( m.NamesToProperties.ContainsKey( m_LastElement ) ) { - m_CurrentChunk.Code[jumpCodeBodyEnd] = (byte) BiteVmOpCodes.OpJump; - IntByteStruct intByteStruct = new IntByteStruct(); - intByteStruct.integer = jumpCodeHeaderStart; - m_CurrentChunk.Code[jumpCodeBodyEnd + 1] = intByteStruct.byte0; - m_CurrentChunk.Code[jumpCodeBodyEnd + 2] = intByteStruct.byte1; - m_CurrentChunk.Code[jumpCodeBodyEnd + 3] = intByteStruct.byte2; - m_CurrentChunk.Code[jumpCodeBodyEnd + 4] = intByteStruct.byte3; + m.Put( m_LastElement, m_VmStack.Pop() ); } else { - m_CurrentInstructionPointer = jumpCodeBodyEnd + 10; - m_CurrentChunk.Code[jumpCodeBodyEnd] = 0; - m_CurrentChunk.Code[jumpCodeBodyEnd + 1] = 0; - m_CurrentChunk.Code[jumpCodeBodyEnd + 2] = 0; - m_CurrentChunk.Code[jumpCodeBodyEnd + 3] = 0; - m_CurrentChunk.Code[jumpCodeBodyEnd + 4] = 0; - - m_CurrentChunk.Code[jumpCodeBodyEnd + 5] = 0; - m_CurrentChunk.Code[jumpCodeBodyEnd + 6] = 0; - m_CurrentChunk.Code[jumpCodeBodyEnd + 7] = 0; - m_CurrentChunk.Code[jumpCodeBodyEnd + 8] = 0; - m_CurrentChunk.Code[jumpCodeBodyEnd + 9] = 0; + m.Define( m_VmStack.Pop(), m_LastElement, false ); } - - break; } - - case BiteVmOpCodes.OpJump: + else { - int jumpCode = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; - m_CurrentInstructionPointer += 4; - m_CurrentInstructionPointer = jumpCode; - - break; + if ( fastMemorySpace.NamesToProperties.ContainsKey( m_LastElement ) ) + { + fastMemorySpace.Put( m_LastElement, m_VmStack.Pop() ); + } + else + { + fastMemorySpace.Define( m_VmStack.Pop(), m_LastElement, false ); + } } - case BiteVmOpCodes.OpPushNextAssignmentOnStack: + m_SetMember = false; + m_SetElement = false; + } + else if ( m_SetMemberWithString ) + { + if ( m_VmStack.Peek().ObjectData is FastMemorySpace ) { - m_PushNextAssignmentOnStack = true; + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; - break; + if ( fastMemorySpace.NamesToProperties.ContainsKey( m_MemberWithStringToSet ) ) + { + fastMemorySpace.Put( m_MemberWithStringToSet, m_VmStack.Pop() ); + } + else + { + fastMemorySpace.Define( m_VmStack.Pop(), m_MemberWithStringToSet ); + } } - case BiteVmOpCodes.OpAssign: + else { - if (m_SetMember && !m_SetElement) + object obj = m_VmStack.Pop().ObjectData; + + if ( obj != null ) { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + Type type = null; - if (fastMemorySpace.Exist( -1, 0, -1, m_LastGetLocalVarId )) + if ( obj is StaticWrapper wrapper ) { - fastMemorySpace.Put( -1, 0, -1, m_LastGetLocalVarId, m_VmStack.Pop() ); + type = wrapper.StaticWrapperType; } else { - fastMemorySpace.Define( m_VmStack.Pop() ); + type = obj.GetType(); } - m_SetMember = false; - } - else if (m_SetVarWithExternalName) - { - m_ExternalObjects[m_SetVarExternalName] = m_VmStack.Pop().ToObject(); - - m_SetVarWithExternalName = false; - } - else if (m_SetElement) - { - if (m_SetMember) + if ( FastCachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out IFastPropertyInfo fastPropertyInfo ) ) { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; - - FastMemorySpace m = - (FastMemorySpace) fastMemorySpace.Get( -1, 0, -1, m_LastGetLocalVarId ). - ObjectData; + object data = m_VmStack.PopDataByType( fastPropertyInfo.PropertyType ); - if (m.NamesToProperties.ContainsKey( m_LastElement )) - { - m.Put( m_LastElement, m_VmStack.Pop() ); - } - else - { - m.Define( m_VmStack.Pop(), m_LastElement, false ); - } + fastPropertyInfo.InvokeSet( obj, data ); } - else + else if ( m_CachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out PropertyInfo propertyInfo ) ) { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + object data = m_VmStack.PopDataByType( propertyInfo.PropertyType ); - if (fastMemorySpace.NamesToProperties.ContainsKey( m_LastElement )) - { - fastMemorySpace.Put( m_LastElement, m_VmStack.Pop() ); - } - else - { - fastMemorySpace.Define( m_VmStack.Pop(), m_LastElement, false ); - } + propertyInfo.SetValue( obj, data ); } - - m_SetMember = false; - m_SetElement = false; - } - else if (m_SetMemberWithString) - { - if (m_VmStack.Peek().ObjectData is FastMemorySpace) + else if ( m_CachedFields.TryGetField( + type, + m_MemberWithStringToSet, + out FastFieldInfo fieldInfo ) ) { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + object data = m_VmStack.PopDataByType( fieldInfo.FieldType ); - if (fastMemorySpace.NamesToProperties.ContainsKey( m_MemberWithStringToSet )) - { - fastMemorySpace.Put( m_MemberWithStringToSet, m_VmStack.Pop() ); - } - else - { - fastMemorySpace.Define( m_VmStack.Pop(), m_MemberWithStringToSet ); - } + fieldInfo.SetField( obj, data ); } else { - object obj = m_VmStack.Pop().ObjectData; - bool valuePushed = false; + throw new BiteVmRuntimeException( + $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); + } + } + } - if (obj != null) - { - Type type = obj.GetType(); + m_SetMemberWithString = false; + } + else + { + m_VmStack.Pop(); + + m_CurrentMemorySpace.Put( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId, + m_VmStack.Pop() ); + } - if (m_CachedProperties.ContainsKey( type )) - { - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - m_CachedProperties[type][i]. - SetValue( obj, m_VmStack.Pop().NumberData ); - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - m_CachedProperties[type][i]. - SetValue( obj, (float) m_VmStack.Pop().NumberData ); - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - m_CachedProperties[type][i]. - SetValue( obj, (int) m_VmStack.Pop().NumberData ); - } - else if (m_CachedProperties[type][i].PropertyType == - typeof( string ) && - m_VmStack.Peek().DynamicType == DynamicVariableType.String) - { - m_CachedProperties[type][i]. - SetValue( obj, m_VmStack.Pop().StringData ); - } - else if (m_CachedProperties[type][i].PropertyType == typeof( bool ) && - (m_VmStack.Peek().DynamicType == DynamicVariableType.True || - m_VmStack.Peek().DynamicType == - DynamicVariableType.False)) - { - if (m_VmStack.Peek().DynamicType == DynamicVariableType.True) - { - m_CachedProperties[type][i].SetValue( obj, true ); - } - - if (m_VmStack.Peek().DynamicType == DynamicVariableType.False) - { - m_CachedProperties[type][i].SetValue( obj, false ); - } - } - else - { - m_CachedProperties[type][i]. - SetValue( obj, m_VmStack.Pop().ObjectData ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedProperties.Add( type, type.GetProperties() ); - - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - m_CachedProperties[type][i]. - SetValue( obj, m_VmStack.Pop().NumberData ); - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - m_CachedProperties[type][i]. - SetValue( obj, (float) m_VmStack.Pop().NumberData ); - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - m_CachedProperties[type][i]. - SetValue( obj, (int) m_VmStack.Pop().NumberData ); - } - else if (m_CachedProperties[type][i].PropertyType == - typeof( string ) && - m_VmStack.Peek().DynamicType == DynamicVariableType.String) - { - m_CachedProperties[type][i]. - SetValue( obj, m_VmStack.Pop().StringData ); - } - else if (m_CachedProperties[type][i].PropertyType == typeof( bool ) && - (m_VmStack.Peek().DynamicType == DynamicVariableType.True || - m_VmStack.Peek().DynamicType == - DynamicVariableType.False)) - { - if (m_VmStack.Peek().DynamicType == DynamicVariableType.True) - { - m_CachedProperties[type][i].SetValue( obj, true ); - } - - if (m_VmStack.Peek().DynamicType == DynamicVariableType.False) - { - m_CachedProperties[type][i].SetValue( obj, false ); - } - } - else - { - m_CachedProperties[type][i]. - SetValue( obj, m_VmStack.Pop().ObjectData ); - } - - valuePushed = true; - - break; - } - } - } + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Count++; + } - if (!valuePushed) - { - if (m_CachedFields.ContainsKey( type )) - { - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - m_CachedFields[type][i]. - SetValue( obj, m_VmStack.Pop().NumberData ); - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - m_CachedFields[type][i]. - SetValue( obj, (float) m_VmStack.Pop().NumberData ); - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - m_CachedFields[type][i]. - SetValue( obj, (int) m_VmStack.Pop().NumberData ); - } - else if (m_CachedFields[type][i].FieldType == - typeof( string ) && - m_VmStack.Peek().DynamicType == - DynamicVariableType.String) - { - m_CachedFields[type][i]. - SetValue( obj, m_VmStack.Pop().StringData ); - } - else if (m_CachedFields[type][i].FieldType == typeof( bool ) && - (m_VmStack.Peek().DynamicType == - DynamicVariableType.True || - m_VmStack.Peek().DynamicType == - DynamicVariableType.False)) - { - if (m_VmStack.Peek().DynamicType == DynamicVariableType.True) - { - m_CachedFields[type][i].SetValue( obj, true ); - } - - if (m_VmStack.Peek().DynamicType == DynamicVariableType.False) - { - m_CachedFields[type][i].SetValue( obj, false ); - } - } - else - { - m_CachedFields[type][i]. - SetValue( obj, m_VmStack.Pop().ObjectData ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedFields.Add( type, type.GetFields() ); - - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - m_CachedFields[type][i]. - SetValue( obj, m_VmStack.Pop().NumberData ); - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - m_CachedFields[type][i]. - SetValue( obj, (float) m_VmStack.Pop().NumberData ); - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - m_CachedFields[type][i]. - SetValue( obj, (int) m_VmStack.Pop().NumberData ); - } - else if (m_CachedFields[type][i].FieldType == - typeof( string ) && - m_VmStack.Peek().DynamicType == - DynamicVariableType.String) - { - m_CachedFields[type][i]. - SetValue( obj, m_VmStack.Pop().StringData ); - } - else if (m_CachedFields[type][i].FieldType == typeof( bool ) && - (m_VmStack.Peek().DynamicType == - DynamicVariableType.True || - m_VmStack.Peek().DynamicType == - DynamicVariableType.False)) - { - if (m_VmStack.Peek().DynamicType == DynamicVariableType.True) - { - m_CachedFields[type][i].SetValue( obj, true ); - } - - if (m_VmStack.Peek().DynamicType == DynamicVariableType.False) - { - m_CachedFields[type][i].SetValue( obj, false ); - } - } - else - { - m_CachedFields[type][i]. - SetValue( obj, m_VmStack.Pop().ObjectData ); - } - - valuePushed = true; - - break; - } - } - } - } - } + break; + } - if (!valuePushed) - { - throw new BiteVmRuntimeException( - $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); - } - } + case BiteVmOpCodes.OpDivideAssign: + { + if ( m_SetMember && !m_SetElement ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + DynamicBiteVariable valueLhs = fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ); + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData / valueRhs.NumberData ); + + fastMemorySpace.PutLocalVar( m_LastGetLocalVarId, value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + + m_SetMember = false; + } + else if ( m_SetElement ) + { + if ( m_SetMember ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + FastMemorySpace m = + ( FastMemorySpace ) fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ).ObjectData; + + DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData / valueRhs.NumberData ); + + m.Put( + m_LastElement, + value ); - m_SetMemberWithString = false; + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } } else { - m_VmStack.Pop(); - - m_CurrentMemorySpace.Put( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId, - m_VmStack.Pop() ); + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); } - if (m_PushNextAssignmentOnStack) + } + else + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - m_PushNextAssignmentOnStack = false; - m_VmStack.Count++; + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData / valueRhs.NumberData ); + + fastMemorySpace.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); } - break; } - case BiteVmOpCodes.OpDivideAssign: + m_SetMember = false; + m_SetElement = false; + } + else if ( m_SetMemberWithString ) + { + if ( m_VmStack.Peek().ObjectData is FastMemorySpace ) { - if (m_SetMember && !m_SetElement) + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + DynamicBiteVariable valueLhs = + fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData / valueRhs.NumberData ); - DynamicBiteVariable valueLhs = fastMemorySpace.Get( - -1, - 0, - -1, - m_LastGetLocalVarId ); + fastMemorySpace.Put( + m_LastElement, + value ); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + if ( m_PushNextAssignmentOnStack ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData / valueRhs.NumberData ); + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + } + else + { + object obj = m_VmStack.Pop().ObjectData; - fastMemorySpace.Put( - -1, - 0, - -1, - m_LastGetLocalVarId, value - ); + if ( obj != null ) + { + Type type = null; - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } + if ( obj is StaticWrapper wrapper ) + { + type = wrapper.StaticWrapperType; } else { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + type = obj.GetType(); } - m_SetMember = false; - } - else if (m_SetElement) - { - if (m_SetMember) + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( FastCachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out IFastPropertyInfo fastPropertyInfo ) ) { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + if ( fastPropertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fastPropertyInfo.InvokeGet( obj ); - FastMemorySpace m = - (FastMemorySpace) fastMemorySpace.Get( -1, 0, -1, m_LastGetLocalVarId ). - ObjectData; + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs / valueRhs.NumberData ); - DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData / valueRhs.NumberData ); - m.Put( - m_LastElement, - value ); + fastPropertyInfo. + InvokeSet( + obj, + value.NumberData ); - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - else + else if ( fastPropertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + float valueLhs = + ( float ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs / ( float ) valueRhs.NumberData ); + + fastPropertyInfo. + InvokeSet( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } } - } - else - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; - DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + else if ( fastPropertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData / valueRhs.NumberData ); - fastMemorySpace.Put( - m_LastElement, - value ); + int valueLhs = + ( int ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs / ( int ) valueRhs.NumberData ); - if (m_PushNextAssignmentOnStack) + fastPropertyInfo. + InvokeSet( + obj, + ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); @@ -1540,480 +1893,147 @@ private BiteVmInterpretResult Run() else { throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + "Runtime Error: Invalid types for arithmetic operation!" ); } } - m_SetMember = false; - m_SetElement = false; - } - else if (m_SetMemberWithString) - { - if (m_VmStack.Peek().ObjectData is FastMemorySpace) + if ( m_CachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out PropertyInfo propertyInfo ) ) { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; - - DynamicBiteVariable valueLhs = - fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + if ( propertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData / valueRhs.NumberData ); + double valueLhs = + ( double ) propertyInfo.GetValue( obj ); - fastMemorySpace.Put( - m_LastElement, - value ); + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs / valueRhs.NumberData ); - if (m_PushNextAssignmentOnStack) + propertyInfo. + SetValue( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - } - else - { - object obj = m_VmStack.Pop().ObjectData; - bool valuePushed = false; - - if (obj != null) + else if ( propertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - Type type = obj.GetType(); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (m_CachedProperties.ContainsKey( type )) - { - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - - - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs / valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs / (float) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs / (int)valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedProperties.Add( type, type.GetProperties() ); - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs / valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs / (float) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs / (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } + float valueLhs = + ( float ) propertyInfo.GetValue( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs / ( float ) valueRhs.NumberData ); - if (!valuePushed) + propertyInfo. + SetValue( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) { - if (m_CachedFields.ContainsKey( type )) - { - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs / valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs / (float)valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs / (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedFields.Add( type, type.GetFields() ); - - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs / valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs / (float) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs / (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); } } - - if (!valuePushed) + else if ( propertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - throw new BiteVmRuntimeException( - $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); - } - } + int valueLhs = + ( int ) propertyInfo.GetValue( obj ); - m_SetMemberWithString = false; - } - else - { - m_VmStack.Pop(); + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs / ( int ) valueRhs.NumberData ); - DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId ); + propertyInfo. + SetValue( + obj, + ( int ) value.NumberData ); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData / valueRhs.NumberData ); - m_CurrentMemorySpace.Put( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId, - value ); - - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); } } - else + else if ( m_CachedFields.TryGetField( + type, + m_MemberWithStringToSet, + out FastFieldInfo fieldInfo ) ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } - - break; - } - - case BiteVmOpCodes.OpMultiplyAssign: - { - if (m_SetMember && !m_SetElement) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; - - DynamicBiteVariable valueLhs = fastMemorySpace.Get( - -1, - 0, - -1, - m_LastGetLocalVarId ); + if ( fieldInfo.FieldType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fieldInfo.GetField( obj ); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData * valueRhs.NumberData ); + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs / valueRhs.NumberData ); - fastMemorySpace.Put( - -1, - 0, - -1, - m_LastGetLocalVarId, value - ); + fieldInfo. + SetField( + obj, + value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - - m_SetMember = false; - } - else if (m_SetElement) - { - if (m_SetMember) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + else if ( fieldInfo.FieldType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) fieldInfo.GetField( obj ); - FastMemorySpace m = - (FastMemorySpace) fastMemorySpace.Get( -1, 0, -1, m_LastGetLocalVarId ). - ObjectData; + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs / ( float ) valueRhs.NumberData ); - DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData * valueRhs.NumberData ); - m.Put( - m_LastElement, - value ); + fieldInfo. + SetField( + obj, + ( float ) value.NumberData ); - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } - else - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; - DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + else if ( fieldInfo.FieldType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData * valueRhs.NumberData ); - fastMemorySpace.Put( - m_LastElement, - value ); + int valueLhs = + ( int ) fieldInfo.GetField( obj ); - if (m_PushNextAssignmentOnStack) + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs / ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); @@ -2022,936 +2042,348 @@ private BiteVmInterpretResult Run() else { throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + "Runtime Error: Invalid types for arithmetic operation!" ); } } - - m_SetMember = false; - m_SetElement = false; - } - else if (m_SetMemberWithString) - { - if (m_VmStack.Peek().ObjectData is FastMemorySpace) + else { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + throw new BiteVmRuntimeException( + $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid object!" ); + } + } - DynamicBiteVariable valueLhs = - fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData * valueRhs.NumberData ); + m_SetMemberWithString = false; + } + else + { + m_VmStack.Pop(); - fastMemorySpace.Put( - m_LastElement, - value ); + DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - } - else - { - object obj = m_VmStack.Pop().ObjectData; - bool valuePushed = false; + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (obj != null) - { - Type type = obj.GetType(); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (m_CachedProperties.ContainsKey( type )) - { - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - - - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs * valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs * (float) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs * (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedProperties.Add( type, type.GetProperties() ); - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs * valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs * (float) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs * (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData / valueRhs.NumberData ); - if (!valuePushed) - { - if (m_CachedFields.ContainsKey( type )) - { - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs * valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs * (float) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs * (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedFields.Add( type, type.GetFields() ); - - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs * valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs * (float) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - m_VmStack.Peek().DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs * (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - } - } + m_CurrentMemorySpace.Put( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId, + value ); - if (!valuePushed) - { - throw new BiteVmRuntimeException( - $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); - } - } + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } + + break; + } + + case BiteVmOpCodes.OpMultiplyAssign: + { + if ( m_SetMember && !m_SetElement ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + DynamicBiteVariable valueLhs = fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ); - m_SetMemberWithString = false; + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData * valueRhs.NumberData ); + + fastMemorySpace.PutLocalVar( m_LastGetLocalVarId, value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); } - else + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + + m_SetMember = false; + } + else if ( m_SetElement ) + { + if ( m_SetMember ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + FastMemorySpace m = + ( FastMemorySpace ) fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ).ObjectData; + + DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - m_VmStack.Pop(); + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData * valueRhs.NumberData ); - DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId ); + m.Put( + m_LastElement, + value ); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + if ( m_PushNextAssignmentOnStack ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData * valueRhs.NumberData ); - m_CurrentMemorySpace.Put( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId, - value ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); } - else + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } + else + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData * valueRhs.NumberData ); + + fastMemorySpace.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); } } - - break; + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } } - case BiteVmOpCodes.OpPlusAssign: + m_SetMember = false; + m_SetElement = false; + } + else if ( m_SetMemberWithString ) + { + if ( m_VmStack.Peek().ObjectData is FastMemorySpace ) { - if (m_SetMember && !m_SetElement) + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + DynamicBiteVariable valueLhs = + fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData * valueRhs.NumberData ); - DynamicBiteVariable valueLhs = fastMemorySpace.Get( - -1, - 0, - -1, - m_LastGetLocalVarId ); + fastMemorySpace.Put( + m_LastElement, + value ); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + if ( m_PushNextAssignmentOnStack ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData + valueRhs.NumberData ); + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + } + else + { + object obj = m_VmStack.Pop().ObjectData; - fastMemorySpace.Put( - -1, - 0, - -1, - m_LastGetLocalVarId, value - ); + if ( obj != null ) + { + Type type = null; - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } + if ( obj is StaticWrapper wrapper ) + { + type = wrapper.StaticWrapperType; } else { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + type = obj.GetType(); } - m_SetMember = false; - } - else if (m_SetElement) - { - if (m_SetMember) + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( FastCachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out IFastPropertyInfo fastPropertyInfo ) ) { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + if ( fastPropertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fastPropertyInfo.InvokeGet( obj ); - FastMemorySpace m = - (FastMemorySpace) fastMemorySpace.Get( -1, 0, -1, m_LastGetLocalVarId ). - ObjectData; + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs * valueRhs.NumberData ); - DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData + valueRhs.NumberData ); - m.Put( - m_LastElement, - value ); + fastPropertyInfo. + InvokeSet( + obj, + value.NumberData ); - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } - else - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; - DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + else if ( fastPropertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData + valueRhs.NumberData ); - fastMemorySpace.Put( - m_LastElement, - value ); + float valueLhs = + ( float ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs * ( float ) valueRhs.NumberData ); - if (m_PushNextAssignmentOnStack) + fastPropertyInfo. + InvokeSet( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - else + else if ( fastPropertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } - - m_SetMember = false; - m_SetElement = false; - } - else if (m_SetMemberWithString) - { - if (m_VmStack.Peek().ObjectData is FastMemorySpace) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + int valueLhs = + ( int ) fastPropertyInfo.InvokeGet( obj ); - DynamicBiteVariable valueLhs = - fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData + valueRhs.NumberData ); + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs * ( int ) valueRhs.NumberData ); - fastMemorySpace.Put( - m_LastElement, - value ); + fastPropertyInfo. + InvokeSet( + obj, + ( int ) value.NumberData ); - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - } - else - { - object obj = m_VmStack.Pop().ObjectData; - bool valuePushed = false; - - if (obj != null) - { - Type type = obj.GetType(); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (m_CachedProperties.ContainsKey( type )) - { - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - - - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs + valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs + (float) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs + (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedProperties.Add( type, type.GetProperties() ); - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs + valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs + (float) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs + (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - - if (!valuePushed) - { - if (m_CachedFields.ContainsKey( type )) - { - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs + valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs + (float) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs + (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedFields.Add( type, type.GetFields() ); - - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs + valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs + (float) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs + (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - } - } - - if (!valuePushed) + else { throw new BiteVmRuntimeException( - $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); + "Runtime Error: Invalid types for arithmetic operation!" ); } } - - m_SetMemberWithString = false; - } - else - { - m_VmStack.Pop(); - - DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId ); - - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + else if ( m_CachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out PropertyInfo propertyInfo ) ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData + valueRhs.NumberData ); - m_CurrentMemorySpace.Put( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId, - value ); - - if (m_PushNextAssignmentOnStack) + if ( propertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } + double valueLhs = + ( double ) propertyInfo.GetValue( obj ); - break; - } + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs * valueRhs.NumberData ); - case BiteVmOpCodes.OpMinusAssign: - { - if (m_SetMember && !m_SetElement) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + propertyInfo. + SetValue( + obj, + value.NumberData ); - DynamicBiteVariable valueLhs = fastMemorySpace.Get( - -1, - 0, - -1, - m_LastGetLocalVarId ); + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( propertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) propertyInfo.GetValue( obj ); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData - valueRhs.NumberData ); + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs * ( float ) valueRhs.NumberData ); - fastMemorySpace.Put( - -1, - 0, - -1, - m_LastGetLocalVarId, value - ); + propertyInfo. + SetValue( + obj, + ( float ) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - - m_SetMember = false; - } - else if (m_SetElement) - { - if (m_SetMember) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + else if ( propertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) propertyInfo.GetValue( obj ); - FastMemorySpace m = - (FastMemorySpace) fastMemorySpace.Get( -1, 0, -1, m_LastGetLocalVarId ). - ObjectData; + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs * ( int ) valueRhs.NumberData ); - DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData - valueRhs.NumberData ); - m.Put( - m_LastElement, - value ); + propertyInfo. + SetValue( + obj, + ( int ) value.NumberData ); - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); @@ -2960,1444 +2392,431 @@ private BiteVmInterpretResult Run() else { throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + "Runtime Error: Invalid types for arithmetic operation!" ); } } - else + else if ( m_CachedFields.TryGetField( + type, + m_MemberWithStringToSet, + out FastFieldInfo fieldInfo ) ) { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; - DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + if ( fieldInfo.FieldType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData - valueRhs.NumberData ); - fastMemorySpace.Put( - m_LastElement, - value ); + double valueLhs = + ( double ) fieldInfo.GetField( obj ); - if (m_PushNextAssignmentOnStack) + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs * valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - else + else if ( fieldInfo.FieldType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } - - m_SetMember = false; - m_SetElement = false; - } - else if (m_SetMemberWithString) - { - if (m_VmStack.Peek().ObjectData is FastMemorySpace) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + float valueLhs = + ( float ) fieldInfo.GetField( obj ); - DynamicBiteVariable valueLhs = - fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData - valueRhs.NumberData ); + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs * ( float ) valueRhs.NumberData ); - fastMemorySpace.Put( - m_LastElement, - value ); + fieldInfo. + SetField( + obj, + ( float ) value.NumberData ); - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - } - else - { - object obj = m_VmStack.Pop().ObjectData; - bool valuePushed = false; - - if (obj != null) + else if ( fieldInfo.FieldType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - Type type = obj.GetType(); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (m_CachedProperties.ContainsKey( type )) - { - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - - - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs - valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs - (float) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs - (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedProperties.Add( type, type.GetProperties() ); - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs - valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs - (float) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs - (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } + int valueLhs = + ( int ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs * ( int ) valueRhs.NumberData ); - if (!valuePushed) + fieldInfo. + SetField( + obj, + ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) { - if (m_CachedFields.ContainsKey( type )) - { - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs - valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs - (float) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs - (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedFields.Add( type, type.GetFields() ); - - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs - valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs - (float) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs - (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); } } - - if (!valuePushed) + else { throw new BiteVmRuntimeException( - $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); - } - } - - m_SetMemberWithString = false; - } - else - { - m_VmStack.Pop(); - - DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId ); - - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData - valueRhs.NumberData ); - m_CurrentMemorySpace.Put( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId, - value ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); + "Runtime Error: Invalid types for arithmetic operation!" ); } } else { throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); } } - - break; + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid object!" ); + } } - case BiteVmOpCodes.OpModuloAssign: - { - if (m_SetMember && !m_SetElement) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + m_SetMemberWithString = false; + } + else + { + m_VmStack.Pop(); - DynamicBiteVariable valueLhs = fastMemorySpace.Get( - -1, - 0, - -1, - m_LastGetLocalVarId ); + DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId ); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData % valueRhs.NumberData ); + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - fastMemorySpace.Put( - -1, - 0, - -1, - m_LastGetLocalVarId, value - ); + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData * valueRhs.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } + m_CurrentMemorySpace.Put( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId, + value ); - m_SetMember = false; - } - else if (m_SetElement) + if ( m_PushNextAssignmentOnStack ) { - if (m_SetMember) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; - - FastMemorySpace m = - (FastMemorySpace) fastMemorySpace.Get( -1, 0, -1, m_LastGetLocalVarId ). - ObjectData; + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } - DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData % valueRhs.NumberData ); - m.Put( - m_LastElement, - value ); + break; + } - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } - else - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; - DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData % valueRhs.NumberData ); - fastMemorySpace.Put( - m_LastElement, - value ); + case BiteVmOpCodes.OpPlusAssign: + { + if ( m_SetMember && !m_SetElement ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } + DynamicBiteVariable valueLhs = fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ); - m_SetMember = false; - m_SetElement = false; - } - else if (m_SetMemberWithString) + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData + valueRhs.NumberData ); + + fastMemorySpace.PutLocalVar( m_LastGetLocalVarId, value ); + + if ( m_PushNextAssignmentOnStack ) { - if (m_VmStack.Peek().ObjectData is FastMemorySpace) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } - DynamicBiteVariable valueLhs = - fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData % valueRhs.NumberData ); + m_SetMember = false; + } + else if ( m_SetElement ) + { + if ( m_SetMember ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; - fastMemorySpace.Put( - m_LastElement, - value ); + FastMemorySpace m = + ( FastMemorySpace ) fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ).ObjectData; - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - } - else - { - object obj = m_VmStack.Pop().ObjectData; - bool valuePushed = false; + DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; - if (obj != null) - { - Type type = obj.GetType(); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (m_CachedProperties.ContainsKey( type )) - { - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - - - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs % valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs % (float) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs % (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedProperties.Add( type, type.GetProperties() ); - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs % valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs % (float) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs % (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (!valuePushed) - { - if (m_CachedFields.ContainsKey( type )) - { - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs % valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs % (float) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs % (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedFields.Add( type, type.GetFields() ); - - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs % valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs % (float) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs % (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - } - } + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData + valueRhs.NumberData ); - if (!valuePushed) - { - throw new BiteVmRuntimeException( - $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); - } - } + m.Put( + m_LastElement, + value ); - m_SetMemberWithString = false; + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } } else { - m_VmStack.Pop(); + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } + else + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId ); + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData + valueRhs.NumberData ); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData % valueRhs.NumberData ); - m_CurrentMemorySpace.Put( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId, - value ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else + fastMemorySpace.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); } } - - break; + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } } - case BiteVmOpCodes.OpBitwiseAndAssign: + m_SetMember = false; + m_SetElement = false; + } + else if ( m_SetMemberWithString ) + { + if ( m_VmStack.Peek().ObjectData is FastMemorySpace ) { - if (m_SetMember && !m_SetElement) + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + DynamicBiteVariable valueLhs = + fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData + valueRhs.NumberData ); - DynamicBiteVariable valueLhs = fastMemorySpace.Get( - -1, - 0, - -1, - m_LastGetLocalVarId ); + fastMemorySpace.Put( + m_LastElement, + value ); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + if ( m_PushNextAssignmentOnStack ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int)valueLhs.NumberData & (int)valueRhs.NumberData ); + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + } + else if ( m_VmStack.Peek().ObjectData is ICSharpEvent eventWrapper ) + { + m_VmStack.Pop(); - fastMemorySpace.Put( - -1, - 0, - -1, - m_LastGetLocalVarId, value - ); + eventWrapper.TryAddEventHandler( + m_MemberWithStringToSet, + ( BiteChunkWrapper ) m_VmStack.Pop().ObjectData, + this ); + } + else + { + object obj = m_VmStack.Pop().ObjectData; - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } + if ( obj != null ) + { + Type type = null; + + if ( obj is StaticWrapper wrapper ) + { + type = wrapper.StaticWrapperType; } else { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + type = obj.GetType(); } - m_SetMember = false; - } - else if (m_SetElement) - { - if (m_SetMember) + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( FastCachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out IFastPropertyInfo fastPropertyInfo ) ) { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + if ( fastPropertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fastPropertyInfo.InvokeGet( obj ); - FastMemorySpace m = - (FastMemorySpace) fastMemorySpace.Get( -1, 0, -1, m_LastGetLocalVarId ). - ObjectData; + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs + valueRhs.NumberData ); - DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData & (int) valueRhs.NumberData ); - m.Put( - m_LastElement, - value ); + fastPropertyInfo. + InvokeSet( + obj, + value.NumberData ); - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } - else - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; - DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + else if ( fastPropertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData & (int) valueRhs.NumberData ); - fastMemorySpace.Put( - m_LastElement, - value ); + float valueLhs = + ( float ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs + ( float ) valueRhs.NumberData ); - if (m_PushNextAssignmentOnStack) + fastPropertyInfo. + InvokeSet( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - else + else if ( fastPropertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } - - m_SetMember = false; - m_SetElement = false; - } - else if (m_SetMemberWithString) - { - if (m_VmStack.Peek().ObjectData is FastMemorySpace) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + int valueLhs = + ( int ) fastPropertyInfo.InvokeGet( obj ); - DynamicBiteVariable valueLhs = - fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData & (int) valueRhs.NumberData ); + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs + ( int ) valueRhs.NumberData ); - fastMemorySpace.Put( - m_LastElement, - value ); + fastPropertyInfo. + InvokeSet( + obj, + ( int ) value.NumberData ); - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - } - else - { - object obj = m_VmStack.Pop().ObjectData; - bool valuePushed = false; - - if (obj != null) - { - Type type = obj.GetType(); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (m_CachedProperties.ContainsKey( type )) - { - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - - - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs & (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs & (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs & (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedProperties.Add( type, type.GetProperties() ); - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs & (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs & (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs & (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - - if (!valuePushed) - { - if (m_CachedFields.ContainsKey( type )) - { - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int)valueLhs & (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs & (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs & (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedFields.Add( type, type.GetFields() ); - - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs & (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs & (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs & (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - } - } - - if (!valuePushed) + else { throw new BiteVmRuntimeException( - $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); + "Runtime Error: Invalid types for arithmetic operation!" ); } } - - m_SetMemberWithString = false; - } - else - { - m_VmStack.Pop(); - - DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId ); - - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + else if ( m_CachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out PropertyInfo propertyInfo ) ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int)valueLhs.NumberData & (int) valueRhs.NumberData ); - m_CurrentMemorySpace.Put( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId, - value ); - - if (m_PushNextAssignmentOnStack) + if ( propertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } + double valueLhs = + ( double ) propertyInfo.GetValue( obj ); - break; - } + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs + valueRhs.NumberData ); - case BiteVmOpCodes.OpBitwiseOrAssign: - { - if (m_SetMember && !m_SetElement) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + propertyInfo. + SetValue( + obj, + value.NumberData ); - DynamicBiteVariable valueLhs = fastMemorySpace.Get( - -1, - 0, - -1, - m_LastGetLocalVarId ); + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( propertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) propertyInfo.GetValue( obj ); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData | (int) valueRhs.NumberData ); + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs + ( float ) valueRhs.NumberData ); - fastMemorySpace.Put( - -1, - 0, - -1, - m_LastGetLocalVarId, value - ); + propertyInfo. + SetValue( + obj, + ( float ) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - - m_SetMember = false; - } - else if (m_SetElement) - { - if (m_SetMember) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + else if ( propertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) propertyInfo.GetValue( obj ); - FastMemorySpace m = - (FastMemorySpace) fastMemorySpace.Get( -1, 0, -1, m_LastGetLocalVarId ). - ObjectData; + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs + ( int ) valueRhs.NumberData ); - DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData | (int) valueRhs.NumberData ); - m.Put( - m_LastElement, - value ); + propertyInfo. + SetValue( + obj, + ( int ) value.NumberData ); - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); @@ -4406,1444 +2825,416 @@ private BiteVmInterpretResult Run() else { throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + "Runtime Error: Invalid types for arithmetic operation!" ); } } - else + else if ( m_CachedFields.TryGetField( + type, + m_MemberWithStringToSet, + out FastFieldInfo fieldInfo ) ) { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; - DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + if ( fieldInfo.FieldType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData | (int) valueRhs.NumberData ); - fastMemorySpace.Put( - m_LastElement, - value ); + double valueLhs = + ( double ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs + valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + value.NumberData ); - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - else + else if ( fieldInfo.FieldType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } + float valueLhs = + ( float ) fieldInfo.GetField( obj ); - m_SetMember = false; - m_SetElement = false; - } - else if (m_SetMemberWithString) - { - if (m_VmStack.Peek().ObjectData is FastMemorySpace) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; - - DynamicBiteVariable valueLhs = - fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData | (int) valueRhs.NumberData ); + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs + ( float ) valueRhs.NumberData ); - fastMemorySpace.Put( - m_LastElement, - value ); + fieldInfo. + SetField( + obj, + ( float ) value.NumberData ); - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - } - else - { - object obj = m_VmStack.Pop().ObjectData; - bool valuePushed = false; - - if (obj != null) + else if ( fieldInfo.FieldType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - Type type = obj.GetType(); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (m_CachedProperties.ContainsKey( type )) - { - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - - - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs | (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs | (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs | (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedProperties.Add( type, type.GetProperties() ); - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs | (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs | (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs | (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } + int valueLhs = + ( int ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs + ( int ) valueRhs.NumberData ); - if (!valuePushed) + fieldInfo. + SetField( + obj, + ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) { - if (m_CachedFields.ContainsKey( type )) - { - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs | (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs | (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs | (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedFields.Add( type, type.GetFields() ); - - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs | (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs | (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs | (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); } } - - if (!valuePushed) + else { throw new BiteVmRuntimeException( - $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); - } - } - - m_SetMemberWithString = false; - } - else - { - m_VmStack.Pop(); - - DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId ); - - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData | (int) valueRhs.NumberData ); - m_CurrentMemorySpace.Put( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId, - value ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); + "Runtime Error: Invalid types for arithmetic operation!" ); } } else { throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); } } - - break; + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid object!" ); + } } - case BiteVmOpCodes.OpBitwiseXorAssign: - { - if (m_SetMember && !m_SetElement) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + m_SetMemberWithString = false; + } + else + { + m_VmStack.Pop(); - DynamicBiteVariable valueLhs = fastMemorySpace.Get( - -1, - 0, - -1, - m_LastGetLocalVarId ); + DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId ); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData ^ (int) valueRhs.NumberData ); + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - fastMemorySpace.Put( - -1, - 0, - -1, - m_LastGetLocalVarId, value - ); + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData + valueRhs.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } + m_CurrentMemorySpace.Put( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId, + value ); - m_SetMember = false; - } - else if (m_SetElement) + if ( m_PushNextAssignmentOnStack ) { - if (m_SetMember) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } - FastMemorySpace m = - (FastMemorySpace) fastMemorySpace.Get( -1, 0, -1, m_LastGetLocalVarId ). - ObjectData; + break; + } - DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData ^ (int) valueRhs.NumberData ); - m.Put( - m_LastElement, - value ); + case BiteVmOpCodes.OpMinusAssign: + { + if ( m_SetMember && !m_SetElement ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } - else - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; - DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData ^ (int) valueRhs.NumberData ); - fastMemorySpace.Put( - m_LastElement, - value ); + DynamicBiteVariable valueLhs = fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - m_SetMember = false; - m_SetElement = false; - } - else if (m_SetMemberWithString) + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData - valueRhs.NumberData ); + + fastMemorySpace.PutLocalVar( m_LastGetLocalVarId, value ); + + if ( m_PushNextAssignmentOnStack ) { - if (m_VmStack.Peek().ObjectData is FastMemorySpace) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } - DynamicBiteVariable valueLhs = - fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData ^ (int) valueRhs.NumberData ); + m_SetMember = false; + } + else if ( m_SetElement ) + { + if ( m_SetMember ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; - fastMemorySpace.Put( - m_LastElement, - value ); + FastMemorySpace m = + ( FastMemorySpace ) fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ).ObjectData; - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - } - else - { - object obj = m_VmStack.Pop().ObjectData; - bool valuePushed = false; + DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; - if (obj != null) - { - Type type = obj.GetType(); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (m_CachedProperties.ContainsKey( type )) - { - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - - - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs ^ (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs ^ (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs ^ (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedProperties.Add( type, type.GetProperties() ); - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs ^ (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs ^ (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs ^ (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (!valuePushed) - { - if (m_CachedFields.ContainsKey( type )) - { - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs ^ (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs ^ (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs ^ (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedFields.Add( type, type.GetFields() ); - - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs ^ (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs ^ (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs ^ (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - } - } + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData - valueRhs.NumberData ); - if (!valuePushed) - { - throw new BiteVmRuntimeException( - $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); - } - } + m.Put( + m_LastElement, + value ); - m_SetMemberWithString = false; + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } } else { - m_VmStack.Pop(); + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } + else + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData - valueRhs.NumberData ); - DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId ); + fastMemorySpace.Put( + m_LastElement, + value ); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData ^ (int) valueRhs.NumberData ); - m_CurrentMemorySpace.Put( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId, - value ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else + if ( m_PushNextAssignmentOnStack ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); } } - - break; + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } } - case BiteVmOpCodes.OpBitwiseLeftShiftAssign: + m_SetMember = false; + m_SetElement = false; + } + else if ( m_SetMemberWithString ) + { + if ( m_VmStack.Peek().ObjectData is FastMemorySpace ) { - if (m_SetMember && !m_SetElement) + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + DynamicBiteVariable valueLhs = + fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData - valueRhs.NumberData ); - DynamicBiteVariable valueLhs = fastMemorySpace.Get( - -1, - 0, - -1, - m_LastGetLocalVarId ); + fastMemorySpace.Put( + m_LastElement, + value ); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + if ( m_PushNextAssignmentOnStack ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData << (int) valueRhs.NumberData ); + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + } + else + { + object obj = m_VmStack.Pop().ObjectData; - fastMemorySpace.Put( - -1, - 0, - -1, - m_LastGetLocalVarId, value - ); + if ( obj != null ) + { + Type type = null; - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } + if ( obj is StaticWrapper wrapper ) + { + type = wrapper.StaticWrapperType; } else { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + type = obj.GetType(); } - m_SetMember = false; - } - else if (m_SetElement) - { - if (m_SetMember) + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( FastCachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out IFastPropertyInfo fastPropertyInfo ) ) { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + if ( fastPropertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fastPropertyInfo.InvokeGet( obj ); - FastMemorySpace m = - (FastMemorySpace) fastMemorySpace.Get( -1, 0, -1, m_LastGetLocalVarId ). - ObjectData; + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs - valueRhs.NumberData ); - DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData << (int) valueRhs.NumberData ); - m.Put( - m_LastElement, - value ); + fastPropertyInfo. + InvokeSet( + obj, + value.NumberData ); - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } - else - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; - DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + else if ( fastPropertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData << (int) valueRhs.NumberData ); - fastMemorySpace.Put( - m_LastElement, - value ); + float valueLhs = + ( float ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs - ( float ) valueRhs.NumberData ); - if (m_PushNextAssignmentOnStack) + fastPropertyInfo. + InvokeSet( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - else + else if ( fastPropertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } - - m_SetMember = false; - m_SetElement = false; - } - else if (m_SetMemberWithString) - { - if (m_VmStack.Peek().ObjectData is FastMemorySpace) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + int valueLhs = + ( int ) fastPropertyInfo.InvokeGet( obj ); - DynamicBiteVariable valueLhs = - fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData << (int) valueRhs.NumberData ); + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs - ( int ) valueRhs.NumberData ); - fastMemorySpace.Put( - m_LastElement, - value ); + fastPropertyInfo.InvokeSet( obj, ( int ) value.NumberData ); - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - } - else - { - object obj = m_VmStack.Pop().ObjectData; - bool valuePushed = false; - - if (obj != null) - { - Type type = obj.GetType(); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (m_CachedProperties.ContainsKey( type )) - { - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - - - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs << (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs << (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs << (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedProperties.Add( type, type.GetProperties() ); - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs << (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs << (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs << (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - - if (!valuePushed) - { - if (m_CachedFields.ContainsKey( type )) - { - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs << (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs << (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs << (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedFields.Add( type, type.GetFields() ); - - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs << (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs << (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs << (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - } - } - - if (!valuePushed) + else { throw new BiteVmRuntimeException( - $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); + "Runtime Error: Invalid types for arithmetic operation!" ); } } - - m_SetMemberWithString = false; - } - else - { - m_VmStack.Pop(); - - DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId ); - - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + else if ( m_CachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out PropertyInfo propertyInfo ) ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData << (int) valueRhs.NumberData ); - m_CurrentMemorySpace.Put( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId, - value ); - - if (m_PushNextAssignmentOnStack) + if ( propertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } + double valueLhs = + ( double ) propertyInfo.GetValue( obj ); - break; - } + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs - valueRhs.NumberData ); - case BiteVmOpCodes.OpBitwiseRightShiftAssign: - { - if (m_SetMember && !m_SetElement) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + propertyInfo. + SetValue( + obj, + value.NumberData ); - DynamicBiteVariable valueLhs = fastMemorySpace.Get( - -1, - 0, - -1, - m_LastGetLocalVarId ); + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( propertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) propertyInfo.GetValue( obj ); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData >> (int) valueRhs.NumberData ); + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs - ( float ) valueRhs.NumberData ); - fastMemorySpace.Put( - -1, - 0, - -1, - m_LastGetLocalVarId, value - ); + propertyInfo. + SetValue( + obj, + ( float ) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - - m_SetMember = false; - } - else if (m_SetElement) - { - if (m_SetMember) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; + else if ( propertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) propertyInfo.GetValue( obj ); - FastMemorySpace m = - (FastMemorySpace) fastMemorySpace.Get( -1, 0, -1, m_LastGetLocalVarId ). - ObjectData; + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs - ( int ) valueRhs.NumberData ); - DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData >> (int) valueRhs.NumberData ); - m.Put( - m_LastElement, - value ); + propertyInfo.SetValue( obj, ( int ) value.NumberData ); - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); @@ -5852,1289 +3243,3587 @@ private BiteVmInterpretResult Run() else { throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + "Runtime Error: Invalid types for arithmetic operation!" ); } } - else + else if ( m_CachedFields.TryGetField( + type, + m_MemberWithStringToSet, + out FastFieldInfo fieldInfo ) ) { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; - DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + if ( fieldInfo.FieldType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData >> (int) valueRhs.NumberData ); - fastMemorySpace.Put( - m_LastElement, - value ); + double valueLhs = + ( double ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs - valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + value.NumberData ); - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - else + else if ( fieldInfo.FieldType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); - } - } + float valueLhs = + ( float ) fieldInfo.GetField( obj ); - m_SetMember = false; - m_SetElement = false; - } - else if (m_SetMemberWithString) - { - if (m_VmStack.Peek().ObjectData is FastMemorySpace) - { - FastMemorySpace fastMemorySpace = (FastMemorySpace) m_VmStack.Pop().ObjectData; - - DynamicBiteVariable valueLhs = - fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData >> (int) valueRhs.NumberData ); + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs - ( float ) valueRhs.NumberData ); - fastMemorySpace.Put( - m_LastElement, - value ); + fieldInfo. + SetField( + obj, + ( float ) value.NumberData ); - if (m_PushNextAssignmentOnStack) + if ( m_PushNextAssignmentOnStack ) { m_PushNextAssignmentOnStack = false; m_VmStack.Push( value ); } } - } - else - { - object obj = m_VmStack.Pop().ObjectData; - bool valuePushed = false; - - if (obj != null) + else if ( fieldInfo.FieldType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) { - Type type = obj.GetType(); - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (m_CachedProperties.ContainsKey( type )) - { - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - - - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs >> (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs >> (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs >> (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedProperties.Add( type, type.GetProperties() ); - for (int i = 0; i < m_CachedProperties[type].Length; i++) - { - if (m_CachedProperties[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedProperties[type][i].PropertyType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs >> (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedProperties[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs >> (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedProperties[type][i].PropertyType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedProperties[type][i].GetValue( obj ); - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs >> (int) valueRhs.NumberData ); - m_CachedProperties[type][i]. - SetValue( - obj, (int) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } + int valueLhs = + ( int ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs - ( int ) valueRhs.NumberData ); - if (!valuePushed) + fieldInfo. + SetField( + obj, + ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) { - if (m_CachedFields.ContainsKey( type )) - { - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs >> (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs >> (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs >> (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } - else - { - m_CachedFields.Add( type, type.GetFields() ); - - for (int i = 0; i < m_CachedFields[type].Length; i++) - { - if (m_CachedFields[type][i].Name == m_MemberWithStringToSet) - { - if (m_CachedFields[type][i].FieldType == typeof( double ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - double valueLhs = - (double) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs >> (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( float ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - float valueLhs = - (float) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs >> (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (float) value.NumberData ); - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else if (m_CachedFields[type][i].FieldType == typeof( int ) && - valueRhs.DynamicType < DynamicVariableType.True) - { - int valueLhs = - (int) m_CachedFields[type][i].GetValue( obj ); - - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - valueLhs >> (int) valueRhs.NumberData ); - m_CachedFields[type][i]. - SetValue( - obj, - (int) value.NumberData ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); - } - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Invalid types for arithmetic operation!" ); - } - - valuePushed = true; - - break; - } - } - } + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); } } - - if (!valuePushed) + else { throw new BiteVmRuntimeException( - $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); - } - } - - m_SetMemberWithString = false; - } - else - { - m_VmStack.Pop(); - - DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId ); - - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData >> (int) valueRhs.NumberData ); - m_CurrentMemorySpace.Put( - m_LastGetLocalVarModuleId, - m_LastGetLocalVarDepth, - m_LastGetLocalClassId, - m_LastGetLocalVarId, - value ); - - if (m_PushNextAssignmentOnStack) - { - m_PushNextAssignmentOnStack = false; - m_VmStack.Push( value ); + "Runtime Error: Invalid types for arithmetic operation!" ); } } else { throw new BiteVmRuntimeException( - "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); } } - - break; + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid object!" ); + } } - case BiteVmOpCodes.OpSetElement: - { - int elementAccessCount = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + m_SetMemberWithString = false; + } + else + { + m_VmStack.Pop(); - m_CurrentInstructionPointer += 4; + DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId ); - //string element = ""; - m_LastElement = ""; + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - for (int i = 0; i < elementAccessCount; i++) + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData - valueRhs.NumberData ); + + m_CurrentMemorySpace.Put( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId, + value ); + + if ( m_PushNextAssignmentOnStack ) { - if (m_VmStack.Peek().DynamicType == DynamicVariableType.String) - { - m_LastElement += m_VmStack.Pop().StringData; - } - else - { - m_LastElement += m_VmStack.Pop().NumberData; - } + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } - m_SetElement = true; + break; + } - //FastMemorySpace fastMemorySpace = m_VmStack.Pop().ObjectData as FastMemorySpace; - //m_VmStack.Push(fastMemorySpace.Get( element )); - break; - } + case BiteVmOpCodes.OpModuloAssign: + { + if ( m_SetMember && !m_SetElement ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; - case BiteVmOpCodes.OpGetElement: - { - int elementAccessCount = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + DynamicBiteVariable valueLhs = fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ); + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - m_CurrentInstructionPointer += 4; + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData % valueRhs.NumberData ); - //string element = ""; - m_LastElement = ""; + fastMemorySpace.PutLocalVar( m_LastGetLocalVarId, value ); - for (int i = 0; i < elementAccessCount; i++) + if ( m_PushNextAssignmentOnStack ) { - if (m_VmStack.Peek().DynamicType == DynamicVariableType.String) - { - m_LastElement += m_VmStack.Pop().StringData; - } - else - { - m_LastElement += m_VmStack.Pop().NumberData; - } + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); } - - //SetElement = true; - FastMemorySpace fastMemorySpace = m_VmStack.Pop().ObjectData as FastMemorySpace; - m_VmStack.Push( fastMemorySpace.Get( m_LastElement ) ); - - break; } - - case BiteVmOpCodes.OpUsingStatmentHead: + else { - m_UsingStatementStack.Push( m_CurrentMemorySpace.Get( -1, 0, -1, 0 ).ObjectData ); + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } - break; - } - - case BiteVmOpCodes.OpUsingStatmentEnd: + m_SetMember = false; + } + else if ( m_SetElement ) + { + if ( m_SetMember ) { - m_UsingStatementStack.Pop(); - - break; - } + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; - case BiteVmOpCodes.OpTernary: - { - if (m_VmStack.Pop().DynamicType == DynamicVariableType.True) - { - DynamicBiteVariable biteVariable = m_VmStack.Pop(); - m_VmStack.Pop(); - m_VmStack.Push( biteVariable ); - } - else - { - m_VmStack.Pop(); - } + FastMemorySpace m = + ( FastMemorySpace ) fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ).ObjectData; - break; - } + DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; - case BiteVmOpCodes.OpAnd: - { DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); - if (valueLhs.DynamicType == DynamicVariableType.True && - valueRhs.DynamicType == DynamicVariableType.True) - { - m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( true ) ); - } - else + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( false ) ); - } - - break; - } + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData % valueRhs.NumberData ); - case BiteVmOpCodes.OpOr: - { - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); + m.Put( + m_LastElement, + value ); - if (valueLhs.DynamicType == DynamicVariableType.True || - valueRhs.DynamicType == DynamicVariableType.True) - { - m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( true ) ); + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } } else { - m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( false ) ); + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); } - - break; } - - case BiteVmOpCodes.OpBitwiseOr: + else { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData | (int) valueRhs.NumberData ) ); + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData % valueRhs.NumberData ); + + fastMemorySpace.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } } else { throw new BiteVmRuntimeException( - "Runtime Error: Can only perform bitwise or on integers!" ); + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); } - - break; } - case BiteVmOpCodes.OpBitwiseXor: + m_SetMember = false; + m_SetElement = false; + } + else if ( m_SetMemberWithString ) + { + if ( m_VmStack.Peek().ObjectData is FastMemorySpace ) { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + DynamicBiteVariable valueLhs = + fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData ^ (int) valueRhs.NumberData ) ); - } - else + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only perform bitwise xor on integers!" ); - } + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData % valueRhs.NumberData ); - break; - } + fastMemorySpace.Put( + m_LastElement, + value ); - case BiteVmOpCodes.OpBitwiseAnd: + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + } + else { - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); + object obj = m_VmStack.Pop().ObjectData; - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData & (int) valueRhs.NumberData ) ); - } - else + if ( obj != null ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only perform bitwise and on integers!" ); - } + Type type = null; - break; - } + if ( obj is StaticWrapper wrapper ) + { + type = wrapper.StaticWrapperType; + } + else + { + type = obj.GetType(); + } - case BiteVmOpCodes.OpBitwiseLeftShift: - { - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData << (int) valueRhs.NumberData ) ); - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only perform bitwise left shift on integers!" ); - } + if ( FastCachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out IFastPropertyInfo fastPropertyInfo ) ) + { + if ( fastPropertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fastPropertyInfo.InvokeGet( obj ); - break; - } + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs % valueRhs.NumberData ); - case BiteVmOpCodes.OpBitwiseRightShift: - { - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); + fastPropertyInfo. + InvokeSet( + obj, + value.NumberData ); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - (int) valueLhs.NumberData >> (int) valueRhs.NumberData ) ); - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only perform bitwise right shift on integers!" ); - } + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fastPropertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) fastPropertyInfo.InvokeGet( obj ); - break; - } + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs % ( float ) valueRhs.NumberData ); - case BiteVmOpCodes.OpNegate: - { - DynamicBiteVariable currentStack = m_VmStack.Peek(); + fastPropertyInfo. + InvokeSet( + obj, + ( float ) value.NumberData ); - if (currentStack.DynamicType < DynamicVariableType.True) - { - currentStack.NumberData *= -1; - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only negate integers and floating point numbers!" ); - } + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fastPropertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) fastPropertyInfo.InvokeGet( obj ); - break; - } + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs % ( int ) valueRhs.NumberData ); - case BiteVmOpCodes.OpAffirm: - { - DynamicBiteVariable currentStack = m_VmStack.Peek(); + fastPropertyInfo.InvokeSet( obj, ( int ) value.NumberData ); - if (currentStack.DynamicType < DynamicVariableType.True) - { - currentStack.NumberData *= 1; + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } + } + else if ( m_CachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out PropertyInfo propertyInfo ) ) + { + if ( propertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) propertyInfo.GetValue( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs % valueRhs.NumberData ); + + propertyInfo. + SetValue( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( propertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) propertyInfo.GetValue( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs % ( float ) valueRhs.NumberData ); + + propertyInfo. + SetValue( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( propertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) propertyInfo.GetValue( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs % ( int ) valueRhs.NumberData ); + + propertyInfo.SetValue( obj, ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } + } + else if ( m_CachedFields.TryGetField( + type, + m_MemberWithStringToSet, + out FastFieldInfo fieldInfo ) ) + { + if ( fieldInfo.FieldType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs % valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fieldInfo.FieldType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs % ( float ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fieldInfo.FieldType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs % ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } + } + else + { + throw new BiteVmRuntimeException( + $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); + } } else { throw new BiteVmRuntimeException( - "Runtime Error: Can only affirm integers and floating point numbers!" ); + "Runtime Error: Invalid object!" ); } - - break; } - case BiteVmOpCodes.OpCompliment: - { - DynamicBiteVariable currentStack = m_VmStack.Peek(); + m_SetMemberWithString = false; + } + else + { + m_VmStack.Pop(); - if (currentStack.DynamicType < DynamicVariableType.True) - { - currentStack.NumberData = ~(int) currentStack.NumberData; - } - else - { - throw new BiteVmRuntimeException( "Runtime Error: Can only complement integer numbers!" ); - } + DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId ); - break; - } + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - case BiteVmOpCodes.OpPrefixDecrement: + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - DynamicBiteVariable currentStack = m_VmStack.Peek(); + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData % valueRhs.NumberData ); - if (currentStack.DynamicType < DynamicVariableType.True) - { - currentStack.NumberData -= 1; - } - else + m_CurrentMemorySpace.Put( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId, + value ); + + if ( m_PushNextAssignmentOnStack ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only decrement integers and floating point numbers!" ); + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); } - - break; } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } + + break; + } + + case BiteVmOpCodes.OpBitwiseAndAssign: + { + if ( m_SetMember && !m_SetElement ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + DynamicBiteVariable valueLhs = fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ); + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - case BiteVmOpCodes.OpPrefixIncrement: + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - DynamicBiteVariable currentStack = m_VmStack.Peek(); + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData & ( int ) valueRhs.NumberData ); - if (currentStack.DynamicType < DynamicVariableType.True) - { - currentStack.NumberData += 1; - } - else + fastMemorySpace.PutLocalVar( m_LastGetLocalVarId, value ); + + if ( m_PushNextAssignmentOnStack ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only increment integers and floating point numbers!" ); + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); } - - break; + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); } - case BiteVmOpCodes.OpPostfixDecrement: + m_SetMember = false; + } + else if ( m_SetElement ) + { + if ( m_SetMember ) { - DynamicBiteVariable currentStack = m_VmStack.Pop(); + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + FastMemorySpace m = + ( FastMemorySpace ) fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ).ObjectData; + + DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (currentStack.DynamicType < DynamicVariableType.True) + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - currentStack.NumberData -= 1; + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData & ( int ) valueRhs.NumberData ); + + m.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } } else { throw new BiteVmRuntimeException( - "Runtime Error: Can only decrement integers and floating point numbers!" ); + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); } - - break; } - - case BiteVmOpCodes.OpPostfixIncrement: + else { - DynamicBiteVariable currentStack = m_VmStack.Pop(); + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (currentStack.DynamicType < DynamicVariableType.True) + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - currentStack.NumberData += 1; + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData & ( int ) valueRhs.NumberData ); + + fastMemorySpace.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } } else { throw new BiteVmRuntimeException( - "Runtime Error: Can only increment integers and floating point numbers!" ); + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); } - - break; } - case BiteVmOpCodes.OpLess: + m_SetMember = false; + m_SetElement = false; + } + else if ( m_SetMemberWithString ) + { + if ( m_VmStack.Peek().ObjectData is FastMemorySpace ) { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + DynamicBiteVariable valueLhs = + fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); - if ((valueLhs.DynamicType == 0 || valueLhs.DynamicType < DynamicVariableType.True) && - (valueRhs.DynamicType == 0 || valueRhs.DynamicType < DynamicVariableType.True)) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData < valueRhs.NumberData ) ); - } - else + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only compare integers and floating point numbers!" ); - } + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData & ( int ) valueRhs.NumberData ); - break; - } + fastMemorySpace.Put( + m_LastElement, + value ); - case BiteVmOpCodes.OpLessOrEqual: + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + } + else { - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); + object obj = m_VmStack.Pop().ObjectData; - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData <= valueRhs.NumberData ) ); - } - else + if ( obj != null ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only compare integers and floating point numbers!" ); - } + Type type = null; - break; - } + if ( obj is StaticWrapper wrapper ) + { + type = wrapper.StaticWrapperType; + } + else + { + type = obj.GetType(); + } - case BiteVmOpCodes.OpGreater: - { - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData > valueRhs.NumberData ) ); - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only compare integers and floating point numbers!" ); - } + if ( FastCachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out IFastPropertyInfo fastPropertyInfo ) ) + { + if ( fastPropertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fastPropertyInfo.InvokeGet( obj ); - break; - } + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs & ( int ) valueRhs.NumberData ); - case BiteVmOpCodes.OpGreaterEqual: - { - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); + fastPropertyInfo. + InvokeSet( + obj, + value.NumberData ); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData >= valueRhs.NumberData ) ); - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only compare integers and floating point numbers!" ); - } + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fastPropertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) fastPropertyInfo.InvokeGet( obj ); - break; - } + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs & ( int ) valueRhs.NumberData ); - case BiteVmOpCodes.OpEqual: - { - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); + fastPropertyInfo. + InvokeSet( + obj, + ( float ) value.NumberData ); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData == valueRhs.NumberData ) ); - } - else if (valueLhs.DynamicType == DynamicVariableType.True && - valueRhs.DynamicType == DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( true ) ); - } - else if (valueLhs.DynamicType == DynamicVariableType.False && - valueRhs.DynamicType == DynamicVariableType.False) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( true ) ); - } - else if (valueLhs.DynamicType == DynamicVariableType.String && - valueRhs.DynamicType == DynamicVariableType.String) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.StringData == valueRhs.StringData ) ); - } - else if (valueLhs.DynamicType == DynamicVariableType.Object && - valueRhs.DynamicType == DynamicVariableType.Object) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.ObjectData == valueRhs.ObjectData ) ); - } - else if (valueLhs.DynamicType == DynamicVariableType.False && - valueRhs.DynamicType == DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( false ) ); - } - else if (valueLhs.DynamicType == DynamicVariableType.True && - valueRhs.DynamicType == DynamicVariableType.False) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( false ) ); - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only check equality on integers, floating point numbers, strings, objects and boolean values!" ); - } + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fastPropertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) fastPropertyInfo.InvokeGet( obj ); - break; - } + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs & ( int ) valueRhs.NumberData ); - case BiteVmOpCodes.OpNotEqual: - { - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); + fastPropertyInfo.InvokeSet( obj, ( int ) value.NumberData ); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData != valueRhs.NumberData ) ); - } - else if (valueLhs.DynamicType == DynamicVariableType.True && - valueRhs.DynamicType == DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( false ) ); - } - else if (valueLhs.DynamicType == DynamicVariableType.False && - valueRhs.DynamicType == DynamicVariableType.False) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( false ) ); - } - else if (valueLhs.DynamicType == DynamicVariableType.String && - valueRhs.DynamicType == DynamicVariableType.String) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.StringData != valueRhs.StringData ) ); - } - else if (valueLhs.DynamicType == DynamicVariableType.Object && - valueRhs.DynamicType == DynamicVariableType.Object) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.ObjectData != valueRhs.ObjectData ) ); - } - else if (valueLhs.DynamicType == DynamicVariableType.False && - valueRhs.DynamicType == DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( true ) ); - } - else if (valueLhs.DynamicType == DynamicVariableType.True && - valueRhs.DynamicType == DynamicVariableType.False) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( true ) ); - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only check equality on integers, floating point numbers, strings, objects and boolean values!" ); - } + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } + } + else if ( m_CachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out PropertyInfo propertyInfo ) ) + { + if ( propertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) propertyInfo.GetValue( obj ); - break; - } + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs & ( int ) valueRhs.NumberData ); - case BiteVmOpCodes.OpNot: - { - DynamicBiteVariable value = m_VmStack.Pop(); + propertyInfo. + SetValue( + obj, + value.NumberData ); - if (value.DynamicType == DynamicVariableType.False) - { - value.DynamicType = DynamicVariableType.True; - } - else if (value.DynamicType == DynamicVariableType.True) - { - value.DynamicType = DynamicVariableType.False; - } - else - { - throw new BiteVmRuntimeException( - "Runtime Error: Can only perform not-operation on boolean values!" ); - } + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( propertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) propertyInfo.GetValue( obj ); - m_VmStack.Push( value ); + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs & ( int ) valueRhs.NumberData ); - break; - } + propertyInfo. + SetValue( + obj, + ( float ) value.NumberData ); - case BiteVmOpCodes.OpAdd: - { - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( propertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) propertyInfo.GetValue( obj ); - if (valueLhs.DynamicType == DynamicVariableType.String || - valueRhs.DynamicType == DynamicVariableType.String) - { - // TODO: String concat rules - if (valueLhs.DynamicType < DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData + valueRhs.StringData ) ); - } - else if (valueRhs.DynamicType < DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.StringData + valueRhs.NumberData ) ); + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs & ( int ) valueRhs.NumberData ); + + propertyInfo.SetValue( obj, ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } } - else if (valueLhs.DynamicType == DynamicVariableType.String || - valueRhs.DynamicType == DynamicVariableType.String) + else if ( m_CachedFields.TryGetField( + type, + m_MemberWithStringToSet, + out FastFieldInfo fieldInfo ) ) { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.StringData + valueRhs.StringData ) ); + if ( fieldInfo.FieldType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs & ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fieldInfo.FieldType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs & ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fieldInfo.FieldType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs & ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } } else { throw new BiteVmRuntimeException( - "Runtime Error: Can only concatenate strings with integers and floating point numbers!" ); + $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); } } - else if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData + valueRhs.NumberData ) ); - } else { throw new BiteVmRuntimeException( - "Runtime Error: Can only concatenate strings with integers and floating point numbers. Or add integers and floating point numbers!" ); + "Runtime Error: Invalid object!" ); } - - break; } - case BiteVmOpCodes.OpSubtract: + m_SetMemberWithString = false; + } + else + { + m_VmStack.Pop(); + + DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId ); + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData & ( int ) valueRhs.NumberData ); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData - valueRhs.NumberData ) ); - } - else + m_CurrentMemorySpace.Put( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId, + value ); + + if ( m_PushNextAssignmentOnStack ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only subtract integers and floating point numbers!" ); + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); } - - break; } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } - case BiteVmOpCodes.OpMultiply: + break; + } + + case BiteVmOpCodes.OpBitwiseOrAssign: + { + if ( m_SetMember && !m_SetElement ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + DynamicBiteVariable valueLhs = fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ); + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData | ( int ) valueRhs.NumberData ); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) - { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData * valueRhs.NumberData ) ); - } - else + fastMemorySpace.PutLocalVar( m_LastGetLocalVarId, value ); + + if ( m_PushNextAssignmentOnStack ) { - throw new BiteVmRuntimeException( - "Runtime Error: Can only multiply integers and floating point numbers!" ); + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); } - - break; + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); } - case BiteVmOpCodes.OpDivide: + m_SetMember = false; + } + else if ( m_SetElement ) + { + if ( m_SetMember ) { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + FastMemorySpace m = + ( FastMemorySpace ) fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ).ObjectData; + + DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData / valueRhs.NumberData ) ); + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData | ( int ) valueRhs.NumberData ); + + m.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } } else { throw new BiteVmRuntimeException( - "Runtime Error: Can only divide integers and floating point numbers!" ); + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); } - - break; } - - case BiteVmOpCodes.OpModulo: + else { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; DynamicBiteVariable valueRhs = m_VmStack.Pop(); - DynamicBiteVariable valueLhs = m_VmStack.Pop(); - if (valueLhs.DynamicType < DynamicVariableType.True && - valueRhs.DynamicType < DynamicVariableType.True) + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - m_VmStack.Push( - DynamicVariableExtension.ToDynamicVariable( - valueLhs.NumberData % valueRhs.NumberData ) ); + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData | ( int ) valueRhs.NumberData ); + + fastMemorySpace.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } } else { throw new BiteVmRuntimeException( - "Runtime Error: Can only modulo integers and floating point numbers!" ); + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); } - - break; } - case BiteVmOpCodes.OpJumpIfFalse: + m_SetMember = false; + m_SetElement = false; + } + else if ( m_SetMemberWithString ) + { + if ( m_VmStack.Peek().ObjectData is FastMemorySpace ) { - int offset = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; - m_CurrentInstructionPointer += 4; + DynamicBiteVariable valueLhs = + fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); - if (m_VmStack.Pop().DynamicType == DynamicVariableType.False) + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) { - m_CurrentInstructionPointer = offset; + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData | ( int ) valueRhs.NumberData ); + + fastMemorySpace.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + } + else + { + object obj = m_VmStack.Pop().ObjectData; + + if ( obj != null ) + { + Type type = null; + + if ( obj is StaticWrapper wrapper ) + { + type = wrapper.StaticWrapperType; + } + else + { + type = obj.GetType(); + } + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( FastCachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out IFastPropertyInfo fastPropertyInfo ) ) + { + if ( fastPropertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs | ( int ) valueRhs.NumberData ); + + fastPropertyInfo. + InvokeSet( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fastPropertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs | ( int ) valueRhs.NumberData ); + + fastPropertyInfo. + InvokeSet( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fastPropertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs | ( int ) valueRhs.NumberData ); + + fastPropertyInfo.InvokeSet( obj, ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } + } + else if ( m_CachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out PropertyInfo propertyInfo ) ) + { + if ( propertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) propertyInfo.GetValue( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs | ( int ) valueRhs.NumberData ); + + propertyInfo. + SetValue( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( propertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) propertyInfo.GetValue( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs | ( int ) valueRhs.NumberData ); + + propertyInfo. + SetValue( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( propertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) propertyInfo.GetValue( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs | ( int ) valueRhs.NumberData ); + + propertyInfo.SetValue( obj, ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } + } + else if ( m_CachedFields.TryGetField( + type, + m_MemberWithStringToSet, + out FastFieldInfo fieldInfo ) ) + { + if ( fieldInfo.FieldType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs | ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fieldInfo.FieldType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs | ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fieldInfo.FieldType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs | ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } + } + else + { + throw new BiteVmRuntimeException( + $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid object!" ); + } + } + + m_SetMemberWithString = false; + } + else + { + m_VmStack.Pop(); + + DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId ); + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData | ( int ) valueRhs.NumberData ); + + m_CurrentMemorySpace.Put( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } + + break; + } + + case BiteVmOpCodes.OpBitwiseXorAssign: + { + if ( m_SetMember && !m_SetElement ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + DynamicBiteVariable valueLhs = fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ); + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData ^ ( int ) valueRhs.NumberData ); + + fastMemorySpace.PutLocalVar( m_LastGetLocalVarId, value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + + m_SetMember = false; + } + else if ( m_SetElement ) + { + if ( m_SetMember ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + FastMemorySpace m = + ( FastMemorySpace ) fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ).ObjectData; + + DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData ^ ( int ) valueRhs.NumberData ); + + m.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } + else + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData ^ ( int ) valueRhs.NumberData ); + + fastMemorySpace.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } + + m_SetMember = false; + m_SetElement = false; + } + else if ( m_SetMemberWithString ) + { + if ( m_VmStack.Peek().ObjectData is FastMemorySpace ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + DynamicBiteVariable valueLhs = + fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData ^ ( int ) valueRhs.NumberData ); + + fastMemorySpace.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + } + else + { + object obj = m_VmStack.Pop().ObjectData; + + if ( obj != null ) + { + Type type = null; + + if ( obj is StaticWrapper wrapper ) + { + type = wrapper.StaticWrapperType; + } + else + { + type = obj.GetType(); + } + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( FastCachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out IFastPropertyInfo fastPropertyInfo ) ) + { + if ( fastPropertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs ^ ( int ) valueRhs.NumberData ); + + fastPropertyInfo. + InvokeSet( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fastPropertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs ^ ( int ) valueRhs.NumberData ); + + fastPropertyInfo. + InvokeSet( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fastPropertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs ^ ( int ) valueRhs.NumberData ); + + fastPropertyInfo.InvokeSet( obj, ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } + } + else if ( m_CachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out PropertyInfo propertyInfo ) ) + { + if ( propertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) propertyInfo.GetValue( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs ^ ( int ) valueRhs.NumberData ); + + propertyInfo. + SetValue( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( propertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) propertyInfo.GetValue( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs ^ ( int ) valueRhs.NumberData ); + + propertyInfo. + SetValue( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( propertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) propertyInfo.GetValue( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs ^ ( int ) valueRhs.NumberData ); + + propertyInfo.SetValue( obj, ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } + } + else if ( m_CachedFields.TryGetField( + type, + m_MemberWithStringToSet, + out FastFieldInfo fieldInfo ) ) + { + if ( fieldInfo.FieldType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs ^ ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fieldInfo.FieldType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs ^ ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fieldInfo.FieldType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs ^ ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } + } + else + { + throw new BiteVmRuntimeException( + $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid object!" ); + } + } + + m_SetMemberWithString = false; + } + else + { + m_VmStack.Pop(); + + DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId ); + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData ^ ( int ) valueRhs.NumberData ); + + m_CurrentMemorySpace.Put( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } + + break; + } + + case BiteVmOpCodes.OpBitwiseLeftShiftAssign: + { + if ( m_SetMember && !m_SetElement ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + DynamicBiteVariable valueLhs = fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ); + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData << ( int ) valueRhs.NumberData ); + + fastMemorySpace.PutLocalVar( m_LastGetLocalVarId, value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + + m_SetMember = false; + } + else if ( m_SetElement ) + { + if ( m_SetMember ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + FastMemorySpace m = + ( FastMemorySpace ) fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ).ObjectData; + + DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData << ( int ) valueRhs.NumberData ); + + m.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } + else + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData << ( int ) valueRhs.NumberData ); + + fastMemorySpace.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } + + m_SetMember = false; + m_SetElement = false; + } + else if ( m_SetMemberWithString ) + { + if ( m_VmStack.Peek().ObjectData is FastMemorySpace ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + DynamicBiteVariable valueLhs = + fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData << ( int ) valueRhs.NumberData ); + + fastMemorySpace.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + } + else + { + object obj = m_VmStack.Pop().ObjectData; + + if ( obj != null ) + { + Type type = null; + + if ( obj is StaticWrapper wrapper ) + { + type = wrapper.StaticWrapperType; + } + else + { + type = obj.GetType(); + } + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( FastCachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out IFastPropertyInfo fastPropertyInfo ) ) + { + if ( fastPropertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs << ( int ) valueRhs.NumberData ); + + fastPropertyInfo. + InvokeSet( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fastPropertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs << ( int ) valueRhs.NumberData ); + + fastPropertyInfo. + InvokeSet( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fastPropertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs << ( int ) valueRhs.NumberData ); + + fastPropertyInfo.InvokeSet( obj, ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } + } + else if ( m_CachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out PropertyInfo propertyInfo ) ) + { + if ( propertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) propertyInfo.GetValue( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs << ( int ) valueRhs.NumberData ); + + propertyInfo. + SetValue( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( propertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) propertyInfo.GetValue( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs << ( int ) valueRhs.NumberData ); + + propertyInfo. + SetValue( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( propertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) propertyInfo.GetValue( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs << ( int ) valueRhs.NumberData ); + + propertyInfo.SetValue( obj, ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } + } + else if ( m_CachedFields.TryGetField( + type, + m_MemberWithStringToSet, + out FastFieldInfo fieldInfo ) ) + { + if ( fieldInfo.FieldType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs << ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fieldInfo.FieldType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs << ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fieldInfo.FieldType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs << ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } + } + else + { + throw new BiteVmRuntimeException( + $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid object!" ); + } + } + + m_SetMemberWithString = false; + } + else + { + m_VmStack.Pop(); + + DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId ); + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData << ( int ) valueRhs.NumberData ); + + m_CurrentMemorySpace.Put( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } + + break; + } + + case BiteVmOpCodes.OpBitwiseRightShiftAssign: + { + if ( m_SetMember && !m_SetElement ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + DynamicBiteVariable valueLhs = fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ); + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData >> ( int ) valueRhs.NumberData ); + + fastMemorySpace.PutLocalVar( m_LastGetLocalVarId, value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + + m_SetMember = false; + } + else if ( m_SetElement ) + { + if ( m_SetMember ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + FastMemorySpace m = + ( FastMemorySpace ) fastMemorySpace.GetLocalVar( m_LastGetLocalVarId ).ObjectData; + + DynamicBiteVariable valueLhs = m.NamesToProperties[m_LastElement]; + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData >> ( int ) valueRhs.NumberData ); + + m.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } + else + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + DynamicBiteVariable valueLhs = fastMemorySpace.NamesToProperties[m_LastElement]; + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData >> ( int ) valueRhs.NumberData ); + + fastMemorySpace.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } + + m_SetMember = false; + m_SetElement = false; + } + else if ( m_SetMemberWithString ) + { + if ( m_VmStack.Peek().ObjectData is FastMemorySpace ) + { + FastMemorySpace fastMemorySpace = ( FastMemorySpace ) m_VmStack.Pop().ObjectData; + + DynamicBiteVariable valueLhs = + fastMemorySpace.NamesToProperties[m_MemberWithStringToSet]; + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData >> ( int ) valueRhs.NumberData ); + + fastMemorySpace.Put( + m_LastElement, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + } + else + { + object obj = m_VmStack.Pop().ObjectData; + + if ( obj != null ) + { + Type type = null; + + if ( obj is StaticWrapper wrapper ) + { + type = wrapper.StaticWrapperType; + } + else + { + type = obj.GetType(); + } + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( FastCachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out IFastPropertyInfo fastPropertyInfo ) ) + { + if ( fastPropertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs >> ( int ) valueRhs.NumberData ); + + fastPropertyInfo. + InvokeSet( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fastPropertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs >> ( int ) valueRhs.NumberData ); + + fastPropertyInfo. + InvokeSet( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fastPropertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) fastPropertyInfo.InvokeGet( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs >> ( int ) valueRhs.NumberData ); + + fastPropertyInfo.InvokeSet( obj, ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } + } + else if ( m_CachedProperties.TryGetProperty( + type, + m_MemberWithStringToSet, + out PropertyInfo propertyInfo ) ) + { + if ( propertyInfo.PropertyType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) propertyInfo.GetValue( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs >> ( int ) valueRhs.NumberData ); + + propertyInfo. + SetValue( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( propertyInfo.PropertyType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) propertyInfo.GetValue( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs >> ( int ) valueRhs.NumberData ); + + propertyInfo. + SetValue( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( propertyInfo.PropertyType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) propertyInfo.GetValue( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs >> ( int ) valueRhs.NumberData ); + + propertyInfo.SetValue( obj, ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } + } + else if ( m_CachedFields.TryGetField( + type, + m_MemberWithStringToSet, + out FastFieldInfo fieldInfo ) ) + { + if ( fieldInfo.FieldType == typeof( double ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + double valueLhs = + ( double ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs >> ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fieldInfo.FieldType == typeof( float ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + float valueLhs = + ( float ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs >> ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + ( float ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else if ( fieldInfo.FieldType == typeof( int ) && + valueRhs.DynamicType < DynamicVariableType.True ) + { + int valueLhs = + ( int ) fieldInfo.GetField( obj ); + + DynamicBiteVariable value = + DynamicVariableExtension.ToDynamicVariable( + valueLhs >> ( int ) valueRhs.NumberData ); + + fieldInfo. + SetField( + obj, + ( int ) value.NumberData ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid types for arithmetic operation!" ); + } + } + else + { + throw new BiteVmRuntimeException( + $"Runtime Error: Member: {m_MemberWithStringToSet} not found!" ); + } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Invalid object!" ); + } + } + + m_SetMemberWithString = false; + } + else + { + m_VmStack.Pop(); + + DynamicBiteVariable valueLhs = m_CurrentMemorySpace.Get( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId ); + + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + DynamicBiteVariable value = DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData >> ( int ) valueRhs.NumberData ); + + m_CurrentMemorySpace.Put( + m_LastGetLocalVarModuleId, + m_LastGetLocalVarDepth, + m_LastGetLocalClassId, + m_LastGetLocalVarId, + value ); + + if ( m_PushNextAssignmentOnStack ) + { + m_PushNextAssignmentOnStack = false; + m_VmStack.Push( value ); } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only use integers and floating point numbers for arithmetic Operations!" ); + } + } + + break; + } + + case BiteVmOpCodes.OpSetElement: + { + int elementAccessCount = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); + + m_CurrentInstructionPointer += 4; + + //string element = ""; + m_LastElement = ""; + + for ( int i = 0; i < elementAccessCount; i++ ) + { + if ( m_VmStack.Peek().DynamicType == DynamicVariableType.String ) + { + m_LastElement += m_VmStack.Pop().StringData; + } + else + { + m_LastElement += m_VmStack.Pop().NumberData; + } + } + + m_SetElement = true; + + //FastMemorySpace fastMemorySpace = m_VmStack.Pop().ObjectData as FastMemorySpace; + //m_VmStack.Push(fastMemorySpace.Get( element )); + break; + } + + case BiteVmOpCodes.OpGetElement: + { + int elementAccessCount = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); + + m_CurrentInstructionPointer += 4; + + //string element = ""; + m_LastElement = ""; + + for ( int i = 0; i < elementAccessCount; i++ ) + { + if ( m_VmStack.Peek().DynamicType == DynamicVariableType.String ) + { + m_LastElement += m_VmStack.Pop().StringData; + } + else + { + m_LastElement += m_VmStack.Pop().NumberData; + } + } + + //SetElement = true; + FastMemorySpace fastMemorySpace = m_VmStack.Pop().ObjectData as FastMemorySpace; + m_VmStack.Push( fastMemorySpace.Get( m_LastElement ) ); + + break; + } + + case BiteVmOpCodes.OpUsingStatmentHead: + { + m_UsingStatementStack.Push( m_CurrentMemorySpace.Get( -1, 0, -1, 0 ).ObjectData ); + + break; + } + + case BiteVmOpCodes.OpUsingStatmentEnd: + { + m_UsingStatementStack.Pop(); + + break; + } + + case BiteVmOpCodes.OpTernary: + { + if ( m_VmStack.Pop().DynamicType == DynamicVariableType.True ) + { + DynamicBiteVariable biteVariable = m_VmStack.Pop(); + m_VmStack.Pop(); + m_VmStack.Push( biteVariable ); + } + else + { + m_VmStack.Pop(); + } + + break; + } + + case BiteVmOpCodes.OpAnd: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType == DynamicVariableType.True && + valueRhs.DynamicType == DynamicVariableType.True ) + { + m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( true ) ); + } + else + { + m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( false ) ); + } + + break; + } + + case BiteVmOpCodes.OpOr: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType == DynamicVariableType.True || + valueRhs.DynamicType == DynamicVariableType.True ) + { + m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( true ) ); + } + else + { + m_VmStack.Push( DynamicVariableExtension.ToDynamicVariable( false ) ); + } + + break; + } + + case BiteVmOpCodes.OpBitwiseOr: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData | ( int ) valueRhs.NumberData ) ); + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only perform bitwise or on integers!" ); + } + + break; + } + + case BiteVmOpCodes.OpBitwiseXor: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData ^ ( int ) valueRhs.NumberData ) ); + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only perform bitwise xor on integers!" ); + } + + break; + } + + case BiteVmOpCodes.OpBitwiseAnd: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData & ( int ) valueRhs.NumberData ) ); + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only perform bitwise and on integers!" ); + } + + break; + } + + case BiteVmOpCodes.OpBitwiseLeftShift: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData << ( int ) valueRhs.NumberData ) ); + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only perform bitwise left shift on integers!" ); + } + + break; + } + + case BiteVmOpCodes.OpBitwiseRightShift: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + ( int ) valueLhs.NumberData >> ( int ) valueRhs.NumberData ) ); + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only perform bitwise right shift on integers!" ); + } + + break; + } + + case BiteVmOpCodes.OpNegate: + { + DynamicBiteVariable currentStack = m_VmStack.Peek(); + + if ( currentStack.DynamicType < DynamicVariableType.True ) + { + currentStack.NumberData *= -1; + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only negate integers and floating point numbers!" ); + } + + break; + } + + case BiteVmOpCodes.OpAffirm: + { + DynamicBiteVariable currentStack = m_VmStack.Peek(); + + if ( currentStack.DynamicType < DynamicVariableType.True ) + { + currentStack.NumberData *= 1; + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only affirm integers and floating point numbers!" ); + } + + break; + } + + case BiteVmOpCodes.OpCompliment: + { + DynamicBiteVariable currentStack = m_VmStack.Peek(); + + if ( currentStack.DynamicType < DynamicVariableType.True ) + { + currentStack.NumberData = ~( int ) currentStack.NumberData; + } + else + { + throw new BiteVmRuntimeException( "Runtime Error: Can only complement integer numbers!" ); + } + + break; + } + + case BiteVmOpCodes.OpPrefixDecrement: + { + DynamicBiteVariable currentStack = m_VmStack.Peek(); + + if ( currentStack.DynamicType < DynamicVariableType.True ) + { + currentStack.NumberData -= 1; + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only decrement integers and floating point numbers!" ); + } + + break; + } + + case BiteVmOpCodes.OpPrefixIncrement: + { + DynamicBiteVariable currentStack = m_VmStack.Peek(); + + if ( currentStack.DynamicType < DynamicVariableType.True ) + { + currentStack.NumberData += 1; + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only increment integers and floating point numbers!" ); + } + + break; + } + + case BiteVmOpCodes.OpPostfixDecrement: + { + DynamicBiteVariable currentStack = m_VmStack.Pop(); + + if ( currentStack.DynamicType < DynamicVariableType.True ) + { + currentStack.NumberData -= 1; + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only decrement integers and floating point numbers!" ); + } + + break; + } + + case BiteVmOpCodes.OpPostfixIncrement: + { + DynamicBiteVariable currentStack = m_VmStack.Pop(); + + if ( currentStack.DynamicType < DynamicVariableType.True ) + { + currentStack.NumberData += 1; + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only increment integers and floating point numbers!" ); + } + + break; + } - break; - } + case BiteVmOpCodes.OpLess: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); - case BiteVmOpCodes.OpEnterBlock: - { - int memberCount = m_CurrentChunk.Code[m_CurrentInstructionPointer] | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16) | - (m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24); - - m_CurrentInstructionPointer += 4; - FastMemorySpace block = m_PoolFastMemoryFastMemory.Get(); - block.ResetPropertiesArray( memberCount ); - block.m_EnclosingSpace = m_CurrentMemorySpace; - block.StackCountAtBegin = m_VmStack.Count; - m_CurrentMemorySpace = block; - m_CallStack.Push( m_CurrentMemorySpace ); + if ( ( valueLhs.DynamicType == 0 || valueLhs.DynamicType < DynamicVariableType.True ) && + ( valueRhs.DynamicType == 0 || valueRhs.DynamicType < DynamicVariableType.True ) ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData < valueRhs.NumberData ) ); + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only compare integers and floating point numbers!" ); + } - break; - } + break; + } - case BiteVmOpCodes.OpExitBlock: - { - if (m_KeepLastItemOnStackToReturn) - { - ReturnValue = m_VmStack.Pop(); - } + case BiteVmOpCodes.OpLessOrEqual: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); - if (m_CurrentMemorySpace.StackCountAtBegin < m_VmStack.Count) - { - int stackCounter = m_VmStack.Count - m_CurrentMemorySpace.StackCountAtBegin; - m_VmStack.Count -= stackCounter; - } + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData <= valueRhs.NumberData ) ); + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only compare integers and floating point numbers!" ); + } - FastMemorySpace fastMemorySpace = m_CallStack.Pop(); + break; + } - if (fastMemorySpace.CallerChunk != null) - { - m_CurrentChunk = fastMemorySpace.CallerChunk; - m_CurrentInstructionPointer = fastMemorySpace.CallerIntructionPointer; - } + case BiteVmOpCodes.OpGreater: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData > valueRhs.NumberData ) ); + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only compare integers and floating point numbers!" ); + } - m_PoolFastMemoryFastMemory.Return( fastMemorySpace ); - m_CurrentMemorySpace = m_CallStack.Peek(); + break; + } - if (m_KeepLastItemOnStackToReturn) - { - m_VmStack.Push( ReturnValue ); - } + case BiteVmOpCodes.OpGreaterEqual: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); - break; - } + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData >= valueRhs.NumberData ) ); + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only compare integers and floating point numbers!" ); + } - case BiteVmOpCodes.OpKeepLastItemOnStack: - { - m_KeepLastItemOnStackToReturn = true; + break; + } - break; - } + case BiteVmOpCodes.OpEqual: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData == valueRhs.NumberData ) ); + } + else if ( valueLhs.DynamicType == DynamicVariableType.True && + valueRhs.DynamicType == DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( true ) ); + } + else if ( valueLhs.DynamicType == DynamicVariableType.False && + valueRhs.DynamicType == DynamicVariableType.False ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( true ) ); + } + else if ( valueLhs.DynamicType == DynamicVariableType.String && + valueRhs.DynamicType == DynamicVariableType.String ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.StringData == valueRhs.StringData ) ); + } + else if ( valueLhs.DynamicType == DynamicVariableType.Object && + valueRhs.DynamicType == DynamicVariableType.Object ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.ObjectData == valueRhs.ObjectData ) ); + } + else if ( valueLhs.DynamicType == DynamicVariableType.False && + valueRhs.DynamicType == DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( false ) ); + } + else if ( valueLhs.DynamicType == DynamicVariableType.True && + valueRhs.DynamicType == DynamicVariableType.False ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( false ) ); + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only check equality on integers, floating point numbers, strings, objects and boolean values!" ); + } + + break; + } + + case BiteVmOpCodes.OpNotEqual: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData != valueRhs.NumberData ) ); + } + else if ( valueLhs.DynamicType == DynamicVariableType.True && + valueRhs.DynamicType == DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( false ) ); + } + else if ( valueLhs.DynamicType == DynamicVariableType.False && + valueRhs.DynamicType == DynamicVariableType.False ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( false ) ); + } + else if ( valueLhs.DynamicType == DynamicVariableType.String && + valueRhs.DynamicType == DynamicVariableType.String ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.StringData != valueRhs.StringData ) ); + } + else if ( valueLhs.DynamicType == DynamicVariableType.Object && + valueRhs.DynamicType == DynamicVariableType.Object ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.ObjectData != valueRhs.ObjectData ) ); + } + else if ( valueLhs.DynamicType == DynamicVariableType.Object && + valueRhs.DynamicType == DynamicVariableType.Null ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.ObjectData != null ) ); + } + else if ( valueLhs.DynamicType == DynamicVariableType.Null && + valueRhs.DynamicType == DynamicVariableType.Object ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + null != valueRhs.ObjectData ) ); + } + else if ( valueLhs.DynamicType == DynamicVariableType.False && + valueRhs.DynamicType == DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( true ) ); + } + else if ( valueLhs.DynamicType == DynamicVariableType.True && + valueRhs.DynamicType == DynamicVariableType.False ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( true ) ); + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only check equality on integers, floating point numbers, strings, objects and boolean values!" ); + } + + break; + } - case BiteVmOpCodes.OpReturn: + case BiteVmOpCodes.OpNot: + { + DynamicBiteVariable value = m_VmStack.Pop(); + + if ( value.DynamicType == DynamicVariableType.False ) + { + value.DynamicType = DynamicVariableType.True; + } + else if ( value.DynamicType == DynamicVariableType.True ) + { + value.DynamicType = DynamicVariableType.False; + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only perform not-operation on boolean values!" ); + } + + m_VmStack.Push( value ); + + break; + } + + case BiteVmOpCodes.OpAdd: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType == DynamicVariableType.String || + valueRhs.DynamicType == DynamicVariableType.String ) + { + // TODO: String concat rules + if ( valueLhs.DynamicType < DynamicVariableType.True ) { - if (m_KeepLastItemOnStackToReturn) - { - ReturnValue = m_VmStack.Pop(); - } + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData + valueRhs.StringData ) ); + } + else if ( valueRhs.DynamicType < DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.StringData + valueRhs.NumberData ) ); + } + else if ( valueLhs.DynamicType == DynamicVariableType.String || + valueRhs.DynamicType == DynamicVariableType.String ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.StringData + valueRhs.StringData ) ); + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only concatenate strings with integers and floating point numbers!" ); + } + } + else if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData + valueRhs.NumberData ) ); + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only concatenate strings with integers and floating point numbers. Or add integers and floating point numbers!" ); + } - if (m_CurrentMemorySpace.StackCountAtBegin < m_VmStack.Count) - { - int stackCounter = m_VmStack.Count - m_CurrentMemorySpace.StackCountAtBegin; - m_VmStack.Count -= stackCounter; - } + break; + } - if (m_CallStack.Peek().CallerChunk.Code != null && - m_CallStack.Peek().CallerChunk.Code != m_CurrentChunk.Code) - { - m_CurrentChunk = m_CallStack.Peek().CallerChunk; - m_CurrentInstructionPointer = m_CallStack.Peek().CallerIntructionPointer; - } + case BiteVmOpCodes.OpSubtract: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); - m_PoolFastMemoryFastMemory.Return( m_CallStack.Pop() ); - m_CurrentMemorySpace = m_CallStack.Peek(); + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData - valueRhs.NumberData ) ); + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only subtract integers and floating point numbers!" ); + } - if (m_KeepLastItemOnStackToReturn) - { - m_VmStack.Push( ReturnValue ); - } + break; + } - m_KeepLastItemOnStackToReturn = false; + case BiteVmOpCodes.OpMultiply: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); - break; + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData * valueRhs.NumberData ) ); + } + else if ( valueLhs.DynamicType == DynamicVariableType.Object && + valueRhs.DynamicType < DynamicVariableType.True ) + { + object obj = valueLhs.ToObject(); + Type objType = obj.GetType(); + Type[] argsTypes = { objType, typeof( float ) }; + + if ( m_CachedMethods.TryGetMethod( + obj.GetType(), + argsTypes, + "op_Multiply", + out FastMethodInfo fastMethodInfo ) ) + { + object[] args = { obj, ( float ) valueRhs.NumberData }; + fastMethodInfo.Invoke( obj, args ); + } + } + else if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType == DynamicVariableType.Object ) + { + object obj = valueRhs.ToObject(); + Type objType = obj.GetType(); + Type[] argsTypes = { typeof( float ), objType }; + + if ( m_CachedMethods.TryGetMethod( + obj.GetType(), + argsTypes, + "op_Multiply", + out FastMethodInfo fastMethodInfo ) ) + { + object[] args = { ( float ) valueLhs.NumberData, obj }; + fastMethodInfo.Invoke( obj, args ); } + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only multiply integers and floating point numbers!" ); + } - default: - throw new ArgumentOutOfRangeException( "Instruction : " + instruction ); + break; } - } - else - { - if (m_CallStack.Count > 0) + + case BiteVmOpCodes.OpDivide: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData / valueRhs.NumberData ) ); + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only divide integers and floating point numbers!" ); + } + + break; + } + + case BiteVmOpCodes.OpModulo: + { + DynamicBiteVariable valueRhs = m_VmStack.Pop(); + DynamicBiteVariable valueLhs = m_VmStack.Pop(); + + if ( valueLhs.DynamicType < DynamicVariableType.True && + valueRhs.DynamicType < DynamicVariableType.True ) + { + m_VmStack.Push( + DynamicVariableExtension.ToDynamicVariable( + valueLhs.NumberData % valueRhs.NumberData ) ); + } + else + { + throw new BiteVmRuntimeException( + "Runtime Error: Can only modulo integers and floating point numbers!" ); + } + + break; + } + + case BiteVmOpCodes.OpJumpIfFalse: + { + int offset = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); + + m_CurrentInstructionPointer += 4; + + if ( m_VmStack.Pop().DynamicType == DynamicVariableType.False ) + { + m_CurrentInstructionPointer = offset; + } + + break; + } + + case BiteVmOpCodes.OpEnterBlock: + { + int memberCount = m_CurrentChunk.Code[m_CurrentInstructionPointer] | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 1] << 8 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 2] << 16 ) | + ( m_CurrentChunk.Code[m_CurrentInstructionPointer + 3] << 24 ); + + m_CurrentInstructionPointer += 4; + FastMemorySpace block = m_PoolFastMemoryFastMemory.Get(); + + //block.ResetPropertiesArray( memberCount ); + block.m_EnclosingSpace = m_CurrentMemorySpace; + block.StackCountAtBegin = m_VmStack.Count; + m_CurrentMemorySpace = block; + m_CallStack.Push( m_CurrentMemorySpace ); + + break; + } + + case BiteVmOpCodes.OpExitBlock: { - if (m_VmStack.Count > 0) + if ( m_KeepLastItemOnStackToReturn ) { - ReturnValue = m_VmStack.Peek(); + ReturnValue = m_VmStack.Pop(); } - if (m_CurrentMemorySpace.StackCountAtBegin < m_VmStack.Count) + if ( m_CurrentMemorySpace.StackCountAtBegin < m_VmStack.Count ) { int stackCounter = m_VmStack.Count - m_CurrentMemorySpace.StackCountAtBegin; m_VmStack.Count -= stackCounter; } - if (m_CallStack.Peek().CallerChunk.Code != null && - m_CallStack.Peek().CallerChunk.Code != m_CurrentChunk.Code) + FastMemorySpace fastMemorySpace = m_CallStack.Pop(); + + if ( fastMemorySpace.CallerChunk != null ) { - m_CurrentChunk = m_CallStack.Peek().CallerChunk; - m_CurrentInstructionPointer = m_CallStack.Peek().CallerIntructionPointer; + m_CurrentChunk = fastMemorySpace.CallerChunk; + m_CurrentInstructionPointer = fastMemorySpace.CallerIntructionPointer; + m_CurrentLineNumberPointer = fastMemorySpace.CallerLineNumberPointer; } - if (m_CurrentMemorySpace is FastClassMemorySpace || m_CurrentMemorySpace is FastModuleMemorySpace) + m_PoolFastMemoryFastMemory.Return( fastMemorySpace ); + m_CurrentMemorySpace = m_CallStack.Peek(); + + if ( m_KeepLastItemOnStackToReturn ) { - m_CallStack.Pop(); + m_VmStack.Push( ReturnValue ); } - else + + break; + } + + case BiteVmOpCodes.OpKeepLastItemOnStack: + { + m_KeepLastItemOnStackToReturn = true; + + break; + } + + case BiteVmOpCodes.OpReturn: + { + if ( m_KeepLastItemOnStackToReturn ) + { + ReturnValue = m_VmStack.Pop(); + } + + if ( m_CurrentMemorySpace.StackCountAtBegin < m_VmStack.Count ) + { + int stackCounter = m_VmStack.Count - m_CurrentMemorySpace.StackCountAtBegin; + m_VmStack.Count -= stackCounter; + } + + if ( m_CallStack.Peek().CallerChunk != null && + m_CallStack.Peek().CallerChunk.Code != null ) + { + m_CurrentChunk = m_CallStack.Peek().CallerChunk; + m_CurrentInstructionPointer = m_CallStack.Peek().CallerIntructionPointer; + m_CurrentLineNumberPointer = m_CallStack.Peek().CallerLineNumberPointer; + } + + m_PoolFastMemoryFastMemory.Return( m_CallStack.Pop() ); + + if ( m_KeepLastItemOnStackToReturn ) { - m_PoolFastMemoryFastMemory.Return( m_CallStack.Pop() ); + m_VmStack.Push( ReturnValue ); } - if (m_CallStack.Count > 0) + m_KeepLastItemOnStackToReturn = false; + + if ( m_CurrentMemorySpace.IsRunningCallback ) { - m_CurrentMemorySpace = m_CallStack.Peek(); + m_SpinLockCallingThread = false; + m_SpinLockWorkingThread = false; } + + m_CurrentMemorySpace = m_CallStack.Peek(); + + break; + } + + default: + throw new ArgumentOutOfRangeException( "Instruction : " + instruction ); + } + + m_CurrentLineNumberPointer++; + } + else + { + if ( m_CallStack.Count > 0 ) + { + if ( m_VmStack.Count > 0 ) + { + ReturnValue = m_VmStack.Peek(); + } + + if ( m_CurrentMemorySpace.StackCountAtBegin < m_VmStack.Count ) + { + int stackCounter = m_VmStack.Count - m_CurrentMemorySpace.StackCountAtBegin; + m_VmStack.Count -= stackCounter; + } + + if ( m_CallStack.Peek().CallerChunk != null && + m_CallStack.Peek().CallerChunk.Code != null ) + { + m_CurrentChunk = m_CallStack.Peek().CallerChunk; + m_CurrentInstructionPointer = m_CallStack.Peek().CallerIntructionPointer; + m_CurrentLineNumberPointer = m_CallStack.Peek().CallerLineNumberPointer; + } + + if ( m_CurrentMemorySpace is FastClassMemorySpace || m_CurrentMemorySpace is FastModuleMemorySpace ) + { + m_CallStack.Pop(); } else { - if (m_VmStack.Count > 0) - { - ReturnValue = m_VmStack.Peek(); - } + m_PoolFastMemoryFastMemory.Return( m_CallStack.Pop() ); + } + + if ( m_CurrentMemorySpace.IsRunningCallback ) + { + m_SpinLockCallingThread = false; + m_SpinLockWorkingThread = false; + } - return BiteVmInterpretResult.InterpretOk; + if ( m_CallStack.Count > 0 ) + { + m_CurrentMemorySpace = m_CallStack.Peek(); + } + } + else + { + if ( m_VmStack.Count > 0 ) + { + ReturnValue = m_VmStack.Peek(); } + + return BiteVmInterpretResult.InterpretOk; } } } - #endregion + return result; } + #endregion +} + } diff --git a/Bite/Runtime/BiteVmInterpretResult.cs b/Bite/Runtime/BiteVmInterpretResult.cs index fa1a007..ccb0575 100644 --- a/Bite/Runtime/BiteVmInterpretResult.cs +++ b/Bite/Runtime/BiteVmInterpretResult.cs @@ -5,7 +5,9 @@ public enum BiteVmInterpretResult { InterpretOk, InterpretCompileError, - InterpretRuntimeError + InterpretRuntimeError, + Continue, + Cancelled } } diff --git a/Bite/Runtime/BiteVmOpCodes.cs b/Bite/Runtime/BiteVmOpCodes.cs index 59448ae..b7c2864 100644 --- a/Bite/Runtime/BiteVmOpCodes.cs +++ b/Bite/Runtime/BiteVmOpCodes.cs @@ -79,7 +79,9 @@ public enum BiteVmOpCodes : byte OpSetMemberWithString, OpKeepLastItemOnStack, OpBreak, - OpReturn + OpReturn, + OpSwitchContext, + OpReturnContext } } diff --git a/Bite/Runtime/BiteVmRuntimeException.cs b/Bite/Runtime/BiteVmRuntimeException.cs new file mode 100644 index 0000000..e542b4c --- /dev/null +++ b/Bite/Runtime/BiteVmRuntimeException.cs @@ -0,0 +1,20 @@ +using System; + +namespace Bite.Runtime +{ + +public class BiteVmRuntimeException : ApplicationException +{ + public string BiteVmRuntimeExceptionMessage { get; } + + #region Public + + public BiteVmRuntimeException( string message ) : base( message ) + { + BiteVmRuntimeExceptionMessage = message; + } + + #endregion +} + +} diff --git a/Bite/Runtime/Bytecode/ChunkDebugHelper.cs b/Bite/Runtime/Bytecode/ChunkDebugHelper.cs index ec17fd6..266fd91 100644 --- a/Bite/Runtime/Bytecode/ChunkDebugHelper.cs +++ b/Bite/Runtime/Bytecode/ChunkDebugHelper.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Concurrent; using System.Collections.Generic; namespace Bite.Runtime.Bytecode @@ -11,10 +12,10 @@ public class InstructionAnalysis public static class ChunkDebugHelper { - public static Dictionary < string, long > InstructionCounter = new Dictionary < string, long >(); + public static ConcurrentDictionary < string, long > InstructionCounter = new ConcurrentDictionary < string, long >(); - public static Dictionary < string, InstructionAnalysis > InstructionAnalysis = - new Dictionary < string, InstructionAnalysis >(); + public static ConcurrentDictionary < string, InstructionAnalysis > InstructionAnalysis = + new ConcurrentDictionary < string, InstructionAnalysis >(); #region Public @@ -27,14 +28,12 @@ public static void DissassembleChunk( this Chunk chunk, string name ) offset = DissassembleInstruction( chunk, offset ); }*/ } - - public static int DissassembleInstruction( this BinaryChunk chunk, int offset ) + + public static int CountInstruction( this BinaryChunk chunk, int offset ) { - Console.Write( offset + " " ); - BiteVmOpCodes instruction = ( BiteVmOpCodes ) chunk.Code[offset]; offset++; - + switch ( instruction ) { default: @@ -46,12 +45,39 @@ public static int DissassembleInstruction( this BinaryChunk chunk, int offset ) } else { - InstructionCounter.Add( inst, 1 ); + InstructionCounter.TryAdd( inst, 1 ); //InstructionAnalysis.Add( inst, new InstructionAnalysis() ); } - Console.WriteLine( inst ); + return offset + 1; + } + } + + public static int DissassembleInstruction( this BinaryChunk chunk, int offset, int lineOffset ) + { + Console.Write( offset + " " ); + + BiteVmOpCodes instruction = ( BiteVmOpCodes ) chunk.Code[offset]; + offset++; + + + switch ( instruction ) + { + default: + string inst = instruction.ToString(); + + int lineNumber = 0; + if ( lineOffset < chunk.Lines.Count ) + { + lineNumber = chunk.Lines[lineOffset]; + } + else + { + lineNumber = chunk.Lines[chunk.Lines.Count - 1]; + } + + Console.WriteLine( $"{inst} Line: {lineNumber}" ); return offset + 1; } diff --git a/Bite/Runtime/Bytecode/ChunkHelper.cs b/Bite/Runtime/Bytecode/ChunkHelper.cs index e4e7344..a4ff433 100644 --- a/Bite/Runtime/Bytecode/ChunkHelper.cs +++ b/Bite/Runtime/Bytecode/ChunkHelper.cs @@ -91,6 +91,21 @@ public static int WriteToChunk( return chunk.Code.Count - 1; } + + public static int WriteToChunk( + this Chunk chunk, + BiteVmOpCodes code, + ConstantValue constant, + int opCodeData, + int opCodeData2, + int line ) + { + chunk.Code.Add( new ByteCode( code, chunk.Constants.Count, opCodeData, opCodeData2 ) ); + chunk.Constants.Add( constant ); + chunk.Lines.Add( line ); + + return chunk.Code.Count - 1; + } #endregion } diff --git a/Bite/Runtime/Bytecode/ConstantValue.cs b/Bite/Runtime/Bytecode/ConstantValue.cs index 1619e14..737ff5a 100644 --- a/Bite/Runtime/Bytecode/ConstantValue.cs +++ b/Bite/Runtime/Bytecode/ConstantValue.cs @@ -22,6 +22,9 @@ public struct ConstantValue [FieldOffset( 16 )] public string StringConstantValue; + + [FieldOffset( 16 )] + public object NullConstantValue; public ConstantValue( int value ) : this() { @@ -46,6 +49,15 @@ public ConstantValue( bool value ) : this() BoolConstantValue = value; ConstantType = ConstantValueType.Bool; } + + public ConstantValue( object value ) : this() + { + if ( value == null ) + { + NullConstantValue = value; + ConstantType = ConstantValueType.Null; + } + } public override string ToString() { @@ -62,6 +74,9 @@ public override string ToString() case ConstantValueType.Bool: return $"{ConstantType.ToString()}: {BoolConstantValue.ToString()}"; + + case ConstantValueType.Null: + return $"{ConstantType.ToString()}"; default: throw new ArgumentOutOfRangeException(); diff --git a/Bite/Runtime/BytecodeList.cs b/Bite/Runtime/BytecodeList.cs new file mode 100644 index 0000000..5afc954 --- /dev/null +++ b/Bite/Runtime/BytecodeList.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using Bite.Runtime.Bytecode; + +namespace Bite.Runtime +{ + +public class BytecodeList +{ + public List < ByteCode > ByteCodes = new List < ByteCode >(); +} + +} diff --git a/Bite/Runtime/BytecodeListStack.cs b/Bite/Runtime/BytecodeListStack.cs new file mode 100644 index 0000000..9c61ef0 --- /dev/null +++ b/Bite/Runtime/BytecodeListStack.cs @@ -0,0 +1,50 @@ +using System; + +namespace Bite.Runtime +{ + +public class BytecodeListStack +{ + private readonly BytecodeList[] m_BytecodeLists = new BytecodeList[1024]; + + public int Count { get; set; } = 0; + + #region Public + + public BytecodeList Peek() + { + BytecodeList bytecodeList = m_BytecodeLists[Count - 1]; + + return bytecodeList; + } + + public BytecodeList Peek( int i ) + { + BytecodeList bytecodeList = m_BytecodeLists[i]; + + return bytecodeList; + } + + public BytecodeList Pop() + { + BytecodeList bytecodeList = m_BytecodeLists[--Count]; + + return bytecodeList; + } + + public void Push( BytecodeList dynamicVar ) + { + m_BytecodeLists[Count] = dynamicVar; + + if ( Count >= 1023 ) + { + throw new IndexOutOfRangeException( "Stack Overflow" ); + } + + Count++; + } + + #endregion +} + +} diff --git a/Bite/Runtime/DynamicBiteVariableStack.cs b/Bite/Runtime/DynamicBiteVariableStack.cs new file mode 100644 index 0000000..b63c016 --- /dev/null +++ b/Bite/Runtime/DynamicBiteVariableStack.cs @@ -0,0 +1,53 @@ +using System; +using Bite.Runtime.Memory; + +namespace Bite.Runtime +{ + +public class DynamicBiteVariableStack +{ + private DynamicBiteVariable[] m_DynamicVariables = new DynamicBiteVariable[128]; + + public int Count { get; set; } = 0; + + #region Public + + public DynamicBiteVariable Peek() + { + DynamicBiteVariable dynamicVariable = m_DynamicVariables[Count - 1]; + + return dynamicVariable; + } + + public DynamicBiteVariable Peek( int i ) + { + DynamicBiteVariable dynamicVariable = m_DynamicVariables[i]; + + return dynamicVariable; + } + + public DynamicBiteVariable Pop() + { + DynamicBiteVariable dynamicVariable = m_DynamicVariables[--Count]; + + return dynamicVariable; + } + + public void Push( DynamicBiteVariable dynamicVar ) + { + if ( Count >= m_DynamicVariables.Length ) + { + DynamicBiteVariable[] newProperties = new DynamicBiteVariable[m_DynamicVariables.Length * 2]; + Array.Copy( m_DynamicVariables, newProperties, m_DynamicVariables.Length ); + m_DynamicVariables = newProperties; + } + + m_DynamicVariables[Count] = dynamicVar; + + Count++; + } + + #endregion +} + +} diff --git a/Bite/Runtime/FastMemoryStack.cs b/Bite/Runtime/FastMemoryStack.cs index 6d3a439..8a0d3e6 100644 --- a/Bite/Runtime/FastMemoryStack.cs +++ b/Bite/Runtime/FastMemoryStack.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using Bite.Runtime.Bytecode; using Bite.Runtime.Memory; namespace Bite.Runtime @@ -36,138 +34,8 @@ public void Push( FastMemorySpace fastMemorySpace ) Array.Copy( m_FastMemorySpaces, newProperties, m_FastMemorySpaces.Length ); m_FastMemorySpaces = newProperties; } - - m_FastMemorySpaces[Count] = fastMemorySpace; - Count++; - } - - #endregion -} - -public class DynamicBiteVariableStack -{ - private DynamicBiteVariable[] m_DynamicVariables = new DynamicBiteVariable[128]; - - public int Count { get; set; } = 0; - - #region Public - - public DynamicBiteVariable Peek() - { - DynamicBiteVariable dynamicVariable = m_DynamicVariables[Count - 1]; - - return dynamicVariable; - } - - public DynamicBiteVariable Peek( int i ) - { - DynamicBiteVariable dynamicVariable = m_DynamicVariables[i]; - - return dynamicVariable; - } - - public DynamicBiteVariable Pop() - { - DynamicBiteVariable dynamicVariable = m_DynamicVariables[--Count]; - - return dynamicVariable; - } - - public void Push( DynamicBiteVariable dynamicVar ) - { - if ( Count >= m_DynamicVariables.Length ) - { - DynamicBiteVariable[] newProperties = new DynamicBiteVariable[m_DynamicVariables.Length * 2]; - Array.Copy( m_DynamicVariables, newProperties, m_DynamicVariables.Length ); - m_DynamicVariables = newProperties; - } - - m_DynamicVariables[Count] = dynamicVar; - - Count++; - } - - #endregion -} - -public class BytecodeList -{ - public List < ByteCode > ByteCodes = new List < ByteCode >(); -} -public class BytecodeListStack -{ - private readonly BytecodeList[] m_BytecodeLists = new BytecodeList[1024]; - - public int Count { get; set; } = 0; - - #region Public - - public BytecodeList Peek() - { - BytecodeList bytecodeList = m_BytecodeLists[Count - 1]; - - return bytecodeList; - } - - public BytecodeList Peek( int i ) - { - BytecodeList bytecodeList = m_BytecodeLists[i]; - - return bytecodeList; - } - - public BytecodeList Pop() - { - BytecodeList bytecodeList = m_BytecodeLists[--Count]; - - return bytecodeList; - } - - public void Push( BytecodeList dynamicVar ) - { - m_BytecodeLists[Count] = dynamicVar; - - if ( Count >= 1023 ) - { - throw new IndexOutOfRangeException( "Stack Overflow" ); - } - - Count++; - } - - #endregion -} - -public class UsingStatementStack -{ - private object[] m_UsedObjects = new object[128]; - - public int Count { get; set; } = 0; - - #region Public - - public void Pop() - { - object usedObject = m_UsedObjects[--Count]; - ( ( IDisposable ) usedObject ).Dispose(); - } - - public void Push( object usedObject ) - { - if ( Count >= m_UsedObjects.Length ) - { - object[] newProperties = new object[m_UsedObjects.Length * 2]; - Array.Copy( m_UsedObjects, newProperties, m_UsedObjects.Length ); - m_UsedObjects = newProperties; - } - - m_UsedObjects[Count] = usedObject; - - if ( Count >= 1023 ) - { - throw new IndexOutOfRangeException( "Using Statement Overflow" ); - } + m_FastMemorySpaces[Count] = fastMemorySpace; Count++; } diff --git a/Bite/Runtime/FastPropertyCache.cs b/Bite/Runtime/FastPropertyCache.cs new file mode 100644 index 0000000..56cdab7 --- /dev/null +++ b/Bite/Runtime/FastPropertyCache.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using Bite.Runtime.Functions.ForeignInterface; + +namespace Bite.Runtime +{ + +public class FastPropertyCache +{ + private static Dictionary < string, IFastPropertyInfo > m_PropertyCache = new Dictionary < string, IFastPropertyInfo >(); + + #region Public + + public static void AddPropertyToCache(string propertyName) + { + string key = $"{typeof(T).FullName}.{propertyName}"; + var type = typeof(T); + var pi = type.GetProperty(propertyName); + var fp = new FastPropertyInfo(pi); + + IFastPropertyInfo fastPropertyInfo = new CachedProperty < T >(fp.GetterDelegate, fp.SetterDelegate); + fastPropertyInfo.PropertyType = pi.PropertyType; + m_PropertyCache.Add( key, fastPropertyInfo ); + } + public bool TryGetProperty( Type type, string propertyName, out IFastPropertyInfo propertyInfo ) + { + string key = $"{type.FullName}.{propertyName}"; + + if ( !m_PropertyCache.TryGetValue( key, out propertyInfo ) ) + { + return false; + } + + return true; + } + + #endregion +} + +} diff --git a/Bite/Runtime/FieldCache.cs b/Bite/Runtime/FieldCache.cs new file mode 100644 index 0000000..addff13 --- /dev/null +++ b/Bite/Runtime/FieldCache.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using Bite.Runtime.Functions.ForeignInterface; + +namespace Bite.Runtime +{ + +public class FieldCache +{ + private static readonly Dictionary < string, FastFieldInfo > m_FieldCache = new Dictionary < string, FastFieldInfo >(); + + #region Public + + public bool TryGetField( Type type, string fieldName, out FastFieldInfo fieldInfo ) + { + string key = $"{type.FullName}.{fieldName}"; + + if ( !m_FieldCache.TryGetValue( key, out fieldInfo ) ) + { + FieldInfo fi = type.GetField( fieldName ); + + if ( fi != null ) + { + FastFieldInfo ffi = new FastFieldInfo( fi ); + m_FieldCache.Add( key, ffi ); + fieldInfo = ffi; + return true; + } + + return false; + } + + return true; + } + + #endregion +} + +} diff --git a/Bite/Runtime/Functions/ForeignInterface/CSharpEvent.cs b/Bite/Runtime/Functions/ForeignInterface/CSharpEvent.cs new file mode 100644 index 0000000..a251e86 --- /dev/null +++ b/Bite/Runtime/Functions/ForeignInterface/CSharpEvent.cs @@ -0,0 +1,44 @@ +using System.Collections.Generic; +using System.Reflection; +using Bite.Runtime.Memory; + +namespace Bite.Runtime.Functions.ForeignInterface +{ + +public class CSharpEvent < V, T, K > : ICSharpEvent +{ + private readonly EventWrapper < V, T, K > m_EventWrapper; + + #region Public + + public CSharpEvent( object obj ) + { + m_EventWrapper = new EventWrapper < V, T, K >( obj ); + } + + public bool TryGetEventInfo( string name, out EventInfo eventInfo ) + { + return m_EventWrapper.TryGetEventInfo( name, out eventInfo ); + } + + public object GetEventHolder() + { + return m_EventWrapper.EventHolder; + } + + public void Invoke( string name, DynamicBiteVariable[] m_FunctionArguments ) + { + m_EventWrapper.Invoke( name, m_FunctionArguments ); + } + + public bool TryAddEventHandler( string name, BiteChunkWrapper eventHandlerFunction, BiteVm biteVm ) + { + return m_EventWrapper.TryAddEventHandler( name, eventHandlerFunction, biteVm ); + } + + + + #endregion +} + +} diff --git a/Bite/Runtime/Functions/ForeignInterface/CachedProperty.cs b/Bite/Runtime/Functions/ForeignInterface/CachedProperty.cs new file mode 100644 index 0000000..6a7b404 --- /dev/null +++ b/Bite/Runtime/Functions/ForeignInterface/CachedProperty.cs @@ -0,0 +1,31 @@ +using System; + +namespace Bite.Runtime.Functions.ForeignInterface +{ + +public class CachedProperty: IFastPropertyInfo +{ + private FastPropertyInfo .ReturnValueDelegate GetterDelegate { get; } + + private FastPropertyInfo .UpdateValueDelegate SetterDelegate { get; } + + public CachedProperty(FastPropertyInfo .ReturnValueDelegate returnValueDelegate, FastPropertyInfo .UpdateValueDelegate updateValueDelegate) + { + GetterDelegate = returnValueDelegate; + SetterDelegate = updateValueDelegate; + } + + public Type PropertyType { get; set; } + + public object InvokeGet( object instance, params object[] arguments ) + { + return GetterDelegate((T)instance, arguments); + } + + public void InvokeSet( object instance, object value, params object[] arguments ) + { + SetterDelegate( ( T ) instance, value, arguments ); + } +} + +} diff --git a/Bite/Runtime/Functions/ForeignInterface/DelegateUtility.cs b/Bite/Runtime/Functions/ForeignInterface/DelegateUtility.cs new file mode 100644 index 0000000..69906f2 --- /dev/null +++ b/Bite/Runtime/Functions/ForeignInterface/DelegateUtility.cs @@ -0,0 +1,48 @@ +using System; + +namespace Bite.Runtime.Functions.ForeignInterface +{ + +public static class DelegateUtility +{ + #region Public + + public static T Cast < T >( Delegate source ) where T : class + { + return Cast( source, typeof( T ) ) as T; + } + + public static Delegate Cast( Delegate source, Type type ) + { + if ( source == null ) + { + return null; + } + + Delegate[] delegates = source.GetInvocationList(); + + if ( delegates.Length == 1 ) + { + return Delegate.CreateDelegate( + type, + delegates[0].Target, + delegates[0].Method ); + } + + Delegate[] delegatesDest = new Delegate[delegates.Length]; + + for ( int nDelegate = 0; nDelegate < delegates.Length; nDelegate++ ) + { + delegatesDest[nDelegate] = Delegate.CreateDelegate( + type, + delegates[nDelegate].Target, + delegates[nDelegate].Method ); + } + + return Delegate.Combine( delegatesDest ); + } + + #endregion +} + +} diff --git a/Bite/Runtime/Functions/ForeignInterface/EventWrapper.cs b/Bite/Runtime/Functions/ForeignInterface/EventWrapper.cs new file mode 100644 index 0000000..a931cdf --- /dev/null +++ b/Bite/Runtime/Functions/ForeignInterface/EventWrapper.cs @@ -0,0 +1,230 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using Bite.Runtime.Memory; + +namespace Bite.Runtime.Functions.ForeignInterface +{ + +public class EventWrapper < V, T, K > +{ + private readonly Dictionary < string, EventInfo > m_EventInfos = new Dictionary < string, EventInfo >(); + + public object EventHolder { get; set; } + + #region Public + + public EventWrapper( object obj ) + { + EventHolder = obj; + EventInfo[] eventInfos = obj.GetType().GetEvents(); + + foreach ( EventInfo eventInfo in eventInfos ) + { + m_EventInfos.Add( eventInfo.Name, eventInfo ); + } + } + + public bool TryAddEventHandler( string name, BiteChunkWrapper eventHandlerFunction, BiteVm biteVm ) + { + if ( m_EventInfos.TryGetValue( name, out EventInfo eventInfo ) ) + { + MethodInfo methodInfo = eventInfo.EventHandlerType.GetMethod( "Invoke" ); + ParameterInfo[] parameterInfos = methodInfo.GetParameters(); + + if ( parameterInfos.Length == 0 ) + { + if ( methodInfo.ReturnParameter != null ) + { + Func < object > action = delegate + { + DynamicBiteVariable[] dynamicBiteVariables = new DynamicBiteVariable[0]; + + BiteFunctionCall biteFunctionCall = new BiteFunctionCall( + eventHandlerFunction, + dynamicBiteVariables ); + + biteVm.CallBiteFunction( biteFunctionCall ); + + return null; + }; + + Delegate del = action; + eventInfo.AddEventHandler( EventHolder, DelegateUtility.Cast( del, typeof( V ) ) ); + } + else + { + Action action = delegate + { + DynamicBiteVariable[] dynamicBiteVariables = new DynamicBiteVariable[0]; + + BiteFunctionCall biteFunctionCall = new BiteFunctionCall( + eventHandlerFunction, + dynamicBiteVariables ); + + biteVm.CallBiteFunction( biteFunctionCall ); + }; + + Delegate del = action; + eventInfo.AddEventHandler( EventHolder, DelegateUtility.Cast( del, typeof( V ) ) ); + } + } + else if ( parameterInfos.Length == 1 ) + { + if ( methodInfo.ReturnParameter != null ) + { + Func < T, object > action = delegate( T arg1 ) + { + DynamicBiteVariable[] dynamicBiteVariables = new DynamicBiteVariable[1]; + + dynamicBiteVariables[0] = DynamicVariableExtension.ToDynamicVariable( arg1 ); + + BiteFunctionCall biteFunctionCall = new BiteFunctionCall( + eventHandlerFunction, + dynamicBiteVariables ); + + biteVm.CallBiteFunction( biteFunctionCall ); + + return null; + }; + + Delegate del = action; + eventInfo.AddEventHandler( EventHolder, DelegateUtility.Cast( del, typeof( V ) ) ); + } + else + { + Action < T > action = delegate( T arg1 ) + { + DynamicBiteVariable[] dynamicBiteVariables = new DynamicBiteVariable[1]; + + dynamicBiteVariables[0] = DynamicVariableExtension.ToDynamicVariable( arg1 ); + + BiteFunctionCall biteFunctionCall = new BiteFunctionCall( + eventHandlerFunction, + dynamicBiteVariables ); + + biteVm.CallBiteFunction( biteFunctionCall ); + }; + + Delegate del = action; + eventInfo.AddEventHandler( EventHolder, DelegateUtility.Cast( del, typeof( V ) ) ); + } + } + else if ( parameterInfos.Length == 2 ) + { + if ( methodInfo.ReturnParameter != null ) + { + Func < T, K, object > action = delegate( T arg1, K k ) + { + DynamicBiteVariable[] dynamicBiteVariables = new DynamicBiteVariable[2]; + + dynamicBiteVariables[0] = DynamicVariableExtension.ToDynamicVariable( arg1 ); + dynamicBiteVariables[1] = DynamicVariableExtension.ToDynamicVariable( k ); + + BiteFunctionCall biteFunctionCall = new BiteFunctionCall( + eventHandlerFunction, + dynamicBiteVariables ); + + biteVm.CallBiteFunction( biteFunctionCall ); + + return null; + }; + + Delegate del = action; + eventInfo.AddEventHandler( EventHolder, DelegateUtility.Cast( del, typeof( V ) ) ); + } + else + { + Action < T, K > action = delegate( T arg1, K k ) + { + DynamicBiteVariable[] dynamicBiteVariables = new DynamicBiteVariable[2]; + + dynamicBiteVariables[0] = DynamicVariableExtension.ToDynamicVariable( arg1 ); + dynamicBiteVariables[1] = DynamicVariableExtension.ToDynamicVariable( k ); + + BiteFunctionCall biteFunctionCall = new BiteFunctionCall( + eventHandlerFunction, + dynamicBiteVariables ); + + biteVm.CallBiteFunction( biteFunctionCall ); + }; + + Delegate del = action; + eventInfo.AddEventHandler( EventHolder, DelegateUtility.Cast( del, typeof( V ) ) ); + } + } + else + { + return false; + } + + return true; + } + + return false; + } + + public bool TryGetEventInfo( string name, out EventInfo eventInfo ) + { + return m_EventInfos.TryGetValue( name, out eventInfo ); + } + + public void Invoke( string name, DynamicBiteVariable[] functionArguments ) + { + if ( m_EventInfos.TryGetValue( name, out EventInfo eventInfo ) ) + { + MethodInfo methodInfo = eventInfo.EventHandlerType.GetMethod( "Invoke" ); + ParameterInfo[] parameterInfos = methodInfo.GetParameters(); + + if ( functionArguments.Length != parameterInfos.Length ) + { + return; + } + else + { + object[] eventArgs = new object[functionArguments.Length]; + + for ( int i = 0; i < functionArguments.Length; i++ ) + { + object arg = functionArguments[i].ToObject(); + + if ( arg is FastClassMemorySpace ) + { + eventArgs[i] = arg; + } + else + { + eventArgs[i] = Convert.ChangeType( arg, parameterInfos[i].ParameterType ); + } + + } + + RaiseEventViaReflection( EventHolder, name, eventArgs ); + return; + } + } + } + + private void RaiseEventViaReflection(object source, string eventName, object[] eventArgs) + { + if ( source != null ) + { + ((Delegate)source + .GetType() + .GetField(eventName, BindingFlags.Instance | BindingFlags.NonPublic) + .GetValue(source)) + .DynamicInvoke(eventArgs); + } + } + private void RaiseEventViaReflection(object source, string eventName) + { + ((Delegate)source + .GetType() + .GetField(eventName, BindingFlags.Instance | BindingFlags.NonPublic) + .GetValue(source)) + .DynamicInvoke(source, EventArgs.Empty); + } + #endregion +} + +} diff --git a/Bite/Runtime/Functions/ForeignInterface/FastFieldInfo.cs b/Bite/Runtime/Functions/ForeignInterface/FastFieldInfo.cs new file mode 100644 index 0000000..8a3cb9c --- /dev/null +++ b/Bite/Runtime/Functions/ForeignInterface/FastFieldInfo.cs @@ -0,0 +1,67 @@ +using System; +using System.Linq.Expressions; +using System.Reflection; + +namespace Bite.Runtime.Functions.ForeignInterface +{ + +public class FastFieldInfo +{ + private delegate object ReturnValueDelegate( object instance ); + + private delegate void UpdateValueDelegate( object instance, object value ); + + private UpdateValueDelegate SetDelegate { get; } + + private ReturnValueDelegate Delegate { get; } + + #region Public + + public FastFieldInfo( FieldInfo propertyInfo ) + { + ParameterExpression instanceExpression = Expression.Parameter( typeof( object ), "instance" ); + ParameterExpression valueExpression = Expression.Parameter( typeof( object ), "value" ); + + MemberExpression callExpression = Expression.Field( + !propertyInfo.IsStatic ? propertyInfo.ReflectedType.IsValueType + ? Expression.Unbox(instanceExpression, propertyInfo.ReflectedType) + : Expression.Convert(instanceExpression, propertyInfo.ReflectedType) : null, + propertyInfo ); + + Delegate = Expression.Lambda < ReturnValueDelegate >( + Expression.Convert( callExpression, typeof( object ) ), + instanceExpression ). + Compile(); + + if ( !propertyInfo.ReflectedType.IsEnum ) + { + BinaryExpression assignExpression = Expression.Assign( + callExpression, + Expression.Convert( valueExpression, propertyInfo.FieldType ) ); + + SetDelegate = Expression.Lambda < UpdateValueDelegate >( + assignExpression, + instanceExpression, + valueExpression ). + Compile(); + } + + + FieldType = propertyInfo.FieldType; + } + + public Type FieldType { get; set; } + public object GetField( object instance ) + { + return Delegate( instance ); + } + + public void SetField( object instance, object value ) + { + SetDelegate( instance, value ); + } + + #endregion +} + +} diff --git a/Bite/Runtime/Functions/ForeignInterface/FastPropertyInfo.cs b/Bite/Runtime/Functions/ForeignInterface/FastPropertyInfo.cs new file mode 100644 index 0000000..ea10a01 --- /dev/null +++ b/Bite/Runtime/Functions/ForeignInterface/FastPropertyInfo.cs @@ -0,0 +1,74 @@ +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Reflection; + +namespace Bite.Runtime.Functions.ForeignInterface +{ + +public class FastPropertyInfo < T > +{ + public delegate object ReturnValueDelegate( T instance, object[] arguments ); + + public delegate void UpdateValueDelegate( T instance, object value, object[] arguments ); + + public ReturnValueDelegate GetterDelegate { get; } + + public UpdateValueDelegate SetterDelegate { get; } + + #region Public + + public FastPropertyInfo( PropertyInfo propertyInfo ) + { + ParameterExpression instanceExpression = Expression.Parameter( typeof( T ), "instance" ); + ParameterExpression valueExpression = Expression.Parameter( typeof( object ), "value" ); + ParameterExpression argumentsExpression = Expression.Parameter( typeof( object[] ), "arguments" ); + List < Expression > argumentExpressions = new List < Expression >(); + ParameterInfo[] parameterInfos = propertyInfo.GetIndexParameters(); + + for ( int i = 0; i < parameterInfos.Length; ++i ) + { + ParameterInfo parameterInfo = parameterInfos[i]; + + argumentExpressions.Add( + Expression.Convert( + Expression.ArrayIndex( argumentsExpression, Expression.Constant( i ) ), + parameterInfo.ParameterType ) ); + } + + IndexExpression callExpression = Expression.Property( + instanceExpression, + propertyInfo, + argumentExpressions ); + + BinaryExpression assignExpression = Expression.Assign( + callExpression, + Expression.Convert( valueExpression, propertyInfo.PropertyType ) ); + + GetterDelegate = Expression.Lambda < ReturnValueDelegate >( + Expression.Convert( callExpression, typeof( object ) ), + instanceExpression, + argumentsExpression ). + Compile(); + + SetterDelegate = Expression.Lambda < UpdateValueDelegate >( + assignExpression, + instanceExpression, + valueExpression, + argumentsExpression ). + Compile(); + } + + public object InvokeGet( object instance, params object[] arguments ) + { + return GetterDelegate( ( T ) instance, arguments ); + } + + public void InvokeSet( object instance, object value, params object[] arguments ) + { + SetterDelegate( ( T ) instance, value, arguments ); + } + + #endregion +} + +} diff --git a/Bite/Runtime/Functions/ForeignInterface/ForeignLibraryInterfaceVm.cs b/Bite/Runtime/Functions/ForeignInterface/ForeignLibraryInterfaceVm.cs index 24f8639..7251131 100644 --- a/Bite/Runtime/Functions/ForeignInterface/ForeignLibraryInterfaceVm.cs +++ b/Bite/Runtime/Functions/ForeignInterface/ForeignLibraryInterfaceVm.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Reflection; using Bite.Runtime.Memory; @@ -8,19 +9,52 @@ namespace Bite.Runtime.Functions.ForeignInterface public class ForeignLibraryInterfaceVm : IBiteVmCallable { + private readonly TypeRegistry m_TypeRegistry; + + private MethodCache m_MethodCache = new MethodCache(); + #region Public - public object Call( List < DynamicBiteVariable > arguments ) + public ForeignLibraryInterfaceVm() { - if ( arguments.Count > 0 ) + m_TypeRegistry = new TypeRegistry(); + } + + public ForeignLibraryInterfaceVm( TypeRegistry typeRegistry ) + { + m_TypeRegistry = typeRegistry; + } + + public object Call( DynamicBiteVariable[] arguments ) + { + if ( arguments.Length > 0 ) { - if ( arguments[0].ObjectData is FastMemorySpace fliObject ) + if ( arguments.Length == 1 && + arguments[0].DynamicType == DynamicVariableType.Object && + arguments[0].ObjectData is FastMemorySpace fliObject ) { string typeString = fliObject.Get( "Type" ).StringData; if ( !string.IsNullOrEmpty( typeString ) ) { - Type type = Type.GetType( typeString ); + Type type = ResolveType( typeString ); + + if ( type == null ) + { + throw new BiteVmRuntimeException( + $"Runtime Error: Type: {typeString} not registered as a type!" ); + } + + DynamicBiteVariable returnClassBool = fliObject.Get( "ReturnClass" ); + + if ( returnClassBool.DynamicType == DynamicVariableType.True ) + { + StaticWrapper wrapper = new StaticWrapper( type ); + fliObject.Put( "ObjectInstance", DynamicVariableExtension.ToDynamicVariable( wrapper ) ); + + return wrapper; + } + DynamicBiteVariable methodString = fliObject.Get( "Method" ); if ( methodString.DynamicType == DynamicVariableType.String && @@ -36,7 +70,10 @@ public object Call( List < DynamicBiteVariable > arguments ) } } - MethodInfo method = type.GetMethod( methodString.StringData, argTypes.ToArray() ); + MethodInfo method = m_TypeRegistry.GetMethod( + type, + methodString.StringData, + argTypes.ToArray() ); if ( method != null && method.IsStatic ) { @@ -99,7 +136,10 @@ public object Call( List < DynamicBiteVariable > arguments ) } } - ConstructorInfo constructor = type.GetConstructor( constructorArgTypes.ToArray() ); + ConstructorInfo constructor = m_TypeRegistry.GetConstructor( + type, + constructorArgTypes.ToArray() ); + object classObject = constructor.Invoke( constructorArgs.ToArray() ); fliObject.Put( @@ -125,7 +165,10 @@ public object Call( List < DynamicBiteVariable > arguments ) if ( type.IsSealed && type.IsAbstract ) { StaticWrapper wrapper = new StaticWrapper( type ); - fliObject.Put( "ObjectInstance", DynamicVariableExtension.ToDynamicVariable( wrapper ) ); + + fliObject.Put( + "ObjectInstance", + DynamicVariableExtension.ToDynamicVariable( wrapper ) ); return wrapper; } @@ -157,7 +200,7 @@ public object Call( List < DynamicBiteVariable > arguments ) if ( constructorArgs.Count == 0 ) { - ConstructorInfo constructor = type.GetConstructor( Type.EmptyTypes ); + ConstructorInfo constructor = m_TypeRegistry.GetConstructor( type ); object classObject = constructor.Invoke( new object[] { } ); fliObject.Put( @@ -168,7 +211,10 @@ public object Call( List < DynamicBiteVariable > arguments ) } else { - ConstructorInfo constructor = type.GetConstructor( constructorArgTypes.ToArray() ); + ConstructorInfo constructor = m_TypeRegistry.GetConstructor( + type, + constructorArgTypes.ToArray() ); + object classObject = constructor.Invoke( constructorArgs.ToArray() ); fliObject.Put( @@ -197,15 +243,16 @@ public object Call( List < DynamicBiteVariable > arguments ) FastMemorySpace constructorArgumentsTypes = ( FastMemorySpace ) fliObject.Get( "ConstructorArgumentsTypes" ).ObjectData; - if ( constructorArguments != null && constructorArguments.NamesToProperties.Count > 0 ) + if ( constructorArguments != null && constructorArguments.NamesToProperties.Count > 0 ) { - foreach ( KeyValuePair < string, DynamicBiteVariable > constructorArgumentsNamesToProperty + foreach ( KeyValuePair < string, DynamicBiteVariable > + constructorArgumentsNamesToProperty in constructorArgumentsTypes.NamesToProperties ) { if ( constructorArgumentsNamesToProperty.Key != "this" ) { constructorArgTypes.Add( - Type.GetType( constructorArgumentsNamesToProperty.Value.StringData ) ); + ResolveType( constructorArgumentsNamesToProperty.Value.StringData ) ); } } } @@ -216,7 +263,8 @@ public object Call( List < DynamicBiteVariable > arguments ) { int i = 0; - foreach ( KeyValuePair < string, DynamicBiteVariable > constructorArgumentsNamesToProperty + foreach ( KeyValuePair < string, DynamicBiteVariable > + constructorArgumentsNamesToProperty in constructorArguments.NamesToProperties ) { if ( constructorArgumentsNamesToProperty.Key != "this" ) @@ -233,7 +281,7 @@ public object Call( List < DynamicBiteVariable > arguments ) if ( constructorArgs.Count == 0 ) { - ConstructorInfo constructor = type.GetConstructor( Type.EmptyTypes ); + ConstructorInfo constructor = m_TypeRegistry.GetConstructor( type ); object classObject = constructor.Invoke( new object[] { } ); fliObject.Put( @@ -244,7 +292,9 @@ public object Call( List < DynamicBiteVariable > arguments ) } else { - ConstructorInfo constructor = type.GetConstructor( constructorArgTypes.ToArray() ); + ConstructorInfo constructor = m_TypeRegistry.GetConstructor( + type, + constructorArgTypes.ToArray() ); object classObject = constructor.Invoke( constructorArgs.ToArray() ); @@ -257,6 +307,149 @@ public object Call( List < DynamicBiteVariable > arguments ) } } } + else if ( arguments.Length == 1 && arguments[0].DynamicType == DynamicVariableType.String ) + { + Type type = ResolveType( arguments[0].StringData ); + + if ( type == null ) + { + throw new BiteVmRuntimeException( + $"Runtime Error: Type: {arguments[0].StringData} not registered as a type!" ); + } + + StaticWrapper wrapper = new StaticWrapper( type ); + + return wrapper; + } + else if ( arguments.Length == 2 && + arguments[0].DynamicType == DynamicVariableType.String && + arguments[1].DynamicType == DynamicVariableType.String ) + { + Type type = ResolveType( arguments[0].StringData ); + + if ( type == null ) + { + throw new BiteVmRuntimeException( + $"Runtime Error: Type: {arguments[0].StringData} not registered as a type!" ); + } + + MemberInfo[] memberInfo = + type.GetMember( arguments[1].StringData, BindingFlags.Public | BindingFlags.Static ); + + if ( memberInfo.Length > 0 ) + { + object obj = GetValue( memberInfo[0], null ); + + return obj; + } + } + else if ( arguments.Length == 2 && + arguments[0].DynamicType == DynamicVariableType.String && + arguments[1].DynamicType == DynamicVariableType.True ) + { + Type type = ResolveType( arguments[0].StringData ); + + if ( type == null ) + { + throw new BiteVmRuntimeException( + $"Runtime Error: Type: {arguments[0].StringData} not registered as a type!" ); + } + + ConstructorInfo constructorInfo = m_TypeRegistry.GetConstructor( type ); + object classObject = constructorInfo.Invoke( new object[] { } ); + + return classObject; + } + else if ( arguments.Length > 2 && + arguments[0].DynamicType == DynamicVariableType.String && + arguments[1].DynamicType == DynamicVariableType.True ) + { + Type type = ResolveType( arguments[0].StringData ); + + if ( type == null ) + { + throw new BiteVmRuntimeException( + $"Runtime Error: Type: {arguments[0].StringData} not registered as a type!" ); + } + + Type[] constructorArgTypes = new Type[( arguments.Length - 2 ) / 2]; + object[] constructorArgs = new object[( arguments.Length - 2 ) / 2]; + + int counter = 0; + + for ( int i = 2; i < arguments.Length; i += 2 ) + { + if ( arguments[i + 1].DynamicType == DynamicVariableType.String ) + { + Type argType = ResolveType( arguments[i + 1].StringData ); + + if ( argType == null ) + { + throw new BiteVmRuntimeException( + $"Runtime Error: Type: {arguments[0].StringData} not registered as a type!" ); + } + + constructorArgTypes[counter] = argType; + + constructorArgs[counter] = Convert.ChangeType( + arguments[i].ToObject(), + argType ); + + } + + counter++; + } + + ConstructorInfo constructorInfo = m_TypeRegistry.GetConstructor( type, constructorArgTypes ); + object classObject = constructorInfo.Invoke( constructorArgs ); + + return classObject; + } + else if ( arguments.Length > 2 && + arguments[0].DynamicType == DynamicVariableType.Object && + arguments[1].DynamicType == DynamicVariableType.String ) + { + object obj = arguments[0].ToObject(); + Type type = obj.GetType(); + + Type[] argTypes = new Type[( arguments.Length - 2 ) / 2]; + object[] args = new object[( arguments.Length - 2 ) / 2]; + + int counter = 0; + + for ( int i = 2; i < arguments.Length; i += 2 ) + { + if ( arguments[i + 1].DynamicType == DynamicVariableType.String ) + { + Type argType = ResolveType( arguments[i + 1].StringData ); + + if ( argType == null ) + { + throw new BiteVmRuntimeException( + $"Runtime Error: Type: {arguments[0].StringData} not registered as a type!" ); + } + + argTypes[counter] = argType; + + args[counter] = Convert.ChangeType( + arguments[i].ToObject(), + argType ); + + } + + counter++; + } + + if ( m_MethodCache.TryGetMethod( + type, + argTypes, + arguments[1].StringData, + out FastMethodInfo fastMethodInfo ) ) + { + return fastMethodInfo.Invoke( obj, args ); + } + } + return null; } @@ -264,6 +457,31 @@ public object Call( List < DynamicBiteVariable > arguments ) return null; } + public Type ResolveType( string name ) + { + if ( m_TypeRegistry == null || !m_TypeRegistry.TryResolveType( name, out Type type ) ) + { + type = Type.GetType( name ); + } + + return type; + } + + public static object GetValue( MemberInfo memberInfo, object forObject ) + { + switch ( memberInfo.MemberType ) + { + case MemberTypes.Field: + return ( ( FieldInfo ) memberInfo ).GetValue( forObject ); + + case MemberTypes.Property: + return ( ( PropertyInfo ) memberInfo ).GetValue( forObject ); + + default: + throw new NotImplementedException(); + } + } + #endregion } diff --git a/Bite/Runtime/Functions/ForeignInterface/ICSharpEvent.cs b/Bite/Runtime/Functions/ForeignInterface/ICSharpEvent.cs new file mode 100644 index 0000000..1a4b6a0 --- /dev/null +++ b/Bite/Runtime/Functions/ForeignInterface/ICSharpEvent.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Reflection; +using Bite.Runtime.Memory; + +namespace Bite.Runtime.Functions.ForeignInterface +{ + +public interface ICSharpEvent +{ + bool TryGetEventInfo( string name, out EventInfo eventInfo ); + object GetEventHolder(); + void Invoke( string name, DynamicBiteVariable[] m_FunctionArguments ); + bool TryAddEventHandler( string name, BiteChunkWrapper eventHandlerFunction, BiteVm biteVm ); +} + +} diff --git a/Bite/Runtime/Functions/ForeignInterface/IFastPropertyInfo.cs b/Bite/Runtime/Functions/ForeignInterface/IFastPropertyInfo.cs new file mode 100644 index 0000000..05dddc0 --- /dev/null +++ b/Bite/Runtime/Functions/ForeignInterface/IFastPropertyInfo.cs @@ -0,0 +1,14 @@ +using System; + +namespace Bite.Runtime.Functions.ForeignInterface +{ + +public interface IFastPropertyInfo +{ + Type PropertyType { get; set; } + object InvokeGet( object instance, params object[] arguments ); + + void InvokeSet( object instance, object value, params object[] arguments ); +} + +} diff --git a/Bite/Runtime/Functions/ForeignInterface/InteropBase.cs b/Bite/Runtime/Functions/ForeignInterface/InteropBase.cs new file mode 100644 index 0000000..fdf56a5 --- /dev/null +++ b/Bite/Runtime/Functions/ForeignInterface/InteropBase.cs @@ -0,0 +1,33 @@ +using System; + +namespace Bite.Runtime.Functions.ForeignInterface +{ + +public abstract class InteropBase +{ + protected readonly TypeRegistry m_TypeRegistry; + + protected InteropBase() + { + m_TypeRegistry = new TypeRegistry(); + } + + protected InteropBase( TypeRegistry typeRegistry ) + { + m_TypeRegistry = typeRegistry; + } + + + public Type ResolveType( string name ) + { + if (m_TypeRegistry == null || !m_TypeRegistry.TryResolveType( name, out Type type )) + { + type = Type.GetType( name ); + } + + return type; + } + +} + +} \ No newline at end of file diff --git a/Bite/Runtime/Functions/ForeignInterface/StaticWrapper.cs b/Bite/Runtime/Functions/ForeignInterface/StaticWrapper.cs index e51fa42..8aeb341 100644 --- a/Bite/Runtime/Functions/ForeignInterface/StaticWrapper.cs +++ b/Bite/Runtime/Functions/ForeignInterface/StaticWrapper.cs @@ -7,21 +7,23 @@ namespace Bite.Runtime.Functions.ForeignInterface public class StaticWrapper { - private readonly Type _type; - private readonly Dictionary < string, FastMethodInfo > CachedMethods = new Dictionary < string, FastMethodInfo >(); + private readonly Dictionary < string, FastMethodInfo > CachedStaticMethods = + new Dictionary < string, FastMethodInfo >(); + + public Type StaticWrapperType { get; } #region Public public StaticWrapper( Type type ) { - _type = type; + StaticWrapperType = type; } public object InvokeMember( string name, object[] args, Type[] argsTypes ) { - if ( !CachedMethods.ContainsKey( name ) ) + if ( !CachedStaticMethods.ContainsKey( name ) ) { - MethodInfo method = _type.GetMethod( + MethodInfo method = StaticWrapperType.GetMethod( name, BindingFlags.Static | BindingFlags.Public, null, @@ -30,12 +32,12 @@ public object InvokeMember( string name, object[] args, Type[] argsTypes ) FastMethodInfo fastMethodInfo = new FastMethodInfo( method ); - CachedMethods.Add( name, fastMethodInfo ); + CachedStaticMethods.Add( name, fastMethodInfo ); return fastMethodInfo.Invoke( null, args ); } - return CachedMethods[name].Invoke( null, args ); + return CachedStaticMethods[name].Invoke( null, args ); } #endregion diff --git a/Bite/Runtime/Functions/ForeignInterface/TypeRegistry.cs b/Bite/Runtime/Functions/ForeignInterface/TypeRegistry.cs new file mode 100644 index 0000000..18b2e88 --- /dev/null +++ b/Bite/Runtime/Functions/ForeignInterface/TypeRegistry.cs @@ -0,0 +1,185 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +namespace Bite.Runtime.Functions.ForeignInterface +{ + +public class TypeRegistry +{ + private readonly Dictionary < string, Type > m_RegisteredTypes = new Dictionary < string, Type >(); + + private readonly Dictionary < string, MethodInfo > m_MethodCache = new Dictionary < string, MethodInfo >(); + + private readonly Dictionary < string, ConstructorInfo > m_ConstructorCache = + new Dictionary < string, ConstructorInfo >(); + + #region Public + + public TypeRegistry() + { + RegisterDefaultTypes(); + } + + public ConstructorInfo GetConstructor( Type type ) + { + string key = $"{type.FullName}.ctor()"; + + if ( !m_ConstructorCache.TryGetValue( key, out ConstructorInfo constructorInfo ) ) + { + constructorInfo = type.GetConstructor( Type.EmptyTypes ); + m_ConstructorCache.Add( key, constructorInfo ); + } + + return constructorInfo; + } + + public ConstructorInfo GetConstructor( Type type, Type[] argTypes ) + { + string key = $"{type.FullName}.ctor({GetArgTypeNames( argTypes )})"; + + if ( !m_ConstructorCache.TryGetValue( key, out ConstructorInfo constructorInfo ) ) + { + constructorInfo = type.GetConstructor( argTypes ); + m_ConstructorCache.Add( key, constructorInfo ); + } + + return constructorInfo; + } + + public MethodInfo GetMethod( Type type, string methodName, Type[] argTypes ) + { + string key = $"{type.FullName}.{methodName}({GetArgTypeNames( argTypes )})"; + + if ( !m_MethodCache.TryGetValue( key, out MethodInfo methodInfo ) ) + { + methodInfo = type.GetMethod( methodName, argTypes ); + m_MethodCache.Add( key, methodInfo ); + } + + return methodInfo; + } + + public MethodInfo GetStaticMethod( Type type, string methodName, Type[] argTypes ) + { + string key = $"{type.FullName}.${methodName}({GetArgTypeNames( argTypes )})"; + + if (!m_MethodCache.TryGetValue( key, out MethodInfo methodInfo )) + { + methodInfo = type.GetMethod( methodName, BindingFlags.Static | BindingFlags.Public, null, argTypes, null ); + m_MethodCache.Add( key, methodInfo ); + } + + return methodInfo; + } + + public void RegisterAssemblyTypes( Assembly assembly, Func < Type, bool > filter = null ) + { + IEnumerable < Type > types = assembly.GetTypes().AsEnumerable(); + + if ( filter != null ) + { + types = types.Where( filter ); + } + + foreach ( Type type in types ) + { + m_RegisteredTypes.Add( type.Name, type ); + } + } + + /// + /// Registers the type using the specified type's Name + /// + /// + /// + public void RegisterType < T >( string alias ) + { + m_RegisteredTypes.Add( alias, typeof( T ) ); + } + + /// + /// Registers the type using the specified type's Name + /// + /// + public void RegisterType < T >() + { + Type type = typeof( T ); + m_RegisteredTypes.Add( type.Name, type ); + } + + + /// + /// Registers the type using the specified alias + /// + /// + /// + public void RegisterType( Type type, string alias ) + { + m_RegisteredTypes.Add( alias, type ); + } + + /// + /// Registers the type using the specified type's Name + /// + /// + public void RegisterType( Type type ) + { + m_RegisteredTypes.Add( type.Name, type ); + } + + /// + /// Registers the types using the specified type's Name + /// + /// + public void RegisterTypes( IEnumerable < Type > types ) + { + foreach ( Type type in types ) + { + m_RegisteredTypes.Add( type.Name, type ); + } + } + + public bool TryResolveType( string name, out Type type ) + { + return m_RegisteredTypes.TryGetValue( name, out type ); + } + + #endregion + + #region Private + + private string GetArgTypeNames( Type[] argTypes ) + { + // if (argTypes == null || argTypes.Length == 0) return ""; + + string[] argTypeNames = new string[argTypes.Length]; + + for ( int i = 0; i < argTypes.Length; i++ ) + { + argTypeNames[i] = argTypes[i].FullName; + } + + return string.Join( ",", argTypeNames ); + } + + private void RegisterDefaultTypes() + { + m_RegisteredTypes.Add( "bool", typeof( bool ) ); + m_RegisteredTypes.Add( "byte", typeof( byte ) ); + m_RegisteredTypes.Add( "ushort", typeof( ushort ) ); + m_RegisteredTypes.Add( "short", typeof( short ) ); + m_RegisteredTypes.Add( "uint", typeof( uint ) ); + m_RegisteredTypes.Add( "int", typeof( int ) ); + m_RegisteredTypes.Add( "ulong", typeof( ulong ) ); + m_RegisteredTypes.Add( "long", typeof( long ) ); + m_RegisteredTypes.Add( "float", typeof( float ) ); + m_RegisteredTypes.Add( "double", typeof( double ) ); + m_RegisteredTypes.Add( "string", typeof( string ) ); + } + + #endregion +} + +} diff --git a/Bite/Runtime/Functions/IBiteVmCallable.cs b/Bite/Runtime/Functions/IBiteVmCallable.cs index 6410380..22c6465 100644 --- a/Bite/Runtime/Functions/IBiteVmCallable.cs +++ b/Bite/Runtime/Functions/IBiteVmCallable.cs @@ -6,7 +6,7 @@ namespace Bite.Runtime.Functions public interface IBiteVmCallable { - object Call( List < DynamicBiteVariable > arguments ); + object Call( DynamicBiteVariable[] arguments ); } } diff --git a/Bite/Runtime/Functions/Interop/ConstructorInvoker.cs b/Bite/Runtime/Functions/Interop/ConstructorInvoker.cs new file mode 100644 index 0000000..5ba7fad --- /dev/null +++ b/Bite/Runtime/Functions/Interop/ConstructorInvoker.cs @@ -0,0 +1,45 @@ +using System; +using System.Reflection; +using Bite.Runtime.Memory; + +namespace Bite.Runtime.Functions.Interop +{ + +public class ConstructorInvoker : IBiteVmCallable +{ + private ConstructorInfo m_ConstructorInfo; + private Type[] m_ArgTypes; + + + public ConstructorInvoker( ConstructorInfo constructorInfo ) + { + m_ConstructorInfo = constructorInfo; + ParameterInfo[] parameterInfos = m_ConstructorInfo.GetParameters(); + m_ArgTypes = new Type[parameterInfos.Length]; + + for ( var i = 0; i < parameterInfos.Length; i++ ) + { + m_ArgTypes[i] = parameterInfos[i].ParameterType; + } + } + + public object Call( DynamicBiteVariable[] arguments ) + { + object[] constructorArgs = new object[arguments.Length]; + + for ( int i = 0; i < arguments.Length; i++ ) + { + constructorArgs[i] = Convert.ChangeType( + arguments[i].ToObject(), + m_ArgTypes[i] ); + + } + + object classObject = m_ConstructorInfo.Invoke( constructorArgs ); + + return classObject; + } + +} + +} \ No newline at end of file diff --git a/Bite/Runtime/Functions/Interop/GenericMethodInvoker.cs b/Bite/Runtime/Functions/Interop/GenericMethodInvoker.cs new file mode 100644 index 0000000..69cc302 --- /dev/null +++ b/Bite/Runtime/Functions/Interop/GenericMethodInvoker.cs @@ -0,0 +1,53 @@ +using System; +using System.Reflection; +using Bite.Runtime.Functions.ForeignInterface; +using Bite.Runtime.Memory; + +namespace Bite.Runtime.Functions.Interop +{ + +public class GenericMethodInvoker : IBiteVmCallable +{ + private Type[] m_ArgTypes; + + private MethodInfo m_OriginalMethodInfo; + + public GenericMethodInvoker( MethodInfo methodInfo ) + { + OriginalMethodInfo = methodInfo; + + ParameterInfo[] parameterInfos = methodInfo.GetParameters(); + m_ArgTypes = new Type[parameterInfos.Length]; + + for (var i = 0; i < parameterInfos.Length; i++) + { + m_ArgTypes[i] = parameterInfos[i].ParameterType; + } + } + + public MethodInfo OriginalMethodInfo + { + get => m_OriginalMethodInfo; + private set => m_OriginalMethodInfo = value; + } + + public object Call( DynamicBiteVariable[] arguments ) + { + object[] constructorArgs = new object[arguments.Length - 1]; + + for (int i = 1; i < arguments.Length; i++) + { + constructorArgs[i - 1] = Convert.ChangeType( + arguments[i].ToObject(), + m_ArgTypes[i - 1] ); + + } + + object value = OriginalMethodInfo.Invoke( arguments[0].ToObject(), constructorArgs ); + + return value; + } + +} + +} diff --git a/Bite/Runtime/Functions/Interop/InteropGetConstructor.cs b/Bite/Runtime/Functions/Interop/InteropGetConstructor.cs new file mode 100644 index 0000000..842681f --- /dev/null +++ b/Bite/Runtime/Functions/Interop/InteropGetConstructor.cs @@ -0,0 +1,68 @@ +using System; +using System.Reflection; +using Bite.Runtime.Functions.ForeignInterface; +using Bite.Runtime.Memory; + +namespace Bite.Runtime.Functions.Interop +{ + +public class InteropGetConstructor : InteropBase, IBiteVmCallable + { + + #region Public + + public InteropGetConstructor() + { + } + + public InteropGetConstructor( TypeRegistry typeRegistry ) : base( typeRegistry ) + { + } + + public object Call( DynamicBiteVariable[] arguments ) + { + Type type = ResolveType( arguments[0].StringData ); + + if ( type == null ) + { + throw new BiteVmRuntimeException( + $"Runtime Error: Type: {arguments[0].StringData} not registered as a type!" ); + } + + Type[] constructorArgTypes = new Type[arguments.Length - 1]; + + int counter = 0; + + for ( int i = 1; i < arguments.Length; i++ ) + { + if ( arguments[i].DynamicType == DynamicVariableType.String ) + { + Type argType = ResolveType( arguments[i].StringData ); + + if ( argType == null ) + { + throw new BiteVmRuntimeException( + $"Runtime Error: Type: {arguments[i].StringData} not registered as a type!" ); + } + + constructorArgTypes[counter] = argType; + + } + else + { + throw new BiteVmRuntimeException( "Expected string" ); + } + + counter++; + } + + ConstructorInfo constructorInfo = m_TypeRegistry.GetConstructor( type, constructorArgTypes ); + + return new ConstructorInvoker( constructorInfo ); + } + + + #endregion +} + +} \ No newline at end of file diff --git a/Bite/Runtime/Functions/Interop/InteropGetGenericMethod.cs b/Bite/Runtime/Functions/Interop/InteropGetGenericMethod.cs new file mode 100644 index 0000000..c17cc79 --- /dev/null +++ b/Bite/Runtime/Functions/Interop/InteropGetGenericMethod.cs @@ -0,0 +1,61 @@ +using System; +using System.Reflection; +using Bite.Runtime.Functions.ForeignInterface; +using Bite.Runtime.Memory; + +namespace Bite.Runtime.Functions.Interop +{ + +public class InteropGetGenericMethod : InteropBase, IBiteVmCallable +{ + public InteropGetGenericMethod() + { + } + + public InteropGetGenericMethod( TypeRegistry typeRegistry ) : base( typeRegistry ) + { + } + + public object Call( DynamicBiteVariable[] arguments ) + { + if ( arguments[0].ObjectData is MethodInfo methodInvoker ) + { + Type[] methodArgTypes = new Type[arguments.Length - 1]; + + int counter = 0; + + for (int i = 1; i < arguments.Length; i++) + { + if (arguments[i].DynamicType == DynamicVariableType.String) + { + Type argType = ResolveType( arguments[i].StringData ); + + if (argType == null) + { + throw new BiteVmRuntimeException( + $"Runtime Error: Type: {arguments[i].StringData} not registered as a type!" ); + } + + methodArgTypes[counter] = argType; + + } + else + { + throw new BiteVmRuntimeException( "Expected string" ); + } + + counter++; + } + + MethodInfo genericMethod = methodInvoker.MakeGenericMethod( methodArgTypes ); + + GenericMethodInvoker genericMethodInvoker = new GenericMethodInvoker( genericMethod ); + + return genericMethodInvoker; + } + + return null; + } +} + +} diff --git a/Bite/Runtime/Functions/Interop/InteropGetMethod.cs b/Bite/Runtime/Functions/Interop/InteropGetMethod.cs new file mode 100644 index 0000000..1a6e8a1 --- /dev/null +++ b/Bite/Runtime/Functions/Interop/InteropGetMethod.cs @@ -0,0 +1,76 @@ +using System; +using System.Reflection; +using Bite.Runtime.Functions.ForeignInterface; +using Bite.Runtime.Memory; + +namespace Bite.Runtime.Functions.Interop +{ + +public class InteropGetMethod : InteropBase, IBiteVmCallable +{ + + #region Public + + public InteropGetMethod() + { + } + + public InteropGetMethod( TypeRegistry typeRegistry ) : base( typeRegistry ) + { + } + + public object Call( DynamicBiteVariable[] arguments ) + { + Type type = ResolveType( arguments[0].StringData ); + + if (type == null) + { + throw new BiteVmRuntimeException( + $"Runtime Error: Type: {arguments[0].StringData} not registered as a type!" ); + } + + Type[] methodArgTypes = new Type[arguments.Length - 2]; + + int counter = 0; + + for (int i = 2; i < arguments.Length; i++) + { + if (arguments[i].DynamicType == DynamicVariableType.String) + { + Type argType = ResolveType( arguments[i].StringData ); + + if (argType == null) + { + throw new BiteVmRuntimeException( + $"Runtime Error: Type: {arguments[i].StringData} not registered as a type!" ); + } + + methodArgTypes[counter] = argType; + + } + else + { + throw new BiteVmRuntimeException( "Expected string" ); + } + + counter++; + } + + MethodInfo methodInfo = m_TypeRegistry.GetMethod( type, arguments[1].StringData, methodArgTypes ); + + if ( methodInfo.IsGenericMethod ) + { + return methodInfo; + } + else + { + return new MethodInvoker( methodInfo ); + } + + } + + + #endregion +} + +} \ No newline at end of file diff --git a/Bite/Runtime/Functions/Interop/InteropGetStaticClass.cs b/Bite/Runtime/Functions/Interop/InteropGetStaticClass.cs new file mode 100644 index 0000000..8235c37 --- /dev/null +++ b/Bite/Runtime/Functions/Interop/InteropGetStaticClass.cs @@ -0,0 +1,34 @@ +using System; +using Bite.Runtime.Functions.ForeignInterface; +using Bite.Runtime.Memory; + +namespace Bite.Runtime.Functions.Interop +{ + +public class InteropGetStaticClass : InteropBase, IBiteVmCallable +{ + public InteropGetStaticClass() + { + } + + public InteropGetStaticClass( TypeRegistry typeRegistry ) : base( typeRegistry ) + { + } + + public object Call( DynamicBiteVariable[] arguments ) + { + Type type = ResolveType( arguments[0].StringData ); + + if ( type == null ) + { + throw new BiteVmRuntimeException( + $"Runtime Error: Type: {arguments[0].StringData} not registered as a type!" ); + } + + StaticWrapper wrapper = new StaticWrapper( type ); + + return wrapper; + } +} + +} \ No newline at end of file diff --git a/Bite/Runtime/Functions/Interop/InteropGetStaticMember.cs b/Bite/Runtime/Functions/Interop/InteropGetStaticMember.cs new file mode 100644 index 0000000..688a6dc --- /dev/null +++ b/Bite/Runtime/Functions/Interop/InteropGetStaticMember.cs @@ -0,0 +1,59 @@ +using System; +using System.Reflection; +using Bite.Runtime.Functions.ForeignInterface; +using Bite.Runtime.Memory; + +namespace Bite.Runtime.Functions.Interop +{ + +public class InteropGetStaticMember : InteropBase, IBiteVmCallable +{ + public InteropGetStaticMember() + { + } + + public InteropGetStaticMember( TypeRegistry typeRegistry ) : base( typeRegistry ) + { + } + + public object Call( DynamicBiteVariable[] arguments ) + { + Type type = ResolveType( arguments[0].StringData ); + + if ( type == null ) + { + throw new BiteVmRuntimeException( + $"Runtime Error: Type: {arguments[0].StringData} not registered as a type!" ); + } + + MemberInfo[] memberInfo = + type.GetMember( arguments[1].StringData, BindingFlags.Public | BindingFlags.Static ); + + if ( memberInfo.Length > 0 ) + { + object obj = GetValue( memberInfo[0], null ); + + return obj; + } + + throw new BiteVmRuntimeException( + $"Runtime Error: member {arguments[0].StringData} not found on type {arguments[0].StringData}" ); + } + + private static object GetValue( MemberInfo memberInfo, object forObject ) + { + switch ( memberInfo.MemberType ) + { + case MemberTypes.Field: + return ( ( FieldInfo ) memberInfo ).GetValue( forObject ); + + case MemberTypes.Property: + return ( ( PropertyInfo ) memberInfo ).GetValue( forObject ); + + default: + throw new NotImplementedException(); + } + } +} + +} \ No newline at end of file diff --git a/Bite/Runtime/Functions/Interop/InteropGetStaticMethod.cs b/Bite/Runtime/Functions/Interop/InteropGetStaticMethod.cs new file mode 100644 index 0000000..eab785c --- /dev/null +++ b/Bite/Runtime/Functions/Interop/InteropGetStaticMethod.cs @@ -0,0 +1,64 @@ +using System; +using System.Reflection; +using Bite.Runtime.Functions.ForeignInterface; +using Bite.Runtime.Memory; + +namespace Bite.Runtime.Functions.Interop +{ + +public class InteropGetStaticMethod : InteropBase, IBiteVmCallable +{ + public InteropGetStaticMethod() + { + } + + public InteropGetStaticMethod( TypeRegistry typeRegistry ) : base( typeRegistry ) + { + } + + public object Call( DynamicBiteVariable[] arguments ) + { + Type type = ResolveType( arguments[0].StringData ); + + if ( type == null ) + { + throw new BiteVmRuntimeException( + $"Runtime Error: Type: {arguments[0].StringData} not registered as a type!" ); + } + + Type[] methodArgTypes = new Type[arguments.Length - 2]; + + int counter = 0; + + for (int i = 2; i < arguments.Length; i++) + { + if (arguments[i].DynamicType == DynamicVariableType.String) + { + Type argType = ResolveType( arguments[i].StringData ); + + if (argType == null) + { + throw new BiteVmRuntimeException( + $"Runtime Error: Type: {arguments[i].StringData} not registered as a type!" ); + } + + methodArgTypes[counter] = argType; + + } + else + { + throw new BiteVmRuntimeException( "Expected string" ); + } + + counter++; + } + + MethodInfo methodInfo = m_TypeRegistry.GetMethod( type, arguments[1].StringData, methodArgTypes ); + + StaticMethodInvoker staticMethodInvoker = new StaticMethodInvoker( methodInfo ); + + return staticMethodInvoker; + } +} + +} diff --git a/Bite/Runtime/Functions/Interop/MethodInvoker.cs b/Bite/Runtime/Functions/Interop/MethodInvoker.cs new file mode 100644 index 0000000..26b5eb4 --- /dev/null +++ b/Bite/Runtime/Functions/Interop/MethodInvoker.cs @@ -0,0 +1,55 @@ +using System; +using System.Reflection; +using Bite.Runtime.Functions.ForeignInterface; +using Bite.Runtime.Memory; + +namespace Bite.Runtime.Functions.Interop +{ + +public class MethodInvoker : IBiteVmCallable +{ + private Type[] m_ArgTypes; + private readonly FastMethodInfo m_FastMethodInfo; + + private MethodInfo m_OriginalMethodInfo; + + public MethodInvoker( MethodInfo methodInfo ) + { + OriginalMethodInfo = methodInfo; + m_FastMethodInfo = new FastMethodInfo( methodInfo ); + + ParameterInfo[] parameterInfos = methodInfo.GetParameters(); + m_ArgTypes = new Type[parameterInfos.Length]; + + for (var i = 0; i < parameterInfos.Length; i++) + { + m_ArgTypes[i] = parameterInfos[i].ParameterType; + } + } + + public MethodInfo OriginalMethodInfo + { + get => m_OriginalMethodInfo; + private set => m_OriginalMethodInfo = value; + } + + public object Call( DynamicBiteVariable[] arguments ) + { + object[] constructorArgs = new object[arguments.Length - 1]; + + for (int i = 1; i < arguments.Length; i++) + { + constructorArgs[i - 1] = Convert.ChangeType( + arguments[i].ToObject(), + m_ArgTypes[i - 1] ); + + } + + object value = m_FastMethodInfo.Invoke( arguments[0].ToObject(), constructorArgs ); + + return value; + } + +} + +} \ No newline at end of file diff --git a/Bite/Runtime/Functions/Interop/StaticGenericMethodInvoker.cs b/Bite/Runtime/Functions/Interop/StaticGenericMethodInvoker.cs new file mode 100644 index 0000000..7f90e91 --- /dev/null +++ b/Bite/Runtime/Functions/Interop/StaticGenericMethodInvoker.cs @@ -0,0 +1,53 @@ +using System; +using System.Reflection; +using Bite.Runtime.Functions.ForeignInterface; +using Bite.Runtime.Memory; + +namespace Bite.Runtime.Functions.Interop +{ + +public class StaticGenericMethodInvoker : IBiteVmCallable +{ + private Type[] m_ArgTypes; + + private MethodInfo m_OriginalMethodInfo; + + public StaticGenericMethodInvoker( MethodInfo methodInfo ) + { + OriginalMethodInfo = methodInfo; + + ParameterInfo[] parameterInfos = methodInfo.GetParameters(); + m_ArgTypes = new Type[parameterInfos.Length]; + + for (var i = 0; i < parameterInfos.Length; i++) + { + m_ArgTypes[i] = parameterInfos[i].ParameterType; + } + } + + public MethodInfo OriginalMethodInfo + { + get => m_OriginalMethodInfo; + private set => m_OriginalMethodInfo = value; + } + + public object Call( DynamicBiteVariable[] arguments ) + { + object[] constructorArgs = new object[arguments.Length - 1]; + + for (int i = 0; i < arguments.Length; i++) + { + constructorArgs[i] = Convert.ChangeType( + arguments[i].ToObject(), + m_ArgTypes[i] ); + + } + + object value = OriginalMethodInfo.Invoke( null, constructorArgs ); + + return value; + } + +} + +} diff --git a/Bite/Runtime/Functions/Interop/StaticMethodInvoker.cs b/Bite/Runtime/Functions/Interop/StaticMethodInvoker.cs new file mode 100644 index 0000000..f9c9495 --- /dev/null +++ b/Bite/Runtime/Functions/Interop/StaticMethodInvoker.cs @@ -0,0 +1,54 @@ +using System; +using System.Reflection; +using Bite.Runtime.Functions.ForeignInterface; +using Bite.Runtime.Memory; + +namespace Bite.Runtime.Functions.Interop +{ + +public class StaticMethodInvoker : IBiteVmCallable +{ + private Type[] m_ArgTypes; + private readonly FastMethodInfo m_FastMethodInfo; + + private MethodInfo m_OriginalMethodInfo; + public StaticMethodInvoker( MethodInfo methodInfo ) + { + OriginalMethodInfo = methodInfo; + m_FastMethodInfo = new FastMethodInfo( methodInfo ); + + ParameterInfo[] parameterInfos = methodInfo.GetParameters(); + m_ArgTypes = new Type[parameterInfos.Length]; + + for (var i = 0; i < parameterInfos.Length; i++) + { + m_ArgTypes[i] = parameterInfos[i].ParameterType; + } + } + + public MethodInfo OriginalMethodInfo + { + get => m_OriginalMethodInfo; + private set => m_OriginalMethodInfo = value; + } + + public object Call( DynamicBiteVariable[] arguments ) + { + object[] constructorArgs = new object[arguments.Length]; + + for (int i = 0; i < arguments.Length; i++) + { + constructorArgs[i] = Convert.ChangeType( + arguments[i].ToObject(), + m_ArgTypes[i] ); + + } + + object value = m_FastMethodInfo.Invoke( null, constructorArgs ); + + return value; + } + +} + +} diff --git a/Bite/Runtime/Functions/PrintFunctionVm.cs b/Bite/Runtime/Functions/PrintFunctionVm.cs index 8d010f0..b9d39a1 100644 --- a/Bite/Runtime/Functions/PrintFunctionVm.cs +++ b/Bite/Runtime/Functions/PrintFunctionVm.cs @@ -9,12 +9,12 @@ public class PrintFunctionVm : IBiteVmCallable { #region Public - public object Call( List < DynamicBiteVariable > arguments ) + public object Call( DynamicBiteVariable[] arguments ) { if ( arguments[0].DynamicType != DynamicVariableType.Null ) { - int arraySize = arguments.Count; - + int arraySize = arguments.Length; + for ( int i = 0; i < arraySize; i++ ) { Console.Write( arguments[i].ToString() ); diff --git a/Bite/Runtime/Functions/PrintLineFunctionVm.cs b/Bite/Runtime/Functions/PrintLineFunctionVm.cs index 72ad836..0898c13 100644 --- a/Bite/Runtime/Functions/PrintLineFunctionVm.cs +++ b/Bite/Runtime/Functions/PrintLineFunctionVm.cs @@ -9,20 +9,13 @@ public class PrintLineFunctionVm : IBiteVmCallable { #region Public - public object Call( List < DynamicBiteVariable > arguments ) + public object Call( DynamicBiteVariable[] arguments ) { - if ( arguments[0].DynamicType != DynamicVariableType.Null ) - { - int arraySize = arguments.Count; - - for ( int i = 0; i < arraySize; i++ ) - { - Console.WriteLine( arguments[i].ToString() ); - } - } - else + int argumentsCount = arguments.Length; + + for ( int i = 0; i < argumentsCount; i++ ) { - Console.WriteLine( "Error: Passed Null Reference to Function!" ); + Console.WriteLine( arguments[i].ToString() ); } return null; @@ -31,4 +24,4 @@ public object Call( List < DynamicBiteVariable > arguments ) #endregion } -} \ No newline at end of file +} diff --git a/Bite/Runtime/Memory/BiteMemorySpace.cs b/Bite/Runtime/Memory/BiteMemorySpace.cs new file mode 100644 index 0000000..535ce9e --- /dev/null +++ b/Bite/Runtime/Memory/BiteMemorySpace.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +namespace Bite.Runtime.Memory +{ + +public class BiteMemorySpace +{ + private Dictionary < string, DynamicBiteVariable > m_FunctionByName = + new Dictionary < string, DynamicBiteVariable >(); + + private Dictionary < string, DynamicBiteVariable > m_ClassInstanceByName = + new Dictionary < string, DynamicBiteVariable >(); + + + private DynamicBiteVariable[] m_Properties; + + public BiteMemorySpace(int size) + { + m_Properties = new DynamicBiteVariable[size]; + } + + public void DefineVariable( int i, DynamicBiteVariable dynamicBiteVariable ) + { + + } +} + +} diff --git a/Bite/Runtime/Memory/ConstantValueType.cs b/Bite/Runtime/Memory/ConstantValueType.cs index 1a2584d..726c0af 100644 --- a/Bite/Runtime/Memory/ConstantValueType.cs +++ b/Bite/Runtime/Memory/ConstantValueType.cs @@ -6,6 +6,7 @@ public enum ConstantValueType : byte Integer, Double, String, + Null, Bool } diff --git a/Bite/Runtime/Memory/DynamicBiteVariable.cs b/Bite/Runtime/Memory/DynamicBiteVariable.cs index 41b74cf..92309c2 100644 --- a/Bite/Runtime/Memory/DynamicBiteVariable.cs +++ b/Bite/Runtime/Memory/DynamicBiteVariable.cs @@ -1,9 +1,30 @@ using System; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace Bite.Runtime.Memory { +public static class DynamicBiteVariableExtensions +{ + #region Public + + [MethodImpl( MethodImplOptions.AggressiveInlining )] + public static bool IsBoolean( this DynamicBiteVariable variable ) + { + return variable.DynamicType == DynamicVariableType.True || + variable.DynamicType == DynamicVariableType.False; + } + + [MethodImpl( MethodImplOptions.AggressiveInlining )] + public static bool IsNumeric( this DynamicBiteVariable variable ) + { + return variable.DynamicType < DynamicVariableType.True; + } + + #endregion +} + [StructLayout( LayoutKind.Explicit )] public class DynamicBiteVariable { diff --git a/Bite/Runtime/Memory/DynamicVariableExtension.cs b/Bite/Runtime/Memory/DynamicVariableExtension.cs index d0aedc9..1818bf9 100644 --- a/Bite/Runtime/Memory/DynamicVariableExtension.cs +++ b/Bite/Runtime/Memory/DynamicVariableExtension.cs @@ -1,6 +1,4 @@ -using System; - -namespace Bite.Runtime.Memory +namespace Bite.Runtime.Memory { public static class DynamicVariableExtension @@ -91,6 +89,15 @@ public static DynamicBiteVariable ToDynamicVariable( object data ) break; + case float f: + biteVariable.DynamicType = 0; + biteVariable.StringData = null; + biteVariable.ObjectData = null; + biteVariable.ArrayData = null; + biteVariable.NumberData = f; + + break; + case bool b when b: biteVariable.NumberData = 0; biteVariable.StringData = null; @@ -135,43 +142,49 @@ public static DynamicBiteVariable ToDynamicVariable( object data ) biteVariable.DynamicType = DynamicVariableType.Object; break; - + case DynamicBiteVariable dynamicBiteVariable: switch ( dynamicBiteVariable.DynamicType ) { case DynamicVariableType.Null: biteVariable.DynamicType = DynamicVariableType.Null; + break; case DynamicVariableType.True: biteVariable.DynamicType = DynamicVariableType.True; + break; case DynamicVariableType.False: biteVariable.DynamicType = DynamicVariableType.False; + break; case DynamicVariableType.String: biteVariable.StringData = dynamicBiteVariable.StringData; biteVariable.DynamicType = DynamicVariableType.String; + break; case DynamicVariableType.Array: biteVariable.ArrayData = dynamicBiteVariable.ArrayData; biteVariable.DynamicType = DynamicVariableType.Array; + break; case DynamicVariableType.Object: biteVariable.ObjectData = dynamicBiteVariable.ObjectData; biteVariable.DynamicType = DynamicVariableType.Object; + break; default: biteVariable.DynamicType = 0; biteVariable.NumberData = dynamicBiteVariable.NumberData; + break; } - break; @@ -188,6 +201,54 @@ public static DynamicBiteVariable ToDynamicVariable( object data ) return biteVariable; } + public static DynamicBiteVariable ToDynamicVariable( DynamicBiteVariable dynamicBiteVariable ) + { + DynamicBiteVariable biteVariable = new DynamicBiteVariable(); + switch ( dynamicBiteVariable.DynamicType ) + { + case DynamicVariableType.Null: + biteVariable.DynamicType = DynamicVariableType.Null; + + break; + + case DynamicVariableType.True: + biteVariable.DynamicType = DynamicVariableType.True; + + break; + + case DynamicVariableType.False: + biteVariable.DynamicType = DynamicVariableType.False; + + break; + + case DynamicVariableType.String: + biteVariable.StringData = dynamicBiteVariable.StringData; + biteVariable.DynamicType = DynamicVariableType.String; + + break; + + case DynamicVariableType.Array: + biteVariable.ArrayData = dynamicBiteVariable.ArrayData; + biteVariable.DynamicType = DynamicVariableType.Array; + + break; + + case DynamicVariableType.Object: + biteVariable.ObjectData = dynamicBiteVariable.ObjectData; + biteVariable.DynamicType = DynamicVariableType.Object; + + break; + + default: + biteVariable.DynamicType = 0; + biteVariable.NumberData = dynamicBiteVariable.NumberData; + + break; + } + + return biteVariable; + } + public static DynamicBiteVariable ToDynamicVariable( object[] data ) { DynamicBiteVariable biteVariable = new DynamicBiteVariable(); diff --git a/Bite/Runtime/Memory/FastClassMemorySpace.cs b/Bite/Runtime/Memory/FastClassMemorySpace.cs index 4d6d608..8f71252 100644 --- a/Bite/Runtime/Memory/FastClassMemorySpace.cs +++ b/Bite/Runtime/Memory/FastClassMemorySpace.cs @@ -1,4 +1,5 @@ -using Bite.Runtime.Bytecode; +using System; +using Bite.Runtime.Bytecode; namespace Bite.Runtime.Memory { @@ -13,7 +14,15 @@ public FastClassMemorySpace( int stackCount, BinaryChunk callerChunk, int callerInstructionPointer, - int memberCount ) : base( $"$class_{name}", enclosingSpace, stackCount, callerChunk, callerInstructionPointer, memberCount ) + int callerLineNumberPointer, + int memberCount ) : base( + $"$class_{name}", + enclosingSpace, + stackCount, + callerChunk, + callerInstructionPointer, + callerLineNumberPointer, + memberCount ) { } diff --git a/Bite/Runtime/Memory/FastGlobalMemorySpace.cs b/Bite/Runtime/Memory/FastGlobalMemorySpace.cs index 911d0f0..1aeda67 100644 --- a/Bite/Runtime/Memory/FastGlobalMemorySpace.cs +++ b/Bite/Runtime/Memory/FastGlobalMemorySpace.cs @@ -10,7 +10,7 @@ public class FastGlobalMemorySpace : FastMemorySpace #region Public - public FastGlobalMemorySpace( int memberCount ) : base( "Global", null, 0, new BinaryChunk(), 0, memberCount ) + public FastGlobalMemorySpace( int memberCount ) : base( "Global", null, 0, new BinaryChunk(), 0, 0, memberCount ) { } @@ -42,7 +42,7 @@ public FastMemorySpace GetModule( int index ) { return m_Modules[index]; } - + public FastMemorySpace GetModule( string moduleName ) { for ( int i = 0; i < m_Modules.Count; i++ ) @@ -52,6 +52,7 @@ public FastMemorySpace GetModule( string moduleName ) return m_Modules[i]; } } + return null; } diff --git a/Bite/Runtime/Memory/FastMemorySpace.cs b/Bite/Runtime/Memory/FastMemorySpace.cs index baf7f51..3a01188 100644 --- a/Bite/Runtime/Memory/FastMemorySpace.cs +++ b/Bite/Runtime/Memory/FastMemorySpace.cs @@ -18,6 +18,10 @@ public class FastMemorySpace public BinaryChunk CallerChunk; public int CallerIntructionPointer; + + public int CallerLineNumberPointer; + + public bool IsRunningCallback = false; public int CurrentMemoryPointer { get; set; } = 0; @@ -29,10 +33,12 @@ public FastMemorySpace( int stackCount, BinaryChunk callerChunk, int callerInstructionPointer, + int callerLineNumberPointer, int memberCount ) { CallerChunk = callerChunk; CallerIntructionPointer = callerInstructionPointer; + CallerLineNumberPointer = callerLineNumberPointer; m_EnclosingSpace = enclosingSpace; Name = name; StackCountAtBegin = stackCount; @@ -43,32 +49,45 @@ public virtual void Define( DynamicBiteVariable value ) { if ( CurrentMemoryPointer >= Properties.Length ) { - DynamicBiteVariable[] newProperties = new DynamicBiteVariable[Properties.Length * 2]; - Array.Copy( Properties, newProperties, Properties.Length ); - Properties = newProperties; + if ( CurrentMemoryPointer == 0 ) + { + DynamicBiteVariable[] newProperties = new DynamicBiteVariable[2]; + Array.Copy( Properties, newProperties, Properties.Length ); + Properties = newProperties; + } + else + { + DynamicBiteVariable[] newProperties = new DynamicBiteVariable[Properties.Length * 2]; + Array.Copy( Properties, newProperties, Properties.Length ); + Properties = newProperties; + } } - + Properties[CurrentMemoryPointer] = value; CurrentMemoryPointer++; } - public void SetNameOfVariable(int varIndex, string name) - { - NamesToProperties.Add( name, Properties[varIndex] ); - } - public virtual void Define( DynamicBiteVariable value, string idStr, bool addToProperties = true ) { if ( addToProperties ) { if ( CurrentMemoryPointer >= Properties.Length ) { - DynamicBiteVariable[] newProperties = new DynamicBiteVariable[Properties.Length * 2]; - Array.Copy( Properties, newProperties, Properties.Length ); - Properties = newProperties; + if ( CurrentMemoryPointer == 0 ) + { + DynamicBiteVariable[] newProperties = new DynamicBiteVariable[2]; + Array.Copy( Properties, newProperties, Properties.Length ); + Properties = newProperties; + } + else + { + DynamicBiteVariable[] newProperties = new DynamicBiteVariable[Properties.Length * 2]; + Array.Copy( Properties, newProperties, Properties.Length ); + Properties = newProperties; + } } - + Properties[CurrentMemoryPointer] = value; if ( !string.IsNullOrEmpty( idStr ) ) @@ -218,6 +237,16 @@ public FastMemorySpace GetEnclosingSpace() return null; } + public virtual DynamicBiteVariable GetLocalVar( int id ) + { + if ( id < Properties.Length ) + { + return Properties[id]; + } + + return DynamicVariableExtension.ToDynamicVariable(); + } + public virtual void Put( string idStr, DynamicBiteVariable value ) { if ( NamesToProperties.ContainsKey( idStr ) ) @@ -275,11 +304,24 @@ public virtual void Put( int moduleId, int depth, int classId, int id, DynamicBi } } - public void ResetPropertiesArray( int memberCount ) + public virtual void PutLocalVar( int id, DynamicBiteVariable value ) + { + if ( id < CurrentMemoryPointer ) + { + Properties[id].Change( value ); + } + } + + public void SetNameOfVariable( int varIndex, string name ) + { + NamesToProperties.Add( name, Properties[varIndex] ); + } + + /*public void ResetPropertiesArray( int memberCount ) { Properties = new DynamicBiteVariable[memberCount]; CurrentMemoryPointer = 0; - } + }*/ public override string ToString() { diff --git a/Bite/Runtime/Memory/FastModuleMemorySpace.cs b/Bite/Runtime/Memory/FastModuleMemorySpace.cs index 5aaab0d..2f87639 100644 --- a/Bite/Runtime/Memory/FastModuleMemorySpace.cs +++ b/Bite/Runtime/Memory/FastModuleMemorySpace.cs @@ -13,7 +13,8 @@ public FastModuleMemorySpace( int stackCount, BinaryChunk callerChunk, int callerInstructionPointer, - int memberCount ) : base( name, enclosingSpace, stackCount, callerChunk, callerInstructionPointer, memberCount ) + int callerLineNumberPointer, + int memberCount ) : base( name, enclosingSpace, stackCount, callerChunk, callerInstructionPointer, callerLineNumberPointer, memberCount ) { } diff --git a/Bite/Runtime/Memory/ObjectPoolFastMemory.cs b/Bite/Runtime/Memory/ObjectPoolFastMemory.cs index 53a6c25..5ab5124 100644 --- a/Bite/Runtime/Memory/ObjectPoolFastMemory.cs +++ b/Bite/Runtime/Memory/ObjectPoolFastMemory.cs @@ -14,7 +14,7 @@ public ObjectPoolFastMemory() { for ( int i = 0; i < 128; i++ ) { - m_FastCallMemorySpaces[i] = new FastMemorySpace( $"$objectpool_{i}", null, 0, null, 0, 0 ); + m_FastCallMemorySpaces[i] = new FastMemorySpace( $"$objectpool_{i}", null, 0, null, 0, 0, 0 ); } } @@ -27,18 +27,21 @@ public FastMemorySpace Get() for ( int i = m_FastMemorySpacePointer; i < newProperties.Length; i++ ) { - newProperties[i] = new FastMemorySpace( $"$objectpool_{i}", null, 0, null, 0, 0 ); + newProperties[i] = new FastMemorySpace( $"$objectpool_{i}", null, 0, null, 0, 0,0 ); } + m_FastCallMemorySpaces = newProperties; } - + FastMemorySpace fastMemorySpace = m_FastCallMemorySpaces[m_FastMemorySpacePointer]; fastMemorySpace.Properties = Array.Empty < DynamicBiteVariable >(); + fastMemorySpace.CurrentMemoryPointer = 0; fastMemorySpace.NamesToProperties.Clear(); fastMemorySpace.CallerChunk = null; fastMemorySpace.CallerIntructionPointer = 0; + fastMemorySpace.CallerLineNumberPointer = 0; fastMemorySpace.StackCountAtBegin = 0; - + fastMemorySpace.IsRunningCallback = false; m_FastMemorySpacePointer++; diff --git a/Bite/Runtime/MethodCache.cs b/Bite/Runtime/MethodCache.cs new file mode 100644 index 0000000..216d58c --- /dev/null +++ b/Bite/Runtime/MethodCache.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using Bite.Runtime.Functions.ForeignInterface; + +namespace Bite.Runtime +{ + +public class MethodCache +{ + private static readonly Dictionary < string, FastMethodInfo > m_MethodCache = + new Dictionary < string, FastMethodInfo >(); + + #region Public + + public bool TryGetMethod( + Type type, + Type[] functionArgumentTypes, + string methodName, + out FastMethodInfo fastMethodInfo ) + { + string key = $"{type.FullName}.{methodName}"; + + for ( int i = 0; i < functionArgumentTypes.Length; i++ ) + { + key += "." + functionArgumentTypes[i].Name; + } + + if ( !m_MethodCache.TryGetValue( key, out fastMethodInfo ) ) + { + MethodInfo methodInfo = type.GetMethod( methodName, functionArgumentTypes ); + + if ( methodInfo != null ) + { + fastMethodInfo = new FastMethodInfo( methodInfo ); + m_MethodCache.Add( key, fastMethodInfo ); + + return true; + } + + return false; + } + + return true; + } + + #endregion +} + +} diff --git a/Bite/Runtime/PropertyCache.cs b/Bite/Runtime/PropertyCache.cs new file mode 100644 index 0000000..2911e1f --- /dev/null +++ b/Bite/Runtime/PropertyCache.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Reflection; + +namespace Bite.Runtime +{ + +public class PropertyCache +{ + private static readonly Dictionary < string, PropertyInfo > m_PropertyCache = + new Dictionary < string, PropertyInfo >(); + + #region Public + + public bool TryGetProperty( Type type, string propertyName, out PropertyInfo propertyInfo ) + { + string key = $"{type.FullName}.{propertyName}"; + + if ( !m_PropertyCache.TryGetValue( key, out propertyInfo ) ) + { + propertyInfo = type.GetProperty( propertyName ); + + if ( propertyInfo != null ) + { + m_PropertyCache.Add( key, propertyInfo ); + + return true; + } + + return false; + } + + return true; + } + + #endregion +} + +} diff --git a/Bite/Runtime/StackExtensions.cs b/Bite/Runtime/StackExtensions.cs new file mode 100644 index 0000000..2cff820 --- /dev/null +++ b/Bite/Runtime/StackExtensions.cs @@ -0,0 +1,55 @@ +using System; +using Bite.Runtime.Memory; + +namespace Bite.Runtime +{ + +public static class StackExtensions +{ + #region Public + + /// + /// Retrieves the current value on the stack based on the specified type + /// + /// + /// + /// + public static object PopDataByType( this DynamicBiteVariableStack vmStack, Type type ) + { + object data; + + DynamicBiteVariable currentStack = vmStack.Peek(); + + // Cast the data based on the recieving propertyType + if ( type == typeof( double ) && currentStack.IsNumeric() ) + { + data = vmStack.Pop().NumberData; + } + else if ( type == typeof( float ) && currentStack.IsNumeric() ) + { + data = ( float ) vmStack.Pop().NumberData; + } + else if ( type == typeof( int ) && currentStack.IsNumeric() ) + { + data = ( int ) vmStack.Pop().NumberData; + } + else if ( type == typeof( string ) && currentStack.DynamicType == DynamicVariableType.String ) + { + data = vmStack.Pop().StringData; + } + else if ( type == typeof( bool ) && currentStack.IsBoolean() ) + { + data = currentStack.DynamicType == DynamicVariableType.True; + } + else + { + data = vmStack.Pop().ObjectData; + } + + return data; + } + + #endregion +} + +} diff --git a/Bite/Runtime/UsingStatementStack.cs b/Bite/Runtime/UsingStatementStack.cs new file mode 100644 index 0000000..fb51ec7 --- /dev/null +++ b/Bite/Runtime/UsingStatementStack.cs @@ -0,0 +1,42 @@ +using System; + +namespace Bite.Runtime +{ + +public class UsingStatementStack +{ + private object[] m_UsedObjects = new object[128]; + + public int Count { get; set; } = 0; + + #region Public + + public void Pop() + { + object usedObject = m_UsedObjects[--Count]; + ( ( IDisposable ) usedObject ).Dispose(); + } + + public void Push( object usedObject ) + { + if ( Count >= m_UsedObjects.Length ) + { + object[] newProperties = new object[m_UsedObjects.Length * 2]; + Array.Copy( m_UsedObjects, newProperties, m_UsedObjects.Length ); + m_UsedObjects = newProperties; + } + + m_UsedObjects[Count] = usedObject; + + if ( Count >= 1023 ) + { + throw new IndexOutOfRangeException( "Using Statement Overflow" ); + } + + Count++; + } + + #endregion +} + +} diff --git a/Bite/Symbols/BaseScope.cs b/Bite/Symbols/BaseScope.cs index d691415..129741e 100644 --- a/Bite/Symbols/BaseScope.cs +++ b/Bite/Symbols/BaseScope.cs @@ -6,7 +6,7 @@ namespace Bite.Symbols { -[DebuggerDisplay("{Name}")] +[DebuggerDisplay( "{Name}" )] public abstract class BaseScope : Scope { public abstract string Name { get; } @@ -89,17 +89,9 @@ public virtual int NestedSymbolCount #region Public - protected BaseScope() - { - } - - protected BaseScope( Scope enclosingScope ) - { - EnclosingScope = enclosingScope; - } - public virtual void define( Symbol sym ) { + //GlobalSymbolTable.Define( sym ); if ( symbols.ContainsKey( sym.Name ) ) { throw new ArgumentException( "duplicate symbol " + sym.Name ); @@ -150,6 +142,19 @@ public override string ToString() #endregion + #region Protected + + protected BaseScope() + { + } + + protected BaseScope( Scope enclosingScope ) + { + EnclosingScope = enclosingScope; + } + + #endregion + protected internal Scope enclosingScope; protected internal IList < Scope > nestedScopesNotSymbols = new List < Scope >(); diff --git a/Bite/Symbols/BaseSymbol.cs b/Bite/Symbols/BaseSymbol.cs index 1c506ac..fb1ba6a 100644 --- a/Bite/Symbols/BaseSymbol.cs +++ b/Bite/Symbols/BaseSymbol.cs @@ -53,10 +53,10 @@ public override bool Equals( object obj ) return name.Equals( ( ( Symbol ) obj ).Name ); } - public override int GetHashCode() + /*public override int GetHashCode() { return name.GetHashCode(); - } + }*/ public override string ToString() { @@ -84,8 +84,9 @@ public override string ToString() #endregion - protected internal AstBaseNode m_DefBaseNode; protected internal int lexicalOrder; + + protected internal AstBaseNode m_DefBaseNode; protected internal readonly string name; protected internal Scope scope; protected internal Type type; diff --git a/Bite/Symbols/ClassSymbol.cs b/Bite/Symbols/ClassSymbol.cs index e2fc08a..74a9b7b 100644 --- a/Bite/Symbols/ClassSymbol.cs +++ b/Bite/Symbols/ClassSymbol.cs @@ -215,6 +215,12 @@ public ClassSymbol( string name, AccesModifierType accesModifierType, ClassAndMe { } + public void DefineField( FieldSymbol fieldSymbol ) + { + fieldSymbol.EnclosingScope = this; + define( fieldSymbol ); + } + public override Symbol resolve( string name, out int moduleId, ref int depth, bool throwErrorWhenNotFound = true ) { Symbol s = resolveMember( name ); @@ -327,13 +333,6 @@ public override void SetSlotNumber( Symbol symbol ) } } - public void DefineField( FieldSymbol fieldSymbol ) - { - fieldSymbol.EnclosingScope = this; - define( fieldSymbol ); - } - - public override string ToString() { List < ClassSymbol > superClassScope = BaseClassesScopes; diff --git a/Bite/Symbols/DataAggregateSymbol.cs b/Bite/Symbols/DataAggregateSymbol.cs index 9f8ae86..be48810 100644 --- a/Bite/Symbols/DataAggregateSymbol.cs +++ b/Bite/Symbols/DataAggregateSymbol.cs @@ -88,6 +88,7 @@ public DataAggregateSymbol( public override void define( Symbol sym ) { + //GlobalSymbolTable.Define( sym ); if ( !( sym is MemberSymbol ) ) { throw new ArgumentException( "sym is " + sym.GetType().Name + " not MemberSymbol" ); diff --git a/Bite/Symbols/FunctionSymbol.cs b/Bite/Symbols/FunctionSymbol.cs index db3e467..93e367f 100644 --- a/Bite/Symbols/FunctionSymbol.cs +++ b/Bite/Symbols/FunctionSymbol.cs @@ -6,6 +6,8 @@ namespace Bite.Symbols public class FunctionSymbol : SymbolWithScope, TypedSymbol { + public string LinkName; + public virtual FunctionDeclarationBaseNode DefBaseNode { set => m_DefBaseNode = value; @@ -44,17 +46,14 @@ public virtual int NumberOfParameters public bool IsCallable => m_IsCallable; - public string LinkName; - #region Public - public FunctionSymbol( + public FunctionSymbol( string name, AccesModifierType accesModifierType, ClassAndMemberModifiers classAndMemberModifiers, bool isExtern, - bool isCallable - ) : base( name ) + bool isCallable ) : base( name ) { m_AccessModifier = accesModifierType; m_ClassAndMemberModifier = classAndMemberModifiers; @@ -69,12 +68,13 @@ public override string ToString() #endregion - protected internal FunctionDeclarationBaseNode m_DefBaseNode; protected internal AccesModifierType m_AccessModifier; protected internal ClassAndMemberModifiers m_ClassAndMemberModifier; - protected internal Type retType; - protected internal bool m_IsExtern; + + protected internal FunctionDeclarationBaseNode m_DefBaseNode; protected internal bool m_IsCallable; + protected internal bool m_IsExtern; + protected internal Type retType; } } diff --git a/Bite/Symbols/GlobalScope.cs b/Bite/Symbols/GlobalScope.cs index c838576..a026eae 100644 --- a/Bite/Symbols/GlobalScope.cs +++ b/Bite/Symbols/GlobalScope.cs @@ -11,8 +11,6 @@ public GlobalScope() : base( null ) { } - #endregion - public void DefineModule( ModuleSymbol moduleSymbol ) { moduleSymbol.EnclosingScope = this; @@ -23,6 +21,8 @@ public void DefineVariable( VariableSymbol variableSymbol ) { define( variableSymbol ); } + + #endregion } } diff --git a/Bite/Symbols/GlobalSymbolTable.cs b/Bite/Symbols/GlobalSymbolTable.cs new file mode 100644 index 0000000..08e7389 --- /dev/null +++ b/Bite/Symbols/GlobalSymbolTable.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace Bite.Symbols +{ + +public class GlobalSymbolTable +{ + /*private static Dictionary < Symbol, int > GlobalSymbols = new Dictionary < Symbol, int >(); + private static int m_Counter = 0; + + public static void Define( Symbol symbol ) + { + GlobalSymbols.Add( symbol, m_Counter ); + m_Counter++; + } + + public static int GetIndex( Symbol symbol ) + { + return GlobalSymbols[symbol]; + }*/ +} + +} diff --git a/Bite/Symbols/MethodSymbol.cs b/Bite/Symbols/MethodSymbol.cs index 5381b51..3340821 100644 --- a/Bite/Symbols/MethodSymbol.cs +++ b/Bite/Symbols/MethodSymbol.cs @@ -13,7 +13,12 @@ public class MethodSymbol : FunctionSymbol, MemberSymbol public MethodSymbol( string name, AccesModifierType accessModifier, - ClassAndMemberModifiers classAndMemberModifiers ) : base( name, accessModifier, classAndMemberModifiers, false, false ) + ClassAndMemberModifiers classAndMemberModifiers ) : base( + name, + accessModifier, + classAndMemberModifiers, + false, + false ) { } diff --git a/Bite/Symbols/ModuleBuilder.cs b/Bite/Symbols/ModuleBuilder.cs index 93877c9..ee82676 100644 --- a/Bite/Symbols/ModuleBuilder.cs +++ b/Bite/Symbols/ModuleBuilder.cs @@ -6,25 +6,28 @@ namespace Bite.Symbols { /// -/// Contains helper methods for building module members +/// Contains helper methods for building module members /// public abstract class ModuleBuilder { - protected FunctionSymbol CreateFunction( string name, + #region Protected + + protected FunctionSymbol CreateFunction( + string name, AccesModifierType accesModifier, - ClassAndMemberModifiers memberModifiers, - bool isExtern, - bool isCallable, + ClassAndMemberModifiers memberModifiers, + bool isExtern, + bool isCallable, string type, IReadOnlyCollection < string > parameters ) { - var functionSymbol = new FunctionSymbol( + FunctionSymbol functionSymbol = new FunctionSymbol( name, accesModifier, - memberModifiers, + memberModifiers, isExtern, isCallable - ) + ) { Type = new BiteClassType( type ), m_DefBaseNode = new FunctionDeclarationBaseNode @@ -37,7 +40,7 @@ protected FunctionSymbol CreateFunction( string name, } }; - foreach ( var parameter in parameters ) + foreach ( string parameter in parameters ) { functionSymbol.define( new ParameterSymbol( parameter ) ); } @@ -50,11 +53,7 @@ protected FieldSymbol CreatePublicField( string name, string type ) return new FieldSymbol( name, AccesModifierType.Public, - ClassAndMemberModifiers.None ) - { - Type = new BiteClassType( type ), - DefinitionBaseNode = null - }; + ClassAndMemberModifiers.None ) { Type = new BiteClassType( type ), DefinitionBaseNode = null }; } protected FieldSymbol CreatePublicField( string name, string type, AstBaseNode declaringType ) @@ -62,12 +61,10 @@ protected FieldSymbol CreatePublicField( string name, string type, AstBaseNode d return new FieldSymbol( name, AccesModifierType.Public, - ClassAndMemberModifiers.None ) - { - Type = new BiteClassType( type ), - DefinitionBaseNode = declaringType - }; + ClassAndMemberModifiers.None ) { Type = new BiteClassType( type ), DefinitionBaseNode = declaringType }; } + + #endregion } -} \ No newline at end of file +} diff --git a/Bite/Symbols/ModuleSymbol.cs b/Bite/Symbols/ModuleSymbol.cs index bf28a88..f38fbda 100644 --- a/Bite/Symbols/ModuleSymbol.cs +++ b/Bite/Symbols/ModuleSymbol.cs @@ -28,8 +28,6 @@ public ModuleSymbol( m_ModuleName = moduleIdentifier; ImportedModules = importedModules; UsedModules = usedModules; - - } public ModuleSymbol( string moduleIdentifier ) : base( moduleIdentifier ) @@ -44,7 +42,7 @@ public void CheckForAmbiguousReferences() if ( UsedModules != null ) { Scope parent = EnclosingScope; - + foreach ( ModuleIdentifier importedModule in UsedModules ) { int i; @@ -63,7 +61,7 @@ public void CheckForAmbiguousReferences() parent.resolve( importedModule.ToString(), out i, ref d ) as SymbolWithScope; Symbol symbol = module2.resolve( moduleSymbols.Name, out d, ref d, false ); - + if ( symbol != null ) { if ( symbol.SymbolScope != moduleSymbols.SymbolScope ) @@ -71,7 +69,6 @@ public void CheckForAmbiguousReferences() throw new BiteSymbolTableException( $"Symbol Table Error: Ambiguous references: {moduleSymbols.Name}" ); } - } } } @@ -79,6 +76,24 @@ public void CheckForAmbiguousReferences() } } } + + public void DefineClass( ClassSymbol classSymbol ) + { + classSymbol.EnclosingScope = this; + define( classSymbol ); + } + + public void DefineFunction( FunctionSymbol functionSymbol ) + { + functionSymbol.EnclosingScope = this; + define( functionSymbol ); + } + + public void DefineVariable( VariableSymbol variableSymbol ) + { + define( variableSymbol ); + } + public override Symbol resolve( string name, out int moduleid, ref int depth, bool throwErrorWhenNotFound = true ) { if ( symbols.ContainsKey( name ) ) @@ -93,10 +108,8 @@ public override Symbol resolve( string name, out int moduleid, ref int depth, bo if ( parent != null ) { - Symbol symbol = parent.resolve( name, out moduleid, ref depth, throwErrorWhenNotFound ); - if ( symbol == null ) { if ( UsedModules != null ) @@ -136,7 +149,6 @@ public override Symbol resolve( string name, out int moduleid, ref int depth, bo depth++; m_SearchedModules.Clear(); - if ( symbol == null && throwErrorWhenNotFound ) { throw new BiteSymbolTableException( $"Compiler Error: Name '{name}' not found in current program!" ); @@ -156,23 +168,6 @@ public override Symbol resolve( string name, out int moduleid, ref int depth, bo return null; } - public void DefineClass( ClassSymbol classSymbol ) - { - classSymbol.EnclosingScope = this; - define( classSymbol ); - } - - public void DefineFunction ( FunctionSymbol functionSymbol ) - { - functionSymbol.EnclosingScope = this; - define( functionSymbol ); - } - - public void DefineVariable ( VariableSymbol variableSymbol ) - { - define( variableSymbol ); - } - #endregion } diff --git a/Bite/Symbols/Symbol.cs b/Bite/Symbols/Symbol.cs index 613003c..ae8c39c 100644 --- a/Bite/Symbols/Symbol.cs +++ b/Bite/Symbols/Symbol.cs @@ -5,7 +5,7 @@ public interface Symbol { bool Equals( object o ); - int GetHashCode(); + //int GetHashCode(); int InsertionOrderNumber { get; set; } diff --git a/Bite/Symbols/SymbolTable.cs b/Bite/Symbols/SymbolTable.cs index 637f3a4..dd2ec4f 100644 --- a/Bite/Symbols/SymbolTable.cs +++ b/Bite/Symbols/SymbolTable.cs @@ -1,18 +1,22 @@ -using System.Collections.Generic; - -namespace Bite.Symbols +namespace Bite.Symbols { public class SymbolTable { - public SymbolTable( ) + public GlobalScope RootScope { get; } + + internal Scope CurrentScope { get; private set; } + + #region Public + + public SymbolTable() { RootScope = new GlobalScope(); CurrentScope = RootScope; } /// - /// Defines the specified module on the Global scope + /// Defines the specified module on the Global scope /// /// public SymbolTable WithModule( ModuleSymbol module ) @@ -22,26 +26,6 @@ public SymbolTable WithModule( ModuleSymbol module ) return this; } - /// - /// Creates the System module and defines it on the Global scope - /// - /// - public SymbolTable WithSystem() - { - //var systemModuleBuilder = new SystemModuleBuilder(); - - //var systemModule = systemModuleBuilder.BuildSystemModule(); - - //RootScope.DefineModule( systemModule ); - - return this; - } - - /// - /// Returns a new with the System module defined - /// - public static SymbolTable Default => new SymbolTable().WithSystem(); - internal void PopScope() { CurrentScope = CurrentScope.EnclosingScope; @@ -52,9 +36,7 @@ internal void PushScope( Scope s ) CurrentScope = s; } - internal Scope CurrentScope { get; private set; } - - public GlobalScope RootScope { get; private set; } + #endregion } -} \ No newline at end of file +} diff --git a/Bite/Symbols/SymbolTableBuilder.cs b/Bite/Symbols/SymbolTableBuilder.cs index 8cc5504..926ff24 100644 --- a/Bite/Symbols/SymbolTableBuilder.cs +++ b/Bite/Symbols/SymbolTableBuilder.cs @@ -4,16 +4,20 @@ namespace Bite.Symbols { + public class BiteSymbolTableException : Exception { - public BiteSymbolTableException(string message): base(message) + public string BiteSymbolTableExceptionMessage { get; } + + #region Public + + public BiteSymbolTableException( string message ) : base( message ) { BiteSymbolTableExceptionMessage = message; } - - public string BiteSymbolTableExceptionMessage { get; } -} + #endregion +} public class SymbolTableBuilder : AstVisitor < object >, IAstVisitor { @@ -35,7 +39,7 @@ public enum FunctionType private FunctionType m_CurrentFunction = FunctionType.NONE; private ClassType m_CurrentClass = ClassType.NONE; - private SymbolTable m_SymbolTable; + private readonly SymbolTable m_SymbolTable; #region Public @@ -78,7 +82,10 @@ public override object Visit( ModuleBaseNode node ) { node.AstScopeNode = m_SymbolTable.CurrentScope; int d = 0; - ModuleSymbol m = m_SymbolTable.CurrentScope.resolve( node.ModuleIdent.ToString(), out int moduleId, ref d ) as ModuleSymbol; + + ModuleSymbol m = + m_SymbolTable.CurrentScope.resolve( node.ModuleIdent.ToString(), out int moduleId, ref d ) as ModuleSymbol; + bool defineModule = false; if ( m == null ) @@ -123,11 +130,10 @@ public override object Visit( ModuleBaseNode node ) if ( defineModule ) { m_SymbolTable.CurrentScope.define( m ); - } + m.CheckForAmbiguousReferences(); - return null; } @@ -286,6 +292,8 @@ public override object Visit( ClassDeclarationBaseNode node ) classSymbol.BaseClassNames = baseClasses; } + m_SymbolTable.CurrentScope.define( classSymbol ); + m_SymbolTable.PushScope( classSymbol ); foreach ( FieldSymbol fieldSymbol in classSymbol.Fields ) @@ -301,7 +309,8 @@ public override object Visit( ClassDeclarationBaseNode node ) m_SymbolTable.CurrentScope.define( methodSymbol ); } - foreach ( VariableDeclarationBaseNode memberDeclarationContext in node.BlockStatementBase.DeclarationsBase.Variables ) + foreach ( VariableDeclarationBaseNode memberDeclarationContext in node.BlockStatementBase.DeclarationsBase. + Variables ) { memberDeclarationContext.AstScopeNode = m_SymbolTable.CurrentScope; @@ -357,7 +366,8 @@ public override object Visit( ClassDeclarationBaseNode node ) } } - foreach ( FunctionDeclarationBaseNode memberDeclarationContext in node.BlockStatementBase.DeclarationsBase.Functions ) + foreach ( FunctionDeclarationBaseNode memberDeclarationContext in node.BlockStatementBase.DeclarationsBase. + Functions ) { memberDeclarationContext.AstScopeNode = m_SymbolTable.CurrentScope; @@ -400,6 +410,8 @@ public override object Visit( ClassDeclarationBaseNode node ) f.IsConstructor = declarationType == FunctionType.CONSTRUCTOR; f.m_DefBaseNode = memberDeclarationContext; f.EnclosingScope = m_SymbolTable.CurrentScope; + + m_SymbolTable.CurrentScope.define( f ); m_SymbolTable.PushScope( f ); if ( memberDeclarationContext.ParametersBase != null && @@ -420,7 +432,7 @@ public override object Visit( ClassDeclarationBaseNode node ) } m_SymbolTable.PopScope(); - m_SymbolTable.CurrentScope.define( f ); + m_CurrentFunction = FunctionType.NONE; } } @@ -431,7 +443,7 @@ public override object Visit( ClassDeclarationBaseNode node ) m_SymbolTable.PopScope(); - m_SymbolTable.CurrentScope.define( classSymbol ); + m_CurrentClass = enclosingClass; return null; @@ -455,7 +467,7 @@ public override object Visit( FunctionDeclarationBaseNode node ) node.ModifiersBase.Modifiers.Contains( ModifiersBaseNode.ModifierTypes.DeclareExtern ); bool isCallable = node.ModifiersBase.Modifiers != null && - node.ModifiersBase.Modifiers.Contains( ModifiersBaseNode.ModifierTypes.DeclareCallable ); + node.ModifiersBase.Modifiers.Contains( ModifiersBaseNode.ModifierTypes.DeclareCallable ); if ( isAbstract || isStatic ) { @@ -470,15 +482,21 @@ public override object Visit( FunctionDeclarationBaseNode node ) m_CurrentFunction = FunctionType.FUNCTION; int depth = 0; - FunctionSymbol f = new FunctionSymbol( - node.FunctionId.Id, - declaredPublicOrPrivate ? AccesModifierType.Public : AccesModifierType.Private, - isStatic ? ClassAndMemberModifiers.Static : - isAbstract ? ClassAndMemberModifiers.Abstract : ClassAndMemberModifiers.None, - isExtern, - isCallable + + FunctionSymbol f = node.AstScopeNode.resolve( node.FunctionId.Id, out int moduleId, ref depth, false ) as FunctionSymbol; + if (f == null ) + { + f = new FunctionSymbol( + node.FunctionId.Id, + declaredPublicOrPrivate ? AccesModifierType.Public : AccesModifierType.Private, + isStatic ? ClassAndMemberModifiers.Static : + isAbstract ? ClassAndMemberModifiers.Abstract : ClassAndMemberModifiers.None, + isExtern, + isCallable ); - + m_SymbolTable.CurrentScope.define( f ); + } + if ( isCallable ) { f.LinkName = node.LinkFunctionId.Id; @@ -512,10 +530,7 @@ public override object Visit( FunctionDeclarationBaseNode node ) m_SymbolTable.PopScope(); - if ( node.AstScopeNode.resolve( node.FunctionId.Id, out int moduleId, ref depth, false ) == null ) - { - m_SymbolTable.CurrentScope.define( f ); - } + m_CurrentFunction = FunctionType.NONE; @@ -524,7 +539,7 @@ public override object Visit( FunctionDeclarationBaseNode node ) public override object Visit( LocalVariableInitializerBaseNode node ) { - foreach ( var variableDeclaration in node.VariableDeclarations ) + foreach ( LocalVariableDeclarationBaseNode variableDeclaration in node.VariableDeclarations ) { Resolve( variableDeclaration ); } @@ -542,12 +557,14 @@ public override object Visit( LocalVariableDeclarationBaseNode node ) } bool declaredPublicOrPrivate = node.ModifiersBase.Modifiers != null && - node.ModifiersBase.Modifiers.Contains( ModifiersBaseNode.ModifierTypes.DeclarePublic ); + node.ModifiersBase.Modifiers.Contains( + ModifiersBaseNode.ModifierTypes.DeclarePublic ); bool isStatic = node.ModifiersBase.Modifiers != null && node.ModifiersBase.Modifiers.Contains( ModifiersBaseNode.ModifierTypes.DeclareStatic ); - DynamicVariable variableSymbol = new DynamicVariable( node.VarId.Id, + DynamicVariable variableSymbol = new DynamicVariable( + node.VarId.Id, declaredPublicOrPrivate ? AccesModifierType.Public : AccesModifierType.Private, isStatic ? ClassAndMemberModifiers.Static : ClassAndMemberModifiers.None ); @@ -568,12 +585,14 @@ public override object Visit( VariableDeclarationBaseNode node ) } bool declaredPublicOrPrivate = node.ModifiersBase.Modifiers != null && - node.ModifiersBase.Modifiers.Contains( ModifiersBaseNode.ModifierTypes.DeclarePublic ); + node.ModifiersBase.Modifiers.Contains( + ModifiersBaseNode.ModifierTypes.DeclarePublic ); bool isStatic = node.ModifiersBase.Modifiers != null && node.ModifiersBase.Modifiers.Contains( ModifiersBaseNode.ModifierTypes.DeclareStatic ); - DynamicVariable variableSymbol = new DynamicVariable( node.VarId.Id, + DynamicVariable variableSymbol = new DynamicVariable( + node.VarId.Id, declaredPublicOrPrivate ? AccesModifierType.Public : AccesModifierType.Private, isStatic ? ClassAndMemberModifiers.Static : ClassAndMemberModifiers.None ); @@ -655,6 +674,7 @@ public override object Visit( CallBaseNode node ) if ( node.PrimaryBase.PrimaryType == PrimaryBaseNode.PrimaryTypes.Identifier ) { int d = 0; + //node.AstScopeNode.resolve( node.Primary.PrimaryId.Id, out int moduleId, ref d, false); Resolve( node.PrimaryBase ); } @@ -700,7 +720,7 @@ public override object Visit( CallBaseNode node ) /*DynamicVariable symbol = node.AstScopeNode.resolve( node.Primary.PrimaryId.Id, out int moduleId, ref d ) as DynamicVariable; ClassSymbol classSymbol = symbol.resolve( symbol.Type.Name, out moduleId, ref d ) as ClassSymbol; classSymbol.resolve( terminalNode.Primary.PrimaryId.Id, out moduleId, ref d );*/ - Resolve( terminalNode.PrimaryBase); + Resolve( terminalNode.PrimaryBase ); } //SymbolTable.popScope(); @@ -724,10 +744,9 @@ public override object Visit( CallBaseNode node ) ClassSymbol classSymbol = symbol.resolve( symbol.Type.Name, out moduleId, ref d ) as ClassSymbol; classSymbol.resolve( terminalNode.Primary.PrimaryId.Id, out moduleId, ref d ); }*/ - + Resolve( terminalNode.PrimaryBase ); } - } i++; @@ -815,6 +834,13 @@ public override object Visit( BlockStatementBaseNode node ) return null; } + public override object Visit( SyncBlockNode node ) + { + Visit( node.Block ); + + return null; + } + public override object Visit( StatementBaseNode node ) { node.AstScopeNode = m_SymbolTable.CurrentScope; @@ -861,6 +887,13 @@ public override object Visit( StatementBaseNode node ) return null; } + if ( node is SyncBlockNode syncStatement ) + { + Resolve( syncStatement ); + + return null; + } + return null; } @@ -876,11 +909,11 @@ public override object Visit( IfStatementBaseNode node ) { node.AstScopeNode = m_SymbolTable.CurrentScope; Resolve( node.ExpressionBase ); - Resolve(node.ThenStatementBase); + Resolve( node.ThenStatementBase ); - if (node.ElseStatementBase != null) + if ( node.ElseStatementBase != null ) { - Resolve(node.ElseStatementBase); + Resolve( node.ElseStatementBase ); } return null; @@ -897,7 +930,7 @@ public override object Visit( ForStatementBaseNode node ) { if ( node.InitializerBase.Expressions != null ) { - foreach ( var expression in node.InitializerBase.Expressions ) + foreach ( ExpressionBaseNode expression in node.InitializerBase.Expressions ) { Resolve( expression ); } @@ -915,7 +948,7 @@ public override object Visit( ForStatementBaseNode node ) if ( node.Iterators != null ) { - foreach ( var iterator in node.Iterators ) + foreach ( ExpressionBaseNode iterator in node.Iterators ) { Resolve( iterator ); } @@ -992,7 +1025,7 @@ public override object Visit( TernaryOperationBaseNode node ) public override object Visit( PrimaryBaseNode node ) { node.AstScopeNode = m_SymbolTable.CurrentScope; - + if ( node.PrimaryType == PrimaryBaseNode.PrimaryTypes.InterpolatedString ) { foreach ( InterpolatedStringPart interpolatedStringStringPart in node.InterpolatedString.StringParts ) @@ -1000,7 +1033,7 @@ public override object Visit( PrimaryBaseNode node ) Resolve( interpolatedStringStringPart.ExpressionBaseNode ); } } - + if ( node.PrimaryType == PrimaryBaseNode.PrimaryTypes.Expression ) { Resolve( node.Expression ); @@ -1050,12 +1083,12 @@ public override object Visit( AstBaseNode baseNode ) case FunctionDeclarationBaseNode functionDeclarationNode: return Visit( functionDeclarationNode ); - + case LocalVariableDeclarationBaseNode localVar: - return Visit(localVar); + return Visit( localVar ); case LocalVariableInitializerBaseNode initializer: - return Visit(initializer); + return Visit( initializer ); case VariableDeclarationBaseNode variable: return Visit( variable ); @@ -1084,6 +1117,9 @@ public override object Visit( AstBaseNode baseNode ) case BlockStatementBaseNode blockStatementNode: return Visit( blockStatementNode ); + case SyncBlockNode syncBlockNode: + return Visit( syncBlockNode ); + case AssignmentBaseNode assignmentNode: return Visit( assignmentNode ); @@ -1126,7 +1162,6 @@ public override object Visit( AstBaseNode baseNode ) #region Private - private object Resolve( AstBaseNode astBaseNode ) { return astBaseNode.Accept( this ); diff --git a/Bite/Symbols/SymbolWithScope.cs b/Bite/Symbols/SymbolWithScope.cs index cb3af7e..1f080bd 100644 --- a/Bite/Symbols/SymbolWithScope.cs +++ b/Bite/Symbols/SymbolWithScope.cs @@ -75,10 +75,10 @@ public virtual string getFullyQualifiedName( string scopePathSeparator ) return buf.ToString(); } - public override int GetHashCode() + /*public override int GetHashCode() { return name.GetHashCode(); - } + }*/ public virtual string getQualifiedName( string scopePathSeparator ) { diff --git a/Bite/Symbols/VariableSymbol.cs b/Bite/Symbols/VariableSymbol.cs index 8b19858..8572972 100644 --- a/Bite/Symbols/VariableSymbol.cs +++ b/Bite/Symbols/VariableSymbol.cs @@ -17,7 +17,6 @@ public VariableSymbol( m_AccessModifier = accesModifierType; m_ClassAndMemberModifier = classAndMemberModifiers; } - #endregion diff --git a/BiteProgrammingLanguage.sln b/BiteProgrammingLanguage.sln index e781222..2f17aa0 100644 --- a/BiteProgrammingLanguage.sln +++ b/BiteProgrammingLanguage.sln @@ -13,7 +13,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bite.Cli", "Bite.Cli\Bite.C EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests", "UnitTests\UnitTests.csproj", "{3CD99924-9A63-4B54-A44F-9B93F3CFAB34}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmarks", "Benchmarks\Benchmarks.csproj", "{F6AF1417-0199-4315-82CF-4A7F33A7320E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmarks", "Benchmarks\Benchmarks.csproj", "{F6AF1417-0199-4315-82CF-4A7F33A7320E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfThreadTest", "WpfThreadTest\WpfThreadTest.csproj", "{0E941E9C-13D3-4AB4-97A7-55CDD3D0BD5B}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharpTest", "FSharpTest\FSharpTest.fsproj", "{69E5A329-0D7E-4C21-A44D-6B2DA04D3A98}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestMandelbrot", "TestMandelbrot\TestMandelbrot.csproj", "{46A37F39-770C-42DB-888A-CDB8EB674B3B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -45,6 +51,18 @@ Global {F6AF1417-0199-4315-82CF-4A7F33A7320E}.Debug|Any CPU.Build.0 = Debug|Any CPU {F6AF1417-0199-4315-82CF-4A7F33A7320E}.Release|Any CPU.ActiveCfg = Release|Any CPU {F6AF1417-0199-4315-82CF-4A7F33A7320E}.Release|Any CPU.Build.0 = Release|Any CPU + {0E941E9C-13D3-4AB4-97A7-55CDD3D0BD5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0E941E9C-13D3-4AB4-97A7-55CDD3D0BD5B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0E941E9C-13D3-4AB4-97A7-55CDD3D0BD5B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0E941E9C-13D3-4AB4-97A7-55CDD3D0BD5B}.Release|Any CPU.Build.0 = Release|Any CPU + {69E5A329-0D7E-4C21-A44D-6B2DA04D3A98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {69E5A329-0D7E-4C21-A44D-6B2DA04D3A98}.Debug|Any CPU.Build.0 = Debug|Any CPU + {69E5A329-0D7E-4C21-A44D-6B2DA04D3A98}.Release|Any CPU.ActiveCfg = Release|Any CPU + {69E5A329-0D7E-4C21-A44D-6B2DA04D3A98}.Release|Any CPU.Build.0 = Release|Any CPU + {46A37F39-770C-42DB-888A-CDB8EB674B3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {46A37F39-770C-42DB-888A-CDB8EB674B3B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {46A37F39-770C-42DB-888A-CDB8EB674B3B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {46A37F39-770C-42DB-888A-CDB8EB674B3B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/FSharpTest/AssemblyInfo.fs b/FSharpTest/AssemblyInfo.fs new file mode 100644 index 0000000..e387e35 --- /dev/null +++ b/FSharpTest/AssemblyInfo.fs @@ -0,0 +1,41 @@ +namespace FSharpTest.AssemblyInfo + +open System.Reflection +open System.Runtime.CompilerServices +open System.Runtime.InteropServices + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[] +[] +[] +[] +[] +[] +[] +[] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [] +[] +[] + +do + () \ No newline at end of file diff --git a/FSharpTest/FSharpTest.fsproj b/FSharpTest/FSharpTest.fsproj new file mode 100644 index 0000000..e1cb78f --- /dev/null +++ b/FSharpTest/FSharpTest.fsproj @@ -0,0 +1,50 @@ + + + + + + Debug + AnyCPU + {69E5A329-0D7E-4C21-A44D-6B2DA04D3A98} + Library + FSharpTest + FSharpTest + v4.6.2 + true + + + true + portable + false + false + bin\$(Configuration)\ + DEBUG;TRACE + 3 + --warnon:1182 + + + pdbonly + true + true + bin\$(Configuration)\ + TRACE + 3 + --warnon:1182 + + + + + + + + ..\packages\FSharp.Core.4.5.2\lib\net45\FSharp.Core.dll + + + + + + + + + + \ No newline at end of file diff --git a/FSharpTest/Library.fs b/FSharpTest/Library.fs new file mode 100644 index 0000000..f28a587 --- /dev/null +++ b/FSharpTest/Library.fs @@ -0,0 +1,18 @@ +namespace FSharpTest + +type Line = class + val X1 : float + val Y1 : float + val X2 : float + val Y2 : float + + new (x1, y1, x2, y2) as this = + { X1 = x1; Y1 = y1; X2 = x2; Y2 = y2;} + then + printfn " Creating Line: {(%g, %g), (%g, %g)}\nLength: %g" + this.X1 this.Y1 this.X2 this.Y2 this.Length + + member x.Length = + let sqr x = x * x + sqrt(sqr(x.X1 - x.X2) + sqr(x.Y1 - x.Y2) ) +end diff --git a/FSharpTest/Script.fsx b/FSharpTest/Script.fsx new file mode 100644 index 0000000..df04111 --- /dev/null +++ b/FSharpTest/Script.fsx @@ -0,0 +1,8 @@ +// Learn more about F# at http://fsharp.org. See the 'F# Tutorial' project +// for more guidance on F# programming. + +#load "Library.fs" +open FSharpTest + +// Define your library scripting code here + diff --git a/FSharpTest/packages.config b/FSharpTest/packages.config new file mode 100644 index 0000000..1c7b36b --- /dev/null +++ b/FSharpTest/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/README.md b/README.md index c9dd2db..09d4cc0 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,28 @@ # Bite Programming Language -[German Readme|Deutsches Readme](https://github.com/Maximilian-Winter/Bite-Programming-Language/blob/master/README_DE.md) -[Most of the following information can also be found here in the wiki!](https://github.com/Maximilian-Winter/Bite-Programming-Language/wiki) +Bite Logo -Bite is a dynamically typed programming language -Which means that the type of the content of a variable can change during runtime of the program. -Bite uses Modules, Classes and Functions to separate the code. +# Introduction + +[Most of the following information and more can also be found here in the wiki!](https://github.com/Maximilian-Winter/Bite-Programming-Language/wiki) + +[Join the Bite Language Discord Server!](https://discord.gg/wM44r5Ustt) + +**Bite** is a dynamically typed, object oriented programming language + +Dynamically typed, because the type of the content of a variable can change during runtime of the program. + +Object-oriented, because you can define classes to encapsulate your code and data. + +Bite uses modules, classes and functions to separate code. Modules are the basic foundation of a program in Bite. Each program consists of at least one module. The code on the module level can contain functions, classes, objects and other variables. It can also create objects from classes, call functions and access objects. -This is the place where the actual Bite program is written. -You can import one module into another to access its declarations. + +This is the place where the actual Bite program is written. You can import one module into another to access its declarations. Classes in Bite are an object-oriented way to separate Code into blueprints for objects and data structures. Classes can contain objects, other variables and functions. Classes can inherit members of other classes through inheritance. Functions in classes and functions in general can also create objects from classes, call functions and access objects. @@ -21,17 +30,31 @@ Bite compiles to a bytecode that is run on a virtual machine. The reference virtual machine, BiteVM, is a stack-based virtual machine written in C#. +# Nuget + +```ps +> Install-package BiteVM +``` + + +# Disclaimer + +Bite is still in early stages and some things may change as the language develops. + # Features * Module system * Dynamically typed +* Module-level code, variables and functions +* Classes, with inheritance * Functions are first class citizens and allow Higher Order Functions -* Importing and using C# Types and Objects +* Importing and using .NET Types and Objects * Supports .NET Framework 4.x and .NET Core 3.1 to .NET 6.0 (netstandard2.0) * [VS Code Language Extension for Bite](https://github.com/Maximilian-Winter/Bite-Language-Extension-for-VS-Code) ([VISX Installer](https://github.com/Maximilian-Winter/Bite-Language-Extension-for-VS-Code/releases)) # Overall Status -Most of Language Features are implemented. + +Most of the basic Language Features are implemented. Still has to be integrated into unity! An early test of the integration can be found [here](https://github.com/Maximilian-Winter/BiteUnity). @@ -43,7 +66,6 @@ ToDo: * Virtual Inheritance * Better Error Messages for Users - # Syntax For an introduction about how to write Code in the Bite Language, go [here](https://github.com/Maximilian-Winter/Bite-Programming-Language/wiki#writing-code-in-bite). @@ -62,30 +84,28 @@ The following code will calculate the first 50 fibonacci numbers and print them # Getting Started -To try out Bite, you will need to download the [BiteVM CLI](http://link.to.bitevm). It's a command line program that will compile and interpret Bite programs. +To try out Bite, you will need to download the [BiteVM CLI](https://github.com/Maximilian-Winter/Bite-Programming-Language/releases/download/alpha-release/Bite-Language-Alpha-v0.1.2.zip). It's a command line program that will compile and interpret Bite programs. The CLI has two modes, [REPL mode](https://github.com/Maximilian-Winter/Bite-Programming-Language/wiki/Bite-CLI#repl-mode) and [Compile and Interpret mode](https://github.com/Maximilian-Winter/Bite-Programming-Language/wiki/Bite-CLI#compile-and-interpret-mode) -To start the REPL mode, just start the [BiteVM CLI](http://link.to.bitevm). +To start the REPL mode, just start `bitevm` without parameters. -To compile the bite modules in `.\TestProgram` and start the execution, just start the [BiteVM CLI](http://link.to.bitevm) like this: +To compile the bite modules in `.\TestProgram` and start the execution: ``` bitevm.exe -p .\TestProgram ``` - You can use your favorite editor to create Bite programs, but we have a [Visual Studio Code Extension](https://github.com/Maximilian-Winter/Bite-Language-Extension-for-VS-Code/releases/tag/alpha). that gives .bite programs syntax highlighting. -## If you want to use BiteVM in your Unity or C# application, do the following: - - -Install the Nuget package for BiteVM +# Integrating BiteVM in your Unity or C# application +Install the nuget package: ```ps > Install-package BiteVM ``` +Or download the release package. Create an instance of the `BiteCompiler` class and call the `Compile()` method. The only argument is an `IEnumerable` that takes a collection of strings that contain the Bite code of each module. For this sample the modules are being loaded from disk, but they can come from memory as they are compiled during runtime. @@ -104,43 +124,35 @@ The function will return a `BiteProgram` instance. You can call the `Run()` meth program.Run(); ``` -# Importing and using C# Types and Objects. +# Importing and using .NET Types and Objects. -You can import c# types into a module. For example, to write to the console you can use the `CSharpInterface` object like so: +You can register .NET types in the BiteProgram Type Registry and import these types into a module. For example, to get and use the static class `System.Console` from C#, you first has to register it in a BiteProgram through the TypeRegisty RegisterType Function. +```c# + program.TypeRegistry.RegisterType (typeof(System.Console),"Console"); ``` -module CSharpSystem; - -import System; -using System; +The first parameter is the C# Type, the second is an alias used in Bite to identifiy the class. -var CSharpInterfaceObject = new CSharpInterface(); +After this, you can use the registered class, in Bite code, through the `NetLanguageInterface` like so: -CSharpInterfaceObject.Type = "System.Console"; - -var Console = CSharpInterfaceCall(CSharpInterfaceObject); ``` -Now you can use the variable Console like the static Class Console in C#. - - - -For .NET Core to .NET 6.0, you need to specify an Assembly Qualified Name if the type it is not in mscorlib. You don't need the full name, but you need to specify the assembly. +// Get the static class System.Console +var Console = NetLanguageInterface("Console"); +// Use the static class and call the method WriteLine. +Console.WriteLine("Hello World!"); ``` -CSharpInterfaceObject.Type = "System.Console, System.Console"; -``` - -The following code shows how to create an C# Object by calling his constructor and the use after it: -``` -var testClassInterface = new CSharpInterface(); -testClassInterface.Type = "TestApp.TestClassCSharp, TestApp"; -testClassInterface.ConstructorArguments[0] = 42; -testClassInterface.ConstructorArgumentsTypes[0] = "System.Int32"; +The following code shows how to create an C# Object in Bite by calling his constructor and the use after it: +``` +// Create an instance of TestClassCSharp, the first argument of NetLanguageInterface function is the class name, +// the second argument is a boolean that signals to the NetLanguageInterface to create an object. +// The third argument is a argument for the constructor and the fourth is its C# type. +// Constructor Arguments are passed to the NetLanguageInterface like this: constructorArgument, constructorArgumentCSharpType -var TestCSharp = CSharpInterfaceCall(testClassInterface); +var TestCSharp = NetLanguageInterface("TestClassCSharp", true, 42, "int"); TestCSharp.PrintVar(); PrintLine(TestCSharp.testfield.i); @@ -157,16 +169,27 @@ public class Foo public class TestClassCSharp { - private readonly int i = 5; + public static int t = 45; + public double i = 5; public Foo testfield { get; set; } = new Foo(); #region Public + + public TestClassCSharp() + { + i = 0; + } public TestClassCSharp( int n ) { i = n; } + + public TestClassCSharp( int n, double x, int y, float z ) + { + i = n * x * y * z; + } public void PrintVar() { @@ -176,3 +199,8 @@ public class TestClassCSharp #endregion } ``` + + +Here are more examples on how to use the `NetLanguageInterface` + +![BitNetInterface](https://user-images.githubusercontent.com/24946356/163724215-78bde228-9ce7-4c92-b7c5-52163d6fcd45.PNG) diff --git a/TestApp/Program.cs b/TestApp/Program.cs index b1ae9b0..1c4f7ee 100644 --- a/TestApp/Program.cs +++ b/TestApp/Program.cs @@ -1,80 +1,135 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Drawing; +using System.Drawing.Imaging; using System.IO; -using System.Linq; +using System.Threading; +using System.Threading.Tasks; using Bite.Compiler; +using Bite.Modules.Callables; using Bite.Runtime; -using Bite.Runtime.Bytecode; using Bite.Runtime.CodeGen; +using Bite.Runtime.Functions; +using Bite.Runtime.Functions.ForeignInterface; +using Bite.Runtime.Memory; namespace TestApp { +class ChangColorIntensity { + public static Color GetWhiteColorByIntensity( float correctionFactor) + { + float red = 255 * correctionFactor; + float green = 255 * correctionFactor; + float blue = 255 * correctionFactor; + + return Color.FromArgb((int)255, (int)red, (int)green, (int)blue); + } +} +public class WhiteColorByIntensityVm : IBiteVmCallable +{ + + public object Call( DynamicBiteVariable[] arguments ) + { + if ( arguments.Length == 1 ) + { + return ChangColorIntensity.GetWhiteColorByIntensity( + (float) arguments[0].NumberData ); + } + + return null; + } +} +public class SampleEventArgs +{ + public string Text { get; set; } // readonly + + #region Public + + public SampleEventArgs( string text ) + { + Text = text; + } + + #endregion +} + +public class DelegateTest +{ + public delegate object TestDelegate( object sender, SampleEventArgs sampleEventArgs ); + + public event TestDelegate OnSampleEvent; + + #region Public + + public void InvokeEvent( object sender, SampleEventArgs sampleEventArgs ) + { + OnSampleEvent?.Invoke( sender, sampleEventArgs ); + } + + #endregion +} + public class Program { #region Public public static void Main( string[] args ) { - IEnumerable < string > files = Directory.EnumerateFiles( ".\\TestProgram", - "*.bite", + "FibonacciExample.bite", SearchOption.AllDirectories ); BiteCompiler compiler = new BiteCompiler(); + BiteVm biteVm = new BiteVm(); + + biteVm.InitVm(); + + DelegateTest delegateTest = new DelegateTest(); + + ICSharpEvent cSharpEvent = + new CSharpEvent < DelegateTest.TestDelegate, object, SampleEventArgs >( delegateTest ); + + //delegateTest.OnSampleEvent += Test; foreach ( string file in files ) { - Console.WriteLine($"File: {file}"); + Console.WriteLine( $"File: {file}" ); List < string > biteProg = new List < string >(); biteProg.Add( File.ReadAllText( file ) ); - BiteProgram program = compiler.Compile(biteProg); - - if ( program != null ) - { - program.Run(); - /*int k = 1; - long elapsedMillisecondsAccu = 0; - - for ( int i = 0; i < k; i++ ) - { - Stopwatch stopwatch2 = new Stopwatch(); - stopwatch2.Start(); - program.Run(); - stopwatch2.Stop(); - Console.WriteLine( "--Elapsed Time for Interpreting Run {0} is {1} ms", i, stopwatch2.ElapsedMilliseconds ); - elapsedMillisecondsAccu += stopwatch2.ElapsedMilliseconds; - } - - Console.WriteLine( "--Average Elapsed Time for Interpreting per Run is {0} ms", elapsedMillisecondsAccu / k ); - Console.WriteLine( "--Total Elapsed Time for Interpreting {0} Runs is {1} ms", k, elapsedMillisecondsAccu ); - - IOrderedEnumerable < KeyValuePair < string, long > > sortedDict = - from entry in ChunkDebugHelper.InstructionCounter orderby entry.Value descending select entry; - - long totalInstructions = 0; - - foreach ( KeyValuePair < string, long > keyValuePair in sortedDict ) - { - totalInstructions += keyValuePair.Value; - } - - foreach ( KeyValuePair < string, long > keyValuePair in sortedDict ) - { - Console.WriteLine( - "--Instruction Count for Instruction {0}: {2} {1}%", - keyValuePair.Key, - ( 100.0 / totalInstructions * keyValuePair.Value ).ToString( "00.0" ), - keyValuePair.Value ); - } - - ChunkDebugHelper.InstructionCounter.Clear();*/ - - } + BiteProgram biteProgram = compiler.Compile( biteProg ); + + biteProgram.TypeRegistry.RegisterType < SampleEventArgs >(); + biteProgram.TypeRegistry.RegisterType < TestClassCSharp >(); + biteProgram.TypeRegistry.RegisterType < Bitmap >(); + biteProgram.TypeRegistry.RegisterType < ImageFormat >(); + biteProgram.TypeRegistry.RegisterType < Color >(); + // biteProgram.TypeRegistry.RegisterType < FSharpTest.Line >(); + biteProgram.TypeRegistry.RegisterType( typeof( Console ), "Console" ); + biteProgram.TypeRegistry.RegisterType (typeof(Math), "Math"); + biteVm.RegisterSystemModuleCallables( biteProgram.TypeRegistry ); + biteVm.RegisterCallable( "GetWhiteColorByIntensity", new WhiteColorByIntensityVm() ); + biteVm.SynchronizationContext = new SynchronizationContext(); + biteVm.RegisterExternalGlobalObject( "EventObject", cSharpEvent ); + + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + biteVm.Interpret( biteProgram ); + stopwatch.Stop(); + + Console.WriteLine( $"--- Elapsed Time Interpreting in Milliseconds: {stopwatch.ElapsedMilliseconds}ms --- " ); } - + + Console.ReadLine(); + } + + public static object Test( object sender, SampleEventArgs sampleEventArgs ) + { + Console.WriteLine( sampleEventArgs.Text ); + + return sender; } #endregion diff --git a/TestApp/TestApp.csproj b/TestApp/TestApp.csproj index c4cca50..532b825 100644 --- a/TestApp/TestApp.csproj +++ b/TestApp/TestApp.csproj @@ -31,6 +31,7 @@ TRACE prompt 4 + false TestApp.Program @@ -42,6 +43,7 @@ + @@ -57,11 +59,8 @@ - - PreserveNewest - - - PreserveNewest + + Always @@ -69,15 +68,49 @@ {2b941484-fb5e-4b3f-af7d-bf61238d6f16} Bite + + {69e5a329-0d7e-4c21-a44d-6b2da04d3a98} + FSharpTest + - - - - - - - + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + + Always + + + + + Always + \ No newline at end of file diff --git a/TestApp/TestClassCSharp.cs b/TestApp/TestClassCSharp.cs index cac7ce2..b4425c4 100644 --- a/TestApp/TestClassCSharp.cs +++ b/TestApp/TestClassCSharp.cs @@ -10,16 +10,27 @@ public class Foo public class TestClassCSharp { - private readonly int i = 5; + public static int t = 45; + public double i = 5; public Foo testfield { get; set; } = new Foo(); #region Public + + public TestClassCSharp() + { + i = 0; + } public TestClassCSharp( int n ) { i = n; } + + public TestClassCSharp( int n, double x, int y, float z ) + { + i = n * x * y * z; + } public void PrintVar() { diff --git a/TestApp/TestProgram/CSharpEventInvokeExample.bite b/TestApp/TestProgram/CSharpEventInvokeExample.bite new file mode 100644 index 0000000..fdb439e --- /dev/null +++ b/TestApp/TestProgram/CSharpEventInvokeExample.bite @@ -0,0 +1,21 @@ +module HelloWorld; + +import System; +using System; + +class TestSender +{ + +} +var valueSetByCallback = "Hallo"; +var sender = new TestSender(); +var counter = 0; + +var SampleEventArgs = NetLanguageInterface("SampleEventArgs", true, "", "string"); + +while(true) +{ + SampleEventArgs.Text = "Hallo: ${counter}"; + EventObject.OnSampleEvent.Invoke(sender, SampleEventArgs); + counter++; +} diff --git a/TestApp/TestProgram/CSharpEventReceiverExample.bite b/TestApp/TestProgram/CSharpEventReceiverExample.bite new file mode 100644 index 0000000..cfba944 --- /dev/null +++ b/TestApp/TestProgram/CSharpEventReceiverExample.bite @@ -0,0 +1,23 @@ +module HelloWorld; + +import System; +using System; + +var valueSetByCallback = "Hallo"; + +function CallBack(n, s) +{ + valueSetByCallback = s.Text; +} + +PrintLine(valueSetByCallback); +EventObject.OnSampleEvent += CallBack; + +var oldValue = valueSetByCallback; +while(true) +{ + if(oldValue != valueSetByCallback) + { + PrintLine("New Value From Callback: ${valueSetByCallback}"); + } +} \ No newline at end of file diff --git a/TestApp/TestProgram/CSharpSystemModule.bite.bak b/TestApp/TestProgram/CSharpSystemModule.bite.bak deleted file mode 100644 index 8418e5b..0000000 --- a/TestApp/TestProgram/CSharpSystemModule.bite.bak +++ /dev/null @@ -1,16 +0,0 @@ -module CSharpSystem; - -import System; -using System; - -var CSharpInterfaceObject = new CSharpInterface(); - -CSharpInterfaceObject.Type = "System.Console"; - -var Console = CSharpInterfaceCall(CSharpInterfaceObject); - - - - - - diff --git a/TestApp/TestProgram/Interop.bite b/TestApp/TestProgram/Interop.bite new file mode 100644 index 0000000..37ccdd6 --- /dev/null +++ b/TestApp/TestProgram/Interop.bite @@ -0,0 +1,11 @@ +module Mandelbrot; + +import Interop; +using Interop; + +var xres = 300; +var yres = 300; + +var bitmapConstructor = GetConstructor("Bitmap", "int", "int"); + +var img = bitmapConstructor(xres, yres); diff --git a/TestApp/TestProgram/MainModule.bite b/TestApp/TestProgram/MainModule.bite deleted file mode 100644 index bd368b6..0000000 --- a/TestApp/TestProgram/MainModule.bite +++ /dev/null @@ -1,533 +0,0 @@ -module HelloWorld; - -import System; -using System; - -var testClassInterface = new CSharpInterface(); -testClassInterface.Type = "TestApp.TestClassCSharp, TestApp"; - -testClassInterface.ConstructorArguments[0] = 0; -testClassInterface.ConstructorArgumentsTypes[0] = "System.Int32"; - - -var TestCSharp = CSharpInterfaceCall(testClassInterface); - -PrintLine(TestCSharp.testfield.i); -for(var i = 0; i < 5000; i++) -{ - TestCSharp.testfield.i += 25; - PrintLine(TestCSharp.testfield.i); -} -/* - - -var testClassInterface = new CSharpInterface(); - -testClassInterface.Type = "TestApp.TestClassCSharp, TestApp"; -testClassInterface.ConstructorArguments[0] = 42; -testClassInterface.ConstructorArgumentsTypes[0] = "System.Int32"; - -var TestCSharp = CSharpInterfaceCall(testClassInterface); - -PrintLine(TestCSharp.testfield.i); - -for(var i = 0; i < 5000; i++) -{ - TestCSharp.testfield.i += 25; -} - -PrintLine(TestCSharp.testfield.i); - -/* -class A -{ - var i = 5; -} - -class B -{ - var testfield = new A(); -} - -var TestCSharp = new B(); - -PrintLine(TestCSharp.testfield.i); -for(var i = 0; i < 5000; i++) -{ - TestCSharp.testfield.i = TestCSharp.testfield.i + 25; -} -PrintLine(TestCSharp.testfield.i); -*/ - -/* - -var testClassInterface = new CSharpInterface(); -testClassInterface.Type = "TestApp.TestClassCSharp, TestApp"; - -testClassInterface.ConstructorArguments[0] = 0; -testClassInterface.ConstructorArgumentsTypes[0] = "System.Int32"; - - -var TestCSharp = CSharpInterfaceCall(testClassInterface); - -PrintLine(TestCSharp.testfield.i); -for(var i = 0; i < 5000; i++) -{ - TestCSharp.testfield.i += 25; - PrintLine(TestCSharp.testfield.i); -} -*/ - -/* -// Fibonacci function returned as return value example -module MainModule; - -import System; -using System; - -function FindFibonacciNumber(n) -{ - var count= 2; - var a = 1; - var b = 1; - var c = 1; - if(n == 0) - { - return 0; - } - while(count 0) - { - count++; - } - a++; - } - return (--a); -} - -PrintLine(FindPrimeNumber(2)); -PrintLine(FindPrimeNumber(4)); -PrintLine(FindPrimeNumber(8)); -PrintLine(FindPrimeNumber(16)); -PrintLine(FindPrimeNumber(32)); -PrintLine(FindPrimeNumber(64)); - -*/ - -/* -// Fibonacci in Class Example - -class Fibo -{ - function FindFibonacciNumber(n) - { - var count= 2; - var a = 1; - var b = 1; - var c = 1; - if(n == 0) - { - return 0; - } - while(count= maxiter ) + { + setPixel( img, i, j, colorBlack ); + } + else + { + var intensity = mathSqrt(k / maxiter); + setPixel( img, i, j, GetWhiteColorByIntensity(intensity)); + } + } +} + +img.Save( "file.png", "string", imgFormat, "ImageFormat" ); diff --git a/TestApp/TestProgram/NetLanguageInterfaceExample.bite b/TestApp/TestProgram/NetLanguageInterfaceExample.bite new file mode 100644 index 0000000..22e641f --- /dev/null +++ b/TestApp/TestProgram/NetLanguageInterfaceExample.bite @@ -0,0 +1,42 @@ +module HelloWorld; + +import System; +using System; + + +// Create variable that holds static class. In this case it is System.Console. +var Console = NetLanguageInterface("Console"); + +// Use the variable declared before and call the WriteLine method. +Console.WriteLine("Hello World!"); + + +// Create variable that holds an instance of TestClassCSharp through use of the default constructor. +var TestCSharp1 = NetLanguageInterface("TestClassCSharp", true); + +// Access the field 'i' from the TestClassCSharp instance. +Console.WriteLine(TestCSharp1.i); + + +// Create variable that holds an instance of TestClassCSharp, it passes an argument of type int to the constructor. +var TestCSharp2 = NetLanguageInterface("TestClassCSharp", true, 42, "int"); + +// Access the field 'i' from the TestClassCSharp instance. +Console.WriteLine(TestCSharp2.i); + + +// Create variable that holds an instance of TestClassCSharp, it passes 4 arguments to the constructor int, double, int and float. +var TestCSharp3 = NetLanguageInterface("TestClassCSharp", true, 42, "int", 42.24, "double", 42, "int", 42.42, "float"); + +// Access the field 'i' from the TestClassCSharp instance. +Console.WriteLine(TestCSharp3.i); + + +// Create variable that holds an instance of Line from a F# Library, it passes 4 arguments to the constructor all of them floats. +var FSharpLine = NetLanguageInterface("Line", true, 1, "float", 2, "float", 3, "float", 4, "float"); + +// Access the field 'Y2' from the Line instance. +Console.WriteLine(FSharpLine.Y2); + + + diff --git a/TestApp/packages.config b/TestApp/packages.config index 2bc8a6a..a196d26 100644 --- a/TestApp/packages.config +++ b/TestApp/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/TestAppNet6/Program.cs b/TestAppNet6/Program.cs index bb7dd9d..c0c0f90 100644 --- a/TestAppNet6/Program.cs +++ b/TestAppNet6/Program.cs @@ -48,7 +48,7 @@ public static void PerfTests() BiteResult result = program.Run(); stopwatch2.Stop(); - Console.WriteLine(result.ReturnValue.ToString() ); + Console.WriteLine( result.ReturnValue.ToString() ); Console.WriteLine( "--Elapsed Time for Interpreting Run {0} is {1} ms", i, stopwatch2.ElapsedMilliseconds ); elapsedMillisecondsAccu += stopwatch2.ElapsedMilliseconds; @@ -81,16 +81,16 @@ public static void PerfTests() public static void TestCodeModules() { - List < Module > modules = new List < Module > + List < Module > modules = new() { new() { Name = "CSharpSystem", Imports = new[] { "System" }, Code = @" -var CSharpInterfaceObject = new CSharpInterface(); +var CSharpInterfaceObject = new NetInterfaceObject(); CSharpInterfaceObject.Type = ""System.Console, System.Console""; -var Console = CSharpInterfaceCall(CSharpInterfaceObject); +var Console = NetLanguageInterface(CSharpInterfaceObject); " }, new() @@ -124,6 +124,6 @@ public static void TestProgram() BiteProgram program = compiler.Compile( files.Select( File.ReadAllText ) ); BiteResult vm = program.Run(); } - + #endregion } diff --git a/TestAppNet6/TestAppNet6.csproj b/TestAppNet6/TestAppNet6.csproj index db3cf94..b213ebc 100644 --- a/TestAppNet6/TestAppNet6.csproj +++ b/TestAppNet6/TestAppNet6.csproj @@ -6,12 +6,12 @@ - + + + + + - - - - diff --git a/TestMandelbrot/Mandelbrot.bite b/TestMandelbrot/Mandelbrot.bite new file mode 100644 index 0000000..4b64679 --- /dev/null +++ b/TestMandelbrot/Mandelbrot.bite @@ -0,0 +1,65 @@ +module Mandelbrot; + +import System; +using System; + +extern callable function GetWhiteColorByIntensity ( intensity ); + +var xmin = -2.0; +var xmax = 2.0; +var ymin = -2.0; +var ymax = 2.0; + +var maxiter = 1000; + +var xres = 512; +var yres = ( xres * ( ymax - ymin ) ) / ( xmax - xmin ); + +var dx = ( xmax - xmin ) / xres; +var dy = ( ymax - ymin ) / yres; + +var x; +var y; +var i; +var j; +var k; + +var img = NetLanguageInterface("Bitmap", true, xres, "int", yres, "int"); +var imgFormat = NetLanguageInterface("ImageFormat", "Png"); +var colorBlack = NetLanguageInterface("Color", "Black"); +var colorBrown = NetLanguageInterface("Color", "Brown"); +var math = NetLanguageInterface("Math"); + +for ( j = 0; j < yres; j++ ) +{ + y = ymax - j * dy; + + for ( i = 0; i < xres; i++ ) + { + var u = 0.0; + var v = 0.0; + var u2 = u * u; + var v2 = v * v; + x = xmin + i * dx; + + for ( k = 1; k < maxiter && ( u2 + v2 < 4.0 ); k++ ) + { + v = 2 * u * v + y; + u = u2 - v2 + x; + u2 = u * u; + v2 = v * v; + } + + if ( k >= maxiter ) + { + img.SetPixel( i, "int", j, "int", colorBlack, "Color" ); + } + else + { + var intensity = math.Sqrt(k / maxiter, "double"); + img.SetPixel( i, "int", j, "int", GetWhiteColorByIntensity(intensity), "Color" ); + } + } +} + +img.Save( "file.png", "string", imgFormat, "ImageFormat" ); \ No newline at end of file diff --git a/TestMandelbrot/Program.cs b/TestMandelbrot/Program.cs new file mode 100644 index 0000000..6a6cd92 --- /dev/null +++ b/TestMandelbrot/Program.cs @@ -0,0 +1,111 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Bite.Compiler; +using Bite.Modules.Callables; +using Bite.Runtime; +using Bite.Runtime.Bytecode; +using Bite.Runtime.CodeGen; +using Bite.Runtime.Functions; +using Bite.Runtime.Memory; + +namespace TestMandelbrot +{ + +class ChangColorIntensity { + public static Color GetWhiteColorByIntensity( float correctionFactor) + { + float red = 255 * correctionFactor; + float green = 255 * correctionFactor; + float blue = 255 * correctionFactor; + + return Color.FromArgb((int)255, (int)red, (int)green, (int)blue); + } +} +public class WhiteColorByIntensityVm : IBiteVmCallable +{ + + public object Call( DynamicBiteVariable[] arguments ) + { + if ( arguments.Length == 1 ) + { + return ChangColorIntensity.GetWhiteColorByIntensity( + (float) arguments[0].NumberData ); + } + + return null; + } +} +internal class Program +{ + public static void Main( string[] args ) + { + IEnumerable < string > files = Directory.EnumerateFiles( + ".\\", + "Mandelbrot.bite", + SearchOption.AllDirectories ); + + BiteCompiler compiler = new BiteCompiler(); + + BiteVm biteVmReciever = new BiteVm(); + + biteVmReciever.InitVm(); + + BiteProgram programReciever = null; + + foreach ( string file in files ) + { + Console.WriteLine( $"File: {file}" ); + List < string > biteProg = new List < string >(); + biteProg.Add( File.ReadAllText( file ) ); + programReciever = compiler.Compile( biteProg ); + + programReciever.TypeRegistry.RegisterType < Bitmap >(); + programReciever.TypeRegistry.RegisterType < ImageFormat >(); + programReciever.TypeRegistry.RegisterType < Color >(); + programReciever.TypeRegistry.RegisterType (typeof(Math), "Math"); + biteVmReciever.RegisterCallable( "GetWhiteColorByIntensity", new WhiteColorByIntensityVm() ); + biteVmReciever.RegisterSystemModuleCallables( programReciever.TypeRegistry ); + biteVmReciever.SynchronizationContext = new SynchronizationContext(); + biteVmReciever.TypeRegistry = programReciever.TypeRegistry; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + biteVmReciever.Interpret( programReciever ); + stopwatch.Stop(); + + Console.WriteLine( + $"--- Elapsed Time Interpreting in Milliseconds: {stopwatch.ElapsedMilliseconds}ms --- " ); + + IOrderedEnumerable < KeyValuePair < string, long > > sortedDict = + from entry in ChunkDebugHelper.InstructionCounter orderby entry.Value descending select entry; + + long totalInstructions = 0; + + foreach ( KeyValuePair < string, long > keyValuePair in sortedDict ) + { + totalInstructions += keyValuePair.Value; + } + + foreach ( KeyValuePair < string, long > keyValuePair in sortedDict ) + { + Console.WriteLine( + "--Instruction Count for Instruction {0}: {2} {1}%", + keyValuePair.Key, + ( 100.0 / totalInstructions * keyValuePair.Value ).ToString( "00.0" ), + keyValuePair.Value ); + } + } + + + + Console.ReadLine(); + } +} + +} diff --git a/TestMandelbrot/Properties/AssemblyInfo.cs b/TestMandelbrot/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1ab2ed7 --- /dev/null +++ b/TestMandelbrot/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle( "TestMandelbrot" )] +[assembly: AssemblyDescription( "" )] +[assembly: AssemblyConfiguration( "" )] +[assembly: AssemblyCompany( "" )] +[assembly: AssemblyProduct( "TestMandelbrot" )] +[assembly: AssemblyCopyright( "Copyright © 2022" )] +[assembly: AssemblyTrademark( "" )] +[assembly: AssemblyCulture( "" )] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible( false )] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid( "46A37F39-770C-42DB-888A-CDB8EB674B3B" )] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion( "1.0.0.0" )] +[assembly: AssemblyFileVersion( "1.0.0.0" )] diff --git a/TestMandelbrot/TestMandelbrot.csproj b/TestMandelbrot/TestMandelbrot.csproj new file mode 100644 index 0000000..e2c6413 --- /dev/null +++ b/TestMandelbrot/TestMandelbrot.csproj @@ -0,0 +1,67 @@ + + + + + Debug + AnyCPU + {46A37F39-770C-42DB-888A-CDB8EB674B3B} + Exe + Properties + TestMandelbrot + TestMandelbrot + v4.8 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + + + + + + + + + + + + + {2b941484-fb5e-4b3f-af7d-bf61238d6f16} + Bite + + + + + Always + + + + + + diff --git a/UnitTests/ExpressionUnitTests.cs b/UnitTests/ExpressionUnitTests.cs index 020314c..75059ac 100644 --- a/UnitTests/ExpressionUnitTests.cs +++ b/UnitTests/ExpressionUnitTests.cs @@ -11,7 +11,7 @@ public class ExpressionUnitTests { private BiteResult ExecExpression( string expression ) { - var compiler = new BiteCompiler(); + BiteCompiler compiler = new BiteCompiler(); BiteProgram program = compiler.CompileExpression( expression ); @@ -373,7 +373,6 @@ public void StringConcatenation() Assert.Equal( "Hello World", result.ReturnValue.StringData ); } } - } } diff --git a/UnitTests/ModuleUnitTests.cs b/UnitTests/ModuleUnitTests.cs index 334e960..82046ce 100644 --- a/UnitTests/ModuleUnitTests.cs +++ b/UnitTests/ModuleUnitTests.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using Bite.Compiler; using Bite.Runtime; @@ -13,7 +12,7 @@ public class ModuleUnitTests { private BiteResult ExecModules( IEnumerable < string > modules ) { - var compiler = new BiteCompiler(); + BiteCompiler compiler = new BiteCompiler(); BiteProgram program = compiler.Compile( modules ); @@ -39,7 +38,6 @@ public void AmbiguousReferences() } } - [Fact] public void LoadModuleDependencyBehavior() { @@ -55,7 +53,7 @@ public void LoadModuleDependencyBehavior() [Fact] public void LoadModuleDependencyBehaviorInvariant() { - string moduleA = "module ModuleA; import ModuleC; import ModuleB; var a = 1; ModuleB.foo();"; + string moduleA = "module ModuleA; import ModuleC; import ModuleB; var a = 1; var b = ModuleB.foo(); b;"; string moduleB = "module ModuleB; import ModuleD; ModuleD.d = 11; function foo() { return ModuleD.d; }"; string moduleC = "module ModuleC; import ModuleD; ModuleD.d = 13; function foo() { return ModuleD.d; }"; string moduleD = "module ModuleD; var d = 7;"; @@ -115,22 +113,20 @@ public void ReferenceStringsFromSubmodule() } [Fact] - public void VariableDeclaration() + public void SystemModuleDeclaration() { - string mainModule = "module MainModule; import System; using System; var a = 1;"; + string mainModule = "module MainModule; import System; using System; PrintLine( \"Hello World!\" );"; BiteResult result = ExecModules( new[] { mainModule } ); Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); } [Fact] - public void SystemModuleDeclaration() + public void VariableDeclaration() { - string mainModule = "module MainModule; import System; using System; PrintLine( \"Hello World!\" );"; + string mainModule = "module MainModule; import System; using System; var a = 1;"; BiteResult result = ExecModules( new[] { mainModule } ); Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); } - - - } +} } diff --git a/UnitTests/StatementUnitTests.cs b/UnitTests/StatementUnitTests.cs index 6fb0e9e..0f643c1 100644 --- a/UnitTests/StatementUnitTests.cs +++ b/UnitTests/StatementUnitTests.cs @@ -8,17 +8,83 @@ namespace UnitTests { +public class Bar +{ + public int i; + public float f; + public double d; + + public int I { get; set; } + + public float F { get; set; } + + public double D { get; set; } +} + public class StatementUnitTests { private BiteResult ExecStatements( string statements, Dictionary < string, object > externalObjects = null ) { - var compiler = new BiteCompiler(); + BiteCompiler compiler = new BiteCompiler(); BiteProgram program = compiler.CompileStatements( statements ); return program.Run( externalObjects ); } + //[Fact] + //Corner Case + public void PostfixDecrement() + { + BiteResult result = ExecStatements( "var a = 7; a--;" ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + Assert.Equal( 7, result.ReturnValue.NumberData ); + } + + //[Fact] + //Corner Case + public void PostfixIncrement() + { + BiteResult result = ExecStatements( "var a = 7; a++;" ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + Assert.Equal( 7, result.ReturnValue.NumberData ); + } + + //[Fact] + //Corner Case + public void PostFixReturn() + { + // While this code probably doesn't make sense, + // i.e. you never return a postix, it is still valid code + BiteResult result = ExecStatements( "var a = 1; a++;" ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + Assert.Equal( 1, result.ReturnValue.NumberData ); + } + + //[Fact] + //Corner Case + public void PostFixReturnFromFunction() + { + // While this code probably doesn't make sense, + // i.e. you never return a postix, it is still valid code + BiteResult result = ExecStatements( "function fn(a) { return a++; } fn(1);" ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + Assert.Equal( 1, result.ReturnValue.NumberData ); + } + + [Fact] + public void AddTwoNumbers() + { + string statements = @"var c = 1 + 2; c;"; + + BiteResult result = ExecStatements( + statements, + new Dictionary < string, object > { { "a", 1 }, { "b", 2 } } ); + + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + Assert.Equal( 3, result.ReturnValue.NumberData ); + } + [Fact] public void AfterMultiArgumentPostFix() { @@ -52,15 +118,45 @@ public void AfterMultiPostFix() } [Fact] - public void ArithmeticAssignment() + public void ArithmeticAdditionAssignment() { - string statements = @"var a = 1; + string statements = @" + class foo { + var x = 5; + var y = 2; + } + + var a = 1; + var b = new foo(); + a += 2; - a;"; + b.x += 2; + b[""y""] += 3; + + bar.i += 1; + bar.f += 2; + bar.d += 3; + + bar.I += 4; + bar.F += 5; + bar.D += 6; + + a + b.x + b.y; + "; + + Bar bar = new Bar(); + + BiteResult result = ExecStatements( statements, new Dictionary < string, object > { { "bar", bar } } ); - BiteResult result = ExecStatements( statements ); Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); - Assert.Equal( 3, result.ReturnValue.NumberData ); + + Assert.Equal( 15, result.ReturnValue.NumberData ); + Assert.Equal( 1, bar.i ); + Assert.Equal( 2f, bar.f ); + Assert.Equal( 3d, bar.d ); + Assert.Equal( 4, bar.I ); + Assert.Equal( 5f, bar.F ); + Assert.Equal( 6d, bar.D ); } [Fact] @@ -72,29 +168,552 @@ public void ArithmeticAssignmentAssignment() BiteResult result = ExecStatements( statements ); Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); - Assert.Equal( 3, result.ReturnValue.NumberData ); + Assert.Equal( 3, result.ReturnValue.NumberData ); + } + + [Fact] + public void ArithmeticBitwiseAndAssignment() + { + string statements = @" + class foo { + var x = 4; + var y = 7; + } + + var a = 8; + var b = new foo(); + + a &= 3; + + b.x &= 2; + b[""y""] &= 3; + + bar.i &= 1; + bar.f &= 2; + bar.d &= 3; + + bar.I &= 4; + bar.F &= 5; + bar.D &= 6; + + a + b.x + b.y; + "; + + Bar bar = new Bar + { + i = 1, + f = 1f, + d = 2d, + I = 2, + F = 4f, + D = 5d + }; + + BiteResult result = ExecStatements( statements, new Dictionary < string, object > { { "bar", bar } } ); + + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + + Assert.Equal( 3, result.ReturnValue.NumberData ); + Assert.Equal( 1, bar.i ); + Assert.Equal( 0f, bar.f ); + Assert.Equal( 2d, bar.d ); + Assert.Equal( 0, bar.I ); + Assert.Equal( 4f, bar.F ); + Assert.Equal( 4d, bar.D ); + } + + [Fact] + public void ArithmeticBitwiseOrAssignment() + { + string statements = @" + class foo { + var x = 4; + var y = 7; + } + + var a = 8; + var b = new foo(); + + a |= 3; + + b.x |= 2; + b[""y""] |= 3; + + bar.i |= 1; + bar.f |= 2; + bar.d |= 3; + + bar.I |= 4; + bar.F |= 5; + bar.D |= 6; + + a + b.x + b.y; + "; + + Bar bar = new Bar + { + i = 1, + f = 1f, + d = 2d, + I = 2, + F = 4f, + D = 5d + }; + + BiteResult result = ExecStatements( statements, new Dictionary < string, object > { { "bar", bar } } ); + + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + + Assert.Equal( 24, result.ReturnValue.NumberData ); + Assert.Equal( 1, bar.i ); + Assert.Equal( 3f, bar.f ); + Assert.Equal( 3d, bar.d ); + Assert.Equal( 6, bar.I ); + Assert.Equal( 5f, bar.F ); + Assert.Equal( 7d, bar.D ); + } + + [Fact] + public void ArithmeticBitwiseShiftLeftAssignment() + { + string statements = @" + class foo { + var x = 4; + var y = 7; + } + + var a = 8; + var b = new foo(); + + a <<= 3; + + b.x <<= 2; + b[""y""] <<= 3; + + bar.i <<= 1; + bar.f <<= 2; + bar.d <<= 3; + + bar.I <<= 4; + bar.F <<= 5; + bar.D <<= 6; + + a + b.x + b.y; + "; + + Bar bar = new Bar + { + i = 1, + f = 1f, + d = 2d, + I = 2, + F = 4f, + D = 5d + }; + + BiteResult result = ExecStatements( statements, new Dictionary < string, object > { { "bar", bar } } ); + + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + + Assert.Equal( 136, result.ReturnValue.NumberData ); + Assert.Equal( 2, bar.i ); + Assert.Equal( 4f, bar.f ); + Assert.Equal( 16d, bar.d ); + Assert.Equal( 32, bar.I ); + Assert.Equal( 128f, bar.F ); + Assert.Equal( 320d, bar.D ); + } + + [Fact] + public void ArithmeticBitwiseShiftRightAssignment() + { + string statements = @" + class foo { + var x = 4; + var y = 7; + } + + var a = 8; + var b = new foo(); + + a >>= 3; + + b.x >>= 2; + b[""y""] >>= 3; + + bar.i >>= 1; + bar.f >>= 2; + bar.d >>= 3; + + bar.I >>= 4; + bar.F >>= 5; + bar.D >>= 6; + + a + b.x + b.y; + "; + + Bar bar = new Bar + { + i = 256, + f = 256, + d = 256, + I = 256, + F = 256, + D = 256 + }; + + BiteResult result = ExecStatements( statements, new Dictionary < string, object > { { "bar", bar } } ); + + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + + Assert.Equal( 2, result.ReturnValue.NumberData ); + Assert.Equal( 128, bar.i ); + Assert.Equal( 64f, bar.f ); + Assert.Equal( 32d, bar.d ); + Assert.Equal( 16, bar.I ); + Assert.Equal( 8f, bar.F ); + Assert.Equal( 4d, bar.D ); + } + + [Fact] + public void ArithmeticDivisionAssignment() + { + string statements = @" + class foo { + var x = 10; + var y = 6; + } + + var a = 15; + var b = new foo(); + + a /= 3; + + b.x /= 2; + b[""y""] /= 3; + + bar.i /= 1; + bar.f /= 2; + bar.d /= 3; + + bar.I /= 4; + bar.F /= 5; + bar.D /= 6; + + a + b.x + b.y; + "; + + Bar bar = new Bar + { + i = 60, + f = 60f, + d = 60d, + I = 60, + F = 60f, + D = 60d + }; + + BiteResult result = ExecStatements( statements, new Dictionary < string, object > { { "bar", bar } } ); + + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + + Assert.Equal( 12, result.ReturnValue.NumberData ); + Assert.Equal( 60, bar.i ); + Assert.Equal( 30f, bar.f ); + Assert.Equal( 20d, bar.d ); + Assert.Equal( 15, bar.I ); + Assert.Equal( 12f, bar.F ); + Assert.Equal( 10d, bar.D ); + } + + [Fact] + public void ArithmeticModuloAssignment() + { + string statements = @" + class foo { + var x = 7; + var y = 6; + } + + var a = 17; + var b = new foo(); + + a %= 3; + + b.x %= 2; + b[""y""] %= 3; + + bar.i %= 1; + bar.f %= 2; + bar.d %= 3; + + bar.I %= 4; + bar.F %= 5; + bar.D %= 6; + + a + b.x + b.y; + "; + + Bar bar = new Bar + { + i = 10, + f = 10f, + d = 10d, + I = 10, + F = 10f, + D = 10d + }; + + BiteResult result = ExecStatements( statements, new Dictionary < string, object > { { "bar", bar } } ); + + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + + Assert.Equal( 3, result.ReturnValue.NumberData ); + Assert.Equal( 0, bar.i ); + Assert.Equal( 0f, bar.f ); + Assert.Equal( 1d, bar.d ); + Assert.Equal( 2, bar.I ); + Assert.Equal( 0f, bar.F ); + Assert.Equal( 4d, bar.D ); + } + + [Fact] + public void ArithmeticMultiplicationAssignment() + { + string statements = @" + class foo { + var x = 5; + var y = 2; + } + + var a = 5; + var b = new foo(); + + a *= 3; + + b.x *= 2; + b[""y""] *= 3; + + bar.i *= 1; + bar.f *= 2; + bar.d *= 3; + + bar.I *= 4; + bar.F *= 5; + bar.D *= 6; + + a + b.x + b.y; + "; + + Bar bar = new Bar + { + i = 2, + f = 2f, + d = 2d, + I = 2, + F = 2f, + D = 2d + }; + + BiteResult result = ExecStatements( statements, new Dictionary < string, object > { { "bar", bar } } ); + + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + + Assert.Equal( 31, result.ReturnValue.NumberData ); + Assert.Equal( 2, bar.i ); + Assert.Equal( 4f, bar.f ); + Assert.Equal( 6d, bar.d ); + Assert.Equal( 8, bar.I ); + Assert.Equal( 10f, bar.F ); + Assert.Equal( 12d, bar.D ); + } + + [Fact] + public void ArithmeticSubtractionAssignment() + { + string statements = @" + class foo { + var x = 5; + var y = 2; + } + + var a = 5; + var b = new foo(); + + a -= 3; + + b.x -= 2; + b[""y""] -= 3; + + bar.i -= 1; + bar.f -= 2; + bar.d -= 3; + + bar.I -= 4; + bar.F -= 5; + bar.D -= 6; + + a + b.x + b.y; +"; + + Bar bar = new Bar(); + + BiteResult result = ExecStatements( statements, new Dictionary < string, object > { { "bar", bar } } ); + + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + + Assert.Equal( 4, result.ReturnValue.NumberData ); + Assert.Equal( -1, bar.i ); + Assert.Equal( -2f, bar.f ); + Assert.Equal( -3d, bar.d ); + Assert.Equal( -4, bar.I ); + Assert.Equal( -5f, bar.F ); + Assert.Equal( -6d, bar.D ); + } + + [Fact] + public void ArrayInitializers() + { + string statements = @" + function foo() { + return 5; + } + + var a = [ 10, 20, 30, ""Hello"", foo(), foo ];"; + + BiteResult result = ExecStatements( statements ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + } + + [Fact] + public void Assignment() + { + string statements = @" + class foo { + var x = 5; + var y = 2; + } + + var a = 1; + var b = new foo(); + + b.x = 2; + b[""y""] = 3; + + bar.i = 1; + bar.f = 2; + bar.d = 3; + + bar.I = 4; + bar.F = 5; + bar.D = 6; + + a + b.x + b.y; + "; + + Bar bar = new Bar(); + + BiteResult result = ExecStatements( statements, new Dictionary < string, object > { { "bar", bar } } ); + + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + + Assert.Equal( 6, result.ReturnValue.NumberData ); + Assert.Equal( 1, bar.i ); + Assert.Equal( 2f, bar.f ); + Assert.Equal( 3d, bar.d ); + Assert.Equal( 4, bar.I ); + Assert.Equal( 5f, bar.F ); + Assert.Equal( 6d, bar.D ); + } + + [Fact] + public void ClassConstructorArguments() + { + string statements = @"class TestClass + { + var x = 5; + + function TestClass(n) + { + x = n; + } + } + + var a = new TestClass(150); + + a.x;"; + + BiteResult result = ExecStatements( statements ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + Assert.Equal( 150, result.ReturnValue.NumberData ); + } + + [Fact] + public void ClassConstructorMultipleArguments() + { + string statements = @"class TestClass + { + var x = 0; + var y = 0; + var z = 0; + + function TestClass( a, b, c ) + { + x = a; + y = b; + z = c; + } + } + + var a = new TestClass(1, 3, 7); + + a.x + a.y + a.z;"; + + BiteResult result = ExecStatements( statements ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + Assert.Equal( 11, result.ReturnValue.NumberData ); + } + + [Fact] + public void ClassExpressionArgument() + { + string statements = @"class Foo { + var x = 5; + } + + function bar(foo) { + return foo.x; + } + + var a = bar(new Foo()); + + a;"; + + BiteResult result = ExecStatements( statements ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + Assert.Equal( 5, result.ReturnValue.NumberData ); } [Fact] - public void ClassConstructorArguments() + public void ClassExpressionAssignment() { - string statements = @"class TestClass - { - var x = 5; + string statements = @"class Foo { + var x = 5; + } - function TestClass(n) - { - x = n; - } + class Bar { + var foo; } - var a = new TestClass(150); + var a = new Bar(); - a.x;"; + a.foo = new Foo(); + + a.foo.x;"; BiteResult result = ExecStatements( statements ); Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); - Assert.Equal( 150, result.ReturnValue.NumberData ); + Assert.Equal( 5, result.ReturnValue.NumberData ); } [Fact] @@ -115,31 +734,54 @@ public void ClassFields() } [Fact] - public void ClassInstanceAsArgument() + public void ClassFieldsAssignment() { string statements = @"class TestClass { - var x = 5; - function TestClass(n) - { - x = n; - } + var x; + var y; } - function TestFunction(n) + var a = new TestClass(); + + function foo () { + return 5; + } + + a.x = foo(); + a.y = ""five""; + + a.x + a.y;"; + + BiteResult result = ExecStatements( statements ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + Assert.Equal( "5five", result.ReturnValue.StringData ); + } + + [Fact] + public void ClassFieldsInitializers() + { + string statements = @"class TestClass { - n.x = 10; + var x; + var y; } - var a = new TestClass(150); + function foo () { + return 5; + } - TestFunction(a); + var a = new TestClass() { + x = ""Hello"", + y = 10, + z = foo() + } - a.x;"; + a.x + a.y + a.z;"; BiteResult result = ExecStatements( statements ); Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); - Assert.Equal( 10, result.ReturnValue.NumberData ); + Assert.Equal( "Hello105", result.ReturnValue.StringData ); } [Fact] @@ -175,6 +817,55 @@ function bar() { Assert.Equal( 6, result.ReturnValue.NumberData ); } + [Fact] + public void ClassInstanceAsArgument() + { + string statements = @"class TestClass + { + var x = 5; + function TestClass(n) + { + x = n; + } + } + + function TestFunction(n) + { + n.x = 10; + } + + var a = new TestClass(150); + + TestFunction(a); + + a.x;"; + + BiteResult result = ExecStatements( statements ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + Assert.Equal( 10, result.ReturnValue.NumberData ); + } + + [Fact] + public void DictionaryInitializers() + { + string statements = @" + function foo() { + return 5; + } + + var a = { + x: 10, + y: 20, + z: 30, + a: ""Hello"", + b: foo(), + c: foo + };"; + + BiteResult result = ExecStatements( statements ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + } + [Fact] public void DynamicMemberFunctionCall() { @@ -274,33 +965,14 @@ function TestClass(n) Assert.Equal( 10, result.ReturnValue.NumberData ); } - [Fact] - public void AddTwoNumbers() - { - string statements = @"var c = 1 + 2; c;"; - - BiteResult result = ExecStatements( statements, - new Dictionary() - { - { "a", 1 }, - { "b", 2 } - } ); - - Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); - Assert.Equal( 3, result.ReturnValue.NumberData ); - } - [Fact] public void ExternalValues() { string statements = @"var c = a + b; c;"; - BiteResult result = ExecStatements( statements, - new Dictionary < string, object >() - { - { "a", 1 }, - { "b", 2 } - }); + BiteResult result = ExecStatements( + statements, + new Dictionary < string, object > { { "a", 1 }, { "b", 2 } } ); Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); Assert.Equal( 3, result.ReturnValue.NumberData ); @@ -312,13 +984,12 @@ public void ForEverLoopBreak() BiteResult result = ExecStatements( "var i = 0; for (;;) { i++; if (i == 10) { break; } } i;" ); Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); Assert.Equal( 10, result.ReturnValue.NumberData ); - } [Fact] public void ForInitLoopBreak() { - var result = ExecStatements( "var a = 0; for (var i = 0;;) { i++; a++; if (i == 10) { break; } } a;" ); + BiteResult result = ExecStatements( "var a = 0; for (var i = 0;;) { i++; a++; if (i == 10) { break; } } a;" ); Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); Assert.Equal( 10, result.ReturnValue.NumberData ); } @@ -352,7 +1023,7 @@ public void ForLoopDecrement() [Fact] public void ForLoopScope() { - var result = ExecStatements( "var j = 0; for (var i = 0; i < 10; i++) { j++; i++; } j;" ); + BiteResult result = ExecStatements( "var j = 0; for (var i = 0; i < 10; i++) { j++; i++; } j;" ); Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); Assert.Equal( 5, result.ReturnValue.NumberData ); } @@ -360,7 +1031,7 @@ public void ForLoopScope() [Fact] public void ForMultipleVarAndIterator() { - var result = ExecStatements( "var a = 0; for (var i = 0, j = 0; i < 10; i++, j++ ) { a += j + i; } a;" ); + BiteResult result = ExecStatements( "var a = 0; for (var i = 0, j = 0; i < 10; i++, j++ ) { a += j + i; } a;" ); Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); Assert.Equal( 90, result.ReturnValue.NumberData ); } @@ -383,12 +1054,12 @@ public void FunctionCallNoReturnShouldThrowErrorWhenAssigned() [Fact] public void FunctionCallUseBeforeDeclarationShouldThrowException() { - Assert.Throws < BiteSymbolTableException >( () => - { - BiteResult result = ExecStatements( - "var a = foo(1); function foo(a) { return a + bar(a); } function bar(a) { return a + a; } a;" ); - - } ); + Assert.Throws < BiteSymbolTableException >( + () => + { + BiteResult result = ExecStatements( + "var a = foo(1); function foo(a) { return a + bar(a); } function bar(a) { return a + a; } a;" ); + } ); } [Fact] @@ -546,11 +1217,26 @@ public void NestedFunctionCall() [Fact] public void NestedFunctionCallReverseDeclaration() { - Assert.Throws < BiteSymbolTableException >( () => - { - ExecStatements( - "function foo(a) { return a + bar(a); } function bar(a) { return a + a; } var a = foo(1); a;" ); - } ); + Assert.Throws < BiteSymbolTableException >( + () => + { + ExecStatements( + "function foo(a) { return a + bar(a); } function bar(a) { return a + a; } var a = foo(1); a;" ); + } ); + } + + [Fact] + public void NonStringInterpolation() + { + BiteResult result = ExecStatements( + @" + var Hello = ""Hello""; + var World = ""World""; + var s = ""\${Hello} \${World}""; + s;" ); + + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + Assert.Equal( "${Hello} ${World}", result.ReturnValue.StringData ); } [Fact] @@ -584,15 +1270,6 @@ public void PostFixAssignment() Assert.Equal( 1, result.ReturnValue.NumberData ); } - //[Fact] - //Corner Case - public void PostfixDecrement() - { - BiteResult result = ExecStatements( "var a = 7; a--;" ); - Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); - Assert.Equal( 7, result.ReturnValue.NumberData ); - } - [Fact] public void PostfixDecrementAsArgument() { @@ -613,15 +1290,6 @@ public void PostFixInBinaryOperationAssignment() Assert.Equal( 3, result.ReturnValue.NumberData ); } - //[Fact] - //Corner Case - public void PostfixIncrement() - { - BiteResult result = ExecStatements( "var a = 7; a++;" ); - Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); - Assert.Equal( 7, result.ReturnValue.NumberData ); - } - [Fact] public void PostfixIncrementAsArgument() { @@ -645,28 +1313,6 @@ public void PostFixMultiple() Assert.Equal( 5, result.ReturnValue.NumberData ); } - //[Fact] - //Corner Case - public void PostFixReturn() - { - // While this code probably doesn't make sense, - // i.e. you never return a postix, it is still valid code - BiteResult result = ExecStatements( "var a = 1; a++;" ); - Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); - Assert.Equal( 1, result.ReturnValue.NumberData ); - } - - //[Fact] - //Corner Case - public void PostFixReturnFromFunction() - { - // While this code probably doesn't make sense, - // i.e. you never return a postix, it is still valid code - BiteResult result = ExecStatements( "function fn(a) { return a++; } fn(1);" ); - Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); - Assert.Equal( 1, result.ReturnValue.NumberData ); - } - [Fact] public void PrefixDecrement() { @@ -700,56 +1346,41 @@ public void PrefixIncrementAsArgument() } [Fact] - public void NonStringInterpolation() + public void StringInterpolatioInsideStringInterpolation() { - BiteResult result = ExecStatements( @" - var Hello = ""Hello""; - var World = ""World""; - var s = ""\${Hello} \${World}""; + BiteResult result = ExecStatements( + @" + var x = ""Inception""; + var s = ""${""${x}"" + "" "" + ""World""}""; s;" ); - Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); - Assert.Equal( "${Hello} ${World}", result.ReturnValue.StringData ); - } - [Fact] - public void StringInterpolationStringExpressions() - { - BiteResult result = ExecStatements( @" - var Hello = ""Hello""; - var World = ""World""; - var s = ""${Hello} ${World}""; - s;" ); Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); - Assert.Equal( "Hello World", result.ReturnValue.StringData ); + Assert.Equal( "Inception World", result.ReturnValue.StringData ); } [Fact] - public void StringInterpolationStringLiteralsWithClosingCurlyBrace() + public void StringInterpolationAsFunctionArgument() { - BiteResult result = ExecStatements( @" - var s = ""${""Hello}""} ${""{World""}""; - s;" ); - Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); - Assert.Equal( "Hello} {World", result.ReturnValue.StringData ); - } + BiteResult result = ExecStatements( + @" + function bar(b) { + return b + "" World""; + } - [Fact] - public void StringInterpolationNumericExpressions() - { - BiteResult result = ExecStatements( @" - var X = 200; - var Y = 100; - var s = ""${X}:${Y}""; + var Hello = ""Hello""; + var s = bar(""${Hello}""); s;" ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); - Assert.Equal( "200:100", result.ReturnValue.StringData ); + Assert.Equal( "Hello World", result.ReturnValue.StringData ); } [Fact] public void StringInterpolationFunctionExpressions() { - BiteResult result = ExecStatements( @" + BiteResult result = ExecStatements( + @" function foo(a) { return a + 1; } @@ -762,67 +1393,87 @@ function bar(b) { var Y = 100; var s = ""${foo(X)}:${bar(Y)}""; s;" ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); Assert.Equal( "201:102", result.ReturnValue.StringData ); } [Fact] - public void StringInterpolationAsFunctionArgument() + public void StringInterpolationNumericExpressions() { - BiteResult result = ExecStatements( @" - - function bar(b) { - return b + "" World""; - } - - var Hello = ""Hello""; - var s = bar(""${Hello}""); + BiteResult result = ExecStatements( + @" + var X = 200; + var Y = 100; + var s = ""${X}:${Y}""; s;" ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); - Assert.Equal( "Hello World", result.ReturnValue.StringData ); + Assert.Equal( "200:100", result.ReturnValue.StringData ); } [Fact] - public void StringInterpolatioWithStringLiterals() + public void StringInterpolationStringExpressions() { - BiteResult result = ExecStatements( @" - var s = ""${""Hello""} ${""World""}""; + BiteResult result = ExecStatements( + @" + var Hello = ""Hello""; + var World = ""World""; + var s = ""${Hello} ${World}""; s;" ); - Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); Assert.Equal( "Hello World", result.ReturnValue.StringData ); } [Fact] - public void StringInterpolatioWithStringLiteralConcatenation() + public void StringInterpolationStringLiteralsWithClosingCurlyBrace() { - BiteResult result = ExecStatements( @" - var s = ""${""Hello"" + "" "" + ""World""}""; + BiteResult result = ExecStatements( + @" + var s = ""${""Hello}""} ${""{World""}""; s;" ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); - Assert.Equal( "Hello World", result.ReturnValue.StringData ); + Assert.Equal( "Hello} {World", result.ReturnValue.StringData ); } [Fact] public void StringInterpolatioWithMultiLine() { - BiteResult result = ExecStatements( @" + BiteResult result = ExecStatements( + @" var s = ""${""Hello"" + "" "" + ""World""}""; s;" ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); Assert.Equal( "Hello World", result.ReturnValue.StringData ); } [Fact] - public void StringInterpolatioInsideStringInterpolation() + public void StringInterpolatioWithStringLiteralConcatenation() { - BiteResult result = ExecStatements( @" - var x = ""Inception""; - var s = ""${""${x}"" + "" "" + ""World""}""; + BiteResult result = ExecStatements( + @" + var s = ""${""Hello"" + "" "" + ""World""}""; s;" ); + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); - Assert.Equal( "Inception World", result.ReturnValue.StringData ); + Assert.Equal( "Hello World", result.ReturnValue.StringData ); + } + + [Fact] + public void StringInterpolatioWithStringLiterals() + { + BiteResult result = ExecStatements( + @" + var s = ""${""Hello""} ${""World""}""; + s;" ); + + Assert.Equal( BiteVmInterpretResult.InterpretOk, result.InterpretResult ); + Assert.Equal( "Hello World", result.ReturnValue.StringData ); } [Fact] @@ -881,4 +1532,4 @@ public void WhileTrueLoopBreak() } } -} \ No newline at end of file +} diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj index 2ce1cd9..2cba84a 100644 --- a/UnitTests/UnitTests.csproj +++ b/UnitTests/UnitTests.csproj @@ -5,13 +5,13 @@ false - - - + + + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -23,7 +23,7 @@ - + diff --git a/WpfThreadTest/App.config b/WpfThreadTest/App.config new file mode 100644 index 0000000..3470d2d --- /dev/null +++ b/WpfThreadTest/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WpfThreadTest/App.xaml b/WpfThreadTest/App.xaml new file mode 100644 index 0000000..1ea4608 --- /dev/null +++ b/WpfThreadTest/App.xaml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/WpfThreadTest/App.xaml.cs b/WpfThreadTest/App.xaml.cs new file mode 100644 index 0000000..13310e6 --- /dev/null +++ b/WpfThreadTest/App.xaml.cs @@ -0,0 +1,13 @@ +using System.Windows; + +namespace WpfThreadTest +{ + +/// +/// Interaction logic for App.xaml +/// +public partial class App : Application +{ +} + +} diff --git a/WpfThreadTest/GameObject.cs b/WpfThreadTest/GameObject.cs new file mode 100644 index 0000000..5111e01 --- /dev/null +++ b/WpfThreadTest/GameObject.cs @@ -0,0 +1,38 @@ +using System.Windows; +using System.Windows.Controls; + +namespace WpfThreadTest +{ + +public class GameObject +{ + private readonly UIElement m_Element; + + public float X { get; set; } + + public float Y { get; set; } + + public float dX { get; set; } + + public float dY { get; set; } + + #region Public + + public GameObject( UIElement element ) + { + m_Element = element; + dX = 0.01f; + dY = 0.01f; + } + + public void Move() + { + // This code needs to be executed on the UI thread, where the element was created + Canvas.SetLeft( m_Element, X ); + Canvas.SetTop( m_Element, Y ); + } + + #endregion +} + +} diff --git a/WpfThreadTest/MainWindow.xaml b/WpfThreadTest/MainWindow.xaml new file mode 100644 index 0000000..c8906c7 --- /dev/null +++ b/WpfThreadTest/MainWindow.xaml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WpfThreadTest/MainWindow.xaml.cs b/WpfThreadTest/MainWindow.xaml.cs new file mode 100644 index 0000000..a87ea01 --- /dev/null +++ b/WpfThreadTest/MainWindow.xaml.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media; +using System.Windows.Shapes; +using Bite.Compiler; +using Bite.Modules.Callables; +using Bite.Runtime; +using Bite.Runtime.CodeGen; + +namespace WpfThreadTest +{ + +/// +/// Interaction logic for MainWindow.xaml +/// +public partial class MainWindow : Window +{ + private GameObject gameObject; + + private BiteVm vm = null; + + #region Public + + public MainWindow() + { + InitializeComponent(); + InitObjects(); + } + + #endregion + + #region Private + + private void Compile_OnClick( object sender, RoutedEventArgs e ) + { + if ( vm != null ) + { + vm.Stop(); + + // wait for thread to exit? + Task.Delay( 500 ); + } + + vm = new BiteVm(); + vm.InitVm(); + vm.RegisterSystemModuleCallables(); + vm.SynchronizationContext = SynchronizationContext.Current; + + // Expose CSharp objects to the Bite virtual machine + vm.RegisterExternalGlobalObjects( new Dictionary < string, object > { { "gameObject", gameObject } } ); + + BiteCompiler compiler = new BiteCompiler(); + + try + { + BiteProgram program = compiler.Compile( new[] { Code.Text } ); + + vm.InterpretAsync( program, CancellationToken.None ). + ContinueWith( + t => + { + if ( t.IsFaulted ) + { + Dispatcher.Invoke( + () => + { + MessageBox.Show( + t.Exception.InnerException.Message, + "Bite WPF Thread Test", + MessageBoxButton.OK, + MessageBoxImage.Exclamation ); + } ); + } + } ); + } + catch ( Exception exception ) + { + MessageBox.Show( + exception.Message, + "Bite WPF Thread Test", + MessageBoxButton.OK, + MessageBoxImage.Exclamation ); + } + } + + private void InitObjects() + { + Ellipse circle = new Ellipse { Fill = Brushes.Black, Width = 100, Height = 100 }; + + gameObject = new GameObject( circle ); + + Canvas.Children.Add( circle ); + + string mod = @"module Main; + +while ( true ) { + + if (gameObject.X < 0 || gameObject.X > 300 ) { + gameObject.dX = -gameObject.dX; + } + + gameObject.X += gameObject.dX; + + sync { + gameObject.Move(); + } + +}"; + + Code.Text = mod; + } + + private void Stop_OnClick( object sender, RoutedEventArgs e ) + { + if ( vm != null ) + { + vm.Stop(); + + // wait for thread to exit? + Task.Delay( 500 ); + } + } + + #endregion +} + +} diff --git a/WpfThreadTest/Properties/AssemblyInfo.cs b/WpfThreadTest/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..150f3ac --- /dev/null +++ b/WpfThreadTest/Properties/AssemblyInfo.cs @@ -0,0 +1,51 @@ +using System.Reflection; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle( "WpfThreadTest" )] +[assembly: AssemblyDescription( "" )] +[assembly: AssemblyConfiguration( "" )] +[assembly: AssemblyCompany( "" )] +[assembly: AssemblyProduct( "WpfThreadTest" )] +[assembly: AssemblyCopyright( "Copyright © 2022" )] +[assembly: AssemblyTrademark( "" )] +[assembly: AssemblyCulture( "" )] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible( false )] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion( "1.0.0.0" )] +[assembly: AssemblyFileVersion( "1.0.0.0" )] diff --git a/WpfThreadTest/Properties/Resources.Designer.cs b/WpfThreadTest/Properties/Resources.Designer.cs new file mode 100644 index 0000000..efd6354 --- /dev/null +++ b/WpfThreadTest/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WpfThreadTest.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WpfThreadTest.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/WpfThreadTest/Properties/Resources.resx b/WpfThreadTest/Properties/Resources.resx new file mode 100644 index 0000000..668cdff --- /dev/null +++ b/WpfThreadTest/Properties/Resources.resx @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + \ No newline at end of file diff --git a/WpfThreadTest/Properties/Settings.Designer.cs b/WpfThreadTest/Properties/Settings.Designer.cs new file mode 100644 index 0000000..3b95764 --- /dev/null +++ b/WpfThreadTest/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace WpfThreadTest.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/WpfThreadTest/Properties/Settings.settings b/WpfThreadTest/Properties/Settings.settings new file mode 100644 index 0000000..564d334 --- /dev/null +++ b/WpfThreadTest/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/WpfThreadTest/README.md b/WpfThreadTest/README.md new file mode 100644 index 0000000..d0cb3b3 --- /dev/null +++ b/WpfThreadTest/README.md @@ -0,0 +1,134 @@ +# WpfThreadTest + +**NOTE:** While this demo uses WPF to show cross-thread object access, the same principles can be applied to Unity. + +The main purpose of this project is to + +* show Bite in action inside an acutal application +* demonstrate the ability to compile a bite program and run on the fly +* demonstrate how to manipulate objects in your C# program from within your Bite program +* most importantly, **show how to access objects created on another thread, such as when updating UIElements in WPF, or game objects in Unity**. + +# A simple Bite program + +This simple program sets up an infinite loop and causes the object to move left and right. + +```bite +module Main; + +while ( true ) { + if (gameObject.X < 0 || gameObject.X > 300 ) { + gameObject.dX = -gameObject.dX; + } + gameObject.X += gameObject.dX; + + gameObject.Move(); +} +``` + +`gameObject` is an object created in the host program that we pass in to bite using the `BiteVm`'s `RegisterExternalGlobalObjects` method. + +# The GameObject + +We use the WPF `Canvas` as a simple rendering engine. We add a `UIElement` and we want to animate it using Bite. WPF uses static methods (e.g. `Canvas.SetLeft`) to affect the `UIElement`'s position. + +It's possible but awkward to pass in the static Canvas class into Bite to perform the actual movement, so instead we wrap our `UIElement` with the the `GameObject` class, which allows us to "redirect" access to the Canvas static through more accessible instance methods. + +```cs +public class GameObject +{ + private readonly UIElement m_Element; + + public float X { get; set; } + + public float Y { get; set; } + + public float dX { get; set; } + + public float dY { get; set; } + + + public GameObject( UIElement element ) + { + m_Element = element; + dX = 0.01f; + dY = 0.01f; + } + + public void Move() + { + Canvas.SetLeft( m_Element, X ); + Canvas.SetTop( m_Element, Y ); + } +} +``` + +# Running a Bite program on another thread + +When we run a Bite program, we want to execute it on another thread to prevent the UI thread from being blocked and making the application unusable. + +To do that we call either the `BiteProgram` `RunAsync` method or if using the `BiteVm`, the `InterpretAsync` method (`RunAsync` is just a wrapper around creating a `BiteVm` and executing`InterpretAsync`). + +```cs + vm = new BiteVm(); + vm.InitVm(); + vm.RegisterSystemModuleCallables(); + vm.SynchronizationContext = SynchronizationContext.Current; + + // Expose CSharp objects to the Bite virtual machine + vm.RegisterExternalGlobalObjects( new Dictionary < string, object >() + { + { "gameObject", gameObject } + } ); + + BiteCompiler compiler = new BiteCompiler(); + + var program = compiler.Compile( new[] { Code.Text } ); + + // Executes the program asynchronously in a Task, to avoid blocking the UI thread + vm.InterpretAsync( program ); +``` + +If we run the program as-is, we will get the unfortunate message: + +``` +System.InvalidOperationException: 'The calling thread cannot access this object because a different thread owns it.' +``` + +at this line of code in our `GameObject`. + +```cs +Canvas.SetLeft( m_Element, X ); +``` + +This is because out Bite program is running on another thread, and attempting to access objects that were created on the main thread. + +To fix this issue, we need a way to run code on the main thread! + +# The `sync` keyword + +The `sync` keyword is used to execute anything inside a sync block in another context. This is done by temporarily exiting the internal Run loop to switch to a `SynchronizedContext` and execute the Run loop from there. At the end of the block, execution returns to the current thread. + +```bite +module Main; + +while ( true ) { + if (gameObject.X < 0 || gameObject.X > 300 ) { + gameObject.dX = -gameObject.dX; + } + gameObject.X += gameObject.dX; + + // execute on the main thread + sync { + gameObject.Move(); + } +} +``` + +The thread where the code in the `sync` block will be executed on is determined by passing a `SynchronizationContext` to the `BiteVm`. The assignment should be done on the UI thread. + +```cs +vm.SynchronizationContext = SynchronizationContext.Current; +``` + +With the `sync` block in place, the bit program can now move the circle on the Canvas. diff --git a/WpfThreadTest/WpfThreadTest.csproj b/WpfThreadTest/WpfThreadTest.csproj new file mode 100644 index 0000000..dc969b5 --- /dev/null +++ b/WpfThreadTest/WpfThreadTest.csproj @@ -0,0 +1,105 @@ + + + + + Debug + AnyCPU + {0E941E9C-13D3-4AB4-97A7-55CDD3D0BD5B} + WinExe + WpfThreadTest + WpfThreadTest + v4.6.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + {2B941484-FB5E-4B3F-AF7D-BF61238D6F16} + Bite + + + + \ No newline at end of file