protected void Start() { if (seed == null) { seed = new LSSeed(seedInput); } if (rules == null) { int numRules = rulesInput.Length; rules = new LSRule[numRules]; for (int i = 0; i < numRules; i++) { rules[i] = LSRule.FromString(rulesInput[i]); } } if (constants == null) { int numConstants = constantsInput.Length; constants = new LSSymbol[numConstants]; for (int i = 0; i < numConstants; i++) { constants[i] = new LSSymbol(constantsInput[i]); } } }
public static LSRule FromString(string input, string output) { LSSymbol inputSb = new LSSymbol(input); int numOutput = output.Length; LSSymbol[] outputSbs = new LSSymbol[numOutput]; for (int i = 0; i < numOutput; i++) { outputSbs[i] = new LSSymbol(output[i]); } LSRule rule = new LSRule(inputSb, outputSbs); return(rule); }
public LSRule(LSSymbol input, LSSymbol[] output) { this.input = input; this.output = output; }