annotate doc/interpreter/grammar.txi @ 19628:fe689210525c gui-release

maint: Periodic merge of stable to gui-release.
author John W. Eaton <jwe@octave.org>
date Tue, 20 Jan 2015 10:05:42 -0500
parents e0775b4f41dd 446c46af4b42
children 0e1f5a750d00
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 17517
diff changeset
1 @c Copyright (C) 1996-2013 John W. Eaton
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
2 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
3 @c This file is part of Octave.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
4 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
5 @c Octave is free software; you can redistribute it and/or modify it
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
6 @c under the terms of the GNU General Public License as published by the
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
7 @c Free Software Foundation; either version 3 of the License, or (at
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
8 @c your option) any later version.
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
9 @c
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
13 @c for more details.
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
14 @c
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
15 @c You should have received a copy of the GNU General Public License
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
16 @c along with Octave; see the file COPYING. If not, see
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
17 @c <http://www.gnu.org/licenses/>.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
18
12573
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
19 @node Grammar and Parser
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
20 @appendix Grammar and Parser
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
21 @cindex grammar rules
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
22 @cindex language definition
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
23
12573
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
24 This appendix will eventually contain a semi-formal description of
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
25 Octave's language.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
26
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
27 @menu
17152
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 14293
diff changeset
28 * Keywords::
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 14293
diff changeset
29 * Parser::
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
30 @end menu
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
31
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3449
diff changeset
32 @node Keywords
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
33 @section Keywords
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
34 @cindex keywords
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
35
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
36 The following identifiers are keywords, and may not be used as variable
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
37 or function names:
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
38
6547
4fb053f24fd6 [project @ 2007-04-19 21:47:40 by jwe]
jwe
parents: 5849
diff changeset
39 @multitable @columnfractions .33 .33 .33
11446
67e3edbf8ff7 Update list of keywords in Grammar chapter of documentation.
Rik <octave@nomad.inbox5.com>
parents: 7018
diff changeset
40 @item @code{__FILE__} @tab @code{__LINE__} @tab @code{break}
67e3edbf8ff7 Update list of keywords in Grammar chapter of documentation.
Rik <octave@nomad.inbox5.com>
parents: 7018
diff changeset
41 @item @code{case} @tab @code{catch} @tab @code{classdef}
6547
4fb053f24fd6 [project @ 2007-04-19 21:47:40 by jwe]
jwe
parents: 5849
diff changeset
42 @item @code{continue} @tab @code{do} @tab @code{else}
4fb053f24fd6 [project @ 2007-04-19 21:47:40 by jwe]
jwe
parents: 5849
diff changeset
43 @item @code{elseif} @tab @code{end} @tab @code{end_try_catch}
13945
0f69d849360e doc: Update list of keywords for Octave grammar.
Rik <octave@nomad.inbox5.com>
parents: 12573
diff changeset
44 @item @code{end_unwind_protect} @tab @code{endclassdef} @tab @code{endenumeration}
0f69d849360e doc: Update list of keywords for Octave grammar.
Rik <octave@nomad.inbox5.com>
parents: 12573
diff changeset
45 @item @code{endevents} @tab @code{endfor} @tab @code{endfunction}
0f69d849360e doc: Update list of keywords for Octave grammar.
Rik <octave@nomad.inbox5.com>
parents: 12573
diff changeset
46 @item @code{endif} @tab @code{endmethods} @tab @code{endparfor}
0f69d849360e doc: Update list of keywords for Octave grammar.
Rik <octave@nomad.inbox5.com>
parents: 12573
diff changeset
47 @item @code{endproperties} @tab @code{endswitch} @tab @code{endwhile}
0f69d849360e doc: Update list of keywords for Octave grammar.
Rik <octave@nomad.inbox5.com>
parents: 12573
diff changeset
48 @item @code{enumeration} @tab @code{events} @tab @code{for}
14293
71a198cca35b improve parsing of classdef methods
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
49 @item @code{function} @tab @code{global} @tab @code{if}
71a198cca35b improve parsing of classdef methods
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
50 @item @code{methods} @tab @code{otherwise} @tab @code{parfor}
71a198cca35b improve parsing of classdef methods
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
51 @item @code{persistent} @tab @code{properties} @tab @code{return}
71a198cca35b improve parsing of classdef methods
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
52 @item @code{static} @tab @code{switch} @tab @code{try}
71a198cca35b improve parsing of classdef methods
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
53 @item @code{until} @tab @code{unwind_protect} @tab @code{unwind_protect_cleanup}
71a198cca35b improve parsing of classdef methods
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
54 @item @code{while}
6547
4fb053f24fd6 [project @ 2007-04-19 21:47:40 by jwe]
jwe
parents: 5849
diff changeset
55 @end multitable
6551
75c4045cf1db [project @ 2007-04-20 08:09:16 by jwe]
jwe
parents: 6547
diff changeset
56
12573
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
57 The function @code{iskeyword} can be used to quickly check whether an
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
58 identifier is reserved by Octave.
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
59
6551
75c4045cf1db [project @ 2007-04-20 08:09:16 by jwe]
jwe
parents: 6547
diff changeset
60 @DOCSTRING(iskeyword)
12573
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
61
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
62 @node Parser
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
63 @section Parser
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
64 @cindex parser
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
65
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
66 The parser has a number of variables that affect its internal operation.
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
67 These variables are generally documented in the manual alongside the code that
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
68 they affect. For example, @code{allow_noninteger_range_as_index} is discussed
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
69 in the section on index expressions.
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
70
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
71 In addition, there are three non-specific parser customization functions.
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
72 @code{add_input_event_hook} can be used to schedule a user function for
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
73 periodic evaluation. @code{remove_input_event_hook} will stop a user function
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
74 from being evaluated periodically.
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
75
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
76 @DOCSTRING(add_input_event_hook)
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
77
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
78 @DOCSTRING(remove_input_event_hook)
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
79
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
80 Finally, when the parser cannot identify an input token it calls a particular
17517
9c994995ddb0 doc: Fix reference to __unimplemented__
Mike Miller <mtmiller@ieee.org>
parents: 17281
diff changeset
81 function to handle this. By default, this is the internal function
9c994995ddb0 doc: Fix reference to __unimplemented__
Mike Miller <mtmiller@ieee.org>
parents: 17281
diff changeset
82 @qcode{"__unimplemented__"} which makes suggestions about possible Octave
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17152
diff changeset
83 substitutes for @sc{matlab} functions.
12573
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
84
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
85 @DOCSTRING(missing_function_hook)
232a90612254 Add new section on parsing to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
86