(content []rune)
| 67 | } |
| 68 | |
| 69 | func getCodeIndexList(content []rune) *utils.BitList { |
| 70 | result := new(utils.BitList) |
| 71 | curEncoding := byte(0) |
| 72 | for i := 0; i < len(content); i++ { |
| 73 | if shouldUseCTable(content[i:], curEncoding) { |
| 74 | if curEncoding != startCSymbol { |
| 75 | if curEncoding == byte(0) { |
| 76 | result.AddByte(startCSymbol) |
| 77 | } else { |
| 78 | result.AddByte(codeCSymbol) |
| 79 | } |
| 80 | curEncoding = startCSymbol |
| 81 | } |
| 82 | if content[i] == FNC1 { |
| 83 | result.AddByte(102) |
| 84 | } else { |
| 85 | idx := (content[i] - '0') * 10 |
| 86 | i++ |
| 87 | idx = idx + (content[i] - '0') |
| 88 | result.AddByte(byte(idx)) |
| 89 | } |
| 90 | } else if shouldUseATable(content[i:], curEncoding) { |
| 91 | if curEncoding != startASymbol { |
| 92 | if curEncoding == byte(0) { |
| 93 | result.AddByte(startASymbol) |
| 94 | } else { |
| 95 | result.AddByte(codeASymbol) |
| 96 | } |
| 97 | curEncoding = startASymbol |
| 98 | } |
| 99 | var idx int |
| 100 | switch content[i] { |
| 101 | case FNC1: |
| 102 | idx = 102 |
| 103 | break |
| 104 | case FNC2: |
| 105 | idx = 97 |
| 106 | break |
| 107 | case FNC3: |
| 108 | idx = 96 |
| 109 | break |
| 110 | case FNC4: |
| 111 | idx = 101 |
| 112 | break |
| 113 | default: |
| 114 | idx = strings.IndexRune(aTable, content[i]) |
| 115 | break |
| 116 | } |
| 117 | if idx < 0 { |
| 118 | return nil |
| 119 | } |
| 120 | result.AddByte(byte(idx)) |
| 121 | } else { |
| 122 | if curEncoding != startBSymbol { |
| 123 | if curEncoding == byte(0) { |
| 124 | result.AddByte(startBSymbol) |
| 125 | } else { |
| 126 | result.AddByte(codeBSymbol) |
no test coverage detected