2 // GenericParser.cs: The Base Parser for the Mono compilers
4 // Author: A Rafael D Teixeira (rafaelteixeirabr@hotmail.com)
6 // Licensed under the terms of the GNU GPL
8 // Copyright (C) 2001 Ximian, Inc.
13 namespace Mono.Languages
15 using System.Collections;
18 /// Base class to support multiple Jay generated parsers
20 public abstract class GenericParser
22 static protected int global_errors;
24 // Name of the file we are parsing
27 // Input stream to parse from.
28 public System.IO.Stream input;
30 public abstract int parse ();
32 public virtual string[] extensions()
34 string [] list = { ".cs" };
39 /// Emits error messages and increments a global count of them
41 /// <param name="code"></param>
42 /// <param name="desc"></param>
43 static public void error (int code, string desc)
45 Console.WriteLine ("Error "+code+": "+ desc);
49 // Emits error messages with location info.
50 // FIXME : Ideally, all error reporting should happen
51 // with Report.Error but how do you get at that non-static
52 // method everywhere you need it ?
53 static public void error (int code, Mono.CSharp.Location l, string text)
55 Console.WriteLine (l.Name + "(" + l.Row + "," +
56 "): Error CS" + code + ": " + text);
60 public GenericParser()
63 // DO NOTHING: Derived classes should do their iniatilization here duties
67 protected bool yacc_verbose_flag = false;
69 public bool yacc_verbose
73 yacc_verbose_flag = value;
78 return yacc_verbose_flag;