(name)
| 1237 | } |
| 1238 | |
| 1239 | parseProperty(name) { |
| 1240 | this.skipWhitespace(); |
| 1241 | |
| 1242 | if (this.pos >= this.length) { |
| 1243 | throw new Error(`Unexpected end of input while parsing property '${name}' at position ${this.pos}`); |
| 1244 | } |
| 1245 | |
| 1246 | const property = { |
| 1247 | name: name, |
| 1248 | value: null |
| 1249 | }; |
| 1250 | |
| 1251 | if (this.content.charCodeAt(this.pos) === EQUALS) { |
| 1252 | this.pos++; |
| 1253 | this.skipWhitespace(); |
| 1254 | |
| 1255 | if (this.pos >= this.length) { |
| 1256 | throw new Error(`Unexpected end of input after '=' for property '${name}' at position ${this.pos}`); |
| 1257 | } |
| 1258 | |
| 1259 | try { |
| 1260 | property.value = this.parseValue(); |
| 1261 | } catch (error) { |
| 1262 | throw new Error(`Failed to parse value for property '${name}': ${error.message}`); |
| 1263 | } |
| 1264 | } |
| 1265 | |
| 1266 | // Skip to semicolon |
| 1267 | while (this.pos < this.length && this.content.charCodeAt(this.pos) !== SEMICOLON) { |
| 1268 | this.pos++; |
| 1269 | } |
| 1270 | |
| 1271 | if (this.pos >= this.length) { |
| 1272 | throw new Error(`Missing semicolon for property '${name}' - unexpected end of input at position ${this.pos}`); |
| 1273 | } |
| 1274 | |
| 1275 | this.pos++; // consume semicolon |
| 1276 | return property; |
| 1277 | } |
| 1278 | |
| 1279 | parseValue() { |
| 1280 | this.skipWhitespace(); |
no test coverage detected