Exemplo n.º 1
0
 public static Doc <Unit> Nesting(Func <int, Doc <Unit> > f) =>
 DocAnn.Nesting(f);
Exemplo n.º 2
0
 /// <summary>
 /// Hang lays out the document with a nesting level set to the
 /// /current column/ plus offset. Negative values are allowed, and decrease the
 /// nesting level accordingly.
 ///
 /// >>> var doc = Reflow("Indenting these words with hang")
 /// >>> PutDocW(24, ("prefix" + Hang(4, doc)))
 /// prefix Indenting these
 ///            words with
 ///            hang
 ///
 /// This differs from Nest, which is based on the /current nesting level/ plus
 /// offset. When you're not sure, try the more efficient 'nest' first. In our
 /// example, this would yield
 ///
 /// >>> var doc = Reflow("Indenting these words with nest")
 /// >>> PutDocW(24, "prefix" + Nest(4, doc))
 /// prefix Indenting these
 ///     words with nest
 /// </summary>
 public static Doc <Unit> Hang(int offset, Doc <Unit> doc) =>
 DocAnn.Hang(offset, doc);
Exemplo n.º 3
0
 public static Doc <Unit> Cat(Doc <Unit> da, Doc <Unit> db) =>
 DocAnn.Cat(da, db);
Exemplo n.º 4
0
 public static Doc <Unit> Column(Func <int, Doc <Unit> > f) =>
 DocAnn.Column(f);
Exemplo n.º 5
0
 /// <summary>
 /// Width lays out the document 'doc', and makes the column width
 /// of it available to a function.
 /// </summary>
 public static Doc <Unit> Width(Doc <Unit> doc, Func <int, Doc <Unit> > f) =>
 DocAnn.Width(doc, f);
Exemplo n.º 6
0
 /// <summary>
 /// Enclose
 /// </summary>
 public static Doc <Unit> Between(Doc <Unit> left, Doc <Unit> right, Doc <Unit> middle) =>
 DocAnn.Between(left, middle, right);
Exemplo n.º 7
0
 /// <summary>
 /// Haskell-inspired array/list formatting
 /// </summary>
 public static Doc <Unit> List(params Doc <Unit>[] docs) =>
 DocAnn.List(docs);
Exemplo n.º 8
0
 /// <summary>
 /// VertCat vertically concatenates the documents. If it is
 /// Grouped, the line breaks are removed.
 ///
 /// In other words VertCat is like VertSep, with newlines removed instead of
 /// replaced by spaces.
 /// </summary>
 public static Doc <Unit> VertCat(Seq <Doc <Unit> > docs) =>
 DocAnn.VertSep(docs);
Exemplo n.º 9
0
 /// <summary>
 /// Haskell-inspired array/list formatting
 /// </summary>
 public static Doc <Unit> List(Seq <Doc <Unit> > docs) =>
 DocAnn.List(docs);
Exemplo n.º 10
0
 /// <summary>
 /// Haskell-inspired tuple formatting
 /// </summary>
 public static Doc <Unit> Tuple(Seq <Doc <Unit> > docs) =>
 DocAnn.Tuple(docs);
Exemplo n.º 11
0
 /// <summary>
 /// Delimit and intersperse the documents with a separator
 /// </summary>
 public static Doc <Unit> EncloseSep(Doc <Unit> leftDelim, Doc <Unit> rightDelim, Doc <Unit> sep, params Doc <Unit>[] docs) =>
 DocAnn.BetweenSep(leftDelim, rightDelim, sep, docs);
Exemplo n.º 12
0
 /// <summary>
 /// Delimit and intersperse the documents with a separator
 /// </summary>
 public static Doc <Unit> EncloseSep(Doc <Unit> leftDelim, Doc <Unit> rightDelim, Doc <Unit> sep, Seq <Doc <Unit> > docs) =>
 DocAnn.BetweenSep(leftDelim, rightDelim, sep, docs);
Exemplo n.º 13
0
 /// <summary>
 /// Indents document `indent` columns, starting from the
 /// current cursor position.
 ///
 /// >>> var doc = Reflow("The indent function indents these words!")
 /// >>> PutDocW(24, ("prefix" + Indent(4, doc))
 /// prefix    The indent
 ///           function
 ///           indents these
 ///           words!
 ///
 /// </summary>
 public static Doc <Unit> Indent(int indent, Doc <Unit> doc) =>
 DocAnn.Indent(indent, doc);
Exemplo n.º 14
0
 /// <summary>
 /// Hard line separator
 /// </summary>
 public static Doc <Unit> HardSep(Seq <Doc <Unit> > docs) =>
 DocAnn.HardSep(docs);
