예제 #1
0
		public DestinationDelegate this[Minor c] {
			get {
				return callbacks[(int)c];
			}

			set {
				callbacks[(int)c] = value;
			}
		}
예제 #2
0
 public override string ToString()
 {
     return(string.Format(
                "{0}.{1}.{2}.{3}",
                Major.ToString().PadLeft(2, '0'),
                Minor.ToString().PadLeft(2, '0'),
                Revision.ToString().PadLeft(2, '0'),
                Build.ToString().PadLeft(4, '0')
                ));
 }
예제 #3
0
		public RTFException(RTF rtf, string error_message) {
			this.pos = rtf.LinePos;
			this.line = rtf.LineNumber;
			this.token_class = rtf.TokenClass;
			this.major = rtf.Major;
			this.minor = rtf.Minor;
			this.param = rtf.Param;
			this.text = rtf.Text;
			this.error_message = error_message;
		}
예제 #4
0
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hash = 17;
         hash = hash * 23 + Major.GetHashCode();
         hash = hash * 23 + Minor.GetHashCode();
         hash = hash * 23 + Patch.GetHashCode();
         return(hash);
     }
 }
 public RTFException(RTF rtf, string error_message)
 {
     this.pos           = rtf.LinePos;
     this.line          = rtf.LineNumber;
     this.token_class   = rtf.TokenClass;
     this.major         = rtf.Major;
     this.minor         = rtf.Minor;
     this.param         = rtf.Param;
     this.text          = rtf.Text;
     this.error_message = error_message;
 }
            public override string ToString()
            {
                var version = $"{Major?.ToString() ?? Wildcard}.{Minor?.ToString() ?? Wildcard}.{Patch?.ToString() ?? Wildcard}";

                if (Suffix != null)
                {
                    version = $"{version}{SuffixSeparator}{Suffix}";
                }

                return(version);
            }
예제 #7
0
            public override int GetHashCode()
            {
                return(Patch.GetHashCode() ^ ROL(Minor.GetHashCode(), 10) ^ ROL(Major.GetHashCode(), 20) ^ Name.GetHashCode());

                int ROL(int value, int bits)
                {
                    uint val = (uint)value;

                    return((int)((val << bits) | (val >> (32 - bits))));
                }
            }
예제 #8
0
 /// <summary>
 /// Gets a hash code for this version
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + Major.GetHashCode();
         hash = hash * 23 + Minor.GetHashCode();
         hash = hash * 23 + Patch.GetHashCode();
         return(hash);
     }
 }
예제 #9
0
 public override int GetHashCode()
 {
     unchecked
     {
         var result = Major.GetHashCode();
         result = result * 31 + Minor.GetHashCode();
         result = result * 31 + Patch.GetHashCode();
         result = result * 31 + Prerelease.GetHashCode();
         return(result);
     }
 }
예제 #10
0
        public override int GetHashCode()
        {
            int hashCode = 84185362;

            hashCode = (hashCode * -1521134295) + EqualityComparer <string> .Default.GetHashCode(PublisherID);

            hashCode = (hashCode * -1521134295) + DataSetWriterID.GetHashCode();
            hashCode = (hashCode * -1521134295) + Major.GetHashCode();
            hashCode = (hashCode * -1521134295) + Minor.GetHashCode();
            return(hashCode);
        }
예제 #11
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Major.GetHashCode();
         hashCode = (hashCode * 397) ^ Minor.GetHashCode();
         hashCode = (hashCode * 397) ^ Build.GetHashCode();
         hashCode = (hashCode * 397) ^ Revision.GetHashCode();
         return(hashCode);
     }
 }
예제 #12
0
        public override int GetHashCode()
        {
            int hash = 17;

            hash = hash * 23 + Major.GetHashCode();
            hash = hash * 23 + Minor.GetHashCode();
            hash = hash * 23 + Patch.GetHashCode();
            hash = hash * 23 + Build.GetHashCode();
            hash = hash * 23 + (Special != null ? Special.GetHashCode() : 0);
            return(hash);
        }
예제 #13
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Version != null ? Version.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Major != null ? Major.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Minor != null ? Minor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Patch != null ? Patch.GetHashCode() : 0);
         return(hashCode);
     }
 }
예제 #14
0
        public int CompareTo(LanguageVersion other)
        {
            var results = new[]
            {
                Major.CompareTo(other.Major),
                Minor.CompareTo(other.Minor)
            };

            return(results
                   .SkipWhile(diff => diff == 0)
                   .FirstOrDefault());
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hash = 17;
         hash = hash * 23 + Major.GetHashCode();
         hash = hash * 23 + Minor.GetHashCode();
         hash = hash * 23 + Build.GetHashCode();
         hash = hash * 23 + Revision.GetHashCode();
         return(hash);
     }
 }
