Mercurial > hg > octave-nkf
changeset 13246:0c69a564f2be
additional parfor changes
* octave.gperf (octave_kw_id): Use endparfor_kw, not end_parfor_kw.
(octave_kw): Use endparfor, not end_parfor. Change all uses.
* help.cc (keywords): Include parfor and endparfor in the list.
* pt-pr-code.cc (tree_print_code::visit_simple_for_command):
Print endparfor if in parallel.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 29 Sep 2011 03:35:58 -0400 |
parents | 027a2186cd90 |
children | e36c2f4ea8f5 |
files | src/help.cc src/lex.ll src/oct-parse.yy src/octave.gperf src/pt-pr-code.cc |
diffstat | 5 files changed, 39 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/help.cc +++ b/src/help.cc @@ -432,7 +432,7 @@ "-*- texinfo -*-\n\ @deftypefn {Keyword} {} break\n\ Exit the innermost enclosing do, while or for loop.\n\ -@seealso{do, while, for, continue}\n\ +@seealso{do, while, for, parfor, continue}\n\ @end deftypefn"), pair_type ("case", @@ -455,7 +455,7 @@ "-*- texinfo -*-\n\ @deftypefn {Keyword} {} continue\n\ Jump to the end of the innermost enclosing do, while or for loop.\n\ -@seealso{do, while, for, break}\n\ +@seealso{do, while, for, parfor, break}\n\ @end deftypefn"), pair_type ("do", @@ -485,7 +485,7 @@ @deftypefn {Keyword} {} end\n\ Mark the end of any @code{for}, @code{if}, @code{do}, @code{while}, or\n\ @code{function} block.\n\ -@seealso{for, if, do, while, function}\n\ +@seealso{for, parfor, if, do, while, function}\n\ @end deftypefn"), pair_type ("end_try_catch", @@ -523,6 +523,13 @@ @seealso{if}\n\ @end deftypefn"), + pair_type ("endparfor", + "-*- texinfo -*-\n\ +@deftypefn {Keyword} {} endparfor\n\ +Mark the end of a parfor loop. See @code{parfor} for an example.\n\ +@seealso{parfor}\n\ +@end deftypefn"), + pair_type ("endswitch", "-*- texinfo -*-\n\ @deftypefn {Keyword} {} endswitch\n\ @@ -549,7 +556,7 @@ endfor\n\ @end group\n\ @end example\n\ -@seealso{do, while}\n\ +@seealso{do, parfor, while}\n\ @end deftypefn"), pair_type ("function", @@ -608,6 +615,22 @@ @seealso{switch}\n\ @end deftypefn"), + pair_type ("parfor", + "-*- texinfo -*-\n\ +@deftypefn {Keyword} {} for @var{i} = @var{range}\n\ +@deftypefnx {Keyword} {} for (@var{i} = @var{range}, @var{maxproc})\n\ +Begin a for loop that may execute in parallel.\n\ +\n\ +@example\n\ +@group\n\ +parfor i = 1:10\n\ + i\n\ +endparfor\n\ +@end group\n\ +@end example\n\ +@seealso{do, for, while}\n\ +@end deftypefn"), + pair_type ("persistent", "-*- texinfo -*-\n\ @deftypefn {Keyword} {} persistent @var{var}\n\
--- a/src/lex.ll +++ b/src/lex.ll @@ -1496,11 +1496,6 @@ lexer_flags.at_beginning_of_statement = true; break; - case end_parfor_kw: - yylval.tok_val = new token (token::parfor_end, l, c); - lexer_flags.at_beginning_of_statement = true; - break; - case end_try_catch_kw: yylval.tok_val = new token (token::try_catch_end, l, c); lexer_flags.at_beginning_of_statement = true; @@ -1526,6 +1521,11 @@ lexer_flags.at_beginning_of_statement = true; break; + case endparfor_kw: + yylval.tok_val = new token (token::parfor_end, l, c); + lexer_flags.at_beginning_of_statement = true; + break; + case endswitch_kw: yylval.tok_val = new token (token::switch_end, l, c); lexer_flags.at_beginning_of_statement = true;
--- a/src/oct-parse.yy +++ b/src/oct-parse.yy @@ -1785,6 +1785,10 @@ end_error ("if", ettype, l, c); break; + case token::parfor_end: + end_error ("parfor", ettype, l, c); + break; + case token::try_catch_end: end_error ("try", ettype, l, c); break;
--- a/src/octave.gperf +++ b/src/octave.gperf @@ -35,7 +35,6 @@ else_kw, elseif_kw, end_kw, - end_parfor_kw, end_try_catch_kw, end_unwind_protect_kw, endclassdef_kw, @@ -44,6 +43,7 @@ endfunction_kw, endif_kw, endmethods_kw, + endparfor_kw, endproperties_kw, endswitch_kw, endwhile_kw, @@ -81,7 +81,6 @@ else, ELSE, else_kw elseif, ELSEIF, elseif_kw end, END, end_kw -end_parfor, END, end_parfor_kw end_try_catch, END, end_try_catch_kw end_unwind_protect, END, end_unwind_protect_kw endclassdef, END, endclassdef_kw @@ -90,6 +89,7 @@ endfunction, END, endfunction_kw endif, END, endif_kw endmethods, END, endmethods_kw +endparfor, END, endparfor_kw endproperties, END, endproperties_kw endswitch, END, endswitch_kw endwhile, END, endwhile_kw