private void Implement_Template(GMacMacroTemplate macroTemplate, GMacFrame frame) { try { Context.MarkCheckPointState(); Context.PushState(frame.ChildSymbolScope); var macro = GMacMacroGenerator.Translate(Context, macroTemplate.TemplateParseNode); _generatedMacros.Add(macro); Context.PopState(); Context.UnmarkCheckPointState(); } catch (CompilerException) { Context.RestoreToCheckPointState(); } catch (Exception e) { Context.RestoreToCheckPointState(); throw (new Exception("Unhandled Exception", e)); } }
public void Visit(GMacMacroTemplate template) { Log.AppendAtNewLine("template macro "); Log.Append(template.SymbolAccessName); Log.AppendLineAtNewLine(); }
public TreeNode Visit(GMacMacroTemplate macroTemplate) { var node = new TreeNode("<MACRO_TEMPLATE> " + macroTemplate.ObjectName) { Tag = macroTemplate }; return(node); }
public void Visit(GMacMacroTemplate macroTemplate) { var node = new TreeNode(macroTemplate.SymbolAccessName) { Tag = macroTemplate }; RoleNodes[MacroTemplatesNode].Nodes.Add(node); }
//public override void ResetOnAcquire() //{ // base.ResetOnAcquire(); // _generatedMacroTemplate = null; //} private void translate_MacroTemplate() { try { Context.MarkCheckPointState(); var nodeMacro = RootParseNode.ChildNodes[0]; //Read the name of the new macro template var qualList = GenUtils.Translate_Qualified_Identifier(nodeMacro.ChildNodes[0]); if (qualList.ActiveLength > 1) { CompilationLog.RaiseGeneratorError <int>("Template name cannot be a qualified name", RootParseNode.ChildNodes[0]); } var templateName = qualList.FirstItem; if (Context.ParentNamespace.CanDefineChildSymbol(templateName) == false) { CompilationLog.RaiseGeneratorError <int>("Symbol name already used", RootParseNode.ChildNodes[0]); } _generatedMacroTemplate = Context.ParentNamespace.DefineMacroTemplate(templateName, nodeMacro); _generatedMacroTemplate.CodeLocation = Context.GetCodeLocation(RootParseNode); Context.UnmarkCheckPointState(); } catch (CompilerException) { Context.RestoreToCheckPointState(); } catch (Exception e) { Context.RestoreToCheckPointState(); throw new Exception("Unhandled Exception", e); } }