public static List <Variable> GetArgs(string data, ref int from, char start, char end, out bool isList) { List <Variable> args = new List <Variable>(); isList = from < data.Length && data[from] == Constants.START_GROUP; if (from >= data.Length || data[from] == Constants.END_STATEMENT) { return(args); } int lastChar = from; Utils.GetBodyBetween(data, ref lastChar, start, end); while (from < lastChar) { Variable item = Utils.GetItem(data, ref from); if (item.Equals(Variable.EmptyInstance)) { break; } args.Add(item); } MoveForwardIf(data, ref from, end, Constants.SPACE); return(args); }
internal Variable ProcessSwitch(ParsingScript script) { Variable switchValue = Utils.GetItem(script); script.Forward(); Variable result = Variable.EmptyInstance; var caseSep = ":".ToCharArray(); bool caseDone = false; while (script.StillValid()) { var nextToken = Utils.GetBodySize(script, Constants.CASE, Constants.DEFAULT); if (string.IsNullOrEmpty(nextToken)) { break; } if (nextToken == Constants.DEFAULT && !caseDone) { result = ProcessBlock(script); break; } if (!caseDone) { Variable caseValue = script.Execute(caseSep); script.Forward(); if (switchValue.Type == caseValue.Type && switchValue.Equals(caseValue)) { caseDone = true; result = ProcessBlock(script); if (script.Prev == '}') { break; } script.Forward(); } } } script.MoveForwardIfNotPrevious('}'); script.GoToNextStatement(); return(result); }