Skip to content

Commit

Permalink
Move 'getTokenDesc' into parser (#2025)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Jul 10, 2019
1 parent 1fd4a22 commit d05c983
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
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;
}

0 comments on commit d05c983

Please sign in to comment.