Commit Graph

36 Commits

Author SHA1 Message Date
Dave Cunningham
df7753e2c7 Bring up-to-date with cpp version 2019-05-22 20:43:37 +01:00
Dave Cunningham
6fa1db7d85 Update cpp submodule 2019-05-16 10:12:09 +01:00
Stanisław Barzowski
33b6dcfa53
Keep object locals only once in AST (#263)
Keep object locals only once in AST

For example this reduces the size of stdlib ast file
roughly 3x. Note that this change doesn't regenerate the stdlib,
so that the diff here is sane.

It is likely to slightly improve performance of code using
a lot of locals (~10% on bench.05.gen.jsonnet).

The desugaring is more strightforward now, and we're back
to desugaring each node exactly once.
2019-05-07 22:43:55 +02:00
Stanisław Barzowski
c195e570ef Share std.jsonnet with cpp-jsonnet
So far `std.jsonnet` needed to be updated seprately from
the cpp-jsonnet submodule. Since we should update it anyway
at the same time (to make sure the tests are running fine),
we can just as well get it directly from there, eliminating
the extra step of copying the new `std.jsonnet` version.

This change updates the cpp-jsonnet used.
2019-04-16 20:35:19 +02: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
Stanisław Barzowski
7012604878 Update stdlib 2018-12-12 21:01:20 +00:00
Dave Cunningham
95e1c1790a
Lex fodder in a manner compatible with C++ (#231)
* Lex fodder in a manner compatible with C++
2018-06-11 14:40:28 -04:00
Dave Cunningham
d9b833b8a0
Bump C++ version, implement std.trace, fix parsing of -$, update std (#224) 2018-05-23 22:24:12 -04:00
Roger Peppe
fde815f6a1 godoc.org-compatible ast package
Change the dump code so that it hides the values of variable
definitions if they're large. This means that godoc.org should
be able to deal with the output, and the godoc output is
readable without needing to read through a huge struct literal definition.

Other approaches might be to always generate an extra variable
(seems unnecessary) or to pass to writer explicitly to the dump
methods rather than swapping s.w out temporarily. The former
seems unnecessarily intrusive to the usual output; the latter
seemed unnecessarily intrusive to the source itself.
YMMV.
2018-04-12 14:06:52 -04:00
Dave Cunningham
0b46b25f0f Update to cpp jsonnet 2018-03-16 22:20:53 -04:00
Dave Cunningham
6efde9677d Handle base case of cloneForSpec 2018-03-15 13:56:17 -04:00
Dave Cunningham
405726fae2
Clone ASTs to avoid aliasing and double-unescaping (#210)
* Clone ASTs to avoid aliasing and double-unescaping
2018-03-07 11:23:32 -05:00
Dave Cunningham
5cc426ed04 Bring submodule and stdlib to cpp master 2018-03-06 23:49:02 -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
Stanisław Barzowski
44770e75dd Add std.sign and fix division by zero in stdlib 2018-02-21 20:31:04 -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
Dave Cunningham
741f9f06a2 Update stdlib and ||| fix 2018-01-23 23:26:28 -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
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
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
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
0b52ea4d40 Support for various kinds of strings in imports 2017-09-29 12:34:21 -04:00
Stanisław Barzowski
0c86c9e109 Support of +:, in, in super
Also profiling
2017-09-28 22:21:46 -04:00
Stanisław Barzowski
78b4794523 Object comprehensions 2017-09-27 18:00:30 -04:00
Stanisław Barzowski
999ff267f1 Remove unused autogenerated code 2017-09-12 17:10:36 -04:00
Stanisław Barzowski
c26c50c04b Array comprehensions (#35)
* Array comprehensions

Implemented using flatMap.

The representation in AST was changed - now it expresses
the semantic structure better.

Ifs in comprehensions are not supported yet, but easy.
2017-09-07 11:55:33 -04:00
Stanisław Barzowski
77b8b9e335 Optional args parser/lexer/ast support (#33)
* Optional args parser/lexer/ast support

Just "frontend" part. They are ignored during actual execution.
2017-09-06 11:53:10 -04:00
Stanisław Barzowski
b1427d563b Parser & desugarer support for "in" 2017-08-29 22:14:12 -04:00
Alex Clemmer
ad56a074aa Move AST to its own package 2017-08-25 00:30:56 -04:00