コード例 #1
0
 /// <summary> pattern for a decimal integer.
 /// It starts with a non-zero digit and followed by 0 or more digits.
 /// </summary>
 /// <returns> the Pattern object.
 /// </returns>
 public static Pattern IsDecInteger()
 {
     return(InRange('1', '9').Seq(Many(CharPredicates.IsDigit())));
 }
コード例 #2
0
 /// <summary> Recognizes a decimal point and 1 or more digits after it.</summary>
 /// <returns> the Pattern object.
 /// </returns>
 public static Pattern IsDecimalR()
 {
     return(IsChar('.').Seq(Many(1, CharPredicates.IsDigit())));
 }
コード例 #3
0
 /// <summary> pattern for an integer. ([0-9]+) </summary>
 /// <returns> the Pattern object.
 /// </returns>
 public static Pattern IsInteger()
 {
     return(Many(1, CharPredicates.IsDigit()));
 }
コード例 #4
0
        /// <summary> a decimal number that has at least one number before the decimal point.
        /// the decimal point and the numbers to the right are optional.
        /// 0, 11., 2.3 are all good candidates. While .1, . are not.
        /// </summary>
        /// <returns> the Pattern object.
        /// </returns>
        public static Pattern IsDecimalL()
        {
            CharPredicate cp = CharPredicates.IsDigit();

            return(Many(1, cp).Seq(IsChar('.').Seq(Many(cp)).Optional()));
        }