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
|
package marker
import (
"bytes"
)
const (
// For simplicity we are using a rune that is one byte wide. A character
// that is not used widely (apart from cli's) is the bell character (7).
MarkerEscaping rune = '\a'
// - - - - //
// Marker0 rune = '\uF000' // 61440
// Marker1 rune = '\uF001' // 61441
MarkerCodeBlockNewline rune = '\uF002' // 61442
)
var (
BytesMarkerEscaping = []byte{7}
BytesMarkerCodeBlockNewline = []byte{239, 128, 130}
)
func init() {
checkRuneAndByteSlice(MarkerEscaping, BytesMarkerEscaping)
checkRuneAndByteSlice(MarkerCodeBlockNewline, BytesMarkerCodeBlockNewline)
}
func checkRuneAndByteSlice(r rune, b []byte) {
if !bytes.Equal([]byte(string(r)), b) {
panic("the rune and byte slice do not represent the same character")
}
}
|