From 326dfd217b74178aae57cc1bee82bfa993a3e19d Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 5 Jan 2019 14:17:57 -0800 Subject: Initial commit --- places.peg | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 places.peg (limited to 'places.peg') 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 <- [ ]+ -- cgit v1.2.3