View Javadoc

1   /* The following code was generated by JFlex 1.4.3 on 5/19/14 4:43 AM */
2   
3   
4   
5   // generated by yylex.xsl from PogamutUT2004\src\gb3\messages\FlexGenerator.xslt, called from ant script build.xml
6   // file was further processed by JFlex to create class Yylex (yylex.java)
7   
8   package cz.cuni.amis.pogamut.ut3.communication.messages.gbinfomessages;
9   
10  import java.io.Reader;
11  
12  // imports from MessageObjectsList.xml/gbmessages/settings/jflexsettings/javaimport
13  import java.util.*;
14  import javax.vecmath.*;
15  import cz.cuni.amis.pogamut.base.communication.translator.*;
16  import cz.cuni.amis.pogamut.base.communication.translator.event.*;
17  import cz.cuni.amis.pogamut.ut2004.communication.translator.itemdescriptor.*;
18  import cz.cuni.amis.pogamut.base.communication.parser.*;
19  import cz.cuni.amis.pogamut.base.communication.parser.exception.*;
20  import cz.cuni.amis.pogamut.base.communication.parser.impl.yylex.*;
21  import cz.cuni.amis.pogamut.base.communication.messages.*;
22  import cz.cuni.amis.pogamut.base.communication.worldview.*;
23  import cz.cuni.amis.pogamut.base.communication.worldview.event.*;
24  import cz.cuni.amis.pogamut.base.communication.worldview.object.*;
25  import cz.cuni.amis.pogamut.base3d.worldview.object.*;
26  import cz.cuni.amis.pogamut.base3d.worldview.object.event.*;
27  import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;
28  import cz.cuni.amis.pogamut.ut2004.communication.parser.*;
29  import cz.cuni.amis.pogamut.ut2004.communication.messages.*;
30  import cz.cuni.amis.pogamut.ut2004.communication.messages.ItemType.Category;
31  import cz.cuni.amis.pogamut.ut2004.communication.worldview.objects.*;
32  import cz.cuni.amis.pogamut.ut2004.utils.UnrealUtils;
33  import java.lang.reflect.Method;
34  import cz.cuni.amis.utils.exception.*;
35  import cz.cuni.amis.pogamut.multi.agent.*;
36  
37  
38  
39  // beggining of the yylex definition
40  
41  /**
42   * This class is a scanner generated by 
43   * <a href="http://www.jflex.de/">JFlex</a> 1.4.3
44   * on 5/19/14 4:43 AM from the specification file
45   * <tt>/mnt/jenkins/var/lib/jenkins/jobs/PogamutUT3 (deploy site)/workspace/src/main/jflex/GB3Parser.jflex</tt>
46   */
47  public class Yylex implements IUT2004Yylex {
48  
49    /** This character denotes the end of file */
50    public static final int YYEOF = -1;
51  
52    /** initial size of the lookahead buffer */
53    private static final int ZZ_BUFFERSIZE = 16384;
54  
55    /** lexical states */
56    public static final int MSG_BEG = 8;
57    public static final int UNPROCESSED_MESSAGE = 2;
58    public static final int YYINITIAL = 0;
59    public static final int MSG_ALIVE = 6;
60    public static final int MSG_EMP = 4;
61  
62    /**
63     * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
64     * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
65     *                  at the beginning of a line
66     * l is of the form l = 2*k, k a non negative integer
67     */
68    private static final int ZZ_LEXSTATE[] = { 
69       0,  0,  1,  1,  2,  2,  3,  3,  4, 4
70    };
71  
72    /** 
73     * Translates characters to character classes
74     */
75    private static final String ZZ_CMAP_PACKED = 
76      "\10\0\2\3\1\5\2\0\1\4\22\0\1\23\13\0\1\0\1\7"+
77      "\1\6\1\0\12\2\7\0\1\27\1\33\2\1\1\24\1\15\1\34"+
78      "\1\1\1\31\2\1\1\30\1\25\2\1\1\26\3\1\1\11\1\40"+
79      "\1\32\4\1\4\0\1\0\1\0\1\16\2\1\1\42\1\14\1\15"+
80      "\2\1\1\36\2\1\1\17\1\37\1\1\1\22\1\41\1\1\1\12"+
81      "\1\20\1\21\1\13\5\1\1\35\1\0\1\10\uff82\0";
82  
83    /** 
84     * Translates characters to character classes
85     */
86    private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
87  
88    /** 
89     * Translates DFA states to action switch labels.
90     */
91    private static final int [] ZZ_ACTION = zzUnpackAction();
92  
93    private static final String ZZ_ACTION_PACKED_0 =
94      "\5\1\1\2\1\1\2\3\3\1\3\4\3\5\4\6"+
95      "\4\7\1\10\3\1\4\0\1\11\1\1\1\12\4\0"+
96      "\1\1\1\13\3\0\1\14\16\0\1\15\1\0\1\16"+
97      "\14\0\1\17";
98  
99    private static int [] zzUnpackAction() {
100     int [] result = new int[77];
101     int offset = 0;
102     offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
103     return result;
104   }
105 
106   private static int zzUnpackAction(String packed, int offset, int [] result) {
107     int i = 0;       /* index in packed string  */
108     int j = offset;  /* index in unpacked array */
109     int l = packed.length();
110     while (i < l) {
111       int count = packed.charAt(i++);
112       int value = packed.charAt(i++);
113       do result[j++] = value; while (--count > 0);
114     }
115     return j;
116   }
117 
118 
119   /** 
120    * Translates a state to a row index in the transition table
121    */
122   private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
123 
124   private static final String ZZ_ROWMAP_PACKED_0 =
125     "\0\0\0\43\0\106\0\151\0\214\0\257\0\322\0\257"+
126     "\0\365\0\u0118\0\u013b\0\u015e\0\257\0\322\0\u0181\0\257"+
127     "\0\322\0\365\0\257\0\322\0\365\0\u01a4\0\257\0\322"+
128     "\0\365\0\u01c7\0\257\0\u01ea\0\u020d\0\u0230\0\u0253\0\u0276"+
129     "\0\u0299\0\u02bc\0\322\0\u02df\0\322\0\u0302\0\u0325\0\u0348"+
130     "\0\u036b\0\u038e\0\257\0\u03b1\0\u03d4\0\u03f7\0\322\0\u041a"+
131     "\0\u043d\0\u0460\0\u0483\0\u04a6\0\u04c9\0\u04ec\0\u050f\0\u0532"+
132     "\0\u0555\0\u0578\0\u059b\0\u05be\0\u05e1\0\257\0\u0604\0\257"+
133     "\0\u0627\0\u064a\0\u066d\0\u0690\0\u06b3\0\u06d6\0\u06f9\0\u071c"+
134     "\0\u073f\0\u0762\0\u0785\0\u07a8\0\257";
135 
136   private static int [] zzUnpackRowMap() {
137     int [] result = new int[77];
138     int offset = 0;
139     offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
140     return result;
141   }
142 
143   private static int zzUnpackRowMap(String packed, int offset, int [] result) {
144     int i = 0;  /* index in packed string  */
145     int j = offset;  /* index in unpacked array */
146     int l = packed.length();
147     while (i < l) {
148       int high = packed.charAt(i++) << 16;
149       result[j++] = high | packed.charAt(i++);
150     }
151     return j;
152   }
153 
154   /** 
155    * The transition table of the DFA
156    */
157   private static final int [] ZZ_TRANS = zzUnpackTrans();
158 
159   private static final String ZZ_TRANS_PACKED_0 =
160     "\1\6\2\7\1\10\1\11\1\10\3\6\12\7\1\10"+
161     "\1\12\2\7\1\13\3\7\1\14\1\7\1\6\5\7"+
162     "\1\15\2\16\1\10\1\11\1\10\3\15\12\16\1\10"+
163     "\11\16\1\17\5\16\1\20\2\21\1\20\1\22\1\10"+
164     "\3\20\12\21\1\20\11\21\1\20\5\21\1\23\2\24"+
165     "\1\23\1\25\1\10\3\23\12\24\1\23\11\24\1\26"+
166     "\5\24\1\27\2\30\1\27\1\31\1\10\3\27\12\30"+
167     "\1\27\11\30\1\32\5\30\44\0\2\7\6\0\12\7"+
168     "\1\0\11\7\1\0\5\7\5\0\1\33\36\0\2\7"+
169     "\6\0\12\7\1\0\1\7\1\34\7\7\1\0\5\7"+
170     "\1\0\2\7\6\0\12\7\1\0\4\7\1\35\4\7"+
171     "\1\0\5\7\1\0\2\7\6\0\12\7\1\0\1\36"+
172     "\10\7\1\0\5\7\10\37\1\0\32\37\11\0\1\40"+
173     "\42\0\1\41\20\0\1\42\11\0\2\7\6\0\12\7"+
174     "\1\0\2\7\1\43\6\7\1\0\5\7\1\0\2\7"+
175     "\6\0\12\7\1\0\5\7\1\44\3\7\1\0\5\7"+
176     "\1\0\2\7\6\0\12\7\1\0\10\7\1\45\1\0"+
177     "\5\7\10\37\1\0\12\37\1\46\17\37\36\0\1\47"+
178     "\42\0\1\50\42\0\1\51\5\0\2\7\6\0\12\7"+
179     "\1\0\6\7\1\52\2\7\1\0\5\7\10\46\1\53"+
180     "\32\46\37\0\1\54\42\0\1\55\23\0\1\56\23\0"+
181     "\2\7\6\0\12\7\1\0\1\57\10\7\1\0\5\7"+
182     "\14\0\1\60\42\0\1\61\66\0\1\62\25\0\1\63"+
183     "\42\0\1\64\60\0\1\65\3\0\1\66\3\0\1\67"+
184     "\1\70\35\0\1\71\3\0\1\72\1\73\75\0\1\74"+
185     "\2\0\1\66\3\0\1\75\1\0\1\76\34\0\1\75"+
186     "\42\0\1\66\3\0\1\67\36\0\1\71\3\0\1\77"+
187     "\1\0\1\100\34\0\1\77\42\0\1\71\3\0\1\72"+
188     "\52\0\1\101\26\0\1\75\5\0\1\76\34\0\1\77"+
189     "\5\0\1\100\53\0\1\102\35\0\1\103\51\0\1\104"+
190     "\30\0\1\105\3\0\1\106\3\0\1\105\33\0\1\107"+
191     "\46\0\1\110\37\0\1\111\46\0\1\112\37\0\1\113"+
192     "\46\0\1\114\32\0\1\115\46\0\1\113\5\0\1\113"+
193     "\20\0";
194 
195   private static int [] zzUnpackTrans() {
196     int [] result = new int[1995];
197     int offset = 0;
198     offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
199     return result;
200   }
201 
202   private static int zzUnpackTrans(String packed, int offset, int [] result) {
203     int i = 0;       /* index in packed string  */
204     int j = offset;  /* index in unpacked array */
205     int l = packed.length();
206     while (i < l) {
207       int count = packed.charAt(i++);
208       int value = packed.charAt(i++);
209       value--;
210       do result[j++] = value; while (--count > 0);
211     }
212     return j;
213   }
214 
215 
216   /* error codes */
217   private static final int ZZ_UNKNOWN_ERROR = 0;
218   private static final int ZZ_NO_MATCH = 1;
219   private static final int ZZ_PUSHBACK_2BIG = 2;
220 
221   /* error messages for the codes above */
222   private static final String ZZ_ERROR_MSG[] = {
223     "Unkown internal scanner error",
224     "Error: could not match input",
225     "Error: pushback value was too large"
226   };
227 
228   /**
229    * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
230    */
231   private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
232 
233   private static final String ZZ_ATTRIBUTE_PACKED_0 =
234     "\5\1\1\11\1\1\1\11\4\1\1\11\2\1\1\11"+
235     "\2\1\1\11\3\1\1\11\3\1\1\11\3\1\4\0"+
236     "\3\1\4\0\1\1\1\11\3\0\1\1\16\0\1\11"+
237     "\1\0\1\11\14\0\1\11";
238 
239   private static int [] zzUnpackAttribute() {
240     int [] result = new int[77];
241     int offset = 0;
242     offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
243     return result;
244   }
245 
246   private static int zzUnpackAttribute(String packed, int offset, int [] result) {
247     int i = 0;       /* index in packed string  */
248     int j = offset;  /* index in unpacked array */
249     int l = packed.length();
250     while (i < l) {
251       int count = packed.charAt(i++);
252       int value = packed.charAt(i++);
253       do result[j++] = value; while (--count > 0);
254     }
255     return j;
256   }
257 
258   /** the input device */
259   private java.io.Reader zzReader;
260 
261   /** the current state of the DFA */
262   private int zzState;
263 
264   /** the current lexical state */
265   private int zzLexicalState = YYINITIAL;
266 
267   /** this buffer contains the current text to be matched and is
268       the source of the yytext() string */
269   private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
270 
271   /** the textposition at the last accepting state */
272   private int zzMarkedPos;
273 
274   /** the current text position in the buffer */
275   private int zzCurrentPos;
276 
277   /** startRead marks the beginning of the yytext() string in the buffer */
278   private int zzStartRead;
279 
280   /** endRead marks the last character in the buffer, that has been read
281       from input */
282   private int zzEndRead;
283 
284   /** number of newlines encountered up to the start of the matched text */
285   private int yyline;
286 
287   /** the number of characters up to the start of the matched text */
288   private int yychar;
289 
290   /**
291    * the number of characters from the last newline up to the start of the 
292    * matched text
293    */
294   private int yycolumn;
295 
296   /** 
297    * zzAtBOL == true <=> the scanner is currently at the beginning of a line
298    */
299   private boolean zzAtBOL = true;
300 
301   /** zzAtEOF == true <=> the scanner is at the EOF */
302   private boolean zzAtEOF;
303 
304   /** denotes if the user-EOF-code has already been executed */
305   private boolean zzEOFDone;
306 
307   /* user code: */
308 	
309  	public static final String DELIMITERS_STANDARD = " {}";
310  	public static final String DELIMITERS_EXTENDED = " {},";
311 
312 	/** Map for list of String, Double */
313 	protected Map<Integer, Double> mapIntIDDouble = null;
314 
315 	/** Map for list of String, Double */
316 	protected Map<Integer, Double> mapIntDouble = null;
317 	
318 	/** parser reference, this parser will be used for translation of UnrealID to IntID */
319 	protected UnrealIdTranslator translator = null;
320 	
321 	/** object that is used to translate messages into objects */ 
322 	protected ItemTranslator itemTranslator = null;
323 	
324 	/** observer for the yylex for reporting exceptions */	
325 	protected IYylexObserver observer = null;
326 	
327 	/** object that is used to translate strings into item types */
328 	protected ItemTypeTranslator itemTypeTranslator;
329 	
330 	/** time in the UT2004 */	
331 	protected double ut2004Time = 0;
332 	
333 	public Yylex(){
334 	}
335 	
336 	public void setReader(Reader reader) {
337 		yyreset(reader);
338 	}
339 	
340 	public void close() throws java.io.IOException {
341 		yyclose();
342 	}
343 	
344 	public void setItemTranslator(ItemTranslator translator) {
345 		this.itemTranslator = translator;
346 	}
347 	
348 	@Override
349 	public void setItemTypeTranslator(ItemTypeTranslator translator) {
350 		this.itemTypeTranslator = translator;
351 	}
352 	
353 	public void setObserver(IYylexObserver observer) {
354 		this.observer = observer;
355 	}
356 	
357 	/**
358 	 * Set parser translating UnrealID to IntID.
359 	 * This function should be called after constructor, I dont know how to define constructor, so this will do.
360 	 */
361 	public void setTranslator(UnrealIdTranslator translator) {
362 		this.translator = translator;
363 	}
364 	
365 	public void setTime(IWorldObjectUpdatedEvent obj, double time) {
366        //we have to multiply by 1000 to convert from floats to longs, larger number is not required because of the way GB2004 work
367        setPropertyByReflection( obj, "SimTime", long.class, (long)(ut2004Time*1000) );
368 	}
369 	
370 	public void setTime(IWorldEvent obj, double time) {
371 	   //we have to multiply by 1000 to convert from floats to longs, larger number is not required because of the way GB2004 work
372 	   setPropertyByReflection( obj, "SimTime", long.class, (long)(ut2004Time*1000) );
373 	}
374 	
375 	/** Set property of an object by reflection
376 	 * 
377 	 * Setter method name is expected to follow name convention "set<PropertyName>", where the first letter of property name is upper case.
378 	 * Potential access restriction of the setter method is overriden via reflection.
379 	 * 
380 	 * @param object the object
381 	 * @param propertyName property name
382 	 * @param valueType property value / setter argument type
383 	 * @param value value to set
384 	 */
385 	protected <T> void setPropertyByReflection( Object object, String propertyName, Class<T> valueType, T value ) {
386 	    try {
387             Method m = null;
388             // we have to look for definition in each ancestor starting with the class itself
389             Class<?> ancestorClass = object.getClass();
390             Class<?>[] argumentTypes = new Class[]{valueType};
391             String setterName = "set"+propertyName.substring( 0, 1 ).toUpperCase()+propertyName.substring( 1 );
392             while ( m == null ) {
393 	            try {
394 	                m = ancestorClass.getDeclaredMethod( setterName, argumentTypes );
395 	            } catch ( NoSuchMethodException e ) {
396 	                ancestorClass = ancestorClass.getSuperclass();
397 	                if ( ancestorClass == null ) {
398 	                    throw e;
399 	                }
400 	            }
401 	        }
402             m.setAccessible( true );
403             m.invoke( object, value );
404         } catch (Exception e) {
405             exceptionOccured(e, "Can't set "+propertyName+" to message " + object.getClass() );
406         }
407 	}
408 	
409 	/**
410 	 * Logs the exception if observer present, or print it to System.out.
411 	 * <BR><BR>
412 	 * Does not throw the exception...
413 	 * <BR><BR>
414 	 * If exception 'e' is null, only info message is written to logs.
415 	 * @param e
416 	 * @param info	 
417 	 */
418 	protected void exceptionOccured(Exception e, String info) {
419 		IYylexObserver currentObserver = this.observer;
420 		if (currentObserver != null) {			
421 			currentObserver.exception(e, info != null ? info : "--empty info--");
422 		} else {
423 			System.out.println("Yylex exception: " + info);
424 			if (e != null) e.printStackTrace(); 
425 		}
426 	}
427 	
428 	/**
429 	 * Send the warning to observer or prints it to the console.
430 	 */
431 	protected void warning(String info) {
432 		IYylexObserver currentObserver = this.observer;
433 		if (currentObserver != null) {			
434 			currentObserver.warning(info != null ? info : "--empty warning--");
435 		} else {
436 			System.out.println("Yylex warning: " + info);			 
437 		}
438 	}
439 	
440 	/**
441      * This method should be overriden to parse additional messages, that are not part of PogamutUDK Core.
442      * This method is called whenever the parser meets a message name it does not recognize. If the message is 
443      * recognized by overriding class, it should return new instance of a message the name represents. Otherwise it should return null.
444      * The newly created message is then accesible for parameter setting via {@link #getParsedObject() }.
445      * For further discussion on how this is done see <a href="http://pogamut.cuni.cz/pogamut-devel/doku.php?id=guidelines:adding_gamebots_message_to_pogamut_java">wiki article</a>.
446      * @param messageName
447      * @see #tryParsingUnprocessedMessageParameter(java.lang.String, java.lang.String) 
448      * @return New message or null if not recognized
449      */                       
450     protected InfoMessage tryParsingUnprocessedMessage(String messageName){
451         return null;
452     }
453         
454     /**
455      * This method should be overridden to parse parameters of additional messages that are not part of PogamuUDK Core.
456      * Once the message was recognized by {@link #tryParsingUnprocessedMessage(java.lang.String) } this method
457      * is called for every parameter.
458      * @param paramName The name of the parameter as appeared in the Gamebots message
459      * @param wholeParamText Whole text of the parameter part of message (contains the param name) - this string can be directly passed to 
460      * xxxValue methods of this class to obtain translated values for basically all usable datatypes. If this is not enough, use {@link #getToken(java.lang.String, int) } 
461      * to extract desired part of the message text (the value has index 1)
462      * @see #tryParsingUnprocessedMessage(java.lang.String) 
463      * @return 
464      */        
465     protected boolean tryParsingUnprocessedMessageParameter(String paramName, String wholeParamText){
466         return false;
467     }
468         
469 	/**
470 	 * Returns 'num'-th token from 'text' using 'delimiters'.
471 	 * <BR><BR>
472 	 * Use only IFF you're getting only one token from 'text'.
473 	 * @param text
474 	 * @param delimiters
475 	 * @return String token
476 	 */ 
477 	protected String getToken(String text, String delimiters, int num) {
478 		StringTokenizer st = new StringTokenizer(text, delimiters);
479 		while (num-- > 0 && st.hasMoreTokens()) {
480 			st.nextToken();
481 		}
482 		try {
483 			return st.nextToken();
484 		} catch (Exception e) {
485 			exceptionOccured(e, "Can't get " + num + "-th token from text '"+text+"' using delimiters '"+delimiters+"'.");
486 			return null;
487 		}
488 	}
489 	
490 	/**
491 	 * Returns 'num'-th token from 'text' using DELIMITERS_STANDARD.
492 	 * <BR><BR>
493 	 * Use only IFF you're getting only one token from 'text'.
494 	 * @param text
495 	 * @return String token
496 	 */ 
497 	protected String getToken(String text, int num) {
498 		return getToken(text, DELIMITERS_STANDARD, num);		
499 	}
500 
501 	/**
502 	 * Return an integer from num token in txt.
503 	 * <BR><BR>
504 	 * Integer token is expected to be 'second token' in the 'txt' using delimiters " {}".
505 	 * 
506 	 * @param  txt  text of parameter
507 	 * @return Integer from given token.
508 	 */
509 	protected int intValue( String txt  ) {
510 		if (txt == null || txt.toLowerCase().equals("none")) return UnrealUtils.iNT_NONE;
511 		try {
512         	return Integer.parseInt(getToken(txt, 1));
513         } catch (NullPointerException e) {
514         	warning("Can't get int token from text '"+txt+"'.");
515         	return -1;
516         } catch (NumberFormatException e) {
517         	exceptionOccured(e, "Wrong int number format in '"+txt+".");
518         	return -1; 
519         } catch (Exception e) {
520         	exceptionOccured(e, "Can't get int token from text '"+txt+"'.");
521         	return -1;
522         }
523 	}
524 	
525 	/**
526 	 * Return a long from num token in txt.
527 	 * <BR><BR>
528 	 * Long token is expected to be 'second token' in the 'txt' using delimiters " {}".
529 	 * 
530 	 * @param  txt  text of parameter
531 	 * @return Integer from given token.
532 	 */
533 	protected long longValue( String txt  ) {
534 		if (txt == null || txt.toLowerCase().equals("none")) return UnrealUtils.lONG_NONE;
535 		try {
536         	return Long.parseLong(getToken(txt, 1));
537         } catch (NullPointerException e) {
538         	warning("Can't get long token from text '"+txt+"'.");
539         	return -1;
540         } catch (NumberFormatException e) {
541         	exceptionOccured(e, "Wrong long number format in '"+txt+".");
542         	return -1; 
543         } catch (Exception e) {
544         	exceptionOccured(e, "Can't get long token from text '"+txt+"'.");
545         	return -1;
546         }
547 	}
548 	
549 	/**
550 	 * Return an integer from num token in txt.
551 	 * <BR><BR>
552 	 * Integer token is expected to be 'second token' in the 'txt' using delimiters " {}".
553 	 * 
554 	 * @param  txt  text of parameter
555 	 * @return Integer from given token.
556 	 */
557 	protected Integer integerValue( String txt  ) {
558 		if (txt == null || txt.toLowerCase().equals("none")) return UnrealUtils.INT_NONE;
559 		try {
560         	return Integer.parseInt(getToken(txt, 1));
561         } catch (NullPointerException e) {
562         	warning("Can't get int token from text '"+txt+"'.");
563         	return null;
564         } catch (NumberFormatException e) {
565         	exceptionOccured(e, "Wrong int number format in '"+txt+".");
566         	return null; 
567         } catch (Exception e) {
568         	exceptionOccured(e, "Can't get int token from text '"+txt+"'.");
569         	return null;
570         }
571 	}
572 
573 	
574 	/**
575 	 * Return a double from num token in txt.
576 	 * <BR><BR>
577 	 * Num token is expected to be 'second token' in the 'txt' using delimiters " {}".	 
578 	 * 
579 	 * @param  txt  text of parameter
580 	 * @return Double from given token.
581 	 */
582 	protected double doubleValue(String txt) {
583 		if (txt == null || txt.toLowerCase().equals("none")) return UnrealUtils.dOUBLE_NONE;
584 		try {
585         	return Double.parseDouble(getToken(txt, 1));
586         } catch (NullPointerException e) {
587         	warning("Can't get double token from text '"+txt+"'.");
588         	return -1;
589         } catch (NumberFormatException e) {
590         	exceptionOccured(e, "Wrong double number format in '"+txt+".");
591         	return -1; 
592         } catch (Exception e) {
593         	exceptionOccured(e, "Can't get double token from text '"+txt+"'.");
594         	return -1;
595         }
596 	}
597 	
598 	/**
599 	 * Return a float from num token in txt.
600 	 * <BR><BR>
601 	 * Num token is expected to be 'second token' in the 'txt' using delimiters " {}".	 
602 	 * 
603 	 * @param  txt  text of parameter
604 	 * @return Float from given token.
605 	 */
606 	protected float floatValue(String txt) {
607 		if (txt == null || txt.toLowerCase().equals("none")) return UnrealUtils.fLOAT_NONE;
608 		try {
609         	return Float.parseFloat(getToken(txt, 1));
610         } catch (NullPointerException e) {
611         	warning("Can't get float token from text '"+txt+"'.");
612         	return -1;
613         } catch (NumberFormatException e) {
614         	exceptionOccured(e, "Wrong float number format in '"+txt+".");
615         	return -1; 
616         } catch (Exception e) {
617         	exceptionOccured(e, "Can't get float token from text '"+txt+"'.");
618         	return -1;
619         }
620 	}
621 	
622     /**
623 	 * Return a triple (double[]{x,y,z})
624 	 * starting from num token(tokens are separated by space) in 'txt'
625 	 * 
626 	 * @param  txt  text of parameter
627 	 * @return Array of three doubles from given token.
628 	 */
629 	protected double[] getTriple( String txt ) {
630 		StringTokenizer st = new StringTokenizer(txt, DELIMITERS_EXTENDED);
631 		
632 		int num = 1;
633 		while (num-- > 0 && st.hasMoreTokens()) {
634 			st.nextToken();
635 		}
636 		
637 		// now we should have an token with integer
638 		try {
639 			double t1,t2,t3;
640 			t1 = new Double(st.nextToken()).doubleValue();
641 			t2 = new Double(st.nextToken()).doubleValue();
642 			t3 = new Double(st.nextToken()).doubleValue();
643         	return new double[]{t1,t2,t3};
644         } catch (NumberFormatException e) {
645         	exceptionOccured(e, "Wrong double number format in '"+txt+".");
646         	return null; 
647         } catch (Exception e) {
648         	exceptionOccured(e, "Can't get triple from text '"+txt+"'.");
649         	return null;
650         }
651 	}
652 	
653 	/**
654 	 * Return a Location instance starting from num token(tokens are separated by space) in txt
655 	 * 
656 	 * @param  txt  text of parameter
657 	 * @return Location from given token.
658 	 */
659 	protected Location locationValue(String txt) {
660 		if (txt == null || txt.toLowerCase().equals("none")) return Location.NONE;		
661 		double[] triple = getTriple(txt);
662 		try {
663 			return new Location(triple[0], triple[1], triple[2]);
664 		} catch (NullPointerException e) {
665 			warning("Can't get Location from text '"+txt+"'.");
666 			return Location.ZERO;
667 		} catch (Exception e) {
668 			exceptionOccured(e, "Can't get Location from text '"+txt+"'.");
669 			return null;
670 		}
671 	}
672 	
673 	/**
674      * Return an ItemType instance.
675      * 
676      * @param  txt  text of parameter
677      * @return ItemType from given token.
678      */
679     protected ItemType itemTypeValue(String txt) {
680         return itemTypeTranslator.get(getToken(txt, 1));
681     }
682     
683     protected ItemDescriptor itemDescriptorValue(ItemType type) {
684     	return itemTranslator.getDescriptor(type);
685     }
686     
687     /**
688      * Return a Category of the item.
689      * @param  txt  text of parameter
690      * @return ItemType.Category from given token.
691      */ 
692     protected ItemType.Category categoryValue(String txt) {
693     	if (txt == null || txt.toLowerCase().equals("none")) return ItemType.Category.NONE;
694     	try {
695     		return ItemType.Category.valueOf(getToken(txt, 1).toUpperCase());
696     	} catch (IllegalArgumentException e) {
697     		return ItemType.Category.OTHER;
698     	}
699     }
700 	
701 	/**
702 	 * Return a Velocity instance starting from num token(tokens are separated by space) in txt
703 	 * 
704 	 * @param  txt  text of parameter
705 	 * @return Velocity from given token.
706 	 */
707 	protected Velocity velocityValue(String txt) {
708 		if (txt == null || txt.toLowerCase().equals("none")) return Velocity.NONE;
709 		double[] triple = getTriple(txt);
710 		try {
711 			return new Velocity(triple[0], triple[1], triple[2]);
712 		} catch (NullPointerException e) {
713 			warning("Can't get Velocity from text '"+txt+"'.");
714 			return Velocity.ZERO;
715 		} catch (Exception e) {
716 			exceptionOccured(e, "Can't get Velocity from text '"+txt+"'.");
717 			return null;
718 		}
719 	}
720 
721 	/**
722 	 * Return a Rotation instance starting from num token(tokens are separated by space) in txt
723 	 * 
724 	 * @param  txt  text of parameter
725 	 * @return Rotation from given token.
726 	 */
727 	protected Rotation rotationValue(String txt) {
728 		if (txt == null || txt.toLowerCase().equals("none")) return Rotation.NONE;
729 		double[] triple = getTriple(txt);
730 		try {
731 			return new Rotation(triple[0], triple[1], triple[2]);
732 		} catch (NullPointerException e) {
733 			warning("Can't get Rotation from text '"+txt+"'.");
734 			return Rotation.ZERO;
735 		} catch (Exception e) {
736 			exceptionOccured(e, "Can't get Rotation from text '"+txt+"'.");
737 			return null;
738 		}
739 	}
740 	
741 	/**
742 	 * Return a Point3d instance starting from num token(tokens are separated by space) in txt
743 	 * 
744 	 * @param  txt  text of parameter
745 	 * @return Point3d from given token.
746 	 */
747 	protected Point3d point3dValue(String txt) {
748 		if (txt == null || txt.toLowerCase().equals("none")) return UnrealUtils.POINT3D_NONE;
749 		double[] triple = getTriple(txt);
750 		try {
751 			return new Point3d(triple[0], triple[1], triple[2]);
752 		} catch (NullPointerException e) {
753 			warning("Can't get Point3d from text '"+txt+"'.");
754         	return new Point3d(0,0,0);
755 		} catch (Exception e) {
756         	exceptionOccured(e, "Can't get Point3d from text '"+txt+"'.");
757         	return null;
758         }
759 	}
760 	
761 	/**
762 	 * Return a Vector3d instance starting from num token(tokens are separated by space) in txt
763 	 * 
764 	 * @param  txt  text of parameter
765 	 * @return Vector3d from given token.
766 	 */
767 	protected Vector3d vector3dValue(String txt) {
768 		if (txt == null || txt.toLowerCase().equals("none")) return UnrealUtils.VECTOR3D_NONE;
769 		double[] triple = getTriple(txt);
770 		try {
771 			return new Vector3d(triple[0], triple[1], triple[2]);
772 		} catch (NullPointerException e) {
773 			warning("Can't get Vector3d from text '"+txt+"'.");
774         	return new Vector3d(0,0,0);
775 		} catch (Exception e) {
776         	exceptionOccured(e, "Can't get Vector3d from text '"+txt+"'.");
777         	return null;
778         }
779 	}
780 	
781 	/**
782 	 * Returns string for parsed token.
783 	 *	 
784 	 * @param  txt  text of parameter
785 	 * @return String from given token.
786 	 */
787 	protected String stringValue( String txt ) {	
788 		try {
789         	int index = txt.indexOf(" ");
790 			if (index == -1) {
791 				warning("Can't get string token from text '" + txt + "'.");
792 				return "";
793 			}
794 			String string = txt.substring(index+1, txt.length()-1);
795         	if (string != null) {
796 				return string;        	        		
797         	} else {
798         		warning("Can't get string token from text '"+txt+"'.");
799         		return "";
800         	}
801         } catch (Exception e) {
802         	exceptionOccured(e, "Can't get string token from text '"+txt+"'.");
803         	return "";
804         }
805 	}
806 	
807 	/**
808 	 * Returns UnrealId for parsed token.
809 	 *	 
810 	 * @param  txt  text of parameter
811 	 * @return StringId from given token.
812 	 */
813 	protected UnrealId stringIdValue( String txt ) {
814 		if (txt == null || txt.toLowerCase().equals("none")) return UnrealId.NONE;
815 		return unrealIdValue(txt);				
816 	}
817 	
818 	/**
819 	 * Return a boolean from boolean token in txt.
820 	 * <BR><BR>
821 	 * Boolean token is expected to be 'second token' in the 'txt' using delimiters " {}".	 
822 	 * 
823 	 * @param  txt  text of parameter
824 	 * @return Boolean from given token.
825 	 */
826 	protected boolean booleanValue(String txt) {
827 		try {
828         	String token = getToken(txt, 1);
829         	if (token.equals("True")) return true;
830         	if (token.equals("true")) return true;
831         	else return false;
832         } catch (NullPointerException e) {
833         	warning("Can't get boolean token from text '"+txt+"'.");
834         	return false; 
835         } catch (Exception e) {
836         	exceptionOccured(e, "Can't get boolean token from text '"+txt+"'.");
837         	return false;
838         }
839 	}
840 	
841 	/**
842 	 * Return an UnrealId instance from identificator token in txt.
843 	 * <BR><BR>
844 	 * Boolean token is expected to be 'second token' in the 'txt' using delimiters " {}".	 
845 	 * 
846 	 * @param  txt  text of parameter
847 	 * @return UnrealId from given token.
848 	 */
849 	protected UnrealId unrealIdValue(String txt) {
850 		if (txt == null || txt.toLowerCase().equals("none")) return UnrealId.NONE;
851 		try {
852         	String token = getToken(txt, 1);
853         	if (token == null) {
854         		warning("Can't get UnrealId token from text '"+txt+"'.");
855         		return null;
856         	}
857         	return translator.getId(token);
858         } catch (NullPointerException e) {
859         	warning("Can't get UnrealId token from text '"+txt+"' (translator not set?).");
860         	return null; 
861         } catch (Exception e) {
862         	exceptionOccured(e, "Can't get UnrealId token from text '"+txt+"'.");
863         	return null;
864         }
865 	}
866 	
867 	/**
868 	 * Return an UnrealId instance from identificator token in txt.
869 	 * <BR><BR>
870 	 * Boolean token is expected to be 'second token' in the 'txt' using delimiters " {}".	 
871 	 * 
872 	 * @param  txt  text of parameter
873 	 * @return UnrealId from given token.
874 	 */
875 	protected UnrealId worldObjectIdValue(String txt) {
876 		if (txt == null || txt.toLowerCase().equals("none")) return UnrealId.NONE;
877 		try {
878         	String token = getToken(txt, 1);
879         	if (token == null) {
880         		warning("Can't get UnrealId token from text '"+txt+"'.");
881         		return null;
882         	}
883         	return translator.getId(token);
884         } catch (NullPointerException e) {
885         	warning("Can't get UnrealId token from text '"+txt+"' (translator not set?).");
886         	return null; 
887         } catch (Exception e) {
888         	exceptionOccured(e, "Can't get UnrealId token from text '"+txt+"'.");
889         	return null;
890         }
891 	}
892 	
893 	private ITeamId teamId;
894 	
895 	/**
896 	 * Sets teamId that has to be slipped to every {@link IWorldObjectUpdatedEvent}.
897 	 */
898 	public void setTeamId(ITeamId teamId) {
899 		this.teamId = teamId;
900 	}
901 	
902 	private void setTeamId(IWorldObjectUpdatedEvent obj) {
903        setPropertyByReflection( obj, "TeamId", ITeamId.class, (ITeamId)teamId );
904 	}
905 		
906     // this is stack with static size, so it can overflow... theoreticly... No.
907     private int[] stack = new int[10];
908     private int stack_pos = 0;
909   
910  	// actual object that is being parsed 
911     protected Object actObj;
912   
913     /**
914      * Change state to state and push original state to stack, so parser can return in state_return
915      */
916     private void state_go(int state)
917     {
918   	    stack[stack_pos++] = yystate();
919   	    yybegin(state);
920     }
921   
922     /**
923      * Return to previous state.
924      */
925     private void state_return()
926     {
927   	    yybegin(stack[--stack_pos]);
928     }
929 
930 
931   /**
932    * Creates a new scanner
933    * There is also a java.io.InputStream version of this constructor.
934    *
935    * @param   in  the java.io.Reader to read input from.
936    */
937   public Yylex(java.io.Reader in) {
938     this.zzReader = in;
939   }
940 
941   /**
942    * Creates a new scanner.
943    * There is also java.io.Reader version of this constructor.
944    *
945    * @param   in  the java.io.Inputstream to read input from.
946    */
947   public Yylex(java.io.InputStream in) {
948     this(new java.io.InputStreamReader(in));
949   }
950 
951   /** 
952    * Unpacks the compressed character translation table.
953    *
954    * @param packed   the packed character translation table
955    * @return         the unpacked character translation table
956    */
957   private static char [] zzUnpackCMap(String packed) {
958     char [] map = new char[0x10000];
959     int i = 0;  /* index in packed string  */
960     int j = 0;  /* index in unpacked array */
961     while (i < 116) {
962       int  count = packed.charAt(i++);
963       char value = packed.charAt(i++);
964       do map[j++] = value; while (--count > 0);
965     }
966     return map;
967   }
968 
969 
970   /**
971    * Refills the input buffer.
972    *
973    * @return      <code>false</code>, iff there was new input.
974    * 
975    * @exception   java.io.IOException  if any I/O-Error occurs
976    */
977   private boolean zzRefill() throws java.io.IOException {
978 
979     /* first: make room (if you can) */
980     if (zzStartRead > 0) {
981       System.arraycopy(zzBuffer, zzStartRead,
982                        zzBuffer, 0,
983                        zzEndRead-zzStartRead);
984 
985       /* translate stored positions */
986       zzEndRead-= zzStartRead;
987       zzCurrentPos-= zzStartRead;
988       zzMarkedPos-= zzStartRead;
989       zzStartRead = 0;
990     }
991 
992     /* is the buffer big enough? */
993     if (zzCurrentPos >= zzBuffer.length) {
994       /* if not: blow it up */
995       char newBuffer[] = new char[zzCurrentPos*2];
996       System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
997       zzBuffer = newBuffer;
998     }
999 
1000     /* finally: fill the buffer with new input */
1001     int numRead = zzReader.read(zzBuffer, zzEndRead,
1002                                             zzBuffer.length-zzEndRead);
1003 
1004     if (numRead > 0) {
1005       zzEndRead+= numRead;
1006       return false;
1007     }
1008     // unlikely but not impossible: read 0 characters, but not at end of stream    
1009     if (numRead == 0) {
1010       int c = zzReader.read();
1011       if (c == -1) {
1012         return true;
1013       } else {
1014         zzBuffer[zzEndRead++] = (char) c;
1015         return false;
1016       }     
1017     }
1018 
1019 	// numRead < 0
1020     return true;
1021   }
1022 
1023     
1024   /**
1025    * Closes the input stream.
1026    */
1027   public final void yyclose() throws java.io.IOException {
1028     zzAtEOF = true;            /* indicate end of file */
1029     zzEndRead = zzStartRead;  /* invalidate buffer    */
1030 
1031     if (zzReader != null)
1032       zzReader.close();
1033   }
1034 
1035 
1036   /**
1037    * Resets the scanner to read from a new input stream.
1038    * Does not close the old reader.
1039    *
1040    * All internal variables are reset, the old input stream 
1041    * <b>cannot</b> be reused (internal buffer is discarded and lost).
1042    * Lexical state is set to <tt>ZZ_INITIAL</tt>.
1043    *
1044    * @param reader   the new input stream 
1045    */
1046   public final void yyreset(java.io.Reader reader) {
1047     zzReader = reader;
1048     zzAtBOL  = true;
1049     zzAtEOF  = false;
1050     zzEOFDone = false;
1051     zzEndRead = zzStartRead = 0;
1052     zzCurrentPos = zzMarkedPos = 0;
1053     yyline = yychar = yycolumn = 0;
1054     zzLexicalState = YYINITIAL;
1055   }
1056 
1057 
1058   /**
1059    * Returns the current lexical state.
1060    */
1061   public final int yystate() {
1062     return zzLexicalState;
1063   }
1064 
1065 
1066   /**
1067    * Enters a new lexical state
1068    *
1069    * @param newState the new lexical state
1070    */
1071   public final void yybegin(int newState) {
1072     zzLexicalState = newState;
1073   }
1074 
1075 
1076   /**
1077    * Returns the text matched by the current regular expression.
1078    */
1079   public final String yytext() {
1080     return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
1081   }
1082 
1083 
1084   /**
1085    * Returns the character at position <tt>pos</tt> from the 
1086    * matched text. 
1087    * 
1088    * It is equivalent to yytext().charAt(pos), but faster
1089    *
1090    * @param pos the position of the character to fetch. 
1091    *            A value from 0 to yylength()-1.
1092    *
1093    * @return the character at position pos
1094    */
1095   public final char yycharat(int pos) {
1096     return zzBuffer[zzStartRead+pos];
1097   }
1098 
1099 
1100   /**
1101    * Returns the length of the matched text region.
1102    */
1103   public final int yylength() {
1104     return zzMarkedPos-zzStartRead;
1105   }
1106 
1107 
1108   /**
1109    * Reports an error that occured while scanning.
1110    *
1111    * In a wellformed scanner (no or only correct usage of 
1112    * yypushback(int) and a match-all fallback rule) this method 
1113    * will only be called with things that "Can't Possibly Happen".
1114    * If this method is called, something is seriously wrong
1115    * (e.g. a JFlex bug producing a faulty scanner etc.).
1116    *
1117    * Usual syntax/scanner level error handling should be done
1118    * in error fallback rules.
1119    *
1120    * @param   errorCode  the code of the errormessage to display
1121    */
1122   private void zzScanError(int errorCode) {
1123     String message;
1124     try {
1125       message = ZZ_ERROR_MSG[errorCode];
1126     }
1127     catch (ArrayIndexOutOfBoundsException e) {
1128       message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
1129     }
1130 
1131     throw new Error(message);
1132   } 
1133 
1134 
1135   /**
1136    * Pushes the specified amount of characters back into the input stream.
1137    *
1138    * They will be read again by then next call of the scanning method
1139    *
1140    * @param number  the number of characters to be read again.
1141    *                This number must not be greater than yylength()!
1142    */
1143   public void yypushback(int number)  {
1144     if ( number > yylength() )
1145       zzScanError(ZZ_PUSHBACK_2BIG);
1146 
1147     zzMarkedPos -= number;
1148   }
1149 
1150 
1151   /**
1152    * Resumes scanning until the next regular expression is matched,
1153    * the end of input is encountered or an I/O-Error occurs.
1154    *
1155    * @return      the next token
1156    * @exception   java.io.IOException  if any I/O-Error occurs
1157    */
1158   public InfoMessage yylex() throws java.io.IOException {
1159     int zzInput;
1160     int zzAction;
1161 
1162     // cached fields:
1163     int zzCurrentPosL;
1164     int zzMarkedPosL;
1165     int zzEndReadL = zzEndRead;
1166     char [] zzBufferL = zzBuffer;
1167     char [] zzCMapL = ZZ_CMAP;
1168 
1169     int [] zzTransL = ZZ_TRANS;
1170     int [] zzRowMapL = ZZ_ROWMAP;
1171     int [] zzAttrL = ZZ_ATTRIBUTE;
1172 
1173     while (true) {
1174       zzMarkedPosL = zzMarkedPos;
1175 
1176       yychar+= zzMarkedPosL-zzStartRead;
1177 
1178       boolean zzR = false;
1179       for (zzCurrentPosL = zzStartRead; zzCurrentPosL < zzMarkedPosL;
1180                                                              zzCurrentPosL++) {
1181         switch (zzBufferL[zzCurrentPosL]) {
1182         case '\u000B':
1183         case '\u000C':
1184         case '\u0085':
1185         case '\u2028':
1186         case '\u2029':
1187           yyline++;
1188           zzR = false;
1189           break;
1190         case '\r':
1191           yyline++;
1192           zzR = true;
1193           break;
1194         case '\n':
1195           if (zzR)
1196             zzR = false;
1197           else {
1198             yyline++;
1199           }
1200           break;
1201         default:
1202           zzR = false;
1203         }
1204       }
1205 
1206       if (zzR) {
1207         // peek one character ahead if it is \n (if we have counted one line too much)
1208         boolean zzPeek;
1209         if (zzMarkedPosL < zzEndReadL)
1210           zzPeek = zzBufferL[zzMarkedPosL] == '\n';
1211         else if (zzAtEOF)
1212           zzPeek = false;
1213         else {
1214           boolean eof = zzRefill();
1215           zzEndReadL = zzEndRead;
1216           zzMarkedPosL = zzMarkedPos;
1217           zzBufferL = zzBuffer;
1218           if (eof) 
1219             zzPeek = false;
1220           else 
1221             zzPeek = zzBufferL[zzMarkedPosL] == '\n';
1222         }
1223         if (zzPeek) yyline--;
1224       }
1225       zzAction = -1;
1226 
1227       zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
1228   
1229       zzState = ZZ_LEXSTATE[zzLexicalState];
1230 
1231 
1232       zzForAction: {
1233         while (true) {
1234     
1235           if (zzCurrentPosL < zzEndReadL)
1236             zzInput = zzBufferL[zzCurrentPosL++];
1237           else if (zzAtEOF) {
1238             zzInput = YYEOF;
1239             break zzForAction;
1240           }
1241           else {
1242             // store back cached positions
1243             zzCurrentPos  = zzCurrentPosL;
1244             zzMarkedPos   = zzMarkedPosL;
1245             boolean eof = zzRefill();
1246             // get translated positions and possibly new buffer
1247             zzCurrentPosL  = zzCurrentPos;
1248             zzMarkedPosL   = zzMarkedPos;
1249             zzBufferL      = zzBuffer;
1250             zzEndReadL     = zzEndRead;
1251             if (eof) {
1252               zzInput = YYEOF;
1253               break zzForAction;
1254             }
1255             else {
1256               zzInput = zzBufferL[zzCurrentPosL++];
1257             }
1258           }
1259           int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
1260           if (zzNext == -1) break zzForAction;
1261           zzState = zzNext;
1262 
1263           int zzAttributes = zzAttrL[zzState];
1264           if ( (zzAttributes & 1) == 1 ) {
1265             zzAction = zzState;
1266             zzMarkedPosL = zzCurrentPosL;
1267             if ( (zzAttributes & 8) == 8 ) break zzForAction;
1268           }
1269 
1270         }
1271       }
1272 
1273       // store back cached position
1274       zzMarkedPos = zzMarkedPosL;
1275 
1276       switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
1277         case 4: 
1278           { if (!yytext().equals(" ")) {
1279                     warning("State UNPROCESSED_MESSAGE unprocessed: " + yytext());
1280             }
1281           }
1282         case 16: break;
1283         case 13: 
1284           { ((AliveMessageMessage)actObj).
1285 					Time = doubleValue(yytext());
1286 				
1287 					((AliveMessageMessage)actObj).Time_Set = true;
1288           }
1289         case 17: break;
1290         case 9: 
1291           { actObj = new EmptyMessage();
1292   		
1293   	state_go(MSG_EMP);
1294           }
1295         case 18: break;
1296         case 7: 
1297           { if (!yytext().equals(" ")) {
1298 			warning("State MSG_BEG unprocessed: " + yytext());
1299 		}
1300           }
1301         case 19: break;
1302         case 6: 
1303           { if (!yytext().equals(" ")) {
1304 			warning("State MSG_ALIVE unprocessed: " + yytext());
1305 		}
1306           }
1307         case 20: break;
1308         case 2: 
1309           { warning("Illegal character: <" + yytext() + "> + currentstate "+ yystate());
1310           }
1311         case 21: break;
1312         case 11: 
1313           { String text = yytext();
1314         if(!tryParsingUnprocessedMessageParameter(getToken(text,0), text)) {
1315             warning("Illegal unprocessed message parameter: <" + yytext() + ">");  
1316         }
1317           }
1318         case 22: break;
1319         case 5: 
1320           { if (!yytext().equals(" ")) {
1321 			warning("State MSG_EMP unprocessed: " + yytext());
1322 		}
1323           }
1324         case 23: break;
1325         case 10: 
1326           { actObj = new BeginMessage();
1327   		
1328   	state_go(MSG_BEG);
1329           }
1330         case 24: break;
1331         case 12: 
1332           { actObj = new AliveMessageMessage();
1333   		
1334   	state_go(MSG_ALIVE);
1335           }
1336         case 25: break;
1337         case 15: 
1338           { ((BeginMessage)actObj).
1339 					VisUpdate = booleanValue(yytext());
1340           }
1341         case 26: break;
1342         case 8: 
1343           { // reset scanning
1344 		stack_pos = 0;
1345  		yybegin(YYINITIAL);
1346  		if (actObj != null)
1347  		{ 			
1348  			InfoMessage obj = (InfoMessage) actObj;
1349  			
1350  			if (obj instanceof IWorldObjectUpdatedEvent) {
1351  				setTeamId((IWorldObjectUpdatedEvent)obj);
1352  			}
1353  			
1354  			if (obj instanceof BeginMessage) {
1355                 ut2004Time = ((BeginMessage)obj).getTime();
1356                 setTime((IWorldEvent)obj, ut2004Time);
1357             } else
1358             if (obj instanceof AliveMessage) {
1359                 ut2004Time = ((AliveMessage)obj).getTime();
1360                 setTime((IWorldObjectUpdatedEvent)obj, ut2004Time);
1361             } else
1362             if (obj instanceof IWorldObjectUpdatedEvent) {
1363  				setTime((IWorldObjectUpdatedEvent)obj, ut2004Time);
1364  			} else
1365  			if (obj instanceof IWorldEvent) {
1366  				setTime((IWorldEvent)obj, ut2004Time);
1367  			}
1368  			
1369  			actObj = null;
1370  			return obj;
1371  		}
1372           }
1373         case 27: break;
1374         case 1: 
1375           { InfoMessage obj = tryParsingUnprocessedMessage(yytext());
1376   if(obj != null){
1377     actObj = obj;
1378     state_go(UNPROCESSED_MESSAGE);
1379   } else {
1380     warning("Illegal character sequence: <" + yytext() + "> + currentstate "+ yystate());  
1381   }
1382           }
1383         case 28: break;
1384         case 14: 
1385           { ((BeginMessage)actObj).
1386 					Time = doubleValue(yytext());
1387           }
1388         case 29: break;
1389         case 3: 
1390           { 
1391           }
1392         case 30: break;
1393         default: 
1394           if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
1395             zzAtEOF = true;
1396               { throw new ParserEOFException(this);
1397  }
1398           } 
1399           else {
1400             zzScanError(ZZ_NO_MATCH);
1401           }
1402       }
1403     }
1404   }
1405 
1406   /**
1407    * Runs the scanner on input files.
1408    *
1409    * This is a standalone scanner, it will print any unmatched
1410    * text to System.out unchanged.
1411    *
1412    * @param argv   the command line, contains the filenames to run
1413    *               the scanner on.
1414    */
1415   public static void main(String argv[]) {
1416     if (argv.length == 0) {
1417       System.out.println("Usage : java Yylex <inputfile>");
1418     }
1419     else {
1420       for (int i = 0; i < argv.length; i++) {
1421         Yylex scanner = null;
1422         try {
1423           scanner = new Yylex( new java.io.FileReader(argv[i]) );
1424           while ( !scanner.zzAtEOF ) scanner.yylex();
1425         }
1426         catch (java.io.FileNotFoundException e) {
1427           System.out.println("File not found : \""+argv[i]+"\"");
1428         }
1429         catch (java.io.IOException e) {
1430           System.out.println("IO error scanning file \""+argv[i]+"\"");
1431           System.out.println(e);
1432         }
1433         catch (Exception e) {
1434           System.out.println("Unexpected exception:");
1435           e.printStackTrace();
1436         }
1437       }
1438     }
1439   }
1440 
1441 
1442 }