예제 #1
0
        override public object Clone()
        {
            SpliceMemberReferenceExpression clone = new SpliceMemberReferenceExpression();

            clone._lexicalInfo       = _lexicalInfo;
            clone._endSourceLocation = _endSourceLocation;
            clone._documentation     = _documentation;
            clone._isSynthetic       = _isSynthetic;
            clone._entity            = _entity;
            if (_annotations != null)
            {
                clone._annotations = (Hashtable)_annotations.Clone();
            }
            clone._expressionType = _expressionType;
            if (null != _target)
            {
                clone._target = _target.Clone() as Expression;
                clone._target.InitializeParent(clone);
            }
            if (null != _nameExpression)
            {
                clone._nameExpression = _nameExpression.Clone() as Expression;
                clone._nameExpression.InitializeParent(clone);
            }
            return(clone);
        }
        override public object Clone()
        {
            SpliceMemberReferenceExpression clone = (SpliceMemberReferenceExpression)FormatterServices.GetUninitializedObject(typeof(SpliceMemberReferenceExpression));

            clone._lexicalInfo       = _lexicalInfo;
            clone._endSourceLocation = _endSourceLocation;
            clone._documentation     = _documentation;
            clone._entity            = _entity;
            if (_annotations != null)
            {
                clone._annotations = (Hashtable)_annotations.Clone();
            }

            clone._expressionType = _expressionType;
            if (null != _target)
            {
                clone._target = _target.Clone() as Expression;
                clone._target.InitializeParent(clone);
            }
            if (null != _nameExpression)
            {
                clone._nameExpression = _nameExpression.Clone() as Expression;
                clone._nameExpression.InitializeParent(clone);
            }
            return(clone);
        }
예제 #3
0
        public override void OnSpliceMemberReferenceExpression(SpliceMemberReferenceExpression node)
        {
            MethodInvocationExpression ctor = CreateInvocation(node, "Boo.Lang.Compiler.Ast.MemberReferenceExpression");

            ctor.Arguments.Add(Serialize(node.Target));
            ctor.Arguments.Add(LiftMemberName(node.NameExpression));
            Push(ctor);
        }
예제 #4
0
        public override void OnSpliceMemberReferenceExpression(SpliceMemberReferenceExpression node)
        {
            if (InsideSerializedQuasiquote())
            {
                SerializeSpliceMemberReferenceExpression(node);
                return;
            }
            var ctor = CreateInvocation(node, "Boo.Lang.Compiler.Ast.MemberReferenceExpression");

            ctor.Arguments.Add(Serialize(node.Target));
            ctor.Arguments.Add(LiftMemberName(node.NameExpression));
            Push(ctor);
        }
