Example #1
0
        /// <summary>
        /// This method prints the dpinNode
        /// </summary>
        /// <param name="dpinNode">The node to print.</param>
        /// <returns>Returns null</returns>
        public override object Visit(DPinNode dpinNode)
        {
            Print("DPinNode");

            return(null);
        }
 /// <summary>
 /// This method visits an Apin node
 /// It checks if the digital pin is defined or is a part of an expression
 /// If its a part of an expression it prints the Dpin and the ID
 /// </summary>
 /// <param name="dpinNode">The name of the node</param>
 /// <returns>Returns the Dpin ID or "digitalRead(Dpin and ID)"</returns>
 public override object Visit(DPinNode dpinNode)
 {
     return(dpinNode.Parent == null ? dpinNode.Id : $"digitalRead({dpinNode.Id})");
 }
Example #3
0
 /// <summary>
 /// This method type checks the DPinNode node in the AST.
 /// </summary>
 /// <param name="dpinNode">The node to check.</param>
 /// <returns>DPin type context</returns>
 public override object Visit(DPinNode dpinNode)
 {
     return(PWM.Contains(dpinNode.Id) ? new TypeContext(NUMERIC) : new TypeContext(BOOL));
 }
Example #4
0
 /// <summary>
 /// This visits a DPin node
 /// </summary>
 /// <param name="dpinNode">The visited node</param>
 /// <returns></returns>
 public abstract object Visit(DPinNode dpinNode);