2021-05-14 06:11:50 +00:00
|
|
|
import 'package:angel3_combinator/angel3_combinator.dart';
|
2021-03-17 23:04:36 +00:00
|
|
|
import 'package:string_scanner/string_scanner.dart';
|
|
|
|
|
|
|
|
void main() {
|
2021-03-18 00:00:56 +00:00
|
|
|
var pub = match('pub').map((r) => r.span!.text).space();
|
2021-03-17 23:04:36 +00:00
|
|
|
var dart = match('dart').map((r) => 24).space();
|
|
|
|
var lang = match('lang').map((r) => true).space();
|
|
|
|
|
|
|
|
// Parses a Tuple3<String, int, bool>
|
|
|
|
var grammar = tuple3(pub, dart, lang);
|
|
|
|
|
|
|
|
var scanner = SpanScanner('pub dart lang');
|
2021-05-02 04:12:43 +00:00
|
|
|
print(grammar.parse(scanner).value);
|
2021-03-17 23:04:36 +00:00
|
|
|
}
|