Commit Graph

16 Commits

Author SHA1 Message Date
Dominik Süß
6838b0a0b8
feat: add debugger support (#739) 2024-06-09 15:09:24 +01:00
Jesse
2655afd2bd
memory align structs (#635)
feat: align most structs and add lint rule to enforce struct alignment
2022-10-19 06:19:15 +01:00
Stanisław Barzowski
9ada769ce4 Make golangci-lint happy
Some of the suggestions are minor bug fixes (missing error handling).
2020-03-05 14:54:27 +01:00
Dave Cunningham
5476fefb25 Add ParseParameter. Also fell down the rabbithole improving content and consistency of parse errors 2020-03-05 09:33:21 +01:00
Stanisław Barzowski
85fd887750 Unexport a bunch of symbols
Many things were exported for no particular reason.
2019-09-09 16:11:00 +02:00
Stanisław Barzowski
45f3912215 Make parser package internal
There is no reason for external users to directly depend
on parser. It had a few random things exported as well,
namely errors and "children" functions (helpers for AST
traversal).

It was easy to extract the errors package, but I needed to leave
children in parser for now. The errors package was also
made internal, but it's a candidate for making it public
again potentially (if someone wants to display error messages
just like us). For now it's probably too incomplete anyway.

This change has a potential of breaking the existing users
since we technically remove public APIs. These were not needed
or even helpful for actually running Jsonnet code, but perhaps
someone used them anyway.
2019-09-03 17:28:33 +02:00
Marcelo Cantos
ed5f280c59 Apply golint recommendations (#196)
* Apply golint recommendations
2018-02-26 14:12:25 -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
Dave Cunningham
4356f42578
max_trace==0 means no trace limit (#141) 2017-11-03 00:33:31 -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
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
Alex Clemmer
0d716ae56f Move parser to its own package 2017-08-25 00:30:56 -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