src/parser.cpp

changeset 206
654661eab7f3
parent 201
5d201ee4a9c3
child 242
16855456992d
equal deleted inserted replaced
205:1a4342d80de7 206:654661eab7f3
191 } 191 }
192 bool ok_code; 192 bool ok_code;
193 const int code = tokens[0].toInt(&ok_code); 193 const int code = tokens[0].toInt(&ok_code);
194 if (not ok_code) 194 if (not ok_code)
195 { 195 {
196 throw BodyParseError{"line type was not an integer"}; 196 throw BodyParseError{QObject::tr("line type was not an integer")};
197 } 197 }
198 switch (code) 198 switch (code)
199 { 199 {
200 case 0: 200 case 0:
201 return parseType0Line(line); 201 return parseType0Line(line);
223 const auto pair = parsePolygon<4>(tokens); 223 const auto pair = parsePolygon<4>(tokens);
224 const ConditionalEdge cedge{pair.first[0], pair.first[1], pair.first[2], pair.first[3]}; 224 const ConditionalEdge cedge{pair.first[0], pair.first[1], pair.first[2], pair.first[3]};
225 return Colored<ConditionalEdge>{cedge, pair.second}; 225 return Colored<ConditionalEdge>{cedge, pair.second};
226 } 226 }
227 default: 227 default:
228 throw BodyParseError{format("bad line type '%1'", code)}; 228 throw BodyParseError{QObject::tr("bad line type '%1'").arg(code)};
229 } 229 }
230 } 230 }
231 catch(const BodyParseError& error) 231 catch(const BodyParseError& error)
232 { 232 {
233 return ParseError{line}; 233 return ParseError{line};

mercurial