refactoring to eliminate Token.result()
[sbp.git] / src / edu / berkeley / sbp / Token.java
1 package edu.berkeley.sbp;
2 import java.io.*;
3 import java.util.*;
4 import java.lang.reflect.*;
5 import java.lang.ref.*;
6 import edu.berkeley.sbp.*;
7 import edu.berkeley.sbp.util.*;
8 import edu.berkeley.sbp.*;
9
10 /** a token of input -- note that this represents an <i>actual input token</i> rather than an <tt>Element</tt> which <i>matches</i> a token */
11 public interface Token {
12
13     /** this is declared abstract as a way of forcing subclasses to provide a thoughtful implementation */
14     public abstract String toString();
15
16     public abstract Location getLocation();
17
18     /** a sequence of input tokens; returns null when EOF is reached */
19     public static interface Stream<T extends Token> {
20         public T next() throws IOException;
21     }
22
23     /** a location within the input stream */
24     public static interface Location {
25         public String toString();
26         public String getContext();
27     }
28
29 }
30