Esempio n. 1
0
        public static void Run(TreeElement node, ILexer lexer, ITokenOffsetProvider offsetProvider, bool trimTokens, SeldomInterruptChecker interruptChecker)
        {
            Assertion.Assert(node.parent == null, "node.parent == null");

            var root = node as CompositeElement;

            if (root == null)
            {
                return;
            }

            var inserter = new PsiMissingTokensInserter(lexer, offsetProvider, interruptChecker);

            lexer.Start();

            if (trimTokens)
            {
                using (var container = new DummyContainer(root))
                {
                    inserter.Run(container);
                }
            }
            else
            {
                var terminator = new EofToken(lexer.Buffer);
                root.AppendNewChild(terminator);
                inserter.Run(root);
                root.DeleteChildRange(terminator, terminator);
            }
        }
Esempio n. 2
0
 private void InsertMissingTokens(TreeElement result, bool trimMissingTokens)
 {
     PsiMissingTokensInserter.Run(result, myOriginalLexer, this, trimMissingTokens, myCheckForInterrupt);
 }
    public static void Run(TreeElement node, ILexer lexer, ITokenOffsetProvider offsetProvider, bool trimTokens, SeldomInterruptChecker interruptChecker)
    {
      Assertion.Assert(node.parent == null, "node.parent == null");

      var root = node as CompositeElement;
      if (root == null)
      {
        return;
      }

      var inserter = new PsiMissingTokensInserter(lexer, offsetProvider, interruptChecker);
      lexer.Start();

      if (trimTokens)
      {
        using (var container = new DummyContainer(root))
        {
          inserter.Run(container);
        }
      }
      else
      {
        var terminator = new EofToken(lexer.Buffer);
        root.AppendNewChild(terminator);
        inserter.Run(root);
        root.DeleteChildRange(terminator, terminator);
      }
    }