yrunner − yrunner input file The input files the
program uses are YAML (version 1.2) files, with the
preferred file-name extension "yaml" or
"yml". Each file should start with the sequence
followed a list of objects, each with a single key, and
ending with the line As a reminder, YAML syntax describes
nested lists and objects with indentation used to denote the
level of nesting. List elements always start with a
’-’ followed by a space. Objects are key-value
pairs. If the key is not an identifier, it must be quoted.
Keys are case sensitive, and are always followed by a colon
and then a space. List elements and object values can be
other lists or objects, but also strings, numbers, and
various special values ( YAML also allows lists to be
written as comma-separated values delimited by and and
allows object to be written as a comma-separated sequence of
key-value pairs, with the object itself delimited by and
where each key-value pair consists of an identifier, a
colon, and a value. For example, [10, 20, 30] and {a: 10, b:
20, c: 30} are equivalent to - 10
- 20
- 30 and a: 10
b: 20
c: 30 respectively. Which form to us uses is a matter of
personal preference or convenience. For the allowed keys in
the top-level lists’ objects are and Each can appear
multiple times in any desired order. This key’s value
is either a string containing an expression-parser statement
or a list of expression-parser statements, one statement per
list element. The syntax used for expression-parser
statements is described below. At a minimum, the first key
in the file will be an key and it will define a variable and
initialize it so that it’s value is an animation,
simulation, or some similar object that implements the
object-namer interface For example, - execute:
- var a2d = new Animation2D(1920, 1080, 10000.0, 400)
- var scaleF = 1080.0/100.0
- = a2d.setRanges(0.0, 0.0, 0.35, 0.0, scaleF, scaleF)
The value for this key is an object with a mandatory key
named whose value is a list with two elements. The first
element is a string providing the variable name for an
object namer, and the second element is a string containing
a package name in which to find factory classes. The
remaining items are key-value pairs where the key is used as
the name of a variable whose value is a factory, and the
second is the simple class name of the factory, which must
be in the package specified in the element. For example:
- factories:
context: ["a2d", "org.bzdev.anim2d"]
alf: AnimationLayer2DFactory
The value for this key is a single value or a list of
values, and each value is expected to have a YAML anchor -
an identifier preceded by an ampersand (&). For example,
- define:
- &font {withPrefix: "fontParms", config: [
{name: "SANS_SARIF"},
{withPrefix: "color",
red: 212, blue: 44, green: 174}]}
With this definition, the alias can be used later to insert
the defined object at any desired location, reducing the
amount of repetition that would otherwise be needed. Aside
from defining anchors. All the objects in a key’s
value are ignored unless referenced with an alias. The value
for this key is either a single object or a list of objects,
with each value specifying an object created by a factory.
There are four keys: the value for the key provides a name
for the object that will be created for use in an
expression; the value for the key provides a print name for
the object; the value for the key provides the factory to
use to create the object; the value for the key is a
possibly nested list or object that specifies the
configuration. The syntax is factory dependent and there
should be documentation for each factory (there is for each
in the BZDev library). Documentation for the class contains
an overview appropriate for yrunner, and for scrunner when
using the scripting language ESP or ECMAScript. For example,
- create:
- var: layer
name: layer
factory: alf
configuration:
- {zorder: 0, visible: true}
- withPrefix: object
withIndex:
- # first text line
- type: TEXT
text: Sample Text 1
- {x: 10, y: 20}
- *font
- # second text line
- type: TEXT
config:
- text: Sample Test 2
- {x: 10, y: 40}
- *font
The crosshatch starts a comment that terminates at the end
of the line containing it. The list element is an alias (the
use of aliases is described above). Typically a top-level
key will appear after factories are created to continue
processing by (for example) running a simulation or
animation. For example, - execute:
- var maxFrames = a2d.estimateFrameCount(1.0);
- = a2d.initFrames(maxFrames, isw);
- = a2d.scheduleFrames(0, maxFrames);
- = a2d.run();
- = isw.close();
The documentation for describes the syntax used in
expressions. The program configures expression parsers so
that scripting mode, import mode, and global mode are
disabled. An expression is restricted to the following: For
this case, is the name of a variable that must not have been
defined previously and is an expression recognized by The
order of evaluation is the lexical ordering of the
expressions, and will evaluate an expression only once. For
example, when an anchor is defined, any expressions
referenced by the anchor will be evaluated where the anchor
was defined, not at the points where a corresponding alias
references that anchor. For this case, is the name of a
variable that may (or may not) have been defined previously
and is an expression, recognized by that will be evaluated
if has not been previously defined. For this case, is the
name of a variable that may (or may not) have been defined
previously and is an expression, recognized by that will be
evaluated if either has not been previously defined or has
the value For this case, is the name of a function (a
previously defined function or variable with that name must
not exist), is a comma-separated list of identifiers, and is
a semicolon-separated list of expressions using the syntax
defined in the documentation. The value of the last
expression in the list is the value returned by the
function. For this case, is the name of a function (a
previously defined function or variable with that name must
not exist), is a comma-separated list of identifiers, and is
a semicolon-separated list of expressions using the syntax
defined in the documentation. The value of the last
expression in the list is the value returned by the
function. For this case, is evaluated. The syntax for an
identifier or name is the same that Java uses for
identifiers. The following variables are reserved in
expressions: is the variable for standard output. It will
always be an instance of the Java class PrintWriter, and
will flush its output after each line. is the variable for
standard error. It will always be an instance of the Java
class PrintWriter, and will flush its output after each
line.
https://en.wikipedia.org/wiki/YAML
https://yaml.org/spec/1.2/spec.html