Commit Graph

54 Commits

Author SHA1 Message Date
John Bartholomew
67968688d9 release: prepare to release v0.21.0 2025-05-07 16:12:02 +01:00
John Bartholomew
2a3f4afd6a release: prepare to release v0.21.0-rc2 2025-03-12 23:42:07 +00:00
John Bartholomew
5b5bcd566a release: prepare to release v0.21.0-rc1
This updates embedded version numbers, and also updates the
C++ jsonnet dependency to the published v0.21.0-rc1 (source release).
2025-02-22 23:18:43 +00:00
Dominik Süß
6838b0a0b8
feat: add debugger support (#739) 2024-06-09 15:09:24 +01:00
Dave Cunningham
7903819abf
Bump version to 0.20.0 (#688) 2023-04-17 20:44:57 +01:00
Dave Cunningham
c298238534 Bump version to v0.19.1 2022-10-27 20:58:41 +01:00
Dave Cunningham
ec039600bc Update version to v0.19.0 2022-10-26 20:56:31 +01:00
Jesse
2655afd2bd
memory align structs (#635)
feat: align most structs and add lint rule to enforce struct alignment
2022-10-19 06:19:15 +01:00
Angus Lees
856bd58872 Add 'importbin' statement
Add `importbin` statement.  Similar to `importstr` but the result is
an array of numbers (all integers 0-255).
2022-03-03 22:49:02 +00:00
Dave Cunningham
fb6c700f29 Prepare for v0.18.0 2021-12-21 18:34:50 +00:00
Hanyu Cui
f742f2463e
Allow setting a different output stream than os.Stderr for std.trace (#514)
Allow std.trace output to other streams
2021-02-09 14:44:23 +01:00
gotwarlost
6d6c293079 allow initialization of external and TLA code variables from an AST node.
This allows configuration of a VM with an external code variable that has been pre-parsed into an AST node.
This allows a caller to pre-parse a large object into a node and re-use that for multiple VMs. The cost
of converting the object to an ast.Node is incurred only once by the caller as opposed to having this
eagerly incurred (whether or not the object is used) before the eval.
2021-02-04 12:05:09 +01:00
Krishnan Anantheswaran
8a3fcc0302
Allow reset of ext and TLA vars for VM reuse (#509)
Allow reset of ext and TLA vars for VM reuse

Currently ext and TLA vars can be set but not reset. This makes
re-using VMs that have different variables impossible.

Add VM methods to be able to reset ext and TLA vars
2021-02-03 22:55:13 +01:00
Stanisław Barzowski
0d1d4cb812 Release 0.17.0 2020-11-22 15:45:52 +01: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
Varun B Patil
2e346e53e7 jsonnet-deps: Jsonnet static dependency parser
Fixes #833
2020-08-08 19:59:36 +02:00
Stanisław Barzowski
d1c1457520 Release v0.16.0 2020-05-22 19:13:53 +02:00
Stanisław Barzowski
70a6b3d419 Release 0.15.0. 2020-02-09 23:57:46 +01:00
Alexander Petrov
d8f0505fc9 Implemented python gojsonnet get_version 2019-12-19 18:09:09 +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
Stanisław Barzowski
fbde25be21 Release v0.14.0 2019-09-16 16:15:48 +02:00
Stanisław Barzowski
e6c74ca7a6 Address review comments 2019-08-28 20:16:47 +01:00
Stanisław Barzowski
82f949e7fe Extract AST processing to separate packages
Making it independent from the jsonnet package breaks the circular
dependency during stdast generation.
2019-08-28 20:16:47 +01:00
Stanisław Barzowski
11e63b6703 Make golint happy (#296) 2019-07-24 13:02:12 -04:00
Dave Cunningham
0d560aff58 Update for version v0.13.0 2019-06-03 18:46:24 +01:00
Stanisław Barzowski
aa47869bc4 Add basic tests for Children and add missing cases 2019-03-20 10:23:24 -04:00
Alexandre Bourget
ce90e53336 Expose Evaluate functions, to be able to reuse the AST from SnippetToAST.
Right now, SnippetToAST provides a `Node` but nothing consumes it it seems.
2019-03-11 12:03:15 -04:00
Stanisław Barzowski
9348a5d2b1 Update cpp-jsonnet submodule and stdlib
Current go-jsonnet is not really 0.12.1 - it even
reports 0.12.0. This brings all the good stuff
from recent cpp-jsonnet commits and actually syncs
the version.
2019-03-04 09:45:11 -05:00
Dave Cunningham
493c45a403 Update cpp-jsonnet and bump version to 0.12.0 2018-12-18 14:32:59 -05:00
Dave Cunningham
6144c57d2a Update cpp-jsonnet & bump version 2018-07-19 16:09:27 -04:00
Luke Granger-Brown
643210d274 Add string output support for multifile output (#220)
* Add test support for multi-file output.

* Add -update support for multi-file output tests.

* Add support for string output in multi-file output mode.

* Rename 'stringOutput' to 'stringOutputMode' to better express what it does

* Refactor main_test to make it less nested.

This also causes the -update flag to output a list of files which
have been updated. This does not include the paths which are deleted
for multi-file tests.
2018-05-09 11:49:07 -04:00
Dave Cunningham
dfddf2b4e3 Update version 2018-03-16 22:34:36 -04:00
Marcelo Cantos
ed5f280c59 Apply golint recommendations (#196)
* Apply golint recommendations
2018-02-26 14:12:25 -05:00
Stanisław Barzowski
5fc25a6e75 Remove unnecessary type alias 2018-01-12 14:26:54 -05:00
Daniel Theophanes
83abda5985 jsonnet: fix docs, correct EvaluateSnippetMulti
EvaluateSnippetMulti comment was copied from another function by mistake.
Add a space between the license and the package name.
Add a few periods after the comments.

Fixes google/go-jsonnet#160
2017-12-13 18:09:05 -05:00
Daniel Theophanes
691e8d4f3c Remove unused dependencies
The imports in "_gen.go" were not used, compiled, or
apparently useful so remove.

The color field in the ErrorFormatter was never set
to true and never used. This brought in many unused
dependencies including x/sys/unix that aren't ever
used. Move the color dependencies to the jsonnet main
package and set the colorized output there. Turn the
exported ErrorFormatter into an interface. In the future
it could be used to export JSON or HTML output.

Fixes google/go-jsonnet#131
2017-12-12 00:05:28 -05:00
Liang Mingqiang
aeda6138e5 experiment dump ast to source code (#101)
* Add facility to dump part of Go heap as Go code.

* Generate stdlib AST as Go code

* Use hardcoded stdlib AST instead of parsing it
2017-11-07 23:31:11 -05:00
Dave Cunningham
c60056c75f
Feature-complete commandline interface (#138)
* Feature-complete commandline interface
* Make errors match cpp implementation
2017-11-03 22:00:30 -04:00
Dave Cunningham
f965f9ee04
For compatability, emit the \n within the library, not the cmd (#137)
* For compatability, emit the \n within the library, not the commandline tool
* Also add manifestString to library
2017-10-29 21:41:01 -04:00
Dave Cunningham
e8f6d25f61 Add Version() 2017-10-25 20:19:19 -04:00
Dave Cunningham
968ae23435 Make NativeFunction members public (#135)
* Make NativeFunction members public
2017-10-24 23:00:40 -04:00
Alex Clemmer
52d2fdcfde Rename jsonnet.nativeFunction -> jsonnet.NativeFunction
Currently, `jsonnet.VM#NativeFunction` takes a single argument of type
`jsonnet.nativeFunction`. This is ok for internal use, but because this
type is private to the `jsonnet` package, it is not possible for a
third party to call this function (since it can't instantiate the type).

This commit makes this type public to remedy this problem.
2017-10-24 21:53:52 -04:00
Stanisław Barzowski
ed281bc563 Support for native callbacks 2017-10-13 15:49:06 -04:00
Stanisław Barzowski
2db3d1c3cc TLA support 2017-10-12 20:00:45 -04:00
Stanisław Barzowski
0c43340142 Support for import callbacks
It was already there, it was a matter of exposing it in the API
2017-10-10 00:31:02 -04:00
Stanisław Barzowski
f0f70419f8 Clean up some TODOs
Some were stale, some were transformed into issues, some were fixed
2017-10-05 22:13:09 -04:00
Stanisław Barzowski
a4058fc177 Support for stack trace size limit 2017-10-05 03:31:16 -04:00
Stanisław Barzowski
c3459153df Location, error formatting and stack trace improvements (#59)
* Location, error formatting and stack trace improvements

* Static context for AST nodes
* Thunks no longer need `name`
* Prototype for showing snippets in error messages (old format still
available)
* Use ast.Function to represent methods and local function sugar.
* Change tests so that the error output is pretty
2017-10-03 14:27:44 -04:00
Stanisław Barzowski
78b4794523 Object comprehensions 2017-09-27 18:00:30 -04:00
Alex Clemmer
0d716ae56f Move parser to its own package 2017-08-25 00:30:56 -04:00