Ejemplo n.º 1
0
        public Node TransformAssignment(ParseScope Scope, Let Let, Node Value)
        {
            var arguments = new List<Node>();
            arguments.Add(Object);
            arguments.Add(Value);

            return StaticInvokation.CreateCorrectInvokationNode(Source, Scope, Function, arguments);
        }
Ejemplo n.º 2
0
 public Node TransformAssignment(ParseScope Scope, Let Let, Node Value)
 {
     return Let;
 }
Ejemplo n.º 3
0
        internal static Variable ParseGlobalDeclaration(TokenStream Stream, ParseContext Context)
        {
            if (Stream.Next().Type != TokenType.Identifier) throw new CompileError("[032] Expected identifier", Stream.Next());
            Stream.Advance();

            var r = new Variable();
            r.StorageMethod = VariableStorageMethod.Member;

            if (Stream.Next().Type != TokenType.Identifier) throw new CompileError("[033] Expected identifier", Stream.Next());
            var start = Stream.Next();
            r.Name = Stream.Next().Value.ToUpper();

            Stream.Advance();

            if (Stream.Next().Type == TokenType.Colon)
            {
                Stream.Advance();
                if (Stream.Next().Type != TokenType.Identifier) throw new CompileError("[034] Expected identifier", Stream.Next());
                r.DeclaredTypeName = Stream.Next().Value.ToUpper();
                Stream.Advance();
            }

            if (Stream.Next().Type == TokenType.Operator && Stream.Next().Value == "=")
            {
                Stream.Advance();
                var initialValue = ParseExpression(Stream, Context, TokenType.Semicolon);
                var initializer = new Ast.Let(start, new Ast.Identifier(start), initialValue);
                Context.Initialization.Add(initializer);
            }

            if (!Stream.AtEnd() && Stream.Next().Type == TokenType.QuestionMark)
            {
                Stream.Advance();
                if (Stream.Next().Type != TokenType.String) throw new CompileError("Expected documentation", Stream);
                r.Documentation = Stream.Next().Value;
                Stream.Advance();
            }

            if (Stream.Next().Type != TokenType.Semicolon) throw new CompileError("[035] Expected ;", Stream.Next());
            Stream.Advance();
            return r;
        }