示例#1
0
 public Parser(StreamReader stream)
 {
     lexer = new Lexer(stream);
 }
 public Parser(StreamReader stream)
 {
     lexer = new Lexer(stream);
 }
示例#3
0
 public Parser(Lexer Lexer)
 {
     this.Lexer = Lexer;
 }
        public object Read(TextReader Reader, string Source)
        {
            LispRootAttribute RootAttrib = (LispRootAttribute)
                Attribute.GetCustomAttribute(RootType, typeof(LispRootAttribute));
            if(RootAttrib == null)
                throw new LispException("Type needs to have LispRoot attribute");

            Lexer Lexer = new Lexer(Reader);
            Parser Parser = new Parser(Lexer);

            List Root = Parser.Parse();
            Properties RootP = new Properties(Root);

            List List = null;
            if(!RootP.Get(RootAttrib.Name, ref List))
                throw new LispException("'" + Source + "' is not a " + RootAttrib.Name + " file");

            return ReadType(RootType, List);
        }