public override void VisitAttribute(VersionCondition vis) { if (vis.VersionIdHash == DTokens.IncompleteIdHash) { halt = true; prv = new VersionSpecificationCompletionProvider(cdgen); } else { base.VisitAttribute(vis); } }
/// <summary> /// Vegleicht zwei Versionen /// </summary> /// <param name="Then">Version als String (Bspl: 1.0.0.0)</param> /// <param name="Other">Version als String (Bspl: 1.0.0.0)</param> /// <param name="Condition">Vergleichsoperator</param> /// <returns>True, wenn die Bedingung erfüllt wird</returns> public static bool CompareVersion(string Then, string Other, VersionCondition Condition) { bool returnValue = false; Version v1 = null; Version v2 = null; try { v1 = Version.Parse(Then); v2 = Version.Parse(Other); } catch { throw new Exception(String.Format("Die Versionen konnten nicht in System.Version gecastet werden: {0} / {1}", Then, Other)); } switch (Condition) { case VersionCondition.Equal: returnValue = v1 == v2; break; case VersionCondition.Greater: returnValue = v1 > v2; break; case VersionCondition.Smaller: returnValue = v1 < v2; break; case VersionCondition.GreaterEqual: returnValue = v1 >= v2; break; case VersionCondition.SmallerEqual: returnValue = v1 <= v2; break; } return(returnValue); }
public virtual void VisitAttribute(VersionCondition vis) { }
/// <summary> /// Vegleicht zwei Versionen /// </summary> /// <param name="Then">Version als System.Version (Bspl: 1.0.0.0)</param> /// <param name="Other">Version als String (Bspl: 1.0.0.0)</param> /// <param name="Condition">Vergleichsoperator</param> /// <returns>True, wenn die Bedingung erfüllt wird</returns> public static bool CompareVersion(Version Then, string Other, VersionCondition Condition) { return(CompareVersion(Then.ToString(), Other, Condition)); }
public string VisitAttribute(VersionCondition a) { throw new NotImplementedException(); }
public override void VisitAttribute(VersionCondition vis) { }
DeclarationCondition Condition(IBlockNode parent) { DeclarationCondition c = null; switch (laKind) { case Version: /* * http://www.dlang.org/version.html#VersionSpecification * VersionCondition: * version ( IntegerLiteral ) * version ( Identifier ) * version ( unittest ) * version ( assert ) */ Step (); if (Expect (OpenParenthesis)) { switch (laKind) { case Unittest: Step (); c = new VersionCondition ("unittest") { IdLocation = t.Location }; break; case Assert: Step (); c = new VersionCondition ("assert") { IdLocation = t.Location }; break; case Literal: Step (); if (t.LiteralFormat != LiteralFormat.Scalar) SynErr (t.Kind, "Version number must be an integer"); else c = new VersionCondition (Convert.ToInt32 (t.LiteralValue)) { IdLocation = t.Location }; break; default: if (Expect (Identifier)) c = new VersionCondition (t.Value) { IdLocation = t.Location }; else if (IsEOF) { c = new VersionCondition (DTokens.IncompleteId); parent.Add (new DVariable{ Attributes = new List<DAttribute>{ c } }); } break; } Expect (CloseParenthesis); } if (c == null) c = new VersionCondition (""); break; case Debug: /* * DebugCondition: * debug * debug ( IntegerLiteral ) * debug ( Identifier ) */ Step (); if (laKind == OpenParenthesis) { Step (); if (laKind == Literal) { Step (); if (t.LiteralFormat != LiteralFormat.Scalar) SynErr (t.Kind, "Debug level must be an integer"); else c = new DebugCondition (Convert.ToInt32 (t.LiteralValue)) { IdLocation = t.Location }; } else if (Expect (Identifier)) c = new DebugCondition ((string)t.LiteralValue) { IdLocation = t.Location }; else if (IsEOF) { c = new DebugCondition (DTokens.IncompleteId); parent.Add (new DVariable{ Attributes = new List<DAttribute>{ c } }); } Expect (CloseParenthesis); } if (c == null) c = new DebugCondition (); break; case Static: /* * StaticIfCondition: * static if ( AssignExpression ) */ Step (); if (Expect (If) && Expect (OpenParenthesis)) { var x = AssignExpression (parent); c = new StaticIfCondition (x); if (!Expect (CloseParenthesis) && IsEOF) parent.Add (new DVariable{ Attributes = new List<DAttribute>{ c } }); } else c = new StaticIfCondition (null); break; default: throw new Exception("Condition() should only be called if Version/Debug/If is the next token!"); } return c; }
public AbstractType VisitAttribute(VersionCondition a) { throw new NotImplementedException(); }
DeclarationCondition Condition(IBlockNode parent) { DeclarationCondition c = null; /* * http://www.dlang.org/version.html#VersionSpecification * VersionCondition: * version ( IntegerLiteral ) * version ( Identifier ) * version ( unittest ) * version ( assert ) */ if (laKind == Version) { Step(); if (Expect(OpenParenthesis)) { TrackerVariables.ExpectingIdentifier = true; if (laKind == Unittest) { Step(); c = new VersionCondition("unittest") { IdLocation = t.Location }; } else if (laKind == Assert) { Step(); c = new VersionCondition("assert") { IdLocation = t.Location }; } else if (laKind == Literal) { Step(); if (t.LiteralFormat != LiteralFormat.Scalar) SynErr(t.Kind, "Version number must be an integer"); else c = new VersionCondition(Convert.ToInt32(t.LiteralValue)) { IdLocation = t.Location }; } else if (Expect(Identifier)) c = new VersionCondition(t.Value) { IdLocation = t.Location }; if (Expect(CloseParenthesis)) TrackerVariables.ExpectingIdentifier = false; } if(c==null) c = new VersionCondition(""); } /* * DebugCondition: * debug * debug ( IntegerLiteral ) * debug ( Identifier ) */ else if (laKind == Debug) { Step(); if (laKind == OpenParenthesis) { Step(); TrackerVariables.ExpectingIdentifier = true; if (laKind == Literal) { Step(); if (t.LiteralFormat != LiteralFormat.Scalar) SynErr(t.Kind, "Debug level must be an integer"); else c = new DebugCondition(Convert.ToInt32(t.LiteralValue)) { IdLocation = t.Location }; } else if (Expect(Identifier)) c = new DebugCondition((string)t.LiteralValue) { IdLocation = t.Location }; else c = new DebugCondition(); if (Expect(CloseParenthesis)) TrackerVariables.ExpectingIdentifier = false; } else c = new DebugCondition(); } /* * StaticIfCondition: * static if ( AssignExpression ) */ else if (laKind == Static) { Step (); if (Expect (If) && Expect(OpenParenthesis)) { var x = AssignExpression(parent); c = new StaticIfCondition(x); Expect(CloseParenthesis); } else c = new StaticIfCondition(null); } else throw new Exception("Condition() should only be called if Version/Debug/If is the next token!"); LastParsedObject = c; return c; }
public override void VisitAttribute(VersionCondition vis) { if (vis.VersionIdHash == DTokens.IncompleteIdHash) { halt = true; prv = new AttributeCompletionProvider (cdgen){ Attribute = vis }; } else base.VisitAttribute (vis); }
public ulong VisitAttribute(VersionCondition a) { return(1000193 + (a.VersionIdHash == 0 ? a.VersionNumber : (ulong)a.VersionIdHash) << 32); }
public CompletionItemKind VisitAttribute(VersionCondition a) { throw new NotImplementedException(); }