int token=st.nextToken(); |
int token=st.nextToken(); |
switch(token){ |
switch(token){ |
case StreamTokenizer.TT_NUMBER: |
case StreamTokenizer.TT_NUMBER: |
// System.out.println("Number: "+st.nval+"String:"+st.sval); |
System.out.println("Number: "+st.nval+"String:"+st.sval); |
break; |
break; |
case StreamTokenizer.TT_WORD: |
case StreamTokenizer.TT_WORD: |
// System.out.println("WORD: "+st.sval); |
System.out.println("WORD: "+st.sval); |
break; |
break; |
default: |
default: |
// System.out.println("CHARACTER: "+token); |
System.out.println("CHARACTER: "+token); |
break; |
break; |
} |
} |
return token; |
return token; |
} |
} |
} |
} |
public LispObject nextObject() throws IOException{ |
public LispObject nextObject() throws IOException{ |
// System.out.println("nextObject"); |
System.out.println("nextObject"); |
int token=nextToken(); |
int token=nextToken(); |
// System.out.println("token="+token); |
System.out.println("token="+token); |
switch(token){ |
switch(token){ |
case '(': { |
case '(': { |
// System.out.println("readList"); |
System.out.println("readList"); |
return readList(); |
return readList(); |
} |
} |
case '\'': { |
case '\'': { |
// System.out.println("quote"); |
System.out.println("quote"); |
LispObject ret=nextObject(); |
LispObject ret=nextObject(); |
return new Cons(Symbol.quote,new Cons(ret,Symbol.nil)); |
return new Cons(Symbol.quote,new Cons(ret,Symbol.nil)); |
} |
} |