本文整理汇总了C#中Boo.Lang.Compiler.Ast.ParameterDeclarationCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ParameterDeclarationCollection.Add方法的具体用法?C# ParameterDeclarationCollection.Add怎么用?C# ParameterDeclarationCollection.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boo.Lang.Compiler.Ast.ParameterDeclarationCollection
的用法示例。
在下文中一共展示了ParameterDeclarationCollection.Add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: callable_parameter_declaration
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;
}
示例2: parameter_declaration
//.........这里部分代码省略.........
{
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;
}
示例3: parameter_declaration
//.........这里部分代码省略.........
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;
}
示例4: CustomizeCompiler
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"));
}
示例5: callable_parameter_declaration
//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;
}
}
}
示例6: function_type_parameters
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_);
}
}