Procedure parsed item
Inheritance: ParsedScopeItem
Exemple #1
0
        /// <summary>
        /// Main block, definitions block...
        /// </summary>
        /// <param name="pars"></param>
        public void Visit(ParsedPreProcBlock pars)
        {
            if (pars.Flags.HasFlag(ParseFlag.FromInclude))
            {
                return;
            }

            CodeExplorerIconType type;

            switch (pars.Type)
            {
            case ParsedPreProcBlockType.MainBlock:
                type = CodeExplorerIconType.MainBlock;
                break;

            case ParsedPreProcBlockType.Definitions:
                type = CodeExplorerIconType.DefinitionBlock;
                break;

            case ParsedPreProcBlockType.UibPreprocessorBlock:
                type = CodeExplorerIconType.PreprocessorBlock;
                break;

            case ParsedPreProcBlockType.Xftr:
                type = CodeExplorerIconType.XtfrBlock;
                break;

            case ParsedPreProcBlockType.ProcedureSettings:
                type = CodeExplorerIconType.SettingsBlock;
                break;

            case ParsedPreProcBlockType.CreateWindow:
                type = CodeExplorerIconType.CreateWindowBlock;
                break;

            case ParsedPreProcBlockType.RunTimeAttributes:
                type = CodeExplorerIconType.RuntimeBlock;
                break;

            default:
                return;
            }

            // to code explorer
            CodeItem parentNode = type == CodeExplorerIconType.MainBlock ? null : GetExplorerListNode("AppBuilder blocks", CodeExplorerIconType.Block);
            CodeItem newNode    = CodeItem.Factory.New(type);

            newNode.DisplayText   = pars.Name;
            newNode.Flags         = pars.Flags;
            newNode.SubText       = null;
            newNode.DocumentOwner = pars.FilePath;
            newNode.GoToLine      = pars.Line;
            newNode.GoToColumn    = pars.Column;
            if (type != CodeExplorerIconType.MainBlock)
            {
                newNode.Type = type;
            }
            PushToCodeExplorer(parentNode, newNode);
        }
Exemple #2
0
        /// <summary>
        /// Matches a & IF.. & THEN pre-processed statement
        /// </summary>
        private ParsedPreProcBlock CreateParsedIfEndIfPreProc(Token ifToken)
        {
            _lastTokenWasSpace = true;
            StringBuilder expression = new StringBuilder();

            do {
                var token = PeekAt(1);
                if (token is TokenEos) break;
                if (token is TokenComment) continue;
                 AddTokenToStringBuilder(expression, token);
            } while (MoveNext());

            var newIf = new ParsedPreProcBlock(string.Empty, ifToken) {
                Type = ParsedPreProcBlockType.IfEndIf,
                BlockDescription = expression.ToString(),
            };
            AddParsedItem(newIf);
            return newIf;
        }
Exemple #3
0
        /// <summary>
        /// Main block, definitions block...
        /// </summary>
        /// <param name="pars"></param>
        public void Visit(ParsedPreProcBlock pars)
        {
            // add the prototype block only once, for the first proto
            if (pars.Type == ParsedPreProcBlockType.FunctionForward)
            {
                if (_prototypeAdded)
                {
                    return;
                }
                _prototypeAdded = true;
            }

            CodeExplorerIconType type;

            switch (pars.Type)
            {
            case ParsedPreProcBlockType.MainBlock:
                type = CodeExplorerIconType.BranchIcon;
                break;

            case ParsedPreProcBlockType.FunctionForward:
                type = CodeExplorerIconType.Prototype;
                break;

            case ParsedPreProcBlockType.Definitions:
                type = CodeExplorerIconType.DefinitionBlock;
                break;

            case ParsedPreProcBlockType.UibPreprocessorBlock:
                type = CodeExplorerIconType.PreprocessorBlock;
                break;

            case ParsedPreProcBlockType.Xftr:
                type = CodeExplorerIconType.XtfrBlock;
                break;

            case ParsedPreProcBlockType.ProcedureSettings:
                type = CodeExplorerIconType.SettingsBlock;
                break;

            case ParsedPreProcBlockType.CreateWindow:
                type = CodeExplorerIconType.CreateWindowBlock;
                break;

            case ParsedPreProcBlockType.RunTimeAttributes:
                type = CodeExplorerIconType.RuntimeBlock;
                break;

            default:
                return;
            }

            // to code explorer
            _parsedExplorerItemsList.Add(new CodeExplorerItem {
                DisplayText   = pars.Name,
                Branch        = pars.Type == ParsedPreProcBlockType.MainBlock ? CodeExplorerBranch.MainBlock : CodeExplorerBranch.Block,
                IconType      = type,
                IsRoot        = pars.Type == ParsedPreProcBlockType.MainBlock,
                Flag          = AddExternalFlag((CodeExplorerFlag)0),
                DocumentOwner = pars.FilePath,
                GoToLine      = pars.Line,
                GoToColumn    = pars.Column,
                SubString     = SetExternalInclude(null)
            });
        }