repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/rivo/uniseg/wordproperties.go
vendor/github.com/rivo/uniseg/wordproperties.go
// Code generated via go generate from gen_properties.go. DO NOT EDIT. package uniseg // workBreakCodePoints are taken from // https://www.unicode.org/Public/15.0.0/ucd/auxiliary/WordBreakProperty.txt // and // https://unicode.org/Public/15.0.0/ucd/emoji/emoji-data.txt // ("Extended_Pictographic" only) // on September 5, 2023. See https://www.unicode.org/license.html for the Unicode // license agreement. var workBreakCodePoints = [][3]int{ {0x000A, 0x000A, prLF}, // Cc <control-000A> {0x000B, 0x000C, prNewline}, // Cc [2] <control-000B>..<control-000C> {0x000D, 0x000D, prCR}, // Cc <control-000D> {0x0020, 0x0020, prWSegSpace}, // Zs SPACE {0x0022, 0x0022, prDoubleQuote}, // Po QUOTATION MARK {0x0027, 0x0027, prSingleQuote}, // Po APOSTROPHE {0x002C, 0x002C, prMidNum}, // Po COMMA {0x002E, 0x002E, prMidNumLet}, // Po FULL STOP {0x0030, 0x0039, prNumeric}, // Nd [10] DIGIT ZERO..DIGIT NINE {0x003A, 0x003A, prMidLetter}, // Po COLON {0x003B, 0x003B, prMidNum}, // Po SEMICOLON {0x0041, 0x005A, prALetter}, // L& [26] LATIN CAPITAL LETTER A..LATIN CAPITAL LETTER Z {0x005F, 0x005F, prExtendNumLet}, // Pc LOW LINE {0x0061, 0x007A, prALetter}, // L& [26] LATIN SMALL LETTER A..LATIN SMALL LETTER Z {0x0085, 0x0085, prNewline}, // Cc <control-0085> {0x00A9, 0x00A9, prExtendedPictographic}, // E0.6 [1] (©️) copyright {0x00AA, 0x00AA, prALetter}, // Lo FEMININE ORDINAL INDICATOR {0x00AD, 0x00AD, prFormat}, // Cf SOFT HYPHEN {0x00AE, 0x00AE, prExtendedPictographic}, // E0.6 [1] (®️) registered {0x00B5, 0x00B5, prALetter}, // L& MICRO SIGN {0x00B7, 0x00B7, prMidLetter}, // Po MIDDLE DOT {0x00BA, 0x00BA, prALetter}, // Lo MASCULINE ORDINAL INDICATOR {0x00C0, 0x00D6, prALetter}, // L& [23] LATIN CAPITAL LETTER A WITH GRAVE..LATIN CAPITAL LETTER O WITH DIAERESIS {0x00D8, 0x00F6, prALetter}, // L& [31] LATIN CAPITAL LETTER O WITH STROKE..LATIN SMALL LETTER O WITH DIAERESIS {0x00F8, 0x01BA, prALetter}, // L& [195] LATIN SMALL LETTER O WITH STROKE..LATIN SMALL LETTER EZH WITH TAIL {0x01BB, 0x01BB, prALetter}, // Lo LATIN LETTER TWO WITH STROKE {0x01BC, 0x01BF, prALetter}, // L& [4] LATIN CAPITAL LETTER TONE FIVE..LATIN LETTER WYNN {0x01C0, 0x01C3, prALetter}, // Lo [4] LATIN LETTER DENTAL CLICK..LATIN LETTER RETROFLEX CLICK {0x01C4, 0x0293, prALetter}, // L& [208] LATIN CAPITAL LETTER DZ WITH CARON..LATIN SMALL LETTER EZH WITH CURL {0x0294, 0x0294, prALetter}, // Lo LATIN LETTER GLOTTAL STOP {0x0295, 0x02AF, prALetter}, // L& [27] LATIN LETTER PHARYNGEAL VOICED FRICATIVE..LATIN SMALL LETTER TURNED H WITH FISHHOOK AND TAIL {0x02B0, 0x02C1, prALetter}, // Lm [18] MODIFIER LETTER SMALL H..MODIFIER LETTER REVERSED GLOTTAL STOP {0x02C2, 0x02C5, prALetter}, // Sk [4] MODIFIER LETTER LEFT ARROWHEAD..MODIFIER LETTER DOWN ARROWHEAD {0x02C6, 0x02D1, prALetter}, // Lm [12] MODIFIER LETTER CIRCUMFLEX ACCENT..MODIFIER LETTER HALF TRIANGULAR COLON {0x02D2, 0x02D7, prALetter}, // Sk [6] MODIFIER LETTER CENTRED RIGHT HALF RING..MODIFIER LETTER MINUS SIGN {0x02DE, 0x02DF, prALetter}, // Sk [2] MODIFIER LETTER RHOTIC HOOK..MODIFIER LETTER CROSS ACCENT {0x02E0, 0x02E4, prALetter}, // Lm [5] MODIFIER LETTER SMALL GAMMA..MODIFIER LETTER SMALL REVERSED GLOTTAL STOP {0x02E5, 0x02EB, prALetter}, // Sk [7] MODIFIER LETTER EXTRA-HIGH TONE BAR..MODIFIER LETTER YANG DEPARTING TONE MARK {0x02EC, 0x02EC, prALetter}, // Lm MODIFIER LETTER VOICING {0x02ED, 0x02ED, prALetter}, // Sk MODIFIER LETTER UNASPIRATED {0x02EE, 0x02EE, prALetter}, // Lm MODIFIER LETTER DOUBLE APOSTROPHE {0x02EF, 0x02FF, prALetter}, // Sk [17] MODIFIER LETTER LOW DOWN ARROWHEAD..MODIFIER LETTER LOW LEFT ARROW {0x0300, 0x036F, prExtend}, // Mn [112] COMBINING GRAVE ACCENT..COMBINING LATIN SMALL LETTER X {0x0370, 0x0373, prALetter}, // L& [4] GREEK CAPITAL LETTER HETA..GREEK SMALL LETTER ARCHAIC SAMPI {0x0374, 0x0374, prALetter}, // Lm GREEK NUMERAL SIGN {0x0376, 0x0377, prALetter}, // L& [2] GREEK CAPITAL LETTER PAMPHYLIAN DIGAMMA..GREEK SMALL LETTER PAMPHYLIAN DIGAMMA {0x037A, 0x037A, prALetter}, // Lm GREEK YPOGEGRAMMENI {0x037B, 0x037D, prALetter}, // L& [3] GREEK SMALL REVERSED LUNATE SIGMA SYMBOL..GREEK SMALL REVERSED DOTTED LUNATE SIGMA SYMBOL {0x037E, 0x037E, prMidNum}, // Po GREEK QUESTION MARK {0x037F, 0x037F, prALetter}, // L& GREEK CAPITAL LETTER YOT {0x0386, 0x0386, prALetter}, // L& GREEK CAPITAL LETTER ALPHA WITH TONOS {0x0387, 0x0387, prMidLetter}, // Po GREEK ANO TELEIA {0x0388, 0x038A, prALetter}, // L& [3] GREEK CAPITAL LETTER EPSILON WITH TONOS..GREEK CAPITAL LETTER IOTA WITH TONOS {0x038C, 0x038C, prALetter}, // L& GREEK CAPITAL LETTER OMICRON WITH TONOS {0x038E, 0x03A1, prALetter}, // L& [20] GREEK CAPITAL LETTER UPSILON WITH TONOS..GREEK CAPITAL LETTER RHO {0x03A3, 0x03F5, prALetter}, // L& [83] GREEK CAPITAL LETTER SIGMA..GREEK LUNATE EPSILON SYMBOL {0x03F7, 0x0481, prALetter}, // L& [139] GREEK CAPITAL LETTER SHO..CYRILLIC SMALL LETTER KOPPA {0x0483, 0x0487, prExtend}, // Mn [5] COMBINING CYRILLIC TITLO..COMBINING CYRILLIC POKRYTIE {0x0488, 0x0489, prExtend}, // Me [2] COMBINING CYRILLIC HUNDRED THOUSANDS SIGN..COMBINING CYRILLIC MILLIONS SIGN {0x048A, 0x052F, prALetter}, // L& [166] CYRILLIC CAPITAL LETTER SHORT I WITH TAIL..CYRILLIC SMALL LETTER EL WITH DESCENDER {0x0531, 0x0556, prALetter}, // L& [38] ARMENIAN CAPITAL LETTER AYB..ARMENIAN CAPITAL LETTER FEH {0x0559, 0x0559, prALetter}, // Lm ARMENIAN MODIFIER LETTER LEFT HALF RING {0x055A, 0x055C, prALetter}, // Po [3] ARMENIAN APOSTROPHE..ARMENIAN EXCLAMATION MARK {0x055E, 0x055E, prALetter}, // Po ARMENIAN QUESTION MARK {0x055F, 0x055F, prMidLetter}, // Po ARMENIAN ABBREVIATION MARK {0x0560, 0x0588, prALetter}, // L& [41] ARMENIAN SMALL LETTER TURNED AYB..ARMENIAN SMALL LETTER YI WITH STROKE {0x0589, 0x0589, prMidNum}, // Po ARMENIAN FULL STOP {0x058A, 0x058A, prALetter}, // Pd ARMENIAN HYPHEN {0x0591, 0x05BD, prExtend}, // Mn [45] HEBREW ACCENT ETNAHTA..HEBREW POINT METEG {0x05BF, 0x05BF, prExtend}, // Mn HEBREW POINT RAFE {0x05C1, 0x05C2, prExtend}, // Mn [2] HEBREW POINT SHIN DOT..HEBREW POINT SIN DOT {0x05C4, 0x05C5, prExtend}, // Mn [2] HEBREW MARK UPPER DOT..HEBREW MARK LOWER DOT {0x05C7, 0x05C7, prExtend}, // Mn HEBREW POINT QAMATS QATAN {0x05D0, 0x05EA, prHebrewLetter}, // Lo [27] HEBREW LETTER ALEF..HEBREW LETTER TAV {0x05EF, 0x05F2, prHebrewLetter}, // Lo [4] HEBREW YOD TRIANGLE..HEBREW LIGATURE YIDDISH DOUBLE YOD {0x05F3, 0x05F3, prALetter}, // Po HEBREW PUNCTUATION GERESH {0x05F4, 0x05F4, prMidLetter}, // Po HEBREW PUNCTUATION GERSHAYIM {0x0600, 0x0605, prFormat}, // Cf [6] ARABIC NUMBER SIGN..ARABIC NUMBER MARK ABOVE {0x060C, 0x060D, prMidNum}, // Po [2] ARABIC COMMA..ARABIC DATE SEPARATOR {0x0610, 0x061A, prExtend}, // Mn [11] ARABIC SIGN SALLALLAHOU ALAYHE WASSALLAM..ARABIC SMALL KASRA {0x061C, 0x061C, prFormat}, // Cf ARABIC LETTER MARK {0x0620, 0x063F, prALetter}, // Lo [32] ARABIC LETTER KASHMIRI YEH..ARABIC LETTER FARSI YEH WITH THREE DOTS ABOVE {0x0640, 0x0640, prALetter}, // Lm ARABIC TATWEEL {0x0641, 0x064A, prALetter}, // Lo [10] ARABIC LETTER FEH..ARABIC LETTER YEH {0x064B, 0x065F, prExtend}, // Mn [21] ARABIC FATHATAN..ARABIC WAVY HAMZA BELOW {0x0660, 0x0669, prNumeric}, // Nd [10] ARABIC-INDIC DIGIT ZERO..ARABIC-INDIC DIGIT NINE {0x066B, 0x066B, prNumeric}, // Po ARABIC DECIMAL SEPARATOR {0x066C, 0x066C, prMidNum}, // Po ARABIC THOUSANDS SEPARATOR {0x066E, 0x066F, prALetter}, // Lo [2] ARABIC LETTER DOTLESS BEH..ARABIC LETTER DOTLESS QAF {0x0670, 0x0670, prExtend}, // Mn ARABIC LETTER SUPERSCRIPT ALEF {0x0671, 0x06D3, prALetter}, // Lo [99] ARABIC LETTER ALEF WASLA..ARABIC LETTER YEH BARREE WITH HAMZA ABOVE {0x06D5, 0x06D5, prALetter}, // Lo ARABIC LETTER AE {0x06D6, 0x06DC, prExtend}, // Mn [7] ARABIC SMALL HIGH LIGATURE SAD WITH LAM WITH ALEF MAKSURA..ARABIC SMALL HIGH SEEN {0x06DD, 0x06DD, prFormat}, // Cf ARABIC END OF AYAH {0x06DF, 0x06E4, prExtend}, // Mn [6] ARABIC SMALL HIGH ROUNDED ZERO..ARABIC SMALL HIGH MADDA {0x06E5, 0x06E6, prALetter}, // Lm [2] ARABIC SMALL WAW..ARABIC SMALL YEH {0x06E7, 0x06E8, prExtend}, // Mn [2] ARABIC SMALL HIGH YEH..ARABIC SMALL HIGH NOON {0x06EA, 0x06ED, prExtend}, // Mn [4] ARABIC EMPTY CENTRE LOW STOP..ARABIC SMALL LOW MEEM {0x06EE, 0x06EF, prALetter}, // Lo [2] ARABIC LETTER DAL WITH INVERTED V..ARABIC LETTER REH WITH INVERTED V {0x06F0, 0x06F9, prNumeric}, // Nd [10] EXTENDED ARABIC-INDIC DIGIT ZERO..EXTENDED ARABIC-INDIC DIGIT NINE {0x06FA, 0x06FC, prALetter}, // Lo [3] ARABIC LETTER SHEEN WITH DOT BELOW..ARABIC LETTER GHAIN WITH DOT BELOW {0x06FF, 0x06FF, prALetter}, // Lo ARABIC LETTER HEH WITH INVERTED V {0x070F, 0x070F, prFormat}, // Cf SYRIAC ABBREVIATION MARK {0x0710, 0x0710, prALetter}, // Lo SYRIAC LETTER ALAPH {0x0711, 0x0711, prExtend}, // Mn SYRIAC LETTER SUPERSCRIPT ALAPH {0x0712, 0x072F, prALetter}, // Lo [30] SYRIAC LETTER BETH..SYRIAC LETTER PERSIAN DHALATH {0x0730, 0x074A, prExtend}, // Mn [27] SYRIAC PTHAHA ABOVE..SYRIAC BARREKH {0x074D, 0x07A5, prALetter}, // Lo [89] SYRIAC LETTER SOGDIAN ZHAIN..THAANA LETTER WAAVU {0x07A6, 0x07B0, prExtend}, // Mn [11] THAANA ABAFILI..THAANA SUKUN {0x07B1, 0x07B1, prALetter}, // Lo THAANA LETTER NAA {0x07C0, 0x07C9, prNumeric}, // Nd [10] NKO DIGIT ZERO..NKO DIGIT NINE {0x07CA, 0x07EA, prALetter}, // Lo [33] NKO LETTER A..NKO LETTER JONA RA {0x07EB, 0x07F3, prExtend}, // Mn [9] NKO COMBINING SHORT HIGH TONE..NKO COMBINING DOUBLE DOT ABOVE {0x07F4, 0x07F5, prALetter}, // Lm [2] NKO HIGH TONE APOSTROPHE..NKO LOW TONE APOSTROPHE {0x07F8, 0x07F8, prMidNum}, // Po NKO COMMA {0x07FA, 0x07FA, prALetter}, // Lm NKO LAJANYALAN {0x07FD, 0x07FD, prExtend}, // Mn NKO DANTAYALAN {0x0800, 0x0815, prALetter}, // Lo [22] SAMARITAN LETTER ALAF..SAMARITAN LETTER TAAF {0x0816, 0x0819, prExtend}, // Mn [4] SAMARITAN MARK IN..SAMARITAN MARK DAGESH {0x081A, 0x081A, prALetter}, // Lm SAMARITAN MODIFIER LETTER EPENTHETIC YUT {0x081B, 0x0823, prExtend}, // Mn [9] SAMARITAN MARK EPENTHETIC YUT..SAMARITAN VOWEL SIGN A {0x0824, 0x0824, prALetter}, // Lm SAMARITAN MODIFIER LETTER SHORT A {0x0825, 0x0827, prExtend}, // Mn [3] SAMARITAN VOWEL SIGN SHORT A..SAMARITAN VOWEL SIGN U {0x0828, 0x0828, prALetter}, // Lm SAMARITAN MODIFIER LETTER I {0x0829, 0x082D, prExtend}, // Mn [5] SAMARITAN VOWEL SIGN LONG I..SAMARITAN MARK NEQUDAA {0x0840, 0x0858, prALetter}, // Lo [25] MANDAIC LETTER HALQA..MANDAIC LETTER AIN {0x0859, 0x085B, prExtend}, // Mn [3] MANDAIC AFFRICATION MARK..MANDAIC GEMINATION MARK {0x0860, 0x086A, prALetter}, // Lo [11] SYRIAC LETTER MALAYALAM NGA..SYRIAC LETTER MALAYALAM SSA {0x0870, 0x0887, prALetter}, // Lo [24] ARABIC LETTER ALEF WITH ATTACHED FATHA..ARABIC BASELINE ROUND DOT {0x0889, 0x088E, prALetter}, // Lo [6] ARABIC LETTER NOON WITH INVERTED SMALL V..ARABIC VERTICAL TAIL {0x0890, 0x0891, prFormat}, // Cf [2] ARABIC POUND MARK ABOVE..ARABIC PIASTRE MARK ABOVE {0x0898, 0x089F, prExtend}, // Mn [8] ARABIC SMALL HIGH WORD AL-JUZ..ARABIC HALF MADDA OVER MADDA {0x08A0, 0x08C8, prALetter}, // Lo [41] ARABIC LETTER BEH WITH SMALL V BELOW..ARABIC LETTER GRAF {0x08C9, 0x08C9, prALetter}, // Lm ARABIC SMALL FARSI YEH {0x08CA, 0x08E1, prExtend}, // Mn [24] ARABIC SMALL HIGH FARSI YEH..ARABIC SMALL HIGH SIGN SAFHA {0x08E2, 0x08E2, prFormat}, // Cf ARABIC DISPUTED END OF AYAH {0x08E3, 0x0902, prExtend}, // Mn [32] ARABIC TURNED DAMMA BELOW..DEVANAGARI SIGN ANUSVARA {0x0903, 0x0903, prExtend}, // Mc DEVANAGARI SIGN VISARGA {0x0904, 0x0939, prALetter}, // Lo [54] DEVANAGARI LETTER SHORT A..DEVANAGARI LETTER HA {0x093A, 0x093A, prExtend}, // Mn DEVANAGARI VOWEL SIGN OE {0x093B, 0x093B, prExtend}, // Mc DEVANAGARI VOWEL SIGN OOE {0x093C, 0x093C, prExtend}, // Mn DEVANAGARI SIGN NUKTA {0x093D, 0x093D, prALetter}, // Lo DEVANAGARI SIGN AVAGRAHA {0x093E, 0x0940, prExtend}, // Mc [3] DEVANAGARI VOWEL SIGN AA..DEVANAGARI VOWEL SIGN II {0x0941, 0x0948, prExtend}, // Mn [8] DEVANAGARI VOWEL SIGN U..DEVANAGARI VOWEL SIGN AI {0x0949, 0x094C, prExtend}, // Mc [4] DEVANAGARI VOWEL SIGN CANDRA O..DEVANAGARI VOWEL SIGN AU {0x094D, 0x094D, prExtend}, // Mn DEVANAGARI SIGN VIRAMA {0x094E, 0x094F, prExtend}, // Mc [2] DEVANAGARI VOWEL SIGN PRISHTHAMATRA E..DEVANAGARI VOWEL SIGN AW {0x0950, 0x0950, prALetter}, // Lo DEVANAGARI OM {0x0951, 0x0957, prExtend}, // Mn [7] DEVANAGARI STRESS SIGN UDATTA..DEVANAGARI VOWEL SIGN UUE {0x0958, 0x0961, prALetter}, // Lo [10] DEVANAGARI LETTER QA..DEVANAGARI LETTER VOCALIC LL {0x0962, 0x0963, prExtend}, // Mn [2] DEVANAGARI VOWEL SIGN VOCALIC L..DEVANAGARI VOWEL SIGN VOCALIC LL {0x0966, 0x096F, prNumeric}, // Nd [10] DEVANAGARI DIGIT ZERO..DEVANAGARI DIGIT NINE {0x0971, 0x0971, prALetter}, // Lm DEVANAGARI SIGN HIGH SPACING DOT {0x0972, 0x0980, prALetter}, // Lo [15] DEVANAGARI LETTER CANDRA A..BENGALI ANJI {0x0981, 0x0981, prExtend}, // Mn BENGALI SIGN CANDRABINDU {0x0982, 0x0983, prExtend}, // Mc [2] BENGALI SIGN ANUSVARA..BENGALI SIGN VISARGA {0x0985, 0x098C, prALetter}, // Lo [8] BENGALI LETTER A..BENGALI LETTER VOCALIC L {0x098F, 0x0990, prALetter}, // Lo [2] BENGALI LETTER E..BENGALI LETTER AI {0x0993, 0x09A8, prALetter}, // Lo [22] BENGALI LETTER O..BENGALI LETTER NA {0x09AA, 0x09B0, prALetter}, // Lo [7] BENGALI LETTER PA..BENGALI LETTER RA {0x09B2, 0x09B2, prALetter}, // Lo BENGALI LETTER LA {0x09B6, 0x09B9, prALetter}, // Lo [4] BENGALI LETTER SHA..BENGALI LETTER HA {0x09BC, 0x09BC, prExtend}, // Mn BENGALI SIGN NUKTA {0x09BD, 0x09BD, prALetter}, // Lo BENGALI SIGN AVAGRAHA {0x09BE, 0x09C0, prExtend}, // Mc [3] BENGALI VOWEL SIGN AA..BENGALI VOWEL SIGN II {0x09C1, 0x09C4, prExtend}, // Mn [4] BENGALI VOWEL SIGN U..BENGALI VOWEL SIGN VOCALIC RR {0x09C7, 0x09C8, prExtend}, // Mc [2] BENGALI VOWEL SIGN E..BENGALI VOWEL SIGN AI {0x09CB, 0x09CC, prExtend}, // Mc [2] BENGALI VOWEL SIGN O..BENGALI VOWEL SIGN AU {0x09CD, 0x09CD, prExtend}, // Mn BENGALI SIGN VIRAMA {0x09CE, 0x09CE, prALetter}, // Lo BENGALI LETTER KHANDA TA {0x09D7, 0x09D7, prExtend}, // Mc BENGALI AU LENGTH MARK {0x09DC, 0x09DD, prALetter}, // Lo [2] BENGALI LETTER RRA..BENGALI LETTER RHA {0x09DF, 0x09E1, prALetter}, // Lo [3] BENGALI LETTER YYA..BENGALI LETTER VOCALIC LL {0x09E2, 0x09E3, prExtend}, // Mn [2] BENGALI VOWEL SIGN VOCALIC L..BENGALI VOWEL SIGN VOCALIC LL {0x09E6, 0x09EF, prNumeric}, // Nd [10] BENGALI DIGIT ZERO..BENGALI DIGIT NINE {0x09F0, 0x09F1, prALetter}, // Lo [2] BENGALI LETTER RA WITH MIDDLE DIAGONAL..BENGALI LETTER RA WITH LOWER DIAGONAL {0x09FC, 0x09FC, prALetter}, // Lo BENGALI LETTER VEDIC ANUSVARA {0x09FE, 0x09FE, prExtend}, // Mn BENGALI SANDHI MARK {0x0A01, 0x0A02, prExtend}, // Mn [2] GURMUKHI SIGN ADAK BINDI..GURMUKHI SIGN BINDI {0x0A03, 0x0A03, prExtend}, // Mc GURMUKHI SIGN VISARGA {0x0A05, 0x0A0A, prALetter}, // Lo [6] GURMUKHI LETTER A..GURMUKHI LETTER UU {0x0A0F, 0x0A10, prALetter}, // Lo [2] GURMUKHI LETTER EE..GURMUKHI LETTER AI {0x0A13, 0x0A28, prALetter}, // Lo [22] GURMUKHI LETTER OO..GURMUKHI LETTER NA {0x0A2A, 0x0A30, prALetter}, // Lo [7] GURMUKHI LETTER PA..GURMUKHI LETTER RA {0x0A32, 0x0A33, prALetter}, // Lo [2] GURMUKHI LETTER LA..GURMUKHI LETTER LLA {0x0A35, 0x0A36, prALetter}, // Lo [2] GURMUKHI LETTER VA..GURMUKHI LETTER SHA {0x0A38, 0x0A39, prALetter}, // Lo [2] GURMUKHI LETTER SA..GURMUKHI LETTER HA {0x0A3C, 0x0A3C, prExtend}, // Mn GURMUKHI SIGN NUKTA {0x0A3E, 0x0A40, prExtend}, // Mc [3] GURMUKHI VOWEL SIGN AA..GURMUKHI VOWEL SIGN II {0x0A41, 0x0A42, prExtend}, // Mn [2] GURMUKHI VOWEL SIGN U..GURMUKHI VOWEL SIGN UU {0x0A47, 0x0A48, prExtend}, // Mn [2] GURMUKHI VOWEL SIGN EE..GURMUKHI VOWEL SIGN AI {0x0A4B, 0x0A4D, prExtend}, // Mn [3] GURMUKHI VOWEL SIGN OO..GURMUKHI SIGN VIRAMA {0x0A51, 0x0A51, prExtend}, // Mn GURMUKHI SIGN UDAAT {0x0A59, 0x0A5C, prALetter}, // Lo [4] GURMUKHI LETTER KHHA..GURMUKHI LETTER RRA {0x0A5E, 0x0A5E, prALetter}, // Lo GURMUKHI LETTER FA {0x0A66, 0x0A6F, prNumeric}, // Nd [10] GURMUKHI DIGIT ZERO..GURMUKHI DIGIT NINE {0x0A70, 0x0A71, prExtend}, // Mn [2] GURMUKHI TIPPI..GURMUKHI ADDAK {0x0A72, 0x0A74, prALetter}, // Lo [3] GURMUKHI IRI..GURMUKHI EK ONKAR {0x0A75, 0x0A75, prExtend}, // Mn GURMUKHI SIGN YAKASH {0x0A81, 0x0A82, prExtend}, // Mn [2] GUJARATI SIGN CANDRABINDU..GUJARATI SIGN ANUSVARA {0x0A83, 0x0A83, prExtend}, // Mc GUJARATI SIGN VISARGA {0x0A85, 0x0A8D, prALetter}, // Lo [9] GUJARATI LETTER A..GUJARATI VOWEL CANDRA E {0x0A8F, 0x0A91, prALetter}, // Lo [3] GUJARATI LETTER E..GUJARATI VOWEL CANDRA O {0x0A93, 0x0AA8, prALetter}, // Lo [22] GUJARATI LETTER O..GUJARATI LETTER NA {0x0AAA, 0x0AB0, prALetter}, // Lo [7] GUJARATI LETTER PA..GUJARATI LETTER RA {0x0AB2, 0x0AB3, prALetter}, // Lo [2] GUJARATI LETTER LA..GUJARATI LETTER LLA {0x0AB5, 0x0AB9, prALetter}, // Lo [5] GUJARATI LETTER VA..GUJARATI LETTER HA {0x0ABC, 0x0ABC, prExtend}, // Mn GUJARATI SIGN NUKTA {0x0ABD, 0x0ABD, prALetter}, // Lo GUJARATI SIGN AVAGRAHA {0x0ABE, 0x0AC0, prExtend}, // Mc [3] GUJARATI VOWEL SIGN AA..GUJARATI VOWEL SIGN II {0x0AC1, 0x0AC5, prExtend}, // Mn [5] GUJARATI VOWEL SIGN U..GUJARATI VOWEL SIGN CANDRA E {0x0AC7, 0x0AC8, prExtend}, // Mn [2] GUJARATI VOWEL SIGN E..GUJARATI VOWEL SIGN AI {0x0AC9, 0x0AC9, prExtend}, // Mc GUJARATI VOWEL SIGN CANDRA O {0x0ACB, 0x0ACC, prExtend}, // Mc [2] GUJARATI VOWEL SIGN O..GUJARATI VOWEL SIGN AU {0x0ACD, 0x0ACD, prExtend}, // Mn GUJARATI SIGN VIRAMA {0x0AD0, 0x0AD0, prALetter}, // Lo GUJARATI OM {0x0AE0, 0x0AE1, prALetter}, // Lo [2] GUJARATI LETTER VOCALIC RR..GUJARATI LETTER VOCALIC LL {0x0AE2, 0x0AE3, prExtend}, // Mn [2] GUJARATI VOWEL SIGN VOCALIC L..GUJARATI VOWEL SIGN VOCALIC LL {0x0AE6, 0x0AEF, prNumeric}, // Nd [10] GUJARATI DIGIT ZERO..GUJARATI DIGIT NINE {0x0AF9, 0x0AF9, prALetter}, // Lo GUJARATI LETTER ZHA {0x0AFA, 0x0AFF, prExtend}, // Mn [6] GUJARATI SIGN SUKUN..GUJARATI SIGN TWO-CIRCLE NUKTA ABOVE {0x0B01, 0x0B01, prExtend}, // Mn ORIYA SIGN CANDRABINDU {0x0B02, 0x0B03, prExtend}, // Mc [2] ORIYA SIGN ANUSVARA..ORIYA SIGN VISARGA {0x0B05, 0x0B0C, prALetter}, // Lo [8] ORIYA LETTER A..ORIYA LETTER VOCALIC L {0x0B0F, 0x0B10, prALetter}, // Lo [2] ORIYA LETTER E..ORIYA LETTER AI {0x0B13, 0x0B28, prALetter}, // Lo [22] ORIYA LETTER O..ORIYA LETTER NA {0x0B2A, 0x0B30, prALetter}, // Lo [7] ORIYA LETTER PA..ORIYA LETTER RA {0x0B32, 0x0B33, prALetter}, // Lo [2] ORIYA LETTER LA..ORIYA LETTER LLA {0x0B35, 0x0B39, prALetter}, // Lo [5] ORIYA LETTER VA..ORIYA LETTER HA {0x0B3C, 0x0B3C, prExtend}, // Mn ORIYA SIGN NUKTA {0x0B3D, 0x0B3D, prALetter}, // Lo ORIYA SIGN AVAGRAHA {0x0B3E, 0x0B3E, prExtend}, // Mc ORIYA VOWEL SIGN AA {0x0B3F, 0x0B3F, prExtend}, // Mn ORIYA VOWEL SIGN I {0x0B40, 0x0B40, prExtend}, // Mc ORIYA VOWEL SIGN II {0x0B41, 0x0B44, prExtend}, // Mn [4] ORIYA VOWEL SIGN U..ORIYA VOWEL SIGN VOCALIC RR {0x0B47, 0x0B48, prExtend}, // Mc [2] ORIYA VOWEL SIGN E..ORIYA VOWEL SIGN AI {0x0B4B, 0x0B4C, prExtend}, // Mc [2] ORIYA VOWEL SIGN O..ORIYA VOWEL SIGN AU {0x0B4D, 0x0B4D, prExtend}, // Mn ORIYA SIGN VIRAMA {0x0B55, 0x0B56, prExtend}, // Mn [2] ORIYA SIGN OVERLINE..ORIYA AI LENGTH MARK {0x0B57, 0x0B57, prExtend}, // Mc ORIYA AU LENGTH MARK {0x0B5C, 0x0B5D, prALetter}, // Lo [2] ORIYA LETTER RRA..ORIYA LETTER RHA {0x0B5F, 0x0B61, prALetter}, // Lo [3] ORIYA LETTER YYA..ORIYA LETTER VOCALIC LL {0x0B62, 0x0B63, prExtend}, // Mn [2] ORIYA VOWEL SIGN VOCALIC L..ORIYA VOWEL SIGN VOCALIC LL {0x0B66, 0x0B6F, prNumeric}, // Nd [10] ORIYA DIGIT ZERO..ORIYA DIGIT NINE {0x0B71, 0x0B71, prALetter}, // Lo ORIYA LETTER WA {0x0B82, 0x0B82, prExtend}, // Mn TAMIL SIGN ANUSVARA {0x0B83, 0x0B83, prALetter}, // Lo TAMIL SIGN VISARGA {0x0B85, 0x0B8A, prALetter}, // Lo [6] TAMIL LETTER A..TAMIL LETTER UU {0x0B8E, 0x0B90, prALetter}, // Lo [3] TAMIL LETTER E..TAMIL LETTER AI {0x0B92, 0x0B95, prALetter}, // Lo [4] TAMIL LETTER O..TAMIL LETTER KA {0x0B99, 0x0B9A, prALetter}, // Lo [2] TAMIL LETTER NGA..TAMIL LETTER CA {0x0B9C, 0x0B9C, prALetter}, // Lo TAMIL LETTER JA {0x0B9E, 0x0B9F, prALetter}, // Lo [2] TAMIL LETTER NYA..TAMIL LETTER TTA {0x0BA3, 0x0BA4, prALetter}, // Lo [2] TAMIL LETTER NNA..TAMIL LETTER TA {0x0BA8, 0x0BAA, prALetter}, // Lo [3] TAMIL LETTER NA..TAMIL LETTER PA {0x0BAE, 0x0BB9, prALetter}, // Lo [12] TAMIL LETTER MA..TAMIL LETTER HA {0x0BBE, 0x0BBF, prExtend}, // Mc [2] TAMIL VOWEL SIGN AA..TAMIL VOWEL SIGN I {0x0BC0, 0x0BC0, prExtend}, // Mn TAMIL VOWEL SIGN II {0x0BC1, 0x0BC2, prExtend}, // Mc [2] TAMIL VOWEL SIGN U..TAMIL VOWEL SIGN UU {0x0BC6, 0x0BC8, prExtend}, // Mc [3] TAMIL VOWEL SIGN E..TAMIL VOWEL SIGN AI {0x0BCA, 0x0BCC, prExtend}, // Mc [3] TAMIL VOWEL SIGN O..TAMIL VOWEL SIGN AU {0x0BCD, 0x0BCD, prExtend}, // Mn TAMIL SIGN VIRAMA {0x0BD0, 0x0BD0, prALetter}, // Lo TAMIL OM {0x0BD7, 0x0BD7, prExtend}, // Mc TAMIL AU LENGTH MARK {0x0BE6, 0x0BEF, prNumeric}, // Nd [10] TAMIL DIGIT ZERO..TAMIL DIGIT NINE {0x0C00, 0x0C00, prExtend}, // Mn TELUGU SIGN COMBINING CANDRABINDU ABOVE {0x0C01, 0x0C03, prExtend}, // Mc [3] TELUGU SIGN CANDRABINDU..TELUGU SIGN VISARGA {0x0C04, 0x0C04, prExtend}, // Mn TELUGU SIGN COMBINING ANUSVARA ABOVE {0x0C05, 0x0C0C, prALetter}, // Lo [8] TELUGU LETTER A..TELUGU LETTER VOCALIC L {0x0C0E, 0x0C10, prALetter}, // Lo [3] TELUGU LETTER E..TELUGU LETTER AI {0x0C12, 0x0C28, prALetter}, // Lo [23] TELUGU LETTER O..TELUGU LETTER NA {0x0C2A, 0x0C39, prALetter}, // Lo [16] TELUGU LETTER PA..TELUGU LETTER HA {0x0C3C, 0x0C3C, prExtend}, // Mn TELUGU SIGN NUKTA {0x0C3D, 0x0C3D, prALetter}, // Lo TELUGU SIGN AVAGRAHA {0x0C3E, 0x0C40, prExtend}, // Mn [3] TELUGU VOWEL SIGN AA..TELUGU VOWEL SIGN II {0x0C41, 0x0C44, prExtend}, // Mc [4] TELUGU VOWEL SIGN U..TELUGU VOWEL SIGN VOCALIC RR {0x0C46, 0x0C48, prExtend}, // Mn [3] TELUGU VOWEL SIGN E..TELUGU VOWEL SIGN AI {0x0C4A, 0x0C4D, prExtend}, // Mn [4] TELUGU VOWEL SIGN O..TELUGU SIGN VIRAMA {0x0C55, 0x0C56, prExtend}, // Mn [2] TELUGU LENGTH MARK..TELUGU AI LENGTH MARK {0x0C58, 0x0C5A, prALetter}, // Lo [3] TELUGU LETTER TSA..TELUGU LETTER RRRA {0x0C5D, 0x0C5D, prALetter}, // Lo TELUGU LETTER NAKAARA POLLU {0x0C60, 0x0C61, prALetter}, // Lo [2] TELUGU LETTER VOCALIC RR..TELUGU LETTER VOCALIC LL {0x0C62, 0x0C63, prExtend}, // Mn [2] TELUGU VOWEL SIGN VOCALIC L..TELUGU VOWEL SIGN VOCALIC LL {0x0C66, 0x0C6F, prNumeric}, // Nd [10] TELUGU DIGIT ZERO..TELUGU DIGIT NINE {0x0C80, 0x0C80, prALetter}, // Lo KANNADA SIGN SPACING CANDRABINDU {0x0C81, 0x0C81, prExtend}, // Mn KANNADA SIGN CANDRABINDU {0x0C82, 0x0C83, prExtend}, // Mc [2] KANNADA SIGN ANUSVARA..KANNADA SIGN VISARGA {0x0C85, 0x0C8C, prALetter}, // Lo [8] KANNADA LETTER A..KANNADA LETTER VOCALIC L {0x0C8E, 0x0C90, prALetter}, // Lo [3] KANNADA LETTER E..KANNADA LETTER AI {0x0C92, 0x0CA8, prALetter}, // Lo [23] KANNADA LETTER O..KANNADA LETTER NA {0x0CAA, 0x0CB3, prALetter}, // Lo [10] KANNADA LETTER PA..KANNADA LETTER LLA {0x0CB5, 0x0CB9, prALetter}, // Lo [5] KANNADA LETTER VA..KANNADA LETTER HA {0x0CBC, 0x0CBC, prExtend}, // Mn KANNADA SIGN NUKTA {0x0CBD, 0x0CBD, prALetter}, // Lo KANNADA SIGN AVAGRAHA {0x0CBE, 0x0CBE, prExtend}, // Mc KANNADA VOWEL SIGN AA {0x0CBF, 0x0CBF, prExtend}, // Mn KANNADA VOWEL SIGN I {0x0CC0, 0x0CC4, prExtend}, // Mc [5] KANNADA VOWEL SIGN II..KANNADA VOWEL SIGN VOCALIC RR {0x0CC6, 0x0CC6, prExtend}, // Mn KANNADA VOWEL SIGN E {0x0CC7, 0x0CC8, prExtend}, // Mc [2] KANNADA VOWEL SIGN EE..KANNADA VOWEL SIGN AI {0x0CCA, 0x0CCB, prExtend}, // Mc [2] KANNADA VOWEL SIGN O..KANNADA VOWEL SIGN OO {0x0CCC, 0x0CCD, prExtend}, // Mn [2] KANNADA VOWEL SIGN AU..KANNADA SIGN VIRAMA {0x0CD5, 0x0CD6, prExtend}, // Mc [2] KANNADA LENGTH MARK..KANNADA AI LENGTH MARK {0x0CDD, 0x0CDE, prALetter}, // Lo [2] KANNADA LETTER NAKAARA POLLU..KANNADA LETTER FA {0x0CE0, 0x0CE1, prALetter}, // Lo [2] KANNADA LETTER VOCALIC RR..KANNADA LETTER VOCALIC LL {0x0CE2, 0x0CE3, prExtend}, // Mn [2] KANNADA VOWEL SIGN VOCALIC L..KANNADA VOWEL SIGN VOCALIC LL {0x0CE6, 0x0CEF, prNumeric}, // Nd [10] KANNADA DIGIT ZERO..KANNADA DIGIT NINE {0x0CF1, 0x0CF2, prALetter}, // Lo [2] KANNADA SIGN JIHVAMULIYA..KANNADA SIGN UPADHMANIYA {0x0CF3, 0x0CF3, prExtend}, // Mc KANNADA SIGN COMBINING ANUSVARA ABOVE RIGHT {0x0D00, 0x0D01, prExtend}, // Mn [2] MALAYALAM SIGN COMBINING ANUSVARA ABOVE..MALAYALAM SIGN CANDRABINDU {0x0D02, 0x0D03, prExtend}, // Mc [2] MALAYALAM SIGN ANUSVARA..MALAYALAM SIGN VISARGA {0x0D04, 0x0D0C, prALetter}, // Lo [9] MALAYALAM LETTER VEDIC ANUSVARA..MALAYALAM LETTER VOCALIC L {0x0D0E, 0x0D10, prALetter}, // Lo [3] MALAYALAM LETTER E..MALAYALAM LETTER AI {0x0D12, 0x0D3A, prALetter}, // Lo [41] MALAYALAM LETTER O..MALAYALAM LETTER TTTA {0x0D3B, 0x0D3C, prExtend}, // Mn [2] MALAYALAM SIGN VERTICAL BAR VIRAMA..MALAYALAM SIGN CIRCULAR VIRAMA {0x0D3D, 0x0D3D, prALetter}, // Lo MALAYALAM SIGN AVAGRAHA {0x0D3E, 0x0D40, prExtend}, // Mc [3] MALAYALAM VOWEL SIGN AA..MALAYALAM VOWEL SIGN II {0x0D41, 0x0D44, prExtend}, // Mn [4] MALAYALAM VOWEL SIGN U..MALAYALAM VOWEL SIGN VOCALIC RR {0x0D46, 0x0D48, prExtend}, // Mc [3] MALAYALAM VOWEL SIGN E..MALAYALAM VOWEL SIGN AI {0x0D4A, 0x0D4C, prExtend}, // Mc [3] MALAYALAM VOWEL SIGN O..MALAYALAM VOWEL SIGN AU {0x0D4D, 0x0D4D, prExtend}, // Mn MALAYALAM SIGN VIRAMA {0x0D4E, 0x0D4E, prALetter}, // Lo MALAYALAM LETTER DOT REPH {0x0D54, 0x0D56, prALetter}, // Lo [3] MALAYALAM LETTER CHILLU M..MALAYALAM LETTER CHILLU LLL {0x0D57, 0x0D57, prExtend}, // Mc MALAYALAM AU LENGTH MARK {0x0D5F, 0x0D61, prALetter}, // Lo [3] MALAYALAM LETTER ARCHAIC II..MALAYALAM LETTER VOCALIC LL {0x0D62, 0x0D63, prExtend}, // Mn [2] MALAYALAM VOWEL SIGN VOCALIC L..MALAYALAM VOWEL SIGN VOCALIC LL {0x0D66, 0x0D6F, prNumeric}, // Nd [10] MALAYALAM DIGIT ZERO..MALAYALAM DIGIT NINE {0x0D7A, 0x0D7F, prALetter}, // Lo [6] MALAYALAM LETTER CHILLU NN..MALAYALAM LETTER CHILLU K {0x0D81, 0x0D81, prExtend}, // Mn SINHALA SIGN CANDRABINDU {0x0D82, 0x0D83, prExtend}, // Mc [2] SINHALA SIGN ANUSVARAYA..SINHALA SIGN VISARGAYA {0x0D85, 0x0D96, prALetter}, // Lo [18] SINHALA LETTER AYANNA..SINHALA LETTER AUYANNA {0x0D9A, 0x0DB1, prALetter}, // Lo [24] SINHALA LETTER ALPAPRAANA KAYANNA..SINHALA LETTER DANTAJA NAYANNA {0x0DB3, 0x0DBB, prALetter}, // Lo [9] SINHALA LETTER SANYAKA DAYANNA..SINHALA LETTER RAYANNA {0x0DBD, 0x0DBD, prALetter}, // Lo SINHALA LETTER DANTAJA LAYANNA {0x0DC0, 0x0DC6, prALetter}, // Lo [7] SINHALA LETTER VAYANNA..SINHALA LETTER FAYANNA {0x0DCA, 0x0DCA, prExtend}, // Mn SINHALA SIGN AL-LAKUNA
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
true
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/rivo/uniseg/line.go
vendor/github.com/rivo/uniseg/line.go
package uniseg import "unicode/utf8" // FirstLineSegment returns the prefix of the given byte slice after which a // decision to break the string over to the next line can or must be made, // according to the rules of [Unicode Standard Annex #14]. This is used to // implement line breaking. // // Line breaking, also known as word wrapping, is the process of breaking a // section of text into lines such that it will fit in the available width of a // page, window or other display area. // // The returned "segment" may not be broken into smaller parts, unless no other // breaking opportunities present themselves, in which case you may break by // grapheme clusters (using the [FirstGraphemeCluster] function to determine the // grapheme clusters). // // The "mustBreak" flag indicates whether you MUST break the line after the // given segment (true), for example after newline characters, or you MAY break // the line after the given segment (false). // // This function can be called continuously to extract all non-breaking sub-sets // from a byte slice, as illustrated in the example below. // // If you don't know the current state, for example when calling the function // for the first time, you must pass -1. For consecutive calls, pass the state // and rest slice returned by the previous call. // // The "rest" slice is the sub-slice of the original byte slice "b" starting // after the last byte of the identified line segment. If the length of the // "rest" slice is 0, the entire byte slice "b" has been processed. The // "segment" byte slice is the sub-slice of the input slice containing the // identified line segment. // // Given an empty byte slice "b", the function returns nil values. // // Note that in accordance with [UAX #14 LB3], the final segment will end with // "mustBreak" set to true. You can choose to ignore this by checking if the // length of the "rest" slice is 0 and calling [HasTrailingLineBreak] or // [HasTrailingLineBreakInString] on the last rune. // // Note also that this algorithm may break within grapheme clusters. This is // addressed in Section 8.2 Example 6 of UAX #14. To avoid this, you can use // the [Step] function instead. // // [Unicode Standard Annex #14]: https://www.unicode.org/reports/tr14/ // [UAX #14 LB3]: https://www.unicode.org/reports/tr14/#Algorithm func FirstLineSegment(b []byte, state int) (segment, rest []byte, mustBreak bool, newState int) { // An empty byte slice returns nothing. if len(b) == 0 { return } // Extract the first rune. r, length := utf8.DecodeRune(b) if len(b) <= length { // If we're already past the end, there is nothing else to parse. return b, nil, true, lbAny // LB3. } // If we don't know the state, determine it now. if state < 0 { state, _ = transitionLineBreakState(state, r, b[length:], "") } // Transition until we find a boundary. var boundary int for { r, l := utf8.DecodeRune(b[length:]) state, boundary = transitionLineBreakState(state, r, b[length+l:], "") if boundary != LineDontBreak { return b[:length], b[length:], boundary == LineMustBreak, state } length += l if len(b) <= length { return b, nil, true, lbAny // LB3 } } } // FirstLineSegmentInString is like [FirstLineSegment] but its input and outputs // are strings. func FirstLineSegmentInString(str string, state int) (segment, rest string, mustBreak bool, newState int) { // An empty byte slice returns nothing. if len(str) == 0 { return } // Extract the first rune. r, length := utf8.DecodeRuneInString(str) if len(str) <= length { // If we're already past the end, there is nothing else to parse. return str, "", true, lbAny // LB3. } // If we don't know the state, determine it now. if state < 0 { state, _ = transitionLineBreakState(state, r, nil, str[length:]) } // Transition until we find a boundary. var boundary int for { r, l := utf8.DecodeRuneInString(str[length:]) state, boundary = transitionLineBreakState(state, r, nil, str[length+l:]) if boundary != LineDontBreak { return str[:length], str[length:], boundary == LineMustBreak, state } length += l if len(str) <= length { return str, "", true, lbAny // LB3. } } } // HasTrailingLineBreak returns true if the last rune in the given byte slice is // one of the hard line break code points defined in LB4 and LB5 of [UAX #14]. // // [UAX #14]: https://www.unicode.org/reports/tr14/#Algorithm func HasTrailingLineBreak(b []byte) bool { r, _ := utf8.DecodeLastRune(b) property, _ := propertyLineBreak(r) return property == prBK || property == prCR || property == prLF || property == prNL } // HasTrailingLineBreakInString is like [HasTrailingLineBreak] but for a string. func HasTrailingLineBreakInString(str string) bool { r, _ := utf8.DecodeLastRuneInString(str) property, _ := propertyLineBreak(r) return property == prBK || property == prCR || property == prLF || property == prNL }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/rivo/uniseg/sentencerules.go
vendor/github.com/rivo/uniseg/sentencerules.go
package uniseg import "unicode/utf8" // The states of the sentence break parser. const ( sbAny = iota sbCR sbParaSep sbATerm sbUpper sbLower sbSB7 sbSB8Close sbSB8Sp sbSTerm sbSB8aClose sbSB8aSp ) // sbTransitions implements the sentence break parser's state transitions. It's // anologous to [grTransitions], see comments there for details. // // Unicode version 15.0.0. func sbTransitions(state, prop int) (newState int, sentenceBreak bool, rule int) { switch uint64(state) | uint64(prop)<<32 { // SB3. case sbAny | prCR<<32: return sbCR, false, 9990 case sbCR | prLF<<32: return sbParaSep, false, 30 // SB4. case sbAny | prSep<<32: return sbParaSep, false, 9990 case sbAny | prLF<<32: return sbParaSep, false, 9990 case sbParaSep | prAny<<32: return sbAny, true, 40 case sbCR | prAny<<32: return sbAny, true, 40 // SB6. case sbAny | prATerm<<32: return sbATerm, false, 9990 case sbATerm | prNumeric<<32: return sbAny, false, 60 case sbSB7 | prNumeric<<32: return sbAny, false, 60 // Because ATerm also appears in SB7. // SB7. case sbAny | prUpper<<32: return sbUpper, false, 9990 case sbAny | prLower<<32: return sbLower, false, 9990 case sbUpper | prATerm<<32: return sbSB7, false, 70 case sbLower | prATerm<<32: return sbSB7, false, 70 case sbSB7 | prUpper<<32: return sbUpper, false, 70 // SB8a. case sbAny | prSTerm<<32: return sbSTerm, false, 9990 case sbATerm | prSContinue<<32: return sbAny, false, 81 case sbATerm | prATerm<<32: return sbATerm, false, 81 case sbATerm | prSTerm<<32: return sbSTerm, false, 81 case sbSB7 | prSContinue<<32: return sbAny, false, 81 case sbSB7 | prATerm<<32: return sbATerm, false, 81 case sbSB7 | prSTerm<<32: return sbSTerm, false, 81 case sbSB8Close | prSContinue<<32: return sbAny, false, 81 case sbSB8Close | prATerm<<32: return sbATerm, false, 81 case sbSB8Close | prSTerm<<32: return sbSTerm, false, 81 case sbSB8Sp | prSContinue<<32: return sbAny, false, 81 case sbSB8Sp | prATerm<<32: return sbATerm, false, 81 case sbSB8Sp | prSTerm<<32: return sbSTerm, false, 81 case sbSTerm | prSContinue<<32: return sbAny, false, 81 case sbSTerm | prATerm<<32: return sbATerm, false, 81 case sbSTerm | prSTerm<<32: return sbSTerm, false, 81 case sbSB8aClose | prSContinue<<32: return sbAny, false, 81 case sbSB8aClose | prATerm<<32: return sbATerm, false, 81 case sbSB8aClose | prSTerm<<32: return sbSTerm, false, 81 case sbSB8aSp | prSContinue<<32: return sbAny, false, 81 case sbSB8aSp | prATerm<<32: return sbATerm, false, 81 case sbSB8aSp | prSTerm<<32: return sbSTerm, false, 81 // SB9. case sbATerm | prClose<<32: return sbSB8Close, false, 90 case sbSB7 | prClose<<32: return sbSB8Close, false, 90 case sbSB8Close | prClose<<32: return sbSB8Close, false, 90 case sbATerm | prSp<<32: return sbSB8Sp, false, 90 case sbSB7 | prSp<<32: return sbSB8Sp, false, 90 case sbSB8Close | prSp<<32: return sbSB8Sp, false, 90 case sbSTerm | prClose<<32: return sbSB8aClose, false, 90 case sbSB8aClose | prClose<<32: return sbSB8aClose, false, 90 case sbSTerm | prSp<<32: return sbSB8aSp, false, 90 case sbSB8aClose | prSp<<32: return sbSB8aSp, false, 90 case sbATerm | prSep<<32: return sbParaSep, false, 90 case sbATerm | prCR<<32: return sbParaSep, false, 90 case sbATerm | prLF<<32: return sbParaSep, false, 90 case sbSB7 | prSep<<32: return sbParaSep, false, 90 case sbSB7 | prCR<<32: return sbParaSep, false, 90 case sbSB7 | prLF<<32: return sbParaSep, false, 90 case sbSB8Close | prSep<<32: return sbParaSep, false, 90 case sbSB8Close | prCR<<32: return sbParaSep, false, 90 case sbSB8Close | prLF<<32: return sbParaSep, false, 90 case sbSTerm | prSep<<32: return sbParaSep, false, 90 case sbSTerm | prCR<<32: return sbParaSep, false, 90 case sbSTerm | prLF<<32: return sbParaSep, false, 90 case sbSB8aClose | prSep<<32: return sbParaSep, false, 90 case sbSB8aClose | prCR<<32: return sbParaSep, false, 90 case sbSB8aClose | prLF<<32: return sbParaSep, false, 90 // SB10. case sbSB8Sp | prSp<<32: return sbSB8Sp, false, 100 case sbSB8aSp | prSp<<32: return sbSB8aSp, false, 100 case sbSB8Sp | prSep<<32: return sbParaSep, false, 100 case sbSB8Sp | prCR<<32: return sbParaSep, false, 100 case sbSB8Sp | prLF<<32: return sbParaSep, false, 100 // SB11. case sbATerm | prAny<<32: return sbAny, true, 110 case sbSB7 | prAny<<32: return sbAny, true, 110 case sbSB8Close | prAny<<32: return sbAny, true, 110 case sbSB8Sp | prAny<<32: return sbAny, true, 110 case sbSTerm | prAny<<32: return sbAny, true, 110 case sbSB8aClose | prAny<<32: return sbAny, true, 110 case sbSB8aSp | prAny<<32: return sbAny, true, 110 // We'll always break after ParaSep due to SB4. default: return -1, false, -1 } } // transitionSentenceBreakState determines the new state of the sentence break // parser given the current state and the next code point. It also returns // whether a sentence boundary was detected. If more than one code point is // needed to determine the new state, the byte slice or the string starting // after rune "r" can be used (whichever is not nil or empty) for further // lookups. func transitionSentenceBreakState(state int, r rune, b []byte, str string) (newState int, sentenceBreak bool) { // Determine the property of the next character. nextProperty := property(sentenceBreakCodePoints, r) // SB5 (Replacing Ignore Rules). if nextProperty == prExtend || nextProperty == prFormat { if state == sbParaSep || state == sbCR { return sbAny, true // Make sure we don't apply SB5 to SB3 or SB4. } if state < 0 { return sbAny, true // SB1. } return state, false } // Find the applicable transition in the table. var rule int newState, sentenceBreak, rule = sbTransitions(state, nextProperty) if newState < 0 { // No specific transition found. Try the less specific ones. anyPropState, anyPropProp, anyPropRule := sbTransitions(state, prAny) anyStateState, anyStateProp, anyStateRule := sbTransitions(sbAny, nextProperty) if anyPropState >= 0 && anyStateState >= 0 { // Both apply. We'll use a mix (see comments for grTransitions). newState, sentenceBreak, rule = anyStateState, anyStateProp, anyStateRule if anyPropRule < anyStateRule { sentenceBreak, rule = anyPropProp, anyPropRule } } else if anyPropState >= 0 { // We only have a specific state. newState, sentenceBreak, rule = anyPropState, anyPropProp, anyPropRule // This branch will probably never be reached because okAnyState will // always be true given the current transition map. But we keep it here // for future modifications to the transition map where this may not be // true anymore. } else if anyStateState >= 0 { // We only have a specific property. newState, sentenceBreak, rule = anyStateState, anyStateProp, anyStateRule } else { // No known transition. SB999: Any × Any. newState, sentenceBreak, rule = sbAny, false, 9990 } } // SB8. if rule > 80 && (state == sbATerm || state == sbSB8Close || state == sbSB8Sp || state == sbSB7) { // Check the right side of the rule. var length int for nextProperty != prOLetter && nextProperty != prUpper && nextProperty != prLower && nextProperty != prSep && nextProperty != prCR && nextProperty != prLF && nextProperty != prATerm && nextProperty != prSTerm { // Move on to the next rune. if b != nil { // Byte slice version. r, length = utf8.DecodeRune(b) b = b[length:] } else { // String version. r, length = utf8.DecodeRuneInString(str) str = str[length:] } if r == utf8.RuneError { break } nextProperty = property(sentenceBreakCodePoints, r) } if nextProperty == prLower { return sbLower, false } } return }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/rivo/uniseg/gen_breaktest.go
vendor/github.com/rivo/uniseg/gen_breaktest.go
//go:build generate // This program generates a Go containing a slice of test cases based on the // Unicode Character Database auxiliary data files. The command line arguments // are as follows: // // 1. The name of the Unicode data file (just the filename, without extension). // 2. The name of the locally generated Go file. // 3. The name of the slice containing the test cases. // 4. The name of the generator, for logging purposes. // //go:generate go run gen_breaktest.go GraphemeBreakTest graphemebreak_test.go graphemeBreakTestCases graphemes //go:generate go run gen_breaktest.go WordBreakTest wordbreak_test.go wordBreakTestCases words //go:generate go run gen_breaktest.go SentenceBreakTest sentencebreak_test.go sentenceBreakTestCases sentences //go:generate go run gen_breaktest.go LineBreakTest linebreak_test.go lineBreakTestCases lines package main import ( "bufio" "bytes" "errors" "fmt" "go/format" "io/ioutil" "log" "net/http" "os" "time" ) // We want to test against a specific version rather than the latest. When the // package is upgraded to a new version, change these to generate new tests. const ( testCaseURL = `https://www.unicode.org/Public/15.0.0/ucd/auxiliary/%s.txt` ) func main() { if len(os.Args) < 5 { fmt.Println("Not enough arguments, see code for details") os.Exit(1) } log.SetPrefix("gen_breaktest (" + os.Args[4] + "): ") log.SetFlags(0) // Read text of testcases and parse into Go source code. src, err := parse(fmt.Sprintf(testCaseURL, os.Args[1])) if err != nil { log.Fatal(err) } // Format the Go code. formatted, err := format.Source(src) if err != nil { log.Fatalln("gofmt:", err) } // Write it out. log.Print("Writing to ", os.Args[2]) if err := ioutil.WriteFile(os.Args[2], formatted, 0644); err != nil { log.Fatal(err) } } // parse reads a break text file, either from a local file or from a URL. It // parses the file data into Go source code representing the test cases. func parse(url string) ([]byte, error) { log.Printf("Parsing %s", url) res, err := http.Get(url) if err != nil { return nil, err } body := res.Body defer body.Close() buf := new(bytes.Buffer) buf.Grow(120 << 10) buf.WriteString(`// Code generated via go generate from gen_breaktest.go. DO NOT EDIT. package uniseg // ` + os.Args[3] + ` are Grapheme testcases taken from // ` + url + ` // on ` + time.Now().Format("January 2, 2006") + `. See // https://www.unicode.org/license.html for the Unicode license agreement. var ` + os.Args[3] + ` = []testCase { `) sc := bufio.NewScanner(body) num := 1 var line []byte original := make([]byte, 0, 64) expected := make([]byte, 0, 64) for sc.Scan() { num++ line = sc.Bytes() if len(line) == 0 || line[0] == '#' { continue } var comment []byte if i := bytes.IndexByte(line, '#'); i >= 0 { comment = bytes.TrimSpace(line[i+1:]) line = bytes.TrimSpace(line[:i]) } original, expected, err := parseRuneSequence(line, original[:0], expected[:0]) if err != nil { return nil, fmt.Errorf(`line %d: %v: %q`, num, err, line) } fmt.Fprintf(buf, "\t{original: \"%s\", expected: %s}, // %s\n", original, expected, comment) } if err := sc.Err(); err != nil { return nil, err } // Check for final "# EOF", useful check if we're streaming via HTTP if !bytes.Equal(line, []byte("# EOF")) { return nil, fmt.Errorf(`line %d: exected "# EOF" as final line, got %q`, num, line) } buf.WriteString("}\n") return buf.Bytes(), nil } // Used by parseRuneSequence to match input via bytes.HasPrefix. var ( prefixBreak = []byte("÷ ") prefixDontBreak = []byte("× ") breakOk = []byte("÷") breakNo = []byte("×") ) // parseRuneSequence parses a rune + breaking opportunity sequence from b // and appends the Go code for testcase.original to orig // and appends the Go code for testcase.expected to exp. // It retuns the new orig and exp slices. // // E.g. for the input b="÷ 0020 × 0308 ÷ 1F1E6 ÷" // it will append // // "\u0020\u0308\U0001F1E6" // // and "[][]rune{{0x0020,0x0308},{0x1F1E6},}" // to orig and exp respectively. // // The formatting of exp is expected to be cleaned up by gofmt or format.Source. // Note we explicitly require the sequence to start with ÷ and we implicitly // require it to end with ÷. func parseRuneSequence(b, orig, exp []byte) ([]byte, []byte, error) { // Check for and remove first ÷ or ×. if !bytes.HasPrefix(b, prefixBreak) && !bytes.HasPrefix(b, prefixDontBreak) { return nil, nil, errors.New("expected ÷ or × as first character") } if bytes.HasPrefix(b, prefixBreak) { b = b[len(prefixBreak):] } else { b = b[len(prefixDontBreak):] } boundary := true exp = append(exp, "[][]rune{"...) for len(b) > 0 { if boundary { exp = append(exp, '{') } exp = append(exp, "0x"...) // Find end of hex digits. var i int for i = 0; i < len(b) && b[i] != ' '; i++ { if d := b[i]; ('0' <= d || d <= '9') || ('A' <= d || d <= 'F') || ('a' <= d || d <= 'f') { continue } return nil, nil, errors.New("bad hex digit") } switch i { case 4: orig = append(orig, "\\u"...) case 5: orig = append(orig, "\\U000"...) default: return nil, nil, errors.New("unsupport code point hex length") } orig = append(orig, b[:i]...) exp = append(exp, b[:i]...) b = b[i:] // Check for space between hex and ÷ or ×. if len(b) < 1 || b[0] != ' ' { return nil, nil, errors.New("bad input") } b = b[1:] // Check for next boundary. switch { case bytes.HasPrefix(b, breakOk): boundary = true b = b[len(breakOk):] case bytes.HasPrefix(b, breakNo): boundary = false b = b[len(breakNo):] default: return nil, nil, errors.New("missing ÷ or ×") } if boundary { exp = append(exp, '}') } exp = append(exp, ',') if len(b) > 0 && b[0] == ' ' { b = b[1:] } } exp = append(exp, '}') return orig, exp, nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/rivo/uniseg/width.go
vendor/github.com/rivo/uniseg/width.go
package uniseg // EastAsianAmbiguousWidth specifies the monospace width for East Asian // characters classified as Ambiguous. The default is 1 but some rare fonts // render them with a width of 2. var EastAsianAmbiguousWidth = 1 // runeWidth returns the monospace width for the given rune. The provided // grapheme property is a value mapped by the [graphemeCodePoints] table. // // Every rune has a width of 1, except for runes with the following properties // (evaluated in this order): // // - Control, CR, LF, Extend, ZWJ: Width of 0 // - \u2e3a, TWO-EM DASH: Width of 3 // - \u2e3b, THREE-EM DASH: Width of 4 // - East-Asian width Fullwidth and Wide: Width of 2 (Ambiguous and Neutral // have a width of 1) // - Regional Indicator: Width of 2 // - Extended Pictographic: Width of 2, unless Emoji Presentation is "No". func runeWidth(r rune, graphemeProperty int) int { switch graphemeProperty { case prControl, prCR, prLF, prExtend, prZWJ: return 0 case prRegionalIndicator: return 2 case prExtendedPictographic: if property(emojiPresentation, r) == prEmojiPresentation { return 2 } return 1 } switch r { case 0x2e3a: return 3 case 0x2e3b: return 4 } switch propertyEastAsianWidth(r) { case prW, prF: return 2 case prA: return EastAsianAmbiguousWidth } return 1 } // StringWidth returns the monospace width for the given string, that is, the // number of same-size cells to be occupied by the string. func StringWidth(s string) (width int) { state := -1 for len(s) > 0 { var w int _, s, w, state = FirstGraphemeClusterInString(s, state) width += w } return }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/rivo/uniseg/graphemeproperties.go
vendor/github.com/rivo/uniseg/graphemeproperties.go
// Code generated via go generate from gen_properties.go. DO NOT EDIT. package uniseg // graphemeCodePoints are taken from // https://www.unicode.org/Public/15.0.0/ucd/auxiliary/GraphemeBreakProperty.txt // and // https://unicode.org/Public/15.0.0/ucd/emoji/emoji-data.txt // ("Extended_Pictographic" only) // on September 5, 2023. See https://www.unicode.org/license.html for the Unicode // license agreement. var graphemeCodePoints = [][3]int{ {0x0000, 0x0009, prControl}, // Cc [10] <control-0000>..<control-0009> {0x000A, 0x000A, prLF}, // Cc <control-000A> {0x000B, 0x000C, prControl}, // Cc [2] <control-000B>..<control-000C> {0x000D, 0x000D, prCR}, // Cc <control-000D> {0x000E, 0x001F, prControl}, // Cc [18] <control-000E>..<control-001F> {0x007F, 0x009F, prControl}, // Cc [33] <control-007F>..<control-009F> {0x00A9, 0x00A9, prExtendedPictographic}, // E0.6 [1] (©️) copyright {0x00AD, 0x00AD, prControl}, // Cf SOFT HYPHEN {0x00AE, 0x00AE, prExtendedPictographic}, // E0.6 [1] (®️) registered {0x0300, 0x036F, prExtend}, // Mn [112] COMBINING GRAVE ACCENT..COMBINING LATIN SMALL LETTER X {0x0483, 0x0487, prExtend}, // Mn [5] COMBINING CYRILLIC TITLO..COMBINING CYRILLIC POKRYTIE {0x0488, 0x0489, prExtend}, // Me [2] COMBINING CYRILLIC HUNDRED THOUSANDS SIGN..COMBINING CYRILLIC MILLIONS SIGN {0x0591, 0x05BD, prExtend}, // Mn [45] HEBREW ACCENT ETNAHTA..HEBREW POINT METEG {0x05BF, 0x05BF, prExtend}, // Mn HEBREW POINT RAFE {0x05C1, 0x05C2, prExtend}, // Mn [2] HEBREW POINT SHIN DOT..HEBREW POINT SIN DOT {0x05C4, 0x05C5, prExtend}, // Mn [2] HEBREW MARK UPPER DOT..HEBREW MARK LOWER DOT {0x05C7, 0x05C7, prExtend}, // Mn HEBREW POINT QAMATS QATAN {0x0600, 0x0605, prPrepend}, // Cf [6] ARABIC NUMBER SIGN..ARABIC NUMBER MARK ABOVE {0x0610, 0x061A, prExtend}, // Mn [11] ARABIC SIGN SALLALLAHOU ALAYHE WASSALLAM..ARABIC SMALL KASRA {0x061C, 0x061C, prControl}, // Cf ARABIC LETTER MARK {0x064B, 0x065F, prExtend}, // Mn [21] ARABIC FATHATAN..ARABIC WAVY HAMZA BELOW {0x0670, 0x0670, prExtend}, // Mn ARABIC LETTER SUPERSCRIPT ALEF {0x06D6, 0x06DC, prExtend}, // Mn [7] ARABIC SMALL HIGH LIGATURE SAD WITH LAM WITH ALEF MAKSURA..ARABIC SMALL HIGH SEEN {0x06DD, 0x06DD, prPrepend}, // Cf ARABIC END OF AYAH {0x06DF, 0x06E4, prExtend}, // Mn [6] ARABIC SMALL HIGH ROUNDED ZERO..ARABIC SMALL HIGH MADDA {0x06E7, 0x06E8, prExtend}, // Mn [2] ARABIC SMALL HIGH YEH..ARABIC SMALL HIGH NOON {0x06EA, 0x06ED, prExtend}, // Mn [4] ARABIC EMPTY CENTRE LOW STOP..ARABIC SMALL LOW MEEM {0x070F, 0x070F, prPrepend}, // Cf SYRIAC ABBREVIATION MARK {0x0711, 0x0711, prExtend}, // Mn SYRIAC LETTER SUPERSCRIPT ALAPH {0x0730, 0x074A, prExtend}, // Mn [27] SYRIAC PTHAHA ABOVE..SYRIAC BARREKH {0x07A6, 0x07B0, prExtend}, // Mn [11] THAANA ABAFILI..THAANA SUKUN {0x07EB, 0x07F3, prExtend}, // Mn [9] NKO COMBINING SHORT HIGH TONE..NKO COMBINING DOUBLE DOT ABOVE {0x07FD, 0x07FD, prExtend}, // Mn NKO DANTAYALAN {0x0816, 0x0819, prExtend}, // Mn [4] SAMARITAN MARK IN..SAMARITAN MARK DAGESH {0x081B, 0x0823, prExtend}, // Mn [9] SAMARITAN MARK EPENTHETIC YUT..SAMARITAN VOWEL SIGN A {0x0825, 0x0827, prExtend}, // Mn [3] SAMARITAN VOWEL SIGN SHORT A..SAMARITAN VOWEL SIGN U {0x0829, 0x082D, prExtend}, // Mn [5] SAMARITAN VOWEL SIGN LONG I..SAMARITAN MARK NEQUDAA {0x0859, 0x085B, prExtend}, // Mn [3] MANDAIC AFFRICATION MARK..MANDAIC GEMINATION MARK {0x0890, 0x0891, prPrepend}, // Cf [2] ARABIC POUND MARK ABOVE..ARABIC PIASTRE MARK ABOVE {0x0898, 0x089F, prExtend}, // Mn [8] ARABIC SMALL HIGH WORD AL-JUZ..ARABIC HALF MADDA OVER MADDA {0x08CA, 0x08E1, prExtend}, // Mn [24] ARABIC SMALL HIGH FARSI YEH..ARABIC SMALL HIGH SIGN SAFHA {0x08E2, 0x08E2, prPrepend}, // Cf ARABIC DISPUTED END OF AYAH {0x08E3, 0x0902, prExtend}, // Mn [32] ARABIC TURNED DAMMA BELOW..DEVANAGARI SIGN ANUSVARA {0x0903, 0x0903, prSpacingMark}, // Mc DEVANAGARI SIGN VISARGA {0x093A, 0x093A, prExtend}, // Mn DEVANAGARI VOWEL SIGN OE {0x093B, 0x093B, prSpacingMark}, // Mc DEVANAGARI VOWEL SIGN OOE {0x093C, 0x093C, prExtend}, // Mn DEVANAGARI SIGN NUKTA {0x093E, 0x0940, prSpacingMark}, // Mc [3] DEVANAGARI VOWEL SIGN AA..DEVANAGARI VOWEL SIGN II {0x0941, 0x0948, prExtend}, // Mn [8] DEVANAGARI VOWEL SIGN U..DEVANAGARI VOWEL SIGN AI {0x0949, 0x094C, prSpacingMark}, // Mc [4] DEVANAGARI VOWEL SIGN CANDRA O..DEVANAGARI VOWEL SIGN AU {0x094D, 0x094D, prExtend}, // Mn DEVANAGARI SIGN VIRAMA {0x094E, 0x094F, prSpacingMark}, // Mc [2] DEVANAGARI VOWEL SIGN PRISHTHAMATRA E..DEVANAGARI VOWEL SIGN AW {0x0951, 0x0957, prExtend}, // Mn [7] DEVANAGARI STRESS SIGN UDATTA..DEVANAGARI VOWEL SIGN UUE {0x0962, 0x0963, prExtend}, // Mn [2] DEVANAGARI VOWEL SIGN VOCALIC L..DEVANAGARI VOWEL SIGN VOCALIC LL {0x0981, 0x0981, prExtend}, // Mn BENGALI SIGN CANDRABINDU {0x0982, 0x0983, prSpacingMark}, // Mc [2] BENGALI SIGN ANUSVARA..BENGALI SIGN VISARGA {0x09BC, 0x09BC, prExtend}, // Mn BENGALI SIGN NUKTA {0x09BE, 0x09BE, prExtend}, // Mc BENGALI VOWEL SIGN AA {0x09BF, 0x09C0, prSpacingMark}, // Mc [2] BENGALI VOWEL SIGN I..BENGALI VOWEL SIGN II {0x09C1, 0x09C4, prExtend}, // Mn [4] BENGALI VOWEL SIGN U..BENGALI VOWEL SIGN VOCALIC RR {0x09C7, 0x09C8, prSpacingMark}, // Mc [2] BENGALI VOWEL SIGN E..BENGALI VOWEL SIGN AI {0x09CB, 0x09CC, prSpacingMark}, // Mc [2] BENGALI VOWEL SIGN O..BENGALI VOWEL SIGN AU {0x09CD, 0x09CD, prExtend}, // Mn BENGALI SIGN VIRAMA {0x09D7, 0x09D7, prExtend}, // Mc BENGALI AU LENGTH MARK {0x09E2, 0x09E3, prExtend}, // Mn [2] BENGALI VOWEL SIGN VOCALIC L..BENGALI VOWEL SIGN VOCALIC LL {0x09FE, 0x09FE, prExtend}, // Mn BENGALI SANDHI MARK {0x0A01, 0x0A02, prExtend}, // Mn [2] GURMUKHI SIGN ADAK BINDI..GURMUKHI SIGN BINDI {0x0A03, 0x0A03, prSpacingMark}, // Mc GURMUKHI SIGN VISARGA {0x0A3C, 0x0A3C, prExtend}, // Mn GURMUKHI SIGN NUKTA {0x0A3E, 0x0A40, prSpacingMark}, // Mc [3] GURMUKHI VOWEL SIGN AA..GURMUKHI VOWEL SIGN II {0x0A41, 0x0A42, prExtend}, // Mn [2] GURMUKHI VOWEL SIGN U..GURMUKHI VOWEL SIGN UU {0x0A47, 0x0A48, prExtend}, // Mn [2] GURMUKHI VOWEL SIGN EE..GURMUKHI VOWEL SIGN AI {0x0A4B, 0x0A4D, prExtend}, // Mn [3] GURMUKHI VOWEL SIGN OO..GURMUKHI SIGN VIRAMA {0x0A51, 0x0A51, prExtend}, // Mn GURMUKHI SIGN UDAAT {0x0A70, 0x0A71, prExtend}, // Mn [2] GURMUKHI TIPPI..GURMUKHI ADDAK {0x0A75, 0x0A75, prExtend}, // Mn GURMUKHI SIGN YAKASH {0x0A81, 0x0A82, prExtend}, // Mn [2] GUJARATI SIGN CANDRABINDU..GUJARATI SIGN ANUSVARA {0x0A83, 0x0A83, prSpacingMark}, // Mc GUJARATI SIGN VISARGA {0x0ABC, 0x0ABC, prExtend}, // Mn GUJARATI SIGN NUKTA {0x0ABE, 0x0AC0, prSpacingMark}, // Mc [3] GUJARATI VOWEL SIGN AA..GUJARATI VOWEL SIGN II {0x0AC1, 0x0AC5, prExtend}, // Mn [5] GUJARATI VOWEL SIGN U..GUJARATI VOWEL SIGN CANDRA E {0x0AC7, 0x0AC8, prExtend}, // Mn [2] GUJARATI VOWEL SIGN E..GUJARATI VOWEL SIGN AI {0x0AC9, 0x0AC9, prSpacingMark}, // Mc GUJARATI VOWEL SIGN CANDRA O {0x0ACB, 0x0ACC, prSpacingMark}, // Mc [2] GUJARATI VOWEL SIGN O..GUJARATI VOWEL SIGN AU {0x0ACD, 0x0ACD, prExtend}, // Mn GUJARATI SIGN VIRAMA {0x0AE2, 0x0AE3, prExtend}, // Mn [2] GUJARATI VOWEL SIGN VOCALIC L..GUJARATI VOWEL SIGN VOCALIC LL {0x0AFA, 0x0AFF, prExtend}, // Mn [6] GUJARATI SIGN SUKUN..GUJARATI SIGN TWO-CIRCLE NUKTA ABOVE {0x0B01, 0x0B01, prExtend}, // Mn ORIYA SIGN CANDRABINDU {0x0B02, 0x0B03, prSpacingMark}, // Mc [2] ORIYA SIGN ANUSVARA..ORIYA SIGN VISARGA {0x0B3C, 0x0B3C, prExtend}, // Mn ORIYA SIGN NUKTA {0x0B3E, 0x0B3E, prExtend}, // Mc ORIYA VOWEL SIGN AA {0x0B3F, 0x0B3F, prExtend}, // Mn ORIYA VOWEL SIGN I {0x0B40, 0x0B40, prSpacingMark}, // Mc ORIYA VOWEL SIGN II {0x0B41, 0x0B44, prExtend}, // Mn [4] ORIYA VOWEL SIGN U..ORIYA VOWEL SIGN VOCALIC RR {0x0B47, 0x0B48, prSpacingMark}, // Mc [2] ORIYA VOWEL SIGN E..ORIYA VOWEL SIGN AI {0x0B4B, 0x0B4C, prSpacingMark}, // Mc [2] ORIYA VOWEL SIGN O..ORIYA VOWEL SIGN AU {0x0B4D, 0x0B4D, prExtend}, // Mn ORIYA SIGN VIRAMA {0x0B55, 0x0B56, prExtend}, // Mn [2] ORIYA SIGN OVERLINE..ORIYA AI LENGTH MARK {0x0B57, 0x0B57, prExtend}, // Mc ORIYA AU LENGTH MARK {0x0B62, 0x0B63, prExtend}, // Mn [2] ORIYA VOWEL SIGN VOCALIC L..ORIYA VOWEL SIGN VOCALIC LL {0x0B82, 0x0B82, prExtend}, // Mn TAMIL SIGN ANUSVARA {0x0BBE, 0x0BBE, prExtend}, // Mc TAMIL VOWEL SIGN AA {0x0BBF, 0x0BBF, prSpacingMark}, // Mc TAMIL VOWEL SIGN I {0x0BC0, 0x0BC0, prExtend}, // Mn TAMIL VOWEL SIGN II {0x0BC1, 0x0BC2, prSpacingMark}, // Mc [2] TAMIL VOWEL SIGN U..TAMIL VOWEL SIGN UU {0x0BC6, 0x0BC8, prSpacingMark}, // Mc [3] TAMIL VOWEL SIGN E..TAMIL VOWEL SIGN AI {0x0BCA, 0x0BCC, prSpacingMark}, // Mc [3] TAMIL VOWEL SIGN O..TAMIL VOWEL SIGN AU {0x0BCD, 0x0BCD, prExtend}, // Mn TAMIL SIGN VIRAMA {0x0BD7, 0x0BD7, prExtend}, // Mc TAMIL AU LENGTH MARK {0x0C00, 0x0C00, prExtend}, // Mn TELUGU SIGN COMBINING CANDRABINDU ABOVE {0x0C01, 0x0C03, prSpacingMark}, // Mc [3] TELUGU SIGN CANDRABINDU..TELUGU SIGN VISARGA {0x0C04, 0x0C04, prExtend}, // Mn TELUGU SIGN COMBINING ANUSVARA ABOVE {0x0C3C, 0x0C3C, prExtend}, // Mn TELUGU SIGN NUKTA {0x0C3E, 0x0C40, prExtend}, // Mn [3] TELUGU VOWEL SIGN AA..TELUGU VOWEL SIGN II {0x0C41, 0x0C44, prSpacingMark}, // Mc [4] TELUGU VOWEL SIGN U..TELUGU VOWEL SIGN VOCALIC RR {0x0C46, 0x0C48, prExtend}, // Mn [3] TELUGU VOWEL SIGN E..TELUGU VOWEL SIGN AI {0x0C4A, 0x0C4D, prExtend}, // Mn [4] TELUGU VOWEL SIGN O..TELUGU SIGN VIRAMA {0x0C55, 0x0C56, prExtend}, // Mn [2] TELUGU LENGTH MARK..TELUGU AI LENGTH MARK {0x0C62, 0x0C63, prExtend}, // Mn [2] TELUGU VOWEL SIGN VOCALIC L..TELUGU VOWEL SIGN VOCALIC LL {0x0C81, 0x0C81, prExtend}, // Mn KANNADA SIGN CANDRABINDU {0x0C82, 0x0C83, prSpacingMark}, // Mc [2] KANNADA SIGN ANUSVARA..KANNADA SIGN VISARGA {0x0CBC, 0x0CBC, prExtend}, // Mn KANNADA SIGN NUKTA {0x0CBE, 0x0CBE, prSpacingMark}, // Mc KANNADA VOWEL SIGN AA {0x0CBF, 0x0CBF, prExtend}, // Mn KANNADA VOWEL SIGN I {0x0CC0, 0x0CC1, prSpacingMark}, // Mc [2] KANNADA VOWEL SIGN II..KANNADA VOWEL SIGN U {0x0CC2, 0x0CC2, prExtend}, // Mc KANNADA VOWEL SIGN UU {0x0CC3, 0x0CC4, prSpacingMark}, // Mc [2] KANNADA VOWEL SIGN VOCALIC R..KANNADA VOWEL SIGN VOCALIC RR {0x0CC6, 0x0CC6, prExtend}, // Mn KANNADA VOWEL SIGN E {0x0CC7, 0x0CC8, prSpacingMark}, // Mc [2] KANNADA VOWEL SIGN EE..KANNADA VOWEL SIGN AI {0x0CCA, 0x0CCB, prSpacingMark}, // Mc [2] KANNADA VOWEL SIGN O..KANNADA VOWEL SIGN OO {0x0CCC, 0x0CCD, prExtend}, // Mn [2] KANNADA VOWEL SIGN AU..KANNADA SIGN VIRAMA {0x0CD5, 0x0CD6, prExtend}, // Mc [2] KANNADA LENGTH MARK..KANNADA AI LENGTH MARK {0x0CE2, 0x0CE3, prExtend}, // Mn [2] KANNADA VOWEL SIGN VOCALIC L..KANNADA VOWEL SIGN VOCALIC LL {0x0CF3, 0x0CF3, prSpacingMark}, // Mc KANNADA SIGN COMBINING ANUSVARA ABOVE RIGHT {0x0D00, 0x0D01, prExtend}, // Mn [2] MALAYALAM SIGN COMBINING ANUSVARA ABOVE..MALAYALAM SIGN CANDRABINDU {0x0D02, 0x0D03, prSpacingMark}, // Mc [2] MALAYALAM SIGN ANUSVARA..MALAYALAM SIGN VISARGA {0x0D3B, 0x0D3C, prExtend}, // Mn [2] MALAYALAM SIGN VERTICAL BAR VIRAMA..MALAYALAM SIGN CIRCULAR VIRAMA {0x0D3E, 0x0D3E, prExtend}, // Mc MALAYALAM VOWEL SIGN AA {0x0D3F, 0x0D40, prSpacingMark}, // Mc [2] MALAYALAM VOWEL SIGN I..MALAYALAM VOWEL SIGN II {0x0D41, 0x0D44, prExtend}, // Mn [4] MALAYALAM VOWEL SIGN U..MALAYALAM VOWEL SIGN VOCALIC RR {0x0D46, 0x0D48, prSpacingMark}, // Mc [3] MALAYALAM VOWEL SIGN E..MALAYALAM VOWEL SIGN AI {0x0D4A, 0x0D4C, prSpacingMark}, // Mc [3] MALAYALAM VOWEL SIGN O..MALAYALAM VOWEL SIGN AU {0x0D4D, 0x0D4D, prExtend}, // Mn MALAYALAM SIGN VIRAMA {0x0D4E, 0x0D4E, prPrepend}, // Lo MALAYALAM LETTER DOT REPH {0x0D57, 0x0D57, prExtend}, // Mc MALAYALAM AU LENGTH MARK {0x0D62, 0x0D63, prExtend}, // Mn [2] MALAYALAM VOWEL SIGN VOCALIC L..MALAYALAM VOWEL SIGN VOCALIC LL {0x0D81, 0x0D81, prExtend}, // Mn SINHALA SIGN CANDRABINDU {0x0D82, 0x0D83, prSpacingMark}, // Mc [2] SINHALA SIGN ANUSVARAYA..SINHALA SIGN VISARGAYA {0x0DCA, 0x0DCA, prExtend}, // Mn SINHALA SIGN AL-LAKUNA {0x0DCF, 0x0DCF, prExtend}, // Mc SINHALA VOWEL SIGN AELA-PILLA {0x0DD0, 0x0DD1, prSpacingMark}, // Mc [2] SINHALA VOWEL SIGN KETTI AEDA-PILLA..SINHALA VOWEL SIGN DIGA AEDA-PILLA {0x0DD2, 0x0DD4, prExtend}, // Mn [3] SINHALA VOWEL SIGN KETTI IS-PILLA..SINHALA VOWEL SIGN KETTI PAA-PILLA {0x0DD6, 0x0DD6, prExtend}, // Mn SINHALA VOWEL SIGN DIGA PAA-PILLA {0x0DD8, 0x0DDE, prSpacingMark}, // Mc [7] SINHALA VOWEL SIGN GAETTA-PILLA..SINHALA VOWEL SIGN KOMBUVA HAA GAYANUKITTA {0x0DDF, 0x0DDF, prExtend}, // Mc SINHALA VOWEL SIGN GAYANUKITTA {0x0DF2, 0x0DF3, prSpacingMark}, // Mc [2] SINHALA VOWEL SIGN DIGA GAETTA-PILLA..SINHALA VOWEL SIGN DIGA GAYANUKITTA {0x0E31, 0x0E31, prExtend}, // Mn THAI CHARACTER MAI HAN-AKAT {0x0E33, 0x0E33, prSpacingMark}, // Lo THAI CHARACTER SARA AM {0x0E34, 0x0E3A, prExtend}, // Mn [7] THAI CHARACTER SARA I..THAI CHARACTER PHINTHU {0x0E47, 0x0E4E, prExtend}, // Mn [8] THAI CHARACTER MAITAIKHU..THAI CHARACTER YAMAKKAN {0x0EB1, 0x0EB1, prExtend}, // Mn LAO VOWEL SIGN MAI KAN {0x0EB3, 0x0EB3, prSpacingMark}, // Lo LAO VOWEL SIGN AM {0x0EB4, 0x0EBC, prExtend}, // Mn [9] LAO VOWEL SIGN I..LAO SEMIVOWEL SIGN LO {0x0EC8, 0x0ECE, prExtend}, // Mn [7] LAO TONE MAI EK..LAO YAMAKKAN {0x0F18, 0x0F19, prExtend}, // Mn [2] TIBETAN ASTROLOGICAL SIGN -KHYUD PA..TIBETAN ASTROLOGICAL SIGN SDONG TSHUGS {0x0F35, 0x0F35, prExtend}, // Mn TIBETAN MARK NGAS BZUNG NYI ZLA {0x0F37, 0x0F37, prExtend}, // Mn TIBETAN MARK NGAS BZUNG SGOR RTAGS {0x0F39, 0x0F39, prExtend}, // Mn TIBETAN MARK TSA -PHRU {0x0F3E, 0x0F3F, prSpacingMark}, // Mc [2] TIBETAN SIGN YAR TSHES..TIBETAN SIGN MAR TSHES {0x0F71, 0x0F7E, prExtend}, // Mn [14] TIBETAN VOWEL SIGN AA..TIBETAN SIGN RJES SU NGA RO {0x0F7F, 0x0F7F, prSpacingMark}, // Mc TIBETAN SIGN RNAM BCAD {0x0F80, 0x0F84, prExtend}, // Mn [5] TIBETAN VOWEL SIGN REVERSED I..TIBETAN MARK HALANTA {0x0F86, 0x0F87, prExtend}, // Mn [2] TIBETAN SIGN LCI RTAGS..TIBETAN SIGN YANG RTAGS {0x0F8D, 0x0F97, prExtend}, // Mn [11] TIBETAN SUBJOINED SIGN LCE TSA CAN..TIBETAN SUBJOINED LETTER JA {0x0F99, 0x0FBC, prExtend}, // Mn [36] TIBETAN SUBJOINED LETTER NYA..TIBETAN SUBJOINED LETTER FIXED-FORM RA {0x0FC6, 0x0FC6, prExtend}, // Mn TIBETAN SYMBOL PADMA GDAN {0x102D, 0x1030, prExtend}, // Mn [4] MYANMAR VOWEL SIGN I..MYANMAR VOWEL SIGN UU {0x1031, 0x1031, prSpacingMark}, // Mc MYANMAR VOWEL SIGN E {0x1032, 0x1037, prExtend}, // Mn [6] MYANMAR VOWEL SIGN AI..MYANMAR SIGN DOT BELOW {0x1039, 0x103A, prExtend}, // Mn [2] MYANMAR SIGN VIRAMA..MYANMAR SIGN ASAT {0x103B, 0x103C, prSpacingMark}, // Mc [2] MYANMAR CONSONANT SIGN MEDIAL YA..MYANMAR CONSONANT SIGN MEDIAL RA {0x103D, 0x103E, prExtend}, // Mn [2] MYANMAR CONSONANT SIGN MEDIAL WA..MYANMAR CONSONANT SIGN MEDIAL HA {0x1056, 0x1057, prSpacingMark}, // Mc [2] MYANMAR VOWEL SIGN VOCALIC R..MYANMAR VOWEL SIGN VOCALIC RR {0x1058, 0x1059, prExtend}, // Mn [2] MYANMAR VOWEL SIGN VOCALIC L..MYANMAR VOWEL SIGN VOCALIC LL {0x105E, 0x1060, prExtend}, // Mn [3] MYANMAR CONSONANT SIGN MON MEDIAL NA..MYANMAR CONSONANT SIGN MON MEDIAL LA {0x1071, 0x1074, prExtend}, // Mn [4] MYANMAR VOWEL SIGN GEBA KAREN I..MYANMAR VOWEL SIGN KAYAH EE {0x1082, 0x1082, prExtend}, // Mn MYANMAR CONSONANT SIGN SHAN MEDIAL WA {0x1084, 0x1084, prSpacingMark}, // Mc MYANMAR VOWEL SIGN SHAN E {0x1085, 0x1086, prExtend}, // Mn [2] MYANMAR VOWEL SIGN SHAN E ABOVE..MYANMAR VOWEL SIGN SHAN FINAL Y {0x108D, 0x108D, prExtend}, // Mn MYANMAR SIGN SHAN COUNCIL EMPHATIC TONE {0x109D, 0x109D, prExtend}, // Mn MYANMAR VOWEL SIGN AITON AI {0x1100, 0x115F, prL}, // Lo [96] HANGUL CHOSEONG KIYEOK..HANGUL CHOSEONG FILLER {0x1160, 0x11A7, prV}, // Lo [72] HANGUL JUNGSEONG FILLER..HANGUL JUNGSEONG O-YAE {0x11A8, 0x11FF, prT}, // Lo [88] HANGUL JONGSEONG KIYEOK..HANGUL JONGSEONG SSANGNIEUN {0x135D, 0x135F, prExtend}, // Mn [3] ETHIOPIC COMBINING GEMINATION AND VOWEL LENGTH MARK..ETHIOPIC COMBINING GEMINATION MARK {0x1712, 0x1714, prExtend}, // Mn [3] TAGALOG VOWEL SIGN I..TAGALOG SIGN VIRAMA {0x1715, 0x1715, prSpacingMark}, // Mc TAGALOG SIGN PAMUDPOD {0x1732, 0x1733, prExtend}, // Mn [2] HANUNOO VOWEL SIGN I..HANUNOO VOWEL SIGN U {0x1734, 0x1734, prSpacingMark}, // Mc HANUNOO SIGN PAMUDPOD {0x1752, 0x1753, prExtend}, // Mn [2] BUHID VOWEL SIGN I..BUHID VOWEL SIGN U {0x1772, 0x1773, prExtend}, // Mn [2] TAGBANWA VOWEL SIGN I..TAGBANWA VOWEL SIGN U {0x17B4, 0x17B5, prExtend}, // Mn [2] KHMER VOWEL INHERENT AQ..KHMER VOWEL INHERENT AA {0x17B6, 0x17B6, prSpacingMark}, // Mc KHMER VOWEL SIGN AA {0x17B7, 0x17BD, prExtend}, // Mn [7] KHMER VOWEL SIGN I..KHMER VOWEL SIGN UA {0x17BE, 0x17C5, prSpacingMark}, // Mc [8] KHMER VOWEL SIGN OE..KHMER VOWEL SIGN AU {0x17C6, 0x17C6, prExtend}, // Mn KHMER SIGN NIKAHIT {0x17C7, 0x17C8, prSpacingMark}, // Mc [2] KHMER SIGN REAHMUK..KHMER SIGN YUUKALEAPINTU {0x17C9, 0x17D3, prExtend}, // Mn [11] KHMER SIGN MUUSIKATOAN..KHMER SIGN BATHAMASAT {0x17DD, 0x17DD, prExtend}, // Mn KHMER SIGN ATTHACAN {0x180B, 0x180D, prExtend}, // Mn [3] MONGOLIAN FREE VARIATION SELECTOR ONE..MONGOLIAN FREE VARIATION SELECTOR THREE {0x180E, 0x180E, prControl}, // Cf MONGOLIAN VOWEL SEPARATOR {0x180F, 0x180F, prExtend}, // Mn MONGOLIAN FREE VARIATION SELECTOR FOUR {0x1885, 0x1886, prExtend}, // Mn [2] MONGOLIAN LETTER ALI GALI BALUDA..MONGOLIAN LETTER ALI GALI THREE BALUDA {0x18A9, 0x18A9, prExtend}, // Mn MONGOLIAN LETTER ALI GALI DAGALGA {0x1920, 0x1922, prExtend}, // Mn [3] LIMBU VOWEL SIGN A..LIMBU VOWEL SIGN U {0x1923, 0x1926, prSpacingMark}, // Mc [4] LIMBU VOWEL SIGN EE..LIMBU VOWEL SIGN AU {0x1927, 0x1928, prExtend}, // Mn [2] LIMBU VOWEL SIGN E..LIMBU VOWEL SIGN O {0x1929, 0x192B, prSpacingMark}, // Mc [3] LIMBU SUBJOINED LETTER YA..LIMBU SUBJOINED LETTER WA {0x1930, 0x1931, prSpacingMark}, // Mc [2] LIMBU SMALL LETTER KA..LIMBU SMALL LETTER NGA {0x1932, 0x1932, prExtend}, // Mn LIMBU SMALL LETTER ANUSVARA {0x1933, 0x1938, prSpacingMark}, // Mc [6] LIMBU SMALL LETTER TA..LIMBU SMALL LETTER LA {0x1939, 0x193B, prExtend}, // Mn [3] LIMBU SIGN MUKPHRENG..LIMBU SIGN SA-I {0x1A17, 0x1A18, prExtend}, // Mn [2] BUGINESE VOWEL SIGN I..BUGINESE VOWEL SIGN U {0x1A19, 0x1A1A, prSpacingMark}, // Mc [2] BUGINESE VOWEL SIGN E..BUGINESE VOWEL SIGN O {0x1A1B, 0x1A1B, prExtend}, // Mn BUGINESE VOWEL SIGN AE {0x1A55, 0x1A55, prSpacingMark}, // Mc TAI THAM CONSONANT SIGN MEDIAL RA {0x1A56, 0x1A56, prExtend}, // Mn TAI THAM CONSONANT SIGN MEDIAL LA {0x1A57, 0x1A57, prSpacingMark}, // Mc TAI THAM CONSONANT SIGN LA TANG LAI {0x1A58, 0x1A5E, prExtend}, // Mn [7] TAI THAM SIGN MAI KANG LAI..TAI THAM CONSONANT SIGN SA {0x1A60, 0x1A60, prExtend}, // Mn TAI THAM SIGN SAKOT {0x1A62, 0x1A62, prExtend}, // Mn TAI THAM VOWEL SIGN MAI SAT {0x1A65, 0x1A6C, prExtend}, // Mn [8] TAI THAM VOWEL SIGN I..TAI THAM VOWEL SIGN OA BELOW {0x1A6D, 0x1A72, prSpacingMark}, // Mc [6] TAI THAM VOWEL SIGN OY..TAI THAM VOWEL SIGN THAM AI {0x1A73, 0x1A7C, prExtend}, // Mn [10] TAI THAM VOWEL SIGN OA ABOVE..TAI THAM SIGN KHUEN-LUE KARAN {0x1A7F, 0x1A7F, prExtend}, // Mn TAI THAM COMBINING CRYPTOGRAMMIC DOT {0x1AB0, 0x1ABD, prExtend}, // Mn [14] COMBINING DOUBLED CIRCUMFLEX ACCENT..COMBINING PARENTHESES BELOW {0x1ABE, 0x1ABE, prExtend}, // Me COMBINING PARENTHESES OVERLAY {0x1ABF, 0x1ACE, prExtend}, // Mn [16] COMBINING LATIN SMALL LETTER W BELOW..COMBINING LATIN SMALL LETTER INSULAR T {0x1B00, 0x1B03, prExtend}, // Mn [4] BALINESE SIGN ULU RICEM..BALINESE SIGN SURANG {0x1B04, 0x1B04, prSpacingMark}, // Mc BALINESE SIGN BISAH {0x1B34, 0x1B34, prExtend}, // Mn BALINESE SIGN REREKAN {0x1B35, 0x1B35, prExtend}, // Mc BALINESE VOWEL SIGN TEDUNG {0x1B36, 0x1B3A, prExtend}, // Mn [5] BALINESE VOWEL SIGN ULU..BALINESE VOWEL SIGN RA REPA {0x1B3B, 0x1B3B, prSpacingMark}, // Mc BALINESE VOWEL SIGN RA REPA TEDUNG {0x1B3C, 0x1B3C, prExtend}, // Mn BALINESE VOWEL SIGN LA LENGA {0x1B3D, 0x1B41, prSpacingMark}, // Mc [5] BALINESE VOWEL SIGN LA LENGA TEDUNG..BALINESE VOWEL SIGN TALING REPA TEDUNG {0x1B42, 0x1B42, prExtend}, // Mn BALINESE VOWEL SIGN PEPET {0x1B43, 0x1B44, prSpacingMark}, // Mc [2] BALINESE VOWEL SIGN PEPET TEDUNG..BALINESE ADEG ADEG {0x1B6B, 0x1B73, prExtend}, // Mn [9] BALINESE MUSICAL SYMBOL COMBINING TEGEH..BALINESE MUSICAL SYMBOL COMBINING GONG {0x1B80, 0x1B81, prExtend}, // Mn [2] SUNDANESE SIGN PANYECEK..SUNDANESE SIGN PANGLAYAR {0x1B82, 0x1B82, prSpacingMark}, // Mc SUNDANESE SIGN PANGWISAD {0x1BA1, 0x1BA1, prSpacingMark}, // Mc SUNDANESE CONSONANT SIGN PAMINGKAL {0x1BA2, 0x1BA5, prExtend}, // Mn [4] SUNDANESE CONSONANT SIGN PANYAKRA..SUNDANESE VOWEL SIGN PANYUKU {0x1BA6, 0x1BA7, prSpacingMark}, // Mc [2] SUNDANESE VOWEL SIGN PANAELAENG..SUNDANESE VOWEL SIGN PANOLONG {0x1BA8, 0x1BA9, prExtend}, // Mn [2] SUNDANESE VOWEL SIGN PAMEPET..SUNDANESE VOWEL SIGN PANEULEUNG {0x1BAA, 0x1BAA, prSpacingMark}, // Mc SUNDANESE SIGN PAMAAEH {0x1BAB, 0x1BAD, prExtend}, // Mn [3] SUNDANESE SIGN VIRAMA..SUNDANESE CONSONANT SIGN PASANGAN WA {0x1BE6, 0x1BE6, prExtend}, // Mn BATAK SIGN TOMPI {0x1BE7, 0x1BE7, prSpacingMark}, // Mc BATAK VOWEL SIGN E {0x1BE8, 0x1BE9, prExtend}, // Mn [2] BATAK VOWEL SIGN PAKPAK E..BATAK VOWEL SIGN EE {0x1BEA, 0x1BEC, prSpacingMark}, // Mc [3] BATAK VOWEL SIGN I..BATAK VOWEL SIGN O {0x1BED, 0x1BED, prExtend}, // Mn BATAK VOWEL SIGN KARO O {0x1BEE, 0x1BEE, prSpacingMark}, // Mc BATAK VOWEL SIGN U {0x1BEF, 0x1BF1, prExtend}, // Mn [3] BATAK VOWEL SIGN U FOR SIMALUNGUN SA..BATAK CONSONANT SIGN H {0x1BF2, 0x1BF3, prSpacingMark}, // Mc [2] BATAK PANGOLAT..BATAK PANONGONAN {0x1C24, 0x1C2B, prSpacingMark}, // Mc [8] LEPCHA SUBJOINED LETTER YA..LEPCHA VOWEL SIGN UU {0x1C2C, 0x1C33, prExtend}, // Mn [8] LEPCHA VOWEL SIGN E..LEPCHA CONSONANT SIGN T {0x1C34, 0x1C35, prSpacingMark}, // Mc [2] LEPCHA CONSONANT SIGN NYIN-DO..LEPCHA CONSONANT SIGN KANG {0x1C36, 0x1C37, prExtend}, // Mn [2] LEPCHA SIGN RAN..LEPCHA SIGN NUKTA {0x1CD0, 0x1CD2, prExtend}, // Mn [3] VEDIC TONE KARSHANA..VEDIC TONE PRENKHA {0x1CD4, 0x1CE0, prExtend}, // Mn [13] VEDIC SIGN YAJURVEDIC MIDLINE SVARITA..VEDIC TONE RIGVEDIC KASHMIRI INDEPENDENT SVARITA {0x1CE1, 0x1CE1, prSpacingMark}, // Mc VEDIC TONE ATHARVAVEDIC INDEPENDENT SVARITA {0x1CE2, 0x1CE8, prExtend}, // Mn [7] VEDIC SIGN VISARGA SVARITA..VEDIC SIGN VISARGA ANUDATTA WITH TAIL {0x1CED, 0x1CED, prExtend}, // Mn VEDIC SIGN TIRYAK {0x1CF4, 0x1CF4, prExtend}, // Mn VEDIC TONE CANDRA ABOVE {0x1CF7, 0x1CF7, prSpacingMark}, // Mc VEDIC SIGN ATIKRAMA {0x1CF8, 0x1CF9, prExtend}, // Mn [2] VEDIC TONE RING ABOVE..VEDIC TONE DOUBLE RING ABOVE {0x1DC0, 0x1DFF, prExtend}, // Mn [64] COMBINING DOTTED GRAVE ACCENT..COMBINING RIGHT ARROWHEAD AND DOWN ARROWHEAD BELOW {0x200B, 0x200B, prControl}, // Cf ZERO WIDTH SPACE {0x200C, 0x200C, prExtend}, // Cf ZERO WIDTH NON-JOINER {0x200D, 0x200D, prZWJ}, // Cf ZERO WIDTH JOINER {0x200E, 0x200F, prControl}, // Cf [2] LEFT-TO-RIGHT MARK..RIGHT-TO-LEFT MARK {0x2028, 0x2028, prControl}, // Zl LINE SEPARATOR {0x2029, 0x2029, prControl}, // Zp PARAGRAPH SEPARATOR {0x202A, 0x202E, prControl}, // Cf [5] LEFT-TO-RIGHT EMBEDDING..RIGHT-TO-LEFT OVERRIDE {0x203C, 0x203C, prExtendedPictographic}, // E0.6 [1] (‼️) double exclamation mark {0x2049, 0x2049, prExtendedPictographic}, // E0.6 [1] (⁉️) exclamation question mark {0x2060, 0x2064, prControl}, // Cf [5] WORD JOINER..INVISIBLE PLUS {0x2065, 0x2065, prControl}, // Cn <reserved-2065> {0x2066, 0x206F, prControl}, // Cf [10] LEFT-TO-RIGHT ISOLATE..NOMINAL DIGIT SHAPES {0x20D0, 0x20DC, prExtend}, // Mn [13] COMBINING LEFT HARPOON ABOVE..COMBINING FOUR DOTS ABOVE {0x20DD, 0x20E0, prExtend}, // Me [4] COMBINING ENCLOSING CIRCLE..COMBINING ENCLOSING CIRCLE BACKSLASH {0x20E1, 0x20E1, prExtend}, // Mn COMBINING LEFT RIGHT ARROW ABOVE {0x20E2, 0x20E4, prExtend}, // Me [3] COMBINING ENCLOSING SCREEN..COMBINING ENCLOSING UPWARD POINTING TRIANGLE {0x20E5, 0x20F0, prExtend}, // Mn [12] COMBINING REVERSE SOLIDUS OVERLAY..COMBINING ASTERISK ABOVE {0x2122, 0x2122, prExtendedPictographic}, // E0.6 [1] (™️) trade mark {0x2139, 0x2139, prExtendedPictographic}, // E0.6 [1] (ℹ️) information {0x2194, 0x2199, prExtendedPictographic}, // E0.6 [6] (↔️..↙️) left-right arrow..down-left arrow {0x21A9, 0x21AA, prExtendedPictographic}, // E0.6 [2] (↩️..↪️) right arrow curving left..left arrow curving right {0x231A, 0x231B, prExtendedPictographic}, // E0.6 [2] (⌚..⌛) watch..hourglass done {0x2328, 0x2328, prExtendedPictographic}, // E1.0 [1] (⌨️) keyboard {0x2388, 0x2388, prExtendedPictographic}, // E0.0 [1] (⎈) HELM SYMBOL {0x23CF, 0x23CF, prExtendedPictographic}, // E1.0 [1] (⏏️) eject button {0x23E9, 0x23EC, prExtendedPictographic}, // E0.6 [4] (⏩..⏬) fast-forward button..fast down button {0x23ED, 0x23EE, prExtendedPictographic}, // E0.7 [2] (⏭️..⏮️) next track button..last track button {0x23EF, 0x23EF, prExtendedPictographic}, // E1.0 [1] (⏯️) play or pause button {0x23F0, 0x23F0, prExtendedPictographic}, // E0.6 [1] (⏰) alarm clock {0x23F1, 0x23F2, prExtendedPictographic}, // E1.0 [2] (⏱️..⏲️) stopwatch..timer clock {0x23F3, 0x23F3, prExtendedPictographic}, // E0.6 [1] (⏳) hourglass not done {0x23F8, 0x23FA, prExtendedPictographic}, // E0.7 [3] (⏸️..⏺️) pause button..record button {0x24C2, 0x24C2, prExtendedPictographic}, // E0.6 [1] (Ⓜ️) circled M {0x25AA, 0x25AB, prExtendedPictographic}, // E0.6 [2] (▪️..▫️) black small square..white small square {0x25B6, 0x25B6, prExtendedPictographic}, // E0.6 [1] (▶️) play button {0x25C0, 0x25C0, prExtendedPictographic}, // E0.6 [1] (◀️) reverse button {0x25FB, 0x25FE, prExtendedPictographic}, // E0.6 [4] (◻️..◾) white medium square..black medium-small square {0x2600, 0x2601, prExtendedPictographic}, // E0.6 [2] (☀️..☁️) sun..cloud {0x2602, 0x2603, prExtendedPictographic}, // E0.7 [2] (☂️..☃️) umbrella..snowman {0x2604, 0x2604, prExtendedPictographic}, // E1.0 [1] (☄️) comet {0x2605, 0x2605, prExtendedPictographic}, // E0.0 [1] (★) BLACK STAR {0x2607, 0x260D, prExtendedPictographic}, // E0.0 [7] (☇..☍) LIGHTNING..OPPOSITION {0x260E, 0x260E, prExtendedPictographic}, // E0.6 [1] (☎️) telephone {0x260F, 0x2610, prExtendedPictographic}, // E0.0 [2] (☏..☐) WHITE TELEPHONE..BALLOT BOX {0x2611, 0x2611, prExtendedPictographic}, // E0.6 [1] (☑️) check box with check {0x2612, 0x2612, prExtendedPictographic}, // E0.0 [1] (☒) BALLOT BOX WITH X {0x2614, 0x2615, prExtendedPictographic}, // E0.6 [2] (☔..☕) umbrella with rain drops..hot beverage {0x2616, 0x2617, prExtendedPictographic}, // E0.0 [2] (☖..☗) WHITE SHOGI PIECE..BLACK SHOGI PIECE {0x2618, 0x2618, prExtendedPictographic}, // E1.0 [1] (☘️) shamrock {0x2619, 0x261C, prExtendedPictographic}, // E0.0 [4] (☙..☜) REVERSED ROTATED FLORAL HEART BULLET..WHITE LEFT POINTING INDEX {0x261D, 0x261D, prExtendedPictographic}, // E0.6 [1] (☝️) index pointing up {0x261E, 0x261F, prExtendedPictographic}, // E0.0 [2] (☞..☟) WHITE RIGHT POINTING INDEX..WHITE DOWN POINTING INDEX {0x2620, 0x2620, prExtendedPictographic}, // E1.0 [1] (☠️) skull and crossbones
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
true
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/rivo/uniseg/properties.go
vendor/github.com/rivo/uniseg/properties.go
package uniseg // The Unicode properties as used in the various parsers. Only the ones needed // in the context of this package are included. const ( prXX = 0 // Same as prAny. prAny = iota // prAny must be 0. prPrepend // Grapheme properties must come first, to reduce the number of bits stored in the state vector. prCR prLF prControl prExtend prRegionalIndicator prSpacingMark prL prV prT prLV prLVT prZWJ prExtendedPictographic prNewline prWSegSpace prDoubleQuote prSingleQuote prMidNumLet prNumeric prMidLetter prMidNum prExtendNumLet prALetter prFormat prHebrewLetter prKatakana prSp prSTerm prClose prSContinue prATerm prUpper prLower prSep prOLetter prCM prBA prBK prSP prEX prQU prAL prPR prPO prOP prCP prIS prHY prSY prNU prCL prNL prGL prAI prBB prHL prSA prJL prJV prJT prNS prZW prB2 prIN prWJ prID prEB prCJ prH2 prH3 prSG prCB prRI prEM prN prNa prA prW prH prF prEmojiPresentation ) // Unicode General Categories. Only the ones needed in the context of this // package are included. const ( gcNone = iota // gcNone must be 0. gcCc gcZs gcPo gcSc gcPs gcPe gcSm gcPd gcNd gcLu gcSk gcPc gcLl gcSo gcLo gcPi gcCf gcNo gcPf gcLC gcLm gcMn gcMe gcMc gcNl gcZl gcZp gcCn gcCs gcCo ) // Special code points. const ( vs15 = 0xfe0e // Variation Selector-15 (text presentation) vs16 = 0xfe0f // Variation Selector-16 (emoji presentation) ) // propertySearch performs a binary search on a property slice and returns the // entry whose range (start = first array element, end = second array element) // includes r, or an array of 0's if no such entry was found. func propertySearch[E interface{ [3]int | [4]int }](dictionary []E, r rune) (result E) { // Run a binary search. from := 0 to := len(dictionary) for to > from { middle := (from + to) / 2 cpRange := dictionary[middle] if int(r) < cpRange[0] { to = middle continue } if int(r) > cpRange[1] { from = middle + 1 continue } return cpRange } return } // property returns the Unicode property value (see constants above) of the // given code point. func property(dictionary [][3]int, r rune) int { return propertySearch(dictionary, r)[2] } // propertyLineBreak returns the Unicode property value and General Category // (see constants above) of the given code point, as listed in the line break // code points table, while fast tracking ASCII digits and letters. func propertyLineBreak(r rune) (property, generalCategory int) { if r >= 'a' && r <= 'z' { return prAL, gcLl } if r >= 'A' && r <= 'Z' { return prAL, gcLu } if r >= '0' && r <= '9' { return prNU, gcNd } entry := propertySearch(lineBreakCodePoints, r) return entry[2], entry[3] } // propertyGraphemes returns the Unicode grapheme cluster property value of the // given code point while fast tracking ASCII characters. func propertyGraphemes(r rune) int { if r >= 0x20 && r <= 0x7e { return prAny } if r == 0x0a { return prLF } if r == 0x0d { return prCR } if r >= 0 && r <= 0x1f || r == 0x7f { return prControl } return property(graphemeCodePoints, r) } // propertyEastAsianWidth returns the Unicode East Asian Width property value of // the given code point while fast tracking ASCII characters. func propertyEastAsianWidth(r rune) int { if r >= 0x20 && r <= 0x7e { return prNa } if r >= 0 && r <= 0x1f || r == 0x7f { return prN } return property(eastAsianWidth, r) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/rivo/uniseg/grapheme.go
vendor/github.com/rivo/uniseg/grapheme.go
package uniseg import "unicode/utf8" // Graphemes implements an iterator over Unicode grapheme clusters, or // user-perceived characters. While iterating, it also provides information // about word boundaries, sentence boundaries, line breaks, and monospace // character widths. // // After constructing the class via [NewGraphemes] for a given string "str", // [Graphemes.Next] is called for every grapheme cluster in a loop until it // returns false. Inside the loop, information about the grapheme cluster as // well as boundary information and character width is available via the various // methods (see examples below). // // This class basically wraps the [StepString] parser and provides a convenient // interface to it. If you are only interested in some parts of this package's // functionality, using the specialized functions starting with "First" is // almost always faster. type Graphemes struct { // The original string. original string // The remaining string to be parsed. remaining string // The current grapheme cluster. cluster string // The byte offset of the current grapheme cluster relative to the original // string. offset int // The current boundary information of the [Step] parser. boundaries int // The current state of the [Step] parser. state int } // NewGraphemes returns a new grapheme cluster iterator. func NewGraphemes(str string) *Graphemes { return &Graphemes{ original: str, remaining: str, state: -1, } } // Next advances the iterator by one grapheme cluster and returns false if no // clusters are left. This function must be called before the first cluster is // accessed. func (g *Graphemes) Next() bool { if len(g.remaining) == 0 { // We're already past the end. g.state = -2 g.cluster = "" return false } g.offset += len(g.cluster) g.cluster, g.remaining, g.boundaries, g.state = StepString(g.remaining, g.state) return true } // Runes returns a slice of runes (code points) which corresponds to the current // grapheme cluster. If the iterator is already past the end or [Graphemes.Next] // has not yet been called, nil is returned. func (g *Graphemes) Runes() []rune { if g.state < 0 { return nil } return []rune(g.cluster) } // Str returns a substring of the original string which corresponds to the // current grapheme cluster. If the iterator is already past the end or // [Graphemes.Next] has not yet been called, an empty string is returned. func (g *Graphemes) Str() string { return g.cluster } // Bytes returns a byte slice which corresponds to the current grapheme cluster. // If the iterator is already past the end or [Graphemes.Next] has not yet been // called, nil is returned. func (g *Graphemes) Bytes() []byte { if g.state < 0 { return nil } return []byte(g.cluster) } // Positions returns the interval of the current grapheme cluster as byte // positions into the original string. The first returned value "from" indexes // the first byte and the second returned value "to" indexes the first byte that // is not included anymore, i.e. str[from:to] is the current grapheme cluster of // the original string "str". If [Graphemes.Next] has not yet been called, both // values are 0. If the iterator is already past the end, both values are 1. func (g *Graphemes) Positions() (int, int) { if g.state == -1 { return 0, 0 } else if g.state == -2 { return 1, 1 } return g.offset, g.offset + len(g.cluster) } // IsWordBoundary returns true if a word ends after the current grapheme // cluster. func (g *Graphemes) IsWordBoundary() bool { if g.state < 0 { return true } return g.boundaries&MaskWord != 0 } // IsSentenceBoundary returns true if a sentence ends after the current // grapheme cluster. func (g *Graphemes) IsSentenceBoundary() bool { if g.state < 0 { return true } return g.boundaries&MaskSentence != 0 } // LineBreak returns whether the line can be broken after the current grapheme // cluster. A value of [LineDontBreak] means the line may not be broken, a value // of [LineMustBreak] means the line must be broken, and a value of // [LineCanBreak] means the line may or may not be broken. func (g *Graphemes) LineBreak() int { if g.state == -1 { return LineDontBreak } if g.state == -2 { return LineMustBreak } return g.boundaries & MaskLine } // Width returns the monospace width of the current grapheme cluster. func (g *Graphemes) Width() int { if g.state < 0 { return 0 } return g.boundaries >> ShiftWidth } // Reset puts the iterator into its initial state such that the next call to // [Graphemes.Next] sets it to the first grapheme cluster again. func (g *Graphemes) Reset() { g.state = -1 g.offset = 0 g.cluster = "" g.remaining = g.original } // GraphemeClusterCount returns the number of user-perceived characters // (grapheme clusters) for the given string. func GraphemeClusterCount(s string) (n int) { state := -1 for len(s) > 0 { _, s, _, state = FirstGraphemeClusterInString(s, state) n++ } return } // ReverseString reverses the given string while observing grapheme cluster // boundaries. func ReverseString(s string) string { str := []byte(s) reversed := make([]byte, len(str)) state := -1 index := len(str) for len(str) > 0 { var cluster []byte cluster, str, _, state = FirstGraphemeCluster(str, state) index -= len(cluster) copy(reversed[index:], cluster) if index <= len(str)/2 { break } } return string(reversed) } // The number of bits the grapheme property must be shifted to make place for // grapheme states. const shiftGraphemePropState = 4 // FirstGraphemeCluster returns the first grapheme cluster found in the given // byte slice according to the rules of [Unicode Standard Annex #29, Grapheme // Cluster Boundaries]. This function can be called continuously to extract all // grapheme clusters from a byte slice, as illustrated in the example below. // // If you don't know the current state, for example when calling the function // for the first time, you must pass -1. For consecutive calls, pass the state // and rest slice returned by the previous call. // // The "rest" slice is the sub-slice of the original byte slice "b" starting // after the last byte of the identified grapheme cluster. If the length of the // "rest" slice is 0, the entire byte slice "b" has been processed. The // "cluster" byte slice is the sub-slice of the input slice containing the // identified grapheme cluster. // // The returned width is the width of the grapheme cluster for most monospace // fonts where a value of 1 represents one character cell. // // Given an empty byte slice "b", the function returns nil values. // // While slightly less convenient than using the Graphemes class, this function // has much better performance and makes no allocations. It lends itself well to // large byte slices. // // [Unicode Standard Annex #29, Grapheme Cluster Boundaries]: http://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries func FirstGraphemeCluster(b []byte, state int) (cluster, rest []byte, width, newState int) { // An empty byte slice returns nothing. if len(b) == 0 { return } // Extract the first rune. r, length := utf8.DecodeRune(b) if len(b) <= length { // If we're already past the end, there is nothing else to parse. var prop int if state < 0 { prop = propertyGraphemes(r) } else { prop = state >> shiftGraphemePropState } return b, nil, runeWidth(r, prop), grAny | (prop << shiftGraphemePropState) } // If we don't know the state, determine it now. var firstProp int if state < 0 { state, firstProp, _ = transitionGraphemeState(state, r) } else { firstProp = state >> shiftGraphemePropState } width += runeWidth(r, firstProp) // Transition until we find a boundary. for { var ( prop int boundary bool ) r, l := utf8.DecodeRune(b[length:]) state, prop, boundary = transitionGraphemeState(state&maskGraphemeState, r) if boundary { return b[:length], b[length:], width, state | (prop << shiftGraphemePropState) } if firstProp == prExtendedPictographic { if r == vs15 { width = 1 } else if r == vs16 { width = 2 } } else if firstProp != prRegionalIndicator && firstProp != prL { width += runeWidth(r, prop) } length += l if len(b) <= length { return b, nil, width, grAny | (prop << shiftGraphemePropState) } } } // FirstGraphemeClusterInString is like [FirstGraphemeCluster] but its input and // outputs are strings. func FirstGraphemeClusterInString(str string, state int) (cluster, rest string, width, newState int) { // An empty string returns nothing. if len(str) == 0 { return } // Extract the first rune. r, length := utf8.DecodeRuneInString(str) if len(str) <= length { // If we're already past the end, there is nothing else to parse. var prop int if state < 0 { prop = propertyGraphemes(r) } else { prop = state >> shiftGraphemePropState } return str, "", runeWidth(r, prop), grAny | (prop << shiftGraphemePropState) } // If we don't know the state, determine it now. var firstProp int if state < 0 { state, firstProp, _ = transitionGraphemeState(state, r) } else { firstProp = state >> shiftGraphemePropState } width += runeWidth(r, firstProp) // Transition until we find a boundary. for { var ( prop int boundary bool ) r, l := utf8.DecodeRuneInString(str[length:]) state, prop, boundary = transitionGraphemeState(state&maskGraphemeState, r) if boundary { return str[:length], str[length:], width, state | (prop << shiftGraphemePropState) } if firstProp == prExtendedPictographic { if r == vs15 { width = 1 } else if r == vs16 { width = 2 } } else if firstProp != prRegionalIndicator && firstProp != prL { width += runeWidth(r, prop) } length += l if len(str) <= length { return str, "", width, grAny | (prop << shiftGraphemePropState) } } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/rivo/uniseg/gen_properties.go
vendor/github.com/rivo/uniseg/gen_properties.go
//go:build generate // This program generates a property file in Go file from Unicode Character // Database auxiliary data files. The command line arguments are as follows: // // 1. The name of the Unicode data file (just the filename, without extension). // Can be "-" (to skip) if the emoji flag is included. // 2. The name of the locally generated Go file. // 3. The name of the slice mapping code points to properties. // 4. The name of the generator, for logging purposes. // 5. (Optional) Flags, comma-separated. The following flags are available: // - "emojis=<property>": include the specified emoji properties (e.g. // "Extended_Pictographic"). // - "gencat": include general category properties. // //go:generate go run gen_properties.go auxiliary/GraphemeBreakProperty graphemeproperties.go graphemeCodePoints graphemes emojis=Extended_Pictographic //go:generate go run gen_properties.go auxiliary/WordBreakProperty wordproperties.go workBreakCodePoints words emojis=Extended_Pictographic //go:generate go run gen_properties.go auxiliary/SentenceBreakProperty sentenceproperties.go sentenceBreakCodePoints sentences //go:generate go run gen_properties.go LineBreak lineproperties.go lineBreakCodePoints lines gencat //go:generate go run gen_properties.go EastAsianWidth eastasianwidth.go eastAsianWidth eastasianwidth //go:generate go run gen_properties.go - emojipresentation.go emojiPresentation emojipresentation emojis=Emoji_Presentation package main import ( "bufio" "bytes" "errors" "fmt" "go/format" "io/ioutil" "log" "net/http" "os" "regexp" "sort" "strconv" "strings" "time" ) // We want to test against a specific version rather than the latest. When the // package is upgraded to a new version, change these to generate new tests. const ( propertyURL = `https://www.unicode.org/Public/15.0.0/ucd/%s.txt` emojiURL = `https://unicode.org/Public/15.0.0/ucd/emoji/emoji-data.txt` ) // The regular expression for a line containing a code point range property. var propertyPattern = regexp.MustCompile(`^([0-9A-F]{4,6})(\.\.([0-9A-F]{4,6}))?\s*;\s*([A-Za-z0-9_]+)\s*#\s(.+)$`) func main() { if len(os.Args) < 5 { fmt.Println("Not enough arguments, see code for details") os.Exit(1) } log.SetPrefix("gen_properties (" + os.Args[4] + "): ") log.SetFlags(0) // Parse flags. flags := make(map[string]string) if len(os.Args) >= 6 { for _, flag := range strings.Split(os.Args[5], ",") { flagFields := strings.Split(flag, "=") if len(flagFields) == 1 { flags[flagFields[0]] = "yes" } else { flags[flagFields[0]] = flagFields[1] } } } // Parse the text file and generate Go source code from it. _, includeGeneralCategory := flags["gencat"] var mainURL string if os.Args[1] != "-" { mainURL = fmt.Sprintf(propertyURL, os.Args[1]) } src, err := parse(mainURL, flags["emojis"], includeGeneralCategory) if err != nil { log.Fatal(err) } // Format the Go code. formatted, err := format.Source([]byte(src)) if err != nil { log.Fatal("gofmt:", err) } // Save it to the (local) target file. log.Print("Writing to ", os.Args[2]) if err := ioutil.WriteFile(os.Args[2], formatted, 0644); err != nil { log.Fatal(err) } } // parse parses the Unicode Properties text files located at the given URLs and // returns their equivalent Go source code to be used in the uniseg package. If // "emojiProperty" is not an empty string, emoji code points for that emoji // property (e.g. "Extended_Pictographic") will be included. In those cases, you // may pass an empty "propertyURL" to skip parsing the main properties file. If // "includeGeneralCategory" is true, the Unicode General Category property will // be extracted from the comments and included in the output. func parse(propertyURL, emojiProperty string, includeGeneralCategory bool) (string, error) { if propertyURL == "" && emojiProperty == "" { return "", errors.New("no properties to parse") } // Temporary buffer to hold properties. var properties [][4]string // Open the first URL. if propertyURL != "" { log.Printf("Parsing %s", propertyURL) res, err := http.Get(propertyURL) if err != nil { return "", err } in1 := res.Body defer in1.Close() // Parse it. scanner := bufio.NewScanner(in1) num := 0 for scanner.Scan() { num++ line := strings.TrimSpace(scanner.Text()) // Skip comments and empty lines. if strings.HasPrefix(line, "#") || line == "" { continue } // Everything else must be a code point range, a property and a comment. from, to, property, comment, err := parseProperty(line) if err != nil { return "", fmt.Errorf("%s line %d: %v", os.Args[4], num, err) } properties = append(properties, [4]string{from, to, property, comment}) } if err := scanner.Err(); err != nil { return "", err } } // Open the second URL. if emojiProperty != "" { log.Printf("Parsing %s", emojiURL) res, err := http.Get(emojiURL) if err != nil { return "", err } in2 := res.Body defer in2.Close() // Parse it. scanner := bufio.NewScanner(in2) num := 0 for scanner.Scan() { num++ line := scanner.Text() // Skip comments, empty lines, and everything not containing // "Extended_Pictographic". if strings.HasPrefix(line, "#") || line == "" || !strings.Contains(line, emojiProperty) { continue } // Everything else must be a code point range, a property and a comment. from, to, property, comment, err := parseProperty(line) if err != nil { return "", fmt.Errorf("emojis line %d: %v", num, err) } properties = append(properties, [4]string{from, to, property, comment}) } if err := scanner.Err(); err != nil { return "", err } } // Avoid overflow during binary search. if len(properties) >= 1<<31 { return "", errors.New("too many properties") } // Sort properties. sort.Slice(properties, func(i, j int) bool { left, _ := strconv.ParseUint(properties[i][0], 16, 64) right, _ := strconv.ParseUint(properties[j][0], 16, 64) return left < right }) // Header. var ( buf bytes.Buffer emojiComment string ) columns := 3 if includeGeneralCategory { columns = 4 } if emojiURL != "" { emojiComment = ` // and // ` + emojiURL + ` // ("Extended_Pictographic" only)` } buf.WriteString(`// Code generated via go generate from gen_properties.go. DO NOT EDIT. package uniseg // ` + os.Args[3] + ` are taken from // ` + propertyURL + emojiComment + ` // on ` + time.Now().Format("January 2, 2006") + `. See https://www.unicode.org/license.html for the Unicode // license agreement. var ` + os.Args[3] + ` = [][` + strconv.Itoa(columns) + `]int{ `) // Properties. for _, prop := range properties { if includeGeneralCategory { generalCategory := "gc" + prop[3][:2] if generalCategory == "gcL&" { generalCategory = "gcLC" } prop[3] = prop[3][3:] fmt.Fprintf(&buf, "{0x%s,0x%s,%s,%s}, // %s\n", prop[0], prop[1], translateProperty("pr", prop[2]), generalCategory, prop[3]) } else { fmt.Fprintf(&buf, "{0x%s,0x%s,%s}, // %s\n", prop[0], prop[1], translateProperty("pr", prop[2]), prop[3]) } } // Tail. buf.WriteString("}") return buf.String(), nil } // parseProperty parses a line of the Unicode properties text file containing a // property for a code point range and returns it along with its comment. func parseProperty(line string) (from, to, property, comment string, err error) { fields := propertyPattern.FindStringSubmatch(line) if fields == nil { err = errors.New("no property found") return } from = fields[1] to = fields[3] if to == "" { to = from } property = fields[4] comment = fields[5] return } // translateProperty translates a property name as used in the Unicode data file // to a variable used in the Go code. func translateProperty(prefix, property string) string { return prefix + strings.ReplaceAll(property, "_", "") }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/rivo/uniseg/eastasianwidth.go
vendor/github.com/rivo/uniseg/eastasianwidth.go
// Code generated via go generate from gen_properties.go. DO NOT EDIT. package uniseg // eastAsianWidth are taken from // https://www.unicode.org/Public/15.0.0/ucd/EastAsianWidth.txt // and // https://unicode.org/Public/15.0.0/ucd/emoji/emoji-data.txt // ("Extended_Pictographic" only) // on September 5, 2023. See https://www.unicode.org/license.html for the Unicode // license agreement. var eastAsianWidth = [][3]int{ {0x0000, 0x001F, prN}, // Cc [32] <control-0000>..<control-001F> {0x0020, 0x0020, prNa}, // Zs SPACE {0x0021, 0x0023, prNa}, // Po [3] EXCLAMATION MARK..NUMBER SIGN {0x0024, 0x0024, prNa}, // Sc DOLLAR SIGN {0x0025, 0x0027, prNa}, // Po [3] PERCENT SIGN..APOSTROPHE {0x0028, 0x0028, prNa}, // Ps LEFT PARENTHESIS {0x0029, 0x0029, prNa}, // Pe RIGHT PARENTHESIS {0x002A, 0x002A, prNa}, // Po ASTERISK {0x002B, 0x002B, prNa}, // Sm PLUS SIGN {0x002C, 0x002C, prNa}, // Po COMMA {0x002D, 0x002D, prNa}, // Pd HYPHEN-MINUS {0x002E, 0x002F, prNa}, // Po [2] FULL STOP..SOLIDUS {0x0030, 0x0039, prNa}, // Nd [10] DIGIT ZERO..DIGIT NINE {0x003A, 0x003B, prNa}, // Po [2] COLON..SEMICOLON {0x003C, 0x003E, prNa}, // Sm [3] LESS-THAN SIGN..GREATER-THAN SIGN {0x003F, 0x0040, prNa}, // Po [2] QUESTION MARK..COMMERCIAL AT {0x0041, 0x005A, prNa}, // Lu [26] LATIN CAPITAL LETTER A..LATIN CAPITAL LETTER Z {0x005B, 0x005B, prNa}, // Ps LEFT SQUARE BRACKET {0x005C, 0x005C, prNa}, // Po REVERSE SOLIDUS {0x005D, 0x005D, prNa}, // Pe RIGHT SQUARE BRACKET {0x005E, 0x005E, prNa}, // Sk CIRCUMFLEX ACCENT {0x005F, 0x005F, prNa}, // Pc LOW LINE {0x0060, 0x0060, prNa}, // Sk GRAVE ACCENT {0x0061, 0x007A, prNa}, // Ll [26] LATIN SMALL LETTER A..LATIN SMALL LETTER Z {0x007B, 0x007B, prNa}, // Ps LEFT CURLY BRACKET {0x007C, 0x007C, prNa}, // Sm VERTICAL LINE {0x007D, 0x007D, prNa}, // Pe RIGHT CURLY BRACKET {0x007E, 0x007E, prNa}, // Sm TILDE {0x007F, 0x007F, prN}, // Cc <control-007F> {0x0080, 0x009F, prN}, // Cc [32] <control-0080>..<control-009F> {0x00A0, 0x00A0, prN}, // Zs NO-BREAK SPACE {0x00A1, 0x00A1, prA}, // Po INVERTED EXCLAMATION MARK {0x00A2, 0x00A3, prNa}, // Sc [2] CENT SIGN..POUND SIGN {0x00A4, 0x00A4, prA}, // Sc CURRENCY SIGN {0x00A5, 0x00A5, prNa}, // Sc YEN SIGN {0x00A6, 0x00A6, prNa}, // So BROKEN BAR {0x00A7, 0x00A7, prA}, // Po SECTION SIGN {0x00A8, 0x00A8, prA}, // Sk DIAERESIS {0x00A9, 0x00A9, prN}, // So COPYRIGHT SIGN {0x00AA, 0x00AA, prA}, // Lo FEMININE ORDINAL INDICATOR {0x00AB, 0x00AB, prN}, // Pi LEFT-POINTING DOUBLE ANGLE QUOTATION MARK {0x00AC, 0x00AC, prNa}, // Sm NOT SIGN {0x00AD, 0x00AD, prA}, // Cf SOFT HYPHEN {0x00AE, 0x00AE, prA}, // So REGISTERED SIGN {0x00AF, 0x00AF, prNa}, // Sk MACRON {0x00B0, 0x00B0, prA}, // So DEGREE SIGN {0x00B1, 0x00B1, prA}, // Sm PLUS-MINUS SIGN {0x00B2, 0x00B3, prA}, // No [2] SUPERSCRIPT TWO..SUPERSCRIPT THREE {0x00B4, 0x00B4, prA}, // Sk ACUTE ACCENT {0x00B5, 0x00B5, prN}, // Ll MICRO SIGN {0x00B6, 0x00B7, prA}, // Po [2] PILCROW SIGN..MIDDLE DOT {0x00B8, 0x00B8, prA}, // Sk CEDILLA {0x00B9, 0x00B9, prA}, // No SUPERSCRIPT ONE {0x00BA, 0x00BA, prA}, // Lo MASCULINE ORDINAL INDICATOR {0x00BB, 0x00BB, prN}, // Pf RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK {0x00BC, 0x00BE, prA}, // No [3] VULGAR FRACTION ONE QUARTER..VULGAR FRACTION THREE QUARTERS {0x00BF, 0x00BF, prA}, // Po INVERTED QUESTION MARK {0x00C0, 0x00C5, prN}, // Lu [6] LATIN CAPITAL LETTER A WITH GRAVE..LATIN CAPITAL LETTER A WITH RING ABOVE {0x00C6, 0x00C6, prA}, // Lu LATIN CAPITAL LETTER AE {0x00C7, 0x00CF, prN}, // Lu [9] LATIN CAPITAL LETTER C WITH CEDILLA..LATIN CAPITAL LETTER I WITH DIAERESIS {0x00D0, 0x00D0, prA}, // Lu LATIN CAPITAL LETTER ETH {0x00D1, 0x00D6, prN}, // Lu [6] LATIN CAPITAL LETTER N WITH TILDE..LATIN CAPITAL LETTER O WITH DIAERESIS {0x00D7, 0x00D7, prA}, // Sm MULTIPLICATION SIGN {0x00D8, 0x00D8, prA}, // Lu LATIN CAPITAL LETTER O WITH STROKE {0x00D9, 0x00DD, prN}, // Lu [5] LATIN CAPITAL LETTER U WITH GRAVE..LATIN CAPITAL LETTER Y WITH ACUTE {0x00DE, 0x00E1, prA}, // L& [4] LATIN CAPITAL LETTER THORN..LATIN SMALL LETTER A WITH ACUTE {0x00E2, 0x00E5, prN}, // Ll [4] LATIN SMALL LETTER A WITH CIRCUMFLEX..LATIN SMALL LETTER A WITH RING ABOVE {0x00E6, 0x00E6, prA}, // Ll LATIN SMALL LETTER AE {0x00E7, 0x00E7, prN}, // Ll LATIN SMALL LETTER C WITH CEDILLA {0x00E8, 0x00EA, prA}, // Ll [3] LATIN SMALL LETTER E WITH GRAVE..LATIN SMALL LETTER E WITH CIRCUMFLEX {0x00EB, 0x00EB, prN}, // Ll LATIN SMALL LETTER E WITH DIAERESIS {0x00EC, 0x00ED, prA}, // Ll [2] LATIN SMALL LETTER I WITH GRAVE..LATIN SMALL LETTER I WITH ACUTE {0x00EE, 0x00EF, prN}, // Ll [2] LATIN SMALL LETTER I WITH CIRCUMFLEX..LATIN SMALL LETTER I WITH DIAERESIS {0x00F0, 0x00F0, prA}, // Ll LATIN SMALL LETTER ETH {0x00F1, 0x00F1, prN}, // Ll LATIN SMALL LETTER N WITH TILDE {0x00F2, 0x00F3, prA}, // Ll [2] LATIN SMALL LETTER O WITH GRAVE..LATIN SMALL LETTER O WITH ACUTE {0x00F4, 0x00F6, prN}, // Ll [3] LATIN SMALL LETTER O WITH CIRCUMFLEX..LATIN SMALL LETTER O WITH DIAERESIS {0x00F7, 0x00F7, prA}, // Sm DIVISION SIGN {0x00F8, 0x00FA, prA}, // Ll [3] LATIN SMALL LETTER O WITH STROKE..LATIN SMALL LETTER U WITH ACUTE {0x00FB, 0x00FB, prN}, // Ll LATIN SMALL LETTER U WITH CIRCUMFLEX {0x00FC, 0x00FC, prA}, // Ll LATIN SMALL LETTER U WITH DIAERESIS {0x00FD, 0x00FD, prN}, // Ll LATIN SMALL LETTER Y WITH ACUTE {0x00FE, 0x00FE, prA}, // Ll LATIN SMALL LETTER THORN {0x00FF, 0x00FF, prN}, // Ll LATIN SMALL LETTER Y WITH DIAERESIS {0x0100, 0x0100, prN}, // Lu LATIN CAPITAL LETTER A WITH MACRON {0x0101, 0x0101, prA}, // Ll LATIN SMALL LETTER A WITH MACRON {0x0102, 0x0110, prN}, // L& [15] LATIN CAPITAL LETTER A WITH BREVE..LATIN CAPITAL LETTER D WITH STROKE {0x0111, 0x0111, prA}, // Ll LATIN SMALL LETTER D WITH STROKE {0x0112, 0x0112, prN}, // Lu LATIN CAPITAL LETTER E WITH MACRON {0x0113, 0x0113, prA}, // Ll LATIN SMALL LETTER E WITH MACRON {0x0114, 0x011A, prN}, // L& [7] LATIN CAPITAL LETTER E WITH BREVE..LATIN CAPITAL LETTER E WITH CARON {0x011B, 0x011B, prA}, // Ll LATIN SMALL LETTER E WITH CARON {0x011C, 0x0125, prN}, // L& [10] LATIN CAPITAL LETTER G WITH CIRCUMFLEX..LATIN SMALL LETTER H WITH CIRCUMFLEX {0x0126, 0x0127, prA}, // L& [2] LATIN CAPITAL LETTER H WITH STROKE..LATIN SMALL LETTER H WITH STROKE {0x0128, 0x012A, prN}, // L& [3] LATIN CAPITAL LETTER I WITH TILDE..LATIN CAPITAL LETTER I WITH MACRON {0x012B, 0x012B, prA}, // Ll LATIN SMALL LETTER I WITH MACRON {0x012C, 0x0130, prN}, // L& [5] LATIN CAPITAL LETTER I WITH BREVE..LATIN CAPITAL LETTER I WITH DOT ABOVE {0x0131, 0x0133, prA}, // L& [3] LATIN SMALL LETTER DOTLESS I..LATIN SMALL LIGATURE IJ {0x0134, 0x0137, prN}, // L& [4] LATIN CAPITAL LETTER J WITH CIRCUMFLEX..LATIN SMALL LETTER K WITH CEDILLA {0x0138, 0x0138, prA}, // Ll LATIN SMALL LETTER KRA {0x0139, 0x013E, prN}, // L& [6] LATIN CAPITAL LETTER L WITH ACUTE..LATIN SMALL LETTER L WITH CARON {0x013F, 0x0142, prA}, // L& [4] LATIN CAPITAL LETTER L WITH MIDDLE DOT..LATIN SMALL LETTER L WITH STROKE {0x0143, 0x0143, prN}, // Lu LATIN CAPITAL LETTER N WITH ACUTE {0x0144, 0x0144, prA}, // Ll LATIN SMALL LETTER N WITH ACUTE {0x0145, 0x0147, prN}, // L& [3] LATIN CAPITAL LETTER N WITH CEDILLA..LATIN CAPITAL LETTER N WITH CARON {0x0148, 0x014B, prA}, // L& [4] LATIN SMALL LETTER N WITH CARON..LATIN SMALL LETTER ENG {0x014C, 0x014C, prN}, // Lu LATIN CAPITAL LETTER O WITH MACRON {0x014D, 0x014D, prA}, // Ll LATIN SMALL LETTER O WITH MACRON {0x014E, 0x0151, prN}, // L& [4] LATIN CAPITAL LETTER O WITH BREVE..LATIN SMALL LETTER O WITH DOUBLE ACUTE {0x0152, 0x0153, prA}, // L& [2] LATIN CAPITAL LIGATURE OE..LATIN SMALL LIGATURE OE {0x0154, 0x0165, prN}, // L& [18] LATIN CAPITAL LETTER R WITH ACUTE..LATIN SMALL LETTER T WITH CARON {0x0166, 0x0167, prA}, // L& [2] LATIN CAPITAL LETTER T WITH STROKE..LATIN SMALL LETTER T WITH STROKE {0x0168, 0x016A, prN}, // L& [3] LATIN CAPITAL LETTER U WITH TILDE..LATIN CAPITAL LETTER U WITH MACRON {0x016B, 0x016B, prA}, // Ll LATIN SMALL LETTER U WITH MACRON {0x016C, 0x017F, prN}, // L& [20] LATIN CAPITAL LETTER U WITH BREVE..LATIN SMALL LETTER LONG S {0x0180, 0x01BA, prN}, // L& [59] LATIN SMALL LETTER B WITH STROKE..LATIN SMALL LETTER EZH WITH TAIL {0x01BB, 0x01BB, prN}, // Lo LATIN LETTER TWO WITH STROKE {0x01BC, 0x01BF, prN}, // L& [4] LATIN CAPITAL LETTER TONE FIVE..LATIN LETTER WYNN {0x01C0, 0x01C3, prN}, // Lo [4] LATIN LETTER DENTAL CLICK..LATIN LETTER RETROFLEX CLICK {0x01C4, 0x01CD, prN}, // L& [10] LATIN CAPITAL LETTER DZ WITH CARON..LATIN CAPITAL LETTER A WITH CARON {0x01CE, 0x01CE, prA}, // Ll LATIN SMALL LETTER A WITH CARON {0x01CF, 0x01CF, prN}, // Lu LATIN CAPITAL LETTER I WITH CARON {0x01D0, 0x01D0, prA}, // Ll LATIN SMALL LETTER I WITH CARON {0x01D1, 0x01D1, prN}, // Lu LATIN CAPITAL LETTER O WITH CARON {0x01D2, 0x01D2, prA}, // Ll LATIN SMALL LETTER O WITH CARON {0x01D3, 0x01D3, prN}, // Lu LATIN CAPITAL LETTER U WITH CARON {0x01D4, 0x01D4, prA}, // Ll LATIN SMALL LETTER U WITH CARON {0x01D5, 0x01D5, prN}, // Lu LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON {0x01D6, 0x01D6, prA}, // Ll LATIN SMALL LETTER U WITH DIAERESIS AND MACRON {0x01D7, 0x01D7, prN}, // Lu LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE {0x01D8, 0x01D8, prA}, // Ll LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE {0x01D9, 0x01D9, prN}, // Lu LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON {0x01DA, 0x01DA, prA}, // Ll LATIN SMALL LETTER U WITH DIAERESIS AND CARON {0x01DB, 0x01DB, prN}, // Lu LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE {0x01DC, 0x01DC, prA}, // Ll LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE {0x01DD, 0x024F, prN}, // L& [115] LATIN SMALL LETTER TURNED E..LATIN SMALL LETTER Y WITH STROKE {0x0250, 0x0250, prN}, // Ll LATIN SMALL LETTER TURNED A {0x0251, 0x0251, prA}, // Ll LATIN SMALL LETTER ALPHA {0x0252, 0x0260, prN}, // Ll [15] LATIN SMALL LETTER TURNED ALPHA..LATIN SMALL LETTER G WITH HOOK {0x0261, 0x0261, prA}, // Ll LATIN SMALL LETTER SCRIPT G {0x0262, 0x0293, prN}, // Ll [50] LATIN LETTER SMALL CAPITAL G..LATIN SMALL LETTER EZH WITH CURL {0x0294, 0x0294, prN}, // Lo LATIN LETTER GLOTTAL STOP {0x0295, 0x02AF, prN}, // Ll [27] LATIN LETTER PHARYNGEAL VOICED FRICATIVE..LATIN SMALL LETTER TURNED H WITH FISHHOOK AND TAIL {0x02B0, 0x02C1, prN}, // Lm [18] MODIFIER LETTER SMALL H..MODIFIER LETTER REVERSED GLOTTAL STOP {0x02C2, 0x02C3, prN}, // Sk [2] MODIFIER LETTER LEFT ARROWHEAD..MODIFIER LETTER RIGHT ARROWHEAD {0x02C4, 0x02C4, prA}, // Sk MODIFIER LETTER UP ARROWHEAD {0x02C5, 0x02C5, prN}, // Sk MODIFIER LETTER DOWN ARROWHEAD {0x02C6, 0x02C6, prN}, // Lm MODIFIER LETTER CIRCUMFLEX ACCENT {0x02C7, 0x02C7, prA}, // Lm CARON {0x02C8, 0x02C8, prN}, // Lm MODIFIER LETTER VERTICAL LINE {0x02C9, 0x02CB, prA}, // Lm [3] MODIFIER LETTER MACRON..MODIFIER LETTER GRAVE ACCENT {0x02CC, 0x02CC, prN}, // Lm MODIFIER LETTER LOW VERTICAL LINE {0x02CD, 0x02CD, prA}, // Lm MODIFIER LETTER LOW MACRON {0x02CE, 0x02CF, prN}, // Lm [2] MODIFIER LETTER LOW GRAVE ACCENT..MODIFIER LETTER LOW ACUTE ACCENT {0x02D0, 0x02D0, prA}, // Lm MODIFIER LETTER TRIANGULAR COLON {0x02D1, 0x02D1, prN}, // Lm MODIFIER LETTER HALF TRIANGULAR COLON {0x02D2, 0x02D7, prN}, // Sk [6] MODIFIER LETTER CENTRED RIGHT HALF RING..MODIFIER LETTER MINUS SIGN {0x02D8, 0x02DB, prA}, // Sk [4] BREVE..OGONEK {0x02DC, 0x02DC, prN}, // Sk SMALL TILDE {0x02DD, 0x02DD, prA}, // Sk DOUBLE ACUTE ACCENT {0x02DE, 0x02DE, prN}, // Sk MODIFIER LETTER RHOTIC HOOK {0x02DF, 0x02DF, prA}, // Sk MODIFIER LETTER CROSS ACCENT {0x02E0, 0x02E4, prN}, // Lm [5] MODIFIER LETTER SMALL GAMMA..MODIFIER LETTER SMALL REVERSED GLOTTAL STOP {0x02E5, 0x02EB, prN}, // Sk [7] MODIFIER LETTER EXTRA-HIGH TONE BAR..MODIFIER LETTER YANG DEPARTING TONE MARK {0x02EC, 0x02EC, prN}, // Lm MODIFIER LETTER VOICING {0x02ED, 0x02ED, prN}, // Sk MODIFIER LETTER UNASPIRATED {0x02EE, 0x02EE, prN}, // Lm MODIFIER LETTER DOUBLE APOSTROPHE {0x02EF, 0x02FF, prN}, // Sk [17] MODIFIER LETTER LOW DOWN ARROWHEAD..MODIFIER LETTER LOW LEFT ARROW {0x0300, 0x036F, prA}, // Mn [112] COMBINING GRAVE ACCENT..COMBINING LATIN SMALL LETTER X {0x0370, 0x0373, prN}, // L& [4] GREEK CAPITAL LETTER HETA..GREEK SMALL LETTER ARCHAIC SAMPI {0x0374, 0x0374, prN}, // Lm GREEK NUMERAL SIGN {0x0375, 0x0375, prN}, // Sk GREEK LOWER NUMERAL SIGN {0x0376, 0x0377, prN}, // L& [2] GREEK CAPITAL LETTER PAMPHYLIAN DIGAMMA..GREEK SMALL LETTER PAMPHYLIAN DIGAMMA {0x037A, 0x037A, prN}, // Lm GREEK YPOGEGRAMMENI {0x037B, 0x037D, prN}, // Ll [3] GREEK SMALL REVERSED LUNATE SIGMA SYMBOL..GREEK SMALL REVERSED DOTTED LUNATE SIGMA SYMBOL {0x037E, 0x037E, prN}, // Po GREEK QUESTION MARK {0x037F, 0x037F, prN}, // Lu GREEK CAPITAL LETTER YOT {0x0384, 0x0385, prN}, // Sk [2] GREEK TONOS..GREEK DIALYTIKA TONOS {0x0386, 0x0386, prN}, // Lu GREEK CAPITAL LETTER ALPHA WITH TONOS {0x0387, 0x0387, prN}, // Po GREEK ANO TELEIA {0x0388, 0x038A, prN}, // Lu [3] GREEK CAPITAL LETTER EPSILON WITH TONOS..GREEK CAPITAL LETTER IOTA WITH TONOS {0x038C, 0x038C, prN}, // Lu GREEK CAPITAL LETTER OMICRON WITH TONOS {0x038E, 0x0390, prN}, // L& [3] GREEK CAPITAL LETTER UPSILON WITH TONOS..GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS {0x0391, 0x03A1, prA}, // Lu [17] GREEK CAPITAL LETTER ALPHA..GREEK CAPITAL LETTER RHO {0x03A3, 0x03A9, prA}, // Lu [7] GREEK CAPITAL LETTER SIGMA..GREEK CAPITAL LETTER OMEGA {0x03AA, 0x03B0, prN}, // L& [7] GREEK CAPITAL LETTER IOTA WITH DIALYTIKA..GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS {0x03B1, 0x03C1, prA}, // Ll [17] GREEK SMALL LETTER ALPHA..GREEK SMALL LETTER RHO {0x03C2, 0x03C2, prN}, // Ll GREEK SMALL LETTER FINAL SIGMA {0x03C3, 0x03C9, prA}, // Ll [7] GREEK SMALL LETTER SIGMA..GREEK SMALL LETTER OMEGA {0x03CA, 0x03F5, prN}, // L& [44] GREEK SMALL LETTER IOTA WITH DIALYTIKA..GREEK LUNATE EPSILON SYMBOL {0x03F6, 0x03F6, prN}, // Sm GREEK REVERSED LUNATE EPSILON SYMBOL {0x03F7, 0x03FF, prN}, // L& [9] GREEK CAPITAL LETTER SHO..GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL {0x0400, 0x0400, prN}, // Lu CYRILLIC CAPITAL LETTER IE WITH GRAVE {0x0401, 0x0401, prA}, // Lu CYRILLIC CAPITAL LETTER IO {0x0402, 0x040F, prN}, // Lu [14] CYRILLIC CAPITAL LETTER DJE..CYRILLIC CAPITAL LETTER DZHE {0x0410, 0x044F, prA}, // L& [64] CYRILLIC CAPITAL LETTER A..CYRILLIC SMALL LETTER YA {0x0450, 0x0450, prN}, // Ll CYRILLIC SMALL LETTER IE WITH GRAVE {0x0451, 0x0451, prA}, // Ll CYRILLIC SMALL LETTER IO {0x0452, 0x0481, prN}, // L& [48] CYRILLIC SMALL LETTER DJE..CYRILLIC SMALL LETTER KOPPA {0x0482, 0x0482, prN}, // So CYRILLIC THOUSANDS SIGN {0x0483, 0x0487, prN}, // Mn [5] COMBINING CYRILLIC TITLO..COMBINING CYRILLIC POKRYTIE {0x0488, 0x0489, prN}, // Me [2] COMBINING CYRILLIC HUNDRED THOUSANDS SIGN..COMBINING CYRILLIC MILLIONS SIGN {0x048A, 0x04FF, prN}, // L& [118] CYRILLIC CAPITAL LETTER SHORT I WITH TAIL..CYRILLIC SMALL LETTER HA WITH STROKE {0x0500, 0x052F, prN}, // L& [48] CYRILLIC CAPITAL LETTER KOMI DE..CYRILLIC SMALL LETTER EL WITH DESCENDER {0x0531, 0x0556, prN}, // Lu [38] ARMENIAN CAPITAL LETTER AYB..ARMENIAN CAPITAL LETTER FEH {0x0559, 0x0559, prN}, // Lm ARMENIAN MODIFIER LETTER LEFT HALF RING {0x055A, 0x055F, prN}, // Po [6] ARMENIAN APOSTROPHE..ARMENIAN ABBREVIATION MARK {0x0560, 0x0588, prN}, // Ll [41] ARMENIAN SMALL LETTER TURNED AYB..ARMENIAN SMALL LETTER YI WITH STROKE {0x0589, 0x0589, prN}, // Po ARMENIAN FULL STOP {0x058A, 0x058A, prN}, // Pd ARMENIAN HYPHEN {0x058D, 0x058E, prN}, // So [2] RIGHT-FACING ARMENIAN ETERNITY SIGN..LEFT-FACING ARMENIAN ETERNITY SIGN {0x058F, 0x058F, prN}, // Sc ARMENIAN DRAM SIGN {0x0591, 0x05BD, prN}, // Mn [45] HEBREW ACCENT ETNAHTA..HEBREW POINT METEG {0x05BE, 0x05BE, prN}, // Pd HEBREW PUNCTUATION MAQAF {0x05BF, 0x05BF, prN}, // Mn HEBREW POINT RAFE {0x05C0, 0x05C0, prN}, // Po HEBREW PUNCTUATION PASEQ {0x05C1, 0x05C2, prN}, // Mn [2] HEBREW POINT SHIN DOT..HEBREW POINT SIN DOT {0x05C3, 0x05C3, prN}, // Po HEBREW PUNCTUATION SOF PASUQ {0x05C4, 0x05C5, prN}, // Mn [2] HEBREW MARK UPPER DOT..HEBREW MARK LOWER DOT {0x05C6, 0x05C6, prN}, // Po HEBREW PUNCTUATION NUN HAFUKHA {0x05C7, 0x05C7, prN}, // Mn HEBREW POINT QAMATS QATAN {0x05D0, 0x05EA, prN}, // Lo [27] HEBREW LETTER ALEF..HEBREW LETTER TAV {0x05EF, 0x05F2, prN}, // Lo [4] HEBREW YOD TRIANGLE..HEBREW LIGATURE YIDDISH DOUBLE YOD {0x05F3, 0x05F4, prN}, // Po [2] HEBREW PUNCTUATION GERESH..HEBREW PUNCTUATION GERSHAYIM {0x0600, 0x0605, prN}, // Cf [6] ARABIC NUMBER SIGN..ARABIC NUMBER MARK ABOVE {0x0606, 0x0608, prN}, // Sm [3] ARABIC-INDIC CUBE ROOT..ARABIC RAY {0x0609, 0x060A, prN}, // Po [2] ARABIC-INDIC PER MILLE SIGN..ARABIC-INDIC PER TEN THOUSAND SIGN {0x060B, 0x060B, prN}, // Sc AFGHANI SIGN {0x060C, 0x060D, prN}, // Po [2] ARABIC COMMA..ARABIC DATE SEPARATOR {0x060E, 0x060F, prN}, // So [2] ARABIC POETIC VERSE SIGN..ARABIC SIGN MISRA {0x0610, 0x061A, prN}, // Mn [11] ARABIC SIGN SALLALLAHOU ALAYHE WASSALLAM..ARABIC SMALL KASRA {0x061B, 0x061B, prN}, // Po ARABIC SEMICOLON {0x061C, 0x061C, prN}, // Cf ARABIC LETTER MARK {0x061D, 0x061F, prN}, // Po [3] ARABIC END OF TEXT MARK..ARABIC QUESTION MARK {0x0620, 0x063F, prN}, // Lo [32] ARABIC LETTER KASHMIRI YEH..ARABIC LETTER FARSI YEH WITH THREE DOTS ABOVE {0x0640, 0x0640, prN}, // Lm ARABIC TATWEEL {0x0641, 0x064A, prN}, // Lo [10] ARABIC LETTER FEH..ARABIC LETTER YEH {0x064B, 0x065F, prN}, // Mn [21] ARABIC FATHATAN..ARABIC WAVY HAMZA BELOW {0x0660, 0x0669, prN}, // Nd [10] ARABIC-INDIC DIGIT ZERO..ARABIC-INDIC DIGIT NINE {0x066A, 0x066D, prN}, // Po [4] ARABIC PERCENT SIGN..ARABIC FIVE POINTED STAR {0x066E, 0x066F, prN}, // Lo [2] ARABIC LETTER DOTLESS BEH..ARABIC LETTER DOTLESS QAF {0x0670, 0x0670, prN}, // Mn ARABIC LETTER SUPERSCRIPT ALEF {0x0671, 0x06D3, prN}, // Lo [99] ARABIC LETTER ALEF WASLA..ARABIC LETTER YEH BARREE WITH HAMZA ABOVE {0x06D4, 0x06D4, prN}, // Po ARABIC FULL STOP {0x06D5, 0x06D5, prN}, // Lo ARABIC LETTER AE {0x06D6, 0x06DC, prN}, // Mn [7] ARABIC SMALL HIGH LIGATURE SAD WITH LAM WITH ALEF MAKSURA..ARABIC SMALL HIGH SEEN {0x06DD, 0x06DD, prN}, // Cf ARABIC END OF AYAH {0x06DE, 0x06DE, prN}, // So ARABIC START OF RUB EL HIZB {0x06DF, 0x06E4, prN}, // Mn [6] ARABIC SMALL HIGH ROUNDED ZERO..ARABIC SMALL HIGH MADDA {0x06E5, 0x06E6, prN}, // Lm [2] ARABIC SMALL WAW..ARABIC SMALL YEH {0x06E7, 0x06E8, prN}, // Mn [2] ARABIC SMALL HIGH YEH..ARABIC SMALL HIGH NOON {0x06E9, 0x06E9, prN}, // So ARABIC PLACE OF SAJDAH {0x06EA, 0x06ED, prN}, // Mn [4] ARABIC EMPTY CENTRE LOW STOP..ARABIC SMALL LOW MEEM {0x06EE, 0x06EF, prN}, // Lo [2] ARABIC LETTER DAL WITH INVERTED V..ARABIC LETTER REH WITH INVERTED V {0x06F0, 0x06F9, prN}, // Nd [10] EXTENDED ARABIC-INDIC DIGIT ZERO..EXTENDED ARABIC-INDIC DIGIT NINE {0x06FA, 0x06FC, prN}, // Lo [3] ARABIC LETTER SHEEN WITH DOT BELOW..ARABIC LETTER GHAIN WITH DOT BELOW {0x06FD, 0x06FE, prN}, // So [2] ARABIC SIGN SINDHI AMPERSAND..ARABIC SIGN SINDHI POSTPOSITION MEN {0x06FF, 0x06FF, prN}, // Lo ARABIC LETTER HEH WITH INVERTED V {0x0700, 0x070D, prN}, // Po [14] SYRIAC END OF PARAGRAPH..SYRIAC HARKLEAN ASTERISCUS {0x070F, 0x070F, prN}, // Cf SYRIAC ABBREVIATION MARK {0x0710, 0x0710, prN}, // Lo SYRIAC LETTER ALAPH {0x0711, 0x0711, prN}, // Mn SYRIAC LETTER SUPERSCRIPT ALAPH {0x0712, 0x072F, prN}, // Lo [30] SYRIAC LETTER BETH..SYRIAC LETTER PERSIAN DHALATH {0x0730, 0x074A, prN}, // Mn [27] SYRIAC PTHAHA ABOVE..SYRIAC BARREKH {0x074D, 0x074F, prN}, // Lo [3] SYRIAC LETTER SOGDIAN ZHAIN..SYRIAC LETTER SOGDIAN FE {0x0750, 0x077F, prN}, // Lo [48] ARABIC LETTER BEH WITH THREE DOTS HORIZONTALLY BELOW..ARABIC LETTER KAF WITH TWO DOTS ABOVE {0x0780, 0x07A5, prN}, // Lo [38] THAANA LETTER HAA..THAANA LETTER WAAVU {0x07A6, 0x07B0, prN}, // Mn [11] THAANA ABAFILI..THAANA SUKUN {0x07B1, 0x07B1, prN}, // Lo THAANA LETTER NAA {0x07C0, 0x07C9, prN}, // Nd [10] NKO DIGIT ZERO..NKO DIGIT NINE {0x07CA, 0x07EA, prN}, // Lo [33] NKO LETTER A..NKO LETTER JONA RA {0x07EB, 0x07F3, prN}, // Mn [9] NKO COMBINING SHORT HIGH TONE..NKO COMBINING DOUBLE DOT ABOVE {0x07F4, 0x07F5, prN}, // Lm [2] NKO HIGH TONE APOSTROPHE..NKO LOW TONE APOSTROPHE {0x07F6, 0x07F6, prN}, // So NKO SYMBOL OO DENNEN {0x07F7, 0x07F9, prN}, // Po [3] NKO SYMBOL GBAKURUNEN..NKO EXCLAMATION MARK {0x07FA, 0x07FA, prN}, // Lm NKO LAJANYALAN {0x07FD, 0x07FD, prN}, // Mn NKO DANTAYALAN {0x07FE, 0x07FF, prN}, // Sc [2] NKO DOROME SIGN..NKO TAMAN SIGN {0x0800, 0x0815, prN}, // Lo [22] SAMARITAN LETTER ALAF..SAMARITAN LETTER TAAF {0x0816, 0x0819, prN}, // Mn [4] SAMARITAN MARK IN..SAMARITAN MARK DAGESH {0x081A, 0x081A, prN}, // Lm SAMARITAN MODIFIER LETTER EPENTHETIC YUT {0x081B, 0x0823, prN}, // Mn [9] SAMARITAN MARK EPENTHETIC YUT..SAMARITAN VOWEL SIGN A {0x0824, 0x0824, prN}, // Lm SAMARITAN MODIFIER LETTER SHORT A {0x0825, 0x0827, prN}, // Mn [3] SAMARITAN VOWEL SIGN SHORT A..SAMARITAN VOWEL SIGN U {0x0828, 0x0828, prN}, // Lm SAMARITAN MODIFIER LETTER I {0x0829, 0x082D, prN}, // Mn [5] SAMARITAN VOWEL SIGN LONG I..SAMARITAN MARK NEQUDAA {0x0830, 0x083E, prN}, // Po [15] SAMARITAN PUNCTUATION NEQUDAA..SAMARITAN PUNCTUATION ANNAAU {0x0840, 0x0858, prN}, // Lo [25] MANDAIC LETTER HALQA..MANDAIC LETTER AIN {0x0859, 0x085B, prN}, // Mn [3] MANDAIC AFFRICATION MARK..MANDAIC GEMINATION MARK {0x085E, 0x085E, prN}, // Po MANDAIC PUNCTUATION {0x0860, 0x086A, prN}, // Lo [11] SYRIAC LETTER MALAYALAM NGA..SYRIAC LETTER MALAYALAM SSA {0x0870, 0x0887, prN}, // Lo [24] ARABIC LETTER ALEF WITH ATTACHED FATHA..ARABIC BASELINE ROUND DOT {0x0888, 0x0888, prN}, // Sk ARABIC RAISED ROUND DOT {0x0889, 0x088E, prN}, // Lo [6] ARABIC LETTER NOON WITH INVERTED SMALL V..ARABIC VERTICAL TAIL {0x0890, 0x0891, prN}, // Cf [2] ARABIC POUND MARK ABOVE..ARABIC PIASTRE MARK ABOVE {0x0898, 0x089F, prN}, // Mn [8] ARABIC SMALL HIGH WORD AL-JUZ..ARABIC HALF MADDA OVER MADDA {0x08A0, 0x08C8, prN}, // Lo [41] ARABIC LETTER BEH WITH SMALL V BELOW..ARABIC LETTER GRAF {0x08C9, 0x08C9, prN}, // Lm ARABIC SMALL FARSI YEH {0x08CA, 0x08E1, prN}, // Mn [24] ARABIC SMALL HIGH FARSI YEH..ARABIC SMALL HIGH SIGN SAFHA {0x08E2, 0x08E2, prN}, // Cf ARABIC DISPUTED END OF AYAH {0x08E3, 0x08FF, prN}, // Mn [29] ARABIC TURNED DAMMA BELOW..ARABIC MARK SIDEWAYS NOON GHUNNA {0x0900, 0x0902, prN}, // Mn [3] DEVANAGARI SIGN INVERTED CANDRABINDU..DEVANAGARI SIGN ANUSVARA {0x0903, 0x0903, prN}, // Mc DEVANAGARI SIGN VISARGA {0x0904, 0x0939, prN}, // Lo [54] DEVANAGARI LETTER SHORT A..DEVANAGARI LETTER HA {0x093A, 0x093A, prN}, // Mn DEVANAGARI VOWEL SIGN OE {0x093B, 0x093B, prN}, // Mc DEVANAGARI VOWEL SIGN OOE {0x093C, 0x093C, prN}, // Mn DEVANAGARI SIGN NUKTA {0x093D, 0x093D, prN}, // Lo DEVANAGARI SIGN AVAGRAHA {0x093E, 0x0940, prN}, // Mc [3] DEVANAGARI VOWEL SIGN AA..DEVANAGARI VOWEL SIGN II {0x0941, 0x0948, prN}, // Mn [8] DEVANAGARI VOWEL SIGN U..DEVANAGARI VOWEL SIGN AI {0x0949, 0x094C, prN}, // Mc [4] DEVANAGARI VOWEL SIGN CANDRA O..DEVANAGARI VOWEL SIGN AU {0x094D, 0x094D, prN}, // Mn DEVANAGARI SIGN VIRAMA {0x094E, 0x094F, prN}, // Mc [2] DEVANAGARI VOWEL SIGN PRISHTHAMATRA E..DEVANAGARI VOWEL SIGN AW {0x0950, 0x0950, prN}, // Lo DEVANAGARI OM {0x0951, 0x0957, prN}, // Mn [7] DEVANAGARI STRESS SIGN UDATTA..DEVANAGARI VOWEL SIGN UUE {0x0958, 0x0961, prN}, // Lo [10] DEVANAGARI LETTER QA..DEVANAGARI LETTER VOCALIC LL {0x0962, 0x0963, prN}, // Mn [2] DEVANAGARI VOWEL SIGN VOCALIC L..DEVANAGARI VOWEL SIGN VOCALIC LL {0x0964, 0x0965, prN}, // Po [2] DEVANAGARI DANDA..DEVANAGARI DOUBLE DANDA {0x0966, 0x096F, prN}, // Nd [10] DEVANAGARI DIGIT ZERO..DEVANAGARI DIGIT NINE {0x0970, 0x0970, prN}, // Po DEVANAGARI ABBREVIATION SIGN {0x0971, 0x0971, prN}, // Lm DEVANAGARI SIGN HIGH SPACING DOT {0x0972, 0x097F, prN}, // Lo [14] DEVANAGARI LETTER CANDRA A..DEVANAGARI LETTER BBA {0x0980, 0x0980, prN}, // Lo BENGALI ANJI {0x0981, 0x0981, prN}, // Mn BENGALI SIGN CANDRABINDU {0x0982, 0x0983, prN}, // Mc [2] BENGALI SIGN ANUSVARA..BENGALI SIGN VISARGA {0x0985, 0x098C, prN}, // Lo [8] BENGALI LETTER A..BENGALI LETTER VOCALIC L {0x098F, 0x0990, prN}, // Lo [2] BENGALI LETTER E..BENGALI LETTER AI {0x0993, 0x09A8, prN}, // Lo [22] BENGALI LETTER O..BENGALI LETTER NA {0x09AA, 0x09B0, prN}, // Lo [7] BENGALI LETTER PA..BENGALI LETTER RA {0x09B2, 0x09B2, prN}, // Lo BENGALI LETTER LA {0x09B6, 0x09B9, prN}, // Lo [4] BENGALI LETTER SHA..BENGALI LETTER HA {0x09BC, 0x09BC, prN}, // Mn BENGALI SIGN NUKTA {0x09BD, 0x09BD, prN}, // Lo BENGALI SIGN AVAGRAHA {0x09BE, 0x09C0, prN}, // Mc [3] BENGALI VOWEL SIGN AA..BENGALI VOWEL SIGN II {0x09C1, 0x09C4, prN}, // Mn [4] BENGALI VOWEL SIGN U..BENGALI VOWEL SIGN VOCALIC RR {0x09C7, 0x09C8, prN}, // Mc [2] BENGALI VOWEL SIGN E..BENGALI VOWEL SIGN AI {0x09CB, 0x09CC, prN}, // Mc [2] BENGALI VOWEL SIGN O..BENGALI VOWEL SIGN AU {0x09CD, 0x09CD, prN}, // Mn BENGALI SIGN VIRAMA {0x09CE, 0x09CE, prN}, // Lo BENGALI LETTER KHANDA TA {0x09D7, 0x09D7, prN}, // Mc BENGALI AU LENGTH MARK {0x09DC, 0x09DD, prN}, // Lo [2] BENGALI LETTER RRA..BENGALI LETTER RHA {0x09DF, 0x09E1, prN}, // Lo [3] BENGALI LETTER YYA..BENGALI LETTER VOCALIC LL {0x09E2, 0x09E3, prN}, // Mn [2] BENGALI VOWEL SIGN VOCALIC L..BENGALI VOWEL SIGN VOCALIC LL {0x09E6, 0x09EF, prN}, // Nd [10] BENGALI DIGIT ZERO..BENGALI DIGIT NINE {0x09F0, 0x09F1, prN}, // Lo [2] BENGALI LETTER RA WITH MIDDLE DIAGONAL..BENGALI LETTER RA WITH LOWER DIAGONAL {0x09F2, 0x09F3, prN}, // Sc [2] BENGALI RUPEE MARK..BENGALI RUPEE SIGN {0x09F4, 0x09F9, prN}, // No [6] BENGALI CURRENCY NUMERATOR ONE..BENGALI CURRENCY DENOMINATOR SIXTEEN {0x09FA, 0x09FA, prN}, // So BENGALI ISSHAR {0x09FB, 0x09FB, prN}, // Sc BENGALI GANDA MARK {0x09FC, 0x09FC, prN}, // Lo BENGALI LETTER VEDIC ANUSVARA {0x09FD, 0x09FD, prN}, // Po BENGALI ABBREVIATION SIGN {0x09FE, 0x09FE, prN}, // Mn BENGALI SANDHI MARK {0x0A01, 0x0A02, prN}, // Mn [2] GURMUKHI SIGN ADAK BINDI..GURMUKHI SIGN BINDI {0x0A03, 0x0A03, prN}, // Mc GURMUKHI SIGN VISARGA {0x0A05, 0x0A0A, prN}, // Lo [6] GURMUKHI LETTER A..GURMUKHI LETTER UU {0x0A0F, 0x0A10, prN}, // Lo [2] GURMUKHI LETTER EE..GURMUKHI LETTER AI {0x0A13, 0x0A28, prN}, // Lo [22] GURMUKHI LETTER OO..GURMUKHI LETTER NA {0x0A2A, 0x0A30, prN}, // Lo [7] GURMUKHI LETTER PA..GURMUKHI LETTER RA {0x0A32, 0x0A33, prN}, // Lo [2] GURMUKHI LETTER LA..GURMUKHI LETTER LLA {0x0A35, 0x0A36, prN}, // Lo [2] GURMUKHI LETTER VA..GURMUKHI LETTER SHA {0x0A38, 0x0A39, prN}, // Lo [2] GURMUKHI LETTER SA..GURMUKHI LETTER HA {0x0A3C, 0x0A3C, prN}, // Mn GURMUKHI SIGN NUKTA {0x0A3E, 0x0A40, prN}, // Mc [3] GURMUKHI VOWEL SIGN AA..GURMUKHI VOWEL SIGN II {0x0A41, 0x0A42, prN}, // Mn [2] GURMUKHI VOWEL SIGN U..GURMUKHI VOWEL SIGN UU {0x0A47, 0x0A48, prN}, // Mn [2] GURMUKHI VOWEL SIGN EE..GURMUKHI VOWEL SIGN AI {0x0A4B, 0x0A4D, prN}, // Mn [3] GURMUKHI VOWEL SIGN OO..GURMUKHI SIGN VIRAMA {0x0A51, 0x0A51, prN}, // Mn GURMUKHI SIGN UDAAT {0x0A59, 0x0A5C, prN}, // Lo [4] GURMUKHI LETTER KHHA..GURMUKHI LETTER RRA {0x0A5E, 0x0A5E, prN}, // Lo GURMUKHI LETTER FA {0x0A66, 0x0A6F, prN}, // Nd [10] GURMUKHI DIGIT ZERO..GURMUKHI DIGIT NINE {0x0A70, 0x0A71, prN}, // Mn [2] GURMUKHI TIPPI..GURMUKHI ADDAK {0x0A72, 0x0A74, prN}, // Lo [3] GURMUKHI IRI..GURMUKHI EK ONKAR {0x0A75, 0x0A75, prN}, // Mn GURMUKHI SIGN YAKASH {0x0A76, 0x0A76, prN}, // Po GURMUKHI ABBREVIATION SIGN {0x0A81, 0x0A82, prN}, // Mn [2] GUJARATI SIGN CANDRABINDU..GUJARATI SIGN ANUSVARA {0x0A83, 0x0A83, prN}, // Mc GUJARATI SIGN VISARGA {0x0A85, 0x0A8D, prN}, // Lo [9] GUJARATI LETTER A..GUJARATI VOWEL CANDRA E {0x0A8F, 0x0A91, prN}, // Lo [3] GUJARATI LETTER E..GUJARATI VOWEL CANDRA O {0x0A93, 0x0AA8, prN}, // Lo [22] GUJARATI LETTER O..GUJARATI LETTER NA {0x0AAA, 0x0AB0, prN}, // Lo [7] GUJARATI LETTER PA..GUJARATI LETTER RA {0x0AB2, 0x0AB3, prN}, // Lo [2] GUJARATI LETTER LA..GUJARATI LETTER LLA {0x0AB5, 0x0AB9, prN}, // Lo [5] GUJARATI LETTER VA..GUJARATI LETTER HA {0x0ABC, 0x0ABC, prN}, // Mn GUJARATI SIGN NUKTA {0x0ABD, 0x0ABD, prN}, // Lo GUJARATI SIGN AVAGRAHA {0x0ABE, 0x0AC0, prN}, // Mc [3] GUJARATI VOWEL SIGN AA..GUJARATI VOWEL SIGN II {0x0AC1, 0x0AC5, prN}, // Mn [5] GUJARATI VOWEL SIGN U..GUJARATI VOWEL SIGN CANDRA E {0x0AC7, 0x0AC8, prN}, // Mn [2] GUJARATI VOWEL SIGN E..GUJARATI VOWEL SIGN AI {0x0AC9, 0x0AC9, prN}, // Mc GUJARATI VOWEL SIGN CANDRA O {0x0ACB, 0x0ACC, prN}, // Mc [2] GUJARATI VOWEL SIGN O..GUJARATI VOWEL SIGN AU {0x0ACD, 0x0ACD, prN}, // Mn GUJARATI SIGN VIRAMA {0x0AD0, 0x0AD0, prN}, // Lo GUJARATI OM {0x0AE0, 0x0AE1, prN}, // Lo [2] GUJARATI LETTER VOCALIC RR..GUJARATI LETTER VOCALIC LL {0x0AE2, 0x0AE3, prN}, // Mn [2] GUJARATI VOWEL SIGN VOCALIC L..GUJARATI VOWEL SIGN VOCALIC LL {0x0AE6, 0x0AEF, prN}, // Nd [10] GUJARATI DIGIT ZERO..GUJARATI DIGIT NINE {0x0AF0, 0x0AF0, prN}, // Po GUJARATI ABBREVIATION SIGN {0x0AF1, 0x0AF1, prN}, // Sc GUJARATI RUPEE SIGN
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
true
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/rivo/uniseg/step.go
vendor/github.com/rivo/uniseg/step.go
package uniseg import "unicode/utf8" // The bit masks used to extract boundary information returned by [Step]. const ( MaskLine = 3 MaskWord = 4 MaskSentence = 8 ) // The number of bits to shift the boundary information returned by [Step] to // obtain the monospace width of the grapheme cluster. const ShiftWidth = 4 // The bit positions by which boundary flags are shifted by the [Step] function. // These must correspond to the Mask constants. const ( shiftWord = 2 shiftSentence = 3 // shiftwWidth is ShiftWidth above. No mask as these are always the remaining bits. ) // The bit positions by which states are shifted by the [Step] function. These // values must ensure state values defined for each of the boundary algorithms // don't overlap (and that they all still fit in a single int). These must // correspond to the Mask constants. const ( shiftWordState = 4 shiftSentenceState = 9 shiftLineState = 13 shiftPropState = 21 // No mask as these are always the remaining bits. ) // The bit mask used to extract the state returned by the [Step] function, after // shifting. These values must correspond to the shift constants. const ( maskGraphemeState = 0xf maskWordState = 0x1f maskSentenceState = 0xf maskLineState = 0xff ) // Step returns the first grapheme cluster (user-perceived character) found in // the given byte slice. It also returns information about the boundary between // that grapheme cluster and the one following it as well as the monospace width // of the grapheme cluster. There are three types of boundary information: word // boundaries, sentence boundaries, and line breaks. This function is therefore // a combination of [FirstGraphemeCluster], [FirstWord], [FirstSentence], and // [FirstLineSegment]. // // The "boundaries" return value can be evaluated as follows: // // - boundaries&MaskWord != 0: The boundary is a word boundary. // - boundaries&MaskWord == 0: The boundary is not a word boundary. // - boundaries&MaskSentence != 0: The boundary is a sentence boundary. // - boundaries&MaskSentence == 0: The boundary is not a sentence boundary. // - boundaries&MaskLine == LineDontBreak: You must not break the line at the // boundary. // - boundaries&MaskLine == LineMustBreak: You must break the line at the // boundary. // - boundaries&MaskLine == LineCanBreak: You may or may not break the line at // the boundary. // - boundaries >> ShiftWidth: The width of the grapheme cluster for most // monospace fonts where a value of 1 represents one character cell. // // This function can be called continuously to extract all grapheme clusters // from a byte slice, as illustrated in the examples below. // // If you don't know which state to pass, for example when calling the function // for the first time, you must pass -1. For consecutive calls, pass the state // and rest slice returned by the previous call. // // The "rest" slice is the sub-slice of the original byte slice "b" starting // after the last byte of the identified grapheme cluster. If the length of the // "rest" slice is 0, the entire byte slice "b" has been processed. The // "cluster" byte slice is the sub-slice of the input slice containing the // first identified grapheme cluster. // // Given an empty byte slice "b", the function returns nil values. // // While slightly less convenient than using the Graphemes class, this function // has much better performance and makes no allocations. It lends itself well to // large byte slices. // // Note that in accordance with [UAX #14 LB3], the final segment will end with // a mandatory line break (boundaries&MaskLine == LineMustBreak). You can choose // to ignore this by checking if the length of the "rest" slice is 0 and calling // [HasTrailingLineBreak] or [HasTrailingLineBreakInString] on the last rune. // // [UAX #14 LB3]: https://www.unicode.org/reports/tr14/#Algorithm func Step(b []byte, state int) (cluster, rest []byte, boundaries int, newState int) { // An empty byte slice returns nothing. if len(b) == 0 { return } // Extract the first rune. r, length := utf8.DecodeRune(b) if len(b) <= length { // If we're already past the end, there is nothing else to parse. var prop int if state < 0 { prop = propertyGraphemes(r) } else { prop = state >> shiftPropState } return b, nil, LineMustBreak | (1 << shiftWord) | (1 << shiftSentence) | (runeWidth(r, prop) << ShiftWidth), grAny | (wbAny << shiftWordState) | (sbAny << shiftSentenceState) | (lbAny << shiftLineState) | (prop << shiftPropState) } // If we don't know the state, determine it now. var graphemeState, wordState, sentenceState, lineState, firstProp int remainder := b[length:] if state < 0 { graphemeState, firstProp, _ = transitionGraphemeState(state, r) wordState, _ = transitionWordBreakState(state, r, remainder, "") sentenceState, _ = transitionSentenceBreakState(state, r, remainder, "") lineState, _ = transitionLineBreakState(state, r, remainder, "") } else { graphemeState = state & maskGraphemeState wordState = (state >> shiftWordState) & maskWordState sentenceState = (state >> shiftSentenceState) & maskSentenceState lineState = (state >> shiftLineState) & maskLineState firstProp = state >> shiftPropState } // Transition until we find a grapheme cluster boundary. width := runeWidth(r, firstProp) for { var ( graphemeBoundary, wordBoundary, sentenceBoundary bool lineBreak, prop int ) r, l := utf8.DecodeRune(remainder) remainder = b[length+l:] graphemeState, prop, graphemeBoundary = transitionGraphemeState(graphemeState, r) wordState, wordBoundary = transitionWordBreakState(wordState, r, remainder, "") sentenceState, sentenceBoundary = transitionSentenceBreakState(sentenceState, r, remainder, "") lineState, lineBreak = transitionLineBreakState(lineState, r, remainder, "") if graphemeBoundary { boundary := lineBreak | (width << ShiftWidth) if wordBoundary { boundary |= 1 << shiftWord } if sentenceBoundary { boundary |= 1 << shiftSentence } return b[:length], b[length:], boundary, graphemeState | (wordState << shiftWordState) | (sentenceState << shiftSentenceState) | (lineState << shiftLineState) | (prop << shiftPropState) } if firstProp == prExtendedPictographic { if r == vs15 { width = 1 } else if r == vs16 { width = 2 } } else if firstProp != prRegionalIndicator && firstProp != prL { width += runeWidth(r, prop) } length += l if len(b) <= length { return b, nil, LineMustBreak | (1 << shiftWord) | (1 << shiftSentence) | (width << ShiftWidth), grAny | (wbAny << shiftWordState) | (sbAny << shiftSentenceState) | (lbAny << shiftLineState) | (prop << shiftPropState) } } } // StepString is like [Step] but its input and outputs are strings. func StepString(str string, state int) (cluster, rest string, boundaries int, newState int) { // An empty byte slice returns nothing. if len(str) == 0 { return } // Extract the first rune. r, length := utf8.DecodeRuneInString(str) if len(str) <= length { // If we're already past the end, there is nothing else to parse. prop := propertyGraphemes(r) return str, "", LineMustBreak | (1 << shiftWord) | (1 << shiftSentence) | (runeWidth(r, prop) << ShiftWidth), grAny | (wbAny << shiftWordState) | (sbAny << shiftSentenceState) | (lbAny << shiftLineState) } // If we don't know the state, determine it now. var graphemeState, wordState, sentenceState, lineState, firstProp int remainder := str[length:] if state < 0 { graphemeState, firstProp, _ = transitionGraphemeState(state, r) wordState, _ = transitionWordBreakState(state, r, nil, remainder) sentenceState, _ = transitionSentenceBreakState(state, r, nil, remainder) lineState, _ = transitionLineBreakState(state, r, nil, remainder) } else { graphemeState = state & maskGraphemeState wordState = (state >> shiftWordState) & maskWordState sentenceState = (state >> shiftSentenceState) & maskSentenceState lineState = (state >> shiftLineState) & maskLineState firstProp = state >> shiftPropState } // Transition until we find a grapheme cluster boundary. width := runeWidth(r, firstProp) for { var ( graphemeBoundary, wordBoundary, sentenceBoundary bool lineBreak, prop int ) r, l := utf8.DecodeRuneInString(remainder) remainder = str[length+l:] graphemeState, prop, graphemeBoundary = transitionGraphemeState(graphemeState, r) wordState, wordBoundary = transitionWordBreakState(wordState, r, nil, remainder) sentenceState, sentenceBoundary = transitionSentenceBreakState(sentenceState, r, nil, remainder) lineState, lineBreak = transitionLineBreakState(lineState, r, nil, remainder) if graphemeBoundary { boundary := lineBreak | (width << ShiftWidth) if wordBoundary { boundary |= 1 << shiftWord } if sentenceBoundary { boundary |= 1 << shiftSentence } return str[:length], str[length:], boundary, graphemeState | (wordState << shiftWordState) | (sentenceState << shiftSentenceState) | (lineState << shiftLineState) | (prop << shiftPropState) } if firstProp == prExtendedPictographic { if r == vs15 { width = 1 } else if r == vs16 { width = 2 } } else if firstProp != prRegionalIndicator && firstProp != prL { width += runeWidth(r, prop) } length += l if len(str) <= length { return str, "", LineMustBreak | (1 << shiftWord) | (1 << shiftSentence) | (width << ShiftWidth), grAny | (wbAny << shiftWordState) | (sbAny << shiftSentenceState) | (lbAny << shiftLineState) | (prop << shiftPropState) } } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/rivo/uniseg/sentenceproperties.go
vendor/github.com/rivo/uniseg/sentenceproperties.go
// Code generated via go generate from gen_properties.go. DO NOT EDIT. package uniseg // sentenceBreakCodePoints are taken from // https://www.unicode.org/Public/15.0.0/ucd/auxiliary/SentenceBreakProperty.txt // and // https://unicode.org/Public/15.0.0/ucd/emoji/emoji-data.txt // ("Extended_Pictographic" only) // on September 5, 2023. See https://www.unicode.org/license.html for the Unicode // license agreement. var sentenceBreakCodePoints = [][3]int{ {0x0009, 0x0009, prSp}, // Cc <control-0009> {0x000A, 0x000A, prLF}, // Cc <control-000A> {0x000B, 0x000C, prSp}, // Cc [2] <control-000B>..<control-000C> {0x000D, 0x000D, prCR}, // Cc <control-000D> {0x0020, 0x0020, prSp}, // Zs SPACE {0x0021, 0x0021, prSTerm}, // Po EXCLAMATION MARK {0x0022, 0x0022, prClose}, // Po QUOTATION MARK {0x0027, 0x0027, prClose}, // Po APOSTROPHE {0x0028, 0x0028, prClose}, // Ps LEFT PARENTHESIS {0x0029, 0x0029, prClose}, // Pe RIGHT PARENTHESIS {0x002C, 0x002C, prSContinue}, // Po COMMA {0x002D, 0x002D, prSContinue}, // Pd HYPHEN-MINUS {0x002E, 0x002E, prATerm}, // Po FULL STOP {0x0030, 0x0039, prNumeric}, // Nd [10] DIGIT ZERO..DIGIT NINE {0x003A, 0x003A, prSContinue}, // Po COLON {0x003F, 0x003F, prSTerm}, // Po QUESTION MARK {0x0041, 0x005A, prUpper}, // L& [26] LATIN CAPITAL LETTER A..LATIN CAPITAL LETTER Z {0x005B, 0x005B, prClose}, // Ps LEFT SQUARE BRACKET {0x005D, 0x005D, prClose}, // Pe RIGHT SQUARE BRACKET {0x0061, 0x007A, prLower}, // L& [26] LATIN SMALL LETTER A..LATIN SMALL LETTER Z {0x007B, 0x007B, prClose}, // Ps LEFT CURLY BRACKET {0x007D, 0x007D, prClose}, // Pe RIGHT CURLY BRACKET {0x0085, 0x0085, prSep}, // Cc <control-0085> {0x00A0, 0x00A0, prSp}, // Zs NO-BREAK SPACE {0x00AA, 0x00AA, prLower}, // Lo FEMININE ORDINAL INDICATOR {0x00AB, 0x00AB, prClose}, // Pi LEFT-POINTING DOUBLE ANGLE QUOTATION MARK {0x00AD, 0x00AD, prFormat}, // Cf SOFT HYPHEN {0x00B5, 0x00B5, prLower}, // L& MICRO SIGN {0x00BA, 0x00BA, prLower}, // Lo MASCULINE ORDINAL INDICATOR {0x00BB, 0x00BB, prClose}, // Pf RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK {0x00C0, 0x00D6, prUpper}, // L& [23] LATIN CAPITAL LETTER A WITH GRAVE..LATIN CAPITAL LETTER O WITH DIAERESIS {0x00D8, 0x00DE, prUpper}, // L& [7] LATIN CAPITAL LETTER O WITH STROKE..LATIN CAPITAL LETTER THORN {0x00DF, 0x00F6, prLower}, // L& [24] LATIN SMALL LETTER SHARP S..LATIN SMALL LETTER O WITH DIAERESIS {0x00F8, 0x00FF, prLower}, // L& [8] LATIN SMALL LETTER O WITH STROKE..LATIN SMALL LETTER Y WITH DIAERESIS {0x0100, 0x0100, prUpper}, // L& LATIN CAPITAL LETTER A WITH MACRON {0x0101, 0x0101, prLower}, // L& LATIN SMALL LETTER A WITH MACRON {0x0102, 0x0102, prUpper}, // L& LATIN CAPITAL LETTER A WITH BREVE {0x0103, 0x0103, prLower}, // L& LATIN SMALL LETTER A WITH BREVE {0x0104, 0x0104, prUpper}, // L& LATIN CAPITAL LETTER A WITH OGONEK {0x0105, 0x0105, prLower}, // L& LATIN SMALL LETTER A WITH OGONEK {0x0106, 0x0106, prUpper}, // L& LATIN CAPITAL LETTER C WITH ACUTE {0x0107, 0x0107, prLower}, // L& LATIN SMALL LETTER C WITH ACUTE {0x0108, 0x0108, prUpper}, // L& LATIN CAPITAL LETTER C WITH CIRCUMFLEX {0x0109, 0x0109, prLower}, // L& LATIN SMALL LETTER C WITH CIRCUMFLEX {0x010A, 0x010A, prUpper}, // L& LATIN CAPITAL LETTER C WITH DOT ABOVE {0x010B, 0x010B, prLower}, // L& LATIN SMALL LETTER C WITH DOT ABOVE {0x010C, 0x010C, prUpper}, // L& LATIN CAPITAL LETTER C WITH CARON {0x010D, 0x010D, prLower}, // L& LATIN SMALL LETTER C WITH CARON {0x010E, 0x010E, prUpper}, // L& LATIN CAPITAL LETTER D WITH CARON {0x010F, 0x010F, prLower}, // L& LATIN SMALL LETTER D WITH CARON {0x0110, 0x0110, prUpper}, // L& LATIN CAPITAL LETTER D WITH STROKE {0x0111, 0x0111, prLower}, // L& LATIN SMALL LETTER D WITH STROKE {0x0112, 0x0112, prUpper}, // L& LATIN CAPITAL LETTER E WITH MACRON {0x0113, 0x0113, prLower}, // L& LATIN SMALL LETTER E WITH MACRON {0x0114, 0x0114, prUpper}, // L& LATIN CAPITAL LETTER E WITH BREVE {0x0115, 0x0115, prLower}, // L& LATIN SMALL LETTER E WITH BREVE {0x0116, 0x0116, prUpper}, // L& LATIN CAPITAL LETTER E WITH DOT ABOVE {0x0117, 0x0117, prLower}, // L& LATIN SMALL LETTER E WITH DOT ABOVE {0x0118, 0x0118, prUpper}, // L& LATIN CAPITAL LETTER E WITH OGONEK {0x0119, 0x0119, prLower}, // L& LATIN SMALL LETTER E WITH OGONEK {0x011A, 0x011A, prUpper}, // L& LATIN CAPITAL LETTER E WITH CARON {0x011B, 0x011B, prLower}, // L& LATIN SMALL LETTER E WITH CARON {0x011C, 0x011C, prUpper}, // L& LATIN CAPITAL LETTER G WITH CIRCUMFLEX {0x011D, 0x011D, prLower}, // L& LATIN SMALL LETTER G WITH CIRCUMFLEX {0x011E, 0x011E, prUpper}, // L& LATIN CAPITAL LETTER G WITH BREVE {0x011F, 0x011F, prLower}, // L& LATIN SMALL LETTER G WITH BREVE {0x0120, 0x0120, prUpper}, // L& LATIN CAPITAL LETTER G WITH DOT ABOVE {0x0121, 0x0121, prLower}, // L& LATIN SMALL LETTER G WITH DOT ABOVE {0x0122, 0x0122, prUpper}, // L& LATIN CAPITAL LETTER G WITH CEDILLA {0x0123, 0x0123, prLower}, // L& LATIN SMALL LETTER G WITH CEDILLA {0x0124, 0x0124, prUpper}, // L& LATIN CAPITAL LETTER H WITH CIRCUMFLEX {0x0125, 0x0125, prLower}, // L& LATIN SMALL LETTER H WITH CIRCUMFLEX {0x0126, 0x0126, prUpper}, // L& LATIN CAPITAL LETTER H WITH STROKE {0x0127, 0x0127, prLower}, // L& LATIN SMALL LETTER H WITH STROKE {0x0128, 0x0128, prUpper}, // L& LATIN CAPITAL LETTER I WITH TILDE {0x0129, 0x0129, prLower}, // L& LATIN SMALL LETTER I WITH TILDE {0x012A, 0x012A, prUpper}, // L& LATIN CAPITAL LETTER I WITH MACRON {0x012B, 0x012B, prLower}, // L& LATIN SMALL LETTER I WITH MACRON {0x012C, 0x012C, prUpper}, // L& LATIN CAPITAL LETTER I WITH BREVE {0x012D, 0x012D, prLower}, // L& LATIN SMALL LETTER I WITH BREVE {0x012E, 0x012E, prUpper}, // L& LATIN CAPITAL LETTER I WITH OGONEK {0x012F, 0x012F, prLower}, // L& LATIN SMALL LETTER I WITH OGONEK {0x0130, 0x0130, prUpper}, // L& LATIN CAPITAL LETTER I WITH DOT ABOVE {0x0131, 0x0131, prLower}, // L& LATIN SMALL LETTER DOTLESS I {0x0132, 0x0132, prUpper}, // L& LATIN CAPITAL LIGATURE IJ {0x0133, 0x0133, prLower}, // L& LATIN SMALL LIGATURE IJ {0x0134, 0x0134, prUpper}, // L& LATIN CAPITAL LETTER J WITH CIRCUMFLEX {0x0135, 0x0135, prLower}, // L& LATIN SMALL LETTER J WITH CIRCUMFLEX {0x0136, 0x0136, prUpper}, // L& LATIN CAPITAL LETTER K WITH CEDILLA {0x0137, 0x0138, prLower}, // L& [2] LATIN SMALL LETTER K WITH CEDILLA..LATIN SMALL LETTER KRA {0x0139, 0x0139, prUpper}, // L& LATIN CAPITAL LETTER L WITH ACUTE {0x013A, 0x013A, prLower}, // L& LATIN SMALL LETTER L WITH ACUTE {0x013B, 0x013B, prUpper}, // L& LATIN CAPITAL LETTER L WITH CEDILLA {0x013C, 0x013C, prLower}, // L& LATIN SMALL LETTER L WITH CEDILLA {0x013D, 0x013D, prUpper}, // L& LATIN CAPITAL LETTER L WITH CARON {0x013E, 0x013E, prLower}, // L& LATIN SMALL LETTER L WITH CARON {0x013F, 0x013F, prUpper}, // L& LATIN CAPITAL LETTER L WITH MIDDLE DOT {0x0140, 0x0140, prLower}, // L& LATIN SMALL LETTER L WITH MIDDLE DOT {0x0141, 0x0141, prUpper}, // L& LATIN CAPITAL LETTER L WITH STROKE {0x0142, 0x0142, prLower}, // L& LATIN SMALL LETTER L WITH STROKE {0x0143, 0x0143, prUpper}, // L& LATIN CAPITAL LETTER N WITH ACUTE {0x0144, 0x0144, prLower}, // L& LATIN SMALL LETTER N WITH ACUTE {0x0145, 0x0145, prUpper}, // L& LATIN CAPITAL LETTER N WITH CEDILLA {0x0146, 0x0146, prLower}, // L& LATIN SMALL LETTER N WITH CEDILLA {0x0147, 0x0147, prUpper}, // L& LATIN CAPITAL LETTER N WITH CARON {0x0148, 0x0149, prLower}, // L& [2] LATIN SMALL LETTER N WITH CARON..LATIN SMALL LETTER N PRECEDED BY APOSTROPHE {0x014A, 0x014A, prUpper}, // L& LATIN CAPITAL LETTER ENG {0x014B, 0x014B, prLower}, // L& LATIN SMALL LETTER ENG {0x014C, 0x014C, prUpper}, // L& LATIN CAPITAL LETTER O WITH MACRON {0x014D, 0x014D, prLower}, // L& LATIN SMALL LETTER O WITH MACRON {0x014E, 0x014E, prUpper}, // L& LATIN CAPITAL LETTER O WITH BREVE {0x014F, 0x014F, prLower}, // L& LATIN SMALL LETTER O WITH BREVE {0x0150, 0x0150, prUpper}, // L& LATIN CAPITAL LETTER O WITH DOUBLE ACUTE {0x0151, 0x0151, prLower}, // L& LATIN SMALL LETTER O WITH DOUBLE ACUTE {0x0152, 0x0152, prUpper}, // L& LATIN CAPITAL LIGATURE OE {0x0153, 0x0153, prLower}, // L& LATIN SMALL LIGATURE OE {0x0154, 0x0154, prUpper}, // L& LATIN CAPITAL LETTER R WITH ACUTE {0x0155, 0x0155, prLower}, // L& LATIN SMALL LETTER R WITH ACUTE {0x0156, 0x0156, prUpper}, // L& LATIN CAPITAL LETTER R WITH CEDILLA {0x0157, 0x0157, prLower}, // L& LATIN SMALL LETTER R WITH CEDILLA {0x0158, 0x0158, prUpper}, // L& LATIN CAPITAL LETTER R WITH CARON {0x0159, 0x0159, prLower}, // L& LATIN SMALL LETTER R WITH CARON {0x015A, 0x015A, prUpper}, // L& LATIN CAPITAL LETTER S WITH ACUTE {0x015B, 0x015B, prLower}, // L& LATIN SMALL LETTER S WITH ACUTE {0x015C, 0x015C, prUpper}, // L& LATIN CAPITAL LETTER S WITH CIRCUMFLEX {0x015D, 0x015D, prLower}, // L& LATIN SMALL LETTER S WITH CIRCUMFLEX {0x015E, 0x015E, prUpper}, // L& LATIN CAPITAL LETTER S WITH CEDILLA {0x015F, 0x015F, prLower}, // L& LATIN SMALL LETTER S WITH CEDILLA {0x0160, 0x0160, prUpper}, // L& LATIN CAPITAL LETTER S WITH CARON {0x0161, 0x0161, prLower}, // L& LATIN SMALL LETTER S WITH CARON {0x0162, 0x0162, prUpper}, // L& LATIN CAPITAL LETTER T WITH CEDILLA {0x0163, 0x0163, prLower}, // L& LATIN SMALL LETTER T WITH CEDILLA {0x0164, 0x0164, prUpper}, // L& LATIN CAPITAL LETTER T WITH CARON {0x0165, 0x0165, prLower}, // L& LATIN SMALL LETTER T WITH CARON {0x0166, 0x0166, prUpper}, // L& LATIN CAPITAL LETTER T WITH STROKE {0x0167, 0x0167, prLower}, // L& LATIN SMALL LETTER T WITH STROKE {0x0168, 0x0168, prUpper}, // L& LATIN CAPITAL LETTER U WITH TILDE {0x0169, 0x0169, prLower}, // L& LATIN SMALL LETTER U WITH TILDE {0x016A, 0x016A, prUpper}, // L& LATIN CAPITAL LETTER U WITH MACRON {0x016B, 0x016B, prLower}, // L& LATIN SMALL LETTER U WITH MACRON {0x016C, 0x016C, prUpper}, // L& LATIN CAPITAL LETTER U WITH BREVE {0x016D, 0x016D, prLower}, // L& LATIN SMALL LETTER U WITH BREVE {0x016E, 0x016E, prUpper}, // L& LATIN CAPITAL LETTER U WITH RING ABOVE {0x016F, 0x016F, prLower}, // L& LATIN SMALL LETTER U WITH RING ABOVE {0x0170, 0x0170, prUpper}, // L& LATIN CAPITAL LETTER U WITH DOUBLE ACUTE {0x0171, 0x0171, prLower}, // L& LATIN SMALL LETTER U WITH DOUBLE ACUTE {0x0172, 0x0172, prUpper}, // L& LATIN CAPITAL LETTER U WITH OGONEK {0x0173, 0x0173, prLower}, // L& LATIN SMALL LETTER U WITH OGONEK {0x0174, 0x0174, prUpper}, // L& LATIN CAPITAL LETTER W WITH CIRCUMFLEX {0x0175, 0x0175, prLower}, // L& LATIN SMALL LETTER W WITH CIRCUMFLEX {0x0176, 0x0176, prUpper}, // L& LATIN CAPITAL LETTER Y WITH CIRCUMFLEX {0x0177, 0x0177, prLower}, // L& LATIN SMALL LETTER Y WITH CIRCUMFLEX {0x0178, 0x0179, prUpper}, // L& [2] LATIN CAPITAL LETTER Y WITH DIAERESIS..LATIN CAPITAL LETTER Z WITH ACUTE {0x017A, 0x017A, prLower}, // L& LATIN SMALL LETTER Z WITH ACUTE {0x017B, 0x017B, prUpper}, // L& LATIN CAPITAL LETTER Z WITH DOT ABOVE {0x017C, 0x017C, prLower}, // L& LATIN SMALL LETTER Z WITH DOT ABOVE {0x017D, 0x017D, prUpper}, // L& LATIN CAPITAL LETTER Z WITH CARON {0x017E, 0x0180, prLower}, // L& [3] LATIN SMALL LETTER Z WITH CARON..LATIN SMALL LETTER B WITH STROKE {0x0181, 0x0182, prUpper}, // L& [2] LATIN CAPITAL LETTER B WITH HOOK..LATIN CAPITAL LETTER B WITH TOPBAR {0x0183, 0x0183, prLower}, // L& LATIN SMALL LETTER B WITH TOPBAR {0x0184, 0x0184, prUpper}, // L& LATIN CAPITAL LETTER TONE SIX {0x0185, 0x0185, prLower}, // L& LATIN SMALL LETTER TONE SIX {0x0186, 0x0187, prUpper}, // L& [2] LATIN CAPITAL LETTER OPEN O..LATIN CAPITAL LETTER C WITH HOOK {0x0188, 0x0188, prLower}, // L& LATIN SMALL LETTER C WITH HOOK {0x0189, 0x018B, prUpper}, // L& [3] LATIN CAPITAL LETTER AFRICAN D..LATIN CAPITAL LETTER D WITH TOPBAR {0x018C, 0x018D, prLower}, // L& [2] LATIN SMALL LETTER D WITH TOPBAR..LATIN SMALL LETTER TURNED DELTA {0x018E, 0x0191, prUpper}, // L& [4] LATIN CAPITAL LETTER REVERSED E..LATIN CAPITAL LETTER F WITH HOOK {0x0192, 0x0192, prLower}, // L& LATIN SMALL LETTER F WITH HOOK {0x0193, 0x0194, prUpper}, // L& [2] LATIN CAPITAL LETTER G WITH HOOK..LATIN CAPITAL LETTER GAMMA {0x0195, 0x0195, prLower}, // L& LATIN SMALL LETTER HV {0x0196, 0x0198, prUpper}, // L& [3] LATIN CAPITAL LETTER IOTA..LATIN CAPITAL LETTER K WITH HOOK {0x0199, 0x019B, prLower}, // L& [3] LATIN SMALL LETTER K WITH HOOK..LATIN SMALL LETTER LAMBDA WITH STROKE {0x019C, 0x019D, prUpper}, // L& [2] LATIN CAPITAL LETTER TURNED M..LATIN CAPITAL LETTER N WITH LEFT HOOK {0x019E, 0x019E, prLower}, // L& LATIN SMALL LETTER N WITH LONG RIGHT LEG {0x019F, 0x01A0, prUpper}, // L& [2] LATIN CAPITAL LETTER O WITH MIDDLE TILDE..LATIN CAPITAL LETTER O WITH HORN {0x01A1, 0x01A1, prLower}, // L& LATIN SMALL LETTER O WITH HORN {0x01A2, 0x01A2, prUpper}, // L& LATIN CAPITAL LETTER OI {0x01A3, 0x01A3, prLower}, // L& LATIN SMALL LETTER OI {0x01A4, 0x01A4, prUpper}, // L& LATIN CAPITAL LETTER P WITH HOOK {0x01A5, 0x01A5, prLower}, // L& LATIN SMALL LETTER P WITH HOOK {0x01A6, 0x01A7, prUpper}, // L& [2] LATIN LETTER YR..LATIN CAPITAL LETTER TONE TWO {0x01A8, 0x01A8, prLower}, // L& LATIN SMALL LETTER TONE TWO {0x01A9, 0x01A9, prUpper}, // L& LATIN CAPITAL LETTER ESH {0x01AA, 0x01AB, prLower}, // L& [2] LATIN LETTER REVERSED ESH LOOP..LATIN SMALL LETTER T WITH PALATAL HOOK {0x01AC, 0x01AC, prUpper}, // L& LATIN CAPITAL LETTER T WITH HOOK {0x01AD, 0x01AD, prLower}, // L& LATIN SMALL LETTER T WITH HOOK {0x01AE, 0x01AF, prUpper}, // L& [2] LATIN CAPITAL LETTER T WITH RETROFLEX HOOK..LATIN CAPITAL LETTER U WITH HORN {0x01B0, 0x01B0, prLower}, // L& LATIN SMALL LETTER U WITH HORN {0x01B1, 0x01B3, prUpper}, // L& [3] LATIN CAPITAL LETTER UPSILON..LATIN CAPITAL LETTER Y WITH HOOK {0x01B4, 0x01B4, prLower}, // L& LATIN SMALL LETTER Y WITH HOOK {0x01B5, 0x01B5, prUpper}, // L& LATIN CAPITAL LETTER Z WITH STROKE {0x01B6, 0x01B6, prLower}, // L& LATIN SMALL LETTER Z WITH STROKE {0x01B7, 0x01B8, prUpper}, // L& [2] LATIN CAPITAL LETTER EZH..LATIN CAPITAL LETTER EZH REVERSED {0x01B9, 0x01BA, prLower}, // L& [2] LATIN SMALL LETTER EZH REVERSED..LATIN SMALL LETTER EZH WITH TAIL {0x01BB, 0x01BB, prOLetter}, // Lo LATIN LETTER TWO WITH STROKE {0x01BC, 0x01BC, prUpper}, // L& LATIN CAPITAL LETTER TONE FIVE {0x01BD, 0x01BF, prLower}, // L& [3] LATIN SMALL LETTER TONE FIVE..LATIN LETTER WYNN {0x01C0, 0x01C3, prOLetter}, // Lo [4] LATIN LETTER DENTAL CLICK..LATIN LETTER RETROFLEX CLICK {0x01C4, 0x01C5, prUpper}, // L& [2] LATIN CAPITAL LETTER DZ WITH CARON..LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON {0x01C6, 0x01C6, prLower}, // L& LATIN SMALL LETTER DZ WITH CARON {0x01C7, 0x01C8, prUpper}, // L& [2] LATIN CAPITAL LETTER LJ..LATIN CAPITAL LETTER L WITH SMALL LETTER J {0x01C9, 0x01C9, prLower}, // L& LATIN SMALL LETTER LJ {0x01CA, 0x01CB, prUpper}, // L& [2] LATIN CAPITAL LETTER NJ..LATIN CAPITAL LETTER N WITH SMALL LETTER J {0x01CC, 0x01CC, prLower}, // L& LATIN SMALL LETTER NJ {0x01CD, 0x01CD, prUpper}, // L& LATIN CAPITAL LETTER A WITH CARON {0x01CE, 0x01CE, prLower}, // L& LATIN SMALL LETTER A WITH CARON {0x01CF, 0x01CF, prUpper}, // L& LATIN CAPITAL LETTER I WITH CARON {0x01D0, 0x01D0, prLower}, // L& LATIN SMALL LETTER I WITH CARON {0x01D1, 0x01D1, prUpper}, // L& LATIN CAPITAL LETTER O WITH CARON {0x01D2, 0x01D2, prLower}, // L& LATIN SMALL LETTER O WITH CARON {0x01D3, 0x01D3, prUpper}, // L& LATIN CAPITAL LETTER U WITH CARON {0x01D4, 0x01D4, prLower}, // L& LATIN SMALL LETTER U WITH CARON {0x01D5, 0x01D5, prUpper}, // L& LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON {0x01D6, 0x01D6, prLower}, // L& LATIN SMALL LETTER U WITH DIAERESIS AND MACRON {0x01D7, 0x01D7, prUpper}, // L& LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE {0x01D8, 0x01D8, prLower}, // L& LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE {0x01D9, 0x01D9, prUpper}, // L& LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON {0x01DA, 0x01DA, prLower}, // L& LATIN SMALL LETTER U WITH DIAERESIS AND CARON {0x01DB, 0x01DB, prUpper}, // L& LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE {0x01DC, 0x01DD, prLower}, // L& [2] LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE..LATIN SMALL LETTER TURNED E {0x01DE, 0x01DE, prUpper}, // L& LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON {0x01DF, 0x01DF, prLower}, // L& LATIN SMALL LETTER A WITH DIAERESIS AND MACRON {0x01E0, 0x01E0, prUpper}, // L& LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON {0x01E1, 0x01E1, prLower}, // L& LATIN SMALL LETTER A WITH DOT ABOVE AND MACRON {0x01E2, 0x01E2, prUpper}, // L& LATIN CAPITAL LETTER AE WITH MACRON {0x01E3, 0x01E3, prLower}, // L& LATIN SMALL LETTER AE WITH MACRON {0x01E4, 0x01E4, prUpper}, // L& LATIN CAPITAL LETTER G WITH STROKE {0x01E5, 0x01E5, prLower}, // L& LATIN SMALL LETTER G WITH STROKE {0x01E6, 0x01E6, prUpper}, // L& LATIN CAPITAL LETTER G WITH CARON {0x01E7, 0x01E7, prLower}, // L& LATIN SMALL LETTER G WITH CARON {0x01E8, 0x01E8, prUpper}, // L& LATIN CAPITAL LETTER K WITH CARON {0x01E9, 0x01E9, prLower}, // L& LATIN SMALL LETTER K WITH CARON {0x01EA, 0x01EA, prUpper}, // L& LATIN CAPITAL LETTER O WITH OGONEK {0x01EB, 0x01EB, prLower}, // L& LATIN SMALL LETTER O WITH OGONEK {0x01EC, 0x01EC, prUpper}, // L& LATIN CAPITAL LETTER O WITH OGONEK AND MACRON {0x01ED, 0x01ED, prLower}, // L& LATIN SMALL LETTER O WITH OGONEK AND MACRON {0x01EE, 0x01EE, prUpper}, // L& LATIN CAPITAL LETTER EZH WITH CARON {0x01EF, 0x01F0, prLower}, // L& [2] LATIN SMALL LETTER EZH WITH CARON..LATIN SMALL LETTER J WITH CARON {0x01F1, 0x01F2, prUpper}, // L& [2] LATIN CAPITAL LETTER DZ..LATIN CAPITAL LETTER D WITH SMALL LETTER Z {0x01F3, 0x01F3, prLower}, // L& LATIN SMALL LETTER DZ {0x01F4, 0x01F4, prUpper}, // L& LATIN CAPITAL LETTER G WITH ACUTE {0x01F5, 0x01F5, prLower}, // L& LATIN SMALL LETTER G WITH ACUTE {0x01F6, 0x01F8, prUpper}, // L& [3] LATIN CAPITAL LETTER HWAIR..LATIN CAPITAL LETTER N WITH GRAVE {0x01F9, 0x01F9, prLower}, // L& LATIN SMALL LETTER N WITH GRAVE {0x01FA, 0x01FA, prUpper}, // L& LATIN CAPITAL LETTER A WITH RING ABOVE AND ACUTE {0x01FB, 0x01FB, prLower}, // L& LATIN SMALL LETTER A WITH RING ABOVE AND ACUTE {0x01FC, 0x01FC, prUpper}, // L& LATIN CAPITAL LETTER AE WITH ACUTE {0x01FD, 0x01FD, prLower}, // L& LATIN SMALL LETTER AE WITH ACUTE {0x01FE, 0x01FE, prUpper}, // L& LATIN CAPITAL LETTER O WITH STROKE AND ACUTE {0x01FF, 0x01FF, prLower}, // L& LATIN SMALL LETTER O WITH STROKE AND ACUTE {0x0200, 0x0200, prUpper}, // L& LATIN CAPITAL LETTER A WITH DOUBLE GRAVE {0x0201, 0x0201, prLower}, // L& LATIN SMALL LETTER A WITH DOUBLE GRAVE {0x0202, 0x0202, prUpper}, // L& LATIN CAPITAL LETTER A WITH INVERTED BREVE {0x0203, 0x0203, prLower}, // L& LATIN SMALL LETTER A WITH INVERTED BREVE {0x0204, 0x0204, prUpper}, // L& LATIN CAPITAL LETTER E WITH DOUBLE GRAVE {0x0205, 0x0205, prLower}, // L& LATIN SMALL LETTER E WITH DOUBLE GRAVE {0x0206, 0x0206, prUpper}, // L& LATIN CAPITAL LETTER E WITH INVERTED BREVE {0x0207, 0x0207, prLower}, // L& LATIN SMALL LETTER E WITH INVERTED BREVE {0x0208, 0x0208, prUpper}, // L& LATIN CAPITAL LETTER I WITH DOUBLE GRAVE {0x0209, 0x0209, prLower}, // L& LATIN SMALL LETTER I WITH DOUBLE GRAVE {0x020A, 0x020A, prUpper}, // L& LATIN CAPITAL LETTER I WITH INVERTED BREVE {0x020B, 0x020B, prLower}, // L& LATIN SMALL LETTER I WITH INVERTED BREVE {0x020C, 0x020C, prUpper}, // L& LATIN CAPITAL LETTER O WITH DOUBLE GRAVE {0x020D, 0x020D, prLower}, // L& LATIN SMALL LETTER O WITH DOUBLE GRAVE {0x020E, 0x020E, prUpper}, // L& LATIN CAPITAL LETTER O WITH INVERTED BREVE {0x020F, 0x020F, prLower}, // L& LATIN SMALL LETTER O WITH INVERTED BREVE {0x0210, 0x0210, prUpper}, // L& LATIN CAPITAL LETTER R WITH DOUBLE GRAVE {0x0211, 0x0211, prLower}, // L& LATIN SMALL LETTER R WITH DOUBLE GRAVE {0x0212, 0x0212, prUpper}, // L& LATIN CAPITAL LETTER R WITH INVERTED BREVE {0x0213, 0x0213, prLower}, // L& LATIN SMALL LETTER R WITH INVERTED BREVE {0x0214, 0x0214, prUpper}, // L& LATIN CAPITAL LETTER U WITH DOUBLE GRAVE {0x0215, 0x0215, prLower}, // L& LATIN SMALL LETTER U WITH DOUBLE GRAVE {0x0216, 0x0216, prUpper}, // L& LATIN CAPITAL LETTER U WITH INVERTED BREVE {0x0217, 0x0217, prLower}, // L& LATIN SMALL LETTER U WITH INVERTED BREVE {0x0218, 0x0218, prUpper}, // L& LATIN CAPITAL LETTER S WITH COMMA BELOW {0x0219, 0x0219, prLower}, // L& LATIN SMALL LETTER S WITH COMMA BELOW {0x021A, 0x021A, prUpper}, // L& LATIN CAPITAL LETTER T WITH COMMA BELOW {0x021B, 0x021B, prLower}, // L& LATIN SMALL LETTER T WITH COMMA BELOW {0x021C, 0x021C, prUpper}, // L& LATIN CAPITAL LETTER YOGH {0x021D, 0x021D, prLower}, // L& LATIN SMALL LETTER YOGH {0x021E, 0x021E, prUpper}, // L& LATIN CAPITAL LETTER H WITH CARON {0x021F, 0x021F, prLower}, // L& LATIN SMALL LETTER H WITH CARON {0x0220, 0x0220, prUpper}, // L& LATIN CAPITAL LETTER N WITH LONG RIGHT LEG {0x0221, 0x0221, prLower}, // L& LATIN SMALL LETTER D WITH CURL {0x0222, 0x0222, prUpper}, // L& LATIN CAPITAL LETTER OU {0x0223, 0x0223, prLower}, // L& LATIN SMALL LETTER OU {0x0224, 0x0224, prUpper}, // L& LATIN CAPITAL LETTER Z WITH HOOK {0x0225, 0x0225, prLower}, // L& LATIN SMALL LETTER Z WITH HOOK {0x0226, 0x0226, prUpper}, // L& LATIN CAPITAL LETTER A WITH DOT ABOVE {0x0227, 0x0227, prLower}, // L& LATIN SMALL LETTER A WITH DOT ABOVE {0x0228, 0x0228, prUpper}, // L& LATIN CAPITAL LETTER E WITH CEDILLA {0x0229, 0x0229, prLower}, // L& LATIN SMALL LETTER E WITH CEDILLA {0x022A, 0x022A, prUpper}, // L& LATIN CAPITAL LETTER O WITH DIAERESIS AND MACRON {0x022B, 0x022B, prLower}, // L& LATIN SMALL LETTER O WITH DIAERESIS AND MACRON {0x022C, 0x022C, prUpper}, // L& LATIN CAPITAL LETTER O WITH TILDE AND MACRON {0x022D, 0x022D, prLower}, // L& LATIN SMALL LETTER O WITH TILDE AND MACRON {0x022E, 0x022E, prUpper}, // L& LATIN CAPITAL LETTER O WITH DOT ABOVE {0x022F, 0x022F, prLower}, // L& LATIN SMALL LETTER O WITH DOT ABOVE {0x0230, 0x0230, prUpper}, // L& LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON {0x0231, 0x0231, prLower}, // L& LATIN SMALL LETTER O WITH DOT ABOVE AND MACRON {0x0232, 0x0232, prUpper}, // L& LATIN CAPITAL LETTER Y WITH MACRON {0x0233, 0x0239, prLower}, // L& [7] LATIN SMALL LETTER Y WITH MACRON..LATIN SMALL LETTER QP DIGRAPH {0x023A, 0x023B, prUpper}, // L& [2] LATIN CAPITAL LETTER A WITH STROKE..LATIN CAPITAL LETTER C WITH STROKE {0x023C, 0x023C, prLower}, // L& LATIN SMALL LETTER C WITH STROKE {0x023D, 0x023E, prUpper}, // L& [2] LATIN CAPITAL LETTER L WITH BAR..LATIN CAPITAL LETTER T WITH DIAGONAL STROKE {0x023F, 0x0240, prLower}, // L& [2] LATIN SMALL LETTER S WITH SWASH TAIL..LATIN SMALL LETTER Z WITH SWASH TAIL {0x0241, 0x0241, prUpper}, // L& LATIN CAPITAL LETTER GLOTTAL STOP {0x0242, 0x0242, prLower}, // L& LATIN SMALL LETTER GLOTTAL STOP {0x0243, 0x0246, prUpper}, // L& [4] LATIN CAPITAL LETTER B WITH STROKE..LATIN CAPITAL LETTER E WITH STROKE {0x0247, 0x0247, prLower}, // L& LATIN SMALL LETTER E WITH STROKE {0x0248, 0x0248, prUpper}, // L& LATIN CAPITAL LETTER J WITH STROKE {0x0249, 0x0249, prLower}, // L& LATIN SMALL LETTER J WITH STROKE {0x024A, 0x024A, prUpper}, // L& LATIN CAPITAL LETTER SMALL Q WITH HOOK TAIL {0x024B, 0x024B, prLower}, // L& LATIN SMALL LETTER Q WITH HOOK TAIL {0x024C, 0x024C, prUpper}, // L& LATIN CAPITAL LETTER R WITH STROKE {0x024D, 0x024D, prLower}, // L& LATIN SMALL LETTER R WITH STROKE {0x024E, 0x024E, prUpper}, // L& LATIN CAPITAL LETTER Y WITH STROKE {0x024F, 0x0293, prLower}, // L& [69] LATIN SMALL LETTER Y WITH STROKE..LATIN SMALL LETTER EZH WITH CURL {0x0294, 0x0294, prOLetter}, // Lo LATIN LETTER GLOTTAL STOP {0x0295, 0x02AF, prLower}, // L& [27] LATIN LETTER PHARYNGEAL VOICED FRICATIVE..LATIN SMALL LETTER TURNED H WITH FISHHOOK AND TAIL {0x02B0, 0x02B8, prLower}, // Lm [9] MODIFIER LETTER SMALL H..MODIFIER LETTER SMALL Y {0x02B9, 0x02BF, prOLetter}, // Lm [7] MODIFIER LETTER PRIME..MODIFIER LETTER LEFT HALF RING {0x02C0, 0x02C1, prLower}, // Lm [2] MODIFIER LETTER GLOTTAL STOP..MODIFIER LETTER REVERSED GLOTTAL STOP {0x02C6, 0x02D1, prOLetter}, // Lm [12] MODIFIER LETTER CIRCUMFLEX ACCENT..MODIFIER LETTER HALF TRIANGULAR COLON {0x02E0, 0x02E4, prLower}, // Lm [5] MODIFIER LETTER SMALL GAMMA..MODIFIER LETTER SMALL REVERSED GLOTTAL STOP {0x02EC, 0x02EC, prOLetter}, // Lm MODIFIER LETTER VOICING {0x02EE, 0x02EE, prOLetter}, // Lm MODIFIER LETTER DOUBLE APOSTROPHE {0x0300, 0x036F, prExtend}, // Mn [112] COMBINING GRAVE ACCENT..COMBINING LATIN SMALL LETTER X {0x0370, 0x0370, prUpper}, // L& GREEK CAPITAL LETTER HETA {0x0371, 0x0371, prLower}, // L& GREEK SMALL LETTER HETA {0x0372, 0x0372, prUpper}, // L& GREEK CAPITAL LETTER ARCHAIC SAMPI {0x0373, 0x0373, prLower}, // L& GREEK SMALL LETTER ARCHAIC SAMPI {0x0374, 0x0374, prOLetter}, // Lm GREEK NUMERAL SIGN {0x0376, 0x0376, prUpper}, // L& GREEK CAPITAL LETTER PAMPHYLIAN DIGAMMA {0x0377, 0x0377, prLower}, // L& GREEK SMALL LETTER PAMPHYLIAN DIGAMMA {0x037A, 0x037A, prLower}, // Lm GREEK YPOGEGRAMMENI {0x037B, 0x037D, prLower}, // L& [3] GREEK SMALL REVERSED LUNATE SIGMA SYMBOL..GREEK SMALL REVERSED DOTTED LUNATE SIGMA SYMBOL {0x037F, 0x037F, prUpper}, // L& GREEK CAPITAL LETTER YOT {0x0386, 0x0386, prUpper}, // L& GREEK CAPITAL LETTER ALPHA WITH TONOS {0x0388, 0x038A, prUpper}, // L& [3] GREEK CAPITAL LETTER EPSILON WITH TONOS..GREEK CAPITAL LETTER IOTA WITH TONOS {0x038C, 0x038C, prUpper}, // L& GREEK CAPITAL LETTER OMICRON WITH TONOS {0x038E, 0x038F, prUpper}, // L& [2] GREEK CAPITAL LETTER UPSILON WITH TONOS..GREEK CAPITAL LETTER OMEGA WITH TONOS {0x0390, 0x0390, prLower}, // L& GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS {0x0391, 0x03A1, prUpper}, // L& [17] GREEK CAPITAL LETTER ALPHA..GREEK CAPITAL LETTER RHO {0x03A3, 0x03AB, prUpper}, // L& [9] GREEK CAPITAL LETTER SIGMA..GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA {0x03AC, 0x03CE, prLower}, // L& [35] GREEK SMALL LETTER ALPHA WITH TONOS..GREEK SMALL LETTER OMEGA WITH TONOS {0x03CF, 0x03CF, prUpper}, // L& GREEK CAPITAL KAI SYMBOL {0x03D0, 0x03D1, prLower}, // L& [2] GREEK BETA SYMBOL..GREEK THETA SYMBOL {0x03D2, 0x03D4, prUpper}, // L& [3] GREEK UPSILON WITH HOOK SYMBOL..GREEK UPSILON WITH DIAERESIS AND HOOK SYMBOL {0x03D5, 0x03D7, prLower}, // L& [3] GREEK PHI SYMBOL..GREEK KAI SYMBOL {0x03D8, 0x03D8, prUpper}, // L& GREEK LETTER ARCHAIC KOPPA {0x03D9, 0x03D9, prLower}, // L& GREEK SMALL LETTER ARCHAIC KOPPA {0x03DA, 0x03DA, prUpper}, // L& GREEK LETTER STIGMA {0x03DB, 0x03DB, prLower}, // L& GREEK SMALL LETTER STIGMA {0x03DC, 0x03DC, prUpper}, // L& GREEK LETTER DIGAMMA {0x03DD, 0x03DD, prLower}, // L& GREEK SMALL LETTER DIGAMMA {0x03DE, 0x03DE, prUpper}, // L& GREEK LETTER KOPPA {0x03DF, 0x03DF, prLower}, // L& GREEK SMALL LETTER KOPPA {0x03E0, 0x03E0, prUpper}, // L& GREEK LETTER SAMPI {0x03E1, 0x03E1, prLower}, // L& GREEK SMALL LETTER SAMPI {0x03E2, 0x03E2, prUpper}, // L& COPTIC CAPITAL LETTER SHEI {0x03E3, 0x03E3, prLower}, // L& COPTIC SMALL LETTER SHEI {0x03E4, 0x03E4, prUpper}, // L& COPTIC CAPITAL LETTER FEI {0x03E5, 0x03E5, prLower}, // L& COPTIC SMALL LETTER FEI {0x03E6, 0x03E6, prUpper}, // L& COPTIC CAPITAL LETTER KHEI {0x03E7, 0x03E7, prLower}, // L& COPTIC SMALL LETTER KHEI {0x03E8, 0x03E8, prUpper}, // L& COPTIC CAPITAL LETTER HORI {0x03E9, 0x03E9, prLower}, // L& COPTIC SMALL LETTER HORI {0x03EA, 0x03EA, prUpper}, // L& COPTIC CAPITAL LETTER GANGIA {0x03EB, 0x03EB, prLower}, // L& COPTIC SMALL LETTER GANGIA {0x03EC, 0x03EC, prUpper}, // L& COPTIC CAPITAL LETTER SHIMA {0x03ED, 0x03ED, prLower}, // L& COPTIC SMALL LETTER SHIMA {0x03EE, 0x03EE, prUpper}, // L& COPTIC CAPITAL LETTER DEI {0x03EF, 0x03F3, prLower}, // L& [5] COPTIC SMALL LETTER DEI..GREEK LETTER YOT {0x03F4, 0x03F4, prUpper}, // L& GREEK CAPITAL THETA SYMBOL {0x03F5, 0x03F5, prLower}, // L& GREEK LUNATE EPSILON SYMBOL {0x03F7, 0x03F7, prUpper}, // L& GREEK CAPITAL LETTER SHO {0x03F8, 0x03F8, prLower}, // L& GREEK SMALL LETTER SHO {0x03F9, 0x03FA, prUpper}, // L& [2] GREEK CAPITAL LUNATE SIGMA SYMBOL..GREEK CAPITAL LETTER SAN {0x03FB, 0x03FC, prLower}, // L& [2] GREEK SMALL LETTER SAN..GREEK RHO WITH STROKE SYMBOL {0x03FD, 0x042F, prUpper}, // L& [51] GREEK CAPITAL REVERSED LUNATE SIGMA SYMBOL..CYRILLIC CAPITAL LETTER YA {0x0430, 0x045F, prLower}, // L& [48] CYRILLIC SMALL LETTER A..CYRILLIC SMALL LETTER DZHE {0x0460, 0x0460, prUpper}, // L& CYRILLIC CAPITAL LETTER OMEGA {0x0461, 0x0461, prLower}, // L& CYRILLIC SMALL LETTER OMEGA {0x0462, 0x0462, prUpper}, // L& CYRILLIC CAPITAL LETTER YAT {0x0463, 0x0463, prLower}, // L& CYRILLIC SMALL LETTER YAT {0x0464, 0x0464, prUpper}, // L& CYRILLIC CAPITAL LETTER IOTIFIED E {0x0465, 0x0465, prLower}, // L& CYRILLIC SMALL LETTER IOTIFIED E {0x0466, 0x0466, prUpper}, // L& CYRILLIC CAPITAL LETTER LITTLE YUS {0x0467, 0x0467, prLower}, // L& CYRILLIC SMALL LETTER LITTLE YUS {0x0468, 0x0468, prUpper}, // L& CYRILLIC CAPITAL LETTER IOTIFIED LITTLE YUS {0x0469, 0x0469, prLower}, // L& CYRILLIC SMALL LETTER IOTIFIED LITTLE YUS {0x046A, 0x046A, prUpper}, // L& CYRILLIC CAPITAL LETTER BIG YUS {0x046B, 0x046B, prLower}, // L& CYRILLIC SMALL LETTER BIG YUS
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
true
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/rivo/uniseg/doc.go
vendor/github.com/rivo/uniseg/doc.go
/* Package uniseg implements Unicode Text Segmentation, Unicode Line Breaking, and string width calculation for monospace fonts. Unicode Text Segmentation conforms to Unicode Standard Annex #29 (https://unicode.org/reports/tr29/) and Unicode Line Breaking conforms to Unicode Standard Annex #14 (https://unicode.org/reports/tr14/). In short, using this package, you can split a string into grapheme clusters (what people would usually refer to as a "character"), into words, and into sentences. Or, in its simplest case, this package allows you to count the number of characters in a string, especially when it contains complex characters such as emojis, combining characters, or characters from Asian, Arabic, Hebrew, or other languages. Additionally, you can use it to implement line breaking (or "word wrapping"), that is, to determine where text can be broken over to the next line when the width of the line is not big enough to fit the entire text. Finally, you can use it to calculate the display width of a string for monospace fonts. # Getting Started If you just want to count the number of characters in a string, you can use [GraphemeClusterCount]. If you want to determine the display width of a string, you can use [StringWidth]. If you want to iterate over a string, you can use [Step], [StepString], or the [Graphemes] class (more convenient but less performant). This will provide you with all information: grapheme clusters, word boundaries, sentence boundaries, line breaks, and monospace character widths. The specialized functions [FirstGraphemeCluster], [FirstGraphemeClusterInString], [FirstWord], [FirstWordInString], [FirstSentence], and [FirstSentenceInString] can be used if only one type of information is needed. # Grapheme Clusters Consider the rainbow flag emoji: 🏳️‍🌈. On most modern systems, it appears as one character. But its string representation actually has 14 bytes, so counting bytes (or using len("🏳️‍🌈")) will not work as expected. Counting runes won't, either: The flag has 4 Unicode code points, thus 4 runes. The stdlib function utf8.RuneCountInString("🏳️‍🌈") and len([]rune("🏳️‍🌈")) will both return 4. The [GraphemeClusterCount] function will return 1 for the rainbow flag emoji. The Graphemes class and a variety of functions in this package will allow you to split strings into its grapheme clusters. # Word Boundaries Word boundaries are used in a number of different contexts. The most familiar ones are selection (double-click mouse selection), cursor movement ("move to next word" control-arrow keys), and the dialog option "Whole Word Search" for search and replace. This package provides methods for determining word boundaries. # Sentence Boundaries Sentence boundaries are often used for triple-click or some other method of selecting or iterating through blocks of text that are larger than single words. They are also used to determine whether words occur within the same sentence in database queries. This package provides methods for determining sentence boundaries. # Line Breaking Line breaking, also known as word wrapping, is the process of breaking a section of text into lines such that it will fit in the available width of a page, window or other display area. This package provides methods to determine the positions in a string where a line must be broken, may be broken, or must not be broken. # Monospace Width Monospace width, as referred to in this package, is the width of a string in a monospace font. This is commonly used in terminal user interfaces or text displays or editors that don't support proportional fonts. A width of 1 corresponds to a single character cell. The C function [wcswidth()] and its implementation in other programming languages is in widespread use for the same purpose. However, there is no standard for the calculation of such widths, and this package differs from wcswidth() in a number of ways, presumably to generate more visually pleasing results. To start, we assume that every code point has a width of 1, with the following exceptions: - Code points with grapheme cluster break properties Control, CR, LF, Extend, and ZWJ have a width of 0. - U+2E3A, Two-Em Dash, has a width of 3. - U+2E3B, Three-Em Dash, has a width of 4. - Characters with the East-Asian Width properties "Fullwidth" (F) and "Wide" (W) have a width of 2. (Properties "Ambiguous" (A) and "Neutral" (N) both have a width of 1.) - Code points with grapheme cluster break property Regional Indicator have a width of 2. - Code points with grapheme cluster break property Extended Pictographic have a width of 2, unless their Emoji Presentation flag is "No", in which case the width is 1. For Hangul grapheme clusters composed of conjoining Jamo and for Regional Indicators (flags), all code points except the first one have a width of 0. For grapheme clusters starting with an Extended Pictographic, any additional code point will force a total width of 2, except if the Variation Selector-15 (U+FE0E) is included, in which case the total width is always 1. Grapheme clusters ending with Variation Selector-16 (U+FE0F) have a width of 2. Note that whether these widths appear correct depends on your application's render engine, to which extent it conforms to the Unicode Standard, and its choice of font. [wcswidth()]: https://man7.org/linux/man-pages/man3/wcswidth.3.html */ package uniseg
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/rivo/uniseg/wordrules.go
vendor/github.com/rivo/uniseg/wordrules.go
package uniseg import "unicode/utf8" // The states of the word break parser. const ( wbAny = iota wbCR wbLF wbNewline wbWSegSpace wbHebrewLetter wbALetter wbWB7 wbWB7c wbNumeric wbWB11 wbKatakana wbExtendNumLet wbOddRI wbEvenRI wbZWJBit = 16 // This bit is set for any states followed by at least one zero-width joiner (see WB4 and WB3c). ) // wbTransitions implements the word break parser's state transitions. It's // anologous to [grTransitions], see comments there for details. // // Unicode version 15.0.0. func wbTransitions(state, prop int) (newState int, wordBreak bool, rule int) { switch uint64(state) | uint64(prop)<<32 { // WB3b. case wbAny | prNewline<<32: return wbNewline, true, 32 case wbAny | prCR<<32: return wbCR, true, 32 case wbAny | prLF<<32: return wbLF, true, 32 // WB3a. case wbNewline | prAny<<32: return wbAny, true, 31 case wbCR | prAny<<32: return wbAny, true, 31 case wbLF | prAny<<32: return wbAny, true, 31 // WB3. case wbCR | prLF<<32: return wbLF, false, 30 // WB3d. case wbAny | prWSegSpace<<32: return wbWSegSpace, true, 9990 case wbWSegSpace | prWSegSpace<<32: return wbWSegSpace, false, 34 // WB5. case wbAny | prALetter<<32: return wbALetter, true, 9990 case wbAny | prHebrewLetter<<32: return wbHebrewLetter, true, 9990 case wbALetter | prALetter<<32: return wbALetter, false, 50 case wbALetter | prHebrewLetter<<32: return wbHebrewLetter, false, 50 case wbHebrewLetter | prALetter<<32: return wbALetter, false, 50 case wbHebrewLetter | prHebrewLetter<<32: return wbHebrewLetter, false, 50 // WB7. Transitions to wbWB7 handled by transitionWordBreakState(). case wbWB7 | prALetter<<32: return wbALetter, false, 70 case wbWB7 | prHebrewLetter<<32: return wbHebrewLetter, false, 70 // WB7a. case wbHebrewLetter | prSingleQuote<<32: return wbAny, false, 71 // WB7c. Transitions to wbWB7c handled by transitionWordBreakState(). case wbWB7c | prHebrewLetter<<32: return wbHebrewLetter, false, 73 // WB8. case wbAny | prNumeric<<32: return wbNumeric, true, 9990 case wbNumeric | prNumeric<<32: return wbNumeric, false, 80 // WB9. case wbALetter | prNumeric<<32: return wbNumeric, false, 90 case wbHebrewLetter | prNumeric<<32: return wbNumeric, false, 90 // WB10. case wbNumeric | prALetter<<32: return wbALetter, false, 100 case wbNumeric | prHebrewLetter<<32: return wbHebrewLetter, false, 100 // WB11. Transitions to wbWB11 handled by transitionWordBreakState(). case wbWB11 | prNumeric<<32: return wbNumeric, false, 110 // WB13. case wbAny | prKatakana<<32: return wbKatakana, true, 9990 case wbKatakana | prKatakana<<32: return wbKatakana, false, 130 // WB13a. case wbAny | prExtendNumLet<<32: return wbExtendNumLet, true, 9990 case wbALetter | prExtendNumLet<<32: return wbExtendNumLet, false, 131 case wbHebrewLetter | prExtendNumLet<<32: return wbExtendNumLet, false, 131 case wbNumeric | prExtendNumLet<<32: return wbExtendNumLet, false, 131 case wbKatakana | prExtendNumLet<<32: return wbExtendNumLet, false, 131 case wbExtendNumLet | prExtendNumLet<<32: return wbExtendNumLet, false, 131 // WB13b. case wbExtendNumLet | prALetter<<32: return wbALetter, false, 132 case wbExtendNumLet | prHebrewLetter<<32: return wbHebrewLetter, false, 132 case wbExtendNumLet | prNumeric<<32: return wbNumeric, false, 132 case wbExtendNumLet | prKatakana<<32: return wbKatakana, false, 132 default: return -1, false, -1 } } // transitionWordBreakState determines the new state of the word break parser // given the current state and the next code point. It also returns whether a // word boundary was detected. If more than one code point is needed to // determine the new state, the byte slice or the string starting after rune "r" // can be used (whichever is not nil or empty) for further lookups. func transitionWordBreakState(state int, r rune, b []byte, str string) (newState int, wordBreak bool) { // Determine the property of the next character. nextProperty := property(workBreakCodePoints, r) // "Replacing Ignore Rules". if nextProperty == prZWJ { // WB4 (for zero-width joiners). if state == wbNewline || state == wbCR || state == wbLF { return wbAny | wbZWJBit, true // Make sure we don't apply WB4 to WB3a. } if state < 0 { return wbAny | wbZWJBit, false } return state | wbZWJBit, false } else if nextProperty == prExtend || nextProperty == prFormat { // WB4 (for Extend and Format). if state == wbNewline || state == wbCR || state == wbLF { return wbAny, true // Make sure we don't apply WB4 to WB3a. } if state == wbWSegSpace || state == wbAny|wbZWJBit { return wbAny, false // We don't break but this is also not WB3d or WB3c. } if state < 0 { return wbAny, false } return state, false } else if nextProperty == prExtendedPictographic && state >= 0 && state&wbZWJBit != 0 { // WB3c. return wbAny, false } if state >= 0 { state = state &^ wbZWJBit } // Find the applicable transition in the table. var rule int newState, wordBreak, rule = wbTransitions(state, nextProperty) if newState < 0 { // No specific transition found. Try the less specific ones. anyPropState, anyPropWordBreak, anyPropRule := wbTransitions(state, prAny) anyStateState, anyStateWordBreak, anyStateRule := wbTransitions(wbAny, nextProperty) if anyPropState >= 0 && anyStateState >= 0 { // Both apply. We'll use a mix (see comments for grTransitions). newState, wordBreak, rule = anyStateState, anyStateWordBreak, anyStateRule if anyPropRule < anyStateRule { wordBreak, rule = anyPropWordBreak, anyPropRule } } else if anyPropState >= 0 { // We only have a specific state. newState, wordBreak, rule = anyPropState, anyPropWordBreak, anyPropRule // This branch will probably never be reached because okAnyState will // always be true given the current transition map. But we keep it here // for future modifications to the transition map where this may not be // true anymore. } else if anyStateState >= 0 { // We only have a specific property. newState, wordBreak, rule = anyStateState, anyStateWordBreak, anyStateRule } else { // No known transition. WB999: Any ÷ Any. newState, wordBreak, rule = wbAny, true, 9990 } } // For those rules that need to look up runes further in the string, we // determine the property after nextProperty, skipping over Format, Extend, // and ZWJ (according to WB4). It's -1 if not needed, if such a rune cannot // be determined (because the text ends or the rune is faulty). farProperty := -1 if rule > 60 && (state == wbALetter || state == wbHebrewLetter || state == wbNumeric) && (nextProperty == prMidLetter || nextProperty == prMidNumLet || nextProperty == prSingleQuote || // WB6. nextProperty == prDoubleQuote || // WB7b. nextProperty == prMidNum) { // WB12. for { var ( r rune length int ) if b != nil { // Byte slice version. r, length = utf8.DecodeRune(b) b = b[length:] } else { // String version. r, length = utf8.DecodeRuneInString(str) str = str[length:] } if r == utf8.RuneError { break } prop := property(workBreakCodePoints, r) if prop == prExtend || prop == prFormat || prop == prZWJ { continue } farProperty = prop break } } // WB6. if rule > 60 && (state == wbALetter || state == wbHebrewLetter) && (nextProperty == prMidLetter || nextProperty == prMidNumLet || nextProperty == prSingleQuote) && (farProperty == prALetter || farProperty == prHebrewLetter) { return wbWB7, false } // WB7b. if rule > 72 && state == wbHebrewLetter && nextProperty == prDoubleQuote && farProperty == prHebrewLetter { return wbWB7c, false } // WB12. if rule > 120 && state == wbNumeric && (nextProperty == prMidNum || nextProperty == prMidNumLet || nextProperty == prSingleQuote) && farProperty == prNumeric { return wbWB11, false } // WB15 and WB16. if newState == wbAny && nextProperty == prRegionalIndicator { if state != wbOddRI && state != wbEvenRI { // Includes state == -1. // Transition into the first RI. return wbOddRI, true } if state == wbOddRI { // Don't break pairs of Regional Indicators. return wbEvenRI, false } return wbOddRI, true // We can break after a pair. } return }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/gcfg/errors.go
vendor/github.com/go-git/gcfg/errors.go
package gcfg import ( "gopkg.in/warnings.v0" ) // FatalOnly filters the results of a Read*Into invocation and returns only // fatal errors. That is, errors (warnings) indicating data for unknown // sections / variables is ignored. Example invocation: // // err := gcfg.FatalOnly(gcfg.ReadFileInto(&cfg, configFile)) // if err != nil { // ... // func FatalOnly(err error) error { return warnings.FatalOnly(err) } func isFatal(err error) bool { _, ok := err.(extraData) return !ok } type extraData struct { section string subsection *string variable *string } func (e extraData) Error() string { s := "can't store data at section \"" + e.section + "\"" if e.subsection != nil { s += ", subsection \"" + *e.subsection + "\"" } if e.variable != nil { s += ", variable \"" + *e.variable + "\"" } return s } var _ error = extraData{}
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/gcfg/read.go
vendor/github.com/go-git/gcfg/read.go
package gcfg import ( "fmt" "io" "os" "strings" "gopkg.in/warnings.v0" "github.com/go-git/gcfg/scanner" "github.com/go-git/gcfg/token" ) var unescape = map[rune]rune{'\\': '\\', '"': '"', 'n': '\n', 't': '\t', 'b': '\b', '\n': '\n'} // no error: invalid literals should be caught by scanner func unquote(s string) string { u, q, esc := make([]rune, 0, len(s)), false, false for _, c := range s { if esc { uc, ok := unescape[c] switch { case ok: u = append(u, uc) fallthrough case !q && c == '\n': esc = false continue } panic("invalid escape sequence") } switch c { case '"': q = !q case '\\': esc = true default: u = append(u, c) } } if q { panic("missing end quote") } if esc { panic("invalid escape sequence") } return string(u) } func read(c *warnings.Collector, callback func(string, string, string, string, bool) error, fset *token.FileSet, file *token.File, src []byte) error { // var s scanner.Scanner var errs scanner.ErrorList s.Init(file, src, func(p token.Position, m string) { errs.Add(p, m) }, 0) sect, sectsub := "", "" pos, tok, lit := s.Scan() errfn := func(msg string) error { return fmt.Errorf("%s: %s", fset.Position(pos), msg) } for { if errs.Len() > 0 { if err := c.Collect(errs.Err()); err != nil { return err } } switch tok { case token.EOF: return nil case token.EOL, token.COMMENT: pos, tok, lit = s.Scan() case token.LBRACK: pos, tok, lit = s.Scan() if errs.Len() > 0 { if err := c.Collect(errs.Err()); err != nil { return err } } if tok != token.IDENT { if err := c.Collect(errfn("expected section name")); err != nil { return err } } sect, sectsub = lit, "" pos, tok, lit = s.Scan() if errs.Len() > 0 { if err := c.Collect(errs.Err()); err != nil { return err } } if tok == token.STRING { sectsub = unquote(lit) if sectsub == "" { if err := c.Collect(errfn("empty subsection name")); err != nil { return err } } pos, tok, lit = s.Scan() if errs.Len() > 0 { if err := c.Collect(errs.Err()); err != nil { return err } } } if tok != token.RBRACK { if sectsub == "" { if err := c.Collect(errfn("expected subsection name or right bracket")); err != nil { return err } } if err := c.Collect(errfn("expected right bracket")); err != nil { return err } } pos, tok, lit = s.Scan() if tok != token.EOL && tok != token.EOF && tok != token.COMMENT { if err := c.Collect(errfn("expected EOL, EOF, or comment")); err != nil { return err } } // If a section/subsection header was found, ensure a // container object is created, even if there are no // variables further down. err := c.Collect(callback(sect, sectsub, "", "", true)) if err != nil { return err } case token.IDENT: if sect == "" { if err := c.Collect(errfn("expected section header")); err != nil { return err } } n := lit pos, tok, lit = s.Scan() if errs.Len() > 0 { return errs.Err() } blank, v := tok == token.EOF || tok == token.EOL || tok == token.COMMENT, "" if !blank { if tok != token.ASSIGN { if err := c.Collect(errfn("expected '='")); err != nil { return err } } pos, tok, lit = s.Scan() if errs.Len() > 0 { if err := c.Collect(errs.Err()); err != nil { return err } } if tok != token.STRING { if err := c.Collect(errfn("expected value")); err != nil { return err } } v = unquote(lit) pos, tok, lit = s.Scan() if errs.Len() > 0 { if err := c.Collect(errs.Err()); err != nil { return err } } if tok != token.EOL && tok != token.EOF && tok != token.COMMENT { if err := c.Collect(errfn("expected EOL, EOF, or comment")); err != nil { return err } } } err := c.Collect(callback(sect, sectsub, n, v, blank)) if err != nil { return err } default: if sect == "" { if err := c.Collect(errfn("expected section header")); err != nil { return err } } if err := c.Collect(errfn("expected section header or variable declaration")); err != nil { return err } } } panic("never reached") } func readInto(config interface{}, fset *token.FileSet, file *token.File, src []byte) error { // c := warnings.NewCollector(isFatal) firstPassCallback := func(s string, ss string, k string, v string, bv bool) error { return set(c, config, s, ss, k, v, bv, false) } err := read(c, firstPassCallback, fset, file, src) if err != nil { return err } secondPassCallback := func(s string, ss string, k string, v string, bv bool) error { return set(c, config, s, ss, k, v, bv, true) } err = read(c, secondPassCallback, fset, file, src) if err != nil { return err } return c.Done() } // ReadWithCallback reads gcfg formatted data from reader and calls // callback with each section and option found. // // Callback is called with section, subsection, option key, option value // and blank value flag as arguments. // // When a section is found, callback is called with nil subsection, option key // and option value. // // When a subsection is found, callback is called with nil option key and // option value. // // If blank value flag is true, it means that the value was not set for an option // (as opposed to set to empty string). // // If callback returns an error, ReadWithCallback terminates with an error too. func ReadWithCallback(reader io.Reader, callback func(string, string, string, string, bool) error) error { src, err := io.ReadAll(reader) if err != nil { return err } fset := token.NewFileSet() file := fset.AddFile("", fset.Base(), len(src)) c := warnings.NewCollector(isFatal) return read(c, callback, fset, file, src) } // ReadInto reads gcfg formatted data from reader and sets the values into the // corresponding fields in config. func ReadInto(config interface{}, reader io.Reader) error { src, err := io.ReadAll(reader) if err != nil { return err } fset := token.NewFileSet() file := fset.AddFile("", fset.Base(), len(src)) return readInto(config, fset, file, src) } // ReadStringInto reads gcfg formatted data from str and sets the values into // the corresponding fields in config. func ReadStringInto(config interface{}, str string) error { r := strings.NewReader(str) return ReadInto(config, r) } // ReadFileInto reads gcfg formatted data from the file filename and sets the // values into the corresponding fields in config. func ReadFileInto(config interface{}, filename string) error { f, err := os.Open(filename) if err != nil { return err } defer f.Close() src, err := io.ReadAll(f) if err != nil { return err } fset := token.NewFileSet() file := fset.AddFile(filename, fset.Base(), len(src)) return readInto(config, fset, file, src) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/gcfg/set.go
vendor/github.com/go-git/gcfg/set.go
package gcfg import ( "bytes" "encoding" "encoding/gob" "fmt" "math/big" "reflect" "strings" "unicode" "unicode/utf8" "gopkg.in/warnings.v0" "github.com/go-git/gcfg/types" ) type tag struct { ident string intMode string } func newTag(ts string) tag { t := tag{} s := strings.Split(ts, ",") t.ident = s[0] for _, tse := range s[1:] { if strings.HasPrefix(tse, "int=") { t.intMode = tse[len("int="):] } } return t } func fieldFold(v reflect.Value, name string) (reflect.Value, tag) { var n string r0, _ := utf8.DecodeRuneInString(name) if unicode.IsLetter(r0) && !unicode.IsLower(r0) && !unicode.IsUpper(r0) { n = "X" } n += strings.Replace(name, "-", "_", -1) f, ok := v.Type().FieldByNameFunc(func(fieldName string) bool { if !v.FieldByName(fieldName).CanSet() { return false } f, _ := v.Type().FieldByName(fieldName) t := newTag(f.Tag.Get("gcfg")) if t.ident != "" { return strings.EqualFold(t.ident, name) } return strings.EqualFold(n, fieldName) }) if !ok { return reflect.Value{}, tag{} } return v.FieldByName(f.Name), newTag(f.Tag.Get("gcfg")) } type setter func(destp interface{}, blank bool, val string, t tag) error var errUnsupportedType = fmt.Errorf("unsupported type") var errBlankUnsupported = fmt.Errorf("blank value not supported for type") var setters = []setter{ typeSetter, textUnmarshalerSetter, kindSetter, scanSetter, } func textUnmarshalerSetter(d interface{}, blank bool, val string, t tag) error { dtu, ok := d.(encoding.TextUnmarshaler) if !ok { return errUnsupportedType } if blank { return errBlankUnsupported } return dtu.UnmarshalText([]byte(val)) } func boolSetter(d interface{}, blank bool, val string, t tag) error { if blank { reflect.ValueOf(d).Elem().Set(reflect.ValueOf(true)) return nil } b, err := types.ParseBool(val) if err == nil { reflect.ValueOf(d).Elem().Set(reflect.ValueOf(b)) } return err } func intMode(mode string) types.IntMode { var m types.IntMode if strings.ContainsAny(mode, "dD") { m |= types.Dec } if strings.ContainsAny(mode, "hH") { m |= types.Hex } if strings.ContainsAny(mode, "oO") { m |= types.Oct } return m } var typeModes = map[reflect.Type]types.IntMode{ reflect.TypeOf(int(0)): types.Dec | types.Hex, reflect.TypeOf(int8(0)): types.Dec | types.Hex, reflect.TypeOf(int16(0)): types.Dec | types.Hex, reflect.TypeOf(int32(0)): types.Dec | types.Hex, reflect.TypeOf(int64(0)): types.Dec | types.Hex, reflect.TypeOf(uint(0)): types.Dec | types.Hex, reflect.TypeOf(uint8(0)): types.Dec | types.Hex, reflect.TypeOf(uint16(0)): types.Dec | types.Hex, reflect.TypeOf(uint32(0)): types.Dec | types.Hex, reflect.TypeOf(uint64(0)): types.Dec | types.Hex, // use default mode (allow dec/hex/oct) for uintptr type reflect.TypeOf(big.Int{}): types.Dec | types.Hex, } func intModeDefault(t reflect.Type) types.IntMode { m, ok := typeModes[t] if !ok { m = types.Dec | types.Hex | types.Oct } return m } func intSetter(d interface{}, blank bool, val string, t tag) error { if blank { return errBlankUnsupported } mode := intMode(t.intMode) if mode == 0 { mode = intModeDefault(reflect.TypeOf(d).Elem()) } return types.ParseInt(d, val, mode) } func stringSetter(d interface{}, blank bool, val string, t tag) error { if blank { return errBlankUnsupported } dsp, ok := d.(*string) if !ok { return errUnsupportedType } *dsp = val return nil } var kindSetters = map[reflect.Kind]setter{ reflect.String: stringSetter, reflect.Bool: boolSetter, reflect.Int: intSetter, reflect.Int8: intSetter, reflect.Int16: intSetter, reflect.Int32: intSetter, reflect.Int64: intSetter, reflect.Uint: intSetter, reflect.Uint8: intSetter, reflect.Uint16: intSetter, reflect.Uint32: intSetter, reflect.Uint64: intSetter, reflect.Uintptr: intSetter, } var typeSetters = map[reflect.Type]setter{ reflect.TypeOf(big.Int{}): intSetter, } func typeSetter(d interface{}, blank bool, val string, tt tag) error { t := reflect.ValueOf(d).Type().Elem() setter, ok := typeSetters[t] if !ok { return errUnsupportedType } return setter(d, blank, val, tt) } func kindSetter(d interface{}, blank bool, val string, tt tag) error { k := reflect.ValueOf(d).Type().Elem().Kind() setter, ok := kindSetters[k] if !ok { return errUnsupportedType } return setter(d, blank, val, tt) } func scanSetter(d interface{}, blank bool, val string, tt tag) error { if blank { return errBlankUnsupported } return types.ScanFully(d, val, 'v') } func newValue(c *warnings.Collector, sect string, vCfg reflect.Value, vType reflect.Type) (reflect.Value, error) { // pv := reflect.New(vType) dfltName := "default-" + sect dfltField, _ := fieldFold(vCfg, dfltName) var err error if dfltField.IsValid() { b := bytes.NewBuffer(nil) ge := gob.NewEncoder(b) if err = c.Collect(ge.EncodeValue(dfltField)); err != nil { return pv, err } gd := gob.NewDecoder(bytes.NewReader(b.Bytes())) if err = c.Collect(gd.DecodeValue(pv.Elem())); err != nil { return pv, err } } return pv, nil } func set(c *warnings.Collector, cfg interface{}, sect, sub, name string, value string, blankValue bool, subsectPass bool) error { // vPCfg := reflect.ValueOf(cfg) if vPCfg.Kind() != reflect.Ptr || vPCfg.Elem().Kind() != reflect.Struct { panic(fmt.Errorf("config must be a pointer to a struct")) } vCfg := vPCfg.Elem() vSect, _ := fieldFold(vCfg, sect) if !vSect.IsValid() { err := extraData{section: sect} return c.Collect(err) } isSubsect := vSect.Kind() == reflect.Map if subsectPass != isSubsect { return nil } if isSubsect { vst := vSect.Type() if vst.Key().Kind() != reflect.String || vst.Elem().Kind() != reflect.Ptr || vst.Elem().Elem().Kind() != reflect.Struct { panic(fmt.Errorf("map field for section must have string keys and "+ " pointer-to-struct values: section %q", sect)) } if vSect.IsNil() { vSect.Set(reflect.MakeMap(vst)) } k := reflect.ValueOf(sub) pv := vSect.MapIndex(k) if !pv.IsValid() { vType := vSect.Type().Elem().Elem() var err error if pv, err = newValue(c, sect, vCfg, vType); err != nil { return err } vSect.SetMapIndex(k, pv) } vSect = pv.Elem() } else if vSect.Kind() != reflect.Struct { panic(fmt.Errorf("field for section must be a map or a struct: "+ "section %q", sect)) } else if sub != "" { err := extraData{section: sect, subsection: &sub} return c.Collect(err) } // Empty name is a special value, meaning that only the // section/subsection object is to be created, with no values set. if name == "" { return nil } vVar, t := fieldFold(vSect, name) if !vVar.IsValid() { var err error if isSubsect { err = extraData{section: sect, subsection: &sub, variable: &name} } else { err = extraData{section: sect, variable: &name} } return c.Collect(err) } // vVal is either single-valued var, or newly allocated value within multi-valued var var vVal reflect.Value // multi-value if unnamed slice type isMulti := vVar.Type().Name() == "" && vVar.Kind() == reflect.Slice || vVar.Type().Name() == "" && vVar.Kind() == reflect.Ptr && vVar.Type().Elem().Name() == "" && vVar.Type().Elem().Kind() == reflect.Slice if isMulti && vVar.Kind() == reflect.Ptr { if vVar.IsNil() { vVar.Set(reflect.New(vVar.Type().Elem())) } vVar = vVar.Elem() } if isMulti && blankValue { vVar.Set(reflect.Zero(vVar.Type())) return nil } if isMulti { vVal = reflect.New(vVar.Type().Elem()).Elem() } else { vVal = vVar } isDeref := vVal.Type().Name() == "" && vVal.Type().Kind() == reflect.Ptr isNew := isDeref && vVal.IsNil() // vAddr is address of value to set (dereferenced & allocated as needed) var vAddr reflect.Value switch { case isNew: vAddr = reflect.New(vVal.Type().Elem()) case isDeref && !isNew: vAddr = vVal default: vAddr = vVal.Addr() } vAddrI := vAddr.Interface() err, ok := error(nil), false for _, s := range setters { err = s(vAddrI, blankValue, value, t) if err == nil { ok = true break } if err != errUnsupportedType { return err } } if !ok { // in case all setters returned errUnsupportedType return err } if isNew { // set reference if it was dereferenced and newly allocated vVal.Set(vAddr) } if isMulti { // append if multi-valued vVar.Set(reflect.Append(vVar, vVal)) } return nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/gcfg/doc.go
vendor/github.com/go-git/gcfg/doc.go
// Package gcfg reads "INI-style" text-based configuration files with // "name=value" pairs grouped into sections (gcfg files). // // This package is still a work in progress; see the sections below for planned // changes. // // Syntax // // The syntax is based on that used by git config: // http://git-scm.com/docs/git-config#_syntax . // There are some (planned) differences compared to the git config format: // - improve data portability: // - must be encoded in UTF-8 (for now) and must not contain the 0 byte // - include and "path" type is not supported // (path type may be implementable as a user-defined type) // - internationalization // - section and variable names can contain unicode letters, unicode digits // (as defined in http://golang.org/ref/spec#Characters ) and hyphens // (U+002D), starting with a unicode letter // - disallow potentially ambiguous or misleading definitions: // - `[sec.sub]` format is not allowed (deprecated in gitconfig) // - `[sec ""]` is not allowed // - use `[sec]` for section name "sec" and empty subsection name // - (planned) within a single file, definitions must be contiguous for each: // - section: '[secA]' -> '[secB]' -> '[secA]' is an error // - subsection: '[sec "A"]' -> '[sec "B"]' -> '[sec "A"]' is an error // - multivalued variable: 'multi=a' -> 'other=x' -> 'multi=b' is an error // // Data structure // // The functions in this package read values into a user-defined struct. // Each section corresponds to a struct field in the config struct, and each // variable in a section corresponds to a data field in the section struct. // The mapping of each section or variable name to fields is done either based // on the "gcfg" struct tag or by matching the name of the section or variable, // ignoring case. In the latter case, hyphens '-' in section and variable names // correspond to underscores '_' in field names. // Fields must be exported; to use a section or variable name starting with a // letter that is neither upper- or lower-case, prefix the field name with 'X'. // (See https://code.google.com/p/go/issues/detail?id=5763#c4 .) // // For sections with subsections, the corresponding field in config must be a // map, rather than a struct, with string keys and pointer-to-struct values. // Values for subsection variables are stored in the map with the subsection // name used as the map key. // (Note that unlike section and variable names, subsection names are case // sensitive.) // When using a map, and there is a section with the same section name but // without a subsection name, its values are stored with the empty string used // as the key. // It is possible to provide default values for subsections in the section // "default-<sectionname>" (or by setting values in the corresponding struct // field "Default_<sectionname>"). // // The functions in this package panic if config is not a pointer to a struct, // or when a field is not of a suitable type (either a struct or a map with // string keys and pointer-to-struct values). // // Parsing of values // // The section structs in the config struct may contain single-valued or // multi-valued variables. Variables of unnamed slice type (that is, a type // starting with `[]`) are treated as multi-value; all others (including named // slice types) are treated as single-valued variables. // // Single-valued variables are handled based on the type as follows. // Unnamed pointer types (that is, types starting with `*`) are dereferenced, // and if necessary, a new instance is allocated. // // For types implementing the encoding.TextUnmarshaler interface, the // UnmarshalText method is used to set the value. Implementing this method is // the recommended way for parsing user-defined types. // // For fields of string kind, the value string is assigned to the field, after // unquoting and unescaping as needed. // For fields of bool kind, the field is set to true if the value is "true", // "yes", "on" or "1", and set to false if the value is "false", "no", "off" or // "0", ignoring case. In addition, single-valued bool fields can be specified // with a "blank" value (variable name without equals sign and value); in such // case the value is set to true. // // Predefined integer types [u]int(|8|16|32|64) and big.Int are parsed as // decimal or hexadecimal (if having '0x' prefix). (This is to prevent // unintuitively handling zero-padded numbers as octal.) Other types having // [u]int* as the underlying type, such as os.FileMode and uintptr allow // decimal, hexadecimal, or octal values. // Parsing mode for integer types can be overridden using the struct tag option // ",int=mode" where mode is a combination of the 'd', 'h', and 'o' characters // (each standing for decimal, hexadecimal, and octal, respectively.) // // All other types are parsed using fmt.Sscanf with the "%v" verb. // // For multi-valued variables, each individual value is parsed as above and // appended to the slice. If the first value is specified as a "blank" value // (variable name without equals sign and value), a new slice is allocated; // that is any values previously set in the slice will be ignored. // // The types subpackage for provides helpers for parsing "enum-like" and integer // types. // // Error handling // // There are 3 types of errors: // // - programmer errors / panics: // - invalid configuration structure // - data errors: // - fatal errors: // - invalid configuration syntax // - warnings: // - data that doesn't belong to any part of the config structure // // Programmer errors trigger panics. These are should be fixed by the programmer // before releasing code that uses gcfg. // // Data errors cause gcfg to return a non-nil error value. This includes the // case when there are extra unknown key-value definitions in the configuration // data (extra data). // However, in some occasions it is desirable to be able to proceed in // situations when the only data error is that of extra data. // These errors are handled at a different (warning) priority and can be // filtered out programmatically. To ignore extra data warnings, wrap the // gcfg.Read*Into invocation into a call to gcfg.FatalOnly. // // TODO // // The following is a list of changes under consideration: // - documentation // - self-contained syntax documentation // - more practical examples // - move TODOs to issue tracker (eventually) // - syntax // - reconsider valid escape sequences // (gitconfig doesn't support \r in value, \t in subsection name, etc.) // - reading / parsing gcfg files // - define internal representation structure // - support multiple inputs (readers, strings, files) // - support declaring encoding (?) // - support varying fields sets for subsections (?) // - writing gcfg files // - error handling // - make error context accessible programmatically? // - limit input size? // package gcfg // import "github.com/go-git/gcfg"
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/gcfg/scanner/errors.go
vendor/github.com/go-git/gcfg/scanner/errors.go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package scanner import ( "fmt" "io" "sort" ) import ( "github.com/go-git/gcfg/token" ) // In an ErrorList, an error is represented by an *Error. // The position Pos, if valid, points to the beginning of // the offending token, and the error condition is described // by Msg. // type Error struct { Pos token.Position Msg string } // Error implements the error interface. func (e Error) Error() string { if e.Pos.Filename != "" || e.Pos.IsValid() { // don't print "<unknown position>" // TODO(gri) reconsider the semantics of Position.IsValid return e.Pos.String() + ": " + e.Msg } return e.Msg } // ErrorList is a list of *Errors. // The zero value for an ErrorList is an empty ErrorList ready to use. // type ErrorList []*Error // Add adds an Error with given position and error message to an ErrorList. func (p *ErrorList) Add(pos token.Position, msg string) { *p = append(*p, &Error{pos, msg}) } // Reset resets an ErrorList to no errors. func (p *ErrorList) Reset() { *p = (*p)[0:0] } // ErrorList implements the sort Interface. func (p ErrorList) Len() int { return len(p) } func (p ErrorList) Swap(i, j int) { p[i], p[j] = p[j], p[i] } func (p ErrorList) Less(i, j int) bool { e := &p[i].Pos f := &p[j].Pos if e.Filename < f.Filename { return true } if e.Filename == f.Filename { return e.Offset < f.Offset } return false } // Sort sorts an ErrorList. *Error entries are sorted by position, // other errors are sorted by error message, and before any *Error // entry. // func (p ErrorList) Sort() { sort.Sort(p) } // RemoveMultiples sorts an ErrorList and removes all but the first error per line. func (p *ErrorList) RemoveMultiples() { sort.Sort(p) var last token.Position // initial last.Line is != any legal error line i := 0 for _, e := range *p { if e.Pos.Filename != last.Filename || e.Pos.Line != last.Line { last = e.Pos (*p)[i] = e i++ } } (*p) = (*p)[0:i] } // An ErrorList implements the error interface. func (p ErrorList) Error() string { switch len(p) { case 0: return "no errors" case 1: return p[0].Error() } return fmt.Sprintf("%s (and %d more errors)", p[0], len(p)-1) } // Err returns an error equivalent to this error list. // If the list is empty, Err returns nil. func (p ErrorList) Err() error { if len(p) == 0 { return nil } return p } // PrintError is a utility function that prints a list of errors to w, // one error per line, if the err parameter is an ErrorList. Otherwise // it prints the err string. // func PrintError(w io.Writer, err error) { if list, ok := err.(ErrorList); ok { for _, e := range list { fmt.Fprintf(w, "%s\n", e) } } else if err != nil { fmt.Fprintf(w, "%s\n", err) } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/gcfg/scanner/scanner.go
vendor/github.com/go-git/gcfg/scanner/scanner.go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package scanner implements a scanner for gcfg configuration text. // It takes a []byte as source which can then be tokenized // through repeated calls to the Scan method. // // Note that the API for the scanner package may change to accommodate new // features or implementation changes in gcfg. package scanner import ( "fmt" "path/filepath" "unicode" "unicode/utf8" "github.com/go-git/gcfg/token" ) // An ErrorHandler may be provided to Scanner.Init. If a syntax error is // encountered and a handler was installed, the handler is called with a // position and an error message. The position points to the beginning of // the offending token. type ErrorHandler func(pos token.Position, msg string) // A Scanner holds the scanner's internal state while processing // a given text. It can be allocated as part of another data // structure but must be initialized via Init before use. type Scanner struct { // immutable state file *token.File // source file handle dir string // directory portion of file.Name() src []byte // source err ErrorHandler // error reporting; or nil mode Mode // scanning mode // scanning state ch rune // current character offset int // character offset rdOffset int // reading offset (position after current character) lineOffset int // current line offset nextVal bool // next token is expected to be a value // public state - ok to modify ErrorCount int // number of errors encountered } // Read the next Unicode char into s.ch. // s.ch < 0 means end-of-file. func (s *Scanner) next() { if s.rdOffset < len(s.src) { s.offset = s.rdOffset if s.ch == '\n' { s.lineOffset = s.offset s.file.AddLine(s.offset) } r, w := rune(s.src[s.rdOffset]), 1 switch { case r == 0: s.error(s.offset, "illegal character NUL") case r >= 0x80: // not ASCII r, w = utf8.DecodeRune(s.src[s.rdOffset:]) if r == utf8.RuneError && w == 1 { s.error(s.offset, "illegal UTF-8 encoding") } } s.rdOffset += w s.ch = r } else { s.offset = len(s.src) if s.ch == '\n' { s.lineOffset = s.offset s.file.AddLine(s.offset) } s.ch = -1 // eof } } // A mode value is a set of flags (or 0). // They control scanner behavior. type Mode uint const ( ScanComments Mode = 1 << iota // return comments as COMMENT tokens ) // Init prepares the scanner s to tokenize the text src by setting the // scanner at the beginning of src. The scanner uses the file set file // for position information and it adds line information for each line. // It is ok to re-use the same file when re-scanning the same file as // line information which is already present is ignored. Init causes a // panic if the file size does not match the src size. // // Calls to Scan will invoke the error handler err if they encounter a // syntax error and err is not nil. Also, for each error encountered, // the Scanner field ErrorCount is incremented by one. The mode parameter // determines how comments are handled. // // Note that Init may call err if there is an error in the first character // of the file. func (s *Scanner) Init(file *token.File, src []byte, err ErrorHandler, mode Mode) { // Explicitly initialize all fields since a scanner may be reused. if file.Size() != len(src) { panic(fmt.Sprintf("file size (%d) does not match src len (%d)", file.Size(), len(src))) } s.file = file s.dir, _ = filepath.Split(file.Name()) s.src = src s.err = err s.mode = mode s.ch = ' ' s.offset = 0 s.rdOffset = 0 s.lineOffset = 0 s.ErrorCount = 0 s.nextVal = false s.next() } func (s *Scanner) error(offs int, msg string) { if s.err != nil { s.err(s.file.Position(s.file.Pos(offs)), msg) } s.ErrorCount++ } func (s *Scanner) scanComment() string { // initial [;#] already consumed offs := s.offset - 1 // position of initial [;#] for s.ch != '\n' && s.ch >= 0 { s.next() } return string(s.src[offs:s.offset]) } func isLetter(ch rune) bool { return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch >= 0x80 && unicode.IsLetter(ch) } func isDigit(ch rune) bool { return '0' <= ch && ch <= '9' || ch >= 0x80 && unicode.IsDigit(ch) } func (s *Scanner) scanIdentifier() string { offs := s.offset for isLetter(s.ch) || isDigit(s.ch) || s.ch == '-' { s.next() } return string(s.src[offs:s.offset]) } // val indicate if we are scanning a value (vs a header) func (s *Scanner) scanEscape(val bool) { offs := s.offset ch := s.ch s.next() // always make progress switch ch { case '\\', '"', '\n': // ok case 'n', 't', 'b': if val { break // ok } fallthrough default: s.error(offs, "unknown escape sequence") } } func (s *Scanner) scanString() string { // '"' opening already consumed offs := s.offset - 1 for s.ch != '"' { ch := s.ch s.next() if ch == '\n' || ch < 0 { s.error(offs, "string not terminated") break } if ch == '\\' { s.scanEscape(false) } } s.next() return string(s.src[offs:s.offset]) } func stripCR(b []byte) []byte { c := make([]byte, len(b)) i := 0 for _, ch := range b { if ch != '\r' { c[i] = ch i++ } } return c[:i] } func (s *Scanner) scanValString() string { offs := s.offset hasCR := false end := offs inQuote := false loop: for inQuote || s.ch >= 0 && s.ch != '\n' && s.ch != ';' && s.ch != '#' { ch := s.ch s.next() switch { case inQuote && ch == '\\': s.scanEscape(true) case !inQuote && ch == '\\': if s.ch == '\r' { hasCR = true s.next() } if s.ch != '\n' { s.scanEscape(true) } else { s.next() } case ch == '"': inQuote = !inQuote case ch == '\r': hasCR = true case ch < 0 || inQuote && ch == '\n': s.error(offs, "string not terminated") break loop } if inQuote || !isWhiteSpace(ch) { end = s.offset } } lit := s.src[offs:end] if hasCR { lit = stripCR(lit) } return string(lit) } func isWhiteSpace(ch rune) bool { return ch == ' ' || ch == '\t' || ch == '\r' } func (s *Scanner) skipWhitespace() { for isWhiteSpace(s.ch) { s.next() } } // Scan scans the next token and returns the token position, the token, // and its literal string if applicable. The source end is indicated by // token.EOF. // // If the returned token is a literal (token.IDENT, token.STRING) or // token.COMMENT, the literal string has the corresponding value. // // If the returned token is token.ILLEGAL, the literal string is the // offending character. // // In all other cases, Scan returns an empty literal string. // // For more tolerant parsing, Scan will return a valid token if // possible even if a syntax error was encountered. Thus, even // if the resulting token sequence contains no illegal tokens, // a client may not assume that no error occurred. Instead it // must check the scanner's ErrorCount or the number of calls // of the error handler, if there was one installed. // // Scan adds line information to the file added to the file // set with Init. Token positions are relative to that file // and thus relative to the file set. func (s *Scanner) Scan() (pos token.Pos, tok token.Token, lit string) { scanAgain: s.skipWhitespace() // current token start pos = s.file.Pos(s.offset) // determine token value switch ch := s.ch; { case s.nextVal: lit = s.scanValString() tok = token.STRING s.nextVal = false case isLetter(ch): lit = s.scanIdentifier() tok = token.IDENT default: s.next() // always make progress switch ch { case -1: tok = token.EOF case '\n': tok = token.EOL case '"': tok = token.STRING lit = s.scanString() case '[': tok = token.LBRACK case ']': tok = token.RBRACK case ';', '#': // comment lit = s.scanComment() if s.mode&ScanComments == 0 { // skip comment goto scanAgain } tok = token.COMMENT case '=': tok = token.ASSIGN s.nextVal = true default: s.error(s.file.Offset(pos), fmt.Sprintf("illegal character %#U", ch)) tok = token.ILLEGAL lit = string(ch) } } return }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/gcfg/types/bool.go
vendor/github.com/go-git/gcfg/types/bool.go
package types // BoolValues defines the name and value mappings for ParseBool. var BoolValues = map[string]interface{}{ "true": true, "yes": true, "on": true, "1": true, "false": false, "no": false, "off": false, "0": false, } var boolParser = func() *EnumParser { ep := &EnumParser{} ep.AddVals(BoolValues) return ep }() // ParseBool parses bool values according to the definitions in BoolValues. // Parsing is case-insensitive. func ParseBool(s string) (bool, error) { v, err := boolParser.Parse(s) if err != nil { return false, err } return v.(bool), nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/gcfg/types/scan.go
vendor/github.com/go-git/gcfg/types/scan.go
package types import ( "fmt" "io" "reflect" ) // ScanFully uses fmt.Sscanf with verb to fully scan val into ptr. func ScanFully(ptr interface{}, val string, verb byte) error { t := reflect.ValueOf(ptr).Elem().Type() // attempt to read extra bytes to make sure the value is consumed var b []byte n, err := fmt.Sscanf(val, "%"+string(verb)+"%s", ptr, &b) switch { case n < 1 || n == 1 && err != io.EOF: return fmt.Errorf("failed to parse %q as %v: %v", val, t, err) case n > 1: return fmt.Errorf("failed to parse %q as %v: extra characters %q", val, t, string(b)) } // n == 1 && err == io.EOF return nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/gcfg/types/int.go
vendor/github.com/go-git/gcfg/types/int.go
package types import ( "fmt" "strings" ) // An IntMode is a mode for parsing integer values, representing a set of // accepted bases. type IntMode uint8 // IntMode values for ParseInt; can be combined using binary or. const ( Dec IntMode = 1 << iota Hex Oct ) // String returns a string representation of IntMode; e.g. `IntMode(Dec|Hex)`. func (m IntMode) String() string { var modes []string if m&Dec != 0 { modes = append(modes, "Dec") } if m&Hex != 0 { modes = append(modes, "Hex") } if m&Oct != 0 { modes = append(modes, "Oct") } return "IntMode(" + strings.Join(modes, "|") + ")" } var errIntAmbig = fmt.Errorf("ambiguous integer value; must include '0' prefix") func prefix0(val string) bool { return strings.HasPrefix(val, "0") || strings.HasPrefix(val, "-0") } func prefix0x(val string) bool { return strings.HasPrefix(val, "0x") || strings.HasPrefix(val, "-0x") } // ParseInt parses val using mode into intptr, which must be a pointer to an // integer kind type. Non-decimal value require prefix `0` or `0x` in the cases // when mode permits ambiguity of base; otherwise the prefix can be omitted. func ParseInt(intptr interface{}, val string, mode IntMode) error { val = strings.TrimSpace(val) verb := byte(0) switch mode { case Dec: verb = 'd' case Dec + Hex: if prefix0x(val) { verb = 'v' } else { verb = 'd' } case Dec + Oct: if prefix0(val) && !prefix0x(val) { verb = 'v' } else { verb = 'd' } case Dec + Hex + Oct: verb = 'v' case Hex: if prefix0x(val) { verb = 'v' } else { verb = 'x' } case Oct: verb = 'o' case Hex + Oct: if prefix0(val) { verb = 'v' } else { return errIntAmbig } } if verb == 0 { panic("unsupported mode") } return ScanFully(intptr, val, verb) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/gcfg/types/enum.go
vendor/github.com/go-git/gcfg/types/enum.go
package types import ( "fmt" "reflect" "strings" ) // EnumParser parses "enum" values; i.e. a predefined set of strings to // predefined values. type EnumParser struct { Type string // type name; if not set, use type of first value added CaseMatch bool // if true, matching of strings is case-sensitive // PrefixMatch bool vals map[string]interface{} } // AddVals adds strings and values to an EnumParser. func (ep *EnumParser) AddVals(vals map[string]interface{}) { if ep.vals == nil { ep.vals = make(map[string]interface{}) } for k, v := range vals { if ep.Type == "" { ep.Type = reflect.TypeOf(v).Name() } if !ep.CaseMatch { k = strings.ToLower(k) } ep.vals[k] = v } } // Parse parses the string and returns the value or an error. func (ep EnumParser) Parse(s string) (interface{}, error) { if !ep.CaseMatch { s = strings.ToLower(s) } v, ok := ep.vals[s] if !ok { return false, fmt.Errorf("failed to parse %s %#q", ep.Type, s) } return v, nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/gcfg/types/doc.go
vendor/github.com/go-git/gcfg/types/doc.go
// Package types defines helpers for type conversions. // // The API for this package is not finalized yet. package types
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/gcfg/token/token.go
vendor/github.com/go-git/gcfg/token/token.go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package token defines constants representing the lexical tokens of the gcfg // configuration syntax and basic operations on tokens (printing, predicates). // // Note that the API for the token package may change to accommodate new // features or implementation changes in gcfg. // package token import "strconv" // Token is the set of lexical tokens of the gcfg configuration syntax. type Token int // The list of tokens. const ( // Special tokens ILLEGAL Token = iota EOF COMMENT literal_beg // Identifiers and basic type literals // (these tokens stand for classes of literals) IDENT // section-name, variable-name STRING // "subsection-name", variable value literal_end operator_beg // Operators and delimiters ASSIGN // = LBRACK // [ RBRACK // ] EOL // \n operator_end ) var tokens = [...]string{ ILLEGAL: "ILLEGAL", EOF: "EOF", COMMENT: "COMMENT", IDENT: "IDENT", STRING: "STRING", ASSIGN: "=", LBRACK: "[", RBRACK: "]", EOL: "\n", } // String returns the string corresponding to the token tok. // For operators and delimiters, the string is the actual token character // sequence (e.g., for the token ASSIGN, the string is "="). For all other // tokens the string corresponds to the token constant name (e.g. for the // token IDENT, the string is "IDENT"). // func (tok Token) String() string { s := "" if 0 <= tok && tok < Token(len(tokens)) { s = tokens[tok] } if s == "" { s = "token(" + strconv.Itoa(int(tok)) + ")" } return s } // Predicates // IsLiteral returns true for tokens corresponding to identifiers // and basic type literals; it returns false otherwise. // func (tok Token) IsLiteral() bool { return literal_beg < tok && tok < literal_end } // IsOperator returns true for tokens corresponding to operators and // delimiters; it returns false otherwise. // func (tok Token) IsOperator() bool { return operator_beg < tok && tok < operator_end }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/gcfg/token/position.go
vendor/github.com/go-git/gcfg/token/position.go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // TODO(gri) consider making this a separate package outside the go directory. package token import ( "fmt" "sort" "sync" ) // ----------------------------------------------------------------------------- // Positions // Position describes an arbitrary source position // including the file, line, and column location. // A Position is valid if the line number is > 0. // type Position struct { Filename string // filename, if any Offset int // offset, starting at 0 Line int // line number, starting at 1 Column int // column number, starting at 1 (character count) } // IsValid returns true if the position is valid. func (pos *Position) IsValid() bool { return pos.Line > 0 } // String returns a string in one of several forms: // // file:line:column valid position with file name // line:column valid position without file name // file invalid position with file name // - invalid position without file name // func (pos Position) String() string { s := pos.Filename if pos.IsValid() { if s != "" { s += ":" } s += fmt.Sprintf("%d:%d", pos.Line, pos.Column) } if s == "" { s = "-" } return s } // Pos is a compact encoding of a source position within a file set. // It can be converted into a Position for a more convenient, but much // larger, representation. // // The Pos value for a given file is a number in the range [base, base+size], // where base and size are specified when adding the file to the file set via // AddFile. // // To create the Pos value for a specific source offset, first add // the respective file to the current file set (via FileSet.AddFile) // and then call File.Pos(offset) for that file. Given a Pos value p // for a specific file set fset, the corresponding Position value is // obtained by calling fset.Position(p). // // Pos values can be compared directly with the usual comparison operators: // If two Pos values p and q are in the same file, comparing p and q is // equivalent to comparing the respective source file offsets. If p and q // are in different files, p < q is true if the file implied by p was added // to the respective file set before the file implied by q. // type Pos int // The zero value for Pos is NoPos; there is no file and line information // associated with it, and NoPos().IsValid() is false. NoPos is always // smaller than any other Pos value. The corresponding Position value // for NoPos is the zero value for Position. // const NoPos Pos = 0 // IsValid returns true if the position is valid. func (p Pos) IsValid() bool { return p != NoPos } // ----------------------------------------------------------------------------- // File // A File is a handle for a file belonging to a FileSet. // A File has a name, size, and line offset table. // type File struct { set *FileSet name string // file name as provided to AddFile base int // Pos value range for this file is [base...base+size] size int // file size as provided to AddFile // lines and infos are protected by set.mutex lines []int infos []lineInfo } // Name returns the file name of file f as registered with AddFile. func (f *File) Name() string { return f.name } // Base returns the base offset of file f as registered with AddFile. func (f *File) Base() int { return f.base } // Size returns the size of file f as registered with AddFile. func (f *File) Size() int { return f.size } // LineCount returns the number of lines in file f. func (f *File) LineCount() int { f.set.mutex.RLock() n := len(f.lines) f.set.mutex.RUnlock() return n } // AddLine adds the line offset for a new line. // The line offset must be larger than the offset for the previous line // and smaller than the file size; otherwise the line offset is ignored. // func (f *File) AddLine(offset int) { f.set.mutex.Lock() if i := len(f.lines); (i == 0 || f.lines[i-1] < offset) && offset < f.size { f.lines = append(f.lines, offset) } f.set.mutex.Unlock() } // SetLines sets the line offsets for a file and returns true if successful. // The line offsets are the offsets of the first character of each line; // for instance for the content "ab\nc\n" the line offsets are {0, 3}. // An empty file has an empty line offset table. // Each line offset must be larger than the offset for the previous line // and smaller than the file size; otherwise SetLines fails and returns // false. // func (f *File) SetLines(lines []int) bool { // verify validity of lines table size := f.size for i, offset := range lines { if i > 0 && offset <= lines[i-1] || size <= offset { return false } } // set lines table f.set.mutex.Lock() f.lines = lines f.set.mutex.Unlock() return true } // SetLinesForContent sets the line offsets for the given file content. func (f *File) SetLinesForContent(content []byte) { var lines []int line := 0 for offset, b := range content { if line >= 0 { lines = append(lines, line) } line = -1 if b == '\n' { line = offset + 1 } } // set lines table f.set.mutex.Lock() f.lines = lines f.set.mutex.Unlock() } // A lineInfo object describes alternative file and line number // information (such as provided via a //line comment in a .go // file) for a given file offset. type lineInfo struct { // fields are exported to make them accessible to gob Offset int Filename string Line int } // AddLineInfo adds alternative file and line number information for // a given file offset. The offset must be larger than the offset for // the previously added alternative line info and smaller than the // file size; otherwise the information is ignored. // // AddLineInfo is typically used to register alternative position // information for //line filename:line comments in source files. // func (f *File) AddLineInfo(offset int, filename string, line int) { f.set.mutex.Lock() if i := len(f.infos); i == 0 || f.infos[i-1].Offset < offset && offset < f.size { f.infos = append(f.infos, lineInfo{offset, filename, line}) } f.set.mutex.Unlock() } // Pos returns the Pos value for the given file offset; // the offset must be <= f.Size(). // f.Pos(f.Offset(p)) == p. // func (f *File) Pos(offset int) Pos { if offset > f.size { panic("illegal file offset") } return Pos(f.base + offset) } // Offset returns the offset for the given file position p; // p must be a valid Pos value in that file. // f.Offset(f.Pos(offset)) == offset. // func (f *File) Offset(p Pos) int { if int(p) < f.base || int(p) > f.base+f.size { panic("illegal Pos value") } return int(p) - f.base } // Line returns the line number for the given file position p; // p must be a Pos value in that file or NoPos. // func (f *File) Line(p Pos) int { // TODO(gri) this can be implemented much more efficiently return f.Position(p).Line } func searchLineInfos(a []lineInfo, x int) int { return sort.Search(len(a), func(i int) bool { return a[i].Offset > x }) - 1 } // info returns the file name, line, and column number for a file offset. func (f *File) info(offset int) (filename string, line, column int) { filename = f.name if i := searchInts(f.lines, offset); i >= 0 { line, column = i+1, offset-f.lines[i]+1 } if len(f.infos) > 0 { // almost no files have extra line infos if i := searchLineInfos(f.infos, offset); i >= 0 { alt := &f.infos[i] filename = alt.Filename if i := searchInts(f.lines, alt.Offset); i >= 0 { line += alt.Line - i - 1 } } } return } func (f *File) position(p Pos) (pos Position) { offset := int(p) - f.base pos.Offset = offset pos.Filename, pos.Line, pos.Column = f.info(offset) return } // Position returns the Position value for the given file position p; // p must be a Pos value in that file or NoPos. // func (f *File) Position(p Pos) (pos Position) { if p != NoPos { if int(p) < f.base || int(p) > f.base+f.size { panic("illegal Pos value") } pos = f.position(p) } return } // ----------------------------------------------------------------------------- // FileSet // A FileSet represents a set of source files. // Methods of file sets are synchronized; multiple goroutines // may invoke them concurrently. // type FileSet struct { mutex sync.RWMutex // protects the file set base int // base offset for the next file files []*File // list of files in the order added to the set last *File // cache of last file looked up } // NewFileSet creates a new file set. func NewFileSet() *FileSet { s := new(FileSet) s.base = 1 // 0 == NoPos return s } // Base returns the minimum base offset that must be provided to // AddFile when adding the next file. // func (s *FileSet) Base() int { s.mutex.RLock() b := s.base s.mutex.RUnlock() return b } // AddFile adds a new file with a given filename, base offset, and file size // to the file set s and returns the file. Multiple files may have the same // name. The base offset must not be smaller than the FileSet's Base(), and // size must not be negative. // // Adding the file will set the file set's Base() value to base + size + 1 // as the minimum base value for the next file. The following relationship // exists between a Pos value p for a given file offset offs: // // int(p) = base + offs // // with offs in the range [0, size] and thus p in the range [base, base+size]. // For convenience, File.Pos may be used to create file-specific position // values from a file offset. // func (s *FileSet) AddFile(filename string, base, size int) *File { s.mutex.Lock() defer s.mutex.Unlock() if base < s.base || size < 0 { panic("illegal base or size") } // base >= s.base && size >= 0 f := &File{s, filename, base, size, []int{0}, nil} base += size + 1 // +1 because EOF also has a position if base < 0 { panic("token.Pos offset overflow (> 2G of source code in file set)") } // add the file to the file set s.base = base s.files = append(s.files, f) s.last = f return f } // Iterate calls f for the files in the file set in the order they were added // until f returns false. // func (s *FileSet) Iterate(f func(*File) bool) { for i := 0; ; i++ { var file *File s.mutex.RLock() if i < len(s.files) { file = s.files[i] } s.mutex.RUnlock() if file == nil || !f(file) { break } } } func searchFiles(a []*File, x int) int { return sort.Search(len(a), func(i int) bool { return a[i].base > x }) - 1 } func (s *FileSet) file(p Pos) *File { // common case: p is in last file if f := s.last; f != nil && f.base <= int(p) && int(p) <= f.base+f.size { return f } // p is not in last file - search all files if i := searchFiles(s.files, int(p)); i >= 0 { f := s.files[i] // f.base <= int(p) by definition of searchFiles if int(p) <= f.base+f.size { s.last = f return f } } return nil } // File returns the file that contains the position p. // If no such file is found (for instance for p == NoPos), // the result is nil. // func (s *FileSet) File(p Pos) (f *File) { if p != NoPos { s.mutex.RLock() f = s.file(p) s.mutex.RUnlock() } return } // Position converts a Pos in the fileset into a general Position. func (s *FileSet) Position(p Pos) (pos Position) { if p != NoPos { s.mutex.RLock() if f := s.file(p); f != nil { pos = f.position(p) } s.mutex.RUnlock() } return } // ----------------------------------------------------------------------------- // Helper functions func searchInts(a []int, x int) int { // This function body is a manually inlined version of: // // return sort.Search(len(a), func(i int) bool { return a[i] > x }) - 1 // // With better compiler optimizations, this may not be needed in the // future, but at the moment this change improves the go/printer // benchmark performance by ~30%. This has a direct impact on the // speed of gofmt and thus seems worthwhile (2011-04-29). // TODO(gri): Remove this when compilers have caught up. i, j := 0, len(a) for i < j { h := i + (j-i)/2 // avoid overflow when computing h // i ≤ h < j if a[h] <= x { i = h + 1 } else { j = h } } return i - 1 }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/gcfg/token/serialize.go
vendor/github.com/go-git/gcfg/token/serialize.go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package token type serializedFile struct { // fields correspond 1:1 to fields with same (lower-case) name in File Name string Base int Size int Lines []int Infos []lineInfo } type serializedFileSet struct { Base int Files []serializedFile } // Read calls decode to deserialize a file set into s; s must not be nil. func (s *FileSet) Read(decode func(interface{}) error) error { var ss serializedFileSet if err := decode(&ss); err != nil { return err } s.mutex.Lock() s.base = ss.Base files := make([]*File, len(ss.Files)) for i := 0; i < len(ss.Files); i++ { f := &ss.Files[i] files[i] = &File{s, f.Name, f.Base, f.Size, f.Lines, f.Infos} } s.files = files s.last = nil s.mutex.Unlock() return nil } // Write calls encode to serialize the file set s. func (s *FileSet) Write(encode func(interface{}) error) error { var ss serializedFileSet s.mutex.Lock() ss.Base = s.base files := make([]serializedFile, len(s.files)) for i, f := range s.files { files[i] = serializedFile{f.name, f.base, f.size, f.lines, f.infos} } ss.Files = files s.mutex.Unlock() return encode(ss) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/fs.go
vendor/github.com/go-git/go-billy/v5/fs.go
package billy import ( "errors" "io" "os" "time" ) var ( ErrReadOnly = errors.New("read-only filesystem") ErrNotSupported = errors.New("feature not supported") ErrCrossedBoundary = errors.New("chroot boundary crossed") ) // Capability holds the supported features of a billy filesystem. This does // not mean that the capability has to be supported by the underlying storage. // For example, a billy filesystem may support WriteCapability but the // storage be mounted in read only mode. type Capability uint64 const ( // WriteCapability means that the fs is writable. WriteCapability Capability = 1 << iota // ReadCapability means that the fs is readable. ReadCapability // ReadAndWriteCapability is the ability to open a file in read and write mode. ReadAndWriteCapability // SeekCapability means it is able to move position inside the file. SeekCapability // TruncateCapability means that a file can be truncated. TruncateCapability // LockCapability is the ability to lock a file. LockCapability // DefaultCapabilities lists all capable features supported by filesystems // without Capability interface. This list should not be changed until a // major version is released. DefaultCapabilities Capability = WriteCapability | ReadCapability | ReadAndWriteCapability | SeekCapability | TruncateCapability | LockCapability // AllCapabilities lists all capable features. AllCapabilities Capability = WriteCapability | ReadCapability | ReadAndWriteCapability | SeekCapability | TruncateCapability | LockCapability ) // Filesystem abstract the operations in a storage-agnostic interface. // Each method implementation mimics the behavior of the equivalent functions // at the os package from the standard library. type Filesystem interface { Basic TempFile Dir Symlink Chroot } // Basic abstract the basic operations in a storage-agnostic interface as // an extension to the Basic interface. type Basic interface { // Create creates the named file with mode 0666 (before umask), truncating // it if it already exists. If successful, methods on the returned File can // be used for I/O; the associated file descriptor has mode O_RDWR. Create(filename string) (File, error) // Open opens the named file for reading. If successful, methods on the // returned file can be used for reading; the associated file descriptor has // mode O_RDONLY. Open(filename string) (File, error) // OpenFile is the generalized open call; most users will use Open or Create // instead. It opens the named file with specified flag (O_RDONLY etc.) and // perm, (0666 etc.) if applicable. If successful, methods on the returned // File can be used for I/O. OpenFile(filename string, flag int, perm os.FileMode) (File, error) // Stat returns a FileInfo describing the named file. Stat(filename string) (os.FileInfo, error) // Rename renames (moves) oldpath to newpath. If newpath already exists and // is not a directory, Rename replaces it. OS-specific restrictions may // apply when oldpath and newpath are in different directories. Rename(oldpath, newpath string) error // Remove removes the named file or directory. Remove(filename string) error // Join joins any number of path elements into a single path, adding a // Separator if necessary. Join calls filepath.Clean on the result; in // particular, all empty strings are ignored. On Windows, the result is a // UNC path if and only if the first path element is a UNC path. Join(elem ...string) string } type TempFile interface { // TempFile creates a new temporary file in the directory dir with a name // beginning with prefix, opens the file for reading and writing, and // returns the resulting *os.File. If dir is the empty string, TempFile // uses the default directory for temporary files (see os.TempDir). // Multiple programs calling TempFile simultaneously will not choose the // same file. The caller can use f.Name() to find the pathname of the file. // It is the caller's responsibility to remove the file when no longer // needed. TempFile(dir, prefix string) (File, error) } // Dir abstract the dir related operations in a storage-agnostic interface as // an extension to the Basic interface. type Dir interface { // ReadDir reads the directory named by dirname and returns a list of // directory entries sorted by filename. ReadDir(path string) ([]os.FileInfo, error) // MkdirAll creates a directory named path, along with any necessary // parents, and returns nil, or else returns an error. The permission bits // perm are used for all directories that MkdirAll creates. If path is/ // already a directory, MkdirAll does nothing and returns nil. MkdirAll(filename string, perm os.FileMode) error } // Symlink abstract the symlink related operations in a storage-agnostic // interface as an extension to the Basic interface. type Symlink interface { // Lstat returns a FileInfo describing the named file. If the file is a // symbolic link, the returned FileInfo describes the symbolic link. Lstat // makes no attempt to follow the link. Lstat(filename string) (os.FileInfo, error) // Symlink creates a symbolic-link from link to target. target may be an // absolute or relative path, and need not refer to an existing node. // Parent directories of link are created as necessary. Symlink(target, link string) error // Readlink returns the target path of link. Readlink(link string) (string, error) } // Change abstract the FileInfo change related operations in a storage-agnostic // interface as an extension to the Basic interface type Change interface { // Chmod changes the mode of the named file to mode. If the file is a // symbolic link, it changes the mode of the link's target. Chmod(name string, mode os.FileMode) error // Lchown changes the numeric uid and gid of the named file. If the file is // a symbolic link, it changes the uid and gid of the link itself. Lchown(name string, uid, gid int) error // Chown changes the numeric uid and gid of the named file. If the file is a // symbolic link, it changes the uid and gid of the link's target. Chown(name string, uid, gid int) error // Chtimes changes the access and modification times of the named file, // similar to the Unix utime() or utimes() functions. // // The underlying filesystem may truncate or round the values to a less // precise time unit. Chtimes(name string, atime time.Time, mtime time.Time) error } // Chroot abstract the chroot related operations in a storage-agnostic interface // as an extension to the Basic interface. type Chroot interface { // Chroot returns a new filesystem from the same type where the new root is // the given path. Files outside of the designated directory tree cannot be // accessed. Chroot(path string) (Filesystem, error) // Root returns the root path of the filesystem. Root() string } // File represent a file, being a subset of the os.File type File interface { // Name returns the name of the file as presented to Open. Name() string io.Writer // TODO: Add io.WriterAt for v6 // io.WriterAt io.Reader io.ReaderAt io.Seeker io.Closer // Lock locks the file like e.g. flock. It protects against access from // other processes. Lock() error // Unlock unlocks the file. Unlock() error // Truncate the file. Truncate(size int64) error } // Capable interface can return the available features of a filesystem. type Capable interface { // Capabilities returns the capabilities of a filesystem in bit flags. Capabilities() Capability } // Capabilities returns the features supported by a filesystem. If the FS // does not implement Capable interface it returns all features. func Capabilities(fs Basic) Capability { capable, ok := fs.(Capable) if !ok { return DefaultCapabilities } return capable.Capabilities() } // CapabilityCheck tests the filesystem for the provided capabilities and // returns true in case it supports all of them. func CapabilityCheck(fs Basic, capabilities Capability) bool { fsCaps := Capabilities(fs) return fsCaps&capabilities == capabilities }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/util/walk.go
vendor/github.com/go-git/go-billy/v5/util/walk.go
package util import ( "os" "path/filepath" "github.com/go-git/go-billy/v5" ) // walk recursively descends path, calling walkFn // adapted from https://golang.org/src/path/filepath/path.go func walk(fs billy.Filesystem, path string, info os.FileInfo, walkFn filepath.WalkFunc) error { if !info.IsDir() { return walkFn(path, info, nil) } names, err := readdirnames(fs, path) err1 := walkFn(path, info, err) // If err != nil, walk can't walk into this directory. // err1 != nil means walkFn want walk to skip this directory or stop walking. // Therefore, if one of err and err1 isn't nil, walk will return. if err != nil || err1 != nil { // The caller's behavior is controlled by the return value, which is decided // by walkFn. walkFn may ignore err and return nil. // If walkFn returns SkipDir, it will be handled by the caller. // So walk should return whatever walkFn returns. return err1 } for _, name := range names { filename := filepath.Join(path, name) fileInfo, err := fs.Lstat(filename) if err != nil { if err := walkFn(filename, fileInfo, err); err != nil && err != filepath.SkipDir { return err } } else { err = walk(fs, filename, fileInfo, walkFn) if err != nil { if !fileInfo.IsDir() || err != filepath.SkipDir { return err } } } } return nil } // Walk walks the file tree rooted at root, calling fn for each file or // directory in the tree, including root. All errors that arise visiting files // and directories are filtered by fn: see the WalkFunc documentation for // details. // // The files are walked in lexical order, which makes the output deterministic // but requires Walk to read an entire directory into memory before proceeding // to walk that directory. Walk does not follow symbolic links. // // Function adapted from https://github.com/golang/go/blob/3b770f2ccb1fa6fecc22ea822a19447b10b70c5c/src/path/filepath/path.go#L500 func Walk(fs billy.Filesystem, root string, walkFn filepath.WalkFunc) error { info, err := fs.Lstat(root) if err != nil { err = walkFn(root, nil, err) } else { err = walk(fs, root, info, walkFn) } if err == filepath.SkipDir { return nil } return err }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/util/util.go
vendor/github.com/go-git/go-billy/v5/util/util.go
package util import ( "errors" "io" "os" "path/filepath" "strconv" "sync" "time" "github.com/go-git/go-billy/v5" ) // RemoveAll removes path and any children it contains. It removes everything it // can but returns the first error it encounters. If the path does not exist, // RemoveAll returns nil (no error). func RemoveAll(fs billy.Basic, path string) error { fs, path = getUnderlyingAndPath(fs, path) if r, ok := fs.(removerAll); ok { return r.RemoveAll(path) } return removeAll(fs, path) } type removerAll interface { RemoveAll(string) error } func removeAll(fs billy.Basic, path string) error { // This implementation is adapted from os.RemoveAll. // Simple case: if Remove works, we're done. err := fs.Remove(path) if err == nil || errors.Is(err, os.ErrNotExist) { return nil } // Otherwise, is this a directory we need to recurse into? dir, serr := fs.Stat(path) if serr != nil { if errors.Is(serr, os.ErrNotExist) { return nil } return serr } if !dir.IsDir() { // Not a directory; return the error from Remove. return err } dirfs, ok := fs.(billy.Dir) if !ok { return billy.ErrNotSupported } // Directory. fis, err := dirfs.ReadDir(path) if err != nil { if errors.Is(err, os.ErrNotExist) { // Race. It was deleted between the Lstat and Open. // Return nil per RemoveAll's docs. return nil } return err } // Remove contents & return first error. err = nil for _, fi := range fis { cpath := fs.Join(path, fi.Name()) err1 := removeAll(fs, cpath) if err == nil { err = err1 } } // Remove directory. err1 := fs.Remove(path) if err1 == nil || errors.Is(err1, os.ErrNotExist) { return nil } if err == nil { err = err1 } return err } // WriteFile writes data to a file named by filename in the given filesystem. // If the file does not exist, WriteFile creates it with permissions perm; // otherwise WriteFile truncates it before writing. func WriteFile(fs billy.Basic, filename string, data []byte, perm os.FileMode) (err error) { f, err := fs.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm) if err != nil { return err } defer func() { if f != nil { err1 := f.Close() if err == nil { err = err1 } } }() n, err := f.Write(data) if err == nil && n < len(data) { err = io.ErrShortWrite } return nil } // Random number state. // We generate random temporary file names so that there's a good // chance the file doesn't exist yet - keeps the number of tries in // TempFile to a minimum. var rand uint32 var randmu sync.Mutex func reseed() uint32 { return uint32(time.Now().UnixNano() + int64(os.Getpid())) } func nextSuffix() string { randmu.Lock() r := rand if r == 0 { r = reseed() } r = r*1664525 + 1013904223 // constants from Numerical Recipes rand = r randmu.Unlock() return strconv.Itoa(int(1e9 + r%1e9))[1:] } // TempFile creates a new temporary file in the directory dir with a name // beginning with prefix, opens the file for reading and writing, and returns // the resulting *os.File. If dir is the empty string, TempFile uses the default // directory for temporary files (see os.TempDir). Multiple programs calling // TempFile simultaneously will not choose the same file. The caller can use // f.Name() to find the pathname of the file. It is the caller's responsibility // to remove the file when no longer needed. func TempFile(fs billy.Basic, dir, prefix string) (f billy.File, err error) { // This implementation is based on stdlib ioutil.TempFile. if dir == "" { dir = getTempDir(fs) } nconflict := 0 for i := 0; i < 10000; i++ { name := filepath.Join(dir, prefix+nextSuffix()) f, err = fs.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600) if errors.Is(err, os.ErrExist) { if nconflict++; nconflict > 10 { randmu.Lock() rand = reseed() randmu.Unlock() } continue } break } return } // TempDir creates a new temporary directory in the directory dir // with a name beginning with prefix and returns the path of the // new directory. If dir is the empty string, TempDir uses the // default directory for temporary files (see os.TempDir). // Multiple programs calling TempDir simultaneously // will not choose the same directory. It is the caller's responsibility // to remove the directory when no longer needed. func TempDir(fs billy.Dir, dir, prefix string) (name string, err error) { // This implementation is based on stdlib ioutil.TempDir if dir == "" { dir = getTempDir(fs.(billy.Basic)) } nconflict := 0 for i := 0; i < 10000; i++ { try := filepath.Join(dir, prefix+nextSuffix()) err = fs.MkdirAll(try, 0700) if errors.Is(err, os.ErrExist) { if nconflict++; nconflict > 10 { randmu.Lock() rand = reseed() randmu.Unlock() } continue } if errors.Is(err, os.ErrNotExist) { if _, err := os.Stat(dir); errors.Is(err, os.ErrNotExist) { return "", err } } if err == nil { name = try } break } return } func getTempDir(fs billy.Basic) string { ch, ok := fs.(billy.Chroot) if !ok || ch.Root() == "" || ch.Root() == "/" || ch.Root() == string(filepath.Separator) { return os.TempDir() } return ".tmp" } type underlying interface { Underlying() billy.Basic } func getUnderlyingAndPath(fs billy.Basic, path string) (billy.Basic, string) { u, ok := fs.(underlying) if !ok { return fs, path } if ch, ok := fs.(billy.Chroot); ok { path = fs.Join(ch.Root(), path) } return u.Underlying(), path } // ReadFile reads the named file and returns the contents from the given filesystem. // A successful call returns err == nil, not err == EOF. // Because ReadFile reads the whole file, it does not treat an EOF from Read // as an error to be reported. func ReadFile(fs billy.Basic, name string) ([]byte, error) { f, err := fs.Open(name) if err != nil { return nil, err } defer f.Close() var size int if info, err := fs.Stat(name); err == nil { size64 := info.Size() if int64(int(size64)) == size64 { size = int(size64) } } size++ // one byte for final read at EOF // If a file claims a small size, read at least 512 bytes. // In particular, files in Linux's /proc claim size 0 but // then do not work right if read in small pieces, // so an initial read of 1 byte would not work correctly. if size < 512 { size = 512 } data := make([]byte, 0, size) for { if len(data) >= cap(data) { d := append(data[:cap(data)], 0) data = d[:len(data)] } n, err := f.Read(data[len(data):cap(data)]) data = data[:len(data)+n] if err != nil { if errors.Is(err, io.EOF) { err = nil } return data, err } } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/util/glob.go
vendor/github.com/go-git/go-billy/v5/util/glob.go
package util import ( "path/filepath" "sort" "strings" "github.com/go-git/go-billy/v5" ) // Glob returns the names of all files matching pattern or nil // if there is no matching file. The syntax of patterns is the same // as in Match. The pattern may describe hierarchical names such as // /usr/*/bin/ed (assuming the Separator is '/'). // // Glob ignores file system errors such as I/O errors reading directories. // The only possible returned error is ErrBadPattern, when pattern // is malformed. // // Function originally from https://golang.org/src/path/filepath/match_test.go func Glob(fs billy.Filesystem, pattern string) (matches []string, err error) { if !hasMeta(pattern) { if _, err = fs.Lstat(pattern); err != nil { return nil, nil } return []string{pattern}, nil } dir, file := filepath.Split(pattern) // Prevent infinite recursion. See issue 15879. if dir == pattern { return nil, filepath.ErrBadPattern } var m []string m, err = Glob(fs, cleanGlobPath(dir)) if err != nil { return } for _, d := range m { matches, err = glob(fs, d, file, matches) if err != nil { return } } return } // cleanGlobPath prepares path for glob matching. func cleanGlobPath(path string) string { switch path { case "": return "." case string(filepath.Separator): // do nothing to the path return path default: return path[0 : len(path)-1] // chop off trailing separator } } // glob searches for files matching pattern in the directory dir // and appends them to matches. If the directory cannot be // opened, it returns the existing matches. New matches are // added in lexicographical order. func glob(fs billy.Filesystem, dir, pattern string, matches []string) (m []string, e error) { m = matches fi, err := fs.Stat(dir) if err != nil { return } if !fi.IsDir() { return } names, _ := readdirnames(fs, dir) sort.Strings(names) for _, n := range names { matched, err := filepath.Match(pattern, n) if err != nil { return m, err } if matched { m = append(m, filepath.Join(dir, n)) } } return } // hasMeta reports whether path contains any of the magic characters // recognized by Match. func hasMeta(path string) bool { // TODO(niemeyer): Should other magic characters be added here? return strings.ContainsAny(path, "*?[") } func readdirnames(fs billy.Filesystem, dir string) ([]string, error) { files, err := fs.ReadDir(dir) if err != nil { return nil, err } var names []string for _, file := range files { names = append(names, file.Name()) } return names, nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/memfs/storage.go
vendor/github.com/go-git/go-billy/v5/memfs/storage.go
package memfs import ( "errors" "fmt" "io" "os" "path/filepath" "strings" "sync" ) type storage struct { files map[string]*file children map[string]map[string]*file } func newStorage() *storage { return &storage{ files: make(map[string]*file, 0), children: make(map[string]map[string]*file, 0), } } func (s *storage) Has(path string) bool { path = clean(path) _, ok := s.files[path] return ok } func (s *storage) New(path string, mode os.FileMode, flag int) (*file, error) { path = clean(path) if s.Has(path) { if !s.MustGet(path).mode.IsDir() { return nil, fmt.Errorf("file already exists %q", path) } return nil, nil } name := filepath.Base(path) f := &file{ name: name, content: &content{name: name}, mode: mode, flag: flag, } s.files[path] = f s.createParent(path, mode, f) return f, nil } func (s *storage) createParent(path string, mode os.FileMode, f *file) error { base := filepath.Dir(path) base = clean(base) if f.Name() == string(separator) { return nil } if _, err := s.New(base, mode.Perm()|os.ModeDir, 0); err != nil { return err } if _, ok := s.children[base]; !ok { s.children[base] = make(map[string]*file, 0) } s.children[base][f.Name()] = f return nil } func (s *storage) Children(path string) []*file { path = clean(path) l := make([]*file, 0) for _, f := range s.children[path] { l = append(l, f) } return l } func (s *storage) MustGet(path string) *file { f, ok := s.Get(path) if !ok { panic(fmt.Errorf("couldn't find %q", path)) } return f } func (s *storage) Get(path string) (*file, bool) { path = clean(path) if !s.Has(path) { return nil, false } file, ok := s.files[path] return file, ok } func (s *storage) Rename(from, to string) error { from = clean(from) to = clean(to) if !s.Has(from) { return os.ErrNotExist } move := [][2]string{{from, to}} for pathFrom := range s.files { if pathFrom == from || !strings.HasPrefix(pathFrom, from) { continue } rel, _ := filepath.Rel(from, pathFrom) pathTo := filepath.Join(to, rel) move = append(move, [2]string{pathFrom, pathTo}) } for _, ops := range move { from := ops[0] to := ops[1] if err := s.move(from, to); err != nil { return err } } return nil } func (s *storage) move(from, to string) error { s.files[to] = s.files[from] s.files[to].name = filepath.Base(to) s.children[to] = s.children[from] defer func() { delete(s.children, from) delete(s.files, from) delete(s.children[filepath.Dir(from)], filepath.Base(from)) }() return s.createParent(to, 0644, s.files[to]) } func (s *storage) Remove(path string) error { path = clean(path) f, has := s.Get(path) if !has { return os.ErrNotExist } if f.mode.IsDir() && len(s.children[path]) != 0 { return fmt.Errorf("dir: %s contains files", path) } base, file := filepath.Split(path) base = filepath.Clean(base) delete(s.children[base], file) delete(s.files, path) return nil } func clean(path string) string { return filepath.Clean(filepath.FromSlash(path)) } type content struct { name string bytes []byte m sync.RWMutex } func (c *content) WriteAt(p []byte, off int64) (int, error) { if off < 0 { return 0, &os.PathError{ Op: "writeat", Path: c.name, Err: errors.New("negative offset"), } } c.m.Lock() prev := len(c.bytes) diff := int(off) - prev if diff > 0 { c.bytes = append(c.bytes, make([]byte, diff)...) } c.bytes = append(c.bytes[:off], p...) if len(c.bytes) < prev { c.bytes = c.bytes[:prev] } c.m.Unlock() return len(p), nil } func (c *content) ReadAt(b []byte, off int64) (n int, err error) { if off < 0 { return 0, &os.PathError{ Op: "readat", Path: c.name, Err: errors.New("negative offset"), } } c.m.RLock() size := int64(len(c.bytes)) if off >= size { c.m.RUnlock() return 0, io.EOF } l := int64(len(b)) if off+l > size { l = size - off } btr := c.bytes[off : off+l] n = copy(b, btr) if len(btr) < len(b) { err = io.EOF } c.m.RUnlock() return }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/memfs/memory.go
vendor/github.com/go-git/go-billy/v5/memfs/memory.go
// Package memfs provides a billy filesystem base on memory. package memfs // import "github.com/go-git/go-billy/v5/memfs" import ( "errors" "fmt" "io" "os" "path/filepath" "sort" "strings" "syscall" "time" "github.com/go-git/go-billy/v5" "github.com/go-git/go-billy/v5/helper/chroot" "github.com/go-git/go-billy/v5/util" ) const separator = filepath.Separator var errNotLink = errors.New("not a link") // Memory a very convenient filesystem based on memory files. type Memory struct { s *storage tempCount int } // New returns a new Memory filesystem. func New() billy.Filesystem { fs := &Memory{s: newStorage()} fs.s.New("/", 0755|os.ModeDir, 0) return chroot.New(fs, string(separator)) } func (fs *Memory) Create(filename string) (billy.File, error) { return fs.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666) } func (fs *Memory) Open(filename string) (billy.File, error) { return fs.OpenFile(filename, os.O_RDONLY, 0) } func (fs *Memory) OpenFile(filename string, flag int, perm os.FileMode) (billy.File, error) { f, has := fs.s.Get(filename) if !has { if !isCreate(flag) { return nil, os.ErrNotExist } var err error f, err = fs.s.New(filename, perm, flag) if err != nil { return nil, err } } else { if isExclusive(flag) { return nil, os.ErrExist } if target, isLink := fs.resolveLink(filename, f); isLink { if target != filename { return fs.OpenFile(target, flag, perm) } } } if f.mode.IsDir() { return nil, fmt.Errorf("cannot open directory: %s", filename) } return f.Duplicate(filename, perm, flag), nil } func (fs *Memory) resolveLink(fullpath string, f *file) (target string, isLink bool) { if !isSymlink(f.mode) { return fullpath, false } target = string(f.content.bytes) if !isAbs(target) { target = fs.Join(filepath.Dir(fullpath), target) } return target, true } // On Windows OS, IsAbs validates if a path is valid based on if stars with a // unit (eg.: `C:\`) to assert that is absolute, but in this mem implementation // any path starting by `separator` is also considered absolute. func isAbs(path string) bool { return filepath.IsAbs(path) || strings.HasPrefix(path, string(separator)) } func (fs *Memory) Stat(filename string) (os.FileInfo, error) { f, has := fs.s.Get(filename) if !has { return nil, os.ErrNotExist } fi, _ := f.Stat() var err error if target, isLink := fs.resolveLink(filename, f); isLink { fi, err = fs.Stat(target) if err != nil { return nil, err } } // the name of the file should always the name of the stated file, so we // overwrite the Stat returned from the storage with it, since the // filename may belong to a link. fi.(*fileInfo).name = filepath.Base(filename) return fi, nil } func (fs *Memory) Lstat(filename string) (os.FileInfo, error) { f, has := fs.s.Get(filename) if !has { return nil, os.ErrNotExist } return f.Stat() } type ByName []os.FileInfo func (a ByName) Len() int { return len(a) } func (a ByName) Less(i, j int) bool { return a[i].Name() < a[j].Name() } func (a ByName) Swap(i, j int) { a[i], a[j] = a[j], a[i] } func (fs *Memory) ReadDir(path string) ([]os.FileInfo, error) { if f, has := fs.s.Get(path); has { if target, isLink := fs.resolveLink(path, f); isLink { if target != path { return fs.ReadDir(target) } } } else { return nil, &os.PathError{Op: "open", Path: path, Err: syscall.ENOENT} } var entries []os.FileInfo for _, f := range fs.s.Children(path) { fi, _ := f.Stat() entries = append(entries, fi) } sort.Sort(ByName(entries)) return entries, nil } func (fs *Memory) MkdirAll(path string, perm os.FileMode) error { _, err := fs.s.New(path, perm|os.ModeDir, 0) return err } func (fs *Memory) TempFile(dir, prefix string) (billy.File, error) { return util.TempFile(fs, dir, prefix) } func (fs *Memory) getTempFilename(dir, prefix string) string { fs.tempCount++ filename := fmt.Sprintf("%s_%d_%d", prefix, fs.tempCount, time.Now().UnixNano()) return fs.Join(dir, filename) } func (fs *Memory) Rename(from, to string) error { return fs.s.Rename(from, to) } func (fs *Memory) Remove(filename string) error { return fs.s.Remove(filename) } // Falls back to Go's filepath.Join, which works differently depending on the // OS where the code is being executed. func (fs *Memory) Join(elem ...string) string { return filepath.Join(elem...) } func (fs *Memory) Symlink(target, link string) error { _, err := fs.Lstat(link) if err == nil { return os.ErrExist } if !errors.Is(err, os.ErrNotExist) { return err } return util.WriteFile(fs, link, []byte(target), 0777|os.ModeSymlink) } func (fs *Memory) Readlink(link string) (string, error) { f, has := fs.s.Get(link) if !has { return "", os.ErrNotExist } if !isSymlink(f.mode) { return "", &os.PathError{ Op: "readlink", Path: link, Err: fmt.Errorf("not a symlink"), } } return string(f.content.bytes), nil } // Capabilities implements the Capable interface. func (fs *Memory) Capabilities() billy.Capability { return billy.WriteCapability | billy.ReadCapability | billy.ReadAndWriteCapability | billy.SeekCapability | billy.TruncateCapability } type file struct { name string content *content position int64 flag int mode os.FileMode isClosed bool } func (f *file) Name() string { return f.name } func (f *file) Read(b []byte) (int, error) { n, err := f.ReadAt(b, f.position) f.position += int64(n) if errors.Is(err, io.EOF) && n != 0 { err = nil } return n, err } func (f *file) ReadAt(b []byte, off int64) (int, error) { if f.isClosed { return 0, os.ErrClosed } if !isReadAndWrite(f.flag) && !isReadOnly(f.flag) { return 0, errors.New("read not supported") } n, err := f.content.ReadAt(b, off) return n, err } func (f *file) Seek(offset int64, whence int) (int64, error) { if f.isClosed { return 0, os.ErrClosed } switch whence { case io.SeekCurrent: f.position += offset case io.SeekStart: f.position = offset case io.SeekEnd: f.position = int64(f.content.Len()) + offset } return f.position, nil } func (f *file) Write(p []byte) (int, error) { return f.WriteAt(p, f.position) } func (f *file) WriteAt(p []byte, off int64) (int, error) { if f.isClosed { return 0, os.ErrClosed } if !isReadAndWrite(f.flag) && !isWriteOnly(f.flag) { return 0, errors.New("write not supported") } n, err := f.content.WriteAt(p, off) f.position = off + int64(n) return n, err } func (f *file) Close() error { if f.isClosed { return os.ErrClosed } f.isClosed = true return nil } func (f *file) Truncate(size int64) error { if size < int64(len(f.content.bytes)) { f.content.bytes = f.content.bytes[:size] } else if more := int(size) - len(f.content.bytes); more > 0 { f.content.bytes = append(f.content.bytes, make([]byte, more)...) } return nil } func (f *file) Duplicate(filename string, mode os.FileMode, flag int) billy.File { new := &file{ name: filename, content: f.content, mode: mode, flag: flag, } if isTruncate(flag) { new.content.Truncate() } if isAppend(flag) { new.position = int64(new.content.Len()) } return new } func (f *file) Stat() (os.FileInfo, error) { return &fileInfo{ name: f.Name(), mode: f.mode, size: f.content.Len(), }, nil } // Lock is a no-op in memfs. func (f *file) Lock() error { return nil } // Unlock is a no-op in memfs. func (f *file) Unlock() error { return nil } type fileInfo struct { name string size int mode os.FileMode } func (fi *fileInfo) Name() string { return fi.name } func (fi *fileInfo) Size() int64 { return int64(fi.size) } func (fi *fileInfo) Mode() os.FileMode { return fi.mode } func (*fileInfo) ModTime() time.Time { return time.Now() } func (fi *fileInfo) IsDir() bool { return fi.mode.IsDir() } func (*fileInfo) Sys() interface{} { return nil } func (c *content) Truncate() { c.bytes = make([]byte, 0) } func (c *content) Len() int { return len(c.bytes) } func isCreate(flag int) bool { return flag&os.O_CREATE != 0 } func isExclusive(flag int) bool { return flag&os.O_EXCL != 0 } func isAppend(flag int) bool { return flag&os.O_APPEND != 0 } func isTruncate(flag int) bool { return flag&os.O_TRUNC != 0 } func isReadAndWrite(flag int) bool { return flag&os.O_RDWR != 0 } func isReadOnly(flag int) bool { return flag == os.O_RDONLY } func isWriteOnly(flag int) bool { return flag&os.O_WRONLY != 0 } func isSymlink(m os.FileMode) bool { return m&os.ModeSymlink != 0 }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/helper/chroot/chroot.go
vendor/github.com/go-git/go-billy/v5/helper/chroot/chroot.go
package chroot import ( "os" "path/filepath" "strings" "github.com/go-git/go-billy/v5" "github.com/go-git/go-billy/v5/helper/polyfill" ) // ChrootHelper is a helper to implement billy.Chroot. type ChrootHelper struct { underlying billy.Filesystem base string } // New creates a new filesystem wrapping up the given 'fs'. // The created filesystem has its base in the given ChrootHelperectory of the // underlying filesystem. func New(fs billy.Basic, base string) billy.Filesystem { return &ChrootHelper{ underlying: polyfill.New(fs), base: base, } } func (fs *ChrootHelper) underlyingPath(filename string) (string, error) { if isCrossBoundaries(filename) { return "", billy.ErrCrossedBoundary } return fs.Join(fs.Root(), filename), nil } func isCrossBoundaries(path string) bool { path = filepath.ToSlash(path) path = filepath.Clean(path) return strings.HasPrefix(path, ".."+string(filepath.Separator)) } func (fs *ChrootHelper) Create(filename string) (billy.File, error) { fullpath, err := fs.underlyingPath(filename) if err != nil { return nil, err } f, err := fs.underlying.Create(fullpath) if err != nil { return nil, err } return newFile(fs, f, filename), nil } func (fs *ChrootHelper) Open(filename string) (billy.File, error) { fullpath, err := fs.underlyingPath(filename) if err != nil { return nil, err } f, err := fs.underlying.Open(fullpath) if err != nil { return nil, err } return newFile(fs, f, filename), nil } func (fs *ChrootHelper) OpenFile(filename string, flag int, mode os.FileMode) (billy.File, error) { fullpath, err := fs.underlyingPath(filename) if err != nil { return nil, err } f, err := fs.underlying.OpenFile(fullpath, flag, mode) if err != nil { return nil, err } return newFile(fs, f, filename), nil } func (fs *ChrootHelper) Stat(filename string) (os.FileInfo, error) { fullpath, err := fs.underlyingPath(filename) if err != nil { return nil, err } return fs.underlying.Stat(fullpath) } func (fs *ChrootHelper) Rename(from, to string) error { var err error from, err = fs.underlyingPath(from) if err != nil { return err } to, err = fs.underlyingPath(to) if err != nil { return err } return fs.underlying.Rename(from, to) } func (fs *ChrootHelper) Remove(path string) error { fullpath, err := fs.underlyingPath(path) if err != nil { return err } return fs.underlying.Remove(fullpath) } func (fs *ChrootHelper) Join(elem ...string) string { return fs.underlying.Join(elem...) } func (fs *ChrootHelper) TempFile(dir, prefix string) (billy.File, error) { fullpath, err := fs.underlyingPath(dir) if err != nil { return nil, err } f, err := fs.underlying.(billy.TempFile).TempFile(fullpath, prefix) if err != nil { return nil, err } return newFile(fs, f, fs.Join(dir, filepath.Base(f.Name()))), nil } func (fs *ChrootHelper) ReadDir(path string) ([]os.FileInfo, error) { fullpath, err := fs.underlyingPath(path) if err != nil { return nil, err } return fs.underlying.(billy.Dir).ReadDir(fullpath) } func (fs *ChrootHelper) MkdirAll(filename string, perm os.FileMode) error { fullpath, err := fs.underlyingPath(filename) if err != nil { return err } return fs.underlying.(billy.Dir).MkdirAll(fullpath, perm) } func (fs *ChrootHelper) Lstat(filename string) (os.FileInfo, error) { fullpath, err := fs.underlyingPath(filename) if err != nil { return nil, err } return fs.underlying.(billy.Symlink).Lstat(fullpath) } func (fs *ChrootHelper) Symlink(target, link string) error { target = filepath.FromSlash(target) // only rewrite target if it's already absolute if filepath.IsAbs(target) || strings.HasPrefix(target, string(filepath.Separator)) { target = fs.Join(fs.Root(), target) target = filepath.Clean(filepath.FromSlash(target)) } link, err := fs.underlyingPath(link) if err != nil { return err } return fs.underlying.(billy.Symlink).Symlink(target, link) } func (fs *ChrootHelper) Readlink(link string) (string, error) { fullpath, err := fs.underlyingPath(link) if err != nil { return "", err } target, err := fs.underlying.(billy.Symlink).Readlink(fullpath) if err != nil { return "", err } if !filepath.IsAbs(target) && !strings.HasPrefix(target, string(filepath.Separator)) { return target, nil } target, err = filepath.Rel(fs.base, target) if err != nil { return "", err } return string(os.PathSeparator) + target, nil } func (fs *ChrootHelper) Chroot(path string) (billy.Filesystem, error) { fullpath, err := fs.underlyingPath(path) if err != nil { return nil, err } return New(fs.underlying, fullpath), nil } func (fs *ChrootHelper) Root() string { return fs.base } func (fs *ChrootHelper) Underlying() billy.Basic { return fs.underlying } // Capabilities implements the Capable interface. func (fs *ChrootHelper) Capabilities() billy.Capability { return billy.Capabilities(fs.underlying) } type file struct { billy.File name string } func newFile(fs billy.Filesystem, f billy.File, filename string) billy.File { filename = fs.Join(fs.Root(), filename) filename, _ = filepath.Rel(fs.Root(), filename) return &file{ File: f, name: filename, } } func (f *file) Name() string { return f.name }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/helper/polyfill/polyfill.go
vendor/github.com/go-git/go-billy/v5/helper/polyfill/polyfill.go
package polyfill import ( "os" "path/filepath" "github.com/go-git/go-billy/v5" ) // Polyfill is a helper that implements all missing method from billy.Filesystem. type Polyfill struct { billy.Basic c capabilities } type capabilities struct{ tempfile, dir, symlink, chroot bool } // New creates a new filesystem wrapping up 'fs' the intercepts all the calls // made and errors if fs doesn't implement any of the billy interfaces. func New(fs billy.Basic) billy.Filesystem { if original, ok := fs.(billy.Filesystem); ok { return original } h := &Polyfill{Basic: fs} _, h.c.tempfile = h.Basic.(billy.TempFile) _, h.c.dir = h.Basic.(billy.Dir) _, h.c.symlink = h.Basic.(billy.Symlink) _, h.c.chroot = h.Basic.(billy.Chroot) return h } func (h *Polyfill) TempFile(dir, prefix string) (billy.File, error) { if !h.c.tempfile { return nil, billy.ErrNotSupported } return h.Basic.(billy.TempFile).TempFile(dir, prefix) } func (h *Polyfill) ReadDir(path string) ([]os.FileInfo, error) { if !h.c.dir { return nil, billy.ErrNotSupported } return h.Basic.(billy.Dir).ReadDir(path) } func (h *Polyfill) MkdirAll(filename string, perm os.FileMode) error { if !h.c.dir { return billy.ErrNotSupported } return h.Basic.(billy.Dir).MkdirAll(filename, perm) } func (h *Polyfill) Symlink(target, link string) error { if !h.c.symlink { return billy.ErrNotSupported } return h.Basic.(billy.Symlink).Symlink(target, link) } func (h *Polyfill) Readlink(link string) (string, error) { if !h.c.symlink { return "", billy.ErrNotSupported } return h.Basic.(billy.Symlink).Readlink(link) } func (h *Polyfill) Lstat(path string) (os.FileInfo, error) { if !h.c.symlink { return nil, billy.ErrNotSupported } return h.Basic.(billy.Symlink).Lstat(path) } func (h *Polyfill) Chroot(path string) (billy.Filesystem, error) { if !h.c.chroot { return nil, billy.ErrNotSupported } return h.Basic.(billy.Chroot).Chroot(path) } func (h *Polyfill) Root() string { if !h.c.chroot { return string(filepath.Separator) } return h.Basic.(billy.Chroot).Root() } func (h *Polyfill) Underlying() billy.Basic { return h.Basic } // Capabilities implements the Capable interface. func (h *Polyfill) Capabilities() billy.Capability { return billy.Capabilities(h.Basic) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/osfs/os_plan9.go
vendor/github.com/go-git/go-billy/v5/osfs/os_plan9.go
//go:build plan9 // +build plan9 package osfs import ( "io" "os" "path/filepath" "syscall" ) func (f *file) Lock() error { // Plan 9 uses a mode bit instead of explicit lock/unlock syscalls. // // Per http://man.cat-v.org/plan_9/5/stat: “Exclusive use files may be open // for I/O by only one fid at a time across all clients of the server. If a // second open is attempted, it draws an error.” // // There is no obvious way to implement this function using the exclusive use bit. // See https://golang.org/src/cmd/go/internal/lockedfile/lockedfile_plan9.go // for how file locking is done by the go tool on Plan 9. return nil } func (f *file) Unlock() error { return nil } func rename(from, to string) error { // If from and to are in different directories, copy the file // since Plan 9 does not support cross-directory rename. if filepath.Dir(from) != filepath.Dir(to) { fi, err := os.Stat(from) if err != nil { return &os.LinkError{"rename", from, to, err} } if fi.Mode().IsDir() { return &os.LinkError{"rename", from, to, syscall.EISDIR} } fromFile, err := os.Open(from) if err != nil { return &os.LinkError{"rename", from, to, err} } toFile, err := os.OpenFile(to, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) if err != nil { return &os.LinkError{"rename", from, to, err} } _, err = io.Copy(toFile, fromFile) if err != nil { return &os.LinkError{"rename", from, to, err} } // Copy mtime and mode from original file. // We need only one syscall if we avoid os.Chmod and os.Chtimes. dir := fi.Sys().(*syscall.Dir) var d syscall.Dir d.Null() d.Mtime = dir.Mtime d.Mode = dir.Mode if err = dirwstat(to, &d); err != nil { return &os.LinkError{"rename", from, to, err} } // Remove original file. err = os.Remove(from) if err != nil { return &os.LinkError{"rename", from, to, err} } return nil } return os.Rename(from, to) } func dirwstat(name string, d *syscall.Dir) error { var buf [syscall.STATFIXLEN]byte n, err := d.Marshal(buf[:]) if err != nil { return &os.PathError{"dirwstat", name, err} } if err = syscall.Wstat(name, buf[:n]); err != nil { return &os.PathError{"dirwstat", name, err} } return nil } func umask(new int) func() { return func() { } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/osfs/os_posix.go
vendor/github.com/go-git/go-billy/v5/osfs/os_posix.go
//go:build !plan9 && !windows && !wasm // +build !plan9,!windows,!wasm package osfs import ( "os" "syscall" "golang.org/x/sys/unix" ) func (f *file) Lock() error { f.m.Lock() defer f.m.Unlock() return unix.Flock(int(f.File.Fd()), unix.LOCK_EX) } func (f *file) Unlock() error { f.m.Lock() defer f.m.Unlock() return unix.Flock(int(f.File.Fd()), unix.LOCK_UN) } func rename(from, to string) error { return os.Rename(from, to) } // umask sets umask to a new value, and returns a func which allows the // caller to reset it back to what it was originally. func umask(new int) func() { old := syscall.Umask(new) return func() { syscall.Umask(old) } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/osfs/os_chroot.go
vendor/github.com/go-git/go-billy/v5/osfs/os_chroot.go
//go:build !js // +build !js package osfs import ( "os" "path/filepath" "github.com/go-git/go-billy/v5" "github.com/go-git/go-billy/v5/helper/chroot" ) // ChrootOS is a legacy filesystem based on a "soft chroot" of the os filesystem. // Although this is still the default os filesystem, consider using BoundOS instead. // // Behaviours of note: // 1. A "soft chroot" translates the base dir to "/" for the purposes of the // fs abstraction. // 2. Symlinks targets may be modified to be kept within the chroot bounds. // 3. Some file modes does not pass-through the fs abstraction. // 4. The combination of 1 and 2 may cause go-git to think that a Git repository // is dirty, when in fact it isn't. type ChrootOS struct{} func newChrootOS(baseDir string) billy.Filesystem { return chroot.New(&ChrootOS{}, baseDir) } func (fs *ChrootOS) Create(filename string) (billy.File, error) { return fs.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, defaultCreateMode) } func (fs *ChrootOS) OpenFile(filename string, flag int, perm os.FileMode) (billy.File, error) { return openFile(filename, flag, perm, fs.createDir) } func (fs *ChrootOS) createDir(fullpath string) error { dir := filepath.Dir(fullpath) if dir != "." { if err := os.MkdirAll(dir, defaultDirectoryMode); err != nil { return err } } return nil } func (fs *ChrootOS) ReadDir(dir string) ([]os.FileInfo, error) { return readDir(dir) } func (fs *ChrootOS) Rename(from, to string) error { if err := fs.createDir(to); err != nil { return err } return rename(from, to) } func (fs *ChrootOS) MkdirAll(path string, perm os.FileMode) error { return os.MkdirAll(path, defaultDirectoryMode) } func (fs *ChrootOS) Open(filename string) (billy.File, error) { return fs.OpenFile(filename, os.O_RDONLY, 0) } func (fs *ChrootOS) Stat(filename string) (os.FileInfo, error) { return os.Stat(filename) } func (fs *ChrootOS) Remove(filename string) error { return os.Remove(filename) } func (fs *ChrootOS) TempFile(dir, prefix string) (billy.File, error) { if err := fs.createDir(dir + string(os.PathSeparator)); err != nil { return nil, err } return tempFile(dir, prefix) } func (fs *ChrootOS) Join(elem ...string) string { return filepath.Join(elem...) } func (fs *ChrootOS) RemoveAll(path string) error { return os.RemoveAll(filepath.Clean(path)) } func (fs *ChrootOS) Lstat(filename string) (os.FileInfo, error) { return os.Lstat(filepath.Clean(filename)) } func (fs *ChrootOS) Symlink(target, link string) error { if err := fs.createDir(link); err != nil { return err } return os.Symlink(target, link) } func (fs *ChrootOS) Readlink(link string) (string, error) { return os.Readlink(link) } // Capabilities implements the Capable interface. func (fs *ChrootOS) Capabilities() billy.Capability { return billy.DefaultCapabilities }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/osfs/os_wasip1.go
vendor/github.com/go-git/go-billy/v5/osfs/os_wasip1.go
//go:build wasip1 // +build wasip1 package osfs import ( "os" "syscall" ) func (f *file) Lock() error { f.m.Lock() defer f.m.Unlock() return nil } func (f *file) Unlock() error { f.m.Lock() defer f.m.Unlock() return nil } func rename(from, to string) error { return os.Rename(from, to) } // umask sets umask to a new value, and returns a func which allows the // caller to reset it back to what it was originally. func umask(new int) func() { old := syscall.Umask(new) return func() { syscall.Umask(old) } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/osfs/os_js.go
vendor/github.com/go-git/go-billy/v5/osfs/os_js.go
//go:build js // +build js package osfs import ( "github.com/go-git/go-billy/v5" "github.com/go-git/go-billy/v5/helper/chroot" "github.com/go-git/go-billy/v5/memfs" ) // globalMemFs is the global memory fs var globalMemFs = memfs.New() // Default Filesystem representing the root of in-memory filesystem for a // js/wasm environment. var Default = memfs.New() // New returns a new OS filesystem. func New(baseDir string, _ ...Option) billy.Filesystem { return chroot.New(Default, Default.Join("/", baseDir)) } type options struct { }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/osfs/os_bound.go
vendor/github.com/go-git/go-billy/v5/osfs/os_bound.go
//go:build !js // +build !js /* Copyright 2022 The Flux authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package osfs import ( "fmt" "os" "path/filepath" "strings" securejoin "github.com/cyphar/filepath-securejoin" "github.com/go-git/go-billy/v5" ) // BoundOS is a fs implementation based on the OS filesystem which is bound to // a base dir. // Prefer this fs implementation over ChrootOS. // // Behaviours of note: // 1. Read and write operations can only be directed to files which descends // from the base dir. // 2. Symlinks don't have their targets modified, and therefore can point // to locations outside the base dir or to non-existent paths. // 3. Readlink and Lstat ensures that the link file is located within the base // dir, evaluating any symlinks that file or base dir may contain. type BoundOS struct { baseDir string deduplicatePath bool } func newBoundOS(d string, deduplicatePath bool) billy.Filesystem { return &BoundOS{baseDir: d, deduplicatePath: deduplicatePath} } func (fs *BoundOS) Create(filename string) (billy.File, error) { return fs.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, defaultCreateMode) } func (fs *BoundOS) OpenFile(filename string, flag int, perm os.FileMode) (billy.File, error) { fn, err := fs.abs(filename) if err != nil { return nil, err } return openFile(fn, flag, perm, fs.createDir) } func (fs *BoundOS) ReadDir(path string) ([]os.FileInfo, error) { dir, err := fs.abs(path) if err != nil { return nil, err } return readDir(dir) } func (fs *BoundOS) Rename(from, to string) error { f, err := fs.abs(from) if err != nil { return err } t, err := fs.abs(to) if err != nil { return err } // MkdirAll for target name. if err := fs.createDir(t); err != nil { return err } return os.Rename(f, t) } func (fs *BoundOS) MkdirAll(path string, perm os.FileMode) error { dir, err := fs.abs(path) if err != nil { return err } return os.MkdirAll(dir, perm) } func (fs *BoundOS) Open(filename string) (billy.File, error) { return fs.OpenFile(filename, os.O_RDONLY, 0) } func (fs *BoundOS) Stat(filename string) (os.FileInfo, error) { filename, err := fs.abs(filename) if err != nil { return nil, err } return os.Stat(filename) } func (fs *BoundOS) Remove(filename string) error { fn, err := fs.abs(filename) if err != nil { return err } return os.Remove(fn) } // TempFile creates a temporary file. If dir is empty, the file // will be created within the OS Temporary dir. If dir is provided // it must descend from the current base dir. func (fs *BoundOS) TempFile(dir, prefix string) (billy.File, error) { if dir != "" { var err error dir, err = fs.abs(dir) if err != nil { return nil, err } } return tempFile(dir, prefix) } func (fs *BoundOS) Join(elem ...string) string { return filepath.Join(elem...) } func (fs *BoundOS) RemoveAll(path string) error { dir, err := fs.abs(path) if err != nil { return err } return os.RemoveAll(dir) } func (fs *BoundOS) Symlink(target, link string) error { ln, err := fs.abs(link) if err != nil { return err } // MkdirAll for containing dir. if err := fs.createDir(ln); err != nil { return err } return os.Symlink(target, ln) } func (fs *BoundOS) Lstat(filename string) (os.FileInfo, error) { filename = filepath.Clean(filename) if !filepath.IsAbs(filename) { filename = filepath.Join(fs.baseDir, filename) } if ok, err := fs.insideBaseDirEval(filename); !ok { return nil, err } return os.Lstat(filename) } func (fs *BoundOS) Readlink(link string) (string, error) { if !filepath.IsAbs(link) { link = filepath.Clean(filepath.Join(fs.baseDir, link)) } if ok, err := fs.insideBaseDirEval(link); !ok { return "", err } return os.Readlink(link) } // Chroot returns a new OS filesystem, with the base dir set to the // result of joining the provided path with the underlying base dir. func (fs *BoundOS) Chroot(path string) (billy.Filesystem, error) { joined, err := securejoin.SecureJoin(fs.baseDir, path) if err != nil { return nil, err } return New(joined), nil } // Root returns the current base dir of the billy.Filesystem. // This is required in order for this implementation to be a drop-in // replacement for other upstream implementations (e.g. memory and osfs). func (fs *BoundOS) Root() string { return fs.baseDir } func (fs *BoundOS) createDir(fullpath string) error { dir := filepath.Dir(fullpath) if dir != "." { if err := os.MkdirAll(dir, defaultDirectoryMode); err != nil { return err } } return nil } // abs transforms filename to an absolute path, taking into account the base dir. // Relative paths won't be allowed to ascend the base dir, so `../file` will become // `/working-dir/file`. // // Note that if filename is a symlink, the returned address will be the target of the // symlink. func (fs *BoundOS) abs(filename string) (string, error) { if filename == fs.baseDir { filename = string(filepath.Separator) } path, err := securejoin.SecureJoin(fs.baseDir, filename) if err != nil { return "", nil } if fs.deduplicatePath { vol := filepath.VolumeName(fs.baseDir) dup := filepath.Join(fs.baseDir, fs.baseDir[len(vol):]) if strings.HasPrefix(path, dup+string(filepath.Separator)) { return fs.abs(path[len(dup):]) } } return path, nil } // insideBaseDir checks whether filename is located within // the fs.baseDir. func (fs *BoundOS) insideBaseDir(filename string) (bool, error) { if filename == fs.baseDir { return true, nil } if !strings.HasPrefix(filename, fs.baseDir+string(filepath.Separator)) { return false, fmt.Errorf("path outside base dir") } return true, nil } // insideBaseDirEval checks whether filename is contained within // a dir that is within the fs.baseDir, by first evaluating any symlinks // that either filename or fs.baseDir may contain. func (fs *BoundOS) insideBaseDirEval(filename string) (bool, error) { // "/" contains all others. if fs.baseDir == "/" { return true, nil } dir, err := filepath.EvalSymlinks(filepath.Dir(filename)) if dir == "" || os.IsNotExist(err) { dir = filepath.Dir(filename) } wd, err := filepath.EvalSymlinks(fs.baseDir) if wd == "" || os.IsNotExist(err) { wd = fs.baseDir } if filename != wd && dir != wd && !strings.HasPrefix(dir, wd+string(filepath.Separator)) { return false, fmt.Errorf("%q: path outside base dir %q: %w", filename, fs.baseDir, os.ErrNotExist) } return true, nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/osfs/os_options.go
vendor/github.com/go-git/go-billy/v5/osfs/os_options.go
package osfs type Option func(*options)
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/osfs/os_windows.go
vendor/github.com/go-git/go-billy/v5/osfs/os_windows.go
//go:build windows // +build windows package osfs import ( "os" "runtime" "unsafe" "golang.org/x/sys/windows" ) var ( kernel32DLL = windows.NewLazySystemDLL("kernel32.dll") lockFileExProc = kernel32DLL.NewProc("LockFileEx") unlockFileProc = kernel32DLL.NewProc("UnlockFile") ) const ( lockfileExclusiveLock = 0x2 ) func (f *file) Lock() error { f.m.Lock() defer f.m.Unlock() var overlapped windows.Overlapped // err is always non-nil as per sys/windows semantics. ret, _, err := lockFileExProc.Call(f.File.Fd(), lockfileExclusiveLock, 0, 0xFFFFFFFF, 0, uintptr(unsafe.Pointer(&overlapped))) runtime.KeepAlive(&overlapped) if ret == 0 { return err } return nil } func (f *file) Unlock() error { f.m.Lock() defer f.m.Unlock() // err is always non-nil as per sys/windows semantics. ret, _, err := unlockFileProc.Call(f.File.Fd(), 0, 0, 0xFFFFFFFF, 0) if ret == 0 { return err } return nil } func rename(from, to string) error { return os.Rename(from, to) } func umask(new int) func() { return func() { } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/go-git/go-billy/v5/osfs/os.go
vendor/github.com/go-git/go-billy/v5/osfs/os.go
//go:build !js // +build !js // Package osfs provides a billy filesystem for the OS. package osfs import ( "fmt" "io/fs" "os" "sync" "github.com/go-git/go-billy/v5" ) const ( defaultDirectoryMode = 0o755 defaultCreateMode = 0o666 ) // Default Filesystem representing the root of the os filesystem. var Default = &ChrootOS{} // New returns a new OS filesystem. // By default paths are deduplicated, but still enforced // under baseDir. For more info refer to WithDeduplicatePath. func New(baseDir string, opts ...Option) billy.Filesystem { o := &options{ deduplicatePath: true, } for _, opt := range opts { opt(o) } if o.Type == BoundOSFS { return newBoundOS(baseDir, o.deduplicatePath) } return newChrootOS(baseDir) } // WithBoundOS returns the option of using a Bound filesystem OS. func WithBoundOS() Option { return func(o *options) { o.Type = BoundOSFS } } // WithChrootOS returns the option of using a Chroot filesystem OS. func WithChrootOS() Option { return func(o *options) { o.Type = ChrootOSFS } } // WithDeduplicatePath toggles the deduplication of the base dir in the path. // This occurs when absolute links are being used. // Assuming base dir /base/dir and an absolute symlink /base/dir/target: // // With DeduplicatePath (default): /base/dir/target // Without DeduplicatePath: /base/dir/base/dir/target // // This option is only used by the BoundOS OS type. func WithDeduplicatePath(enabled bool) Option { return func(o *options) { o.deduplicatePath = enabled } } type options struct { Type deduplicatePath bool } type Type int const ( ChrootOSFS Type = iota BoundOSFS ) func readDir(dir string) ([]os.FileInfo, error) { entries, err := os.ReadDir(dir) if err != nil { return nil, err } infos := make([]fs.FileInfo, 0, len(entries)) for _, entry := range entries { fi, err := entry.Info() if err != nil { return nil, err } infos = append(infos, fi) } return infos, nil } func tempFile(dir, prefix string) (billy.File, error) { f, err := os.CreateTemp(dir, prefix) if err != nil { return nil, err } return &file{File: f}, nil } func openFile(fn string, flag int, perm os.FileMode, createDir func(string) error) (billy.File, error) { if flag&os.O_CREATE != 0 { if createDir == nil { return nil, fmt.Errorf("createDir func cannot be nil if file needs to be opened in create mode") } if err := createDir(fn); err != nil { return nil, err } } f, err := os.OpenFile(fn, flag, perm) if err != nil { return nil, err } return &file{File: f}, err } // file is a wrapper for an os.File which adds support for file locking. type file struct { *os.File m sync.Mutex }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/cloudfoundry/jibber_jabber/jibber_jabber_unix.go
vendor/github.com/cloudfoundry/jibber_jabber/jibber_jabber_unix.go
// +build darwin freebsd linux netbsd openbsd package jibber_jabber import ( "errors" "os" "strings" ) func getLangFromEnv() (locale string) { locale = os.Getenv("LC_ALL") if locale == "" { locale = os.Getenv("LANG") } return } func getUnixLocale() (unix_locale string, err error) { unix_locale = getLangFromEnv() if unix_locale == "" { err = errors.New(COULD_NOT_DETECT_PACKAGE_ERROR_MESSAGE) } return } func DetectIETF() (locale string, err error) { unix_locale, err := getUnixLocale() if err == nil { language, territory := splitLocale(unix_locale) locale = language if territory != "" { locale = strings.Join([]string{language, territory}, "-") } } return } func DetectLanguage() (language string, err error) { unix_locale, err := getUnixLocale() if err == nil { language, _ = splitLocale(unix_locale) } return } func DetectTerritory() (territory string, err error) { unix_locale, err := getUnixLocale() if err == nil { _, territory = splitLocale(unix_locale) } return }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/cloudfoundry/jibber_jabber/jibber_jabber.go
vendor/github.com/cloudfoundry/jibber_jabber/jibber_jabber.go
package jibber_jabber import ( "strings" ) const ( COULD_NOT_DETECT_PACKAGE_ERROR_MESSAGE = "Could not detect Language" ) func splitLocale(locale string) (string, string) { formattedLocale := strings.Split(locale, ".")[0] formattedLocale = strings.Replace(formattedLocale, "-", "_", -1) pieces := strings.Split(formattedLocale, "_") language := pieces[0] territory := "" if len(pieces) > 1 { territory = strings.Split(formattedLocale, "_")[1] } return language, territory }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/cloudfoundry/jibber_jabber/jibber_jabber_windows.go
vendor/github.com/cloudfoundry/jibber_jabber/jibber_jabber_windows.go
// +build windows package jibber_jabber import ( "errors" "syscall" "unsafe" ) const LOCALE_NAME_MAX_LENGTH uint32 = 85 var SUPPORTED_LOCALES = map[uintptr]string{ 0x0407: "de-DE", 0x0409: "en-US", 0x0c0a: "es-ES", //or is it 0x040a 0x040c: "fr-FR", 0x0410: "it-IT", 0x0411: "ja-JA", 0x0412: "ko_KR", 0x0416: "pt-BR", //0x0419: "ru_RU", - Will add support for Russian when nicksnyder/go-i18n supports Russian 0x0804: "zh-CN", 0x0c04: "zh-HK", 0x0404: "zh-TW", } func getWindowsLocaleFrom(sysCall string) (locale string, err error) { buffer := make([]uint16, LOCALE_NAME_MAX_LENGTH) dll := syscall.MustLoadDLL("kernel32") proc := dll.MustFindProc(sysCall) r, _, dllError := proc.Call(uintptr(unsafe.Pointer(&buffer[0])), uintptr(LOCALE_NAME_MAX_LENGTH)) if r == 0 { err = errors.New(COULD_NOT_DETECT_PACKAGE_ERROR_MESSAGE + ":\n" + dllError.Error()) return } locale = syscall.UTF16ToString(buffer) return } func getAllWindowsLocaleFrom(sysCall string) (string, error) { dll, err := syscall.LoadDLL("kernel32") if err != nil { return "", errors.New("Could not find kernel32 dll") } proc, err := dll.FindProc(sysCall) if err != nil { return "", err } locale, _, dllError := proc.Call() if locale == 0 { return "", errors.New(COULD_NOT_DETECT_PACKAGE_ERROR_MESSAGE + ":\n" + dllError.Error()) } return SUPPORTED_LOCALES[locale], nil } func getWindowsLocale() (locale string, err error) { dll, err := syscall.LoadDLL("kernel32") if err != nil { return "", errors.New("Could not find kernel32 dll") } proc, err := dll.FindProc("GetVersion") if err != nil { return "", err } v, _, _ := proc.Call() windowsVersion := byte(v) isVistaOrGreater := (windowsVersion >= 6) if isVistaOrGreater { locale, err = getWindowsLocaleFrom("GetUserDefaultLocaleName") if err != nil { locale, err = getWindowsLocaleFrom("GetSystemDefaultLocaleName") } } else if !isVistaOrGreater { locale, err = getAllWindowsLocaleFrom("GetUserDefaultLCID") if err != nil { locale, err = getAllWindowsLocaleFrom("GetSystemDefaultLCID") } } else { panic(v) } return } func DetectIETF() (locale string, err error) { locale, err = getWindowsLocale() return } func DetectLanguage() (language string, err error) { windows_locale, err := getWindowsLocale() if err == nil { language, _ = splitLocale(windows_locale) } return } func DetectTerritory() (territory string, err error) { windows_locale, err := getWindowsLocale() if err == nil { _, territory = splitLocale(windows_locale) } return }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/emirpasic/gods/lists/lists.go
vendor/github.com/emirpasic/gods/lists/lists.go
// Copyright (c) 2015, Emir Pasic. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package lists provides an abstract List interface. // // In computer science, a list or sequence is an abstract data type that represents an ordered sequence of values, where the same value may occur more than once. An instance of a list is a computer representation of the mathematical concept of a finite sequence; the (potentially) infinite analog of a list is a stream. Lists are a basic example of containers, as they contain other values. If the same value occurs multiple times, each occurrence is considered a distinct item. // // Reference: https://en.wikipedia.org/wiki/List_%28abstract_data_type%29 package lists import ( "github.com/emirpasic/gods/containers" "github.com/emirpasic/gods/utils" ) // List interface that all lists implement type List interface { Get(index int) (interface{}, bool) Remove(index int) Add(values ...interface{}) Contains(values ...interface{}) bool Sort(comparator utils.Comparator) Swap(index1, index2 int) Insert(index int, values ...interface{}) Set(index int, value interface{}) containers.Container // Empty() bool // Size() int // Clear() // Values() []interface{} // String() string }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/emirpasic/gods/lists/arraylist/enumerable.go
vendor/github.com/emirpasic/gods/lists/arraylist/enumerable.go
// Copyright (c) 2015, Emir Pasic. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package arraylist import "github.com/emirpasic/gods/containers" // Assert Enumerable implementation var _ containers.EnumerableWithIndex = (*List)(nil) // Each calls the given function once for each element, passing that element's index and value. func (list *List) Each(f func(index int, value interface{})) { iterator := list.Iterator() for iterator.Next() { f(iterator.Index(), iterator.Value()) } } // Map invokes the given function once for each element and returns a // container containing the values returned by the given function. func (list *List) Map(f func(index int, value interface{}) interface{}) *List { newList := &List{} iterator := list.Iterator() for iterator.Next() { newList.Add(f(iterator.Index(), iterator.Value())) } return newList } // Select returns a new container containing all elements for which the given function returns a true value. func (list *List) Select(f func(index int, value interface{}) bool) *List { newList := &List{} iterator := list.Iterator() for iterator.Next() { if f(iterator.Index(), iterator.Value()) { newList.Add(iterator.Value()) } } return newList } // Any passes each element of the collection to the given function and // returns true if the function ever returns true for any element. func (list *List) Any(f func(index int, value interface{}) bool) bool { iterator := list.Iterator() for iterator.Next() { if f(iterator.Index(), iterator.Value()) { return true } } return false } // All passes each element of the collection to the given function and // returns true if the function returns true for all elements. func (list *List) All(f func(index int, value interface{}) bool) bool { iterator := list.Iterator() for iterator.Next() { if !f(iterator.Index(), iterator.Value()) { return false } } return true } // Find passes each element of the container to the given function and returns // the first (index,value) for which the function is true or -1,nil otherwise // if no element matches the criteria. func (list *List) Find(f func(index int, value interface{}) bool) (int, interface{}) { iterator := list.Iterator() for iterator.Next() { if f(iterator.Index(), iterator.Value()) { return iterator.Index(), iterator.Value() } } return -1, nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/emirpasic/gods/lists/arraylist/iterator.go
vendor/github.com/emirpasic/gods/lists/arraylist/iterator.go
// Copyright (c) 2015, Emir Pasic. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package arraylist import "github.com/emirpasic/gods/containers" // Assert Iterator implementation var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil) // Iterator holding the iterator's state type Iterator struct { list *List index int } // Iterator returns a stateful iterator whose values can be fetched by an index. func (list *List) Iterator() Iterator { return Iterator{list: list, index: -1} } // Next moves the iterator to the next element and returns true if there was a next element in the container. // If Next() returns true, then next element's index and value can be retrieved by Index() and Value(). // If Next() was called for the first time, then it will point the iterator to the first element if it exists. // Modifies the state of the iterator. func (iterator *Iterator) Next() bool { if iterator.index < iterator.list.size { iterator.index++ } return iterator.list.withinRange(iterator.index) } // Prev moves the iterator to the previous element and returns true if there was a previous element in the container. // If Prev() returns true, then previous element's index and value can be retrieved by Index() and Value(). // Modifies the state of the iterator. func (iterator *Iterator) Prev() bool { if iterator.index >= 0 { iterator.index-- } return iterator.list.withinRange(iterator.index) } // Value returns the current element's value. // Does not modify the state of the iterator. func (iterator *Iterator) Value() interface{} { return iterator.list.elements[iterator.index] } // Index returns the current element's index. // Does not modify the state of the iterator. func (iterator *Iterator) Index() int { return iterator.index } // Begin resets the iterator to its initial state (one-before-first) // Call Next() to fetch the first element if any. func (iterator *Iterator) Begin() { iterator.index = -1 } // End moves the iterator past the last element (one-past-the-end). // Call Prev() to fetch the last element if any. func (iterator *Iterator) End() { iterator.index = iterator.list.size } // First moves the iterator to the first element and returns true if there was a first element in the container. // If First() returns true, then first element's index and value can be retrieved by Index() and Value(). // Modifies the state of the iterator. func (iterator *Iterator) First() bool { iterator.Begin() return iterator.Next() } // Last moves the iterator to the last element and returns true if there was a last element in the container. // If Last() returns true, then last element's index and value can be retrieved by Index() and Value(). // Modifies the state of the iterator. func (iterator *Iterator) Last() bool { iterator.End() return iterator.Prev() } // NextTo moves the iterator to the next element from current position that satisfies the condition given by the // passed function, and returns true if there was a next element in the container. // If NextTo() returns true, then next element's index and value can be retrieved by Index() and Value(). // Modifies the state of the iterator. func (iterator *Iterator) NextTo(f func(index int, value interface{}) bool) bool { for iterator.Next() { index, value := iterator.Index(), iterator.Value() if f(index, value) { return true } } return false } // PrevTo moves the iterator to the previous element from current position that satisfies the condition given by the // passed function, and returns true if there was a next element in the container. // If PrevTo() returns true, then next element's index and value can be retrieved by Index() and Value(). // Modifies the state of the iterator. func (iterator *Iterator) PrevTo(f func(index int, value interface{}) bool) bool { for iterator.Prev() { index, value := iterator.Index(), iterator.Value() if f(index, value) { return true } } return false }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/emirpasic/gods/lists/arraylist/arraylist.go
vendor/github.com/emirpasic/gods/lists/arraylist/arraylist.go
// Copyright (c) 2015, Emir Pasic. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package arraylist implements the array list. // // Structure is not thread safe. // // Reference: https://en.wikipedia.org/wiki/List_%28abstract_data_type%29 package arraylist import ( "fmt" "strings" "github.com/emirpasic/gods/lists" "github.com/emirpasic/gods/utils" ) // Assert List implementation var _ lists.List = (*List)(nil) // List holds the elements in a slice type List struct { elements []interface{} size int } const ( growthFactor = float32(2.0) // growth by 100% shrinkFactor = float32(0.25) // shrink when size is 25% of capacity (0 means never shrink) ) // New instantiates a new list and adds the passed values, if any, to the list func New(values ...interface{}) *List { list := &List{} if len(values) > 0 { list.Add(values...) } return list } // Add appends a value at the end of the list func (list *List) Add(values ...interface{}) { list.growBy(len(values)) for _, value := range values { list.elements[list.size] = value list.size++ } } // Get returns the element at index. // Second return parameter is true if index is within bounds of the array and array is not empty, otherwise false. func (list *List) Get(index int) (interface{}, bool) { if !list.withinRange(index) { return nil, false } return list.elements[index], true } // Remove removes the element at the given index from the list. func (list *List) Remove(index int) { if !list.withinRange(index) { return } list.elements[index] = nil // cleanup reference copy(list.elements[index:], list.elements[index+1:list.size]) // shift to the left by one (slow operation, need ways to optimize this) list.size-- list.shrink() } // Contains checks if elements (one or more) are present in the set. // All elements have to be present in the set for the method to return true. // Performance time complexity of n^2. // Returns true if no arguments are passed at all, i.e. set is always super-set of empty set. func (list *List) Contains(values ...interface{}) bool { for _, searchValue := range values { found := false for index := 0; index < list.size; index++ { if list.elements[index] == searchValue { found = true break } } if !found { return false } } return true } // Values returns all elements in the list. func (list *List) Values() []interface{} { newElements := make([]interface{}, list.size, list.size) copy(newElements, list.elements[:list.size]) return newElements } //IndexOf returns index of provided element func (list *List) IndexOf(value interface{}) int { if list.size == 0 { return -1 } for index, element := range list.elements { if element == value { return index } } return -1 } // Empty returns true if list does not contain any elements. func (list *List) Empty() bool { return list.size == 0 } // Size returns number of elements within the list. func (list *List) Size() int { return list.size } // Clear removes all elements from the list. func (list *List) Clear() { list.size = 0 list.elements = []interface{}{} } // Sort sorts values (in-place) using. func (list *List) Sort(comparator utils.Comparator) { if len(list.elements) < 2 { return } utils.Sort(list.elements[:list.size], comparator) } // Swap swaps the two values at the specified positions. func (list *List) Swap(i, j int) { if list.withinRange(i) && list.withinRange(j) { list.elements[i], list.elements[j] = list.elements[j], list.elements[i] } } // Insert inserts values at specified index position shifting the value at that position (if any) and any subsequent elements to the right. // Does not do anything if position is negative or bigger than list's size // Note: position equal to list's size is valid, i.e. append. func (list *List) Insert(index int, values ...interface{}) { if !list.withinRange(index) { // Append if index == list.size { list.Add(values...) } return } l := len(values) list.growBy(l) list.size += l copy(list.elements[index+l:], list.elements[index:list.size-l]) copy(list.elements[index:], values) } // Set the value at specified index // Does not do anything if position is negative or bigger than list's size // Note: position equal to list's size is valid, i.e. append. func (list *List) Set(index int, value interface{}) { if !list.withinRange(index) { // Append if index == list.size { list.Add(value) } return } list.elements[index] = value } // String returns a string representation of container func (list *List) String() string { str := "ArrayList\n" values := []string{} for _, value := range list.elements[:list.size] { values = append(values, fmt.Sprintf("%v", value)) } str += strings.Join(values, ", ") return str } // Check that the index is within bounds of the list func (list *List) withinRange(index int) bool { return index >= 0 && index < list.size } func (list *List) resize(cap int) { newElements := make([]interface{}, cap, cap) copy(newElements, list.elements) list.elements = newElements } // Expand the array if necessary, i.e. capacity will be reached if we add n elements func (list *List) growBy(n int) { // When capacity is reached, grow by a factor of growthFactor and add number of elements currentCapacity := cap(list.elements) if list.size+n >= currentCapacity { newCapacity := int(growthFactor * float32(currentCapacity+n)) list.resize(newCapacity) } } // Shrink the array if necessary, i.e. when size is shrinkFactor percent of current capacity func (list *List) shrink() { if shrinkFactor == 0.0 { return } // Shrink when size is at shrinkFactor * capacity currentCapacity := cap(list.elements) if list.size <= int(float32(currentCapacity)*shrinkFactor) { list.resize(list.size) } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/emirpasic/gods/lists/arraylist/serialization.go
vendor/github.com/emirpasic/gods/lists/arraylist/serialization.go
// Copyright (c) 2015, Emir Pasic. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package arraylist import ( "encoding/json" "github.com/emirpasic/gods/containers" ) // Assert Serialization implementation var _ containers.JSONSerializer = (*List)(nil) var _ containers.JSONDeserializer = (*List)(nil) // ToJSON outputs the JSON representation of list's elements. func (list *List) ToJSON() ([]byte, error) { return json.Marshal(list.elements[:list.size]) } // FromJSON populates list's elements from the input JSON representation. func (list *List) FromJSON(data []byte) error { err := json.Unmarshal(data, &list.elements) if err == nil { list.size = len(list.elements) } return err } // UnmarshalJSON @implements json.Unmarshaler func (list *List) UnmarshalJSON(bytes []byte) error { return list.FromJSON(bytes) } // MarshalJSON @implements json.Marshaler func (list *List) MarshalJSON() ([]byte, error) { return list.ToJSON() }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/emirpasic/gods/utils/comparator.go
vendor/github.com/emirpasic/gods/utils/comparator.go
// Copyright (c) 2015, Emir Pasic. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package utils import "time" // Comparator will make type assertion (see IntComparator for example), // which will panic if a or b are not of the asserted type. // // Should return a number: // negative , if a < b // zero , if a == b // positive , if a > b type Comparator func(a, b interface{}) int // StringComparator provides a fast comparison on strings func StringComparator(a, b interface{}) int { s1 := a.(string) s2 := b.(string) min := len(s2) if len(s1) < len(s2) { min = len(s1) } diff := 0 for i := 0; i < min && diff == 0; i++ { diff = int(s1[i]) - int(s2[i]) } if diff == 0 { diff = len(s1) - len(s2) } if diff < 0 { return -1 } if diff > 0 { return 1 } return 0 } // IntComparator provides a basic comparison on int func IntComparator(a, b interface{}) int { aAsserted := a.(int) bAsserted := b.(int) switch { case aAsserted > bAsserted: return 1 case aAsserted < bAsserted: return -1 default: return 0 } } // Int8Comparator provides a basic comparison on int8 func Int8Comparator(a, b interface{}) int { aAsserted := a.(int8) bAsserted := b.(int8) switch { case aAsserted > bAsserted: return 1 case aAsserted < bAsserted: return -1 default: return 0 } } // Int16Comparator provides a basic comparison on int16 func Int16Comparator(a, b interface{}) int { aAsserted := a.(int16) bAsserted := b.(int16) switch { case aAsserted > bAsserted: return 1 case aAsserted < bAsserted: return -1 default: return 0 } } // Int32Comparator provides a basic comparison on int32 func Int32Comparator(a, b interface{}) int { aAsserted := a.(int32) bAsserted := b.(int32) switch { case aAsserted > bAsserted: return 1 case aAsserted < bAsserted: return -1 default: return 0 } } // Int64Comparator provides a basic comparison on int64 func Int64Comparator(a, b interface{}) int { aAsserted := a.(int64) bAsserted := b.(int64) switch { case aAsserted > bAsserted: return 1 case aAsserted < bAsserted: return -1 default: return 0 } } // UIntComparator provides a basic comparison on uint func UIntComparator(a, b interface{}) int { aAsserted := a.(uint) bAsserted := b.(uint) switch { case aAsserted > bAsserted: return 1 case aAsserted < bAsserted: return -1 default: return 0 } } // UInt8Comparator provides a basic comparison on uint8 func UInt8Comparator(a, b interface{}) int { aAsserted := a.(uint8) bAsserted := b.(uint8) switch { case aAsserted > bAsserted: return 1 case aAsserted < bAsserted: return -1 default: return 0 } } // UInt16Comparator provides a basic comparison on uint16 func UInt16Comparator(a, b interface{}) int { aAsserted := a.(uint16) bAsserted := b.(uint16) switch { case aAsserted > bAsserted: return 1 case aAsserted < bAsserted: return -1 default: return 0 } } // UInt32Comparator provides a basic comparison on uint32 func UInt32Comparator(a, b interface{}) int { aAsserted := a.(uint32) bAsserted := b.(uint32) switch { case aAsserted > bAsserted: return 1 case aAsserted < bAsserted: return -1 default: return 0 } } // UInt64Comparator provides a basic comparison on uint64 func UInt64Comparator(a, b interface{}) int { aAsserted := a.(uint64) bAsserted := b.(uint64) switch { case aAsserted > bAsserted: return 1 case aAsserted < bAsserted: return -1 default: return 0 } } // Float32Comparator provides a basic comparison on float32 func Float32Comparator(a, b interface{}) int { aAsserted := a.(float32) bAsserted := b.(float32) switch { case aAsserted > bAsserted: return 1 case aAsserted < bAsserted: return -1 default: return 0 } } // Float64Comparator provides a basic comparison on float64 func Float64Comparator(a, b interface{}) int { aAsserted := a.(float64) bAsserted := b.(float64) switch { case aAsserted > bAsserted: return 1 case aAsserted < bAsserted: return -1 default: return 0 } } // ByteComparator provides a basic comparison on byte func ByteComparator(a, b interface{}) int { aAsserted := a.(byte) bAsserted := b.(byte) switch { case aAsserted > bAsserted: return 1 case aAsserted < bAsserted: return -1 default: return 0 } } // RuneComparator provides a basic comparison on rune func RuneComparator(a, b interface{}) int { aAsserted := a.(rune) bAsserted := b.(rune) switch { case aAsserted > bAsserted: return 1 case aAsserted < bAsserted: return -1 default: return 0 } } // TimeComparator provides a basic comparison on time.Time func TimeComparator(a, b interface{}) int { aAsserted := a.(time.Time) bAsserted := b.(time.Time) switch { case aAsserted.After(bAsserted): return 1 case aAsserted.Before(bAsserted): return -1 default: return 0 } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/emirpasic/gods/utils/sort.go
vendor/github.com/emirpasic/gods/utils/sort.go
// Copyright (c) 2015, Emir Pasic. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package utils import "sort" // Sort sorts values (in-place) with respect to the given comparator. // // Uses Go's sort (hybrid of quicksort for large and then insertion sort for smaller slices). func Sort(values []interface{}, comparator Comparator) { sort.Sort(sortable{values, comparator}) } type sortable struct { values []interface{} comparator Comparator } func (s sortable) Len() int { return len(s.values) } func (s sortable) Swap(i, j int) { s.values[i], s.values[j] = s.values[j], s.values[i] } func (s sortable) Less(i, j int) bool { return s.comparator(s.values[i], s.values[j]) < 0 }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/emirpasic/gods/utils/utils.go
vendor/github.com/emirpasic/gods/utils/utils.go
// Copyright (c) 2015, Emir Pasic. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package utils provides common utility functions. // // Provided functionalities: // - sorting // - comparators package utils import ( "fmt" "strconv" ) // ToString converts a value to string. func ToString(value interface{}) string { switch value := value.(type) { case string: return value case int8: return strconv.FormatInt(int64(value), 10) case int16: return strconv.FormatInt(int64(value), 10) case int32: return strconv.FormatInt(int64(value), 10) case int64: return strconv.FormatInt(value, 10) case uint8: return strconv.FormatUint(uint64(value), 10) case uint16: return strconv.FormatUint(uint64(value), 10) case uint32: return strconv.FormatUint(uint64(value), 10) case uint64: return strconv.FormatUint(value, 10) case float32: return strconv.FormatFloat(float64(value), 'g', -1, 64) case float64: return strconv.FormatFloat(value, 'g', -1, 64) case bool: return strconv.FormatBool(value) default: return fmt.Sprintf("%+v", value) } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/emirpasic/gods/containers/enumerable.go
vendor/github.com/emirpasic/gods/containers/enumerable.go
// Copyright (c) 2015, Emir Pasic. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package containers // EnumerableWithIndex provides functions for ordered containers whose values can be fetched by an index. type EnumerableWithIndex interface { // Each calls the given function once for each element, passing that element's index and value. Each(func(index int, value interface{})) // Map invokes the given function once for each element and returns a // container containing the values returned by the given function. // Map(func(index int, value interface{}) interface{}) Container // Select returns a new container containing all elements for which the given function returns a true value. // Select(func(index int, value interface{}) bool) Container // Any passes each element of the container to the given function and // returns true if the function ever returns true for any element. Any(func(index int, value interface{}) bool) bool // All passes each element of the container to the given function and // returns true if the function returns true for all elements. All(func(index int, value interface{}) bool) bool // Find passes each element of the container to the given function and returns // the first (index,value) for which the function is true or -1,nil otherwise // if no element matches the criteria. Find(func(index int, value interface{}) bool) (int, interface{}) } // EnumerableWithKey provides functions for ordered containers whose values whose elements are key/value pairs. type EnumerableWithKey interface { // Each calls the given function once for each element, passing that element's key and value. Each(func(key interface{}, value interface{})) // Map invokes the given function once for each element and returns a container // containing the values returned by the given function as key/value pairs. // Map(func(key interface{}, value interface{}) (interface{}, interface{})) Container // Select returns a new container containing all elements for which the given function returns a true value. // Select(func(key interface{}, value interface{}) bool) Container // Any passes each element of the container to the given function and // returns true if the function ever returns true for any element. Any(func(key interface{}, value interface{}) bool) bool // All passes each element of the container to the given function and // returns true if the function returns true for all elements. All(func(key interface{}, value interface{}) bool) bool // Find passes each element of the container to the given function and returns // the first (key,value) for which the function is true or nil,nil otherwise if no element // matches the criteria. Find(func(key interface{}, value interface{}) bool) (interface{}, interface{}) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/emirpasic/gods/containers/iterator.go
vendor/github.com/emirpasic/gods/containers/iterator.go
// Copyright (c) 2015, Emir Pasic. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package containers // IteratorWithIndex is stateful iterator for ordered containers whose values can be fetched by an index. type IteratorWithIndex interface { // Next moves the iterator to the next element and returns true if there was a next element in the container. // If Next() returns true, then next element's index and value can be retrieved by Index() and Value(). // If Next() was called for the first time, then it will point the iterator to the first element if it exists. // Modifies the state of the iterator. Next() bool // Value returns the current element's value. // Does not modify the state of the iterator. Value() interface{} // Index returns the current element's index. // Does not modify the state of the iterator. Index() int // Begin resets the iterator to its initial state (one-before-first) // Call Next() to fetch the first element if any. Begin() // First moves the iterator to the first element and returns true if there was a first element in the container. // If First() returns true, then first element's index and value can be retrieved by Index() and Value(). // Modifies the state of the iterator. First() bool // NextTo moves the iterator to the next element from current position that satisfies the condition given by the // passed function, and returns true if there was a next element in the container. // If NextTo() returns true, then next element's index and value can be retrieved by Index() and Value(). // Modifies the state of the iterator. NextTo(func(index int, value interface{}) bool) bool } // IteratorWithKey is a stateful iterator for ordered containers whose elements are key value pairs. type IteratorWithKey interface { // Next moves the iterator to the next element and returns true if there was a next element in the container. // If Next() returns true, then next element's key and value can be retrieved by Key() and Value(). // If Next() was called for the first time, then it will point the iterator to the first element if it exists. // Modifies the state of the iterator. Next() bool // Value returns the current element's value. // Does not modify the state of the iterator. Value() interface{} // Key returns the current element's key. // Does not modify the state of the iterator. Key() interface{} // Begin resets the iterator to its initial state (one-before-first) // Call Next() to fetch the first element if any. Begin() // First moves the iterator to the first element and returns true if there was a first element in the container. // If First() returns true, then first element's key and value can be retrieved by Key() and Value(). // Modifies the state of the iterator. First() bool // NextTo moves the iterator to the next element from current position that satisfies the condition given by the // passed function, and returns true if there was a next element in the container. // If NextTo() returns true, then next element's key and value can be retrieved by Key() and Value(). // Modifies the state of the iterator. NextTo(func(key interface{}, value interface{}) bool) bool } // ReverseIteratorWithIndex is stateful iterator for ordered containers whose values can be fetched by an index. // // Essentially it is the same as IteratorWithIndex, but provides additional: // // Prev() function to enable traversal in reverse // // Last() function to move the iterator to the last element. // // End() function to move the iterator past the last element (one-past-the-end). type ReverseIteratorWithIndex interface { // Prev moves the iterator to the previous element and returns true if there was a previous element in the container. // If Prev() returns true, then previous element's index and value can be retrieved by Index() and Value(). // Modifies the state of the iterator. Prev() bool // End moves the iterator past the last element (one-past-the-end). // Call Prev() to fetch the last element if any. End() // Last moves the iterator to the last element and returns true if there was a last element in the container. // If Last() returns true, then last element's index and value can be retrieved by Index() and Value(). // Modifies the state of the iterator. Last() bool // PrevTo moves the iterator to the previous element from current position that satisfies the condition given by the // passed function, and returns true if there was a next element in the container. // If PrevTo() returns true, then next element's index and value can be retrieved by Index() and Value(). // Modifies the state of the iterator. PrevTo(func(index int, value interface{}) bool) bool IteratorWithIndex } // ReverseIteratorWithKey is a stateful iterator for ordered containers whose elements are key value pairs. // // Essentially it is the same as IteratorWithKey, but provides additional: // // Prev() function to enable traversal in reverse // // Last() function to move the iterator to the last element. type ReverseIteratorWithKey interface { // Prev moves the iterator to the previous element and returns true if there was a previous element in the container. // If Prev() returns true, then previous element's key and value can be retrieved by Key() and Value(). // Modifies the state of the iterator. Prev() bool // End moves the iterator past the last element (one-past-the-end). // Call Prev() to fetch the last element if any. End() // Last moves the iterator to the last element and returns true if there was a last element in the container. // If Last() returns true, then last element's key and value can be retrieved by Key() and Value(). // Modifies the state of the iterator. Last() bool // PrevTo moves the iterator to the previous element from current position that satisfies the condition given by the // passed function, and returns true if there was a next element in the container. // If PrevTo() returns true, then next element's key and value can be retrieved by Key() and Value(). // Modifies the state of the iterator. PrevTo(func(key interface{}, value interface{}) bool) bool IteratorWithKey }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/emirpasic/gods/containers/containers.go
vendor/github.com/emirpasic/gods/containers/containers.go
// Copyright (c) 2015, Emir Pasic. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package containers provides core interfaces and functions for data structures. // // Container is the base interface for all data structures to implement. // // Iterators provide stateful iterators. // // Enumerable provides Ruby inspired (each, select, map, find, any?, etc.) container functions. // // Serialization provides serializers (marshalers) and deserializers (unmarshalers). package containers import "github.com/emirpasic/gods/utils" // Container is base interface that all data structures implement. type Container interface { Empty() bool Size() int Clear() Values() []interface{} String() string } // GetSortedValues returns sorted container's elements with respect to the passed comparator. // Does not affect the ordering of elements within the container. func GetSortedValues(container Container, comparator utils.Comparator) []interface{} { values := container.Values() if len(values) < 2 { return values } utils.Sort(values, comparator) return values }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/emirpasic/gods/containers/serialization.go
vendor/github.com/emirpasic/gods/containers/serialization.go
// Copyright (c) 2015, Emir Pasic. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package containers // JSONSerializer provides JSON serialization type JSONSerializer interface { // ToJSON outputs the JSON representation of containers's elements. ToJSON() ([]byte, error) // MarshalJSON @implements json.Marshaler MarshalJSON() ([]byte, error) } // JSONDeserializer provides JSON deserialization type JSONDeserializer interface { // FromJSON populates containers's elements from the input JSON representation. FromJSON([]byte) error // UnmarshalJSON @implements json.Unmarshaler UnmarshalJSON([]byte) error }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/emirpasic/gods/trees/trees.go
vendor/github.com/emirpasic/gods/trees/trees.go
// Copyright (c) 2015, Emir Pasic. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package trees provides an abstract Tree interface. // // In computer science, a tree is a widely used abstract data type (ADT) or data structure implementing this ADT that simulates a hierarchical tree structure, with a root value and subtrees of children with a parent node, represented as a set of linked nodes. // // Reference: https://en.wikipedia.org/wiki/Tree_%28data_structure%29 package trees import "github.com/emirpasic/gods/containers" // Tree interface that all trees implement type Tree interface { containers.Container // Empty() bool // Size() int // Clear() // Values() []interface{} // String() string }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/emirpasic/gods/trees/binaryheap/iterator.go
vendor/github.com/emirpasic/gods/trees/binaryheap/iterator.go
// Copyright (c) 2015, Emir Pasic. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package binaryheap import ( "github.com/emirpasic/gods/containers" ) // Assert Iterator implementation var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil) // Iterator returns a stateful iterator whose values can be fetched by an index. type Iterator struct { heap *Heap index int } // Iterator returns a stateful iterator whose values can be fetched by an index. func (heap *Heap) Iterator() Iterator { return Iterator{heap: heap, index: -1} } // Next moves the iterator to the next element and returns true if there was a next element in the container. // If Next() returns true, then next element's index and value can be retrieved by Index() and Value(). // If Next() was called for the first time, then it will point the iterator to the first element if it exists. // Modifies the state of the iterator. func (iterator *Iterator) Next() bool { if iterator.index < iterator.heap.Size() { iterator.index++ } return iterator.heap.withinRange(iterator.index) } // Prev moves the iterator to the previous element and returns true if there was a previous element in the container. // If Prev() returns true, then previous element's index and value can be retrieved by Index() and Value(). // Modifies the state of the iterator. func (iterator *Iterator) Prev() bool { if iterator.index >= 0 { iterator.index-- } return iterator.heap.withinRange(iterator.index) } // Value returns the current element's value. // Does not modify the state of the iterator. func (iterator *Iterator) Value() interface{} { start, end := evaluateRange(iterator.index) if end > iterator.heap.Size() { end = iterator.heap.Size() } tmpHeap := NewWith(iterator.heap.Comparator) for n := start; n < end; n++ { value, _ := iterator.heap.list.Get(n) tmpHeap.Push(value) } for n := 0; n < iterator.index-start; n++ { tmpHeap.Pop() } value, _ := tmpHeap.Pop() return value } // Index returns the current element's index. // Does not modify the state of the iterator. func (iterator *Iterator) Index() int { return iterator.index } // Begin resets the iterator to its initial state (one-before-first) // Call Next() to fetch the first element if any. func (iterator *Iterator) Begin() { iterator.index = -1 } // End moves the iterator past the last element (one-past-the-end). // Call Prev() to fetch the last element if any. func (iterator *Iterator) End() { iterator.index = iterator.heap.Size() } // First moves the iterator to the first element and returns true if there was a first element in the container. // If First() returns true, then first element's index and value can be retrieved by Index() and Value(). // Modifies the state of the iterator. func (iterator *Iterator) First() bool { iterator.Begin() return iterator.Next() } // Last moves the iterator to the last element and returns true if there was a last element in the container. // If Last() returns true, then last element's index and value can be retrieved by Index() and Value(). // Modifies the state of the iterator. func (iterator *Iterator) Last() bool { iterator.End() return iterator.Prev() } // NextTo moves the iterator to the next element from current position that satisfies the condition given by the // passed function, and returns true if there was a next element in the container. // If NextTo() returns true, then next element's index and value can be retrieved by Index() and Value(). // Modifies the state of the iterator. func (iterator *Iterator) NextTo(f func(index int, value interface{}) bool) bool { for iterator.Next() { index, value := iterator.Index(), iterator.Value() if f(index, value) { return true } } return false } // PrevTo moves the iterator to the previous element from current position that satisfies the condition given by the // passed function, and returns true if there was a next element in the container. // If PrevTo() returns true, then next element's index and value can be retrieved by Index() and Value(). // Modifies the state of the iterator. func (iterator *Iterator) PrevTo(f func(index int, value interface{}) bool) bool { for iterator.Prev() { index, value := iterator.Index(), iterator.Value() if f(index, value) { return true } } return false } // numOfBits counts the number of bits of an int func numOfBits(n int) uint { var count uint for n != 0 { count++ n >>= 1 } return count } // evaluateRange evaluates the index range [start,end) of same level nodes in the heap as the index func evaluateRange(index int) (start int, end int) { bits := numOfBits(index+1) - 1 start = 1<<bits - 1 end = start + 1<<bits return }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/emirpasic/gods/trees/binaryheap/binaryheap.go
vendor/github.com/emirpasic/gods/trees/binaryheap/binaryheap.go
// Copyright (c) 2015, Emir Pasic. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package binaryheap implements a binary heap backed by array list. // // Comparator defines this heap as either min or max heap. // // Structure is not thread safe. // // References: http://en.wikipedia.org/wiki/Binary_heap package binaryheap import ( "fmt" "github.com/emirpasic/gods/lists/arraylist" "github.com/emirpasic/gods/trees" "github.com/emirpasic/gods/utils" "strings" ) // Assert Tree implementation var _ trees.Tree = (*Heap)(nil) // Heap holds elements in an array-list type Heap struct { list *arraylist.List Comparator utils.Comparator } // NewWith instantiates a new empty heap tree with the custom comparator. func NewWith(comparator utils.Comparator) *Heap { return &Heap{list: arraylist.New(), Comparator: comparator} } // NewWithIntComparator instantiates a new empty heap with the IntComparator, i.e. elements are of type int. func NewWithIntComparator() *Heap { return &Heap{list: arraylist.New(), Comparator: utils.IntComparator} } // NewWithStringComparator instantiates a new empty heap with the StringComparator, i.e. elements are of type string. func NewWithStringComparator() *Heap { return &Heap{list: arraylist.New(), Comparator: utils.StringComparator} } // Push adds a value onto the heap and bubbles it up accordingly. func (heap *Heap) Push(values ...interface{}) { if len(values) == 1 { heap.list.Add(values[0]) heap.bubbleUp() } else { // Reference: https://en.wikipedia.org/wiki/Binary_heap#Building_a_heap for _, value := range values { heap.list.Add(value) } size := heap.list.Size()/2 + 1 for i := size; i >= 0; i-- { heap.bubbleDownIndex(i) } } } // Pop removes top element on heap and returns it, or nil if heap is empty. // Second return parameter is true, unless the heap was empty and there was nothing to pop. func (heap *Heap) Pop() (value interface{}, ok bool) { value, ok = heap.list.Get(0) if !ok { return } lastIndex := heap.list.Size() - 1 heap.list.Swap(0, lastIndex) heap.list.Remove(lastIndex) heap.bubbleDown() return } // Peek returns top element on the heap without removing it, or nil if heap is empty. // Second return parameter is true, unless the heap was empty and there was nothing to peek. func (heap *Heap) Peek() (value interface{}, ok bool) { return heap.list.Get(0) } // Empty returns true if heap does not contain any elements. func (heap *Heap) Empty() bool { return heap.list.Empty() } // Size returns number of elements within the heap. func (heap *Heap) Size() int { return heap.list.Size() } // Clear removes all elements from the heap. func (heap *Heap) Clear() { heap.list.Clear() } // Values returns all elements in the heap. func (heap *Heap) Values() []interface{} { values := make([]interface{}, heap.list.Size(), heap.list.Size()) for it := heap.Iterator(); it.Next(); { values[it.Index()] = it.Value() } return values } // String returns a string representation of container func (heap *Heap) String() string { str := "BinaryHeap\n" values := []string{} for it := heap.Iterator(); it.Next(); { values = append(values, fmt.Sprintf("%v", it.Value())) } str += strings.Join(values, ", ") return str } // Performs the "bubble down" operation. This is to place the element that is at the root // of the heap in its correct place so that the heap maintains the min/max-heap order property. func (heap *Heap) bubbleDown() { heap.bubbleDownIndex(0) } // Performs the "bubble down" operation. This is to place the element that is at the index // of the heap in its correct place so that the heap maintains the min/max-heap order property. func (heap *Heap) bubbleDownIndex(index int) { size := heap.list.Size() for leftIndex := index<<1 + 1; leftIndex < size; leftIndex = index<<1 + 1 { rightIndex := index<<1 + 2 smallerIndex := leftIndex leftValue, _ := heap.list.Get(leftIndex) rightValue, _ := heap.list.Get(rightIndex) if rightIndex < size && heap.Comparator(leftValue, rightValue) > 0 { smallerIndex = rightIndex } indexValue, _ := heap.list.Get(index) smallerValue, _ := heap.list.Get(smallerIndex) if heap.Comparator(indexValue, smallerValue) > 0 { heap.list.Swap(index, smallerIndex) } else { break } index = smallerIndex } } // Performs the "bubble up" operation. This is to place a newly inserted // element (i.e. last element in the list) in its correct place so that // the heap maintains the min/max-heap order property. func (heap *Heap) bubbleUp() { index := heap.list.Size() - 1 for parentIndex := (index - 1) >> 1; index > 0; parentIndex = (index - 1) >> 1 { indexValue, _ := heap.list.Get(index) parentValue, _ := heap.list.Get(parentIndex) if heap.Comparator(parentValue, indexValue) <= 0 { break } heap.list.Swap(index, parentIndex) index = parentIndex } } // Check that the index is within bounds of the list func (heap *Heap) withinRange(index int) bool { return index >= 0 && index < heap.list.Size() }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/emirpasic/gods/trees/binaryheap/serialization.go
vendor/github.com/emirpasic/gods/trees/binaryheap/serialization.go
// Copyright (c) 2015, Emir Pasic. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package binaryheap import ( "github.com/emirpasic/gods/containers" ) // Assert Serialization implementation var _ containers.JSONSerializer = (*Heap)(nil) var _ containers.JSONDeserializer = (*Heap)(nil) // ToJSON outputs the JSON representation of the heap. func (heap *Heap) ToJSON() ([]byte, error) { return heap.list.ToJSON() } // FromJSON populates the heap from the input JSON representation. func (heap *Heap) FromJSON(data []byte) error { return heap.list.FromJSON(data) } // UnmarshalJSON @implements json.Unmarshaler func (heap *Heap) UnmarshalJSON(bytes []byte) error { return heap.FromJSON(bytes) } // MarshalJSON @implements json.Marshaler func (heap *Heap) MarshalJSON() ([]byte, error) { return heap.ToJSON() }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/kardianos/osext/osext_windows.go
vendor/github.com/kardianos/osext/osext_windows.go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //+build !go1.8 package osext import ( "syscall" "unicode/utf16" "unsafe" ) var ( kernel = syscall.MustLoadDLL("kernel32.dll") getModuleFileNameProc = kernel.MustFindProc("GetModuleFileNameW") ) // GetModuleFileName() with hModule = NULL func executable() (exePath string, err error) { return getModuleFileName() } func getModuleFileName() (string, error) { var n uint32 b := make([]uint16, syscall.MAX_PATH) size := uint32(len(b)) r0, _, e1 := getModuleFileNameProc.Call(0, uintptr(unsafe.Pointer(&b[0])), uintptr(size)) n = uint32(r0) if n == 0 { return "", e1 } return string(utf16.Decode(b[0:n])), nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/kardianos/osext/osext_plan9.go
vendor/github.com/kardianos/osext/osext_plan9.go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //+build !go1.8 package osext import ( "os" "strconv" "syscall" ) func executable() (string, error) { f, err := os.Open("/proc/" + strconv.Itoa(os.Getpid()) + "/text") if err != nil { return "", err } defer f.Close() return syscall.Fd2path(int(f.Fd())) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/kardianos/osext/osext_go18.go
vendor/github.com/kardianos/osext/osext_go18.go
//+build go1.8,!openbsd package osext import "os" func executable() (string, error) { return os.Executable() }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/kardianos/osext/osext_procfs.go
vendor/github.com/kardianos/osext/osext_procfs.go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build !go1.8,android !go1.8,linux !go1.8,netbsd !go1.8,solaris !go1.8,dragonfly package osext import ( "errors" "fmt" "os" "runtime" "strings" ) func executable() (string, error) { switch runtime.GOOS { case "linux", "android": const deletedTag = " (deleted)" execpath, err := os.Readlink("/proc/self/exe") if err != nil { return execpath, err } execpath = strings.TrimSuffix(execpath, deletedTag) execpath = strings.TrimPrefix(execpath, deletedTag) return execpath, nil case "netbsd": return os.Readlink("/proc/curproc/exe") case "dragonfly": return os.Readlink("/proc/curproc/file") case "solaris": return os.Readlink(fmt.Sprintf("/proc/%d/path/a.out", os.Getpid())) } return "", errors.New("ExecPath not implemented for " + runtime.GOOS) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/kardianos/osext/osext.go
vendor/github.com/kardianos/osext/osext.go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Extensions to the standard "os" package. package osext // import "github.com/kardianos/osext" import "path/filepath" var cx, ce = executableClean() func executableClean() (string, error) { p, err := executable() return filepath.Clean(p), err } // Executable returns an absolute path that can be used to // re-invoke the current program. // It may not be valid after the current program exits. func Executable() (string, error) { return cx, ce } // Returns same path as Executable, returns just the folder // path. Excludes the executable name and any trailing slash. func ExecutableFolder() (string, error) { p, err := Executable() if err != nil { return "", err } return filepath.Dir(p), nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/kardianos/osext/osext_sysctl.go
vendor/github.com/kardianos/osext/osext_sysctl.go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build !go1.8,darwin !go1.8,freebsd openbsd package osext import ( "os" "os/exec" "path/filepath" "runtime" "syscall" "unsafe" ) var initCwd, initCwdErr = os.Getwd() func executable() (string, error) { var mib [4]int32 switch runtime.GOOS { case "freebsd": mib = [4]int32{1 /* CTL_KERN */, 14 /* KERN_PROC */, 12 /* KERN_PROC_PATHNAME */, -1} case "darwin": mib = [4]int32{1 /* CTL_KERN */, 38 /* KERN_PROCARGS */, int32(os.Getpid()), -1} case "openbsd": mib = [4]int32{1 /* CTL_KERN */, 55 /* KERN_PROC_ARGS */, int32(os.Getpid()), 1 /* KERN_PROC_ARGV */} } n := uintptr(0) // Get length. _, _, errNum := syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 4, 0, uintptr(unsafe.Pointer(&n)), 0, 0) if errNum != 0 { return "", errNum } if n == 0 { // This shouldn't happen. return "", nil } buf := make([]byte, n) _, _, errNum = syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 4, uintptr(unsafe.Pointer(&buf[0])), uintptr(unsafe.Pointer(&n)), 0, 0) if errNum != 0 { return "", errNum } if n == 0 { // This shouldn't happen. return "", nil } var execPath string switch runtime.GOOS { case "openbsd": // buf now contains **argv, with pointers to each of the C-style // NULL terminated arguments. var args []string argv := uintptr(unsafe.Pointer(&buf[0])) Loop: for { argp := *(**[1 << 20]byte)(unsafe.Pointer(argv)) if argp == nil { break } for i := 0; uintptr(i) < n; i++ { // we don't want the full arguments list if string(argp[i]) == " " { break Loop } if argp[i] != 0 { continue } args = append(args, string(argp[:i])) n -= uintptr(i) break } if n < unsafe.Sizeof(argv) { break } argv += unsafe.Sizeof(argv) n -= unsafe.Sizeof(argv) } execPath = args[0] // There is no canonical way to get an executable path on // OpenBSD, so check PATH in case we are called directly if execPath[0] != '/' && execPath[0] != '.' { execIsInPath, err := exec.LookPath(execPath) if err == nil { execPath = execIsInPath } } default: for i, v := range buf { if v == 0 { buf = buf[:i] break } } execPath = string(buf) } var err error // execPath will not be empty due to above checks. // Try to get the absolute path if the execPath is not rooted. if execPath[0] != '/' { execPath, err = getAbs(execPath) if err != nil { return execPath, err } } // For darwin KERN_PROCARGS may return the path to a symlink rather than the // actual executable. if runtime.GOOS == "darwin" { if execPath, err = filepath.EvalSymlinks(execPath); err != nil { return execPath, err } } return execPath, nil } func getAbs(execPath string) (string, error) { if initCwdErr != nil { return execPath, initCwdErr } // The execPath may begin with a "../" or a "./" so clean it first. // Join the two paths, trailing and starting slashes undetermined, so use // the generic Join function. return filepath.Join(initCwd, filepath.Clean(execPath)), nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/pjbgf/sha1cd/sha1cd.go
vendor/github.com/pjbgf/sha1cd/sha1cd.go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package sha1cd implements collision detection based on the whitepaper // Counter-cryptanalysis from Marc Stevens. The original ubc implementation // was done by Marc Stevens and Dan Shumow, and can be found at: // https://github.com/cr-marcstevens/sha1collisiondetection package sha1cd // This SHA1 implementation is based on Go's generic SHA1. // Original: https://github.com/golang/go/blob/master/src/crypto/sha1/sha1.go import ( "crypto" "encoding/binary" "errors" "hash" shared "github.com/pjbgf/sha1cd/internal" ) //go:generate go run -C asm . -out ../sha1cdblock_amd64.s -pkg $GOPACKAGE func init() { crypto.RegisterHash(crypto.SHA1, New) } // The size of a SHA-1 checksum in bytes. const Size = shared.Size // The blocksize of SHA-1 in bytes. const BlockSize = shared.Chunk // digest represents the partial evaluation of a checksum. type digest struct { h [shared.WordBuffers]uint32 x [shared.Chunk]byte nx int len uint64 // col defines whether a collision has been found. col bool blockFunc func(dig *digest, p []byte) } func (d *digest) MarshalBinary() ([]byte, error) { b := make([]byte, 0, shared.MarshaledSize) b = append(b, shared.Magic...) b = appendUint32(b, d.h[0]) b = appendUint32(b, d.h[1]) b = appendUint32(b, d.h[2]) b = appendUint32(b, d.h[3]) b = appendUint32(b, d.h[4]) b = append(b, d.x[:d.nx]...) b = b[:len(b)+len(d.x)-d.nx] // already zero b = appendUint64(b, d.len) return b, nil } func appendUint32(b []byte, v uint32) []byte { return append(b, byte(v>>24), byte(v>>16), byte(v>>8), byte(v), ) } func appendUint64(b []byte, v uint64) []byte { return append(b, byte(v>>56), byte(v>>48), byte(v>>40), byte(v>>32), byte(v>>24), byte(v>>16), byte(v>>8), byte(v), ) } func (d *digest) UnmarshalBinary(b []byte) error { if len(b) < len(shared.Magic) || string(b[:len(shared.Magic)]) != shared.Magic { return errors.New("crypto/sha1: invalid hash state identifier") } if len(b) != shared.MarshaledSize { return errors.New("crypto/sha1: invalid hash state size") } b = b[len(shared.Magic):] b, d.h[0] = consumeUint32(b) b, d.h[1] = consumeUint32(b) b, d.h[2] = consumeUint32(b) b, d.h[3] = consumeUint32(b) b, d.h[4] = consumeUint32(b) b = b[copy(d.x[:], b):] b, d.len = consumeUint64(b) d.nx = int(d.len % shared.Chunk) return nil } func consumeUint64(b []byte) ([]byte, uint64) { _ = b[7] x := uint64(b[7]) | uint64(b[6])<<8 | uint64(b[shared.WordBuffers])<<16 | uint64(b[4])<<24 | uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56 return b[8:], x } func consumeUint32(b []byte) ([]byte, uint32) { _ = b[3] x := uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24 return b[4:], x } func (d *digest) Reset() { d.h[0] = shared.Init0 d.h[1] = shared.Init1 d.h[2] = shared.Init2 d.h[3] = shared.Init3 d.h[4] = shared.Init4 d.nx = 0 d.len = 0 d.col = false } // New returns a new hash.Hash computing the SHA1 checksum. The Hash also // implements encoding.BinaryMarshaler and encoding.BinaryUnmarshaler to // marshal and unmarshal the internal state of the hash. func New() hash.Hash { d := new(digest) d.blockFunc = block d.Reset() return d } // NewGeneric is equivalent to New but uses the Go generic implementation, // avoiding any processor-specific optimizations. func NewGeneric() hash.Hash { d := new(digest) d.blockFunc = blockGeneric d.Reset() return d } func (d *digest) Size() int { return Size } func (d *digest) BlockSize() int { return BlockSize } func (d *digest) Write(p []byte) (nn int, err error) { if len(p) == 0 { return } nn = len(p) d.len += uint64(nn) if d.nx > 0 { n := copy(d.x[d.nx:], p) d.nx += n if d.nx == shared.Chunk { d.blockFunc(d, d.x[:]) d.nx = 0 } p = p[n:] } if len(p) >= shared.Chunk { n := len(p) &^ (shared.Chunk - 1) d.blockFunc(d, p[:n]) p = p[n:] } if len(p) > 0 { d.nx = copy(d.x[:], p) } return } func (d *digest) Sum(in []byte) []byte { // Make a copy of d so that caller can keep writing and summing. d0 := *d hash := d0.checkSum() return append(in, hash[:]...) } func (d *digest) checkSum() [Size]byte { len := d.len // Padding. Add a 1 bit and 0 bits until 56 bytes mod 64. var tmp [64]byte tmp[0] = 0x80 if len%64 < 56 { d.Write(tmp[0 : 56-len%64]) } else { d.Write(tmp[0 : 64+56-len%64]) } // Length in bits. len <<= 3 binary.BigEndian.PutUint64(tmp[:], len) d.Write(tmp[0:8]) if d.nx != 0 { panic("d.nx != 0") } var digest [Size]byte binary.BigEndian.PutUint32(digest[0:], d.h[0]) binary.BigEndian.PutUint32(digest[4:], d.h[1]) binary.BigEndian.PutUint32(digest[8:], d.h[2]) binary.BigEndian.PutUint32(digest[12:], d.h[3]) binary.BigEndian.PutUint32(digest[16:], d.h[4]) return digest } // Sum returns the SHA-1 checksum of the data. func Sum(data []byte) ([Size]byte, bool) { d := New().(*digest) d.Write(data) return d.checkSum(), d.col } func (d *digest) CollisionResistantSum(in []byte) ([]byte, bool) { // Make a copy of d so that caller can keep writing and summing. d0 := *d hash := d0.checkSum() return append(in, hash[:]...), d0.col }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/pjbgf/sha1cd/sha1cdblock_generic.go
vendor/github.com/pjbgf/sha1cd/sha1cdblock_generic.go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Originally from: https://github.com/go/blob/master/src/crypto/sha1/sha1block.go // It has been modified to support collision detection. package sha1cd import ( "fmt" "math/bits" shared "github.com/pjbgf/sha1cd/internal" "github.com/pjbgf/sha1cd/ubc" ) // blockGeneric is a portable, pure Go version of the SHA-1 block step. // It's used by sha1block_generic.go and tests. func blockGeneric(dig *digest, p []byte) { var w [16]uint32 // cs stores the pre-step compression state for only the steps required for the // collision detection, which are 0, 58 and 65. // Refer to ubc/const.go for more details. cs := [shared.PreStepState][shared.WordBuffers]uint32{} h0, h1, h2, h3, h4 := dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4] for len(p) >= shared.Chunk { m1 := [shared.Rounds]uint32{} hi := 1 // Collision attacks are thwarted by hashing a detected near-collision block 3 times. // Think of it as extending SHA-1 from 80-steps to 240-steps for such blocks: // The best collision attacks against SHA-1 have complexity about 2^60, // thus for 240-steps an immediate lower-bound for the best cryptanalytic attacks would be 2^180. // An attacker would be better off using a generic birthday search of complexity 2^80. rehash: a, b, c, d, e := h0, h1, h2, h3, h4 // Each of the four 20-iteration rounds // differs only in the computation of f and // the choice of K (K0, K1, etc). i := 0 // Store pre-step compression state for the collision detection. cs[0] = [shared.WordBuffers]uint32{a, b, c, d, e} for ; i < 16; i++ { // load step j := i * 4 w[i] = uint32(p[j])<<24 | uint32(p[j+1])<<16 | uint32(p[j+2])<<8 | uint32(p[j+3]) f := b&c | (^b)&d t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + shared.K0 a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d // Store compression state for the collision detection. m1[i] = w[i&0xf] } for ; i < 20; i++ { tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] w[i&0xf] = tmp<<1 | tmp>>(32-1) f := b&c | (^b)&d t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + shared.K0 a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d // Store compression state for the collision detection. m1[i] = w[i&0xf] } for ; i < 40; i++ { tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] w[i&0xf] = tmp<<1 | tmp>>(32-1) f := b ^ c ^ d t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + shared.K1 a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d // Store compression state for the collision detection. m1[i] = w[i&0xf] } for ; i < 60; i++ { if i == 58 { // Store pre-step compression state for the collision detection. cs[1] = [shared.WordBuffers]uint32{a, b, c, d, e} } tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] w[i&0xf] = tmp<<1 | tmp>>(32-1) f := ((b | c) & d) | (b & c) t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + shared.K2 a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d // Store compression state for the collision detection. m1[i] = w[i&0xf] } for ; i < 80; i++ { if i == 65 { // Store pre-step compression state for the collision detection. cs[2] = [shared.WordBuffers]uint32{a, b, c, d, e} } tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] w[i&0xf] = tmp<<1 | tmp>>(32-1) f := b ^ c ^ d t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + shared.K3 a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d // Store compression state for the collision detection. m1[i] = w[i&0xf] } h0 += a h1 += b h2 += c h3 += d h4 += e if hi == 2 { hi++ goto rehash } if hi == 1 { col := checkCollision(m1, cs, [shared.WordBuffers]uint32{h0, h1, h2, h3, h4}) if col { dig.col = true hi++ goto rehash } } p = p[shared.Chunk:] } dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4] = h0, h1, h2, h3, h4 } func checkCollision( m1 [shared.Rounds]uint32, cs [shared.PreStepState][shared.WordBuffers]uint32, state [shared.WordBuffers]uint32) bool { if mask := ubc.CalculateDvMask(m1); mask != 0 { dvs := ubc.SHA1_dvs() for i := 0; dvs[i].DvType != 0; i++ { if (mask & ((uint32)(1) << uint32(dvs[i].MaskB))) != 0 { var csState [shared.WordBuffers]uint32 switch dvs[i].TestT { case 58: csState = cs[1] case 65: csState = cs[2] case 0: csState = cs[0] default: panic(fmt.Sprintf("dvs data is trying to use a testT that isn't available: %d", dvs[i].TestT)) } col := hasCollided( dvs[i].TestT, // testT is the step number // m2 is a secondary message created XORing with // ubc's DM prior to the SHA recompression step. m1, dvs[i].Dm, csState, state) if col { return true } } } } return false } func hasCollided(step uint32, m1, dm [shared.Rounds]uint32, state [shared.WordBuffers]uint32, h [shared.WordBuffers]uint32) bool { // Intermediary Hash Value. ihv := [shared.WordBuffers]uint32{} a, b, c, d, e := state[0], state[1], state[2], state[3], state[4] // Walk backwards from current step to undo previous compression. // The existing collision detection does not have dvs higher than 65, // start value of i accordingly. for i := uint32(64); i >= 60; i-- { a, b, c, d, e = b, c, d, e, a if step > i { b = bits.RotateLeft32(b, -30) f := b ^ c ^ d e -= bits.RotateLeft32(a, 5) + f + shared.K3 + (m1[i] ^ dm[i]) // m2 = m1 ^ dm. } } for i := uint32(59); i >= 40; i-- { a, b, c, d, e = b, c, d, e, a if step > i { b = bits.RotateLeft32(b, -30) f := ((b | c) & d) | (b & c) e -= bits.RotateLeft32(a, 5) + f + shared.K2 + (m1[i] ^ dm[i]) } } for i := uint32(39); i >= 20; i-- { a, b, c, d, e = b, c, d, e, a if step > i { b = bits.RotateLeft32(b, -30) f := b ^ c ^ d e -= bits.RotateLeft32(a, 5) + f + shared.K1 + (m1[i] ^ dm[i]) } } for i := uint32(20); i > 0; i-- { j := i - 1 a, b, c, d, e = b, c, d, e, a if step > j { b = bits.RotateLeft32(b, -30) // undo the rotate left f := b&c | (^b)&d // subtract from e e -= bits.RotateLeft32(a, 5) + f + shared.K0 + (m1[j] ^ dm[j]) } } ihv[0] = a ihv[1] = b ihv[2] = c ihv[3] = d ihv[4] = e a = state[0] b = state[1] c = state[2] d = state[3] e = state[4] // Recompress blocks based on the current step. // The existing collision detection does not have dvs below 58, so they have been removed // from the source code. If new dvs are added which target rounds below 40, that logic // will need to be readded here. for i := uint32(40); i < 60; i++ { if step <= i { f := ((b | c) & d) | (b & c) t := bits.RotateLeft32(a, 5) + f + e + shared.K2 + (m1[i] ^ dm[i]) a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d } } for i := uint32(60); i < 80; i++ { if step <= i { f := b ^ c ^ d t := bits.RotateLeft32(a, 5) + f + e + shared.K3 + (m1[i] ^ dm[i]) a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d } } ihv[0] += a ihv[1] += b ihv[2] += c ihv[3] += d ihv[4] += e if ((ihv[0] ^ h[0]) | (ihv[1] ^ h[1]) | (ihv[2] ^ h[2]) | (ihv[3] ^ h[3]) | (ihv[4] ^ h[4])) == 0 { return true } return false }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/pjbgf/sha1cd/detection.go
vendor/github.com/pjbgf/sha1cd/detection.go
package sha1cd import "hash" type CollisionResistantHash interface { // CollisionResistantSum extends on Sum by returning an additional boolean // which indicates whether a collision was found during the hashing process. CollisionResistantSum(b []byte) ([]byte, bool) hash.Hash }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/pjbgf/sha1cd/sha1cdblock_amd64.go
vendor/github.com/pjbgf/sha1cd/sha1cdblock_amd64.go
//go:build !noasm && gc && amd64 // +build !noasm,gc,amd64 package sha1cd import ( "math" "unsafe" shared "github.com/pjbgf/sha1cd/internal" ) type sliceHeader struct { base uintptr len int cap int } // blockAMD64 hashes the message p into the current state in dig. // Both m1 and cs are used to store intermediate results which are used by the collision detection logic. // //go:noescape func blockAMD64(dig *digest, p sliceHeader, m1 []uint32, cs [][5]uint32) func block(dig *digest, p []byte) { m1 := [shared.Rounds]uint32{} cs := [shared.PreStepState][shared.WordBuffers]uint32{} for len(p) >= shared.Chunk { // Only send a block to be processed, as the collission detection // works on a block by block basis. ips := sliceHeader{ base: uintptr(unsafe.Pointer(&p[0])), len: int(math.Min(float64(len(p)), float64(shared.Chunk))), cap: shared.Chunk, } blockAMD64(dig, ips, m1[:], cs[:]) col := checkCollision(m1, cs, dig.h) if col { dig.col = true blockAMD64(dig, ips, m1[:], cs[:]) blockAMD64(dig, ips, m1[:], cs[:]) } p = p[shared.Chunk:] } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/pjbgf/sha1cd/sha1cdblock_noasm.go
vendor/github.com/pjbgf/sha1cd/sha1cdblock_noasm.go
//go:build !amd64 || noasm || !gc // +build !amd64 noasm !gc package sha1cd func block(dig *digest, p []byte) { blockGeneric(dig, p) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/pjbgf/sha1cd/internal/const.go
vendor/github.com/pjbgf/sha1cd/internal/const.go
package shared const ( // Constants for the SHA-1 hash function. K0 = 0x5A827999 K1 = 0x6ED9EBA1 K2 = 0x8F1BBCDC K3 = 0xCA62C1D6 // Initial values for the buffer variables: h0, h1, h2, h3, h4. Init0 = 0x67452301 Init1 = 0xEFCDAB89 Init2 = 0x98BADCFE Init3 = 0x10325476 Init4 = 0xC3D2E1F0 // Initial values for the temporary variables (ihvtmp0, ihvtmp1, ihvtmp2, ihvtmp3, ihvtmp4) during the SHA recompression step. InitTmp0 = 0xD5 InitTmp1 = 0x394 InitTmp2 = 0x8152A8 InitTmp3 = 0x0 InitTmp4 = 0xA7ECE0 // SHA1 contains 2 buffers, each based off 5 32-bit words. WordBuffers = 5 // The output of SHA1 is 20 bytes (160 bits). Size = 20 // Rounds represents the number of steps required to process each chunk. Rounds = 80 // SHA1 processes the input data in chunks. Each chunk contains 64 bytes. Chunk = 64 // The number of pre-step compression state to store. // Currently there are 3 pre-step compression states required: 0, 58, 65. PreStepState = 3 Magic = "shacd\x01" MarshaledSize = len(Magic) + 5*4 + Chunk + 8 )
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/pjbgf/sha1cd/ubc/ubc_amd64.go
vendor/github.com/pjbgf/sha1cd/ubc/ubc_amd64.go
//go:build !noasm && gc && amd64 // +build !noasm,gc,amd64 package ubc func CalculateDvMaskAMD64(W [80]uint32) uint32 // Check takes as input an expanded message block and verifies the unavoidable bitconditions // for all listed DVs. It returns a dvmask where each bit belonging to a DV is set if all // unavoidable bitconditions for that DV have been met. // Thus, one needs to do the recompression check for each DV that has its bit set. func CalculateDvMask(W [80]uint32) uint32 { return CalculateDvMaskAMD64(W) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/pjbgf/sha1cd/ubc/ubc.go
vendor/github.com/pjbgf/sha1cd/ubc/ubc.go
// ubc package provides ways for SHA1 blocks to be checked for // Unavoidable Bit Conditions that arise from crypto analysis attacks. package ubc //go:generate go run -C asm . -out ../ubc_amd64.s -pkg $GOPACKAGE
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/pjbgf/sha1cd/ubc/ubc_generic.go
vendor/github.com/pjbgf/sha1cd/ubc/ubc_generic.go
// Based on the C implementation from Marc Stevens and Dan Shumow. // https://github.com/cr-marcstevens/sha1collisiondetection package ubc type DvInfo struct { // DvType, DvK and DvB define the DV: I(K,B) or II(K,B) (see the paper). // https://marc-stevens.nl/research/papers/C13-S.pdf DvType uint32 DvK uint32 DvB uint32 // TestT is the step to do the recompression from for collision detection. TestT uint32 // MaskI and MaskB define the bit to check for each DV in the dvmask returned by ubc_check. MaskI uint32 MaskB uint32 // Dm is the expanded message block XOR-difference defined by the DV. Dm [80]uint32 } // CalculateDvMask takes as input an expanded message block and verifies the unavoidable bitconditions // for all listed DVs. It returns a dvmask where each bit belonging to a DV is set if all // unavoidable bitconditions for that DV have been met. // Thus, one needs to do the recompression check for each DV that has its bit set. func CalculateDvMaskGeneric(W [80]uint32) uint32 { mask := uint32(0xFFFFFFFF) mask &= (((((W[44] ^ W[45]) >> 29) & 1) - 1) | ^(DV_I_48_0_bit | DV_I_51_0_bit | DV_I_52_0_bit | DV_II_45_0_bit | DV_II_46_0_bit | DV_II_50_0_bit | DV_II_51_0_bit)) mask &= (((((W[49] ^ W[50]) >> 29) & 1) - 1) | ^(DV_I_46_0_bit | DV_II_45_0_bit | DV_II_50_0_bit | DV_II_51_0_bit | DV_II_55_0_bit | DV_II_56_0_bit)) mask &= (((((W[48] ^ W[49]) >> 29) & 1) - 1) | ^(DV_I_45_0_bit | DV_I_52_0_bit | DV_II_49_0_bit | DV_II_50_0_bit | DV_II_54_0_bit | DV_II_55_0_bit)) mask &= ((((W[47] ^ (W[50] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_47_0_bit | DV_I_49_0_bit | DV_I_51_0_bit | DV_II_45_0_bit | DV_II_51_0_bit | DV_II_56_0_bit)) mask &= (((((W[47] ^ W[48]) >> 29) & 1) - 1) | ^(DV_I_44_0_bit | DV_I_51_0_bit | DV_II_48_0_bit | DV_II_49_0_bit | DV_II_53_0_bit | DV_II_54_0_bit)) mask &= (((((W[46] >> 4) ^ (W[49] >> 29)) & 1) - 1) | ^(DV_I_46_0_bit | DV_I_48_0_bit | DV_I_50_0_bit | DV_I_52_0_bit | DV_II_50_0_bit | DV_II_55_0_bit)) mask &= (((((W[46] ^ W[47]) >> 29) & 1) - 1) | ^(DV_I_43_0_bit | DV_I_50_0_bit | DV_II_47_0_bit | DV_II_48_0_bit | DV_II_52_0_bit | DV_II_53_0_bit)) mask &= (((((W[45] >> 4) ^ (W[48] >> 29)) & 1) - 1) | ^(DV_I_45_0_bit | DV_I_47_0_bit | DV_I_49_0_bit | DV_I_51_0_bit | DV_II_49_0_bit | DV_II_54_0_bit)) mask &= (((((W[45] ^ W[46]) >> 29) & 1) - 1) | ^(DV_I_49_0_bit | DV_I_52_0_bit | DV_II_46_0_bit | DV_II_47_0_bit | DV_II_51_0_bit | DV_II_52_0_bit)) mask &= (((((W[44] >> 4) ^ (W[47] >> 29)) & 1) - 1) | ^(DV_I_44_0_bit | DV_I_46_0_bit | DV_I_48_0_bit | DV_I_50_0_bit | DV_II_48_0_bit | DV_II_53_0_bit)) mask &= (((((W[43] >> 4) ^ (W[46] >> 29)) & 1) - 1) | ^(DV_I_43_0_bit | DV_I_45_0_bit | DV_I_47_0_bit | DV_I_49_0_bit | DV_II_47_0_bit | DV_II_52_0_bit)) mask &= (((((W[43] ^ W[44]) >> 29) & 1) - 1) | ^(DV_I_47_0_bit | DV_I_50_0_bit | DV_I_51_0_bit | DV_II_45_0_bit | DV_II_49_0_bit | DV_II_50_0_bit)) mask &= (((((W[42] >> 4) ^ (W[45] >> 29)) & 1) - 1) | ^(DV_I_44_0_bit | DV_I_46_0_bit | DV_I_48_0_bit | DV_I_52_0_bit | DV_II_46_0_bit | DV_II_51_0_bit)) mask &= (((((W[41] >> 4) ^ (W[44] >> 29)) & 1) - 1) | ^(DV_I_43_0_bit | DV_I_45_0_bit | DV_I_47_0_bit | DV_I_51_0_bit | DV_II_45_0_bit | DV_II_50_0_bit)) mask &= (((((W[40] ^ W[41]) >> 29) & 1) - 1) | ^(DV_I_44_0_bit | DV_I_47_0_bit | DV_I_48_0_bit | DV_II_46_0_bit | DV_II_47_0_bit | DV_II_56_0_bit)) mask &= (((((W[54] ^ W[55]) >> 29) & 1) - 1) | ^(DV_I_51_0_bit | DV_II_47_0_bit | DV_II_50_0_bit | DV_II_55_0_bit | DV_II_56_0_bit)) mask &= (((((W[53] ^ W[54]) >> 29) & 1) - 1) | ^(DV_I_50_0_bit | DV_II_46_0_bit | DV_II_49_0_bit | DV_II_54_0_bit | DV_II_55_0_bit)) mask &= (((((W[52] ^ W[53]) >> 29) & 1) - 1) | ^(DV_I_49_0_bit | DV_II_45_0_bit | DV_II_48_0_bit | DV_II_53_0_bit | DV_II_54_0_bit)) mask &= ((((W[50] ^ (W[53] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_50_0_bit | DV_I_52_0_bit | DV_II_46_0_bit | DV_II_48_0_bit | DV_II_54_0_bit)) mask &= (((((W[50] ^ W[51]) >> 29) & 1) - 1) | ^(DV_I_47_0_bit | DV_II_46_0_bit | DV_II_51_0_bit | DV_II_52_0_bit | DV_II_56_0_bit)) mask &= ((((W[49] ^ (W[52] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_49_0_bit | DV_I_51_0_bit | DV_II_45_0_bit | DV_II_47_0_bit | DV_II_53_0_bit)) mask &= ((((W[48] ^ (W[51] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_48_0_bit | DV_I_50_0_bit | DV_I_52_0_bit | DV_II_46_0_bit | DV_II_52_0_bit)) mask &= (((((W[42] ^ W[43]) >> 29) & 1) - 1) | ^(DV_I_46_0_bit | DV_I_49_0_bit | DV_I_50_0_bit | DV_II_48_0_bit | DV_II_49_0_bit)) mask &= (((((W[41] ^ W[42]) >> 29) & 1) - 1) | ^(DV_I_45_0_bit | DV_I_48_0_bit | DV_I_49_0_bit | DV_II_47_0_bit | DV_II_48_0_bit)) mask &= (((((W[40] >> 4) ^ (W[43] >> 29)) & 1) - 1) | ^(DV_I_44_0_bit | DV_I_46_0_bit | DV_I_50_0_bit | DV_II_49_0_bit | DV_II_56_0_bit)) mask &= (((((W[39] >> 4) ^ (W[42] >> 29)) & 1) - 1) | ^(DV_I_43_0_bit | DV_I_45_0_bit | DV_I_49_0_bit | DV_II_48_0_bit | DV_II_55_0_bit)) if (mask & (DV_I_44_0_bit | DV_I_48_0_bit | DV_II_47_0_bit | DV_II_54_0_bit | DV_II_56_0_bit)) != 0 { mask &= (((((W[38] >> 4) ^ (W[41] >> 29)) & 1) - 1) | ^(DV_I_44_0_bit | DV_I_48_0_bit | DV_II_47_0_bit | DV_II_54_0_bit | DV_II_56_0_bit)) } mask &= (((((W[37] >> 4) ^ (W[40] >> 29)) & 1) - 1) | ^(DV_I_43_0_bit | DV_I_47_0_bit | DV_II_46_0_bit | DV_II_53_0_bit | DV_II_55_0_bit)) if (mask & (DV_I_52_0_bit | DV_II_48_0_bit | DV_II_51_0_bit | DV_II_56_0_bit)) != 0 { mask &= (((((W[55] ^ W[56]) >> 29) & 1) - 1) | ^(DV_I_52_0_bit | DV_II_48_0_bit | DV_II_51_0_bit | DV_II_56_0_bit)) } if (mask & (DV_I_52_0_bit | DV_II_48_0_bit | DV_II_50_0_bit | DV_II_56_0_bit)) != 0 { mask &= ((((W[52] ^ (W[55] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_52_0_bit | DV_II_48_0_bit | DV_II_50_0_bit | DV_II_56_0_bit)) } if (mask & (DV_I_51_0_bit | DV_II_47_0_bit | DV_II_49_0_bit | DV_II_55_0_bit)) != 0 { mask &= ((((W[51] ^ (W[54] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_51_0_bit | DV_II_47_0_bit | DV_II_49_0_bit | DV_II_55_0_bit)) } if (mask & (DV_I_48_0_bit | DV_II_47_0_bit | DV_II_52_0_bit | DV_II_53_0_bit)) != 0 { mask &= (((((W[51] ^ W[52]) >> 29) & 1) - 1) | ^(DV_I_48_0_bit | DV_II_47_0_bit | DV_II_52_0_bit | DV_II_53_0_bit)) } if (mask & (DV_I_46_0_bit | DV_I_49_0_bit | DV_II_45_0_bit | DV_II_48_0_bit)) != 0 { mask &= (((((W[36] >> 4) ^ (W[40] >> 29)) & 1) - 1) | ^(DV_I_46_0_bit | DV_I_49_0_bit | DV_II_45_0_bit | DV_II_48_0_bit)) } if (mask & (DV_I_52_0_bit | DV_II_48_0_bit | DV_II_49_0_bit)) != 0 { mask &= ((0 - (((W[53] ^ W[56]) >> 29) & 1)) | ^(DV_I_52_0_bit | DV_II_48_0_bit | DV_II_49_0_bit)) } if (mask & (DV_I_50_0_bit | DV_II_46_0_bit | DV_II_47_0_bit)) != 0 { mask &= ((0 - (((W[51] ^ W[54]) >> 29) & 1)) | ^(DV_I_50_0_bit | DV_II_46_0_bit | DV_II_47_0_bit)) } if (mask & (DV_I_49_0_bit | DV_I_51_0_bit | DV_II_45_0_bit)) != 0 { mask &= ((0 - (((W[50] ^ W[52]) >> 29) & 1)) | ^(DV_I_49_0_bit | DV_I_51_0_bit | DV_II_45_0_bit)) } if (mask & (DV_I_48_0_bit | DV_I_50_0_bit | DV_I_52_0_bit)) != 0 { mask &= ((0 - (((W[49] ^ W[51]) >> 29) & 1)) | ^(DV_I_48_0_bit | DV_I_50_0_bit | DV_I_52_0_bit)) } if (mask & (DV_I_47_0_bit | DV_I_49_0_bit | DV_I_51_0_bit)) != 0 { mask &= ((0 - (((W[48] ^ W[50]) >> 29) & 1)) | ^(DV_I_47_0_bit | DV_I_49_0_bit | DV_I_51_0_bit)) } if (mask & (DV_I_46_0_bit | DV_I_48_0_bit | DV_I_50_0_bit)) != 0 { mask &= ((0 - (((W[47] ^ W[49]) >> 29) & 1)) | ^(DV_I_46_0_bit | DV_I_48_0_bit | DV_I_50_0_bit)) } if (mask & (DV_I_45_0_bit | DV_I_47_0_bit | DV_I_49_0_bit)) != 0 { mask &= ((0 - (((W[46] ^ W[48]) >> 29) & 1)) | ^(DV_I_45_0_bit | DV_I_47_0_bit | DV_I_49_0_bit)) } mask &= ((((W[45] ^ W[47]) & (1 << 6)) - (1 << 6)) | ^(DV_I_47_2_bit | DV_I_49_2_bit | DV_I_51_2_bit)) if (mask & (DV_I_44_0_bit | DV_I_46_0_bit | DV_I_48_0_bit)) != 0 { mask &= ((0 - (((W[45] ^ W[47]) >> 29) & 1)) | ^(DV_I_44_0_bit | DV_I_46_0_bit | DV_I_48_0_bit)) } mask &= (((((W[44] ^ W[46]) >> 6) & 1) - 1) | ^(DV_I_46_2_bit | DV_I_48_2_bit | DV_I_50_2_bit)) if (mask & (DV_I_43_0_bit | DV_I_45_0_bit | DV_I_47_0_bit)) != 0 { mask &= ((0 - (((W[44] ^ W[46]) >> 29) & 1)) | ^(DV_I_43_0_bit | DV_I_45_0_bit | DV_I_47_0_bit)) } mask &= ((0 - ((W[41] ^ (W[42] >> 5)) & (1 << 1))) | ^(DV_I_48_2_bit | DV_II_46_2_bit | DV_II_51_2_bit)) mask &= ((0 - ((W[40] ^ (W[41] >> 5)) & (1 << 1))) | ^(DV_I_47_2_bit | DV_I_51_2_bit | DV_II_50_2_bit)) if (mask & (DV_I_44_0_bit | DV_I_46_0_bit | DV_II_56_0_bit)) != 0 { mask &= ((0 - (((W[40] ^ W[42]) >> 4) & 1)) | ^(DV_I_44_0_bit | DV_I_46_0_bit | DV_II_56_0_bit)) } mask &= ((0 - ((W[39] ^ (W[40] >> 5)) & (1 << 1))) | ^(DV_I_46_2_bit | DV_I_50_2_bit | DV_II_49_2_bit)) if (mask & (DV_I_43_0_bit | DV_I_45_0_bit | DV_II_55_0_bit)) != 0 { mask &= ((0 - (((W[39] ^ W[41]) >> 4) & 1)) | ^(DV_I_43_0_bit | DV_I_45_0_bit | DV_II_55_0_bit)) } if (mask & (DV_I_44_0_bit | DV_II_54_0_bit | DV_II_56_0_bit)) != 0 { mask &= ((0 - (((W[38] ^ W[40]) >> 4) & 1)) | ^(DV_I_44_0_bit | DV_II_54_0_bit | DV_II_56_0_bit)) } if (mask & (DV_I_43_0_bit | DV_II_53_0_bit | DV_II_55_0_bit)) != 0 { mask &= ((0 - (((W[37] ^ W[39]) >> 4) & 1)) | ^(DV_I_43_0_bit | DV_II_53_0_bit | DV_II_55_0_bit)) } mask &= ((0 - ((W[36] ^ (W[37] >> 5)) & (1 << 1))) | ^(DV_I_47_2_bit | DV_I_50_2_bit | DV_II_46_2_bit)) if (mask & (DV_I_45_0_bit | DV_I_48_0_bit | DV_II_47_0_bit)) != 0 { mask &= (((((W[35] >> 4) ^ (W[39] >> 29)) & 1) - 1) | ^(DV_I_45_0_bit | DV_I_48_0_bit | DV_II_47_0_bit)) } if (mask & (DV_I_48_0_bit | DV_II_48_0_bit)) != 0 { mask &= ((0 - ((W[63] ^ (W[64] >> 5)) & (1 << 0))) | ^(DV_I_48_0_bit | DV_II_48_0_bit)) } if (mask & (DV_I_45_0_bit | DV_II_45_0_bit)) != 0 { mask &= ((0 - ((W[63] ^ (W[64] >> 5)) & (1 << 1))) | ^(DV_I_45_0_bit | DV_II_45_0_bit)) } if (mask & (DV_I_47_0_bit | DV_II_47_0_bit)) != 0 { mask &= ((0 - ((W[62] ^ (W[63] >> 5)) & (1 << 0))) | ^(DV_I_47_0_bit | DV_II_47_0_bit)) } if (mask & (DV_I_46_0_bit | DV_II_46_0_bit)) != 0 { mask &= ((0 - ((W[61] ^ (W[62] >> 5)) & (1 << 0))) | ^(DV_I_46_0_bit | DV_II_46_0_bit)) } mask &= ((0 - ((W[61] ^ (W[62] >> 5)) & (1 << 2))) | ^(DV_I_46_2_bit | DV_II_46_2_bit)) if (mask & (DV_I_45_0_bit | DV_II_45_0_bit)) != 0 { mask &= ((0 - ((W[60] ^ (W[61] >> 5)) & (1 << 0))) | ^(DV_I_45_0_bit | DV_II_45_0_bit)) } if (mask & (DV_II_51_0_bit | DV_II_54_0_bit)) != 0 { mask &= (((((W[58] ^ W[59]) >> 29) & 1) - 1) | ^(DV_II_51_0_bit | DV_II_54_0_bit)) } if (mask & (DV_II_50_0_bit | DV_II_53_0_bit)) != 0 { mask &= (((((W[57] ^ W[58]) >> 29) & 1) - 1) | ^(DV_II_50_0_bit | DV_II_53_0_bit)) } if (mask & (DV_II_52_0_bit | DV_II_54_0_bit)) != 0 { mask &= ((((W[56] ^ (W[59] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_II_52_0_bit | DV_II_54_0_bit)) } if (mask & (DV_II_51_0_bit | DV_II_52_0_bit)) != 0 { mask &= ((0 - (((W[56] ^ W[59]) >> 29) & 1)) | ^(DV_II_51_0_bit | DV_II_52_0_bit)) } if (mask & (DV_II_49_0_bit | DV_II_52_0_bit)) != 0 { mask &= (((((W[56] ^ W[57]) >> 29) & 1) - 1) | ^(DV_II_49_0_bit | DV_II_52_0_bit)) } if (mask & (DV_II_51_0_bit | DV_II_53_0_bit)) != 0 { mask &= ((((W[55] ^ (W[58] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_II_51_0_bit | DV_II_53_0_bit)) } if (mask & (DV_II_50_0_bit | DV_II_52_0_bit)) != 0 { mask &= ((((W[54] ^ (W[57] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_II_50_0_bit | DV_II_52_0_bit)) } if (mask & (DV_II_49_0_bit | DV_II_51_0_bit)) != 0 { mask &= ((((W[53] ^ (W[56] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_II_49_0_bit | DV_II_51_0_bit)) } mask &= ((((W[51] ^ (W[50] >> 5)) & (1 << 1)) - (1 << 1)) | ^(DV_I_50_2_bit | DV_II_46_2_bit)) mask &= ((((W[48] ^ W[50]) & (1 << 6)) - (1 << 6)) | ^(DV_I_50_2_bit | DV_II_46_2_bit)) if (mask & (DV_I_51_0_bit | DV_I_52_0_bit)) != 0 { mask &= ((0 - (((W[48] ^ W[55]) >> 29) & 1)) | ^(DV_I_51_0_bit | DV_I_52_0_bit)) } mask &= ((((W[47] ^ W[49]) & (1 << 6)) - (1 << 6)) | ^(DV_I_49_2_bit | DV_I_51_2_bit)) mask &= ((((W[48] ^ (W[47] >> 5)) & (1 << 1)) - (1 << 1)) | ^(DV_I_47_2_bit | DV_II_51_2_bit)) mask &= ((((W[46] ^ W[48]) & (1 << 6)) - (1 << 6)) | ^(DV_I_48_2_bit | DV_I_50_2_bit)) mask &= ((((W[47] ^ (W[46] >> 5)) & (1 << 1)) - (1 << 1)) | ^(DV_I_46_2_bit | DV_II_50_2_bit)) mask &= ((0 - ((W[44] ^ (W[45] >> 5)) & (1 << 1))) | ^(DV_I_51_2_bit | DV_II_49_2_bit)) mask &= ((((W[43] ^ W[45]) & (1 << 6)) - (1 << 6)) | ^(DV_I_47_2_bit | DV_I_49_2_bit)) mask &= (((((W[42] ^ W[44]) >> 6) & 1) - 1) | ^(DV_I_46_2_bit | DV_I_48_2_bit)) mask &= ((((W[43] ^ (W[42] >> 5)) & (1 << 1)) - (1 << 1)) | ^(DV_II_46_2_bit | DV_II_51_2_bit)) mask &= ((((W[42] ^ (W[41] >> 5)) & (1 << 1)) - (1 << 1)) | ^(DV_I_51_2_bit | DV_II_50_2_bit)) mask &= ((((W[41] ^ (W[40] >> 5)) & (1 << 1)) - (1 << 1)) | ^(DV_I_50_2_bit | DV_II_49_2_bit)) if (mask & (DV_I_52_0_bit | DV_II_51_0_bit)) != 0 { mask &= ((((W[39] ^ (W[43] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_52_0_bit | DV_II_51_0_bit)) } if (mask & (DV_I_51_0_bit | DV_II_50_0_bit)) != 0 { mask &= ((((W[38] ^ (W[42] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_51_0_bit | DV_II_50_0_bit)) } if (mask & (DV_I_48_2_bit | DV_I_51_2_bit)) != 0 { mask &= ((0 - ((W[37] ^ (W[38] >> 5)) & (1 << 1))) | ^(DV_I_48_2_bit | DV_I_51_2_bit)) } if (mask & (DV_I_50_0_bit | DV_II_49_0_bit)) != 0 { mask &= ((((W[37] ^ (W[41] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_50_0_bit | DV_II_49_0_bit)) } if (mask & (DV_II_52_0_bit | DV_II_54_0_bit)) != 0 { mask &= ((0 - ((W[36] ^ W[38]) & (1 << 4))) | ^(DV_II_52_0_bit | DV_II_54_0_bit)) } mask &= ((0 - ((W[35] ^ (W[36] >> 5)) & (1 << 1))) | ^(DV_I_46_2_bit | DV_I_49_2_bit)) if (mask & (DV_I_51_0_bit | DV_II_47_0_bit)) != 0 { mask &= ((((W[35] ^ (W[39] >> 25)) & (1 << 3)) - (1 << 3)) | ^(DV_I_51_0_bit | DV_II_47_0_bit)) } if mask != 0 { if (mask & DV_I_43_0_bit) != 0 { if not((W[61]^(W[62]>>5))&(1<<1)) != 0 || not(not((W[59]^(W[63]>>25))&(1<<5))) != 0 || not((W[58]^(W[63]>>30))&(1<<0)) != 0 { mask &= ^DV_I_43_0_bit } } if (mask & DV_I_44_0_bit) != 0 { if not((W[62]^(W[63]>>5))&(1<<1)) != 0 || not(not((W[60]^(W[64]>>25))&(1<<5))) != 0 || not((W[59]^(W[64]>>30))&(1<<0)) != 0 { mask &= ^DV_I_44_0_bit } } if (mask & DV_I_46_2_bit) != 0 { mask &= ((^((W[40] ^ W[42]) >> 2)) | ^DV_I_46_2_bit) } if (mask & DV_I_47_2_bit) != 0 { if not((W[62]^(W[63]>>5))&(1<<2)) != 0 || not(not((W[41]^W[43])&(1<<6))) != 0 { mask &= ^DV_I_47_2_bit } } if (mask & DV_I_48_2_bit) != 0 { if not((W[63]^(W[64]>>5))&(1<<2)) != 0 || not(not((W[48]^(W[49]<<5))&(1<<6))) != 0 { mask &= ^DV_I_48_2_bit } } if (mask & DV_I_49_2_bit) != 0 { if not(not((W[49]^(W[50]<<5))&(1<<6))) != 0 || not((W[42]^W[50])&(1<<1)) != 0 || not(not((W[39]^(W[40]<<5))&(1<<6))) != 0 || not((W[38]^W[40])&(1<<1)) != 0 { mask &= ^DV_I_49_2_bit } } if (mask & DV_I_50_0_bit) != 0 { mask &= (((W[36] ^ W[37]) << 7) | ^DV_I_50_0_bit) } if (mask & DV_I_50_2_bit) != 0 { mask &= (((W[43] ^ W[51]) << 11) | ^DV_I_50_2_bit) } if (mask & DV_I_51_0_bit) != 0 { mask &= (((W[37] ^ W[38]) << 9) | ^DV_I_51_0_bit) } if (mask & DV_I_51_2_bit) != 0 { if not(not((W[51]^(W[52]<<5))&(1<<6))) != 0 || not(not((W[49]^W[51])&(1<<6))) != 0 || not(not((W[37]^(W[37]>>5))&(1<<1))) != 0 || not(not((W[35]^(W[39]>>25))&(1<<5))) != 0 { mask &= ^DV_I_51_2_bit } } if (mask & DV_I_52_0_bit) != 0 { mask &= (((W[38] ^ W[39]) << 11) | ^DV_I_52_0_bit) } if (mask & DV_II_46_2_bit) != 0 { mask &= (((W[47] ^ W[51]) << 17) | ^DV_II_46_2_bit) } if (mask & DV_II_48_0_bit) != 0 { if not(not((W[36]^(W[40]>>25))&(1<<3))) != 0 || not((W[35]^(W[40]<<2))&(1<<30)) != 0 { mask &= ^DV_II_48_0_bit } } if (mask & DV_II_49_0_bit) != 0 { if not(not((W[37]^(W[41]>>25))&(1<<3))) != 0 || not((W[36]^(W[41]<<2))&(1<<30)) != 0 { mask &= ^DV_II_49_0_bit } } if (mask & DV_II_49_2_bit) != 0 { if not(not((W[53]^(W[54]<<5))&(1<<6))) != 0 || not(not((W[51]^W[53])&(1<<6))) != 0 || not((W[50]^W[54])&(1<<1)) != 0 || not(not((W[45]^(W[46]<<5))&(1<<6))) != 0 || not(not((W[37]^(W[41]>>25))&(1<<5))) != 0 || not((W[36]^(W[41]>>30))&(1<<0)) != 0 { mask &= ^DV_II_49_2_bit } } if (mask & DV_II_50_0_bit) != 0 { if not((W[55]^W[58])&(1<<29)) != 0 || not(not((W[38]^(W[42]>>25))&(1<<3))) != 0 || not((W[37]^(W[42]<<2))&(1<<30)) != 0 { mask &= ^DV_II_50_0_bit } } if (mask & DV_II_50_2_bit) != 0 { if not(not((W[54]^(W[55]<<5))&(1<<6))) != 0 || not(not((W[52]^W[54])&(1<<6))) != 0 || not((W[51]^W[55])&(1<<1)) != 0 || not((W[45]^W[47])&(1<<1)) != 0 || not(not((W[38]^(W[42]>>25))&(1<<5))) != 0 || not((W[37]^(W[42]>>30))&(1<<0)) != 0 { mask &= ^DV_II_50_2_bit } } if (mask & DV_II_51_0_bit) != 0 { if not(not((W[39]^(W[43]>>25))&(1<<3))) != 0 || not((W[38]^(W[43]<<2))&(1<<30)) != 0 { mask &= ^DV_II_51_0_bit } } if (mask & DV_II_51_2_bit) != 0 { if not(not((W[55]^(W[56]<<5))&(1<<6))) != 0 || not(not((W[53]^W[55])&(1<<6))) != 0 || not((W[52]^W[56])&(1<<1)) != 0 || not((W[46]^W[48])&(1<<1)) != 0 || not(not((W[39]^(W[43]>>25))&(1<<5))) != 0 || not((W[38]^(W[43]>>30))&(1<<0)) != 0 { mask &= ^DV_II_51_2_bit } } if (mask & DV_II_52_0_bit) != 0 { if not(not((W[59]^W[60])&(1<<29))) != 0 || not(not((W[40]^(W[44]>>25))&(1<<3))) != 0 || not(not((W[40]^(W[44]>>25))&(1<<4))) != 0 || not((W[39]^(W[44]<<2))&(1<<30)) != 0 { mask &= ^DV_II_52_0_bit } } if (mask & DV_II_53_0_bit) != 0 { if not((W[58]^W[61])&(1<<29)) != 0 || not(not((W[57]^(W[61]>>25))&(1<<4))) != 0 || not(not((W[41]^(W[45]>>25))&(1<<3))) != 0 || not(not((W[41]^(W[45]>>25))&(1<<4))) != 0 { mask &= ^DV_II_53_0_bit } } if (mask & DV_II_54_0_bit) != 0 { if not(not((W[58]^(W[62]>>25))&(1<<4))) != 0 || not(not((W[42]^(W[46]>>25))&(1<<3))) != 0 || not(not((W[42]^(W[46]>>25))&(1<<4))) != 0 { mask &= ^DV_II_54_0_bit } } if (mask & DV_II_55_0_bit) != 0 { if not(not((W[59]^(W[63]>>25))&(1<<4))) != 0 || not(not((W[57]^(W[59]>>25))&(1<<4))) != 0 || not(not((W[43]^(W[47]>>25))&(1<<3))) != 0 || not(not((W[43]^(W[47]>>25))&(1<<4))) != 0 { mask &= ^DV_II_55_0_bit } } if (mask & DV_II_56_0_bit) != 0 { if not(not((W[60]^(W[64]>>25))&(1<<4))) != 0 || not(not((W[44]^(W[48]>>25))&(1<<3))) != 0 || not(not((W[44]^(W[48]>>25))&(1<<4))) != 0 { mask &= ^DV_II_56_0_bit } } } return mask } func not(x uint32) uint32 { if x == 0 { return 1 } return 0 } func SHA1_dvs() []DvInfo { return sha1_dvs }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/pjbgf/sha1cd/ubc/const.go
vendor/github.com/pjbgf/sha1cd/ubc/const.go
// Based on the C implementation from Marc Stevens and Dan Shumow. // https://github.com/cr-marcstevens/sha1collisiondetection package ubc const ( CheckSize = 80 DV_I_43_0_bit = (uint32)(1 << 0) DV_I_44_0_bit = (uint32)(1 << 1) DV_I_45_0_bit = (uint32)(1 << 2) DV_I_46_0_bit = (uint32)(1 << 3) DV_I_46_2_bit = (uint32)(1 << 4) DV_I_47_0_bit = (uint32)(1 << 5) DV_I_47_2_bit = (uint32)(1 << 6) DV_I_48_0_bit = (uint32)(1 << 7) DV_I_48_2_bit = (uint32)(1 << 8) DV_I_49_0_bit = (uint32)(1 << 9) DV_I_49_2_bit = (uint32)(1 << 10) DV_I_50_0_bit = (uint32)(1 << 11) DV_I_50_2_bit = (uint32)(1 << 12) DV_I_51_0_bit = (uint32)(1 << 13) DV_I_51_2_bit = (uint32)(1 << 14) DV_I_52_0_bit = (uint32)(1 << 15) DV_II_45_0_bit = (uint32)(1 << 16) DV_II_46_0_bit = (uint32)(1 << 17) DV_II_46_2_bit = (uint32)(1 << 18) DV_II_47_0_bit = (uint32)(1 << 19) DV_II_48_0_bit = (uint32)(1 << 20) DV_II_49_0_bit = (uint32)(1 << 21) DV_II_49_2_bit = (uint32)(1 << 22) DV_II_50_0_bit = (uint32)(1 << 23) DV_II_50_2_bit = (uint32)(1 << 24) DV_II_51_0_bit = (uint32)(1 << 25) DV_II_51_2_bit = (uint32)(1 << 26) DV_II_52_0_bit = (uint32)(1 << 27) DV_II_53_0_bit = (uint32)(1 << 28) DV_II_54_0_bit = (uint32)(1 << 29) DV_II_55_0_bit = (uint32)(1 << 30) DV_II_56_0_bit = (uint32)(1 << 31) ) // sha1_dvs contains a list of SHA-1 Disturbance Vectors (DV) which defines the // unavoidable bit conditions when a collision attack is in progress. var sha1_dvs = []DvInfo{ { DvType: 1, DvK: 43, DvB: 0, TestT: 58, MaskI: 0, MaskB: 0, Dm: [CheckSize]uint32{ 0x08000000, 0x9800000c, 0xd8000010, 0x08000010, 0xb8000010, 0x98000000, 0x60000000, 0x00000008, 0xc0000000, 0x90000014, 0x10000010, 0xb8000014, 0x28000000, 0x20000010, 0x48000000, 0x08000018, 0x60000000, 0x90000010, 0xf0000010, 0x90000008, 0xc0000000, 0x90000010, 0xf0000010, 0xb0000008, 0x40000000, 0x90000000, 0xf0000010, 0x90000018, 0x60000000, 0x90000010, 0x90000010, 0x90000000, 0x80000000, 0x00000010, 0xa0000000, 0x20000000, 0xa0000000, 0x20000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x20000000, 0x00000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000040, 0x40000002, 0x80000004, 0x80000080, 0x80000006, 0x00000049, 0x00000103, 0x80000009, 0x80000012, 0x80000202, 0x00000018, 0x00000164, 0x00000408, 0x800000e6, 0x8000004c, 0x00000803, 0x80000161, 0x80000599}, }, { DvType: 1, DvK: 44, DvB: 0, TestT: 58, MaskI: 0, MaskB: 1, Dm: [CheckSize]uint32{ 0xb4000008, 0x08000000, 0x9800000c, 0xd8000010, 0x08000010, 0xb8000010, 0x98000000, 0x60000000, 0x00000008, 0xc0000000, 0x90000014, 0x10000010, 0xb8000014, 0x28000000, 0x20000010, 0x48000000, 0x08000018, 0x60000000, 0x90000010, 0xf0000010, 0x90000008, 0xc0000000, 0x90000010, 0xf0000010, 0xb0000008, 0x40000000, 0x90000000, 0xf0000010, 0x90000018, 0x60000000, 0x90000010, 0x90000010, 0x90000000, 0x80000000, 0x00000010, 0xa0000000, 0x20000000, 0xa0000000, 0x20000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x20000000, 0x00000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000040, 0x40000002, 0x80000004, 0x80000080, 0x80000006, 0x00000049, 0x00000103, 0x80000009, 0x80000012, 0x80000202, 0x00000018, 0x00000164, 0x00000408, 0x800000e6, 0x8000004c, 0x00000803, 0x80000161}, }, { DvType: 1, DvK: 45, DvB: 0, TestT: 58, MaskI: 0, MaskB: 2, Dm: [CheckSize]uint32{ 0xf4000014, 0xb4000008, 0x08000000, 0x9800000c, 0xd8000010, 0x08000010, 0xb8000010, 0x98000000, 0x60000000, 0x00000008, 0xc0000000, 0x90000014, 0x10000010, 0xb8000014, 0x28000000, 0x20000010, 0x48000000, 0x08000018, 0x60000000, 0x90000010, 0xf0000010, 0x90000008, 0xc0000000, 0x90000010, 0xf0000010, 0xb0000008, 0x40000000, 0x90000000, 0xf0000010, 0x90000018, 0x60000000, 0x90000010, 0x90000010, 0x90000000, 0x80000000, 0x00000010, 0xa0000000, 0x20000000, 0xa0000000, 0x20000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x20000000, 0x00000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000040, 0x40000002, 0x80000004, 0x80000080, 0x80000006, 0x00000049, 0x00000103, 0x80000009, 0x80000012, 0x80000202, 0x00000018, 0x00000164, 0x00000408, 0x800000e6, 0x8000004c, 0x00000803}, }, { DvType: 1, DvK: 46, DvB: 0, TestT: 58, MaskI: 0, MaskB: 3, Dm: [CheckSize]uint32{ 0x2c000010, 0xf4000014, 0xb4000008, 0x08000000, 0x9800000c, 0xd8000010, 0x08000010, 0xb8000010, 0x98000000, 0x60000000, 0x00000008, 0xc0000000, 0x90000014, 0x10000010, 0xb8000014, 0x28000000, 0x20000010, 0x48000000, 0x08000018, 0x60000000, 0x90000010, 0xf0000010, 0x90000008, 0xc0000000, 0x90000010, 0xf0000010, 0xb0000008, 0x40000000, 0x90000000, 0xf0000010, 0x90000018, 0x60000000, 0x90000010, 0x90000010, 0x90000000, 0x80000000, 0x00000010, 0xa0000000, 0x20000000, 0xa0000000, 0x20000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x20000000, 0x00000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000040, 0x40000002, 0x80000004, 0x80000080, 0x80000006, 0x00000049, 0x00000103, 0x80000009, 0x80000012, 0x80000202, 0x00000018, 0x00000164, 0x00000408, 0x800000e6, 0x8000004c}, }, { DvType: 1, DvK: 46, DvB: 2, TestT: 58, MaskI: 0, MaskB: 4, Dm: [CheckSize]uint32{ 0xb0000040, 0xd0000053, 0xd0000022, 0x20000000, 0x60000032, 0x60000043, 0x20000040, 0xe0000042, 0x60000002, 0x80000001, 0x00000020, 0x00000003, 0x40000052, 0x40000040, 0xe0000052, 0xa0000000, 0x80000040, 0x20000001, 0x20000060, 0x80000001, 0x40000042, 0xc0000043, 0x40000022, 0x00000003, 0x40000042, 0xc0000043, 0xc0000022, 0x00000001, 0x40000002, 0xc0000043, 0x40000062, 0x80000001, 0x40000042, 0x40000042, 0x40000002, 0x00000002, 0x00000040, 0x80000002, 0x80000000, 0x80000002, 0x80000040, 0x00000000, 0x80000040, 0x80000000, 0x00000040, 0x80000000, 0x00000040, 0x80000002, 0x00000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000080, 0x00000004, 0x00000009, 0x00000101, 0x00000009, 0x00000012, 0x00000202, 0x0000001a, 0x00000124, 0x0000040c, 0x00000026, 0x0000004a, 0x0000080a, 0x00000060, 0x00000590, 0x00001020, 0x0000039a, 0x00000132}, }, { DvType: 1, DvK: 47, DvB: 0, TestT: 58, MaskI: 0, MaskB: 5, Dm: [CheckSize]uint32{ 0xc8000010, 0x2c000010, 0xf4000014, 0xb4000008, 0x08000000, 0x9800000c, 0xd8000010, 0x08000010, 0xb8000010, 0x98000000, 0x60000000, 0x00000008, 0xc0000000, 0x90000014, 0x10000010, 0xb8000014, 0x28000000, 0x20000010, 0x48000000, 0x08000018, 0x60000000, 0x90000010, 0xf0000010, 0x90000008, 0xc0000000, 0x90000010, 0xf0000010, 0xb0000008, 0x40000000, 0x90000000, 0xf0000010, 0x90000018, 0x60000000, 0x90000010, 0x90000010, 0x90000000, 0x80000000, 0x00000010, 0xa0000000, 0x20000000, 0xa0000000, 0x20000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x20000000, 0x00000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000040, 0x40000002, 0x80000004, 0x80000080, 0x80000006, 0x00000049, 0x00000103, 0x80000009, 0x80000012, 0x80000202, 0x00000018, 0x00000164, 0x00000408, 0x800000e6}, }, { DvType: 1, DvK: 47, DvB: 2, TestT: 58, MaskI: 0, MaskB: 6, Dm: [CheckSize]uint32{ 0x20000043, 0xb0000040, 0xd0000053, 0xd0000022, 0x20000000, 0x60000032, 0x60000043, 0x20000040, 0xe0000042, 0x60000002, 0x80000001, 0x00000020, 0x00000003, 0x40000052, 0x40000040, 0xe0000052, 0xa0000000, 0x80000040, 0x20000001, 0x20000060, 0x80000001, 0x40000042, 0xc0000043, 0x40000022, 0x00000003, 0x40000042, 0xc0000043, 0xc0000022, 0x00000001, 0x40000002, 0xc0000043, 0x40000062, 0x80000001, 0x40000042, 0x40000042, 0x40000002, 0x00000002, 0x00000040, 0x80000002, 0x80000000, 0x80000002, 0x80000040, 0x00000000, 0x80000040, 0x80000000, 0x00000040, 0x80000000, 0x00000040, 0x80000002, 0x00000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000080, 0x00000004, 0x00000009, 0x00000101, 0x00000009, 0x00000012, 0x00000202, 0x0000001a, 0x00000124, 0x0000040c, 0x00000026, 0x0000004a, 0x0000080a, 0x00000060, 0x00000590, 0x00001020, 0x0000039a, }, }, { DvType: 1, DvK: 48, DvB: 0, TestT: 58, MaskI: 0, MaskB: 7, Dm: [CheckSize]uint32{ 0xb800000a, 0xc8000010, 0x2c000010, 0xf4000014, 0xb4000008, 0x08000000, 0x9800000c, 0xd8000010, 0x08000010, 0xb8000010, 0x98000000, 0x60000000, 0x00000008, 0xc0000000, 0x90000014, 0x10000010, 0xb8000014, 0x28000000, 0x20000010, 0x48000000, 0x08000018, 0x60000000, 0x90000010, 0xf0000010, 0x90000008, 0xc0000000, 0x90000010, 0xf0000010, 0xb0000008, 0x40000000, 0x90000000, 0xf0000010, 0x90000018, 0x60000000, 0x90000010, 0x90000010, 0x90000000, 0x80000000, 0x00000010, 0xa0000000, 0x20000000, 0xa0000000, 0x20000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x20000000, 0x00000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000040, 0x40000002, 0x80000004, 0x80000080, 0x80000006, 0x00000049, 0x00000103, 0x80000009, 0x80000012, 0x80000202, 0x00000018, 0x00000164, 0x00000408, }, }, { DvType: 1, DvK: 48, DvB: 2, TestT: 58, MaskI: 0, MaskB: 8, Dm: [CheckSize]uint32{ 0xe000002a, 0x20000043, 0xb0000040, 0xd0000053, 0xd0000022, 0x20000000, 0x60000032, 0x60000043, 0x20000040, 0xe0000042, 0x60000002, 0x80000001, 0x00000020, 0x00000003, 0x40000052, 0x40000040, 0xe0000052, 0xa0000000, 0x80000040, 0x20000001, 0x20000060, 0x80000001, 0x40000042, 0xc0000043, 0x40000022, 0x00000003, 0x40000042, 0xc0000043, 0xc0000022, 0x00000001, 0x40000002, 0xc0000043, 0x40000062, 0x80000001, 0x40000042, 0x40000042, 0x40000002, 0x00000002, 0x00000040, 0x80000002, 0x80000000, 0x80000002, 0x80000040, 0x00000000, 0x80000040, 0x80000000, 0x00000040, 0x80000000, 0x00000040, 0x80000002, 0x00000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000080, 0x00000004, 0x00000009, 0x00000101, 0x00000009, 0x00000012, 0x00000202, 0x0000001a, 0x00000124, 0x0000040c, 0x00000026, 0x0000004a, 0x0000080a, 0x00000060, 0x00000590, 0x00001020}, }, { DvType: 1, DvK: 49, DvB: 0, TestT: 58, MaskI: 0, MaskB: 9, Dm: [CheckSize]uint32{ 0x18000000, 0xb800000a, 0xc8000010, 0x2c000010, 0xf4000014, 0xb4000008, 0x08000000, 0x9800000c, 0xd8000010, 0x08000010, 0xb8000010, 0x98000000, 0x60000000, 0x00000008, 0xc0000000, 0x90000014, 0x10000010, 0xb8000014, 0x28000000, 0x20000010, 0x48000000, 0x08000018, 0x60000000, 0x90000010, 0xf0000010, 0x90000008, 0xc0000000, 0x90000010, 0xf0000010, 0xb0000008, 0x40000000, 0x90000000, 0xf0000010, 0x90000018, 0x60000000, 0x90000010, 0x90000010, 0x90000000, 0x80000000, 0x00000010, 0xa0000000, 0x20000000, 0xa0000000, 0x20000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x20000000, 0x00000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000040, 0x40000002, 0x80000004, 0x80000080, 0x80000006, 0x00000049, 0x00000103, 0x80000009, 0x80000012, 0x80000202, 0x00000018, 0x00000164}, }, { DvType: 1, DvK: 49, DvB: 2, TestT: 58, MaskI: 0, MaskB: 10, Dm: [CheckSize]uint32{ 0x60000000, 0xe000002a, 0x20000043, 0xb0000040, 0xd0000053, 0xd0000022, 0x20000000, 0x60000032, 0x60000043, 0x20000040, 0xe0000042, 0x60000002, 0x80000001, 0x00000020, 0x00000003, 0x40000052, 0x40000040, 0xe0000052, 0xa0000000, 0x80000040, 0x20000001, 0x20000060, 0x80000001, 0x40000042, 0xc0000043, 0x40000022, 0x00000003, 0x40000042, 0xc0000043, 0xc0000022, 0x00000001, 0x40000002, 0xc0000043, 0x40000062, 0x80000001, 0x40000042, 0x40000042, 0x40000002, 0x00000002, 0x00000040, 0x80000002, 0x80000000, 0x80000002, 0x80000040, 0x00000000, 0x80000040, 0x80000000, 0x00000040, 0x80000000, 0x00000040, 0x80000002, 0x00000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000080, 0x00000004, 0x00000009, 0x00000101, 0x00000009, 0x00000012, 0x00000202, 0x0000001a, 0x00000124, 0x0000040c, 0x00000026, 0x0000004a, 0x0000080a, 0x00000060, 0x00000590}, }, { DvType: 1, DvK: 50, DvB: 0, TestT: 65, MaskI: 0, MaskB: 11, Dm: [CheckSize]uint32{ 0x0800000c, 0x18000000, 0xb800000a, 0xc8000010, 0x2c000010, 0xf4000014, 0xb4000008, 0x08000000, 0x9800000c, 0xd8000010, 0x08000010, 0xb8000010, 0x98000000, 0x60000000, 0x00000008, 0xc0000000, 0x90000014, 0x10000010, 0xb8000014, 0x28000000, 0x20000010, 0x48000000, 0x08000018, 0x60000000, 0x90000010, 0xf0000010, 0x90000008, 0xc0000000, 0x90000010, 0xf0000010, 0xb0000008, 0x40000000, 0x90000000, 0xf0000010, 0x90000018, 0x60000000, 0x90000010, 0x90000010, 0x90000000, 0x80000000, 0x00000010, 0xa0000000, 0x20000000, 0xa0000000, 0x20000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x20000000, 0x00000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000040, 0x40000002, 0x80000004, 0x80000080, 0x80000006, 0x00000049, 0x00000103, 0x80000009, 0x80000012, 0x80000202, 0x00000018, }, }, { DvType: 1, DvK: 50, DvB: 2, TestT: 65, MaskI: 0, MaskB: 12, Dm: [CheckSize]uint32{ 0x20000030, 0x60000000, 0xe000002a, 0x20000043, 0xb0000040, 0xd0000053, 0xd0000022, 0x20000000, 0x60000032, 0x60000043, 0x20000040, 0xe0000042, 0x60000002, 0x80000001, 0x00000020, 0x00000003, 0x40000052, 0x40000040, 0xe0000052, 0xa0000000, 0x80000040, 0x20000001, 0x20000060, 0x80000001, 0x40000042, 0xc0000043, 0x40000022, 0x00000003, 0x40000042, 0xc0000043, 0xc0000022, 0x00000001, 0x40000002, 0xc0000043, 0x40000062, 0x80000001, 0x40000042, 0x40000042, 0x40000002, 0x00000002, 0x00000040, 0x80000002, 0x80000000, 0x80000002, 0x80000040, 0x00000000, 0x80000040, 0x80000000, 0x00000040, 0x80000000, 0x00000040, 0x80000002, 0x00000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000080, 0x00000004, 0x00000009, 0x00000101, 0x00000009, 0x00000012, 0x00000202, 0x0000001a, 0x00000124, 0x0000040c, 0x00000026, 0x0000004a, 0x0000080a, 0x00000060}, }, { DvType: 1, DvK: 51, DvB: 0, TestT: 65, MaskI: 0, MaskB: 13, Dm: [CheckSize]uint32{ 0xe8000000, 0x0800000c, 0x18000000, 0xb800000a, 0xc8000010, 0x2c000010, 0xf4000014, 0xb4000008, 0x08000000, 0x9800000c, 0xd8000010, 0x08000010, 0xb8000010, 0x98000000, 0x60000000, 0x00000008, 0xc0000000, 0x90000014, 0x10000010, 0xb8000014, 0x28000000, 0x20000010, 0x48000000, 0x08000018, 0x60000000, 0x90000010, 0xf0000010, 0x90000008, 0xc0000000, 0x90000010, 0xf0000010, 0xb0000008, 0x40000000, 0x90000000, 0xf0000010, 0x90000018, 0x60000000, 0x90000010, 0x90000010, 0x90000000, 0x80000000, 0x00000010, 0xa0000000, 0x20000000, 0xa0000000, 0x20000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x20000000, 0x00000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000040, 0x40000002, 0x80000004, 0x80000080, 0x80000006, 0x00000049, 0x00000103, 0x80000009, 0x80000012, 0x80000202}, }, { DvType: 1, DvK: 51, DvB: 2, TestT: 65, MaskI: 0, MaskB: 14, Dm: [CheckSize]uint32{ 0xa0000003, 0x20000030, 0x60000000, 0xe000002a, 0x20000043, 0xb0000040, 0xd0000053, 0xd0000022, 0x20000000, 0x60000032, 0x60000043, 0x20000040, 0xe0000042, 0x60000002, 0x80000001, 0x00000020, 0x00000003, 0x40000052, 0x40000040, 0xe0000052, 0xa0000000, 0x80000040, 0x20000001, 0x20000060, 0x80000001, 0x40000042, 0xc0000043, 0x40000022, 0x00000003, 0x40000042, 0xc0000043, 0xc0000022, 0x00000001, 0x40000002, 0xc0000043, 0x40000062, 0x80000001, 0x40000042, 0x40000042, 0x40000002, 0x00000002, 0x00000040, 0x80000002, 0x80000000, 0x80000002, 0x80000040, 0x00000000, 0x80000040, 0x80000000, 0x00000040, 0x80000000, 0x00000040, 0x80000002, 0x00000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000080, 0x00000004, 0x00000009, 0x00000101, 0x00000009, 0x00000012, 0x00000202, 0x0000001a, 0x00000124, 0x0000040c, 0x00000026, 0x0000004a, 0x0000080a}, }, { DvType: 1, DvK: 52, DvB: 0, TestT: 65, MaskI: 0, MaskB: 15, Dm: [CheckSize]uint32{ 0x04000010, 0xe8000000, 0x0800000c, 0x18000000, 0xb800000a, 0xc8000010, 0x2c000010, 0xf4000014, 0xb4000008, 0x08000000, 0x9800000c, 0xd8000010, 0x08000010, 0xb8000010, 0x98000000, 0x60000000, 0x00000008, 0xc0000000, 0x90000014, 0x10000010, 0xb8000014, 0x28000000, 0x20000010, 0x48000000, 0x08000018, 0x60000000, 0x90000010, 0xf0000010, 0x90000008, 0xc0000000, 0x90000010, 0xf0000010, 0xb0000008, 0x40000000, 0x90000000, 0xf0000010, 0x90000018, 0x60000000, 0x90000010, 0x90000010, 0x90000000, 0x80000000, 0x00000010, 0xa0000000, 0x20000000, 0xa0000000, 0x20000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x20000000, 0x00000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000040, 0x40000002, 0x80000004, 0x80000080, 0x80000006, 0x00000049, 0x00000103, 0x80000009, 0x80000012}, }, { DvType: 2, DvK: 45, DvB: 0, TestT: 58, MaskI: 0, MaskB: 16, Dm: [CheckSize]uint32{ 0xec000014, 0x0c000002, 0xc0000010, 0xb400001c, 0x2c000004, 0xbc000018, 0xb0000010, 0x0000000c, 0xb8000010, 0x08000018, 0x78000010, 0x08000014, 0x70000010, 0xb800001c, 0xe8000000, 0xb0000004, 0x58000010, 0xb000000c, 0x48000000, 0xb0000000, 0xb8000010, 0x98000010, 0xa0000000, 0x00000000, 0x00000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x60000000, 0x00000018, 0xe0000000, 0x90000000, 0x30000010, 0xb0000000, 0x20000000, 0x20000000, 0xa0000000, 0x00000010, 0x80000000, 0x20000000, 0x20000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000041, 0x40000022, 0x80000005, 0xc0000082, 0xc0000046, 0x4000004b, 0x80000107, 0x00000089, 0x00000014, 0x8000024b, 0x0000011b, 0x8000016d, 0x8000041a, 0x000002e4, 0x80000054, 0x00000967}, }, { DvType: 2, DvK: 46, DvB: 0, TestT: 58, MaskI: 0, MaskB: 17, Dm: [CheckSize]uint32{ 0x2400001c, 0xec000014, 0x0c000002, 0xc0000010, 0xb400001c, 0x2c000004, 0xbc000018, 0xb0000010, 0x0000000c, 0xb8000010, 0x08000018, 0x78000010, 0x08000014, 0x70000010, 0xb800001c, 0xe8000000, 0xb0000004, 0x58000010, 0xb000000c, 0x48000000, 0xb0000000, 0xb8000010, 0x98000010, 0xa0000000, 0x00000000, 0x00000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x60000000, 0x00000018, 0xe0000000, 0x90000000, 0x30000010, 0xb0000000, 0x20000000, 0x20000000, 0xa0000000, 0x00000010, 0x80000000, 0x20000000, 0x20000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000041, 0x40000022, 0x80000005, 0xc0000082, 0xc0000046, 0x4000004b, 0x80000107, 0x00000089, 0x00000014, 0x8000024b, 0x0000011b, 0x8000016d, 0x8000041a, 0x000002e4, 0x80000054}, }, { DvType: 2, DvK: 46, DvB: 2, TestT: 58, MaskI: 0, MaskB: 18, Dm: [CheckSize]uint32{ 0x90000070, 0xb0000053, 0x30000008, 0x00000043, 0xd0000072, 0xb0000010, 0xf0000062, 0xc0000042, 0x00000030, 0xe0000042, 0x20000060, 0xe0000041, 0x20000050, 0xc0000041, 0xe0000072, 0xa0000003, 0xc0000012, 0x60000041, 0xc0000032, 0x20000001, 0xc0000002, 0xe0000042, 0x60000042, 0x80000002, 0x00000000, 0x00000000, 0x80000000, 0x00000002, 0x00000040, 0x00000000, 0x80000040, 0x80000000, 0x00000040, 0x80000001, 0x00000060, 0x80000003, 0x40000002, 0xc0000040, 0xc0000002, 0x80000000, 0x80000000, 0x80000002, 0x00000040, 0x00000002, 0x80000000, 0x80000000, 0x80000000, 0x00000002, 0x00000040, 0x00000000, 0x80000040, 0x80000002, 0x00000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000080, 0x00000004, 0x00000009, 0x00000105, 0x00000089, 0x00000016, 0x0000020b, 0x0000011b, 0x0000012d, 0x0000041e, 0x00000224, 0x00000050, 0x0000092e, 0x0000046c, 0x000005b6, 0x0000106a, 0x00000b90, 0x00000152}, }, { DvType: 2, DvK: 47, DvB: 0, TestT: 58, MaskI: 0, MaskB: 19, Dm: [CheckSize]uint32{ 0x20000010, 0x2400001c, 0xec000014, 0x0c000002, 0xc0000010, 0xb400001c, 0x2c000004, 0xbc000018, 0xb0000010, 0x0000000c, 0xb8000010, 0x08000018, 0x78000010, 0x08000014, 0x70000010, 0xb800001c, 0xe8000000, 0xb0000004, 0x58000010, 0xb000000c, 0x48000000, 0xb0000000, 0xb8000010, 0x98000010, 0xa0000000, 0x00000000, 0x00000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x60000000, 0x00000018, 0xe0000000, 0x90000000, 0x30000010, 0xb0000000, 0x20000000, 0x20000000, 0xa0000000, 0x00000010, 0x80000000, 0x20000000, 0x20000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000041, 0x40000022, 0x80000005, 0xc0000082, 0xc0000046, 0x4000004b, 0x80000107, 0x00000089, 0x00000014, 0x8000024b, 0x0000011b, 0x8000016d, 0x8000041a, 0x000002e4}, }, { DvType: 2, DvK: 48, DvB: 0, TestT: 58, MaskI: 0, MaskB: 20, Dm: [CheckSize]uint32{ 0xbc00001a, 0x20000010, 0x2400001c, 0xec000014, 0x0c000002, 0xc0000010, 0xb400001c, 0x2c000004, 0xbc000018, 0xb0000010, 0x0000000c, 0xb8000010, 0x08000018, 0x78000010, 0x08000014, 0x70000010, 0xb800001c, 0xe8000000, 0xb0000004, 0x58000010, 0xb000000c, 0x48000000, 0xb0000000, 0xb8000010, 0x98000010, 0xa0000000, 0x00000000, 0x00000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x60000000, 0x00000018, 0xe0000000, 0x90000000, 0x30000010, 0xb0000000, 0x20000000, 0x20000000, 0xa0000000, 0x00000010, 0x80000000, 0x20000000, 0x20000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000041, 0x40000022, 0x80000005, 0xc0000082, 0xc0000046, 0x4000004b, 0x80000107, 0x00000089, 0x00000014, 0x8000024b, 0x0000011b, 0x8000016d, 0x8000041a}, }, { DvType: 2, DvK: 49, DvB: 0, TestT: 58, MaskI: 0, MaskB: 21, Dm: [CheckSize]uint32{ 0x3c000004, 0xbc00001a, 0x20000010, 0x2400001c, 0xec000014, 0x0c000002, 0xc0000010, 0xb400001c, 0x2c000004, 0xbc000018, 0xb0000010, 0x0000000c, 0xb8000010, 0x08000018, 0x78000010, 0x08000014, 0x70000010, 0xb800001c, 0xe8000000, 0xb0000004, 0x58000010, 0xb000000c, 0x48000000, 0xb0000000, 0xb8000010, 0x98000010, 0xa0000000, 0x00000000, 0x00000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x60000000, 0x00000018, 0xe0000000, 0x90000000, 0x30000010, 0xb0000000, 0x20000000, 0x20000000, 0xa0000000, 0x00000010, 0x80000000, 0x20000000, 0x20000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000041, 0x40000022, 0x80000005, 0xc0000082, 0xc0000046, 0x4000004b, 0x80000107, 0x00000089, 0x00000014, 0x8000024b, 0x0000011b, 0x8000016d}, }, { DvType: 2, DvK: 49, DvB: 2, TestT: 58, MaskI: 0, MaskB: 22, Dm: [CheckSize]uint32{ 0xf0000010, 0xf000006a, 0x80000040, 0x90000070, 0xb0000053, 0x30000008, 0x00000043, 0xd0000072, 0xb0000010, 0xf0000062, 0xc0000042, 0x00000030, 0xe0000042, 0x20000060, 0xe0000041, 0x20000050, 0xc0000041, 0xe0000072, 0xa0000003, 0xc0000012, 0x60000041, 0xc0000032, 0x20000001, 0xc0000002, 0xe0000042, 0x60000042, 0x80000002, 0x00000000, 0x00000000, 0x80000000, 0x00000002, 0x00000040, 0x00000000, 0x80000040, 0x80000000, 0x00000040, 0x80000001, 0x00000060, 0x80000003, 0x40000002, 0xc0000040, 0xc0000002, 0x80000000, 0x80000000, 0x80000002, 0x00000040, 0x00000002, 0x80000000, 0x80000000, 0x80000000, 0x00000002, 0x00000040, 0x00000000, 0x80000040, 0x80000002, 0x00000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000080, 0x00000004, 0x00000009, 0x00000105, 0x00000089, 0x00000016, 0x0000020b, 0x0000011b, 0x0000012d, 0x0000041e, 0x00000224, 0x00000050, 0x0000092e, 0x0000046c, 0x000005b6}, }, { DvType: 2, DvK: 50, DvB: 0, TestT: 65, MaskI: 0, MaskB: 23, Dm: [CheckSize]uint32{ 0xb400001c, 0x3c000004, 0xbc00001a, 0x20000010, 0x2400001c, 0xec000014, 0x0c000002, 0xc0000010, 0xb400001c, 0x2c000004, 0xbc000018, 0xb0000010, 0x0000000c, 0xb8000010, 0x08000018, 0x78000010, 0x08000014, 0x70000010, 0xb800001c, 0xe8000000, 0xb0000004, 0x58000010, 0xb000000c, 0x48000000, 0xb0000000, 0xb8000010, 0x98000010, 0xa0000000, 0x00000000, 0x00000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x60000000, 0x00000018, 0xe0000000, 0x90000000, 0x30000010, 0xb0000000, 0x20000000, 0x20000000, 0xa0000000, 0x00000010, 0x80000000, 0x20000000, 0x20000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000041, 0x40000022, 0x80000005, 0xc0000082, 0xc0000046, 0x4000004b, 0x80000107, 0x00000089, 0x00000014, 0x8000024b, 0x0000011b}, }, { DvType: 2, DvK: 50, DvB: 2, TestT: 65, MaskI: 0, MaskB: 24, Dm: [CheckSize]uint32{ 0xd0000072, 0xf0000010, 0xf000006a, 0x80000040, 0x90000070, 0xb0000053, 0x30000008, 0x00000043, 0xd0000072, 0xb0000010, 0xf0000062, 0xc0000042, 0x00000030, 0xe0000042, 0x20000060, 0xe0000041, 0x20000050, 0xc0000041, 0xe0000072, 0xa0000003, 0xc0000012, 0x60000041, 0xc0000032, 0x20000001, 0xc0000002, 0xe0000042, 0x60000042, 0x80000002, 0x00000000, 0x00000000, 0x80000000, 0x00000002, 0x00000040, 0x00000000, 0x80000040, 0x80000000, 0x00000040, 0x80000001, 0x00000060, 0x80000003, 0x40000002, 0xc0000040, 0xc0000002, 0x80000000, 0x80000000, 0x80000002, 0x00000040, 0x00000002, 0x80000000, 0x80000000, 0x80000000, 0x00000002, 0x00000040, 0x00000000, 0x80000040, 0x80000002, 0x00000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000080, 0x00000004, 0x00000009, 0x00000105, 0x00000089, 0x00000016, 0x0000020b, 0x0000011b, 0x0000012d, 0x0000041e, 0x00000224, 0x00000050, 0x0000092e, 0x0000046c}, }, { DvType: 2, DvK: 51, DvB: 0, TestT: 65, MaskI: 0, MaskB: 25, Dm: [CheckSize]uint32{ 0xc0000010, 0xb400001c, 0x3c000004, 0xbc00001a, 0x20000010, 0x2400001c, 0xec000014, 0x0c000002, 0xc0000010, 0xb400001c, 0x2c000004, 0xbc000018, 0xb0000010, 0x0000000c, 0xb8000010, 0x08000018, 0x78000010, 0x08000014, 0x70000010, 0xb800001c, 0xe8000000, 0xb0000004, 0x58000010, 0xb000000c, 0x48000000, 0xb0000000, 0xb8000010, 0x98000010, 0xa0000000, 0x00000000, 0x00000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x60000000, 0x00000018, 0xe0000000, 0x90000000, 0x30000010, 0xb0000000, 0x20000000, 0x20000000, 0xa0000000, 0x00000010, 0x80000000, 0x20000000, 0x20000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000041, 0x40000022, 0x80000005, 0xc0000082, 0xc0000046, 0x4000004b, 0x80000107, 0x00000089, 0x00000014, 0x8000024b}, }, { DvType: 2, DvK: 51, DvB: 2, TestT: 65, MaskI: 0, MaskB: 26, Dm: [CheckSize]uint32{ 0x00000043, 0xd0000072, 0xf0000010, 0xf000006a, 0x80000040, 0x90000070, 0xb0000053, 0x30000008, 0x00000043, 0xd0000072, 0xb0000010, 0xf0000062, 0xc0000042, 0x00000030, 0xe0000042, 0x20000060, 0xe0000041, 0x20000050, 0xc0000041, 0xe0000072, 0xa0000003, 0xc0000012, 0x60000041, 0xc0000032, 0x20000001, 0xc0000002, 0xe0000042, 0x60000042, 0x80000002, 0x00000000, 0x00000000, 0x80000000, 0x00000002, 0x00000040, 0x00000000, 0x80000040, 0x80000000, 0x00000040, 0x80000001, 0x00000060, 0x80000003, 0x40000002, 0xc0000040, 0xc0000002, 0x80000000, 0x80000000, 0x80000002, 0x00000040, 0x00000002, 0x80000000, 0x80000000, 0x80000000, 0x00000002, 0x00000040, 0x00000000, 0x80000040, 0x80000002, 0x00000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000080, 0x00000004, 0x00000009, 0x00000105, 0x00000089, 0x00000016, 0x0000020b, 0x0000011b, 0x0000012d, 0x0000041e, 0x00000224, 0x00000050, 0x0000092e}, }, { DvType: 2, DvK: 52, DvB: 0, TestT: 65, MaskI: 0, MaskB: 27, Dm: [CheckSize]uint32{ 0x0c000002, 0xc0000010, 0xb400001c, 0x3c000004, 0xbc00001a, 0x20000010, 0x2400001c, 0xec000014, 0x0c000002, 0xc0000010, 0xb400001c, 0x2c000004, 0xbc000018, 0xb0000010, 0x0000000c, 0xb8000010, 0x08000018, 0x78000010, 0x08000014, 0x70000010, 0xb800001c, 0xe8000000, 0xb0000004, 0x58000010, 0xb000000c, 0x48000000, 0xb0000000, 0xb8000010, 0x98000010, 0xa0000000, 0x00000000, 0x00000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x60000000, 0x00000018, 0xe0000000, 0x90000000, 0x30000010, 0xb0000000, 0x20000000, 0x20000000, 0xa0000000, 0x00000010, 0x80000000, 0x20000000, 0x20000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000041, 0x40000022, 0x80000005, 0xc0000082, 0xc0000046, 0x4000004b, 0x80000107, 0x00000089, 0x00000014}, }, { DvType: 2, DvK: 53, DvB: 0, TestT: 65, MaskI: 0, MaskB: 28, Dm: [CheckSize]uint32{ 0xcc000014, 0x0c000002, 0xc0000010, 0xb400001c, 0x3c000004, 0xbc00001a, 0x20000010, 0x2400001c, 0xec000014, 0x0c000002, 0xc0000010, 0xb400001c, 0x2c000004, 0xbc000018, 0xb0000010, 0x0000000c, 0xb8000010, 0x08000018, 0x78000010, 0x08000014, 0x70000010, 0xb800001c, 0xe8000000, 0xb0000004, 0x58000010, 0xb000000c, 0x48000000, 0xb0000000, 0xb8000010, 0x98000010, 0xa0000000, 0x00000000, 0x00000000, 0x20000000, 0x80000000, 0x00000010,
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
true
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/pjbgf/sha1cd/ubc/ubc_noasm.go
vendor/github.com/pjbgf/sha1cd/ubc/ubc_noasm.go
//go:build !amd64 || noasm || !gc // +build !amd64 noasm !gc package ubc // Check takes as input an expanded message block and verifies the unavoidable bitconditions // for all listed DVs. It returns a dvmask where each bit belonging to a DV is set if all // unavoidable bitconditions for that DV have been met. // Thus, one needs to do the recompression check for each DV that has its bit set. func CalculateDvMask(W [80]uint32) uint32 { return CalculateDvMaskGeneric(W) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/mgutz/str/funcsPZ.go
vendor/github.com/mgutz/str/funcsPZ.go
package str import ( "fmt" "html" //"log" "math" "regexp" "runtime" "strconv" "strings" "unicode/utf8" ) // Pad pads string s on both sides with c until it has length of n. func Pad(s, c string, n int) string { L := len(s) if L >= n { return s } n -= L left := strings.Repeat(c, int(math.Ceil(float64(n)/2))) right := strings.Repeat(c, int(math.Floor(float64(n)/2))) return left + s + right } // PadF is the filter form of Pad. func PadF(c string, n int) func(string) string { return func(s string) string { return Pad(s, c, n) } } // PadLeft pads s on left side with c until it has length of n. func PadLeft(s, c string, n int) string { L := len(s) if L > n { return s } return strings.Repeat(c, (n-L)) + s } // PadLeftF is the filter form of PadLeft. func PadLeftF(c string, n int) func(string) string { return func(s string) string { return PadLeft(s, c, n) } } // PadRight pads s on right side with c until it has length of n. func PadRight(s, c string, n int) string { L := len(s) if L > n { return s } return s + strings.Repeat(c, n-L) } // PadRightF is the filter form of Padright func PadRightF(c string, n int) func(string) string { return func(s string) string { return PadRight(s, c, n) } } // Pipe pipes s through one or more string filters. func Pipe(s string, funcs ...func(string) string) string { for _, fn := range funcs { s = fn(s) } return s } // QuoteItems quotes all items in array, mostly for debugging. func QuoteItems(arr []string) []string { return Map(arr, func(s string) string { return strconv.Quote(s) }) } // ReplaceF is the filter form of strings.Replace. func ReplaceF(old, new string, n int) func(string) string { return func(s string) string { return strings.Replace(s, old, new, n) } } // ReplacePattern replaces string with regexp string. // ReplacePattern returns a copy of src, replacing matches of the Regexp with the replacement string repl. Inside repl, $ signs are interpreted as in Expand, so for instance $1 represents the text of the first submatch. func ReplacePattern(s, pattern, repl string) string { r := regexp.MustCompile(pattern) return r.ReplaceAllString(s, repl) } // ReplacePatternF is the filter form of ReplaceRegexp. func ReplacePatternF(pattern, repl string) func(string) string { return func(s string) string { return ReplacePattern(s, pattern, repl) } } // Reverse a string func Reverse(s string) string { cs := make([]rune, utf8.RuneCountInString(s)) i := len(cs) for _, c := range s { i-- cs[i] = c } return string(cs) } // Right returns the right substring of length n. func Right(s string, n int) string { if n < 0 { return Left(s, -n) } return Substr(s, len(s)-n, n) } // RightF is the Filter version of Right. func RightF(n int) func(string) string { return func(s string) string { return Right(s, n) } } // RightOf returns the substring to the right of prefix. func RightOf(s string, prefix string) string { return Between(s, prefix, "") } // SetTemplateDelimiters sets the delimiters for Template function. Defaults to "{{" and "}}" func SetTemplateDelimiters(opening, closing string) { templateOpen = opening templateClose = closing } // Slice slices a string. If end is negative then it is the from the end // of the string. func Slice(s string, start, end int) string { if end > -1 { return s[start:end] } L := len(s) if L+end > 0 { return s[start : L-end] } return s[start:] } // SliceF is the filter for Slice. func SliceF(start, end int) func(string) string { return func(s string) string { return Slice(s, start, end) } } // SliceContains determines whether val is an element in slice. func SliceContains(slice []string, val string) bool { if slice == nil { return false } for _, it := range slice { if it == val { return true } } return false } // SliceIndexOf gets the indx of val in slice. Returns -1 if not found. func SliceIndexOf(slice []string, val string) int { if slice == nil { return -1 } for i, it := range slice { if it == val { return i } } return -1 } // Slugify converts s into a dasherized string suitable for URL segment. func Slugify(s string) string { sl := slugifyRe.ReplaceAllString(s, "") sl = strings.ToLower(sl) sl = Dasherize(sl) return sl } // StripPunctuation strips puncation from string. func StripPunctuation(s string) string { s = stripPuncRe.ReplaceAllString(s, "") s = nWhitespaceRe.ReplaceAllString(s, " ") return s } // StripTags strips all of the html tags or tags specified by the parameters func StripTags(s string, tags ...string) string { if len(tags) == 0 { tags = append(tags, "") } for _, tag := range tags { stripTagsRe := regexp.MustCompile(`(?i)<\/?` + tag + `[^<>]*>`) s = stripTagsRe.ReplaceAllString(s, "") } return s } // Substr returns a substring of s starting at index of length n. func Substr(s string, index int, n int) string { L := len(s) if index < 0 || index >= L || s == "" { return "" } end := index + n if end >= L { end = L } if end <= index { return "" } return s[index:end] } // SubstrF is the filter form of Substr. func SubstrF(index, n int) func(string) string { return func(s string) string { return Substr(s, index, n) } } // Template is a string template which replaces template placeholders delimited // by "{{" and "}}" with values from map. The global delimiters may be set with // SetTemplateDelimiters. func Template(s string, values map[string]interface{}) string { return TemplateWithDelimiters(s, values, templateOpen, templateClose) } // TemplateDelimiters is the getter for the opening and closing delimiters for Template. func TemplateDelimiters() (opening string, closing string) { return templateOpen, templateClose } // TemplateWithDelimiters is string template with user-defineable opening and closing delimiters. func TemplateWithDelimiters(s string, values map[string]interface{}, opening, closing string) string { escapeDelimiter := func(delim string) string { result := templateRe.ReplaceAllString(delim, "\\$1") return templateRe2.ReplaceAllString(result, "\\$") } openingDelim := escapeDelimiter(opening) closingDelim := escapeDelimiter(closing) r := regexp.MustCompile(openingDelim + `(.+?)` + closingDelim) matches := r.FindAllStringSubmatch(s, -1) for _, submatches := range matches { match := submatches[0] key := submatches[1] //log.Printf("match %s key %s\n", match, key) if values[key] != nil { v := fmt.Sprintf("%v", values[key]) s = strings.Replace(s, match, v, -1) } } return s } // ToArgv converts string s into an argv for exec. func ToArgv(s string) []string { const ( InArg = iota InArgQuote OutOfArg ) currentState := OutOfArg currentQuoteChar := "\x00" // to distinguish between ' and " quotations // this allows to use "foo'bar" currentArg := "" argv := []string{} isQuote := func(c string) bool { return c == `"` || c == `'` } isEscape := func(c string) bool { return c == `\` } isWhitespace := func(c string) bool { return c == " " || c == "\t" } L := len(s) for i := 0; i < L; i++ { c := s[i : i+1] //fmt.Printf("c %s state %v arg %s argv %v i %d\n", c, currentState, currentArg, args, i) if isQuote(c) { switch currentState { case OutOfArg: currentArg = "" fallthrough case InArg: currentState = InArgQuote currentQuoteChar = c case InArgQuote: if c == currentQuoteChar { currentState = InArg } else { currentArg += c } } } else if isWhitespace(c) { switch currentState { case InArg: argv = append(argv, currentArg) currentState = OutOfArg case InArgQuote: currentArg += c case OutOfArg: // nothing } } else if isEscape(c) { switch currentState { case OutOfArg: currentArg = "" currentState = InArg fallthrough case InArg: fallthrough case InArgQuote: if i == L-1 { if runtime.GOOS == "windows" { // just add \ to end for windows currentArg += c } else { panic("Escape character at end string") } } else { if runtime.GOOS == "windows" { peek := s[i+1 : i+2] if peek != `"` { currentArg += c } } else { i++ c = s[i : i+1] currentArg += c } } } } else { switch currentState { case InArg, InArgQuote: currentArg += c case OutOfArg: currentArg = "" currentArg += c currentState = InArg } } } if currentState == InArg { argv = append(argv, currentArg) } else if currentState == InArgQuote { panic("Starting quote has no ending quote.") } return argv } // ToBool fuzzily converts truthy values. func ToBool(s string) bool { s = strings.ToLower(s) return s == "true" || s == "yes" || s == "on" || s == "1" } // ToBoolOr parses s as a bool or returns defaultValue. func ToBoolOr(s string, defaultValue bool) bool { b, err := strconv.ParseBool(s) if err != nil { return defaultValue } return b } // ToIntOr parses s as an int or returns defaultValue. func ToIntOr(s string, defaultValue int) int { n, err := strconv.Atoi(s) if err != nil { return defaultValue } return n } // ToFloat32Or parses as a float32 or returns defaultValue on error. func ToFloat32Or(s string, defaultValue float32) float32 { f, err := strconv.ParseFloat(s, 32) if err != nil { return defaultValue } return float32(f) } // ToFloat64Or parses s as a float64 or returns defaultValue. func ToFloat64Or(s string, defaultValue float64) float64 { f, err := strconv.ParseFloat(s, 64) if err != nil { return defaultValue } return f } // ToFloatOr parses as a float64 or returns defaultValue. var ToFloatOr = ToFloat64Or // TODO This is not working yet. Go's regexp package does not have some // of the niceities in JavaScript // // Truncate truncates the string, accounting for word placement and chars count // adding a morestr (defaults to ellipsis) // func Truncate(s, morestr string, n int) string { // L := len(s) // if L <= n { // return s // } // // if morestr == "" { // morestr = "..." // } // // tmpl := func(c string) string { // if strings.ToUpper(c) != strings.ToLower(c) { // return "A" // } // return " " // } // template := s[0 : n+1] // var truncateRe = regexp.MustCompile(`.(?=\W*\w*$)`) // truncateRe.ReplaceAllStringFunc(template, tmpl) // 'Hello, world' -> 'HellAA AAAAA' // var wwRe = regexp.MustCompile(`\w\w`) // var whitespaceRe2 = regexp.MustCompile(`\s*\S+$`) // if wwRe.MatchString(template[len(template)-2:]) { // template = whitespaceRe2.ReplaceAllString(template, "") // } else { // template = strings.TrimRight(template, " \t\n") // } // // if len(template+morestr) > L { // return s // } // return s[0:len(template)] + morestr // } // // truncate: function(length, pruneStr) { //from underscore.string, author: github.com/rwz // var str = this.s; // // length = ~~length; // pruneStr = pruneStr || '...'; // // if (str.length <= length) return new this.constructor(str); // // var tmpl = function(c){ return c.toUpperCase() !== c.toLowerCase() ? 'A' : ' '; }, // template = str.slice(0, length+1).replace(/.(?=\W*\w*$)/g, tmpl); // 'Hello, world' -> 'HellAA AAAAA' // // if (template.slice(template.length-2).match(/\w\w/)) // template = template.replace(/\s*\S+$/, ''); // else // template = new S(template.slice(0, template.length-1)).trimRight().s; // // return (template+pruneStr).length > str.length ? new S(str) : new S(str.slice(0, template.length)+pruneStr); // }, // Underscore returns converted camel cased string into a string delimited by underscores. func Underscore(s string) string { if s == "" { return "" } u := strings.TrimSpace(s) u = underscoreRe.ReplaceAllString(u, "${1}_$2") u = dashSpaceRe.ReplaceAllString(u, "_") u = strings.ToLower(u) if IsUpper(s[0:1]) { return "_" + u } return u } // UnescapeHTML is an alias for html.UnescapeString. func UnescapeHTML(s string) string { if Verbose { fmt.Println("Use html.UnescapeString instead of UnescapeHTML") } return html.UnescapeString(s) } // WrapHTML wraps s within HTML tag having attributes attrs. Note, // WrapHTML does not escape s value. func WrapHTML(s string, tag string, attrs map[string]string) string { escapeHTMLAttributeQuotes := func(v string) string { v = strings.Replace(v, "<", "&lt;", -1) v = strings.Replace(v, "&", "&amp;", -1) v = strings.Replace(v, "\"", "&quot;", -1) return v } if tag == "" { tag = "div" } el := "<" + tag for name, val := range attrs { el += " " + name + "=\"" + escapeHTMLAttributeQuotes(val) + "\"" } el += ">" + s + "</" + tag + ">" return el } // WrapHTMLF is the filter form of WrapHTML. func WrapHTMLF(tag string, attrs map[string]string) func(string) string { return func(s string) string { return WrapHTML(s, tag, attrs) } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/mgutz/str/doc.go
vendor/github.com/mgutz/str/doc.go
// Package str is a comprehensive set of string functions to build more // Go awesomeness. Str complements Go's standard packages and does not duplicate // functionality found in `strings` or `strconv`. // // Str is based on plain functions instead of object-based methods, // consistent with Go standard string packages. // // str.Between("<a>foo</a>", "<a>", "</a>") == "foo" // // Str supports pipelining instead of chaining // // s := str.Pipe("\nabcdef\n", Clean, BetweenF("a", "f"), ChompLeftF("bc")) // // User-defined filters can be added to the pipeline by inserting a function // or closure that returns a function with this signature // // func(string) string // package str
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/mgutz/str/funcsAO.go
vendor/github.com/mgutz/str/funcsAO.go
package str import ( "fmt" "html" //"log" "regexp" "strings" ) // Verbose flag enables console output for those functions that have // counterparts in Go's excellent stadard packages. var Verbose = false var templateOpen = "{{" var templateClose = "}}" var beginEndSpacesRe = regexp.MustCompile("^\\s+|\\s+$") var camelizeRe = regexp.MustCompile(`(\-|_|\s)+(.)?`) var camelizeRe2 = regexp.MustCompile(`(\-|_|\s)+`) var capitalsRe = regexp.MustCompile("([A-Z])") var dashSpaceRe = regexp.MustCompile(`[-\s]+`) var dashesRe = regexp.MustCompile("-+") var isAlphaNumericRe = regexp.MustCompile(`[^0-9a-z\xC0-\xFF]`) var isAlphaRe = regexp.MustCompile(`[^a-z\xC0-\xFF]`) var nWhitespaceRe = regexp.MustCompile(`\s+`) var notDigitsRe = regexp.MustCompile(`[^0-9]`) var slugifyRe = regexp.MustCompile(`[^\w\s\-]`) var spaceUnderscoreRe = regexp.MustCompile("[_\\s]+") var spacesRe = regexp.MustCompile("[\\s\\xA0]+") var stripPuncRe = regexp.MustCompile(`[^\w\s]|_`) var templateRe = regexp.MustCompile(`([\-\[\]()*\s])`) var templateRe2 = regexp.MustCompile(`\$`) var underscoreRe = regexp.MustCompile(`([a-z\d])([A-Z]+)`) var whitespaceRe = regexp.MustCompile(`^[\s\xa0]*$`) func min(a, b int) int { if a < b { return a } return b } func max(a, b int) int { if a > b { return a } return b } // Between extracts a string between left and right strings. func Between(s, left, right string) string { l := len(left) startPos := strings.Index(s, left) if startPos < 0 { return "" } endPos := IndexOf(s, right, startPos+l) //log.Printf("%s: left %s right %s start %d end %d", s, left, right, startPos+l, endPos) if endPos < 0 { return "" } else if right == "" { return s[endPos:] } else { return s[startPos+l : endPos] } } // BetweenF is the filter form for Between. func BetweenF(left, right string) func(string) string { return func(s string) string { return Between(s, left, right) } } // Camelize return new string which removes any underscores or dashes and convert a string into camel casing. func Camelize(s string) string { return camelizeRe.ReplaceAllStringFunc(s, func(val string) string { val = strings.ToUpper(val) val = camelizeRe2.ReplaceAllString(val, "") return val }) } // Capitalize uppercases the first char of s and lowercases the rest. func Capitalize(s string) string { return strings.ToUpper(s[0:1]) + strings.ToLower(s[1:]) } // CharAt returns a string from the character at the specified position. func CharAt(s string, index int) string { l := len(s) shortcut := index < 0 || index > l-1 || l == 0 if shortcut { return "" } return s[index : index+1] } // CharAtF is the filter form of CharAt. func CharAtF(index int) func(string) string { return func(s string) string { return CharAt(s, index) } } // ChompLeft removes prefix at the start of a string. func ChompLeft(s, prefix string) string { if strings.HasPrefix(s, prefix) { return s[len(prefix):] } return s } // ChompLeftF is the filter form of ChompLeft. func ChompLeftF(prefix string) func(string) string { return func(s string) string { return ChompLeft(s, prefix) } } // ChompRight removes suffix from end of s. func ChompRight(s, suffix string) string { if strings.HasSuffix(s, suffix) { return s[:len(s)-len(suffix)] } return s } // ChompRightF is the filter form of ChompRight. func ChompRightF(suffix string) func(string) string { return func(s string) string { return ChompRight(s, suffix) } } // Classify returns a camelized string with the first letter upper cased. func Classify(s string) string { return Camelize("-" + s) } // ClassifyF is the filter form of Classify. func ClassifyF(s string) func(string) string { return func(s string) string { return Classify(s) } } // Clean compresses all adjacent whitespace to a single space and trims s. func Clean(s string) string { s = spacesRe.ReplaceAllString(s, " ") s = beginEndSpacesRe.ReplaceAllString(s, "") return s } // Dasherize converts a camel cased string into a string delimited by dashes. func Dasherize(s string) string { s = strings.TrimSpace(s) s = spaceUnderscoreRe.ReplaceAllString(s, "-") s = capitalsRe.ReplaceAllString(s, "-$1") s = dashesRe.ReplaceAllString(s, "-") s = strings.ToLower(s) return s } // EscapeHTML is alias for html.EscapeString. func EscapeHTML(s string) string { if Verbose { fmt.Println("Use html.EscapeString instead of EscapeHTML") } return html.EscapeString(s) } // DecodeHTMLEntities decodes HTML entities into their proper string representation. // DecodeHTMLEntities is an alias for html.UnescapeString func DecodeHTMLEntities(s string) string { if Verbose { fmt.Println("Use html.UnescapeString instead of DecodeHTMLEntities") } return html.UnescapeString(s) } // EnsurePrefix ensures s starts with prefix. func EnsurePrefix(s, prefix string) string { if strings.HasPrefix(s, prefix) { return s } return prefix + s } // EnsurePrefixF is the filter form of EnsurePrefix. func EnsurePrefixF(prefix string) func(string) string { return func(s string) string { return EnsurePrefix(s, prefix) } } // EnsureSuffix ensures s ends with suffix. func EnsureSuffix(s, suffix string) string { if strings.HasSuffix(s, suffix) { return s } return s + suffix } // EnsureSuffixF is the filter form of EnsureSuffix. func EnsureSuffixF(suffix string) func(string) string { return func(s string) string { return EnsureSuffix(s, suffix) } } // Humanize transforms s into a human friendly form. func Humanize(s string) string { if s == "" { return s } s = Underscore(s) var humanizeRe = regexp.MustCompile(`_id$`) s = humanizeRe.ReplaceAllString(s, "") s = strings.Replace(s, "_", " ", -1) s = strings.TrimSpace(s) s = Capitalize(s) return s } // Iif is short for immediate if. If condition is true return truthy else falsey. func Iif(condition bool, truthy string, falsey string) string { if condition { return truthy } return falsey } // IndexOf finds the index of needle in s starting from start. func IndexOf(s string, needle string, start int) int { l := len(s) if needle == "" { if start < 0 { return 0 } else if start < l { return start } else { return l } } if start < 0 || start > l-1 { return -1 } pos := strings.Index(s[start:], needle) if pos == -1 { return -1 } return start + pos } // IsAlpha returns true if a string contains only letters from ASCII (a-z,A-Z). Other letters from other languages are not supported. func IsAlpha(s string) bool { return !isAlphaRe.MatchString(strings.ToLower(s)) } // IsAlphaNumeric returns true if a string contains letters and digits. func IsAlphaNumeric(s string) bool { return !isAlphaNumericRe.MatchString(strings.ToLower(s)) } // IsLower returns true if s comprised of all lower case characters. func IsLower(s string) bool { return IsAlpha(s) && s == strings.ToLower(s) } // IsNumeric returns true if a string contains only digits from 0-9. Other digits not in Latin (such as Arabic) are not currently supported. func IsNumeric(s string) bool { return !notDigitsRe.MatchString(s) } // IsUpper returns true if s contains all upper case chracters. func IsUpper(s string) bool { return IsAlpha(s) && s == strings.ToUpper(s) } // IsEmpty returns true if the string is solely composed of whitespace. func IsEmpty(s string) bool { if s == "" { return true } return whitespaceRe.MatchString(s) } // Left returns the left substring of length n. func Left(s string, n int) string { if n < 0 { return Right(s, -n) } return Substr(s, 0, n) } // LeftF is the filter form of Left. func LeftF(n int) func(string) string { return func(s string) string { return Left(s, n) } } // LeftOf returns the substring left of needle. func LeftOf(s string, needle string) string { return Between(s, "", needle) } // Letters returns an array of runes as strings so it can be indexed into. func Letters(s string) []string { result := []string{} for _, r := range s { result = append(result, string(r)) } return result } // Lines convert windows newlines to unix newlines then convert to an Array of lines. func Lines(s string) []string { s = strings.Replace(s, "\r\n", "\n", -1) return strings.Split(s, "\n") } // Map maps an array's iitem through an iterator. func Map(arr []string, iterator func(string) string) []string { r := []string{} for _, item := range arr { r = append(r, iterator(item)) } return r } // Match returns true if patterns matches the string func Match(s, pattern string) bool { r := regexp.MustCompile(pattern) return r.MatchString(s) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/creack/pty/pty_freebsd.go
vendor/github.com/creack/pty/pty_freebsd.go
package pty import ( "errors" "os" "syscall" "unsafe" ) func posixOpenpt(oflag int) (fd int, err error) { r0, _, e1 := syscall.Syscall(syscall.SYS_POSIX_OPENPT, uintptr(oflag), 0, 0) fd = int(r0) if e1 != 0 { err = e1 } return fd, err } func open() (pty, tty *os.File, err error) { fd, err := posixOpenpt(syscall.O_RDWR | syscall.O_CLOEXEC) if err != nil { return nil, nil, err } p := os.NewFile(uintptr(fd), "/dev/pts") // In case of error after this point, make sure we close the pts fd. defer func() { if err != nil { _ = p.Close() // Best effort. } }() sname, err := ptsname(p) if err != nil { return nil, nil, err } t, err := os.OpenFile("/dev/"+sname, os.O_RDWR, 0) if err != nil { return nil, nil, err } return p, t, nil } func isptmaster(fd uintptr) (bool, error) { err := ioctl(fd, syscall.TIOCPTMASTER, 0) return err == nil, err } var ( emptyFiodgnameArg fiodgnameArg ioctlFIODGNAME = _IOW('f', 120, unsafe.Sizeof(emptyFiodgnameArg)) ) func ptsname(f *os.File) (string, error) { master, err := isptmaster(f.Fd()) if err != nil { return "", err } if !master { return "", syscall.EINVAL } const n = _C_SPECNAMELEN + 1 var ( buf = make([]byte, n) arg = fiodgnameArg{Len: n, Buf: (*byte)(unsafe.Pointer(&buf[0]))} ) if err := ioctl(f.Fd(), ioctlFIODGNAME, uintptr(unsafe.Pointer(&arg))); err != nil { return "", err } for i, c := range buf { if c == 0 { return string(buf[:i]), nil } } return "", errors.New("FIODGNAME string not NUL-terminated") }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/creack/pty/ztypes_arm.go
vendor/github.com/creack/pty/ztypes_arm.go
// Created by cgo -godefs - DO NOT EDIT // cgo -godefs types.go package pty type ( _C_int int32 _C_uint uint32 )
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/creack/pty/ztypes_ppc64le.go
vendor/github.com/creack/pty/ztypes_ppc64le.go
// +build ppc64le // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types.go package pty type ( _C_int int32 _C_uint uint32 )
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/creack/pty/ztypes_freebsd_386.go
vendor/github.com/creack/pty/ztypes_freebsd_386.go
// Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_freebsd.go package pty const ( _C_SPECNAMELEN = 0x3f ) type fiodgnameArg struct { Len int32 Buf *byte }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/creack/pty/pty_openbsd.go
vendor/github.com/creack/pty/pty_openbsd.go
package pty import ( "os" "syscall" "unsafe" ) func open() (pty, tty *os.File, err error) { /* * from ptm(4): * The PTMGET command allocates a free pseudo terminal, changes its * ownership to the caller, revokes the access privileges for all previous * users, opens the file descriptors for the pty and tty devices and * returns them to the caller in struct ptmget. */ p, err := os.OpenFile("/dev/ptm", os.O_RDWR|syscall.O_CLOEXEC, 0) if err != nil { return nil, nil, err } defer p.Close() var ptm ptmget if err := ioctl(p.Fd(), uintptr(ioctl_PTMGET), uintptr(unsafe.Pointer(&ptm))); err != nil { return nil, nil, err } pty = os.NewFile(uintptr(ptm.Cfd), "/dev/ptm") tty = os.NewFile(uintptr(ptm.Sfd), "/dev/ptm") return pty, tty, nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/creack/pty/pty_darwin.go
vendor/github.com/creack/pty/pty_darwin.go
package pty import ( "errors" "os" "syscall" "unsafe" ) func open() (pty, tty *os.File, err error) { pFD, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|syscall.O_CLOEXEC, 0) if err != nil { return nil, nil, err } p := os.NewFile(uintptr(pFD), "/dev/ptmx") // In case of error after this point, make sure we close the ptmx fd. defer func() { if err != nil { _ = p.Close() // Best effort. } }() sname, err := ptsname(p) if err != nil { return nil, nil, err } if err := grantpt(p); err != nil { return nil, nil, err } if err := unlockpt(p); err != nil { return nil, nil, err } t, err := os.OpenFile(sname, os.O_RDWR, 0) if err != nil { return nil, nil, err } return p, t, nil } func ptsname(f *os.File) (string, error) { n := make([]byte, _IOC_PARM_LEN(syscall.TIOCPTYGNAME)) err := ioctl(f.Fd(), syscall.TIOCPTYGNAME, uintptr(unsafe.Pointer(&n[0]))) if err != nil { return "", err } for i, c := range n { if c == 0 { return string(n[:i]), nil } } return "", errors.New("TIOCPTYGNAME string not NUL-terminated") } func grantpt(f *os.File) error { return ioctl(f.Fd(), syscall.TIOCPTYGRANT, 0) } func unlockpt(f *os.File) error { return ioctl(f.Fd(), syscall.TIOCPTYUNLK, 0) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/creack/pty/ztypes_freebsd_arm.go
vendor/github.com/creack/pty/ztypes_freebsd_arm.go
// Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_freebsd.go package pty const ( _C_SPECNAMELEN = 0x3f ) type fiodgnameArg struct { Len int32 Buf *byte }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/creack/pty/ztypes_openbsd_32bit_int.go
vendor/github.com/creack/pty/ztypes_openbsd_32bit_int.go
// +build openbsd // +build 386 amd64 arm arm64 package pty type ptmget struct { Cfd int32 Sfd int32 Cn [16]int8 Sn [16]int8 } var ioctl_PTMGET = 0x40287401
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/creack/pty/ztypes_s390x.go
vendor/github.com/creack/pty/ztypes_s390x.go
// +build s390x // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types.go package pty type ( _C_int int32 _C_uint uint32 )
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/creack/pty/ztypes_freebsd_arm64.go
vendor/github.com/creack/pty/ztypes_freebsd_arm64.go
// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs types_freebsd.go package pty const ( _C_SPECNAMELEN = 0xff ) type fiodgnameArg struct { Len int32 Buf *byte }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/creack/pty/ztypes_riscvx.go
vendor/github.com/creack/pty/ztypes_riscvx.go
// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs types.go // +build riscv riscv64 package pty type ( _C_int int32 _C_uint uint32 )
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/creack/pty/ztypes_ppc64.go
vendor/github.com/creack/pty/ztypes_ppc64.go
// +build ppc64 // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types.go package pty type ( _C_int int32 _C_uint uint32 )
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/creack/pty/util.go
vendor/github.com/creack/pty/util.go
// +build !windows,!solaris package pty import ( "os" "syscall" "unsafe" ) // InheritSize applies the terminal size of pty to tty. This should be run // in a signal handler for syscall.SIGWINCH to automatically resize the tty when // the pty receives a window size change notification. func InheritSize(pty, tty *os.File) error { size, err := GetsizeFull(pty) if err != nil { return err } err = Setsize(tty, size) if err != nil { return err } return nil } // Setsize resizes t to s. func Setsize(t *os.File, ws *Winsize) error { return windowRectCall(ws, t.Fd(), syscall.TIOCSWINSZ) } // GetsizeFull returns the full terminal size description. func GetsizeFull(t *os.File) (size *Winsize, err error) { var ws Winsize err = windowRectCall(&ws, t.Fd(), syscall.TIOCGWINSZ) return &ws, err } // Getsize returns the number of rows (lines) and cols (positions // in each line) in terminal t. func Getsize(t *os.File) (rows, cols int, err error) { ws, err := GetsizeFull(t) return int(ws.Rows), int(ws.Cols), err } // Winsize describes the terminal size. type Winsize struct { Rows uint16 // ws_row: Number of rows (in cells) Cols uint16 // ws_col: Number of columns (in cells) X uint16 // ws_xpixel: Width in pixels Y uint16 // ws_ypixel: Height in pixels } func windowRectCall(ws *Winsize, fd, a2 uintptr) error { _, _, errno := syscall.Syscall( syscall.SYS_IOCTL, fd, a2, uintptr(unsafe.Pointer(ws)), ) if errno != 0 { return syscall.Errno(errno) } return nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/creack/pty/ioctl_bsd.go
vendor/github.com/creack/pty/ioctl_bsd.go
// +build darwin dragonfly freebsd netbsd openbsd package pty // from <sys/ioccom.h> const ( _IOC_VOID uintptr = 0x20000000 _IOC_OUT uintptr = 0x40000000 _IOC_IN uintptr = 0x80000000 _IOC_IN_OUT uintptr = _IOC_OUT | _IOC_IN _IOC_DIRMASK = _IOC_VOID | _IOC_OUT | _IOC_IN _IOC_PARAM_SHIFT = 13 _IOC_PARAM_MASK = (1 << _IOC_PARAM_SHIFT) - 1 ) func _IOC_PARM_LEN(ioctl uintptr) uintptr { return (ioctl >> 16) & _IOC_PARAM_MASK } func _IOC(inout uintptr, group byte, ioctl_num uintptr, param_len uintptr) uintptr { return inout | (param_len&_IOC_PARAM_MASK)<<16 | uintptr(group)<<8 | ioctl_num } func _IO(group byte, ioctl_num uintptr) uintptr { return _IOC(_IOC_VOID, group, ioctl_num, 0) } func _IOR(group byte, ioctl_num uintptr, param_len uintptr) uintptr { return _IOC(_IOC_OUT, group, ioctl_num, param_len) } func _IOW(group byte, ioctl_num uintptr, param_len uintptr) uintptr { return _IOC(_IOC_IN, group, ioctl_num, param_len) } func _IOWR(group byte, ioctl_num uintptr, param_len uintptr) uintptr { return _IOC(_IOC_IN_OUT, group, ioctl_num, param_len) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/creack/pty/ztypes_freebsd_amd64.go
vendor/github.com/creack/pty/ztypes_freebsd_amd64.go
// Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_freebsd.go package pty const ( _C_SPECNAMELEN = 0x3f ) type fiodgnameArg struct { Len int32 Pad_cgo_0 [4]byte Buf *byte }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/creack/pty/ztypes_arm64.go
vendor/github.com/creack/pty/ztypes_arm64.go
// Created by cgo -godefs - DO NOT EDIT // cgo -godefs types.go // +build arm64 package pty type ( _C_int int32 _C_uint uint32 )
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false