sjsonnet
package sjsonnet
- Alphabetic
- Public
- Protected
Type Members
- class BaseCharRenderer[T <: Output] extends JsVisitor[T, T]
- class BaseRenderer[T <: Writer] extends JsVisitor[T, T]
Vendored version of
ujson.BaseRenderer
from ujson 1.2.3.Vendored version of
ujson.BaseRenderer
from ujson 1.2.3.uJson has replaced this with a pair of byte/char specialized renderers for performance. For now, we just want to upgrade uJson to the latest version to avoid classpath conflicts, so just vendor this code for now. In the future we may remove it to interface with uJson's specialized renderers directly, to benefit from their improved performance.
- class CachedImporter extends Importer
- class CachedResolver extends CachedImporter
- class DefaultParseCache extends ParseCache
- class Error extends Exception
An exception that can keep track of the Sjsonnet call-stack while it is propagating upwards.
An exception that can keep track of the Sjsonnet call-stack while it is propagating upwards. This helps provide good error messages with line numbers pointing towards user code.
- trait EvalErrorScope extends AnyRef
- abstract class EvalScope extends EvalErrorScope
EvalScope models the per-evaluator context that is propagated throughout the Jsonnet evaluation.
- class Evaluator extends EvalScope
Recursively walks the Expr trees to convert them into into Val objects that can be materialized to JSON.
Recursively walks the Expr trees to convert them into into Val objects that can be materialized to JSON.
Performs import resolution and parsing on-demand when the relevant nodes in the syntax tree are reached, and caches the evaluated result of each imported module to be re-used. Parsing is cached separatedly by an external
parseCache
. - trait Expr extends AnyRef
Exprs are the parsed syntax trees of a Jsonnet program.
Exprs are the parsed syntax trees of a Jsonnet program. They model the program mostly as-written, except for resolving local variable names and assigning them indices in the scope bindings array.
Each Expr represents an expression in the Jsonnet program, and contains an integer offset into the file that is later used to provide error messages.
- abstract class ExprTransform extends AnyRef
Simple tree transformer for the AST.
- class FileScope extends AnyRef
FileScope models the per-file context that is propagated throughout the evaluation of a single Jsonnet file.
FileScope models the per-file context that is propagated throughout the evaluation of a single Jsonnet file. Contains the current file path.
- abstract class Importer extends AnyRef
Resolve and read imported files
- class Interpreter extends AnyRef
Wraps all the machinery of evaluating Jsonnet source code, from parsing to evaluation to materialization, into a convenient wrapper class.
- case class JsVirtualPath(path: String) extends Path with Product with Serializable
- abstract class Lazy extends AnyRef
Lazy models lazy evaluation within a Jsonnet program.
- case class MaterializeJsonRenderer(indent: Int = 4, escapeUnicode: Boolean = false, out: StringWriter = new StringWriter()) extends BaseCharRenderer[StringWriter] with Product with Serializable
Renderer used by std.manifestJson and std.manifestJsonEx
- abstract class Materializer extends AnyRef
Serializes the given Val out to the given upickle.core.Visitor, which can transform it into ujson.Values or directly serialize it to
String
s - trait ParseCache extends AnyRef
- class ParseError extends Error
- class Parser extends AnyRef
- trait Path extends AnyRef
Paths represent handles that Sjsonnet can use to resolve imports and load file contents.
Paths represent handles that Sjsonnet can use to resolve imports and load file contents. Abstracts away the filesystem access so import resolution can be customized, e.g. using a virtual filesystem when running in the browser.
- final class Position extends AnyRef
- class PrettyNamed[T] extends AnyRef
- class PrettyYamlRenderer extends BaseRenderer[Writer]
A version of YamlRenderer that tries its best to make the output YAML as pretty as possible: unquoted strings, de-dented lists, etc.
A version of YamlRenderer that tries its best to make the output YAML as pretty as possible: unquoted strings, de-dented lists, etc. Follows the PyYAML style. Also adds the ability to stream writes to a generic
Writer
. - class PythonRenderer extends BaseCharRenderer[Writer]
- sealed abstract class ReadWriter[T] extends AnyRef
Typeclasses for easy conversion between Vals and Scala data types
- class Renderer extends BaseCharRenderer[Writer]
Custom JSON renderer to try and match the behavior of google/jsonnet's render:
Custom JSON renderer to try and match the behavior of google/jsonnet's render:
- Custom printing of Doubles - Custom printing of empty dictionaries and arrays
- class ScopedExprTransform extends ExprTransform
Tree transformer that keeps track of the bindings in the static scope.
- class Settings extends AnyRef
Settings for the interpreter.
Settings for the interpreter. This is a subset of Config which is used in the inner layers of the interpreters and shared between all platforms.
- class StaticError extends Error
- class StaticOptimizer extends ScopedExprTransform
StaticOptimizer performs necessary transformations for the evaluator (assigning ValScope indices) plus additional optimizations (post-order) and static checking (pre-order).
- sealed abstract class Val extends Lazy
Vals represented Jsonnet values that are the result of evaluating a Jsonnet program.
- final class ValScope extends AnyVal
ValScopes which model the lexical scopes within a Jsonnet file that bind variable names to Vals, as well as other contextual information like
self
this
orsuper
.ValScopes which model the lexical scopes within a Jsonnet file that bind variable names to Vals, as well as other contextual information like
self
this
orsuper
.Note that scopes are standalone, and nested scopes are done by copying and updating the array of bindings rather than using a linked list. This is because the bindings array is typically pretty small and the constant factor overhead from a cleverer data structure dominates any algorithmic improvements
The bindings array is private and only copy-on-write, so for nested scopes which do not change it (e.g. those just updating
dollar0
orself0
) the bindings array can be shared cheaply. - class ValVisitor extends JsVisitor[Val, Val]
Parse JSON directly into a literal
Val
- class YamlRenderer extends BaseCharRenderer[StringWriter]
Value Members
- object ArrayOps
Array operations which are missing in Scala 2.12
- object BaseRenderer
- object DecimalFormat
Minimal re-implementation of java.text.DecimalFormat, for Scala.js compatibility (the existing shim for java.text scala-java-locales isn't fully compliant, and adds tons of unnecessary code that bloats the JS bundle)
- object Error extends Serializable
- object Evaluator
- object Expr
- object Format
Minimal re-implementation of Python's
%
formatting logic, since Jsonnet's%
formatter is basically "do whatever python does", with a link to:Minimal re-implementation of Python's
%
formatting logic, since Jsonnet's%
formatter is basically "do whatever python does", with a link to:- https://docs.python.org/2/library/stdtypes.html#string-formatting
Parses the formatted strings into a sequence of literal strings separated by
%
interpolations modelled as structured Format.FormatSpecs, and use those to decide how to inteprolate the provided Jsonnet Vals into the final string. - object Importer
- object Materializer extends Materializer
- object Parser
Parses Jsonnet source code
String
s into a Expr syntax tree, using the FastParse parsing library.Parses Jsonnet source code
String
s into a Expr syntax tree, using the FastParse parsing library. Uses precedence climbing to handle infix operators, and resolves local variable names to array indices during parsing to allow better performance at runtime. - object Platform
- object PrettyNamed
- object PrettyYamlRenderer
- object ReadWriter
- object RenderUtils
- object ScopedExprTransform
- object Settings
- object SjsonnetMain
- Annotations
- @JSExportTopLevel("SjsonnetMain")
- object StaticError extends Serializable
- object Std
The Jsonnet standard library,
std
, with each builtin function implemented in Scala code.The Jsonnet standard library,
std
, with each builtin function implemented in Scala code. Usesbuiltin
and other helpers to handle the common wrapper logic automatically - object Util
- object Val
- object ValScope
- object Version
- object YamlRenderer