()
| 261 | } |
| 262 | |
| 263 | private void parseHeader() throws PoParserException { |
| 264 | if (!mMsgId.equals("")) { |
| 265 | throw new PoParserException(mLineNumber + 1, "Missing header"); |
| 266 | } |
| 267 | String header = mMsgStr.get(0); |
| 268 | Matcher matcher = HEADER_PATTERN.matcher(header); |
| 269 | if (!matcher.find()) { |
| 270 | throw new PoParserException( |
| 271 | mLineNumber + 1, "Can't find plural definition in header:\n" + header); |
| 272 | } |
| 273 | mPluralCount = Integer.parseInt(matcher.group(1)); |
| 274 | // Simplify expressionString: remove spaces and surrounding parenthesis |
| 275 | String expressionString = matcher.group(2).replace(" ", ""); |
| 276 | if (expressionString.startsWith("(") && expressionString.endsWith(")")) { |
| 277 | expressionString = expressionString.substring(1, expressionString.length() - 1); |
| 278 | } |
| 279 | Messages.PluralExpression expression = sPluralExpressionByString.get(expressionString); |
| 280 | if (expression == null) { |
| 281 | throw new PoParserException( |
| 282 | mLineNumber + 1, "Unknown plural expression: " + expressionString); |
| 283 | } |
| 284 | mMessages = new Messages(expression); |
| 285 | } |
| 286 | |
| 287 | // Internal function to be able to early returns and still get the clean of member vars |
| 288 | // in addCurrentEntry() |
no test coverage detected