File: separators.go

package info (click to toggle)
miller 6.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 87,928 kB
  • sloc: ruby: 162; sh: 119; makefile: 87
file content (134 lines) | stat: -rw-r--r-- 3,098 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package cli

const COLON = ":"
const COMMA = ","
const CR = "\\r"
const CRCR = "\\r\\r"
const CRLF = "\\r\\n"
const CRLFCRLF = "\\r\\n\\r\\n"
const EQUALS = "="
const LF = "\\n"
const LFLF = "\\n\\n"
const NEWLINE = "\\n"
const PIPE = "|"
const SEMICOLON = ";"
const SLASH = "/"
const SPACE = " "
const TAB = "\\t"

const SPACES_REGEX = "( )+"
const TABS_REGEX = "(\\t)+"
const WHITESPACE_REGEX = "([ \\t])+"

const ASCII_ESC = "\\x1b"
const ASCII_ETX = "\\x03"
const ASCII_FS = "\\x1c"
const ASCII_GS = "\\x1d"
const ASCII_NULL = "\\x00"
const ASCII_RS = "\\x1e"
const ASCII_SOH = "\\x01"
const ASCII_STX = "\\x02"
const ASCII_US = "\\x1f"

const ASV_FS = "\\x1f"
const ASV_RS = "\\x1e"
const USV_FS = "\\xe2\\x90\\x9f"
const USV_RS = "\\xe2\\x90\\x9e"

const ASV_FS_FOR_HELP = "\\x1f"
const ASV_RS_FOR_HELP = "\\x1e"
const USV_FS_FOR_HELP = "U+241F (UTF-8 \\xe2\\x90\\x9f)"
const USV_RS_FOR_HELP = "U+241E (UTF-8 \\xe2\\x90\\x9e)"

const DEFAULT_JSON_FLATTEN_SEPARATOR = "."

var SEPARATOR_NAMES_TO_VALUES = map[string]string{
	"ascii_esc":  ASCII_ESC,
	"ascii_etx":  ASCII_ETX,
	"ascii_fs":   ASCII_FS,
	"ascii_gs":   ASCII_GS,
	"ascii_null": ASCII_NULL,
	"ascii_rs":   ASCII_RS,
	"ascii_soh":  ASCII_SOH,
	"ascii_stx":  ASCII_STX,
	"ascii_us":   ASCII_US,
	"asv_fs":     ASV_FS,
	"asv_rs":     ASV_RS,
	"colon":      COLON,
	"comma":      COMMA,
	"cr":         CR,
	"crcr":       CRCR,
	"crlf":       CRLF,
	"crlfcrlf":   CRLFCRLF,
	"equals":     EQUALS,
	"lf":         LF,
	"lflf":       LFLF,
	"newline":    NEWLINE,
	"pipe":       PIPE,
	"semicolon":  SEMICOLON,
	"slash":      SLASH,
	"space":      SPACE,
	"tab":        TAB,
	"usv_fs":     USV_FS,
	"usv_rs":     USV_RS,
}

var SEPARATOR_REGEX_NAMES_TO_VALUES = map[string]string{
	"spaces":     SPACES_REGEX,
	"tabs":       TABS_REGEX,
	"whitespace": WHITESPACE_REGEX,
}

// E.g. if IFS isn't specified, it's space for NIDX and comma for DKVP, etc.

var defaultFSes = map[string]string{
	"gen":      ",",
	"csv":      ",",
	"csvlite":  ",",
	"dkvp":     ",",
	"json":     "N/A", // not alterable; not parameterizable in JSON format
	"nidx":     " ",
	"markdown": " ",
	"pprint":   " ",
	"tsv":      "\t",
	"xtab":     "\n", // todo: windows-dependent ...
}

var defaultPSes = map[string]string{
	"gen":      "N/A",
	"csv":      "N/A",
	"csvlite":  "N/A",
	"dkvp":     "=",
	"json":     "N/A", // not alterable; not parameterizable in JSON format
	"markdown": "N/A",
	"nidx":     "N/A",
	"pprint":   "N/A",
	"tsv":      "N/A",
	"xtab":     " ",
}

var defaultRSes = map[string]string{
	"gen":      "\n",
	"csv":      "\n",
	"csvlite":  "\n",
	"dkvp":     "\n",
	"json":     "N/A", // not alterable; not parameterizable in JSON format
	"markdown": "\n",
	"nidx":     "\n",
	"pprint":   "\n",
	"tsv":      "\n",
	"xtab":     "\n\n", // todo: maybe jettison the idea of this being alterable
}

var defaultAllowRepeatIFSes = map[string]bool{
	"gen":      false,
	"csv":      false,
	"csvlite":  false,
	"dkvp":     false,
	"json":     false,
	"markdown": false,
	"nidx":     false,
	"pprint":   true,
	"tsv":      false,
	"xtab":     false,
}