private Pivot buildPivot(Pivot fn) { var gVal = getValue(FunDefination.fun, _current.Value); var items = split(FunDefination.splitbyComma, gVal); if (items.Length == 4) { fn.Datasource = items[0]; var row = items[1]; var col = items[2]; var agg = items[3]; if (QScriptParser.Scan(FunDefination.row, row) == true) { var rs = split(FunDefination.splitbyComma, row.Replace("row:[", "").Replace("]", "")); foreach (string s in rs) { fn.AddRowFields(s); } } { AddError(Source.Severity.Error, "invalid pivot row syntax", _current.Span); } if (QScriptParser.Scan(FunDefination.column, col) == true) { var rs = split(FunDefination.splitbyComma, col.Replace("column:[", "").Replace("]", "")); foreach (string s in rs) { fn.AddColumnFields(s); } } else { AddError(Source.Severity.Error, "invalid pivot column syntax", _current.Span); } if (QScriptParser.Scan(FunDefination.agg, agg) == true) { var rs = split(FunDefination.splitbyComma, agg.Replace("column:[", "").Replace("]", "")); foreach (string s in rs) { var aggitems = split(@":", s); if (aggitems.Length == 2) { if (getAggType(aggitems[1]) != AggregateType.none) { fn.AddAggregate(aggitems[0], getAggType(aggitems[1])); } else { AddError(Source.Severity.Error, "Invalid pivot aggregate syntax", _current.Span); } } else { AddError(Source.Severity.Error, "Invalid pivot aggregate syntax", _current.Span); } } } else { AddError(Source.Severity.Error, "invalid pivot row syntax", _current.Span); } } else { AddError(Source.Severity.Error, "Invalid pivot function", _current.Span); } return(fn); }