PPML Box Meta model - mn-mikke/Model-driven-Pretty-Printer-for-Xtext-Framework GitHub Wiki
The box meta-model is integrated into the [PPML](<http://www-sop.inria.fr/croap/ctcoq/help/notations.html) formalism, whose full name is Pretty Printer Meta Language. The PPML has been used in the Centaur system to write pretty printers for various programming languages.
The PPML formalism encloses the textual usage of a meta-model into square brackets. Furthermore, the name of a used operator and a usage of corresponding operators are enclosed in angle brackets. The boxes waiting for be formatting follows after the definition in angle brackets. The box meta-model is comprised of four following operators.
- H - The operator aligns boxes horizontally and inserts spacing defined by the dx parameter between boxes. The dx parameter expresses a count of given characters which will be inserted.
-
V - The operator aligns boxes vertically and inserts spacing defined by the dy parameter between boxes. The dy parameter expresses a count of new lines which will be inserted. The operator has also the second parameter i that allows for setting indentation of the second box. Although, the source of the meta-model does not mention indentation of other lines, it results from descriptions of following operators.
-
HV - The operator aligns boxes as follows. The result formatting depends on whether the total length of boxes including horizontal spacing exceeds the maximal length of line, which is fixed. When the length of all boxes including horizontal spacing is smaller than the maximum length of line, then the boxes are aligned horizontally with spacing defined in the dx parameter. Otherwise, the first line is filled as much as possible and the second one is indented of count of spacing character, which is defined in the i parameter. The operator fills the second line like for the first and the following lines are vertically aligned with the second line. Two consecutive lines are separated by blank lines, whose count is defined in the dy parameter.
- HOV - The operator behaves like the operator H when the total length of boxes including horizontal spacing does not exceed the maximal line length. Otherwise, the operator behaves like the operator V. The parameters of the operator have the same significance as with the previous operators.