# HG changeset patch # User John W. Eaton # Date 1424882019 18000 # Node ID 77f65eabac201738879c599880e458576c2dc734 # Parent 6e2729924601665914ee9bc8c095e50647341b83 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. diff -r 6e2729924601 -r 77f65eabac20 libinterp/parse-tree/lex.ll --- 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); } diff -r 6e2729924601 -r 77f65eabac20 libinterp/parse-tree/token.cc --- 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; diff -r 6e2729924601 -r 77f65eabac20 libinterp/parse-tree/token.h --- 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);