MCPcopy Create free account
hub / github.com/demoth/jake2 / Parse

Method Parse

qcommon/src/main/java/jake2/qcommon/Com.java:171–234  ·  view source on GitHub ↗
(ParseHelp hlp)

Source from the content-addressed store, hash-verified

169
170 // See GameSpanw.ED_ParseEdict() to see how to use it now.
171 @Deprecated
172 public static String Parse(ParseHelp hlp) {
173 int c;
174 int len = 0;
175
176 if (hlp.data == null) {
177 return "";
178 }
179
180 while (true) {
181 // skip whitespace
182 hlp.skipwhites();
183 if (hlp.isEof()) {
184 hlp.data = null;
185 return "";
186 }
187
188 // skip // comments
189 if (hlp.getchar() == '/') {
190 if (hlp.nextchar() == '/') {
191 hlp.skiptoeol();
192 // goto skip whitespace
193 continue;
194 } else {
195 hlp.prevchar();
196 break;
197 }
198 } else
199 break;
200 }
201
202 // handle quoted strings specially
203 if (hlp.getchar() == '\"') {
204 hlp.nextchar();
205 while (true) {
206 c = hlp.getchar();
207 hlp.nextchar();
208 if (c == '\"' || c == 0) {
209 return new String(com_token, 0, len);
210 }
211 if (len < Defines.MAX_TOKEN_CHARS) {
212 com_token[len] = (char) c;
213 len++;
214 }
215 }
216 }
217
218 // parse a regular word
219 c = hlp.getchar();
220 do {
221 if (len < Defines.MAX_TOKEN_CHARS) {
222 com_token[len] = (char) c;
223 len++;
224 }
225 c = hlp.nextchar();
226 } while (c > 32);
227
228 if (len == Defines.MAX_TOKEN_CHARS) {

Callers 12

ED_ParseEdictMethod · 0.95
StartServer_MenuInitMethod · 0.95
testParseHelpNullMethod · 0.95
testParseHelpMethod · 0.95
MacroExpandStringMethod · 0.95
TokenizeStringMethod · 0.95

Calls 7

PrintfMethod · 0.95
skipwhitesMethod · 0.45
isEofMethod · 0.45
getcharMethod · 0.45
nextcharMethod · 0.45
skiptoeolMethod · 0.45
prevcharMethod · 0.45

Tested by 8

testParseHelpNullMethod · 0.76
testParseHelpMethod · 0.76