Browse Source

finished implementation of global level VB constructs

newNRvisualizers
Siegfried Pammer 14 years ago
parent
commit
b5c55470c5
  1. 5
      ICSharpCode.NRefactory.VB/Ast/AstNode.cs
  2. 32
      ICSharpCode.NRefactory.VB/Ast/Enums.cs
  3. 1
      ICSharpCode.NRefactory.VB/Ast/General/AttributeBlock.cs
  4. 15
      ICSharpCode.NRefactory.VB/Ast/General/AttributedNode.cs
  5. 40
      ICSharpCode.NRefactory.VB/Ast/General/ParameterDeclaration.cs
  6. 44
      ICSharpCode.NRefactory.VB/Ast/General/TypeParameterDeclaration.cs
  7. 52
      ICSharpCode.NRefactory.VB/Ast/GlobalScope/DelegateDeclaration.cs
  8. 44
      ICSharpCode.NRefactory.VB/Ast/GlobalScope/EnumDeclaration.cs
  9. 39
      ICSharpCode.NRefactory.VB/Ast/GlobalScope/EnumMemberDeclaration.cs
  10. 78
      ICSharpCode.NRefactory.VB/Ast/GlobalScope/NamespaceDeclaration.cs
  11. 58
      ICSharpCode.NRefactory.VB/Ast/GlobalScope/TypeDeclaration.cs
  12. 1
      ICSharpCode.NRefactory.VB/Ast/VBModifierToken.cs
  13. 22
      ICSharpCode.NRefactory.VB/IAstVisitor.cs
  14. 10
      ICSharpCode.NRefactory.VB/ICSharpCode.NRefactory.VB.csproj
  15. 98
      ICSharpCode.NRefactory.VB/OutputVisitor/OutputVisitor.cs
  16. 49
      ICSharpCode.NRefactory.VB/Parser/ParamModifierList.cs

5
ICSharpCode.NRefactory.VB/Ast/AstNode.cs

@ -677,16 +677,15 @@ namespace ICSharpCode.NRefactory.VB @@ -677,16 +677,15 @@ namespace ICSharpCode.NRefactory.VB
public static readonly Role<XmlLiteralString> XmlLiteralString = new Role<XmlLiteralString>("XmlLiteralString", Ast.XmlLiteralString.Null);
// public static readonly Role<BlockStatement> Body = new Role<BlockStatement>("Body", CSharp.BlockStatement.Null);
// public static readonly Role<ParameterDeclaration> Parameter = new Role<ParameterDeclaration>("Parameter");
public static readonly Role<ParameterDeclaration> Parameter = new Role<ParameterDeclaration>("Parameter");
public static readonly Role<Expression> Argument = new Role<Expression>("Argument", Ast.Expression.Null);
public static readonly Role<AstType> Type = new Role<AstType>("Type", AstType.Null);
public static readonly Role<Expression> Expression = new Role<Expression>("Expression", Ast.Expression.Null);
// public static readonly Role<Expression> TargetExpression = new Role<Expression>("Target", CSharp.Expression.Null);
// public readonly static Role<Expression> Condition = new Role<Expression>("Condition", CSharp.Expression.Null);
//
// public static readonly Role<TypeParameterDeclaration> TypeParameter = new Role<TypeParameterDeclaration>("TypeParameter");
public static readonly Role<TypeParameterDeclaration> TypeParameter = new Role<TypeParameterDeclaration>("TypeParameter");
public static readonly Role<AstType> TypeArgument = new Role<AstType>("TypeArgument", AstType.Null);
// public readonly static Role<Constraint> Constraint = new Role<Constraint>("Constraint");
// public static readonly Role<VariableInitializer> Variable = new Role<VariableInitializer>("Variable");
// public static readonly Role<Statement> EmbeddedStatement = new Role<Statement>("EmbeddedStatement", CSharp.Statement.Null);
//

