Exemplo n.º 1
0
 public static void VAR(Token next, LinkedList<ActionNode> lNode, LinkedListNode<ActionNode> before)
 {
     if (next.Type == TokenType.NUMBER)
     {
         DirectFunctionCallNode dfn = new DirectFunctionCallNode();
         dfn.Parameters = new List<string>() { BaseCompiled.SET_CONST_TO_RTV, next.Text };
         lNode.AddBefore(before, dfn);
     }
     else
     {
         DirectFunctionCallNode dfnx = new DirectFunctionCallNode();
         dfnx.Parameters = new List<string>() { BaseCompiled.SET_ID_TO_RTV, next.Text };//Set the variable name
         lNode.AddBefore(before, dfnx);
     }
 }
Exemplo n.º 2
0
        public static void Create(string text, Tokenizr t)
        {
            Token token = null;
            if (_Tokens.ContainsKey(text))
            {
                token = (Token)_Tokens[text].Clone();
            }
            else
            {
                token = new Token()
                {
                    Text = text,
                    Type = GetVarType(text)
                };
            }

            token.Register(t);//Register the new Token
        }
Exemplo n.º 3
0
        public void AddToken(Token token)
        {
            token.ID = id++;
            token.Col = collumn;
            token.Line = line;
            var t = this._tokens.AddLast(token);

            if (partners.ContainsValue(token.Type))
            {// CLOSE
                SetPartners(_stack.Pop(), t);
                if (token.Type != TokenType.STATEMENT_ELSE) token.Level = --level;
            }
            token.Level = level;
            if (partners.ContainsKey(token.Type))
            {// Als de token ~OPEN voorkomt als key in de partners Dictionary
                //Voeg toe aan de stack
                _stack.Push(t);
                if (token.Type != TokenType.STATEMENT_IF) token.Level = level++;
            }
        }