platform/example/basic.dart
2017-01-24 23:28:09 -05:00

21 lines
419 B
Dart

import 'dart:async';
import 'package:graphql_parser/src/language/language.dart';
Stream<String> input() async* {
yield '''
{
project(name: "GraphQL") {
tagline
}
}
'''
.trim();
}
main() async {
var lexer = new Lexer(), parser = new Parser();
var stream = input().transform(lexer).asBroadcastStream();
await stream.forEach(print);
stream.pipe(parser);
await parser.onNode.forEach(print);
}