Mercurial > hg > octave-lojdl
changeset 7699:27a5f578750c
make_constant: handle escape sequences in dq-strings
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 04 Apr 2008 15:57:31 -0400 |
parents | 4584feed3ec4 |
children | efccca5f2ad7 |
files | src/ChangeLog src/parse.y |
diffstat | 2 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2008-04-04 John W. Eaton <jwe@octave.org> + + * parse.y (make_constant): Handle escape sequences in dq-strings. + 2008-04-03 John W. Eaton <jwe@octave.org> * parse.y (make_constant): Also stash original text for strings.
--- a/src/parse.y +++ b/src/parse.y @@ -1697,12 +1697,19 @@ case DQ_STRING: case SQ_STRING: { + std::string txt = tok_val->text (); + char delim = op == DQ_STRING ? '"' : '\''; - octave_value tmp (tok_val->text (), delim); + + octave_value tmp (txt, delim); retval = new tree_constant (tmp, l, c); + + if (op == DQ_STRING) + txt = undo_string_escapes (txt); + // FIXME -- maybe this should also be handled by // tok_val->text_rep () for character strings? - retval->stash_original_text (delim + tok_val->text () + delim); + retval->stash_original_text (delim + txt + delim); } break;