Added comment support

This commit is contained in:
Jaex 2015-02-17 16:52:31 +02:00
parent 780c1d3ae8
commit 90353e1a94
2 changed files with 21 additions and 3 deletions

View file

@ -73,6 +73,9 @@ private void InitializeComponent()
//
// pInput
//
this.pInput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pInput.BackColor = System.Drawing.Color.White;
this.pInput.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pInput.Controls.Add(this.rtbInput);
@ -84,6 +87,7 @@ private void InitializeComponent()
//
// cbFunctions
//
this.cbFunctions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cbFunctions.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbFunctions.FormattingEnabled = true;
this.cbFunctions.Location = new System.Drawing.Point(344, 24);
@ -93,6 +97,7 @@ private void InitializeComponent()
//
// lblFunctions
//
this.lblFunctions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.lblFunctions.AutoSize = true;
this.lblFunctions.Location = new System.Drawing.Point(341, 8);
this.lblFunctions.Name = "lblFunctions";
@ -102,6 +107,7 @@ private void InitializeComponent()
//
// btnLoadExample
//
this.btnLoadExample.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnLoadExample.Location = new System.Drawing.Point(520, 96);
this.btnLoadExample.Name = "btnLoadExample";
this.btnLoadExample.Size = new System.Drawing.Size(152, 24);
@ -112,6 +118,7 @@ private void InitializeComponent()
//
// txtScriptName
//
this.txtScriptName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.txtScriptName.Location = new System.Drawing.Point(520, 24);
this.txtScriptName.Name = "txtScriptName";
this.txtScriptName.Size = new System.Drawing.Size(152, 20);
@ -119,6 +126,7 @@ private void InitializeComponent()
//
// btnSaveScript
//
this.btnSaveScript.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnSaveScript.Location = new System.Drawing.Point(520, 48);
this.btnSaveScript.Name = "btnSaveScript";
this.btnSaveScript.Size = new System.Drawing.Size(152, 24);
@ -129,6 +137,7 @@ private void InitializeComponent()
//
// lblScriptName
//
this.lblScriptName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.lblScriptName.AutoSize = true;
this.lblScriptName.Location = new System.Drawing.Point(517, 8);
this.lblScriptName.Name = "lblScriptName";
@ -138,6 +147,7 @@ private void InitializeComponent()
//
// btnRemoveScript
//
this.btnRemoveScript.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnRemoveScript.Location = new System.Drawing.Point(520, 72);
this.btnRemoveScript.Name = "btnRemoveScript";
this.btnRemoveScript.Size = new System.Drawing.Size(152, 24);
@ -148,6 +158,7 @@ private void InitializeComponent()
//
// btnAddMouseMove
//
this.btnAddMouseMove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnAddMouseMove.Location = new System.Drawing.Point(344, 48);
this.btnAddMouseMove.Name = "btnAddMouseMove";
this.btnAddMouseMove.Size = new System.Drawing.Size(168, 23);
@ -159,7 +170,7 @@ private void InitializeComponent()
// lblLineDelay
//
this.lblLineDelay.AutoSize = true;
this.lblLineDelay.Location = new System.Drawing.Point(136, 8);
this.lblLineDelay.Location = new System.Drawing.Point(133, 8);
this.lblLineDelay.Name = "lblLineDelay";
this.lblLineDelay.Size = new System.Drawing.Size(58, 13);
this.lblLineDelay.TabIndex = 11;
@ -199,6 +210,8 @@ private void InitializeComponent()
//
// lvScripts
//
this.lvScripts.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.lvScripts.AutoFillColumn = true;
this.lvScripts.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.chScriptName});

View file

@ -95,15 +95,20 @@ public bool Compile(string[] lines)
tokenizer.Keywords = Functions.Select(x => x.Key).ToArray();
List<Token> tokens = tokenizer.Tokenize(line);
if (tokens[0].Type == TokenType.Literal) // Comment?
{
continue;
}
int loop = 1;
if (tokens[0].Type == TokenType.Numeric)
if (tokens[0].Type == TokenType.Numeric) // Loop?
{
loop = int.Parse(tokens[0].Text);
tokens.RemoveAt(0);
}
if (tokens[0].Type == TokenType.Keyword)
if (tokens[0].Type == TokenType.Keyword) // Function?
{
string name = tokens[0].Text;
string[] parameters = tokens.Skip(1).Select(x => x.Text).ToArray();