Esempio n. 1
0
 public void TokenHandleReturnsEmptyStringOnceItIsRunOut()
 {
     var th = new TokenizerHandle("hello" + Environment.NewLine + "world");
       th.Advance();
       th.CurrentLine.ShouldBeEqualTo("hello");
       th.CurrentHandled();
       th.Advance();
       th.CurrentLine.ShouldBeEqualTo("world");
       th.CurrentHandled();
       th.Advance();
       th.CurrentLine.ShouldBeNull();
 }
Esempio n. 2
0
 protected void extractScript(TokenizerHandle h)
 {
     h.CurrentHandled();
       h.Advance();
       var rEnd = new Regex(@"\s*" + Terminator);
       var b = new StringBuilder();
       while (!rEnd.IsMatch(h.CurrentLine))
       {
     b.AppendLine(h.CurrentLine);
     h.CurrentHandled();
     h.Advance();
       }
       Script = b.ToString();
 }
Esempio n. 3
0
 protected override AbstractToken handle(TokenizerHandle handle)
 {
     if (!commentMatch.IsMatch(handle.CurrentLine))
     return null;
       handle.CurrentHandled();
       return this;
 }
Esempio n. 4
0
 protected override AbstractToken handle(TokenizerHandle handle)
 {
     var match = psScriptStart.Match(handle.CurrentLine);
       if (match.Groups.Count != 2)
     return null;
       Terminator = match.Groups[1].Value;
       extractScript(handle);
       handle.CurrentHandled();
       return this;
 }
Esempio n. 5
0
 protected override AbstractToken handle(TokenizerHandle handle)
 {
     var match = matchBacktick.Match(handle.CurrentLine);
       if (match.Groups.Count > 1)
       {
     BackTickValue = match.Groups[1].Value;
     handle.CurrentHandled();
     return this;
       }
       return null;
 }
Esempio n. 6
0
        protected override AbstractToken handle(TokenizerHandle tHandle)
        {
            var m = matchRegEx.Match(tHandle.CurrentLine);
              if (m.Groups.Count == 0 || m.Groups.Count != 3)
            return null;

              VariableName = m.Groups[1].Captures[0].Value.Trim(' ');
              Value = m.Groups[2].Captures[0].Value.Trim(' ');
              tHandle.CurrentHandled();
              withinHandle(tHandle);
              return this;
        }