555 Commits

Author SHA1 Message Date
Dave Cunningham
8b2b1ba839 Avoid float overflow errors at parse time. 2020-02-27 23:06:53 +00:00
Alexander Petrov
413234ce49
Replace setup.py test with pytest command (#380)
Replace `setup.py test` with pytest command
2020-02-20 10:37:39 +01:00
Alexander Petrov
e6572f5083 Compile package in 32-bit mode 2020-02-18 10:32:37 +01:00
Robert-André Mauchin
f5778853ed Prevent int overflow
Fix #376
2020-02-14 08:18:22 +01:00
Stanisław Barzowski
31b9ace0f6 Remove old release mechanism from Travis 2020-02-10 00:28:17 +01:00
Stanisław Barzowski
70a6b3d419 Release 0.15.0. v0.15.0 2020-02-09 23:57:46 +01:00
Stanisław Barzowski
425405da78 Update cpp-jsonnet. 2020-02-09 23:57:46 +01:00
Stanisław Barzowski
a7af40a87e Remove files which are no longer relevant 2020-02-09 14:59:31 +01:00
Stanisław Barzowski
07fa4c037b Run tests on other CPU architectures (arm64, ppc64le). 2020-02-02 17:52:52 +01:00
Stanisław Barzowski
5976644a3b Introduce tolerance in tests of numeric functions.
There are slight differences across CPU architectures which we cannot
avoid. These should have no practical consequences for the users.
2020-02-02 17:51:42 +01:00
Stanisław Barzowski
03f5ad2dc0 Add explicit bounds checks for bitwise operators 2020-02-02 13:28:29 +01:00
Wes McNamee
399a61ca31 feat: improve std.base64Decode performance 97%+ (#346)
feat: improve std.base64Decode performance 97%+

Provides a Go-native implementation of std.base64Decode and std.base64DecodeBytes

benchmark                                  old ns/op       new ns/op     delta
Benchmark_Builtin_base64Decode-16          10946388307     25004135      -99.77%
Benchmark_Builtin_base64DecodeBytes-16     6420742757      181513016     -97.17%

related to #111
2020-01-27 14:31:45 +01:00
Wes McNamee
e8bd3f4ff8 feat: improve stdlib base64 performance by 98.58%+
Implements std.base64 in native Go, improving performance

benchmark                                 old ns/op       new ns/op     delta
Benchmark_Builtin_base64-16               10805730974     23158636      -99.79%
Benchmark_Builtin_base64_bytearray-16     8682808704      123360964     -98.58%
2020-01-27 09:40:21 +01:00
Stanisław Barzowski
492503d13b Fix formatting 2020-01-26 22:21:59 +01:00
Wes McNamee
3b580145f4 feat: improve std.reverse performance by 73.39%
Implements std.reverse in native Go, improving performance

benchmark                        old ns/op     new ns/op     delta
Benchmark_Builtin_reverse-16     869191619     231309458     -73.39%

part of #111
2020-01-26 22:11:59 +01:00
Weston McNamee
27b4c60bc7 feat: Improve performance of substr by 84.44%
This pulls in the implementation of substr into native Go instead of interpretted Jsonnet.

benchmark                       old ns/op     new ns/op     delta
Benchmark_Builtin_substr-16     97121527      15115905      -84.44%

part of #111
2020-01-26 09:20:58 +01:00
Weston McNamee
9518d4c520 feat: Install extra dependencies
related to #235
2020-01-25 07:45:07 +01:00
Wes McNamee
599addaa03 fix: Typos in travis.yml 2020-01-25 07:45:07 +01:00
Wes McNamee
4573374093 test: Add additional go versions to travis 2020-01-25 07:45:07 +01:00
Wes McNamee
9ba4b2ac86 test: Run Make Checks for all versions 2020-01-25 07:45:07 +01:00
Wes McNamee
d28d7d79af test: add Make Check to Travis 2020-01-25 07:45:07 +01:00
Wes McNamee
99980ef423 feat: add asdf integration for bazel
Add support for asdf-managed versions of bazel

https://github.com/asdf-vm/asdf
2020-01-25 07:45:07 +01:00
Weston McNamee
16dc50b566 feat: add Makefile
This streamlines and simplifies local development by adding
a Makefile based on the commands in the README.md
2020-01-25 07:45:07 +01:00
Carlos Cobo
e90ff27a27 Fix git clone in build instructions 2020-01-22 11:08:43 +01:00
Stanisław Barzowski
fe82a78401 Adaptive string representation
When adding long strings, don't copy them immediately. Instead
build long strings only when their contents are requested.

This allows to build a long string from parts, using a regular
operator+ in linear time. This lets users to worry much less
about using std.join etc.

If indexing the string is mixed with building it using operator+
the behavior can still be quadratic. We may want to address it in
a later change.
2020-01-04 23:28:21 +01:00
Stanisław Barzowski
b44e63e102 Bump officially supported Go version to 1.11
Go 1.8 has been unsupported for more than a year.
2019-12-20 15:48:45 +01:00
Alexander Petrov
4b0052a9e3 Python package now is called _gojsonnet for avoiding package collision 2019-12-19 18:09:09 +01:00
Alexander Petrov
f3b46ad15c Code review: fixed comments 2019-12-19 18:09:09 +01:00
Alexander Petrov
d8f0505fc9 Implemented python gojsonnet get_version 2019-12-19 18:09:09 +01:00
Alexander Petrov
741eec05fe Added python tests CI 2019-12-19 18:09:09 +01:00
Alexander Petrov
3be91c4752 Changed python package name to gojsonnet 2019-12-19 18:09:09 +01:00
Alexander Petrov
441e4cc581 Use backed by go-jsonnet for python extension 2019-12-19 18:09:09 +01:00
Dave Cunningham
0959f85501 break up parseObjectRemainder 2019-11-06 19:46:26 +00:00
Dave Cunningham
407c0f311a Fix #331 missing comma error 2019-10-16 22:15:28 +02:00
Alexander Petrov
acf0e5cfbf Implemented jsonnet_import_callback c-binding (#330)
Implemented jsonnet_import_callback c-binding
2019-10-14 20:49:24 +02:00
sh0rez
42cb19ef24 feat(parser): export parser.Children (#327)
* feat(parser): export parser.Children

As parser was moved to internal/parser, it is not possible to import it into
external projects anymore.

However, parser.Children() is handy to use in static analysis tools, so it is
worth exporting. This does that by adding a stub package
`github.com/google/go-jsonnet/parser` that wraps the internal function.

Signed-off-by: sh0rez <me@shorez.de>
2019-10-06 22:38:37 +02:00
Alexander Petrov
56da397819 Code review fixes: Removed unnecessary vm handle checks 2019-10-06 21:20:15 +02:00
Alexander Petrov
4abec72f46 Code review fixes:
* Renamed jsonValue obj field to val
* Renamed jsonValue children field to owned + added an explicit comment about this field
* Got rid of unnecessary vm handle checks
* Renamed arg to param, identifiers to paramNames
* Raised maxID value to 100 000
* Removed freedIDs entry check
2019-10-06 21:20:15 +02:00
Alexander Petrov
3504d5001e Removed ';' in compat_test 2019-10-06 21:20:15 +02:00
Alexander Petrov
ba37440e4f * Added more tests on native callback
* Fixed jsonnet_json_array_append, jsonnet_json_object_append bugs
* jsonValue now stores the list of related struct_JsonnetJsonValue
instead of handles ids
2019-10-06 21:20:15 +02:00
Alexander Petrov
6e9943c99d * Implemented jsonnet_native_callback
* Moved handles workflow to handles.go
* Replaced JsonnetJsonValue c++ implementation with go
* Added jsonnet_json_* integration tests
2019-10-06 21:20:15 +02:00
Dave Cunningham
dc5c94ac78
Add fodder to AST nodes (#319)
* Preserve fodder during parsing.
2019-09-24 12:11:22 +01:00
Stanisław Barzowski
21c00f1b9e Better importing (caching & public API)
* It adds new API which allows using VM for importing
  files in external tools "just as Jsonnet would". This is
  primarily intended for use in static analysis tools.
* Imports are now cached between evaluate calls. This may improve
  performance significantly for some users. I would like to add
  some way of achieving this with commandline in the future.
* Additional layer of caching was internally added - AST level.
  This was necessary so that Jsonnet could always return the same
  exact AST when asked multiple times (meaning the same pointers).
2019-09-23 15:37:10 +02:00
alldroll
8f0e634bb6 Disallow unary + on Object 2019-09-23 13:07:05 +02:00
alldroll
f00242da42 Add runtime check for binary +-* operations for numbers 2019-09-19 14:34:14 +01:00
Stanisław Barzowski
fbde25be21 Release v0.14.0 v0.14.0 2019-09-16 16:15:48 +02:00
Stanisław Barzowski
0d5e73c8b0 Check Bazel in Travis 2019-09-11 01:01:01 +02:00
Stanisław Barzowski
ab95594eea Add missing cases in specialChildren
Namely:
1) function body and optional params
2) object locals
2019-09-10 15:41:17 +02:00
Stanisław Barzowski
85fd887750 Unexport a bunch of symbols
Many things were exported for no particular reason.
2019-09-09 16:11:00 +02:00
Stanisław Barzowski
6490cb1973 Builtin implementation for std.sort
Sort is something that is highly optimized in most languages
and users can expect it to be fast. We can piggyback on
the Go implementation.

This change results in 100x speedup on bench.06.jsonnet.
2019-09-09 13:37:12 +02:00