aboutsummaryrefslogtreecommitdiff
path: root/places.peg
blob: b23cf7680990c4a1ae6b2ef7f72cf6832556ae84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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 <- [ ]+