git.iko.soy/rowtype-yoga/purescript-graphql
on master help sign in
Add trailing whitespace to definition parser

Previously parsing queries with trailing whitespace failed. This will make sure that queries can end with newlines or spaces.

commit5fd7c0f2b88c66106f9e24d13969cde645bfd5b2 authorhendrikniemann <h.neverman@web.de> dateSat 22 Feb 2020, 19:22 (7 years ago) parente99da9c
1 file changed+2−2
src/GraphQL/Language/Parser.purs+2−2
src/GraphQL/Language/Parser.purs+2−2
@@ -58,7 +58,7 @@ definition :: Parser AST.DefinitionNode
5858definition = do
5959 header <- optionMaybe operationHeader
6060 v <- variableDefinitionList <* whiteSpace <|> pure Nil
61− s <- selectionSet
61+ s <- selectionSet <* whiteSpace
6262 let { op, n } = fromMaybe { op: AST.Query, n: Nothing } header
6363 pure $ AST.OperationDefinitionNode {name: n, operation: op, selectionSet: s, variableDefinitions: v }
6464 where
@@ -138,7 +138,7 @@ value =
138138 <|> AST.ObjectValueNode <<< {fields: _} <$> objectParser
139139 where
140140 variableParser = string "$" *> name
141−
141+
142142 stringParser = charListToStringParser $ quotes $ many $ noneOf ['"']
143143 where
144144 charListToStringParser = map (fromCharArray <<< toUnfoldable)