Help parser a bit
authorunc0rr
Fri, 25 Nov 2011 23:22:35 +0300
changeset 6426 2d44f6561e72
parent 6425 1ef4192aa80d
child 6428 2d2b5e3c59a7
Help parser a bit
hedgewars/ArgParsers.inc
hedgewars/uTypes.pas
hedgewars/uVariables.pas
tools/PascalParser.hs
--- a/hedgewars/ArgParsers.inc	Fri Nov 25 18:36:12 2011 +0300
+++ b/hedgewars/ArgParsers.inc	Fri Nov 25 23:22:35 2011 +0300
@@ -159,7 +159,7 @@
     recordFileName:= ParamStr(3);
     paramIndex:= 4;
     wrongParameter:= false;
-    while (paramIndex <= ParamCount) and not wrongParameter do
+    while (paramIndex <= ParamCount) and (not wrongParameter) do
         begin
         if ParamStr(paramIndex) = '--set-video'  then
 //--set-video [screen width] [screen height] [color dept]
--- a/hedgewars/uTypes.pas	Fri Nov 25 18:36:12 2011 +0300
+++ b/hedgewars/uTypes.pas	Fri Nov 25 23:22:35 2011 +0300
@@ -256,7 +256,7 @@
             PortalCounter: LongWord;  // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion.
             LastDamage: PHedgehog;
         end;
-    TPGearArray = Array of PGear;
+    TPGearArray = array of PGear;
 
     PVisualGear = ^TVisualGear;
     TVGearStepProcedure = procedure (Gear: PVisualGear; Steps: Longword);
@@ -324,7 +324,7 @@
     THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo;
 
     THedgehog = record
-            Name: string[MAXNAMELEN];
+            Name: string[192];
             Gear: PGear;
             GearHidden: PGear;
             SpeechGear: PVisualGear;
@@ -345,12 +345,12 @@
             King: boolean;  // Flag for a bunch of hedgehog attributes
             Unplaced: boolean;  // Flag for hog placing mode
             Timer: Longword;
-            Effects: Array[THogEffect] of boolean;
+            Effects: array[THogEffect] of boolean;
             end;
 
     TTeam = record
             Clan: PClan;
-            TeamName: string[MAXNAMELEN];
+            TeamName: string[192];
             ExtDriven: boolean;
             Binds: TBinds;
             Hedgehogs: array[0..cMaxHHIndex] of THedgehog;
--- a/hedgewars/uVariables.pas	Fri Nov 25 18:36:12 2011 +0300
+++ b/hedgewars/uVariables.pas	Fri Nov 25 23:22:35 2011 +0300
@@ -16,7 +16,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  *)
 
-{$INCLUDE options.inc}
+{$INCLUDE "options.inc"}
 
 unit uVariables;
 interface
@@ -264,7 +264,7 @@
             );
 
     SpritesData: array[TSprite] of record
-            FileName: String[16];
+            FileName: string[16];
             Path, AltPath: TPathType;
             Texture: PTexture;
             Surface: PSDL_Surface;
@@ -635,7 +635,7 @@
             Sprite: TSprite;
             FramesCount: Longword;
             Interval: Longword;
-            cmd: String[20];
+            cmd: string[20];
             Voice: TSound;
             VoiceDelay: LongWord;
             end = (
@@ -649,7 +649,7 @@
             );
 
     Soundz: array[TSound] of record
-            FileName: String[25];
+            FileName: string[25];
             Path    : TPathType;
             end = (
             (FileName:                         ''; Path: ptNone  ),// sndNone
--- a/tools/PascalParser.hs	Fri Nov 25 18:36:12 2011 +0300
+++ b/tools/PascalParser.hs	Fri Nov 25 23:22:35 2011 +0300
@@ -204,16 +204,19 @@
             optional $ (try $ string "packed") >> comments
             string "array"
         comments
-        r <- optionMaybe $ do
+        r <- option [] $ do
             char '['
-            r <- rangeDecl
+            r <- commaSep pas rangeDecl
             char ']'
             comments
             return r
         string "of"
         comments
         t <- typeDecl
-        return $ ArrayDecl r t
+        if null r then
+            return $ ArrayDecl Nothing t
+            else
+            return $ foldr (\a b -> ArrayDecl (Just a) b) (ArrayDecl (Just $ head r) t) (tail r) 
     recordDecl = do
         try $ do
             optional $ (try $ string "packed") >> comments