@effekt-lang/effekt 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/effekt +0 -0
- package/libraries/common/char.effekt +47 -23
- package/libraries/common/effekt.effekt +6 -1
- package/libraries/common/json.effekt +385 -0
- package/libraries/common/list.effekt +21 -0
- package/libraries/common/scanner.effekt +171 -0
- package/libraries/common/stream.effekt +161 -134
- package/libraries/common/test.effekt +3 -3
- package/libraries/common/tty.effekt +192 -0
- package/licenses/eclipse public license, version 2.0 - epl-2.0.html +10 -10
- package/licenses/mit license - mit-license.html +1263 -0
- package/licenses/the bsd license - bsd-license.html +1261 -0
- package/licenses/the mit license - mit.html +1261 -0
- package/package.json +1 -1
- package/libraries/common/string/tty.effekt +0 -66
package/package.json
CHANGED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
module string/tty
|
|
2
|
-
|
|
3
|
-
// ANSI escape codes
|
|
4
|
-
namespace ANSI {
|
|
5
|
-
val CSI = "\u001b["
|
|
6
|
-
|
|
7
|
-
def escape(s: String) = CSI ++ s ++ "m"
|
|
8
|
-
|
|
9
|
-
val BLACK = escape("30")
|
|
10
|
-
val RED = escape("31")
|
|
11
|
-
val GREEN = escape("32")
|
|
12
|
-
val YELLOW = escape("33")
|
|
13
|
-
val BLUE = escape("34")
|
|
14
|
-
val MAGENTA = escape("35")
|
|
15
|
-
val CYAN = escape("36")
|
|
16
|
-
val WHITE = escape("37")
|
|
17
|
-
|
|
18
|
-
val BG_BLACK = escape("40")
|
|
19
|
-
val BG_RED = escape("41")
|
|
20
|
-
val BG_GREEN = escape("42")
|
|
21
|
-
val BG_YELLOW = escape("43")
|
|
22
|
-
val BG_BLUE = escape("44")
|
|
23
|
-
val BG_MAGENTA = escape("45")
|
|
24
|
-
val BG_CYAN = escape("46")
|
|
25
|
-
val BG_WHITE = escape("47")
|
|
26
|
-
|
|
27
|
-
val RESET = escape("0")
|
|
28
|
-
|
|
29
|
-
val BOLD = escape("1")
|
|
30
|
-
val FAINT = escape("2")
|
|
31
|
-
val ITALIC = escape("3")
|
|
32
|
-
val UNDERLINE = escape("4")
|
|
33
|
-
val BLINK = escape("5")
|
|
34
|
-
val REVERSE = escape("7")
|
|
35
|
-
val CROSSOUT = escape("9")
|
|
36
|
-
val OVERLINE = escape("53")
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
def red(text: String) = Formatted::colored(text, ANSI::RED)
|
|
40
|
-
def green(text: String) = Formatted::colored(text, ANSI::GREEN)
|
|
41
|
-
def dim(text: String) = Formatted::colored(text, ANSI::FAINT)
|
|
42
|
-
def bold(text: String) = Formatted::colored(text, ANSI::BOLD)
|
|
43
|
-
|
|
44
|
-
interface Formatted {
|
|
45
|
-
def supportsEscape(escape: String): Bool
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
namespace Formatted {
|
|
49
|
-
/// Run given block of code, allowing all formatting
|
|
50
|
-
def formatting[R] { prog : => R / Formatted }: R =
|
|
51
|
-
try { prog() } with Formatted {
|
|
52
|
-
def supportsEscape(escape: String) = resume(true)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/// Run given block of code, ignoring all formatting
|
|
56
|
-
def noFormatting[R] { prog : => R / Formatted }: R =
|
|
57
|
-
try { prog() } with Formatted {
|
|
58
|
-
def supportsEscape(escape: String) = resume(false)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
def tryEmit(escape: String): String / Formatted =
|
|
62
|
-
if (do supportsEscape(escape)) escape else ""
|
|
63
|
-
|
|
64
|
-
def colored(text: String, colorEscape: String): String / Formatted =
|
|
65
|
-
tryEmit(colorEscape) ++ text ++ tryEmit(ANSI::RESET)
|
|
66
|
-
}
|