555 Commits

Author SHA1 Message Date
Dave Cunningham
7c8f4d0b12
Call top level function even if there are no TLAs (match cpp semantics) (#169)
* Call top level function even if there are no TLAs (match cpp semantics)
2018-01-10 20:43:55 -05:00
Cam Hutchison
c7a5b68f1c Add test case for native function returning error
A native function returning an error should be reported as a runtime
error, with a stack trace.
2017-12-18 10:22:53 -05:00
Stanisław Barzowski
de6b2b8a55 Make errors in native functions runtime errors
Instead of crashing with internal error
2017-12-18 10:22:21 -05:00
Stanisław Barzowski
c3551f4f61 Basic refactoring - towards shared e2e tests 2017-12-14 17:48:34 -05:00
Stanisław Barzowski
8ade994928 Efficient native implementation of std.join
It changes the behavior slightly - mixing strings
and arrays in join is no longer allowed.
2017-12-13 18:09:56 -05:00
Dave Cunningham
3481c9c698 Add JSONNET_PATH (go version) 2017-12-13 18:09:32 -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
Stanisław Barzowski
f7eea3b545 Native implementation of std.range 2017-12-08 17:17:17 -05:00
Cam Hutchison
219d970ba0 jsonnet: Fix --output-file command line option
The long option --output-file was not working, due to what looks like a
cut and paste error, leaving --exec as the string to test for.
2017-12-08 15:34:11 -05:00
Dave Cunningham
fe6a54abaf Justify \/ escape 2017-12-07 21:05:26 -05:00
Dave Cunningham
dfc9428ac7 refactor import callback to separate error from return value 2017-11-24 20:32:46 -05:00
Dave Cunningham
c65317e03f Make fields of ImportedData public 2017-11-24 20:32:46 -05:00
Kuat Yessenov
ec5b07c45a Expose MemoryImporter data
Signed-off-by: Kuat Yessenov <kuat@google.com>
2017-11-15 22:38:13 -05:00
Liang Mingqiang
8f568c1115 remove escLocalFS (#150)
* remove escLocalFS

* update README
2017-11-10 09:55:22 -05:00
Liang Mingqiang
395102359b fix go vet error (#151) 2017-11-10 09:53:40 -05:00
Stanisław Barzowski
03e2a7f474 Fix bad format string (#149) 2017-11-09 08:56:06 -05:00
Liang Mingqiang
ce84685fb0 Sort FreeVariables slice (#148)
* sort FreeVariables slice

* regenerate the standard library AST
2017-11-09 08:55:36 -05:00
Dave Cunningham
b04e73e163 Fix unparsing of enums, avoid static type error 2017-11-08 11:28:38 -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
b6ee2c2f51
String token end location off-by-one error (#139)
* String token end location off-by-one error
2017-11-03 21:36:31 -04:00
Dave Cunningham
d753072f4e
Stdlib go generate (#144)
* run go generate for new stdlib
2017-11-03 00:56:08 -04:00
Dave Cunningham
e72d930647
update stdlib (#143) 2017-11-03 00:46:13 -04:00
Dave Cunningham
fd1eaa9e36
tell tests which implementation we are using (#142) 2017-11-03 00:41:40 -04:00
Dave Cunningham
dbc7fb3dc2
search jpaths from right to left, compatibility with cpp (#140) 2017-11-03 00:33:43 -04:00
Dave Cunningham
4356f42578
max_trace==0 means no trace limit (#141) 2017-11-03 00:33:31 -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
3eaf189897 Allow bitwise operations on floats, according to Spec (and Javascript behavior) 2017-10-26 20:26:16 -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
10d377f068 [WIP] Disallow floating point indexing (waiting for #116) 2017-10-14 00:49:04 -04:00
Stanisław Barzowski
bb8d424f73 Add previously forgotten tests 2017-10-13 19:55:24 -04:00
Dave Cunningham
5ff7ee047d Update README.md 2017-10-13 19:55:06 -04:00
Dave Cunningham
f3cb9eb8cf Rename 'ast' variable that shadowed package name. 2017-10-13 17:03:01 -04:00
Stanisław Barzowski
ed281bc563 Support for native callbacks 2017-10-13 15:49:06 -04:00
Stanisław Barzowski
96a2abc46c Some initial test metadata
It will be useful for properly testing TLAs, import callbacks etc.
2017-10-13 15:34:00 -04:00
Stanisław Barzowski
5c946dfb76 Eliminate duplication in builtin names
Actually there was one (objectFieldEx) that was inconsistent, i.e.
it was available by a different name from what appeared in the stack
trace. This is now fixed.
2017-10-13 15:33:34 -04:00
Stanisław Barzowski
0f049eaa38 Basic tailstrict support 2017-10-13 15:33:23 -04:00
Stanisław Barzowski
2db3d1c3cc TLA support 2017-10-12 20:00:45 -04:00
Stanisław Barzowski
171cdd67f9 Post-rebase fix
Dead code removed in one branch, ended up being used in another.
2017-10-10 18:57:58 -04:00
Stanisław Barzowski
4b0735826d Rename valueSimpleObjectField -> simpleObjectField
A field on it's own is not a value
2017-10-10 00:31:49 -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
5b1798233c Represent types as Go objects, not strings (give them pointer identity) (#119)
Faster comparisons and IMO cleaner feeling overall.
It doesn't affect behaviour in any way.
2017-10-10 00:11:36 -04:00
Stanisław Barzowski
4a4a7fe459 Check index types (#116)
Before it would just crash
2017-10-10 00:09:32 -04:00
Stanisław Barzowski
ba0f236b14 Optional eval (#92)
* Optional arguments
2017-10-10 00:06:14 -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
02a4eed22d Support $ in comprehesions, fixes #68 2017-10-03 19:51:01 -04:00