Mercurial > octave
changeset 26899:236d8f52cbb3
identify "x .foo@bar" or "x @foo" as command syntax (bug #55891)
* lex.ll ({FQIDENT}{S}*@{S}*{FQIDENT}): If we are at the beginning of
a statement and there is a space before the first "." or "@"
character, parse as a normal identifier, which will lead to parsing as
a command. Also set m_beginning_of_statement to false if a superclass
identifier is found.
* debug.cc: Use command syntax for dbstop commands with @ftp/dir and
@audioplayer/set again as it provides a test for this form of command
syntax.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 13 Mar 2019 18:54:11 +0000 |
parents | d94876e7a0aa |
children | ebe7e12765ba |
files | libinterp/corefcn/debug.cc libinterp/parse-tree/lex.ll |
diffstat | 2 files changed, 21 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/debug.cc Wed Mar 13 08:03:10 2019 +0100 +++ b/libinterp/corefcn/debug.cc Wed Mar 13 18:54:11 2019 +0000 @@ -529,8 +529,8 @@ %! endif %! unwind_protect %! dbclear all; # Clear out breakpoints before test -%! dbstop ("@ftp/dir"); -%! dbstop ("@audioplayer/set", "70"); +%! dbstop @ftp/dir; +%! dbstop @audioplayer/set 70; %! dbstop quantile>__quantile__; %! dbstop ls; %! s = dbstatus;
--- a/libinterp/parse-tree/lex.ll Wed Mar 13 08:03:10 2019 +0100 +++ b/libinterp/parse-tree/lex.ll Wed Mar 13 18:54:11 2019 +0000 @@ -1269,11 +1269,30 @@ } else { + if (curr_lexer->m_at_beginning_of_statement) + { + std::string txt = yytext; + + size_t at_or_dot_pos = txt.find_first_of ("@."); + + if (at_or_dot_pos != std::string::npos) + { + size_t spc_pos = txt.find_first_of (" \t"); + + if (spc_pos != std::string::npos && spc_pos < at_or_dot_pos) + { + yyless (spc_pos); + return curr_lexer->handle_identifier (); + } + } + } + int id_tok = curr_lexer->handle_superclass_identifier (); if (id_tok >= 0) { curr_lexer->m_looking_for_object_index = true; + curr_lexer->m_at_beginning_of_statement = false; return curr_lexer->count_token_internal (id_tok); }