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();
        }
Exemplo n.º 2
0
        internal void ParseGlobals(Lines lines)
        {
            if (lines.FirstLineTryMatch(Patterns.BlankLine))
            {
                return;
            }

            lines.FirstLineMustMatch(Patterns.Variables);

            while (true)
            {
                if (lines.FirstLineTryMatch(Patterns.ProcedureSignature, false))
                {
                    break;
                }

                if (!lines.FirstLineTryMatch(Patterns.BlankLine))
                {
                    if (!ParseVariable(lines))
                    {
                        if (!ParseMultiLineTextConstant(lines))
                        {
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        internal void ParseObjectProperty(Lines lines)
        {
            var match         = lines.FirstLineMustMatch(Patterns.ObjectPropertySignature);
            var propertyName  = match.Groups[1].Value;
            var propertyValue = match.Groups[2].Value;

            Listener.OnObjectProperty(propertyName, propertyValue);
        }
Exemplo n.º 5
0
        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 ParseObjectProperty(Lines lines)
        {
            var match        = lines.FirstLineMustMatch(Patterns.ObjectPropertySignature);
            var propertyName = match.Groups[1].Value;

            propertyName = CodeStyle.CustomPropertyMappings.GetRealName(propertyName);
            var propertyValue = match.Groups[2].Value;

            Listener.OnObjectProperty(propertyName, propertyValue);
        }
Exemplo n.º 7
0
        internal void ParseFormMenuItem(Lines lines)
        {
            var match = lines.FirstLineMustMatch(Patterns.BeginMenuItem);

            Listener.OnBeginFormMenuItem();

            lines.Unindent(2);
            lines.FirstLineTryMatch(Patterns.BlankLine);
            FormMenuItemProperties(lines);

            Listener.OnEndFormMenuItem();
        }
Exemplo n.º 8
0
        internal bool ParseEvent(Lines lines)
        {
            Match match;

            if (!lines.FirstLineTryMatch(Patterns.EventSignature, out match))
            {
                return(false);
            }

            var variableName = match.Groups[1].Value;
            var variableID   = match.Groups[2].Value.ToInteger();
            var eventName    = match.Groups[3].Value;
            var eventID      = match.Groups[4].Value.ToInteger();

            Listener.OnBeginEvent(variableID, variableName, eventID, eventName);

            ParseParameters(lines);
            lines.FirstLineMustMatch(Patterns.ProcedureNoReturnValue);

            if (lines.FirstLineTryMatch(Patterns.Variables))
            {
                ParseLocals(lines);
            }
            else
            {
                lines.FirstLineMustMatch(Patterns.BeginCodeBlock);
            }

            while (!lines.FirstLineTryMatch(Patterns.EndCodeBlock))
            {
                Listener.OnCodeLine(lines.FirstLineMustMatch(Patterns.Any).Value.UnIndent(2));
            }

            Listener.OnEndEvent();

            lines.FirstLineTryMatch(Patterns.BlankLine);
            return(true);
        }
Exemplo n.º 9
0
        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 ParseFormMenuItem(Lines lines)
        {
            var match             = lines.FirstLineMustMatch(Patterns.PageAction);
            var menuItemSeparator = match.Groups[1].Value;

            Listener.OnBeginFormMenuItem();

            if (menuItemSeparator == ";")
            {
                lines.Unindent(2);
                FormMenuItemProperties(lines);
            }

            Listener.OnEndFormMenuItem();
        }
Exemplo n.º 11
0
        internal void ParseParameters(Lines lines)
        {
            var match      = lines.FirstLineMustMatch(Patterns.ProcedureParameters);
            var parameters = match.Groups[1].Value;

            if (string.IsNullOrEmpty(parameters))
            {
                return;
            }

            foreach (var parameter in parameters.Split(";".ToCharArray()))
            {
                ParseParameter(parameter);
            }
        }
        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();
        }
Exemplo n.º 13
0
        internal void ParseReturnValue(Lines lines)
        {
            if (lines.FirstLineTryMatch(Patterns.ProcedureNoReturnValue))
            {
                return;
            }

            var match                 = lines.FirstLineMustMatch(Patterns.ProcedureReturnValue);
            var returnValueName       = match.Groups[1].Value.Trim();
            var returnValueType       = match.Groups[2].Value;
            var returnValueLength     = ParseVariableLength(ref returnValueType);
            var returnValueDimensions = ParseDimensions(ref returnValueType);

            Listener.OnReturnValue(returnValueName, returnValueType.ToEnum <FunctionReturnValueType>(), returnValueLength, returnValueDimensions);
        }
        internal void ParseTableKey(Lines lines)
        {
            var match      = lines.FirstLineMustMatch(Patterns.TableKey);
            var keyEnabled = match.Groups[1].Value.ToNullableBoolean(CodeStyle.Localization);
            var keyFields  = match.Groups[2].Value.TrimEnd().Split(",".ToCharArray());
            var separator  = match.Groups[3].Value;

            Listener.OnBeginTableKey(keyEnabled, keyFields);

            if (separator == ";")
            {
                lines.Unindent(Math.Min(match.Length, 47));
                ParseTableKeyProperties(lines);
            }

            Listener.OnEndTableKey();
        }
Exemplo n.º 15
0
        internal void ParseReportLabel(Lines lines)
        {
            var match          = lines.FirstLineMustMatch(Patterns.ReportLabel);
            var labelID        = match.Groups[1].Value.ToInteger();
            var labelName      = match.Groups[2].Value.Trim();
            var labelSeparator = match.Groups[3].Value;

            Listener.OnBeginReportLabel(labelID, labelName);

            if (labelSeparator == ";")
            {
                lines.Unindent(28);
                ParseReportLabelProperties(lines);
            }

            Listener.OnEndReportLabel();
        }
Exemplo n.º 16
0
        internal void ParseFormControl(Lines lines)
        {
            var match            = lines.FirstLineMustMatch(Patterns.FormControl);
            var controlID        = match.Groups[1].Value.ToInteger();
            var controlType      = match.Groups[2].Value.ToEnum <ClassicControlType>();
            var posX             = match.Groups[3].Value.ToInteger();
            var posY             = match.Groups[4].Value.ToInteger();
            var width            = match.Groups[5].Value.ToInteger();
            var height           = match.Groups[6].Value.ToInteger();
            var controlSeparator = match.Groups[7].Value;

            Listener.OnBeginFormControl(controlID, controlType, posX, posY, width, height);

            if (controlSeparator == ";")
            {
                var indentation = FindBestIndentationForFormControl(match.Value, lines);
                lines.Unindent(indentation);
                var list   = lines.ToList();
                int dedent = 0;
                foreach (var line in lines.Skip(1))
                {
                    var trimmedLine = line.TrimStart();
                    if (trimmedLine.EndsWith("=BEGIN") || trimmedLine.EndsWith("=VAR") || trimmedLine.EndsWith("=MENUITEMS") || trimmedLine.Contains("RunFormLink="))
                    {
                        dedent = line.Length - trimmedLine.Length;
                        break;
                    }

                    if (dedent == 0)
                    {
                        dedent = line.Length - trimmedLine.Length;
                    }
                    int diff = line.Length - trimmedLine.Length;
                    if ((diff > 0) && (diff < dedent))
                    {
                        dedent = diff;
                    }
                }
                lines = new Lines(list);
                lines.Unindent(dedent);
                ParseFormControlProperties(lines);
            }

            Listener.OnEndFormControl();
        }
        internal void ParsePageAction(Lines lines)
        {
            var match             = lines.FirstLineMustMatch(Patterns.PageAction);
            var actionID          = match.Groups [1].Value.ToInteger();
            var actionIndentation = match.Groups [2].Value.ToNullableInteger();
            var actionType        = match.Groups [3].Value.ToEnum <PageActionType>();
            var actionSeparator   = match.Groups [4].Value;

            Listener.OnBeginPageAction(actionID, actionIndentation, actionType);

            if (actionSeparator == ";")
            {
                lines.Unindent(16);
                ParsePageActionProperties(lines);
            }

            Listener.OnEndPageAction();
        }
        internal void ParseDataPortField(Lines lines)
        {
            var match      = lines.FirstLineMustMatch(Patterns.DataportField);
            var startPos   = match.Groups [1].Value.ToNullableInteger();
            var width      = match.Groups[2].Value.ToNullableInteger();
            var sourceExpr = match.Groups [3].Value.TrimEnd();
            var separator  = match.Groups [4].Value;

            Listener.OnBeginDataPortField(startPos, width, sourceExpr);

            if (separator == ";")
            {
                lines.Unindent(Math.Min(match.Length, 35));
                ParseDataPortFieldProperties(lines);
            }

            Listener.OnEndDataPortField();
        }
Exemplo n.º 19
0
        internal void ParseFieldGroup(Lines lines)
        {
            var match            = lines.FirstLineMustMatch(Patterns.FieldGroup);
            var fieldGroupID     = match.Groups[1].Value.Trim().ToInteger();
            var fieldGroupName   = match.Groups[2].Value.TrimEnd();
            var fieldGroupFields = match.Groups[3].Value.TrimEnd().Split(",".ToCharArray());
            var separator        = match.Groups[4].Value;

            Listener.OnBeginTableFieldGroup(fieldGroupID, fieldGroupName, fieldGroupFields);

            if (separator == ";")
            {
                lines.Unindent(Math.Min(match.Length, 69));
                ParseFieldGroupProperties(lines);
            }

            Listener.OnEndTableFieldGroup();
        }
        internal void ParseReportElement(Lines lines)
        {
            var match              = lines.FirstLineMustMatch(Patterns.ReportElement);
            var elementID          = match.Groups[1].Value.ToInteger();
            var elementIndentation = match.Groups[2].Value.ToNullableInteger();
            var elementType        = match.Groups[3].Value.ToEnum <ReportElementType>();
            var elementName        = match.Groups[4].Value.Trim();
            var elementSeparator   = match.Groups[5].Value;

            Listener.OnBeginReportElement(elementID, elementIndentation, elementName, elementType);

            if (elementSeparator == ";")
            {
                lines.Unindent(11);
                ParseReportElementProperties(lines);
            }

            Listener.OnEndReportElement();
        }
        internal void ParsePageControl(Lines lines)
        {
            var match              = lines.FirstLineMustMatch(Patterns.PageControl);
            var controlID          = match.Groups[1].Value.ToInteger();
            var controlIndentation = match.Groups[2].Value.ToNullableInteger();
            var controlType        = match.Groups[3].Value.ToEnum <PageControlType>();
            var controlSeparator   = match.Groups[4].Value;

            Listener.OnBeginPageControl(controlID, controlIndentation, controlType);

            if (controlSeparator == ";")
            {
                var indentation = lines.First().Length - lines.First().TrimStart().Length;
                lines.Unindent(indentation);
                ParsePageControlProperties(lines);
            }

            Listener.OnEndPageControl();
        }
Exemplo n.º 22
0
        internal void ParseTableField(Lines lines)
        {
            var match        = lines.FirstLineMustMatch(Patterns.TableField);
            var fieldNo      = match.Groups [1].Value.ToInteger();
            var fieldEnabled = match.Groups [2].Value.ToNullableBoolean();
            var fieldName    = match.Groups [3].Value.TrimEnd();
            var fieldType    = match.Groups [4].Value.TrimEnd();
            var fieldLength  = ParseFieldLength(ref fieldType);
            var separator    = match.Groups [5].Value;

            Listener.OnBeginTableField(fieldNo, fieldEnabled, fieldName, fieldType.ToEnum <TableFieldType>(), fieldLength);

            if (separator == ";")
            {
                lines.Unindent(Math.Min(match.Length, 47));
                ParseTableFieldProperties(lines);
            }

            Listener.OnEndTableField();
        }
Exemplo n.º 23
0
        internal void ParseXmlPortElement(Lines lines)
        {
            var match              = lines.FirstLineMustMatch(Patterns.XmlPortElement);
            var elementID          = match.Groups[1].Value.ToGuid();
            var elementIndentation = match.Groups[2].Value.ToNullableInteger();
            var elementName        = match.Groups[3].Value;
            var elementNodeType    = match.Groups[4].Value.ToEnum <XmlPortNodeType>();
            var elementSourceType  = match.Groups[5].Value.ToEnum <XmlPortSourceType>();
            var elementSeparator   = match.Groups[6].Value;

            Listener.OnBeginXmlPortElement(elementID, elementIndentation, elementName, elementNodeType, elementSourceType);

            if (elementSeparator == ";")
            {
                lines.Unindent(Math.Min(match.Length, 46));
                ParseXmlPortElementProperties(lines);
            }

            Listener.OnEndXmlPortElement();
        }
Exemplo n.º 24
0
        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 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 ParseFormControl(Lines lines)
        {
            var match            = lines.FirstLineMustMatch(Patterns.PageControl);
            var controlID        = match.Groups[1].Value.ToInteger();
            var controlType      = match.Groups[2].Value.ToEnum <ClassicControlType>();
            var posX             = match.Groups[3].Value.ToInteger();
            var posY             = match.Groups[4].Value.ToInteger();
            var width            = match.Groups[5].Value.ToInteger();
            var height           = match.Groups[6].Value.ToInteger();
            var controlSeparator = match.Groups[7].Value;

            Listener.OnBeginFormControl(controlID, controlType, posX, posY, width, height);

            if (controlSeparator == ";")
            {
                var indentation = lines.First().Length - lines.First().TrimStart().Length;
                lines.Unindent(indentation);
                ParseFormControlProperties(lines);
            }

            Listener.OnEndFormControl();
        }
Exemplo n.º 27
0
        internal bool ParseProcedure(Lines lines)
        {
#if NAV2016
            lines.FirstLineTryMatch(Patterns.EventSubscriberAttribute, out Match eventSubscriberMatch);
            lines.FirstLineTryMatch(Patterns.TryFunctionAttribute, out Match tryFunctionMatch);
#endif
#if NAV2018
            lines.FirstLineTryMatch(Patterns.ServiceEnabledAttribute, out Match serviceEnabledMatch);
#endif
#if NAV2016
            lines.FirstLineTryMatch(Patterns.BusinessEventPublisherAttribute, out Match businessEventPublisherMatch);
            lines.FirstLineTryMatch(Patterns.IntegrationEventPublisherAttribute, out Match integrationEventPublisherMatch);
#endif
            lines.FirstLineTryMatch(Patterns.FunctionTypeAttribute, out Match functionTypeMatch);
            lines.FirstLineTryMatch(Patterns.HandlerFunctionsAttribute, out Match handlerFunctionsMatch);
            lines.FirstLineTryMatch(Patterns.TransactionModelAttribute, out Match transactionModelMatch);
#if NAV2017
            lines.FirstLineTryMatch(Patterns.TestPermissionsAttribute, out Match testPermissionsMatch);
#endif
#if NAV2018
            lines.FirstLineTryMatch(Patterns.FunctionVisibilityAttribute, out Match functionVisibilityMatch);
#endif
#if NAVBC2
            lines.FirstLineTryMatch(Patterns.LineStartAttribute, out Match lineStartMatch);
#endif

            if (!lines.FirstLineTryMatch(Patterns.ProcedureSignature, out Match procedureSignatureMatch))
            {
                return(false);
            }

            var procedureLocal = procedureSignatureMatch.Groups[1].Value == "LOCAL ";
            var procedureName  = procedureSignatureMatch.Groups[2].Value;
            var procedureID    = procedureSignatureMatch.Groups[3].Value.ToInteger();

            Listener.OnBeginFunction(procedureID, procedureName, procedureLocal);

#if NAV2016
            if (businessEventPublisherMatch.Success)
            {
                Listener.OnFunctionAttribute("Business", businessEventPublisherMatch.Groups[2].Value);
            }
            else if (integrationEventPublisherMatch.Success)
            {
                Listener.OnFunctionAttribute("Integration", integrationEventPublisherMatch.Groups[2].Value, integrationEventPublisherMatch.Groups[4].Value);
            }
            else if (eventSubscriberMatch.Success)
            {
                Listener.OnFunctionAttribute(
                    "EventSubscriber",
                    eventSubscriberMatch.Groups["ObjectType"].Value,
                    eventSubscriberMatch.Groups["ObjectID"].Value,
                    eventSubscriberMatch.Groups["Function"].Value,
                    eventSubscriberMatch.Groups["Element"].Value,
                    eventSubscriberMatch.Groups["OnMissingLicense"].Value,
                    eventSubscriberMatch.Groups["OnMissingPermission"].Value);
            }
            //else
#endif
            if (functionTypeMatch.Success)
            {
                Listener.OnFunctionAttribute(functionTypeMatch.Groups[1].Value);
            }

#if NAV2016
            if (tryFunctionMatch.Success)
            {
                Listener.OnFunctionAttribute("TryFunction");
            }
#endif

            if (handlerFunctionsMatch.Success)
            {
                Listener.OnFunctionAttribute("HandlerFunctions", handlerFunctionsMatch.Groups[1].Value);
            }

            if (transactionModelMatch.Success)
            {
                Listener.OnFunctionAttribute("TransactionModel", transactionModelMatch.Groups[1].Value);
            }

#if NAV2017
            if (testPermissionsMatch.Success)
            {
                Listener.OnFunctionAttribute("TestPermissions", testPermissionsMatch.Groups[1].Value);
            }
#endif

#if NAV2018
            if (functionVisibilityMatch.Success)
            {
                Listener.OnFunctionAttribute("FunctionVisibility", functionVisibilityMatch.Groups[1].Value);
            }

            if (serviceEnabledMatch.Success)
            {
                Listener.OnFunctionAttribute("ServiceEnabled");
            }
#endif
#if NAVBC
            if (lineStartMatch.Success)
            {
                Listener.OnFunctionAttribute("LineStart", lineStartMatch.Groups[1].Value);
            }
#endif

            ParseParameters(lines);
            ParseReturnValue(lines);

            if (lines.FirstLineTryMatch(Patterns.Variables))
            {
                ParseLocals(lines);
            }
            else
            {
                lines.FirstLineMustMatch(Patterns.BeginCodeBlock);
            }

            while (!lines.FirstLineTryMatch(Patterns.EndCodeBlock))
            {
                Listener.OnCodeLine(lines.FirstLineMustMatch(Patterns.Any).Value.UnIndent(2));
            }

            Listener.OnEndFunction();

            lines.FirstLineTryMatch(Patterns.BlankLine);
            return(true);
        }
Exemplo n.º 28
0
        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();
        }