aboutsummaryrefslogtreecommitdiff
path: root/places.peg
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-01-05 14:17:57 -0800
committerBruce Hill <bruce@bruce-hill.com>2019-01-05 14:17:57 -0800
commit326dfd217b74178aae57cc1bee82bfa993a3e19d (patch)
tree2545a5a0e060e1ddfe575780ec866c75aa2671f9 /places.peg
Initial commit
Diffstat (limited to 'places.peg')
-rw-r--r--places.peg21
1 files changed, 21 insertions, 0 deletions
diff --git a/places.peg b/places.peg
new file mode 100644
index 0000000..b23cf76
--- /dev/null
+++ b/places.peg
@@ -0,0 +1,21 @@
+file <- {| (place / ws? comment? %nl)* |} {.+}?
+place <- {|
+ {:name: {word (ws word)*} :}
+ ws? ("(" {:tags: {| {word} ("," ws? {word})* |} :} ")")? ":"
+ ({:times: {|
+ ((ws? comment? %nl)+ " " {| days ws? ("closed" / {:open: time :} "-" {:close: time :}) |})+
+ |} :})
+|}
+
+comment <- "#" [^%nl]*
+
+days <-
+ ({:from: {word} :} "-" {:to: {word} :} ":")
+ /({:from: {word} :} ":")
+ /({:from:''->'sun':} {:to:''->'sat':})
+
+time <- {|
+ {:hour: {[0-9]+} :} (":" {:minute: {[0-9]+} :})? {:ampm: { "am" / "pm"} :}
+|}
+word <- [^%nl (),:#0-9-]+
+ws <- [ ]+