public void loadFromFile(string filename) { FileWorker actionsWorker = new FileWorker(filename); List <string> strings = actionsWorker.readAllLinesToList(); string regex = "true|false|\\(\\w+[,][\\s\\w]+\\)"; Regex reg = new Regex(regex); for (int i = 0; i < strings.Count; i++) { MatchCollection matches = reg.Matches(strings[i]); bool shift = bool.Parse(matches[0].Value); ActionValue[] data = new ActionValue[matches.Count - 1]; if (matches.Count - 1 > 0) { for (int j = 0; j < matches.Count - 1; j++) { string subregex = "\\w+"; Regex subreg = new Regex(subregex); MatchCollection submatches = subreg.Matches(matches[j + 1].Value); int state = (submatches[0].Value == "sSym" ? Actions.SYNTAX_SYMBOL : (submatches[0].Value == "sAct" ? Actions.SYNTAX_ACTION : int.Parse(submatches[0].Value))); int value = int.Parse(submatches[1].Value); data[j] = new ActionValue(state, value); } } this.data.Add(new ActionData(shift, data)); } }
public void push(ActionValue item) { this.data.push(item); }
private void setItem(int i, ActionValue value) { this.data[i] = value; }