Commit Graph

10 Commits

Author SHA1 Message Date
Martin Atkins
44670ddd50 zclparse: keep ParseZCL results in the files registry
This is important to make the source code and context available for
printing diagnostics.
2017-06-04 09:02:41 -07:00
Martin Atkins
19064ef9ee zclparse: function to create a new Parser 2017-06-04 08:40:49 -07:00
Martin Atkins
9348014b2d zclparse: ParseZCL and ParseZCLFile methods
These are the top-level interface to parsing configuration files in the
native zcl syntax, similarly to the existing methods for parsing other
syntaxes.
2017-05-30 08:03:38 -07:00
Martin Atkins
308eb3a291 Relocate into the "zclconf" github account 2017-05-27 17:33:09 -07:00
Martin Atkins
a5640a0948 zclparse: actually be called zclparse
The package name was missed when this was reorganized out into a top-level
package, from ./zcl/parser where it had been previously.
2017-05-23 08:06:44 -07:00
Martin Atkins
2cfc08c632 json: Allow strings to be treated as HIL templates
Eventually zcl will have its own native template format that we'll use
by default, but for applications migrating from HCL/HIL we can instead
parse strings as HIL templates, for compatibility with how JSON configs
would've been processed in a HCL/HIL app.

When this mode is not enabled, we still just treat strings as literals,
pending the implementation of the zcl template parser.
2017-05-21 22:34:23 -07:00
Martin Atkins
764e4c465b hclhil: Parsing and JustAttributes for HCL 2017-05-21 16:13:04 -07:00
Martin Atkins
e765ff422a zclparse: Stub API for HCL/HIL file parsing
This is intended as a backward-compatibility interface, allowing
applications that previously used HCL/HIL to adopt zcl while still being
able to parse their old HCL/HIL-based configuration file formats.
2017-05-21 13:04:33 -07:00
Martin Atkins
a940c30903 Mechanism for introspection of source code for editors
The new "Nav" member on a zcl.File is an opaque object that can be
populated by parsers with an object that supports certain interfaces
that are not part of the main API but are useful for integration with
editors and other tooling.

As a first example of this, we replace the hack for getting context in
the diagnostic package with a new ContextString interface, which can
then be optionally implemented by a given parser to return a contextual
string native to the source language.
2017-05-19 19:33:58 -07:00
Martin Atkins
cdefa254c9 zclparse: new package for the primary parser API
Although the actual parsing code will be split across multiple packages,
it's convenient for the public interface to be in a single package. The
parsers are accessed through a "Parser" type, which both wraps the
real parsers and maintains a registry of parsed files to ensure that
the same file isn't parsed more than once (which might be confusing if
there are different results) and to provide raw source code for
diagnostic-printing functions.

The parser API is in a separate package both due to the fundamental
problem that it would create an import cycle if included in the main
package and also because it's expected that calling applications will
deal with parsing once in a central place (a single file depending on
zclparse) but the resulting objects will be used broadly across the
application, causing many files to depend on the main zcl package.
2017-05-18 08:41:48 -07:00