Class JavaCCTokenFilter

  • All Implemented Interfaces:
    TokenFilter

    public class JavaCCTokenFilter
    extends java.lang.Object
    implements TokenFilter
    A generic filter for JavaCC-based token managers that allows to use comments to enable / disable analysis of parts of the stream
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void analyzeToken​(GenericToken currentToken)
      Extension point for subclasses to analyze all tokens (before filtering) and update internal status to decide on custom discard rules.
      GenericToken getNextToken()
      Retrieves the next token to pass the filter
      protected boolean isLanguageSpecificDiscarding()
      Extension point for subclasses to indicate tokens are to be filtered.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JavaCCTokenFilter

        public JavaCCTokenFilter​(TokenManager tokenManager)
        Creates a new JavaCCTokenFilter
        Parameters:
        tokenManager - The token manager from which to retrieve tokens to be filtered
    • Method Detail

      • getNextToken

        public final GenericToken getNextToken()
        Description copied from interface: TokenFilter
        Retrieves the next token to pass the filter
        Specified by:
        getNextToken in interface TokenFilter
        Returns:
        The next token to pass the filter, or null if the end of the stream was reached
      • isLanguageSpecificDiscarding

        protected boolean isLanguageSpecificDiscarding()
        Extension point for subclasses to indicate tokens are to be filtered.
        Returns:
        True if tokens should be filtered, false otherwise
      • analyzeToken

        protected void analyzeToken​(GenericToken currentToken)
        Extension point for subclasses to analyze all tokens (before filtering) and update internal status to decide on custom discard rules.
        Parameters:
        currentToken - The token to be analyzed
        See Also:
        isLanguageSpecificDiscarding()