Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /** \file lispparser.h
  2.  *  parsing and printing in the old-fashioned lisp style
  3.  *
  4.  */
  5.  
  6. #ifndef __lispparser_h__
  7. #define __lispparser_h__
  8.  
  9. #include "yacasbase.h"
  10. #include "lispobject.h"
  11. #include "tokenizer.h"
  12. #include "lispio.h"
  13. #include "lisphash.h"
  14. #include "evalfunc.h"
  15. class LispParser : public YacasBase
  16. {
  17. public:
  18.     LispParser(LispTokenizer& aTokenizer, LispInput& aInput,
  19.                LispEnvironment& aEnvironment);
  20.     virtual ~LispParser();
  21.     virtual void Parse(LispPtr& aResult );
  22. protected:
  23.     void ParseList(LispPtr& aResult);
  24.     void ParseAtom(LispPtr& aResult,LispString * aToken);
  25.  
  26. public:
  27.     LispTokenizer& iTokenizer;
  28.     LispInput& iInput;
  29.     LispEnvironment& iEnvironment;
  30.     LispInt iListed;
  31. };
  32.  
  33.  
  34.  
  35.  
  36. class LispPrinter : public YacasBase
  37. {
  38. public:
  39.     virtual ~LispPrinter();
  40.     virtual void Print(LispPtr& aExpression, LispOutput& aOutput, LispEnvironment& aEnvironment);
  41.     virtual void RememberLastChar(LispChar aChar);
  42. private:
  43.     void PrintExpression(LispPtr& aExpression, LispOutput& aOutput,
  44.                        LispEnvironment& aEnvironment,
  45.        LispInt aDepth=0);
  46.  
  47.     void Indent(LispOutput& aOutput, LispInt aDepth);
  48. };
  49.  
  50.  
  51. #endif
  52.