Mercurial > hg > octave-nkf
changeset 11739:5d011c1f68fd release-3-0-x
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 | 5dc5de967ab0 |
children | 72830070a17b |
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 @@ -1734,12 +1734,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;