# SRS Plugin3 Output Syntax

The output of the SRS plugin is a pattern match automaton, which tells the algorithm how to match left hand sides of the given patterns, as well as what substitution to apply when a left hand side is matched. Each state in the machine is denoted as < stateNumber @ stateDepth >. Depth is the number of inputs from the start state, and it is used to determine the *action* of a given transition in the machine. The action is used to determine how far to move the first pointer into the symbol buffer maintained by the SRS algorithm. Because the first pointer and current pointer denote the part of the character buffer that must be replaced when a left hand side is matched, the action is of vital importance. The action is determined by subtracting the depth the state transition to from that of the state transitioned from whenever there is a backward transition in the machine. The action in each transition in the machine is a number surrounded by brackets. If a given state matches a rule it is explicitly stated as < stateNum @ statDepth matches ruleText >.

Before the automaton description are two boolean values which denote whether or not "^" and "$" appear in any rule in the SRS, respectively because they require special handling in the SRS Monitoring Algorithm.

### Example

The following is the output for the example given on SRS Input Syntax.

<mop>

<Client>Web</Client>

<Events>hasnext next</Events>

<Property>

<Logic>srs</Logic>

<Formula>

true

false

<0 @ 0>

[ ^ -> [0] <4 @ 1>

hasnext -> [0] <0 @ 0>

next -> [0] <0 @ 0>

hasnexttrue -> [0] <1 @ 1>

]

<1 @ 1>

[ ^ -> [1] <0 @ 0>

hasnext -> [1] <0 @ 0>

next -> [0] <3 @ 2 matches hasnexttrue next -> #epsilon>

hasnexttrue -> [0] <2 @ 2 matches hasnexttrue hasnexttrue -> hasnexttrue >

]

<2 @ 2 matches hasnexttrue hasnexttrue -> hasnexttrue >

[ ^ -> [1] <1 @ 1>

hasnext -> [1] <1 @ 1>

next -> [1] <1 @ 1>

hasnexttrue -> [1] <1 @ 1>

]

<3 @ 2 matches hasnexttrue next -> #epsilon>

[ ^ -> [2] <0 @ 0>

hasnext -> [2] <0 @ 0>

next -> [2] <0 @ 0>

hasnexttrue -> [2] <0 @ 0>

]

<4 @ 1>

[ ^ -> [1] <0 @ 0>

hasnext -> [1] <0 @ 0>

hasnexttrue -> [1] <0 @ 0>

next -> [0] <5 @ 2 matches ^ next -> #fail>

]

<5 @ 2 matches ^ next -> #fail>

[ ^ -> [2] <0 @ 0>

hasnext -> [2] <0 @ 0>

next -> [2] <0 @ 0>

hasnexttrue -> [2] <0 @ 0>

]

</Formula>

</Property>

<Categories>succeed</Categories>

<Message>done</Message>

</mop>