Commit Graph

10 Commits

Author SHA1 Message Date
Martin Atkins
5fa767a43a json: mark properties as used after blocks are decoded from them 2017-05-21 11:03:47 -07:00
Martin Atkins
64c1036f80 Remove "ExprRange" from zcl.Attribute
Now that expressions themselves have Range and StartRange methods, this
is redundant.
2017-05-21 09:50:29 -07:00
Martin Atkins
4fcad1f493 json: Respect hiddenAttrs in JustAttributes
Previously it was leaking out hidden attributes.
2017-05-21 09:46:50 -07:00
Martin Atkins
bb5044d015 Range and StartRange methods on Expression
This gives us some contextual information to use for error handling when
working generically with expressions.
2017-05-20 17:40:03 -07:00
Martin Atkins
dfafa6fc00 Flesh out interface for evaluating expressions
Expressions can now be evaluated within an "EvalContext", which provides
the variable and function scopes. The JSON implementation of this
currently ignores the context entirely and just returns literal values,
since we've not yet implemented the template language parser that would
be needed for the JSON parser to properly support expressions.
2017-05-20 15:17:56 -07:00
Martin Atkins
92e407e672 Body.JustAttributes method
The Content and PartialContent methods deal with the case where the caller
knows what structure is expected within the body, but sometimes the
structure of a body is just a free-form set of attributes that the caller
needs to enumerate.

The idea here is that the block in question must contain only attributes,
and no child blocks. For JSON this just entails interpreting every
property as an attribute. For native syntax later this will mean
producing an error diagnostic if any blocks appear within the body.
2017-05-20 14:35:19 -07:00
Martin Atkins
45f97bf427 json: Implement Body.Content
This is a wrapper around Body.PartialContent that generates additional
error diagnostics if any object properties are left over after decoding,
helping the config author to catch typos that would otherwise have caused
a property to be silently ignored.
2017-05-20 09:50:48 -07:00
Martin Atkins
8883fb76ce json: include NameRange and ExprRange in returned attributes 2017-05-20 08:56:41 -07:00
Martin Atkins
1168f36be5 json: start of low-level decoding 2017-05-19 19:33:58 -07:00
Martin Atkins
160f56abb1 json: beginnings of parsing JSON into File objects
The returned file objects are not actually functional yet, but this
establishes the interface.
2017-05-18 07:57:04 -07:00