KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > persistence > antlr > DefaultFileLineFormatter


1 package persistence.antlr;
2
3 /* ANTLR Translator Generator
4  * Project led by Terence Parr at http://www.jGuru.com
5  * Software rights: http://www.antlr.org/license.html
6  *
7  */

8
9 public class DefaultFileLineFormatter extends FileLineFormatter {
10     public String JavaDoc getFormatString(String JavaDoc fileName, int line, int column) {
11         StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
12
13         if (fileName != null)
14             buf.append(fileName + ":");
15
16         if (line != -1) {
17             if (fileName == null)
18                 buf.append("line ");
19
20             buf.append(line);
21
22             if (column != -1)
23                 buf.append(":" + column);
24
25             buf.append(":");
26         }
27
28         buf.append(" ");
29
30         return buf.toString();
31     }
32 }
33
Popular Tags