void ConvertParameters(List <ParameterDeclarationExpression> input, B.ParameterDeclarationCollection output)
        {
            bool isParams = false;

            foreach (ParameterDeclarationExpression pde in input)
            {
                B.ParameterDeclaration para = ConvertParameter(pde, out isParams);
                if (para != null)
                {
                    output.Add(para);
                }
            }
            output.HasParamArray = isParams;
        }
Beispiel #2
0
	protected bool  callable_parameter_declaration(
		ParameterDeclarationCollection c
	) //throws RecognitionException, TokenStreamException
{
		bool varArgs;
		
				
				TypeReference tr = null;
				ParameterModifiers pm = ParameterModifiers.None;
				varArgs = false;
			
		
		try {      // for error handling
			{
				switch ( LA(1) )
				{
				case MULTIPLY:
				{
					{
						match(MULTIPLY);
						if (0==inputState.guessing)
						{
							varArgs=true;
						}
						tr=type_reference();
					}
					break;
				}
				case CALLABLE:
				case CHAR:
				case REF:
				case THEN:
				case LPAREN:
				case ID:
				case SPLICE_BEGIN:
				{
					{
						{
							switch ( LA(1) )
							{
							case REF:
							{
								pm=parameter_modifier();
								break;
							}
							case CALLABLE:
							case CHAR:
							case THEN:
							case LPAREN:
							case ID:
							case SPLICE_BEGIN:
							{
								break;
							}
							default:
							{
								throw new NoViableAltException(LT(1), getFilename());
							}
							 }
						}
						{
							tr=type_reference();
						}
					}
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			if (0==inputState.guessing)
			{
				
						ParameterDeclaration pd = new ParameterDeclaration(tr.LexicalInfo);
						pd.Name = "arg" + c.Count;
						pd.Type = tr;
						pd.Modifiers = pm;
						c.Add(pd);
					
			}
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "callable_parameter_declaration");
				recover(ex,tokenSet_87_);
			}
			else
			{
				throw ex;
			}
		}
		return varArgs;
	}
Beispiel #3
0
	protected bool  parameter_declaration(
		ParameterDeclarationCollection c
	) //throws RecognitionException, TokenStreamException
{
		bool variableArguments;
		
		IToken  id1 = null;
		IToken  begin1 = null;
		IToken  id2 = null;
		IToken  begin2 = null;
				
				IToken id = null;
				TypeReference tr = null;
				ParameterModifiers pm = ParameterModifiers.None;
				variableArguments = false;
				Expression nameSplice = null;
			
		
		try {      // for error handling
			attributes();
			{
				switch ( LA(1) )
				{
				case MULTIPLY:
				{
					{
						match(MULTIPLY);
						if (0==inputState.guessing)
						{
							variableArguments=true;
						}
						{
							switch ( LA(1) )
							{
							case ID:
							{
								id1 = LT(1);
								match(ID);
								if (0==inputState.guessing)
								{
									id = id1;
								}
								break;
							}
							case SPLICE_BEGIN:
							{
								begin1 = LT(1);
								match(SPLICE_BEGIN);
								nameSplice=atom();
								if (0==inputState.guessing)
								{
									id = begin1;
								}
								break;
							}
							default:
							{
								throw new NoViableAltException(LT(1), getFilename());
							}
							 }
						}
						{
							switch ( LA(1) )
							{
							case AS:
							{
								match(AS);
								tr=array_type_reference();
								break;
							}
							case RPAREN:
							case RBRACK:
							case COMMA:
							case BITWISE_OR:
							{
								break;
							}
							default:
							{
								throw new NoViableAltException(LT(1), getFilename());
							}
							 }
						}
					}
					break;
				}
				case REF:
				case ID:
				case SPLICE_BEGIN:
				{
					{
						{
							switch ( LA(1) )
							{
							case REF:
							{
								pm=parameter_modifier();
								break;
							}
							case ID:
							case SPLICE_BEGIN:
							{
								break;
							}
							default:
							{
								throw new NoViableAltException(LT(1), getFilename());
							}
							 }
						}
						{
							switch ( LA(1) )
							{
							case ID:
							{
								id2 = LT(1);
								match(ID);
								if (0==inputState.guessing)
								{
									id = id2;
								}
								break;
							}
							case SPLICE_BEGIN:
							{
								begin2 = LT(1);
								match(SPLICE_BEGIN);
								nameSplice=atom();
								if (0==inputState.guessing)
								{
									id = begin2;
								}
								break;
							}
							default:
							{
								throw new NoViableAltException(LT(1), getFilename());
							}
							 }
						}
						{
							switch ( LA(1) )
							{
							case AS:
							{
								match(AS);
								tr=type_reference();
								break;
							}
							case RPAREN:
							case RBRACK:
							case COMMA:
							case BITWISE_OR:
							{
								break;
							}
							default:
							{
								throw new NoViableAltException(LT(1), getFilename());
							}
							 }
						}
					}
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			if (0==inputState.guessing)
			{
				
						ParameterDeclaration pd = new ParameterDeclaration(ToLexicalInfo(id));
						pd.Name = id.getText();
						pd.Type = tr;
						pd.Modifiers = pm;
						AddAttributes(pd.Attributes);
						
						c.Add(
							nameSplice != null
							? new SpliceParameterDeclaration(pd, nameSplice)
							: pd);
					
			}
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "parameter_declaration");
				recover(ex,tokenSet_86_);
			}
			else
			{
				throw ex;
			}
		}
		return variableArguments;
	}
Beispiel #4
0
        //throws RecognitionException, TokenStreamException
        protected bool parameter_declaration(
            ParameterDeclarationCollection c
            )
        {
            bool variableArguments;

            IToken  id1 = null;
            IToken  id2 = null;

                IToken id = null;
                TypeReference tr = null;
                ParameterModifiers pm = ParameterModifiers.None;
                variableArguments = false;

            try {      // for error handling
            attributes();
            {
                switch ( LA(1) )
                {
                case MULTIPLY:
                {
                    {
                        match(MULTIPLY);
                        if (0==inputState.guessing)
                        {
                            variableArguments=true;
                        }
                        id1 = LT(1);
                        match(ID);
                        {
                            switch ( LA(1) )
                            {
                            case AS:
                            {
                                match(AS);
                                tr=array_type_reference();
                                break;
                            }
                            case RPAREN:
                            case RBRACK:
                            case COMMA:
                            case BITWISE_OR:
                            {
                                break;
                            }
                            default:
                            {
                                throw new NoViableAltException(LT(1), getFilename());
                            }
                             }
                        }
                        if (0==inputState.guessing)
                        {
                            id = id1;
                        }
                    }
                    break;
                }
                case REF:
                case ID:
                {
                    {
                        {
                            switch ( LA(1) )
                            {
                            case REF:
                            {
                                pm=parameter_modifier();
                                break;
                            }
                            case ID:
                            {
                                break;
                            }
                            default:
                            {
                                throw new NoViableAltException(LT(1), getFilename());
                            }
                             }
                        }
                        id2 = LT(1);
                        match(ID);
                        {
                            switch ( LA(1) )
                            {
                            case AS:
                            {
                                match(AS);
                                tr=type_reference();
                                break;
                            }
                            case RPAREN:
                            case RBRACK:
                            case COMMA:
                            case BITWISE_OR:
                            {
                                break;
                            }
                            default:
                            {
                                throw new NoViableAltException(LT(1), getFilename());
                            }
                             }
                        }
                        if (0==inputState.guessing)
                        {
                            id = id2;
                        }
                    }
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            if (0==inputState.guessing)
            {

                        ParameterDeclaration pd = new ParameterDeclaration(SourceLocationFactory.ToLexicalInfo(id));
                        pd.Name = id.getText();
                        pd.Type = tr;
                        pd.Modifiers = pm;
                        AddAttributes(pd.Attributes);
                        c.Add(pd);

            }
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_81_);
            }
            else
            {
                throw ex;
            }
            }
            return variableArguments;
        }
Beispiel #5
0
        protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
        {
            ParameterDeclarationCollection parameters = new ParameterDeclarationCollection();
            ParameterDeclaration newParameterDeclaration =
                new ParameterDeclaration("input", new SimpleTypeReference("System.String"));
            parameters.Add(newParameterDeclaration);

            pipeline.Insert(1, new ImplicitBaseClassCompilerStep(typeof(MyClassWithParams),
                "Hello",
                parameters,
                "System"));
        }
Beispiel #6
0
        //throws RecognitionException, TokenStreamException
        protected void callable_parameter_declaration(
		ParameterDeclarationCollection c
	)
        {
            TypeReference tr = null;
                ParameterModifiers pm = ParameterModifiers.None;

            try {      // for error handling
            {
                {
                    switch ( LA(1) )
                    {
                    case REF:
                    {
                        pm=parameter_modifier();
                        break;
                    }
                    case CALLABLE:
                    case CHAR:
                    case ID:
                    case LPAREN:
                    case SPLICE_BEGIN:
                    {
                        break;
                    }
                    default:
                    {
                        throw new NoViableAltException(LT(1), getFilename());
                    }
                     }
                }
                {
                    tr=type_reference();
                }
            }
            if (0==inputState.guessing)
            {

                        ParameterDeclaration pd = new ParameterDeclaration(tr.LexicalInfo);
                        pd.Name = "arg" + c.Count;
                        pd.Type = tr;
                        pd.Modifiers = pm;
                        c.Add(pd);

            }
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_69_);
            }
            else
            {
                throw ex;
            }
            }
        }
        public void function_type_parameters(ParameterDeclarationCollection parameters)
        {
            try
            {
                this.match(0x3f);
                switch (this.LA(1))
                {
                    case 0x13:
                    case 0x3b:
                    {
                        TypeReference reference = this.type_reference();
                        if (base.inputState.guessing == 0)
                        {
                            ParameterDeclaration declaration;
                            ParameterDeclaration declaration1 = declaration = new ParameterDeclaration();
                            declaration.set_Type(reference);
                            declaration.set_Name("arg" + parameters.Count);
                            parameters.Add(declaration);
                        }
                        while (this.LA(1) == 0x43)
                        {
                            this.match(0x43);
                            reference = this.type_reference();
                            if (base.inputState.guessing == 0)
                            {
                                ParameterDeclaration declaration2;
                                ParameterDeclaration declaration3 = declaration2 = new ParameterDeclaration();
                                declaration2.set_Type(reference);
                                declaration2.set_Name("arg" + parameters.Count);
                                parameters.Add(declaration2);
                            }
                        }
                        break;
                    }
                    case 0x40:
                        break;

                    default:
                        throw new NoViableAltException(this.LT(1), this.getFilename());
                }
                this.match(0x40);
            }
            catch (RecognitionException exception)
            {
                if (base.inputState.guessing != 0)
                {
                    throw;
                }
                this.reportError(exception);
                this.recover(exception, tokenSet_35_);
            }
        }