F.2 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.

In addition, there are three non-specific parser customization functions. add_input_event_hook can be used to schedule a user function for periodic evaluation. remove_input_event_hook will stop a user function from being evaluated periodically.

id = add_input_event_hook (fcn)
id = add_input_event_hook (fcn, data)

Add the named function or function handle fcn to the list of functions to call periodically when Octave is waiting for input.

The function should have the form

fcn (data)

If data is omitted, Octave calls the function without any arguments.

The returned identifier may be used to remove the function handle from the list of input hook functions.

See also: remove_input_event_hook.

remove_input_event_hook (name)
remove_input_event_hook (fcn_id)

Remove the named function or function handle with the given identifier from the list of functions to call periodically when Octave is waiting for input.

See also: add_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 internal function "__unimplemented__" which makes suggestions about possible Octave substitutes for MATLAB functions.

val = missing_function_hook ()
old_val = missing_function_hook (new_val)
missing_function_hook (new_val, "local")

Query or set the internal variable that specifies the function to call when an unknown identifier is requested.

When called from inside a function with the "local" option, the variable is changed locally for the function and any subroutines it calls. The original variable value is restored when exiting the function.

See also: missing_component_hook.

© 1996–2020 John W. Eaton
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://octave.org/doc/v5.2.0/Parser.html