public sealed class SyntaxDomainA language's inputs, mutated a syntax node at a time.
Remarks
One domain for both front ends, because they are the same tree. VXML and Raven each bring a grammar and nothing else — the green/red nodes, the trivia model and the printer all come from Vixen.Core.Syntax — so everything this needs is on SyntaxNode and neither language is named here. A third grammar on the same tree costs a parse delegate and a list of fragments.
⚠ The unit of mutation is a node; the edit is carried in the text, and that is a decision rather than a shortcut. Rewriting the tree itself is the obvious design and it does not survive contact with either front end: VXML has no public way to make a SyntaxToken at all, its generated Update returns a detached node with no parent, and its SyntaxRewriter cannot remove a list element — so a tree rewriter outside the assembly would be reduced to grafting whole subtrees anyway. Choosing the edit from the tree and applying it to the source text gets the same population of inputs with none of that, and it has two properties a rewriter would have had to work for: it needs no internals, and it carries trivia exactly, because a node's span already contains the author's whitespace and comments.
What matters is that the unit is grammatical. Replacing an element with an element, duplicating an attribute, deleting a statement — each produces something that lexes and mostly parses, which is the whole reason for the seam. Byte havoc gets a share of the budget anyway; see GarbageIn.
Fields and properties (2)
public const int MaxNodesHow many nodes an edit is chosen from.
public override string WhatWhat is being mutated, in one line, for a report.
Methods (5)
public SyntaxDomain(string what, Func<string, SyntaxNode> parse, IReadOnlyList<string> fragments, ulong seed)Creates a domain over one grammar.
protected override bool TryRead(ReadOnlySpan<byte> bytes, out SyntaxDomain.Source value)Reads a corpus entry.
protected override byte[] Write(SyntaxDomain.Source value)Writes one back out.
protected override SyntaxDomain.Source Mutate(SyntaxDomain.Source value, SyntaxDomain.Source other, FuzzRandom random)protected override SyntaxDomain.Source Create(FuzzRandom random)
Used by (2)
- RavenTargetVixen.Fuzz
- VxmlTargetVixen.Fuzz