Esempio n. 1
0
        public static Assignment Parse(ref string input, Namespace ns)
        {
            var orgInput = input;

            var ident = Identifier.Parse(ref input);
            if (ident == null)
                return null;

            Whitespace.Parse(ref input);

            if (input[0] != '=')
                return null;
            input = input.Substring(1);

            Whitespace.Parse(ref input);

            var expr = Expression.Parse(ref input, ns);

            if (ident.Value.Contains("."))
            {
                input = orgInput;
                return null;
            }

            var id = ns.GetScope().Add(ident.Value, expr.ReturnType);
            return new Assignment(ident, expr, id);
        }
Esempio n. 2
0
        public static Variable Parse(ref string input, Namespace ns)
        {
            var ident = Identifier.Parse(ref input);
            if (ident == null)
                return null;

            return ns.GetScope().Get(ident.Value);
        }