Skip to content

Commit 72eca4a

Browse files
committed
Revert conflict resolution with main version
1 parent 222cbc1 commit 72eca4a

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/parser.ts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ function advance(pattern: RegExp) {
2525
}
2626

2727
const leadingRe = / +(?=[^\s])/y;
28-
const nameRe = /[A-Za-z_][0-9A-Za-z_]*/y;
2928
function blockString(string: string) {
3029
const lines = string.split('\n');
3130
let out = '';
@@ -471,27 +470,21 @@ function variableDefinitions(): ast.VariableDefinitionNode[] | undefined {
471470
}
472471

473472
function fragmentDefinition(description?: ast.StringValueNode): ast.FragmentDefinitionNode {
474-
let _name: string | undefined;
475-
let _condition: string | undefined;
476-
if ((_name = advance(nameRe)) == null) throw error('FragmentDefinition');
473+
const name = nameNode();
477474
const _variableDefinitions = variableDefinitions();
478-
if (advance(nameRe) !== 'on') throw error('FragmentDefinition');
479-
ignored();
480-
if ((_condition = advance(nameRe)) == null) throw error('FragmentDefinition');
481-
ignored();
482-
const _directives = directives(false);
483-
if (input.charCodeAt(idx++) !== 123 /*'{'*/) throw error('FragmentDefinition');
475+
if (input.charCodeAt(idx++) !== 111 /*'o'*/ || input.charCodeAt(idx++) !== 110 /*'n'*/)
476+
throw error('FragmentDefinition');
484477
ignored();
485478
const fragDef: ast.FragmentDefinitionNode = {
486479
kind: 'FragmentDefinition' as Kind.FRAGMENT_DEFINITION,
487-
name: { kind: 'Name' as Kind.NAME, value: _name },
480+
name,
488481
typeCondition: {
489482
kind: 'NamedType' as Kind.NAMED_TYPE,
490-
name: { kind: 'Name' as Kind.NAME, value: _condition },
483+
name: nameNode(),
491484
},
492485
variableDefinitions: _variableDefinitions,
493-
directives: _directives,
494-
selectionSet: selectionSet(),
486+
directives: directives(false),
487+
selectionSet: selectionSetStart(),
495488
};
496489
if (description) {
497490
fragDef.description = description;

0 commit comments

Comments
 (0)