Exemplo n.º 1
0
        public void EnterBlock(string name, Definition definition)
        {
            #if TEST
            if (name == null)
                throw new System.ArgumentException("name");
            if (definition == null)
                throw new System.ArgumentException("definition");
            #endif

            // Handle re-visits to existing scopes.
            Folder<Symbol> found = (Folder<Symbol>) _stack.Peek().Resolve(name);
            if (found != null && found.Data.Definition == definition)
            {
                _stack.Push(found);
                return;
            }

            // Create new folder and push it onto the stack of open folders.
            Symbol symbol = new Symbol(definition);
            symbol.Folder = _stack.Peek().InsertFolder(name, symbol);
            _stack.Push(symbol.Folder);
        }
Exemplo n.º 2
0
 public Symbol(Definition definition, Folder<Symbol> folder = null)
 {
     _folder = folder;
     _definition = definition;
 }
 private void PrintDefinition(Definition that)
 {
     PrintNodeId("Name", that.Name);
 }
Exemplo n.º 4
0
 /** Inserts the specified name into this symbol table and returns the corresponding symbol. */
 public Symbol Insert(string name, Definition definition)
 {
     #if TEST
     if (name == null)
         throw new System.ArgumentException("name");
     #endif
     Symbol symbol = new Symbol(definition, _stack.Peek());
     try
     {
         _stack.Peek().InsertObject(name, symbol);
     }
     catch (Toolbox.VFS.Error)
     {
         throw new ParserError(definition.Cursor, "Symbol already exists: " + name);
     }
     return symbol;
 }