source: trunk/yao/share/antlr-2.7.7/lib/csharp/antlr.runtime/antlr/DefaultFileLineFormatter.cs @ 1

Last change on this file since 1 was 1, checked in by lnalod, 15 years ago

Initial import of YAO sources

File size: 1018 bytes
Line 
1using System;
2using StringBuilder                     = System.Text.StringBuilder;
3
4namespace antlr
5{
6        /*ANTLR Translator Generator
7        * Project led by Terence Parr at http://www.jGuru.com
8        * Software rights: http://www.antlr.org/license.html
9        *
10        * $Id:$
11        */
12       
13        //
14        // ANTLR C# Code Generator by Micheal Jordan
15        //                            Kunle Odutola       : kunle UNDERSCORE odutola AT hotmail DOT com
16        //                            Anthony Oguntimehin
17        //
18        // With many thanks to Eric V. Smith from the ANTLR list.
19        //
20
21        public class DefaultFileLineFormatter : FileLineFormatter
22        {
23                public override string getFormatString(string fileName, int line, int column)
24                {
25                        StringBuilder buf = new StringBuilder();
26                       
27                        if (fileName != null)
28                                buf.Append(fileName + ":");
29                       
30                        if (line != - 1)
31                        {
32                                if (fileName == null)
33                                        buf.Append("line ");
34                               
35                                buf.Append(line);
36                               
37                                if (column != - 1)
38                                        buf.Append(":" + column);
39                               
40                                buf.Append(":");
41                        }
42                       
43                        buf.Append(" ");
44                       
45                        return buf.ToString();
46                }
47        }
48}
Note: See TracBrowser for help on using the repository browser.