# HG changeset patch # User Rik # Date 1301887994 25200 # Node ID 232a90612254905198e351912c31139297022246 # Parent dffd30f1275208def2d019d6b1d5ddf2119e611f Add new section on parsing to documentation. Add functions add_input_event_hook, remove_input_event_hook, missing_function_hook to documentation. diff -r dffd30f12752 -r 232a90612254 doc/ChangeLog --- a/doc/ChangeLog Sun Apr 03 13:55:58 2011 -0700 +++ b/doc/ChangeLog Sun Apr 03 20:33:14 2011 -0700 @@ -1,3 +1,9 @@ +2011-04-03 Rik + + * interpreter/grammar.txi, interpreter/octave.texi: Add new section + on parsing to documentation. Add functions add_input_event_hook, + remove_input_event_hook, missing_function_hook to documentation. + 2011-04-03 Rik * interpreter/linalg.txi: Add blkmm function to documentation. diff -r dffd30f12752 -r 232a90612254 doc/interpreter/grammar.txi --- a/doc/interpreter/grammar.txi Sun Apr 03 13:55:58 2011 -0700 +++ b/doc/interpreter/grammar.txi Sun Apr 03 20:33:14 2011 -0700 @@ -16,16 +16,17 @@ @c along with Octave; see the file COPYING. If not, see @c . -@node Grammar -@appendix Grammar +@node Grammar and Parser +@appendix Grammar and Parser @cindex grammar rules @cindex language definition -This appendix should eventually contain a semi-formal description of +This appendix will eventually contain a semi-formal description of Octave's language. @menu * Keywords:: +* Parser:: @end menu @node Keywords @@ -52,4 +53,33 @@ @item @code{unwind_protect_cleanup}@tab @code{while} @end multitable +The function @code{iskeyword} can be used to quickly check whether an +identifier is reserved by Octave. + @DOCSTRING(iskeyword) + +@node Parser +@section Parser +@cindex parser + +The parser has a number of variables that affect its internal operation. +These variables are generally documented in the manual alongside the code that +they affect. For example, @code{allow_noninteger_range_as_index} is discussed +in the section on index expressions. + +In addition, there are three non-specific parser customization functions. +@code{add_input_event_hook} can be used to schedule a user function for +periodic evaluation. @code{remove_input_event_hook} will stop a user function +from being evaluated periodically. + +@DOCSTRING(add_input_event_hook) + +@DOCSTRING(remove_input_event_hook) + +Finally, when the parser cannot identify an input token it calls a particular +function to handle this. By default, this is the function "unimplemented" +which makes suggestions about possible Octave substitutes for @sc{matlab} +functions. + +@DOCSTRING(missing_function_hook) + diff -r dffd30f12752 -r 232a90612254 doc/interpreter/octave.texi --- a/doc/interpreter/octave.texi Sun Apr 03 13:55:58 2011 -0700 +++ b/doc/interpreter/octave.texi Sun Apr 03 20:33:14 2011 -0700 @@ -209,7 +209,7 @@ * Trouble:: If you have trouble installing Octave. * Installation:: How to configure, compile and install Octave. * Emacs Octave Support:: -@c * Grammar:: +* Grammar and Parser:: * Copying:: The GNU General Public License. * Concept Index:: An item for each concept. * Function Index:: An item for each documented function. @@ -854,6 +854,12 @@ * Using Octave Mode:: * Running Octave from Within Emacs:: * Using the Emacs Info Reader for Octave:: + +Grammar and Parser + +* Keywords:: +* Parser:: + @end detailmenu @end menu @@ -912,7 +918,7 @@ @include bugs.texi @include install.texi @include emacs.texi -@c @include grammar.texi +@include grammar.texi @include gpl.texi @c ------------------------------------------------------------------------ diff -r dffd30f12752 -r 232a90612254 src/ChangeLog --- a/src/ChangeLog Sun Apr 03 13:55:58 2011 -0700 +++ b/src/ChangeLog Sun Apr 03 20:33:14 2011 -0700 @@ -1,3 +1,10 @@ +2011-04-03 Rik + + * input.cc (add_input_event_hook, remove_input_event_hook): Improve + docstring. + * utils.cc (isvarname): Add seealso link to iskeyword(). + * variables.cc (missing_function_hook): Improve docstring. + 2011-04-03 Rik * DLD-FUNCTIONS/dot.cc (blkmm): Improve docstring. diff -r dffd30f12752 -r 232a90612254 src/input.cc --- a/src/input.cc Sun Apr 03 13:55:58 2011 -0700 +++ b/src/input.cc Sun Apr 03 20:33:14 2011 -0700 @@ -1277,7 +1277,8 @@ DEFUN (add_input_event_hook, args, , "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} add_input_event_hook (@var{fcn}, @var{data})\n\ +@deftypefn {Built-in Function} {} add_input_event_hook (@var{fcn})\n\ +@deftypefnx {Built-in Function} {} add_input_event_hook (@var{fcn}, @var{data})\n\ Add the named function @var{fcn} to the list of functions to call\n\ periodically when Octave is waiting for input. The function should\n\ have the form\n\ @@ -1323,7 +1324,7 @@ DEFUN (remove_input_event_hook, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} remove_input_event_hook (@var{fcn})\n\ -Remove the named function @var{fcn} to the list of functions to call\n\ +Remove the named function @var{fcn} from the list of functions to call\n\ periodically when Octave is waiting for input.\n\ @seealso{add_input_event_hook}\n\ @end deftypefn") diff -r dffd30f12752 -r 232a90612254 src/utils.cc --- a/src/utils.cc Sun Apr 03 13:55:58 2011 -0700 +++ b/src/utils.cc Sun Apr 03 20:33:14 2011 -0700 @@ -94,7 +94,7 @@ "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} isvarname (@var{name})\n\ Return true if @var{name} is a valid variable name.\n\ -@seealso{exist, who}\n\ +@seealso{iskeyword, exist, who}\n\ @end deftypefn") { octave_value retval; diff -r dffd30f12752 -r 232a90612254 src/variables.cc --- a/src/variables.cc Sun Apr 03 13:55:58 2011 -0700 +++ b/src/variables.cc Sun Apr 03 20:33:14 2011 -0700 @@ -2521,8 +2521,8 @@ "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{val} =} missing_function_hook ()\n\ @deftypefnx {Built-in Function} {@var{old_val} =} missing_function_hook (@var{new_val})\n\ -Query or set the internal variable that allows setting a custom hook function\n\ -called when an uknown identifier is requested.\n\ +Query or set the internal variable that specifies the function to call when\n\ +an unknown identifier is requested.\n\ @end deftypefn") { return SET_INTERNAL_VARIABLE (missing_function_hook);