Skip to content

Commit

Permalink
Improve file names and directory structure.
Browse files Browse the repository at this point in the history
Follow the dune spirit, i.e. stop prefixing modules with `Gitconfig_`.
  • Loading branch information
OlivierNicole committed Apr 1, 2022
1 parent 190b459 commit 050cd3a
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 21 deletions.
12 changes: 0 additions & 12 deletions cli/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,6 @@
(modules main api config issue merge_request project user)
(name main))

; Parser for Git config files
(library
(name gitconfig)
(package lab)
(modules gitconfig_lexer gitconfig_types gitconfig_parser)
(modules_without_implementation gitconfig_types))

(ocamllex gitconfig_lexer)

(menhir
(modules gitconfig_parser))

(mdx
(files lab.md)
(package lab)
Expand Down
10 changes: 10 additions & 0 deletions cli/gitconfig/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(library
(name gitconfig)
(package lab)
(modules types lexer parser)
(modules_without_implementation types))

(ocamllex lexer)

(menhir
(modules parser))
2 changes: 1 addition & 1 deletion cli/gitconfig_lexer.mll → cli/gitconfig/lexer.mll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
open Gitconfig_parser
open Parser

exception Error of string
}
Expand Down
6 changes: 3 additions & 3 deletions cli/gitconfig_parser.mly → cli/gitconfig/parser.mly
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
%{
%}

%token <Gitconfig_types.binding> KEYVAL
%token <Types.binding> KEYVAL
%token <string> SECTIONHEADER
%token EOF

%start config

%type <Gitconfig_types.config> config
%type <Gitconfig_types.binding> key_value
%type <Types.config> config
%type <Types.binding> key_value

%%
config:
Expand Down
File renamed without changes.
8 changes: 3 additions & 5 deletions test/gitconfig/gitconfig.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
open Gitconfig

let print_config fmt config =
let open Format in
let rec print_bindings fmt = function
Expand Down Expand Up @@ -31,10 +29,10 @@ let () =
|}
in
try
let config = Gitconfig_parser.config Gitconfig_lexer.token lexbuf in
let config = Gitconfig.Parser.config Gitconfig.Lexer.token lexbuf in
print_config Format.std_formatter config
with
| Gitconfig_lexer.Error msg ->
| Gitconfig.Lexer.Error msg ->
Printf.fprintf stderr "%s%!" msg
| Gitconfig_parser.Error ->
| Gitconfig.Parser.Error ->
Printf.fprintf stderr "At offset %d: syntax error.\n%!" (Lexing.lexeme_start lexbuf)

0 comments on commit 050cd3a

Please sign in to comment.