Mercurial > hg > octave-nkf
diff src/token.cc @ 1755:3a9462b655f1
[project @ 1996-01-22 04:47:22 by jwe]
author | jwe |
---|---|
date | Mon, 22 Jan 1996 04:47:22 +0000 |
parents | 89c587478067 |
children | e62277bf5fe0 |
line wrap: on
line diff
--- a/src/token.cc +++ b/src/token.cc @@ -41,25 +41,22 @@ line_num = l; column_num = c; type_tag = generic_token; - orig_text = 0; } -token::token (char *s, int l, int c) +token::token (const string& s, int l, int c) { line_num = l; column_num = c; type_tag = string_token; - str = strsave (s); - orig_text = 0; + str = new string (s); } -token::token (double d, char * /* s */, int l, int c) +token::token (double d, const string& /* s */, int l, int c) { line_num = l; column_num = c; type_tag = double_token; num = d; - orig_text = 0; // strsave (s); } token::token (end_tok_type t, int l, int c) @@ -68,7 +65,6 @@ column_num = c; type_tag = ettype_token; et = t; - orig_text = 0; } token::token (plot_tok_type t, int l, int c) @@ -77,7 +73,6 @@ column_num = c; type_tag = pttype_token; pt = t; - orig_text = 0; } token::token (symbol_record *s, int l, int c) @@ -86,33 +81,19 @@ column_num = c; type_tag = sym_rec_token; sr = s; - orig_text = 0; } token::~token (void) { if (type_tag == string_token) - delete [] str; - delete [] orig_text; -} - -int -token::line (void) -{ - return line_num; + delete str; } -int -token::column (void) -{ - return column_num; -} - -char * -token::string (void) +string +token::text (void) { assert (type_tag == string_token); - return str; + return *str; } double @@ -143,7 +124,7 @@ return sr; } -char * +string token::text_rep (void) { return orig_text;