This repository has been archived by the owner on Aug 9, 2024. It is now read-only.
-
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.
v1.0.0
- Loading branch information
Showing
138 changed files
with
5,050 additions
and
1,139 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 |
---|---|---|
@@ -1 +1,4 @@ | ||
*.pirate linguist-language=Squirrel | ||
|
||
# Markdown | ||
*.md linguist-detectable=true |
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,24 +1,107 @@ | ||
# Changelog for PirateLang | ||
|
||
Ordered by Release/Milestone, then pullrequest. Listing the changes made. | ||
|
||
## 1.0.0 | ||
|
||
### ([#39](https://github.com/joerivanarkel/PirateLang/pull/39)) New Lexer, Parser and Interpreter | ||
|
||
- Completely remade Parser | ||
- Using a Factory pattern get a Parser per token type. This is using the LL parser pattern. | ||
- Creates a Scope, which consits of a List of Nodes. | ||
- Completely remade Interpreter | ||
- Using a Factory pattern get a Interpreter for each node. | ||
- Returns a BaseValue foreach node. | ||
- Partially Rewrote Lexer, to simplify. | ||
- Created a Object serializer, which takes a Scope and serializes it to binary. | ||
|
||
### ([#49](https://github.com/joerivanarkel/PirateLang/pull/49)) Semicolons | ||
|
||
- Added Semicolon token to parser. | ||
|
||
### ([#51](https://github.com/joerivanarkel/PirateLang/pull/51)) Error Handling and Validation | ||
|
||
- Created Custom exceptions for Type Conversion and Parsing Exceptions | ||
- Added validation for type conversions | ||
- Replaced null return with errors | ||
- Created base class constructors | ||
|
||
### ([#53](https://github.com/joerivanarkel/PirateLang/pull/53)) Fixing Float and Chaarcter issues | ||
|
||
- Moved Logger and Factory to BaseInterpeter | ||
- Moved Logger and Value to BaseVaule | ||
- Added more possible nodes to variables | ||
- Started on Validation methods per entity. #60 | ||
- Fixed Float and Character lexing errors | ||
|
||
### ([#62](https://github.com/joerivanarkel/PirateLang/pull/62)) Command Rework | ||
|
||
- Refined and Refactored commands | ||
- Added a dependency injection container, from Application to the Parser and Lexer | ||
- Moved constant variable parameters to `variables.json` and added new `EnvironmentVariables` class to get these variables | ||
- Created repl command `shell` | ||
- Fixed lexer for multiple inputs | ||
- Move common interfaces to `Common.Interfaces` | ||
|
||
### ([#66](https://github.com/joerivanarkel/PirateLang/pull/66)) Implicit usings | ||
|
||
- Removed unnecessary usings. | ||
- Added implicit using in `Usings.g.cs` | ||
|
||
### ([#68](https://github.com/joerivanarkel/PirateLang/pull/68)) Lexer Rewrite | ||
|
||
- Completely rewrote lexer to remove the static methods and fields. | ||
- Renamed Lexer, Parser and Interpreter to PirateLexer, PirateParser and PirateInterpreter | ||
|
||
### ([#69](https://github.com/joerivanarkel/PirateLang/pull/69)) FileHandlers | ||
|
||
- Added a two filehandlers for writing and reading | ||
|
||
### ([#70](https://github.com/joerivanarkel/PirateLang/pull/70)) Unit Tests | ||
|
||
- Created Unit Tests for Lexer, Parser, Interpreter projects | ||
|
||
## 0.1.2 | ||
|
||
### ([#32](https://github.com/joerivanarkel/PirateLang/pull/32)) Shell, CLI Improvements | ||
|
||
- Added build command to test files. Later to be joined by #35. | ||
- Created `.log` file, added logging in the new Common project | ||
- Checking for modificationdate in `modules.json` and setting the new data in the build command | ||
|
||
## 0.1.1 | ||
### ([#9](https://github.com/joerivanarkel/PirateLang/pull/9)) Shell, CLI Improvements<br> | ||
|
||
### ([#9](https://github.com/joerivanarkel/PirateLang/pull/9)) Shell, CLI Improvements | ||
|
||
- Added pirate init command for creating default gitignore and gitattributes | ||
- Moved Commands + Argument logic from Program.cs to CommandRepository.cs | ||
- Arguments from command line are passed as string, if no argument is given string.empty is passed | ||
- Removed capability from non argument calls, new issue was created: [#13](https://github.com/joerivanarkel/PirateLang/issues/13) Move non argument command result to --help/-h parameter | ||
- Removed capability from non argument calls, new issue was created: [#13](https://github.com/joerivanarkel/PirateLang/issues/13) Move non argument command result to --help/-h parameter | ||
|
||
### ([#14](https://github.com/joerivanarkel/PirateLang/pull/14)) Workflow building | ||
|
||
### ([#14](https://github.com/joerivanarkel/PirateLang/pull/14)) Workflow building<br> | ||
- Added default .NET workflow to check if the project builds. | ||
|
||
### ([#18](https://github.com/joerivanarkel/PirateLang/pull/18)) Added new tokens<br> | ||
### ([#18](https://github.com/joerivanarkel/PirateLang/pull/18)) Added new tokens | ||
|
||
- Added list defined between `[]` | ||
- Added `for` loop for looping through a range | ||
- Added `foreach` loop for looping through a collection | ||
- New foreach and in keywords | ||
- New foreach and in keywords | ||
- Added `+=` `.` and `$` operators | ||
- Added SYNTAX.ms for current syntax | ||
|
||
### ([#25](https://github.com/joerivanarkel/PirateLang/pull/25)) new command structure, added -h and --help arguments<br> | ||
### ([#25](https://github.com/joerivanarkel/PirateLang/pull/25)) new command structure, added -h and --help arguments | ||
|
||
- Added new Factory pattern in `ICommand.cs` and `CommandFactory.cs` | ||
- Defined `-h` and `--help` arguments per command | ||
|
||
### ([#26](https://github.com/joerivanarkel/PirateLang/pull/26)) added comments between: // and ;. added true and false | ||
|
||
- Added true and false booleans | ||
- Ignored tokens between `//` and `;` in the parser acting as comments | ||
|
||
### ([#37](https://github.com/joerivanarkel/PirateLang/pull/37)) Testing | ||
|
||
- Created test for Common, Parser and Lexer | ||
- Made `logger.Log` non static |
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,29 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AutoFixture" Version="4.17.0" /> | ||
<PackageReference Include="FakeItEasy" Version="7.3.1" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="3.1.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Common\Common.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,32 @@ | ||
using Common.Enum; | ||
using Common.FileHandlers; | ||
using Common.FileHandlers.Interfaces; | ||
using Common.Interfaces; | ||
using FakeItEasy; | ||
using Xunit; | ||
|
||
namespace Common.Test; | ||
|
||
public class LoggerTest | ||
{ | ||
[Fact] | ||
public void ShouldLog() | ||
{ | ||
// Arrange | ||
var FileWriteHandler = A.Fake<IFileWriteHandler>(); | ||
var EnvironmentVariables = A.Fake<IEnvironmentVariables>(); | ||
var logger = new Logger(FileWriteHandler, EnvironmentVariables); | ||
|
||
A.CallTo(() => FileWriteHandler.WriteToFile(A<FileWriteModel>.Ignored, A<bool>.Ignored)).Returns(true); | ||
A.CallTo(() => EnvironmentVariables.GetVariable("version")).Returns("1.0.0"); | ||
var message = "Test message"; | ||
var type = LogType.INFO; | ||
|
||
// Act | ||
var result = logger.Log(message, this.GetType().Name, type); | ||
|
||
// Assert | ||
Assert.True(result); | ||
} | ||
|
||
} |
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,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" /> | ||
</ItemGroup> | ||
</Project> |
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,9 @@ | ||
namespace Common.Enum | ||
{ | ||
public enum LogType | ||
{ | ||
ERROR , | ||
WARNING, | ||
INFO | ||
} | ||
} |
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,26 @@ | ||
using Common.Errors; | ||
using Common.Interfaces; | ||
using Microsoft.Extensions.Configuration; | ||
|
||
namespace Common | ||
{ | ||
|
||
public class EnvironmentVariables : IEnvironmentVariables | ||
{ | ||
public string GetVariable(string variablename) | ||
{ | ||
try | ||
{ | ||
var directory = Directory.GetCurrentDirectory(); | ||
var secretConfig = new ConfigurationBuilder() | ||
.AddJsonFile($"{directory}/../Shell/variables.json", false, true) | ||
.Build(); | ||
return secretConfig[variablename]; | ||
} | ||
catch (System.Exception) | ||
{ | ||
throw new FileException($"{variablename} was not found in variables.json"); | ||
} | ||
} | ||
} | ||
} |
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,16 @@ | ||
using System.Runtime.Serialization; | ||
|
||
namespace Common.Errors; | ||
|
||
[Serializable] | ||
public class FileException : Exception | ||
{ | ||
public FileException() { } | ||
public FileException(string message) : base(message) { } | ||
|
||
|
||
protected FileException( | ||
SerializationInfo info, | ||
StreamingContext context) : base(info, context) { } | ||
} | ||
|
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,16 @@ | ||
using System.Runtime.Serialization; | ||
|
||
namespace Common.Errors; | ||
|
||
[Serializable] | ||
public class ParserException : Exception | ||
{ | ||
public ParserException() { } | ||
public ParserException(string message) : base(message) { } | ||
|
||
|
||
protected ParserException( | ||
SerializationInfo info, | ||
StreamingContext context) : base(info, context) { } | ||
} | ||
|
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,16 @@ | ||
using System.Runtime.Serialization; | ||
|
||
namespace Common.Errors; | ||
|
||
[Serializable] | ||
public class RuntimeCommandException : Exception | ||
{ | ||
public RuntimeCommandException() { } | ||
public RuntimeCommandException(string message) : base(message) { } | ||
|
||
|
||
protected RuntimeCommandException( | ||
SerializationInfo info, | ||
StreamingContext context) : base(info, context) { } | ||
} | ||
|
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,26 @@ | ||
using System.Runtime.Serialization; | ||
|
||
namespace Common.Errors; | ||
|
||
[Serializable] | ||
public class TypeConversionException : Exception | ||
{ | ||
public Type? OrginType { get; set; } | ||
public Type? TargetType { get; set; } | ||
public TypeConversionException() { } | ||
public TypeConversionException(string message) : base(message) { } | ||
public TypeConversionException(Type targetType) : base($"Failed to convert to {targetType.Name}") | ||
{ | ||
TargetType = targetType; | ||
} | ||
public TypeConversionException(Type orginType, Type targetType) : base($"Failed to convert {orginType.Name} to {targetType.Name}") | ||
{ | ||
OrginType = orginType; | ||
TargetType = targetType; | ||
} | ||
|
||
protected TypeConversionException( | ||
SerializationInfo info, | ||
StreamingContext context) : base(info, context) { } | ||
} | ||
|
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,22 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Common.FileHandlers; | ||
|
||
public class FileWriteModel | ||
{ | ||
public string Name { get; set; } | ||
public string Extension { get; set; } | ||
public string Location { get; set; } | ||
public string Text { get; set; } | ||
|
||
public FileWriteModel(string fileName, string fileExtension, string fileLocation, string fileText) | ||
{ | ||
Name = fileName; | ||
Extension = fileExtension; | ||
Location = fileLocation; | ||
Text = fileText; | ||
} | ||
} |
Oops, something went wrong.