⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parser.cs

📁 全功能c#编译器
💻 CS
📖 第 1 页 / 共 5 页
字号:
#line  2684 "VBNET.ATG" 
			type = "Double"; 
			break;
		}
		default: SynErr(199); break;
		}
	}

	void EnumBody(
#line  724 "VBNET.ATG" 
TypeDeclaration newType) {

#line  725 "VBNET.ATG" 
		FieldDeclaration f; 
		while (StartOf(7)) {
			EnumMemberDecl(
#line  727 "VBNET.ATG" 
out f);

#line  727 "VBNET.ATG" 
			compilationUnit.AddChild(f); 
		}
		Expect(89);
		Expect(91);

#line  729 "VBNET.ATG" 
		newType.EndLocation = t.EndLocation; 
		Expect(1);
	}

	void InterfaceBase(
#line  1361 "VBNET.ATG" 
out ArrayList bases) {

#line  1363 "VBNET.ATG" 
		TypeReference type;
		bases = new ArrayList();
		
		Expect(111);
		TypeName(
#line  1367 "VBNET.ATG" 
out type);

#line  1367 "VBNET.ATG" 
		bases.Add(type); 
		while (la.kind == 12) {
			lexer.NextToken();
			TypeName(
#line  1370 "VBNET.ATG" 
out type);

#line  1370 "VBNET.ATG" 
			bases.Add(type); 
		}
		Expect(1);
	}

	void InterfaceBody(
#line  733 "VBNET.ATG" 
TypeDeclaration newType) {
		while (StartOf(8)) {
			InterfaceMemberDecl();
		}
		Expect(89);
		Expect(113);

#line  735 "VBNET.ATG" 
		newType.EndLocation = t.EndLocation; 
		Expect(1);
	}

	void FormalParameterList(
#line  1901 "VBNET.ATG" 
out ArrayList parameter) {

#line  1903 "VBNET.ATG" 
		parameter = new ArrayList();
		ParameterDeclarationExpression p;
		AttributeSection section;
		ArrayList attributes = new ArrayList();
		
		while (la.kind == 28) {
			AttributeSection(
#line  1908 "VBNET.ATG" 
out section);

#line  1908 "VBNET.ATG" 
			attributes.Add(section); 
		}
		FormalParameter(
#line  1910 "VBNET.ATG" 
out p);

#line  1912 "VBNET.ATG" 
		bool paramsFound = false;
		p.Attributes = attributes;
		parameter.Add(p);
		
		while (la.kind == 12) {
			lexer.NextToken();

#line  1917 "VBNET.ATG" 
			attributes = new ArrayList(); if (paramsFound) Error("params array must be at end of parameter list"); 
			while (la.kind == 28) {
				AttributeSection(
#line  1918 "VBNET.ATG" 
out section);

#line  1918 "VBNET.ATG" 
				attributes.Add(section); 
			}
			FormalParameter(
#line  1920 "VBNET.ATG" 
out p);

#line  1920 "VBNET.ATG" 
			p.Attributes = attributes; parameter.Add(p); 
		}
	}

	void TypeName(
#line  1735 "VBNET.ATG" 
out TypeReference typeref) {

#line  1737 "VBNET.ATG" 
		ArrayList rank = null;
		
		NonArrayTypeName(
#line  1739 "VBNET.ATG" 
out typeref);
		ArrayTypeModifiers(
#line  1740 "VBNET.ATG" 
out rank);

#line  1742 "VBNET.ATG" 
		typeref = new TypeReference(typeref == null ? "UNKNOWN" : typeref.Type, rank);
		
	}

	void MemberModifier(
#line  2705 "VBNET.ATG" 
Modifiers m) {
		switch (la.kind) {
		case 123: {
			lexer.NextToken();

#line  2706 "VBNET.ATG" 
			m.Add(Modifier.MustInherit);
			break;
		}
		case 80: {
			lexer.NextToken();

#line  2707 "VBNET.ATG" 
			m.Add(Modifier.Default);
			break;
		}
		case 100: {
			lexer.NextToken();

#line  2708 "VBNET.ATG" 
			m.Add(Modifier.Friend);
			break;
		}
		case 159: {
			lexer.NextToken();

#line  2709 "VBNET.ATG" 
			m.Add(Modifier.Shadows);
			break;
		}
		case 144: {
			lexer.NextToken();

#line  2710 "VBNET.ATG" 
			m.Add(Modifier.Overrides);
			break;
		}
		case 124: {
			lexer.NextToken();

#line  2711 "VBNET.ATG" 
			m.Add(Modifier.MustOverride);
			break;
		}
		case 147: {
			lexer.NextToken();

#line  2712 "VBNET.ATG" 
			m.Add(Modifier.Private);
			break;
		}
		case 149: {
			lexer.NextToken();

#line  2713 "VBNET.ATG" 
			m.Add(Modifier.Protected);
			break;
		}
		case 150: {
			lexer.NextToken();

#line  2714 "VBNET.ATG" 
			m.Add(Modifier.Public);
			break;
		}
		case 132: {
			lexer.NextToken();

#line  2715 "VBNET.ATG" 
			m.Add(Modifier.NotInheritable);
			break;
		}
		case 133: {
			lexer.NextToken();

#line  2716 "VBNET.ATG" 
			m.Add(Modifier.NotOverridable);
			break;
		}
		case 160: {
			lexer.NextToken();

#line  2717 "VBNET.ATG" 
			m.Add(Modifier.Shared);
			break;
		}
		case 142: {
			lexer.NextToken();

#line  2718 "VBNET.ATG" 
			m.Add(Modifier.Overridable);
			break;
		}
		case 141: {
			lexer.NextToken();

#line  2719 "VBNET.ATG" 
			m.Add(Modifier.Overloads);
			break;
		}
		case 152: {
			lexer.NextToken();

#line  2720 "VBNET.ATG" 
			m.Add(Modifier.ReadOnly);
			break;
		}
		case 186: {
			lexer.NextToken();

#line  2721 "VBNET.ATG" 
			m.Add(Modifier.WriteOnly);
			break;
		}
		case 185: {
			lexer.NextToken();

#line  2722 "VBNET.ATG" 
			m.Add(Modifier.WithEvents);
			break;
		}
		case 82: {
			lexer.NextToken();

#line  2723 "VBNET.ATG" 
			m.Add(Modifier.Dim);
			break;
		}
		default: SynErr(200); break;
		}
	}

	void ClassMemberDecl(
#line  858 "VBNET.ATG" 
Modifiers m, ArrayList attributes) {
		StructureMemberDecl(
#line  859 "VBNET.ATG" 
m, attributes);
	}

	void StructureMemberDecl(
#line  873 "VBNET.ATG" 
Modifiers m, ArrayList attributes) {

#line  875 "VBNET.ATG" 
		TypeReference type = null;
		ArrayList p = null;
		Statement stmt = null;
		ArrayList variableDeclarators = new ArrayList();
		
		switch (la.kind) {
		case 68: case 81: case 91: case 113: case 122: case 168: {
			NonModuleDeclaration(
#line  880 "VBNET.ATG" 
m, attributes);
			break;
		}
		case 169: {
			lexer.NextToken();

#line  884 "VBNET.ATG" 
			Point startPos = t.Location;
			
			if (StartOf(9)) {

#line  888 "VBNET.ATG" 
				string name = String.Empty;
				MethodDeclaration methodDeclaration;
				HandlesClause handlesClause = null;
				ImplementsClause implementsClause = null;
				
				Identifier();

#line  895 "VBNET.ATG" 
				name = t.val;
				m.Check(Modifier.Methods);
				
				if (la.kind == 25) {
					lexer.NextToken();
					if (StartOf(4)) {
						FormalParameterList(
#line  898 "VBNET.ATG" 
out p);
					}
					Expect(26);
				}
				if (la.kind == 106 || la.kind == 108) {
					if (la.kind == 108) {
						ImplementsClause(
#line  901 "VBNET.ATG" 
out implementsClause);
					} else {
						HandlesClause(
#line  903 "VBNET.ATG" 
out handlesClause);
					}
				}

#line  906 "VBNET.ATG" 
				Point endLocation = t.EndLocation; 
				Expect(1);
				if (
#line  910 "VBNET.ATG" 
IsMustOverride(m)) {

#line  912 "VBNET.ATG" 
					methodDeclaration = new MethodDeclaration(name, m.Modifier,  null, p, attributes);
					methodDeclaration.StartLocation = startPos;
					methodDeclaration.EndLocation   = endLocation;
					
					methodDeclaration.HandlesClause = handlesClause;
					methodDeclaration.ImplementsClause = implementsClause;
					
					compilationUnit.AddChild(methodDeclaration);
					
				} else if (StartOf(10)) {

#line  923 "VBNET.ATG" 
					methodDeclaration = new MethodDeclaration(name, m.Modifier,  null, p, attributes);
					methodDeclaration.StartLocation = startPos;
					methodDeclaration.EndLocation   = endLocation;
					
					methodDeclaration.HandlesClause = handlesClause;
					methodDeclaration.ImplementsClause = implementsClause;
					
					compilationUnit.AddChild(methodDeclaration);
					compilationUnit.BlockStart(methodDeclaration);
					
					Block(
#line  933 "VBNET.ATG" 
out stmt);

#line  935 "VBNET.ATG" 
					compilationUnit.BlockEnd();
					methodDeclaration.Body  = (BlockStatement)stmt;
					
					Expect(89);
					Expect(169);

#line  938 "VBNET.ATG" 
					methodDeclaration.Body.EndLocation = t.EndLocation; 
					Expect(1);
				} else SynErr(201);
			} else if (la.kind == 128) {
				lexer.NextToken();
				if (la.kind == 25) {
					lexer.NextToken();
					if (StartOf(4)) {
						FormalParameterList(
#line  941 "VBNET.ATG" 
out p);
					}
					Expect(26);
				}

#line  942 "VBNET.ATG" 
				m.Check(Modifier.Constructors); 

#line  943 "VBNET.ATG" 
				Point constructorEndLocation = t.EndLocation; 
				Expect(1);
				Block(
#line  945 "VBNET.ATG" 
out stmt);
				Expect(89);
				Expect(169);

#line  946 "VBNET.ATG" 
				Point endLocation = t.EndLocation; 
				Expect(1);

#line  948 "VBNET.ATG" 
				ConstructorDeclaration cd = new ConstructorDeclaration("New", m.Modifier, p, attributes); 
				cd.StartLocation = startPos;
				cd.EndLocation   = constructorEndLocation;
				cd.Body = (BlockStatement)stmt;
				cd.Body.EndLocation   = endLocation;
				compilationUnit.AddChild(cd);
				
			} else SynErr(202);
			break;
		}
		case 101: {
			lexer.NextToken();

#line  960 "VBNET.ATG" 
			m.Check(Modifier.Methods);
			string name = String.Empty;
			Point startPos = t.Location;
			MethodDeclaration methodDeclaration;
			HandlesClause handlesClause = null;
			ImplementsClause implementsClause = null;
			
			Identifier();

#line  967 "VBNET.ATG" 
			name = t.val; 
			if (la.kind == 25) {
				lexer.NextToken();
				if (StartOf(4)) {
					FormalParameterList(
#line  968 "VBNET.ATG" 
out p);
				}
				Expect(26);
			}
			if (la.kind == 49) {
				lexer.NextToken();
				TypeName(
#line  969 "VBNET.ATG" 
out type);
			}

#line  971 "VBNET.ATG" 
			if(type == null) {
			type = new TypeReference("System.Object");
			}
			
			if (la.kind == 106 || la.kind == 108) {
				if (la.kind == 108) {
					ImplementsClause(
#line  977 "VBNET.ATG" 
out implementsClause);
				} else {
					HandlesClause(
#line  979 "VBNET.ATG" 
out handlesClause);
				}
			}
			Expect(1);
			if (
#line  985 "VBNET.ATG" 
IsMustOverride(m)) {

#line  987 "VBNET.ATG" 
				methodDeclaration = new MethodDeclaration(name, m.Modifier,  type, p, attributes);
				methodDeclaration.StartLocation = startPos;
				methodDeclaration.EndLocation   = t.EndLocation;
				methodDeclaration.HandlesClause = handlesClause;
				methodDeclaration.ImplementsClause = implementsClause;
				compilationUnit.AddChild(methodDeclaration);
				
			} else if (StartOf(10)) {

#line  996 "VBNET.ATG" 
				methodDeclaration = new MethodDeclaration(name, m.Modifier,  type, p, attributes);
				methodDeclaration.StartLocation = startPos;
				methodDeclaration.EndLocation   = t.EndLocation;
				
				methodDeclaration.HandlesClause = handlesClause;
				methodDeclaration.ImplementsClause = implementsClause;
				
				compilationUnit.AddChild(methodDeclaration);
				compilationUnit.BlockStart(methodDeclaration);
				
				Block(
#line  1006 "VBNET.ATG" 
out stmt);

#line  1008 "VBNET.ATG" 
				compilationUnit.BlockEnd();
				methodDeclaration.Body  = (BlockStatement)stmt;
				
				Expect(89);
				Expect(101);

#line  1013 "VBNET.ATG" 
				methodDeclaration.Body.StartLocation = methodDeclaration.EndLocation;
				methodDeclaration.Body.EndLocation   = t.EndLocation;
				
				Expect(1);
			} else SynErr(203);
			break;
		}
		case 79: {
			lexer.NextToken();

#line  1022 "VBNET.ATG" 
			m.Check(Modifier.ExternalMethods);
			Point startPos = t.Location;
			CharsetModifier charsetModifer = CharsetModifier.None;
			string library = String.Empty;
			string alias = null;
			string name = String.Empty;
			
			if (StartOf(11)) {
				Charset(
#line  1029 "VBNET.ATG" 
out charsetModifer);
			}
			if (la.kind == 169) {
				lexer.NextToken();
				Identifier();

#line  1032 "VBNET.ATG" 
				name = t.val; 
				Expect(116);
				Expect(3);

#line  1033 "VBNET.ATG" 
				library = t.val; 
				if (la.kind == 45) {
					lexer.NextToken();
					Expect(3);

#line  1034 "VBNET.ATG" 
					alias = t.val; 
				}
				if (la.kind == 25) {
					lexer.NextToken();
					if (StartOf(4)) {
						FormalParameterList(
#line  1035 "VBNET.ATG" 
out p);
					}
					Expect(26);
				}
				Expect(1);

#line  1038 "VBNET.ATG" 
				DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, null, p, attributes, library, alias, charsetModifer);
				declareDeclaration.StartLocation = startPos;
				declareDeclaration.EndLocation   = t.EndLocation;
				compilationUnit.AddChild(declareDeclaration);
				
			} else if (la.kind == 101) {
				lexer.NextToken();
				Identifier();

#line  1045 "VBNET.ATG" 
				name = t.val; 
				Expect(116);
				Expect(3);

#line  1046 "VBNET.ATG" 
				library = t.val; 
				if (la.kind == 45) {
					lexer.NextToken();
					Expect(3);

#line  1047 "VBNET.ATG" 
					alias = t.val; 
				}
				if (la.kind == 25) {
					lexer.NextToken();
					if (StartOf(4)) {
						FormalParameterList(
#line  1048 "VBNET.ATG" 
out p);
					}
					Expect(26);
				}
				if (la.kind == 49) {
					lexer.NextToken();
					TypeName(
#line  1049 "VBNET.ATG" 
out type);
				}
				Expect(1);

#line  1052 "VBNET.ATG" 
				DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, type, p, attributes, library, alias, charsetModifer);
				declareDeclaration.StartLocation = startPos;
				declareDeclaration.EndLocation   = t.EndLocation;
				compilationUnit.AddChild(declareDeclaration);
				
			} else SynErr(204);
			break;
		}
		case 94: {
			lexer.NextToken();

#line  1062 "VBNET.ATG" 
			m.Check(Modifier.Events);
			Point startPos = t.Location;
			EventDeclaration eventDeclaration;
			string name = String.Empty;
			ImplementsClause implementsClause = null;
			
			Identifier();

#line  1068 "VBNET.ATG" 
			name= t.val; 
			if (la.kind == 49) {
				lexer.NextToken();
				TypeName(
#line  1070 "VBNET.ATG" 
out type);
			} else if (la.kind == 1 || la.kind == 25 || la.kind == 108) {
				if (la.kind == 25) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -