com.singularsys.jep.configurableparser.matchers
Class CommentTokenMatcher

java.lang.Object
  extended by com.singularsys.jep.configurableparser.matchers.RegExpTokenMatcher
      extended by com.singularsys.jep.configurableparser.matchers.CommentTokenMatcher
All Implemented Interfaces:
TokenBuilder, TokenMatcher, java.io.Serializable

public class CommentTokenMatcher
extends RegExpTokenMatcher

Matches various styles of comments.

See Also:
Serialized Form

Constructor Summary
CommentTokenMatcher(java.util.regex.Pattern pattern)
           
CommentTokenMatcher(java.lang.String regex)
           
 
Method Summary
 Token buildToken(java.lang.String s)
          Builds a token following a successful match.
static CommentTokenMatcher hashCommentMatcher()
           
 void init(Jep j)
          Initialize the matcher when the Jep instance is known.
static MultiLineMatcher multiLineSlashStarCommentMatcher()
          Recognize comments of the form /* ...
static CommentTokenMatcher slashSlashCommentMatcher()
          Recognize comments of the form /// ...
static CommentTokenMatcher slashStarCommentMatcher()
          Recognize comments of the form /* ...
 
Methods inherited from class com.singularsys.jep.configurableparser.matchers.RegExpTokenMatcher
match
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommentTokenMatcher

public CommentTokenMatcher(java.lang.String regex)

CommentTokenMatcher

public CommentTokenMatcher(java.util.regex.Pattern pattern)
Method Detail

buildToken

public Token buildToken(java.lang.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()
Recognize comments of the form /* ... */ on a single line.


multiLineSlashStarCommentMatcher

public static MultiLineMatcher multiLineSlashStarCommentMatcher()
Recognize comments of the form /* ... */ which can span multiple lines.


slashSlashCommentMatcher

public static CommentTokenMatcher slashSlashCommentMatcher()
Recognize comments of the form /// ...


hashCommentMatcher

public static CommentTokenMatcher hashCommentMatcher()

init

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



Copyright © 2010 Singular Systems http://www.singularsys.com/jep