Skip to content

Commit 6ae8bb8

Browse files
committed
Tokens: Tabspace
1 parent 7f537c9 commit 6ae8bb8

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

src/token/internal/char.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,15 @@ export const Digit = [Zero, ...NonZero] as TDigit
6767
// ------------------------------------------------------------------
6868
export const WhiteSpace = ' '
6969
export const NewLine = '\n'
70+
export const TabSpace = '\t'
7071
export const UnderScore = '_'
7172
export const Dot = '.'
7273
export const DollarSign = '$'
7374
export const Hyphen = '-'
7475

7576
export type TWhiteSpace = typeof WhiteSpace
7677
export type TNewLine = typeof NewLine
78+
export type TTabSpace = typeof TabSpace
7779
export type TUnderScore = typeof UnderScore
7880
export type TDot = typeof Dot
7981
export type TDollarSign = typeof DollarSign

src/token/internal/trim.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export type TTrim<Input extends string> = (
106106
Input extends `${OpenComment}${infer Rest extends string}` ? TTrim<TDiscardMultiLineComment<Rest>> :
107107
Input extends `${LineComment}${infer Rest extends string}` ? TTrim<TDiscardLineComment<Rest>> :
108108
Input extends `${Char.TNewLine}${infer Rest extends string}` ? TTrim<Rest> :
109+
Input extends `${Char.TTabSpace}${infer Rest extends string}` ? TTrim<Rest> :
109110
Input extends `${W4}${infer Rest extends string}` ? TTrim<Rest> :
110111
Input extends `${W3}${infer Rest extends string}` ? TTrim<Rest> :
111112
Input extends `${W1}${infer Rest extends string}` ? TTrim<Rest> :
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Trim } from '../../../../src/token/internal/trim.ts'
2+
import { Assert } from 'test'
3+
4+
const Test = Assert.Context('Token.Internal.Trim')
5+
6+
Test('Should Trim 1', () => Assert.IsExact(Trim(' 1'), '1'))
7+
Test('Should Trim 2', () => Assert.IsExact(Trim(' 1 '), '1 '))
8+
Test('Should Trim 3', () => Assert.IsExact(Trim('\n\n\n1 '), '1 '))
9+
Test('Should Trim 4', () => Assert.IsExact(Trim('\n\n\n1 '), '1 '))
10+
Test('Should Trim 5', () => Assert.IsExact(Trim('\t\t\t1'), '1'))
11+
Test('Should Trim 6', () => Assert.IsExact(Trim('\t\t\t1 '), '1 '))
12+
Test('Should Trim 7', () => Assert.IsExact(Trim('\n\t 1'), '1'))
13+
Test('Should Trim 8', () => Assert.IsExact(Trim('\n\t 1 '), '1 '))

0 commit comments

Comments
 (0)