Exemplo n.º 1
0
        internal void HandleLhs(ident i, BekTypes t, bool implicitdefine = false)
        {
            SymtabElt e;

            if (TryGetElt(i.name, out e))
            {
                if (implicitdefine)
                {
                    throw new BekParseException(i.line, i.pos, string.Format("'{0}' already defined", i.name));
                }
                if (e.type != t)
                {
                    throw new BekParseException(i.line, i.pos, string.Format("'{0}' inconsistent type", i.name));
                }

                this.symtab[i] = e;
            }
            else if (implicitdefine)
            {
                e = new SymtabElt(i, t);
                this.AddElt(i, e);
            }
            else
            {
                throw new BekParseException(i.line, i.pos, string.Format("'{0}' undefined", i.name));
            }
        }
Exemplo n.º 2
0
        internal void HandleLhs(ident i, BekTypes t, bool implicitdefine=false)
        {
            SymtabElt e;
            if (TryGetElt(i.name, out e))
            {
                if (implicitdefine)
                    throw new BekParseException(i.line, i.pos, string.Format("'{0}' already defined", i.name));
                if (e.type != t)
                    throw new BekParseException(i.line, i.pos, string.Format("'{0}' inconsistent type", i.name));

                this.symtab[i] = e;
            }
            else if (implicitdefine)
            {
                e = new SymtabElt(i, t);
                this.AddElt(i, e);
            }
            else
            {
                throw new BekParseException(i.line, i.pos, string.Format("'{0}' undefined", i.name));
            }
        }
Exemplo n.º 3
0
 internal SymtabElt AddElt(ident i, SymtabElt e)
 {
     this.names.Peek()[i.name] = e;
     this.symtab[i] = e;
     return e;
 }
Exemplo n.º 4
0
 internal bool TryGetElt(string name, out SymtabElt e)
 {
     return this.names.Peek().TryGetValue(name, out e);
 }
Exemplo n.º 5
0
 internal SymtabElt AddElt(ident i, SymtabElt e)
 {
     this.names.Peek()[i.name] = e;
     this.symtab[i]            = e;
     return(e);
 }
Exemplo n.º 6
0
 internal bool TryGetElt(string name, out SymtabElt e)
 {
     return(this.names.Peek().TryGetValue(name, out e));
 }