32
ICSharpCode.NRefactory.VB/Ast/Enums.cs

@ -21,7 +21,7 @@ namespace ICSharpCode.NRefactory.VB.Ast @@ -21,7 +21,7 @@ namespace ICSharpCode.NRefactory.VB.Ast
MustOverride = 0x0020, // Members
Overridable = 0x0040,
NotInheritable = 0x0080, // Types
NotOverridable = 0x0100, // Members
NotOverridable = 0x0100, // Members
Const = 0x0200,
Shared = 0x0400,
Static = 0x0800,
@ -35,10 +35,15 @@ namespace ICSharpCode.NRefactory.VB.Ast @@ -35,10 +35,15 @@ namespace ICSharpCode.NRefactory.VB.Ast
WithEvents = 0x20000, // VB specific
Default = 0x40000, // VB specific
Dim = 0x100000, // VB.NET SPECIFIC, for fields/local variables only
Dim = 0x80000, // VB.NET SPECIFIC, for fields/local variables only
/// <summary>Only for VB properties.</summary>
WriteOnly = 0x200000, // VB specific
WriteOnly = 0x100000, // VB specific
ByVal = 0x200000,
ByRef = 0x400000,
ParamArray = 0x800000,
Optional = 0x1000000,
/// <summary>
/// Special value used to match any modifiers during pattern matching.
@ -46,15 +51,6 @@ namespace ICSharpCode.NRefactory.VB.Ast @@ -46,15 +51,6 @@ namespace ICSharpCode.NRefactory.VB.Ast
Any = unchecked((int)0x80000000)
}
public enum ClassType
{
Class,
Module,
Interface,
Struct,
Enum
}
public enum ParentType
{
ClassOrStruct,
@ -71,18 +67,6 @@ namespace ICSharpCode.NRefactory.VB.Ast @@ -71,18 +67,6 @@ namespace ICSharpCode.NRefactory.VB.Ast
Ref
}
[Flags]
public enum ParameterModifiers
{
// Values must be the same as in SharpDevelop's ParameterModifiers
None = 0,
In = 1,
Out = 2,
Ref = 4,
Params = 8,
Optional = 16
}
public enum VarianceModifier
{
Invariant,

1
ICSharpCode.NRefactory.VB/Ast/General/AttributeBlock.cs

@ -8,6 +8,7 @@ namespace ICSharpCode.NRefactory.VB.Ast @@ -8,6 +8,7 @@ namespace ICSharpCode.NRefactory.VB.Ast
public class AttributeBlock : AstNode
{
public readonly static Role<AttributeBlock> AttributeBlockRole = new Role<AttributeBlock>("AttributeBlock");
public readonly static Role<AttributeBlock> ReturnTypeAttributeBlockRole = new Role<AttributeBlock>("ReturnTypeAttributeBlock");
public VBTokenNode LChevron {
get { return GetChildByRole(Roles.LChevron); }

15
ICSharpCode.NRefactory.VB/Ast/GlobalScope/ModuleDeclaration.cs → ICSharpCode.NRefactory.VB/Ast/General/AttributedNode.cs

@ -63,18 +63,5 @@ namespace ICSharpCode.NRefactory.VB.Ast @@ -63,18 +63,5 @@ namespace ICSharpCode.NRefactory.VB.Ast
}
}
public abstract class TypeDeclaration : AttributedNode
{
}
/// <summary>
/// Description of ModuleDeclaration.
/// </summary>
public class ModuleDeclaration
{
public ModuleDeclaration()
{
}
}
}

