public void RegexWithWhiteSpaceIsValid()
        {
            const string input = "regex \".*\\.txt\"";
            RegexValue   value = BasicParser.RegexValue.Parse(input);

            Assert.Equal(".*\\.txt", value.RegexPattern);
            Assert.Matches(value.Regex, "match.txt");
        }
Пример #2
0
        public QuestionDataResponseYear(TextData data) : base(data)
        {
            Type = QuestionDataType.ResponseYear;
            RegexValue <ZValue> value = data.Values["responseYear"];

            Year        = int.Parse((string)value.Value);
            ColumnIndex = value.Index;
            Length      = value.Length;
        }
Пример #3
0
        public QuestionDataQuestionNumber(TextData data) : base(data)
        {
            Type = QuestionDataType.QuestionNumber;
            RegexValue <ZValue> value = data.Values["questionNumber"];

            QuestionNumber = int.Parse((string)value.Value);
            ColumnIndex    = value.Index;
            Length         = value.Length;
        }
        public void RegexCanBeNegatedWithSpaceBeforeKeyword()
        {
            const string input = "! regex\".*\\.txt\"";
            RegexValue   value = BasicParser.RegexValue.Parse(input);

            Assert.Equal(".*\\.txt", value.RegexPattern);

            // The actual regex is not negated. It is up to the user of RegexValue to check the Negated flag
            Assert.Matches(value.Regex, "match.txt");
        }
Пример #5
0
 public void Clear()
 {
     Type         = TokenType.BooleanLiteral;
     Literal      = null;
     Start        = 0;
     End          = 0;
     LineNumber   = 0;
     LineStart    = 0;
     _location    = null;
     Precedence   = 0;
     Octal        = false;
     Head         = false;
     Tail         = false;
     RawTemplate  = null;
     BooleanValue = false;
     NumericValue = 0;
     Value        = null;
     RegexValue   = null;
 }