• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rokucommunity / brighterscript / #13988

10 Mar 2025 03:58PM UTC coverage: 89.113%. Remained the same
#13988

push

TwitchBronBron
0.69.1

7461 of 8823 branches covered (84.56%)

Branch coverage included in aggregate %.

9794 of 10540 relevant lines covered (92.92%)

1836.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

54.55
/src/lexer/Token.ts
1
import { TokenKind } from './TokenKind';
1✔
2
import type { Range } from 'vscode-languageserver';
3

4
/**
5
 * Represents a chunk of BrightScript scanned by the lexer.
6
 */
7
export interface Token {
8
    /** The type of token this represents. */
9
    kind: TokenKind;
10
    /** The text found in the original BrightScript source, if any. */
11
    text: string;
12
    /** True if this token's `text` is a reserved word, otherwise `false`. */
13
    isReserved?: boolean;
14
    /** Where the token was found. */
15
    range: Range;
16
    /**
17
     * Any leading whitespace found prior to this token. Excludes newline characters.
18
     */
19
    leadingWhitespace?: string;
20
}
21

22
/**
23
 * Any object that has a range
24
 */
25
export interface Locatable {
26
    range: Range;
27
    [key: string]: any;
28
}
29

30
/**
31
 * Represents an identifier as scanned by the lexer.
32
 */
33
export interface Identifier extends Token {
34
    kind: TokenKind.Identifier;
35
}
36

37
/**
38
 * Determines whether or not `obj` is a `Token`.
39
 * @param obj the object to check for `Token`-ness
40
 * @returns `true` is `obj` is a `Token`, otherwise `false`
41
 */
42
export function isToken(obj: any): obj is Token {
1✔
43
    return !!(obj.kind && obj.text);
1,835✔
44
}
45

46
/**
47
 * Is this a token that has the `TokenKind.Identifier` kind?
48
 */
49
export function isIdentifier(obj: any): obj is Identifier {
1✔
50
    return obj?.kind === TokenKind.Identifier;
×
51
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc