graphql-idl-parser 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -1
  3. data/Rakefile +6 -4
  4. data/ext/graphql-idl-parser/graphql-idl-parser/Cargo.lock +295 -0
  5. data/ext/graphql-idl-parser/graphql-idl-parser/Cargo.toml +16 -0
  6. data/ext/graphql-idl-parser/graphql-idl-parser/LICENSE.txt +21 -0
  7. data/ext/graphql-idl-parser/graphql-idl-parser/README.md +53 -0
  8. data/ext/graphql-idl-parser/graphql-idl-parser/build.rs +5 -0
  9. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/Cargo.lock +305 -0
  10. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/Cargo.toml +18 -0
  11. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/README.md +48 -0
  12. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/example/example.c +33 -0
  13. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/includes/gql-idl-parser.h +138 -0
  14. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/src/lib.rs +128 -0
  15. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/src/types.rs +485 -0
  16. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/graphql-idl-parser-1d630313aa5d216c/build-script-build +0 -0
  17. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/graphql-idl-parser-1d630313aa5d216c/build_script_build-1d630313aa5d216c +0 -0
  18. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/graphql-idl-parser-3e27951e7158def5/build-script-build +0 -0
  19. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/graphql-idl-parser-3e27951e7158def5/build_script_build-3e27951e7158def5 +0 -0
  20. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/graphql-idl-parser-481c4176d6a6472d/output +0 -0
  21. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/graphql-idl-parser-481c4176d6a6472d/stderr +0 -0
  22. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/graphql-idl-parser-5e9a4656cd081ee1/output +0 -0
  23. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/graphql-idl-parser-5e9a4656cd081ee1/stderr +0 -0
  24. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/kernel32-sys-2b7eb293aa6c1ae8/output +0 -0
  25. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/kernel32-sys-2b7eb293aa6c1ae8/stderr +0 -0
  26. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/kernel32-sys-da175f6bc66f228c/build-script-build +0 -0
  27. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/kernel32-sys-da175f6bc66f228c/build_script_build-da175f6bc66f228c +0 -0
  28. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/lalrpop-d0f0dc8a044bb86f/build-script-build +0 -0
  29. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/lalrpop-d0f0dc8a044bb86f/build_script_build-d0f0dc8a044bb86f +0 -0
  30. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/lalrpop-db9b482018d6c515/output +0 -0
  31. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/lalrpop-db9b482018d6c515/stderr +0 -0
  32. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libaho_corasick-07ac37ff1c5ebb39.rlib +0 -0
  33. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libascii_canvas-37ba58d788f6e28b.rlib +0 -0
  34. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libatty-3d34ead0eff1f49c.rlib +0 -0
  35. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libbit_set-05034a00bed6372c.rlib +0 -0
  36. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libbit_vec-ba66b7b721a96204.rlib +0 -0
  37. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libbuild-d4f96a70b883038d.rlib +0 -0
  38. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libdiff-9cac472257fa481b.rlib +0 -0
  39. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libdocopt-5b3087b1b6e5d091.rlib +0 -0
  40. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libeither-8157fecd348c1485.rlib +0 -0
  41. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libena-b40ce2cd268672c3.rlib +0 -0
  42. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libfixedbitset-c7f65ed08cebcf3b.rlib +0 -0
  43. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libgraphql_idl_parser-38237266b2814db0.rlib +0 -0
  44. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libgraphql_idl_parser-85dc5bc4abe95968.rlib +0 -0
  45. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libgraphqlidlparser.dylib +0 -0
  46. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libitertools-8d570d6c59d3b2d0.rlib +0 -0
  47. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libkernel32-fa4855bd85e0519b.rlib +0 -0
  48. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/liblalrpop-8888f5942735b084.rlib +0 -0
  49. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/liblalrpop_intern-70b4cf4d149e3995.rlib +0 -0
  50. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/liblalrpop_snap-695e4827988eac78.rlib +0 -0
  51. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/liblalrpop_util-90bdd1a9fd691a70.rlib +0 -0
  52. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/liblazy_static-a6b1325db7ee41a1.rlib +0 -0
  53. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/liblibc-0d055c7503ac4180.rlib +0 -0
  54. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libmemchr-7e8d0bb06e3caae0.rlib +0 -0
  55. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libordermap-f92645c599568d9f.rlib +0 -0
  56. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libpetgraph-62c5b51f9db3f0c7.rlib +0 -0
  57. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libregex-5d259a9431f27ed9.rlib +0 -0
  58. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libregex_syntax-e6a16469e776d773.rlib +0 -0
  59. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/librustc_serialize-21d20a12dd90991b.rlib +0 -0
  60. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libstrsim-8e26967d29bdf2e6.rlib +0 -0
  61. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libterm-189de8985c74cf03.rlib +0 -0
  62. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libthread_local-036458f1fbee14fb.rlib +0 -0
  63. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libunicode_xid-8adffabb9e6dd184.rlib +0 -0
  64. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libunreachable-bd47b36c4e87f432.rlib +0 -0
  65. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libutf8_ranges-220e9d44a3644657.rlib +0 -0
  66. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libvoid-d761da60d30362e9.rlib +0 -0
  67. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libwinapi-753252e15931e6fc.rlib +0 -0
  68. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/libgraphqlidlparser.d +1 -0
  69. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/libgraphqlidlparser.dylib +0 -0
  70. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/clar.c +673 -0
  71. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/clar.h +161 -0
  72. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/clar/fixtures.h +54 -0
  73. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/clar/fs.h +341 -0
  74. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/clar/print.h +74 -0
  75. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/clar/sandbox.h +154 -0
  76. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/clar_test.h +19 -0
  77. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/enums.c +40 -0
  78. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/generate.py +243 -0
  79. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/helpers.c +60 -0
  80. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/helpers.h +6 -0
  81. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/input_objects.c +48 -0
  82. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/interfaces.c +41 -0
  83. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/main.c +35 -0
  84. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/objects.c +130 -0
  85. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/scalars.c +39 -0
  86. data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/unions.c +38 -0
  87. data/ext/graphql-idl-parser/graphql-idl-parser/script/compile +11 -0
  88. data/ext/graphql-idl-parser/graphql-idl-parser/script/fmt +23 -0
  89. data/ext/graphql-idl-parser/graphql-idl-parser/script/test +30 -0
  90. data/ext/graphql-idl-parser/graphql-idl-parser/src/gqlidl.lalrpop +199 -0
  91. data/ext/graphql-idl-parser/graphql-idl-parser/src/gqlidl.rs +29491 -0
  92. data/ext/graphql-idl-parser/graphql-idl-parser/src/lib.rs +9 -0
  93. data/ext/graphql-idl-parser/graphql-idl-parser/src/macros.rs +61 -0
  94. data/ext/graphql-idl-parser/graphql-idl-parser/src/tests.rs +561 -0
  95. data/ext/graphql-idl-parser/graphql-idl-parser/src/type_definition.rs +404 -0
  96. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-0ed64d9cad312f79/output +0 -0
  97. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-0ed64d9cad312f79/stderr +0 -0
  98. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-0fa24f7f5e35d20a/build-script-build +0 -0
  99. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-0fa24f7f5e35d20a/build_script_build-0fa24f7f5e35d20a +0 -0
  100. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-0fa24f7f5e35d20a/build_script_build-0fa24f7f5e35d20a.dSYM/Contents/Info.plist +20 -0
  101. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-0fa24f7f5e35d20a/build_script_build-0fa24f7f5e35d20a.dSYM/Contents/Resources/DWARF/build_script_build-0fa24f7f5e35d20a +0 -0
  102. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-57f7e3c3ef8471d2/build-script-build +0 -0
  103. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-57f7e3c3ef8471d2/build_script_build-57f7e3c3ef8471d2 +0 -0
  104. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-57f7e3c3ef8471d2/build_script_build-57f7e3c3ef8471d2.dSYM/Contents/Info.plist +20 -0
  105. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-57f7e3c3ef8471d2/build_script_build-57f7e3c3ef8471d2.dSYM/Contents/Resources/DWARF/build_script_build-57f7e3c3ef8471d2 +0 -0
  106. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-5e9a4656cd081ee1/output +0 -0
  107. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-5e9a4656cd081ee1/stderr +0 -0
  108. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/kernel32-sys-2b7eb293aa6c1ae8/output +0 -0
  109. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/kernel32-sys-2b7eb293aa6c1ae8/stderr +0 -0
  110. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/kernel32-sys-d2306aba19864163/build-script-build +0 -0
  111. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/kernel32-sys-d2306aba19864163/build_script_build-d2306aba19864163 +0 -0
  112. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/kernel32-sys-d2306aba19864163/build_script_build-d2306aba19864163.dSYM/Contents/Info.plist +20 -0
  113. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/kernel32-sys-d2306aba19864163/build_script_build-d2306aba19864163.dSYM/Contents/Resources/DWARF/build_script_build-d2306aba19864163 +0 -0
  114. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/lalrpop-4a05302baa5fb2a2/build-script-build +0 -0
  115. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/lalrpop-4a05302baa5fb2a2/build_script_build-4a05302baa5fb2a2 +0 -0
  116. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/lalrpop-4a05302baa5fb2a2/build_script_build-4a05302baa5fb2a2.dSYM/Contents/Info.plist +20 -0
  117. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/lalrpop-4a05302baa5fb2a2/build_script_build-4a05302baa5fb2a2.dSYM/Contents/Resources/DWARF/build_script_build-4a05302baa5fb2a2 +0 -0
  118. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/lalrpop-db9b482018d6c515/output +0 -0
  119. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/lalrpop-db9b482018d6c515/stderr +0 -0
  120. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libaho_corasick-a9ec1f95080d1f6a.rlib +0 -0
  121. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libascii_canvas-92c3bf0cf98f6d67.rlib +0 -0
  122. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libatty-35b65e46cfc403bc.rlib +0 -0
  123. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libbit_set-d9484919f1726cf1.rlib +0 -0
  124. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libbit_vec-8716b059e7c4619b.rlib +0 -0
  125. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libbuild-0b12b372edd4cd19.rlib +0 -0
  126. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libdiff-c81afd03f1d10610.rlib +0 -0
  127. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libdocopt-f02dfd6fea4878cc.rlib +0 -0
  128. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libeither-20b79fd67623dec7.rlib +0 -0
  129. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libena-e8706d9d37da725b.rlib +0 -0
  130. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libfixedbitset-da616d0027237c90.rlib +0 -0
  131. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libgraphql_idl_parser-33a4c3bdcdc654b7.rlib +0 -0
  132. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libgraphql_idl_parser-d6636cf90a34aa47.rlib +0 -0
  133. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libitertools-34d50068529acf4d.rlib +0 -0
  134. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libkernel32-56b5a11a7716f7c7.rlib +0 -0
  135. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/liblalrpop-65f3c84608c05ce1.rlib +0 -0
  136. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/liblalrpop_intern-a3c97188386c0872.rlib +0 -0
  137. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/liblalrpop_snap-d6e467def27f0a55.rlib +0 -0
  138. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/liblalrpop_util-e59e6b2e2aec1b3e.rlib +0 -0
  139. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/liblazy_static-4518bdaa60b81936.rlib +0 -0
  140. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/liblibc-ab7be4fcfaa3a31b.rlib +0 -0
  141. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libmemchr-85dd561868acc188.rlib +0 -0
  142. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libordermap-4691b832eea88398.rlib +0 -0
  143. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libpetgraph-0220c5a13678d70e.rlib +0 -0
  144. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libregex-44e22d9874a5fb64.rlib +0 -0
  145. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libregex_syntax-490c2654111b5bf0.rlib +0 -0
  146. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/librustc_serialize-a7771718d4ee73a5.rlib +0 -0
  147. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libstrsim-038156debd12bd7a.rlib +0 -0
  148. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libterm-d12b955648e4f4b4.rlib +0 -0
  149. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libthread_local-84091b6b04cf1914.rlib +0 -0
  150. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libunicode_xid-89ce822c6e6dbe69.rlib +0 -0
  151. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libunreachable-654322b1fcb434b1.rlib +0 -0
  152. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libutf8_ranges-53f91d3b6e8885c9.rlib +0 -0
  153. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libvoid-181e881e54467554.rlib +0 -0
  154. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libwinapi-9c9d2aba65add76c.rlib +0 -0
  155. data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/libgraphql_idl_parser.rlib +0 -0
  156. data/ext/graphql-idl-parser/graphql-idl-parser/test/enums.graphql +8 -0
  157. data/ext/graphql-idl-parser/graphql-idl-parser/test/github.graphql +5115 -0
  158. data/ext/graphql-idl-parser/graphql-idl-parser/test/input_objects.graphql +11 -0
  159. data/ext/graphql-idl-parser/graphql-idl-parser/test/interfaces.graphql +5 -0
  160. data/ext/graphql-idl-parser/graphql-idl-parser/test/objects.graphql +54 -0
  161. data/ext/graphql-idl-parser/graphql-idl-parser/test/scalars.graphql +4 -0
  162. data/ext/graphql-idl-parser/graphql-idl-parser/test/unions.graphql +2 -0
  163. data/graphql-idl-parser.gemspec +8 -6
  164. data/lib/graphql-idl-parser/version.rb +1 -1
  165. data/test/graphql-idl-parser/enums_test.rb +20 -0
  166. data/test/graphql-idl-parser/graphql-idl-parser_test.rb +48 -0
  167. data/test/graphql-idl-parser/input_objects_test.rb +28 -0
  168. data/test/graphql-idl-parser/interfaces_test.rb +20 -0
  169. data/test/graphql-idl-parser/objects_test.rb +104 -0
  170. data/test/graphql-idl-parser/scalars_test.rb +19 -0
  171. data/test/graphql-idl-parser/unions_test.rb +18 -0
  172. data/test/test_helper.rb +12 -0
  173. metadata +194 -12
  174. data/.gitignore +0 -18
  175. data/.gitmodules +0 -4
  176. data/.rubocop.yml +0 -10
  177. data/.travis.yml +0 -28
  178. data/Gemfile +0 -4
  179. data/script/bootstrap +0 -11
  180. data/script/cibuild +0 -5
  181. data/script/update_submodules +0 -21
