Flow Control Elements

Contents

And Matcher


The and matcher requires all of its child matchers to match before it will return success.

Syntax

<and>
  <string>Hello</string>
  <optional>
    <character>,</character>
  </optional>
  <one-or-more>
    <whitespace/>
  </one-or-more>
  <string>World</string>
</and>

Class

com.aptana.ide.lexer.matcher.AndMatcher

Children

Any IMatcher class

Attributes

There are no attributes for this matcher.


OneOrMore Matcher


The one-or-more matcher requires that its child pattern to match one or more times. This matcher will continue to process the child pattern until it fails.

If this element contains more than one child, all children will be wrapped in an AndMatcher which then becomes the child of this element.

Syntax

<one-or-more>
  <whitespace/>
</one-or-more>

Class

com.aptana.ide.lexer.matcher.OneOrMoreMatcher

Children

Any IMatcher class

Attributes

There are not attributes for this matcher.


Optional Matcher


The optional matcher will match its child pattern once. If the child reports failure, this matcher will still report success.

If this element contains more than one child, all children will be wrapped in an AndMatcher which then becomes the child of this element.

Syntax

<optional>
  <character>:</character>
  <one-or-more>
    <letter/>
  </one-or-more>
</optional>

Class

com.aptana.ide.lexer.matcher.OptionalMatcher

Children

Any IMatcher class

Attributes

There are no attributes for this matcher.


Or Matcher


The or matcher returns success if any of its child patterns return success. Each child is tested in order until a success is found. If no child returns success, then this matcher fails. Note that order is significant so if one child matches a subset of another child, then you should place the longer match before the shorter match.

Syntax

<or>
  <string>abcdef</string>
  <string>abc</string>
  <string>def</string>
</or>

Class

com.aptana.ide.lexer.matcher.OrMatcher

Children

Any IMatcher class

Attributes

There are no attributes for this matcher.

Repetition Matcher


The repetition matcher defines an interval number of times that its child pattern must match before this matcher returns success.

If this element contains more than one child, all children will be wrapped in an AndMatcher which then becomes the child of this element.

Syntax

<repetition min="3" max="5">
  <digit/>
</repetition>

Class

com.aptana.ide.lexer.matcher.RepetitionMatcher

Children

Any IMatcher class

Attributes

Name Description Type Default Required
min This is the minimum number of matches required by the child pattern before this matcher reports success. int 1 no
max This is the maximum number of matches required by the child pattern before this matcher reports success. int 1 no


ZeroOrMore Matcher


The zero-or-more matcher does not require that its child pattern match, but this matcher will continue processing the child pattern until it fails.

If this element contains more than one child, all children will be wrapped in an AndMatcher which then becomes the child of this element.

Syntax

<zero-or-more>
  <whitespace/>
</zero-or-more>

Class

com.aptana.ide.lexer.matcher.ZeroOrMoreMatcher

Children

Any IMatcher class

Attributes

There are not attributes for this matcher.