internal void ParseXmlPortElementProperties(Lines lines) { lines.LastLineMustMatch(Patterns.BlankLine); lines.LastLineMustMatch(Patterns.EndXmlPortElement); foreach (var chunk in lines.Chunks(Patterns.PropertySignature)) { ParseProperty(chunk, true); } }
internal void ParseFormControlProperties(Lines lines) { lines.LastLineMustMatch(Patterns.BlankLine); lines.LastLineMustMatch(Patterns.EndPageControl); foreach (var chunk in lines.Chunks(Patterns.PropertySignature)) { ParseProperty(chunk, true); } }
internal void ParseObject(Lines lines) { var match = lines.FirstLineMustMatch(Patterns.ObjectSignature); var objectType = match.Groups [1].Value.ToEnum <ObjectType>(); var objectID = match.Groups [2].Value.ToInteger(); var objectName = match.Groups [3].Value; Listener.OnBeginObject(objectType, objectID, objectName); lines.FirstLineMustMatch(Patterns.BeginObject); while (lines.LastLineTryMatch(Patterns.BlankLine)) { ; } lines.LastLineMustMatch(Patterns.EndObject); // Because of the odd indentation of RDLData, we need to extract it // first (if present), so that the remaining lines follow the normal // section pattern. if (objectType == ObjectType.Report) { ParseRdlDataSection(lines); } lines.Unindent(2); foreach (var chunk in lines.Chunks(Patterns.SectionSignature)) { ParseSection(chunk, objectType); } Listener.OnEndObject(); }
internal void ParseDocumentation(Lines lines) { lines.FirstLineMustMatch(Patterns.BeginDocumentation); lines.LastLineMustMatch(Patterns.EndDocumentation); if (lines.FirstLineTryMatch(Patterns.BeginSection)) { lines.LastLineMustMatch(Patterns.EndSection); } lines.Unindent(2); while (lines.Any()) { Listener.OnCodeLine(lines.FirstLineMustMatch(Patterns.Any).Value); } }
internal void ParseProperty(Lines lines, bool mayHaveTriggers) { if (mayHaveTriggers) { if (ParseTrigger(lines)) { return; } } var match = lines.FirstLineMustMatch(Patterns.PropertySignature); var propertyName = match.Groups[1].Value; //propertyName = CodeStyle.CustomPropertyMappings.GetRealName(propertyName); var propertyValueFirstLine = match.Groups[3].Value; switch (propertyName) { case "ActionList": lines.FirstLineMustMatch(Patterns.BeginSection); lines.LastLineMustMatch(Patterns.EndSection); lines.Unindent(2); ParseActionList(lines); return; case "Menu": lines.FirstLineMustMatch(Patterns.BeginSection); lines.LastLineMustMatch(Patterns.EndSection); lines.Unindent(2); ParseFormMenuItems(lines); return; } var stringBuilder = new StringBuilder(propertyValueFirstLine); if (IsMultiLineProperty(propertyName)) { foreach (var line in lines) { stringBuilder.AppendFormat(" {0}", line.TrimStart()); } } var propertyValue = stringBuilder.ToString().TrimEnd(";".ToCharArray()); Listener.OnProperty(propertyName, propertyValue); }
internal void ParseWordLayoutSection(Lines lines) { lines.LastLineMustMatch(Patterns.EndWordLayoutSection); foreach (var line in lines) { Listener.OnCodeLine(line); } }
internal void ParseTableFieldProperties(Lines lines) { lines.LastLineMustMatch(Patterns.EndTableField); foreach (var chunk in lines.Chunks(Patterns.PropertySignature)) { ParseProperty(chunk, true); } }
internal void ParseReportLabelProperties(Lines lines) { lines.LastLineMustMatch(Patterns.EndReportLabel); foreach (var chunk in lines.Chunks(Patterns.PropertySignature)) { ParseProperty(chunk, true); } }
internal void ParseFieldGroupProperties(Lines lines) { lines.LastLineMustMatch(Patterns.EndFieldGroup); foreach (var chunk in lines.Chunks(Patterns.PropertySignature)) { ParseProperty(chunk, false); } }
internal void ParsePageActionProperties(Lines lines) { lines.LastLineMustMatch(Patterns.EndPageAction); foreach (var chunk in lines.Chunks(Patterns.PropertySignature)) { ParseProperty(chunk, true); } }
internal void FormMenuItemProperties(Lines lines) { lines.LastLineMustMatch(Patterns.EndMenuItem); foreach (var chunk in lines.Chunks(Patterns.PropertySignature)) { ParseProperty(chunk, true); } }
internal void ParseQueryElement(Lines lines) { var match = lines.FirstLineMustMatch(Patterns.QueryElement); var elementID = match.Groups[1].Value.ToInteger(); var elementIndentation = match.Groups[2].Value.ToNullableInteger(); var elementType = match.Groups[3].Value.ToEnum <QueryElementType>(); var elementName = match.Groups[4].Value.Trim(); var propertyIndentation = (lines.First().Length - lines.First().TrimStart().Length); Listener.OnBeginQueryElement(elementID, elementIndentation, elementName, elementType); lines.Unindent(propertyIndentation); lines.LastLineMustMatch(Patterns.BlankLine); lines.LastLineMustMatch(Patterns.EndQueryElement); foreach (var chunk in lines.Chunks(Patterns.PropertySignature)) { ParseProperty(chunk, true); } Listener.OnEndQueryElement(); }
internal void ParseCodeLines(Lines lines) { lines.LastLineTryMatch(Patterns.BlankLine); lines.FirstLineTryMatch(Patterns.BeginCodeBlock); lines.LastLineMustMatch(Patterns.EndCodeBlock); lines.Unindent(2); foreach (var line in lines) { Listener.OnCodeLine(line); } }
internal void ParseReportDataItem(Lines lines, ObjectType objectType) { lines.FirstLineMustMatch(Patterns.BeginClassicSection); lines.LastLineMustMatch(Patterns.EndDataItem); lines.Unindent(2); Listener.OnBeginReportDataItem(); foreach (var chunk in lines.Chunks(Patterns.SectionSignature)) { ParseSection(chunk, objectType); } Listener.OnEndReportDataItem(); }
internal void ParseMenuSuiteNode(Lines lines) { var match = lines.FirstLineMustMatch(Patterns.MenuSuiteNode); var nodeType = match.Groups[1].Value.ToMenuSuiteNodeType(); var nodeID = match.Groups[2].Value.ToGuid(); var nodeSeparator = match.Groups[3].Value; Listener.OnBeginMenuSuiteNode(nodeType, nodeID); if (nodeSeparator == ";") { lines.Unindent(60); lines.LastLineMustMatch(Patterns.EndMenuSuiteNode); foreach (var chunk in lines.Chunks(Patterns.PropertySignature)) { ParseProperty(chunk, true); } } Listener.OnEndMenuSuiteNode(); }
internal void ParseProperty(Lines lines, bool mayHaveTriggers) { if (mayHaveTriggers) { if (ParseTrigger(lines)) { return; } } var match = lines.FirstLineMustMatch(Patterns.PropertySignature); var propertyName = match.Groups[1].Value; var propertyValueFirstLine = match.Groups[2].Value; if (propertyName == "ActionList") { lines.FirstLineMustMatch(Patterns.BeginSection); lines.LastLineMustMatch(Patterns.EndSection); lines.Unindent(2); ParseActionList(lines); return; } var stringBuilder = new StringBuilder(propertyValueFirstLine); lines.Unindent(propertyName.Length + 1); foreach (var line in lines) { stringBuilder.AppendFormat(" {0}", line.TrimStart()); // stringBuilder.Append(line.TrimStart()); } var propertyValue = stringBuilder.ToString().TrimEnd(";".ToCharArray()); Listener.OnProperty(propertyName, propertyValue); }
internal void ParseSection(Lines lines, ObjectType objectType, bool forceNewFormat = false, bool inRequestFormOrPage = false) { var match = lines.FirstLineMustMatch(Patterns.SectionSignature); var sectionType = match.Groups[1].Value.ToSectionType(); Listener.OnBeginSection(sectionType); lines.FirstLineMustMatch(Patterns.BeginSection); lines.LastLineMustMatch(Patterns.EndSection); lines.Unindent(2); switch (sectionType) { case SectionType.ObjectProperties: ParseObjectPropertiesSection(lines); break; case SectionType.Properties: ParsePropertiesSection(lines); break; case SectionType.Fields: switch (objectType) { case ObjectType.Table: ParseTableFieldsSection(lines); break; case ObjectType.Dataport: ParseDataPortFieldsSection(lines); break; } break; case SectionType.Keys: ParseKeysSection(lines); break; case SectionType.FieldGroups: ParseFieldGroupsSection(lines); break; case SectionType.Controls: switch (objectType) { case ObjectType.Page: case ObjectType.XmlPort: ParsePageControlsSection(lines); break; case ObjectType.Form: case ObjectType.Dataport: ParseFormControlsSection(lines); break; case ObjectType.Report: if (forceNewFormat) { ParsePageControlsSection(lines); } else { if (inRequestFormOrPage) { ParseFormControlsSection(lines); } else { ParseReportControlsSection(lines); } } break; } break; case SectionType.Elements: switch (objectType) { case ObjectType.Query: ParseQueryElementsSection(lines); break; case ObjectType.XmlPort: ParseXmlPortElementsSection(lines); break; } break; case SectionType.Events: break; case SectionType.Dataset: ParseDatasetSection(lines); break; case SectionType.Labels: ParseLabelsSection(lines); break; case SectionType.RdlData: break; case SectionType.WordLayout: ParseWordLayoutSection(lines); break; case SectionType.Code: ParseCodeSection(lines); break; case SectionType.RequestPage: ParseRequestPageSection(lines, objectType); break; case SectionType.MenuNodes: ParseMenuNodesSection(lines); break; case SectionType.RequestForm: ParseRequestFormSection(lines, objectType); break; case SectionType.DataItems: ParseDataItemsSection(lines, objectType); break; case SectionType.Sections: ParseSectionsSection(lines, objectType); break; default: Exceptions.ThrowException(Exceptions.UnknownSectionType, sectionType); break; } Listener.OnEndSection(); }