changeset 28522:a5541f5a78dd

make parsing of spmd and endspmd keywords work properly (bug #58676) * lex.ll (base_lexer::make_keyword_token): Enable lines left commented out in changeset 6e8a9845d118. Now the spmd and endspmd keywords will be recognized properly and return the correct tokens. * oct-parse.yy (base_parser::make_spmd_command): Fix copy/paste error from changeset b8ab8b58547d so that END token checking will work properly.
author John W. Eaton <jwe@octave.org>
date Wed, 01 Jul 2020 13:18:19 -0400
parents 23a33db2bdb3
children 68000a4df5a8
files libinterp/parse-tree/lex.ll libinterp/parse-tree/oct-parse.yy
diffstat 2 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll	Wed Jul 01 16:04:22 2020 +0900
+++ b/libinterp/parse-tree/lex.ll	Wed Jul 01 13:18:19 2020 -0400
@@ -2843,18 +2843,13 @@
           }
         break;
 
-      /* Unimplementd 'spmd' keyword for Matlab compatibility only.
-         FIXME: Allow spmd statement, but treat as no-op, bug #58676. */
       case spmd_kw:
-        /* m_at_beginning_of_statement = true; */
+        m_at_beginning_of_statement = true;
         break;
 
       case endspmd_kw:
-        /*
-        tok_val = new token (endspmd_kw, token::spmd_end, m_tok_beg,
-                             m_tok_end);
+        tok_val = new token (endspmd_kw, token::spmd_end, m_tok_beg, m_tok_end);
         m_at_beginning_of_statement = true;
-        */
         break;
 
       case magic_file_kw:
--- a/libinterp/parse-tree/oct-parse.yy	Wed Jul 01 16:04:22 2020 +0900
+++ b/libinterp/parse-tree/oct-parse.yy	Wed Jul 01 13:18:19 2020 -0400
@@ -3253,7 +3253,7 @@
   {
     tree_spmd_command *retval = nullptr;
 
-    if (end_token_ok (end_tok, token::if_end))
+    if (end_token_ok (end_tok, token::spmd_end))
       {
         int l = spmd_tok->line ();
         int c = spmd_tok->column ();