@@ -25,7 +25,6 @@ function advance(pattern: RegExp) {
25
25
}
26
26
27
27
const leadingRe = / + (? = [ ^ \s ] ) / y;
28
- const nameRe = / [ A - Z a - z _ ] [ 0 - 9 A - Z a - z _ ] * / y;
29
28
function blockString ( string : string ) {
30
29
const lines = string . split ( '\n' ) ;
31
30
let out = '' ;
@@ -471,27 +470,21 @@ function variableDefinitions(): ast.VariableDefinitionNode[] | undefined {
471
470
}
472
471
473
472
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 ( ) ;
477
474
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' ) ;
484
477
ignored ( ) ;
485
478
const fragDef : ast . FragmentDefinitionNode = {
486
479
kind : 'FragmentDefinition' as Kind . FRAGMENT_DEFINITION ,
487
- name : { kind : 'Name' as Kind . NAME , value : _name } ,
480
+ name,
488
481
typeCondition : {
489
482
kind : 'NamedType' as Kind . NAMED_TYPE ,
490
- name : { kind : 'Name' as Kind . NAME , value : _condition } ,
483
+ name : nameNode ( ) ,
491
484
} ,
492
485
variableDefinitions : _variableDefinitions ,
493
- directives : _directives ,
494
- selectionSet : selectionSet ( ) ,
486
+ directives : directives ( false ) ,
487
+ selectionSet : selectionSetStart ( ) ,
495
488
} ;
496
489
if ( description ) {
497
490
fragDef . description = description ;
0 commit comments