2 // location.cs: Keeps track of the location of source code entity
7 // (C) 2001 Ximian, Inc.
11 using System.Collections;
15 // Keeps track of the location in the program
17 // This uses a compact representation and a couple of auxiliary
18 // structures to keep track of tokens to (file,line) mappings.
20 // We could probably also keep track of columns by storing those
21 // in 8 bits (and say, map anything after char 255 to be `255+').
23 public struct Location {
27 static ArrayList list;
28 static int global_count;
29 static int module_base;
33 map = new Hashtable ();
34 list = new ArrayList ();
44 public void Push (string name)
46 map.Add (global_count, name);
47 list.Add (global_count);
48 module_base = global_count;
51 public Location (int row)
56 token = module_base + row;
62 // Whether the Location is Null
64 static public bool IsNull (Location l)
69 static public Location Null {
71 return new Location (-1);
80 foreach (int b in list){
83 return (string) map [b];
95 foreach (int b in list){