demo/typescript.js
function classifyTokenType(tokenKind, token) {
                if (ts.isKeyword(tokenKind)) {
                    return 3 /* keyword */;
                }
                // Special case < and >  If they appear in a generic context they are punctuation,
                // not operators.
                if (tokenKind === 25 /* LessThanToken */ || tokenKind === 27 /* GreaterThanToken */) {
                    // If the node owning the token has a type argument list or type parameter list, then
                    // we can effectively assume that a '<' and '>' belong to those lists.
                    if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) {
                        return 10 /* punctuation */;
                    }
                }
                if (ts.isPunctuation(tokenKind)) {
                    if (token) {
                        if (tokenKind === 56 /* EqualsToken */) {
                            // the '=' in a variable declaration is special cased here.
                            if (token.parent.kind === 211 /* VariableDeclaration */ ||
                                token.parent.kind === 141 /* PropertyDeclaration */ ||
                                token.parent.kind === 138 /* Parameter */) {
                                return 5 /* operator */;
                            }
                        }
                        if (token.parent.kind === 181 /* BinaryExpression */ ||
                            token.parent.kind === 179 /* PrefixUnaryExpression */ ||
                            token.parent.kind === 180 /* PostfixUnaryExpression */ ||
                            token.parent.kind === 182 /* ConditionalExpression */) {
                            return 5 /* operator */;
                        }
                    }
                    return 10 /* punctuation */;
                }
                else if (tokenKind === 8 /* NumericLiteral */) {
                    return 4 /* numericLiteral */;
                }
                else if (tokenKind === 9 /* StringLiteral */) {
                    return 6 /* stringLiteral */;
                }
                else if (tokenKind === 10 /* RegularExpressionLiteral */) {
                    // TODO: we should get another classification type for these literals.
                    return 6 /* stringLiteral */;
                }
                else if (ts.isTemplateLiteralKind(tokenKind)) {
                    // TODO (drosen): we should *also* get another classification type for these literals.
                    return 6 /* stringLiteral */;
                }
                else if (tokenKind === 69 /* Identifier */) {
                    if (token) {
                        switch (token.parent.kind) {
                            case 214 /* ClassDeclaration */:
                                if (token.parent.name === token) {
                                    return 11 /* className */;
                                }
                                return;
                            case 137 /* TypeParameter */:
                                if (token.parent.name === token) {
                                    return 15 /* typeParameterName */;
                                }
                                return;
                            case 215 /* InterfaceDeclaration */:
                                if (token.parent.name === token) {
                                    return 13 /* interfaceName */;
                                }
                                return;
                            case 217 /* EnumDeclaration */:
                                if (token.parent.name === token) {
                                    return 12 /* enumName */;
                                }
                                return;
                            case 218 /* ModuleDeclaration */:
                                if (token.parent.name === token) {
                                    return 14 /* moduleName */;
                                }
                                return;
                            case 138 /* Parameter */:
                                if (token.parent.name === token) {
                                    return 17 /* parameterName */;
                                }
                                return;
                        }
                    }
                    return 2 /* identifier */;
                }
            }
