Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
eilvelia committed Sep 10, 2024
1 parent 02190a8 commit 3ed0ee7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# ocaml-kdl   [![CI][ci-badge]][ci-page]

[ci-badge]: https://github.com/Bannerets/ocaml-kdl/actions/workflows/ci.yml/badge.svg
[ci-page]: https://github.com/Bannerets/ocaml-kdl/actions/workflows/ci.yml
[ci-badge]: https://github.com/eilvelia/ocaml-kdl/actions/workflows/ci.yml/badge.svg
[ci-page]: https://github.com/eilvelia/ocaml-kdl/actions/workflows/ci.yml

An OCaml implementation of the [KDL][] Document Language, version 2.0.0.
An OCaml implementation of the [KDL][] Document Language 2.0.0.

[KDL]: https://github.com/kdl-org/kdl

Expand Down
10 changes: 5 additions & 5 deletions kdl.opam
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ opam-version: "2.0"
name: "kdl"
version: "0.1.0"
synopsis: "OCaml implementation of the KDL document laguage"
maintainer: "https://github.com/Bannerets <[email protected]>"
authors: "https://github.com/Bannerets <[email protected]>"
maintainer: "eilvelia <[email protected]>"
authors: "eilvelia <[email protected]>"
license: "BlueOak-1.0.0"
tags: ["configuration-language" "data-serialization-format"]
homepage: "https://github.com/Bannerets/ocaml-kdl"
bug-reports: "https://github.com/Bannerets/ocaml-kdl/issues"
dev-repo: "git+https://github.com/Bannerets/ocaml-kdl.git"
homepage: "https://github.com/eilvelia/ocaml-kdl"
bug-reports: "https://github.com/eilvelia/ocaml-kdl/issues"
dev-repo: "git+https://github.com/eilvelia/ocaml-kdl.git"
depends: [
"ocaml" {>= "4.10"}
"dune" {>= "3.0"}
Expand Down
10 changes: 5 additions & 5 deletions kdl.opam.locked
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ opam-version: "2.0"
name: "kdl"
version: "0.1.0"
synopsis: "OCaml implementation of the KDL document laguage"
maintainer: "https://github.com/Bannerets <[email protected]>"
authors: "https://github.com/Bannerets <[email protected]>"
maintainer: "eilvelia <[email protected]>"
authors: "eilvelia <[email protected]>"
license: "BlueOak-1.0.0"
tags: [ "configuration-language" "data-serialization-format"]
homepage: "https://github.com/Bannerets/ocaml-kdl"
bug-reports: "https://github.com/Bannerets/ocaml-kdl/issues"
homepage: "https://github.com/eilvelia/ocaml-kdl"
bug-reports: "https://github.com/eilvelia/ocaml-kdl/issues"
depends: [
"astring" {= "0.8.5" & with-doc}
"base" {= "v0.16.3" & with-test}
Expand Down Expand Up @@ -77,4 +77,4 @@ build: [
"@runtest" {with-test}
"@doc" {with-doc}
]
dev-repo: "git+https://github.com/Bannerets/ocaml-kdl.git"
dev-repo: "git+https://github.com/eilvelia/ocaml-kdl.git"
11 changes: 5 additions & 6 deletions src/lexer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ open Printf

let error msg = raise @@ Err.CustomLexingError msg

(* Note: [Compl] doesn't seem to work *)
let space_char = [%sedlex.regexp?
'\t' (* Character Tabulation U+0009 *)
| 0x000B (* Line Tabulation U+000B *)
Expand Down Expand Up @@ -123,12 +122,12 @@ let dedent ~prefix str =
let line_i = ref 0 in
for i = 0 to String.length str - 1 do
let ch = String.unsafe_get str i in
if !line_i < prefix_len && (!line_i != 0 || ch != '\xFF') then begin
if !line_i < prefix_len && (!line_i <> 0 || ch <> '\xFF') then begin
if ch <> String.get prefix !line_i then
error "Whitespace prefix does not match"
end else if ch = '\xFF' then begin
(* The last newline is trimmed *)
if i != String.length str - 1 then
if i <> String.length str - 1 then
(* Newline is normalized to \n *)
(Buffer.add_char string_buffer '\n'; line_i := -1)
end else begin
Expand Down Expand Up @@ -156,8 +155,8 @@ let raw_string ~multi exp_hashlen lexbuf =
| ws, '"', Plus '#' ->
let quote_pos =
let rec go pos =
if Sedlexing.lexeme_char lexbuf pos = Uchar.of_char '"' then pos
else go (pos + 1)
if Uchar.to_int (Sedlexing.lexeme_char lexbuf pos) = Char.code '"'
then pos else go (pos + 1)
in
go 0
in
Expand Down Expand Up @@ -228,7 +227,7 @@ let rec string ~multi linestart lexbuf =
| '\\', newline ->
new_line lexbuf;
whitespace_escape lexbuf;
string ~multi false lexbuf (* TODO: Is linestart=false correct? *)
string ~multi true lexbuf (* TODO: Is this correct? *)
| '\\', any -> error "Invalid escape sequence"
| ws, '"' ->
let prefix =
Expand Down

0 comments on commit 3ed0ee7

Please sign in to comment.