diff --git a/src/typescript/Scala.tmLanguage.ts b/src/typescript/Scala.tmLanguage.ts index 80870a0..110533b 100644 --- a/src/typescript/Scala.tmLanguage.ts +++ b/src/typescript/Scala.tmLanguage.ts @@ -118,7 +118,7 @@ export const scalaTmLanguage: TmLanguage = { name: 'constant.language.scala' }, { - match: '\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.[0-9]+)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?|[0-9]+)([LlFfDd]|UL|ul)?\\b', + match: '\\b((0(x|X)[0-9a-fA-F_]*)|(([0-9][0-9_]*\\.[0-9][0-9_]*)|(\\.[0-9][0-9_]*))((e|E)(\\+|-)?[0-9][0-9_]*)?|[0-9][0-9_]*)([LlFfDd]|UL|ul)?\\b', name: 'constant.numeric.scala' }, { diff --git a/tests/unit/numeric.literals.test.scala b/tests/unit/numeric.literals.test.scala new file mode 100644 index 0000000..71903c7 --- /dev/null +++ b/tests/unit/numeric.literals.test.scala @@ -0,0 +1,38 @@ +// SYNTAX TEST "source.scala" + + 1 2l 2L 3f 3F 4d 4D 5.6 2.3e56 2.3E56 +// ^ constant.numeric.scala +// ^^ constant.numeric.scala +// ^^ constant.numeric.scala +// ^^ constant.numeric.scala +// ^^ constant.numeric.scala +// ^^ constant.numeric.scala +// ^^ constant.numeric.scala +// ^^^ constant.numeric.scala +// ^^^^^^ constant.numeric.scala +// ^^^^^^ constant.numeric.scala + + -1 +// ^ keyword.operator.arithmetic.scala +// ^ constant.numeric.scala + + 0x123abc +// ^^^^^^^^^ constant.numeric.scala + + 123_456 +// ^^^^^^^ constant.numeric.scala + + 0x123_abc +// ^^^^^^^^^ constant.numeric.scala + + 110_222_795_799.99 +// ^^^^^^^^^^^^^^^^^^ constant.numeric.scala + + 110.9499_999 +// ^^^^^^^^^^^ constant.numeric.scala + + 2_000.343_999e561_100 +// ^^^^^^^^^^^^^^^^^^^^^ constant.numeric.scala + + .123_456 +// ^^^^^^^ constant.numeric.scala