Beispiel #1
0
        public override Verb CreateVerb(string[] tokens)
        {
            Color(position, tokens[1].Length, Whitespaces);
            var variableName = tokens[2];

            if (CompilerState.IsRegisteredOperator(variableName))
            {
                Color(tokens[2].Length, Operators);
                return(CompilerState.Operator(variableName));
            }
            var star       = tokens[3];
            var entityType = Variables;

            if (source.Skip(position + length).IsMatch("^ ['([']"))
            {
                entityType = Invokeables;
            }
            if (IsClassName(variableName))
            {
                entityType = Types;
            }
            Color(variableName.Length, entityType);
            Color(star.Length, Operators);
            if (star == "*")
            {
                variableName += "_" + CompilerState.ObjectID();
            }
            var variable = new Variable(variableName);

            result.Value = variable;
            return(new Push(variable));
        }