Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move 'getTokenDesc' into parser #2025

Merged
merged 1 commit into from Jul 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/language/lexer.js
Expand Up @@ -112,14 +112,6 @@ export function isPunctuatorToken(token: Token) {
);
}

/**
* A helper function to describe a token as a string for debugging
*/
export function getTokenDesc(token: Token): string {
const value = token.value;
return value ? `${token.kind} "${value}"` : token.kind;
}

/**
* Helper function for constructing the Token object.
*/
Expand Down
10 changes: 9 additions & 1 deletion src/language/parser.js
Expand Up @@ -6,7 +6,7 @@ import { Source } from './source';
import { type GraphQLError } from '../error/GraphQLError';
import { syntaxError } from '../error/syntaxError';
import { type TokenKindEnum, TokenKind } from './tokenKind';
import { type Lexer, getTokenDesc, createLexer } from './lexer';
import { type Lexer, createLexer } from './lexer';
import {
type Location,
type Token,
Expand Down Expand Up @@ -1568,3 +1568,11 @@ function many<T>(
} while (!expectOptionalToken(lexer, closeKind));
return nodes;
}

/**
* A helper function to describe a token as a string for debugging
*/
function getTokenDesc(token: Token): string {
const value = token.value;
return value ? `${token.kind} "${value}"` : token.kind;
}