Skip to content

Commit

Permalink
Merge pull request #48 from furesoft/develop
Browse files Browse the repository at this point in the history
feat: Add EnumParselet
  • Loading branch information
furesoft authored Oct 3, 2024
2 parents 8b8c13f + 57ac6a9 commit 2e79b0c
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>1.0.69</Version>
<Version>1.0.70</Version>
<OutputType>Exe</OutputType>
<LangVersion>preview</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand Down
2 changes: 1 addition & 1 deletion Source/Samples/Sample.JSON/Sample.JSON.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>1.0.69</Version>
<Version>1.0.70</Version>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand Down
2 changes: 1 addition & 1 deletion Source/Samples/Sample.Rockstar/Sample.Rockstar.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>1.0.69</Version>
<Version>1.0.70</Version>
<OutputType>Exe</OutputType>
<LangVersion>preview</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand Down
2 changes: 1 addition & 1 deletion Source/Silverfly.Generator/Silverfly.Generator.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>1.0.69</Version>
<Version>1.0.70</Version>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
2 changes: 1 addition & 1 deletion Source/Silverfly.Repl/Silverfly.Repl.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>1.0.69</Version>
<Version>1.0.70</Version>
<LangVersion>preview</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Title>Silverfly.Repl</Title>
Expand Down
2 changes: 1 addition & 1 deletion Source/Silverfly.Testing/Silverfly.Testing.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>1.0.68</Version>
<Version>1.0.70</Version>
<LangVersion>preview</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Title>Silverfly.Testing</Title>
Expand Down
16 changes: 16 additions & 0 deletions Source/Silverfly/Parselets/EnumParselet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using Silverfly.Nodes;

namespace Silverfly.Parselets;

public class EnumParselet<TRegister> : IPrefixParselet
where TRegister : struct
{
public AstNode Parse(Parser parser, Token token)
{
var value = Enum.Parse<TRegister>(token.ToString(), true);

return new LiteralNode(value, token)
.WithRange(token);
}
}
2 changes: 1 addition & 1 deletion Source/Silverfly/Silverfly.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>1.0.69</Version>
<Version>1.0.70</Version>
<LangVersion>preview</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Title>Silverfly</Title>
Expand Down

0 comments on commit 2e79b0c

Please sign in to comment.