-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathparser.dart
More file actions
65 lines (53 loc) · 1.86 KB
/
parser.dart
File metadata and controls
65 lines (53 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import 'package:org_parser/src/query/query.dart';
import 'package:petitparser/petitparser.dart';
final orgQuery = OrgQueryParserDefinition().build();
class OrgQueryParserDefinition extends OrgQueryGrammarDefinition {
@override
Parser alternate() => super.alternate().map((value) => OrgQueryOrMatcher([
value[0] as OrgQueryMatcher,
value[2] as OrgQueryMatcher,
]));
@override
Parser explicitAnd() =>
super.explicitAnd().map((value) => OrgQueryAndMatcher([
value[0] as OrgQueryMatcher,
value[2] as OrgQueryMatcher,
]));
@override
Parser implicitAnd() => super
.implicitAnd()
.castList<OrgQueryMatcher>()
.map((value) => OrgQueryAndMatcher(value));
@override
Parser continuingExplicitAnd() =>
super.continuingExplicitAnd().map((value) => OrgQueryAndMatcher([
value[0] as OrgQueryMatcher,
value[2] as OrgQueryMatcher,
]));
@override
Parser continuingImplicitAnd() => super
.continuingImplicitAnd()
.castList<OrgQueryMatcher>()
.map((value) => OrgQueryAndMatcher(value));
@override
Parser explicitInclude() => super.explicitInclude().map((value) => value[1]);
@override
Parser exclude() => super
.exclude()
.map((value) => OrgQueryNotMatcher(value[1] as OrgQueryMatcher));
@override
Parser tag() =>
super.tag().cast<String>().map((value) => OrgQueryTagMatcher(value));
@override
Parser propertyExpression() =>
super.propertyExpression().map((value) => OrgQueryPropertyMatcher(
property: value[0] as String,
operator: value[1] as String,
value: value[2],
));
@override
Parser numberValue() =>
super.numberValue().cast<String>().map((value) => num.parse(value));
@override
Parser stringValue() => super.stringValue().map((value) => value[1]);
}