cpptools.preprocessor
Class AbstractTokenFilter

java.lang.Object
  extended by cpptools.preprocessor.AbstractTokenFilter
All Implemented Interfaces:
TokenFilter
Direct Known Subclasses:
Define, Macro

public abstract class AbstractTokenFilter
extends java.lang.Object
implements TokenFilter

Captures filter common behaviours.

Author:
Mathieu Champlon

Constructor Summary
AbstractTokenFilter(java.util.Stack<Token> buffer, java.lang.String name, java.lang.String value)
          Create an abstract token filter.
 
Method Summary
protected  void insert(Token location)
          Insert filtered tokens into the token flow.
 boolean matches(java.lang.String name)
          Test if the filter name matches a given name.
protected  void undo(Token token, Token next)
          Put both tokens back into the flow.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cpptools.preprocessor.TokenFilter
process
 

Constructor Detail

AbstractTokenFilter

public AbstractTokenFilter(java.util.Stack<Token> buffer,
                           java.lang.String name,
                           java.lang.String value)
Create an abstract token filter.

Parameters:
buffer - the token stack where to output filtered tokens
name - the name of the filter
value - the raw value of the filtering result
Method Detail

undo

protected final void undo(Token token,
                          Token next)
Put both tokens back into the flow.

Parameters:
token - the head of the flow
next - the token following the head

insert

protected final void insert(Token location)
Insert filtered tokens into the token flow.

Parameters:
location - the location of the insertion

matches

public final boolean matches(java.lang.String name)
Test if the filter name matches a given name.

Specified by:
matches in interface TokenFilter
Parameters:
name - the name to test
Returns:
whether the filter name matches or not


Copyright © 2006-2007 null. All Rights Reserved.