sisc.reader
Class Parser

java.lang.Object
  extended by sisc.util.Util
      extended by sisc.reader.Parser
All Implemented Interfaces:
Tokens, Version

public class Parser
extends Util
implements Tokens

Receives tokens from the Lexer and parses them into valid s-expressions.


Field Summary
 boolean annotate
           
static int CASE_SENSITIVE
           
 Lexer lexer
           
static int PERMISSIVE_PARSING
           
static int PRODUCE_ANNOTATIONS
           
static int PRODUCE_IMMUTABLES
           
static int READING_VECTOR
           
static int STRICT_R5RS
           
 
Fields inherited from class sisc.util.Util
BACKQUOTE, BEGIN, bundles, caseSensitive, EMPTYLIST, EMPTYVEC, EOF, ERRORK, EVAL, EXPSC, EXPTOP, FALSE, FCONT, FIVE, JEXCEPTION, LAMBDA, LOCATION, maxFloatPrecision, MESSAGE, minFloatPrecision, NAME, OTHER, PARENT, permitInterrupts, QUOTE, QUOTESYM, REPORT, SETBANG, SISC, SISC_SPECIFIC, SISCB, SOURCE_COLUMN, SOURCE_FILE, SOURCE_LINE, SYMENV, THIS, TOPLEVEL, TRUE, UNQUOTE, UNQUOTE_SPLICING, VOID, ZV
 
Fields inherited from interface sisc.reader.Tokens
TT_BACKQUOTE, TT_DOT, TT_ENDPAIR, TT_EOF, TT_NUMBER, TT_PAIR, TT_PIPE, TT_QUOTE, TT_SHARP, TT_STRING, TT_SYMBOL, TT_UNQUOTE, TT_UNQUOTE_SPLICING
 
Fields inherited from interface sisc.util.Version
VERSION
 
Constructor Summary
Parser(Lexer l)
           
 
Method Summary
protected  java.lang.Object _nextExpression(java.io.PushbackReader is, java.util.HashMap state, java.lang.Integer def, int radix, int flags, Pair anns)
           
protected  java.lang.Object _nextExpression(java.io.PushbackReader is, java.util.HashMap state, java.lang.Integer def, int flags, Pair anns)
           
protected  boolean caseSensitive(int flags)
           
static boolean isPeculiarIdentifier(java.lang.String s)
           
protected  java.lang.Object listSpecial(Symbol car, java.io.PushbackReader is, java.util.HashMap state, java.lang.Integer def, int flags, Pair anns)
           
static void main(java.lang.String[] args)
           
 Value nextExpression(java.io.PushbackReader is)
           
protected  Value nextExpression(java.io.PushbackReader is, java.util.HashMap state, int flags, Pair anns)
           
 Value nextExpression(java.io.PushbackReader is, int radix, int flags)
           
 Value nextExpression(java.io.PushbackReader is, int radix, int flags, Pair anns)
          Reads an s-expression from the given input port.
 Value nextExpression(java.io.PushbackReader is, int flags, Pair anns)
           
protected  Quantity numberCheck(java.lang.Object o, java.io.PushbackReader is, int flags)
           
protected  boolean permissiveParsing(int flags)
           
protected  void potentialError(int flags, java.lang.String message, java.io.PushbackReader is)
           
protected  void potentialError(int flags, java.lang.String message, java.lang.String arg, java.io.PushbackReader is)
           
protected  boolean produceAnnotations(int flags)
           
protected  boolean produceImmutables(int flags)
           
protected  boolean readingVector(int flags)
           
 Value readList(java.io.PushbackReader is, java.util.HashMap state, java.lang.Integer def, int flags, Pair anns)
           
 
Methods inherited from class sisc.util.Util
annotated, annotatedAppEval, append, argCheck, argsToSymbols, assq, bininport, bininstream, binoutport, binoutstream, box, character, charinport, charinreader, charoutport, charoutwriter, charsetFromString, chr, cont, currentClassLoader, env, error, error, error, error, error, error, error, expr, getDefaultCharacterSet, immutablePair, immutableVector, inport, javaExceptionToString, javaWrap, justify, length, liMessage, liMessage, liMessage, liMessage, liMessage, liMessage, liMessage, list, list, list, list, list, makeURL, mapcar, memq, nlib, num, outport, pair, pairToExpressions, pairToExpVect, pairToValues, proc, read, registerBundle, reverse, reverseInPlace, simpleErrorToString, sourceAnnotations, str, string, sym, symbol, symval, truePair, truth, truth, typeError, typeError, updateName, url, url, url, valArrayToList, valArrayToList, valArrayToVec, vec, warn, warn, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRODUCE_IMMUTABLES

