source: trunk/yao/share/antlr-2.7.7/examples/csharp/TokenStreamRewrite/GenHdr.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: 769 bytes
Line 
1using System;
2using System.IO;
3using antlr;
4
5class GenHdr 
6{
7        public static void Main(string[] args) 
8        {
9                try {
10                        TinyCLexer lexer = null;
11
12                        if ( args.Length > 0 ) 
13                        {
14                                lexer = new TinyCLexer(new StreamReader(new FileStream(args[0], FileMode.Open, FileAccess.Read)));
15                        }
16                        else 
17                        {
18                                lexer = new TinyCLexer(new ByteBuffer(Console.OpenStandardInput()));
19                        }
20                        lexer.setTokenObjectClass(typeof(TokenWithIndex).FullName);
21                        TokenStreamRewriteEngine rewriteEngine = new TokenStreamRewriteEngine(lexer);
22                        rewriteEngine.discard(TinyCLexer.WS);
23                        TinyCParser parser = new TinyCParser(rewriteEngine);
24                        parser.program();
25                        Console.Out.Write(rewriteEngine.ToString());
26                } 
27                catch(Exception e) 
28                {
29                        Console.Error.WriteLine("exception: "+e);
30                }
31        }
32}
Note: See TracBrowser for help on using the repository browser.