src/format.cpp

changeset 137
73d057b030d0
parent 134
eca2fc0acaa2
child 138
a426c1039655
equal deleted inserted replaced
136:1c40bb4f8221 137:73d057b030d0
74 { 74 {
75 mod = fmt[pos + ofs]; 75 mod = fmt[pos + ofs];
76 ofs++; 76 ofs++;
77 } 77 }
78 78
79 if (!isdigit (fmt[pos + ofs])) 79 if (not isdigit (fmt[pos + ofs]))
80 {
80 formatError (fmtstr, "bad format string, expected digit with optional " 81 formatError (fmtstr, "bad format string, expected digit with optional "
81 "modifier after '%%'", pos); 82 "modifier after '%%'", pos);
83 }
82 84
83 int i = fmt[pos + ofs] - '0'; 85 int i = fmt[pos + ofs] - '0';
84 86
85 if (i > static_cast<signed> (args.size())) 87 if (i > static_cast<signed> (args.size()))
86 formatError (fmtstr, String ("Format argument #") + i + " used but not defined.", pos); 88 formatError (fmtstr, String ("Format argument #") + i + " used but not defined.", pos);
106 // Throws a runtime error with the message @msg. If a lexer is active, its 108 // Throws a runtime error with the message @msg. If a lexer is active, its
107 // position is printed as well. 109 // position is printed as well.
108 // 110 //
109 void error (const String& msg) 111 void error (const String& msg)
110 { 112 {
111 Lexer* lx = Lexer::getCurrentLexer(); 113 Lexer* lx = Lexer::GetCurrentLexer();
112 String fileinfo; 114 String fileinfo;
113 115
114 if (lx != null and lx->hasValidToken()) 116 if (lx != null and lx->hasValidToken())
115 { 117 {
116 Lexer::TokenInfo* tk = lx->token(); 118 Lexer::TokenInfo* tk = lx->token();

mercurial