Use genericparser.cs
[mono.git] / mcs / mcs / genericparser.cs
1 //
2 // GenericParser.cs: The Base Parser for the Mono compilers
3 //
4 // Author: A Rafael D Teixeira (rafaelteixeirabr@hotmail.com)
5 //
6 // Licensed under the terms of the GNU GPL
7 //
8 // Copyright (C) 2001 A Rafael D Teixeira
9 //
10 using System;
11 using System.Text;
12
13 namespace Mono.Languages
14 {
15         using System.Collections;
16
17         /// <summary>
18         /// Base class to support multiple Jay generated parsers
19         /// </summary>
20         public abstract class GenericParser
21         {
22                 static protected int global_errors;
23
24                 // Name of the file we are parsing
25                 public string name;
26
27                 // Input stream to parse from.
28                 public System.IO.Stream input;
29
30                 public abstract int parse ();
31
32                 public virtual string[] extensions()
33                 {
34                         string [] list = { ".cs" };
35                         return list;
36                 }
37
38                 /// <summary>
39                 /// Emits error messages and increments a global count of them
40                 /// </summary>
41                 /// <param name="code"></param>
42                 /// <param name="desc"></param>
43                 static public void error (int code, string desc)
44                 {
45                         Console.WriteLine ("Error "+code+": "+ desc);
46                         global_errors++;
47                 }
48
49                 public GenericParser()
50                 {
51                         //
52                         // DO NOTHING: Derived classes should do their iniatilization here duties
53                         //
54                 }
55
56                 protected bool yacc_verbose_flag = false;
57
58                 public bool yacc_verbose
59                 {
60                         set
61                         {
62                                 yacc_verbose_flag = value;
63                         }
64
65                         get
66                         {
67                                 return yacc_verbose_flag;
68                         }
69                 }
70         }
71 }
72
73
74