-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
450 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var $!constant=Constant variable | ||
con.out nl $!constant | ||
var $!constant=Changing variable # should error with code MTS-a (VarIsConst) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
func.start print $msg | ||
con.out nl $msg | ||
func.end | ||
|
||
call print hi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
func.start functionAsdf $text | ||
return $text | ||
func.end | ||
|
||
con.out nl >functionAsdf/HelloWorld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,57 @@ | ||
using Mattodev.MattoScript.Engine; | ||
using System.Diagnostics; | ||
using Mattodev.MattoScript.Engine; | ||
using static Mattodev.MattoScript.Engine.CoreEng; | ||
|
||
namespace Mattodev.MattoScript.Builder | ||
{ | ||
internal class Program | ||
{ | ||
static int Main(string[] args) | ||
{ | ||
MTSConsole c = new(); | ||
Console.Title = c.title; | ||
internal class Program | ||
{ | ||
static int Main(string[] args) | ||
{ | ||
MTSConsole c = new(); | ||
Console.Title = c.title; | ||
|
||
if (args.Length == 0) | ||
{ | ||
MTSError.TooLittleArgs err = new(); | ||
err.message += args.Length; | ||
err.ThrowErr("<build>", -1, ref c); | ||
c.exitCode = err.code; | ||
goto end; | ||
} | ||
string[] code; | ||
try | ||
{ | ||
code = File.ReadAllLines(args[0]); | ||
} | ||
catch (FileNotFoundException) | ||
{ | ||
MTSError.FileNotFound err = new(); | ||
err.message += args[0]; | ||
err.ThrowErr("<build>", -1, ref c); | ||
c.exitCode = err.code; | ||
goto end; | ||
} | ||
catch (Exception e) | ||
{ | ||
MTSError.InternalError err = new(e); | ||
err.message += $"\n\t{e.Message}"; | ||
err.ThrowErr("<build>", -1, ref c); | ||
c.exitCode = err.code; | ||
goto end; | ||
} | ||
Stopwatch s = new(); | ||
s.Start(); | ||
if (args.Length == 0) | ||
{ | ||
MTSError.TooLittleArgs err = new(); | ||
err.message += args.Length; | ||
err.ThrowErr("<build>", -1, ref c); | ||
c.exitCode = err.code; | ||
goto end; | ||
} | ||
string[] code; | ||
try | ||
{ | ||
code = File.ReadAllLines(args[0]); | ||
} | ||
catch (FileNotFoundException) | ||
{ | ||
MTSError.FileNotFound err = new(); | ||
err.message += args[0]; | ||
err.ThrowErr("<build>", -1, ref c); | ||
c.exitCode = err.code; | ||
goto end; | ||
} | ||
catch (Exception e) | ||
{ | ||
MTSError.InternalError err = new(e); | ||
err.message += $"\n\t{e.Message}"; | ||
err.ThrowErr("<build>", -1, ref c); | ||
c.exitCode = err.code; | ||
goto end; | ||
} | ||
|
||
c = Runner.runFromCode(code, args[0]); | ||
Runner.runFromCode(code, args[0], ref c); | ||
|
||
end: | ||
c.disp(); | ||
Console.ForegroundColor = ConsoleColor.DarkGray; | ||
Console.WriteLine($"(exit code {c.exitCode})"); | ||
Console.ResetColor(); | ||
return c.exitCode; | ||
} | ||
} | ||
end: | ||
s.Stop(); | ||
c.disp(); | ||
Console.ForegroundColor = ConsoleColor.DarkGray; | ||
Console.WriteLine($"(exit code {c.exitCode}, execution time {s.ElapsedMilliseconds}ms)"); | ||
Console.ResetColor(); | ||
return c.exitCode; | ||
} | ||
} | ||
} |
Oops, something went wrong.