Skip to content

Commit

Permalink
Update parsing VerDirectiveSyntax
Browse files Browse the repository at this point in the history
  • Loading branch information
winscripter authored Jul 25, 2024
1 parent e3ead5d commit 0e8abdc
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions ILSourceParser/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -531,25 +531,21 @@ select numbers
);
}

internal Parser<VerDirectiveSyntax> ParseVerDirective()
internal static Parser<VerDirectiveSyntax> ParseVerDirective()
{
try
{
return from whitespace in ParseWhiteSpaceTrivia()
from ver in Parse.String(".ver").Token()
from major in ParseVerDirectiveDigit(true)
from minor in ParseVerDirectiveDigit(true)
from build in ParseVerDirectiveDigit(true)
from rev in ParseVerDirectiveDigit(false)
select new VerDirectiveSyntax(major, minor, build, rev, [whitespace], []);
}
catch (ParseException e)
{
return AddErrorAndGet(
e.Position,
Parse.Return(new VerDirectiveSyntax(
'0', '0', '0', '0', [], [])));
}
return from whitespace in ParseWhiteSpaceTrivia()
from ver in Parse.String(".ver").Token()
from major in ParseVerDirectiveDigit(true)
from minor in ParseVerDirectiveDigit(true)
from build in ParseVerDirectiveDigit(true)
from rev in ParseVerDirectiveDigit(false)
select new VerDirectiveSyntax(
leadingTrivia: [whitespace],
trailingTrivia: [],
major: major,
minor: minor,
build: build,
revision: rev);
}

internal static Parser<HashAlgorithmTrivia> ParseHashAlgorithmTrivia()
Expand Down

0 comments on commit 0e8abdc

Please sign in to comment.