InvalidRegex class: Difference between revisions
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
<!-- InvalidRegex class --> | <!-- InvalidRegex class --> | ||
__NOTOC__ | |||
The <var>InvalidRegex</var> exception class describes an exception associated with an invalid [[Regex_processing|regular expression]] being passed to a method that takes a regular expression argument. | The <var>InvalidRegex</var> exception class describes an exception associated with an invalid [[Regex_processing|regular expression]] being passed to a method that takes a regular expression argument. | ||
Revision as of 20:17, 23 July 2013
The InvalidRegex exception class describes an exception associated with an invalid regular expression being passed to a method that takes a regular expression argument.
To produce an InvalidRegex exception yourself, you typically use a User Language Throw statement with an InvalidRegex New constructor. This statement must be issued from within a method, and it can only be caught by the code that calls the method. For example, the following statement throws an InvalidRegex exception with the position set to 13
, the code set to 666
, and the description indicating Bad luck
:
throw %(invalidRegex):new(position=13, code=666, description='Bad luck')
The InvalidRegex methods
The following are the available InvalidRegex class methods.
Method | Description |
---|---|
Code | Numeric code indicating cause of the exception |
Description | Brief description of the exception |
New | Create a new InvalidRegex object |
Position | Regex position at or before which the error occurred |
The methods in the class are described in the subsections that follow. In addition:
- "Notation conventions for methods" has information about the conventions followed.
- "InvalidRegex methods syntax" is a single page that contains the syntax diagrams of all the methods in the class.
Code property
Numeric code indicating cause of the exception (InvalidRegex class)
This ReadOnly property is an integer code that provides some details about the nature of the error. This code is really only useful to someone familiar with the implementation of the regular expression processor, so it is likely to be useful only to Sirius Software technical support.
No assumptions should be made that a particular error will always produce the same code from release to release of the Sirius Mods, or even between runs of an Online.
Syntax
%number = invalidRegex:Code
Syntax terms
%number | This integer value is associated with the regular expression error. |
---|---|
invalidRegex | A reference to an instance of an InvalidRegex object. |
Description property
Brief description of the exception (InvalidRegex class)
This ReadOnly property is a text explanation of the problem. As descriptive text tends to do, this text might change between releases of the Sirius Mods.
Syntax
%string = invalidRegex:Description
Syntax terms
%string | This string value describes the regular expression error. |
---|---|
invalidRegex | A reference to an instance of an InvalidRegex object. |
New constructor
Create a new InvalidRegex object (InvalidRegex class)
This Constructor generates an instance of an InvalidRegex exception.
As shown below, the required arguments of the New method are the Code, Description, and Position properties. Each argument to New sets the value of the corresponding property of the newly constructed InvalidRegex object.
Syntax
%invalidRegex = [%(InvalidRegex):]New( Position= number, Code= number, - Description= string)
Syntax terms
%invalidRegex | A reference to an instance of an InvalidRegex object. |
---|---|
[%(InvalidRegex):] | The class name in parentheses denotes a Constructor. |
Code | This name required parameter specifies the numeric value (number) to be assigned to the exception object's Code property. |
Description | This name required parameter specifies the string value (string) to be assigned to the object's Description property. |
Position | This name required parameter specifies the numeric value (number) to be assigned to the object's Position property. |
Position property
Regex position at or before which the error occurred (InvalidRegex class)
This ReadOnly property is the position in the regular expression that is determined to be where the regular expression was invalid. It is possible that the mistake was earlier but was not detected until later.
Syntax
%number = invalidRegex:Position
Syntax terms
%number | This numeric value is the position in the regular expression where the error was detected. |
---|---|
invalidRegex | A reference to an instance of an InvalidRegex object. |