Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed highlighting for xint literals with separators #474

Merged
merged 2 commits into from
Jan 14, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ HEXDIGIT=({DIGIT}|[A-F]|[a-f])
OCTALDIGIT=[0-7]
BITDIGIT=[0-1]
INT=({DIGIT}(({DIGIT}|{SEPARATOR})*{DIGIT})?)
XINT=(0(((x|X){HEXDIGIT}+)|((o|O){OCTALDIGIT}+)|((b|B){BITDIGIT}+)))
XINT=(0(((x|X){HEXDIGIT}(({HEXDIGIT}|{SEPARATOR})*{HEXDIGIT})?)|((o|O){OCTALDIGIT}(({OCTALDIGIT}|{SEPARATOR})*{OCTALDIGIT})?)|((b|B){BITDIGIT}(({BITDIGIT}|{SEPARATOR})*{BITDIGIT})?)))
SBYTE=(({INT}|{XINT})y)
BYTE=(({INT}|{XINT})uy)
INT16=(({INT}|{XINT})s)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x1_1 0b1_1__1 0o1_1__1___1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
0000: INT32 '0x1_1'
0005: WHITE_SPACE ' '
0006: INT32 '0b1_1__1'
0014: WHITE_SPACE ' '
0015: INT32 '0o1_1__1___1'
0027: NEW_LINE '\r\n'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x1_2__3___4
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Language: PsiLanguageType:F#
IFSharpImplFile
IAnonModuleDeclaration
IExpressionStatement
IChameleonExpression
ILiteralExpr
FSharpToken(type:INT32, text:0x1_2__3___4)
NewLine(type:NEW_LINE, text:\n) spaces:"\n"

Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ type IdentifierHighlightingTest() =
[<Test>] member x.``Method - Application 01``() = x.DoNamedTest()
[<Test>] member x.``Method - Parameters - Optional 01``() = x.DoNamedTest()
[<Test>] member x.``Method - Parameters - Optional 02 - Private``() = x.DoNamedTest()
[<Test>] member x.``Numbers``() = x.DoNamedTest()
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type FSharpLexerTest() =
[<Test>] member x.``Literals 02 - numbers with suffices``() = x.DoNamedTest()
[<Test>] member x.``Literals 03 - digits``() = x.DoNamedTest()
[<Test>] member x.``Literals 04 - escape characters``() = x.DoNamedTest()
[<Test>] member x.``Literals 05 - numbers with separators``() = x.DoNamedTest()

[<Test>] member x.``Strings - Byte array 01``() = x.DoNamedTest()
[<Test>] member x.``Strings - Byte array 02 - Verbatim``() = x.DoNamedTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ type FSharpParserTest() =
[<Test>] member x.``Expr - Tuple 03 - Struct``() = x.DoNamedTest()

[<Test>] member x.``Expr - Const - Numbers 01``() = x.DoNamedTest()
[<Test>] member x.``Expr - Const - Numbers 02 - Separators``() = x.DoNamedTest()
[<Test>] member x.``Expr - Const - String 01``() = x.DoNamedTest()
[<Test>] member x.``Expr - Const - Unit 01``() = x.DoNamedTest()
[<Test>] member x.``Expr - Const - Unit 02 - Parens``() = x.DoNamedTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class FSharpLexerTest : RiderFrontendLexerTest("fs") {

@Test
fun testDigit() {
doTest("1234567890 1234567890u 1234567890l 0XABCDEFy 0x001100010s 3.0F 0x0000000000000000LF 34742626263193832612536171N 0o7 0b1 1F",
doTest("1234567890 1234567890u 1234567890l 0XABCDEFy 0x001100010s 3.0F 0x0000000000000000LF 0x0000_0000_0000_0000LF 34742626263193832612536171N 0o7 0b1 0o1___1 1F",
"""
|INT32 ('1234567890')
|WHITESPACE (' ')
Expand All @@ -26,12 +26,16 @@ class FSharpLexerTest : RiderFrontendLexerTest("fs") {
|WHITESPACE (' ')
|IEEE64 ('0x0000000000000000LF')
|WHITESPACE (' ')
|IEEE64 ('0x0000_0000_0000_0000LF')
|WHITESPACE (' ')
|BIGNUM ('34742626263193832612536171N')
|WHITESPACE (' ')
|INT32 ('0o7')
|WHITESPACE (' ')
|INT32 ('0b1')
|WHITESPACE (' ')
|INT32 ('0o1___1')
|WHITESPACE (' ')
|IEEE32 ('1F')
""".trimMargin()
)
Expand Down