예제 #16
0
        public DestinationDelegate this[Minor c]
        {
            get
            {
                return(callbacks[(int)c]);
            }

            set
            {
                callbacks[(int)c] = value;
            }
        }
예제 #17
0
        public override string ToString()
        {
            StringBuilder objString = new StringBuilder();

            objString.AppendLine("Major: " + Major.ToString());
            objString.AppendLine("Minor: " + Minor.ToString());
            objString.AppendLine("Build: " + Build.ToString());
            objString.AppendLine("Revision: " + Revision.ToString());
            objString.AppendLine("Number: " + Number);

            return(objString.ToString());
        }
예제 #18
0
 public override int GetHashCode()
 {
     unchecked
     {
         var result = Major.GetHashCode();
         result = result * 31 + Minor.GetHashCode();
         result = result * 31 + Patch.GetHashCode();
         result = result * 31 + (Prerelease?.GetHashCode() ?? string.Empty.GetHashCode());
         result = result * 31 + (Build?.GetHashCode() ?? string.Empty.GetHashCode());
         return(result);
     }
 }
예제 #19
0
            public override int GetHashCode()
            {
                var hashCode = Major.GetHashCode();

                hashCode = (hashCode * 397) ^ Minor.GetHashCode();
                hashCode = (hashCode * 397) ^ Patch.GetHashCode();
                if (!string.IsNullOrWhiteSpace(Prerelease))
                {
                    hashCode = (hashCode * 397) ^ Prerelease.GetHashCode();
                }
                return(hashCode);
            }
예제 #20
0
        /// <summary>
        /// Compare this beacon to an other instance.
        /// </summary>
        /// <param name="obj">The other instance.</param>
        /// <returns>A value that indicates the lexical relationship between the two comparands.</returns>
        public int CompareTo(object obj)
        {
            var other = obj as Beacon;

            if (other == null)
            {
                throw new ArgumentException("Must be of type Beacon", "obj");
            }
            return(Uuid.NullableCompareTo(other.Uuid)
                   ?? Major.NullableCompareTo(other.Major)
                   ?? Minor.CompareTo(other.Minor));
        }
예제 #21
0
        public int CompareTo(VersionInfo other)
        {
            int majorCompare = Major.CompareTo(other?.Major);

            if (majorCompare != 0)
            {
                return(majorCompare);
            }

            int minorCompare = Minor.CompareTo(other?.Minor);

            if (minorCompare != 0)
            {
                return(minorCompare);
            }

            int patchCompare = Patch.CompareTo(other?.Patch);

            if (patchCompare != 0)
            {
                return(patchCompare);
            }

            int revisionCompare = BuildNumber.CompareTo(other?.BuildNumber);

            if (revisionCompare != 0)
            {
                return(revisionCompare);
            }

            if (BuildNumber == 0 && other?.BuildNumber == 0)
            {
                if (!IsBasedOnDevMark && other.IsBasedOnDevMark)
                {
                    return(1);
                }
                else if (IsBasedOnDevMark && !other.IsBasedOnDevMark)
                {
                    return(-1);
                }
            }

            string preReleaseTag      = PreReleaseTag ?? string.Empty;
            string otherPreReleaseTag = other?.PreReleaseTag ?? string.Empty;

            if (preReleaseTag != otherPreReleaseTag)
            {
                return(preReleaseTag.CompareTo(otherPreReleaseTag));
            }

            return(0);
        }
예제 #22
0
    public int CompareTo(BuildVersion other)
    {
        if ((Revision == 0) && (other.Revision == 0))
        {
            if (!IsDevMark && other.IsDevMark)
            {
                return(-1);
            }
            else if (IsDevMark && !other.IsDevMark)
            {
                return(1);
            }
        }

        int majorCompare = Major.CompareTo(other.Major);

        if (majorCompare != 0)
        {
            return(majorCompare);
        }

        int minorCompare = Minor.CompareTo(other.Minor);

        if (minorCompare != 0)
        {
            return(minorCompare);
        }

        int patchCompare = Patch.CompareTo(other.Patch);

        if (patchCompare != 0)
        {
            return(patchCompare);
        }

        int revisionCompare = Revision.CompareTo(other.Revision);

        if (revisionCompare != 0)
        {
            return(revisionCompare);
        }

        string normTag      = Tag ?? string.Empty;
        string normOtherTag = other.Tag ?? string.Empty;

        if (normTag != normOtherTag)
        {
            return(normTag.CompareTo(normOtherTag));
        }

        return(0);
    }
