protected override void OnRenderNext(RegExpr defaultTokenWs, RegExpr parent, StringBuilder pattern, ref RenderMode mode, Stack <Token> tokenStack) { base.OnRenderNext(defaultTokenWs, parent, pattern, ref mode, tokenStack); var tokenWs = GetTokenWhitespace(defaultTokenWs); if (NeedsWhitespaceGroup(tokenWs, mode)) { pattern.Append(")"); } if (Expr != null) { if (!mode.HasFlag(RenderMode.Assert) && !string.IsNullOrEmpty(Id)) { string captureId = GenerateCaptureId(Id); Parents.Add(captureId, tokenStack.Peek()); tokenStack.Peek().Children.Add(this); pattern.AppendFormat("(?<{0}>", captureId); } else { pattern.Append("(?:"); } } tokenStack.Push(this); }
private void DrawFace(Vector3 v1, Vector3 v2, Vector3 v3, uint triangleColor, uint edgeColor, int[] zBuffer, RenderMode renderMode, bool backfaceCulling) { Vec3i s1 = CalculateScreenCoordinates(v1); Vec3i s2 = CalculateScreenCoordinates(v2); Vec3i s3 = CalculateScreenCoordinates(v3); if (!backfaceCulling && renderMode.HasFlag(RenderMode.Solid)) { DrawTriangle(s1, s2, s3, triangleColor, ref zBuffer); } if (renderMode.HasFlag(RenderMode.Wireframe)) { DrawLine(s1, s2, edgeColor); DrawLine(s2, s3, edgeColor); DrawLine(s3, s1, edgeColor); } }
protected override void OnRenderNext(RegExpr defaultTokenWs, RegExpr parent, StringBuilder pattern, ref RenderMode mode) { base.OnRenderNext(defaultTokenWs, parent, pattern, ref mode); var tokenWs = GetTokenWhitespace(defaultTokenWs); if (NeedsWhitespaceGroup(tokenWs, mode)) { pattern.Append(")"); } if (Expr != null) { if (!mode.HasFlag(RenderMode.Assert) && !string.IsNullOrEmpty(Id)) { pattern.AppendFormat("(?<{0}>", CaptureId); } else { pattern.Append("(?:"); } } }
protected override IEnumerable <RegExpr> OnRender(RegExpr defaultTokenWs, RegExpr parent, StringBuilder pattern, ref RenderMode mode) { base.OnRender(defaultTokenWs, parent, pattern, ref mode); if (mode.HasFlag(RenderMode.Assert)) { throw new NestedAssertException(); } switch (Context) { case AssertLook.Ahead: if (Negative) { pattern.Append("(?!"); } else { pattern.Append("(?="); } break; case AssertLook.Behind: if (Negative) { pattern.Append("(?<!"); } else { pattern.Append("(?<="); } break; } mode |= RenderMode.Assert; return(Items(Expr)); }
bool NeedsWhitespaceGroup(RegExpr tokenWs, RenderMode mode) { return(tokenWs != null && !mode.HasFlag(RenderMode.Assert) && (tokenWs is RegExprLiteral || tokenWs is RegExprSequence)); }