示例#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();
 }
示例#2
0
文件: PSScriptToken.cs 项目: flq/rfb
 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();
 }
示例#3
0
文件: CommentToken.cs 项目: flq/rfb
 protected override AbstractToken handle(TokenizerHandle handle)
 {
     if (!commentMatch.IsMatch(handle.CurrentLine))
     return null;
       handle.CurrentHandled();
       return this;
 }
示例#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;
 }
示例#5
0
文件: BacktickToken.cs 项目: flq/rfb
 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;
 }
示例#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;
        }