예제 #23
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = Major.GetHashCode();
         result = result * 31 + Minor.GetHashCode();
         result = result * 31 + Revision.GetHashCode();
         result = result * 31 + GetReleaseTypeHashCode(ReleaseType);
         result = result * 31 + IncrementalVersion.GetHashCode();
         // We do not compare the suffix, so we do not hash it either
         return(result);
     }
 }
예제 #24
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 /// <returns>
 /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
 /// </returns>
 public override int GetHashCode()
 {
     unchecked
     {
         // verify this. Some versions start result = 17. Some use 37 instead of 31
         int result = Major.GetHashCode();
         result = result * 31 + Minor.GetHashCode();
         result = result * 31 + Patch.GetHashCode();
         result = result * 31 + Prerelease.GetHashCode();
         result = result * 31 + Build.GetHashCode();
         return(result);
     }
 }
예제 #25
0
        public override int GetHashCode()
        {
            int hash = Major.GetHashCode();

            unchecked
            {
                hash += 17 * Minor.GetHashCode();
                hash += 23 * Build.GetHashCode();
                hash += 29 * (int)Type;
                hash += 31 * TypeNumber;
            }
            return(hash);
        }
예제 #26
0
        public void Write(BinaryWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            writer.Write(Major.ToBytes());
            writer.Write(MajorRevision.ToBytes());
            writer.Write(Minor.ToBytes());
            writer.Write(MinorRevision.ToBytes());
            writer.Write(ProcessId.ToBytes());
        }
예제 #27
0
        public int CompareTo(SdkVersionInfo other)
        {
            var majorComparison = Major.CompareTo(other.Major);

            if (majorComparison != 0)
            {
                return(majorComparison);
            }

            var minorComparison = Minor.CompareTo(other.Minor);

            if (minorComparison != 0)
            {
                return(minorComparison);
            }

            var featureComparison = Feature.CompareTo(other.Feature);

            if (featureComparison != 0)
            {
                return(featureComparison);
            }

            var patchComparison = Patch.CompareTo(other.Patch);

            if (patchComparison != 0)
            {
                return(patchComparison);
            }

            // 3.1.100-preview1-01445 is lesser than 3.1.100
            if (IsPrerelease && !other.IsPrerelease)
            {
                return(-1);
            }

            if (!IsPrerelease && other.IsPrerelease)
            {
                return(1);
            }

            if (IsPrerelease && other.IsPrerelease)
            {
                // We are not parsing the preview part here and are only using string comparison
                // One more thing to complicate thing is that the preview part format has changed between
                // 3.* and 5.*, so this comparison is just fine.
                return(string.Compare(PrereleaseVersion, other.PrereleaseVersion, ignoreCase: true));
            }

            return(0);
        }
예제 #28
0
        /// <summary>
        /// Serves as a hash function for the objects of <see cref="SemanticVersion"/> and its derived types.
        /// </summary>
        /// <returns>A hash code for the current <see cref="SemanticVersion"/> instance.</returns>
        public override int GetHashCode()
        {
            var hashCode = Constants.HashInitializer;

            unchecked
            {
                hashCode = Constants.HashMultiplier * hashCode + Major.GetHashCode();
                hashCode = Constants.HashMultiplier * hashCode + Minor.GetHashCode();
                hashCode = Constants.HashMultiplier * hashCode + Patch.GetHashCode();
                hashCode = Constants.HashMultiplier * hashCode + (Prerelease?.GetHashCode() ?? 0);
            }

            return(hashCode);
        }
