Commit Graph

526 Commits

Author SHA1 Message Date
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
Stanisław Barzowski
0ec5f40a58 Express at-most-once evaluation (thunk caching) in types 2017-10-03 19:50:12 -04:00
Stanisław Barzowski
94797696a9 Remove commented out code 2017-10-03 15:17:43 -04:00
Stanisław Barzowski
774715b3cf Support for std.thisFile, fixes #91.
Sadly it means that std in no longer the same object in each file.
2017-10-03 15:17:43 -04:00
Stanisław Barzowski
82f213a1e3 Fix tests (after rebase) 2017-10-03 15:17:32 -04:00
Stanisław Barzowski
8b843564bf Support --ext-str and --ext-code options 2017-10-03 14:31:53 -04:00
Stanisław Barzowski
33377907ec Allow all kinds of string literals as object field names 2017-10-03 14:30:32 -04:00
Stanisław Barzowski
80ce6ac112 Don't escape block strings (#98)
* Don't escape block strings
2017-10-03 14:29:12 -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
a1b8248e84 Fix comprehensions (#90)
* Fix comprehensions

Only first and last forspec was used due to a parser bug.
2017-09-29 23:33:55 -04:00
Stanisław Barzowski
df1b805c96 More tests for builtins. 2017-09-29 22:57:31 -04:00
Stanisław Barzowski
ec94dec214 Remove stale TODOs 2017-09-29 12:36:29 -04:00
Stanisław Barzowski
e7249a1131 Separate manifestation from serialization to string
This is necessary for example for native functions
(which take json as arguments).

Standard "encoding/json" representation is used, but I have
mixed feeling about it. Not sure if treating json values as interface{}
is the right trade-off in our case.
2017-09-29 12:36:29 -04:00
Stanisław Barzowski
8628b9b4f9 Remove go:generate causing errors 2017-09-29 12:36:04 -04:00
mqliang
c2229ed262 eliminate ununsed code 2017-09-29 12:35:37 -04:00
Stanisław Barzowski
0b52ea4d40 Support for various kinds of strings in imports 2017-09-29 12:34:21 -04:00
Stanisław Barzowski
121a77c66f Remove a few stale TODOs 2017-09-29 12:32:44 -04:00
Stanisław Barzowski
b1a9c0bd6d ExtVar support 2017-09-28 23:14:53 -04:00
Stanisław Barzowski
0c86c9e109 Support of +:, in, in super
Also profiling
2017-09-28 22:21:46 -04:00
Stanisław Barzowski
93bcf64454 Add tests for std.primitiveEquals 2017-09-27 23:07:33 -04:00
Stanisław Barzowski
544fe25700 Simplistic argument checking
To be expanded when optional arguments arrive.
2017-09-27 22:45:41 -04:00
Stanisław Barzowski
a92b30146a Some placeholders and experiments for C library
We want to provide go version of libjsonnet.
2017-09-27 22:01:29 -04:00
Stanisław Barzowski
78b4794523 Object comprehensions 2017-09-27 18:00:30 -04:00
Stanisław Barzowski
850575cf34 More tests for log and exp 2017-09-26 12:17:08 -04:00
Stanisław Barzowski
650825cd5a Change test file extension 2017-09-22 18:28:02 -04:00
Stanisław Barzowski
97a80b94cd Fix inheritance of hidden fields, closes #70 2017-09-22 18:11:05 -04:00
Stanisław Barzowski
02f86ba308 Fix extenstions of test files (merging order issue) 2017-09-22 18:10:44 -04:00
Stanisław Barzowski
fe62ec46a8 Improve imports (#66)
* Improve imports

* Nonexistent file is now a runtime error (used to be ignored)
* Permission denied is a runtime error (used to be an internal error)
* Basic tests added for imports
* Renamed tests from .input to .jsonnet
	* It's standard
	* It's compatible with C++ test suite
	* Editors enable syntax highlighting based on extension
	* Importing .input looks weird
2017-09-22 18:03:00 -04:00
Stanisław Barzowski
8638a21287 Object invariants (#62)
* Object invariants
2017-09-22 18:02:05 -04:00
Stanisław Barzowski
9047718ad0 Add std.filter 2017-09-22 13:45:52 -04:00