public void GetTokenAtTest()
 {
     string text = "if='if'\r\n"+
         "<expr>::=<Expr>'+'<add>\r\n"+
             "<add>::=x!*<mul>if*! !<mul>\r\n"+
             "if = 'IF'";
     var target = new GoldParsedDocument ();
     target.Parse (text);
     var token = target.GetTokenAt (19);
     string expected = "<Expr>";
     string actual = token.Text;
     Assert.AreEqual (expected, actual);
 }
Esempio n. 2
0
        void findSegmentsForRenaming(string text, int documentPosition)
        {
            var doc = new GoldParsedDocument ();
            doc.Parse (text);

            //not everything can be renamed
            var token = doc.GetTokenAt (documentPosition);

            if (tokenIsRenameable (token))
            {
                primarySegment = tokenToSegment (token);
                symbolType = TokenUtil.GetDefinitionType(token);

                //get our list of items to rename
                var renameItems = doc.FindUsesOf(token.Text);

                TextSegment segment;
                foreach (Token renameItem in renameItems)
                {
                    segment = tokenToSegment (renameItem);
                    textSegmentList.Add (segment);
                }
            }
        }