Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Relfos committed Sep 20, 2023
2 parents 244795e + 9b8be00 commit 61243e7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
20 changes: 14 additions & 6 deletions Compiler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,17 +235,25 @@ static void Main(string[] args)
return;
}

var modules = compiler.Process(sourceCode);

foreach (var module in modules)
try
{
ExportModule(module, outputPath);
var modules = compiler.Process(sourceCode);

foreach (var subModule in module.SubModules)
foreach (var module in modules)
{
ExportModule(subModule, outputPath);
ExportModule(module, outputPath);

foreach (var subModule in module.SubModules)
{
ExportModule(subModule, outputPath);
}
}
}
catch (CompilerException ex)
{
Console.WriteLine(ex.Message);
System.Environment.Exit(-1);
}

Console.WriteLine("Success!");

Expand Down
21 changes: 21 additions & 0 deletions Library/src/Compiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,27 @@ protected Expression ParseExpression(Scope scope, bool allowBinary = true)
}

var rightSide = ParseExpression(scope, false);
if (rightSide == null)
{
Rewind();
var token = FetchToken();

if (token.value != null)
{
if (token.value.Equals("and", StringComparison.OrdinalIgnoreCase))
{
throw new CompilerException($"Operator 'and' is obsolete, please use && instead");
}

if (token.value.Equals("or", StringComparison.OrdinalIgnoreCase))
{
throw new CompilerException($"Operator 'or' is obsolete, please use || instead");
}
}

throw new CompilerException($"expected right side expression. Possible compiler error?");
}

var result = ParseBinaryExpression(scope, second, leftSide, rightSide);

var next = FetchToken();
Expand Down

0 comments on commit 61243e7

Please sign in to comment.