move asciitables to std/private/ (#16498)

* move asciitables

* minor
This commit is contained in:
flywind 2020-12-29 09:20:47 -06:00 • committed by GitHub
commit 95f599ca2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 7 deletions

View file

@ -29,7 +29,8 @@
## "A Graph–Free Approach to Data–Flow Analysis" by Markus Mohnen. ## "A Graph–Free Approach to Data–Flow Analysis" by Markus Mohnen.
## https://link.springer.com/content/pdf/10.1007/3-540-45937-5_6.pdf ## https://link.springer.com/content/pdf/10.1007/3-540-45937-5_6.pdf
import ast, types, intsets, lineinfos, renderer, asciitables import ast, types, intsets, lineinfos, renderer
import std/private/asciitables
from patterns import sameTrees from patterns import sameTrees

View file

@ -35,7 +35,7 @@ const
debugEchoCode* = defined(nimVMDebug) debugEchoCode* = defined(nimVMDebug)
when debugEchoCode: when debugEchoCode:
import asciitables import std/private/asciitables
when hasFFI: when hasFFI:
import evalffi import evalffi

View file

@ -1,6 +1,6 @@
#[ #[
move to std/asciitables.nim once stable, or to a nimble paackage move to std/asciitables.nim once stable, or to a fusion package
once compiler can depend on nimble once compiler can depend on fusion
]# ]#
type Cell* = object type Cell* = object
@ -8,7 +8,7 @@ type Cell* = object
width*, row*, col*, ncols*, nrows*: int width*, row*, col*, ncols*, nrows*: int
iterator parseTableCells*(s: string, delim = '\t'): Cell = iterator parseTableCells*(s: string, delim = '\t'): Cell =
## iterates over all cells in a `delim`-delimited `s`, after a 1st ## Iterates over all cells in a `delim`-delimited `s`, after a 1st
## pass that computes number of rows, columns, and width of each column. ## pass that computes number of rows, columns, and width of each column.
var widths: seq[int] var widths: seq[int]
var cell: Cell var cell: Cell
@ -69,7 +69,7 @@ iterator parseTableCells*(s: string, delim = '\t'): Cell =
finishRow() finishRow()
proc alignTable*(s: string, delim = '\t', fill = ' ', sep = " "): string = proc alignTable*(s: string, delim = '\t', fill = ' ', sep = " "): string =
## formats a `delim`-delimited `s` representing a table; each cell is aligned ## Formats a `delim`-delimited `s` representing a table; each cell is aligned
## to a width that's computed for each column; consecutive columns are ## to a width that's computed for each column; consecutive columns are
## delimited by `sep`, and alignment space is filled using `fill`. ## delimited by `sep`, and alignment space is filled using `fill`.
## More customized formatting can be done by calling `parseTableCells` directly. ## More customized formatting can be done by calling `parseTableCells` directly.

View file

@ -1,5 +1,5 @@
import stdtest/unittest_light import stdtest/unittest_light
import compiler/asciitables import std/private/asciitables
import strformat import strformat