Skip to content

Commit e6ab04c

Browse files
committed
Fix character literal
Previously the character literal was updated mimicking that of Rust apparently, but Scala doesn't have curly braces in the character literal. We do, however, support two 'u' characters.
1 parent e02f003 commit e6ab04c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

corpus/literals.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ val myChar = 'c'
228228

229229
val otherChar = '\u0041'
230230

231+
val otherChar2 = '\uu0041'
232+
231233
val anotherChar = '\n'
232234

233235
def foo(a: Char = 'c') = a + 'd'
@@ -244,6 +246,9 @@ def foo(a: Char = 'c') = a + 'd'
244246
(val_definition
245247
(identifier)
246248
(character_literal))
249+
(val_definition
250+
(identifier)
251+
(character_literal))
247252
(function_definition
248253
(identifier)
249254
(parameters

grammar.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,8 +1554,7 @@ module.exports = grammar({
15541554
"\\",
15551555
choice(
15561556
/[^xu]/,
1557-
/u[0-9a-fA-F]{4}/,
1558-
/u{[0-9a-fA-F]+}/,
1557+
/uu?[0-9a-fA-F]{4}/,
15591558
/x[0-9a-fA-F]{2}/,
15601559
),
15611560
),

0 commit comments

Comments
 (0)