function classifyTokenType(tokenKind, token) {
                if (ts.isKeyword(tokenKind)) {
                    return 3 /* keyword */;
                }
                // Special case < and >  If they appear in a generic context they are punctuation,
                // not operators.
                if (tokenKind === 25 /* LessThanToken */ || tokenKind === 27 /* GreaterThanToken */) {
                    // If the node owning the token has a type argument list or type parameter list, then
                    // we can effectively assume that a '<' and '>' belong to those lists.
                    if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) {
                        return 10 /* punctuation */;
                    }
                }
                if (ts.isPunctuation(tokenKind)) {
                    if (token) {
                        if (tokenKind === 56 /* EqualsToken */) {
                            // the '=' in a variable declaration is special cased here.
                            if (token.parent.kind === 211 /* VariableDeclaration */ ||
                                token.parent.kind === 141 /* PropertyDeclaration */ ||
                                token.parent.kind === 138 /* Parameter */) {
                                return 5 /* operator */;
                            }
                        }
                        if (token.parent.kind === 181 /* BinaryExpression */ ||
                            token.parent.kind === 179 /* PrefixUnaryExpression */ ||
                            token.parent.kind === 180 /* PostfixUnaryExpression */ ||
                            token.parent.kind === 182 /* ConditionalExpression */) {
                            return 5 /* operator */;
                        }
                    }
                    return 10 /* punctuation */;
                }
                else if (tokenKind === 8 /* NumericLiteral */) {
                    return 4 /* numericLiteral */;
                }
                else if (tokenKind === 9 /* StringLiteral */) {
                    return 6 /* stringLiteral */;
                }
                else if (tokenKind === 10 /* RegularExpressionLiteral */) {
                    // TODO: we should get another classification type for these literals.
                    return 6 /* stringLiteral */;
                }
                else if (ts.isTemplateLiteralKind(tokenKind)) {
                    // TODO (drosen): we should *also* get another classification type for these literals.
                    return 6 /* stringLiteral */;
                }
                else if (tokenKind === 69 /* Identifier */) {
                    if (token) {
                        switch (token.parent.kind) {
                            case 214 /* ClassDeclaration */:
                                if (token.parent.name === token) {
                                    return 11 /* className */;
                                }
                                return;
                            case 137 /* TypeParameter */:
                                if (token.parent.name === token) {
                                    return 15 /* typeParameterName */;
                                }
                                return;
                            case 215 /* InterfaceDeclaration */:
                                if (token.parent.name === token) {
                                    return 13 /* interfaceName */;
                                }
                                return;
                            case 217 /* EnumDeclaration */:
                                if (token.parent.name === token) {
                                    return 12 /* enumName */;
                                }
                                return;
                            case 218 /* ModuleDeclaration */:
                                if (token.parent.name === token) {
                                    return 14 /* moduleName */;
                                }
                                return;
                            case 138 /* Parameter */:
                                if (token.parent.name === token) {
                                    return 17 /* parameterName */;
                                }
                                return;
                        }
                    }
                    return 2 /* identifier */;
                }
            }
function classifyTokenType ( tokenKind , token ) { if ( ts . isKeyword ( tokenKind ) ) { return 3 /* keyword */ ; } // Special case < and >  If they appear in a generic context they are punctuation, // not operators. if ( tokenKind === 25 /* LessThanToken */ || tokenKind === 27 /* GreaterThanToken */ ) { // If the node owning the token has a type argument list or type parameter list, then // we can effectively assume that a '<' and '>' belong to those lists. if ( token && ts . getTypeArgumentOrTypeParameterList ( token . parent ) ) { return 10 /* punctuation */ ; } } if ( ts . isPunctuation ( tokenKind ) ) { if ( token ) { if ( tokenKind === 56 /* EqualsToken */ ) { // the '=' in a variable declaration is special cased here. if ( token . parent . kind === 211 /* VariableDeclaration */ || token . parent . kind === 141 /* PropertyDeclaration */ || token . parent . kind === 138 /* Parameter */ ) { return 5 /* operator */ ; } } if ( token . parent . kind === 181 /* BinaryExpression */ || token . parent . kind === 179 /* PrefixUnaryExpression */ || token . parent . kind === 180 /* PostfixUnaryExpression */ || token . parent . kind === 182 /* ConditionalExpression */ ) { return 5 /* operator */ ; } } return 10 /* punctuation */ ; } else if ( tokenKind === 8 /* NumericLiteral */ ) { return 4 /* numericLiteral */ ; } else if ( tokenKind === 9 /* StringLiteral */ ) { return 6 /* stringLiteral */ ; } else if ( tokenKind === 10 /* RegularExpressionLiteral */ ) { // TODO: we should get another classification type for these literals. return 6 /* stringLiteral */ ; } else if ( ts . isTemplateLiteralKind ( tokenKind ) ) { // TODO (drosen): we should *also* get another classification type for these literals. return 6 /* stringLiteral */ ; } else if ( tokenKind === 69 /* Identifier */ ) { if ( token ) { switch ( token . parent . kind ) { case 214 /* ClassDeclaration */ : if ( token . parent . name === token ) { return 11 /* className */ ; } return ; case 137 /* TypeParameter */ : if ( token . parent . name === token ) { return 15 /* typeParameterName */ ; } return ; case 215 /* InterfaceDeclaration */ : if ( token . parent . name === token ) { return 13 /* interfaceName */ ; } return ; case 217 /* EnumDeclaration */ : if ( token . parent . name === token ) { return 12 /* enumName */ ; } return ; case 218 /* ModuleDeclaration */ : if ( token . parent . name === token ) { return 14 /* moduleName */ ; } return ; case 138 /* Parameter */ : if ( token . parent . name === token ) { return 17 /* parameterName */ ; } return ; } } return 2 /* identifier */ ; } }
for accurate classification, the actual token should be passed in.  however, for cases like 'disabled merge code' classification, we just get the token kind and classify based on that instead.
for accurate classification the actual token should be passed in . however for cases like disabled merge code classification we just get the token kind and classify based on that instead .