Marcelo Cantos
cf6933d45b
Add C++-Jsonnet submodule for tests ( #202 )
...
* Add C++-Jsonnet submodule for tests
* Add tests.sh to travis-ci
2018-03-06 13:05:00 -05:00
Marcelo Cantos
88519c3704
Apply more golint recommendations ( #201 )
...
* Apply more golint recommendations
* Update dumpstdlibast.go to include StdAst comment
* Improve dump.go package comment.
2018-02-28 01:11:18 -05:00
Marcelo Cantos
ed5f280c59
Apply golint recommendations ( #196 )
...
* Apply golint recommendations
2018-02-26 14:12:25 -05:00
Marcelo Cantos
5ae4798d8d
Clean up token strings
2018-02-25 13:41:11 -05:00
Stanisław Barzowski
44770e75dd
Add std.sign and fix division by zero in stdlib
2018-02-21 20:31:04 -05:00
Petr Krebs
bed2cd89bc
Do not assume that import path is always a filesystem path (do not clean it up)
2018-02-17 16:34:54 -05:00
Dave Cunningham
2ea01b24d8
Introduce a Parens AST ( #189 )
...
* Introduce a Parens AST
2018-02-16 13:01:14 -05:00
Dave Cunningham
f46dea2835
Update std.jsonnet
2018-02-01 14:21:39 -05:00
Stanisław Barzowski
61b33d1a2a
Fast, native implementation of strReplace
2018-01-31 15:27:59 -05:00
Cam Hutchison
d1d9a7f5f8
Convert --tla/ext-*-file to imports
...
Instead of reading the files directly for --tla/ext-*-file, just add a
code snippet that does an import or importstr.
This makes relative imports work when the code-file path is not in the
current directory. It also makes the import lazy so if the arg/var is
not referenced, the file does not have to exist.
Fixes : google/jsonnet#452
2018-01-30 18:22:29 -05:00
Stanisław Barzowski
4406074d47
Add support for memory profiling
2018-01-27 18:44:54 -05:00
Stanisław Barzowski
eeecb7f100
Fix processing the same file many times
...
There was a trivial bug, which disabled caching
of parsed, desugared and analyzed code. So imports
were only cached on data level, not on executable
ast level.
This change will likely result in ~10x speedup
for some users.
2018-01-27 15:09:25 -05:00
Dave Cunningham
741f9f06a2
Update stdlib and ||| fix
2018-01-23 23:26:28 -05:00
Stanisław Barzowski
eedf6760ad
Convert non-string errors to string
2018-01-18 12:48:38 -05:00
Stanisław Barzowski
d6623a98cb
Oldest version known to work = Go 1.8, closes #177
...
It seems like it was broken on older compilers
since pregenerated stdlib AST.
It adds go 1.8.x to travis, so that we have a chance
of catching when our "known to work" no longer holds.
2018-01-18 12:48:20 -05:00
Stanisław Barzowski
d135effbe4
Add missing check for array out of bounds
2018-01-17 15:26:31 -05:00
Yewei Huang
561a986e8e
Remove unnecessary type alias in jsonnet/cmd.go
2018-01-15 21:10:31 -05:00
Stanisław Barzowski
bc88189964
Very basic, experimental linter
...
No tests yet
2018-01-15 21:05:52 -05:00
Stanisław Barzowski
5fc25a6e75
Remove unnecessary type alias
2018-01-12 14:26:54 -05:00
Dave Cunningham
7d821fde83
std.join silently steps over null (match std.jsonnet version)
2018-01-11 09:37:26 -05:00
Stanisław Barzowski
34a24d8bcb
Basic support for running jsonnet command in tests ( #167 )
...
A step towards a unified test suite. In particular this
lets us use C++ version with Go tests. The problem remains
that errors (both static and runtime) may differ between implementations.
This will require special handling. C++ version seems to pass all
"positive" tests. Go version also has this problem (error formatter used in tests is different).
Also native functions etc. are not handled in any way at the moment.
2018-01-10 21:27:44 -05:00
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