コード例 #1
0
        public void AddOption(string optname, int line)
        {
            int optval; Symbol sym;

            try {
                optval = (int)Enum.Parse(typeof(Options), optname);
            } catch (System.ArgumentException) {
                errors.SemErr("Unsupported option '" + optname + "' encountered.");
                return;
            }
            useVector[optval] = true;
            sym = tab.FindSym(optname);
            if (sym == null)
            {
                tab.NewSym(Node.t, optname, line);
            }
        }
コード例 #2
0
        void WriteDeclarations()
        {
            Symbol sym;

            gen.WriteLine("    static readonly int[] useKindVector = new int[] {");
            foreach (string optname in Enum.GetNames(typeof(Options)))
            {
                sym = tab.FindSym(optname);
                gen.WriteLine("        {0}, // {1}",
                              sym == null ? -1 : sym.n, optname);
            }
            gen.WriteLine("    };");
        }