- [ "(" [ FormalParameterList ] ")" (. delegateDeclr.Parameters = p; .) ]
- |
- "Function" Identifier (. delegateDeclr.Name = t.val; .)
- TypeParameterList
- [ "(" [ FormalParameterList ] ")" (. delegateDeclr.Parameters = p; .) ]
- [ "As" (. TypeReference type; .) TypeName (. delegateDeclr.ReturnType = type; .)]
- )
- (. delegateDeclr.EndLocation = t.EndLocation; .)
- EndOfStmt
- (.
- AddChild(delegateDeclr);
- .)
- .
-
-NamespaceBody =
- { EndOfStmt } /* allow empty lines at begin of body */
- {
- NamespaceMemberDecl
- { EndOfStmt } /* allow empty lines in body */
- }
- "End" "Namespace"
- EndOfStmt
- .
-
-ClassBody
- (. AttributeSection section; .) =
- { EndOfStmt } /* allow empty lines at begin of body */
- {
- (.List attributes = new List();
- ModifierList m = new ModifierList();
- .)
- { AttributeSection (. attributes.Add(section); .) }
- { MemberModifier }
- ClassMemberDecl
- { EndOfStmt } /* allow empty lines in body */
- }
- .
-
-StructureBody
- (. AttributeSection section; .) =
- { EndOfStmt } /* allow empty lines at begin of body */
- {
- (.List attributes = new List();
- ModifierList m = new ModifierList();
- .)
- { AttributeSection (. attributes.Add(section); .) }
- { MemberModifier }
- StructureMemberDecl
- { EndOfStmt } /* allow empty lines in body */
- }
- "End" "Structure" (. newType.EndLocation = t.EndLocation; .)
- EndOfStmt
- .
-
-/* 7.7.1 */
-ModuleBody
- (. AttributeSection section; .) =
- { EndOfStmt } /* allow empty lines at begin of body */
- {
- (.List attributes = new List();
- ModifierList m = new ModifierList();
- .)
- { AttributeSection (. attributes.Add(section); .) }
- { MemberModifier }
- ClassMemberDecl
- { EndOfStmt } /* allow empty lines in body */
- }
- "End" "Module" (. newType.EndLocation = t.EndLocation; .)
- EndOfStmt
- .
-
-EnumBody
- (. FieldDeclaration f; .) =
- { EndOfStmt } /* allow empty lines at begin of body */
- {
- EnumMemberDecl
- (.
- AddChild(f);
- .)
- { EndOfStmt } /* allow empty lines in body */
- }
- "End" "Enum" (. newType.EndLocation = t.EndLocation; .)
- EndOfStmt
- .
-
-InterfaceBody =
- { EndOfStmt } /* allow empty lines at begin of body */
- {
- InterfaceMemberDecl
- { EndOfStmt } /* allow empty lines in body */
- }
- "End" "Interface" (. newType.EndLocation = t.EndLocation; .)
- EndOfStmt
- .
-
-/* The information provided in the spec about */
-/* interface declarations is wrong */
-InterfaceMemberDecl
- (.
- TypeReference type =null;
- List p = new List();
- List templates = new List();
- AttributeSection section, returnTypeAttributeSection = null;
- ModifierList mod = new ModifierList();
- List attributes = new List();
- string name;
- .) =
- { AttributeSection (. attributes.Add(section); .) }
- /* this is different to c#: not only the Shadows modifier is allowed, */
- /* also member modifiers like overloads etc. */
- { MemberModifier }
- (
- "Event"
- (.
- mod.Check(Modifiers.VBInterfaceEvents);
- Location startLocation = t.Location;
- .)
- Identifier (. name = t.val; .)
- [ "(" [ FormalParameterList ] ")" ]
- [ "As" TypeName ]
- EndOfStmt
- (.
- EventDeclaration ed = new EventDeclaration {
- Name = name, TypeReference = type, Modifier = mod.Modifier,
- Parameters = p, Attributes = attributes,
- StartLocation = startLocation, EndLocation = t.EndLocation
- };
- AddChild(ed);
- .)
- |
- "Sub"
- (.
- Location startLocation = t.Location;
- mod.Check(Modifiers.VBInterfaceMethods);
- .)
- Identifier (. name = t.val; .)
- TypeParameterList
- [ "(" [ FormalParameterList ] ")" ]
- EndOfStmt
- (.
- MethodDeclaration md = new MethodDeclaration {
- Name = name,
- Modifier = mod.Modifier,
- Parameters = p,
- Attributes = attributes,
- TypeReference = new TypeReference("System.Void", true),
- StartLocation = startLocation,
- EndLocation = t.EndLocation,
- Templates = templates
- };
- AddChild(md);
- .)
- |
- "Function"
- (.
- mod.Check(Modifiers.VBInterfaceMethods);
- Location startLocation = t.Location;
- .)
- Identifier (. name = t.val; .)
- TypeParameterList
- [ "(" [ FormalParameterList ] ")" ]
- [ "As" { AttributeSection } TypeName ]
- (.
- if(type == null) {
- type = new TypeReference("System.Object", true);
- }
- MethodDeclaration md = new MethodDeclaration {
- Name = name, Modifier = mod.Modifier,
- TypeReference = type, Parameters = p, Attributes = attributes
- };
- if (returnTypeAttributeSection != null) {
- returnTypeAttributeSection.AttributeTarget = "return";
- md.Attributes.Add(returnTypeAttributeSection);
- }
- md.StartLocation = startLocation;
- md.EndLocation = t.EndLocation;
- md.Templates = templates;
- AddChild(md);
- .)
- EndOfStmt
- |
- "Property"
- (.
- Location startLocation = t.Location;
- mod.Check(Modifiers.VBInterfaceProperties);
- .)
- Identifier (. name = t.val; .)
- [ "(" [ FormalParameterList ] ")" ]
- [ "As" TypeName ]
- (.
- if(type == null) {
- type = new TypeReference("System.Object", true);
- }
- .)
- EndOfStmt
- (.
- PropertyDeclaration pd = new PropertyDeclaration(name, type, mod.Modifier, attributes);
- pd.Parameters = p;
- pd.EndLocation = t.EndLocation;
- pd.StartLocation = startLocation;
- AddChild(pd);
- .)
- )
- | /* inner type declarations */
- NonModuleDeclaration
- .
-
-/* 7.4.1 */
-EnumMemberDecl
- (.
- Expression expr = null;List attributes = new List();
- AttributeSection section = null;
- VariableDeclaration varDecl = null;
- .) =
- { AttributeSection (. attributes.Add(section); .) }
- Identifier
- (.
- f = new FieldDeclaration(attributes);
- varDecl = new VariableDeclaration(t.val);
- f.Fields.Add(varDecl);
- f.StartLocation = varDecl.StartLocation = t.Location;
- .)
- [ "=" Expr (. varDecl.Initializer = expr; .) ]
- (. f.EndLocation = varDecl.EndLocation = t.EndLocation; .)
- EndOfStmt
-.
-
-ClassMemberDecl attributes> =
- StructureMemberDecl
- .
-
-ClassBaseType
-(.
- typeRef = null;
-.) =
- "Inherits"
- TypeName
- EndOfStmt
-.
-
-/* 7.6.1 */
-StructureMemberDecl attributes>
- (.
- TypeReference type = null;
- List p = new List();
- Statement stmt = null;
- List variableDeclarators = new List();
- List templates = new List();
- .)
-=
- NonModuleDeclaration
-| /* 9.2.1 */
- "Sub"
- (.
- Location startPos = t.Location;
- .)
- (
- (.
- string name = String.Empty;
- MethodDeclaration methodDeclaration; List handlesClause = null;
- List implementsClause = null;
- .)
- Identifier
- (.
- name = t.val;
- m.Check(Modifiers.VBMethods);
- .)
- TypeParameterList
- [ "(" [ FormalParameterList ] ")" ]
- [
- (
- ImplementsClause
- |
- HandlesClause
- )
- ]
- (. Location endLocation = t.EndLocation; .)
- (
- /* abstract methods without a body */
- IF(IsMustOverride(m))
- EndOfStmt
- (.
- methodDeclaration = new MethodDeclaration {
- Name = name, Modifier = m.Modifier, Parameters = p, Attributes = attributes,
- StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endLocation,
- TypeReference = new TypeReference("System.Void", true),
- Templates = templates,
- HandlesClause = handlesClause,
- InterfaceImplementations = implementsClause
- };
- AddChild(methodDeclaration);
- .)
- |
- EOL
- (.
- methodDeclaration = new MethodDeclaration {
- Name = name, Modifier = m.Modifier, Parameters = p, Attributes = attributes,
- StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endLocation,
- TypeReference = new TypeReference("System.Void", true),
- Templates = templates,
- HandlesClause = handlesClause,
- InterfaceImplementations = implementsClause
- };
- AddChild(methodDeclaration);
- .)
-
- (. if (ParseMethodBodies) { .)
- Block
- "End" "Sub"
- (. } else {
- // don't parse method body
- lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement();
- }
- .)
-
- (. methodDeclaration.Body = (BlockStatement)stmt; .)
- (. methodDeclaration.Body.EndLocation = t.EndLocation; .)
- EndOfStmt
- )
- /* 9.3 */
- | "New" [ "(" [ FormalParameterList ] ")" ]
- (. m.Check(Modifiers.Constructors); .)
- (. Location constructorEndLocation = t.EndLocation; .)
- EOL
-
- (. if (ParseMethodBodies) { .)
- Block
- "End" "Sub"
- (. } else {
- // don't parse method body
- lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement();
- }
- .)
-
- (. Location endLocation = t.EndLocation; .)
- EndOfStmt
- (.
- ConstructorDeclaration cd = new ConstructorDeclaration("New", m.Modifier, p, attributes);
- cd.StartLocation = m.GetDeclarationLocation(startPos);
- cd.EndLocation = constructorEndLocation;
- cd.Body = (BlockStatement)stmt;
- cd.Body.EndLocation = endLocation;
- AddChild(cd);
- .)
- )
-|
- /* 9.2.1 */
- "Function"
- (.
- m.Check(Modifiers.VBMethods);
- string name = String.Empty;
- Location startPos = t.Location;
- MethodDeclaration methodDeclaration;List handlesClause = null;
- List implementsClause = null;
- AttributeSection returnTypeAttributeSection = null;
- .)
- Identifier (. name = t.val; .)
- TypeParameterList
- [ "(" [ FormalParameterList ] ")" ]
- ["As" {
- AttributeSection
- (.
- if (returnTypeAttributeSection != null) {
- returnTypeAttributeSection.AttributeTarget = "return";
- attributes.Add(returnTypeAttributeSection);
- }
- .)
- }
- TypeName ]
- (.
- if(type == null) {
- type = new TypeReference("System.Object", true);
- }
- .)
- [
- (
- ImplementsClause
- |
- HandlesClause
- )
- ]
- (. Location endLocation = t.EndLocation; .)
- (
- /* abstract methods without a body */
- IF(IsMustOverride(m))
- EndOfStmt
- (.
- methodDeclaration = new MethodDeclaration {
- Name = name, Modifier = m.Modifier, TypeReference = type,
- Parameters = p, Attributes = attributes,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = endLocation,
- HandlesClause = handlesClause,
- Templates = templates,
- InterfaceImplementations = implementsClause
- };
-
- AddChild(methodDeclaration);
- .)
- |
- EOL
- (.
- methodDeclaration = new MethodDeclaration {
- Name = name, Modifier = m.Modifier, TypeReference = type,
- Parameters = p, Attributes = attributes,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = endLocation,
- Templates = templates,
- HandlesClause = handlesClause,
- InterfaceImplementations = implementsClause
- };
-
- AddChild(methodDeclaration);
-
- if (ParseMethodBodies) { .)
- Block
- "End" "Function"
- (. } else {
- // don't parse method body
- lexer.SkipCurrentBlock(Tokens.Function); stmt = new BlockStatement();
- }
- methodDeclaration.Body = (BlockStatement)stmt;
- methodDeclaration.Body.StartLocation = methodDeclaration.EndLocation;
- methodDeclaration.Body.EndLocation = t.EndLocation;
- .)
- EndOfStmt
- )
-|
- /* 9.2.2. */
- "Declare"
- (.
- m.Check(Modifiers.VBExternalMethods);
- Location startPos = t.Location;
- CharsetModifier charsetModifer = CharsetModifier.None;
- string library = String.Empty;
- string alias = null;
- string name = String.Empty;
- .)
- [Charset