Exemplo n.º 1
0
    private string GetCurrentLine()
    {
        LineArray lines   = Controller.Lines;
        string    command = lines[lines.LinesCount - 1].Text;

        return(command.StartsWith(invitation) ? command.Substring(invitation.Length) : command);
    }
        public void TokenIteratorTest5()
        {
            LineArray lines = new LineArray();

            lines.SetText(@"public class A {
				private char a = '}';
				private char b = '""';
				private char c = '\'';
				private char d = '\n';
				
				public void Method0(char c = 'c')
				{
				}
				
				public void Method1()
				{
				}
			}"            );
            CSTokenIterator iterator = new CSTokenIterator(lines);

            Assert.AreEqual("[<<public>>, <<class>>, <<A>>, '{', " +
                            "<<private>>, <<char>>, <<a>>, '=', <<'}'>>, ';', " +
                            "<<private>>, <<char>>, <<b>>, '=', <<'\"'>>, ';', " +
                            "<<private>>, <<char>>, <<c>>, '=', <<'\\''>>, ';', " +
                            "<<private>>, <<char>>, <<d>>, '=', <<'\\n'>>, ';', " +
                            "<<public>>, <<void>>, <<Method0>>, '(', <<char>>, <<c>>, '=', <<'c'>>, ')', '{', '}', " +
                            "<<public>>, <<void>>, <<Method1>>, '(', ')', '{', '}', " +
                            "'}']", ListUtil.ToString(iterator.tokens));
        }
Exemplo n.º 3
0
 public SelectionAssertion(LineArray provider, int index, string description)
 {
     this.provider    = provider;
     this.index       = index;
     this.description = description;
     SetSelectionByIndex();
 }
Exemplo n.º 4
0
        public void MastNotFail_4_1()
        {
            LineArray  lines      = new LineArray(4);
            Controller controller = new Controller(lines);

            lines.SetText(File.ReadAllText("../test_code_4.txt"));

            controller.PutCursor(new Place(1, 56 - 1), false);
            controller.PutNewCursor(new Place(1, 59 - 1));
            controller.PutNewCursor(new Place(1, 61 - 1));
            controller.PutNewCursor(new Place(1, 67 - 1));
            controller.PutNewCursor(new Place(1, 69 - 1));
            controller.PutNewCursor(new Place(1, 79 - 1));
            controller.PutNewCursor(new Place(1, 145 - 1));
            controller.PutNewCursor(new Place(1, 168 - 1));
            controller.PutNewCursor(new Place(1, 171 - 1));
            controller.PutNewCursor(new Place(1, 316 - 1));
            controller.PutNewCursor(new Place(1, 321 - 1));
            controller.PutNewCursor(new Place(1, 326 - 1));
            controller.PutNewCursor(new Place(1, 342 - 1));
            controller.MoveDown(true);
            controller.MoveDown(true);

            controller.EraseSelection();

            Assert.AreEqual(File.ReadAllText("../test_code_4_1_after.txt"), lines.GetText());
        }
Exemplo n.º 5
0
 private void Init(string text)
 {
     lines         = new LineArray(200);
     lines.tabSize = 4;
     lines.SetText(text);
     line = lines[0];
 }
Exemplo n.º 6
0
 virtual protected void Init(int blockSize)
 {
     lines                     = new LineArray(blockSize);
     lines.tabSize             = 4;
     controller                = new Controller(lines);
     controller.macrosExecutor = new MacrosExecutor(null);
 }
Exemplo n.º 7
0
    private void SelectCurrentLine()
    {
        LineArray lines = Controller.Lines;

        Controller.ClearMinorSelections();
        Controller.LastSelection.anchor = lines.IndexOf(new Place(0, lines.LinesCount - 1));
        Controller.LastSelection.caret  = lines.charsCount;
    }
