annotate libinterp/parse-tree/octave.gperf @ 28517:6e8a9845d118

Add 'spmd' as interpreter keyword for Matlab compatibility (bug #58676). * op-kw-docs: Document 'spmd', 'endspmd' keywords. * lex.ll (base_lexer::make_keyword_token): Add case statements for 'spmd', 'endspmd'. Code is not correct, but something is required to prevent segfault. * oct-parse.yy: Add SPMD token type. * oct-parse.yy (end_token_as_string): Add case statement for 'endspmd'. * octave.gperf: Add endspmd_kw, spmd_kw to enum octave_kw_id. Add declarations to octave_kw struct for endspmd, spmd. * token.h: Add spmd_end to enm end_tok_type.
author Rik <rik@octave.org>
date Tue, 30 Jun 2020 09:34:14 -0700
parents bd51beb6205e
children dc8de424fc72
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
1 %{
7019
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6547
diff changeset
2
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
3 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // Copyright (C) 1995-2020 The Octave Project Developers
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
25 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
26 // NOTE: gperf 2.7.2 will silently generate bad code if there are blank
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
27 // lines following the "%{" marker above. This comment block seems to be
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
28 // handled correctly.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
29 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
30 ////////////////////////////////////////////////////////////////////////
7019
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6547
diff changeset
31
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
32 enum octave_kw_id
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
33 {
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
34 break_kw,
2764
2c0f259cf83d [project @ 1997-03-01 02:30:26 by jwe]
jwe
parents: 1496
diff changeset
35 case_kw,
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
36 catch_kw,
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
37 classdef_kw,
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
38 continue_kw,
3484
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 3174
diff changeset
39 do_kw,
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
40 else_kw,
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
41 elseif_kw,
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
42 end_kw,
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
43 end_try_catch_kw,
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
44 end_unwind_protect_kw,
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
45 endclassdef_kw,
13249
7861a5fd3479 accept enumeration keyword
John W. Eaton <jwe@octave.org>
parents: 13246
diff changeset
46 endenumeration_kw,
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
47 endevents_kw,
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
48 endfor_kw,
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
49 endfunction_kw,
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
50 endif_kw,
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
51 endmethods_kw,
13246
0c69a564f2be additional parfor changes
John W. Eaton <jwe@octave.org>
parents: 13245
diff changeset
52 endparfor_kw,
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
53 endproperties_kw,
28517
6e8a9845d118 Add 'spmd' as interpreter keyword for Matlab compatibility (bug #58676).
Rik <rik@octave.org>
parents: 27923
diff changeset
54 endspmd_kw,
2764
2c0f259cf83d [project @ 1997-03-01 02:30:26 by jwe]
jwe
parents: 1496
diff changeset
55 endswitch_kw,
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
56 endwhile_kw,
13249
7861a5fd3479 accept enumeration keyword
John W. Eaton <jwe@octave.org>
parents: 13246
diff changeset
57 enumeration_kw,
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
58 events_kw,
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
59 for_kw,
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
60 function_kw,
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
61 get_kw,
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
62 global_kw,
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
63 if_kw,
3174
390d5e396682 [project @ 1998-05-04 16:36:17 by jwe]
jwe
parents: 2846
diff changeset
64 magic_file_kw,
390d5e396682 [project @ 1998-05-04 16:36:17 by jwe]
jwe
parents: 2846
diff changeset
65 magic_line_kw,
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
66 methods_kw,
2764
2c0f259cf83d [project @ 1997-03-01 02:30:26 by jwe]
jwe
parents: 1496
diff changeset
67 otherwise_kw,
13245
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
68 parfor_kw,
14294
9e3983c8963c deprecate the static keyword
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
69 persistent_kw,
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
70 properties_kw,
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
71 return_kw,
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
72 set_kw,
28517
6e8a9845d118 Add 'spmd' as interpreter keyword for Matlab compatibility (bug #58676).
Rik <rik@octave.org>
parents: 27923
diff changeset
73 spmd_kw,
2764
2c0f259cf83d [project @ 1997-03-01 02:30:26 by jwe]
jwe
parents: 1496
diff changeset
74 switch_kw,
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
75 try_kw,
3484
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 3174
diff changeset
76 until_kw,
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
77 unwind_protect_kw,
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
78 unwind_protect_cleanup_kw,
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
79 while_kw
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
80 };
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
81
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
82 %}
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
83
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2764
diff changeset
84 struct octave_kw { const char *name; int tok; octave_kw_id kw_id; };
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
85
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
86 %%
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
87 break, BREAK, break_kw
2764
2c0f259cf83d [project @ 1997-03-01 02:30:26 by jwe]
jwe
parents: 1496
diff changeset
88 case, CASE, case_kw
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
89 catch, CATCH, catch_kw
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
90 classdef, CLASSDEF, classdef_kw
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
91 continue, CONTINUE, continue_kw
3484
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 3174
diff changeset
92 do, DO, do_kw
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
93 else, ELSE, else_kw
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
94 elseif, ELSEIF, elseif_kw
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
95 end, END, end_kw
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
96 end_try_catch, END, end_try_catch_kw
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
97 end_unwind_protect, END, end_unwind_protect_kw
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
98 endclassdef, END, endclassdef_kw
13249
7861a5fd3479 accept enumeration keyword
John W. Eaton <jwe@octave.org>
parents: 13246
diff changeset
99 endenumeration, END, endenumeration_kw
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
100 endevents, END, endevents_kw
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
101 endfor, END, endfor_kw
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
102 endfunction, END, endfunction_kw
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
103 endif, END, endif_kw
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
104 endmethods, END, endmethods_kw
13246
0c69a564f2be additional parfor changes
John W. Eaton <jwe@octave.org>
parents: 13245
diff changeset
105 endparfor, END, endparfor_kw
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
106 endproperties, END, endproperties_kw
28517
6e8a9845d118 Add 'spmd' as interpreter keyword for Matlab compatibility (bug #58676).
Rik <rik@octave.org>
parents: 27923
diff changeset
107 endspmd, END, endspmd_kw
2764
2c0f259cf83d [project @ 1997-03-01 02:30:26 by jwe]
jwe
parents: 1496
diff changeset
108 endswitch, END, endswitch_kw
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
109 endwhile, END, endwhile_kw
13249
7861a5fd3479 accept enumeration keyword
John W. Eaton <jwe@octave.org>
parents: 13246
diff changeset
110 enumeration, ENUMERATION, enumeration_kw
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
111 events, EVENTS, events_kw
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
112 for, FOR, for_kw
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
113 function, FCN, function_kw
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
114 get, GET, get_kw
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
115 global, GLOBAL, global_kw
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
116 if, IF, if_kw
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
117 methods, METHODS, methods_kw
2764
2c0f259cf83d [project @ 1997-03-01 02:30:26 by jwe]
jwe
parents: 1496
diff changeset
118 otherwise, OTHERWISE, otherwise_kw
13245
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
119 parfor, PARFOR, parfor_kw
14294
9e3983c8963c deprecate the static keyword
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
120 persistent, PERSISTENT, persistent_kw
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
121 properties, PROPERTIES, properties_kw
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
122 return, FUNC_RET, return_kw
9476
d9b25c5b8ee5 handle classdef syntax in lexer and parser
Ryan Rusaw
parents: 8775
diff changeset
123 set, SET, set_kw
28517
6e8a9845d118 Add 'spmd' as interpreter keyword for Matlab compatibility (bug #58676).
Rik <rik@octave.org>
parents: 27923
diff changeset
124 spmd, SPMD, spmd_kw
2764
2c0f259cf83d [project @ 1997-03-01 02:30:26 by jwe]
jwe
parents: 1496
diff changeset
125 switch, SWITCH, switch_kw
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
126 try, TRY, try_kw
3484
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 3174
diff changeset
127 until, UNTIL, until_kw
1496
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
128 unwind_protect, UNWIND, unwind_protect_kw
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
129 unwind_protect_cleanup, CLEANUP, unwind_protect_cleanup_kw
8bd5499ae4ef [project @ 1995-09-30 21:57:45 by jwe]
jwe
parents:
diff changeset
130 while, WHILE, while_kw
5279
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5102
diff changeset
131 __FILE__, DQ_STRING, magic_file_kw
3174
390d5e396682 [project @ 1998-05-04 16:36:17 by jwe]
jwe
parents: 2846
diff changeset
132 __LINE__, NUM, magic_line_kw