Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
asilverman committed Oct 16, 2023
1 parent 27fd979 commit edf1af0
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Bicep.Core/Syntax/ImportSpecification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,19 @@ public class ImportSpecification : ISymbolNameSource
// language=regex
private const string SemanticVersionPattern = @"(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?";

private static readonly Regex BareSpecification = new(
@$"(?<name>{NamePattern})@(?<version>{SemanticVersionPattern})$");
private static readonly Regex BareSpecification = new(@$"(?<name>{NamePattern})@(?<version>{SemanticVersionPattern})$");


private ImportSpecification(string unqualifiedAddress, string name, string version, bool isValid, TextSpan span)
private ImportSpecification(string triviaPath, string name, string version, bool isValid, TextSpan span)
{
UnqualifiedAddress = unqualifiedAddress;
TriviaPath = triviaPath;
Name = name;
Version = version;
IsValid = isValid;
Span = span;
}

private string UnqualifiedAddress { get; }
private string TriviaPath { get; }

public string Name { get; }

Expand Down Expand Up @@ -76,7 +75,7 @@ public SyntaxBase ToPath()
{
return new SkippedTriviaSyntax(this.Span, Enumerable.Empty<SyntaxBase>());
}
return SyntaxFactory.CreateStringLiteral(this.UnqualifiedAddress);
return SyntaxFactory.CreateStringLiteral(this.TriviaPath);
}

private static ImportSpecification CreateFromStringSyntax(StringSyntax stringSyntax, string value)
Expand All @@ -96,7 +95,7 @@ private static ImportSpecification CreateFromStringSyntax(StringSyntax stringSyn
var version = match.Groups["version"].Value;
var parts = value.Split('@');
var artifactAddress = parts[0];

var span = new TextSpan(stringSyntax.Span.Position + 1, artifactAddress.Length);

return new(string.Join(':', parts), name, version, artifactAddress != "az", span);
Expand Down

0 comments on commit edf1af0

Please sign in to comment.