• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Coco.Graph类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中at.jku.ssw.Coco.Graph的典型用法代码示例。如果您正苦于以下问题:C# Graph类的具体用法?C# Graph怎么用?C# Graph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Graph类属于at.jku.ssw.Coco命名空间,在下文中一共展示了Graph类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TokenTerm

		static void TokenTerm(out Graph g) {
			Graph g2;
			TokenFactor(out g);
			while (StartOf(16)) {
				TokenFactor(out g2);
				Graph.MakeSequence(g, g2);
			}
			if (la.kind == 37) {
				Get();
				Expect(28);
				TokenExpr(out g2);
				Graph.SetContextTrans(g2.l); Graph.MakeSequence(g, g2);
				Expect(29);
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:15,代码来源:Parser.cs


示例2: Term

        void Term(out Graph g)
        {
            Graph g2; Node rslv = null; g = null;
            if (StartOf(19)) {
            if (la.kind == 44 || la.kind == 45) {
                if (la.kind == 44) {
                    rslv = tab.NewNode(Node.rslv, null, la.line, la.col);
                    Resolver(out rslv.pos);
                    g = new Graph(rslv);
                } else {
                    rslv = tab.NewNode(Node.expectedConflict, null, la.line, la.col);
                    ExpectedConflict(out rslv.pos, out rslv.conflictSymbols);
                    g = new Graph(rslv);
                }
            }
            Factor(out g2);
            if (rslv != null) tab.MakeSequence(g, g2);
              else g = g2;

            while (StartOf(20)) {
                Factor(out g2);
                tab.MakeSequence(g, g2);
            }
            } else if (StartOf(21)) {
            g = new Graph(tab.NewNode(Node.eps));
            } else SynErr(58);
            if (g == null) // invalid start of Term
            g = new Graph(tab.NewNode(Node.eps));
        }
开发者ID:dgrunwald,项目名称:coco-csharp,代码行数:29,代码来源:Parser.cs


示例3: TokenFactor

        void TokenFactor(out Graph g)
        {
            string name; int kind; g = null;
            if (la.kind == 1 || la.kind == 3 || la.kind == 5) {
            Sym(out name, out kind);
            if (kind == isIdent) {
                CharClass c = tab.FindCharClass(name);
                if (c == null) {
                  SemErr("undefined name");
                  c = tab.NewCharClass(name, new CharSet());
                }
                Node p = tab.NewNode(Node.clas); p.val = c.n;
                g = new Graph(p);
                tokenString = noString;
              } else { // str
                g = tab.StrToGraph(name);
                if (tokenString == null) tokenString = name;
                else tokenString = noString;
              }

            } else if (la.kind == 37) {
            Get();
            TokenExpr(out g);
            Expect(38);
            } else if (la.kind == 39) {
            Get();
            TokenExpr(out g);
            Expect(40);
            tab.MakeOption(g, t.line, 0); tokenString = noString;
            } else if (la.kind == 41) {
            Get();
            TokenExpr(out g);
            Expect(42);
            tab.MakeIteration(g, t.line, 0); tokenString = noString;
            } else SynErr(61);
            if (g == null) // invalid start of TokenFactor
             g = new Graph(tab.NewNode(Node.eps));
        }
开发者ID:dgrunwald,项目名称:coco-csharp,代码行数:38,代码来源:Parser.cs


示例4: Finish

	public void Finish(Graph g) {
		Node p = g.r;
		while (p != null) {
			Node q = p.next; p.next = null;
			p = q;
		}
	}
开发者ID:ggrov,项目名称:tacny,代码行数:7,代码来源:Tab.cs


示例5: Expression

        void Expression(out Graph g)
        {
            Graph g2;
            Term(out g);
            bool first = true;
            while (WeakSeparator(34,17,18) ) {
            Term(out g2);
            if (first) { tab.MakeFirstAlt(g); first = false; }
              tab.MakeAlternative(g, g2);

            }
        }
开发者ID:dgrunwald,项目名称:coco-csharp,代码行数:12,代码来源:Parser.cs


示例6: MakeAlternative

	// The result will be in g1
	public void MakeAlternative(Graph g1, Graph g2) {
		g2.l = NewNode(Node.alt, g2.l); g2.l.line = g2.l.sub.line;
		g2.l.up = true;
		g2.r.up = true;
		Node p = g1.l; while (p.down != null) p = p.down;
		p.down = g2.l;
		p = g1.r; while (p.next != null) p = p.next;
		// append alternative to g1 end list
		p.next = g2.l;
		// append g2 end list to g1 end list
		g2.l.next = g2.r;
	}
开发者ID:ggrov,项目名称:tacny,代码行数:13,代码来源:Tab.cs


示例7: MakeIteration

	public void MakeIteration(Graph g) {
		g.l = NewNode(Node.iter, g.l);
		g.r.up = true;
		Node p = g.r;
		g.r = g.l;
		while (p != null) {
			Node q = p.next; p.next = g.l;
			p = q;
		}
	}
开发者ID:ggrov,项目名称:tacny,代码行数:10,代码来源:Tab.cs


示例8: MakeIteration

 public void MakeIteration(Graph g, int line, int col)
 {
     g.l = NewNode(Node.iter, g.l);
     g.l.line = line; g.l.col = col;
     g.r.up = true;
     Node p = g.r;
     g.r = g.l;
     while (p != null) {
     Node q = p.next; p.next = g.l;
     p = q;
     }
 }
开发者ID:dgrunwald,项目名称:coco-csharp,代码行数:12,代码来源:Tab.cs


示例9: MakeOption

 public void MakeOption(Graph g, int line, int col)
 {
     g.l = NewNode(Node.opt, g.l);
     g.l.line = line; g.l.col = col;
     g.r.up = true;
     g.l.next = g.r;
     g.r = g.l;
 }
开发者ID:dgrunwald,项目名称:coco-csharp,代码行数:8,代码来源:Tab.cs


示例10: MakeOption

	public static void MakeOption(Graph g) {
		g.l = new Node(Node.opt, g.l);
		g.l.next = g.r;
		g.r = g.l;
	}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:5,代码来源:Tab.cs


示例11: StrToGraph

	public static Graph StrToGraph(string str) {
		string s = DFA.Unescape(str.Substring(1, str.Length-2));
		if (s.IndexOf('\0') >= 0) Parser.SemErr("\\0 not allowed here. Used as eof character");
		if (s.Length == 0) Parser.SemErr("empty token not allowed");
		Graph g = new Graph();
		g.r = dummyNode;
		for (int i = 0; i < s.Length; i++) {
			Node p = new Node(Node.chr, (int)s[i], 0);
			g.r.next = p; g.r = p;
		}
		g.l = dummyNode.next; dummyNode.next = null;
		return g;
	}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:13,代码来源:Tab.cs


示例12: MakeAlternative

	public static void MakeAlternative(Graph g1, Graph g2) {
		g2.l = new Node(Node.alt, g2.l); g2.l.line = g2.l.sub.line;
		Node p = g1.l; while (p.down != null) p = p.down;
		p.down = g2.l;
		p = g1.r; while (p.next != null) p = p.next;
		p.next = g2.r;
	}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:7,代码来源:Tab.cs


示例13: MakeFirstAlt

	public static void MakeFirstAlt(Graph g) {
		g.l = new Node(Node.alt, g.l); g.l.line = g.l.sub.line; /* AW 2002-03-07 make line available for error handling */
		g.l.next = g.r;
		g.r = g.l;
	}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:5,代码来源:Tab.cs


示例14: TokenFactor

		static void TokenFactor(out Graph g) {
			string name; int kind;
			g = new Graph();
			if (la.kind == 1 || la.kind == 3 || la.kind == 5) {
				Sym(out name, out kind);
				if (kind == id) {
					CharClass c = CharClass.Find(name);
					if (c == null) {
						SemErr("undefined name");
						c = new CharClass(name, new BitArray(CharClass.charSetSize));
					}
					Node p = new Node(Node.clas, null, 0); p.val = c.n;
					g = new Graph(p);
				} else g = Graph.StrToGraph(name);  // str
				
			} else if (la.kind == 28) {
				Get();
				TokenExpr(out g);
				Expect(29);
			} else if (la.kind == 30) {
				Get();
				TokenExpr(out g);
				Expect(31);
				Graph.MakeOption(g);
			} else if (la.kind == 32) {
				Get();
				TokenExpr(out g);
				Expect(33);
				Graph.MakeIteration(g);
			} else SynErr(54);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:31,代码来源:Parser.cs


示例15: Factor

	void Factor(
#line 341 "Coco.atg" //SOURCE beg=14902,len=11,col=8
								out Graph g
#line default //END SOURCE
) {

#line 341 "Coco.atg" //SOURCE beg=14930,len=137,col=36
																																				string name; int kind; Position pos; bool weak = false; 
                                   g = null;
                                 
#line default //END SOURCE
		switch (la.kind) {
		case _ident: case _string: case _char: case 30: {
			if (la.kind == 30) {
				Get();

#line 345 "Coco.atg" //SOURCE beg=15109,len=13,col=36
																																				weak = true; 
#line default //END SOURCE
			}
			Sym(
#line 347 "Coco.atg" //SOURCE beg=15137,len=18,col=7
							out name, out kind
#line default //END SOURCE
);

#line 347 "Coco.atg" //SOURCE beg=15166,len=1542,col=36
																																				Symbol sym = tab.FindSym(name);
                                   if (sym == null && kind == str)
                                     sym = tab.literals[name] as Symbol;
                                   bool undef = sym == null;
                                   if (undef) {
                                     if (kind == id)
                                       sym = tab.NewSym(Node.nt, name, 0);  // forward nt
                                     else if (genScanner) { 
                                       sym = tab.NewSym(Node.t, name, t.line);
                                       dfa.MatchLiteral(sym.name, sym);
                                     } else {  // undefined string in production
                                       SemErr("undefined string in production");
                                       sym = tab.eofSy;  // dummy
                                     }
                                   }
                                   int typ = sym.typ;
                                   if (typ != Node.t && typ != Node.nt)
                                     SemErr("this symbol kind is not allowed in a production");
                                   if (weak)
                                     if (typ == Node.t) typ = Node.wt;
                                     else SemErr("only terminals may be weak");
                                   Node p = tab.NewNode(typ, sym, t.line);
                                   g = new Graph(p);
                                 
#line default //END SOURCE
			if (la.kind == 25 || la.kind == 27) {
				Attribs(
#line 371 "Coco.atg" //SOURCE beg=16724,len=1,col=13
													p
#line default //END SOURCE
);

#line 371 "Coco.atg" //SOURCE beg=16747,len=62,col=36
																																				if (kind != id) SemErr("a literal must not have attributes"); 
#line default //END SOURCE
			}

#line 372 "Coco.atg" //SOURCE beg=16848,len=312,col=36
																																				if (undef)
                                     sym.attrPos = p.pos;  // dummy
                                   else if ((p.pos == null) != (sym.attrPos == null))
                                     SemErr("attribute mismatch between declaration and use of this symbol");
                                 
#line default //END SOURCE
			break;
		}
		case 31: {
			Get();
			Expression(
#line 377 "Coco.atg" //SOURCE beg=17181,len=5,col=18
																		out g
#line default //END SOURCE
);
			Expect(32);
			break;
		}
		case 33: {
			Get();
			Expression(
#line 378 "Coco.atg" //SOURCE beg=17210,len=5,col=18
																		out g
#line default //END SOURCE
);
			Expect(34);

#line 378 "Coco.atg" //SOURCE beg=17228,len=19,col=36
																																				tab.MakeOption(g); 
#line default //END SOURCE
			break;
		}
		case 35: {
			Get();
			Expression(
//.........这里部分代码省略.........
开发者ID:SealedSun,项目名称:prx,代码行数:101,代码来源:Parser.cs


示例16: Term

	void Term(out Graph g) {
		Graph g2; Node rslv = null; g = null; 
		if (StartOf(17)) {
			if (la.kind == 37) {
				rslv = tab.NewNode(Node.rslv, null, la.line); 
				Resolver(out rslv.pos);
				g = new Graph(rslv); 
			}
			Factor(out g2);
			if (rslv != null) tab.MakeSequence(g, g2);
			else g = g2;
			
			while (StartOf(18)) {
				Factor(out g2);
				tab.MakeSequence(g, g2); 
			}
		} else if (StartOf(19)) {
			g = new Graph(tab.NewNode(Node.eps, null, 0)); 
		} else SynErr(48);
		if (g == null) // invalid start of Term
		 g = new Graph(tab.NewNode(Node.eps, null, 0));
		
	}
开发者ID:ggrov,项目名称:tacny,代码行数:23,代码来源:Parser.cs


示例17: MakeFirstAlt

	public void MakeFirstAlt(Graph g) {
		g.l = NewNode(Node.alt, g.l); g.l.line = g.l.sub.line;
		g.r.up = true;
		g.l.next = g.r;
		g.r = g.l;
	}
开发者ID:ggrov,项目名称:tacny,代码行数:6,代码来源:Tab.cs


示例18: Factor

	void Factor(out Graph g) {
		string name; int kind; Position pos; bool weak = false; 
		g = null;
		
		switch (la.kind) {
		case 1: case 3: case 5: case 29: {
			if (la.kind == 29) {
				Get();
				weak = true; 
			}
			Sym(out name, out kind);
			Symbol sym = tab.FindSym(name);
			if (sym == null && kind == str)
			  sym = tab.literals[name] as Symbol;
			bool undef = sym == null;
			if (undef) {
			  if (kind == id)
			    sym = tab.NewSym(Node.nt, name, 0);  // forward nt
			  else if (genScanner) { 
			    sym = tab.NewSym(Node.t, name, t.line);
			    dfa.MatchLiteral(sym.name, sym);
			  } else {  // undefined string in production
			    SemErr("undefined string in production");
			    sym = tab.eofSy;  // dummy
			  }
			}
			int typ = sym.typ;
			if (typ != Node.t && typ != Node.nt)
			  SemErr("this symbol kind is not allowed in a production");
			if (weak)
			  if (typ == Node.t) typ = Node.wt;
			  else SemErr("only terminals may be weak");
			Node p = tab.NewNode(typ, sym, t.line);
			g = new Graph(p);
			
			if (la.kind == 24 || la.kind == 26) {
				Attribs(p);
				if (kind != id) SemErr("a literal must not have attributes"); 
			}
			if (undef)
			 sym.attrPos = p.pos;  // dummy
			else if ((p.pos == null) != (sym.attrPos == null))
			  SemErr("attribute mismatch between declaration and use of this symbol");
			
			break;
		}
		case 30: {
			Get();
			Expression(out g);
			Expect(31);
			break;
		}
		case 32: {
			Get();
			Expression(out g);
			Expect(33);
			tab.MakeOption(g); 
			break;
		}
		case 34: {
			Get();
			Expression(out g);
			Expect(35);
			tab.MakeIteration(g); 
			break;
		}
		case 39: {
			SemText(out pos);
			Node p = tab.NewNode(Node.sem, null, 0);
			p.pos = pos;
			g = new Graph(p);
			
			break;
		}
		case 23: {
			Get();
			Node p = tab.NewNode(Node.any, null, 0);  // p.set is set in tab.SetupAnys
			g = new Graph(p);
			
			break;
		}
		case 36: {
			Get();
			Node p = tab.NewNode(Node.sync, null, 0);
			g = new Graph(p);
			
			break;
		}
		default: SynErr(49); break;
		}
		if (g == null) // invalid start of Factor
		 g = new Graph(tab.NewNode(Node.eps, null, 0));
		
	}
开发者ID:ggrov,项目名称:tacny,代码行数:94,代码来源:Parser.cs


示例19: MakeSequence

	// The result will be in g1
	public void MakeSequence(Graph g1, Graph g2) {
		Node p = g1.r.next; g1.r.next = g2.l; // link head node
		while (p != null) {  // link substructure
			Node q = p.next; p.next = g2.l;
			p = q;
		}
		g1.r = g2.r;
	}
开发者ID:ggrov,项目名称:tacny,代码行数:9,代码来源:Tab.cs


示例20: TokenTerm

	void TokenTerm(
#line 422 "Coco.atg" //SOURCE beg=19117,len=11,col=11
											out Graph g
#line default //END SOURCE
) {

#line 422 "Coco.atg" //SOURCE beg=19142,len=10,col=36
																																				Graph g2; 
#line default //END SOURCE
		TokenFactor(
#line 424 "Coco.atg" //SOURCE beg=19173,len=5,col=15
															out g
#line default //END SOURCE
);
		while (StartOf(7)) {
			TokenFactor(
#line 425 "Coco.atg" //SOURCE beg=19197,len=6,col=17
																	out g2
#line default //END SOURCE
);

#line 425 "Coco.atg" //SOURCE beg=19216,len=25,col=36
																																				tab.MakeSequence(g, g2); 
#line default //END SOURCE
		}
		if (la.kind == 39) {
			Get();
			Expect(31);
			TokenExpr(
#line 428 "Coco.atg" //SOURCE beg=19283,len=6,col=19
																			out g2
#line default //END SOURCE
);

#line 428 "Coco.atg" //SOURCE beg=19300,len=112,col=36
																																				tab.SetContextTrans(g2.l); dfa.hasCtxMoves = true;
                                   tab.MakeSequence(g, g2); 
#line default //END SOURCE
			Expect(32);
		}
	}
开发者ID:SealedSun,项目名称:prx,代码行数:41,代码来源:Parser.cs



注:本文中的at.jku.ssw.Coco.Graph类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Coco.Node类代码示例发布时间:2022-05-26
下一篇:
C# Coco.CharSet类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap