|
|
@@ -610,11 +610,11 @@ static int error_count = 0;
|
|
|
static int warning_count = 0;
|
|
|
|
|
|
// This is the pointer to the current input stream.
|
|
|
-static istream *input_p = NULL;
|
|
|
+static std::istream *input_p = nullptr;
|
|
|
|
|
|
// This is the name of the dc file we're parsing. We keep it so we
|
|
|
// can print it out for error messages.
|
|
|
-static string dc_filename;
|
|
|
+static std::string dc_filename;
|
|
|
|
|
|
// This is the initial token state returned by the lexer. It allows
|
|
|
// the yacc grammar to start from initial points.
|
|
|
@@ -626,7 +626,7 @@ static int initial_token;
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
void
|
|
|
-dc_init_lexer(istream &in, const string &filename) {
|
|
|
+dc_init_lexer(std::istream &in, const std::string &filename) {
|
|
|
input_p = ∈
|
|
|
dc_filename = filename;
|
|
|
line_number = 0;
|
|
|
@@ -671,7 +671,9 @@ dcyywrap(void) {
|
|
|
}
|
|
|
|
|
|
void
|
|
|
-dcyyerror(const string &msg) {
|
|
|
+dcyyerror(const std::string &msg) {
|
|
|
+ using std::cerr;
|
|
|
+
|
|
|
cerr << "\nError";
|
|
|
if (!dc_filename.empty()) {
|
|
|
cerr << " in " << dc_filename;
|
|
|
@@ -686,7 +688,9 @@ dcyyerror(const string &msg) {
|
|
|
}
|
|
|
|
|
|
void
|
|
|
-dcyywarning(const string &msg) {
|
|
|
+dcyywarning(const std::string &msg) {
|
|
|
+ using std::cerr;
|
|
|
+
|
|
|
cerr << "\nWarning";
|
|
|
if (!dc_filename.empty()) {
|
|
|
cerr << " in " << dc_filename;
|
|
|
@@ -740,7 +744,7 @@ input_chars(char *buffer, int &result, int max_size) {
|
|
|
// Define this macro carefully, since different flex versions call it
|
|
|
// with a different type for result.
|
|
|
#define YY_INPUT(buffer, result, max_size) { \
|
|
|
- int int_result; \
|
|
|
+ int int_result = 0; \
|
|
|
input_chars((buffer), int_result, (max_size)); \
|
|
|
(result) = int_result; \
|
|
|
}
|
|
|
@@ -762,9 +766,9 @@ read_char(int &line, int &col) {
|
|
|
|
|
|
// scan_quoted_string reads a string delimited by quotation marks and
|
|
|
// returns it.
|
|
|
-static string
|
|
|
+static std::string
|
|
|
scan_quoted_string(char quote_mark) {
|
|
|
- string result;
|
|
|
+ std::string result;
|
|
|
|
|
|
// We don't touch the current line number and column number during
|
|
|
// scanning, so that if we detect an error while scanning the string
|
|
|
@@ -884,9 +888,9 @@ scan_quoted_string(char quote_mark) {
|
|
|
|
|
|
// scan_hex_string reads a string of hexadecimal digits delimited by
|
|
|
// angle brackets and returns the representative string.
|
|
|
-static string
|
|
|
+static std::string
|
|
|
scan_hex_string() {
|
|
|
- string result;
|
|
|
+ std::string result;
|
|
|
|
|
|
// We don't touch the current line number and column number during
|
|
|
// scanning, so that if we detect an error while scanning the string
|
|
|
@@ -916,7 +920,7 @@ scan_hex_string() {
|
|
|
line_number = line;
|
|
|
col_number = col;
|
|
|
dcyyerror("Invalid hex digit.");
|
|
|
- return string();
|
|
|
+ return std::string();
|
|
|
}
|
|
|
|
|
|
odd = !odd;
|
|
|
@@ -930,10 +934,10 @@ scan_hex_string() {
|
|
|
|
|
|
if (c == EOF) {
|
|
|
dcyyerror("This hex string is unterminated.");
|
|
|
- return string();
|
|
|
+ return std::string();
|
|
|
} else if (odd) {
|
|
|
dcyyerror("Odd number of hex digits.");
|
|
|
- return string();
|
|
|
+ return std::string();
|
|
|
}
|
|
|
|
|
|
line_number = line;
|