public VariableDescription(ATriggerDecl triggerDecl) { Name = triggerDecl.GetName().Text; Type = "trigger"; PlacementPrefix = "Field"; VariableType = VariableTypes.Field; Const = false; IsStatic = false; realType = new ANamedType(new TIdentifier("trigger"), null); Visibility = (PVisibilityModifier)triggerDecl.GetVisibilityModifier().Clone(); Line = triggerDecl.GetName().Line; Position = TextPoint.FromCompilerCoords(triggerDecl.GetActionsToken()); }
/*public override void OutAIncludeDecl(AIncludeDecl node) * { * string name = Util.GetString(node.GetName()); * SourceFileContents sourceFile = compiler.LookupFile(name); * if (sourceFile != null) * { * Includes.Add(sourceFile); * } * }*/ public override void OutATriggerDecl(ATriggerDecl node) { //Add field Fields.Add(new VariableDescription(node)); //Add event method //The methods don't start from node.GetName(), make the parser add the events, conditions and action tokens if (node.GetEvents() != null) { Methods.Add( new MethodDescription(TextPoint.FromCompilerCoords(node.GetEventToken().Line, node.GetEventToken().Pos), new AVoidType(new TVoid("void")), (AABlock)node.GetEvents(), null)); } if (node.GetConditions() != null) { Methods.Add( new MethodDescription(TextPoint.FromCompilerCoords(node.GetConditionsToken().Line, node.GetConditionsToken().Pos), new AVoidType(new TVoid("void")), (AABlock)node.GetConditions(), null)); } //Actions. this one can be called { AMethodDecl method = new AMethodDecl((PVisibilityModifier)node.GetVisibilityModifier().Clone(), null, null, null, null, null, new ANamedType(new TIdentifier("bool"), null), new TIdentifier(node.GetName().Text, node.GetActionsToken().Line, node.GetActionsToken().Pos), new ArrayList() { new AALocalDecl(new APublicVisibilityModifier(), null, null, null, null, new ANamedType( new TIdentifier("bool"), null), new TIdentifier("testConds"), null), new AALocalDecl(new APublicVisibilityModifier(), null, null, null, null, new ANamedType( new TIdentifier("bool"), null), new TIdentifier("runActions"), null) }, node.GetActions()); Methods.Add(new MethodDescription(method)); } }