GraphQL.Lang.Parser

GraphQL parser implemented with yecc.

Parse a GraphQL query

iex> GraphQL.parse "{ hello }"
{:ok, %{definitions: [
  %{kind: :OperationDefinition, loc: %{start: 0},
    operation: :query,
    selectionSet: %{kind: :SelectionSet, loc: %{start: 0},
      selections: [
        %{kind: :Field, loc: %{start: 0}, name: "hello"}
      ]
    }}
  ],
  kind: :Document, loc: %{start: 0}
}}

Summary

Parse the input string into a Document AST

Functions

parse(input_string)

Parse the input string into a Document AST.

iex> GraphQL.parse("{ hello }")
{:ok,
  %{definitions: [
    %{kind: :OperationDefinition, loc: %{start: 0},
      operation: :query,
      selectionSet: %{kind: :SelectionSet, loc: %{start: 0},
        selections: [
          %{kind: :Field, loc: %{start: 0}, name: "hello"}
        ]
      }}
    ],
    kind: :Document, loc: %{start: 0}
  }
}