예제 #29
0
        /// <summary>
        /// Returns string representation of the version in format <c>0.0.0</c> or <c>*</c>, depending on <see cref="PartsCount"/>
        /// </summary>
        public override string ToString()
        {
            string majorstr = Major < 0 ? "*" : Major.ToString();
            string minorstr = Minor < 0 ? "*" : Minor.ToString();
            string buildstr = Build < 0 ? "*" : Build.ToString();

            return(PartsCount switch
            {
                0 => "",
                1 => $"{majorstr}",
                2 => $"{majorstr}.{minorstr}",
                3 => $"{majorstr}.{minorstr}.{buildstr}",
                _ => throw new ArgumentException(),
            });
예제 #30
0
            public int CompareTo(VersionInfo vi)
            {
                int cmp = 1;

                if (!object.ReferenceEquals(vi, null))
                {
                    cmp = Major.CompareTo(vi.Major);
                    if (cmp == 0)
                    {
                        cmp = Minor.CompareTo(vi.Minor);
                    }
                }
                return(cmp);
            }
예제 #31
0
        public void Minor()
        {
            var policy = new Minor();

            // Minor present, use LatestPatch
            Assert(policy, true, new NuGetVersion("3.0.2"), Version);
            Assert(policy, false, null, UnsupportedMajor);

            // Minor present, use LatestPatch
            Assert(policy, true, new NuGetVersion("3.0.2"), UnsupportedPatch);

            // Minor not present, upgrade.
            Assert(policy, true, new NuGetVersion("3.4.3"), UnsupportedMinor);
        }
예제 #32
0
        public int CompareTo(SemanticVersion other)
        {
            if (other == null)
            {
                return(1);
            }

            int result = Major.CompareTo(other.Major);

            if (result != 0)
            {
                return(result);
            }

            result = Minor.CompareTo(other.Minor);

            if (result != 0)
            {
                return(result);
            }

            result = Patch.CompareTo(other.Patch);

            if (result != 0)
            {
                return(result);
            }

            //A version not marked with prerelease is later than one with a prerelease designation
            if (PrereleaseVersion == null && other.PrereleaseVersion != null)
            {
                return(1);
            }

            //A version not marked with prerelease is later than one with a prerelease designation
            if (PrereleaseVersion != null && other.PrereleaseVersion == null)
            {
                return(-1);
            }

            result = StringComparer.OrdinalIgnoreCase.Compare(PrereleaseVersion, other.PrereleaseVersion);

            if (result != 0)
            {
                return(result);
            }

            return(StringComparer.OrdinalIgnoreCase.Compare(OriginalText, other.OriginalText));
        }
예제 #33
0
		public StyleElement(Style s, TokenClass token_class, Major major, Minor minor, int param, string text) {
			this.token_class = token_class;
			this.major = major;
			this.minor = minor;
			this.param = param;
			this.text = text;

			lock (s) {
				if (s.Elements == null) {
					s.Elements = this;
				} else {
					StyleElement se = s.Elements;
					while (se.next != null)
						se = se.next;
					se.next = this;
				}
			}
		}
예제 #34
0
        /// <summary>
        /// The following code executes when a syntax error first occurs.
        /// </summary>
        private void SyntaxError(int major, Minor minor)
        {
            Parse parse = this._parse;
            #line 5 "C:\\_APPLICATION\\FEASERVER\\ENGINE_\\FeaServer.Query\\Parser.y"

            Debug.Assert(!string.IsNullOrEmpty(TOKEN)); // The tokenizer always gives us a token
            parse.ErrorMsg("near \"%T\": syntax error", TOKEN);

            this._parse = parse;
        }
예제 #35
0
        /// <summary>
        /// The following function deletes the value associated with a symbol.  The symbol can be either a terminal or nonterminal.
        /// "major" is the symbol code, and "minor" is a pointer to the value.
        /// </summary>
        private void Destructor(byte major, Minor minor) {
            Parse parse = this._parse;
switch (major) {
            // Here is inserted the actions which take place when a terminal or non-terminal is destroyed.  This can happen when the symbol is popped
            // from the stack during a reduce or during error processing or when a parser is being destroyed before it is finished parsing.
            // Note: during a reduce, the only symbols destroyed are those which appear on the RHS of the rule, but which are not used inside the C code.
    case 160: /* select */
    case 194: /* oneselect */
{
#line 298 "C:\_GITHUB\GpuStructs\src\SystemL.Data.net\Core+Vdbe\Parse+Parser.y"
 Select.Delete(parse.Ctx, (minor.yy3)); 
}
      break;
    case 173: /* term */
    case 174: /* expr */
{
#line 575 "C:\_GITHUB\GpuStructs\src\SystemL.Data.net\Core+Vdbe\Parse+Parser.y"
 Expr.Delete(parse.Ctx, (minor.yy4).Expr); 
}
      break;
    case 178: /* idxlist_opt */
    case 187: /* idxlist */
    case 197: /* selcollist */
    case 200: /* groupby_opt */
    case 204: /* sclp */
    case 214: /* sortlist */
    case 215: /* nexprlist */
    case 216: /* setlist */
    case 220: /* exprlist */
    case 225: /* case_exprlist */
{
#line 906 "C:\_GITHUB\GpuStructs\src\SystemL.Data.net\Core+Vdbe\Parse+Parser.y"
 Expr.ListDelete(parse.Ctx, (minor.yy6)); 
}
      break;
    case 193: /* fullname */
    case 198: /* from */
    case 206: /* seltablist */
    case 207: /* stl_prefix */
{
#line 405 "C:\_GITHUB\GpuStructs\src\SystemL.Data.net\Core+Vdbe\Parse+Parser.y"
 Parse.SrcListDelete(parse.Ctx, (minor.yy10)); 
}
      break;
    case 199: /* where_opt */
    case 201: /* having_opt */
    case 210: /* on_opt */
    case 224: /* case_operand */
    case 236: /* when_clause */
    case 241: /* key_opt */
{
#line 490 "C:\_GITHUB\GpuStructs\src\SystemL.Data.net\Core+Vdbe\Parse+Parser.y"
 Expr.Delete(parse.Ctx, (minor.yy12)); 
}
      break;
    case 202: /* orderby_opt */
{
#line 437 "C:\_GITHUB\GpuStructs\src\SystemL.Data.net\Core+Vdbe\Parse+Parser.y"
 Expr.ListDelete(parse.Ctx, (minor.yy6));
}
      break;
    case 211: /* using_opt */
    case 213: /* inscollist */
    case 218: /* inscollist_opt */
{
#line 431 "C:\_GITHUB\GpuStructs\src\SystemL.Data.net\Core+Vdbe\Parse+Parser.y"
 Parse.IdListDelete(parse.Ctx, (minor.yy15)); 
}
      break;
    case 219: /* valuelist */
{
#line 530 "C:\_GITHUB\GpuStructs\src\SystemL.Data.net\Core+Vdbe\Parse+Parser.y"
 Expr.ListDelete(parse.Ctx, (minor.yy16).List); Select.Delete(parse.Ctx, (minor.yy16).Select); 
}
      break;
    case 226: /* case_else */
{
#line 874 "C:\_GITHUB\GpuStructs\src\SystemL.Data.net\Core+Vdbe\Parse+Parser.y"
 sqlite3ExprDelete(parse.Ctx, (minor.yy12)); 
}
      break;
    case 232: /* trigger_cmd_list */
    case 237: /* trigger_cmd */
{
#line 997 "C:\_GITHUB\GpuStructs\src\SystemL.Data.net\Core+Vdbe\Parse+Parser.y"
 Trigger.DeleteTriggerStep(parse.Ctx, (minor.yy18)); 
}
      break;
    case 234: /* trigger_event */
{
#line 983 "C:\_GITHUB\GpuStructs\src\SystemL.Data.net\Core+Vdbe\Parse+Parser.y"
 Parse.IdListDelete(parse.Ctx, (minor.yy20).B); 
}
      break;
}
        }
예제 #36
0
        /// <summary>
        /// The following routine is called if the stack overflows.
        /// </summary>
        private void StackOverflow(Minor minor) {
            Parse parse = this._parse;
            this._idx = (this._idx + 1);
            if ((this._tracePrompt != null)) {
                Trace.WriteLine(String.Format("{0}Stack Overflow!", this._tracePrompt));
            }
            for (
            ; (this._idx >= 0); 
            ) {
                this.PopParserStack();
            }
            // Here code is inserted which will execute if the parser stack every overflows
#line 22 "C:\\_GITHUB\\GpuStructs\\src\\SystemL.Data.net\\Core+Vdbe\\Parse+Parser.y"

	parse.ErrorMsg("parser stack overflow");

            this._parse = parse;
        }
예제 #37
0
		public bool CheckMM(Major major, Minor minor) {
			if ((this.major == major) && (this.minor == minor)) {
				return true;
			}

			return false;
		}
예제 #38
0
 /// <summary>
 /// The following function deletes the value associated with a symbol.  The symbol can be either a terminal or nonterminal.
 /// "major" is the symbol code, and "minor" is a pointer to the value.
 /// </summary>
 private void Destructor(byte major, Minor minor)
 {
     Parse parse = this._parse;
     switch (major) {
     // Here is inserted the actions which take place when a terminal or non-terminal is destroyed.  This can happen when the symbol is popped
     // from the stack during a reduce or during error processing or when a parser is being destroyed before it is finished parsing.
     // Note: during a reduce, the only symbols destroyed are those which appear on the RHS of the rule, but which are not used inside the C code.
     case 115: /* select */
     case 129: /* oneselect */
     {
      sqlite3SelectDelete(pParse->db, (minor.yy2));
     }
       break;
     case 128: /* fullname */
     case 131: /* from */
     case 140: /* seltablist */
     case 141: /* stl_prefix */
     {
     sqlite3SrcListDelete(pParse->db, (minor.yy3));
     }
       break;
     case 130: /* selcollist */
     case 133: /* groupby_opt */
     case 135: /* orderby_opt */
     case 137: /* sclp */
     case 148: /* sortlist */
     case 151: /* nexprlist */
     case 153: /* setlist */
     case 156: /* itemlist */
     case 159: /* exprlist */
     case 163: /* case_exprlist */
     {
     sqlite3ExprListDelete(pParse->db, (minor.yy4));
     }
       break;
     case 132: /* where_opt */
     case 134: /* having_opt */
     case 144: /* on_opt */
     case 149: /* sortitem */
     case 162: /* case_operand */
     case 164: /* case_else */
     {
     sqlite3ExprDelete(pParse->db, (minor.yy5));
     }
       break;
     case 138: /* expr */
     case 157: /* term */
     {
      sqlite3ExprDelete(pParse->db, (minor.yy7).pExpr);
     }
       break;
     case 145: /* using_opt */
     case 147: /* inscollist */
     case 155: /* inscollist_opt */
     {
     sqlite3IdListDelete(pParse->db, (minor.yy8));
     }
       break;
     }
 }
예제 #39
0
		public void SetToken(TokenClass cl, Major maj, Minor min, int par, string text) {
			this.rtf_class = cl;
			this.major = maj;
			this.minor = min;
			this.param = par;
			if (par == NoParam) {
				this.text_buffer = new StringBuilder(text);
			} else {
				this.text_buffer = new StringBuilder(text + par.ToString());
			}
		}
예제 #40
0
		public void UngetToken() {
			if (this.pushed_class != TokenClass.None) {
				throw new RTFException(this, "Cannot unget more than one token");
			}

			if (this.rtf_class == TokenClass.None) {
				throw new RTFException(this, "No token to unget");
			}

			this.pushed_class = this.rtf_class;
			this.pushed_major = this.major;
			this.pushed_minor = this.minor;
			this.pushed_param = this.param;
			//this.pushed_text_buffer = new StringBuilder(this.text_buffer.ToString());
		}
예제 #41
0
		public void Lookup(string token) {
			Object		obj;
			KeyStruct	key;

			obj = key_table[token.Substring(1)];
			if (obj == null) {
				rtf_class = TokenClass.Unknown;
				major = (Major) -1;
				minor = (Minor) -1;
				return;
			}

			key = (KeyStruct)obj;
			this.rtf_class = TokenClass.Control;
			this.major = key.Major;
			this.minor = key.Minor;
		}
예제 #42
0
		public bool CheckCMM(TokenClass rtf_class, Major major, Minor minor) {
			if ((this.rtf_class == rtf_class) && (this.major == major) && (this.minor == minor)) {
				return true;
			}

			return false;
		}
예제 #43
0
        /// <summary>
        /// The following routine is called if the stack overflows.
        /// </summary>
        private void StackOverflow(Minor minor)
        {
            Parse parse = this._parse;
            this._idx = (this._idx + 1);
            if ((this._tracePrompt != null)) {
                Trace.WriteLine(String.Format("{0}Stack Overflow!", this._tracePrompt));
            }
            for (
            ; (this._idx >= 0);
            ) {
                this.PopParserStack();
            }
            // Here code is inserted which will execute if the parser stack every overflows
            #line 9 "C:\\_APPLICATION\\FEASERVER\\ENGINE_\\FeaServer.Query\\Parser.y"

            parse.ErrorMsg("parser stack overflow");

            this._parse = parse;
        }
예제 #44
0
		private void GetToken2() {
			char	c;
			int	sign;

			this.rtf_class = TokenClass.Unknown;
			this.param = NoParam;

			this.text_buffer.Length = 0;

			if (this.pushed_char != EOF) {
				c = this.pushed_char;
				this.text_buffer.Append(c);
				this.pushed_char = EOF;
			} else if ((c = GetChar()) == EOF) {
				this.rtf_class = TokenClass.EOF;
				return;
			}

			if (c == '{') {
				this.rtf_class = TokenClass.Group;
				this.major = Major.BeginGroup;
				return;
			}

			if (c == '}') {
				this.rtf_class = TokenClass.Group;
				this.major = Major.EndGroup;
				return;
			}

			if (c != '\\') {
				if (c != '\t') {
					this.rtf_class = TokenClass.Text;
					this.major = (Major)c;	// FIXME - typing?
					return;
				} else {
					this.rtf_class = TokenClass.Control;
					this.major = Major.SpecialChar;
					this.minor = Minor.Tab;
					return;
				}
			}

			if ((c = GetChar()) == EOF) {
				// Not so good
				return;
			}

			if (!Char.IsLetter(c)) {
				if (c == '\'') {
					char c2;

					if ((c = GetChar()) == EOF) {
						return;
					}

					if ((c2 = GetChar()) == EOF) {
						return;
					}

					this.rtf_class = TokenClass.Text;
					this.major = (Major)((Char)((Convert.ToByte(c.ToString(), 16) * 16 + Convert.ToByte(c2.ToString(), 16))));
					return;
				}

				// Escaped char
				if (c == ':' || c == '{' || c == '}' || c == '\\') {
					this.rtf_class = TokenClass.Text;
					this.major = (Major)c;
					return;
				}

				Lookup(this.text_buffer.ToString());
				return;
			}

			while (Char.IsLetter(c)) {
				if ((c = GetChar()) == EOF) {
					break;
				}
			}

			if (c != EOF) {
				this.text_buffer.Length--;
			}

			Lookup(this.text_buffer.ToString());

			if (c != EOF) {
				this.text_buffer.Append(c);
			}

			sign = 1;
			if (c == '-') {
				sign = -1;
				c = GetChar();
			}

			if (c != EOF && Char.IsDigit(c)) {
				this.param = 0;
				while (Char.IsDigit(c)) {
					this.param = this.param * 10 + Convert.ToByte(c) - 48;
					if ((c = GetChar()) == EOF) {
						break;
					}
				}
				this.param *= sign;
			}

			if (c != EOF) {
				if (c != ' ') {
					this.pushed_char = c;
				}
				this.text_buffer.Length--;
			}
		}
예제 #45
0
		/// <summary>Return the next token in the stream</summary>
		public TokenClass GetToken() {
			if (pushed_class != TokenClass.None) {
				this.rtf_class = this.pushed_class;
				this.major = this.pushed_major;
				this.minor = this.pushed_minor;
				this.param = this.pushed_param;
				this.pushed_class = TokenClass.None;
				return this.rtf_class;
			}

			GetToken2();

			if (this.rtf_class == TokenClass.Text) {
				this.minor = (Minor)this.cur_charset[(int)this.major];
			}

			if (this.cur_charset.Flags == CharsetFlags.None) {
				return this.rtf_class;
			}

			if (((this.cur_charset.Flags & CharsetFlags.Read) != 0) && CheckCM(TokenClass.Control, Major.CharSet)) {
				this.cur_charset.ReadMap();
			} else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && CheckCMM(TokenClass.Control, Major.CharAttr, Minor.FontNum)) {
				Font	fp;

				fp = Font.GetFont(this.font_list, this.param);

				if (fp != null) {
					if (fp.Name.StartsWith("Symbol")) {
						this.cur_charset.ID = CharsetType.Symbol;
					} else {
						this.cur_charset.ID = CharsetType.General;
					}
				} else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && (this.rtf_class == TokenClass.Group)) {
					switch(this.major) {
						case Major.BeginGroup: {
							this.charset_stack.Push(this.cur_charset);
							break;
						}

						case Major.EndGroup: {
							this.cur_charset = (Charset)this.charset_stack.Pop();
							break;
						}
					}
				}
			}

			return this.rtf_class;
		}
