peg 1.0.18 peg: ^1.0.18 copied to clipboard
Command line tool for generating PEG parsers with support for event-based parsing.
import 'csv_parser.dart';
void main(List<String> args) {
const parser = CsvParser();
final rows = parseString(parser.parseStart, _source);
for (final row in rows) {
print(row);
}
}
const _source = '''
"Index", "Item", "Cost", "Tax", "Total"
1, "Fruit of the Loom Girl's Socks", 7.97, 0.60, 8.57
2, "Rawlings Little League Baseball", 2.97, 0.22, 3.19
3, "Secret Antiperspirant", 1.29, 0.10, 1.39
4, "Deadpool DVD", 14.96, 1.12, 16.08
5, "Maxwell House Coffee 28 oz", 7.28, 0.55, 7.83
6, "Banana Boat Sunscreen, 8 oz", 6.68, 0.50, 7.18
7, "Wrench Set, 18 pieces", 10.00, 0.75, 10.75
8, "M and M, 42 oz", 8.98, 0.67, 9.65
9, "Bertoli Alfredo Sauce", 2.12, 0.16, 2.28
10, "Large Paperclips, 10 boxes", 6.19, 0.46, 6.65''';