csharp: add support for binary literals and _ as separator

Note that proper `_` usage is not enforced; this matches vscode behavior.
This commit is contained in:
Sandy Armstrong 2017-04-28 14:34:17 -07:00
parent eb82671c37
commit de35151091
2 changed files with 59 additions and 3 deletions

View file

@ -525,6 +525,12 @@ testTokenization('csharp', [
{ startIndex: 0, type: 'number.cs' }
]}],
[{
line: '123_456',
tokens: [
{ startIndex: 0, type: 'number.cs' }
]}],
[{
line: '0x',
tokens: [
@ -532,18 +538,49 @@ testTokenization('csharp', [
{ startIndex: 1, type: 'identifier.cs' }
]}],
[{
line: '0b',
tokens: [
{ startIndex: 0, type: 'number.cs' },
{ startIndex: 1, type: 'identifier.cs' }
]}],
[{
line: '0x123',
tokens: [
{ startIndex: 0, type: 'number.hex.cs' }
]}],
[{
line: '0x123_456',
tokens: [
{ startIndex: 0, type: 'number.hex.cs' }
]}],
[{
line: '0b101',
tokens: [
{ startIndex: 0, type: 'number.hex.cs' }
]}],
[{
line: '0b1010_0001',
tokens: [
{ startIndex: 0, type: 'number.hex.cs' }
]}],
[{
line: '23.5',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
[{
line: '1_23.5',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
[{
line: '23.5e3',
tokens: [
@ -568,6 +605,12 @@ testTokenization('csharp', [
{ startIndex: 0, type: 'number.float.cs' }
]}],
[{
line: '2_3.5f',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
[{
line: '1.72E3F',
tokens: [
@ -598,6 +641,12 @@ testTokenization('csharp', [
{ startIndex: 0, type: 'number.float.cs' }
]}],
[{
line: '456_123.5D',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
[{
line: '23.5d',
tokens: [
@ -616,6 +665,12 @@ testTokenization('csharp', [
{ startIndex: 0, type: 'number.float.cs' }
]}],
[{
line: '1.720_123E3d',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
[{
line: '1.72e3D',
tokens: [