(Map map)
| 102 | } |
| 103 | |
| 104 | void parse(Map map) |
| 105 | throws IOException |
| 106 | { |
| 107 | boolean escaped = false; |
| 108 | |
| 109 | int c; |
| 110 | while ((c = readCharacter()) != -1) { |
| 111 | if (c == '\\') { |
| 112 | if (escaped) { |
| 113 | escaped = false; |
| 114 | append(c); |
| 115 | } else { |
| 116 | escaped = true; |
| 117 | } |
| 118 | } else { |
| 119 | switch (c) { |
| 120 | case '#': |
| 121 | case '!': |
| 122 | if (key == null) { |
| 123 | while ((c = readCharacter()) != -1 && c != '\n'); |
| 124 | } else { |
| 125 | append(c); |
| 126 | } |
| 127 | break; |
| 128 | |
| 129 | case ' ': |
| 130 | case '\r': |
| 131 | case '\t': |
| 132 | if (escaped || (current != null && value == current)) { |
| 133 | append(c); |
| 134 | } else if (key == current) { |
| 135 | current = null; |
| 136 | } |
| 137 | break; |
| 138 | |
| 139 | case ':': |
| 140 | case '=': |
| 141 | if (escaped || (current != null && value == current)) { |
| 142 | append(c); |
| 143 | } else { |
| 144 | if (key == null) { |
| 145 | key = new StringBuilder(); |
| 146 | } |
| 147 | current = null; |
| 148 | } |
| 149 | break; |
| 150 | |
| 151 | case '\n': |
| 152 | if (escaped) { |
| 153 | append(c); |
| 154 | } else { |
| 155 | finishLine(map); |
| 156 | } |
| 157 | break; |
| 158 | case 'n': |
| 159 | if (escaped) { |
| 160 | append('\n'); |
| 161 | } else { |
no test coverage detected