Skip to content

Commit 437e0e6

Browse files
committed
PR feedback
1 parent a092989 commit 437e0e6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

libraries/rushell/src/Tokenizer.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export enum TokenKind {
1010
// A single newline sequence such as CRLF or LF
1111
NewLine,
1212
// An unrecognized character
13-
Other,
13+
OtherCharacter,
1414
// A sequence of characters that doesn't contain any symbols with special meaning
1515
// Characters can be escaped, in which case the Token.text may differ from the
1616
// Token.range.toString()
@@ -63,6 +63,10 @@ export class Tokenizer {
6363
private _currentIndex: number;
6464

6565
private static _isSpace(c: string | undefined): boolean {
66+
// You can empirically test whether shell treats a given character as whitespace like this:
67+
// echo $(echo -e a '\u0009' b)
68+
// If you get "a b" it means the tab character (Unicode 0009) is being collapsed away.
69+
// If you get "a b" then the invisible character is being padded like a normal letter.
6670
return c === ' ' || c === '\t';
6771
}
6872

@@ -208,7 +212,7 @@ export class Tokenizer {
208212

209213
// Otherwise treat it as an "other" character
210214
this._get();
211-
return new Token(TokenKind.Other, input.getNewRange(startIndex, this._currentIndex));
215+
return new Token(TokenKind.OtherCharacter, input.getNewRange(startIndex, this._currentIndex));
212216
}
213217

214218
public getTokens(): Token[] {

0 commit comments

Comments
 (0)