Source code: org/alicebot/server/core/parser/DeprecatedAIMLParser.java
1 // Decompiled by Jad v1.5.8c. Copyright 2001 Pavel Kouznetsov.
2 // Jad home page: http://www.geocities.com/kpdus/jad.html
3 // Decompiler options: packimports(3)
4
5 package org.alicebot.server.core.parser;
6
7 import org.alicebot.server.core.util.Toolkit;
8
9 // Referenced classes of package org.alicebot.server.core.parser:
10 // UnknownDeprecatedAIMLException, XMLNode, TemplateParser
11
12 public class DeprecatedAIMLParser
13 {
14
15 public DeprecatedAIMLParser()
16 {
17 }
18
19 public static String processTag(int i, String s, XMLNode xmlnode, TemplateParser templateparser)
20 throws UnknownDeprecatedAIMLException
21 {
22 if(xmlnode.XMLData.equals("load") && xmlnode.XMLType == 1)
23 return templateparser.shortcutTag(i, "learn", 0, "", Toolkit.getAttributeValue("filename", xmlnode.XMLAttr), 2);
24 if(xmlnode.XMLData.equals("name") && xmlnode.XMLType == 1)
25 return templateparser.shortcutTag(i, "bot", 1, "name=\"name\"", "", 1);
26 if(xmlnode.XMLData.equals("justbeforethat") && xmlnode.XMLType == 1)
27 return templateparser.shortcutTag(i, "that", 1, "index=\"2,1\"", "", 1);
28 if(xmlnode.XMLData.equals("justthat") && xmlnode.XMLType == 1)
29 return templateparser.shortcutTag(i, "input", 1, "index=\"2\"", "", 1);
30 if(xmlnode.XMLData.equals("beforethat") && xmlnode.XMLType == 1)
31 return templateparser.shortcutTag(i, "input", 1, "index=\"3\"", "", 1);
32 if(xmlnode.XMLData.equals("getname") && xmlnode.XMLType == 1)
33 return templateparser.shortcutTag(i, "get", 1, "name=\"name\"", "", 1);
34 if(xmlnode.XMLData.equals("getsize") && xmlnode.XMLType == 1)
35 return templateparser.shortcutTag(i, "size", 1, "", "", 1);
36 if(xmlnode.XMLData.equals("gettopic") && xmlnode.XMLType == 1)
37 return templateparser.shortcutTag(i, "get", 1, "name=\"topic\"", "", 1);
38 if(xmlnode.XMLData.equals("getversion") && xmlnode.XMLType == 1)
39 return templateparser.shortcutTag(i, "version", 1, "", "", 1);
40 if(xmlnode.XMLData.equals("get_ip") && xmlnode.XMLType == 1)
41 return templateparser.shortcutTag(i, "id", 1, "", "", 1);
42 if(xmlnode.XMLData.equals("settopic") && xmlnode.XMLType == 0)
43 return templateparser.shortcutTag(i, "set", 0, "name=\"topic\"", templateparser.evaluate(i, xmlnode.XMLChild), 2);
44 if(xmlnode.XMLData.equals("setname") && xmlnode.XMLType == 0)
45 return templateparser.shortcutTag(i, "set", 0, "name=\"name\"", templateparser.evaluate(i, xmlnode.XMLChild), 2);
46 if(xmlnode.XMLData.indexOf("set_", 0) >= 0 && xmlnode.XMLType == 0)
47 return templateparser.shortcutTag(i, "set", 0, "name=\"" + xmlnode.XMLData.substring(xmlnode.XMLData.indexOf("_", 0) + 1, xmlnode.XMLData.length()) + "\"", templateparser.evaluate(i, xmlnode.XMLChild), 2);
48 if(xmlnode.XMLData.indexOf("get_", 0) >= 0 && xmlnode.XMLType == 1)
49 return templateparser.shortcutTag(i, "get", 1, "name=\"" + xmlnode.XMLData.substring(xmlnode.XMLData.indexOf("_", 0) + 1, xmlnode.XMLData.length()) + "\"", "", 2);
50 if(xmlnode.XMLData.equals("birthday") && xmlnode.XMLType == 1)
51 return templateparser.shortcutTag(i, "bot", 1, "name=\"birthday\"", "", 1);
52 if(xmlnode.XMLData.equals("birthplace") && xmlnode.XMLType == 1)
53 return templateparser.shortcutTag(i, "bot", 1, "name=\"birthplace\"", "", 1);
54 if(xmlnode.XMLData.equals("boyfriend") && xmlnode.XMLType == 1)
55 return templateparser.shortcutTag(i, "bot", 1, "name=\"boyfriend\"", "", 1);
56 if(xmlnode.XMLData.equals("favoriteband") && xmlnode.XMLType == 1)
57 return templateparser.shortcutTag(i, "bot", 1, "name=\"favoriteband\"", "", 1);
58 if(xmlnode.XMLData.equals("favoritebook") && xmlnode.XMLType == 1)
59 return templateparser.shortcutTag(i, "bot", 1, "name=\"favoritebook\"", "", 1);
60 if(xmlnode.XMLData.equals("favoritecolor") && xmlnode.XMLType == 1)
61 return templateparser.shortcutTag(i, "bot", 1, "name=\"favoritecolor\"", "", 1);
62 if(xmlnode.XMLData.equals("favoritefood") && xmlnode.XMLType == 1)
63 return templateparser.shortcutTag(i, "bot", 1, "name=\"favoritefood\"", "", 1);
64 if(xmlnode.XMLData.equals("favoritemovie") && xmlnode.XMLType == 1)
65 return templateparser.shortcutTag(i, "bot", 1, "name=\"favoritemovie\"", "", 1);
66 if(xmlnode.XMLData.equals("favoritesong") && xmlnode.XMLType == 1)
67 return templateparser.shortcutTag(i, "bot", 1, "name=\"favoritesong\"", "", 1);
68 if(xmlnode.XMLData.equals("for_fun") && xmlnode.XMLType == 1)
69 return templateparser.shortcutTag(i, "bot", 1, "name=\"forfun\"", "", 1);
70 if(xmlnode.XMLData.equals("friends") && xmlnode.XMLType == 1)
71 return templateparser.shortcutTag(i, "bot", 1, "name=\"friends\"", "", 1);
72 if(xmlnode.XMLData.equals("gender") && xmlnode.XMLType == 1)
73 return templateparser.shortcutTag(i, "bot", 1, "name=\"gender\"", "", 1);
74 if(xmlnode.XMLData.equals("girlfriend") && xmlnode.XMLType == 1)
75 return templateparser.shortcutTag(i, "bot", 1, "name=\"girlfriend\"", "", 1);
76 if(xmlnode.XMLData.equals("kind_music") && xmlnode.XMLType == 1)
77 return templateparser.shortcutTag(i, "bot", 1, "name=\"kindmusic\"", "", 1);
78 if(xmlnode.XMLData.equals("location") && xmlnode.XMLType == 1)
79 return templateparser.shortcutTag(i, "bot", 1, "name=\"location\"", "", 1);
80 if(xmlnode.XMLData.equals("look_like") && xmlnode.XMLType == 1)
81 return templateparser.shortcutTag(i, "bot", 1, "name=\"looklike\"", "", 1);
82 if(xmlnode.XMLData.equals("botmaster") && xmlnode.XMLType == 1)
83 return templateparser.shortcutTag(i, "bot", 1, "name=\"master\"", "", 1);
84 if(xmlnode.XMLData.equals("question") && xmlnode.XMLType == 1)
85 return templateparser.shortcutTag(i, "bot", 1, "name=\"question\"", "", 1);
86 if(xmlnode.XMLData.equals("sign") && xmlnode.XMLType == 1)
87 return templateparser.shortcutTag(i, "bot", 1, "name=\"sign\"", "", 1);
88 if(xmlnode.XMLData.equals("talk_about") && xmlnode.XMLType == 1)
89 return templateparser.shortcutTag(i, "bot", 1, "name=\"talkabout\"", "", 1);
90 if(xmlnode.XMLData.equals("wear") && xmlnode.XMLType == 1)
91 return templateparser.shortcutTag(i, "bot", 1, "name=\"wear\"", "", 1);
92 else
93 throw new UnknownDeprecatedAIMLException();
94 }
95
96 private static final String EMPTY_STRING = "";
97 private static final String FILENAME = "filename";
98 private static final String ATTR_NAME_NAME = "name=\"name\"";
99 private static final String ATTR_INDEX_2_1 = "index=\"2,1\"";
100 private static final String ATTR_INDEX_2 = "index=\"2\"";
101 private static final String ATTR_INDEX_3 = "index=\"3\"";
102 private static final String ATTR_NAME_TOPIC = "name=\"topic\"";
103 private static final String NAME_EQUALS_QUOTE = "name=\"";
104 private static final String UNDERSCORE = "_";
105 public static final String QUOTE_MARK = "\"";
106 public static final String ALICE = "alice";
107 public static final String NAME = "name";
108 public static final String JUSTBEFORETHAT = "justbeforethat";
109 public static final String JUSTTHAT = "justthat";
110 public static final String BEFORETHAT = "beforethat";
111 public static final String GET_OLD = "get_";
112 public static final String GET_IP = "get_ip";
113 public static final String GETNAME = "getname";
114 public static final String GETSIZE = "getsize";
115 public static final String GETTOPIC = "gettopic";
116 public static final String GETVERSION = "getversion";
117 public static final String LOAD = "load";
118 public static final String SETTOPIC = "settopic";
119 public static final String SETNAME = "setname";
120 public static final String SET_OLD = "set_";
121 public static final String BIRTHDAY = "birthday";
122 public static final String BIRTHPLACE = "birthplace";
123 public static final String BOYFRIEND = "boyfriend";
124 public static final String FAVORITEBAND = "favoriteband";
125 public static final String FAVORITEBOOK = "favoritebook";
126 public static final String FAVORITECOLOR = "favoritecolor";
127 public static final String FAVORITEFOOD = "favoritefood";
128 public static final String FAVORITEMOVIE = "favoritemovie";
129 public static final String FAVORITESONG = "favoritesong";
130 public static final String FOR_FUN = "for_fun";
131 public static final String FRIENDS = "friends";
132 public static final String GENDER = "gender";
133 public static final String GIRLFRIEND = "girlfriend";
134 public static final String KIND_MUSIC = "kind_music";
135 public static final String LOCATION = "location";
136 public static final String LOOK_LIKE = "look_like";
137 public static final String BOTMASTER = "botmaster";
138 public static final String QUESTION = "question";
139 public static final String SIGN = "sign";
140 public static final String TALK_ABOUT = "talk_about";
141 public static final String WEAR = "wear";
142 }