예제 #46
0
        /// <summary>
        /// The following code executes when a syntax error first occurs.
        /// </summary>
        private void SyntaxError(int major, Minor minor) {
            Parse parse = this._parse;
#line 18 "C:\\_GITHUB\\GpuStructs\\src\\SystemL.Data.net\\Core+Vdbe\\Parse+Parser.y"

	Debug.Assert(TOKEN.data[0]); // The tokenizer always gives us a token
	parse.ErrorMsg("near \"%T\": syntax error", TOKEN);

            this._parse = parse;
        }
예제 #47
0
 // <summary>
 // Perform a shift action.
 // </summary>
 protected virtual void Shift(int newState, int major, Minor minor)
 {
     this._idx = (this._idx + 1);
     if ((this._idx >= 100)) {
         this.StackOverflow(minor);
         return;
     }
     StackEntry tos = this._stack[this._idx];
     tos.stateno = ((byte)(newState));
     tos.major = ((byte)(major));
     tos.minor = minor;
     this._stack[this._idx] = tos;
     if (((this._tracePrompt != null)
                 && (this._idx > 0))) {
         Trace.WriteLine(String.Format("{0}Shift {1}", this._tracePrompt, newState));
         System.Text.StringBuilder b = new System.Text.StringBuilder(String.Format("{0}Stack:", this._tracePrompt));
         for (int i = 1; (i <= this._idx); i = (i + 1)) {
             b.AppendFormat(_tokenNames[this._stack[i].major]);
         }
         b.ToString();
         Trace.WriteLine(b.ToString());
     }
 }
