Skip to content

Commit

Permalink
Add bit precision to hex int literals (#164)
Browse files Browse the repository at this point in the history
Closes #161
  • Loading branch information
kant2002 authored Nov 18, 2024
1 parent 003a07b commit bc08ed7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions Sources/SynKit/Libraries/C.Syntax/CLexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ public CToken Next()
if (this.TakeWhile(text, IsHex, ref offset) > 0)
{
this.TakeWhile(text, IsIntSuffix, ref offset);
this.TakeWhile(text, char.IsDigit, ref offset);
return Make(CTokenType.IntLiteral, text.ToString());
}
else
Expand Down
1 change: 1 addition & 0 deletions Sources/SynKit/Tests/C.Syntax.Tests/CLexerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public class CLexerTests
[InlineData(Kind.IntLiteral, "0x1fbU")]
[InlineData(Kind.IntLiteral, "0x1fbL")]
[InlineData(Kind.IntLiteral, "0XABCU")]
[InlineData(Kind.IntLiteral, "0XABCU16")]

[InlineData(Kind.IntLiteral, "123")]
[InlineData(Kind.IntLiteral, "0123")]
Expand Down

0 comments on commit bc08ed7

Please sign in to comment.