Пример #1
0
        public static IArgument ParseCreate(WordScanner word, ParsedDocument parsedDocument)
        {
            if (word.Text == "\n" || word.Text == ";")
            {
                return(null);
            }
            switch (word.Text)
            {
            case "[":     //  bracket
                Bracket bracket = Bracket.ParseCreate(word, parsedDocument);
                return(bracket);

            case "{":     // brace
                Brace brace = Brace.ParseCreate(word, parsedDocument);
                return(brace);

            case "\"":     // quote
                Quote quote = Quote.ParseCreate(word, parsedDocument);
                return(quote);

            default:
                Text text = Text.ParseCreate(word, parsedDocument);
                return(text);
            }
        }
Пример #2
0
        public static Command ParseCreate(WordScanner word, ParsedDocument parsedDocument)
        {
            if (BuiltInCommandParsers.ContainsKey(word.Text))
            {
                Command bcommand = BuiltInCommandParsers[word.Text](word, parsedDocument);
                return(bcommand);
            }

            Command command = new Command();

            command.Name = word.Text;
            word.Color(CodeDrawStyle.ColorType.Keyword);
            word.MoveNext();

            while (!word.Eof)
            {
                if (word.Text == "\n" || word.Text == ";")
                {
                    word.MoveNext();
                    break;
                }

                IArgument argument = Argument.ParseCreate(word, parsedDocument);
                if (argument != null)
                {
                    command.Arguments.Add(argument);
                }
            }

            return(command);
        }
Пример #3
0
        public static Text ParseCreate(WordScanner word, ParsedDocument parsedDocument)
        {
            Text text = new Text();

            text.Value = word.Text;
            word.MoveNext();

            return(text);
        }
Пример #4
0
        public WordScanner Clone()
        {
            WordScanner ret = new WordScanner(wordPointer.Document, RootParsedDocument, systemTcl);

            ret.wordPointer       = wordPointer.Clone();
            ret.nonGeneratedCount = nonGeneratedCount;
            ret.prototype         = prototype;
            foreach (var wp in stock)
            {
                ret.stock.Add(wp.Clone());
            }
            return(ret);
        }
Пример #5
0
        public static new Comment ParseCreate(WordScanner word, ParsedDocument parsedDocument)
        {
            Comment comment = new Comment();

            word.Color(CodeDrawStyle.ColorType.Comment);
            word.MoveNext();

            while (!word.Eof)
            {
                word.Color(CodeDrawStyle.ColorType.Comment);
                word.MoveNext();
                if (word.Text == "\n" || word.Text == ";")
                {
                    word.MoveNext();
                    break;
                }
            }
            return(comment);
        }
Пример #6
0
        public static Brace ParseCreate(WordScanner word, ParsedDocument parsedDocument)
        {
            Brace brace = new Brace();

            word.Color(CodeDrawStyle.ColorType.Keyword);
            word.MoveNext();

            while (!word.Eof)
            {
                if (word.Text == "}")
                {
                    word.Color(CodeDrawStyle.ColorType.Keyword);
                    word.MoveNext();
                    break;
                }
                word.MoveNext();
            }
            return(brace);
        }
Пример #7
0
        public static Quote ParseCreate(WordScanner word, ParsedDocument parsedDocument)
        {
            Quote quote = new Quote();

            word.Color(CodeDrawStyle.ColorType.Keyword);
            word.MoveNext();

            while (!word.Eof)
            {
                if (word.Text == "\"")
                {
                    word.Color(CodeDrawStyle.ColorType.Keyword);
                    word.MoveNext();
                    break;
                }
                word.MoveNext();
            }
            return(quote);
        }
Пример #8
0
 public void Parse(WordScanner word)
 {
     while (!word.Eof)
     {
         if (word.Text == "\n" || word.Text == ";")
         {
             word.MoveNext();
         }
         if (word.Text.StartsWith("#"))
         {
             Tcl.Comment comment = Tcl.Comment.ParseCreate(word, this);
         }
         else
         {
             Tcl.Command command = Tcl.Command.ParseCreate(word, this);
             if (command != null)
             {
                 Commands.Add(command);
             }
         }
     }
 }