github.com/dolthub/go-mysql-server@v0.18.0/sql/encodings/dec8.go (about)

     1  // Copyright 2023 Dolthub, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package encodings
    16  
    17  // Dec8 represents the `dec8` character set encoding.
    18  var Dec8 Encoder = &RangeMap{
    19  	inputEntries: [][]rangeMapEntry{
    20  		{
    21  			{
    22  				inputRange:  rangeBounds{{0, 127}},
    23  				outputRange: rangeBounds{{0, 127}},
    24  				inputMults:  []int{1},
    25  				outputMults: []int{1},
    26  			},
    27  			{
    28  				inputRange:  rangeBounds{{128, 163}},
    29  				outputRange: rangeBounds{{194, 194}, {128, 163}},
    30  				inputMults:  []int{1},
    31  				outputMults: []int{36, 1},
    32  			},
    33  			{
    34  				inputRange:  rangeBounds{{165, 165}},
    35  				outputRange: rangeBounds{{194, 194}, {165, 165}},
    36  				inputMults:  []int{1},
    37  				outputMults: []int{1, 1},
    38  			},
    39  			{
    40  				inputRange:  rangeBounds{{167, 167}},
    41  				outputRange: rangeBounds{{194, 194}, {167, 167}},
    42  				inputMults:  []int{1},
    43  				outputMults: []int{1, 1},
    44  			},
    45  			{
    46  				inputRange:  rangeBounds{{168, 168}},
    47  				outputRange: rangeBounds{{194, 194}, {164, 164}},
    48  				inputMults:  []int{1},
    49  				outputMults: []int{1, 1},
    50  			},
    51  			{
    52  				inputRange:  rangeBounds{{169, 171}},
    53  				outputRange: rangeBounds{{194, 194}, {169, 171}},
    54  				inputMults:  []int{1},
    55  				outputMults: []int{3, 1},
    56  			},
    57  			{
    58  				inputRange:  rangeBounds{{176, 179}},
    59  				outputRange: rangeBounds{{194, 194}, {176, 179}},
    60  				inputMults:  []int{1},
    61  				outputMults: []int{4, 1},
    62  			},
    63  			{
    64  				inputRange:  rangeBounds{{181, 183}},
    65  				outputRange: rangeBounds{{194, 194}, {181, 183}},
    66  				inputMults:  []int{1},
    67  				outputMults: []int{3, 1},
    68  			},
    69  			{
    70  				inputRange:  rangeBounds{{185, 189}},
    71  				outputRange: rangeBounds{{194, 194}, {185, 189}},
    72  				inputMults:  []int{1},
    73  				outputMults: []int{5, 1},
    74  			},
    75  			{
    76  				inputRange:  rangeBounds{{191, 191}},
    77  				outputRange: rangeBounds{{194, 194}, {191, 191}},
    78  				inputMults:  []int{1},
    79  				outputMults: []int{1, 1},
    80  			},
    81  			{
    82  				inputRange:  rangeBounds{{192, 207}},
    83  				outputRange: rangeBounds{{195, 195}, {128, 143}},
    84  				inputMults:  []int{1},
    85  				outputMults: []int{16, 1},
    86  			},
    87  			{
    88  				inputRange:  rangeBounds{{209, 214}},
    89  				outputRange: rangeBounds{{195, 195}, {145, 150}},
    90  				inputMults:  []int{1},
    91  				outputMults: []int{6, 1},
    92  			},
    93  			{
    94  				inputRange:  rangeBounds{{215, 215}},
    95  				outputRange: rangeBounds{{197, 197}, {146, 146}},
    96  				inputMults:  []int{1},
    97  				outputMults: []int{1, 1},
    98  			},
    99  			{
   100  				inputRange:  rangeBounds{{216, 220}},
   101  				outputRange: rangeBounds{{195, 195}, {152, 156}},
   102  				inputMults:  []int{1},
   103  				outputMults: []int{5, 1},
   104  			},
   105  			{
   106  				inputRange:  rangeBounds{{221, 221}},
   107  				outputRange: rangeBounds{{197, 197}, {184, 184}},
   108  				inputMults:  []int{1},
   109  				outputMults: []int{1, 1},
   110  			},
   111  			{
   112  				inputRange:  rangeBounds{{223, 239}},
   113  				outputRange: rangeBounds{{195, 195}, {159, 175}},
   114  				inputMults:  []int{1},
   115  				outputMults: []int{17, 1},
   116  			},
   117  			{
   118  				inputRange:  rangeBounds{{241, 246}},
   119  				outputRange: rangeBounds{{195, 195}, {177, 182}},
   120  				inputMults:  []int{1},
   121  				outputMults: []int{6, 1},
   122  			},
   123  			{
   124  				inputRange:  rangeBounds{{247, 247}},
   125  				outputRange: rangeBounds{{197, 197}, {147, 147}},
   126  				inputMults:  []int{1},
   127  				outputMults: []int{1, 1},
   128  			},
   129  			{
   130  				inputRange:  rangeBounds{{248, 252}},
   131  				outputRange: rangeBounds{{195, 195}, {184, 188}},
   132  				inputMults:  []int{1},
   133  				outputMults: []int{5, 1},
   134  			},
   135  			{
   136  				inputRange:  rangeBounds{{253, 253}},
   137  				outputRange: rangeBounds{{195, 195}, {191, 191}},
   138  				inputMults:  []int{1},
   139  				outputMults: []int{1, 1},
   140  			},
   141  		},
   142  		nil,
   143  		nil,
   144  		nil,
   145  	},
   146  	outputEntries: [][]rangeMapEntry{
   147  		{
   148  			{
   149  				inputRange:  rangeBounds{{0, 127}},
   150  				outputRange: rangeBounds{{0, 127}},
   151  				inputMults:  []int{1},
   152  				outputMults: []int{1},
   153  			},
   154  		},
   155  		{
   156  			{
   157  				inputRange:  rangeBounds{{128, 163}},
   158  				outputRange: rangeBounds{{194, 194}, {128, 163}},
   159  				inputMults:  []int{1},
   160  				outputMults: []int{36, 1},
   161  			},
   162  			{
   163  				inputRange:  rangeBounds{{165, 165}},
   164  				outputRange: rangeBounds{{194, 194}, {165, 165}},
   165  				inputMults:  []int{1},
   166  				outputMults: []int{1, 1},
   167  			},
   168  			{
   169  				inputRange:  rangeBounds{{167, 167}},
   170  				outputRange: rangeBounds{{194, 194}, {167, 167}},
   171  				inputMults:  []int{1},
   172  				outputMults: []int{1, 1},
   173  			},
   174  			{
   175  				inputRange:  rangeBounds{{168, 168}},
   176  				outputRange: rangeBounds{{194, 194}, {164, 164}},
   177  				inputMults:  []int{1},
   178  				outputMults: []int{1, 1},
   179  			},
   180  			{
   181  				inputRange:  rangeBounds{{169, 171}},
   182  				outputRange: rangeBounds{{194, 194}, {169, 171}},
   183  				inputMults:  []int{1},
   184  				outputMults: []int{3, 1},
   185  			},
   186  			{
   187  				inputRange:  rangeBounds{{176, 179}},
   188  				outputRange: rangeBounds{{194, 194}, {176, 179}},
   189  				inputMults:  []int{1},
   190  				outputMults: []int{4, 1},
   191  			},
   192  			{
   193  				inputRange:  rangeBounds{{181, 183}},
   194  				outputRange: rangeBounds{{194, 194}, {181, 183}},
   195  				inputMults:  []int{1},
   196  				outputMults: []int{3, 1},
   197  			},
   198  			{
   199  				inputRange:  rangeBounds{{185, 189}},
   200  				outputRange: rangeBounds{{194, 194}, {185, 189}},
   201  				inputMults:  []int{1},
   202  				outputMults: []int{5, 1},
   203  			},
   204  			{
   205  				inputRange:  rangeBounds{{191, 191}},
   206  				outputRange: rangeBounds{{194, 194}, {191, 191}},
   207  				inputMults:  []int{1},
   208  				outputMults: []int{1, 1},
   209  			},
   210  			{
   211  				inputRange:  rangeBounds{{192, 207}},
   212  				outputRange: rangeBounds{{195, 195}, {128, 143}},
   213  				inputMults:  []int{1},
   214  				outputMults: []int{16, 1},
   215  			},
   216  			{
   217  				inputRange:  rangeBounds{{209, 214}},
   218  				outputRange: rangeBounds{{195, 195}, {145, 150}},
   219  				inputMults:  []int{1},
   220  				outputMults: []int{6, 1},
   221  			},
   222  			{
   223  				inputRange:  rangeBounds{{215, 215}},
   224  				outputRange: rangeBounds{{197, 197}, {146, 146}},
   225  				inputMults:  []int{1},
   226  				outputMults: []int{1, 1},
   227  			},
   228  			{
   229  				inputRange:  rangeBounds{{216, 220}},
   230  				outputRange: rangeBounds{{195, 195}, {152, 156}},
   231  				inputMults:  []int{1},
   232  				outputMults: []int{5, 1},
   233  			},
   234  			{
   235  				inputRange:  rangeBounds{{221, 221}},
   236  				outputRange: rangeBounds{{197, 197}, {184, 184}},
   237  				inputMults:  []int{1},
   238  				outputMults: []int{1, 1},
   239  			},
   240  			{
   241  				inputRange:  rangeBounds{{223, 239}},
   242  				outputRange: rangeBounds{{195, 195}, {159, 175}},
   243  				inputMults:  []int{1},
   244  				outputMults: []int{17, 1},
   245  			},
   246  			{
   247  				inputRange:  rangeBounds{{241, 246}},
   248  				outputRange: rangeBounds{{195, 195}, {177, 182}},
   249  				inputMults:  []int{1},
   250  				outputMults: []int{6, 1},
   251  			},
   252  			{
   253  				inputRange:  rangeBounds{{247, 247}},
   254  				outputRange: rangeBounds{{197, 197}, {147, 147}},
   255  				inputMults:  []int{1},
   256  				outputMults: []int{1, 1},
   257  			},
   258  			{
   259  				inputRange:  rangeBounds{{248, 252}},
   260  				outputRange: rangeBounds{{195, 195}, {184, 188}},
   261  				inputMults:  []int{1},
   262  				outputMults: []int{5, 1},
   263  			},
   264  			{
   265  				inputRange:  rangeBounds{{253, 253}},
   266  				outputRange: rangeBounds{{195, 195}, {191, 191}},
   267  				inputMults:  []int{1},
   268  				outputMults: []int{1, 1},
   269  			},
   270  		},
   271  		nil,
   272  		nil,
   273  	},
   274  	toUpper: map[rune]rune{
   275  		97:  65,
   276  		98:  66,
   277  		99:  67,
   278  		100: 68,
   279  		101: 69,
   280  		102: 70,
   281  		103: 71,
   282  		104: 72,
   283  		105: 73,
   284  		106: 74,
   285  		107: 75,
   286  		108: 76,
   287  		109: 77,
   288  		110: 78,
   289  		111: 79,
   290  		112: 80,
   291  		113: 81,
   292  		114: 82,
   293  		115: 83,
   294  		116: 84,
   295  		117: 85,
   296  		118: 86,
   297  		119: 87,
   298  		120: 88,
   299  		121: 89,
   300  		122: 90,
   301  		224: 192,
   302  		225: 193,
   303  		226: 194,
   304  		227: 195,
   305  		228: 196,
   306  		229: 197,
   307  		230: 198,
   308  		231: 199,
   309  		232: 200,
   310  		233: 201,
   311  		234: 202,
   312  		235: 203,
   313  		236: 204,
   314  		237: 205,
   315  		238: 206,
   316  		239: 207,
   317  		241: 209,
   318  		242: 210,
   319  		243: 211,
   320  		244: 212,
   321  		245: 213,
   322  		246: 214,
   323  		248: 216,
   324  		249: 217,
   325  		250: 218,
   326  		251: 219,
   327  		252: 220,
   328  		255: 376,
   329  	},
   330  	toLower: map[rune]rune{
   331  		65:  97,
   332  		66:  98,
   333  		67:  99,
   334  		68:  100,
   335  		69:  101,
   336  		70:  102,
   337  		71:  103,
   338  		72:  104,
   339  		73:  105,
   340  		74:  106,
   341  		75:  107,
   342  		76:  108,
   343  		77:  109,
   344  		78:  110,
   345  		79:  111,
   346  		80:  112,
   347  		81:  113,
   348  		82:  114,
   349  		83:  115,
   350  		84:  116,
   351  		85:  117,
   352  		86:  118,
   353  		87:  119,
   354  		88:  120,
   355  		89:  121,
   356  		90:  122,
   357  		192: 224,
   358  		193: 225,
   359  		194: 226,
   360  		195: 227,
   361  		196: 228,
   362  		197: 229,
   363  		198: 230,
   364  		199: 231,
   365  		200: 232,
   366  		201: 233,
   367  		202: 234,
   368  		203: 235,
   369  		204: 236,
   370  		205: 237,
   371  		206: 238,
   372  		207: 239,
   373  		209: 241,
   374  		210: 242,
   375  		211: 243,
   376  		212: 244,
   377  		213: 245,
   378  		214: 246,
   379  		216: 248,
   380  		217: 249,
   381  		218: 250,
   382  		219: 251,
   383  		220: 252,
   384  		376: 255,
   385  	},
   386  }