本文整理汇总了C#中Mono.CSharp.EnumMember类的典型用法代码示例。如果您正苦于以下问题:C# EnumMember类的具体用法?C# EnumMember怎么用?C# EnumMember使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EnumMember类属于Mono.CSharp命名空间,在下文中一共展示了EnumMember类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnumMember
public EnumMember (Enum parent, EnumMember prev_member, string name, Expression expr,
Attributes attrs, Location loc)
: base (parent, new EnumTypeExpr (parent), name, expr, Modifiers.PUBLIC,
attrs, loc)
{
this.ParentEnum = parent;
this.ValueExpr = expr;
this.prev_member = prev_member;
}
示例2: AddEnumMember
public void AddEnumMember (EnumMember em)
{
if (em.Name == UnderlyingValueField) {
Report.Error (76, em.Location, "An item in an enumeration cannot have an identifier `{0}'",
UnderlyingValueField);
return;
}
AddConstant (em);
}
示例3: ImplicitInitializer
public ImplicitInitializer (EnumMember current, EnumMember prev)
{
this.current = current;
this.prev = prev;
}
示例4: Visit
public virtual void Visit (EnumMember em)
{
}
示例5: case_339
void case_339()
#line 2609 "cs-parser.jay"
{
--lexer.parsing_block;
var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop];
var em = new EnumMember ((Enum) current_class, new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-4+yyTop]);
em.Initializer = new ConstInitializer (em, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
((Enum) current_class).AddEnumMember (em);
if (RootContext.Documentation != null)
em.DocComment = ConsumeStoredComment ();
yyVal = em;
}
示例6: case_337
void case_337()
#line 2591 "C:\Projects\Junk\mono\mcs\class\Mono.CSharp\..\..\mcs\cs-parser.jay"
{
--lexer.parsing_block;
var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop];
var em = new EnumMember ((Enum) current_class, new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-4+yyTop]);
em.Initializer = new ConstInitializer (em, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
((Enum) current_class).AddEnumMember (em);
if (doc_support)
em.DocComment = ConsumeStoredComment ();
yyVal = em;
}
示例7: Visit
public override void Visit(EnumMember em)
{
var newField = new EnumMemberDeclaration();
AddAttributeSection(newField, em);
newField.AddChild(Identifier.Create(em.Name, Convert(em.Location)), Roles.Identifier);
if (em.Initializer != null) {
newField.AddChild(new CSharpTokenNode(Convert(em.Initializer.Location), Roles.Assign), Roles.Assign);
newField.AddChild((Expression)em.Initializer.Accept(this), EnumMemberDeclaration.InitializerRole);
}
//Console.WriteLine (newField.StartLocation +"-" + newField.EndLocation);
typeStack.Peek().AddChild(newField, Roles.TypeMemberRole);
}
示例8: case_334
void case_334()
#line 2767 "cs-parser.jay"
{
Error_SyntaxError (yyToken);
var lt = (LocatedToken) yyVals[-1+yyTop];
var em = new EnumMember ((Enum) current_type, new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-2+yyTop]);
((Enum) current_type).AddEnumMember (em);
if (doc_support) {
em.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
yyVal = em;
}
示例9: yyparse
//.........这里部分代码省略.........
if (RootContext.Documentation != null)
indexer.DocComment = ConsumeStoredComment ();
current_container.AddIndexer (indexer);
current_local_parameters = null;
implicit_value_parameter_type = null;
indexer_parameters = null;
}
break;
case 314:
#line 2469 "cs-parser.jay"
{
if (RootContext.Documentation != null)
enumTypeComment = Lexer.consume_doc_comment ();
}
break;
case 315:
#line 2475 "cs-parser.jay"
{
MemberName name = (MemberName) yyVals[-4+yyTop];
if (name.IsGeneric) {
Report.Error (1675, name.Location, "Enums cannot have type parameters");
}
name = MakeName (name);
Enum e = new Enum (current_namespace, current_class, (TypeExpr) yyVals[-3+yyTop], (Modifiers) yyVals[-6+yyTop],
name, (Attributes) yyVals[-7+yyTop]);
if (RootContext.Documentation != null)
e.DocComment = enumTypeComment;
EnumMember em = null;
foreach (VariableDeclaration ev in (IList<VariableDeclaration>) yyVals[-1+yyTop]) {
em = new EnumMember (
e, em, ev.identifier, ev.GetInitializer ((FullNamedExpression) yyVals[-3+yyTop]),
ev.OptAttributes, ev.Location);
/* if (RootContext.Documentation != null)*/
em.DocComment = ev.DocComment;
e.AddEnumMember (em);
}
if (RootContext.EvalMode)
undo.AddTypeContainer (current_container, e);
current_container.AddTypeContainer (e);
yyVal = e;
}
break;
case 316:
#line 2512 "cs-parser.jay"
{
yyVal = TypeManager.system_int32_expr;
}
break;
case 317:
#line 2516 "cs-parser.jay"
{
if (yyVals[0+yyTop] != TypeManager.system_int32_expr && yyVals[0+yyTop] != TypeManager.system_uint32_expr &&
yyVals[0+yyTop] != TypeManager.system_int64_expr && yyVals[0+yyTop] != TypeManager.system_uint64_expr &&
yyVals[0+yyTop] != TypeManager.system_int16_expr && yyVals[0+yyTop] != TypeManager.system_uint16_expr &&
yyVals[0+yyTop] != TypeManager.system_byte_expr && yyVals[0+yyTop] != TypeManager.system_sbyte_expr) {
示例10: Visit
public override void Visit (EnumMember em)
{
EnumMemberDeclaration newField = new EnumMemberDeclaration ();
VariableInitializer variable = new VariableInitializer ();
variable.AddChild (new Identifier (em.Name, Convert (em.Location)), DomNode.Roles.Identifier);
if (em.Initializer != null) {
var initializer = (DomNode)em.Initializer.Accept (this);
if (initializer != null)
variable.AddChild (initializer, DomNode.Roles.Initializer);
}
newField.AddChild (variable, DomNode.Roles.Initializer);
typeStack.Peek ().AddChild (newField, TypeDeclaration.Roles.Member);
}
示例11: Visit
public override void Visit (EnumMember em)
{
EnumMemberDeclaration newField = new EnumMemberDeclaration ();
VariableInitializer variable = new VariableInitializer ();
variable.AddChild (new Identifier (em.Name, Convert (em.Location)), AstNode.Roles.Identifier);
if (em.Initializer != null) {
variable.AddChild ((MonoDevelop.CSharp.Ast.Expression)em.Initializer.Accept (this), VariableInitializer.Roles.Expression);
}
newField.AddChild (variable, AstNode.Roles.Variable);
typeStack.Peek ().AddChild (newField, TypeDeclaration.MemberRole);
}
示例12: Visit
public override void Visit (EnumMember em)
{
EnumMemberDeclaration newField = new EnumMemberDeclaration ();
// TODO: attributes, 'new' modifier
newField.AddChild (new Identifier (em.Name, Convert (em.Location)), AstNode.Roles.Identifier);
if (em.Initializer != null) {
newField.AddChild ((Expression)em.Initializer.Accept (this), EnumMemberDeclaration.InitializerRole);
}
typeStack.Peek ().AddChild (newField, TypeDeclaration.MemberRole);
}
示例13: case_324
void case_324()
{
var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop];
var em = new EnumMember ((Enum) current_type, new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-1+yyTop]);
((Enum) current_type).AddEnumMember (em);
if (doc_support) {
em.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
yyVal = em;
}
示例14: yyparse
//.........这里部分代码省略.........
var te = yyVals[0+yyTop] as TypeExpression;
if (te == null || !EnumSpec.IsValidUnderlyingType (te.Type)) {
Enum.Error_1008 (GetLocation (yyVals[0+yyTop]), report);
yyVal = null;
} else {
yyVal = yyVals[0+yyTop];
}
}
break;
case 341:
#line 2902 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
Error_TypeExpected (GetLocation (yyVals[-1+yyTop]));
yyVal = null;
}
break;
case 344:
#line 2912 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
lbag.AddLocation (yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop]));
}
break;
case 346:
#line 2920 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
lbag.AddLocation (yyVals[-2+yyTop], GetLocation (yyVals[-1+yyTop]));
yyVal = yyVals[0+yyTop];
}
break;
case 347:
#line 2928 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop];
var em = new EnumMember ((Enum) current_class, new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-1+yyTop]);
((Enum) current_class).AddEnumMember (em);
if (doc_support) {
em.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
yyVal = em;
}
break;
case 348:
#line 2941 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
++lexer.parsing_block;
if (doc_support) {
tmpComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.NotAllowed;
}
}
break;
case 349:
#line 2949 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
--lexer.parsing_block;
var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop];
var em = new EnumMember ((Enum) current_class, new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-4+yyTop]);
em.Initializer = new ConstInitializer (em, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
((Enum) current_class).AddEnumMember (em);
if (doc_support)
em.DocComment = ConsumeStoredComment ();
示例15: Visit
public override void Visit (EnumMember em)
{
EnumMemberDeclaration newField = new EnumMemberDeclaration ();
AddAttributeSection (newField, em);
newField.AddChild (Identifier.Create (em.Name, Convert (em.Location)), AstNode.Roles.Identifier);
if (em.Initializer != null) {
newField.AddChild (new CSharpTokenNode (Convert (em.Initializer.Location), 1), EnumMemberDeclaration.Roles.Assign);
newField.AddChild ((Expression)em.Initializer.Accept (this), EnumMemberDeclaration.InitializerRole);
}
typeStack.Peek ().AddChild (newField, TypeDeclaration.MemberRole);
}