Label
Inheritance: ParsedItem
Esempio n. 1
0
        /// <summary>
        /// Labels
        /// </summary>
        /// <param name="pars"></param>
        public void Visit(ParsedLabel pars)
        {
            // find the end line of the labeled block
            var  line          = pars.Line + 1;
            var  depth         = _parser.LineInfo.ContainsKey(pars.Line) ? _parser.LineInfo[pars.Line].BlockDepth : 0;
            bool wentIntoBlock = false;

            while (_parser.LineInfo.ContainsKey(line))
            {
                if (!wentIntoBlock && _parser.LineInfo[line].BlockDepth > depth)
                {
                    wentIntoBlock = true;
                    depth         = _parser.LineInfo[line].BlockDepth;
                }
                else if (wentIntoBlock && _parser.LineInfo[line].BlockDepth < depth)
                {
                    break;
                }
                line++;
            }
            pars.UndefinedLine = line;

            // to completion data
            PushToAutoCompletion(new LabelCompletionItem {
                DisplayText = pars.Name,
                Flags       = pars.Flags,
            }, pars);
        }
Esempio n. 2
0
        /// <summary>
        /// Labels
        /// </summary>
        /// <param name="pars"></param>
        public void Visit(ParsedLabel pars)
        {
            if (!_isBaseFile)
            {
                return;
            }

            // find the end line of the labelled block
            var  line          = pars.Line + 1;
            var  depth         = (_lineInfo.ContainsKey(pars.Line)) ? _lineInfo[pars.Line].BlockDepth : 0;
            bool wentIntoBlock = false;

            while (_lineInfo.ContainsKey(line))
            {
                if (!wentIntoBlock && _lineInfo[line].BlockDepth > depth)
                {
                    wentIntoBlock = true;
                    depth         = _lineInfo[line].BlockDepth;
                }
                else if (wentIntoBlock && _lineInfo[line].BlockDepth < depth)
                {
                    break;
                }
                line++;
            }
            pars.UndefinedLine = line;

            // to completion data
            _parsedCompletionItemsList.Add(new CompletionItem {
                DisplayText = pars.Name,
                Type        = CompletionType.Label,
                Flag        = 0,
                Ranking     = AutoComplete.FindRankingOfParsedItem(pars.Name),
                ParsedItem  = pars,
                FromParser  = true
            });
        }