grammar.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var grammar = {
  7. Name: {
  8. token: 'Name'
  9. },
  10. String: {
  11. token: 'String'
  12. },
  13. BlockString: {
  14. token: 'BlockString'
  15. },
  16. Document: {
  17. listOfType: 'Definition'
  18. },
  19. Definition: {
  20. peek: [{
  21. ifCondition: {
  22. token: 'Name',
  23. oneOf: ['query', 'mutation', 'subscription']
  24. },
  25. expect: 'OperationDefinition'
  26. }, {
  27. ifCondition: {
  28. token: 'Name',
  29. ofValue: 'fragment'
  30. },
  31. expect: 'FragmentDefinition'
  32. }, {
  33. ifCondition: {
  34. token: 'Name',
  35. oneOf: ['schema', 'scalar', 'type', 'interface', 'union', 'enum', 'input', 'directive']
  36. },
  37. expect: 'TypeSystemDefinition'
  38. }, {
  39. ifCondition: {
  40. token: 'Name',
  41. ofValue: 'extend'
  42. },
  43. expect: 'TypeSystemExtension'
  44. }, {
  45. ifCondition: {
  46. token: '{'
  47. },
  48. expect: 'OperationDefinition'
  49. }, {
  50. ifCondition: 'String',
  51. expect: 'TypeSystemDefinition'
  52. }, {
  53. ifCondition: 'BlockString',
  54. expect: 'TypeSystemDefinition'
  55. }]
  56. },
  57. OperationDefinition: {
  58. peek: [{
  59. ifCondition: {
  60. token: '{'
  61. },
  62. expect: 'SelectionSet'
  63. }, {
  64. ifCondition: {
  65. token: 'Name',
  66. oneOf: ['query', 'mutation', 'subscription']
  67. },
  68. expect: ['OperationType', {
  69. token: 'Name',
  70. optional: true,
  71. tokenName: 'OperationName',
  72. definitionName: true
  73. }, {
  74. ofType: 'VariableDefinitions',
  75. optional: true
  76. }, {
  77. ofType: 'Directives',
  78. optional: true
  79. }, 'SelectionSet']
  80. }]
  81. },
  82. OperationType: {
  83. ofType: 'OperationTypeName'
  84. },
  85. OperationTypeName: {
  86. token: 'Name',
  87. oneOf: ['query', 'mutation', 'subscription'],
  88. definitionName: true
  89. },
  90. SelectionSet: [{
  91. token: '{'
  92. }, {
  93. listOfType: 'Selection'
  94. }, {
  95. token: '}'
  96. }],
  97. Selection: {
  98. peek: [{
  99. ifCondition: {
  100. token: '...'
  101. },
  102. expect: 'Fragment'
  103. }, {
  104. ifCondition: {
  105. token: 'Name'
  106. },
  107. expect: 'Field'
  108. }]
  109. },
  110. Field: [{
  111. ofType: 'Alias',
  112. optional: true,
  113. eatNextOnFail: true,
  114. definitionName: true
  115. }, {
  116. token: 'Name',
  117. tokenName: 'FieldName',
  118. definitionName: true
  119. }, {
  120. ofType: 'Arguments',
  121. optional: true
  122. }, {
  123. ofType: 'Directives',
  124. optional: true
  125. }, {
  126. ofType: 'SelectionSet',
  127. optional: true
  128. }],
  129. Arguments: [{
  130. token: '('
  131. }, {
  132. listOfType: 'Argument'
  133. }, {
  134. token: ')'
  135. }],
  136. Argument: [{
  137. token: 'Name',
  138. tokenName: 'ArgumentName',
  139. definitionName: true
  140. }, {
  141. token: ':'
  142. }, 'Value'],
  143. Alias: [{
  144. token: 'Name',
  145. tokenName: 'AliasName',
  146. definitionName: true
  147. }, {
  148. token: ':'
  149. }],
  150. Fragment: [{
  151. token: '...'
  152. }, {
  153. peek: [{
  154. ifCondition: 'FragmentName',
  155. expect: 'FragmentSpread'
  156. }, {
  157. ifCondition: {
  158. token: 'Name',
  159. ofValue: 'on'
  160. },
  161. expect: 'InlineFragment'
  162. }, {
  163. ifCondition: {
  164. token: '@'
  165. },
  166. expect: 'InlineFragment'
  167. }, {
  168. ifCondition: {
  169. token: '{'
  170. },
  171. expect: 'InlineFragment'
  172. }]
  173. }],
  174. FragmentSpread: ['FragmentName', {
  175. ofType: 'Directives',
  176. optional: true
  177. }],
  178. FragmentDefinition: [{
  179. token: 'Name',
  180. ofValue: 'fragment',
  181. tokenName: 'FragmentDefinitionKeyword'
  182. }, 'FragmentName', 'TypeCondition', {
  183. ofType: 'Directives',
  184. optional: true
  185. }, 'SelectionSet'],
  186. FragmentName: {
  187. token: 'Name',
  188. butNot: {
  189. token: 'Name',
  190. ofValue: 'on'
  191. },
  192. definitionName: true
  193. },
  194. TypeCondition: [{
  195. token: 'Name',
  196. ofValue: 'on',
  197. tokenName: 'OnKeyword'
  198. }, 'TypeName'],
  199. InlineFragment: [{
  200. ofType: 'TypeCondition',
  201. optional: true
  202. }, {
  203. ofType: 'Directives',
  204. optional: true
  205. }, 'SelectionSet'],
  206. Value: {
  207. peek: [{
  208. ifCondition: {
  209. token: '$'
  210. },
  211. expect: 'Variable'
  212. }, {
  213. ifCondition: 'IntValue',
  214. expect: {
  215. ofType: 'IntValue',
  216. tokenName: 'NumberValue'
  217. }
  218. }, {
  219. ifCondition: 'FloatValue',
  220. expect: {
  221. ofType: 'FloatValue',
  222. tokenName: 'NumberValue'
  223. }
  224. }, {
  225. ifCondition: 'BooleanValue',
  226. expect: {
  227. ofType: 'BooleanValue',
  228. tokenName: 'BooleanValue'
  229. }
  230. }, {
  231. ifCondition: 'EnumValue',
  232. expect: {
  233. ofType: 'EnumValue',
  234. tokenName: 'EnumValue'
  235. }
  236. }, {
  237. ifCondition: 'String',
  238. expect: {
  239. ofType: 'String',
  240. tokenName: 'StringValue'
  241. }
  242. }, {
  243. ifCondition: 'BlockString',
  244. expect: {
  245. ofType: 'BlockString',
  246. tokenName: 'StringValue'
  247. }
  248. }, {
  249. ifCondition: 'NullValue',
  250. expect: {
  251. ofType: 'NullValue',
  252. tokenName: 'NullValue'
  253. }
  254. }, {
  255. ifCondition: {
  256. token: '['
  257. },
  258. expect: 'ListValue'
  259. }, {
  260. ifCondition: {
  261. token: '{'
  262. },
  263. expect: 'ObjectValue'
  264. }]
  265. },
  266. ConstValue: {
  267. peek: [{
  268. ifCondition: 'IntValue',
  269. expect: {
  270. ofType: 'IntValue'
  271. }
  272. }, {
  273. ifCondition: 'FloatValue',
  274. expect: {
  275. ofType: 'FloatValue'
  276. }
  277. }, {
  278. ifCondition: 'BooleanValue',
  279. expect: 'BooleanValue'
  280. }, {
  281. ifCondition: 'EnumValue',
  282. expect: 'EnumValue'
  283. }, {
  284. ifCondition: 'String',
  285. expect: {
  286. ofType: 'String',
  287. tokenName: 'StringValue'
  288. }
  289. }, {
  290. ifCondition: 'BlockString',
  291. expect: {
  292. token: 'BlockString',
  293. tokenName: 'StringValue'
  294. }
  295. }, {
  296. ifCondition: 'NullValue',
  297. expect: 'NullValue'
  298. }, {
  299. ifCondition: {
  300. token: '['
  301. },
  302. expect: 'ConstListValue'
  303. }, {
  304. ifCondition: {
  305. token: '{'
  306. },
  307. expect: 'ObjectValue'
  308. }]
  309. },
  310. IntValue: {
  311. token: 'Int'
  312. },
  313. FloatValue: {
  314. token: 'Float'
  315. },
  316. StringValue: {
  317. peek: [{
  318. ifCondition: {
  319. token: 'String'
  320. },
  321. expect: {
  322. token: 'String',
  323. tokenName: 'StringValue'
  324. }
  325. }, {
  326. ifCondition: {
  327. token: 'BlockString'
  328. },
  329. expect: {
  330. token: 'BlockString',
  331. tokenName: 'StringValue'
  332. }
  333. }]
  334. },
  335. BooleanValue: {
  336. token: 'Name',
  337. oneOf: ['true', 'false'],
  338. tokenName: 'BooleanValue'
  339. },
  340. NullValue: {
  341. token: 'Name',
  342. ofValue: 'null',
  343. tokenName: 'NullValue'
  344. },
  345. EnumValue: {
  346. token: 'Name',
  347. butNot: {
  348. token: 'Name',
  349. oneOf: ['null', 'true', 'false']
  350. },
  351. tokenName: 'EnumValue'
  352. },
  353. ListValue: [{
  354. token: '['
  355. }, {
  356. listOfType: 'Value',
  357. optional: true
  358. }, {
  359. token: ']'
  360. }],
  361. ConstListValue: [{
  362. token: '['
  363. }, {
  364. listOfType: 'ConstValue',
  365. optional: true
  366. }, {
  367. token: ']'
  368. }],
  369. ObjectValue: [{
  370. token: '{'
  371. }, {
  372. listOfType: 'ObjectField',
  373. optional: true
  374. }, {
  375. token: '}'
  376. }],
  377. ObjectField: [{
  378. token: 'Name',
  379. tokenName: 'ObjectFieldName'
  380. }, {
  381. token: ':'
  382. }, {
  383. ofType: 'ConstValue'
  384. }],
  385. Variable: [{
  386. token: '$',
  387. tokenName: 'VariableName'
  388. }, {
  389. token: 'Name',
  390. tokenName: 'VariableName'
  391. }],
  392. VariableDefinitions: [{
  393. token: '('
  394. }, {
  395. listOfType: 'VariableDefinition'
  396. }, {
  397. token: ')'
  398. }],
  399. VariableDefinition: ['Variable', {
  400. token: ':'
  401. }, 'Type', {
  402. ofType: 'DefaultValue',
  403. optional: true
  404. }],
  405. DefaultValue: [{
  406. token: '='
  407. }, 'ConstValue'],
  408. TypeName: {
  409. token: 'Name',
  410. tokenName: 'TypeName',
  411. typeName: true
  412. },
  413. Type: {
  414. peek: [{
  415. ifCondition: {
  416. token: 'Name'
  417. },
  418. expect: ['TypeName', {
  419. token: '!',
  420. optional: true
  421. }]
  422. }, {
  423. ifCondition: {
  424. token: '['
  425. },
  426. expect: 'ListType'
  427. }]
  428. },
  429. ListType: [{
  430. token: '['
  431. }, {
  432. listOfType: 'Type'
  433. }, {
  434. token: ']'
  435. }, {
  436. token: '!',
  437. optional: true
  438. }],
  439. Directives: {
  440. listOfType: 'Directive'
  441. },
  442. Directive: [{
  443. token: '@',
  444. tokenName: 'DirectiveName'
  445. }, {
  446. token: 'Name',
  447. tokenName: 'DirectiveName'
  448. }, {
  449. ofType: 'Arguments',
  450. optional: true
  451. }],
  452. TypeSystemDefinition: [{
  453. ofType: 'Description',
  454. optional: true
  455. }, {
  456. peek: [{
  457. ifCondition: {
  458. target: 'Name',
  459. ofValue: 'schema'
  460. },
  461. expect: 'SchemaDefinition'
  462. }, {
  463. ifCondition: {
  464. target: 'Name',
  465. ofValue: 'scalar'
  466. },
  467. expect: 'ScalarTypeDefinition'
  468. }, {
  469. ifCondition: {
  470. target: 'Name',
  471. ofValue: 'type'
  472. },
  473. expect: 'ObjectTypeDefinition'
  474. }, {
  475. ifCondition: {
  476. target: 'Name',
  477. ofValue: 'interface'
  478. },
  479. expect: 'InterfaceTypeDefinition'
  480. }, {
  481. ifCondition: {
  482. target: 'Name',
  483. ofValue: 'union'
  484. },
  485. expect: 'UnionTypeDefinition'
  486. }, {
  487. ifCondition: {
  488. target: 'Name',
  489. ofValue: 'enum'
  490. },
  491. expect: 'EnumTypeDefinition'
  492. }, {
  493. ifCondition: {
  494. target: 'Name',
  495. ofValue: 'input'
  496. },
  497. expect: 'InputObjectTypeDefinition'
  498. }, {
  499. ifCondition: {
  500. target: 'Name',
  501. ofValue: 'directive'
  502. },
  503. expect: 'DirectiveDefinition'
  504. }]
  505. }],
  506. TypeSystemExtension: {
  507. peek: [{
  508. ifCondition: {
  509. target: 'Name',
  510. ofValue: 'schema'
  511. },
  512. expect: 'SchemaExtension'
  513. }, {
  514. ifCondition: {
  515. target: 'Name',
  516. ofValue: 'scalar'
  517. },
  518. expect: 'ScalarTypeExtension'
  519. }, {
  520. ifCondition: {
  521. target: 'Name',
  522. ofValue: 'type'
  523. },
  524. expect: 'ObjectTypeExtension'
  525. }, {
  526. ifCondition: {
  527. target: 'Name',
  528. ofValue: 'interface'
  529. },
  530. expect: 'InterfaceTypeExtension'
  531. }, {
  532. ifCondition: {
  533. target: 'Name',
  534. ofValue: 'union'
  535. },
  536. expect: 'UnionTypeExtension'
  537. }, {
  538. ifCondition: {
  539. target: 'Name',
  540. ofValue: 'enum'
  541. },
  542. expect: 'EnumTypeExtension'
  543. }, {
  544. ifCondition: {
  545. target: 'Name',
  546. ofValue: 'input'
  547. },
  548. expect: 'InputObjectTypeExtension'
  549. }]
  550. },
  551. SchemaDefinition: [{
  552. token: 'Name',
  553. ofValue: 'schema',
  554. tokenName: 'SchemaDefinitionKeyword'
  555. }, {
  556. ofType: 'Directives',
  557. optional: true
  558. }, {
  559. token: '{'
  560. }, {
  561. listOfType: 'RootOperationTypeDefinition'
  562. }, {
  563. token: '}'
  564. }],
  565. RootOperationTypeDefinition: ['OperationType', {
  566. token: ':'
  567. }, {
  568. token: 'Name',
  569. tokenName: 'OperationTypeDefinitionName'
  570. }],
  571. SchemaExtension: [{
  572. token: 'Name',
  573. ofValue: 'extend'
  574. }, {
  575. token: 'Name',
  576. ofValue: 'schema'
  577. }, 'Name', {
  578. peek: [{
  579. ifCondition: {
  580. token: '@'
  581. },
  582. expect: ['Directives', {
  583. ofType: [{
  584. token: '{'
  585. }, {
  586. listOfType: 'RootOperationTypeDefinition'
  587. }, {
  588. token: '}'
  589. }],
  590. optional: true
  591. }]
  592. }, {
  593. ifCondition: {
  594. token: '{'
  595. },
  596. expect: [{
  597. token: '{'
  598. }, {
  599. listOfType: 'RootOperationTypeDefinition'
  600. }, {
  601. token: '}'
  602. }]
  603. }]
  604. }],
  605. Description: 'StringValue',
  606. ScalarTypeDefinition: [{
  607. ofType: 'Description',
  608. optional: true
  609. }, {
  610. token: 'Name',
  611. ofValue: 'scalar',
  612. tokenName: 'ScalarDefinitionKeyword'
  613. }, 'TypeName', {
  614. ofType: 'Directives',
  615. optional: true
  616. }],
  617. ScalarTypeExtension: [{
  618. token: 'Name',
  619. ofValue: 'extend',
  620. tokenName: 'ExtendDefinitionKeyword'
  621. }, {
  622. token: 'Name',
  623. ofValue: 'scalar',
  624. tokenName: 'ScalarDefinitionKeyword'
  625. }, 'TypeName', 'Directives'],
  626. ObjectTypeDefinition: [{
  627. ofType: 'Description',
  628. optional: true
  629. }, {
  630. token: 'Name',
  631. ofValue: 'type',
  632. tokenName: 'TypeDefinitionKeyword'
  633. }, 'TypeName', {
  634. ofType: 'ImplementsInterfaces',
  635. optional: true
  636. }, {
  637. ofType: 'Directives',
  638. optional: true
  639. }, {
  640. ofType: 'FieldsDefinition',
  641. optional: true
  642. }],
  643. ImplementsInterfaces: [{
  644. token: 'Name',
  645. ofValue: 'implements',
  646. tokenName: 'ImplementsKeyword'
  647. }, {
  648. token: '&',
  649. optional: true
  650. }, 'TypeName', {
  651. listOfType: 'ImplementsAdditionalInterfaceName',
  652. optional: true
  653. }],
  654. ImplementsAdditionalInterfaceName: [{
  655. token: '&'
  656. }, 'TypeName'],
  657. FieldsDefinition: [{
  658. token: '{'
  659. }, {
  660. listOfType: 'FieldDefinition'
  661. }, {
  662. token: '}'
  663. }],
  664. FieldDefinition: [{
  665. ofType: 'Description',
  666. optional: true
  667. }, {
  668. token: 'Name',
  669. tokenName: 'AliasName',
  670. definitionName: true
  671. }, {
  672. ofType: 'ArgumentsDefinition',
  673. optional: true
  674. }, {
  675. token: ':'
  676. }, 'Type', {
  677. ofType: 'Directives',
  678. optional: true
  679. }],
  680. ArgumentsDefinition: [{
  681. token: '('
  682. }, {
  683. listOfType: 'InputValueDefinition'
  684. }, {
  685. token: ')'
  686. }],
  687. InputValueDefinition: [{
  688. ofType: 'Description',
  689. optional: true
  690. }, {
  691. token: 'Name',
  692. tokenName: 'ArgumentName'
  693. }, {
  694. token: ':'
  695. }, 'Type', {
  696. ofType: 'DefaultValue',
  697. optional: true
  698. }, {
  699. ofType: 'Directives',
  700. optional: true
  701. }],
  702. ObjectTypeExtension: [{
  703. token: 'Name',
  704. ofValue: 'extend',
  705. tokenName: 'ExtendDefinitionKeyword'
  706. }, {
  707. token: 'Name',
  708. ofValue: 'type',
  709. tokenName: 'TypeDefinitionKeyword'
  710. }, 'TypeName', {
  711. peek: [{
  712. ifCondition: {
  713. token: 'Name',
  714. ofValue: 'interface'
  715. },
  716. expect: ['ImplementsInterfaces', {
  717. peek: [{
  718. ifCondition: {
  719. token: '@'
  720. },
  721. expect: ['Directives', {
  722. ofType: 'FieldsDefinition',
  723. optional: true
  724. }]
  725. }, {
  726. ifCondition: {
  727. token: '{'
  728. },
  729. expect: 'FieldsDefinition'
  730. }],
  731. optional: true
  732. }]
  733. }, {
  734. ifCondition: {
  735. token: '@'
  736. },
  737. expect: ['Directives', {
  738. ofType: 'FieldsDefinition',
  739. optional: true
  740. }]
  741. }, {
  742. ifCondition: {
  743. token: '{'
  744. },
  745. expect: 'FieldsDefinition'
  746. }]
  747. }],
  748. InterfaceTypeDefinition: [{
  749. ofType: 'Description',
  750. optional: true
  751. }, {
  752. token: 'Name',
  753. ofValue: 'interface',
  754. tokenName: 'InterfaceDefinitionKeyword'
  755. }, 'TypeName', {
  756. ofType: 'Directives',
  757. optional: true
  758. }, {
  759. ofType: 'FieldsDefinition',
  760. optional: true
  761. }],
  762. InterfaceTypeExtension: [{
  763. token: 'Name',
  764. ofValue: 'extend',
  765. tokenName: 'ExtendDefinitionKeyword'
  766. }, {
  767. token: 'Name',
  768. ofValue: 'interface',
  769. tokenName: 'InterfaceDefinitionKeyword'
  770. }, 'TypeName', {
  771. peek: [{
  772. ifCondition: {
  773. token: '@'
  774. },
  775. expect: ['Directives', {
  776. ofType: 'FieldsDefinition',
  777. optional: true
  778. }]
  779. }, {
  780. ifCondition: {
  781. token: '{'
  782. },
  783. expect: 'FieldsDefinition'
  784. }]
  785. }],
  786. UnionTypeDefinition: [{
  787. ofType: 'Description',
  788. optional: true
  789. }, {
  790. token: 'Name',
  791. ofValue: 'union',
  792. tokenName: 'UnionDefinitionKeyword'
  793. }, 'TypeName', {
  794. ofType: 'Directives',
  795. optional: true
  796. }, {
  797. ofType: 'UnionMemberTypes',
  798. optional: true
  799. }],
  800. UnionMemberTypes: [{
  801. token: '='
  802. }, {
  803. token: '|',
  804. optional: true
  805. }, 'Name', {
  806. listOfType: 'UnionMemberAdditionalTypeName',
  807. optional: true
  808. }],
  809. UnionMemberAdditionalTypeName: [{
  810. token: '|'
  811. }, 'TypeName'],
  812. UnionTypeExtension: [{
  813. token: 'Name',
  814. ofValue: 'extend',
  815. tokenName: 'ExtendDefinitionKeyword'
  816. }, {
  817. token: 'Name',
  818. ofValue: 'union',
  819. tokenName: 'UnionDefinitionKeyword'
  820. }, 'TypeName', {
  821. peek: [{
  822. ifCondition: {
  823. token: '@'
  824. },
  825. expect: ['Directives', {
  826. ofType: 'UnionMemberTypes',
  827. optional: true
  828. }]
  829. }, {
  830. ifCondition: {
  831. token: '='
  832. },
  833. expect: 'UnionMemberTypes'
  834. }]
  835. }],
  836. EnumTypeDefinition: [{
  837. ofType: 'Description',
  838. optional: true
  839. }, {
  840. token: 'Name',
  841. ofValue: 'enum',
  842. tokenName: 'EnumDefinitionKeyword'
  843. }, 'TypeName', {
  844. ofType: 'Directives',
  845. optional: true
  846. }, {
  847. ofType: 'EnumValuesDefinition',
  848. optional: true
  849. }],
  850. EnumValuesDefinition: [{
  851. token: '{'
  852. }, {
  853. listOfType: 'EnumValueDefinition'
  854. }, {
  855. token: '}'
  856. }],
  857. EnumValueDefinition: [{
  858. ofType: 'Description',
  859. optional: true
  860. }, 'EnumValue', {
  861. ofType: 'Directives',
  862. optional: true
  863. }],
  864. EnumTypeExtension: [{
  865. token: 'Name',
  866. ofValue: 'extend',
  867. tokenName: 'ExtendDefinitionKeyword'
  868. }, {
  869. token: 'Name',
  870. ofValue: 'enum',
  871. tokenName: 'EnumDefinitionKeyword'
  872. }, 'TypeName', {
  873. peek: [{
  874. ifCondition: {
  875. token: '@'
  876. },
  877. expect: ['Directives', {
  878. ofType: 'EnumValuesDefinition',
  879. optional: true
  880. }]
  881. }, {
  882. ifCondition: {
  883. token: '{'
  884. },
  885. expect: 'EnumValuesDefinition'
  886. }]
  887. }],
  888. InputObjectTypeDefinition: [{
  889. ofType: 'Description',
  890. optional: true
  891. }, {
  892. token: 'Name',
  893. ofValue: 'input',
  894. tokenName: 'InputDefinitionKeyword'
  895. }, 'TypeName', {
  896. ofType: 'Directives',
  897. optional: true
  898. }, {
  899. ofType: 'InputFieldsDefinition',
  900. optional: true
  901. }],
  902. InputFieldsDefinition: [{
  903. token: '{'
  904. }, {
  905. listOfType: 'InputValueDefinition'
  906. }, {
  907. token: '}'
  908. }],
  909. InputObjectTypeExtension: [{
  910. token: 'Name',
  911. ofValue: 'extend',
  912. tokenName: 'ExtendDefinitionKeyword'
  913. }, {
  914. token: 'Name',
  915. ofValue: 'input',
  916. tokenName: 'InputDefinitionKeyword'
  917. }, 'TypeName', {
  918. peek: [{
  919. ifCondition: {
  920. token: '@'
  921. },
  922. expect: ['Directives', {
  923. ofType: 'InputFieldsDefinition',
  924. optional: true
  925. }]
  926. }, {
  927. ifCondition: {
  928. token: '{'
  929. },
  930. expect: 'InputFieldsDefinition'
  931. }]
  932. }],
  933. DirectiveDefinition: [{
  934. ofType: 'Description',
  935. optional: true
  936. }, {
  937. token: 'Name',
  938. ofValue: 'directive',
  939. tokenName: 'DirectiveDefinitionKeyword'
  940. }, {
  941. token: '@',
  942. tokenName: 'DirectiveName'
  943. }, {
  944. token: 'Name',
  945. tokenName: 'DirectiveName'
  946. }, {
  947. ofType: 'ArgumentsDefinition',
  948. optional: true
  949. }, {
  950. token: 'Name',
  951. ofValue: 'on',
  952. tokenName: 'OnKeyword'
  953. }, 'DirectiveLocations'],
  954. DirectiveLocations: [{
  955. token: '|',
  956. optional: true
  957. }, 'DirectiveLocation', {
  958. listOfType: 'DirectiveLocationAdditionalName',
  959. optional: true
  960. }],
  961. DirectiveLocationAdditionalName: [{
  962. token: '|'
  963. }, 'DirectiveLocation'],
  964. DirectiveLocation: {
  965. peek: [{
  966. ifCondition: 'ExecutableDirectiveLocation',
  967. expect: 'ExecutableDirectiveLocation'
  968. }, {
  969. ifCondition: 'TypeSystemDirectiveLocation',
  970. expect: 'TypeSystemDirectiveLocation'
  971. }]
  972. },
  973. ExecutableDirectiveLocation: {
  974. token: 'Name',
  975. oneOf: ['QUERY', 'MUTATION', 'SUBSCRIPTION', 'FIELD', 'FRAGMENT_DEFINITION', 'FRAGMENT_SPREAD', 'INLINE_FRAGMENT'],
  976. tokenName: 'EnumValue'
  977. },
  978. TypeSystemDirectiveLocation: {
  979. token: 'Name',
  980. oneOf: ['SCHEMA', 'SCALAR', 'OBJECT', 'FIELD_DEFINITION', 'ARGUMENT_DEFINITION', 'INTERFACE', 'UNION', 'ENUM', 'ENUM_VALUE', 'INPUT_OBJECT', 'INPUT_FIELD_DEFINITION'],
  981. tokenName: 'EnumValue'
  982. } // FIXME: enforce proper typing
  983. };
  984. var _default = grammar;
  985. exports.default = _default;