public override void doAction(ITokenCollection semi) { Elem elem; try { // if stack is empty (shouldn't be) pop() will throw exception elem = repo_.stack.pop(); // record ending line count and scope level if (elem.type == "namespace") // if a end of namespace scope detected, we pop the namespaceStack { repo_.namespaceStack.Pop(); } for (int i = 0; i < repo_.locations.Count; ++i) { Elem temp = repo_.locations[i]; if (elem.type == temp.type) { if (elem.name == temp.name) { if ((repo_.locations[i]).endLine == 0) { (repo_.locations[i]).endLine = repo_.semi.lineCount(); (repo_.locations[i]).endScopeCount = repo_.scopeCount; break; } } } } } catch { return; } if (AAction.displaySemi) { Lexer.ITokenCollection local = Factory.create(); local.add(elem.type).add(elem.name); if (local[0] == "control") { return; } Console.Write("\n line# {0,-5}", repo_.semi.lineCount()); Console.Write("leaving "); string indent = new string(' ', 2 * (repo_.stack.count + 1)); Console.Write("{0}", indent); this.display(local); // defined in abstract action } }
public override void doAction(ITokenCollection semi) { Display.displayActions(actionDelegate, "action SaveDeclar"); Elem elem; try { elem = repo_.stack.pop(); TypeInfo tempT = new TypeInfo(); tempT.file = file_; extractType(elem); for (int i = 0; i < repo_.locations.Count; ++i) { Elem temp = repo_.locations[i]; if (elem.type == temp.type) { if (elem.name == temp.name) { if ((repo_.locations[i]).endLine == 0) { (repo_.locations[i]).endLine = repo_.semi.lineCount(); (repo_.locations[i]).endScopeCount = repo_.scopeCount; break; } } } } } catch { return; } if (AAction.displaySemi) { Lexer.ITokenCollection local = Factory.create(); local.add(elem.type).add(elem.name); if (local[0] == "control") { return; } Console.Write("\n line# {0,-5}", repo_.semi.lineCount()); Console.Write("leaving "); string indent = new string(' ', 2 * (repo_.stack.count + 1)); Console.Write("{0}", indent); this.display(local); // defined in abstract action } }