ocaml-toml / to.ml Goto Github PK
View Code? Open in Web Editor NEWOCaml library for TOML
Home Page: https://ocaml-toml.github.io/To.ml
License: Other
OCaml library for TOML
Home Page: https://ocaml-toml.github.io/To.ml
License: Other
I'm not convinced this is actually a TOML issue but I see it when installing TOML. Note that everything is installed fresh so the error doesn't quite make sense to me.
This is for TOML 4.0.0
...
/usr/local/jenkins/jobs/lua_pattern-4.04.0+flambda-unit-tests/workspace/.opam/4.04.0+flambda/bin/ocamlfind ocamldep -package unix -package str -package ISO8601 -modules src/tomlPrinter.ml > src/tomlPrinter.ml.depends
/usr/local/jenkins/jobs/lua_pattern-4.04.0+flambda-unit-tests/workspace/.opam/4.04.0+flambda/bin/ocamlfind ocamlc -c -g -annot -bin-annot -package unix -package str -package ISO8601 -I src -o src/tomlLexer.cmo src/tomlLexer.ml
+ /usr/local/jenkins/jobs/lua_pattern-4.04.0+flambda-unit-tests/workspace/.opam/4.04.0+flambda/bin/ocamlfind ocamlc -c -g -annot -bin-annot -package unix -package str -package ISO8601 -I src -o src/tomlLexer.cmo src/tomlLexer.ml
File "src/tomlLexer.ml", line 1:
Error: /usr/local/jenkins/jobs/lua_pattern-4.04.0+flambda-unit-tests/workspace/.opam/4.04.0+flambda/lib/ISO8601/ISO8601.cmi
is not a compiled interface for this version of OCaml.
It seems to be for an older version of OCaml.
Command exited with code 2.
+ ocamlfind ocamlopt unix.cmxa -I /usr/local/jenkins/jobs/lua_pattern-4.04.0+flambda-unit-tests/workspace/.opam/4.04.0+flambda/lib/ocamlbuild /usr/local/jenkins/jobs/lua_pattern-4.04.0+flambda-unit-tests/workspace/.opam/4.04.0+flambda/lib/ocamlbuild/ocamlbuildlib.cmxa -linkpkg myocamlbuild.ml /usr/local/jenkins/jobs/lua_pattern-4.04.0+flambda-unit-tests/workspace/.opam/4.04.0+flambda/lib/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
Does anyone have any plan of updating To.ml to TOML v0.5.0 ?
It's okay if nobody wants to do it, I'm just checking if someone has already started to work on that or not
Add a real support for real dates
And as bisect is not a dependency, the build fails on opam.
Eg like this library http://calendar.forge.ocamlcore.org/ or camomile or murmur3
I was looking through all my opam deps and many of the libraries use LGPL "with Ocaml linking exception". Should this library?
Following the instructions on the Readme:
⇒ make build
ocaml setup.ml -configure
Cannot find file ./setup.ml.
make: *** [Makefile:34: setup.data] Error 2
Until now, my fork used to be the one used by opam, but since it looks like the original repo is sync (and now more advanced than mine), do you want to change the url for the next release?
All public functions should point to the first version where this function was exported
Maybe keep them in a different directory ?
The github api will not like it a lot, but hey, for science.
This is the tracking issue of the scraping work.
As it is right now (whether or not Oasis support goes in) we could release as 2.2.0, since AFAIK there is no API breakage. Is there anything else we're planning on?
Could the library support comments parsing and setting?
We could for example attach string to keys, and this could write comments in the Toml file.
It seems that we already have some user. Find them, and feature them in the readme. Also, add a call to action in the Readme to be in the featured list.
In _oasis
, mehhir is added as a dependency ("XMetaRequires"), but menhir is a binary. It should only be required for compiling, not when linking the library. Subsequently I can't use the library (version 2.2.0).
Changelog here
0.3.0 / 2014-11-10
Add scientific notation for floats.
Allow optional + prefix on integers.
Switch to RFC 3339 for datetimes (allowing offsets and fractional seconds).
Add multiline and literal strings.
Clarify what characters valid keys can contain.
It is may not to break the API, but valid toml documents for current version will not be valid anymore (mostly because of date format change), so these improvements may lead to a 3.0 version for the library.
README talks about Toml.of_key_values
and Toml.key
when both are in Toml.Min
.
tracking issue
We shouldn't assume that the reader is an expert in ocaml.
We need to add some pointers to ocaml resources so that beginners will not be lost.
Some ideas:
Input welcome
After asking on the Toml project issue #733, I can now confirm that quoted keys and bare keys with the same string are the same semantic key.
This means that the current implementation of [TomlType.Table.Key.compare] is wrong with regard to the Toml specification because it always separate bare and quoted keys.
They signature is currently:
module Key : sig
type t
exception Bad_key of string
val compare : t -> t -> int
val bare_key_of_string : string -> t
val quoted_key_of_string : string -> t
val to_string : t -> string
end
From what I gather the bare key constructor is duplicating validation that the parser has already done. And in fact the quoting of the string only seems to be a concern when serializing the string in order to generate valid TOML.
How would maintainers feel about changing the signature to look like:
module Key : sig
type t
val compare : t -> t -> int
val of_string : string -> t
val to_string : t -> string
end
Any string is a valid key so of_string
will accept it, but on the way out of to_string
, the string will have to be quoted and/or escaped.
I can take a crack at this if it's a welcomed change.
File "src/tomlUnicode.ml", line 13, characters 4-93:
Warning 3: deprecated: String.set
Use Bytes.set instead.
File "src/tomlUnicode.ml", line 14, characters 26-27:
Error: This expression has type bytes but an expression was expected of type
string
# opam-version 1.2.2
# os linux
# command make build
# path /home/x/.opam/4.06.0/build/toml.4.0.0
# compiler 4.06.0
# exit-code 2
# env-file /home/x/.opam/4.06.0/build/toml.4.0.0/toml-7096-541cda.env
# stdout-file /home/x/.opam/4.06.0/build/toml.4.0.0/toml-7096-541cda.out
# stderr-file /home/x/.opam/4.06.0/build/toml.4.0.0/toml-7096-541cda.err
### stdout ###
# [...]
# Error: This expression has type bytes but an expression was expected of type
# string
# Command exited with code 2.
# + ocamlfind ocamlopt unix.cmxa -I /home/x/.opam/4.06.0/lib/ocamlbuild /home/x/.opam/4.06.0/lib/ocamlbuild/ocamlbuildlib.cmxa -linkpkg myocamlbuild.ml /home/x/.opam/4.06.0/lib/ocamlbuild/ocamlbuild.cmx
-o myocamlbuild
# File "myocamlbuild.ml", line 518, characters 43-62:
# Warning 3: deprecated: Ocamlbuild_plugin.String.uncapitalize
# Use String.uncapitalize_ascii instead.
# File "myocamlbuild.ml", line 531, characters 51-70:
# Warning 3: deprecated: Ocamlbuild_plugin.String.uncapitalize
# Use String.uncapitalize_ascii instead.
### stderr ###
# [...]
# Warning 3: deprecated: String.uncapitalize
# Use String.uncapitalize_ascii instead.
# File "setup.ml", line 5847, characters 11-28:
# Warning 3: deprecated: String.capitalize
# Use String.capitalize_ascii instead.
# File "setup.ml", line 5848, characters 11-30:
# Warning 3: deprecated: String.uncapitalize
# Use String.uncapitalize_ascii instead.
# E: Failure("Command ''/home/x/.opam/4.06.0/bin/ocamlbuild' src/toml.cma src/toml.cmxa src/toml.a src/toml.cmxs -use-ocamlfind -tag debug' terminated with error code 10")
# make: *** [Makefile:7: build] Error 1
Tracking issue.
TODO: suggest some designs / screnshoot from the github templates / nice projects
Hi there,
There is a problem with the documentation for version v5.0.0
- it lies at least 10 times. The problem is the signature of TomlTypes.Table
, generated with the Stdlib's Map.Make
that has changed many times since OCaml 4.02. Since there's not a *.mli
file, the incompatibility is only noticed when you try to access the API. Below there's a list of functions from Map.S
(the result of Map.Make
) and whey they were introduced:
Since 4.03.0
Since 4.05.0:
Since 4.06.0:
Need dune#3983 first.
Hey!
So I'm playing around with this package and I'm not sure if I'm missing something but the order of the fields I create (via Toml.Min.of_key_values
) is not respected by Toml.Printer.string_of_table
and my final toml string has fields in what seems to be a random order.
I ran opam install toml
and got:
#=== ERROR while compiling toml.7.0.0 =========================================#
# context 2.1.0 | linux/x86_64 | ocaml-base-compiler.4.09.0 | https://opam.ocaml.org#f00176f2
# path ~/.opam/4.09.0/.opam-switch/build/toml.7.0.0
# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -p toml -j 7 @install
# exit-code 1
# env-file ~/.opam/log/toml-22531-0a5741.env
# output-file ~/.opam/log/toml-22531-0a5741.out
### output ###
# [...]
# 254 | in
# 255 | (_menhir_goto_array_start _menhir_env _menhir_stack _menhir_s _v : 'freshtv354)) : 'freshtv356)
# 256 | | _ ->
# 257 | _menhir_fail ()
# Error: This definition has type
# 'ttv_tail.
# _menhir_env ->
# 'ttv_tail -> _menhir_state -> Toml.Types.array list -> 'freshtv352
# which is less general than
# 'ttv_tail 'ttv_return.
# _menhir_env ->
# 'ttv_tail -> _menhir_state -> Toml.Types.array list -> 'ttv_return
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build toml 7.0.0
└─
╶─ No changes have been performed
contents of ~/.opam/log/toml-22531-0a5741.env
:
ALACRITTY_LOG=/tmp/Alacritty-6512.log
BROWSER=firefox
CAML_LD_LIBRARY_PATH=/home/zaba/.opam/4.09.0/lib/stublibs:/home/zaba/.opam/4.09.0/lib/ocaml/stublibs:/home/zaba/.opam/4.09.0/lib/ocaml
CASROOT=/usr
CDPATH=
COLORTERM=truecolor
CSF_DrawPluginDefaults=/usr/share/opencascade/resources/DrawResources
CSF_EXCEPTION_PROMPT=1
CSF_IGESDefaults=/usr/share/opencascade/resources/XSTEPResource
CSF_LANGUAGE=us
CSF_MDTVTexturesDirectory=/usr/share/opencascade/resources/Textures
CSF_MIGRATION_TYPES=/usr/share/opencascade/resources/StdResource/MigrationSheet.txt
CSF_OCCTResourcePath=/usr/share/opencascade/resources
CSF_PluginDefaults=/usr/share/opencascade/resources/StdResource
CSF_SHMessage=/usr/share/opencascade/resources/SHMessage
CSF_STEPDefaults=/usr/share/opencascade/resources/XSTEPResource
CSF_ShadersDirectory=/usr/share/opencascade/resources/Shaders
CSF_StandardDefaults=/usr/share/opencascade/resources/StdResource
CSF_StandardLiteDefaults=/usr/share/opencascade/resources/StdResource
CSF_TObjDefaults=/usr/share/opencascade/resources/StdResource
CSF_TObjMessage=/usr/share/opencascade/resources/TObj
CSF_XCAFDefaults=/usr/share/opencascade/resources/StdResource
CSF_XSMessage=/usr/share/opencascade/resources/XSMessage
CSF_XmlOcafResource=/usr/share/opencascade/resources/XmlOcafResource
DISPLAY=:0
DOCKER_CONFIG=/home/zaba/.config/docker
DOTNET_CLI_TELEMETRY_OPTOUT=true
DOTNET_ROOT=/home/zaba/.local/share/dotnet
DRAWDEFAULT=/usr/share/opencascade/resources/DrawResources/DrawDefault
DRAWHOME=/usr/share/opencascade/resources/DrawResources
EDITOR=micro
GOBIN=/home/zaba/go/bin
GOPATH=/home/zaba/go
HOME=/home/zaba
INPUTRC=/home/zaba/.config/readline/inputrc
JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk/jre
LANG=en_US.UTF-8
LC_COLLATE=C
LESSHISTFILE=-
LESSKEY=/home/zaba/.config/less/lesskey
LOGNAME=zaba
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.svgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.tbz2=01;31:*.bz=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.svg=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:
MACHINE_STORAGE_PATH=/home/zaba/.local/share/docker-machine
MAIL=/var/mail/zaba
MAKEFLAGS=
MAKELEVEL=
MANPATH=:/home/zaba/.opam/4.09.0/man
MMGT_CLEAR=1
MOTD_SHOWN=pam
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
MPD_HOST=localhost
OCAML_TOPLEVEL_PATH=/home/zaba/.opam/4.09.0/lib/toplevel
OLDPWD=/home/zaba/hack
OPAMCLI=2.0
OPAMROOT=/home/zaba/.opam
OPAMSWITCH=4.09.0
OPAM_PACKAGE_NAME=toml
OPAM_PACKAGE_VERSION=7.0.0
OPAM_SWITCH_PREFIX=/home/zaba/.opam/4.09.0
PAGER=less
PATH=/home/zaba/.opam/4.09.0/bin:/home/zaba/perl5/bin:/home/zaba/.local/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/lib/plan9/bin:/home/zaba/.local/share/dotnet:/home/zaba/go/bin
PERL5LIB=/home/zaba/perl5/lib/perl5
PERL_LOCAL_LIB_ROOT=/home/zaba/perl5
PERL_MB_OPT=--install_base "/home/zaba/perl5"
PERL_MM_OPT=INSTALL_BASE=/home/zaba/perl5
PKG_CONFIG_PATH=/home/zaba/.opam/4.09.0/lib/pkgconfig
PLAN9=/usr/lib/plan9
PWD=/home/zaba/.local/src/comby
SHELL=/bin/bash
SHLVL=1
SVDIR=/home/zaba/.local/service
TERM=alacritty
TZ=
USER=zaba
WINDOWID=20971522
WINDOWPATH=1
XAUTHORITY=/tmp/Xauthority
XDG_CACHE_HOME=/home/zaba/.cache
XDG_CONFIG_HOME=/home/zaba/.config
XDG_DATA_HOME=/home/zaba/.local/share
XDG_RUNTIME_DIR=/tmp
XINITRC=/home/zaba/.config/X11/xinitrc
XSERVERRC=/home/zaba/.config/X11/xserverrc
_=/bin/opam
_JAVA_AWT_WM_NONREPARENTING=1
contents of ~/.opam/log/toml-22531-0a5741.out
:
ocamlc src/.toml.objs/byte/toml__Menhir_parser.{cmo,cmt} (exit 2)
(cd _build/default && /home/zaba/.opam/4.09.0/bin/ocamlc.opt -w -40 -g -bin-annot -I src/.toml.objs/byte -I src/.toml.objs/public_cmi -I /home/zaba/.opam/4.09.0/lib/ISO8601 -intf-suffix .ml -no-alias-deps -open Toml -o src/.toml.objs/byte/toml__Menhir_parser.cmo -c -impl src/menhir_parser.ml)
File "src/menhir_parser.ml", lines 194-257, characters 2-23:
194 | ..fun _menhir_env _menhir_stack _menhir_s _v ->
195 | match _menhir_s with
196 | | MenhirState82 ->
197 | let (_menhir_env : _menhir_env) = _menhir_env in
198 | let (_menhir_stack : (('freshtv351 * _menhir_state)) * _menhir_state * (
...
254 | in
255 | (_menhir_goto_array_start _menhir_env _menhir_stack _menhir_s _v : 'freshtv354)) : 'freshtv356)
256 | | _ ->
257 | _menhir_fail ()
Error: This definition has type
'ttv_tail.
_menhir_env ->
'ttv_tail -> _menhir_state -> Toml.Types.array list -> 'freshtv352
which is less general than
'ttv_tail 'ttv_return.
_menhir_env ->
'ttv_tail -> _menhir_state -> Toml.Types.array list -> 'ttv_return
ocamlopt src/.toml.objs/native/toml__Menhir_parser.{cmx,o} (exit 2)
(cd _build/default && /home/zaba/.opam/4.09.0/bin/ocamlopt.opt -w -40 -g -I src/.toml.objs/byte -I src/.toml.objs/native -I src/.toml.objs/public_cmi -I /home/zaba/.opam/4.09.0/lib/ISO8601 -intf-suffix .ml -no-alias-deps -open Toml -o src/.toml.objs/native/toml__Menhir_parser.cmx -c -impl src/menhir_parser.ml)
File "src/menhir_parser.ml", lines 194-257, characters 2-23:
194 | ..fun _menhir_env _menhir_stack _menhir_s _v ->
195 | match _menhir_s with
196 | | MenhirState82 ->
197 | let (_menhir_env : _menhir_env) = _menhir_env in
198 | let (_menhir_stack : (('freshtv351 * _menhir_state)) * _menhir_state * (
...
254 | in
255 | (_menhir_goto_array_start _menhir_env _menhir_stack _menhir_s _v : 'freshtv354)) : 'freshtv356)
256 | | _ ->
257 | _menhir_fail ()
Error: This definition has type
'ttv_tail.
_menhir_env ->
'ttv_tail -> _menhir_state -> Toml.Types.array list -> 'freshtv352
which is less general than
'ttv_tail 'ttv_return.
_menhir_env ->
'ttv_tail -> _menhir_state -> Toml.Types.array list -> 'ttv_return
Related issue: #8
To.ml parse error on a .gitconfig. It seems to be the tab in the begin of the line.
Standard test case:
# #require "toml";;
# let _ = Toml.Parser.from_filename "/Users/thomas/.gitconfig" in ();;
Exception:
Toml.Parser.Error
("Error in /Users/thomas/.gitconfig at line 2 at column 14 (position 21)",
{Toml.Parser.source = "/Users/thomas/.gitconfig"; line = 2; column = 14;
position = 21}).
Funny thing, the github parser is broken in the same way.
# my ~/.gitconfig
[user]
name = Thomas Wickham
email = t[email protected]
[pull]
default = simple
[push]
default = simple
[github]
user = mackwic
[color]
ui = auto
[filter "media"]
required = true
clean = git media clean %f
smudge = git media smudge %f
[core]
excludesfile = /Users/thomas/.gitignore_global
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[branch]
autosetupmerge = always
I work on this this evening, should be solved by tomorrow.
I can do it if @mackwic wants.
Is this package compatible with 4.06.0? I get an error when installing through opam.
toml is not available because your system doesn't comply with ocaml-version >= "4.01.0" & ocaml-version < "4.06.0".
Whether renaming TomlTypes
and TomlLenses
to Toml.Types
and Toml.Lenses
was a good idea or not... for heavens sake, consider warning your users about that kind of stuff.
I see you've compiled a list of projects using your lib. You knew whose code you are breaking. What was it that kept you from making a 5.1.0 release with deprecation warnings to allow them to adjust dependencies of existing package versions to hardcode toml <= 5.0.0
?
Hell, you knew it's a small list—you could tell those people about your plans. And you chose to unexpectedly break it instead.
It's very annoying. I miss the conversion functions from the previous version (Toml.Value.To.{string,int,...}
namely).
It would appear the most recent version of toml
available on opam is 7.0.0, but it requires somewhat oldish versions of menhir. Commit 41172b7 solves this, but there does not appear to have been any release since.
Some constructions, like this one are specific to OCaml 4.02.
At this point, there is no technical reason to depend on 4.02, so this would be a political decision.
I tend to think that To.ml is not the best place to do OCaml politic, but that could be debatable as Toml is a language that tend himself to renew the configuration languages.
As main contributors, what's your input on this topic, @sagotch @Emm ?
Is that expected?
$ ledit ocaml
OCaml version 4.01.0
# #require "toml";;
# let t = Toml.from_filename "/Users/thomas/.gitconfig";;
Exception: TomlParser.Error.
$ cat /Users/thomas/.gitconfig
[color]
ui = true
[user]
name = Thomas Gazagnaire
email = [email protected]
[push]
default = simple
[core]
editor = emacs
For now, nested arrays are not supported, even if the grammar seems to be ok.
Find out why
See: https://github.com/whitequark/ppx_deriving
We should not provide it in the main package (hide it behind a build flag) as some users don't want libraries to add unexpected syntax extension.
This one:https://github.com/BurntSushi/toml-test
Will need another project referencing Toml.
This is the tracking issue of the work in progress.
setup.ml is missing
$ make build
ocaml setup.ml -configure
Cannot find file setup.ml
I will generate gh-pages and fix opam file as soon as Makefile will be fixed.
Is this project abandoned?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.