Exemplo n.º 8
0
    public override Node Parse(LineArray lines)
    {
        CSTokenIterator iterator = new CSTokenIterator(lines);
        List <Node>     nodes    = new List <Node>();
        Node            root     = (Node)(new Dictionary <string, Node>());

        root["childs"] = nodes;
        ParseRoot(iterator, nodes);
        return(nodes.Count == 1 ? nodes[0] : root);
    }
        private void AssertParse(string expected, string text)
        {
            LineArray lines = new LineArray();

            lines.SetText(text);
            CSTextNodeParser parser = new CSTextNodeParser(null);
            Node             node   = parser.Parse(lines);

            Assert.AreEqual(expected, StringOfNode(node));
        }
Exemplo n.º 10
0
        public void MastNotFail_2()
        {
            LineArray  lines      = new LineArray(10);
            Controller controller = new Controller(lines);

            lines.SetText(File.ReadAllText("../test_code_2.txt"));
            controller.PutCursor(new Place(0, 9), false);
            controller.PutCursor(new Place(0, 20), true);
            controller.Cut();
            Assert.AreEqual(File.ReadAllText("../test_code_2_after.txt"), lines.GetText());
        }
Exemplo n.º 11
0
        public void MastNotFail_3()
        {
            LineArray  lines      = new LineArray(3);
            Controller controller = new Controller(lines);

            lines.SetText(File.ReadAllText("../test_code_3.txt"));
            controller.PutCursor(new Place(1, 45), false);
            controller.PutCursor(new Place(1, 44), true);
            controller.EraseSelection();
            Assert.AreEqual(File.ReadAllText("../test_code_3_after.txt"), lines.GetText());
        }
Exemplo n.º 12
0
        public void AlwaysHasOneLine()
        {
            LineArray lines = new LineArray(4);

            Assert.AreEqual(1, lines.LinesCount);
            Assert.AreEqual("", lines[0].Text);

            lines.SetText("");
            Assert.AreEqual(0, lines.charsCount);
            Assert.AreEqual(1, lines.LinesCount);
            Assert.AreEqual("", lines[0].Text);
        }
Exemplo n.º 13
0
        public void MastNotFail_1()
        {
            LineArray  lines      = new LineArray(100);
            Controller controller = new Controller(lines);

            lines.SetText(GetTextExample());
            controller.PutCursor(new Place(0, 299), false);
            controller.PutCursor(new Place(0, 298), true);
            controller.Cut();
            controller.PutCursor(new Place(0, 305), false);
            controller.Paste();
            Assert.AreEqual(File.ReadAllText("../test_code_after.txt"), lines.GetText());
        }
Exemplo n.º 14
0
        public void TokenIteratorTest()
        {
            LineArray lines = new LineArray();

            lines.SetText(@"public class A {
				private B b;
				public void C() { }
			}"            );
            CSTokenIterator iterator = new CSTokenIterator(lines);

            Assert.AreEqual("[" +
                            "<<public>>, <<class>>, <<A>>, '{', <<private>>, <<B>>, <<b>>, ';', " +
                            "<<public>>, <<void>>, <<C>>, '(', ')', '{', '}', '}'" +
                            "]", ListUtil.ToString(iterator.tokens));
        }
Exemplo n.º 15
0
        public void MastNotFail_4()
        {
            LineArray  lines      = new LineArray(4);
            Controller controller = new Controller(lines);

            lines.SetText(File.ReadAllText("../test_code_4.txt"));

            controller.PutCursor(new Place(1, 316 - 1), false);
            controller.PutCursor(new Place(1, 316 - 0), true);

            controller.PutNewCursor(new Place(1, 321 - 1));
            controller.PutCursor(new Place(1, 321 - 0), true);

            controller.EraseSelection();

            Assert.AreEqual(File.ReadAllText("../test_code_4_after.txt"), lines.GetText());
        }
