InvalidRegex class: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (misc formatting)
Line 3: Line 3:
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.
   
   
To produce an <var>InvalidRegex</var> exception yourself, you typically use a <var class="product">User Language</var> <var>[[Exceptions#Throwing exceptions|Throw]]</var> statement with an <var>InvalidRegex</var> <var>[[New_(InvalidRegex_constructor)|New]]</var> 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 <var>InvalidRegex</var> exception with the position set to <code>13</code>, the code set to <code>666</code>, and the description indicating <code>Bad luck</code>:
To produce an <var>InvalidRegex</var> exception yourself, you typically use a <var class="product">User Language</var> <var>[[Exceptions#Throwing exceptions|Throw]]</var> statement with an <var>InvalidRegex</var> <var>[[New_(InvalidRegex_constructor)|New]]</var> 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 <var>InvalidRegex</var> exception with the position set to <code>13</code>, the code set to <code>666</code>, and the description indicating <code>Bad luck</code>:
<p class="code">throw %(invalidRegex):new(position=13, code=666, description='Bad luck')
<p class="code">throw %(invalidRegex):new(position=13, code=666, description='Bad luck')
</p>
</p>
Line 12: Line 12:
The methods in the class are described in the subsections that follow. In addition:
The methods in the class are described in the subsections that follow. In addition:
<ul>
<ul>
<li>[[Notation conventions for methods|"Notation conventions for methods"]] has information
<li>[[Notation conventions for methods]] has information about the conventions followed. </li>
about the conventions followed.  
 
<li>[[InvalidRegex methods syntax|"InvalidRegex methods syntax"]] is a single page that contains the syntax diagrams of all the methods in the class.
<li>[[InvalidRegex methods syntax]] is a single page that contains the syntax diagrams of all the methods in the class. </li>
</ul>
</ul>


Line 22: Line 22:


This <var>[[Classes and Objects#readWrite|ReadOnly]]</var> 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 [[Contacting Rocket Software Technical Support|Technical Support]].
This <var>[[Classes and Objects#readWrite|ReadOnly]]</var> 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 [[Contacting Rocket Software Technical Support|Technical Support]].
<p>No assumptions should be made that a particular error will always produce the same code from release to release of the <var class="product">[[Sirius Mods|Sirius Mods]]</var>, or even between runs of an Online.</p>
<p>
No assumptions should be made that a particular error will always produce the same code from release to release of <var class="product">[[Model 204]]</var>, or even between runs of an Online.</p>


===Syntax===
===Syntax===
Line 28: Line 29:


====Syntax terms====
====Syntax terms====
<table class="syntaxTable">
<table>
<tr><th>%number</th>
<tr><th>%number</th>
<td>This integer value is associated with the regular expression error.</td></tr>
<td>This integer value is associated with the regular expression error.</td></tr>
Line 59: Line 60:
This <var>Constructor</var> generates an instance of an <var>[[InvalidRegex_class|InvalidRegex]]</var> exception.
This <var>Constructor</var> generates an instance of an <var>[[InvalidRegex_class|InvalidRegex]]</var> exception.
<p>
<p>
As shown below, the required arguments of the <var>New</var> method are the <var>[[Code_(InvalidRegex_property)|Code]]</var>, <var>[[Description_(InvalidRegex_property)|Description]]</var>, and <var>[[Position_(InvalidRegex_property)|Position]]</var> properties. Each argument to <var>New</var> sets the value of the corresponding property of the newly constructed <var>InvalidRegex</var> object.</p>
As shown below, the required arguments of the <var>New</var> method are the <var>[[Code (InvalidRegex_property)|Code]]</var>, <var>[[Description (InvalidRegex property)|Description]]</var>, and <var>[[Position (InvalidRegex property)|Position]]</var> properties. Each argument to <var>New</var> sets the value of the corresponding property of the newly constructed <var>InvalidRegex</var> object.</p>


===Syntax===
===Syntax===
Line 65: Line 66:


====Syntax terms====
====Syntax terms====
<table class="syntaxTable">
<table>
<tr><th>%invalidRegex</th>
<tr><th>%invalidRegex</th>
<td>A reference to an instance of an <var>InvalidRegex</var> object.</td></tr>
<td>A reference to an instance of an <var>InvalidRegex</var> object.</td></tr>
Line 90: Line 91:


====Syntax terms====
====Syntax terms====
<table class="syntaxTable">
<table>
<tr><th>%number</th>
<tr><th>%number</th>
<td>This numeric value is the position in the regular expression where the error was detected.</td></tr>
<td>This numeric value is the position in the regular expression where the error was detected.</td></tr>


<tr><th>invalidRegex</th>
<tr><th>invalidRegex</th>
<td>A reference to an instance of an <var>[[InvalidRegex_class|InvalidRegex]]</var> object.
<td>A reference to an instance of an <var>[[InvalidRegex_class|InvalidRegex]]</var> object.</td></tr>
 
</table>
</td></tr></table>
 


[[Category:System exception classes]]
[[Category:System exception classes]]

Revision as of 17:46, 11 May 2016


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.