예제 #48
0
파일: RTF.cs 프로젝트: nlhepler/mono
		/// <summary>Return the next token in the stream</summary>
		public TokenClass GetToken() {
			if (pushed_class != TokenClass.None) {
				this.rtf_class = this.pushed_class;
				this.major = this.pushed_major;
				this.minor = this.pushed_minor;
				this.param = this.pushed_param;
				this.pushed_class = TokenClass.None;
				return this.rtf_class;
			}

			GetToken2();

			if (this.rtf_class == TokenClass.Text) {
				this.minor = (Minor)this.cur_charset[(int)this.major];
				if (encoding == null) {
					encoding = Encoding.GetEncoding (encoding_code_page);
				}
				encoded_text = new String (encoding.GetChars (new byte [] { (byte) this.major }));
			}

			if (this.cur_charset.Flags == CharsetFlags.None) {
				return this.rtf_class;
			}

			if (CheckCMM (TokenClass.Control, Major.Unicode, Minor.UnicodeAnsiCodepage)) {
				encoding_code_page = param;

				// fallback to the default one in case we have an invalid value
				if (encoding_code_page < 0 || encoding_code_page > 65535)
					encoding_code_page = DefaultEncodingCodePage;
			}

			if (((this.cur_charset.Flags & CharsetFlags.Read) != 0) && CheckCM(TokenClass.Control, Major.CharSet)) {
				this.cur_charset.ReadMap();
			} else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && CheckCMM(TokenClass.Control, Major.CharAttr, Minor.FontNum)) {
				Font	fp;

				fp = Font.GetFont(this.font_list, this.param);

				if (fp != null) {
					if (fp.Name.StartsWith("Symbol")) {
						this.cur_charset.ID = CharsetType.Symbol;
					} else {
						this.cur_charset.ID = CharsetType.General;
					}
				} else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && (this.rtf_class == TokenClass.Group)) {
					switch(this.major) {
						case Major.BeginGroup: {
							this.charset_stack.Push(this.cur_charset);
							break;
						}

						case Major.EndGroup: {
							this.cur_charset = (Charset)this.charset_stack.Pop();
							break;
						}
					}
				}
			}

			return this.rtf_class;
		}
