当前位置: 首页>>代码示例>>C#>>正文


C# ICompiler.NewLink方法代码示例

本文整理汇总了C#中ICompiler.NewLink方法的典型用法代码示例。如果您正苦于以下问题:C# ICompiler.NewLink方法的具体用法?C# ICompiler.NewLink怎么用?C# ICompiler.NewLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICompiler的用法示例。


在下文中一共展示了ICompiler.NewLink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Compile

		public override void Compile (ICompiler cmp, bool reverse) {
			//			LinkRef next = cmp.NewLink ();
			LinkRef tail = cmp.NewLink ();

			foreach (Expression e in Alternatives) {
				LinkRef next = cmp.NewLink ();
				cmp.EmitBranch (next);
				e.Compile (cmp, reverse);
				cmp.EmitJumpTest (tail, next);
				cmp.ResolveLink (next);
				cmp.EmitBranchEnd();
			}

			cmp.EmitFalse ();
			cmp.ResolveLink (tail);
			cmp.EmitAlternationEnd();
		}
开发者ID:carrie901,项目名称:mono,代码行数:17,代码来源:syntax.cs

示例2: Compile

		public override void Compile (ICompiler cmp, bool reverse) {
			// create the meta-collection
			IntervalCollection meta =
				intervals.GetMetaCollection (new IntervalCollection.CostDelegate (GetIntervalCost));

			// count ops
			
			int count = meta.Count;
			for (int i = 0; i < pos_cats.Length; ++ i) {
				// use BitArray.Get instead of indexer for speedups
				//if (pos_cats[i]) ++ count;
				//if (neg_cats[i]) ++ count;
				if (pos_cats.Get(i)) ++ count;
				if (neg_cats.Get(i)) ++ count;
			}

			if (count == 0)
				return;

			// emit in op for |meta| > 1

			LinkRef tail = cmp.NewLink ();
			if (count > 1)
				cmp.EmitIn (tail);
				

			// emit categories

			for (int i = 0; i < pos_cats.Length; ++ i) {
				// use BitArray.Get instead of indexer for speedups
				//if (pos_cats[i]) {
				if (pos_cats.Get(i)) {
					//if (neg_cats [i])
					if (neg_cats.Get(i))
						cmp.EmitCategory (Category.AnySingleline, negate, reverse);
					else
						cmp.EmitCategory ((Category)i, negate, reverse);
//				} else if (neg_cats[i]) {
				} else if (neg_cats.Get(i)) {
					cmp.EmitCategory ((Category)i, !negate, reverse);
				}
			}

			// emit character/range/sets from meta-collection

			foreach (Interval a in meta) {
				if (a.IsDiscontiguous) {			// Set
					BitArray bits = new BitArray (a.Size);
					foreach (Interval b in intervals) {
						if (a.Contains (b)) {
							for (int i = b.low; i <= b.high; ++ i)
								// use BitArray.Get instead of indexer for speedups : bits[i - a.low] = true;
								bits.Set( i - a.low, true );
						}
					}

					cmp.EmitSet ((char)a.low, bits, negate, ignore, reverse);
				}
				else if (a.IsSingleton)				// Character
					cmp.EmitCharacter ((char)a.low, negate, ignore, reverse);
				else						// Range
					cmp.EmitRange ((char)a.low, (char)a.high, negate, ignore, reverse);
			}
			
			// finish up

			if (count > 1) {
				if (negate)
					cmp.EmitTrue ();
				else
					cmp.EmitFalse ();

				cmp.ResolveLink (tail);
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:75,代码来源:syntax.cs


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