Mercurial > octave-nkf
changeset 19892:77f65eabac20 stable
avoid crash when __FILE__ is used at top level (bug #44363)
* lex.ll (octave_base_lexer::is_keyword_token): Call correct
constructor for magic_file_kw.
* token.h, token.cc (token::token (int, const char *, int, int)):
New constructor.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 25 Feb 2015 11:33:39 -0500 |
parents | 6e2729924601 |
children | 734a77207e2e bcf0a288aa6c |
files | libinterp/parse-tree/lex.ll libinterp/parse-tree/token.cc libinterp/parse-tree/token.h |
diffstat | 3 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll Fri Feb 06 08:31:09 2015 -0800 +++ b/libinterp/parse-tree/lex.ll Wed Feb 25 11:33:39 2015 -0500 @@ -2453,8 +2453,7 @@ if ((reading_fcn_file || reading_script_file || reading_classdef_file) && ! fcn_file_full_name.empty ()) - tok_val = new token (magic_file_kw, true, - fcn_file_full_name, l, c); + tok_val = new token (magic_file_kw, fcn_file_full_name, l, c); else tok_val = new token (magic_file_kw, "stdin", l, c); }
--- a/libinterp/parse-tree/token.cc Fri Feb 06 08:31:09 2015 -0800 +++ b/libinterp/parse-tree/token.cc Wed Feb 25 11:33:39 2015 -0500 @@ -52,6 +52,17 @@ type_tag = is_kw ? keyword_token : generic_token; } +token::token (int tv, const char *s, int l, int c) +{ + maybe_cmd = false; + tspc = false; + line_num = l; + column_num = c; + tok_val = tv; + type_tag = string_token; + str = new std::string (s); +} + token::token (int tv, const std::string& s, int l, int c) { maybe_cmd = false;
--- a/libinterp/parse-tree/token.h Fri Feb 06 08:31:09 2015 -0800 +++ b/libinterp/parse-tree/token.h Wed Feb 25 11:33:39 2015 -0500 @@ -64,6 +64,7 @@ token (int tv, int l = -1, int c = -1); token (int tv, bool is_keyword, int l = -1, int c = -1); + token (int tv, const char *s, int l = -1, int c = -1); token (int tv, const std::string& s, int l = -1, int c = -1); token (int tv, double d, const std::string& s = std::string (), int l = -1, int c = -1);