OutOfBounds class: Difference between revisions
m (Created page with "<!-- OutOfBounds class --> __NOTOC__ An <var>OutOfBounds</var> exception indicates that the <var>AtEnd</var> property was true when attempting to scan for a token. For example: <...") |
mNo edit summary |
||
Line 2: | Line 2: | ||
__NOTOC__ | __NOTOC__ | ||
An <var>OutOfBounds</var> exception indicates | An <var>OutOfBounds</var> exception indicates | ||
that the <var>AtEnd</var> property was true when attempting to scan for a token. | that the <var>AtEnd</var> property was <code>true</code> when attempting to scan for a token. | ||
For example: | For example: | ||
<p class="code">%t is object stringTokenizer | <p class="code">%t is object stringTokenizer |
Revision as of 17:02, 1 October 2012
An OutOfBounds exception indicates
that the AtEnd property was true
when attempting to scan for a token.
For example:
%t is object stringTokenizer %t = 'foobar':stringTokenizer printText {~=%t:nextToken} if %t:notAtEnd then printText {~=%t:nextToken} else print 'Safe coding technique protected against OutOfBounds exception' end if print 'Questionable technique...' printText {~=%t:nextToken}
The output from the above fragment is:
%t:nextToken=foobar Safe coding technique protected against OutOfBounds exception Questionable technique... %t:nextToken= *** 1 CANCELLING REQUEST: MSIR.0751: Class StringTokenizer, function NextToken: OutOfBounds exception: Past end of string ...
The OutOfBounds class is available as of version 7.9.
The OutOfBounds methods
The following are the available OutOfBounds class methods.
Method | Description |
---|---|
New | Create a new OutOfBounds object |
The methods in the class are described in the subsections that follow. In addition:
- "Notation conventions for methods" has information about the conventions followed.
- "OutOfBounds methods syntax" is a single page that contains the syntax diagrams of all the methods in the class.
New constructor
Create a new OutOfBounds object (OutOfBounds class)
[Introduced in Sirius Mods 7.9]
This Constructor generates an instance of an OutOfBounds exception. The New method format follows:
Syntax
%outOfBounds = [%(OutOfBounds):]New
Syntax terms
%outOfBounds | A reference to an instance of an OutOfBounds object. |
---|---|
[%(OutOfBounds):] | The class name in parentheses denotes a Constructor. See "Usage notes", below, for more information about invoking an OutOfBounds Constructor. |
Usage notes
- As described in "Using New or other Constructors", New can be invoked with no object, with an explicit class name, or with an object variable in the class, even if that object is Null:
%outOfBoundsExc = new %outOfBoundsExc = %(OutOfBounds):new %outOfBoundsExc = %outOfBoundsExc:new