555 Commits

Author SHA1 Message Date
Kohei Suzuki
35acb29ff8 Add format APIs to C bindings 2020-11-26 19:23:49 +01:00
Kohei Suzuki
57e6137c93 Support creating VMs from multiple threads in C-bindings
Since all VM instances are managed by a global map, read/write of the
global map must be protected by a mutex.
2020-11-23 19:18:40 +01:00
Stanisław Barzowski
0d1d4cb812 Release 0.17.0 v0.17.0 2020-11-22 15:45:52 +01:00
Stanisław Barzowski
5c08e370d3 Fix missing stack trace entry for assertions.
Fixes #467
2020-11-21 18:31:58 +01:00
Stanisław Barzowski
372c2ad732 Release GIL in Python bindings.
We apply the same changes as:
https://github.com/google/jsonnet/pull/814
2020-11-21 18:00:35 +01:00
Stanisław Barzowski
4f527c6f96 Add support for missing functions in C-bindings.
With this change we cover 100% of the C API.
2020-11-21 17:34:25 +01:00
Stanisław Barzowski
797bfd89ed Better handling of stack traces.
Fixes multiple issues with stack traces leading to missing
stack trace lines. Also, we no longer put builtin context
on the line which *calls* the builtin as if it was a part
of the builtin itself.

Code for stack trace handling was centralized. We no longer
need traceElement argument in ~every function. Now the stack
trace state is kept solely in the interpreter.
2020-11-21 15:36:05 +01:00
Stanisław Barzowski
e120148a45 Add a short script for updating cpp-jsonnet. 2020-11-21 15:26:25 +01:00
Stanisław Barzowski
2bc774a030 Update cpp-jsonnet. Stop changing cpp-jsonnet version in tests.sh. 2020-11-21 15:10:43 +01:00
Stanisław Barzowski
fe28095772 Support for array comparison 2020-10-30 20:42:46 +01:00
Zhongpeng Lin
eced33e88b Using cpp_jsonnet as external repo 2020-10-30 19:45:27 +01:00
Stanisław Barzowski
570101d43c Desugar locals in object comprehension.
Desugar the locals in object comprehensions
"traditionally" instead of handling them manually.

Object comprehensions allow the locals to depend
on the index variable which means that they are separate
for each field. It doesn't make sense to treat them as
a property of the whole object.

Fixes #358.
2020-10-22 14:54:50 +02:00
Sargun Dhillon
6967a29721 Add debian package build to goreleaser
This makes the goreleaser output two debian packages. One for jsonnet,
and another for jsonnetfmt. Since we don't use cgo, we don't need to
take dependencies, as we're fully statically linked. The package
name for this package will be jsonnet-go, and jsonnetfmt-go. There
is a package that Ubuntu has released that's based on the C++
version. We have a conflict statement with it in order to
avoid people installing both.

We can ask the C++ package to rename itself to jsonnet-c++, and then
add a provides for the package name jsonnet. The reason to not name
this jsonnet immediately, even though the Go version if meant to
supercede the C++ version, is that this doesn't fully implement the
C++ version (for example, man pages).
2020-10-05 20:40:24 +02:00
Stanisław Barzowski
755ee1ee88 Change CI settings to use the latest release, but not the tip. 2020-10-05 20:39:32 +02:00
Stanisław Barzowski
b70cbd441a Anonymous Import Locations
We used to treat dummy paths like <stdin>, <std>, <extvar> as
real import locations, which causes obvious problem for importers.

After this change we consistently pass "" (an empty string) as location
for non-imported paths.

We exposed new functions to properly handle all paths.

The first function family, EvaluateFile* which allow evaluating
a Jsonnet program at a specified importable path. It should
be used in most cases.

The second function family, EvaluateAnonymousSnippet* allows evaluating
a snippet without an importable path. It should be used for situations
like the code passed as a commandline argument, stdin, etc.

The old function family, EvaluateSnippet* is now deprecated, but
works the same as before, i.e. the passed filenames are treated
as imported paths.

Changes are required to custom importers to make sure they satisfy
the refined contract.

