-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathaux_parser.R
60 lines (52 loc) · 1.29 KB
/
aux_parser.R
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
#' Parse parts
#' @param parser A parser returned by [make_parser()]
#' @export
parse_parts <- function(parser) {
UseMethod("parse_parts", parser)
}
#' Parse data
#' @param parser A parser returned by [make_parser()]
#' @export
parse_data <- function(parser) {
UseMethod("parse_data", parser)
}
#' Parse decisions
#' @param parser A parser returned by [make_parser()]
#' @export
parse_decisions <- function(parser) {
UseMethod("parse_decisions", parser)
}
#' Parse movements
#' @param parser A parser returned by [make_parser()]
#' @export
parse_movs <- function(parser) {
UseMethod("parse_movs", parser)
}
#' Parse history
#' @param parser A parser returned by [make_parser()]
#' @export
parse_hist <- function(parser) {
UseMethod("parse_hist", parser)
}
#' Parse hearings
#' @param parser A parser returned by [make_parser()]
#' @export
parse_hearings <- function(parser) {
UseMethod("parse_hearings", parser)
}
#' Parse police department
#' @param parser A parser returned by [make_parser()]
#' @export
parse_pd <- function(parser) {
UseMethod("parse_pd", parser)
}
# Print parser
print.parser <- function(x, ...) {
if (length(x$name) == 0) {
cat("An empty parser\n")
}
else {
cat("A parser for the following objects:\n")
purrr::walk(x$name, ~cat("- ", .x, "\n", sep = ""))
}
}