예제 #5
0
	protected Expression  slicing_expression() //throws RecognitionException, TokenStreamException
{
		Expression e;
		
		IToken  lbrack = null;
		IToken  oft = null;
		IToken  begin = null;
		IToken  lparen = null;
		
				e = null;
				SlicingExpression se = null;
				MethodInvocationExpression mce = null;
				IToken memberName = null;
				TypeReference genericArgument = null;
				TypeReferenceCollection genericArguments = null;
				Expression nameSplice = null;
				Expression initializer = null;
				UnaryExpression ue = null;		
			
		
		try {      // for error handling
			e=safe_atom();
			{    // ( ... )*
				for (;;)
				{
					if ((LA(1)==LBRACK) && (tokenSet_72_.member(LA(2))))
					{
						{
							lbrack = LT(1);
							match(LBRACK);
							{
								switch ( LA(1) )
								{
								case OF:
								{
									{
										match(OF);
										if (0==inputState.guessing)
										{
											
																	GenericReferenceExpression gre = new GenericReferenceExpression(ToLexicalInfo(lbrack));
																	gre.Target = e;
																	e = gre;
																	genericArguments = gre.GenericArguments;
																
										}
										type_reference_list(genericArguments);
									}
									break;
								}
								case ESEPARATOR:
								case CAST:
								case CHAR:
								case FALSE:
								case NOT:
								case NULL:
								case SELF:
								case SUPER:
								case THEN:
								case TRUE:
								case TYPEOF:
								case TRIPLE_QUOTED_STRING:
								case LPAREN:
								case DOUBLE_QUOTED_STRING:
								case SINGLE_QUOTED_STRING:
								case ID:
								case MULTIPLY:
								case LBRACK:
								case SPLICE_BEGIN:
								case DOT:
								case COLON:
								case LBRACE:
								case QQ_BEGIN:
								case SUBTRACT:
								case LONG:
								case INCREMENT:
								case DECREMENT:
								case ONES_COMPLEMENT:
								case INT:
								case BACKTICK_QUOTED_STRING:
								case RE_LITERAL:
								case DOUBLE:
								case FLOAT:
								case TIMESPAN:
								{
									if (0==inputState.guessing)
									{
										
															se = new SlicingExpression(ToLexicalInfo(lbrack));				
															se.Target = e;
															e = se;
														
									}
									slice(se);
									{    // ( ... )*
										for (;;)
										{
											if ((LA(1)==COMMA))
											{
												match(COMMA);
												slice(se);
											}
											else
											{
												goto _loop591_breakloop;
											}
											
										}
_loop591_breakloop:										;
									}    // ( ... )*
									break;
								}
								default:
								{
									throw new NoViableAltException(LT(1), getFilename());
								}
								 }
							}
							match(RBRACK);
							{
								switch ( LA(1) )
								{
								case NULLABLE_SUFFIX:
								{
									match(NULLABLE_SUFFIX);
									if (0==inputState.guessing)
									{
										
															ue = new UnaryExpression(e.LexicalInfo);
															ue.Operator = UnaryOperatorType.SafeAccess;
															ue.Operand = e;
															e = ue;
														
									}
									break;
								}
								case EOF:
								case DEDENT:
								case ESEPARATOR:
								case EOL:
								case ASSEMBLY_ATTRIBUTE_BEGIN:
								case MODULE_ATTRIBUTE_BEGIN:
								case ABSTRACT:
								case AND:
								case AS:
								case BREAK:
								case CONTINUE:
								case CALLABLE:
								case CAST:
								case CHAR:
								case CLASS:
								case CONSTRUCTOR:
								case DEF:
								case DESTRUCTOR:
								case DO:
								case ELSE:
								case ENUM:
								case EVENT:
								case FINAL:
								case FOR:
								case FALSE:
								case GOTO:
								case INTERFACE:
								case INTERNAL:
								case IS:
								case ISA:
								case IF:
								case IN:
								case NEW:
								case NOT:
								case NULL:
								case OF:
								case OR:
								case OVERRIDE:
								case PARTIAL:
								case PUBLIC:
								case PROTECTED:
								case PRIVATE:
								case RAISE:
								case RETURN:
								case SELF:
								case SUPER:
								case STATIC:
								case STRUCT:
								case THEN:
								case TRY:
								case TRANSIENT:
								case TRUE:
								case TYPEOF:
								case UNLESS:
								case VIRTUAL:
								case WHILE:
								case YIELD:
								case TRIPLE_QUOTED_STRING:
								case EOS:
								case LPAREN:
								case RPAREN:
								case DOUBLE_QUOTED_STRING:
								case SINGLE_QUOTED_STRING:
								case ID:
								case MULTIPLY:
								case LBRACK:
								case RBRACK:
								case ASSIGN:
								case COMMA:
								case SPLICE_BEGIN:
								case DOT:
								case COLON:
								case EXPONENTIATION:
								case BITWISE_OR:
								case LBRACE:
								case RBRACE:
								case QQ_BEGIN:
								case QQ_END:
								case INPLACE_BITWISE_OR:
								case INPLACE_EXCLUSIVE_OR:
								case INPLACE_BITWISE_AND:
								case INPLACE_SHIFT_LEFT:
								case INPLACE_SHIFT_RIGHT:
								case CMP_OPERATOR:
								case GREATER_THAN:
								case LESS_THAN:
								case ADD:
								case SUBTRACT:
								case EXCLUSIVE_OR:
								case DIVISION:
								case MODULUS:
								case BITWISE_AND:
								case SHIFT_LEFT:
								case SHIFT_RIGHT:
								case LONG:
								case INCREMENT:
								case DECREMENT:
								case ONES_COMPLEMENT:
								case INT:
								case BACKTICK_QUOTED_STRING:
								case RE_LITERAL:
								case DOUBLE:
								case FLOAT:
								case TIMESPAN:
								{
									break;
								}
								default:
								{
									throw new NoViableAltException(LT(1), getFilename());
								}
								 }
							}
						}
					}
					else if ((LA(1)==OF)) {
						{
							oft = LT(1);
							match(OF);
							genericArgument=type_reference();
							if (0==inputState.guessing)
							{
								
												GenericReferenceExpression gre = new GenericReferenceExpression(ToLexicalInfo(oft));
												gre.Target = e;
												e = gre;
												gre.GenericArguments.Add(genericArgument);
											
							}
						}
					}
					else if ((LA(1)==DOT) && (tokenSet_33_.member(LA(2)))) {
						{
							match(DOT);
							{
								switch ( LA(1) )
								{
								case EVENT:
								case GET:
								case INTERNAL:
								case PUBLIC:
								case PROTECTED:
								case REF:
								case SET:
								case YIELD:
								case ID:
								{
									{
										memberName=member();
										if (0==inputState.guessing)
										{
											
																	e = MemberReferenceForToken(e, memberName);
																
										}
									}
									break;
								}
								case SPLICE_BEGIN:
								{
									{
										begin = LT(1);
										match(SPLICE_BEGIN);
										nameSplice=atom();
										if (0==inputState.guessing)
										{
											
																	e = new SpliceMemberReferenceExpression(
																				ToLexicalInfo(begin),
																				e,
																				nameSplice);
																
										}
									}
									break;
								}
								default:
								{
									throw new NoViableAltException(LT(1), getFilename());
								}
								 }
							}
							{
								switch ( LA(1) )
								{
								case NULLABLE_SUFFIX:
								{
									match(NULLABLE_SUFFIX);
									if (0==inputState.guessing)
									{
										
															ue = new UnaryExpression(e.LexicalInfo);
															ue.Operator = UnaryOperatorType.SafeAccess;
															ue.Operand = e;
															e = ue;
														
									}
									break;
								}
								case EOF:
								case DEDENT:
								case ESEPARATOR:
								case EOL:
								case ASSEMBLY_ATTRIBUTE_BEGIN:
								case MODULE_ATTRIBUTE_BEGIN:
								case ABSTRACT:
								case AND:
								case AS:
								case BREAK:
								case CONTINUE:
								case CALLABLE:
								case CAST:
								case CHAR:
								case CLASS:
								case CONSTRUCTOR:
								case DEF:
								case DESTRUCTOR:
								case DO:
								case ELSE:
								case ENUM:
								case EVENT:
								case FINAL:
								case FOR:
								case FALSE:
								case GOTO:
								case INTERFACE:
								case INTERNAL:
								case IS:
								case ISA:
								case IF:
								case IN:
								case NEW:
								case NOT:
								case NULL:
								case OF:
								case OR:
								case OVERRIDE:
								case PARTIAL:
								case PUBLIC:
								case PROTECTED:
								case PRIVATE:
								case RAISE:
								case RETURN:
								case SELF:
								case SUPER:
								case STATIC:
								case STRUCT:
								case THEN:
								case TRY:
								case TRANSIENT:
								case TRUE:
								case TYPEOF:
								case UNLESS:
								case VIRTUAL:
								case WHILE:
								case YIELD:
								case TRIPLE_QUOTED_STRING:
								case EOS:
								case LPAREN:
								case RPAREN:
								case DOUBLE_QUOTED_STRING:
								case SINGLE_QUOTED_STRING:
								case ID:
								case MULTIPLY:
								case LBRACK:
								case RBRACK:
								case ASSIGN:
								case COMMA:
								case SPLICE_BEGIN:
								case DOT:
								case COLON:
								case EXPONENTIATION:
								case BITWISE_OR:
								case LBRACE:
								case RBRACE:
								case QQ_BEGIN:
								case QQ_END:
								case INPLACE_BITWISE_OR:
								case INPLACE_EXCLUSIVE_OR:
								case INPLACE_BITWISE_AND:
								case INPLACE_SHIFT_LEFT:
								case INPLACE_SHIFT_RIGHT:
								case CMP_OPERATOR:
								case GREATER_THAN:
								case LESS_THAN:
								case ADD:
								case SUBTRACT:
								case EXCLUSIVE_OR:
								case DIVISION:
								case MODULUS:
								case BITWISE_AND:
								case SHIFT_LEFT:
								case SHIFT_RIGHT:
								case LONG:
								case INCREMENT:
								case DECREMENT:
								case ONES_COMPLEMENT:
								case INT:
								case BACKTICK_QUOTED_STRING:
								case RE_LITERAL:
								case DOUBLE:
								case FLOAT:
								case TIMESPAN:
								{
									break;
								}
								default:
								{
									throw new NoViableAltException(LT(1), getFilename());
								}
								 }
							}
						}
					}
					else if ((LA(1)==LPAREN) && (tokenSet_73_.member(LA(2)))) {
						{
							lparen = LT(1);
							match(LPAREN);
							if (0==inputState.guessing)
							{
								
													mce = new MethodInvocationExpression(ToLexicalInfo(lparen));
													mce.Target = e;
													e = mce;
												
							}
							{
								switch ( LA(1) )
								{
								case ESEPARATOR:
								case CAST:
								case CHAR:
								case FALSE:
								case NOT:
								case NULL:
								case SELF:
								case SUPER:
								case THEN:
								case TRUE:
								case TYPEOF:
								case TRIPLE_QUOTED_STRING:
								case LPAREN:
								case DOUBLE_QUOTED_STRING:
								case SINGLE_QUOTED_STRING:
								case ID:
								case MULTIPLY:
								case LBRACK:
								case SPLICE_BEGIN:
								case DOT:
								case LBRACE:
								case QQ_BEGIN:
								case SUBTRACT:
								case LONG:
								case INCREMENT:
								case DECREMENT:
								case ONES_COMPLEMENT:
								case INT:
								case BACKTICK_QUOTED_STRING:
								case RE_LITERAL:
								case DOUBLE:
								case FLOAT:
								case TIMESPAN:
								{
									argument(mce);
									{    // ( ... )*
										for (;;)
										{
											if ((LA(1)==COMMA))
											{
												match(COMMA);
												argument(mce);
											}
											else
											{
												goto _loop602_breakloop;
											}
											
										}
_loop602_breakloop:										;
									}    // ( ... )*
									break;
								}
								case RPAREN:
								{
									break;
								}
								default:
								{
									throw new NoViableAltException(LT(1), getFilename());
								}
								 }
							}
							match(RPAREN);
							{
								switch ( LA(1) )
								{
								case NULLABLE_SUFFIX:
								{
									match(NULLABLE_SUFFIX);
									if (0==inputState.guessing)
									{
										
															ue = new UnaryExpression(e.LexicalInfo);
															ue.Operator = UnaryOperatorType.SafeAccess;
															ue.Operand = e;
															e = ue;
														
									}
									break;
								}
								case EOF:
								case DEDENT:
								case ESEPARATOR:
								case EOL:
								case ASSEMBLY_ATTRIBUTE_BEGIN:
								case MODULE_ATTRIBUTE_BEGIN:
								case ABSTRACT:
								case AND:
								case AS:
								case BREAK:
								case CONTINUE:
								case CALLABLE:
								case CAST:
								case CHAR:
								case CLASS:
								case CONSTRUCTOR:
								case DEF:
								case DESTRUCTOR:
								case DO:
								case ELSE:
								case ENUM:
								case EVENT:
								case FINAL:
								case FOR:
								case FALSE:
								case GOTO:
								case INTERFACE:
								case INTERNAL:
								case IS:
								case ISA:
								case IF:
								case IN:
								case NEW:
								case NOT:
								case NULL:
								case OF:
								case OR:
								case OVERRIDE:
								case PARTIAL:
								case PUBLIC:
								case PROTECTED:
								case PRIVATE:
								case RAISE:
								case RETURN:
								case SELF:
								case SUPER:
								case STATIC:
								case STRUCT:
								case THEN:
								case TRY:
								case TRANSIENT:
								case TRUE:
								case TYPEOF:
								case UNLESS:
								case VIRTUAL:
								case WHILE:
								case YIELD:
								case TRIPLE_QUOTED_STRING:
								case EOS:
								case LPAREN:
								case RPAREN:
								case DOUBLE_QUOTED_STRING:
								case SINGLE_QUOTED_STRING:
								case ID:
								case MULTIPLY:
								case LBRACK:
								case RBRACK:
								case ASSIGN:
								case COMMA:
								case SPLICE_BEGIN:
								case DOT:
								case COLON:
								case EXPONENTIATION:
								case BITWISE_OR:
								case LBRACE:
								case RBRACE:
								case QQ_BEGIN:
								case QQ_END:
								case INPLACE_BITWISE_OR:
								case INPLACE_EXCLUSIVE_OR:
								case INPLACE_BITWISE_AND:
								case INPLACE_SHIFT_LEFT:
								case INPLACE_SHIFT_RIGHT:
								case CMP_OPERATOR:
								case GREATER_THAN:
								case LESS_THAN:
								case ADD:
								case SUBTRACT:
								case EXCLUSIVE_OR:
								case DIVISION:
								case MODULUS:
								case BITWISE_AND:
								case SHIFT_LEFT:
								case SHIFT_RIGHT:
								case LONG:
								case INCREMENT:
								case DECREMENT:
								case ONES_COMPLEMENT:
								case INT:
								case BACKTICK_QUOTED_STRING:
								case RE_LITERAL:
								case DOUBLE:
								case FLOAT:
								case TIMESPAN:
								{
									break;
								}
								default:
								{
									throw new NoViableAltException(LT(1), getFilename());
								}
								 }
							}
							{
								if ((LA(1)==LBRACE) && (tokenSet_74_.member(LA(2))))
								{
									{
										bool synPredMatched607 = false;
										if (((LA(1)==LBRACE) && (tokenSet_74_.member(LA(2)))))
										{
											int _m607 = mark();
											synPredMatched607 = true;
											inputState.guessing++;
											try {
												{
													hash_literal_test();
												}
											}
											catch (RecognitionException)
											{
												synPredMatched607 = false;
											}
											rewind(_m607);
											inputState.guessing--;
										}
										if ( synPredMatched607 )
										{
											initializer=hash_literal();
										}
										else if ((LA(1)==LBRACE) && (tokenSet_74_.member(LA(2)))) {
											initializer=list_initializer();
										}
										else
										{
											throw new NoViableAltException(LT(1), getFilename());
										}
										
									}
									if (0==inputState.guessing)
									{
										e = new CollectionInitializationExpression(e, initializer);
									}
								}
								else if ((tokenSet_75_.member(LA(1))) && (tokenSet_15_.member(LA(2)))) {
								}
								else
								{
									throw new NoViableAltException(LT(1), getFilename());
								}
								
							}
						}
					}
					else
					{
						goto _loop608_breakloop;
					}
					
				}
_loop608_breakloop:				;
			}    // ( ... )*
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "slicing_expression");
				recover(ex,tokenSet_76_);
			}
			else
			{
				throw ex;
			}
		}
		return e;
	}
