Chapter 7Configuration

When CoffeePot starts, it looks for a configuration file, a Java properties file. If a file named .nineml.properties is found in the current directory, that file is loaded. If it isn’t found in the current directory, it’s loaded from the user’s home directory. If it doesn’t exist there either, CoffeePot searches for nineml.properties (no leading “.”) on the class path.

An example .nineml.properties file:

default-log-level=info
graphviz=/usr/bin/dot
ignore-trailing-whitespace=true
log-levels=CoffeePot:trace,Parser:info
pretty-print=true
progress-bar=tty

If the file is found and is a usable Java properties file, the following options are read from it:

allow-multiple-definitions (boolean), allow-undefined-symbols (boolean), allow-unproductive-symbols (boolean), allow-unreachable-symbols (boolean)

When the parser is not in “pedantic” mode, allow (or forbid) grammars with these conditions.

ascii-only (boolean)

Use only ASCII characters in messages such as the grammar or ambiguity descriptions. (Note: this has no effect on the output of the parse.)

assert-valid-xml-characters (boolean)

Check that the output contains no invalid characters.

assert-valid-xml-names (boolean)

Check that the output contains no invalid XML element or attribute names.

default-log-level (string)

The default log level: trace, debug, info, warning, error, or silent.

disable-pragmas (string)

A comma-separated list of pragma names. These pragmas will be ignored.

enable-pragmas (string)

A comma-separated list of pragma names. These pragmas will be enabled.

graph-options (string)

A comma-separated list of graph options; each option must have the form name=value or name:value. These options will be passed to the stylesheet that generates diagrams of the parse forest.

graphviz (filename)

The location of the Graphviz “dot” program that should be used for rendering diagrams of graphs.

ignore-bom (boolean)

Ignore a BOM at the start of an input document?

ignore-trailing-whitespace (boolean)

If true, trailing whitespace at the end of input files will be ignored if it isn’t successfully parsed.

log-levels (string)

A list of log category/level mappings.

mark-ambiguities (boolean)

Enables marking ambiguities in the output. This option will cause additional attributes to be added to the result trees marking where ambiguous choices were made. (This only works for vertical ambiguities on nonterminals that aren’t suppressed.)

normalize-line-endings (boolean)

If true, line endings on the input file will be normalized. Normalizing will translate all occurrences of carriage return (#D), carriage return followed immediately by a line feed (#D#A), next line (#85), and line separator (#2028) into a single line feed (#A). Multiple line endings are not combined. In other words, #85#2028 becomes #A#A, not #A.

parser (string)

The parser to use: Earley or GLL.

pedantic (boolean)

By default, CoffeePot accepts certain grammar extensions, such as pragmas. If pedantic is true, only grammars strictly conforming to the Invisible XML specification may be used.

prefix-parsing (boolean)

If true, a parse will succeed if it matches a prefix of the input.

pretty-print (boolean)

If true, line breaks and indentation will be added to the XML output so that it’s easier to read.

progress-bar (“on”, “off”, or “tty”)

Setting the progress bar to “on” or “off” enables or disables it. Setting it to “tty” enables it only if the output is going to a “tty”, an interactive computer terminal.

progress-bar-characters (string)

Sets the characters used to construct the progress bar when it is displayed.

progress-bar-style (string)

Sets the progress bar style. The style is just a name for a set of characters. The styles are:

ascii, or plain

The characters .#.

lines

The characters -=.

blocks

The characters ▏▎▍▌▋▊▉█.

shades

The characters ░▒▓█.

provenance (boolean)

If provenance is requested, a comment is generated at the top of XML outputs that identifies the version of NineML used and details about the input and the grammar. (This only applies to XML outputs as neither JSON nor CSV have a standard mechanism for comments.)

strict-ambiguity (boolean)

If a grammar contains priority pragmas that uniquely determine the outcome of every potentially ambiguous choice, you have a choice about whether or not it is reported as ambiguous. If strict ambiguity is true, it will be reported as ambiguous.

suppress-states (string)

An Invisible XML parse adds states to the root element to indicate features such as ambiguity or a prefix parse. The states in this comma-separated list will be suppressed.

trailing-newline-on-output (boolean)

If true, a newline will be printed after the output. It’s often useful to have a newline at the end of the XML, after the closing tag of the document element.

validate-vxml (boolean)

If true (the default), a grammar provided in XML format will be validated before it is used. This is an optional feature and is only supported if the Jing validation APIs for RELAX NG are on the class path.