Package avail. anvil
Types
An abstract FileEditor for an JSON file.
An abstraction for a color that's dependent on light versus dark mode.
A RuntimeException specific to Anvil.
An editor for an Avail source module. Currently supports:
AvailWorkbench is a simple user interface for the Avail builder.
Draws code guides on the decorated JScrollPane after the appropriate columns.
The dark-themed palette of system colors.
Enumerates the feature categories of Anvil that may be turned off by including them in AvailProject.disallow.
An editor for an arbitrary text files.
An editor for a generic file.
An AbstractJSONFileEditor for a generic JSON file.
The light-themed palette of system colors.
Match a style classifier against literal #0. On success, fall through to the next instruction of the enclosing rule and pause; on failure, fail the enclosing rule.
Match a style classifier against literal #1. On success, fall through to the next instruction of the enclosing rule and pause; on failure, fail the enclosing rule.
Match a style classifier against literal #2. On success, fall through to the next instruction of the enclosing rule and pause; on failure, fail the enclosing rule.
Match a style classifier against literal #3. On success, fall through to the next instruction of the enclosing rule and pause; on failure, fail the enclosing rule.
Match a style classifier against literal #N, where N is supplied as an immediate operand. On success, fall through to the next instruction of the enclosing rule and pause; on failure, fail the enclosing rule. Note that the encoding offsets the literal index by -4, so this cannot be used to encode indices ≤ 4.
Match a style classifier against literal #0. On success, fall through to the next instruction of the enclosing rule and pause; on failure, jump to the target instruction.
Match a style classifier against literal #1. On success, fall through to the next instruction of the enclosing rule and pause; on failure, jump to the target instruction.
Match a style classifier against literal #2. On success, fall through to the next instruction of the enclosing rule and pause; on failure, jump to the target instruction.
Match a style classifier against literal #3. On success, fall through to the next instruction of the enclosing rule and pause; on failure, jump to the target instruction.
Match a style classifier against literal #N, where N is supplied as an immediate operand. On success, fall through to the next instruction of the enclosing rule and pause; on failure, jump to the target instruction. Note that the encoding offsets the literal index by -4, so this cannot be used to encode indices ≤ 4.
A helper class for building the menu bar.
A helper class for building menus.
Contains the build progress information for the compilation of a ModuleName that is being compiled.
Utility for applying PhrasePathRecord's information to token ranges in a StyledDocument.
Responsible for watching changes to AvailProject configuration files on disk using a DirectoryWatcher.
A RenderingContext expresses how to render a complete set of character attributes to a contiguous region of text within an arbitrary StyledDocument.
Raised when rendering contextvalidation fails for any reason.
The RenderingEngine renders runs of source text. To achieve this for some run R, it queries the active stylesheet with the run's style classifiers and then uses the obtained rendering context to set the character attributes of R.
Information about the source code for some module.
A persistent stylesheet maps unvalidated style patterns onto unvalidated style attributes. A StylePatternCompiler compiles a valid StylePattern with valid StyleAttributes into a ValidatedStylePattern.
A StylePatternCompiler parses a pattern, resolves a rendering context against a palette, and generates a rule if all syntactic and semantic requirements are met.
Raised when compilation of a StylePattern fails for any reason.
A StyleRule is a pattern-matching program produced by a StylePatternCompiler. A runtime stylesheet aggregates all rules that should be considered when determining how Avail source text should be rendered.
A StyleRuleContext represents the complete machine state of a running StyleRule.
The execution state of a style rule.
The StyleRuleExecutor is a stateless virtual machine that accepts a context and executes one or more instructions of its rule, returning control immediately upon detecting that a derivative of the initial context has left the RUNNING state. The executor uses a supplied injector to feed forked contexts back into the pool of pending contexts. It should be run iteratively against a lineage of contexts and a sequence of classifiers. The special end-of-sequence classifier should terminate a sequence of classifiers (unless the rule rejects the sequence preemptively).
A StyleRuleInstruction is an indivisible unit of behavior within a style rule. Instructions are neither generated nor executed in reified form; the class hierarchy exists only to support disassembly for debugging and provide loci for documentation of behavior.
A StyleRuleInstructionCoder implements a strategy for correlating instructions and their decoders. Subclasses self-register simply by calling the superconstructor.
A StyleRuleTree comprises:
An AvailProject contains a stylesheet that dictates how an Avail source viewer/editor should render a source region tagged with one or more style classifiers. A stylesheet comprises one or more patterns, each of which encodes (1)whether a region of text should be rendered and (2)how it should be rendered. Patterns are written using a simple domain-specific language (DSL); this DSL is designed to be reminiscent of Cascading Stylesheets (CSS), but, for reasons of simplicity, is not compatible with it. Each pattern compiles down into a rule. A rule is a program, comprising StyleRuleInstructions, whose input is the sequence S of style classifiers attached to some source region R and whose output is a partial rendering context that should be applied to R. The complete collection of rules is organized into a global StyleRuleTree, such that every vertex contains the StyleRuleContexts for those rules that are still live and every edge encodes a possible next style classifier, either as (1) a fixed style classifier mentioned by some active rule in the source vertex or (2) a wildcard that matches any style classifier. The RenderingEngine iteratively feeds S, one style classifier at a time, through the tree, starting at the root. At each vertex, it feeds the current classifier C to each rule therein. Each rule that accepts C generates one or more StyleRuleContexts, each of which is injected into the lazy successor vertex along the edge labeled C; each rule that rejects C is excluded from further consideration; each rule that completes adds itself to the (ordered) solution set. After consuming S entirely, the rules of the solution set are ranked according to specificity, and every rule that ties for highest specificity contributes its rendering effects to the final RenderingContext. Rendering conflicts are resolved by insertion order, with later rules prevailing over earlier ones. For computational efficiency, the final result is memoized (to the sequence S).
The abstract palette of system colors. Supports styling Avail source text and UI components.
SystemStyleClassifier enumerates the style classifiers that are well-known to Anvil.
An UnvalidatedRenderingContext not has yet been validated.
An unvalidated style pattern.
A ValidatedRenderingContext has complete StyleAttributes and has been successfully validated against the palette used to construct it. It is therefore ready to render itself onto StyledDocuments.
A style pattern that has been successfully validated by a StylePatternCompiler.
A JFrame that is directly associated with an AvailWorkbench.
Functions
Create a Window menu that appears suitable for the platform. Which is only Mac at the moment, although these commands should work anywhere.
Perform the specified action on the event dispatch thread and wait for it to complete. If this is the event dispatch thread, then just perform the action synchronously.
Unapply the variable-length universal coding strategy applied by opcode to decode a nonnegative integer from the receiver. If the stored encoding does not denote a valid value, the result is undefined, and the number of bytes consumed is also undefined.
Apply a variable-length universal coding strategy to the supplied value, encoding it onto the receiver. The coding is not efficient for large instruction sets, but is quite efficient for a very small instruction set, i.e., fewer than 32 instructions.
Either places the given component inside a JScrollPane or answers the JScrollPane that it's already inside.
Either places the receiver JTextArea inside a JScrollPane with line numbers presented as row headers, or answers the JScrollPane that it's already inside.
Scroll the given JTextPane to ensure the given text range is visible, and preferably not jammed against the top or bottom border.
Unapply the variable-length universal coding strategy applied by vlq to decode a nonnegative integer from the receiver. If the stored encoding does not denote a valid value, the result is undefined, and the number of bytes consumed is also undefined.
Apply a variable-length universal coding strategy to the supplied value, encoding it onto the receiver using a nybble-based variant of MIDI VLQ. The value must be non-negative.