Skip to content

Commit 8683948

Browse files
JoviDeCroockyaacovCR
authored andcommitted
treat dot as punctuator for schema coordinate parsing
1 parent d6d2c20 commit 8683948

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/language/__tests__/parser-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ describe('Parser', () => {
10681068
expect(() => parseSchemaCoordinate('MyType.field.deep'))
10691069
.to.throw()
10701070
.to.deep.include({
1071-
message: 'Syntax Error: Expected <EOF>, found ..',
1071+
message: 'Syntax Error: Expected <EOF>, found ".".',
10721072
locations: [{ line: 1, column: 13 }],
10731073
});
10741074
});
@@ -1194,7 +1194,7 @@ describe('Parser', () => {
11941194
expect(() => parseSchemaCoordinate('@myDirective.field'))
11951195
.to.throw()
11961196
.to.deep.include({
1197-
message: 'Syntax Error: Expected <EOF>, found ..',
1197+
message: 'Syntax Error: Expected <EOF>, found ".".',
11981198
locations: [{ line: 1, column: 13 }],
11991199
});
12001200
});

src/language/lexer.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import type { Source } from './source.js';
77
import { TokenKind } from './tokenKind.js';
88

99
/**
10-
* Parser supports parsing multiple Source types, which may have differing
11-
* Lexer classes. This is used for schema coordinates which has its own distinct
12-
* SchemaCoordinateLexer class.
10+
* A Lexer interface which provides common properties and methods required for
11+
* lexing GraphQL source.
12+
*
13+
* @internal
1314
*/
1415
export interface LexerInterface {
1516
source: Source;
@@ -110,6 +111,7 @@ export function isPunctuatorTokenKind(kind: TokenKind): boolean {
110111
kind === TokenKind.AMP ||
111112
kind === TokenKind.PAREN_L ||
112113
kind === TokenKind.PAREN_R ||
114+
kind === TokenKind.DOT ||
113115
kind === TokenKind.SPREAD ||
114116
kind === TokenKind.COLON ||
115117
kind === TokenKind.EQUALS ||

0 commit comments

Comments
 (0)