00001 00025 #ifndef __MAGIC_MLSYSTEM_H__ 00026 #define __MAGIC_MLSYSTEM_H__ 00027 00028 #include <magic/mobject.h> 00029 #include <magic/mstring.h> 00030 #include <magic/mpararr.h> 00031 00033 // // 00034 // | ---- | // 00035 // | | ) | ___ // 00036 // | |--- | | | / ) // 00037 // | | \ | | | |--- // 00038 // |____ | \ \__! | \__ // 00039 // // 00041 00044 class LRule : public Object { 00045 public: 00047 String left; 00048 00050 String right; 00051 00052 LRule () {;} 00053 00057 LRule (const String& l, const String& r) : left(l), right (r) {;} 00058 }; 00059 00060 00061 00063 // // 00064 // | ---- // 00065 // | | ___ ___ // 00066 // | | --- |/\ ___| |/|/| |/|/| ___| |/\ // 00067 // | | \ | ( | | | | | | | ( | | // 00068 // |____ |___/ | \__| | | | | | | \__| | // 00069 // // 00071 00074 class LGrammar : public Object { 00075 Array<LRule> rules; 00076 public: 00077 LGrammar () {;} 00078 00084 void addRule (const String& left, const String& right); 00085 00090 void applyTo (String& src, int times=1) const; 00091 }; 00092 00093 #endif 00094