InvalidRegex class

From m204wiki
(Redirected from InvalidRegex exception)
Jump to navigation Jump to search


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.

MethodDescription
CodeNumeric code indicating cause of the exception
DescriptionBrief description of the exception
NewCreate a new InvalidRegex object
PositionRegex position at or before which the error occurred

The methods in the class are described in the subsections that follow. In addition:


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 Technical Support.

No assumptions should be made that a particular error will always produce the same code from release to release of Model 204, 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.