Ejemplo n.º 1
0
 public Parser(StreamReader stream)
 {
     lexer = new Lexer(stream);
 }
Ejemplo n.º 2
0
 public Parser(StreamReader stream)
 {
     lexer = new Lexer(stream);
 }
Ejemplo n.º 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);
        }