40
ICSharpCode.NRefactory.VB/Ast/General/ParameterDeclaration.cs

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
namespace ICSharpCode.NRefactory.VB.Ast
{
public class ParameterDeclaration : AttributedNode
{
public Identifier Name {
get { return GetChildByRole(Roles.Identifier); }
set { SetChildByRole(Roles.Identifier, value); }
}
public Expression OptionalValue {
get { return GetChildByRole(Roles.Expression); }
set { SetChildByRole(Roles.Expression, value); }
}
public AstType ReturnType {
get { return GetChildByRole(Roles.Type); }
set { SetChildByRole(Roles.Type, value); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
var param = other as ParameterDeclaration;
return param != null &&
MatchAttributesAndModifiers(param, match) &&
Name.DoMatch(param.Name, match) &&
OptionalValue.DoMatch(param.OptionalValue, match) &&
ReturnType.DoMatch(param.ReturnType, match);
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitParameterDeclaration(this, data);
}
}
}

44
ICSharpCode.NRefactory.VB/Ast/General/TypeParameterDeclaration.cs

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
namespace ICSharpCode.NRefactory.VB.Ast
{
/// <summary>
/// [In|Out] Name [As Contraints]
///
/// Represents a type parameter.
/// </summary>
public class TypeParameterDeclaration : AstNode
{
public static readonly Role<AstType> TypeConstraintRole = TypeDeclaration.InheritsTypeRole;
public static readonly Role<VBTokenNode> VarianceRole = new Role<VBTokenNode>("Variance");
public VarianceModifier Variance { get; set; }
public string Name {
get { return GetChildByRole (Roles.Identifier).Name; }
set { SetChildByRole(Roles.Identifier, new Identifier(value, AstLocation.Empty)); }
}
public AstNodeCollection<AstType> Constraints {
get { return GetChildrenByRole(TypeConstraintRole); }
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitTypeParameterDeclaration(this, data);
}
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
TypeParameterDeclaration o = other as TypeParameterDeclaration;
return o != null && this.Variance == o.Variance
&& MatchString(this.Name, o.Name)
&& this.Constraints.DoMatch(o.Constraints, match);
}
}
}

