Skip to main content

Module rows

Module rows 

Source
Expand description

AlignArrayOfStructures: Left — the columns of a braced table.

A table is a run of adjacent lines that each open with {; its cells are the tokens between top-level commas. clang-format pads every cell to the widest one in its column, so the commas and closing braces line up:

{"and",      TK_AND     },
{"function", TK_FUNCTION},     ← the widest first cell and the widest second one set the columns
{"::",       TK_DBCOLON }      ← the last row may omit the trailing comma and is still a row

The constants were read off LuaLexer.cpp, where clang-format produced the file: the second column starts at 1 + widest_first + 2 (brace, widest first cell, comma and one space), and the closing brace follows the padded last cell with no space of its own (start + widest_last).

Functions§

paddings
Extra spaces to insert before each token (indexed like the stream’s tokens) so that a table’s columns line up.