Documentation
¶
Overview ¶
vera is a package for parsing logical expressions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ASCIIBoxCS = &CharSet{
RowSep: "-",
ColSep: "|",
Center: "+",
TopT: "+",
BottomT: "+",
LeftT: "+",
RightT: "+",
TLCorner: "+",
TRCorner: "+",
BLCorner: "+",
BRCorner: "+",
}
ASCIIBoxCS is a CharSet using only ASCII characters.
var PrettyBoxCS = &CharSet{
RowSep: "─",
ColSep: "│",
Center: "┼",
TopT: "┬",
BottomT: "┴",
LeftT: "├",
RightT: "┤",
TLCorner: "┌",
TRCorner: "┐",
BLCorner: "└",
BRCorner: "┘",
}
PrettyBoxCS is a CharSet using Unicode box drawing characters.
Functions ¶
Types ¶
type CharSet ¶
type CharSet struct { RowSep string ColSep string Center string TopT string BottomT string LeftT string RightT string TLCorner string TRCorner string BLCorner string BRCorner string }
CharSet is a set of characters for rendering a table via RenderTT.
type Truth ¶
Truth represents a set of truth values. The truth values are represented by Val, which is treated like a bit field where each bit represents whether the corresponding atomic statement is true (1) or false (0). The bits are in alphabetical order such that, if all 52 atomic statements are used, the 0th bit corresponds to 'z' and the 51st bit corresponds to 'A'. However, if some of the 52 possible atomic statements are not used, they will not be included in the bit field (e.g if only 'a' and 'G' are used, the 0th bit will correspond to 'a' and the 1st bit will correspond to 'G'; the remaining bits are meaningless). As a result of the truth values being represented as a uint64, it is very easy to iterate over all possible truth values for a statement; for example:
stmt, t, err := vera.Parse(...) // check err for t.Val = 0; t.Val < 1 << len(t.Names); t.Val++ { // Do something with t such as call stmt.Eval. }
If the names associated with each bit value are needed, they are stored in the Names slice which uses the same indexing scheme as the bits in Val (e.g. t.Val&(1<<i)>0 accesses the value of the statement named t.Names[i] for some Truth t and integer i < len(t.Names)).