Add octal support
This commit is contained in:
@@ -244,9 +244,21 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::string match(start, input_pos);
|
std::string match(start, input_pos);
|
||||||
TokenPtr t(new Token(match, Token_Type::Int, filename, prev_line, prev_col, line, col));
|
if ((match.size() > 0) && (match[0] == '0')) {
|
||||||
match_stack.push_back(t);
|
std::stringstream ss(match);
|
||||||
return true;
|
int temp_int;
|
||||||
|
ss >> std::oct >> temp_int;
|
||||||
|
|
||||||
|
std::ostringstream out_int;
|
||||||
|
out_int << temp_int;
|
||||||
|
TokenPtr t(new Token(out_int.str(), Token_Type::Int, filename, prev_line, prev_col, line, col));
|
||||||
|
match_stack.push_back(t);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TokenPtr t(new Token(match, Token_Type::Int, filename, prev_line, prev_col, line, col));
|
||||||
|
match_stack.push_back(t);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Reference in New Issue
Block a user