1
1
mirror of https://github.com/tweag/nickel.git synced 2024-09-19 23:47:54 +03:00
Commit Graph

91 Commits

Author SHA1 Message Date
dependabot[bot]
52511ec5fa
chore(deps): bump comrak from 0.16.0 to 0.17.0 (#1208)
Bumps [comrak](https://github.com/kivikakk/comrak) from 0.16.0 to 0.17.0.
- [Release notes](https://github.com/kivikakk/comrak/releases)
- [Changelog](https://github.com/kivikakk/comrak/blob/main/changelog.txt)
- [Commits](https://github.com/kivikakk/comrak/compare/0.16.0...0.17.0)

---
updated-dependencies:
- dependency-name: comrak
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
2023-03-30 17:03:24 +00:00
matthew healy
828d972fa9
Update stdlib string functions to work on Unicode extended grapheme clusters (#1200)
* Delete dead code from strings.ncl

* Split stdlib_string.ncl into multiple test files

This commit splits the monolithic stdlib string test file into
multiple smaller files, roughly split according to "domain" behaviour.

It also adds some new test cases in places where the coverage seemed
a little thin.

* Maintain extended grapheme cluster abstraction in `string.split`

This commit re-implements `string.split` so that extended grapheme
clusters are never broken up, even if the separator is included
within.

* Return extended grapheme clusters from `string.characters`

* Remove `string.codepoint` and `string.from_codepoint`

These functions break the extended grapheme cluster abstraction,
and don't have equivalents in the Nix language, so we've decided
to remove them.

* Use grapheme cluster indices in string.substring

* Ensure `string.replace` doesn't separate extended grapheme clusters

* `string.contains` should check entire grapheme clusters

This updates the implementation of `string.contains` to avoid returning
true if the string we're searching for only exists as part of a larger
extended grapheme cluster.

* Refactor Nickel string implementation to `term::string` module

* Update stdlib documentation
2023-03-29 10:30:05 +02:00
Yann Hamdaoui
44a97f56d4
Fix serialization/to_string error on rationals 2023-03-14 18:50:42 +01:00
Yann Hamdaoui
61396bb7f7
Use arbitrary precision rationals for numbers
First draft of implementing Nickel numbers using arbitrary precision
rationals instead of 64-bits float. The rationale is to provide exact
precision for common arithmetic operations (understand addition,
division, subtraction, raising to an integer power, modulo), as opposed
to floats, that can incur rounding error on sometimes common decimal
values.

Some operations do need rounding: raising to a non-integer power, as
well as representation as a string (to_string/serialization).
2023-03-14 18:48:01 +01:00
Yann Hamdaoui
b65eb3d72e
Bump rust dependencies, fix breaking changes 2023-03-10 19:18:26 +01:00
Guillaume Desforges
0c68c8e69f Update Cargo.toml
Co-authored-by: Yann Hamdaoui <yann.hamdaoui@gmail.com>
2023-01-16 16:38:24 +01:00
Guillaume Desforges
768656d75a Move Python bindings to its own crate pyckel 2023-01-16 16:38:24 +01:00
Guillaume Desforges
27a8d30ef7 Generating Python module is optional 2023-01-16 16:38:24 +01:00
Guillaume Desforges
6e122939ad init Python bindings 2023-01-16 16:38:24 +01:00
matthew healy
bff8451f7e
Add snapshot testing infrastructure (#1034)
* Update regex crate to 1.7

We want to use the regex filtering feature of the insta snapshot testing
library. That has a dependency on a newer version of the regex crate
than Nickel currently does, so this commit updates the Nickel version to
a more recent compatible version.

* Add insta dependency

* Add cargo-insta to dev shells

* Add snapshot testing infrastructure

This uses the insta crate to implement snapshot testing.

Each snapshot test invokes the debug nickel binary with some set of
arguments, then captures the output & compares it to a file in the
snapshots directory

* Add nixpkgs-fmt to dev shell

This makes it possible to easily reformat flake.nix from within a dev
shell.

* Update HACKING.md

* Add snapshot testing README
2023-01-09 11:32:40 +01:00
matthew healy
14aa2e05e9
Return grapheme cluster count from %str_length% primitive (#1005)
Previously `%str_length%` was returning the number of bytes in the Rust
`String` storage, which lead to unexpected results.

This commit uses the `unicode-segmentation` crate to instead count the
number of extended grapheme clusters in the string. This means that even
complex emoji comprised of multiple characters, but visually rendering
as one, get counted as just one character.

One potential downside to this is that this isn't consistent with how
other standard library functions (such as splitting a string) currently
work, however it also wasn't consistent before, and this change at least
moves things in the right direction
2022-12-16 15:45:19 +01:00
Matthew Healy
89823b1662 Bump versions to 0.3.1 2022-12-15 17:08:50 +01:00
matthew healy
b10b27fe61
Automate adding .ncl file test cases (#992)
* Add test-generator dependency

* Use test-generator to simplify pass test file

This commit uses the test-generator library to automatically generate a
set of integration tests from any `.ncl` file in the
`tests/integration/pass` directory.

As a consequence, simply adding a new file to that directory is
sufficient to add a new test case.

This also meant that the non-test files, like the assertion library and
files that are used to test importing, were moved to a '/lib' directory
so test-generator doesn't pick them up.
2022-12-15 12:06:10 +01:00
Yann Hamdaoui
fd37904c4d
Bump Nickel version to 0.3 2022-12-08 10:44:11 +01:00
Yann Hamdaoui
1ddf52bdeb
[CI] Add clippy check (#793)
* Print logs when running `nix flake check` in CI
* Add clippy to the flake checks and git hooks
* Clippy auto fix
  `cargo clippy --fix --workspace --no-deps --frozen --offline -- --deny warnings --allow "clippy::new-without-default" --allow "clippy::match_like_matches_macro"`
* Manually fix remaining Clippy warnings

Co-authored-by: Julien Debon <julien.debon@tweag.io>
2022-11-17 18:18:49 +01:00
Julien Debon
bb66cb0266 Update wasm-bindgen from 0.2.74 to 0.2.83
Version 0.2.74 no longer builds with recent `nixpkgs` because of openssl.

* Update wasm-bindgen from 0.2.74 to 0.2.83
* Refactor `wasm-bindgen-cli` overlay to override Nixpkgs' definition, rather
than build the package from Github
* Remove the no longer used `wasm-bindgen-api-Cargo.lock` file
* Add comments about the hidden coupling between `wasm-bindgen` in `Cargo.toml`
and `wasm-bindgen-cli` in `flake.nix`
2022-11-03 11:36:34 +01:00
Anthony Caccia
a22f840495 rewrite the Identifier Interner to store strings in an arena and Ident to have symbols 2022-09-20 13:43:09 +02:00
Anthony Caccia
a24edc8535 WIP: add a naive string interner for identifiers 2022-09-16 15:40:31 +02:00
Yann Hamdaoui
50e373f181 Bump version to 0.2.1 2022-08-08 15:31:44 +02:00
Yann Hamdaoui
2a2f486087 Nickel version: 0.1.0 -> 0.2.0 2022-08-08 15:31:44 +02:00
Yann Hamdaoui
947c943f16 Migrate to the latest edition (2021) 2022-08-05 15:08:29 +02:00
Yann Hamdaoui
841cfb7db1
Separate the WASM repl in wrapper crate 2022-06-15 16:53:38 +02:00
Yann Hamdaoui
74f05ba29b
Update all dependencies + corresponding fixes 2022-06-02 17:19:46 +02:00
francois-caddet
28272b2a8b rename the bench 2022-05-30 16:50:15 +02:00
francois-caddet
45487a8063 first draft of typechecker benches.
proved on a rewrite of nixpkgs lists lib in nickel
2022-05-30 16:48:07 +02:00
francois-caddet
43295e39e8 bench stdlib typechecking 2022-05-25 10:40:14 +02:00
francois-caddet
0181308e0f add mantis benches
come from a port of mantis ops by @yannham
2022-05-20 16:28:50 +02:00
francois-caddet
482d5250d9 Merge branch 'master' into feature/pretty-print 2022-05-13 20:03:40 +02:00
francois-caddet
0815ca5480 some cleaning
- unused variables and imports warnings fixed
- move a `similar` to dev-dependencies because only used for
  prettyprinting tests
2022-05-13 19:44:57 +02:00
Erin van der Veen
f84432c440 Construct markdown for (nested) record docs
Documentation generation is hidden behind a feature flag to fix and
issue where the wasm target could not be build
2022-05-13 14:02:52 +02:00
francois-caddet
dad5512de5 fix some multiline string and others prety printing 2022-05-02 19:09:09 +02:00
francois-caddet
983a593a8e add command expend to debug nickel and test prettyprinting 2022-04-12 09:11:19 +02:00
Yann Hamdaoui
e90aada3c3 Add nickel-lang-utilities to the workspace 2022-03-09 20:12:28 +01:00
Yann Hamdaoui
0b1ed40e40 Rename crates nickel* to nickel-lang* 2022-03-06 22:27:57 +01:00
Yann Hamdaoui
879856c51b renaming list -> array 2022-03-02 16:38:46 +01:00
Yann Hamdaoui
98bc241ea6 Fix interpolation in multiline strings
Fix issue #596. The main problem was a `token` annotation instead of a
`regex` in the lexer. Since this bug was preventing the corresponding
code path in the lexer to not be triggered, this patch also fixes a few
other small issues that appeared along the way. Bump the `logos`
dependency and add a regression test as well.
2022-02-04 22:23:31 +01:00
Avi Dessauer
a6f653111b Disable record benchmarks 2022-01-10 15:24:31 -05:00
Avi Dessauer
ac3570cd49 Add explanatory comment + remove debug symbols from release profile 2022-01-04 13:40:34 -05:00
Avi Dessauer
a9a0e58c53 Fix bad merge 2022-01-03 11:11:47 -05:00
Avi Dessauer
5f22ff51ab
Merge branch 'master' into avi/24gb-benchmarks-are-better-than-none 2022-01-03 11:06:38 -05:00
Avi Dessauer
81cca83008 This change allows the criterion-compare-action to pass
It needs to be merged prior to #529
2022-01-01 00:02:06 -05:00
Avi Dessauer
f6f1395a5f Fix: save-baseline 2021-12-31 20:23:59 -05:00
Avi Dessauer
b3e4106a8d Fix church bench 2021-12-31 13:59:10 -05:00
Avi Dessauer
4462cbb57e Disable OOM bench 2021-12-03 13:08:34 -05:00
Avi Dessauer
d580c32d7d Merge branch 'avi/benches-and-flamegraphs-reset' into avi/benches-and-flamegraphs-master-2021-12-03 2021-12-03 11:35:22 -05:00
Yannik Sander
b7c6841375 Update codespan library, downgrade lsp-types
codespan_lsp is to-date not compatible with lsp-types >0.88
lsp_types is already at 0.91
codespan_lsp has already updated the bounds upstream but did not not
yet update on crates.io
2021-11-04 10:49:12 +01:00
Litchi Pi
7da57efeb3 repl: Adding a --history-file option to provide history persistence
Implement feature request #428

Signed-off-by: Litchi Pi <litchi.pi@protonmail.com>
2021-11-03 16:41:35 +01:00
Yann Hamdaoui
3de53703d7 Fix cargo install error for lsp
Cargo install failed because the minimad dependency was duplicated, and
made an import ambiguous (it was both in Cargo.toml and imported by
termimad). Took the occasion to update other dependencies.
2021-10-29 14:24:12 +02:00
regnat
fccb2668b2 Update termimad
Fix #415 as the new version provides a style that seems to work great
both on light and dark backgrounds
2021-10-06 16:42:50 +02:00
Yannik Sander
87cf5827af Clean up cargo files 2021-09-24 17:14:24 +03:00