Yaml

Only valid for the following subset

defaults: &anchor
  repo1: master

host:
  # Inheritance
  <<: *anchor
  repo2: branch

Author: Dimitar Dimitrov mit.nosp@m.kofr@yaho.nosp@m.o.fr

Summary

helpers

indent

let indent = del /[ \t]+/ " "

the imposed indent is 2 spaces

inherit

<<: *anchor

repo

let _repo = [ key Rx.word . colon . space . (val | mval) . eol ]
{ "repo" = "branch" }

anchor

let anchor = Util.del_str "&" . val
&anchor

entry

let entry = [ key Rx.word . colon . (space . anchor)? . eol . (indent . comment)* . ((inherit . (repo+)?) | repo+) ]
host:
  # Inheritance
  <<: *anchor
  repo2: branch

top level sequence

header

let header = [ label "@yaml" . Util.del_str "---" . (Sep.space . store Rx.space_in)? . eol ]

lns

let lns = ((empty|comment)* . header)? . (sequence | entry | comment | empty)*

The yaml lens

let indent = del /[ \t]+/ " "
the imposed indent is 2 spaces
let _repo = [ key Rx.word . colon . space . (val | mval) . eol ]
let anchor = Util.del_str "&" . val
let entry = [ key Rx.word . colon . (space . anchor)? . eol . (indent . comment)* . ((inherit . (repo+)?) | repo+) ]
let header = [ label "@yaml" . Util.del_str "---" . (Sep.space . store Rx.space_in)? . eol ]
let lns = ((empty|comment)* . header)? . (sequence | entry | comment | empty)*
The yaml lens
Close