Fixes #329.
2020-09-08 17:27:47 +02:00
Stanisław Barzowski
8fcbda5b50 Linter 2020-08-13 21:06:34 +02:00
Varun B Patil
2e346e53e7 jsonnet-deps: Jsonnet static dependency parser
Fixes #833
2020-08-08 19:59:36 +02:00
Paul Rudin
a631234631 add action to build binaries with goreleaser 2020-08-08 18:31:51 +02:00
Alexander Petrov
6a41464c6d issue-433 Address review comments: avoid indexing the map twice 2020-08-01 10:55:42 +02:00
Alexander Petrov
fc188d008d issue-433 avoid keeping all the allocated handles forever by using map
and uintptr of the allocated object.
2020-08-01 10:55:42 +02:00
Alexander Petrov
db2bf1e024 issue-433 increase the number of constructed Jsonnet handles. 2020-08-01 10:55:42 +02:00
Stanisław Barzowski
a1f3af26dc Support strings in the builtin std.flatMap.
Fixes #438.
2020-07-28 19:50:22 +02:00
Benoit Gagnon
0856640baf Fix std.manifestJsonEx parameter names
documented as "value" and "indent" in the standard library reference
2020-07-17 21:36:14 +02:00
Stanisław Barzowski
aaf50f5b65 Update project status in README.md 2020-07-03 17:34:29 +02:00
Stanisław Barzowski
0dd210d4a5 Sync cpp-jsonnet (for #429) 2020-07-02 23:05:04 +02:00
Robert Vollmert
9e6b0d15b7 jsonnetfmt --help: Indent subsection and break long lines
For consistency of the formatting changes to jsonnet --help.
Minor phrasing and punctuation changes for consistency.
2020-07-02 23:04:34 +02:00
Robert Vollmert
678df37686 jsonnet --help: align consistently, break long lines
This fits the help text into 80 columns.
2020-07-02 23:04:34 +02:00
Robert Vollmert
e71d28e7c2 jsonnet --help: separate sections more clearly 2020-07-02 23:04:34 +02:00
Weston McNamee
d767ab7bf5 fix(stdlib): 🐛 manifestJsonEx was escaping HTML
minimal repo: https://play.golang.org/p/GQBNMe6k_nm

https://stackoverflow.com/questions/28595664/how-to-stop-json-marshal-from-escaping-and\nminimal

fix proof: https://play.golang.org/p/SJM3KLkYW-

resolves #423
2020-06-13 21:59:31 +02:00
Weston McNamee
3563a21847 perf(stdlib): ️ implement manifestJsonEx as native Go
❯ make benchmark FILTER=Builtin_manifestJsonEx
go build ./cmd/jsonnet
./benchmark.sh Builtin_manifestJsonEx
Running Before Test... (10s)
Running After Test... (10s)
benchmark                               old ns/op     new ns/op     delta
Benchmark_Builtin_manifestJsonEx-16     22656394      7502016       -66.89%
2020-06-13 19:53:42 +02:00
Alexander Petrov
3bd1fb82ba
Throw an error on negative shifts (#421)
Throw an error on negative shifts
2020-06-12 20:42:02 +02:00
Stanisław Barzowski
d1c1457520 Release v0.16.0 v0.16.0 2020-05-22 19:13:53 +02:00
Stanisław Barzowski
2824579c7d Update cpp-jsonnet 2020-05-22 14:54:20 +02:00
Stanisław Barzowski
f3873a7495 Fix duplicated fodder (#411).
CommaFodder was not cleared between arguments,
so when there was no commaFodder and the argument
was named a previous one was duplicated.

Fixes #411.
2020-05-22 11:31:30 +02:00
Stanisław Barzowski
e57db6b9a4 Use the official installation method for golangci-lint. 2020-05-22 11:24:03 +02:00
Ian Woloschin
e2cd7168a6 Add necessary files to MANIFEST.in 2020-05-22 11:04:38 +02:00
Stanisław Barzowski
8a0084e643 Remove depreacted Bazel option for CI 2020-04-15 14:29:41 +02:00
Frank Blechschmidt
bedbae2e6c Add Homebrew install instructions 2020-04-15 10:26:02 +02:00
Mike Danese
b2dbc0c524 fix order-dependent test
TestSdumpLargeDefinition is depnding on a global state change in
TestSdumpReusedPointers. It can't pass if it runs in the wrong order.

Fixes internal auto-filled bug.
2020-04-02 21:59:03 +02:00
sh0rez
4f4aa80dd7 feat(api): expose formatter
Exposes what I consider a good public API from the `internal/formatter`
package.

Having a go-native formatter is an awesome thing, especially because it
allows shipping the formatter as part of other projects. It's also fair
to keep the formatter's code in `internal`, yet third party projects
should have a way to use relevant parts of it.
2020-03-31 20:43:25 +02:00
Ricardo Amaro
6f135f75bc Remove bindings debug msg 2020-03-19 16:51:44 +01:00
Stanisław Barzowski
3a245f70d4 Preparation for linter.
* Extract some test utilities to a separate package.
* Rename some test utilities.
* Internally expose DirectChildren.
* Add LocationRange to some non-expr AST parts,
  such as local binds, parameters and object fields.
* Add end-of-file-reached testcases.
2020-03-15 14:38:40 +01:00
Dave Cunningham
724650d358
Add native golang formatter (#388)
Add native golang formatter
2020-03-10 22:19:49 +00:00
Stanisław Barzowski
234b97cd9c Enforce no golangci-lint warnings in CI 2020-03-05 14:54:27 +01:00
Stanisław Barzowski
9ada769ce4 Make golangci-lint happy
Some of the suggestions are minor bug fixes (missing error handling).
2020-03-05 14:54:27 +01:00
Dave Cunningham
803ad646cb Refactor parseParameter to return ast.Parameter 2020-03-05 09:33:21 +01:00
Dave Cunningham
5476fefb25 Add ParseParameter. Also fell down the rabbithole improving content and consistency of parse errors 2020-03-05 09:33:21 +01:00
Dave Cunningham
ce07c7fb8b Allow positional params after optionals 2020-03-05 09:33:21 +01:00
Dave Cunningham
0e67cc3c68 Refactor to allow interleaving optional and positional params 2020-03-05 09:33:21 +01:00
Stanisław Barzowski
7cad41e894 [Bindings] Fix compatibility issue with C import callback api 2020-03-02 11:57:27 +01:00