private void RefreshModListWithPlaystyle() { matchInstanceModList = playerBaseModList; matchInstanceModList.MergeWith(currentPlaystyle.modifiers); matchInstanceModList.Log(); usableStats = new UsableStats(playerStats,matchInstanceModList); }
public Profile() { modifierList = new ModifierList(); collectionsList = new CollectionsList(); columnsList = new ColumnsList(); selectedColumnsList = new SelectedColumnsList(); }
public ModifiedValueBoilerplate(ModifierList <TModifier> list, Func <TModifier, FloatModifier> func) { Value = new ModifiedValue(); List = list; GetModifier = func; List.ListChanged += RecalculateModifier; }
public static string ModifiersToJson(ModifierList modifiers) { JsonSerializerSettings settings = new JsonSerializerSettings(); settings.TypeNameHandling = TypeNameHandling.All; return(JsonConvert.SerializeObject(modifiers, Formatting.Indented, settings)); }
public LatitudinalRegion(double _angle, double _temperatureAtAngle, double _differenceFromPrevious = 30) { this.angle = _angle; this.temperatureAtAngle = _temperatureAtAngle; this.diffenceFromPrevious = _differenceFromPrevious; this.modifiers = new ModifierList(); }
public override async Task RegisterCodeFixesAsync(CodeFixContext context) { Diagnostic diagnostic = context.Diagnostics[0]; if (!Settings.IsEnabled(diagnostic.Id, CodeFixIdentifiers.MarkOperatorAsPublicAndStatic)) { return; } SyntaxNode root = await context.GetSyntaxRootAsync().ConfigureAwait(false); if (!TryFindFirstAncestorOrSelf(root, context.Span, out MemberDeclarationSyntax memberDeclaration)) { return; } ModifierListInfo info = SyntaxInfo.ModifierListInfo(memberDeclaration); var title = "Add "; if (info.ExplicitAccessibility == Accessibility.Public) { title += "modifier 'static'"; } else if (info.IsStatic) { title += "modifier 'public'"; } else { title += "modifiers 'public static'"; } CodeAction codeAction = CodeAction.Create( title, cancellationToken => { SyntaxNode newNode = memberDeclaration; if (info.Modifiers.ContainsAny(SyntaxKind.InternalKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.PrivateKeyword)) { newNode = SyntaxAccessibility.WithoutExplicitAccessibility(newNode); } if (!info.Modifiers.Contains(SyntaxKind.PublicKeyword)) { newNode = ModifierList.Insert(newNode, SyntaxKind.PublicKeyword); } if (!info.IsStatic) { newNode = ModifierList.Insert(newNode, SyntaxKind.StaticKeyword); } return(context.Document.ReplaceNodeAsync(memberDeclaration, newNode, cancellationToken)); }, base.GetEquivalenceKey(diagnostic)); context.RegisterCodeFix(codeAction, diagnostic); }
public static void RemoveModifier <TNode>( CodeFixContext context, Diagnostic diagnostic, IEnumerable <TNode> nodes, SyntaxKind modifierKind, string title = null, string additionalKey = null) where TNode : SyntaxNode { if (nodes is IList <TNode> list) { if (list.Count == 0) { return; } if (list.Count == 1) { RemoveModifier(context, diagnostic, list[0], modifierKind, title, additionalKey); return; } } CodeAction codeAction = CodeAction.Create( title ?? GetRemoveModifierTitle(modifierKind), cancellationToken => { return(context.Solution().ReplaceNodesAsync( nodes, (f, _) => ModifierList.Remove(f, modifierKind), cancellationToken)); }, GetEquivalenceKey(diagnostic, additionalKey)); context.RegisterCodeFix(codeAction, diagnostic); }
public static void RemoveModifiers( CodeFixContext context, Diagnostic diagnostic, SyntaxNode node, string additionalKey = null) { SyntaxToken modifier = SyntaxInfo.ModifierListInfo(node).Modifiers.SingleOrDefault(shouldThrow: false); if (modifier != default) { RemoveModifier(context, diagnostic, node, modifier, additionalKey); } else { CodeAction codeAction = CodeAction.Create( "Remove modifiers", cancellationToken => { SyntaxNode newNode = ModifierList.RemoveAll(node); return(context.Document.ReplaceNodeAsync(node, newNode, cancellationToken)); }, GetEquivalenceKey(diagnostic, additionalKey)); context.RegisterCodeFix(codeAction, diagnostic); } }
public ModifierType[] GetModifiersOn <ModifierType>(IModifiable modifiable) where ModifierType : class, IModifier { ModifierMap modifiers = FindOrCreateModifierDictionary(modifiable); ModifierList modifierList = FindOrCreateModifierList(modifiers, typeof(ModifierType)); return(Convert <ModifierType>(modifierList)); }
public void MergeWith(ModifierList otherList) { foreach (Modifier modifier in otherList.list) { AddValueToModifier(modifier.modifierName, modifier.modifierValue); } }
protected override async Task <ModifierList> AssignUpsertedReferences(ModifierList record) { record.ListIdentifier = await _strings.UpsertAsync(record.ListIdentifier); record.ListIdentifierId = record.ListIdentifier?.AsciiStringReferenceId ?? record.ListIdentifierId; return(record); }
public void ChangeEffectsList(ModifierList modifierList) { //First, check the current number of childs of the effectslist to know if you want to add/delete some ChangeEffectsListSize(modifierList); for (int i = 0; i < modifierList.List.Length; i++) { effectRows[i].SetText(modifierList.List[i].modifierName + " at " + modifierList.List[i].modifierValue); } }
public Player(PlayerSave save) { this.name = save.name; this.stats = save.playerStats; this.shotCoordProbabilities = new ShotCoordProbabilities(save.shotCoordProbabilities); this.modifierList = save.modifierList; playstyleDeck = new PlaystyleDeck(save.playstyleDeckIDs); equippedPlaystyles = new EquippedPlaystyles(save.equippedPlaystylesIDs); }
internal SymbolSpecification GetSymbolSpecification() { return(new SymbolSpecification( ID, ItemName, SymbolKindList.Where(s => s.IsChecked).Select(s => s.CreateSymbolOrTypeOrMethodKind()).ToImmutableArray(), AccessibilityList.Where(a => a.IsChecked).Select(a => a._accessibility).ToImmutableArray(), ModifierList.Where(m => m.IsChecked).Select(m => new ModifierKind(m._modifier)).ToImmutableArray())); }
public Player() { name = "Jean Valjean"; stats = new PlayerStats(); shotCoordProbabilities = new ShotCoordProbabilities(); modifierList = new ModifierList(); playstyleDeck = new PlaystyleDeck(); equippedPlaystyles = new EquippedPlaystyles(); }
internal SymbolSpecification GetSymbolSpecification() { return(new SymbolSpecification( ID, ItemName, SymbolKindList.Where(s => s.IsChecked).Select(s => s.CreateSymbolKindOrTypeKind()).ToList(), AccessibilityList.Where(a => a.IsChecked).Select(a => new SymbolSpecification.AccessibilityKind(a._accessibility)).ToList(), ModifierList.Where(m => m.IsChecked).Select(m => new ModifierKind(m._modifier)).ToList())); }
public PlayerSave(Player player) { name = player.name; playerStats = player.stats; shotCoordProbabilities = player.shotCoordProbabilities.GetRawProbabilities(); modifierList = player.modifierList; playstyleDeckIDs = player.playstyleDeck.ToStringList(); equippedPlaystylesIDs = player.playstyleDeck.ToStringList(); }
internal SymbolSpecification GetSymbolSpecification() { return(new SymbolSpecification( id: ID, symbolSpecName: ItemName, symbolKindList: SymbolKindList.Where(s => s.IsChecked).Select(s => s.CreateSymbolKindOrTypeKind()).ToList(), accessibilityList: AccessibilityList.Where(a => a.IsChecked).Select(a => a._accessibility).ToList(), modifiers: ModifierList.Where(m => m.IsChecked).Select(m => new ModifierKind(m._modifier)).ToList())); }
public Player(string name) { this.name = name; stats = new PlayerStats(); shotCoordProbabilities = new ShotCoordProbabilities(); modifierList = new ModifierList(); playstyleDeck = new PlaystyleDeck(); equippedPlaystyles = new EquippedPlaystyles(); }
public PlayerMatchInstance(string name) { this.name = name; playerStats = new PlayerStats(); equippedPlaystyles = new EquippedPlaystyles(); currentPlaystyle = equippedPlaystyles.GetPlaystyle(0); playerBaseModList = new ModifierList(); playerShotCoordProbabilities = new ShotCoordProbabilities(); RefreshModListWithPlaystyle(); }
private void CalculateShortDEF(PlayerStats playerStats, ModifierList modifierList) { int SPEED = 20 * playerStats.Speed; int REFLEXES = 10 * playerStats.Reflexes; int DEXTERITY = 15 * playerStats.Dexterity; int ENDURANCE = 15 * playerStats.Endurance; //calculate the modifier lists that are needed here longATK = SPEED + REFLEXES + DEXTERITY + ENDURANCE; }
private void CalculateLongATK(PlayerStats playerStats, ModifierList modifierList) { int STRENGTH = 20 * playerStats.Strength; int INTELLIGENCE = 10 * playerStats.Intelligence; int DEXTERITY = 5 * playerStats.Dexterity; int ENDURANCE = 25 * playerStats.Endurance; //calculate the modifier lists that are needed here longATK = STRENGTH + INTELLIGENCE + DEXTERITY + ENDURANCE; }
private static Task <Document> RemoveModifierAsync <TNode>( Document document, TNode node, SyntaxToken modifier, CancellationToken cancellationToken = default) where TNode : SyntaxNode { TNode newNode = ModifierList.Remove(node, modifier); return(document.ReplaceNodeAsync(node, newNode, cancellationToken)); }
private void CalculateShortATK(PlayerStats playerStats, ModifierList modifierList) { int DEXTERITY = 15 * playerStats.Dexterity; int INTELLIGENCE = 25 * playerStats.Intelligence; int SPEED = 15 * playerStats.Speed; int REFLEXES = 5 * playerStats.Reflexes; //calculate the modifier lists that are needed here longATK = DEXTERITY + INTELLIGENCE + SPEED + REFLEXES; }
private void CalculateLongDEF(PlayerStats playerStats, ModifierList modifierList) { int STRENGTH = 15 * playerStats.Strength; int REFLEXES = 10 * playerStats.Reflexes; int INTELLIGENCE = 10 * playerStats.Intelligence; int ENDURANCE = 25 * playerStats.Endurance; //calculate the modifier lists that are needed here longDEF = STRENGTH + REFLEXES + INTELLIGENCE + ENDURANCE; }
private void CalculateSmashATK(PlayerStats playerStats, ModifierList modifierList) { int STRENGTH = 30 * playerStats.Strength; int SPEED = 10 * playerStats.Speed; int DEXTERITY = 10 * playerStats.Dexterity; int ENDURANCE = 10 * playerStats.Endurance; //calculate the modifier lists that are needed here smashATK = STRENGTH + SPEED + DEXTERITY + ENDURANCE; }
private void CalculateSmashDEF(PlayerStats playerStats, ModifierList modifierList) { int REFLEXES = 25 * playerStats.Reflexes; int SPEED = 15 * playerStats.Speed; int DEXTERITY = 10 * playerStats.Dexterity; int INTELLIGENCE = 10 * playerStats.Intelligence; //calculate the modifier lists that are needed here smashDEF = REFLEXES + SPEED + DEXTERITY + INTELLIGENCE; }
public PlayerMatchInstance() { name = PlayerFirstNameGenerator.GetFirstName(); playerStats = new PlayerStats(); equippedPlaystyles = new EquippedPlaystyles(); currentPlaystyle = equippedPlaystyles.GetPlaystyle(0); playerBaseModList = new ModifierList(); playerShotCoordProbabilities = new ShotCoordProbabilities(); RefreshModListWithPlaystyle(); }
ModifierType[] Convert <ModifierType>(ModifierList modifierList) where ModifierType : class, IModifier { ModifierType[] modifiersArray = new ModifierType[modifierList.Count]; for (int i = 0; i < modifierList.Count; i++) { modifiersArray[i] = modifierList[i] as ModifierType; } return(modifiersArray); }
public UsableStats(PlayerStats playerStats, ModifierList modifierList) { CalculateLongATK(playerStats, modifierList); CalculateLongDEF(playerStats, modifierList); CalculateRushATK(playerStats, modifierList); CalculateRushDEF(playerStats, modifierList); CalculateSmashATK(playerStats, modifierList); CalculateSmashDEF(playerStats, modifierList); CalculateShortATK(playerStats, modifierList); CalculateShortDEF(playerStats, modifierList); }
void InterfaceMemberDecl() { #line 634 "VBNET.ATG" TypeReference type =null; List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>(); List<TemplateDefinition> templates = new List<TemplateDefinition>(); AttributeSection section, returnTypeAttributeSection = null; ModifierList mod = new ModifierList(); List<AttributeSection> attributes = new List<AttributeSection>(); string name; if (StartOf(19)) { while (la.kind == 28) { AttributeSection( #line 642 "VBNET.ATG" out section); #line 642 "VBNET.ATG" attributes.Add(section); } while (StartOf(9)) { MemberModifier( #line 645 "VBNET.ATG" mod); } if (la.kind == 106) { lexer.NextToken(); #line 649 "VBNET.ATG" mod.Check(Modifiers.VBInterfaceEvents); Location startLocation = t.Location; Identifier(); #line 652 "VBNET.ATG" name = t.val; if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 653 "VBNET.ATG" p); } Expect(26); } if (la.kind == 50) { lexer.NextToken(); TypeName( #line 654 "VBNET.ATG" out type); } EndOfStmt(); #line 657 "VBNET.ATG" EventDeclaration ed = new EventDeclaration { Name = name, TypeReference = type, Modifier = mod.Modifier, Parameters = p, Attributes = attributes, StartLocation = startLocation, EndLocation = t.EndLocation }; compilationUnit.AddChild(ed); } else if (la.kind == 195) { lexer.NextToken(); #line 667 "VBNET.ATG" Location startLocation = t.Location; mod.Check(Modifiers.VBInterfaceMethods); Identifier(); #line 670 "VBNET.ATG" name = t.val; TypeParameterList( #line 671 "VBNET.ATG" templates); if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 672 "VBNET.ATG" p); } Expect(26); } EndOfStmt(); #line 675 "VBNET.ATG" 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 }; compilationUnit.AddChild(md); } else if (la.kind == 114) { lexer.NextToken(); #line 690 "VBNET.ATG" mod.Check(Modifiers.VBInterfaceMethods); Location startLocation = t.Location; Identifier(); #line 693 "VBNET.ATG" name = t.val; TypeParameterList( #line 694 "VBNET.ATG" templates); if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 695 "VBNET.ATG" p); } Expect(26); } if (la.kind == 50) { lexer.NextToken(); while (la.kind == 28) { AttributeSection( #line 696 "VBNET.ATG" out returnTypeAttributeSection); } TypeName( #line 696 "VBNET.ATG" out type); } #line 698 "VBNET.ATG" 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; compilationUnit.AddChild(md); EndOfStmt(); } else if (la.kind == 171) { lexer.NextToken(); #line 718 "VBNET.ATG" Location startLocation = t.Location; mod.Check(Modifiers.VBInterfaceProperties); Identifier(); #line 721 "VBNET.ATG" name = t.val; if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 722 "VBNET.ATG" p); } Expect(26); } if (la.kind == 50) { lexer.NextToken(); TypeName( #line 723 "VBNET.ATG" out type); } #line 725 "VBNET.ATG" if(type == null) { type = new TypeReference("System.Object", true); } EndOfStmt(); #line 731 "VBNET.ATG" PropertyDeclaration pd = new PropertyDeclaration(name, type, mod.Modifier, attributes); pd.Parameters = p; pd.EndLocation = t.EndLocation; pd.StartLocation = startLocation; compilationUnit.AddChild(pd); } else SynErr(245); } else if (StartOf(20)) { NonModuleDeclaration( #line 739 "VBNET.ATG" mod, attributes); } else SynErr(246); }
void StructureMemberDecl( #line 775 "VBNET.ATG" ModifierList m, List<AttributeSection> attributes) { #line 777 "VBNET.ATG" TypeReference type = null; List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>(); Statement stmt = null; List<VariableDeclaration> variableDeclarators = new List<VariableDeclaration>(); List<TemplateDefinition> templates = new List<TemplateDefinition>(); switch (la.kind) { case 71: case 90: case 102: case 129: case 141: case 194: { NonModuleDeclaration( #line 784 "VBNET.ATG" m, attributes); break; } case 195: { lexer.NextToken(); #line 788 "VBNET.ATG" Location startPos = t.Location; if (StartOf(14)) { #line 792 "VBNET.ATG" string name = String.Empty; MethodDeclaration methodDeclaration; List<string> handlesClause = null; List<InterfaceImplementation> implementsClause = null; Identifier(); #line 798 "VBNET.ATG" name = t.val; m.Check(Modifiers.VBMethods); TypeParameterList( #line 801 "VBNET.ATG" templates); if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 802 "VBNET.ATG" p); } Expect(26); } if (la.kind == 121 || la.kind == 123) { if (la.kind == 123) { ImplementsClause( #line 805 "VBNET.ATG" out implementsClause); } else { HandlesClause( #line 807 "VBNET.ATG" out handlesClause); } } #line 810 "VBNET.ATG" Location endLocation = t.EndLocation; if ( #line 813 "VBNET.ATG" IsMustOverride(m)) { EndOfStmt(); #line 816 "VBNET.ATG" 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 }; compilationUnit.AddChild(methodDeclaration); } else if (la.kind == 1) { lexer.NextToken(); #line 829 "VBNET.ATG" 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 }; compilationUnit.AddChild(methodDeclaration); #line 840 "VBNET.ATG" if (ParseMethodBodies) { Block( #line 841 "VBNET.ATG" out stmt); Expect(100); Expect(195); #line 843 "VBNET.ATG" } else { // don't parse method body lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement(); } #line 849 "VBNET.ATG" methodDeclaration.Body = (BlockStatement)stmt; #line 850 "VBNET.ATG" methodDeclaration.Body.EndLocation = t.EndLocation; EndOfStmt(); } else SynErr(238); } else if (la.kind == 148) { lexer.NextToken(); if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 854 "VBNET.ATG" p); } Expect(26); } #line 855 "VBNET.ATG" m.Check(Modifiers.Constructors); #line 856 "VBNET.ATG" Location constructorEndLocation = t.EndLocation; Expect(1); #line 859 "VBNET.ATG" if (ParseMethodBodies) { Block( #line 860 "VBNET.ATG" out stmt); Expect(100); Expect(195); #line 862 "VBNET.ATG" } else { // don't parse method body lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement(); } #line 868 "VBNET.ATG" Location endLocation = t.EndLocation; EndOfStmt(); #line 871 "VBNET.ATG" 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; compilationUnit.AddChild(cd); } else SynErr(239); break; } case 114: { lexer.NextToken(); #line 883 "VBNET.ATG" m.Check(Modifiers.VBMethods); string name = String.Empty; Location startPos = t.Location; MethodDeclaration methodDeclaration;List<string> handlesClause = null; List<InterfaceImplementation> implementsClause = null; AttributeSection returnTypeAttributeSection = null; Identifier(); #line 890 "VBNET.ATG" name = t.val; TypeParameterList( #line 891 "VBNET.ATG" templates); if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 892 "VBNET.ATG" p); } Expect(26); } if (la.kind == 50) { lexer.NextToken(); while (la.kind == 28) { AttributeSection( #line 893 "VBNET.ATG" out returnTypeAttributeSection); } TypeName( #line 893 "VBNET.ATG" out type); } #line 895 "VBNET.ATG" if(type == null) { type = new TypeReference("System.Object", true); } if (la.kind == 121 || la.kind == 123) { if (la.kind == 123) { ImplementsClause( #line 901 "VBNET.ATG" out implementsClause); } else { HandlesClause( #line 903 "VBNET.ATG" out handlesClause); } } if ( #line 908 "VBNET.ATG" IsMustOverride(m)) { EndOfStmt(); #line 911 "VBNET.ATG" methodDeclaration = new MethodDeclaration { Name = name, Modifier = m.Modifier, TypeReference = type, Parameters = p, Attributes = attributes, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = t.EndLocation, HandlesClause = handlesClause, Templates = templates, InterfaceImplementations = implementsClause }; if (returnTypeAttributeSection != null) { returnTypeAttributeSection.AttributeTarget = "return"; methodDeclaration.Attributes.Add(returnTypeAttributeSection); } compilationUnit.AddChild(methodDeclaration); } else if (la.kind == 1) { lexer.NextToken(); #line 929 "VBNET.ATG" methodDeclaration = new MethodDeclaration { Name = name, Modifier = m.Modifier, TypeReference = type, Parameters = p, Attributes = attributes, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = t.EndLocation, Templates = templates, HandlesClause = handlesClause, InterfaceImplementations = implementsClause }; if (returnTypeAttributeSection != null) { returnTypeAttributeSection.AttributeTarget = "return"; methodDeclaration.Attributes.Add(returnTypeAttributeSection); } compilationUnit.AddChild(methodDeclaration); if (ParseMethodBodies) { Block( #line 946 "VBNET.ATG" out stmt); Expect(100); Expect(114); #line 948 "VBNET.ATG" } 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(); } else SynErr(240); break; } case 88: { lexer.NextToken(); #line 962 "VBNET.ATG" m.Check(Modifiers.VBExternalMethods); Location startPos = t.Location; CharsetModifier charsetModifer = CharsetModifier.None; string library = String.Empty; string alias = null; string name = String.Empty; if (StartOf(15)) { Charset( #line 969 "VBNET.ATG" out charsetModifer); } if (la.kind == 195) { lexer.NextToken(); Identifier(); #line 972 "VBNET.ATG" name = t.val; Expect(135); Expect(3); #line 973 "VBNET.ATG" library = t.literalValue as string; if (la.kind == 46) { lexer.NextToken(); Expect(3); #line 974 "VBNET.ATG" alias = t.literalValue as string; } if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 975 "VBNET.ATG" p); } Expect(26); } EndOfStmt(); #line 978 "VBNET.ATG" DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, null, p, attributes, library, alias, charsetModifer); declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos); declareDeclaration.EndLocation = t.EndLocation; compilationUnit.AddChild(declareDeclaration); } else if (la.kind == 114) { lexer.NextToken(); Identifier(); #line 985 "VBNET.ATG" name = t.val; Expect(135); Expect(3); #line 986 "VBNET.ATG" library = t.literalValue as string; if (la.kind == 46) { lexer.NextToken(); Expect(3); #line 987 "VBNET.ATG" alias = t.literalValue as string; } if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 988 "VBNET.ATG" p); } Expect(26); } if (la.kind == 50) { lexer.NextToken(); TypeName( #line 989 "VBNET.ATG" out type); } EndOfStmt(); #line 992 "VBNET.ATG" DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, type, p, attributes, library, alias, charsetModifer); declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos); declareDeclaration.EndLocation = t.EndLocation; compilationUnit.AddChild(declareDeclaration); } else SynErr(241); break; } case 106: { lexer.NextToken(); #line 1002 "VBNET.ATG" m.Check(Modifiers.VBEvents); Location startPos = t.Location; EventDeclaration eventDeclaration; string name = String.Empty; List<InterfaceImplementation> implementsClause = null; Identifier(); #line 1008 "VBNET.ATG" name= t.val; if (la.kind == 50) { lexer.NextToken(); TypeName( #line 1010 "VBNET.ATG" out type); } else if (StartOf(16)) { if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 1012 "VBNET.ATG" p); } Expect(26); } } else SynErr(242); if (la.kind == 123) { ImplementsClause( #line 1014 "VBNET.ATG" out implementsClause); } #line 1016 "VBNET.ATG" eventDeclaration = new EventDeclaration { Name = name, TypeReference = type, Modifier = m.Modifier, Parameters = p, Attributes = attributes, InterfaceImplementations = implementsClause, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = t.EndLocation }; compilationUnit.AddChild(eventDeclaration); EndOfStmt(); break; } case 2: case 45: case 49: case 51: case 52: case 53: case 54: case 57: case 74: case 91: case 94: case 103: case 108: case 113: case 120: case 126: case 130: case 133: case 156: case 162: case 169: case 188: case 197: case 198: case 208: case 209: case 215: { #line 1026 "VBNET.ATG" Location startPos = t.Location; #line 1028 "VBNET.ATG" m.Check(Modifiers.Fields); FieldDeclaration fd = new FieldDeclaration(attributes, null, m.Modifier); fd.StartLocation = m.GetDeclarationLocation(startPos); IdentifierForFieldDeclaration(); #line 1032 "VBNET.ATG" string name = t.val; VariableDeclaratorPartAfterIdentifier( #line 1033 "VBNET.ATG" variableDeclarators, name); while (la.kind == 12) { lexer.NextToken(); VariableDeclarator( #line 1034 "VBNET.ATG" variableDeclarators); } EndOfStmt(); #line 1037 "VBNET.ATG" fd.EndLocation = t.EndLocation; fd.Fields = variableDeclarators; compilationUnit.AddChild(fd); break; } case 75: { #line 1042 "VBNET.ATG" m.Check(Modifiers.Fields); lexer.NextToken(); #line 1043 "VBNET.ATG" m.Add(Modifiers.Const, t.Location); #line 1045 "VBNET.ATG" FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier); fd.StartLocation = m.GetDeclarationLocation(t.Location); List<VariableDeclaration> constantDeclarators = new List<VariableDeclaration>(); ConstantDeclarator( #line 1049 "VBNET.ATG" constantDeclarators); while (la.kind == 12) { lexer.NextToken(); ConstantDeclarator( #line 1050 "VBNET.ATG" constantDeclarators); } #line 1052 "VBNET.ATG" fd.Fields = constantDeclarators; fd.EndLocation = t.Location; EndOfStmt(); #line 1057 "VBNET.ATG" fd.EndLocation = t.EndLocation; compilationUnit.AddChild(fd); break; } case 171: { lexer.NextToken(); #line 1063 "VBNET.ATG" m.Check(Modifiers.VBProperties); Location startPos = t.Location; List<InterfaceImplementation> implementsClause = null; Identifier(); #line 1067 "VBNET.ATG" string propertyName = t.val; if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 1068 "VBNET.ATG" p); } Expect(26); } if (la.kind == 50) { lexer.NextToken(); TypeName( #line 1069 "VBNET.ATG" out type); } #line 1071 "VBNET.ATG" if(type == null) { type = new TypeReference("System.Object", true); } if (la.kind == 123) { ImplementsClause( #line 1075 "VBNET.ATG" out implementsClause); } EndOfStmt(); if ( #line 1079 "VBNET.ATG" IsMustOverride(m)) { #line 1081 "VBNET.ATG" PropertyDeclaration ParameterDeclarationExpressionl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes); ParameterDeclarationExpressionl.StartLocation = m.GetDeclarationLocation(startPos); ParameterDeclarationExpressionl.EndLocation = t.Location; ParameterDeclarationExpressionl.TypeReference = type; ParameterDeclarationExpressionl.InterfaceImplementations = implementsClause; ParameterDeclarationExpressionl.Parameters = p; compilationUnit.AddChild(ParameterDeclarationExpressionl); } else if (StartOf(17)) { #line 1091 "VBNET.ATG" PropertyDeclaration ParameterDeclarationExpressionl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes); ParameterDeclarationExpressionl.StartLocation = m.GetDeclarationLocation(startPos); ParameterDeclarationExpressionl.EndLocation = t.Location; ParameterDeclarationExpressionl.BodyStart = t.Location; ParameterDeclarationExpressionl.TypeReference = type; ParameterDeclarationExpressionl.InterfaceImplementations = implementsClause; ParameterDeclarationExpressionl.Parameters = p; PropertyGetRegion getRegion; PropertySetRegion setRegion; AccessorDecls( #line 1101 "VBNET.ATG" out getRegion, out setRegion); Expect(100); Expect(171); EndOfStmt(); #line 1105 "VBNET.ATG" ParameterDeclarationExpressionl.GetRegion = getRegion; ParameterDeclarationExpressionl.SetRegion = setRegion; ParameterDeclarationExpressionl.BodyEnd = t.EndLocation; compilationUnit.AddChild(ParameterDeclarationExpressionl); } else SynErr(243); break; } case 85: { lexer.NextToken(); #line 1112 "VBNET.ATG" Location startPos = t.Location; Expect(106); #line 1114 "VBNET.ATG" m.Check(Modifiers.VBCustomEvents); EventAddRemoveRegion eventAccessorDeclaration; EventAddRegion addHandlerAccessorDeclaration = null; EventRemoveRegion removeHandlerAccessorDeclaration = null; EventRaiseRegion raiseEventAccessorDeclaration = null; List<InterfaceImplementation> implementsClause = null; Identifier(); #line 1121 "VBNET.ATG" string customEventName = t.val; Expect(50); TypeName( #line 1122 "VBNET.ATG" out type); if (la.kind == 123) { ImplementsClause( #line 1123 "VBNET.ATG" out implementsClause); } EndOfStmt(); while (StartOf(18)) { EventAccessorDeclaration( #line 1126 "VBNET.ATG" out eventAccessorDeclaration); #line 1128 "VBNET.ATG" if(eventAccessorDeclaration is EventAddRegion) { addHandlerAccessorDeclaration = (EventAddRegion)eventAccessorDeclaration; } else if(eventAccessorDeclaration is EventRemoveRegion) { removeHandlerAccessorDeclaration = (EventRemoveRegion)eventAccessorDeclaration; } else if(eventAccessorDeclaration is EventRaiseRegion) { raiseEventAccessorDeclaration = (EventRaiseRegion)eventAccessorDeclaration; } } Expect(100); Expect(106); EndOfStmt(); #line 1144 "VBNET.ATG" if(addHandlerAccessorDeclaration == null) { Error("Need to provide AddHandler accessor."); } if(removeHandlerAccessorDeclaration == null) { Error("Need to provide RemoveHandler accessor."); } if(raiseEventAccessorDeclaration == null) { Error("Need to provide RaiseEvent accessor."); } EventDeclaration decl = new EventDeclaration { TypeReference = type, Name = customEventName, Modifier = m.Modifier, Attributes = attributes, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = t.EndLocation, AddRegion = addHandlerAccessorDeclaration, RemoveRegion = removeHandlerAccessorDeclaration, RaiseRegion = raiseEventAccessorDeclaration }; compilationUnit.AddChild(decl); break; } case 147: case 158: case 217: { #line 1170 "VBNET.ATG" ConversionType opConversionType = ConversionType.None; if (la.kind == 147 || la.kind == 217) { if (la.kind == 217) { lexer.NextToken(); #line 1171 "VBNET.ATG" opConversionType = ConversionType.Implicit; } else { lexer.NextToken(); #line 1172 "VBNET.ATG" opConversionType = ConversionType.Explicit; } } Expect(158); #line 1175 "VBNET.ATG" m.Check(Modifiers.VBOperators); Location startPos = t.Location; TypeReference returnType = NullTypeReference.Instance; TypeReference operandType = NullTypeReference.Instance; string operandName; OverloadableOperatorType operatorType; AttributeSection section; List<ParameterDeclarationExpression> parameters = new List<ParameterDeclarationExpression>(); List<AttributeSection> returnTypeAttributes = new List<AttributeSection>(); OverloadableOperator( #line 1185 "VBNET.ATG" out operatorType); Expect(25); if (la.kind == 59) { lexer.NextToken(); } Identifier(); #line 1186 "VBNET.ATG" operandName = t.val; if (la.kind == 50) { lexer.NextToken(); TypeName( #line 1187 "VBNET.ATG" out operandType); } #line 1188 "VBNET.ATG" parameters.Add(new ParameterDeclarationExpression(operandType, operandName, ParameterModifiers.In)); while (la.kind == 12) { lexer.NextToken(); if (la.kind == 59) { lexer.NextToken(); } Identifier(); #line 1192 "VBNET.ATG" operandName = t.val; if (la.kind == 50) { lexer.NextToken(); TypeName( #line 1193 "VBNET.ATG" out operandType); } #line 1194 "VBNET.ATG" parameters.Add(new ParameterDeclarationExpression(operandType, operandName, ParameterModifiers.In)); } Expect(26); #line 1197 "VBNET.ATG" Location endPos = t.EndLocation; if (la.kind == 50) { lexer.NextToken(); while (la.kind == 28) { AttributeSection( #line 1198 "VBNET.ATG" out section); #line 1198 "VBNET.ATG" returnTypeAttributes.Add(section); } TypeName( #line 1198 "VBNET.ATG" out returnType); #line 1198 "VBNET.ATG" endPos = t.EndLocation; } Expect(1); Block( #line 1200 "VBNET.ATG" out stmt); Expect(100); Expect(158); EndOfStmt(); #line 1202 "VBNET.ATG" OperatorDeclaration operatorDeclaration = new OperatorDeclaration { Modifier = m.Modifier, Attributes = attributes, Parameters = parameters, TypeReference = returnType, OverloadableOperator = operatorType, ConversionType = opConversionType, ReturnTypeAttributes = returnTypeAttributes, Body = (BlockStatement)stmt, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endPos }; operatorDeclaration.Body.StartLocation = startPos; operatorDeclaration.Body.EndLocation = t.Location; compilationUnit.AddChild(operatorDeclaration); break; } default: SynErr(244); break; } }
void MemberModifier( #line 3374 "VBNET.ATG" ModifierList m) { switch (la.kind) { case 142: { lexer.NextToken(); #line 3375 "VBNET.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 89: { lexer.NextToken(); #line 3376 "VBNET.ATG" m.Add(Modifiers.Default, t.Location); break; } case 112: { lexer.NextToken(); #line 3377 "VBNET.ATG" m.Add(Modifiers.Internal, t.Location); break; } case 184: { lexer.NextToken(); #line 3378 "VBNET.ATG" m.Add(Modifiers.New, t.Location); break; } case 166: { lexer.NextToken(); #line 3379 "VBNET.ATG" m.Add(Modifiers.Override, t.Location); break; } case 143: { lexer.NextToken(); #line 3380 "VBNET.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 170: { lexer.NextToken(); #line 3381 "VBNET.ATG" m.Add(Modifiers.Private, t.Location); break; } case 172: { lexer.NextToken(); #line 3382 "VBNET.ATG" m.Add(Modifiers.Protected, t.Location); break; } case 173: { lexer.NextToken(); #line 3383 "VBNET.ATG" m.Add(Modifiers.Public, t.Location); break; } case 152: { lexer.NextToken(); #line 3384 "VBNET.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 153: { lexer.NextToken(); #line 3385 "VBNET.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 185: { lexer.NextToken(); #line 3386 "VBNET.ATG" m.Add(Modifiers.Static, t.Location); break; } case 165: { lexer.NextToken(); #line 3387 "VBNET.ATG" m.Add(Modifiers.Virtual, t.Location); break; } case 164: { lexer.NextToken(); #line 3388 "VBNET.ATG" m.Add(Modifiers.Overloads, t.Location); break; } case 175: { lexer.NextToken(); #line 3389 "VBNET.ATG" m.Add(Modifiers.ReadOnly, t.Location); break; } case 220: { lexer.NextToken(); #line 3390 "VBNET.ATG" m.Add(Modifiers.WriteOnly, t.Location); break; } case 219: { lexer.NextToken(); #line 3391 "VBNET.ATG" m.Add(Modifiers.WithEvents, t.Location); break; } case 92: { lexer.NextToken(); #line 3392 "VBNET.ATG" m.Add(Modifiers.Dim, t.Location); break; } case 168: { lexer.NextToken(); #line 3393 "VBNET.ATG" m.Add(Modifiers.Partial, t.Location); break; } default: SynErr(237); break; } }
void StructureBody( #line 573 "VBNET.ATG" TypeDeclaration newType) { #line 574 "VBNET.ATG" AttributeSection section; while (la.kind == 1 || la.kind == 11) { EndOfStmt(); } while (StartOf(8)) { #line 577 "VBNET.ATG" List<AttributeSection> attributes = new List<AttributeSection>(); ModifierList m = new ModifierList(); while (la.kind == 28) { AttributeSection( #line 580 "VBNET.ATG" out section); #line 580 "VBNET.ATG" attributes.Add(section); } while (StartOf(9)) { MemberModifier( #line 581 "VBNET.ATG" m); } StructureMemberDecl( #line 582 "VBNET.ATG" m, attributes); while (la.kind == 1 || la.kind == 11) { EndOfStmt(); } } Expect(100); Expect(194); #line 585 "VBNET.ATG" newType.EndLocation = t.EndLocation; EndOfStmt(); }
void ModuleBody( #line 590 "VBNET.ATG" TypeDeclaration newType) { #line 591 "VBNET.ATG" AttributeSection section; while (la.kind == 1 || la.kind == 11) { EndOfStmt(); } while (StartOf(8)) { #line 594 "VBNET.ATG" List<AttributeSection> attributes = new List<AttributeSection>(); ModifierList m = new ModifierList(); while (la.kind == 28) { AttributeSection( #line 597 "VBNET.ATG" out section); #line 597 "VBNET.ATG" attributes.Add(section); } while (StartOf(9)) { MemberModifier( #line 598 "VBNET.ATG" m); } ClassMemberDecl( #line 599 "VBNET.ATG" m, attributes); while (la.kind == 1 || la.kind == 11) { EndOfStmt(); } } Expect(100); Expect(141); #line 602 "VBNET.ATG" newType.EndLocation = t.EndLocation; EndOfStmt(); }
void NonModuleDeclaration( //#line 455 "VBNET.ATG" ModifierList m, List<AttributeSection> attributes) { //#line 457 "VBNET.ATG" TypeReference typeRef = null; List<TypeReference> baseInterfaces = null; switch (la.kind) { case 84: { //#line 460 "VBNET.ATG" m.Check(Modifiers.Classes); lexer.NextToken(); //#line 463 "VBNET.ATG" TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); newType.StartLocation = t.Location; AddChild(newType); BlockStart(newType); newType.Type = ClassType.Class; Identifier(); //#line 470 "VBNET.ATG" newType.Name = t.val; TypeParameterList( //#line 471 "VBNET.ATG" newType.Templates); EndOfStmt(); //#line 473 "VBNET.ATG" newType.BodyStartLocation = t.Location; if (la.kind == 140) { ClassBaseType( //#line 474 "VBNET.ATG" out typeRef); //#line 474 "VBNET.ATG" SafeAdd(newType, newType.BaseTypes, typeRef); } while (la.kind == 136) { TypeImplementsClause( //#line 475 "VBNET.ATG" out baseInterfaces); //#line 475 "VBNET.ATG" newType.BaseTypes.AddRange(baseInterfaces); } ClassBody( //#line 476 "VBNET.ATG" newType); Expect(113); Expect(84); //#line 477 "VBNET.ATG" newType.EndLocation = t.EndLocation; EndOfStmt(); //#line 480 "VBNET.ATG" BlockEnd(); break; } case 155: { lexer.NextToken(); //#line 484 "VBNET.ATG" m.Check(Modifiers.VBModules); TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); AddChild(newType); BlockStart(newType); newType.StartLocation = m.GetDeclarationLocation(t.Location); newType.Type = ClassType.Module; Identifier(); //#line 491 "VBNET.ATG" newType.Name = t.val; EndOfStmt(); //#line 493 "VBNET.ATG" newType.BodyStartLocation = t.Location; ModuleBody( //#line 494 "VBNET.ATG" newType); //#line 496 "VBNET.ATG" BlockEnd(); break; } case 209: { lexer.NextToken(); //#line 500 "VBNET.ATG" m.Check(Modifiers.VBStructures); TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); AddChild(newType); BlockStart(newType); newType.StartLocation = m.GetDeclarationLocation(t.Location); newType.Type = ClassType.Struct; Identifier(); //#line 507 "VBNET.ATG" newType.Name = t.val; TypeParameterList( //#line 508 "VBNET.ATG" newType.Templates); EndOfStmt(); //#line 510 "VBNET.ATG" newType.BodyStartLocation = t.Location; while (la.kind == 136) { TypeImplementsClause( //#line 511 "VBNET.ATG" out baseInterfaces); //#line 511 "VBNET.ATG" newType.BaseTypes.AddRange(baseInterfaces); } StructureBody( //#line 512 "VBNET.ATG" newType); //#line 514 "VBNET.ATG" BlockEnd(); break; } case 115: { lexer.NextToken(); //#line 519 "VBNET.ATG" m.Check(Modifiers.VBEnums); TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); newType.StartLocation = m.GetDeclarationLocation(t.Location); AddChild(newType); BlockStart(newType); newType.Type = ClassType.Enum; Identifier(); //#line 527 "VBNET.ATG" newType.Name = t.val; if (la.kind == 63) { lexer.NextToken(); NonArrayTypeName( //#line 528 "VBNET.ATG" out typeRef, false); //#line 528 "VBNET.ATG" SafeAdd(newType, newType.BaseTypes, typeRef); } EndOfStmt(); //#line 530 "VBNET.ATG" newType.BodyStartLocation = t.Location; EnumBody( //#line 531 "VBNET.ATG" newType); //#line 533 "VBNET.ATG" BlockEnd(); break; } case 142: { lexer.NextToken(); //#line 538 "VBNET.ATG" m.Check(Modifiers.VBInterfacs); TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); newType.StartLocation = m.GetDeclarationLocation(t.Location); AddChild(newType); BlockStart(newType); newType.Type = ClassType.Interface; Identifier(); //#line 545 "VBNET.ATG" newType.Name = t.val; TypeParameterList( //#line 546 "VBNET.ATG" newType.Templates); EndOfStmt(); //#line 548 "VBNET.ATG" newType.BodyStartLocation = t.Location; while (la.kind == 140) { InterfaceBase( //#line 549 "VBNET.ATG" out baseInterfaces); //#line 549 "VBNET.ATG" newType.BaseTypes.AddRange(baseInterfaces); } InterfaceBody( //#line 550 "VBNET.ATG" newType); //#line 552 "VBNET.ATG" BlockEnd(); break; } case 103: { lexer.NextToken(); //#line 557 "VBNET.ATG" m.Check(Modifiers.VBDelegates); DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes); delegateDeclr.ReturnType = new TypeReference("System.Void", true); delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location); List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>(); if (la.kind == 210) { lexer.NextToken(); Identifier(); //#line 564 "VBNET.ATG" delegateDeclr.Name = t.val; TypeParameterList( //#line 565 "VBNET.ATG" delegateDeclr.Templates); if (la.kind == 37) { lexer.NextToken(); if (StartOf(6)) { FormalParameterList( //#line 566 "VBNET.ATG" p); } Expect(38); //#line 566 "VBNET.ATG" delegateDeclr.Parameters = p; } } else if (la.kind == 127) { lexer.NextToken(); Identifier(); //#line 568 "VBNET.ATG" delegateDeclr.Name = t.val; TypeParameterList( //#line 569 "VBNET.ATG" delegateDeclr.Templates); if (la.kind == 37) { lexer.NextToken(); if (StartOf(6)) { FormalParameterList( //#line 570 "VBNET.ATG" p); } Expect(38); //#line 570 "VBNET.ATG" delegateDeclr.Parameters = p; } if (la.kind == 63) { lexer.NextToken(); //#line 571 "VBNET.ATG" TypeReference type; TypeName( //#line 571 "VBNET.ATG" out type); //#line 571 "VBNET.ATG" delegateDeclr.ReturnType = type; } } else SynErr(250); //#line 573 "VBNET.ATG" delegateDeclr.EndLocation = t.EndLocation; EndOfStmt(); //#line 576 "VBNET.ATG" AddChild(delegateDeclr); break; } default: SynErr(251); break; } }
void NonModuleDeclaration( #line 424 "VBNET.ATG" ModifierList m, List<AttributeSection> attributes) { #line 426 "VBNET.ATG" TypeReference typeRef = null; List<TypeReference> baseInterfaces = null; switch (la.kind) { case 71: { #line 429 "VBNET.ATG" m.Check(Modifiers.Classes); lexer.NextToken(); #line 432 "VBNET.ATG" TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); newType.StartLocation = t.Location; compilationUnit.AddChild(newType); compilationUnit.BlockStart(newType); newType.Type = ClassType.Class; Identifier(); #line 439 "VBNET.ATG" newType.Name = t.val; TypeParameterList( #line 440 "VBNET.ATG" newType.Templates); EndOfStmt(); #line 442 "VBNET.ATG" newType.BodyStartLocation = t.Location; if (la.kind == 127) { ClassBaseType( #line 443 "VBNET.ATG" out typeRef); #line 443 "VBNET.ATG" SafeAdd(newType, newType.BaseTypes, typeRef); } while (la.kind == 123) { TypeImplementsClause( #line 444 "VBNET.ATG" out baseInterfaces); #line 444 "VBNET.ATG" newType.BaseTypes.AddRange(baseInterfaces); } ClassBody( #line 445 "VBNET.ATG" newType); Expect(100); Expect(71); #line 446 "VBNET.ATG" newType.EndLocation = t.EndLocation; EndOfStmt(); #line 449 "VBNET.ATG" compilationUnit.BlockEnd(); break; } case 141: { lexer.NextToken(); #line 453 "VBNET.ATG" m.Check(Modifiers.VBModules); TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); compilationUnit.AddChild(newType); compilationUnit.BlockStart(newType); newType.StartLocation = m.GetDeclarationLocation(t.Location); newType.Type = ClassType.Module; Identifier(); #line 460 "VBNET.ATG" newType.Name = t.val; EndOfStmt(); #line 462 "VBNET.ATG" newType.BodyStartLocation = t.Location; ModuleBody( #line 463 "VBNET.ATG" newType); #line 465 "VBNET.ATG" compilationUnit.BlockEnd(); break; } case 194: { lexer.NextToken(); #line 469 "VBNET.ATG" m.Check(Modifiers.VBStructures); TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); compilationUnit.AddChild(newType); compilationUnit.BlockStart(newType); newType.StartLocation = m.GetDeclarationLocation(t.Location); newType.Type = ClassType.Struct; Identifier(); #line 476 "VBNET.ATG" newType.Name = t.val; TypeParameterList( #line 477 "VBNET.ATG" newType.Templates); EndOfStmt(); #line 479 "VBNET.ATG" newType.BodyStartLocation = t.Location; while (la.kind == 123) { TypeImplementsClause( #line 480 "VBNET.ATG" out baseInterfaces); #line 480 "VBNET.ATG" newType.BaseTypes.AddRange(baseInterfaces); } StructureBody( #line 481 "VBNET.ATG" newType); #line 483 "VBNET.ATG" compilationUnit.BlockEnd(); break; } case 102: { lexer.NextToken(); #line 488 "VBNET.ATG" m.Check(Modifiers.VBEnums); TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); newType.StartLocation = m.GetDeclarationLocation(t.Location); compilationUnit.AddChild(newType); compilationUnit.BlockStart(newType); newType.Type = ClassType.Enum; Identifier(); #line 496 "VBNET.ATG" newType.Name = t.val; if (la.kind == 50) { lexer.NextToken(); NonArrayTypeName( #line 497 "VBNET.ATG" out typeRef, false); #line 497 "VBNET.ATG" SafeAdd(newType, newType.BaseTypes, typeRef); } EndOfStmt(); #line 499 "VBNET.ATG" newType.BodyStartLocation = t.Location; EnumBody( #line 500 "VBNET.ATG" newType); #line 502 "VBNET.ATG" compilationUnit.BlockEnd(); break; } case 129: { lexer.NextToken(); #line 507 "VBNET.ATG" m.Check(Modifiers.VBInterfacs); TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); newType.StartLocation = m.GetDeclarationLocation(t.Location); compilationUnit.AddChild(newType); compilationUnit.BlockStart(newType); newType.Type = ClassType.Interface; Identifier(); #line 514 "VBNET.ATG" newType.Name = t.val; TypeParameterList( #line 515 "VBNET.ATG" newType.Templates); EndOfStmt(); #line 517 "VBNET.ATG" newType.BodyStartLocation = t.Location; while (la.kind == 127) { InterfaceBase( #line 518 "VBNET.ATG" out baseInterfaces); #line 518 "VBNET.ATG" newType.BaseTypes.AddRange(baseInterfaces); } InterfaceBody( #line 519 "VBNET.ATG" newType); #line 521 "VBNET.ATG" compilationUnit.BlockEnd(); break; } case 90: { lexer.NextToken(); #line 526 "VBNET.ATG" m.Check(Modifiers.VBDelegates); DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes); delegateDeclr.ReturnType = new TypeReference("System.Void", true); delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location); List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>(); if (la.kind == 195) { lexer.NextToken(); Identifier(); #line 533 "VBNET.ATG" delegateDeclr.Name = t.val; TypeParameterList( #line 534 "VBNET.ATG" delegateDeclr.Templates); if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 535 "VBNET.ATG" p); } Expect(26); #line 535 "VBNET.ATG" delegateDeclr.Parameters = p; } } else if (la.kind == 114) { lexer.NextToken(); Identifier(); #line 537 "VBNET.ATG" delegateDeclr.Name = t.val; TypeParameterList( #line 538 "VBNET.ATG" delegateDeclr.Templates); if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 539 "VBNET.ATG" p); } Expect(26); #line 539 "VBNET.ATG" delegateDeclr.Parameters = p; } if (la.kind == 50) { lexer.NextToken(); #line 540 "VBNET.ATG" TypeReference type; TypeName( #line 540 "VBNET.ATG" out type); #line 540 "VBNET.ATG" delegateDeclr.ReturnType = type; } } else SynErr(231); #line 542 "VBNET.ATG" delegateDeclr.EndLocation = t.EndLocation; EndOfStmt(); #line 545 "VBNET.ATG" compilationUnit.AddChild(delegateDeclr); break; } default: SynErr(232); break; } }
void NonModuleDeclaration( #line 405 "VBNET.ATG" ModifierList m, List<AttributeSection> attributes) { #line 407 "VBNET.ATG" TypeReference typeRef = null; List<TypeReference> baseInterfaces = null; switch (la.kind) { case 67: { #line 410 "VBNET.ATG" m.Check(Modifiers.Classes); lexer.NextToken(); #line 413 "VBNET.ATG" TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); newType.StartLocation = t.Location; compilationUnit.AddChild(newType); compilationUnit.BlockStart(newType); newType.Type = ClassType.Class; Identifier(); #line 420 "VBNET.ATG" newType.Name = t.val; TypeParameterList( #line 421 "VBNET.ATG" newType.Templates); EndOfStmt(); #line 423 "VBNET.ATG" newType.BodyStartLocation = t.Location; if (la.kind == 110) { ClassBaseType( #line 424 "VBNET.ATG" out typeRef); #line 424 "VBNET.ATG" newType.BaseTypes.Add(typeRef); } while (la.kind == 107) { TypeImplementsClause( #line 425 "VBNET.ATG" out baseInterfaces); #line 425 "VBNET.ATG" newType.BaseTypes.AddRange(baseInterfaces); } ClassBody( #line 426 "VBNET.ATG" newType); Expect(88); Expect(67); #line 427 "VBNET.ATG" newType.EndLocation = t.EndLocation; Expect(1); #line 430 "VBNET.ATG" compilationUnit.BlockEnd(); break; } case 121: { lexer.NextToken(); #line 434 "VBNET.ATG" m.Check(Modifiers.VBModules); TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); compilationUnit.AddChild(newType); compilationUnit.BlockStart(newType); newType.StartLocation = m.GetDeclarationLocation(t.Location); newType.Type = ClassType.Module; Identifier(); #line 441 "VBNET.ATG" newType.Name = t.val; Expect(1); #line 443 "VBNET.ATG" newType.BodyStartLocation = t.Location; ModuleBody( #line 444 "VBNET.ATG" newType); #line 446 "VBNET.ATG" compilationUnit.BlockEnd(); break; } case 166: { lexer.NextToken(); #line 450 "VBNET.ATG" m.Check(Modifiers.VBStructures); TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); compilationUnit.AddChild(newType); compilationUnit.BlockStart(newType); newType.StartLocation = m.GetDeclarationLocation(t.Location); newType.Type = ClassType.Struct; Identifier(); #line 457 "VBNET.ATG" newType.Name = t.val; TypeParameterList( #line 458 "VBNET.ATG" newType.Templates); Expect(1); #line 460 "VBNET.ATG" newType.BodyStartLocation = t.Location; while (la.kind == 107) { TypeImplementsClause( #line 461 "VBNET.ATG" out baseInterfaces); #line 461 "VBNET.ATG" newType.BaseTypes.AddRange(baseInterfaces); } StructureBody( #line 462 "VBNET.ATG" newType); #line 464 "VBNET.ATG" compilationUnit.BlockEnd(); break; } case 90: { lexer.NextToken(); #line 469 "VBNET.ATG" m.Check(Modifiers.VBEnums); TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); newType.StartLocation = m.GetDeclarationLocation(t.Location); compilationUnit.AddChild(newType); compilationUnit.BlockStart(newType); newType.Type = ClassType.Enum; Identifier(); #line 477 "VBNET.ATG" newType.Name = t.val; if (la.kind == 48) { lexer.NextToken(); NonArrayTypeName( #line 478 "VBNET.ATG" out typeRef, false); #line 478 "VBNET.ATG" newType.BaseTypes.Add(typeRef); } Expect(1); #line 480 "VBNET.ATG" newType.BodyStartLocation = t.Location; EnumBody( #line 481 "VBNET.ATG" newType); #line 483 "VBNET.ATG" compilationUnit.BlockEnd(); break; } case 112: { lexer.NextToken(); #line 488 "VBNET.ATG" m.Check(Modifiers.VBInterfacs); TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); newType.StartLocation = m.GetDeclarationLocation(t.Location); compilationUnit.AddChild(newType); compilationUnit.BlockStart(newType); newType.Type = ClassType.Interface; Identifier(); #line 495 "VBNET.ATG" newType.Name = t.val; TypeParameterList( #line 496 "VBNET.ATG" newType.Templates); EndOfStmt(); #line 498 "VBNET.ATG" newType.BodyStartLocation = t.Location; while (la.kind == 110) { InterfaceBase( #line 499 "VBNET.ATG" out baseInterfaces); #line 499 "VBNET.ATG" newType.BaseTypes.AddRange(baseInterfaces); } InterfaceBody( #line 500 "VBNET.ATG" newType); #line 502 "VBNET.ATG" compilationUnit.BlockEnd(); break; } case 80: { lexer.NextToken(); #line 507 "VBNET.ATG" m.Check(Modifiers.VBDelegates); DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes); delegateDeclr.ReturnType = new TypeReference("", "System.Void"); delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location); List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>(); if (la.kind == 167) { lexer.NextToken(); Identifier(); #line 514 "VBNET.ATG" delegateDeclr.Name = t.val; TypeParameterList( #line 515 "VBNET.ATG" delegateDeclr.Templates); if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 516 "VBNET.ATG" p); } Expect(25); #line 516 "VBNET.ATG" delegateDeclr.Parameters = p; } } else if (la.kind == 100) { lexer.NextToken(); Identifier(); #line 518 "VBNET.ATG" delegateDeclr.Name = t.val; TypeParameterList( #line 519 "VBNET.ATG" delegateDeclr.Templates); if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 520 "VBNET.ATG" p); } Expect(25); #line 520 "VBNET.ATG" delegateDeclr.Parameters = p; } if (la.kind == 48) { lexer.NextToken(); #line 521 "VBNET.ATG" TypeReference type; TypeName( #line 521 "VBNET.ATG" out type); #line 521 "VBNET.ATG" delegateDeclr.ReturnType = type; } } else SynErr(215); #line 523 "VBNET.ATG" delegateDeclr.EndLocation = t.EndLocation; Expect(1); #line 526 "VBNET.ATG" compilationUnit.AddChild(delegateDeclr); break; } default: SynErr(216); break; } }
void ClassBody( #line 559 "VBNET.ATG" TypeDeclaration newType) { #line 560 "VBNET.ATG" AttributeSection section; while (la.kind == 1 || la.kind == 11) { EndOfStmt(); } while (StartOf(8)) { #line 563 "VBNET.ATG" List<AttributeSection> attributes = new List<AttributeSection>(); ModifierList m = new ModifierList(); while (la.kind == 28) { AttributeSection( #line 566 "VBNET.ATG" out section); #line 566 "VBNET.ATG" attributes.Add(section); } while (StartOf(9)) { MemberModifier( #line 567 "VBNET.ATG" m); } ClassMemberDecl( #line 568 "VBNET.ATG" m, attributes); while (la.kind == 1 || la.kind == 11) { EndOfStmt(); } } }
void TypeModifier( #line 2874 "VBNET.ATG" ModifierList m) { switch (la.kind) { case 148: { lexer.NextToken(); #line 2875 "VBNET.ATG" m.Add(Modifiers.Public, t.Location); break; } case 147: { lexer.NextToken(); #line 2876 "VBNET.ATG" m.Add(Modifiers.Protected, t.Location); break; } case 99: { lexer.NextToken(); #line 2877 "VBNET.ATG" m.Add(Modifiers.Internal, t.Location); break; } case 145: { lexer.NextToken(); #line 2878 "VBNET.ATG" m.Add(Modifiers.Private, t.Location); break; } case 158: { lexer.NextToken(); #line 2879 "VBNET.ATG" m.Add(Modifiers.Static, t.Location); break; } case 157: { lexer.NextToken(); #line 2880 "VBNET.ATG" m.Add(Modifiers.New, t.Location); break; } case 122: { lexer.NextToken(); #line 2881 "VBNET.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 131: { lexer.NextToken(); #line 2882 "VBNET.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 204: { lexer.NextToken(); #line 2883 "VBNET.ATG" m.Add(Modifiers.Partial, t.Location); break; } default: SynErr(214); break; } }
void InterfaceMemberDecl() { #line 596 "VBNET.ATG" TypeReference type =null; List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>(); List<TemplateDefinition> templates = new List<TemplateDefinition>(); AttributeSection section, returnTypeAttributeSection = null; ModifierList mod = new ModifierList(); List<AttributeSection> attributes = new List<AttributeSection>(); string name; if (StartOf(18)) { while (la.kind == 27) { AttributeSection( #line 604 "VBNET.ATG" out section); #line 604 "VBNET.ATG" attributes.Add(section); } while (StartOf(8)) { MemberModifier( #line 607 "VBNET.ATG" mod); } if (la.kind == 93) { lexer.NextToken(); #line 611 "VBNET.ATG" mod.Check(Modifiers.VBInterfaceEvents); Location startLocation = t.Location; Identifier(); #line 614 "VBNET.ATG" name = t.val; if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 615 "VBNET.ATG" p); } Expect(25); } if (la.kind == 48) { lexer.NextToken(); TypeName( #line 616 "VBNET.ATG" out type); } Expect(1); #line 619 "VBNET.ATG" EventDeclaration ed = new EventDeclaration { Name = name, TypeReference = type, Modifier = mod.Modifier, Parameters = p, Attributes = attributes, StartLocation = startLocation, EndLocation = t.EndLocation }; compilationUnit.AddChild(ed); } else if (la.kind == 167) { lexer.NextToken(); #line 629 "VBNET.ATG" Location startLocation = t.Location; mod.Check(Modifiers.VBInterfaceMethods); Identifier(); #line 632 "VBNET.ATG" name = t.val; TypeParameterList( #line 633 "VBNET.ATG" templates); if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 634 "VBNET.ATG" p); } Expect(25); } Expect(1); #line 637 "VBNET.ATG" MethodDeclaration md = new MethodDeclaration { Name = name, Modifier = mod.Modifier, Parameters = p, Attributes = attributes, TypeReference = new TypeReference("", "System.Void"), StartLocation = startLocation, EndLocation = t.EndLocation, Templates = templates }; compilationUnit.AddChild(md); } else if (la.kind == 100) { lexer.NextToken(); #line 652 "VBNET.ATG" mod.Check(Modifiers.VBInterfaceMethods); Location startLocation = t.Location; Identifier(); #line 655 "VBNET.ATG" name = t.val; TypeParameterList( #line 656 "VBNET.ATG" templates); if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 657 "VBNET.ATG" p); } Expect(25); } if (la.kind == 48) { lexer.NextToken(); while (la.kind == 27) { AttributeSection( #line 658 "VBNET.ATG" out returnTypeAttributeSection); } TypeName( #line 658 "VBNET.ATG" out type); } #line 660 "VBNET.ATG" if(type == null) { type = new TypeReference("System.Object"); } 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; compilationUnit.AddChild(md); Expect(1); } else if (la.kind == 146) { lexer.NextToken(); #line 680 "VBNET.ATG" Location startLocation = t.Location; mod.Check(Modifiers.VBInterfaceProperties); Identifier(); #line 683 "VBNET.ATG" name = t.val; if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 684 "VBNET.ATG" p); } Expect(25); } if (la.kind == 48) { lexer.NextToken(); TypeName( #line 685 "VBNET.ATG" out type); } #line 687 "VBNET.ATG" if(type == null) { type = new TypeReference("System.Object"); } Expect(1); #line 693 "VBNET.ATG" PropertyDeclaration pd = new PropertyDeclaration(name, type, mod.Modifier, attributes); pd.Parameters = p; pd.EndLocation = t.EndLocation; pd.StartLocation = startLocation; compilationUnit.AddChild(pd); } else SynErr(229); } else if (StartOf(19)) { NonModuleDeclaration( #line 701 "VBNET.ATG" mod, attributes); } else SynErr(230); }
void ModuleBody( //#line 621 "VBNET.ATG" TypeDeclaration newType) { //#line 622 "VBNET.ATG" AttributeSection section; while (la.kind == 1 || la.kind == 21) { EndOfStmt(); } while (StartOf(9)) { //#line 625 "VBNET.ATG" List<AttributeSection> attributes = new List<AttributeSection>(); ModifierList m = new ModifierList(); while (la.kind == 40) { AttributeSection( //#line 628 "VBNET.ATG" out section); //#line 628 "VBNET.ATG" attributes.Add(section); } while (StartOf(10)) { MemberModifier( //#line 629 "VBNET.ATG" m); } ClassMemberDecl( //#line 630 "VBNET.ATG" m, attributes); while (la.kind == 1 || la.kind == 21) { EndOfStmt(); } } Expect(113); Expect(155); //#line 633 "VBNET.ATG" newType.EndLocation = t.EndLocation; EndOfStmt(); }
void NamespaceMemberDecl() { #line 341 "VBNET.ATG" ModifierList m = new ModifierList(); AttributeSection section; List<AttributeSection> attributes = new List<AttributeSection>(); string qualident; if (la.kind == 146) { lexer.NextToken(); #line 348 "VBNET.ATG" Location startPos = t.Location; Qualident( #line 350 "VBNET.ATG" out qualident); #line 352 "VBNET.ATG" INode node = new NamespaceDeclaration(qualident); node.StartLocation = startPos; compilationUnit.AddChild(node); compilationUnit.BlockStart(node); EndOfStmt(); NamespaceBody(); #line 360 "VBNET.ATG" node.EndLocation = t.Location; compilationUnit.BlockEnd(); } else if (StartOf(2)) { while (la.kind == 28) { AttributeSection( #line 364 "VBNET.ATG" out section); #line 364 "VBNET.ATG" attributes.Add(section); } while (StartOf(3)) { TypeModifier( #line 365 "VBNET.ATG" m); } NonModuleDeclaration( #line 365 "VBNET.ATG" m, attributes); } else SynErr(228); }
public void addAnnotation(Char[] pAnnotationIdentifier) { StringBuilder sbModifierList = new StringBuilder('@').Append(pAnnotationIdentifier); ModifierList oldModifierList = getModifiers(); if (oldModifierList != null) { sbModifierList.Append(' ') .Append(oldModifierList.getMarshaller().ToString()); } List<String> errorMessages = new List<String>(); try { AST2ModifierList modifierList = getUnmarshaller().unmarshalAST2ModifierList( sbModifierList.ToString(), errorMessages); if (modifierList != null) { // TODO After implementation of adding JSOMs to JSOMs: // Check if error messages have been emitted by the parser. ITree modifierListTree = modifierList.getTreeNode(); mModifierList = modifierList; getTreeNode().SetChild(0, modifierListTree); } } catch (JSourceUnmarshallerException jsue) { // TODO After implementation of adding JSOMs to JSOMs: // Replace message by an internationalized message. throw new JSourceObjectizerException( "Parsing the modifier list '" + pAnnotationIdentifier + "' failed.", jsue); } // Update the token stream. // TODO After implementation of adding JSOMs to JSOMs: // Move this stuff to 'AST2JSOM'. TokenRewriteStream stream = getTokenRewriteStream(); sbModifierList.Remove(0, sbModifierList.Length); sbModifierList.Append('@').Append(pAnnotationIdentifier) .Append(' '); stream.InsertBefore( getTreeNode().TokenStartIndex, sbModifierList.ToString()); }
void TypeModifier( #line 3362 "VBNET.ATG" ModifierList m) { switch (la.kind) { case 173: { lexer.NextToken(); #line 3363 "VBNET.ATG" m.Add(Modifiers.Public, t.Location); break; } case 172: { lexer.NextToken(); #line 3364 "VBNET.ATG" m.Add(Modifiers.Protected, t.Location); break; } case 112: { lexer.NextToken(); #line 3365 "VBNET.ATG" m.Add(Modifiers.Internal, t.Location); break; } case 170: { lexer.NextToken(); #line 3366 "VBNET.ATG" m.Add(Modifiers.Private, t.Location); break; } case 185: { lexer.NextToken(); #line 3367 "VBNET.ATG" m.Add(Modifiers.Static, t.Location); break; } case 184: { lexer.NextToken(); #line 3368 "VBNET.ATG" m.Add(Modifiers.New, t.Location); break; } case 142: { lexer.NextToken(); #line 3369 "VBNET.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 152: { lexer.NextToken(); #line 3370 "VBNET.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 168: { lexer.NextToken(); #line 3371 "VBNET.ATG" m.Add(Modifiers.Partial, t.Location); break; } default: SynErr(230); break; } }
public ModifierList getModifiers() { if (!mHasModifier) { return null; } if (mModifierList == null) { mModifierList = new AST2ModifierList((AST2JSOMTree) getTreeNode().GetChild(0), getTokenRewriteStream()); } return mModifierList; }
void LocalDeclarationStatement( #line 2724 "VBNET.ATG" out Statement statement) { #line 2726 "VBNET.ATG" ModifierList m = new ModifierList(); LocalVariableDeclaration localVariableDeclaration; bool dimfound = false; while (la.kind == 75 || la.kind == 92 || la.kind == 189) { if (la.kind == 75) { lexer.NextToken(); #line 2732 "VBNET.ATG" m.Add(Modifiers.Const, t.Location); } else if (la.kind == 189) { lexer.NextToken(); #line 2733 "VBNET.ATG" m.Add(Modifiers.Static, t.Location); } else { lexer.NextToken(); #line 2734 "VBNET.ATG" dimfound = true; } } #line 2737 "VBNET.ATG" if(dimfound && (m.Modifier & Modifiers.Const) != 0) { Error("Dim is not allowed on constants."); } if(m.isNone && dimfound == false) { Error("Const, Dim or Static expected"); } localVariableDeclaration = new LocalVariableDeclaration(m.Modifier); localVariableDeclaration.StartLocation = t.Location; VariableDeclarator( #line 2748 "VBNET.ATG" localVariableDeclaration.Variables); while (la.kind == 12) { lexer.NextToken(); VariableDeclarator( #line 2749 "VBNET.ATG" localVariableDeclaration.Variables); } #line 2751 "VBNET.ATG" statement = localVariableDeclaration; }
void NamespaceMemberDecl() { //#line 361 "VBNET.ATG" ModifierList m = new ModifierList(); AttributeSection section; List<AttributeSection> attributes = new List<AttributeSection>(); string qualident; if (la.kind == 160) { lexer.NextToken(); //#line 368 "VBNET.ATG" Location startPos = t.Location; Qualident( //#line 370 "VBNET.ATG" out qualident); //#line 372 "VBNET.ATG" INode node = new NamespaceDeclaration(qualident); node.StartLocation = startPos; AddChild(node); BlockStart(node); EndOfStmt(); NamespaceBody(); //#line 380 "VBNET.ATG" node.EndLocation = t.Location; BlockEnd(); } else if (StartOf(2)) { while (la.kind == 40) { AttributeSection( //#line 384 "VBNET.ATG" out section); //#line 384 "VBNET.ATG" attributes.Add(section); } while (StartOf(3)) { TypeModifier( //#line 385 "VBNET.ATG" m); } NonModuleDeclaration( //#line 385 "VBNET.ATG" m, attributes); } else SynErr(245); }
void ClassBody( //#line 590 "VBNET.ATG" TypeDeclaration newType) { //#line 591 "VBNET.ATG" AttributeSection section; while (la.kind == 1 || la.kind == 21) { EndOfStmt(); } while (StartOf(9)) { //#line 594 "VBNET.ATG" List<AttributeSection> attributes = new List<AttributeSection>(); ModifierList m = new ModifierList(); while (la.kind == 40) { AttributeSection( //#line 597 "VBNET.ATG" out section); //#line 597 "VBNET.ATG" attributes.Add(section); } while (StartOf(10)) { MemberModifier( //#line 598 "VBNET.ATG" m); } ClassMemberDecl( //#line 599 "VBNET.ATG" m, attributes); while (la.kind == 1 || la.kind == 21) { EndOfStmt(); } } }
void MemberModifier( //#line 3720 "VBNET.ATG" ModifierList m) { switch (la.kind) { case 156: { lexer.NextToken(); //#line 3721 "VBNET.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 102: { lexer.NextToken(); //#line 3722 "VBNET.ATG" m.Add(Modifiers.Default, t.Location); break; } case 125: { lexer.NextToken(); //#line 3723 "VBNET.ATG" m.Add(Modifiers.Internal, t.Location); break; } case 199: { lexer.NextToken(); //#line 3724 "VBNET.ATG" m.Add(Modifiers.New, t.Location); break; } case 181: { lexer.NextToken(); //#line 3725 "VBNET.ATG" m.Add(Modifiers.Override, t.Location); break; } case 157: { lexer.NextToken(); //#line 3726 "VBNET.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 185: { lexer.NextToken(); //#line 3727 "VBNET.ATG" m.Add(Modifiers.Private, t.Location); break; } case 187: { lexer.NextToken(); //#line 3728 "VBNET.ATG" m.Add(Modifiers.Protected, t.Location); break; } case 188: { lexer.NextToken(); //#line 3729 "VBNET.ATG" m.Add(Modifiers.Public, t.Location); break; } case 166: { lexer.NextToken(); //#line 3730 "VBNET.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 167: { lexer.NextToken(); //#line 3731 "VBNET.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 200: { lexer.NextToken(); //#line 3732 "VBNET.ATG" m.Add(Modifiers.Static, t.Location); break; } case 180: { lexer.NextToken(); //#line 3733 "VBNET.ATG" m.Add(Modifiers.Virtual, t.Location); break; } case 179: { lexer.NextToken(); //#line 3734 "VBNET.ATG" m.Add(Modifiers.Overloads, t.Location); break; } case 190: { lexer.NextToken(); //#line 3735 "VBNET.ATG" m.Add(Modifiers.ReadOnly, t.Location); break; } case 235: { lexer.NextToken(); //#line 3736 "VBNET.ATG" m.Add(Modifiers.WriteOnly, t.Location); break; } case 234: { lexer.NextToken(); //#line 3737 "VBNET.ATG" m.Add(Modifiers.WithEvents, t.Location); break; } case 105: { lexer.NextToken(); //#line 3738 "VBNET.ATG" m.Add(Modifiers.Dim, t.Location); break; } case 183: { lexer.NextToken(); //#line 3739 "VBNET.ATG" m.Add(Modifiers.Partial, t.Location); break; } default: SynErr(255); break; } }
void StructureBody( //#line 604 "VBNET.ATG" TypeDeclaration newType) { //#line 605 "VBNET.ATG" AttributeSection section; while (la.kind == 1 || la.kind == 21) { EndOfStmt(); } while (StartOf(9)) { //#line 608 "VBNET.ATG" List<AttributeSection> attributes = new List<AttributeSection>(); ModifierList m = new ModifierList(); while (la.kind == 40) { AttributeSection( //#line 611 "VBNET.ATG" out section); //#line 611 "VBNET.ATG" attributes.Add(section); } while (StartOf(10)) { MemberModifier( //#line 612 "VBNET.ATG" m); } StructureMemberDecl( //#line 613 "VBNET.ATG" m, attributes); while (la.kind == 1 || la.kind == 21) { EndOfStmt(); } } Expect(113); Expect(209); //#line 616 "VBNET.ATG" newType.EndLocation = t.EndLocation; EndOfStmt(); }
void StructureMemberDecl( //#line 807 "VBNET.ATG" ModifierList m, List<AttributeSection> attributes) { //#line 809 "VBNET.ATG" TypeReference type = null; List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>(); Statement stmt = null; List<VariableDeclaration> variableDeclarators = new List<VariableDeclaration>(); List<TemplateDefinition> templates = new List<TemplateDefinition>(); switch (la.kind) { case 84: case 103: case 115: case 142: case 155: case 209: { NonModuleDeclaration( //#line 816 "VBNET.ATG" m, attributes); break; } case 210: { lexer.NextToken(); //#line 820 "VBNET.ATG" Location startPos = t.Location; if (StartOf(4)) { //#line 824 "VBNET.ATG" string name = String.Empty; MethodDeclaration methodDeclaration; List<string> handlesClause = null; List<InterfaceImplementation> implementsClause = null; Identifier(); //#line 830 "VBNET.ATG" name = t.val; m.Check(Modifiers.VBMethods); TypeParameterList( //#line 833 "VBNET.ATG" templates); if (la.kind == 37) { lexer.NextToken(); if (StartOf(6)) { FormalParameterList( //#line 834 "VBNET.ATG" p); } Expect(38); } if (la.kind == 134 || la.kind == 136) { if (la.kind == 136) { ImplementsClause( //#line 837 "VBNET.ATG" out implementsClause); } else { HandlesClause( //#line 839 "VBNET.ATG" out handlesClause); } } //#line 842 "VBNET.ATG" Location endLocation = t.EndLocation; if ( //#line 845 "VBNET.ATG" IsMustOverride(m)) { EndOfStmt(); //#line 848 "VBNET.ATG" 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); } else if (la.kind == 1) { lexer.NextToken(); //#line 861 "VBNET.ATG" 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); //#line 872 "VBNET.ATG" if (ParseMethodBodies) { Block( //#line 873 "VBNET.ATG" out stmt); Expect(113); Expect(210); //#line 875 "VBNET.ATG" } else { // don't parse method body lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement(); } //#line 881 "VBNET.ATG" methodDeclaration.Body = (BlockStatement)stmt; //#line 882 "VBNET.ATG" methodDeclaration.Body.EndLocation = t.EndLocation; EndOfStmt(); } else SynErr(256); } else if (la.kind == 162) { lexer.NextToken(); if (la.kind == 37) { lexer.NextToken(); if (StartOf(6)) { FormalParameterList( //#line 886 "VBNET.ATG" p); } Expect(38); } //#line 887 "VBNET.ATG" m.Check(Modifiers.Constructors); //#line 888 "VBNET.ATG" Location constructorEndLocation = t.EndLocation; Expect(1); //#line 891 "VBNET.ATG" if (ParseMethodBodies) { Block( //#line 892 "VBNET.ATG" out stmt); Expect(113); Expect(210); //#line 894 "VBNET.ATG" } else { // don't parse method body lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement(); } //#line 900 "VBNET.ATG" Location endLocation = t.EndLocation; EndOfStmt(); //#line 903 "VBNET.ATG" 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); } else SynErr(257); break; } case 127: { lexer.NextToken(); //#line 915 "VBNET.ATG" m.Check(Modifiers.VBMethods); string name = String.Empty; Location startPos = t.Location; MethodDeclaration methodDeclaration;List<string> handlesClause = null; List<InterfaceImplementation> implementsClause = null; AttributeSection returnTypeAttributeSection = null; Identifier(); //#line 922 "VBNET.ATG" name = t.val; TypeParameterList( //#line 923 "VBNET.ATG" templates); if (la.kind == 37) { lexer.NextToken(); if (StartOf(6)) { FormalParameterList( //#line 924 "VBNET.ATG" p); } Expect(38); } if (la.kind == 63) { lexer.NextToken(); while (la.kind == 40) { AttributeSection( //#line 926 "VBNET.ATG" out returnTypeAttributeSection); //#line 928 "VBNET.ATG" if (returnTypeAttributeSection != null) { returnTypeAttributeSection.AttributeTarget = "return"; attributes.Add(returnTypeAttributeSection); } } TypeName( //#line 934 "VBNET.ATG" out type); } //#line 936 "VBNET.ATG" if(type == null) { type = new TypeReference("System.Object", true); } if (la.kind == 134 || la.kind == 136) { if (la.kind == 136) { ImplementsClause( //#line 942 "VBNET.ATG" out implementsClause); } else { HandlesClause( //#line 944 "VBNET.ATG" out handlesClause); } } //#line 947 "VBNET.ATG" Location endLocation = t.EndLocation; if ( //#line 950 "VBNET.ATG" IsMustOverride(m)) { EndOfStmt(); //#line 953 "VBNET.ATG" 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); } else if (la.kind == 1) { lexer.NextToken(); //#line 968 "VBNET.ATG" 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( //#line 981 "VBNET.ATG" out stmt); Expect(113); Expect(127); //#line 983 "VBNET.ATG" } 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(); } else SynErr(258); break; } case 101: { lexer.NextToken(); //#line 997 "VBNET.ATG" m.Check(Modifiers.VBExternalMethods); Location startPos = t.Location; CharsetModifier charsetModifer = CharsetModifier.None; string library = String.Empty; string alias = null; string name = String.Empty; if (StartOf(15)) { Charset( //#line 1004 "VBNET.ATG" out charsetModifer); } if (la.kind == 210) { lexer.NextToken(); Identifier(); //#line 1007 "VBNET.ATG" name = t.val; Expect(149); Expect(3); //#line 1008 "VBNET.ATG" library = t.literalValue as string; if (la.kind == 59) { lexer.NextToken(); Expect(3); //#line 1009 "VBNET.ATG" alias = t.literalValue as string; } if (la.kind == 37) { lexer.NextToken(); if (StartOf(6)) { FormalParameterList( //#line 1010 "VBNET.ATG" p); } Expect(38); } EndOfStmt(); //#line 1013 "VBNET.ATG" DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, null, p, attributes, library, alias, charsetModifer); declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos); declareDeclaration.EndLocation = t.EndLocation; AddChild(declareDeclaration); } else if (la.kind == 127) { lexer.NextToken(); Identifier(); //#line 1020 "VBNET.ATG" name = t.val; Expect(149); Expect(3); //#line 1021 "VBNET.ATG" library = t.literalValue as string; if (la.kind == 59) { lexer.NextToken(); Expect(3); //#line 1022 "VBNET.ATG" alias = t.literalValue as string; } if (la.kind == 37) { lexer.NextToken(); if (StartOf(6)) { FormalParameterList( //#line 1023 "VBNET.ATG" p); } Expect(38); } if (la.kind == 63) { lexer.NextToken(); TypeName( //#line 1024 "VBNET.ATG" out type); } EndOfStmt(); //#line 1027 "VBNET.ATG" DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, type, p, attributes, library, alias, charsetModifer); declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos); declareDeclaration.EndLocation = t.EndLocation; AddChild(declareDeclaration); } else SynErr(259); break; } case 119: { lexer.NextToken(); //#line 1037 "VBNET.ATG" m.Check(Modifiers.VBEvents); Location startPos = t.Location; EventDeclaration eventDeclaration; string name = String.Empty; List<InterfaceImplementation> implementsClause = null; Identifier(); //#line 1043 "VBNET.ATG" name= t.val; if (la.kind == 63) { lexer.NextToken(); TypeName( //#line 1045 "VBNET.ATG" out type); } else if (StartOf(16)) { if (la.kind == 37) { lexer.NextToken(); if (StartOf(6)) { FormalParameterList( //#line 1047 "VBNET.ATG" p); } Expect(38); } } else SynErr(260); if (la.kind == 136) { ImplementsClause( //#line 1049 "VBNET.ATG" out implementsClause); } //#line 1051 "VBNET.ATG" eventDeclaration = new EventDeclaration { Name = name, TypeReference = type, Modifier = m.Modifier, Parameters = p, Attributes = attributes, InterfaceImplementations = implementsClause, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = t.EndLocation }; AddChild(eventDeclaration); EndOfStmt(); break; } case 2: case 58: case 62: case 64: case 65: case 66: case 67: case 70: case 87: case 104: case 107: case 116: case 121: case 126: case 133: case 139: case 143: case 146: case 147: case 170: case 176: case 178: case 184: case 203: case 212: case 213: case 223: case 224: case 230: { //#line 1062 "VBNET.ATG" m.Check(Modifiers.Fields); FieldDeclaration fd = new FieldDeclaration(attributes, null, m.Modifier); IdentifierForFieldDeclaration(); //#line 1065 "VBNET.ATG" string name = t.val; //#line 1066 "VBNET.ATG" fd.StartLocation = m.GetDeclarationLocation(t.Location); VariableDeclaratorPartAfterIdentifier( //#line 1068 "VBNET.ATG" variableDeclarators, name); while (la.kind == 22) { lexer.NextToken(); VariableDeclarator( //#line 1069 "VBNET.ATG" variableDeclarators); } EndOfStmt(); //#line 1072 "VBNET.ATG" fd.EndLocation = t.EndLocation; fd.Fields = variableDeclarators; AddChild(fd); break; } case 88: { //#line 1077 "VBNET.ATG" m.Check(Modifiers.Fields); lexer.NextToken(); //#line 1078 "VBNET.ATG" m.Add(Modifiers.Const, t.Location); //#line 1080 "VBNET.ATG" FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier); fd.StartLocation = m.GetDeclarationLocation(t.Location); List<VariableDeclaration> constantDeclarators = new List<VariableDeclaration>(); ConstantDeclarator( //#line 1084 "VBNET.ATG" constantDeclarators); while (la.kind == 22) { lexer.NextToken(); ConstantDeclarator( //#line 1085 "VBNET.ATG" constantDeclarators); } //#line 1087 "VBNET.ATG" fd.Fields = constantDeclarators; fd.EndLocation = t.Location; EndOfStmt(); //#line 1092 "VBNET.ATG" fd.EndLocation = t.EndLocation; AddChild(fd); break; } case 186: { lexer.NextToken(); //#line 1098 "VBNET.ATG" m.Check(Modifiers.VBProperties); Location startPos = t.Location; List<InterfaceImplementation> implementsClause = null; AttributeSection returnTypeAttributeSection = null; Expression initializer = null; Identifier(); //#line 1104 "VBNET.ATG" string propertyName = t.val; if (la.kind == 37) { lexer.NextToken(); if (StartOf(6)) { FormalParameterList( //#line 1105 "VBNET.ATG" p); } Expect(38); } if (la.kind == 63) { lexer.NextToken(); while (la.kind == 40) { AttributeSection( //#line 1108 "VBNET.ATG" out returnTypeAttributeSection); //#line 1110 "VBNET.ATG" if (returnTypeAttributeSection != null) { returnTypeAttributeSection.AttributeTarget = "return"; attributes.Add(returnTypeAttributeSection); } } if ( //#line 1117 "VBNET.ATG" IsNewExpression()) { ObjectCreateExpression( //#line 1117 "VBNET.ATG" out initializer); //#line 1119 "VBNET.ATG" if (initializer is ObjectCreateExpression) { type = ((ObjectCreateExpression)initializer).CreateType.Clone(); } else { type = ((ArrayCreateExpression)initializer).CreateType.Clone(); } } else if (StartOf(8)) { TypeName( //#line 1126 "VBNET.ATG" out type); } else SynErr(261); } if (la.kind == 20) { lexer.NextToken(); Expr( //#line 1129 "VBNET.ATG" out initializer); } if (la.kind == 136) { ImplementsClause( //#line 1130 "VBNET.ATG" out implementsClause); } EndOfStmt(); if ( //#line 1134 "VBNET.ATG" IsMustOverride(m) || IsAutomaticProperty()) { //#line 1136 "VBNET.ATG" PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes); pDecl.StartLocation = m.GetDeclarationLocation(startPos); pDecl.EndLocation = t.Location; pDecl.TypeReference = type; pDecl.InterfaceImplementations = implementsClause; pDecl.Parameters = p; if (initializer != null) pDecl.Initializer = initializer; AddChild(pDecl); } else if (StartOf(17)) { //#line 1148 "VBNET.ATG" PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes); pDecl.StartLocation = m.GetDeclarationLocation(startPos); pDecl.EndLocation = t.Location; pDecl.BodyStart = t.Location; pDecl.TypeReference = type; pDecl.InterfaceImplementations = implementsClause; pDecl.Parameters = p; PropertyGetRegion getRegion; PropertySetRegion setRegion; AccessorDecls( //#line 1158 "VBNET.ATG" out getRegion, out setRegion); Expect(113); Expect(186); EndOfStmt(); //#line 1162 "VBNET.ATG" pDecl.GetRegion = getRegion; pDecl.SetRegion = setRegion; pDecl.BodyEnd = t.Location; // t = EndOfStmt; not "Property" AddChild(pDecl); } else SynErr(262); break; } case 98: { lexer.NextToken(); //#line 1169 "VBNET.ATG" Location startPos = t.Location; Expect(119); //#line 1171 "VBNET.ATG" m.Check(Modifiers.VBCustomEvents); EventAddRemoveRegion eventAccessorDeclaration; EventAddRegion addHandlerAccessorDeclaration = null; EventRemoveRegion removeHandlerAccessorDeclaration = null; EventRaiseRegion raiseEventAccessorDeclaration = null; List<InterfaceImplementation> implementsClause = null; Identifier(); //#line 1178 "VBNET.ATG" string customEventName = t.val; Expect(63); TypeName( //#line 1179 "VBNET.ATG" out type); if (la.kind == 136) { ImplementsClause( //#line 1180 "VBNET.ATG" out implementsClause); } EndOfStmt(); while (StartOf(18)) { EventAccessorDeclaration( //#line 1183 "VBNET.ATG" out eventAccessorDeclaration); //#line 1185 "VBNET.ATG" if(eventAccessorDeclaration is EventAddRegion) { addHandlerAccessorDeclaration = (EventAddRegion)eventAccessorDeclaration; } else if(eventAccessorDeclaration is EventRemoveRegion) { removeHandlerAccessorDeclaration = (EventRemoveRegion)eventAccessorDeclaration; } else if(eventAccessorDeclaration is EventRaiseRegion) { raiseEventAccessorDeclaration = (EventRaiseRegion)eventAccessorDeclaration; } } Expect(113); Expect(119); EndOfStmt(); //#line 1201 "VBNET.ATG" if(addHandlerAccessorDeclaration == null) { Error("Need to provide AddHandler accessor."); } if(removeHandlerAccessorDeclaration == null) { Error("Need to provide RemoveHandler accessor."); } if(raiseEventAccessorDeclaration == null) { Error("Need to provide RaiseEvent accessor."); } EventDeclaration decl = new EventDeclaration { TypeReference = type, Name = customEventName, Modifier = m.Modifier, Attributes = attributes, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = t.EndLocation, AddRegion = addHandlerAccessorDeclaration, RemoveRegion = removeHandlerAccessorDeclaration, RaiseRegion = raiseEventAccessorDeclaration }; AddChild(decl); break; } case 161: case 172: case 232: { //#line 1227 "VBNET.ATG" ConversionType opConversionType = ConversionType.None; if (la.kind == 161 || la.kind == 232) { if (la.kind == 232) { lexer.NextToken(); //#line 1228 "VBNET.ATG" opConversionType = ConversionType.Implicit; } else { lexer.NextToken(); //#line 1229 "VBNET.ATG" opConversionType = ConversionType.Explicit; } } Expect(172); //#line 1232 "VBNET.ATG" m.Check(Modifiers.VBOperators); Location startPos = t.Location; TypeReference returnType = NullTypeReference.Instance; TypeReference operandType = NullTypeReference.Instance; OverloadableOperatorType operatorType; AttributeSection section; ParameterDeclarationExpression param; List<ParameterDeclarationExpression> parameters = new List<ParameterDeclarationExpression>(); OverloadableOperator( //#line 1241 "VBNET.ATG" out operatorType); Expect(37); FormalParameter( //#line 1243 "VBNET.ATG" out param); //#line 1244 "VBNET.ATG" if (param != null) parameters.Add(param); if (la.kind == 22) { lexer.NextToken(); FormalParameter( //#line 1246 "VBNET.ATG" out param); //#line 1247 "VBNET.ATG" if (param != null) parameters.Add(param); } Expect(38); //#line 1250 "VBNET.ATG" Location endPos = t.EndLocation; if (la.kind == 63) { lexer.NextToken(); while (la.kind == 40) { AttributeSection( //#line 1251 "VBNET.ATG" out section); //#line 1252 "VBNET.ATG" if (section != null) { section.AttributeTarget = "return"; attributes.Add(section); } } TypeName( //#line 1256 "VBNET.ATG" out returnType); //#line 1256 "VBNET.ATG" endPos = t.EndLocation; } Expect(1); Block( //#line 1258 "VBNET.ATG" out stmt); Expect(113); Expect(172); EndOfStmt(); //#line 1260 "VBNET.ATG" OperatorDeclaration operatorDeclaration = new OperatorDeclaration { Modifier = m.Modifier, Attributes = attributes, Parameters = parameters, TypeReference = returnType, OverloadableOperator = operatorType, ConversionType = opConversionType, Body = (BlockStatement)stmt, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endPos }; operatorDeclaration.Body.StartLocation = startPos; operatorDeclaration.Body.EndLocation = t.Location; AddChild(operatorDeclaration); break; } default: SynErr(263); break; } }
void ClassMemberDecl( //#line 793 "VBNET.ATG" ModifierList m, List<AttributeSection> attributes) { StructureMemberDecl( //#line 794 "VBNET.ATG" m, attributes); }
void ModuleBody( #line 563 "VBNET.ATG" TypeDeclaration newType) { #line 564 "VBNET.ATG" AttributeSection section; while (StartOf(7)) { #line 566 "VBNET.ATG" List<AttributeSection> attributes = new List<AttributeSection>(); ModifierList m = new ModifierList(); while (la.kind == 27) { AttributeSection( #line 569 "VBNET.ATG" out section); #line 569 "VBNET.ATG" attributes.Add(section); } while (StartOf(8)) { MemberModifier( #line 570 "VBNET.ATG" m); } ClassMemberDecl( #line 571 "VBNET.ATG" m, attributes); } Expect(88); Expect(121); #line 573 "VBNET.ATG" newType.EndLocation = t.EndLocation; Expect(1); }
void InterfaceMemberDecl() { //#line 665 "VBNET.ATG" TypeReference type =null; List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>(); List<TemplateDefinition> templates = new List<TemplateDefinition>(); AttributeSection section, returnTypeAttributeSection = null; ModifierList mod = new ModifierList(); List<AttributeSection> attributes = new List<AttributeSection>(); string name; if (StartOf(19)) { while (la.kind == 40) { AttributeSection( //#line 673 "VBNET.ATG" out section); //#line 673 "VBNET.ATG" attributes.Add(section); } while (StartOf(10)) { MemberModifier( //#line 676 "VBNET.ATG" mod); } if (la.kind == 119) { lexer.NextToken(); //#line 680 "VBNET.ATG" mod.Check(Modifiers.VBInterfaceEvents); Location startLocation = t.Location; Identifier(); //#line 683 "VBNET.ATG" name = t.val; if (la.kind == 37) { lexer.NextToken(); if (StartOf(6)) { FormalParameterList( //#line 684 "VBNET.ATG" p); } Expect(38); } if (la.kind == 63) { lexer.NextToken(); TypeName( //#line 685 "VBNET.ATG" out type); } EndOfStmt(); //#line 688 "VBNET.ATG" EventDeclaration ed = new EventDeclaration { Name = name, TypeReference = type, Modifier = mod.Modifier, Parameters = p, Attributes = attributes, StartLocation = startLocation, EndLocation = t.EndLocation }; AddChild(ed); } else if (la.kind == 210) { lexer.NextToken(); //#line 698 "VBNET.ATG" Location startLocation = t.Location; mod.Check(Modifiers.VBInterfaceMethods); Identifier(); //#line 701 "VBNET.ATG" name = t.val; TypeParameterList( //#line 702 "VBNET.ATG" templates); if (la.kind == 37) { lexer.NextToken(); if (StartOf(6)) { FormalParameterList( //#line 703 "VBNET.ATG" p); } Expect(38); } EndOfStmt(); //#line 706 "VBNET.ATG" 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); } else if (la.kind == 127) { lexer.NextToken(); //#line 721 "VBNET.ATG" mod.Check(Modifiers.VBInterfaceMethods); Location startLocation = t.Location; Identifier(); //#line 724 "VBNET.ATG" name = t.val; TypeParameterList( //#line 725 "VBNET.ATG" templates); if (la.kind == 37) { lexer.NextToken(); if (StartOf(6)) { FormalParameterList( //#line 726 "VBNET.ATG" p); } Expect(38); } if (la.kind == 63) { lexer.NextToken(); while (la.kind == 40) { AttributeSection( //#line 727 "VBNET.ATG" out returnTypeAttributeSection); } TypeName( //#line 727 "VBNET.ATG" out type); } //#line 729 "VBNET.ATG" 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(); } else if (la.kind == 186) { lexer.NextToken(); //#line 749 "VBNET.ATG" Location startLocation = t.Location; mod.Check(Modifiers.VBInterfaceProperties); Identifier(); //#line 752 "VBNET.ATG" name = t.val; if (la.kind == 37) { lexer.NextToken(); if (StartOf(6)) { FormalParameterList( //#line 753 "VBNET.ATG" p); } Expect(38); } if (la.kind == 63) { lexer.NextToken(); TypeName( //#line 754 "VBNET.ATG" out type); } //#line 756 "VBNET.ATG" if(type == null) { type = new TypeReference("System.Object", true); } EndOfStmt(); //#line 762 "VBNET.ATG" PropertyDeclaration pd = new PropertyDeclaration(name, type, mod.Modifier, attributes); pd.Parameters = p; pd.EndLocation = t.EndLocation; pd.StartLocation = startLocation; AddChild(pd); } else SynErr(264); } else if (StartOf(20)) { NonModuleDeclaration( //#line 770 "VBNET.ATG" mod, attributes); } else SynErr(265); }
void StructureBody( #line 548 "VBNET.ATG" TypeDeclaration newType) { #line 549 "VBNET.ATG" AttributeSection section; while (StartOf(7)) { #line 551 "VBNET.ATG" List<AttributeSection> attributes = new List<AttributeSection>(); ModifierList m = new ModifierList(); while (la.kind == 27) { AttributeSection( #line 554 "VBNET.ATG" out section); #line 554 "VBNET.ATG" attributes.Add(section); } while (StartOf(8)) { MemberModifier( #line 555 "VBNET.ATG" m); } StructureMemberDecl( #line 556 "VBNET.ATG" m, attributes); } Expect(88); Expect(166); #line 558 "VBNET.ATG" newType.EndLocation = t.EndLocation; Expect(1); }
void TypeModifier( //#line 3708 "VBNET.ATG" ModifierList m) { switch (la.kind) { case 188: { lexer.NextToken(); //#line 3709 "VBNET.ATG" m.Add(Modifiers.Public, t.Location); break; } case 187: { lexer.NextToken(); //#line 3710 "VBNET.ATG" m.Add(Modifiers.Protected, t.Location); break; } case 125: { lexer.NextToken(); //#line 3711 "VBNET.ATG" m.Add(Modifiers.Internal, t.Location); break; } case 185: { lexer.NextToken(); //#line 3712 "VBNET.ATG" m.Add(Modifiers.Private, t.Location); break; } case 200: { lexer.NextToken(); //#line 3713 "VBNET.ATG" m.Add(Modifiers.Static, t.Location); break; } case 199: { lexer.NextToken(); //#line 3714 "VBNET.ATG" m.Add(Modifiers.New, t.Location); break; } case 156: { lexer.NextToken(); //#line 3715 "VBNET.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 166: { lexer.NextToken(); //#line 3716 "VBNET.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 183: { lexer.NextToken(); //#line 3717 "VBNET.ATG" m.Add(Modifiers.Partial, t.Location); break; } default: SynErr(249); break; } }
void MemberModifier( #line 2886 "VBNET.ATG" ModifierList m) { switch (la.kind) { case 122: { lexer.NextToken(); #line 2887 "VBNET.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 79: { lexer.NextToken(); #line 2888 "VBNET.ATG" m.Add(Modifiers.Default, t.Location); break; } case 99: { lexer.NextToken(); #line 2889 "VBNET.ATG" m.Add(Modifiers.Internal, t.Location); break; } case 157: { lexer.NextToken(); #line 2890 "VBNET.ATG" m.Add(Modifiers.New, t.Location); break; } case 142: { lexer.NextToken(); #line 2891 "VBNET.ATG" m.Add(Modifiers.Override, t.Location); break; } case 123: { lexer.NextToken(); #line 2892 "VBNET.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 145: { lexer.NextToken(); #line 2893 "VBNET.ATG" m.Add(Modifiers.Private, t.Location); break; } case 147: { lexer.NextToken(); #line 2894 "VBNET.ATG" m.Add(Modifiers.Protected, t.Location); break; } case 148: { lexer.NextToken(); #line 2895 "VBNET.ATG" m.Add(Modifiers.Public, t.Location); break; } case 131: { lexer.NextToken(); #line 2896 "VBNET.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 132: { lexer.NextToken(); #line 2897 "VBNET.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 158: { lexer.NextToken(); #line 2898 "VBNET.ATG" m.Add(Modifiers.Static, t.Location); break; } case 141: { lexer.NextToken(); #line 2899 "VBNET.ATG" m.Add(Modifiers.Virtual, t.Location); break; } case 140: { lexer.NextToken(); #line 2900 "VBNET.ATG" m.Add(Modifiers.Overloads, t.Location); break; } case 150: { lexer.NextToken(); #line 2901 "VBNET.ATG" m.Add(Modifiers.ReadOnly, t.Location); break; } case 184: { lexer.NextToken(); #line 2902 "VBNET.ATG" m.Add(Modifiers.WriteOnly, t.Location); break; } case 183: { lexer.NextToken(); #line 2903 "VBNET.ATG" m.Add(Modifiers.WithEvents, t.Location); break; } case 81: { lexer.NextToken(); #line 2904 "VBNET.ATG" m.Add(Modifiers.Dim, t.Location); break; } default: SynErr(221); break; } }
void LocalDeclarationStatement( //#line 3039 "VBNET.ATG" out Statement statement) { //#line 3041 "VBNET.ATG" ModifierList m = new ModifierList(); LocalVariableDeclaration localVariableDeclaration; bool dimfound = false; while (la.kind == 88 || la.kind == 105 || la.kind == 204) { if (la.kind == 88) { lexer.NextToken(); //#line 3047 "VBNET.ATG" m.Add(Modifiers.Const, t.Location); } else if (la.kind == 204) { lexer.NextToken(); //#line 3048 "VBNET.ATG" m.Add(Modifiers.Static, t.Location); } else { lexer.NextToken(); //#line 3049 "VBNET.ATG" dimfound = true; } } //#line 3052 "VBNET.ATG" if(dimfound && (m.Modifier & Modifiers.Const) != 0) { Error("Dim is not allowed on constants."); } if(m.isNone && dimfound == false) { Error("Const, Dim or Static expected"); } localVariableDeclaration = new LocalVariableDeclaration(m.Modifier); localVariableDeclaration.StartLocation = t.Location; VariableDeclarator( //#line 3063 "VBNET.ATG" localVariableDeclaration.Variables); while (la.kind == 22) { lexer.NextToken(); VariableDeclarator( //#line 3064 "VBNET.ATG" localVariableDeclaration.Variables); } //#line 3066 "VBNET.ATG" statement = localVariableDeclaration; }
void StructureMemberDecl( #line 737 "VBNET.ATG" ModifierList m, List<AttributeSection> attributes) { #line 739 "VBNET.ATG" TypeReference type = null; List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>(); Statement stmt = null; List<VariableDeclaration> variableDeclarators = new List<VariableDeclaration>(); List<TemplateDefinition> templates = new List<TemplateDefinition>(); switch (la.kind) { case 67: case 80: case 90: case 112: case 121: case 166: { NonModuleDeclaration( #line 746 "VBNET.ATG" m, attributes); break; } case 167: { lexer.NextToken(); #line 750 "VBNET.ATG" Location startPos = t.Location; if (StartOf(13)) { #line 754 "VBNET.ATG" string name = String.Empty; MethodDeclaration methodDeclaration; List<string> handlesClause = null; List<InterfaceImplementation> implementsClause = null; Identifier(); #line 760 "VBNET.ATG" name = t.val; m.Check(Modifiers.VBMethods); TypeParameterList( #line 763 "VBNET.ATG" templates); if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 764 "VBNET.ATG" p); } Expect(25); } if (la.kind == 105 || la.kind == 107) { if (la.kind == 107) { ImplementsClause( #line 767 "VBNET.ATG" out implementsClause); } else { HandlesClause( #line 769 "VBNET.ATG" out handlesClause); } } #line 772 "VBNET.ATG" Location endLocation = t.EndLocation; Expect(1); if ( #line 776 "VBNET.ATG" IsMustOverride(m)) { #line 778 "VBNET.ATG" methodDeclaration = new MethodDeclaration { Name = name, Modifier = m.Modifier, Parameters = p, Attributes = attributes, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endLocation, TypeReference = new TypeReference("", "System.Void"), Templates = templates, HandlesClause = handlesClause, InterfaceImplementations = implementsClause }; compilationUnit.AddChild(methodDeclaration); } else if (StartOf(14)) { #line 790 "VBNET.ATG" methodDeclaration = new MethodDeclaration { Name = name, Modifier = m.Modifier, Parameters = p, Attributes = attributes, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endLocation, TypeReference = new TypeReference("", "System.Void"), Templates = templates, HandlesClause = handlesClause, InterfaceImplementations = implementsClause }; compilationUnit.AddChild(methodDeclaration); #line 801 "VBNET.ATG" if (ParseMethodBodies) { Block( #line 802 "VBNET.ATG" out stmt); Expect(88); Expect(167); #line 804 "VBNET.ATG" } else { // don't parse method body lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement(); } #line 810 "VBNET.ATG" methodDeclaration.Body = (BlockStatement)stmt; #line 811 "VBNET.ATG" methodDeclaration.Body.EndLocation = t.EndLocation; Expect(1); } else SynErr(222); } else if (la.kind == 127) { lexer.NextToken(); if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 814 "VBNET.ATG" p); } Expect(25); } #line 815 "VBNET.ATG" m.Check(Modifiers.Constructors); #line 816 "VBNET.ATG" Location constructorEndLocation = t.EndLocation; Expect(1); #line 819 "VBNET.ATG" if (ParseMethodBodies) { Block( #line 820 "VBNET.ATG" out stmt); Expect(88); Expect(167); #line 822 "VBNET.ATG" } else { // don't parse method body lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement(); } #line 828 "VBNET.ATG" Location endLocation = t.EndLocation; Expect(1); #line 830 "VBNET.ATG" 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; compilationUnit.AddChild(cd); } else SynErr(223); break; } case 100: { lexer.NextToken(); #line 842 "VBNET.ATG" m.Check(Modifiers.VBMethods); string name = String.Empty; Location startPos = t.Location; MethodDeclaration methodDeclaration;List<string> handlesClause = null; List<InterfaceImplementation> implementsClause = null; AttributeSection returnTypeAttributeSection = null; Identifier(); #line 849 "VBNET.ATG" name = t.val; TypeParameterList( #line 850 "VBNET.ATG" templates); if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 851 "VBNET.ATG" p); } Expect(25); } if (la.kind == 48) { lexer.NextToken(); while (la.kind == 27) { AttributeSection( #line 852 "VBNET.ATG" out returnTypeAttributeSection); } TypeName( #line 852 "VBNET.ATG" out type); } #line 854 "VBNET.ATG" if(type == null) { type = new TypeReference("System.Object"); } if (la.kind == 105 || la.kind == 107) { if (la.kind == 107) { ImplementsClause( #line 860 "VBNET.ATG" out implementsClause); } else { HandlesClause( #line 862 "VBNET.ATG" out handlesClause); } } Expect(1); if ( #line 868 "VBNET.ATG" IsMustOverride(m)) { #line 870 "VBNET.ATG" methodDeclaration = new MethodDeclaration { Name = name, Modifier = m.Modifier, TypeReference = type, Parameters = p, Attributes = attributes, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = t.EndLocation, HandlesClause = handlesClause, Templates = templates, InterfaceImplementations = implementsClause }; if (returnTypeAttributeSection != null) { returnTypeAttributeSection.AttributeTarget = "return"; methodDeclaration.Attributes.Add(returnTypeAttributeSection); } compilationUnit.AddChild(methodDeclaration); } else if (StartOf(14)) { #line 887 "VBNET.ATG" methodDeclaration = new MethodDeclaration { Name = name, Modifier = m.Modifier, TypeReference = type, Parameters = p, Attributes = attributes, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = t.EndLocation, Templates = templates, HandlesClause = handlesClause, InterfaceImplementations = implementsClause }; if (returnTypeAttributeSection != null) { returnTypeAttributeSection.AttributeTarget = "return"; methodDeclaration.Attributes.Add(returnTypeAttributeSection); } compilationUnit.AddChild(methodDeclaration); if (ParseMethodBodies) { Block( #line 904 "VBNET.ATG" out stmt); Expect(88); Expect(100); #line 906 "VBNET.ATG" } 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; Expect(1); } else SynErr(224); break; } case 78: { lexer.NextToken(); #line 920 "VBNET.ATG" m.Check(Modifiers.VBExternalMethods); Location startPos = t.Location; CharsetModifier charsetModifer = CharsetModifier.None; string library = String.Empty; string alias = null; string name = String.Empty; if (StartOf(15)) { Charset( #line 927 "VBNET.ATG" out charsetModifer); } if (la.kind == 167) { lexer.NextToken(); Identifier(); #line 930 "VBNET.ATG" name = t.val; Expect(115); Expect(3); #line 931 "VBNET.ATG" library = t.literalValue as string; if (la.kind == 44) { lexer.NextToken(); Expect(3); #line 932 "VBNET.ATG" alias = t.literalValue as string; } if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 933 "VBNET.ATG" p); } Expect(25); } Expect(1); #line 936 "VBNET.ATG" DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, null, p, attributes, library, alias, charsetModifer); declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos); declareDeclaration.EndLocation = t.EndLocation; compilationUnit.AddChild(declareDeclaration); } else if (la.kind == 100) { lexer.NextToken(); Identifier(); #line 943 "VBNET.ATG" name = t.val; Expect(115); Expect(3); #line 944 "VBNET.ATG" library = t.literalValue as string; if (la.kind == 44) { lexer.NextToken(); Expect(3); #line 945 "VBNET.ATG" alias = t.literalValue as string; } if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 946 "VBNET.ATG" p); } Expect(25); } if (la.kind == 48) { lexer.NextToken(); TypeName( #line 947 "VBNET.ATG" out type); } Expect(1); #line 950 "VBNET.ATG" DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, type, p, attributes, library, alias, charsetModifer); declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos); declareDeclaration.EndLocation = t.EndLocation; compilationUnit.AddChild(declareDeclaration); } else SynErr(225); break; } case 93: { lexer.NextToken(); #line 960 "VBNET.ATG" m.Check(Modifiers.VBEvents); Location startPos = t.Location; EventDeclaration eventDeclaration; string name = String.Empty; List<InterfaceImplementation> implementsClause = null; Identifier(); #line 966 "VBNET.ATG" name= t.val; if (la.kind == 48) { lexer.NextToken(); TypeName( #line 968 "VBNET.ATG" out type); } else if (la.kind == 1 || la.kind == 24 || la.kind == 107) { if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 970 "VBNET.ATG" p); } Expect(25); } } else SynErr(226); if (la.kind == 107) { ImplementsClause( #line 972 "VBNET.ATG" out implementsClause); } #line 974 "VBNET.ATG" eventDeclaration = new EventDeclaration { Name = name, TypeReference = type, Modifier = m.Modifier, Parameters = p, Attributes = attributes, InterfaceImplementations = implementsClause, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = t.EndLocation }; compilationUnit.AddChild(eventDeclaration); Expect(1); break; } case 2: case 47: case 49: case 50: case 51: case 70: case 95: case 134: case 144: case 169: case 176: case 177: { #line 984 "VBNET.ATG" Location startPos = t.Location; #line 986 "VBNET.ATG" m.Check(Modifiers.Fields); FieldDeclaration fd = new FieldDeclaration(attributes, null, m.Modifier); fd.StartLocation = m.GetDeclarationLocation(startPos); IdentifierForFieldDeclaration(); #line 990 "VBNET.ATG" string name = t.val; VariableDeclaratorPartAfterIdentifier( #line 991 "VBNET.ATG" variableDeclarators, name); while (la.kind == 12) { lexer.NextToken(); VariableDeclarator( #line 992 "VBNET.ATG" variableDeclarators); } Expect(1); #line 995 "VBNET.ATG" fd.EndLocation = t.EndLocation; fd.Fields = variableDeclarators; compilationUnit.AddChild(fd); break; } case 71: { #line 1000 "VBNET.ATG" m.Check(Modifiers.Fields); lexer.NextToken(); #line 1001 "VBNET.ATG" m.Add(Modifiers.Const, t.Location); #line 1003 "VBNET.ATG" FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier); fd.StartLocation = m.GetDeclarationLocation(t.Location); List<VariableDeclaration> constantDeclarators = new List<VariableDeclaration>(); ConstantDeclarator( #line 1007 "VBNET.ATG" constantDeclarators); while (la.kind == 12) { lexer.NextToken(); ConstantDeclarator( #line 1008 "VBNET.ATG" constantDeclarators); } #line 1010 "VBNET.ATG" fd.Fields = constantDeclarators; fd.EndLocation = t.Location; Expect(1); #line 1015 "VBNET.ATG" fd.EndLocation = t.EndLocation; compilationUnit.AddChild(fd); break; } case 146: { lexer.NextToken(); #line 1021 "VBNET.ATG" m.Check(Modifiers.VBProperties); Location startPos = t.Location; List<InterfaceImplementation> implementsClause = null; Identifier(); #line 1025 "VBNET.ATG" string propertyName = t.val; if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( #line 1026 "VBNET.ATG" p); } Expect(25); } if (la.kind == 48) { lexer.NextToken(); TypeName( #line 1027 "VBNET.ATG" out type); } #line 1029 "VBNET.ATG" if(type == null) { type = new TypeReference("System.Object"); } if (la.kind == 107) { ImplementsClause( #line 1033 "VBNET.ATG" out implementsClause); } Expect(1); if ( #line 1037 "VBNET.ATG" IsMustOverride(m)) { #line 1039 "VBNET.ATG" PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes); pDecl.StartLocation = m.GetDeclarationLocation(startPos); pDecl.EndLocation = t.Location; pDecl.TypeReference = type; pDecl.InterfaceImplementations = implementsClause; pDecl.Parameters = p; compilationUnit.AddChild(pDecl); } else if (StartOf(16)) { #line 1049 "VBNET.ATG" PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes); pDecl.StartLocation = m.GetDeclarationLocation(startPos); pDecl.EndLocation = t.Location; pDecl.BodyStart = t.Location; pDecl.TypeReference = type; pDecl.InterfaceImplementations = implementsClause; pDecl.Parameters = p; PropertyGetRegion getRegion; PropertySetRegion setRegion; AccessorDecls( #line 1059 "VBNET.ATG" out getRegion, out setRegion); Expect(88); Expect(146); Expect(1); #line 1063 "VBNET.ATG" pDecl.GetRegion = getRegion; pDecl.SetRegion = setRegion; pDecl.BodyEnd = t.EndLocation; compilationUnit.AddChild(pDecl); } else SynErr(227); break; } case 205: { lexer.NextToken(); #line 1070 "VBNET.ATG" Location startPos = t.Location; Expect(93); #line 1072 "VBNET.ATG" m.Check(Modifiers.VBCustomEvents); EventAddRemoveRegion eventAccessorDeclaration; EventAddRegion addHandlerAccessorDeclaration = null; EventRemoveRegion removeHandlerAccessorDeclaration = null; EventRaiseRegion raiseEventAccessorDeclaration = null; List<InterfaceImplementation> implementsClause = null; Identifier(); #line 1079 "VBNET.ATG" string customEventName = t.val; Expect(48); TypeName( #line 1080 "VBNET.ATG" out type); if (la.kind == 107) { ImplementsClause( #line 1081 "VBNET.ATG" out implementsClause); } Expect(1); while (StartOf(17)) { EventAccessorDeclaration( #line 1084 "VBNET.ATG" out eventAccessorDeclaration); #line 1086 "VBNET.ATG" if(eventAccessorDeclaration is EventAddRegion) { addHandlerAccessorDeclaration = (EventAddRegion)eventAccessorDeclaration; } else if(eventAccessorDeclaration is EventRemoveRegion) { removeHandlerAccessorDeclaration = (EventRemoveRegion)eventAccessorDeclaration; } else if(eventAccessorDeclaration is EventRaiseRegion) { raiseEventAccessorDeclaration = (EventRaiseRegion)eventAccessorDeclaration; } } Expect(88); Expect(93); Expect(1); #line 1102 "VBNET.ATG" if(addHandlerAccessorDeclaration == null) { Error("Need to provide AddHandler accessor."); } if(removeHandlerAccessorDeclaration == null) { Error("Need to provide RemoveHandler accessor."); } if(raiseEventAccessorDeclaration == null) { Error("Need to provide RaiseEvent accessor."); } EventDeclaration decl = new EventDeclaration { TypeReference = type, Name = customEventName, Modifier = m.Modifier, Attributes = attributes, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = t.EndLocation, AddRegion = addHandlerAccessorDeclaration, RemoveRegion = removeHandlerAccessorDeclaration, RaiseRegion = raiseEventAccessorDeclaration }; compilationUnit.AddChild(decl); break; } case 188: case 202: case 203: { #line 1128 "VBNET.ATG" ConversionType opConversionType = ConversionType.None; if (la.kind == 202 || la.kind == 203) { if (la.kind == 203) { lexer.NextToken(); #line 1129 "VBNET.ATG" opConversionType = ConversionType.Implicit; } else { lexer.NextToken(); #line 1130 "VBNET.ATG" opConversionType = ConversionType.Explicit; } } Expect(188); #line 1133 "VBNET.ATG" m.Check(Modifiers.VBOperators); Location startPos = t.Location; TypeReference returnType = NullTypeReference.Instance; TypeReference operandType = NullTypeReference.Instance; string operandName; OverloadableOperatorType operatorType; AttributeSection section; List<ParameterDeclarationExpression> parameters = new List<ParameterDeclarationExpression>(); List<AttributeSection> returnTypeAttributes = new List<AttributeSection>(); OverloadableOperator( #line 1143 "VBNET.ATG" out operatorType); Expect(24); if (la.kind == 55) { lexer.NextToken(); } Identifier(); #line 1144 "VBNET.ATG" operandName = t.val; if (la.kind == 48) { lexer.NextToken(); TypeName( #line 1145 "VBNET.ATG" out operandType); } #line 1146 "VBNET.ATG" parameters.Add(new ParameterDeclarationExpression(operandType, operandName, ParameterModifiers.In)); while (la.kind == 12) { lexer.NextToken(); if (la.kind == 55) { lexer.NextToken(); } Identifier(); #line 1150 "VBNET.ATG" operandName = t.val; if (la.kind == 48) { lexer.NextToken(); TypeName( #line 1151 "VBNET.ATG" out operandType); } #line 1152 "VBNET.ATG" parameters.Add(new ParameterDeclarationExpression(operandType, operandName, ParameterModifiers.In)); } Expect(25); #line 1155 "VBNET.ATG" Location endPos = t.EndLocation; if (la.kind == 48) { lexer.NextToken(); while (la.kind == 27) { AttributeSection( #line 1156 "VBNET.ATG" out section); #line 1156 "VBNET.ATG" returnTypeAttributes.Add(section); } TypeName( #line 1156 "VBNET.ATG" out returnType); #line 1156 "VBNET.ATG" endPos = t.EndLocation; Expect(1); } Block( #line 1157 "VBNET.ATG" out stmt); Expect(88); Expect(188); Expect(1); #line 1159 "VBNET.ATG" OperatorDeclaration operatorDeclaration = new OperatorDeclaration { Modifier = m.Modifier, Attributes = attributes, Parameters = parameters, TypeReference = returnType, OverloadableOperator = operatorType, ConversionType = opConversionType, ReturnTypeAttributes = returnTypeAttributes, Body = (BlockStatement)stmt, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endPos }; operatorDeclaration.Body.StartLocation = startPos; operatorDeclaration.Body.EndLocation = t.Location; compilationUnit.AddChild(operatorDeclaration); break; } default: SynErr(228); break; } }