ocaml-pkgbuild /

open Printf

let _ =
  let print_token tok =
      (match tok with
        RAWTEXT( txt ) -> ("RAWTEXT: '" ^ txt ^ "'")
      | IDENT( name ) -> ("IDENT: " ^ name)
      | SIGIL -> "SIGIL"
      | SOPEN -> "SOPEN"
      | SCLOSE -> "SCLOSE"
      | SUBDEF -> "SUBDEF"
      | SUBSET -> "SUBSET"
      | SUBERR -> "SUBERR"
      | EOF    -> "EOF") in
  let rec dump_tokens lexbuf =
    let tok = pbexplex lexbuf in
    if (match tok with EOF -> false | _ -> true) then
      (print_token tok; dump_tokens lexbuf)
    else () in

  let test_it msg =
    dump_tokens (Lexing.from_string msg);
    ignore (Parsing.set_trace true);
    let lbuf = Lexing.from_string msg in
    let presult = try pbexp pbexplex lbuf
    with Parsing.Parse_error -> begin
      ignore (Parsing.set_trace false);
      failwith (sprintf "Error at chars %d-%d >>> %s"
                  (Lexing.lexeme_start lbuf)
                  (Lexing.lexeme_end lbuf)
    ignore (Parsing.set_trace false);
  test_it "${FOO:=BAR} ${BAR:?OMG where is $FOO?}"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.