Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
v1.0.0
  • Loading branch information
joerivanarkel authored Nov 9, 2022
2 parents 2d83380 + f7812a1 commit 36858a5
Show file tree
Hide file tree
Showing 138 changed files with 5,050 additions and 1,139 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
*.pirate linguist-language=Squirrel

# Markdown
*.md linguist-detectable=true
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ publish/
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# *.pubxml
# *.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/Shell/bin/Debug/net6.0/Shell.dll",
"args": ["run", "main"],
"args": ["run"],
"cwd": "${workspaceFolder}/Shell",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"console": "integratedTerminal",
"stopAtEntry": false,
"requireExactSource": false
},
Expand Down
95 changes: 89 additions & 6 deletions CHANGELOG.md
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
29 changes: 29 additions & 0 deletions Common.Test/Common.Test.csproj
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>
32 changes: 32 additions & 0 deletions Common.Test/LoggerTest.cs
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);
}

}
11 changes: 11 additions & 0 deletions Common/Common.csproj
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>
9 changes: 9 additions & 0 deletions Common/Enum/LogType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Common.Enum
{
public enum LogType
{
ERROR ,
WARNING,
INFO
}
}
26 changes: 26 additions & 0 deletions Common/EnvironmentVariables.cs
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");
}
}
}
}
16 changes: 16 additions & 0 deletions Common/Errors/FileException.cs
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) { }
}

16 changes: 16 additions & 0 deletions Common/Errors/ParserException.cs
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) { }
}

16 changes: 16 additions & 0 deletions Common/Errors/RuntimeCommandException.cs
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) { }
}

26 changes: 26 additions & 0 deletions Common/Errors/TypeConversionException.cs
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) { }
}

22 changes: 22 additions & 0 deletions Common/FileHandlers/FileModel.cs
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;
}
}
Loading

0 comments on commit 36858a5

Please sign in to comment.