Пример #1
0
        public static MutableString Gets(RubyScope /*!*/ scope, RubyIO /*!*/ self, [DefaultProtocol] MutableString separator)
        {
            MutableString result = self.ReadLineOrParagraph(separator);

            KernelOps.Taint(scope.RubyContext, result);

            scope.GetInnerMostClosureScope().LastInputLine = result;
            scope.RubyContext.InputProvider.IncrementLastInputLineNumber();

            return(result);
        }
Пример #2
0
        public static MutableString Gets(RubyScope /*!*/ scope, StringIO /*!*/ self, [DefaultProtocol] MutableString separator)
        {
            var content = self.GetReadableContent();

            int           position = self._position;
            MutableString result   = ReadLine(content, separator, ref position);

            self._position = position;

            scope.GetInnerMostClosureScope().LastInputLine = result;
            self._lineNumber++;

            return(result);
        }
Пример #3
0
        public static MutableString Gets(RubyScope /*!*/ scope, RubyIO /*!*/ self, [DefaultProtocol] MutableString separator)
        {
            MutableString result = self.ReadLineOrParagraph(separator);

            if (result != null)
            {
                result.IsTainted = true;
            }

            scope.GetInnerMostClosureScope().LastInputLine = result;
            scope.RubyContext.InputProvider.LastInputLineNumber = ++self.LineNumber;

            return(result);
        }
Пример #4
0
        public static MatchData SetCurrentMatchData(RubyScope /*!*/ scope, RubyRegex /*!*/ regex, MutableString /*!*/ str)
        {
            var targetScope = scope.GetInnerMostClosureScope();

            if (str == null)
            {
                return(targetScope.CurrentMatch = null);
            }

            Match match = regex.Match(str, 0);

            if (match.Success)
            {
                return(targetScope.CurrentMatch = scope.RubyContext.TaintObjectBy(new MatchData(match, str), str));
            }
            else
            {
                return(targetScope.CurrentMatch = null);
            }
        }
Пример #5
0
 public static MatchData SetCurrentMatchData(RubyScope /*!*/ scope, RubyRegex /*!*/ regex, MutableString str)
 {
     return(scope.GetInnerMostClosureScope().CurrentMatch = (str != null) ? regex.Match(scope.RubyContext.KCode, str) : null);
 }
Пример #6
0
 public static void Print(BinaryOpStorage /*!*/ writeStorage, RubyScope /*!*/ scope, object self)
 {
     Print(writeStorage, self, scope.GetInnerMostClosureScope().LastInputLine);
 }
Пример #7
0
 public static MutableString /*!*/ LastMatch(RubyScope /*!*/ scope, RubyClass /*!*/ self, [DefaultProtocol] int groupIndex)
 {
     return(scope.GetInnerMostClosureScope().CurrentMatch.GetGroupValue(groupIndex));
 }
Пример #8
0
 public static MatchData LastMatch(RubyScope /*!*/ scope, RubyClass /*!*/ self)
 {
     return(scope.GetInnerMostClosureScope().CurrentMatch);
 }
Пример #9
0
 public static object ImplicitMatch(ConversionStorage <MutableString> /*!*/ stringCast, RubyScope /*!*/ scope, RubyRegex /*!*/ self)
 {
     return(MatchIndex(scope, self, Protocols.CastToString(stringCast, scope.GetInnerMostClosureScope().LastInputLine)));
 }
Пример #10
0
 public static void Print(RubyScope /*!*/ scope, object self)
 {
     Print(scope.RubyContext, self, scope.GetInnerMostClosureScope().LastInputLine);
 }
Пример #11
0
 public static object ImplicitMatch(RubyScope /*!*/ scope, RubyRegex /*!*/ self)
 {
     return(MatchIndex(scope, self, Protocols.CastToString(scope.RubyContext, scope.GetInnerMostClosureScope().LastInputLine)));
 }