Exemplo n.º 15
0
 /// <summary>
 /// Haskell-inspired tuple formatting
 /// </summary>
 public static Doc <Unit> Tuple(params Doc <Unit>[] docs) =>
 DocAnn.Tuple(docs);
Exemplo n.º 16
0
 /// <summary>
 /// HorizCat concatenates all documents horizontally with |
 /// (i.e. without any spacing).
 ///
 /// It is provided only for consistency, since it is identical to 'Cat'.
 /// </summary>
 public static Doc <Unit> HorizCat(Seq <Doc <Unit> > docs) =>
 DocAnn.HorizSep(docs);
Exemplo n.º 17
0
 /// <summary>
 /// Insert a number of spaces. Negative values count as 0.
 /// </summary>
 public static Doc <Unit> Spaces(int n) =>
 DocAnn.Spaces <Unit>(n);
Exemplo n.º 18
0
 public static Doc <Unit> FlatAlt(Doc <Unit> da, Doc <Unit> db) =>
 DocAnn.FlatAlt(da, db);
Exemplo n.º 19
0
 public static Doc <Unit> Char(char c) =>
 DocAnn.Char <Unit>(c);
Exemplo n.º 20
0
 /// <summary>
 /// Fill lays out the document. It then appends spaces until
 /// the width is equal to `width`. If the width is already larger, nothing is
 /// appended.
 /// </summary>
 public static Doc <Unit> Fill(int width, Doc <Unit> doc) =>
 DocAnn.Fill(width, doc);
Exemplo n.º 21
0
 /// <summary>
 /// Intersperse the documents with a separator
 /// </summary>
 public static Doc <Unit> Sep(Doc <Unit> sep, Seq <Doc <Unit> > docs) =>
 DocAnn.Sep(sep, docs);
Exemplo n.º 22
0
 public static Doc <Unit> Union(Doc <Unit> da, Doc <Unit> db) =>
 DocAnn.Union(da, db);
Exemplo n.º 23
0
 /// <summary>
 /// Sep tries laying out the documents separated with 'space's,
 /// and if this does not fit the page, separates them with newlines. This is what
 /// differentiates it from VerSep, which always lays out its contents beneath
 /// each other.
 /// </summary>
 public static Doc <Unit> Sep(Seq <Doc <Unit> > docs) =>
 DocAnn.Sep(docs);
Exemplo n.º 24
0
 public static Doc <Unit> Nest(int indent, Doc <Unit> doc) =>
 DocAnn.Nest(indent, doc);
Exemplo n.º 25
0
 public static Doc <Unit> Text(string text) =>
 DocAnn.Text <Unit>(text);
Exemplo n.º 26
0
 public static Doc <Unit> PageWidth(Func <PageWidth, Doc <Unit> > f) =>
 DocAnn.PageWidth(f);
Exemplo n.º 27
0
 /// <summary>
 /// FillSep concatenates the documents horizontally with `+` (inserting a space)
 /// as long as it fits the page, then inserts a Line and continues doing that
 /// for all documents in (Line means that if Grouped, the documents
 /// are separated with a Space instead of newlines.  Use 'FillCat' if you do not
 /// want a 'space'.)
 /// </summary>
 public static Doc <Unit> FillSep(Seq <Doc <Unit> > docs) =>
 DocAnn.FillSep(docs);
Exemplo n.º 28
0
 /// <summary>
 /// Group tries laying out doc into a single line by removing the
 /// contained line breaks; if this does not fit the page, or when a 'hardline'
 /// within doc prevents it from being flattened, doc is laid out without any
 /// changes.
 ///
 /// The 'group' function is key to layouts that adapt to available space nicely.
 /// </summary>
 public static Doc <Unit> Group(Doc <Unit> doc) =>
 DocAnn.Group(doc);
Exemplo n.º 29
0
 /// <summary>
 /// Align lays out the document with the nesting level set to the
 /// current column. It is used for example to implement 'hang'.
 ///
 /// As an example, we will put a document right above another one, regardless of
 /// the current nesting level. Without alignment, the second line is put simply
 /// below everything we've had so far,
 ///
 ///     Text("lorem") + VertSep(["ipsum", "dolor"])
 ///
 /// lorem ipsum
 /// dolor
 ///
 /// If we add an Align to the mix, the VertSep contents all start in the
 /// same column,
 ///
 /// >>> Text("lorem") + Align (VertSep(["ipsum", "dolor"]))
 /// lorem ipsum
 ///       dolor
 /// </summary>
 public static Doc <Unit> Align(Doc <Unit> doc) =>
 DocAnn.Align(doc);