52
ICSharpCode.NRefactory.VB/Ast/GlobalScope/DelegateDeclaration.cs

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
namespace ICSharpCode.NRefactory.VB.Ast
{
public class DelegateDeclaration : AttributedNode
{
public bool IsSub { get; set; }
public AstNodeCollection<TypeParameterDeclaration> TypeParameters {
get { return GetChildrenByRole(Roles.TypeParameter); }
}
public Identifier Name {
get { return GetChildByRole(Roles.Identifier); }
set { SetChildByRole(Roles.Identifier, value); }
}
public AstNodeCollection<ParameterDeclaration> Parameters {
get { return GetChildrenByRole(Roles.Parameter); }
}
public AstNodeCollection<AttributeBlock> ReturnTypeAttributes {
get { return GetChildrenByRole(AttributeBlock.ReturnTypeAttributeBlockRole); }
}
public AstType ReturnType {
get { return GetChildByRole(Roles.Type); }
set { SetChildByRole(Roles.Type, value); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
var o = other as DelegateDeclaration;
return o != null &&
MatchAttributesAndModifiers(o, match) &&
IsSub == o.IsSub &&
TypeParameters.DoMatch(o.TypeParameters, match) &&
Name.DoMatch(o.Name, match) &&
Parameters.DoMatch(o.Parameters, match) &&
ReturnTypeAttributes.DoMatch(o.ReturnTypeAttributes, match) &&
ReturnType.DoMatch(o.ReturnType, match);
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitDelegateDeclaration(this, data);
}
}
}

44
ICSharpCode.NRefactory.VB/Ast/GlobalScope/EnumDeclaration.cs

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
namespace ICSharpCode.NRefactory.VB.Ast
{
public class EnumDeclaration : AttributedNode
{
public readonly static Role<EnumMemberDeclaration> MemberRole = new Role<EnumMemberDeclaration>("Member");
public readonly static Role<AstType> UnderlyingTypeRole = new Role<AstType>("UnderlyingType", AstType.Null);
public Identifier Name {
get { return GetChildByRole(Roles.Identifier); }
set { SetChildByRole(Roles.Identifier, value); }
}
public AstType UnderlyingType {
get { return GetChildByRole(UnderlyingTypeRole); }
set { SetChildByRole(UnderlyingTypeRole, value); }
}
public AstNodeCollection<EnumMemberDeclaration> Member {
get { return GetChildrenByRole(MemberRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
var decl = other as EnumDeclaration;
return decl != null &&
MatchAttributesAndModifiers(decl, match) &&
Name.DoMatch(decl.Name, match) &&
UnderlyingType.DoMatch(decl.UnderlyingType, match) &&
Member.DoMatch(decl.Member, match);
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitEnumDeclaration(this, data);
}
}
}

39
ICSharpCode.NRefactory.VB/Ast/GlobalScope/EnumMemberDeclaration.cs

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
namespace ICSharpCode.NRefactory.VB.Ast
{
public class EnumMemberDeclaration : AstNode
{
public AstNodeCollection<AttributeBlock> Attributes {
get { return GetChildrenByRole(AttributeBlock.AttributeBlockRole); }
}
public Identifier Name {
get { return GetChildByRole(Roles.Identifier); }
set { SetChildByRole(Roles.Identifier, value); }
}
public Expression Value {
get { return GetChildByRole(Roles.Expression); }
set { SetChildByRole(Roles.Expression, value); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
var member = other as EnumMemberDeclaration;
return Attributes.DoMatch(member.Attributes, match) &&
Name.DoMatch(member.Name, match) &&
Value.DoMatch(member.Value, match);
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitEnumMemberDeclaration(this, data);
}
}
}

78
ICSharpCode.NRefactory.VB/Ast/GlobalScope/NamespaceDeclaration.cs

@ -0,0 +1,78 @@ @@ -0,0 +1,78 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ICSharpCode.NRefactory.PatternMatching;
namespace ICSharpCode.NRefactory.VB.Ast
{
/// <summary>
/// Namespace Name
/// Members
/// End Namespace
/// </summary>
public class NamespaceDeclaration : AstNode
{
public static readonly Role<AstNode> MemberRole = CompilationUnit.MemberRole;
public string Name {
get {
StringBuilder builder = new StringBuilder();
foreach (Identifier identifier in GetChildrenByRole (Roles.Identifier)) {
if (builder.Length > 0)
builder.Append ('.');
builder.Append (identifier.Name);
}
return builder.ToString ();
}
set {
GetChildrenByRole(Roles.Identifier).ReplaceWith(value.Split('.').Select(ident => new Identifier(ident, AstLocation.Empty)));
}
}
public AstNodeCollection<Identifier> Identifiers {
get { return GetChildrenByRole (Roles.Identifier); }
}
/// <summary>
/// Gets the full namespace name (including any parent namespaces)
/// </summary>
public string FullName {
get {
NamespaceDeclaration parentNamespace = Parent as NamespaceDeclaration;
if (parentNamespace != null)
return BuildQualifiedName (parentNamespace.FullName, Name);
return Name;
}
}
public AstNodeCollection<AstNode> Members {
get { return GetChildrenByRole(MemberRole); }
}
public static string BuildQualifiedName (string name1, string name2)
{
if (string.IsNullOrEmpty (name1))
return name2;
if (string.IsNullOrEmpty (name2))
return name1;
return name1 + "." + name2;
}
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitNamespaceDeclaration(this, data);
}
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
NamespaceDeclaration o = other as NamespaceDeclaration;
return o != null && MatchString(this.Name, o.Name) && this.Members.DoMatch(o.Members, match);
}
}
};

58
ICSharpCode.NRefactory.VB/Ast/GlobalScope/TypeDeclaration.cs

@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
using ICSharpCode.NRefactory.TypeSystem;
namespace ICSharpCode.NRefactory.VB.Ast
{
public class TypeDeclaration : AttributedNode
{
public readonly static Role<AttributedNode> MemberRole = new Role<AttributedNode>("Member");
public readonly static Role<AstType> InheritsTypeRole = new Role<AstType>("InheritsType", AstType.Null);
public readonly static Role<AstType> ImplementsTypesRole = new Role<AstType>("ImplementsTypes", AstType.Null);
public AstNodeCollection<AttributedNode> Members {
get { return base.GetChildrenByRole(MemberRole); }
}
public ClassType ClassType { get; set; }
public Identifier Name {
get { return GetChildByRole(Roles.Identifier); }
set { SetChildByRole(Roles.Identifier, value); }
}
public AstNodeCollection<TypeParameterDeclaration> TypeParameters {
get { return GetChildrenByRole(Roles.TypeParameter); }
}
public AstType InheritsType {
get { return GetChildByRole(InheritsTypeRole); }
}
public AstNodeCollection<AstType> ImplementsTypes {
get { return GetChildrenByRole(ImplementsTypesRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
TypeDeclaration t = other as TypeDeclaration;
return t != null &&
MatchAttributesAndModifiers(t, match) &&
Members.DoMatch(t.Members, match) &&
ClassType == t.ClassType &&
Name.DoMatch(t.Name, match) &&
TypeParameters.DoMatch(t.TypeParameters, match) &&
InheritsType.DoMatch(t.InheritsType, match) &&
ImplementsTypes.DoMatch(t.ImplementsTypes, match);
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitTypeDeclaration(this, data);
}
}
}

1
ICSharpCode.NRefactory.VB/Ast/VBModifierToken.cs

@ -58,7 +58,6 @@ namespace ICSharpCode.NRefactory.VB.Ast @@ -58,7 +58,6 @@ namespace ICSharpCode.NRefactory.VB.Ast
new KeyValuePair<Modifiers, int>(Modifiers.WithEvents, "WithEvents".Length),
new KeyValuePair<Modifiers, int>(Modifiers.Default, "Default".Length),
new KeyValuePair<Modifiers, int>(Modifiers.Dim, "Dim".Length),
// even though it's used for patterns only, it needs to be in this table to be usable in the AST
new KeyValuePair<Modifiers, int>(Modifiers.Any, "Any".Length)

22
ICSharpCode.NRefactory.VB/IAstVisitor.cs

@ -6,20 +6,28 @@ using ICSharpCode.NRefactory.VB.Ast; @@ -6,20 +6,28 @@ using ICSharpCode.NRefactory.VB.Ast;
using Attribute = ICSharpCode.NRefactory.VB.Ast.Attribute;
namespace ICSharpCode.NRefactory.VB {
public interface IAstVisitor<in T, out S> {
public interface IAstVisitor<in T, out S>
{
S VisitBlockStatement(BlockStatement blockStatement, T data);
S VisitCompilationUnit(CompilationUnit compilationUnit, T data);
S VisitPatternPlaceholder(AstNode placeholder, PatternMatching.Pattern pattern, T data);
S VisitTypeParameterDeclaration(TypeParameterDeclaration typeParameterDeclaration, T data);
S VisitParameterDeclaration(ParameterDeclaration parameterDeclaration, T data);
S VisitVBTokenNode(VBTokenNode vBTokenNode, T data);
S VisitCompilationUnit(CompilationUnit compilationUnit, T data);
S VisitBlockStatement(BlockStatement blockStatement, T data);
// Global scope
S VisitOptionStatement(OptionStatement optionStatement, T data);
S VisitImportsStatement(ImportsStatement importsStatement, T data);
S VisitAliasImportsClause(AliasImportsClause aliasImportsClause, T data);
S VisitMembersImportsClause(MemberImportsClause membersImportsClause, T data);
S VisitXmlNamespaceImportsClause(XmlNamespaceImportsClause xmlNamespaceImportsClause, T data);
S VisitAttribute(Attribute attribute, T data);
S VisitAttributeBlock(AttributeBlock attributeBlock, T data);
S VisitImportsStatement(ImportsStatement importsStatement, T data);
S VisitMembersImportsClause(MemberImportsClause membersImportsClause, T data);
S VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, T data);
S VisitOptionStatement(OptionStatement optionStatement, T data);
S VisitTypeDeclaration(TypeDeclaration typeDeclaration, T data);
S VisitXmlNamespaceImportsClause(XmlNamespaceImportsClause xmlNamespaceImportsClause, T data);
S VisitEnumDeclaration(EnumDeclaration enumDeclaration, T data);
S VisitEnumMemberDeclaration(EnumMemberDeclaration enumMemberDeclaration, T data);
S VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, T data);
// Expression scope
S VisitIdentifier(Identifier identifier, T data);

10
ICSharpCode.NRefactory.VB/ICSharpCode.NRefactory.VB.csproj

@ -54,11 +54,18 @@ @@ -54,11 +54,18 @@
<Compile Include="Ast\Expressions\XmlLiteralString.cs" />
<Compile Include="Ast\General\Attribute.cs" />
<Compile Include="Ast\General\AttributeBlock.cs" />
<Compile Include="Ast\General\AttributedNode.cs" />
<Compile Include="Ast\General\CompilationUnit.cs" />
<Compile Include="Ast\General\ParameterDeclaration.cs" />
<Compile Include="Ast\General\TypeParameterDeclaration.cs" />
<Compile Include="Ast\Generated.cs" />
<Compile Include="Ast\GlobalScope\DelegateDeclaration.cs" />
<Compile Include="Ast\GlobalScope\EnumDeclaration.cs" />
<Compile Include="Ast\GlobalScope\EnumMemberDeclaration.cs" />
<Compile Include="Ast\GlobalScope\ImportsClause.cs" />
<Compile Include="Ast\GlobalScope\ImportsStatement.cs" />
<Compile Include="Ast\GlobalScope\ModuleDeclaration.cs" />
<Compile Include="Ast\GlobalScope\NamespaceDeclaration.cs" />
<Compile Include="Ast\GlobalScope\TypeDeclaration.cs" />
<Compile Include="Ast\GlobalScope\OptionStatement.cs" />
<Compile Include="Ast\Identifier.cs" />
<Compile Include="Ast\INullable.cs" />
@ -100,7 +107,6 @@ @@ -100,7 +107,6 @@
<Compile Include="OutputVisitor\TextWriterOutputFormatter.cs" />
<Compile Include="OutputVisitor\VBFormattingOptions.cs" />
<Compile Include="Parser\Errors.cs" />
<Compile Include="Parser\ParamModifierList.cs" />
<Compile Include="Parser\Parser.cs">
<DependentUpon>vb.atg</DependentUpon>
</Compile>

98
ICSharpCode.NRefactory.VB/OutputVisitor/OutputVisitor.cs

@ -6,6 +6,7 @@ using System.Collections.Generic; @@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO;
using ICSharpCode.NRefactory.PatternMatching;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB
{
@ -40,145 +41,180 @@ namespace ICSharpCode.NRefactory.VB @@ -40,145 +41,180 @@ namespace ICSharpCode.NRefactory.VB
this.policy = formattingPolicy;
}
public object VisitCompilationUnit(ICSharpCode.NRefactory.VB.Ast.CompilationUnit compilationUnit, object data)
{
// don't do node tracking as we visit all children directly
foreach (AstNode node in compilationUnit.Children)
node.AcceptVisitor(this, data);
return null;
}
public object VisitBlockStatement(BlockStatement blockStatement, object data)
{
throw new NotImplementedException();
}
public object VisitPatternPlaceholder(AstNode placeholder, Pattern pattern, object data)
{
throw new NotImplementedException();
}
public object VisitVBTokenNode(ICSharpCode.NRefactory.VB.Ast.VBTokenNode vBTokenNode, object data)
public object VisitTypeParameterDeclaration(TypeParameterDeclaration typeParameterDeclaration, object data)
{
throw new NotImplementedException();
}
public object VisitCompilationUnit(ICSharpCode.NRefactory.VB.Ast.CompilationUnit compilationUnit, object data)
public object VisitParameterDeclaration(ParameterDeclaration parameterDeclaration, object data)
{
// don't do node tracking as we visit all children directly
foreach (AstNode node in compilationUnit.Children)
node.AcceptVisitor(this, data);
return null;
throw new NotImplementedException();
}
public object VisitBlockStatement(ICSharpCode.NRefactory.VB.Ast.BlockStatement blockStatement, object data)
public object VisitVBTokenNode(VBTokenNode vBTokenNode, object data)
{
throw new NotImplementedException();
}
public object VisitOptionStatement(ICSharpCode.NRefactory.VB.Ast.OptionStatement optionStatement, object data)
public object VisitAliasImportsClause(AliasImportsClause aliasImportsClause, object data)
{
throw new NotImplementedException();
}
public object VisitImportsStatement(ICSharpCode.NRefactory.VB.Ast.ImportsStatement importsStatement, object data)
public object VisitAttribute(ICSharpCode.NRefactory.VB.Ast.Attribute attribute, object data)
{
throw new NotImplementedException();
}
public object VisitAliasImportsClause(ICSharpCode.NRefactory.VB.Ast.AliasImportsClause aliasImportsClause, object data)
public object VisitAttributeBlock(AttributeBlock attributeBlock, object data)
{
throw new NotImplementedException();
}
public object VisitMembersImportsClause(ICSharpCode.NRefactory.VB.Ast.MemberImportsClause membersImportsClause, object data)
public object VisitImportsStatement(ImportsStatement importsStatement, object data)
{
throw new NotImplementedException();
}
public object VisitXmlNamespaceImportsClause(ICSharpCode.NRefactory.VB.Ast.XmlNamespaceImportsClause xmlNamespaceImportsClause, object data)
public object VisitMembersImportsClause(MemberImportsClause membersImportsClause, object data)
{
throw new NotImplementedException();
}
public object VisitAttribute(ICSharpCode.NRefactory.VB.Ast.Attribute attribute, object data)
public object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data)
{
throw new NotImplementedException();
}
public object VisitAttributeBlock(ICSharpCode.NRefactory.VB.Ast.AttributeBlock attributeBlock, object data)
public object VisitOptionStatement(OptionStatement optionStatement, object data)
{
throw new NotImplementedException();
}
public object VisitIdentifier(ICSharpCode.NRefactory.VB.Ast.Identifier identifier, object data)
public object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
{
throw new NotImplementedException();
}
public object VisitXmlIdentifier(ICSharpCode.NRefactory.VB.Ast.XmlIdentifier xmlIdentifier, object data)
public object VisitXmlNamespaceImportsClause(XmlNamespaceImportsClause xmlNamespaceImportsClause, object data)
{
throw new NotImplementedException();
}
public object VisitSimpleNameExpression(ICSharpCode.NRefactory.VB.Ast.SimpleNameExpression identifierExpression, object data)
public object VisitEnumDeclaration(EnumDeclaration enumDeclaration, object data)
{
throw new NotImplementedException();
}
public object VisitPrimitiveExpression(ICSharpCode.NRefactory.VB.Ast.PrimitiveExpression primitiveExpression, object data)
public object VisitEnumMemberDeclaration(EnumMemberDeclaration enumMemberDeclaration, object data)
{
throw new NotImplementedException();
}
public object VisitPrimitiveType(ICSharpCode.NRefactory.VB.Ast.PrimitiveType primitiveType, object data)
public object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
{
throw new NotImplementedException();
}
public object VisitComposedType(ICSharpCode.NRefactory.VB.Ast.ComposedType composedType, object data)
public object VisitIdentifier(Identifier identifier, object data)
{
throw new NotImplementedException();
}
public object VisitArraySpecifier(ICSharpCode.NRefactory.VB.Ast.ArraySpecifier arraySpecifier, object data)
public object VisitXmlIdentifier(XmlIdentifier xmlIdentifier, object data)
{
throw new NotImplementedException();
}
public object VisitSimpleType(ICSharpCode.NRefactory.VB.Ast.SimpleType simpleType, object data)
public object VisitXmlLiteralString(XmlLiteralString xmlLiteralString, object data)
{
throw new NotImplementedException();
}
public object VisitAnyNode(AnyNode anyNode, object data)
public object VisitSimpleNameExpression(SimpleNameExpression identifierExpression, object data)
{
throw new NotImplementedException();
}
public object VisitBackreference(Backreference backreference, object data)
public object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
{
throw new NotImplementedException();
}
public object VisitChoice(Choice choice, object data)
public object VisitPrimitiveType(PrimitiveType primitiveType, object data)
{
throw new NotImplementedException();
}
public object VisitNamedNode(NamedNode namedNode, object data)
public object VisitQualifiedType(QualifiedType qualifiedType, object data)
{
throw new NotImplementedException();
}
public object VisitRepeat(Repeat repeat, object data)
public object VisitComposedType(ComposedType composedType, object data)
{
throw new NotImplementedException();
}
public object VisitOptionalNode(OptionalNode optionalNode, object data)
public object VisitArraySpecifier(ArraySpecifier arraySpecifier, object data)
{
throw new NotImplementedException();
}
public object VisitIdentifierExpressionBackreference(IdentifierExpressionBackreference identifierExpressionBackreference, object data)
public object VisitSimpleType(SimpleType simpleType, object data)
{
throw new NotImplementedException();
}
public object VisitXmlLiteralString(ICSharpCode.NRefactory.VB.Ast.XmlLiteralString xmlLiteralString, object data)
public object VisitAnyNode(AnyNode anyNode, object data)
{
throw new NotImplementedException();
}
public object VisitBackreference(Backreference backreference, object data)
{
throw new NotImplementedException();
}
public object VisitChoice(Choice choice, object data)
{
throw new NotImplementedException();
}
public object VisitQualifiedType(ICSharpCode.NRefactory.VB.Ast.QualifiedType qualifiedType, object data)
public object VisitNamedNode(NamedNode namedNode, object data)
{
throw new NotImplementedException();
}
public object VisitRepeat(Repeat repeat, object data)
{
throw new NotImplementedException();
}
public object VisitOptionalNode(OptionalNode optionalNode, object data)
{
throw new NotImplementedException();
}
public object VisitIdentifierExpressionBackreference(IdentifierExpressionBackreference identifierExpressionBackreference, object data)
{
throw new NotImplementedException();
}

49
ICSharpCode.NRefactory.VB/Parser/ParamModifierList.cs

@ -1,49 +0,0 @@ @@ -1,49 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Parser
{
internal class ParamModifierList
{
ParameterModifiers cur;
VBParser parser;
public ParameterModifiers Modifier {
get {
return cur;
}
}
public ParamModifierList(VBParser parser)
{
this.parser = parser;
cur = ParameterModifiers.None;
}
public bool isNone { get { return cur == ParameterModifiers.None; } }
public void Add(ParameterModifiers m)
{
if ((cur & m) == 0) {
cur |= m;
} else {
parser.Error("param modifier " + m + " already defined");
}
}
public void Add(ParamModifierList m)
{
Add(m.cur);
}
public void Check()
{
if((cur & ParameterModifiers.In) != 0 &&
(cur & ParameterModifiers.Ref) != 0) {
parser.Error("ByRef and ByVal are not allowed at the same time.");
}
}
}
}
Loading…
Cancel
Save