checkpoint
[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     // FIXME!!! remove this
14     /** converts this <tt>Token</tt> into a standalone result (ie for a non-rewriting pattern) */
15     public String result();
16
17     /** this is declared abstract as a way of forcing subclasses to provide a thoughtful implementation */
18     public abstract String toString();
19
20     public abstract Location getLocation();
21
22     /** a sequence of input tokens; returns null when EOF is reached */
23     public static interface Stream<T extends Token> {
24         public T next() throws IOException;
25     }
26
27     /** a location within the input stream */
28     public static interface Location {
29         public String toString();
30         public String getContext();
31     }
32
33 }
34