Skip to content

Commit

Permalink
move asciitables to std/private/ (#16498)
Browse files Browse the repository at this point in the history
* move asciitables

* minor
  • Loading branch information
ringabout authored Dec 29, 2020
1 parent 89a2390 commit 95f599c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion compiler/dfa.nim
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
## "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

import ast, types, intsets, lineinfos, renderer, asciitables
import ast, types, intsets, lineinfos, renderer
import std/private/asciitables

from patterns import sameTrees

Expand Down
2 changes: 1 addition & 1 deletion compiler/vmgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const
debugEchoCode* = defined(nimVMDebug)

when debugEchoCode:
import asciitables
import std/private/asciitables
when hasFFI:
import evalffi

Expand Down
8 changes: 4 additions & 4 deletions compiler/asciitables.nim → lib/std/private/asciitables.nim
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#[
move to std/asciitables.nim once stable, or to a nimble paackage
once compiler can depend on nimble
move to std/asciitables.nim once stable, or to a fusion package
once compiler can depend on fusion
]#

type Cell* = object
text*: string
width*, row*, col*, ncols*, nrows*: int

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.
var widths: seq[int]
var cell: Cell
Expand Down Expand Up @@ -69,7 +69,7 @@ iterator parseTableCells*(s: string, delim = '\t'): Cell =
finishRow()

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
## delimited by `sep`, and alignment space is filled using `fill`.
## More customized formatting can be done by calling `parseTableCells` directly.
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/tasciitables.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import stdtest/unittest_light
import compiler/asciitables
import std/private/asciitables

import strformat

Expand Down

0 comments on commit 95f599c

Please sign in to comment.