Hi
As I was experimenting with the style files, I introduced an error
in one of the rules. Then mkgmap naturally reported an error at, say
"line 60:20", but the error line was actually several lines further
down, say line number 73.
This was reported a few days ago and I created a fix, but I can't see
that I sent it out.
I've attached a patch and I will commit it soon anyway.
..Steve
Index: test/uk/me/parabola/mkgmap/scan/TokenScannerTest.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- test/uk/me/parabola/mkgmap/scan/TokenScannerTest.java (revision 3122)
+++ test/uk/me/parabola/mkgmap/scan/TokenScannerTest.java (revision )
@@ -64,6 +64,20 @@
assertEquals(2, ts.getLinenumber());
}
+ @Test
+ public void testLinenumberBlankLines() throws Exception {
+ String s = "hello world\n\nnext tokens\n";
+ TokenScanner ts = new TokenScanner("", new StringReader(s));
+ ts.readLine();
+
+ // still on first line
+ assertEquals(1, ts.getLinenumber());
+
+ // now next line, which is line three in the file as blank line is skipped
+ ts.nextValue();
+ assertEquals(3, ts.getLinenumber());
+ }
+
/**
* This is a misfeature of skipSpace, but relied on everywhere.
*/
Index: src/uk/me/parabola/mkgmap/scan/TokenScanner.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/mkgmap/scan/TokenScanner.java (revision 3122)
+++ src/uk/me/parabola/mkgmap/scan/TokenScanner.java (revision )
@@ -178,13 +178,15 @@
val.append((char) c);
TokType tt;
- if (c == '\n' || c == '\r') {
- while ((c = readChar()) == '\n' || c == '\r')
- val.append(c);
+ if (c == '\r') {
+ c = readChar();
+ if (c != '\n')
- pushback = c;
+ pushback = c;
tt = TokType.EOL;
+ } else if (c == '\n') {
+ tt = TokType.EOL;
} else if (isSpace(c)) {
- while (isSpace(c = readChar()) && (c != '\n' && c != '\r'))
+ while (isSpace(c = readChar()) && c != '\n')
val.append((char) c);
pushback = c;
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev