Skip to content

Command line tools

Zoltán Kovács edited this page Mar 15, 2025 · 3 revisions

pbrst-cli

The command line tool pbrst-cli is a direct interface to analyze a statement without running the bibref program. Its purpose is to perform the analysis for a single file, or, by calling it from external scripts, to multiple files.

Since pbrst-cli is a tool for advanced users, it requires building it from source.

Building

Before building the tool, you need to install the same prerequisites

The following commands are required to build pbrst-cli:

git clone https://github.com/kovzol/bibref.git
cd statements
make

Usage

A quick summary for the usage of the tool can be run by issuing ./pbrst-cli -h. It gives the following output:

pbrst-cli [options] [input.brst], a command line brst parser
Options:
 -h     this help
 -d     switch debug mode on
 -c     colorize output
 -g     show only graphviz output
 -r     correct raw positions
 -D     correct differings
 -C     correct coverings
 -v     correct versification from KJV to LXX
 -u     show BRST dump
 -U     show only BRST dump

The options have the following meaning:

  • -d adds verbosity to the analysis, including debug messages of the bison/flex parsing step.

  • -c colorizes some parts of the analysis.

  • -g omits all information given in the analysis, only the created GraphViz output is shown.

  • -r try to fix raw positions of headlines, introductory texts or fragments.

    In bibref, Bible passages are given with verses and raw positions. Raw positions are confirmed by lengths (but this is optional). If the lengths do not match the raw positions, then raw positions have priority, thus lengths are fixed accordingly, if -r is set. If raw positions do not match the verses, then verses have priority, thus raw positions (and eventually, the lengths in those cases) are fixed accordingly.

  • -D overrides the incorrectly computed differings (based on the jaccard12 command) with the correct value.

  • -C overrides the incorrectly computed percentual covering with the correct value.

  • -v assumest that versification in the input was given with the KJV schema, and the output will use the LXX schema. This feature is incomplete and not fully tested.

  • -u prints the processed BRST dump, that is, it echoes the parsed and semantically checked, and eventually corrected statement file. It is a requirement that the input can be at least syntactically parsed.

  • -U behaves like -u, but all other outputs are omitted.

Example uses

Visualization

  • ./pbrst-cli -g StatResGNT/Matthew/Matthew-2,6.brst outputs a GraphViz file to visualize the input statement.
  • ./pbrst-cli -g StatResGNT/Matthew/Matthew-2,6.brst > Matthew-2,6.gv outputs a GraphViz file to visualize the input statement.
  • ./pbrst-cli -g StatResGNT/Matthew/Matthew-2,6.brst | dot -Tsvg > Matthew-2,6.svg creates an SVG output of the visualized statement.
  • ./pbrst-cli -g StatResGNT/Matthew/Matthew-2,6.brst | dot -Tsvg > Matthew-2,6.svg && sensible-browser Matthew-2,6.svg shows the visualized statement in the default web browser.

Auto-resolution of a faulty BRST file

  • ./pbrst-cli -r -U test.brst > test-corrected.brst corrects raw positions and saves the corrected file in another file.
  • ./pbrst-cli -r -D -C -U test.brst > test-corrected.brst fixes all correctable errors and saves the corrected file in another file.

Auto-indentation of a BRST file

  • ./pbrst-cli -U test.brst prints the input file in auto-indented format on stdout. Comments (written after hashmarks) will be removed.

Clone this wiki locally