@@ -0,0 +1,128 @@
1
+ extern crate libc;
2
+ extern crate graphql_idl_parser;
3
+
4
+ mod types;
5
+
6
+ use types::*;
7
+
8
+ use libc::{c_char, size_t};
9
+ use std::ffi::CStr;
10
+ use std::mem;
11
+ use std::io::{self, Write};
12
+
13
+ #[repr(C)]
14
+ pub union GraphQLType {
15
+ scalar: Scalar,
16
+ object: Object,
17
+ enum_type: Enum,
18
+ interface: Interface,
19
+ union: Union,
20
+ input_object: InputObject,
21
+ }
22
+
23
+ #[no_mangle]
24
+ #[allow(unused)]
25
+ pub extern "C" fn gqlidl_parse_schema(
26
+ schema: *const c_char,
27
+ types: *mut *mut GraphQLType,
28
+ types_len: *mut size_t,
29
+ ) -> u8 {
30
+ // Convert C string to Rust string
31
+ let c_schema = unsafe {
32
+ assert!(!schema.is_null());
33
+ CStr::from_ptr(schema)
34
+ };
35
+ let r_schema = c_schema.to_str().unwrap();
36
+
37
+ match graphql_idl_parser::gqlidl::parse_schema(r_schema) {
38
+ Ok(vec) => {
39
+ let mut tmp_vec: Vec<GraphQLType> = vec.into_iter()
40
+ .map(|mut v| {
41
+ let s = match v.typename() {
42
+ "scalar" => {
43
+ let d = Scalar::new(v.typename(), v.description(), v.name());
44
+ return GraphQLType { scalar: d };
45
+ }
46
+ "object" => {
47
+ let d = Object::new(
48
+ v.typename(),
49
+ v.description(),
50
+ v.name(),
51
+ v.implements(),
52
+ v.directives(),
53
+ v.fields(),
54
+ );
55
+ return GraphQLType { object: d };
56
+ }
57
+ "enum" => {
58
+ let d = Enum::new(
59
+ v.typename(),
60
+ v.description(),
61
+ v.name(),
62
+ v.directives(),
63
+ v.values(),
64
+ );
65
+ return GraphQLType { enum_type: d };
66
+ }
67
+ "interface" => {
68
+ let d = Interface::new(
69
+ v.typename(),
70
+ v.description(),
71
+ v.name(),
72
+ v.directives(),
73
+ v.fields(),
74
+ );
75
+ return GraphQLType { interface: d };
76
+ }
77
+ "union" => {
78
+ let d = Union::new(
79
+ v.typename(),
80
+ v.description(),
81
+ v.name(),
82
+ v.directives(),
83
+ v.types(),
84
+ );
85
+ return GraphQLType { union: d };
86
+ }
87
+ "input_object" => {
88
+ let d = InputObject::new(
89
+ v.typename(),
90
+ v.description(),
91
+ v.name(),
92
+ v.directives(),
93
+ v.fields(),
94
+ );
95
+ return GraphQLType { input_object: d };
96
+ }
97
+ _ => panic!("Unknown typename: {}", v.typename()),
98
+ };
99
+
100
+ mem::forget(v);
101
+ s
102
+ })
103
+ .collect();
104
+
105
+ tmp_vec.shrink_to_fit();
106
+ assert!(tmp_vec.len() == tmp_vec.capacity());
107
+
108
+ // Return number of types
109
+ unsafe {
110
+ *types_len = tmp_vec.len() as size_t;
111
+ }
112
+
113
+ // Return pointer to data
114
+ unsafe {
115
+ *types = tmp_vec.as_mut_ptr();
116
+ }
117
+
118
+ // Prevent memory from being deallocated
119
+ mem::forget(tmp_vec);
120
+
121
+ 0
122
+ }
123
+ Err(err) => {
124
+ writeln!(io::stderr(), "Catastrophic error: {:?}", err).unwrap();
125
+ 1
126
+ }
127
+ }
128
+ }
@@ -0,0 +1,485 @@
1
+ extern crate graphql_idl_parser;
2
+
3
+ use graphql_idl_parser::type_definition::{GraphQLDirective, GraphQLField, GraphQLValue};
4
+
5
+ use libc::{c_char, c_void, size_t};
6
+ use std::ffi::CString;
7
+ use std::{mem, ptr};
8
+
9
+ fn convert_optional_string_to_cstr(string: Option<&str>) -> *const c_char {
10
+ match string {
11
+ Some(string) => CString::new(string).unwrap().into_raw(),
12
+ None => ptr::null(),
13
+ }
14
+ }
15
+
16
+ #[derive(Copy)]
17
+ #[repr(C)]
18
+ pub struct Scalar {
19
+ pub typename: *const c_char,
20
+ pub description: *const c_char,
21
+ pub name: *const c_char,
22
+ }
23
+
24
+ impl Clone for Scalar {
25
+ fn clone(&self) -> Scalar {
26
+ *self
27
+ }
28
+ }
29
+
30
+ impl Scalar {
31
+ pub fn new(typename: &str, description: Option<&str>, name: &str) -> Scalar {
32
+ Scalar {
33
+ typename: CString::new(typename).unwrap().into_raw(),
34
+ description: convert_optional_string_to_cstr(description),
35
+ name: CString::new(name).unwrap().into_raw(),
36
+ }
37
+ }
38
+ }
39
+
40
+ #[derive(Copy)]
41
+ #[repr(C)]
42
+ pub struct Object {
43
+ typename: *const c_char,
44
+ description: *const c_char,
45
+ name: *const c_char,
46
+ implements: ArrayOfCStrings,
47
+ directives: ArrayOfDirectives,
48
+ fields: ArrayOfFields,
49
+ }
50
+
51
+ impl Clone for Object {
52
+ fn clone(&self) -> Object {
53
+ *self
54
+ }
55
+ }
56
+
57
+ impl Object {
58
+ pub fn new(
59
+ typename: &str,
60
+ description: Option<&str>,
61
+ name: &str,
62
+ implements: Option<Vec<String>>,
63
+ directives: Option<Vec<GraphQLDirective>>,
64
+ fields: Option<Vec<GraphQLField>>,
65
+ ) -> Object {
66
+ Object {
67
+ typename: CString::new(typename).unwrap().into_raw(),
68
+ description: convert_optional_string_to_cstr(description),
69
+ name: CString::new(name).unwrap().into_raw(),
70
+ implements: match implements {
71
+ None => ArrayOfCStrings::from_vec(vec![]),
72
+ Some(implements) => ArrayOfCStrings::from_vec(implements),
73
+ },
74
+ directives: match directives {
75
+ None => ArrayOfDirectives::from_vec(vec![]),
76
+ Some(directives) => ArrayOfDirectives::from_vec(directives),
77
+ },
78
+ fields: match fields {
79
+ None => ArrayOfFields::from_vec(vec![]),
80
+ Some(fields) => ArrayOfFields::from_vec(fields),
81
+ },
82
+ }
83
+ }
84
+ }
85
+
86
+
87
+ #[derive(Copy)]
88
+ #[repr(C)]
89
+ pub struct Enum {
90
+ typename: *const c_char,
91
+ description: *const c_char,
92
+ name: *const c_char,
93
+ directives: ArrayOfDirectives,
94
+ values: ArrayOfValues,
95
+ }
96
+
97
+ impl Clone for Enum {
98
+ fn clone(&self) -> Enum {
99
+ *self
100
+ }
101
+ }
102
+
103
+ impl Enum {
104
+ pub fn new(
105
+ typename: &str,
106
+ description: Option<&str>,
107
+ name: &str,
108
+ directives: Option<Vec<GraphQLDirective>>,
109
+ values: Option<Vec<GraphQLValue>>,
110
+ ) -> Enum {
111
+ Enum {
112
+ typename: CString::new(typename).unwrap().into_raw(),
113
+ description: convert_optional_string_to_cstr(description),
114
+ name: CString::new(name).unwrap().into_raw(),
115
+ directives: match directives {
116
+ None => ArrayOfDirectives::from_vec(vec![]),
117
+ Some(directives) => ArrayOfDirectives::from_vec(directives),
118
+ },
119
+ values: match values {
120
+ None => ArrayOfValues::from_vec(vec![]),
121
+ Some(values) => ArrayOfValues::from_vec(values),
122
+ },
123
+ }
124
+ }
125
+ }
126
+
127
+ #[derive(Copy)]
128
+ #[repr(C)]
129
+ pub struct Interface {
130
+ typename: *const c_char,
131
+ description: *const c_char,
132
+ name: *const c_char,
133
+ directives: ArrayOfDirectives,
134
+ fields: ArrayOfFields,
135
+ }
136
+
137
+ impl Clone for Interface {
138
+ fn clone(&self) -> Interface {
139
+ *self
140
+ }
141
+ }
142
+
143
+ impl Interface {
144
+ pub fn new(
145
+ typename: &str,
146
+ description: Option<&str>,
147
+ name: &str,
148
+ directives: Option<Vec<GraphQLDirective>>,
149
+ fields: Option<Vec<GraphQLField>>,
150
+ ) -> Interface {
151
+ Interface {
152
+ typename: CString::new(typename).unwrap().into_raw(),
153
+ description: convert_optional_string_to_cstr(description),
154
+ name: CString::new(name).unwrap().into_raw(),
155
+ directives: match directives {
156
+ None => ArrayOfDirectives::from_vec(vec![]),
157
+ Some(directives) => ArrayOfDirectives::from_vec(directives),
158
+ },
159
+ fields: match fields {
160
+ None => ArrayOfFields::from_vec(vec![]),
161
+ Some(fields) => ArrayOfFields::from_vec(fields),
162
+ },
163
+ }
164
+ }
165
+ }
166
+
167
+ #[derive(Copy)]
168
+ #[repr(C)]
169
+ pub struct Union {
170
+ typename: *const c_char,
171
+ description: *const c_char,
172
+ name: *const c_char,
173
+ directives: ArrayOfDirectives,
174
+ types: ArrayOfCStrings,
175
+ }
176
+
177
+ impl Clone for Union {
178
+ fn clone(&self) -> Union {
179
+ *self
180
+ }
181
+ }
182
+
183
+ impl Union {
184
+ pub fn new(
185
+ typename: &str,
186
+ description: Option<&str>,
187
+ name: &str,
188
+ directives: Option<Vec<GraphQLDirective>>,
189
+ types: Option<Vec<String>>,
190
+ ) -> Union {
191
+ Union {
192
+ typename: CString::new(typename).unwrap().into_raw(),
193
+ description: convert_optional_string_to_cstr(description),
194
+ name: CString::new(name).unwrap().into_raw(),
195
+ directives: match directives {
196
+ None => ArrayOfDirectives::from_vec(vec![]),
197
+ Some(directives) => ArrayOfDirectives::from_vec(directives),
198
+ },
199
+ types: match types {
200
+ None => ArrayOfCStrings::from_vec(vec![]),
201
+ Some(types) => ArrayOfCStrings::from_vec(types),
202
+ },
203
+ }
204
+ }
205
+ }
206
+
207
+ #[derive(Copy)]
208
+ #[repr(C)]
209
+ pub struct InputObject {
210
+ typename: *const c_char,
211
+ description: *const c_char,
212
+ name: *const c_char,
213
+ directives: ArrayOfDirectives,
214
+ fields: ArrayOfFields,
215
+ }
216
+
217
+ impl Clone for InputObject {
218
+ fn clone(&self) -> InputObject {
219
+ *self
220
+ }
221
+ }
222
+
223
+ impl InputObject {
224
+ pub fn new(
225
+ typename: &str,
226
+ description: Option<&str>,
227
+ name: &str,
228
+ directives: Option<Vec<GraphQLDirective>>,
229
+ fields: Option<Vec<GraphQLField>>,
230
+ ) -> InputObject {
231
+ InputObject {
232
+ typename: CString::new(typename).unwrap().into_raw(),
233
+ description: convert_optional_string_to_cstr(description),
234
+ name: CString::new(name).unwrap().into_raw(),
235
+ directives: match directives {
236
+ None => ArrayOfDirectives::from_vec(vec![]),
237
+ Some(directives) => ArrayOfDirectives::from_vec(directives),
238
+ },
239
+ fields: match fields {
240
+ None => ArrayOfFields::from_vec(vec![]),
241
+ Some(fields) => ArrayOfFields::from_vec(fields),
242
+ },
243
+ }
244
+ }
245
+ }
246
+
247
+ #[repr(C)]
248
+ #[derive(Copy, Clone)]
249
+ struct FieldType {
250
+ name: *const c_char,
251
+ type_info: *const c_char,
252
+ }
253
+
254
+ #[repr(C)]
255
+ #[derive(Copy, Clone)]
256
+ struct Argument {
257
+ description: *const c_char,
258
+ name: *const c_char,
259
+ type_info: FieldType,
260
+ default_value: *const c_char,
261
+ directives: ArrayOfDirectives,
262
+ }
263
+
264
+ #[repr(C)]
265
+ #[derive(Copy, Clone)]
266
+ struct ArrayOfArguments {
267
+ length: size_t,
268
+ values: *const *const c_void,
269
+ }
270
+
271
+ #[repr(C)]
272
+ #[derive(Copy, Clone)]
273
+ struct Field {
274
+ description: *const c_char,
275
+ name: *const c_char,
276
+ type_info: FieldType,
277
+ arguments: ArrayOfArguments,
278
+ directives: ArrayOfDirectives,
279
+ }
280
+
281
+ #[repr(C)]
282
+ #[derive(Copy, Clone)]
283
+ struct ArrayOfFields {
284
+ length: size_t,
285
+ values: *const *const c_void,
286
+ }
287
+
288
+ impl ArrayOfFields {
289
+ fn from_vec(vec: Vec<GraphQLField>) -> ArrayOfFields {
290
+ let mut field_vec: Vec<Field> = vec![];
291
+
292
+ for v in vec {
293
+ let mut argument_vec: Vec<Argument> = vec![];
294
+ match v.arguments() {
295
+ None => {}
296
+ Some(arguments) => for arg in arguments {
297
+ argument_vec.push(Argument {
298
+ name: CString::new(arg.name()).unwrap().into_raw(),
299
+ description: convert_optional_string_to_cstr(arg.description()),
300
+ type_info: FieldType {
301
+ name: CString::new(arg.typeinfo().name()).unwrap().into_raw(),
302
+ type_info: CString::new(arg.typeinfo().info()).unwrap().into_raw(),
303
+ },
304
+ default_value: convert_optional_string_to_cstr(arg.default()),
305
+ directives: match v.directives() {
306
+ None => ArrayOfDirectives::from_vec(vec![]),
307
+ Some(directives) => ArrayOfDirectives::from_vec(directives),
308
+ },
309
+ });
310
+ },
311
+ }
312
+
313
+ argument_vec.shrink_to_fit();
314
+
315
+ let arguments = ArrayOfArguments {
316
+ length: argument_vec.len() as size_t,
317
+ values: argument_vec.as_ptr() as *const *const c_void,
318
+ };
319
+
320
+ field_vec.push(Field {
321
+ description: convert_optional_string_to_cstr(v.description()),
322
+ name: CString::new(v.name()).unwrap().into_raw(),
323
+ type_info: FieldType {
324
+ name: CString::new(v.typeinfo().name()).unwrap().into_raw(),
325
+ type_info: CString::new(v.typeinfo().info()).unwrap().into_raw(),
326
+ },
327
+ arguments: arguments,
328
+ directives: match v.directives() {
329
+ None => ArrayOfDirectives::from_vec(vec![]),
330
+ Some(directives) => ArrayOfDirectives::from_vec(directives),
331
+ },
332
+ });
333
+
334
+ mem::forget(argument_vec);
335
+ }
336
+ field_vec.shrink_to_fit();
337
+
338
+ let array = ArrayOfFields {
339
+ length: field_vec.len() as size_t,
340
+ values: field_vec.as_ptr() as *const *const c_void,
341
+ };
342
+
343
+ mem::forget(field_vec);
344
+ array
345
+ }
346
+ }
347
+
348
+ #[repr(C)]
349
+ #[derive(Copy, Clone)]
350
+ struct ArrayOfCStrings {
351
+ length: size_t,
352
+ values: *const *const c_char,
353
+ }
354
+
355
+ impl ArrayOfCStrings {
356
+ fn from_vec(vec: Vec<String>) -> ArrayOfCStrings {
357
+ let mut cstr_vec: Vec<*const c_char> = vec![];
358
+ for s in vec {
359
+ let cstr = CString::new(s).unwrap();
360
+ cstr_vec.push(cstr.into_raw() as *const c_char);
361
+ }
362
+ cstr_vec.shrink_to_fit();
363
+
364
+ let array = ArrayOfCStrings {
365
+ length: cstr_vec.len() as size_t,
366
+ values: cstr_vec.as_ptr() as *const *const c_char,
367
+ };
368
+
369
+ mem::forget(cstr_vec);
370
+ array
371
+ }
372
+ }
373
+
374
+ #[repr(C)]
375
+ #[derive(Copy, Clone)]
376
+ struct Value {
377
+ description: *const c_char,
378
+ name: *const c_char,
379
+ directives: ArrayOfDirectives,
380
+ }
381
+
382
+ #[repr(C)]
383
+ #[derive(Copy, Clone)]
384
+ struct ArrayOfValues {
385
+ length: size_t,
386
+ values: *const *const c_void,
387
+ }
388
+
389
+ impl ArrayOfValues {
390
+ fn from_vec(vec: Vec<GraphQLValue>) -> ArrayOfValues {
391
+ let mut value_vec: Vec<Value> = vec![];
392
+
393
+ for v in vec {
394
+ value_vec.push(Value {
395
+ name: CString::new(v.name()).unwrap().into_raw(),
396
+ description: convert_optional_string_to_cstr(v.description()),
397
+ directives: match v.directives() {
398
+ None => ArrayOfDirectives::from_vec(vec![]),
399
+ Some(directives) => ArrayOfDirectives::from_vec(directives),
400
+ },
401
+ });
402
+ }
403
+ value_vec.shrink_to_fit();
404
+
405
+ let array = ArrayOfValues {
406
+ length: value_vec.len() as size_t,
407
+ values: value_vec.as_ptr() as *const *const c_void,
408
+ };
409
+
410
+ mem::forget(value_vec);
411
+
412
+ array
413
+ }
414
+ }
415
+
416
+ #[repr(C)]
417
+ #[derive(Copy, Clone)]
418
+ struct Directive {
419
+ name: *const c_char,
420
+ arguments: ArrayOfDirectiveArguments,
421
+ }
422
+
423
+ #[repr(C)]
424
+ #[derive(Copy, Clone)]
425
+ struct ArrayOfDirectives {
426
+ length: size_t,
427
+ values: *const *const c_void,
428
+ }
429
+
430
+ #[repr(C)]
431
+ #[derive(Copy, Clone)]
432
+ struct DirectiveArgument {
433
+ name: *const c_char,
434
+ value: *const c_char,
435
+ }
436
+
437
+ #[repr(C)]
438
+ #[derive(Copy, Clone)]
439
+ struct ArrayOfDirectiveArguments {
440
+ length: size_t,
441
+ values: *const *const c_void,
442
+ }
443
+
444
+ impl ArrayOfDirectives {
445
+ fn from_vec(vec: Vec<GraphQLDirective>) -> ArrayOfDirectives {
446
+ let mut value_vec: Vec<Directive> = vec![];
447
+
448
+ for v in vec {
449
+ let mut argument_vec: Vec<DirectiveArgument> = vec![];
450
+ match v.arguments() {
451
+ None => {}
452
+ Some(arguments) => for arg in arguments {
453
+ argument_vec.push(DirectiveArgument {
454
+ name: CString::new(arg.name()).unwrap().into_raw(),
455
+ value: convert_optional_string_to_cstr(arg.value()),
456
+ });
457
+ },
458
+ }
459
+
460
+ argument_vec.shrink_to_fit();
461
+
462
+ let arguments = ArrayOfDirectiveArguments {
463
+ length: argument_vec.len() as size_t,
464
+ values: argument_vec.as_ptr() as *const *const c_void,
465
+ };
466
+
467
+ value_vec.push(Directive {
468
+ name: CString::new(v.name()).unwrap().into_raw(),
469
+ arguments: arguments,
470
+ });
471
+
472
+ mem::forget(argument_vec);
473
+ }
474
+ value_vec.shrink_to_fit();
475
+
476
+ let array = ArrayOfDirectives {
477
+ length: value_vec.len() as size_t,
478
+ values: value_vec.as_ptr() as *const *const c_void,
479
+ };
480
+
481
+ mem::forget(value_vec);
482
+
483
+ array
484
+ }
485
+ }