1
/*******************************************************************************
2
* Copyright (c) 2004, 2008 IBM Corporation and others.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* IBM Corporation - initial implementation
10
* Anton Leherbauer - adding tokens for preprocessing directives
11
* Markus Schorn - classification of preprocessing directives.
12
*******************************************************************************/
13
package org.eclipse.cdt.internal.formatter.scanner;
15
import java.io.IOException;
16
import java.io.Reader;
17
import java.util.Stack;
19
public class ScannerContext {
20
private Reader fReader;
22
private Stack<Integer> fUndo = new Stack<Integer>();
24
public ScannerContext() {
26
public ScannerContext initialize(Reader r) {
31
public ScannerContext initialize(Reader r, int offset) {
34
} catch (IOException exc) {
35
throw new RuntimeException(exc);
42
public int read() throws IOException {
44
return fReader.read();
51
public final int getOffset() {
59
public final Reader getReader() {
63
public final int undoStackSize() {
71
public final int popUndo() {
72
return fUndo.pop().intValue();
77
* @param undo The undo to set
79
public void pushUndo(int undo) {
80
this.fUndo.push(new Integer(undo));