Exemplo n.º 16
0
        public void TokenIteratorTest4()
        {
            LineArray lines = new LineArray();

            lines.SetText(@"public class Test
			{
				private string text = ""ab\""c\n"";
				private string text2 = @""ab""""c"";
				private string text3 = @""ab"                 + "\n" + @"c"";
			}"            );
            CSTokenIterator iterator = new CSTokenIterator(lines);

            Assert.AreEqual("[" +
                            "<<public>>, <<class>>, <<Test>>, '{', " +
                            "<<private>>, <<string>>, <<text>>, '=', <<\"ab\\\"c\\n\">>, ';', " +
                            "<<private>>, <<string>>, <<text2>>, '=', <<@\"ab\"\"c\">>, ';', " +
                            "<<private>>, <<string>>, <<text3>>, '=', <<@\"ab\nc\">>, ';', '}'" +
                            "]", ListUtil.ToString(iterator.tokens));
        }
Exemplo n.º 17
0
        public void Readonly()
        {
            LineArray lines = new LineArray();

            Assert.AreEqual("", ClipboardExecutor.GetFromRegister(lines, ':'));
            Assert.AreEqual("", ClipboardExecutor.GetFromRegister(lines, '.'));
            Assert.AreEqual("", ClipboardExecutor.GetFromRegister(lines, '%'));

            ClipboardExecutor.viLastCommand = "command";
            lines.viFullPath = "file name";

            Assert.AreEqual("command", ClipboardExecutor.GetFromRegister(lines, ':'));
            Assert.AreEqual("file name", ClipboardExecutor.GetFromRegister(lines, '%'));

            ClipboardExecutor.PutToRegister(':', "A");
            ClipboardExecutor.PutToRegister('.', "B");
            ClipboardExecutor.PutToRegister('%', "C");

            Assert.AreEqual("command", ClipboardExecutor.GetFromRegister(lines, ':'));
            Assert.AreEqual("", ClipboardExecutor.GetFromRegister(lines, '.'));
            Assert.AreEqual("file name", ClipboardExecutor.GetFromRegister(lines, '%'));
        }
Exemplo n.º 18
0
        public void TokenIteratorTest3()
        {
            LineArray lines = new LineArray();

            lines.SetText(@"public class Test
			{
				/*public */void Method0()
				{
				}
				
				public void Method1()//}
				{
				}
			}"            );
            CSTokenIterator iterator = new CSTokenIterator(lines);

            Assert.AreEqual("[" +
                            "<<public>>, <<class>>, <<Test>>, '{', " +
                            "<<void>>, <<Method0>>, '(', ')', '{', '}', " +
                            "<<public>>, <<void>>, <<Method1>>, '(', ')', '{', '}', '}'" +
                            "]", ListUtil.ToString(iterator.tokens));
        }
Exemplo n.º 19
0
 public abstract Node Parse(LineArray lines);
Exemplo n.º 20
0
    private void Update()
    {
        if (visuals == null)
        {
            visuals = new List <GameObject>();
        }

        if (array == null)
        {
            array = new LineArray <Element>(width); text.text = "";
        }
        else if (array.empty)
        {
            array = new LineArray <Element>(width); text.text = "";
        }

        if (addLeft)
        {
            array.Add(Instance(prefab), prefab.width, LineArray <Element> .AddMode.Left);
            addLeft = false;
        }
        if (addRight)
        {
            array.Add(Instance(prefab), prefab.width, LineArray <Element> .AddMode.Right);
            addRight = false;
        }
        if (addMiddle)
        {
            array.Add(Instance(prefab), prefab.width, LineArray <Element> .AddMode.Center);
            addMiddle = false;
        }
        if (addRandom)
        {
            array.Add(Instance(prefab), prefab.width, LineArray <Element> .AddMode.Random);
            addRandom = false;
        }

        if (clear)
        {
            array = new LineArray <Element>(width);

            foreach (GameObject g in visuals)
            {
                DestroyImmediate(g);
            }
            text.text = "";

            clear = false;
        }

        line.localScale = new Vector3(array.getWidth, 1, 1);

        float w = 0; int i = 0; string str = array.count.ToString() + " >>  ";

        foreach (LineArray <Element> .Element <Element> e in array.ToArray())
        {
            if (e.obj.obj == null)
            {
                array.RemoveAt(i); break;
            }

            str += e.position.ToString("F1", '[', ';', ']') + "    ";

            w = e.position.bottom + (e.obj.width / 2f);

            e.obj.obj.transform.position = new Vector3(w, 0, 0);

            w += e.obj.width / 2f;
            i++;
        }
        str += "\n" + array.getIntervals.Length.ToString("F0") + " >>  ";
        foreach (LineArray <Element> .intervalID a in array.getIntervals)
        {
            str += a.id + a.ToString("F1", '[', ';', ']') + "    ";
        }

        text.text = str;
    }
Exemplo n.º 21
0
    private void Search(string directory, Regex regex, string pattern, bool ignoreCase, string filter, string ignoreDirs)
    {
        positions                    = new List <Position>();
        buffer                       = new Buffer(null, "Find in files results", SettingsMode.Normal);
        buffer.showEncoding          = false;
        buffer.Controller.isReadonly = true;
        lines = buffer.Controller.Lines;
        lines.ClearAllUnsafely();

        bool needCutCurrent = false;

        if (string.IsNullOrEmpty(directory))
        {
            directory      = Directory.GetCurrentDirectory();
            needCutCurrent = true;
        }

        FileSystemScanner scanner = new FileSystemScanner(directory, filter, ignoreDirs);

        scanner.Scan();
        if (scanner.error != null)
        {
            AddLine("Error: File list reading error: " + scanner.error, Ds.Error);
        }
        fsScanComplete = true;

        string currentDirectory       = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar;
        List <IndexAndLength> indices = new List <IndexAndLength>();
        CompareInfo           ci      = ignoreCase ? CultureInfo.InvariantCulture.CompareInfo : null;
        int    remainsMatchesCount    = 2000000;
        string stopReason             = null;

        foreach (string file in scanner.files)
        {
            if (isStopped)
            {
                if (stopReason == null)
                {
                    stopReason = "STOPPED";
                }
                break;
            }
            string text = null;
            try
            {
                text = File.ReadAllText(file);
            }
            catch (IOException e)
            {
                --remainsMatchesCount;
                if (remainsMatchesCount < 0)
                {
                    isStopped  = true;
                    stopReason = "TOO MANY LINES";
                    break;
                }
                AddLine(file + ": " + e.Message, Ds.Error);
                continue;
            }
            indices.Clear();
            if (regex != null)
            {
                MatchCollection matches = regex.Matches(text);
                if (matches.Count == 0)
                {
                    continue;
                }
                foreach (Match match in matches)
                {
                    indices.Add(new IndexAndLength(match.Index, match.Length));
                }
            }
            else
            {
                int index = ci != null?ci.IndexOf(text, pattern, CompareOptions.IgnoreCase) : text.IndexOf(pattern);

                if (index == -1)
                {
                    continue;
                }
                while (true)
                {
                    indices.Add(new IndexAndLength(index, pattern.Length));
                    index = ci != null?ci.IndexOf(text, pattern, index + 1, CompareOptions.IgnoreCase) : text.IndexOf(pattern, index + 1);

                    if (index == -1)
                    {
                        break;
                    }
                }
            }
            string path = file;
            if (needCutCurrent && path.StartsWith(currentDirectory))
            {
                path = file.Substring(currentDirectory.Length);
            }
            int offset           = 0;
            int currentLineIndex = 0;
            foreach (IndexAndLength indexAndLength in indices)
            {
                int index   = indexAndLength.index;
                int length  = indexAndLength.length;
                int lineEnd = -1;
                while (true)
                {
                    int nIndex = text.IndexOf('\n', offset);
                    int rIndex = text.IndexOf('\r', offset);
                    if (nIndex == -1 && rIndex == -1)
                    {
                        lineEnd = text.Length;
                        break;
                    }
                    int nrIndex = System.Math.Min(nIndex, rIndex);
                    if (nrIndex == -1)
                    {
                        nrIndex = nIndex != -1 ? nIndex : rIndex;
                    }
                    if (nrIndex > index)
                    {
                        lineEnd = nrIndex;
                        break;
                    }
                    currentLineIndex++;
                    if (nrIndex == nIndex)
                    {
                        offset = nIndex + 1;
                    }
                    else
                    {
                        if (rIndex + 1 < text.Length || text[rIndex + 1] == '\n')
                        {
                            offset = rIndex + 2;
                        }
                        else
                        {
                            offset = rIndex + 1;
                        }
                    }
                }

                --remainsMatchesCount;
                if (remainsMatchesCount < 0)
                {
                    isStopped  = true;
                    stopReason = "TOO MANY MATCHES";
                    break;
                }

                int trimOffset      = 0;
                int rightTrimOffset = 0;
                int lineLength      = lineEnd - offset;
                if (index - offset - MaxPartChars > 0)
                {
                    trimOffset = index - offset - MaxPartChars;
                }
                if (lineLength - index + offset - length - MaxPartChars > 0)
                {
                    rightTrimOffset = lineLength - index + offset - length - MaxPartChars;
                }
                if (trimOffset == 0)
                {
                    int whitespaceLength = CommonHelper.GetFirstSpaces(text, offset, lineLength - rightTrimOffset);
                    if (whitespaceLength > 0 && whitespaceLength <= index - offset)
                    {
                        trimOffset = whitespaceLength;
                    }
                }
                positions.Add(new Position(file, new Place(index - offset, currentLineIndex), length));

                int index0  = offset + trimOffset;
                int length0 = lineLength - trimOffset - rightTrimOffset;
                AddLine(path, (currentLineIndex + 1) + " " + (index - offset + 1), text, index0, length0, index - offset - trimOffset, length);
            }
        }
        if (isStopped)
        {
            AddLine("…", Ds.Normal);
            AddLine(stopReason, Ds.Error);
        }
        if (lines.LinesCount == 0)
        {
            lines.AddLineUnsafely(new Line(32));
        }
        else
        {
            lines.CutLastLineBreakUnsafely();
        }
        buffer.additionKeyMap = new KeyMap();
        {
            KeyAction action = new KeyAction("F&ind\\Navigate to found", ExecuteEnter, null, false);
            buffer.additionKeyMap.AddItem(new KeyItem(Keys.Enter, null, action));
            buffer.additionKeyMap.AddItem(new KeyItem(Keys.None, null, action).SetDoubleClick(true));
        }
        finishBuffer = buffer;
        mainForm.Invoke(new Setter(CloseAlert));
    }
Exemplo n.º 22
0
    public void Build(Properties.CommandInfo commandInfo, Encoding encoding, out string error, out string shellError)
    {
        TextNodeParser buildinParser = null;
        string         command       = commandInfo.command;
        int            index         = command.IndexOf(':');

        if (index != -1)
        {
            customSyntax = command.Substring(index + 1).Trim();
            command      = command.Substring(0, index).Trim();
        }
        foreach (TextNodeParser parser in buildinParsers)
        {
            if (parser.name == command)
            {
                buildinParser = parser;
                break;
            }
        }

        error      = null;
        shellError = null;
        Node node = null;

        if (buildinParser != null)
        {
            node = buildinParser.Parse(buffer.Controller.Lines);
        }
        else
        {
            Process p = new Process();
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError  = true;
            p.StartInfo.RedirectStandardInput  = true;
            p.StartInfo.StandardOutputEncoding = encoding;
            p.StartInfo.StandardErrorEncoding  = encoding;
            p.StartInfo.UseShellExecute        = false;
            p.StartInfo.FileName  = "cmd.exe";
            p.StartInfo.Arguments = "/C " + command;
            p.Start();
            p.StandardInput.Write(buffer.Controller.Lines);
            p.StandardInput.Close();
            string output = p.StandardOutput.ReadToEnd();
            string errors = p.StandardError.ReadToEnd();
            p.WaitForExit();

            if (!string.IsNullOrEmpty(errors))
            {
                shellError = errors;
            }
            else
            {
                try
                {
                    node = new Parser().Load(output);
                }
                catch (System.Exception e)
                {
                    error = "Parsing error: " + e.Message +
                            "\nSee \"" + settings.getTextNodes.name + "\" for more info";
                }
            }
        }
        if (node == null)
        {
            if (error == null)
            {
                error = "Empty output\nSee \"" + settings.getTextNodes.name + "\" for more info";
            }
            return;
        }
        tabSize = settings.tabSize.GetValue(null);
        lines   = Controller.Lines;
        lines.ClearAllUnsafely();
        places = new List <Place>();
        AddLine(buffer.Name, new Place(-1, -1), true);
        AppendNodeOrNodesList(node);
        if (lines.LinesCount == 0)
        {
            lines.AddLineUnsafely(new Line(32));
        }
        else
        {
            lines.CutLastLineBreakUnsafely();
        }
        Place target = buffer.Controller.Lines.SoftNormalizedPlaceOf(buffer.Controller.LastSelection.caret);

        for (int i = places.Count; i-- > 0;)
        {
            if (places[i].iLine <= target.iLine)
            {
                Place place = new Place(0, i);
                if (place.iLine < 0)
                {
                    place.iLine = 0;
                }
                else if (place.iLine >= buffer.Controller.Lines.LinesCount)
                {
                    place.iLine = buffer.Controller.Lines.LinesCount;
                }
                Controller.PutCursor(place, false);
                break;
            }
        }

        showEncoding          = false;
        Controller.isReadonly = true;
        additionKeyMap        = new KeyMap();
        {
            KeyAction action = new KeyAction("&View\\Nodes list\\Close nodes list", DoCloseBuffer, null, false);
            additionKeyMap.AddItem(new KeyItem(Keys.Escape, null, action));
            additionKeyMap.AddItem(new KeyItem(Keys.Control | Keys.OemOpenBrackets, null, action));
        }
        {
            KeyAction action = new KeyAction("&View\\Nodes list\\Jump to node", DoJumpTo, null, false);
            additionKeyMap.AddItem(new KeyItem(Keys.Enter, null, action));
        }
    }
Exemplo n.º 23
0
 public CSTokenIterator(LineArray lines)
 {
     tokens = ParseTokens(lines);
     MoveNext();
 }
Exemplo n.º 24
0
    private List <CSToken> ParseTokens(LineArray lines)
    {
        List <CSToken> tokens  = new List <CSToken>();
        StringBuilder  builder = new StringBuilder();
        int            state   = Normal;

        for (int iBlock = 0; iBlock < lines.blocksCount; ++iBlock)
        {
            LineBlock block = lines.blocks[iBlock];
            for (int iLine = 0; iLine < block.count; ++iLine)
            {
                Line line = block.array[iLine];
                for (int i = 0; i < line.charsCount;)
                {
                    char c = line.chars[i].c;
                    if (state == Normal)
                    {
                        if (char.IsWhiteSpace(c))
                        {
                            ++i;
                            continue;
                        }
                        if (char.IsLetterOrDigit(c) || c == '_')
                        {
                            CSToken token = new CSToken();
                            builder.Length = 0;
                            builder.Append(c);
                            for (++i; i < line.charsCount; ++i)
                            {
                                c = line.chars[i].c;
                                if (!char.IsLetterOrDigit(c) && c != '_')
                                {
                                    break;
                                }
                                builder.Append(c);
                            }
                            token.text  = builder.ToString();
                            token.place = new Place(i, block.offset + iLine);
                            tokens.Add(token);
                            continue;
                        }
                        if (c == '/')
                        {
                            ++i;
                            if (i < line.charsCount)
                            {
                                c = line.chars[i].c;
                                if (c == '/')
                                {
                                    i = line.charsCount;
                                }
                                else if (c == '*')
                                {
                                    ++i;
                                    state = MultilineComment;
                                }
                                else
                                {
                                    CSToken token = new CSToken();
                                    token.c     = '/';
                                    token.place = new Place(i, block.offset + iLine);
                                    tokens.Add(token);
                                }
                            }
                        }
                        else if (c == '"')
                        {
                            builder.Length = 0;
                            builder.Append('"');
                            for (++i; i < line.charsCount; ++i)
                            {
                                c = line.chars[i].c;
                                if (c == '\\')
                                {
                                    ++i;
                                    builder.Append('\\');
                                    builder.Append(line.chars[i].c);
                                }
                                else if (c == '"')
                                {
                                    ++i;
                                    builder.Append('"');
                                    break;
                                }
                                else
                                {
                                    builder.Append(c);
                                }
                            }
                            CSToken token = new CSToken();
                            token.text  = builder.ToString();
                            token.place = new Place(i, block.offset + iLine);
                            tokens.Add(token);
                        }
                        else if (c == '\'')
                        {
                            builder.Length = 0;
                            builder.Append('\'');
                            for (++i; i < line.charsCount; ++i)
                            {
                                c = line.chars[i].c;
                                if (c == '\\')
                                {
                                    ++i;
                                    builder.Append('\\');
                                    builder.Append(line.chars[i].c);
                                }
                                else if (c == '\'')
                                {
                                    ++i;
                                    builder.Append('\'');
                                    break;
                                }
                                else
                                {
                                    builder.Append(c);
                                }
                            }
                            CSToken token = new CSToken();
                            token.text  = builder.ToString();
                            token.place = new Place(i, block.offset + iLine);
                            tokens.Add(token);
                        }
                        else if (c == '@' && i + 1 < line.charsCount && line.chars[i + 1].c == '"')
                        {
                            i += 2;
                            builder.Length = 0;
                            builder.Append("@\"");
                            state = MultilineString;
                        }
                        else
                        {
                            if (IsPunctuation(c))
                            {
                                CSToken token = new CSToken();
                                token.c     = c;
                                token.place = new Place(i, block.offset + iLine);
                                tokens.Add(token);
                            }
                            ++i;
                        }
                    }
                    else if (state == MultilineComment)
                    {
                        if (c == '*' && i + 1 < line.charsCount && line.chars[i + 1].c == '/')
                        {
                            ++i;
                            state = Normal;
                        }
                        ++i;
                    }
                    else if (state == MultilineString)
                    {
                        if (c == '"')
                        {
                            ++i;
                            if (i < line.charsCount && line.chars[i].c == '"')
                            {
                                builder.Append("\"\"");
                                ++i;
                            }
                            else
                            {
                                builder.Append('"');
                                CSToken token = new CSToken();
                                token.text  = builder.ToString();
                                token.place = new Place(i, block.offset + iLine);
                                tokens.Add(token);
                                state = Normal;
                            }
                        }
                        else
                        {
                            builder.Append(c);
                            ++i;
                        }
                    }
                }
            }
        }
        return(tokens);
    }
Exemplo n.º 25
0
 public SizeAssertion(LineArray provider)
 {
     this.provider = provider;
 }
Exemplo n.º 26
0
 private void Init()
 {
     lines = new LineArray(4);
 }
Exemplo n.º 27
0
 public SnippetReplaceValue(Frame frame, LineArray lines, int position)
 {
     this.frame    = frame;
     this.lines    = lines;
     this.position = position;
 }
Exemplo n.º 28
0
 private void Init(string text)
 {
     lines = new LineArray(4);
     lines.SetText(text);
 }