예제 #49
0
		public KeyStruct(Major major, Minor minor, string symbol) {
			Major = major;
			Minor = minor;
			Symbol = symbol;
		}
예제 #50
0
 /// <summary>
 /// The following function deletes the value associated with a symbol.  The symbol can be either a terminal or nonterminal.
 /// "major" is the symbol code, and "minor" is a pointer to the value.
 /// </summary>
 private void Destructor(byte major, Minor minor)
 {
     Parse pParse = this._pParse;
     switch (major) {
     // Here is inserted the actions which take place when a terminal or non-terminal is destroyed.  This can happen when the symbol is popped
     // from the stack during a reduce or during error processing or when a parser is being destroyed before it is finished parsing.
     // Note: during a reduce, the only symbols destroyed are those which appear on the RHS of the rule, but which are not used inside the C code.
     case 153: /* select */
     case 189: /* oneselect */
     {
      sqlite3SelectDelete(pParse.db, (minor.yy0));
     }
       break;
     case 167: /* term */
     case 168: /* expr */
     {
      sqlite3ExprDelete(pParse.db, (minor.yy0).pExpr);
     }
       break;
     case 186: /* fullname */
     case 192: /* from */
     case 201: /* seltablist */
     case 202: /* stl_prefix */
     {
      sqlite3SrcListDelete(pParse.db, (minor.yy0));
     }
       break;
     case 191: /* selcollist */
     case 194: /* groupby_opt */
     case 196: /* orderby_opt */
     case 199: /* sclp */
     case 209: /* sortlist */
     case 212: /* setlist */
     case 215: /* itemlist */
     {
      sqlite3ExprListDelete(pParse.db, (minor.yy0));
     }
       break;
     case 193: /* where_opt */
     case 195: /* having_opt */
     case 205: /* on_opt */
     case 210: /* sortitem */
     {
      sqlite3ExprDelete(pParse.db, (minor.yy0));
     }
       break;
     case 206: /* using_opt */
     case 208: /* inscollist */
     case 214: /* inscollist_opt */
     {
      sqlite3IdListDelete(pParse.db, (minor.yy0));
     }
       break;
     }
 }