Package com.singularsys.jep.configurableparser.matchers

# Class CommentTokenMatcher

java.lang.Object
com.singularsys.jep.configurableparser.matchers.RegExpTokenMatcher
com.singularsys.jep.configurableparser.matchers.CommentTokenMatcher

All Implemented Interfaces:
  `TokenBuilder`, `TokenMatcher`, `Serializable`

public class CommentTokenMatcher extends RegExpTokenMatcher
Matches various styles of comments.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CommentTokenMatcher(String regex)`
  `CommentTokenMatcher(Pattern pattern)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Token`
  `buildToken(String s)`
  Builds a token following a successful match.
  `static CommentTokenMatcher`
  `hashCommentMatcher()`
  Recognise comments of the form # ...
  `void`
  `init(Jep j)`
  Initialize the matcher when the Jep instance is known.
  `static MultiLineMatcher`
  `multiLineSlashStarCommentMatcher()`
  Recognise comments of the form /* ... */ which can span multiple lines.
  `static CommentTokenMatcher`
  `slashSlashCommentMatcher()`
  Recognise comments of the form // ...
  `static CommentTokenMatcher`
  `slashStarCommentMatcher()`
  Recognise comments of the form /* ... */ on a single line.

  ### Methods inherited from class com.singularsys.jep.configurableparser.matchers.RegExpTokenMatcher

  `match, toString`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### CommentTokenMatcher

    public CommentTokenMatcher(String regex)

  - ### CommentTokenMatcher

    public CommentTokenMatcher(Pattern pattern)

- ## Method Details

  - ### buildToken

    public Token buildToken(String s)
    Description copied from class: `RegExpTokenMatcher`
    Builds a token following a successful match. Note new objects should be created each time as error reporting information is later attached to tokens.
    Specified by:
      `buildToken` in interface `TokenBuilder`
    Specified by:
      `buildToken` in class `RegExpTokenMatcher`
    Parameters:
      `s` - String representing the completed matched token
    Returns:
      the appropriate type of token.

  - ### slashStarCommentMatcher

    public static CommentTokenMatcher slashStarCommentMatcher()
    Recognise comments of the form /* ... */ on a single line.
    Returns:
      a TokenMatcher

  - ### multiLineSlashStarCommentMatcher

    public static MultiLineMatcher multiLineSlashStarCommentMatcher()
    Recognise comments of the form /* ... */ which can span multiple lines.
    Returns:
      a TokenMatcher

  - ### slashSlashCommentMatcher

    public static CommentTokenMatcher slashSlashCommentMatcher()
    Recognise comments of the form // ...
    Returns:
      a TokenMatcher

  - ### hashCommentMatcher

    public static CommentTokenMatcher hashCommentMatcher()
    Recognise comments of the form # ...
    Returns:
      a TokenMatcher

  - ### init

    public void init(Jep j)
    Description copied from interface: `TokenMatcher`
    Initialize the matcher when the Jep instance is known.
    Parameters:
      `j` - Jep instance