You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zapashcanon 550e581f6d
use a formatting box instead of an int to indent
10 months ago
doc add Query module 11 months ago
example add an example 10 months ago
src use a formatting box instead of an int to indent 10 months ago
test fix bug with newlines at the start of the file 10 months ago
.gitignore first commit 11 months ago
.ocamlformat first commit 11 months ago
CHANGES.md use a formatting box instead of an int to indent 10 months ago
LICENSE.md add missing deps, fix license 11 months ago
README.md clean stuff 10 months ago
dune-project fix menhir lower bound 10 months ago
scfg.opam update opam file 10 months ago

README.md

scfg

scfg is an OCaml executable and library to work with the scfg configuration file format.

Installation

scfg can be installed with opam:

opam install scfg

If you don't have opam, you can install it following the how to install opam guide.

If you can't or don't want to use opam, consult the opam file for build instructions.

Quickstart

Using the library to parse a scfg file and reprint nicely:

open Scfg

let config =
  match Parse.from_file "config.scfg" with
  | Ok config -> config
  | Error e -> begin
    Format.eprintf "error: %s@." e;
    exit 1
  end

let () =
  Format.printf "%a@." Pp.config config

The provided binary does exactly this. If you have the following config.scfg file:

   name "a"        "b b b" 'c' {


       child1       ""    "I'm léo"

                child2 'nono'
     }

Running the binary on it will reprint it trying to make the output pretty:

$ scfg config.scfg
name a "b b b" c {
  child1 "" "I'm léo"
  child2 nono
}

For more, have a look at the example folder, at the documentation or at the test suite.

About