Something went wrong. Try again.
Dockerfile eDSL, combinators, printer and parser forked from gazagnaire.org/ocaml-dockerfile
Something went wrong. Try again.
594 B · 21 lines
at main
12345678910111213141516171819202122%{(* Grammar for a Dockerfile: a sequence of instruction lines and comments. The lexer has already joined continuations and isolated each logical line, so the grammar's job is to collect them in order; the keyword dispatch and argument interpretation happen in {!Dockerfile.of_string}. *)%}
%token <string> INSTR%token <string> COMMENT%token EOF
%start <(Raw.t * (Lexing.position * Lexing.position)) list> file
%%
file: | items = list(item); EOF { items }
item: | s = INSTR { (Raw.Instr s, ($startpos, $endpos)) } | s = COMMENT { (Raw.Comment s, ($startpos, $endpos)) }