Commit Graph

28 Commits

Author SHA1 Message Date
Danny Navarro
8b09c8aa76
Make operation name optional 2017-02-03 12:57:21 -03:00
Danny Navarro
5390c4ca1e
Split AST in 2
One AST is meant to be a target parser and tries to adhere as much as possible
to the spec. The other is a simplified version of that AST meant for execution.

Also newtypes have been replaced by type synonyms and NonEmpty lists are being
used where it makes sense.
2017-01-28 14:15:14 -03:00
Danny Navarro
10fdf05aa7
Remove Type Definition support 2017-01-26 11:56:22 -03:00
Danny Navarro
933cfd2852
Tokenize number parser
The essential change hidden behind the code golfing is using the `tok`
combinator. This was making fail the Kitchen Sink test.
2016-12-18 12:19:59 -03:00
Tom Hunger
87c92e9d6e Parse number as scientific and interpret meaning separately.
The current parser will fail parsing floats because it parses an int,
and then stumbles on the dot.

To fix I interpret the value with the scientific library which already
is a dependency through attoparsec, so we're not introducing any extra
downloads or compiling.

I think this is still subtly wrong because "10.0" will be parsed as
ValueInt, but because input argument ints are allowed to be coerced
into doubles (according to the spec) this is probably acceptable.
2016-12-09 00:03:20 +00:00
Danny Navarro
61f0a06096
Drop support for GHC-7.8.4 2016-11-27 12:56:44 -03:00
Danny Navarro
77853b17ae Merge branch 'all-improvements'
This adds general API documentation, a tutorial and error handling.
2016-03-15 14:02:34 +01:00
solrun
61d6af7778 Added documentation of functions and modules and included tutorial.lhs. 2016-03-14 01:42:55 +01:00
Danny Navarro
d8a731fe30 Remove StringValue type 2016-02-22 13:59:38 +01:00
Danny Navarro
a4db99ea5d Fixes for ghc-7.8 2015-09-22 14:02:49 +02:00
Danny Navarro
06b3302862 Add kitchen sink parse/encode unit test
This also includes the fixes to make it work. Golden tests have been
removed.
2015-09-22 14:02:49 +02:00
Danny Navarro
da97387042 Parser fixes:
- Braces instead of parens for `inputValueDefinitions`.
- Rename `bool` -> `booleanValue`.
- Some code rearrangements.
2015-09-22 10:39:14 +02:00
Danny Navarro
3d97b3e2ff Introduce Node data type to simplify OperationDefinition
Thanks to @swolchok for the suggestion.
2015-09-21 10:05:09 +02:00
Danny Navarro
88ca3d1866 Add errors for all parser Alternatives 2015-09-21 09:28:51 +02:00
Danny Navarro
899fa1b531 Handle escaped quotes for GraphQL String Values
This also includes a new type for Value String.

The tests fail now, although it parses successfully. I'll use a pretty
printer in next commit so that it's easier to spot the differences.
Onces this is working I'll add the rest of the escaped characters.
2015-09-18 18:11:11 +02:00
Danny Navarro
cb9977141d Golf 2015-09-18 16:29:40 +02:00
Danny Navarro
4f4e31805a Parse secure names 2015-09-18 15:43:22 +02:00
Danny Navarro
d88acf3d0e Refine numeric types 2015-09-18 15:02:51 +02:00
Danny Navarro
c9c1137ceb Garden 2015-09-18 14:55:59 +02:00
Danny Navarro
f88948e801 Support ghc-7.8 2015-09-16 10:36:59 +02:00
Danny Navarro
b4b8388392 Enable warnings and take care of extra imports 2015-09-14 15:48:47 +02:00
Danny Navarro
ec018db73a Handle comments in whitespace 2015-09-14 15:43:09 +02:00
Danny Navarro
26e2372c5e Fix value parsing
- Add missing variable parsing.
- Reuse `name` in value string.

This parses successfully the `kitchen-sink.graphql` sample from
`graphql-js`.
2015-09-14 14:14:25 +02:00
Danny Navarro
c0b6fc8a05 Replace take... functions with many...
They are less efficient but they are giving me issues because they don't
fail. Once this is working I'll look into optimizing.

Also disable skipping comments until I figure out how to skip both
comments and space at the same time.
2015-09-14 13:16:58 +02:00
Danny Navarro
62adfd89cd Several improvements to the parser
- Add token combinator to simplify whitespace handling.
- Simplify whiteSpace parsers.
- Add `optempty` to handle pure mempty cases. `empty /= pure mempty`.
- Use `between` combinators for brackets, braces and parens.

This also includes small adjustments to the AST.
2015-09-14 12:15:04 +02:00
Danny Navarro
b206079047 Add missing = required default values and unions 2015-09-13 17:44:31 +02:00
Danny Navarro
048ee552d8 Take care of comments 2015-09-13 15:34:01 +02:00
Danny Navarro
0e67fdc21c Add GraphQL parser
WIP: This parser just type checks, it hasn't even been tested manually.
Check new tasks in the TODO file and the TODO comments in the code for
more gotchas.
2015-09-13 13:55:15 +02:00