Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
            }
        }
Esempio n. 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);
 }
Esempio n. 6
0
 public static void Print(BinaryOpStorage /*!*/ writeStorage, RubyScope /*!*/ scope, object self)
 {
     Print(writeStorage, self, scope.GetInnerMostClosureScope().LastInputLine);
 }
Esempio n. 7
0
 public static MutableString /*!*/ LastMatch(RubyScope /*!*/ scope, RubyClass /*!*/ self, [DefaultProtocol] int groupIndex)
 {
     return(scope.GetInnerMostClosureScope().CurrentMatch.GetGroupValue(groupIndex));
 }
Esempio n. 8
0
 public static MatchData LastMatch(RubyScope /*!*/ scope, RubyClass /*!*/ self)
 {
     return(scope.GetInnerMostClosureScope().CurrentMatch);
 }
Esempio n. 9
0
 public static object ImplicitMatch(ConversionStorage <MutableString> /*!*/ stringCast, RubyScope /*!*/ scope, RubyRegex /*!*/ self)
 {
     return(MatchIndex(scope, self, Protocols.CastToString(stringCast, scope.GetInnerMostClosureScope().LastInputLine)));
 }
Esempio n. 10
0
 public static void Print(RubyScope /*!*/ scope, object self)
 {
     Print(scope.RubyContext, self, scope.GetInnerMostClosureScope().LastInputLine);
 }
Esempio n. 11
0
 public static object ImplicitMatch(RubyScope /*!*/ scope, RubyRegex /*!*/ self)
 {
     return(MatchIndex(scope, self, Protocols.CastToString(scope.RubyContext, scope.GetInnerMostClosureScope().LastInputLine)));
 }