trying to add Id tags in tilemanager files
[supertux.git] / tools / tilemanager / Parser.cs
index daa0ade..22d7701 100644 (file)
@@ -1,3 +1,4 @@
+//  $Id$
 using System;
 using System.IO;
 
@@ -9,14 +10,14 @@ public class Parser {
         START_LIST,
         END_LIST,
         SYMBOL,
-        INTEGER,       
+        INTEGER,
         STRING,
         REAL,
         BOOLEAN
     };
     private Lexer lexer;
     private Lexer.TokenType token;
-    
+
     public Parser(StreamReader stream) {
         lexer = new Lexer(stream);
     }
@@ -31,7 +32,7 @@ public class Parser {
             depth = 0;
             return false;
         }
-       
+
         /*
         Console.WriteLine("Token: " + token.ToString() + " - " +
                 lexer.TokenString);
@@ -63,6 +64,14 @@ public class Parser {
         return true;
     }
 
+    public static void ParseIntList(Parser parser, System.Collections.Generic.List<int> intList) {
+       int d = parser.Depth;
+       while(parser.Depth >= d) {
+               intList.Add(parser.IntegerValue);
+               parser.Parse();
+       }
+    }
+
     private LispType type;
     public LispType Type {
         get { return type; }
@@ -83,7 +92,7 @@ public class Parser {
         get { return Int32.Parse(lexer.TokenString); }
     }
     public bool BoolValue {
-        get { return StringValue == "t" ? true : false; }
+        get { return StringValue == "t"; }
     }
     public float FloatValue {
         get { return Single.Parse(lexer.TokenString); }