platform/example/basic.dart

23 lines
403 B
Dart
Raw Normal View History

2017-01-22 23:15:53 +00:00
import 'dart:async';
import 'package:graphql_parser/src/language/language.dart';
Stream<String> input() async* {
yield '''
{
project(name: "GraphQL") {
tagline
}
}
2017-01-25 04:28:09 +00:00
'''
.trim();
2017-01-22 23:15:53 +00:00
}
2017-02-05 23:08:03 +00:00
main() {
2017-01-22 23:15:53 +00:00
var lexer = new Lexer(), parser = new Parser();
2017-01-25 04:28:09 +00:00
var stream = input().transform(lexer).asBroadcastStream();
2017-02-05 23:08:03 +00:00
stream
..forEach(print)
..pipe(parser);
parser.onNode.forEach(print);
2017-01-22 23:15:53 +00:00
}