public override object Visit(AttributeSection attributeSection, object data)
 {
     return null;
 }
Пример #2
0
	void AttributeSection(
#line  1911 "VBNET.ATG" 
out AttributeSection section) {

#line  1913 "VBNET.ATG" 
		string attributeTarget = "";
		ArrayList attributes = new ArrayList();
		ICSharpCode.SharpRefactory.Parser.AST.VB.Attribute attribute;
		
		
		Expect(28);

#line  1918 "VBNET.ATG" 
		Point startPos = t.Location; 
		if (
#line  1919 "VBNET.ATG" 
IsLocalAttrTarget()) {
			if (la.kind == 94) {
				lexer.NextToken();

#line  1920 "VBNET.ATG" 
				attributeTarget = "event";
			} else if (la.kind == 156) {
				lexer.NextToken();

#line  1921 "VBNET.ATG" 
				attributeTarget = "return";
			} else {
				Identifier();

#line  1924 "VBNET.ATG" 
				string val = t.val.ToLower();
				if (val != "field"	|| val != "method" ||
					val != "module" || val != "param"  ||
					val != "property" || val != "type")
				Error("attribute target specifier (event, return, field," +
						"method, module, param, property, or type) expected");
				attributeTarget = t.val;
				
			}
			Expect(13);
		}
		Attribute(
#line  1934 "VBNET.ATG" 
out attribute);

#line  1934 "VBNET.ATG" 
		attributes.Add(attribute); 
		while (
#line  1935 "VBNET.ATG" 
NotFinalComma()) {
			Expect(12);
			Attribute(
#line  1935 "VBNET.ATG" 
out attribute);

#line  1935 "VBNET.ATG" 
			attributes.Add(attribute); 
		}
		if (la.kind == 12) {
			lexer.NextToken();
		}
		Expect(27);

#line  1939 "VBNET.ATG" 
		section = new AttributeSection(attributeTarget, attributes);
		section.StartLocation = startPos;
		section.EndLocation = t.EndLocation;
		
	}
        public object Visit(AttributeSection attributeSection, object data)
        {
            DebugOutput(attributeSection);
            AppendIndentation();
            sourceText.Append("[");
            if (attributeSection.AttributeTarget != null && attributeSection.AttributeTarget.Length > 0) {
                sourceText.Append(attributeSection.AttributeTarget);
                sourceText.Append(": ");
            }
            for (int j = 0; j < attributeSection.Attributes.Count; ++j) {
                ICSharpCode.SharpRefactory.Parser.AST.VB.Attribute attr = (ICSharpCode.SharpRefactory.Parser.AST.VB.Attribute)attributeSection.Attributes[j];

                sourceText.Append(attr.Name);
                sourceText.Append("(");
                for (int i = 0; i < attr.PositionalArguments.Count; ++i) {
                    Expression expr = (Expression)attr.PositionalArguments[i];
                    sourceText.Append(expr.AcceptVisitor(this, data).ToString());
                    if (i + 1 < attr.PositionalArguments.Count | attr.NamedArguments.Count > 0) {
                        sourceText.Append(", ");
                    }
                }

                for (int i = 0; i < attr.NamedArguments.Count; ++i) {
                    NamedArgumentExpression named = (NamedArgumentExpression)attr.NamedArguments[i];
                    sourceText.Append(named.AcceptVisitor(this, data).ToString());
                    if (i + 1 < attr.NamedArguments.Count) {
                        sourceText.Append(", ");
                    }
                }
                sourceText.Append(")");
                if (j + 1 < attributeSection.Attributes.Count) {
                    sourceText.Append(", ");
                }
            }
            sourceText.Append("]");
            AppendNewLine();
            return null;
        }
Пример #4
0
	void GlobalAttributeSection() {

#line  1840 "VBNET.ATG" 
		Point startPos = t.Location; 
		Expect(28);
		if (la.kind == 50) {
			lexer.NextToken();
		} else if (la.kind == 122) {
			lexer.NextToken();
		} else SynErr(191);

#line  1843 "VBNET.ATG" 
		string attributeTarget = t.val.ToLower();
		ArrayList attributes = new ArrayList();
		ICSharpCode.SharpRefactory.Parser.AST.VB.Attribute attribute;
		
		Expect(13);
		Attribute(
#line  1847 "VBNET.ATG" 
out attribute);

#line  1847 "VBNET.ATG" 
		attributes.Add(attribute); 
		while (
#line  1848 "VBNET.ATG" 
NotFinalComma()) {
			Expect(12);
			Attribute(
#line  1848 "VBNET.ATG" 
out attribute);

#line  1848 "VBNET.ATG" 
			attributes.Add(attribute); 
		}
		if (la.kind == 12) {
			lexer.NextToken();
		}
		Expect(27);
		EndOfStmt();

#line  1853 "VBNET.ATG" 
		AttributeSection section = new AttributeSection(attributeTarget, attributes);
		section.StartLocation = startPos;
		section.EndLocation = t.EndLocation;
		compilationUnit.AddChild(section);
		
	}
 public virtual object Visit(AttributeSection attributeSection, object data)
 {
     object ret = data;
     foreach (ICSharpCode.SharpRefactory.Parser.AST.VB.Attribute a in attributeSection.Attributes) {
         ret = a.AcceptVisitor(this, data);
     }
     return ret;
 }