01: /*
02: * Author: Chris Seguin
03: *
04: * This software has been developed under the copyleft
05: * rules of the GNU General Public License. Please
06: * consult the GNU General Public License for more
07: * details about use and distribution of this software.
08: */
09: package org.acm.seguin.pretty;
10:
11: import net.sourceforge.jrefactory.ast.Node;
12:
13: /**
14: * Consume newline (whitespace) special tokens
15: *
16: *@author Chris Seguin
17: *@created October 14, 1999
18: *@date April 10, 1999
19: */
20: public class PrintSpecialNewline extends PrintSpecial {
21: /**
22: * Determines if this print special can handle the current object
23: *
24: *@param spec Description of Parameter
25: *@return true if this one should process the input
26: */
27: public boolean isAcceptable(SpecialTokenData spec) {
28: int tokenType = spec.getTokenType();
29: return ((tokenType >= 5) || (tokenType <= 7));
30: }
31:
32: /**
33: * Processes the special token
34: *
35: *@param node the type of node this special is being processed for
36: *@param spec the special token data
37: *@return Description of the Returned Value
38: */
39: public boolean process(Node node, SpecialTokenData spec) {
40: if (spec.isAcceptingReturns()) {
41: boolean result = spec.getPrintData().consumeNewline();
42: spec.setReturnExpected(result);
43: return true;
44: }
45:
46: return false;
47: }
48: }
|