Commit Graph

15 Commits

Author SHA1 Message Date
Dave Cunningham
2973e24152
Internal refactor to improve performance (#225)
* Internal refactor to improve performance
2018-06-01 10:52:20 -04:00
Stanisław Barzowski
f4428e6d47 Better Importer interface
As discussed in https://github.com/google/go-jsonnet/issues/190
2018-04-28 01:34:42 -04:00
Marcelo Cantos
ed5f280c59 Apply golint recommendations (#196)
* Apply golint recommendations
2018-02-26 14:12:25 -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
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
Dave Cunningham
dbc7fb3dc2
search jpaths from right to left, compatibility with cpp (#140) 2017-11-03 00:33:43 -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
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
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
b1a9c0bd6d ExtVar support 2017-09-28 23:14:53 -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
Alex Clemmer
ad56a074aa Move AST to its own package 2017-08-25 00:30:56 -04:00
Stanisław Barzowski
5da57ac417 Interpreter & runtime - minimal usable version (#24)
* Interpreter & runtime - minimal usable version

Accomplishments in this commit:
* Majority of language features implemented:
	* Unary operators
	* Binary operators
	* Conditionals
	* Errors
	* Indexing arrays
	* Indexing objects
	* Object inheritance
	* Imports
	* Functions
	* Function calls
* There is a quite nice way for creating builtins
* Static analyzer is there with most of the functionality
* Standard library is included and parts unaffected by missing features
work
* Some bugs in existing parts fixed
* Most positive tests from C++ version pass, the rest is failing mostly
due to missing builtins and comprehensions.
* Some initial structure was created that should allow more incremental
  and focused changes in the future PRs.
* Some comments/explanations added
* Panics translated to a little bit more gentle internal errors (with a
  link to issues on github).

What still sucks:
* Stack traces & error messages (there's some stuff in place)
* Almost everything is in the same package
* Stuff is exported or unexporeted randomly (see above)
* Missing a few lexing/parsing features
* Missing builtins
* Missing support for extvars and top-level-args
* Checking function arguments is missing
* No clean Go API that commandline and compatibility layer to C can use
* No compatibility layer to C
* Assertions don't work (desugaring level, assertEquals works).
* Manifestation stack traces (and generally it could use some work).
* The way environments are constructed is sometimes suboptimal/clumsy.
2017-08-24 20:09:10 -04:00