Martin Atkins
873a4d07b5
json: improve error message for duplicate property
...
We need to be careful to keep straight the distinction between JSON
properties and zcl body attributes here, since properties can represent
both attributes _and_ blocks.
2017-05-20 11:12:03 -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
17d372677d
json: Generalize "keywordSuggestion" for general name suggestions
...
keywordSuggestion is now a wrapper around nameSuggestion with a predefined
list of names.
2017-05-20 09:45:15 -07:00
Martin Atkins
aa13eab21f
json: Don't suppress parser return value on errors
...
Even if errors were encountered during parsing, it is helpful to still
return a partial AST if possible since that allows for the source code
analysis features to still (partially) work in the face of errors.
2017-05-20 09:30:04 -07:00
Martin Atkins
69164859c8
json: Tests for Body.PartialContent
2017-05-20 08:56:55 -07:00
Martin Atkins
8883fb76ce
json: include NameRange and ExprRange in returned attributes
2017-05-20 08:56:41 -07:00
Martin Atkins
d2c9089812
json: ContextString implementation
...
This JSON-flavored ContextString implementation returns a chain of
property names using JavaScript-style attribute access syntax.
2017-05-19 19:33:58 -07:00
Martin Atkins
1168f36be5
json: start of low-level decoding
2017-05-19 19:33:58 -07:00
Martin Atkins
41527d1a3c
Retain the bytes used to construct a file
...
Later on this will be useful when printing diagnostics with source code
snippets as context.
2017-05-18 08:07:52 -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
Martin Atkins
eca76d650c
json: Detect and report extraneous data at EOF
2017-05-17 07:59:41 -07:00
Martin Atkins
0ef4932962
json: parsing of arrays
...
(and assorted bugfixes in parsing of objects that were found in the
process of adapting that code for arrays.)
2017-05-17 07:55:21 -07:00
Martin Atkins
b073937523
json: Basic parsing of number values
2017-05-17 07:34:33 -07:00
Martin Atkins
4100bdfd2f
json: Parsing of strings and objects
2017-05-16 08:00:07 -07:00
Martin Atkins
8dfc3c4bbe
json: fix overly-greedy keyword scanning
...
Logic error in the scanner caused it to always consume the remainder of
the string.
2017-05-16 07:23:33 -07:00
Martin Atkins
66c38447d3
json: fix buggy peeker.Read
2017-05-16 06:51:19 -07:00
Martin Atkins
f6bd122f4b
json: parsing of keywords
2017-05-16 06:51:19 -07:00
Martin Atkins
f754328a91
json: beginnings of parser
...
Only supports parsing objects right now, and even then doesn't really
because objects have to contain strings and that isn't implemented yet.
2017-05-15 08:35:32 -07:00
Martin Atkins
377e20b7b8
json: AST node types
2017-05-15 08:34:35 -07:00
Martin Atkins
838a0332e6
json: token peeker
...
This will help our hand-written recursive-descent parser walk the tokens
with one token of lookahead.
2017-05-15 08:34:00 -07:00
Martin Atkins
45d426b99c
json: Generate EOF tokens marking the end of scanning
...
This helps the parser include a good position when it needs to generate
"unexpected EOF" diagnostics.
2017-05-15 07:15:53 -07:00
Martin Atkins
b5ce4360cd
json: initial scanner implementation
...
Currently lacking correct support for unicode text segmentation into
grapheme clusters, so it miscounts "Column" in positions. This will be
addressed later.
2017-05-15 07:02:13 -07:00