Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/SmallSharp/EmitTargets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ namespace SmallSharp;

public class EmitTargets : Task
{
static readonly Regex sdkExpr = new(@"^#:sdk\s+([^@]+?)(@(.+))?$");
static readonly Regex packageExpr = new(@"^#:package\s+([^@]+)@(.+)$");
static readonly Regex propertyExpr = new(@"^#:property\s+([^=]+)=(.+)$");
static readonly Regex sdkExpr = new(@"^#:sdk\s+(?<sdk>[^@]+?)(@(?<version>.+))?$");
static readonly Regex packageExpr = new(@"^#:package\s+(?<id>[^@]+)@(?<version>.+)$");
static readonly Regex propertyExpr = new(@"^#:property\s+(?<name>[^=]+)=(?<value>.+)$");

[Required]
public required ITaskItem StartupFile { get; set; }
Expand Down Expand Up @@ -66,8 +66,8 @@ public override bool Execute()
{
if (packageExpr.Match(line) is { Success: true } match)
{
var id = match.Groups[1].Value.Trim();
var version = match.Groups[2].Value.Trim();
var id = match.Groups["id"].Value.Trim();
var version = match.Groups["version"].Value.Trim();

packages.Add(NewTaskItem(id, [("Version", version)]));

Expand All @@ -77,8 +77,8 @@ public override bool Execute()
}
else if (sdkExpr.Match(line) is { Success: true } sdkMatch)
{
var name = sdkMatch.Groups[1].Value.Trim();
var version = sdkMatch.Groups[2].Value.Trim();
var name = sdkMatch.Groups["sdk"].Value.Trim();
var version = sdkMatch.Groups["version"].Value.Trim();
if (!string.IsNullOrEmpty(version))
{
sdkItems.Add(NewTaskItem(name, [("Version", version)]));
Expand All @@ -92,8 +92,8 @@ public override bool Execute()
}
else if (propertyExpr.Match(line) is { Success: true } propMatch)
{
var name = propMatch.Groups[1].Value.Trim();
var value = propMatch.Groups[2].Value.Trim();
var name = propMatch.Groups["name"].Value.Trim();
var value = propMatch.Groups["value"].Value.Trim();

propItems.Add(NewTaskItem(name, [("Value", value)]));
properties.Add(new XElement(name, value));
Expand Down