• R/O
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++linuxc#objective-ccocoa誰得qtrubybathyscaphegamephpguicwindows翻訳pythonomegattwitterframeworkbtronarduinovb.net計画中(planning stage)directxpreviewertestゲームエンジンdom

N88BASICが簡単に動くインタープリタを目指します。


コミットメタ情報

リビジョン29 (tree)
日時2018-10-03 12:51:52
作者bellyoshi

ログメッセージ

変更サマリ

差分

--- trunk/csmock/WindowsFormsApp1/ClassLibrary1/N88BASIC_DirectiveAgent.cs (revision 28)
+++ trunk/csmock/WindowsFormsApp1/ClassLibrary1/N88BASIC_DirectiveAgent.cs (revision 29)
@@ -19,8 +19,28 @@
1919 {
2020 B,BF,NONE
2121 }
22- public void Line(int sx,int sy, int ex, int ey, int color = 7, LineBF bf = LineBF.NONE,int color2 = 7)
22+ private Point _PromptSys_CurPos;
23+ private int _PromptSys_TextColor = 7;
24+
25+
26+
27+ public void AB_Print(string buf)
2328 {
29+ var g = Graphics.FromImage(frm.FormImage);
30+ var fnt = new Font("MS UI Gothic", 20);
31+ var brushColor = GetColor(_PromptSys_TextColor);
32+ var brush = new SolidBrush(brushColor);
33+ g.DrawString(buf, fnt, brush, _PromptSys_CurPos.X, _PromptSys_CurPos.Y);
34+ _PromptSys_CurPos.Y += (int)fnt.Size;
35+ frm.RefreshByImage();
36+ }
37+
38+ public void AB_Color(int color)
39+ {
40+ _PromptSys_TextColor = color;
41+ }
42+ public void AB_Line(int sx,int sy, int ex, int ey, int color = 7, LineBF bf = LineBF.NONE,int color2 = 7)
43+ {
2444 var g = Graphics.FromImage(frm.FormImage);
2545 Color penColor = GetColor(color);
2646 var pen = new Pen(penColor);
--- trunk/csmock/WindowsFormsApp1/WindowsFormsApp1/Form1.Designer.cs (revision 28)
+++ trunk/csmock/WindowsFormsApp1/WindowsFormsApp1/Form1.Designer.cs (revision 29)
@@ -81,7 +81,7 @@
8181 this.txtAbSrc.ScrollBars = System.Windows.Forms.ScrollBars.Both;
8282 this.txtAbSrc.Size = new System.Drawing.Size(266, 222);
8383 this.txtAbSrc.TabIndex = 1;
84- this.txtAbSrc.Text = "Line(10,10)-(200,100)\r\n";
84+ this.txtAbSrc.Text = "for i = 0 to 7\r\n color i\r\n print i\r\nnext\r\n";
8585 //
8686 // Form1
8787 //
--- trunk/csmock/WindowsFormsApp1/getToken/Token.cs (revision 28)
+++ trunk/csmock/WindowsFormsApp1/getToken/Token.cs (revision 29)
@@ -10,7 +10,7 @@
1010 int_value,double_value, str_value
1111 ,ab_if,ab_else,ab_end,ab_then,
1212 ab_for,ab_to,ab_step,ab_next, ab_exit,
13- abn88_print, abn88_line,
13+ abn88_print, abn88_line, abn88_color,
1414 identifier,
1515 Plus, Minus, Mult, Div,Equal,// +-*/=
1616 Lparen, Rparen,//()
--- trunk/csmock/WindowsFormsApp1/getToken/TokenGetter.cs (revision 28)
+++ trunk/csmock/WindowsFormsApp1/getToken/TokenGetter.cs (revision 29)
@@ -28,6 +28,7 @@
2828 rKWD("step", ab_step);
2929 rKWD("print", abn88_print);
3030 rKWD("line", abn88_line);
31+ rKWD("color", abn88_color);
3132
3233 }
3334 public void Init()
--- trunk/csmock/WindowsFormsApp1/getToken/compile.cs (revision 28)
+++ trunk/csmock/WindowsFormsApp1/getToken/compile.cs (revision 29)
@@ -56,9 +56,11 @@
5656 s_abn88_Line();
5757 break;
5858 case TokenType.abn88_print:
59- next();
6059 s_abn88_Print();
6160 break;
61+ case TokenType.abn88_color:
62+ s_abn88_Color();
63+ break;
6264 case TokenType.ab_for:
6365 s_for();
6466 break;
@@ -119,7 +121,18 @@
119121
120122
121123 }
122-
124+ public void s_abn88_Color()
125+ {
126+ next();
127+ var col = getExpression();
128+ Console.Write($"n88.AB_Color({col});");
129+ }
130+ public void s_abn88_Print()
131+ {
132+ next();
133+ var ex = getExpression();
134+ Console.Write($"n88.AB_Print(({ex}).ToString());");
135+ }
123136 public void s_abn88_Line()
124137 {
125138 next();
@@ -190,7 +203,7 @@
190203 syntaxError();
191204 return;
192205 }
193- Console.Write($"n88.Line({sx},{sy},{ex},{ey}");
206+ Console.Write($"n88.AB_Line({sx},{sy},{ex},{ey}");
194207 string col,col2;
195208 if (nextToken.TokenType == TokenType.Comma)
196209 {
@@ -333,10 +346,7 @@
333346 }
334347
335348
336- public void s_abn88_Print()
337- {
338349
339- }
340350
341351 void syntaxError()
342352 {