public static int test() {
		var obj = new PropertyGet();
		return obj.Value;
	}
        private Token Factor()
        {
            Token currentToken = _tokens[_iCurrentToken];
            switch(currentToken.Type)
            {
                case Token.TokenType.BeginParen:
                    Match(Token.TokenType.BeginParen);
                    currentToken.Children.Add(Expression());
                    Match(Token.TokenType.EndParen);
                    return currentToken;
                case Token.TokenType.Identifier:
                    // Check if function call
                    if(_iCurrentToken + 1 < _tokens.Length &&
                        _tokens[_iCurrentToken + 1].Type == Token.TokenType.BeginParen)
                    {
                        return Function();
                    }
                    // Check if resolution
                    else if (_iCurrentToken + 1 < _tokens.Length &&
                        _tokens[_iCurrentToken + 1].Type == Token.TokenType.Dot)
                    {
                        Identifier id = Match(Token.TokenType.Identifier) as Identifier;
                        Match(Token.TokenType.Dot);
                        if (_iCurrentToken + 1 < _tokens.Length &&
                            _tokens[_iCurrentToken + 1].Type == Token.TokenType.BeginParen)
                        {
                            FunctionCall func = Function() as FunctionCall;
                            func.CallOn = id.Id;
                            return func;
                        }
                        else if (_iCurrentToken + 1 < _tokens.Length &&
                            _tokens[_iCurrentToken + 1].Type == Token.TokenType.Assign)
                        {
                            Identifier prop = Match(Token.TokenType.Identifier) as Identifier;
                            PropertySet set = new PropertySet(id.Id, prop.Id);
                            Match(Token.TokenType.Assign);
                            set.Children.Add(Expression());
                            return set;
                        }
                        else
                        {
                            Identifier prop = Match(Token.TokenType.Identifier) as Identifier;
                            PropertyGet get = new PropertyGet(id.Id, prop.Id);
                            return get;
                        }
                    }
                    goto default;
                case Token.TokenType.Add:
                case Token.TokenType.Subtract:
                    if (_iCurrentToken + 1 < _tokens.Length &&
                        _tokens[_iCurrentToken + 1].Type == Token.TokenType.LiteralNumber)
                    {
                        Token plusMinus = Match(currentToken.Type);
                        LiteralNumber literal = Match(Token.TokenType.LiteralNumber) as LiteralNumber;
                        if (plusMinus.Type == Token.TokenType.Subtract)
                            literal.Value = -literal.Value;

                        return literal;
                    }
                    goto default;
                case Token.TokenType.LiteralNumber:
                default:
                    return Match(currentToken.Type);
            }
        }
Example #3
0
 /// <summary>
 /// ItemPropertyChanged
 /// </summary>
 public void ItemPropertyChanged()
 {
     OnPropertyChanged(PropertyGet.GetPropertyName(() => Items));
     OnPropertyChanged(PropertyGet.GetPropertyName(() => SelectedItem));
 }
    public static int test()
    {
        var obj = new PropertyGet();

        return(obj.Value);
    }