Skip to content

Commit

Permalink
allow var type in for loop + add disable new line on schreibe
Browse files Browse the repository at this point in the history
  • Loading branch information
PocketMiner82 committed Nov 22, 2023
1 parent adf20fe commit b927ad3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion AutoUpdater.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.0.1.2</version>
<version>1.0.1.3</version>
<url>https://github.com/PocketMiner82/pseudocode-ide/releases/latest/download/pseudocode-ide.zip</url>
<changelog>https://github.com/PocketMiner82/pseudocode-ide/releases</changelog>
<mandatory>false</mandatory>
Expand Down
8 changes: 4 additions & 4 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
[assembly: AssemblyTitle("pseudocode-ide")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Orgname")]
[assembly: AssemblyCompany("PocketMiner82")]
[assembly: AssemblyProduct("pseudocode-ide")]
[assembly: AssemblyCopyright("Copyright © Orgname 2023")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -31,5 +31,5 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.2")]
[assembly: AssemblyFileVersion("1.0.1.2")]
[assembly: AssemblyVersion("1.0.1.3")]
[assembly: AssemblyFileVersion("1.0.1.3")]
4 changes: 2 additions & 2 deletions interpreter/logging/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public static void error(int line, string msg)
error($"Zeile {line}: {msg}");
}

public static void print(string message)
public static void print(string message, bool newLine = true)
{
if (outputForm != null)
{
outputForm.outputText += message + "\n";
outputForm.outputText += message + (newLine ? "\n" : "");
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions interpreter/parser/CSharpCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public void _ersetzen(int index, T value) {
}
public class BaseCodeOutput {
private Action<string> printMethod;
private Action<string, bool> printMethod;
public BaseCodeOutput(Action<string> printMethod) {
public BaseCodeOutput(Action<string, bool> printMethod) {
this.printMethod = printMethod;
}
protected virtual void _schreibe(object msg) {
this.printMethod(msg == null ? ""NICHTS"" : msg.ToString());
protected virtual void _schreibe(object msg, bool newLine = true) {
this.printMethod(msg == null ? ""NICHTS"" : msg.ToString(), newLine);
}
protected virtual void _warte(int millis) {
Expand Down Expand Up @@ -84,7 +84,7 @@ protected virtual void _warte(int millis) {
public class CodeOutput : BaseCodeOutput {
%FIELDS%
public CodeOutput(Action<string> printMethod) : base(printMethod) {
public CodeOutput(Action<string, bool> printMethod) : base(printMethod) {
%CONSTRUCTOR%
}
Expand Down Expand Up @@ -175,7 +175,7 @@ public void execute()
{
Type type = this.compiledAssembly.GetType("codeOutput.CodeOutput");

Activator.CreateInstance(type, new Action<string>(Logger.print));
Activator.CreateInstance(type, new Action<string, bool>(Logger.print));
}
}
catch (ThreadAbortException)
Expand Down
7 changes: 6 additions & 1 deletion interpreter/parser/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,12 @@ private string tryHandleVarDef(bool insideFunctionParens, bool isInForLoopVarDef

if (possibleColon.type == COLON)
{
if(this.isVarType(possibleVarType.type))
if (isInForLoopVarDef)
{
this.currentVarIdentifier = "_" + identifier.lexeme;
}

if (this.isVarType(possibleVarType.type))
{
string type = TOKEN_TO_CSHARP[possibleVarType.type];
if (possibleVarAssign.type == LESS)
Expand Down

0 comments on commit b927ad3

Please sign in to comment.