-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(kotlin) fix poly backtracking issue
- Use same numeric mode rules as for Java
- Loading branch information
1 parent
dee6434
commit 02ca487
Showing
3 changed files
with
41 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
// https://docs.oracle.com/javase/specs/jls/se15/html/jls-3.html#jls-3.10 | ||
var decimalDigits = '[0-9](_*[0-9])*'; | ||
var frac = `\\.(${decimalDigits})`; | ||
var hexDigits = '[0-9a-fA-F](_*[0-9a-fA-F])*'; | ||
export var NUMERIC = { | ||
className: 'number', | ||
variants: [ | ||
// DecimalFloatingPointLiteral | ||
// including ExponentPart | ||
{ begin: `(\\b(${decimalDigits})((${frac})|\\.)?|(${frac}))` + | ||
`[eE][+-]?(${decimalDigits})[fFdD]?\\b` }, | ||
// excluding ExponentPart | ||
{ begin: `\\b(${decimalDigits})((${frac})[fFdD]?\\b|\\.([fFdD]\\b)?)` }, | ||
{ begin: `(${frac})[fFdD]?\\b` }, | ||
{ begin: `\\b(${decimalDigits})[fFdD]\\b` }, | ||
|
||
// HexadecimalFloatingPointLiteral | ||
{ begin: `\\b0[xX]((${hexDigits})\\.?|(${hexDigits})?\\.(${hexDigits}))` + | ||
`[pP][+-]?(${decimalDigits})[fFdD]?\\b` }, | ||
|
||
// DecimalIntegerLiteral | ||
{ begin: '\\b(0|[1-9](_*[0-9])*)[lL]?\\b' }, | ||
|
||
// HexIntegerLiteral | ||
{ begin: `\\b0[xX](${hexDigits})[lL]?\\b` }, | ||
|
||
// OctalIntegerLiteral | ||
{ begin: '\\b0(_*[0-7])*[lL]?\\b' }, | ||
|
||
// BinaryIntegerLiteral | ||
{ begin: '\\b0[bB][01](_*[01])*[lL]?\\b' }, | ||
], | ||
relevance: 0 | ||
}; |