Beispiel #1
0
        internal Object readSymbolOrNumber(LocTextReader t, Int32 ch, Boolean firstInForm)
        {
            StringBuilder b = new StringBuilder();

            b.Append((Char)ch);
            Boolean complete = false;

            while (!complete)
            {
                ch = t.Peek();
                if (ch == -1)
                {
                    complete = true;
                }
                else if (Char.IsWhiteSpace((Char)ch))
                {
                    complete = true;
                }
                else
                {
                    ReaderMacro rm = (ReaderMacro)macroTable[(Char)ch];
                    if (rm != null && rm.isTerminating)
                    {
                        complete = true;
                    }
                    else
                    {
                        t.Read();
                        b.Append((Char)ch);
                    }
                }
            }
            return(parseSymbolOrNumber(b.ToString(), firstInForm));
        }
        internal Object doRead(LocTextReader t, Boolean firstInForm)
        {
            Int32 ch = t.Read();

            while (Char.IsWhiteSpace((Char)ch))
            {
                ch = t.Read();
            }
            if (ch == -1)
            {
                //return null;
                //return Symbol.EOF;
                return(EOF_MARKER);
            }
            if (ch == '#')
            {
                eatMultiComment(t);
                return(doRead(t, firstInForm));
            }
            if (ch == ';')
            {
                eatComment(t);
                return(doRead(t, firstInForm));
            }
            ReaderMacro rm = (ReaderMacro)macroTable[(Char)ch];

            if (rm != null)
            {
                return(rm.func(t, (Char)ch));
            }
            else
            {
                return(readSymbolOrNumber(t, ch, firstInForm));
            }
        }
Beispiel #3
0
        internal Object doRead(LocTextReader t, Boolean firstInForm)
        {
            //MEH: Converted the following from a while loop, and avoid checked build issues with ((Char)-1).
            Int32 ch;    // = t.Read();

            do
            {
                ch = t.Read();
                if (ch == -1)
                {
                    //return null;
                    //return Symbol.EOF;
                    return(EOF_MARKER);
                }
            }while(Char.IsWhiteSpace((Char)ch));
            if (ch == '#')
            {
                eatMultiComment(t);
                return(doRead(t, firstInForm));
            }
            if (ch == ';')
            {
                eatComment(t);
                return(doRead(t, firstInForm));
            }
            ReaderMacro rm = (ReaderMacro)macroTable[(Char)ch];

            if (rm != null)
            {
                return(rm.func(t, (Char)ch));
            }
            else
            {
                return(readSymbolOrNumber(t, ch, firstInForm));
            }
        }