Example #1
0
 public static Doc <Unit> Nesting(Func <int, Doc <Unit> > f) =>
 DocAnn.Nesting(f);
Example #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);
Example #3
0
 public static Doc <Unit> Cat(Doc <Unit> da, Doc <Unit> db) =>
 DocAnn.Cat(da, db);
Example #4
0
 public static Doc <Unit> Column(Func <int, Doc <Unit> > f) =>
 DocAnn.Column(f);
Example #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);
Example #6
0
 /// <summary>
 /// Enclose
 /// </summary>
 public static Doc <Unit> Between(Doc <Unit> left, Doc <Unit> right, Doc <Unit> middle) =>
 DocAnn.Between(left, middle, right);
Example #7
0
 /// <summary>
 /// Haskell-inspired array/list formatting
 /// </summary>
 public static Doc <Unit> List(params Doc <Unit>[] docs) =>
 DocAnn.List(docs);
Example #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);
Example #9
0
 /// <summary>
 /// Haskell-inspired array/list formatting
 /// </summary>
 public static Doc <Unit> List(Seq <Doc <Unit> > docs) =>
 DocAnn.List(docs);
Example #10
0
 /// <summary>
 /// Haskell-inspired tuple formatting
 /// </summary>
 public static Doc <Unit> Tuple(Seq <Doc <Unit> > docs) =>
 DocAnn.Tuple(docs);
Example #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);
Example #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);
Example #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);
Example #14
0
 /// <summary>
 /// Hard line separator
 /// </summary>
 public static Doc <Unit> HardSep(Seq <Doc <Unit> > docs) =>
 DocAnn.HardSep(docs);
Example #15
0
 /// <summary>
 /// Haskell-inspired tuple formatting
 /// </summary>
 public static Doc <Unit> Tuple(params Doc <Unit>[] docs) =>
 DocAnn.Tuple(docs);
Example #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);
Example #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);
Example #18
0
 public static Doc <Unit> FlatAlt(Doc <Unit> da, Doc <Unit> db) =>
 DocAnn.FlatAlt(da, db);
Example #19
0
 public static Doc <Unit> Char(char c) =>
 DocAnn.Char <Unit>(c);
Example #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);
Example #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);
Example #22
0
 public static Doc <Unit> Union(Doc <Unit> da, Doc <Unit> db) =>
 DocAnn.Union(da, db);
Example #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);
Example #24
0
 public static Doc <Unit> Nest(int indent, Doc <Unit> doc) =>
 DocAnn.Nest(indent, doc);
Example #25
0
 public static Doc <Unit> Text(string text) =>
 DocAnn.Text <Unit>(text);
Example #26
0
 public static Doc <Unit> PageWidth(Func <PageWidth, Doc <Unit> > f) =>
 DocAnn.PageWidth(f);
Example #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);
Example #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);
Example #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);