Skip to content

Commit d05c983

Browse files
Move 'getTokenDesc' into parser (#2025)
1 parent 1fd4a22 commit d05c983

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/language/lexer.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,6 @@ export function isPunctuatorToken(token: Token) {
112112
);
113113
}
114114

115-
/**
116-
* A helper function to describe a token as a string for debugging
117-
*/
118-
export function getTokenDesc(token: Token): string {
119-
const value = token.value;
120-
return value ? `${token.kind} "${value}"` : token.kind;
121-
}
122-
123115
/**
124116
* Helper function for constructing the Token object.
125117
*/

src/language/parser.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Source } from './source';
66
import { type GraphQLError } from '../error/GraphQLError';
77
import { syntaxError } from '../error/syntaxError';
88
import { type TokenKindEnum, TokenKind } from './tokenKind';
9-
import { type Lexer, getTokenDesc, createLexer } from './lexer';
9+
import { type Lexer, createLexer } from './lexer';
1010
import {
1111
type Location,
1212
type Token,
@@ -1568,3 +1568,11 @@ function many<T>(
15681568
} while (!expectOptionalToken(lexer, closeKind));
15691569
return nodes;
15701570
}
1571+
1572+
/**
1573+
* A helper function to describe a token as a string for debugging
1574+
*/
1575+
function getTokenDesc(token: Token): string {
1576+
const value = token.value;
1577+
return value ? `${token.kind} "${value}"` : token.kind;
1578+
}

0 commit comments

Comments
 (0)