private bool ParseMacroDefinition(ParseTreeNode node, Block block, out MacroDefinition res) { res = new Assemble.MacroDefinition(); res.AssemblePosition = new Assemble.AssemblePosition(this.ParsingFilePath, node); res.ParentBlock = block; res.DefinedBlock = block; res.RootCode = block.RootCode; { //macro + name + ( + args + ) + { + contents + } //Name res.Name = node.ChildNodes[1].Token.Text; //Arguments if (!ParseMacroDefinitionArguments(node.ChildNodes[3], block, out res.Arguments)) { return(false); } //Contents Block blkedRes = res; if (!ParseBlockContents(node.ChildNodes[6], ref blkedRes)) { return(false); } } return(true); }
public new MacroDefinition Clone(Block parentBlock) { var res = new Assemble.MacroDefinition() { AssemblePosition = this.AssemblePosition, Name = this.Name, RootCode = this.RootCode, ParentBlock = parentBlock, DefinedBlock = this.DefinedBlock,////////////////////////////////////////////// }; //Arguments res.Arguments = new ArgumentElement[this.Arguments.Length]; for (int i = 0; i < this.Arguments.Length; i++) { res.Arguments[i] = this.Arguments[i].Clone(res); //Parent is new result block } //Variables res.Variables = new List <Variable>(); for (int i = 0; i < this.Variables.Count; i++) { res.Variables.Add(this.Variables[i].Clone(res)); } //Statements res.Statements = new List <StatementElement>(); for (int i = 0; i < this.Statements.Count; i++) { res.Statements.Add(this.Statements[i].Clone(res)); } //MacroDefinitions res.MacroDefinitions = new List <MacroDefinition>(); for (int i = 0; i < this.MacroDefinitions.Count; i++) { res.MacroDefinitions.Add(this.MacroDefinitions[i].Clone(res)); } return(res); }