include file parsed item
Inheritance: ParsedItem
Beispiel #1
0
 public ParsedIncludeFile(string name, Token token, Dictionary <string, List <Token> > scopedPreProcVariables, string fullFilePath, ParsedIncludeFile parent)
     : base(name, token)
 {
     ScopedPreProcVariables = scopedPreProcVariables;
     FullFilePath           = fullFilePath;
     Parent = parent;
 }
Beispiel #2
0
        /// <summary>
        /// Include files
        /// </summary>
        /// <param name="pars"></param>
        public void Visit(ParsedIncludeFile pars)
        {
            // try to find the file in the propath
            var fullFilePath = ProEnvironment.Current.FindFirstFileInPropath(pars.Name);

            // To code explorer
            _parsedExplorerItemsList.Add(new CodeExplorerItem {
                DisplayText   = pars.Name,
                Branch        = CodeExplorerBranch.Include,
                IsNotBlock    = true,
                Flag          = AddExternalFlag(string.IsNullOrEmpty(fullFilePath) ? CodeExplorerFlag.NotFound : 0),
                DocumentOwner = pars.FilePath,
                GoToLine      = pars.Line,
                GoToColumn    = pars.Column,
                SubString     = SetExternalInclude(null)
            });

            // Parse the include file ?
            if (string.IsNullOrEmpty(fullFilePath))
            {
                return;
            }

            // ensure to not parse the same file twice in a parser session!
            if (_parsedFiles.Contains(fullFilePath))
            {
                return;
            }
            _parsedFiles.Add(fullFilePath);

            ParserVisitor parserVisitor  = ParseFile(fullFilePath, pars.Scope);
            var           parserItemList = parserVisitor._parsedCompletionItemsList.ToList();

            // correct the line number of each parsed element, so we can filter the items correctly in the completion list
            parserItemList.ForEach(data => { if (data.FromParser)
                                             {
                                                 data.ParsedItem.IncludeLine = pars.Line;
                                             }
                                   });

            // add info from the parser
            _parsedCompletionItemsList.AddRange(parserItemList);
            if (Config.Instance.CodeExplorerDisplayExternalItems)
            {
                _parsedExplorerItemsList.AddRange(parserVisitor._parsedExplorerItemsList.ToList());
            }

            // fill the defined procedures dictionnary
            foreach (var definedProcedure in parserVisitor._definedProcedures.Where(definedProcedure => !_definedProcedures.Contains(definedProcedure)))
            {
                _definedProcedures.Add(definedProcedure);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Include files
 /// </summary>
 /// <param name="pars"></param>
 public void Visit(ParsedIncludeFile pars)
 {
     // To code explorer
     PushToCodeExplorer(
         GetExplorerListNode("Includes", CodeExplorerIconType.Include),
         new IncludeCodeItem {
         DisplayText   = pars.Name,
         Flags         = pars.Flags,
         SubText       = null,
         DocumentOwner = pars.FilePath,
         GoToLine      = pars.Line,
         GoToColumn    = pars.Column
     });
 }