aboutsummaryrefslogtreecommitdiff
path: root/places.peg
blob: cf5a1fe2f38796fc0002c234de8b11c61a3d50db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
file <- {| (place / ws? comment? %nl)* |} {.+}?
place <- {|
    {:name: {word (ws word)*} :}
    ws? ("(" ws? {:tags: {| {tag} (ws? "," ws? {tag})* ws? |} :} ")")? ws? ":"
    ({:times: {|
        ((ws? comment? %nl)+ (%tab / " "^+2) ws? {| 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"} :}
|}
tag <- word (" "+ word)*
word <- [^%nl%tab (),:#0-9-]+
ws <- [ %tab]+