-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
607 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
kind: pipeline | ||
name: default | ||
|
||
steps: | ||
- name: build | ||
image: mcr.microsoft.com/dotnet/core/sdk:3.1 | ||
commands: | ||
- dotnet restore | ||
- dotnet build -c Release | ||
- dotnet test -c Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Logging.Serilog; | ||
|
||
namespace GalaToaster | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
|
||
namespace GalaScript.Attributes | ||
{ | ||
[AttributeUsage(AttributeTargets.Method)] | ||
class AliasAttribute : Attribute | ||
{ | ||
public string Name { get; } | ||
|
||
public AliasAttribute(string name) | ||
{ | ||
Name = name; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using GalaScript.Interfaces; | ||
|
||
namespace GalaScript.Evaluators | ||
{ | ||
public abstract class AbstractEvaluator : IEvaluator | ||
{ | ||
protected IScriptEvaluator _caller; | ||
|
||
public virtual void SetCaller(IScriptEvaluator caller) | ||
{ | ||
_caller = caller; | ||
} | ||
|
||
public virtual object Evaluate() => throw new NotImplementedException(); | ||
|
||
public virtual string ToScriptString() => throw new NotImplementedException(); | ||
|
||
public override string ToString() => ToScriptString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,36 @@ | ||
using GalaScript.Interfaces; | ||
using System.Collections.Generic; | ||
|
||
namespace GalaScript.Evaluators | ||
{ | ||
public class ConstantEvaluator : IEvaluator | ||
public class ConstantEvaluator : AbstractEvaluator | ||
{ | ||
private readonly Dictionary<string, object> _constant = new Dictionary<string, object> | ||
{ | ||
["true"] = true, | ||
["false"] = false, | ||
["null"] = null, | ||
}; | ||
|
||
private readonly string _k; | ||
|
||
public ConstantEvaluator(string k) | ||
{ | ||
_k = k; | ||
_k = k.ToLower() switch | ||
{ | ||
var l when _constant.ContainsKey(l) => l, | ||
_ => k, | ||
}; | ||
} | ||
|
||
public void SetCaller(IScriptEvaluator caller) | ||
public override object Evaluate() | ||
{ | ||
// | ||
return _k switch | ||
{ | ||
_ when _constant.TryGetValue(_k, out var c) => c, | ||
_ => _k, | ||
}; | ||
} | ||
|
||
public object Evaluate() | ||
{ | ||
return _k; | ||
} | ||
public override string ToScriptString() => _k; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System.Globalization; | ||
|
||
namespace GalaScript.Evaluators | ||
{ | ||
public class IntegerConstantEvaluator : AbstractEvaluator | ||
{ | ||
private readonly long _integer; | ||
|
||
public IntegerConstantEvaluator(long integer) | ||
{ | ||
_integer = integer; | ||
} | ||
|
||
public override object Evaluate() | ||
{ | ||
return _integer; | ||
} | ||
|
||
public override string ToScriptString() => $"{_integer.ToString(CultureInfo.InvariantCulture)}L"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.Collections.Generic; | ||
using GalaScript.Interfaces; | ||
|
||
namespace GalaScript.Evaluators | ||
{ | ||
public class NamedParameterEvaluator : AbstractEvaluator, INamedEvaluator | ||
{ | ||
private IEvaluator _evaluator; | ||
|
||
public NamedParameterEvaluator(string name, IEvaluator evaluator) | ||
{ | ||
Name = name; | ||
_evaluator = evaluator; | ||
} | ||
|
||
public override object Evaluate() | ||
{ | ||
return new KeyValuePair<string, object>(Name, _evaluator.Evaluate()); | ||
} | ||
|
||
public string Name { get; } | ||
|
||
public override string ToScriptString() => $"{Name}={_evaluator.ToString()}"; | ||
} | ||
} |
Oops, something went wrong.