Index: resources/typ-files/mapnik.txt
===================================================================
--- resources/typ-files/mapnik.txt	(revision 4476)
+++ resources/typ-files/mapnik.txt	(working copy)
@@ -1,28 +1,33 @@
 ﻿; TYP file to give mapnik rendering
 ; -*- coding: UTF-8 -*- NB: first 3 bytes/char in file is UTF-8 encoded ByteOrderMark (BOM)
-;
-;This program is free software; you can redistribute it and/or modify
-;it under the terms of the GNU General Public License version 3 or
-;version 2 as published by the Free Software Foundation.
-;
-;This program is distributed in the hope that it will be useful, but
-;WITHOUT ANY WARRANTY; without even the implied warranty of
-;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;General Public License for more details.
-;
-;Author: Jorisbo@hotmail.com
-;
-;Based on mkgmap default style version: r4293...4288
-;
+
+[_comments]
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 3 or
+version 2 as published by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+Author: Jorisbo@hotmail.com and others
+
+Based on mkgmap default style version: r4293
+[End]
+
+
 [_id]
 ;ProductCode=1   set from --product-id
 ;FID=8094        set from --family-id
 ;CodePage=65001  set from --code-page
 [End]
-;
+
+
+;=========== POLYGONS : RENDERING PRIORITY ======
 [_drawOrder]
+Type=0x03d,1
 Type=0x04b,1
-Type=0x03d,1
 Type=0x002,2
 Type=0x003,2
 Type=0x007,2
@@ -75,7 +80,11 @@
 Type=0x06c,8
 Type=0x004,9
 [End]
-;
+
+
+;===================== POLYGONS ========================
+
+
 [_polygon]
 type=0x02
 ;GRMN_TYPE: Urban Areas/SMALL_CITY/Small urban area, less than 200 000 inhabitants/Non NT
@@ -1184,7 +1193,11 @@
 Xpm="0 0 1 0"
 "1 c #BBBBBB"
 [end]
-;
+
+
+;====================== LINES ===========================
+
+
 [_line]
 type=0x01
 ;GRMN_TYPE: Roads/INTERSTATE, MAJOR_HWY/Primary, divided, limited-access highway, akin to an interstate in the US/Non NT, NT
@@ -2015,7 +2028,11 @@
 FontStyle=NoLabel (invisible)
 CustomColor=No
 [end]
-;
+
+
+;====================== POINTS ==========================
+
+
 [_point]
 type=0x001
 subtype=0x00
Index: src/uk/me/parabola/mkgmap/typ/IdSection.java
===================================================================
--- src/uk/me/parabola/mkgmap/typ/IdSection.java	(revision 4476)
+++ src/uk/me/parabola/mkgmap/typ/IdSection.java	(working copy)
@@ -13,6 +13,7 @@
 package uk.me.parabola.mkgmap.typ;
 
 import uk.me.parabola.imgfmt.app.typ.TypData;
+import uk.me.parabola.log.Logger;
 import uk.me.parabola.mkgmap.scan.SyntaxException;
 import uk.me.parabola.mkgmap.scan.TokenScanner;
 import uk.me.parabola.mkgmap.srt.SrtTextReader;
@@ -23,6 +24,8 @@
  * @author Steve Ratcliffe
  */
 class IdSection implements ProcessSection {
+	private static final Logger log = Logger.getLogger(IdSection.class);
+
 	private final TypData data;
 
 	public IdSection(TypData data) {
@@ -34,15 +37,25 @@
 		try {
 			ival = Integer.decode(value);
 		} catch (NumberFormatException e) {
-			throw new SyntaxException(scanner, "Bad integer " + value);
+			/* throw new SyntaxException(scanner, "Bad integer " + value);
+			 *
+			 * TYPViewer can leave these as:
+			 * FID=
+			 * ProductCode=
+			 * so just give a warning. Values will be supplied from mkgmap options.
+			 */
+			log.warn("bad/missing integer in TYP [_id] statement: ", name, "=", value);
+			ival = -1;
 		}
 
 		if (name.equalsIgnoreCase("FID")) {
-			data.setFamilyId(ival);
+			if (ival != -1)
+				data.setFamilyId(ival);
 		} else if (name.equalsIgnoreCase("ProductCode")) {
-			data.setProductId(ival);
+			if (ival != -1)
+				data.setProductId(ival);
 		} else if (name.equalsIgnoreCase("CodePage")) {
-			if (data.getSort() == null) // ignore if --code-page
+			if (ival != -1 && data.getSort() == null) // ignore if --code-page
 				data.setSort(SrtTextReader.sortForCodepage(ival));
 		} else {
 			throw new SyntaxException(scanner, "Unrecognised keyword in id section: " + name);
Index: src/uk/me/parabola/mkgmap/typ/TypTextReader.java
===================================================================
--- src/uk/me/parabola/mkgmap/typ/TypTextReader.java	(revision 4476)
+++ src/uk/me/parabola/mkgmap/typ/TypTextReader.java	(working copy)
@@ -116,6 +116,23 @@
 			return new IconSection(data);
 		} else if ("_id".equals(sectionName)) {
 			return new IdSection(data);
+		} else if ("_comments".equals(sectionName)) {
+			// Need to really ignore everything (IgnoreSection tries to parse first bit of each line as name=...)
+			Token tstTok;
+			do {
+				scanner.skipLine(); // after _comments] or testing next line
+				tstTok = scanner.nextToken();
+				if (tstTok.getType() == TokType.SYMBOL && "[".equals(tstTok.getValue())) {
+					tstTok = scanner.nextRawToken();
+					if (tstTok.getType() == TokType.TEXT && "end".equalsIgnoreCase(tstTok.getValue())) {
+						tstTok = scanner.nextRawToken();
+						if (tstTok.getType() == TokType.SYMBOL && "]".equals(tstTok.getValue())) {
+							break;
+						}
+					}
+				}
+			} while (tstTok.getType() != TokType.EOF);
+			return null;
 		} else {
 			log.warn("Unrecognised section " + sectionName);
 			return new IgnoreSection(data);
