Giter Club home page Giter Club logo

ada-toml's People

Contributors

actions-user avatar fabien-chouteau avatar mosteo avatar pmderodat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ada-toml's Issues

Objects that are modified should be passed as in out parameters

Looking at this in toml.ads we have

   procedure Set (Value : TOML_Value; Key : String; Entry_Value : TOML_Value)
      with Pre => Value.Kind = TOML_Table;
   --  Create an entry in Value to bind Key to Entry_Value. If Value already
   --  has an entry for Key, replace it.

In other words, the intent is to modify Value.

Now, TOML_Value is a tagged type and therefore passed by reference, so since Set only touches the internals it appears to work.

However, here in alire-user_pins.adb we have

   function To_TOML (This : Pin) return TOML.TOML_Value is
      use TOML;
      Table : constant TOML_Value := Create_Table;
   begin

      [...]

      Table.Set (Keys.Path,
                 Create_String (VFS.Attempt_Portable (Path (This))));

      Table.Set (Keys.Internal, Create_Boolean (True));

      return Table;
   end To_TOML;

and the compiler is entitled to ignore the two Table.Set calls -- which claim not to alter Table - and return the unmodified Table (it being constant).

I have a strong suspicion that this is exactly what is happening with alire built on Apple M1 (aarch64).

There are several other similar subprograms.

Arrays and arrays of arrays

I noticed some problems with arrays:

echo 'a = ["a", "b"]' | obj-checkers/ada_toml_decode -> OK

echo 'a = [0, 1]' | obj-checkers/ada_toml_decode -> 1:6: invalid token

echo 'a = [[0], [1]]' | obj-checkers/ada_toml_decode -> 1:7: invalid token

echo 'a = [["a"], ["b"]]' | obj-checkers/ada_toml_decode -> OK

Spurious "invalid UTF-8 encoding" when using in Alire 2.0 crate

I'm using ada-toml in my utility alr_appimage, and I'm getting a weird error when processing a file in UTF-8 format, like https://github.com/jfuica/bingada/blob/master/alire.toml:

Error: while loading alire.toml: 5: 31: invalid UTF-8 encoding

I'm using latest version in Alire index (0.3.0).

Alire also uses this library to load the same file without problem.

Could it be that the default Alire switches are now not compatible with how this library is loading the file? I guess that in order to work like in Alire, this commit should be included and a new release made:

mosteo@da4e59c

Is there any problem impending the merge of that change?

Provide line information where a value is defined

This is an improvement suggestion.
It would be nice to know the Source_Location where a TOML_Value is defined in the file.

This is useful when the TOML file is correct but you want to report some configuration error specific to your tool (such as an invalid value, ...).

Example with Alire, if we write an invalid tag somewhere, we get the error:

error: Cannot continue without a workspace:
error:    Loading release from manifest: alire.toml:
error:    Failed to load alire.toml:
error:    Loading release from manifest: alire.toml:
error:    invalid property: 'plop'. Can be: actions, authors, auto-gpr-with, build-profiles, build-switches, configuration, description, environment, executables, gpr-externals, gpr-set-externals, hint, licenses, long-description, maintainers, maintainers-logins, name, notes, project-files, tags, version, website.

I don't think we need the path name since there is no ambiguity on the file name.

Accepted syntax for tables that is rejected by other parsers

I've found that master branch accepts these examples with the obvious intended meaning of creating a table:

one.two = false

or the actual case where I found it:

[[one]]
two.three = false

but these are rejected by the Python and JS parsers, and the haskell validator.

See this stackoverflow post I made for a bit more detail.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.