555 Commits

Author SHA1 Message Date
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
Stanisław Barzowski
2cf7443b91 Add support for % operator 2017-09-22 13:26:04 -04:00
Stanisław Barzowski
cab0cc887e std.codepoint, std.char + a bunch of tests 2017-09-22 11:53:25 -04:00
Davor Kapsa
4c5938c1f0 travis: update go version 2017-09-19 23:48:34 -04:00
Stanisław Barzowski
8a80309137 std.md5 2017-09-14 17:09:57 -04:00
Stanisław Barzowski
999ff267f1 Remove unused autogenerated code 2017-09-12 17:10:36 -04:00
Stanisław Barzowski
a94b877d4b Add std.exponent and std.mantissa 2017-09-12 17:10:21 -04:00
Stanisław Barzowski
ad4be04fc1 Fix desugaring of assertions 2017-09-11 16:38:37 -04:00
Stanisław Barzowski
4d5365f5e2 Add a bunch of tests for fundamental builtins
Support std.length on objects
2017-09-11 16:35:59 -04:00
Stanisław Barzowski
7ebcb06c98 Support for ifs in array comprehensions 2017-09-11 16:34:14 -04:00
Stanisław Barzowski
1e4797071f Even more builtins
Fix a bunch of bugs:
- Reverse meaning of boolean argument to objectFieldsEx and objectHasEx
- Slice desugaring using `std.slice` instead of `slice` as a field name.

Support + on string and something else.
Support + on arrays

assertEqual should now work properly
2017-09-08 14:19:19 -04:00
Stanisław Barzowski
6b040a9afe Actually unparse field names
Instead of just wrapping in "".
2017-09-08 14:14:32 -04:00
Stanisław Barzowski
860c3e6e70 Add more builtins 2017-09-07 15:41:41 -04:00
Stanisław Barzowski
3c94bde4dc String indexing, change of string representation (#34)
* String indexing, change of string representation

Also std.pow
2017-09-07 11:56:11 -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
c9e23d4ff3 Merge pull request #36 from sbarzowski/toString
Add toString builtin
2017-09-06 18:39:19 -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
5cd467fd18 More builtins 2017-08-30 01:38:36 -04:00
Stanisław Barzowski
b1427d563b Parser & desugarer support for "in" 2017-08-29 22:14:12 -04:00
Stanisław Barzowski
a4456d8ecf Add desugaring of standalone assertions 2017-08-29 22:09:40 -04:00
Alex Clemmer
0d716ae56f Move parser to its own package 2017-08-25 00:30:56 -04:00
Alex Clemmer
0cd1ad28cd Make parser members public 2017-08-25 00:30:56 -04:00