예제 #6
0
        //throws RecognitionException, TokenStreamException
        protected Expression slicing_expression()
        {
            Expression e;

            IToken  lbrack = null;
            IToken  oft = null;
            IToken  begin = null;
            IToken  lparen = null;

                e = null;
                SlicingExpression se = null;
                MethodInvocationExpression mce = null;
                IToken memberName = null;
                TypeReference genericArgument = null;
                TypeReferenceCollection genericArguments = null;
                Expression nameSplice = null;
                Expression initializer = null;

            try {      // for error handling
            e=atom();
            {    // ( ... )*
                for (;;)
                {
                    if ((LA(1)==LBRACK) && (tokenSet_63_.member(LA(2))))
                    {
                        {
                            lbrack = LT(1);
                            match(LBRACK);
                            {
                                switch ( LA(1) )
                                {
                                case OF:
                                {
                                    {
                                        match(OF);
                                        if (0==inputState.guessing)
                                        {

                                                                    GenericReferenceExpression gre = new GenericReferenceExpression(ToLexicalInfo(lbrack));
                                                                    gre.Target = e;
                                                                    e = gre;
                                                                    genericArguments = gre.GenericArguments;

                                        }
                                        type_reference_list(genericArguments);
                                    }
                                    break;
                                }
                                case ESEPARATOR:
                                case CAST:
                                case CHAR:
                                case FALSE:
                                case NOT:
                                case NULL:
                                case SELF:
                                case SUPER:
                                case TRUE:
                                case TYPEOF:
                                case ID:
                                case TRIPLE_QUOTED_STRING:
                                case DOUBLE_QUOTED_STRING:
                                case SINGLE_QUOTED_STRING:
                                case LBRACK:
                                case LPAREN:
                                case SPLICE_BEGIN:
                                case DOT:
                                case COLON:
                                case MULTIPLY:
                                case LBRACE:
                                case QQ_BEGIN:
                                case SUBTRACT:
                                case LONG:
                                case INCREMENT:
                                case DECREMENT:
                                case ONES_COMPLEMENT:
                                case INT:
                                case RE_LITERAL:
                                case DOUBLE:
                                case FLOAT:
                                case TIMESPAN:
                                {
                                    if (0==inputState.guessing)
                                    {

                                                            se = new SlicingExpression(ToLexicalInfo(lbrack));
                                                            se.Target = e;
                                                            e = se;

                                    }
                                    slice(se);
                                    {    // ( ... )*
                                        for (;;)
                                        {
                                            if ((LA(1)==COMMA))
                                            {
                                                match(COMMA);
                                                slice(se);
                                            }
                                            else
                                            {
                                                goto _loop574_breakloop;
                                            }

                                        }
            _loop574_breakloop:										;
                                    }    // ( ... )*
                                    break;
                                }
                                default:
                                {
                                    throw new NoViableAltException(LT(1), getFilename());
                                }
                                 }
                            }
                            match(RBRACK);
                        }
                    }
                    else if ((LA(1)==OF)) {
                        {
                            oft = LT(1);
                            match(OF);
                            genericArgument=type_reference();
                            if (0==inputState.guessing)
                            {

                                                GenericReferenceExpression gre = new GenericReferenceExpression(ToLexicalInfo(oft));
                                                gre.Target = e;
                                                e = gre;
                                                gre.GenericArguments.Add(genericArgument);

                            }
                        }
                    }
                    else if ((LA(1)==DOT) && (tokenSet_27_.member(LA(2)))) {
                        {
                            match(DOT);
                            {
                                switch ( LA(1) )
                                {
                                case EVENT:
                                case GET:
                                case INTERNAL:
                                case PUBLIC:
                                case PROTECTED:
                                case REF:
                                case SET:
                                case ID:
                                {
                                    {
                                        memberName=member();
                                        if (0==inputState.guessing)
                                        {

                                                                    e = MemberReferenceForToken(e, memberName);

                                        }
                                    }
                                    break;
                                }
                                case SPLICE_BEGIN:
                                {
                                    {
                                        begin = LT(1);
                                        match(SPLICE_BEGIN);
                                        nameSplice=atom();
                                        if (0==inputState.guessing)
                                        {

                                                                    e = new SpliceMemberReferenceExpression(
                                                                                ToLexicalInfo(begin),
                                                                                e,
                                                                                nameSplice);

                                        }
                                    }
                                    break;
                                }
                                default:
                                {
                                    throw new NoViableAltException(LT(1), getFilename());
                                }
                                 }
                            }
                        }
                    }
                    else if ((LA(1)==LPAREN) && (tokenSet_64_.member(LA(2)))) {
                        {
                            lparen = LT(1);
                            match(LPAREN);
                            if (0==inputState.guessing)
                            {

                                                    mce = new MethodInvocationExpression(ToLexicalInfo(lparen));
                                                    mce.Target = e;
                                                    e = mce;

                            }
                            {
                                switch ( LA(1) )
                                {
                                case ESEPARATOR:
                                case CAST:
                                case CHAR:
                                case FALSE:
                                case NOT:
                                case NULL:
                                case SELF:
                                case SUPER:
                                case TRUE:
                                case TYPEOF:
                                case ID:
                                case TRIPLE_QUOTED_STRING:
                                case DOUBLE_QUOTED_STRING:
                                case SINGLE_QUOTED_STRING:
                                case LBRACK:
                                case LPAREN:
                                case SPLICE_BEGIN:
                                case DOT:
                                case MULTIPLY:
                                case LBRACE:
                                case QQ_BEGIN:
                                case SUBTRACT:
                                case LONG:
                                case INCREMENT:
                                case DECREMENT:
                                case ONES_COMPLEMENT:
                                case INT:
                                case RE_LITERAL:
                                case DOUBLE:
                                case FLOAT:
                                case TIMESPAN:
                                {
                                    argument(mce);
                                    {    // ( ... )*
                                        for (;;)
                                        {
                                            if ((LA(1)==COMMA))
                                            {
                                                match(COMMA);
                                                argument(mce);
                                            }
                                            else
                                            {
                                                goto _loop583_breakloop;
                                            }

                                        }
            _loop583_breakloop:										;
                                    }    // ( ... )*
                                    break;
                                }
                                case RPAREN:
                                {
                                    break;
                                }
                                default:
                                {
                                    throw new NoViableAltException(LT(1), getFilename());
                                }
                                 }
                            }
                            match(RPAREN);
                            {
                                if ((LA(1)==LBRACE) && (tokenSet_65_.member(LA(2))))
                                {
                                    {
                                        bool synPredMatched587 = false;
                                        if (((LA(1)==LBRACE) && (tokenSet_65_.member(LA(2)))))
                                        {
                                            int _m587 = mark();
                                            synPredMatched587 = true;
                                            inputState.guessing++;
                                            try {
                                                {
                                                    hash_literal_test();
                                                }
                                            }
                                            catch (RecognitionException)
                                            {
                                                synPredMatched587 = false;
                                            }
                                            rewind(_m587);
                                            inputState.guessing--;
                                        }
                                        if ( synPredMatched587 )
                                        {
                                            initializer=hash_literal();
                                        }
                                        else if ((LA(1)==LBRACE) && (tokenSet_65_.member(LA(2)))) {
                                            initializer=list_initializer();
                                        }
                                        else
                                        {
                                            throw new NoViableAltException(LT(1), getFilename());
                                        }

                                    }
                                    if (0==inputState.guessing)
                                    {
                                        e = new CollectionInitializationExpression(e, initializer);
                                    }
                                }
                                else if ((tokenSet_66_.member(LA(1))) && (tokenSet_14_.member(LA(2)))) {
                                }
                                else
                                {
                                    throw new NoViableAltException(LT(1), getFilename());
                                }

                            }
                        }
                    }
                    else
                    {
                        goto _loop588_breakloop;
                    }

                }
            _loop588_breakloop:				;
            }    // ( ... )*
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_67_);
            }
            else
            {
                throw ex;
            }
            }
            return e;
        }
		override public object Clone()
		{
		
			SpliceMemberReferenceExpression clone = new SpliceMemberReferenceExpression();
			clone._lexicalInfo = _lexicalInfo;
			clone._endSourceLocation = _endSourceLocation;
			clone._documentation = _documentation;
			clone._isSynthetic = _isSynthetic;
			clone._entity = _entity;
			if (_annotations != null) clone._annotations = (Hashtable)_annotations.Clone();
			clone._expressionType = _expressionType;
			if (null != _target)
			{
				clone._target = _target.Clone() as Expression;
				clone._target.InitializeParent(clone);
			}
			if (null != _nameExpression)
			{
				clone._nameExpression = _nameExpression.Clone() as Expression;
				clone._nameExpression.InitializeParent(clone);
			}
			return clone;


		}
