Mercurial > hg > octave-nkf
diff src/lex.l @ 3802:4f1a26a730fd
[project @ 2001-02-26 20:26:14 by jwe]
author | jwe |
---|---|
date | Mon, 26 Feb 2001 20:26:15 +0000 |
parents | c34164f566f6 |
children | 44386b0e53da |
line wrap: on
line diff
--- a/src/lex.l +++ b/src/lex.l @@ -588,7 +588,7 @@ if (begin_comment && (c == '#' || c == '%')) ; /* Skip leading comment characters. */ else - buf += (char) c; + buf += static_cast<char> (c); } octave_comment_buffer::append (buf); @@ -719,9 +719,9 @@ . { current_input_column++; - error ("invalid character `%s' near line %d, column %d", - undo_string_escape (yytext[0]), input_line_number, - current_input_column); + error ("invalid character `%s' (ASCII %d) near line %d, column %d", + undo_string_escape (yytext[0]), static_cast<int> (yytext[0]), + input_line_number, current_input_column); return LEXICAL_ERROR; } @@ -1228,7 +1228,7 @@ if (in_comment) { - help_buf += (char) c; + help_buf += static_cast<char> (c); if (c == '\n') { @@ -1498,7 +1498,7 @@ if (in_comment) { if (! beginning_of_comment) - comment_buf += (char) c; + comment_buf += static_cast<char> (c); } else { @@ -1510,7 +1510,7 @@ case '\n': if (in_comment) { - comment_buf += (char) c; + comment_buf += static_cast<char> (c); octave_comment_buffer::append (comment_buf); comment_buf.resize (0); in_comment = false; @@ -1520,7 +1520,7 @@ case '\r': if (in_comment) - comment_buf += (char) c; + comment_buf += static_cast<char> (c); if (i < len) { c = text[i++]; @@ -1529,7 +1529,7 @@ { if (in_comment) { - comment_buf += (char) c; + comment_buf += static_cast<char> (c); octave_comment_buffer::append (comment_buf); in_comment = false; beginning_of_comment = false; @@ -1540,7 +1540,7 @@ default: if (in_comment) { - comment_buf += (char) c; + comment_buf += static_cast<char> (c); beginning_of_comment = false; } break; @@ -1581,7 +1581,7 @@ case '\t': if (in_comment) { - comment_buf += (char) c; + comment_buf += static_cast<char> (c); beginning_of_comment = false; } retval |= ATE_SPACE_OR_TAB; @@ -1591,7 +1591,7 @@ retval |= ATE_NEWLINE; if (in_comment) { - comment_buf += (char) c; + comment_buf += static_cast<char> (c); octave_comment_buffer::append (comment_buf); comment_buf.resize (0); in_comment = false; @@ -1605,7 +1605,7 @@ if (in_comment) { if (! beginning_of_comment) - comment_buf += (char) c; + comment_buf += static_cast<char> (c); } else { @@ -1617,7 +1617,7 @@ case '.': if (in_comment) { - comment_buf += (char) c; + comment_buf += static_cast<char> (c); beginning_of_comment = false; break; } @@ -1632,7 +1632,7 @@ case '\\': if (in_comment) { - comment_buf += (char) c; + comment_buf += static_cast<char> (c); beginning_of_comment = false; break; } @@ -1647,7 +1647,7 @@ default: if (in_comment) { - comment_buf += (char) c; + comment_buf += static_cast<char> (c); beginning_of_comment = false; break; } @@ -1743,7 +1743,7 @@ while ((c = yyinput ()) != EOF) { - buf << (char) c; + buf << static_cast<char> (c); switch (c) { @@ -1751,7 +1751,7 @@ case '\t': if (in_comment) { - comment_buf += (char) c; + comment_buf += static_cast<char> (c); beginning_of_comment = false; } break; @@ -1763,7 +1763,7 @@ if (in_comment) { if (! beginning_of_comment) - comment_buf += (char) c; + comment_buf += static_cast<char> (c); } else { @@ -1778,7 +1778,7 @@ case '\n': if (in_comment) { - comment_buf += (char) c; + comment_buf += static_cast<char> (c); octave_comment_buffer::append (comment_buf); } current_input_column = 0; @@ -1787,7 +1787,7 @@ case '\r': if (in_comment) - comment_buf += (char) c; + comment_buf += static_cast<char> (c); c = yyinput (); if (c == EOF) break; @@ -1795,7 +1795,7 @@ { if (in_comment) { - comment_buf += (char) c; + comment_buf += static_cast<char> (c); octave_comment_buffer::append (comment_buf); } current_input_column = 0; @@ -1803,10 +1803,12 @@ return true; } + // Fall through... + default: if (in_comment) { - comment_buf += (char) c; + comment_buf += static_cast<char> (c); beginning_of_comment = false; } else @@ -1894,7 +1896,7 @@ { if (escape_pending) { - buf << (char) c; + buf << static_cast<char> (c); escape_pending = 0; } else @@ -1903,7 +1905,7 @@ escape_pending = 0; else { - buf << (char) c; + buf << static_cast<char> (c); escape_pending = 1; } } @@ -1912,7 +1914,7 @@ else if (c == '.') { if (! have_ellipsis_continuation (false)) - buf << (char) c; + buf << static_cast<char> (c); } else if (c == '\n') { @@ -1922,12 +1924,12 @@ else if (c == delim) { if (escape_pending) - buf << (char) c; + buf << static_cast<char> (c); else { c = yyinput (); if (c == delim) - buf << (char) c; + buf << static_cast<char> (c); else { unput (c); @@ -1959,7 +1961,7 @@ } else { - buf << (char) c; + buf << static_cast<char> (c); } escape_pending = 0; @@ -2348,18 +2350,7 @@ case ',': if (in_comment) { - comment_buf += (char) c; - beginning_of_comment = false; - } - break; - - case '\n': - if (in_comment) - { - comment_buf += (char) c; - octave_comment_buffer::append (comment_buf); - comment_buf.resize (0); - in_comment = false; + comment_buf += static_cast<char> (c); beginning_of_comment = false; } break; @@ -2369,7 +2360,7 @@ if (in_comment) { if (! beginning_of_comment) - comment_buf += (char) c; + comment_buf += static_cast<char> (c); } else { @@ -2378,10 +2369,42 @@ } break; + case '\n': + if (in_comment) + { + comment_buf += static_cast<char> (c); + octave_comment_buffer::append (comment_buf); + comment_buf.resize (0); + in_comment = false; + beginning_of_comment = false; + } + break; + + case '\r': + if (in_comment) + comment_buf += static_cast<char> (c); + c = yyinput (); + if (c == EOF) + break; + else if (c == '\n') + { + if (in_comment) + { + comment_buf += static_cast<char> (c); + octave_comment_buffer::append (comment_buf); + comment_buf.resize (0); + in_comment = false; + beginning_of_comment = false; + } + break; + } + + // Fall through... + default: if (in_comment) { - comment_buf += (char) c; + comment_buf += static_cast<char> (c); beginning_of_comment = false; break; }