public override bool Parse() { Parser parser = Parser.instance; // If the parser hasn't visited this join yet if (!_isSaturated) { // Add jump command with if count as label parser.AddCommand(Parser.CMD_JUMP, parser.ifCount, this); // Add if count as argument parser.AddCommand(parser.ifCount, this); // Get the if node related to this join IfNode prevIf = (IfNode)parser.FindIfWithLabel(parser.ifCount).node; // Set the parsers node to parse back to the false stream of // the if node parser.currentNode = prevIf.altNextNode; // Mark this node as visited _isSaturated = true; return(false); } else { // Add end if command with if count as label parser.AddCommand(Parser.CMD_ENDIF, parser.ifCount, this); // Decrease if count --parser.ifCount; return(true); } }
public override bool Parse() { Parser parser = Parser.instance; // Increment if count and add if command with if count as label parser.AddCommand(Parser.CMD_IF, ++parser.ifCount, this); // Add if counter as argument parser.AddCommand(parser.ifCount, this); return(true); }
public override bool Parse() { Parser parser = Parser.instance; // Add read command parser.AddCommand(Parser.CMD_READ, this); // Add pin to read as argument parser.AddCommand(int.Parse(portInput.text), this); return(true); }
public override bool Parse() { Parser parser = Parser.instance; // Get port write value int value = (portValue.isOn) ? 1 : 0; // Add write command parser.AddCommand(Parser.CMD_WRITE, this); // Add pin to write to as argument parser.AddCommand(int.Parse(portInput.text), this); // Add value to write as argument parser.AddCommand(value, this); return(true); }
public override bool Parse() { /// /// If value is 0, mode is INPUT /// If value is 1, mode is OUTPUT /// Parser parser = Parser.instance; // Get mode value int value = (portValue.isOn) ? 1 : 0; // Add pin time command parser.AddCommand(Parser.CMD_SET_MODE, this); // Add pin to set mode as argument parser.AddCommand(int.Parse(portInput.text), this); // Add mode value as argument parser.AddCommand(value, this); return(true); }