|
@@ -30,36 +30,33 @@ namespace NTERA.Interpreter
|
|
[KeywordMethod(Token.Print)]
|
|
[KeywordMethod(Token.Print)]
|
|
private void Print()
|
|
private void Print()
|
|
{
|
|
{
|
|
- console.Write(RealExpression().ToString());
|
|
|
|
|
|
+ Console.Write(RealExpression().ToString());
|
|
}
|
|
}
|
|
|
|
|
|
[KeywordMethod(Token.PrintL)]
|
|
[KeywordMethod(Token.PrintL)]
|
|
private void PrintL()
|
|
private void PrintL()
|
|
{
|
|
{
|
|
- console.PrintSingleLine(ParseFormat(Expression(new Lexer(Lexer.Value, LexerType.String), type: LexerType.String)));
|
|
|
|
|
|
+ Console.PrintSingleLine(ParseFormat(Expression(new Lexer(Lexer.Value, LexerType.String), type: LexerType.String)));
|
|
|
|
|
|
GetNextToken();
|
|
GetNextToken();
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
[KeywordMethod(Token.PrintHtml)]
|
|
[KeywordMethod(Token.PrintHtml)]
|
|
private void PrintHtml()
|
|
private void PrintHtml()
|
|
{
|
|
{
|
|
AssertToken(Token.Value, false);
|
|
AssertToken(Token.Value, false);
|
|
|
|
|
|
- console.PrintHtml(ParseFormat(Expression(new Lexer(Lexer.Value, LexerType.String), type: LexerType.String)), true);
|
|
|
|
|
|
+ Console.PrintHtml(ParseFormat(Expression(new Lexer(Lexer.Value, LexerType.String), type: LexerType.String)), true);
|
|
|
|
|
|
GetNextToken();
|
|
GetNextToken();
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
[KeywordMethod(Token.PrintImg)]
|
|
[KeywordMethod(Token.PrintImg)]
|
|
private void PrintImg()
|
|
private void PrintImg()
|
|
{
|
|
{
|
|
- console.PrintImg(RealExpression().ToString().Trim().Trim('"'));
|
|
|
|
|
|
+ Console.PrintImg(RealExpression().ToString().Trim().Trim('"'));
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
[KeywordMethod(Token.PrintButton)]
|
|
[KeywordMethod(Token.PrintButton)]
|
|
private void PrintButton()
|
|
private void PrintButton()
|
|
{
|
|
{
|
|
@@ -70,7 +67,7 @@ namespace NTERA.Interpreter
|
|
|
|
|
|
var value = RealExpression();
|
|
var value = RealExpression();
|
|
|
|
|
|
- console.PrintButton(text, (long)value.Real);
|
|
|
|
|
|
+ Console.PrintButton(text, (long)value.Real);
|
|
}
|
|
}
|
|
|
|
|
|
private static readonly Regex RealFormatRegex = new Regex("{(.*?)}");
|
|
private static readonly Regex RealFormatRegex = new Regex("{(.*?)}");
|
|
@@ -90,7 +87,7 @@ namespace NTERA.Interpreter
|
|
{
|
|
{
|
|
AssertToken(Token.Value, false);
|
|
AssertToken(Token.Value, false);
|
|
|
|
|
|
- console.Write(ParseFormat(Lexer.Value));
|
|
|
|
|
|
+ Console.Write(ParseFormat(Lexer.Value));
|
|
|
|
|
|
GetNextToken();
|
|
GetNextToken();
|
|
}
|
|
}
|
|
@@ -100,7 +97,7 @@ namespace NTERA.Interpreter
|
|
{
|
|
{
|
|
AssertToken(Token.Value, false);
|
|
AssertToken(Token.Value, false);
|
|
|
|
|
|
- console.PrintSingleLine(ParseFormat(Lexer.Value));
|
|
|
|
|
|
+ Console.PrintSingleLine(ParseFormat(Lexer.Value));
|
|
|
|
|
|
GetNextToken();
|
|
GetNextToken();
|
|
}
|
|
}
|
|
@@ -108,19 +105,19 @@ namespace NTERA.Interpreter
|
|
[KeywordMethod(Token.DrawLine)]
|
|
[KeywordMethod(Token.DrawLine)]
|
|
private void DrawLine()
|
|
private void DrawLine()
|
|
{
|
|
{
|
|
- console.PrintBar();
|
|
|
|
|
|
+ Console.PrintBar();
|
|
}
|
|
}
|
|
|
|
|
|
[KeywordMethod(Token.DrawLineForm)]
|
|
[KeywordMethod(Token.DrawLineForm)]
|
|
private void DrawLineForm()
|
|
private void DrawLineForm()
|
|
{
|
|
{
|
|
- console.printCustomBar(RealExpression().ToString().Trim());
|
|
|
|
|
|
+ Console.printCustomBar(RealExpression().ToString().Trim());
|
|
}
|
|
}
|
|
|
|
|
|
[KeywordMethod(Token.CustomDrawLine)]
|
|
[KeywordMethod(Token.CustomDrawLine)]
|
|
private void CustomDrawLine()
|
|
private void CustomDrawLine()
|
|
{
|
|
{
|
|
- console.printCustomBar(RealExpression().ToString().Trim());
|
|
|
|
|
|
+ Console.printCustomBar(RealExpression().ToString().Trim());
|
|
}
|
|
}
|
|
|
|
|
|
[KeywordMethod(Token.Alignment)]
|
|
[KeywordMethod(Token.Alignment)]
|
|
@@ -128,7 +125,7 @@ namespace NTERA.Interpreter
|
|
{
|
|
{
|
|
AssertToken(Token.Value, false);
|
|
AssertToken(Token.Value, false);
|
|
|
|
|
|
- console.Alignment = (DisplayLineAlignment)Enum.Parse(typeof(DisplayLineAlignment), Lexer.Value);
|
|
|
|
|
|
+ Console.Alignment = (DisplayLineAlignment)Enum.Parse(typeof(DisplayLineAlignment), Lexer.Value);
|
|
|
|
|
|
GetNextToken();
|
|
GetNextToken();
|
|
}
|
|
}
|
|
@@ -141,7 +138,7 @@ namespace NTERA.Interpreter
|
|
int argb = (int)((int)RealExpression().Real | 0xFF000000);
|
|
int argb = (int)((int)RealExpression().Real | 0xFF000000);
|
|
Color c = Color.FromArgb(argb);
|
|
Color c = Color.FromArgb(argb);
|
|
|
|
|
|
- console.SetStringStyle(c);
|
|
|
|
|
|
+ Console.SetStringStyle(c);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -160,7 +157,7 @@ namespace NTERA.Interpreter
|
|
|
|
|
|
int b = (int)Lexer.Value;
|
|
int b = (int)Lexer.Value;
|
|
|
|
|
|
- console.SetStringStyle(Color.FromArgb(r, g, b));
|
|
|
|
|
|
+ Console.SetStringStyle(Color.FromArgb(r, g, b));
|
|
|
|
|
|
GetNextToken();
|
|
GetNextToken();
|
|
}
|
|
}
|
|
@@ -169,14 +166,14 @@ namespace NTERA.Interpreter
|
|
int argb = (int)((int)Lexer.Value.Real | 0xFF000000);
|
|
int argb = (int)((int)Lexer.Value.Real | 0xFF000000);
|
|
Color c = Color.FromArgb(argb);
|
|
Color c = Color.FromArgb(argb);
|
|
|
|
|
|
- console.SetStringStyle(c);
|
|
|
|
|
|
+ Console.SetStringStyle(c);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
[KeywordMethod(Token.ResetColor)]
|
|
[KeywordMethod(Token.ResetColor)]
|
|
private void ResetColor()
|
|
private void ResetColor()
|
|
{
|
|
{
|
|
- console.ResetStyle();
|
|
|
|
|
|
+ Console.ResetStyle();
|
|
|
|
|
|
GetNextToken();
|
|
GetNextToken();
|
|
}
|
|
}
|
|
@@ -252,7 +249,7 @@ namespace NTERA.Interpreter
|
|
value = RealExpression();
|
|
value = RealExpression();
|
|
}
|
|
}
|
|
else
|
|
else
|
|
- value = StringExpression();
|
|
|
|
|
|
+ value = ParseFormat(StringExpression());
|
|
|
|
|
|
|
|
|
|
if (appending)
|
|
if (appending)
|
|
@@ -274,12 +271,12 @@ namespace NTERA.Interpreter
|
|
|
|
|
|
if (Loops.ContainsKey(var))
|
|
if (Loops.ContainsKey(var))
|
|
{
|
|
{
|
|
- Loops[var] = lineMarker;
|
|
|
|
|
|
+ Loops[var] = LineMarker;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
Variables[var] = v;
|
|
Variables[var] = v;
|
|
- Loops.Add(var, lineMarker);
|
|
|
|
|
|
+ Loops.Add(var, LineMarker);
|
|
}
|
|
}
|
|
|
|
|
|
AssertToken(Token.To, false);
|
|
AssertToken(Token.To, false);
|
|
@@ -291,7 +288,7 @@ namespace NTERA.Interpreter
|
|
{
|
|
{
|
|
while (true)
|
|
while (true)
|
|
{
|
|
{
|
|
- while (!(GetNextToken() == Token.Identifer && prevToken == Token.Next)) { }
|
|
|
|
|
|
+ while (!(GetNextToken() == Token.Identifer && previousToken == Token.Next)) { }
|
|
|
|
|
|
if (Lexer.Identifer == var)
|
|
if (Lexer.Identifer == var)
|
|
{
|
|
{
|