GraphQL v0.2.0 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

Functions

Parse the input string into a Document AST

Functions

parse(input_string)

Specs

parse(char_list) ::
  {:ok, GraphQL.Document.t} |
  {:error, GraphQL.Errors.t}
parse(String.t) ::
  {:ok, GraphQL.Document.t} |
  {:error, GraphQL.Errors.t}

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}
  }
}