예제 #8
0
        //throws RecognitionException, TokenStreamException
        protected Expression slicing_expression()
        {
            Expression e;

            IToken  lbrack = null;
            IToken  oft = null;
            IToken  begin = null;
            IToken  lparen = null;

                e = null;
                SlicingExpression se = null;
                MethodInvocationExpression mce = null;
                IToken memberName = null;
                TypeReference genericArgument = null;
                TypeReferenceCollection genericArguments = null;
                Expression nameSplice = null;

            try {      // for error handling
            e=atom();
            {    // ( ... )*
                for (;;)
                {
                    switch ( LA(1) )
                    {
                    case OF:
                    {
                        {
                            oft = LT(1);
                            match(OF);
                            genericArgument=type_reference();
                            if (0==inputState.guessing)
                            {

                                                GenericReferenceExpression gre = new GenericReferenceExpression(ToLexicalInfo(oft));
                                                gre.Target = e;
                                                e = gre;
                                                gre.GenericArguments.Add(genericArgument);

                            }
                        }
                        break;
                    }
                    case DOT:
                    {
                        {
                            match(DOT);
                            {
                                switch ( LA(1) )
                                {
                                case GET:
                                case INTERNAL:
                                case PUBLIC:
                                case PROTECTED:
                                case REF:
                                case SET:
                                case ID:
                                {
                                    {
                                        memberName=member();
                                        if (0==inputState.guessing)
                                        {

                                                                    MemberReferenceExpression mre = new MemberReferenceExpression(ToLexicalInfo(memberName));
                                                                    mre.Target = e;
                                                                    mre.Name = memberName.getText();
                                                                    e = mre;

                                        }
                                    }
                                    break;
                                }
                                case SPLICE_BEGIN:
                                {
                                    {
                                        begin = LT(1);
                                        match(SPLICE_BEGIN);
                                        nameSplice=atom();
                                        if (0==inputState.guessing)
                                        {

                                                                    e = new SpliceMemberReferenceExpression(
                                                                                ToLexicalInfo(begin),
                                                                                e,
                                                                                nameSplice);

                                        }
                                    }
                                    break;
                                }
                                default:
                                {
                                    throw new NoViableAltException(LT(1), getFilename());
                                }
                                 }
                            }
                        }
                        break;
                    }
                    default:
                        if ((LA(1)==LBRACK) && (tokenSet_56_.member(LA(2))))
                        {
                            {
                                lbrack = LT(1);
                                match(LBRACK);
                                {
                                    switch ( LA(1) )
                                    {
                                    case OF:
                                    {
                                        {
                                            match(OF);
                                            if (0==inputState.guessing)
                                            {

                                                                        GenericReferenceExpression gre = new GenericReferenceExpression(ToLexicalInfo(lbrack));
                                                                        gre.Target = e;
                                                                        e = gre;
                                                                        genericArguments = gre.GenericArguments;

                                            }
                                            type_reference_list(genericArguments);
                                        }
                                        break;
                                    }
                                    case ESEPARATOR:
                                    case CAST:
                                    case CHAR:
                                    case FALSE:
                                    case NOT:
                                    case NULL:
                                    case SELF:
                                    case SUPER:
                                    case TRUE:
                                    case TYPEOF:
                                    case TRIPLE_QUOTED_STRING:
                                    case DOUBLE_QUOTED_STRING:
                                    case SINGLE_QUOTED_STRING:
                                    case ID:
                                    case LBRACK:
                                    case LPAREN:
                                    case SUBTRACT:
                                    case SPLICE_BEGIN:
                                    case COLON:
                                    case LBRACE:
                                    case QQ_BEGIN:
                                    case INCREMENT:
                                    case DECREMENT:
                                    case ONES_COMPLEMENT:
                                    case INT:
                                    case LONG:
                                    case RE_LITERAL:
                                    case DOUBLE:
                                    case FLOAT:
                                    case TIMESPAN:
                                    {
                                        if (0==inputState.guessing)
                                        {

                                                                se = new SlicingExpression(ToLexicalInfo(lbrack));
                                                                se.Target = e;
                                                                e = se;

                                        }
                                        slice(se);
                                        {    // ( ... )*
                                            for (;;)
                                            {
                                                if ((LA(1)==COMMA))
                                                {
                                                    match(COMMA);
                                                    slice(se);
                                                }
                                                else
                                                {
                                                    goto _loop547_breakloop;
                                                }

                                            }
            _loop547_breakloop:											;
                                        }    // ( ... )*
                                        break;
                                    }
                                    default:
                                    {
                                        throw new NoViableAltException(LT(1), getFilename());
                                    }
                                     }
                                }
                                match(RBRACK);
                            }
                        }
                        else if ((LA(1)==LPAREN) && (tokenSet_57_.member(LA(2)))) {
                            {
                                lparen = LT(1);
                                match(LPAREN);
                                if (0==inputState.guessing)
                                {

                                                        mce = new MethodInvocationExpression(ToLexicalInfo(lparen));
                                                        mce.Target = e;
                                                        e = mce;

                                }
                                {
                                    switch ( LA(1) )
                                    {
                                    case ESEPARATOR:
                                    case CAST:
                                    case CHAR:
                                    case FALSE:
                                    case NOT:
                                    case NULL:
                                    case SELF:
                                    case SUPER:
                                    case TRUE:
                                    case TYPEOF:
                                    case TRIPLE_QUOTED_STRING:
                                    case DOUBLE_QUOTED_STRING:
                                    case SINGLE_QUOTED_STRING:
                                    case ID:
                                    case LBRACK:
                                    case LPAREN:
                                    case SUBTRACT:
                                    case SPLICE_BEGIN:
                                    case MULTIPLY:
                                    case LBRACE:
                                    case QQ_BEGIN:
                                    case INCREMENT:
                                    case DECREMENT:
                                    case ONES_COMPLEMENT:
                                    case INT:
                                    case LONG:
                                    case RE_LITERAL:
                                    case DOUBLE:
                                    case FLOAT:
                                    case TIMESPAN:
                                    {
                                        method_invocation_argument(mce);
                                        {    // ( ... )*
                                            for (;;)
                                            {
                                                if ((LA(1)==COMMA))
                                                {
                                                    match(COMMA);
                                                    method_invocation_argument(mce);
                                                }
                                                else
                                                {
                                                    goto _loop556_breakloop;
                                                }

                                            }
            _loop556_breakloop:											;
                                        }    // ( ... )*
                                        break;
                                    }
                                    case RPAREN:
                                    {
                                        break;
                                    }
                                    default:
                                    {
                                        throw new NoViableAltException(LT(1), getFilename());
                                    }
                                     }
                                }
                                match(RPAREN);
                            }
                        }
                    else
                    {
                        goto _loop557_breakloop;
                    }
                    break; }
                }
            _loop557_breakloop:				;
            }    // ( ... )*
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_58_);
            }
            else
            {
                throw ex;
            }
            }
            return e;
        }