forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsyntaxFacts2.ts
More file actions
32 lines (26 loc) · 1.17 KB
/
Copy pathsyntaxFacts2.ts
File metadata and controls
32 lines (26 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
///<reference path='references.ts' />
module TypeScript.SyntaxFacts {
export function isDirectivePrologueElement(node: ISyntaxNodeOrToken): boolean {
return node.kind === SyntaxKind.ExpressionStatement &&
(<ExpressionStatementSyntax>node).expression.kind === SyntaxKind.StringLiteral;
}
export function isUseStrictDirective(node: ISyntaxNodeOrToken): boolean {
var expressionStatement = <ExpressionStatementSyntax>node;
var stringLiteral = <ISyntaxToken>expressionStatement.expression;
var text = stringLiteral.text();
return text === '"use strict"' || text === "'use strict'";
}
export function isIdentifierNameOrAnyKeyword(token: ISyntaxToken): boolean {
var tokenKind = token.kind;
return tokenKind === SyntaxKind.IdentifierName || SyntaxFacts.isAnyKeyword(tokenKind);
}
export function isAccessibilityModifier(kind: SyntaxKind): boolean {
switch (kind) {
case SyntaxKind.PublicKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
return true;
}
return false;
}
}