aboutsummaryrefslogtreecommitdiff
path: root/places.peg
diff options
context:
space:
mode:
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 <- [ ]+