Implement and switch to serialization-based regression testing

Implements a tiny framework for freezing the results of operators over
data, in this case the resultant AST from parsing the dogs command
language.

A modified "fmt" package from Go is used to do this, to overcome
problems with non-deterministic output order of maps.

Output of the astRegress function ends up in the 'results' directory,
and then compared to their equivalents in the 'expected' directory.

Inspired by pg_regress in PostgreSQL.

Signed-off-by: Daniel Farina <daniel@fdr.io>
Fix interface parameter name typo

Signed-off-by: Daniel Farina <daniel@fdr.io>
Add vertical whitespace and indentation to output

This makes line-oriented diffs useful and inspection of AST values
much more palatable.  Requires rebuild of the expected values for the
existing functionality, though.

Signed-off-by: Daniel Farina <daniel@fdr.io>
Refinements to make output even more stable

fmtPointer has been completely gutted to prevent accidentally calling
it: doing so will cause a panic.  It was not removed from all paths in
the stable package as of yet, because it is thought that any path that
matters is already treated.

Sort stability on maps has also been fixed by the addition of
retrieving the interface value of a reflect.Value before printing.
The string rendering of reflect.Value contains non-deterministic
information that would be considered in the sort.

Signed-off-by: Daniel Farina <daniel@fdr.io>
Add input echoing to regression testing

This is for easier reading.  Such a change in output requires
regenerating the expected output.

Signed-off-by: Daniel Farina <daniel@fdr.io>
Reform parser.go to emit more classical AST

These AST nodes, seen in syntax_types, all have roots in Token values,
which allows for error reporting (including the position of the error)
when the tree is semantically analyzed.

The tests have been updated to reflect these new structures.  Notably
they all now contain positioning information in the emitted structure.

Prior to this, some amount of semantic analysis was done while parsing
(such as converting tokens into integers, et al) in an attempt to end
up with structures more similar to what was predicted to be necessary
at run-time.  This has effectively been removed, and needs to be
re-introduced as a pass on top of the AST, per-normal compiler
architecture.

Signed-off-by: Daniel Farina <daniel@fdr.io>
Scan errors now cause scanning to stop

Previously, they'd emit some stderr and continue.  To abort from deep
within the scanner, a more complex mechanism than one might expect
using panic/recovery unwinding seems necessary.

Signed-off-by: Daniel Farina <daniel@fdr.io>
Correct Action parsing to absorb its own right-brace

Previously, input like "[route 'bar' @ 137 [delete]" would parse
properly because the extra-right-braces would not be absorbed by the
action-parsing, but instead by the toplevel parsing.

The result when parsing more credible input is that unconsumed input
intended for the last emitted AST can be left in the scanner.

Signed-off-by: Daniel Farina <daniel@fdr.io>
Add a series of negative tests for incorrect input

This required a relatively large rearrangement to the testing
infrastructure to break out detecing problems from failing the testing
package directly.

In addition, the default fail mode has been switched to Fail() from
Fatal(), as so multiple astRegressions can be run in one test.  This
is easier to read, even if it sacrifices a potential parallelization
opportunity sometimes.

Signed-off-by: Daniel Farina <daniel@fdr.io>
Do not indent on account of pointer rendering

This is to make test output more stable under change (it does not
affect the determinism of testing).  It causes a large change in
output of the current regression tests, but there is no functional
change in any non-test code.

Previously, a change in the level of indirection of a field in a
struct is changed (inlined, single-pointer, double-pointer, etc) would
cause a lot of whitespace alterations.  No longer.

Signed-off-by: Daniel Farina <daniel@fdr.io>
Change a by-value return to a pointer

Exposed when one attempts to add an operator to the
TargetOcnSpecSyntax, not included in this patch.

Signed-off-by: Daniel Farina <daniel@fdr.io>
Refactor resultFile type to a utility file

This algebra is useful for yet-uncommitted semantic analyzer
regression tests, so it's worth calling out this neutrality by
splitting it into its own file.

Signed-off-by: Daniel Farina <daniel@fdr.io>
Support blaming Action production

Previously it was impossible to signal errors on the syntax of an
action, as opposed to its dictionary of modified attributes.

Signed-off-by: Daniel Farina <daniel@fdr.io>
Fix typo in comment

Signed-off-by: Daniel Farina <daniel@fdr.io>
Change attributes supported in dogconf

On reflection, there is no need to know anything about usernames and
passwords.  Even though they are provided by the startup packet, it
seems as though database name routing is all that is needed for now.
And, to take care of replicas, one must support rewriting distinct
database names to one database name, so add this feature.

Signed-off-by: Daniel Farina <daniel@fdr.io>
Add semantic analyzer stubs

This doesn't do anything except prime the code for allowing multiple
contributors to add and test semantic analyzer changes.

In particular, every single one of the checked in regression tests is
effectively bad output, and one should aim to replace them gradually
with correct output over time.

Signed-off-by: Daniel Farina <daniel@fdr.io>