public static final int PRODUCE_IMMUTABLES
See Also:
Constant Field Values

PRODUCE_ANNOTATIONS

public static final int PRODUCE_ANNOTATIONS
See Also:
Constant Field Values

STRICT_R5RS

public static final int STRICT_R5RS
See Also:
Constant Field Values

CASE_SENSITIVE

public static final int CASE_SENSITIVE
See Also:
Constant Field Values

READING_VECTOR

public static final int READING_VECTOR
See Also:
Constant Field Values

PERMISSIVE_PARSING

public static final int PERMISSIVE_PARSING
See Also:
Constant Field Values

annotate

public boolean annotate

lexer

public Lexer lexer
Constructor Detail

Parser

public Parser(Lexer l)
Method Detail

isPeculiarIdentifier

public static boolean isPeculiarIdentifier(java.lang.String s)

nextExpression

public final Value nextExpression(java.io.PushbackReader is)
                           throws java.io.IOException
Throws:
java.io.IOException

nextExpression

public final Value nextExpression(java.io.PushbackReader is,
                                  int flags,
                                  Pair anns)
                           throws java.io.IOException
Throws:
java.io.IOException

nextExpression

public final Value nextExpression(java.io.PushbackReader is,
                                  int radix,
                                  int flags)
                           throws java.io.IOException
Throws:
java.io.IOException

nextExpression

public Value nextExpression(java.io.PushbackReader is,
                            int radix,
                            int flags,
                            Pair anns)
                     throws java.io.IOException
Reads an s-expression from the given input port.

Parameters:
is - PushbackReader from which to read
radix - Specifies the radix of any numbers that are read
flags - Specifies attributes for the returned values (PRODUCE_IMMUTABLES, PRODUCE_ANNOTATIONS, STRICT_R5RS)
anns - additional annotations
Returns:
the read expression
Throws:
java.io.IOException - if an error occurs

nextExpression

protected final Value nextExpression(java.io.PushbackReader is,
                                     java.util.HashMap state,
                                     int flags,
                                     Pair anns)
                              throws java.io.IOException
Throws:
java.io.IOException

potentialError

protected void potentialError(int flags,
                              java.lang.String message,
                              java.io.PushbackReader is)
                       throws java.io.IOException
Throws:
java.io.IOException

potentialError

protected void potentialError(int flags,
                              java.lang.String message,
                              java.lang.String arg,
                              java.io.PushbackReader is)
                       throws java.io.IOException
Throws:
java.io.IOException

_nextExpression

protected java.lang.Object _nextExpression(java.io.PushbackReader is,
                                           java.util.HashMap state,
                                           java.lang.Integer def,
                                           int flags,
                                           Pair anns)
                                    throws java.io.IOException
Throws:
java.io.IOException

numberCheck

protected Quantity numberCheck(java.lang.Object o,
                               java.io.PushbackReader is,
                               int flags)
                        throws java.io.IOException
Throws:
java.io.IOException

listSpecial

protected java.lang.Object listSpecial(Symbol car,
                                       java.io.PushbackReader is,
                                       java.util.HashMap state,
                                       java.lang.Integer def,
                                       int flags,
                                       Pair anns)
                                throws java.io.IOException
Throws:
java.io.IOException

_nextExpression

protected java.lang.Object _nextExpression(java.io.PushbackReader is,
                                           java.util.HashMap state,
                                           java.lang.Integer def,
                                           int radix,
                                           int flags,
                                           Pair anns)
                                    throws java.io.IOException
Throws:
java.io.IOException

readList

public Value readList(java.io.PushbackReader is,
                      java.util.HashMap state,
                      java.lang.Integer def,
                      int flags,
                      Pair anns)
               throws java.io.IOException
Throws:
java.io.IOException

caseSensitive

protected final boolean caseSensitive(int flags)

produceAnnotations

protected final boolean produceAnnotations(int flags)

produceImmutables

protected final boolean produceImmutables(int flags)

readingVector

protected final boolean readingVector(int flags)

permissiveParsing

protected final boolean permissiveParsing(int flags)

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception