@@ -25,7 +25,6 @@ function advance(pattern: RegExp) {
2525}
2626
2727const leadingRe = / + (? = [ ^ \s ] ) / y;
28- const nameRe = / [ A - Z a - z _ ] [ 0 - 9 A - Z a - z _ ] * / y;
2928function blockString ( string : string ) {
3029 const lines = string . split ( '\n' ) ;
3130 let out = '' ;
@@ -471,27 +470,21 @@ function variableDefinitions(): ast.VariableDefinitionNode[] | undefined {
471470}
472471
473472function 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