/// <summary> /// This method prints the apinNode /// </summary> /// <param name="apinNode">The node to print.</param> /// <returns>Returns null</returns> public override object Visit(APinNode apinNode) { Print("APinNode"); return(null); }
/// <summary> /// This method visits an Apin node /// It checks if the analog pin is defined or is a part of an expression /// If its a part of an expression it prints the Apin and the ID /// </summary> /// <param name="apinNode">The name of the node</param> /// <returns>Returns the Apin ID or "AnalogueRead(Apin and ID)"</returns> public override object Visit(APinNode apinNode) { return(apinNode.Parent == null ? apinNode.Id : $"analogueRead({apinNode.Id})"); }
/// <summary> /// This method type checks the APinNode node in the AST. /// </summary> /// <param name="apinNode">The node to check.</param> /// <returns>APin type context</returns> public override object Visit(APinNode apinNode) { return(new TypeContext(NUMERIC)); }
/// <summary> /// This visits an APin node /// </summary> /// <param name="apinNode">The visited node</param> /// <returns></returns> public abstract object Visit(APinNode apinNode);