Cleaned up << operator for the DebugInfo class.

This commit is contained in:
Gunnar Beutner 2012-07-08 23:23:48 +02:00
parent c80d84f61e
commit 0b730a8f6e
3 changed files with 32 additions and 43 deletions

View File

@ -213,13 +213,7 @@ int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner);
void yyerror(YYLTYPE *locp, ConfigCompiler *context, const char *err) void yyerror(YYLTYPE *locp, ConfigCompiler *context, const char *err)
{ {
stringstream message; stringstream message;
message << *locp;
message << "in " << locp->Path << ": "
<< locp->FirstLine << ":" << locp->FirstColumn
<< "-"
<< locp->LastLine << ":" << locp->LastColumn
<< ": " << err << endl;
throw runtime_error(message.str()); throw runtime_error(message.str());
} }
@ -241,7 +235,7 @@ void ConfigCompiler::Compile(void)
/* Line 264 of yacc.c */ /* Line 264 of yacc.c */
#line 245 "config_parser.cc" #line 239 "config_parser.cc"
#ifdef short #ifdef short
# undef short # undef short
@ -541,11 +535,11 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] = static const yytype_uint16 yyrline[] =
{ {
0, 101, 101, 102, 105, 105, 108, 114, 119, 114, 0, 95, 95, 96, 99, 99, 102, 108, 113, 108,
139, 140, 143, 147, 153, 154, 157, 164, 165, 169, 133, 134, 137, 141, 147, 148, 151, 158, 159, 163,
168, 180, 181, 183, 184, 185, 188, 196, 210, 219, 162, 174, 175, 177, 178, 179, 182, 190, 204, 213,
220, 221, 222, 223, 229, 234, 238, 244, 245, 246, 214, 215, 216, 217, 223, 228, 232, 238, 239, 240,
253, 252, 264, 270, 271, 273, 275, 276 247, 246, 258, 264, 265, 267, 269, 270
}; };
#endif #endif
@ -1529,7 +1523,7 @@ yyreduce:
case 6: case 6:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 109 "config_parser.yy" #line 103 "config_parser.yy"
{ {
context->HandleInclude((yyvsp[(2) - (2)].text)); context->HandleInclude((yyvsp[(2) - (2)].text));
} }
@ -1538,7 +1532,7 @@ yyreduce:
case 7: case 7:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 114 "config_parser.yy" #line 108 "config_parser.yy"
{ {
m_Abstract = false; m_Abstract = false;
m_Local = false; m_Local = false;
@ -1548,7 +1542,7 @@ yyreduce:
case 8: case 8:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 119 "config_parser.yy" #line 113 "config_parser.yy"
{ {
m_Item = boost::make_shared<ConfigItemBuilder>(yylloc); m_Item = boost::make_shared<ConfigItemBuilder>(yylloc);
m_Item->SetType((yyvsp[(4) - (5)].text)); m_Item->SetType((yyvsp[(4) - (5)].text));
@ -1559,7 +1553,7 @@ yyreduce:
case 9: case 9:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 125 "config_parser.yy" #line 119 "config_parser.yy"
{ {
Object::Ptr exprl_object = *(yyvsp[(8) - (8)].variant); Object::Ptr exprl_object = *(yyvsp[(8) - (8)].variant);
delete (yyvsp[(8) - (8)].variant); delete (yyvsp[(8) - (8)].variant);
@ -1577,7 +1571,7 @@ yyreduce:
case 12: case 12:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 144 "config_parser.yy" #line 138 "config_parser.yy"
{ {
m_Abstract = true; m_Abstract = true;
} }
@ -1586,7 +1580,7 @@ yyreduce:
case 13: case 13:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 148 "config_parser.yy" #line 142 "config_parser.yy"
{ {
m_Local = true; m_Local = true;
} }
@ -1595,7 +1589,7 @@ yyreduce:
case 16: case 16:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 158 "config_parser.yy" #line 152 "config_parser.yy"
{ {
m_Item->AddParent((yyvsp[(1) - (1)].text)); m_Item->AddParent((yyvsp[(1) - (1)].text));
free((yyvsp[(1) - (1)].text)); free((yyvsp[(1) - (1)].text));
@ -1605,7 +1599,7 @@ yyreduce:
case 19: case 19:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 169 "config_parser.yy" #line 163 "config_parser.yy"
{ {
m_ExpressionLists.push(boost::make_shared<ExpressionList>()); m_ExpressionLists.push(boost::make_shared<ExpressionList>());
} }
@ -1614,7 +1608,7 @@ yyreduce:
case 20: case 20:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 174 "config_parser.yy" #line 168 "config_parser.yy"
{ {
(yyval.variant) = new Variant(m_ExpressionLists.top()); (yyval.variant) = new Variant(m_ExpressionLists.top());
m_ExpressionLists.pop(); m_ExpressionLists.pop();
@ -1624,7 +1618,7 @@ yyreduce:
case 26: case 26:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 189 "config_parser.yy" #line 183 "config_parser.yy"
{ {
Expression expr((yyvsp[(1) - (3)].text), (yyvsp[(2) - (3)].op), *(yyvsp[(3) - (3)].variant), yylloc); Expression expr((yyvsp[(1) - (3)].text), (yyvsp[(2) - (3)].op), *(yyvsp[(3) - (3)].variant), yylloc);
free((yyvsp[(1) - (3)].text)); free((yyvsp[(1) - (3)].text));
@ -1637,7 +1631,7 @@ yyreduce:
case 27: case 27:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 197 "config_parser.yy" #line 191 "config_parser.yy"
{ {
Expression subexpr((yyvsp[(3) - (6)].text), (yyvsp[(5) - (6)].op), *(yyvsp[(6) - (6)].variant), yylloc); Expression subexpr((yyvsp[(3) - (6)].text), (yyvsp[(5) - (6)].op), *(yyvsp[(6) - (6)].variant), yylloc);
free((yyvsp[(3) - (6)].text)); free((yyvsp[(3) - (6)].text));
@ -1656,7 +1650,7 @@ yyreduce:
case 28: case 28:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 211 "config_parser.yy" #line 205 "config_parser.yy"
{ {
Expression expr((yyvsp[(1) - (1)].text), OperatorSet, (yyvsp[(1) - (1)].text), yylloc); Expression expr((yyvsp[(1) - (1)].text), OperatorSet, (yyvsp[(1) - (1)].text), yylloc);
free((yyvsp[(1) - (1)].text)); free((yyvsp[(1) - (1)].text));
@ -1668,7 +1662,7 @@ yyreduce:
case 33: case 33:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 224 "config_parser.yy" #line 218 "config_parser.yy"
{ {
(yyval.op) = (yyvsp[(1) - (1)].op); (yyval.op) = (yyvsp[(1) - (1)].op);
} }
@ -1677,7 +1671,7 @@ yyreduce:
case 34: case 34:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 230 "config_parser.yy" #line 224 "config_parser.yy"
{ {
(yyval.variant) = new Variant((yyvsp[(1) - (1)].text)); (yyval.variant) = new Variant((yyvsp[(1) - (1)].text));
free((yyvsp[(1) - (1)].text)); free((yyvsp[(1) - (1)].text));
@ -1687,7 +1681,7 @@ yyreduce:
case 35: case 35:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 235 "config_parser.yy" #line 229 "config_parser.yy"
{ {
(yyval.variant) = new Variant((yyvsp[(1) - (1)].num)); (yyval.variant) = new Variant((yyvsp[(1) - (1)].num));
} }
@ -1696,7 +1690,7 @@ yyreduce:
case 36: case 36:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 239 "config_parser.yy" #line 233 "config_parser.yy"
{ {
(yyval.variant) = new Variant(); (yyval.variant) = new Variant();
} }
@ -1705,7 +1699,7 @@ yyreduce:
case 39: case 39:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 247 "config_parser.yy" #line 241 "config_parser.yy"
{ {
(yyval.variant) = (yyvsp[(1) - (1)].variant); (yyval.variant) = (yyvsp[(1) - (1)].variant);
} }
@ -1714,7 +1708,7 @@ yyreduce:
case 40: case 40:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 253 "config_parser.yy" #line 247 "config_parser.yy"
{ {
m_Array = boost::make_shared<Dictionary>(); m_Array = boost::make_shared<Dictionary>();
} }
@ -1723,7 +1717,7 @@ yyreduce:
case 41: case 41:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 258 "config_parser.yy" #line 252 "config_parser.yy"
{ {
(yyval.variant) = new Variant(m_Array); (yyval.variant) = new Variant(m_Array);
m_Array.reset(); m_Array.reset();
@ -1733,7 +1727,7 @@ yyreduce:
case 42: case 42:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 265 "config_parser.yy" #line 259 "config_parser.yy"
{ {
m_Array->AddUnnamedProperty(*(yyvsp[(1) - (1)].variant)); m_Array->AddUnnamedProperty(*(yyvsp[(1) - (1)].variant));
delete (yyvsp[(1) - (1)].variant); delete (yyvsp[(1) - (1)].variant);
@ -1743,7 +1737,7 @@ yyreduce:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 1747 "config_parser.cc" #line 1741 "config_parser.cc"
default: break; default: break;
} }
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@ -1962,6 +1956,6 @@ yyreturn:
/* Line 1675 of yacc.c */ /* Line 1675 of yacc.c */
#line 278 "config_parser.yy" #line 272 "config_parser.yy"

View File

@ -70,13 +70,7 @@ int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner);
void yyerror(YYLTYPE *locp, ConfigCompiler *context, const char *err) void yyerror(YYLTYPE *locp, ConfigCompiler *context, const char *err)
{ {
stringstream message; stringstream message;
message << *locp;
message << "in " << locp->Path << ": "
<< locp->FirstLine << ":" << locp->FirstColumn
<< "-"
<< locp->LastLine << ":" << locp->LastColumn
<< ": " << err << endl;
throw runtime_error(message.str()); throw runtime_error(message.str());
} }

View File

@ -54,7 +54,8 @@ struct DebugInfo
inline ostream& operator<<(ostream& out, const DebugInfo& val) inline ostream& operator<<(ostream& out, const DebugInfo& val)
{ {
out << val.FirstLine << ":" << val.FirstColumn out << "in " << val.Path << ": "
<< val.FirstLine << ":" << val.FirstColumn
<< "-" << "-"
<< val.LastLine << ":" << val.LastColumn; << val.LastLine << ":" << val.LastColumn;