TryMatchJSONQuotedString() public method

Matches a quoted string without extracting its content.
public TryMatchJSONQuotedString ( bool allowNull = false ) : bool
allowNull bool True to allow 'null'.
return bool
Esempio n. 1
0
        public virtual bool VisitObjectContent()
        {
            int propertyIndex = 0;

            while (!_m.IsEnd)
            {
                _m.MatchWhiteSpaces(0);
                if (_m.TryMatchChar('}'))
                {
                    return(true);
                }
                int    startPropertyIndex = _m.StartIndex;
                string propName;
                if (!_m.TryMatchJSONQuotedString(out propName))
                {
                    return(false);
                }
                _m.MatchWhiteSpaces(0);
                if (!_m.MatchChar(':') || !VisitObjectProperty(startPropertyIndex, propName, propertyIndex))
                {
                    return(false);
                }
                _m.MatchWhiteSpaces(0);
                _m.TryMatchChar(',');
                ++propertyIndex;
            }
            return(false);
        }
 public void string_matcher_TryMatchJSONQuotedString( string s, string parsed, string textAfter )
 {
     var m = new StringMatcher( s );
     string result;
     Assert.That( m.TryMatchJSONQuotedString( out result, true ) );
     Assert.That( result, Is.EqualTo( parsed ) );
     Assert.That( m.TryMatchText( textAfter ), "Should be followed by: " + textAfter );
     
     m = new StringMatcher( s );
     Assert.That( m.TryMatchJSONQuotedString( true ) );
     Assert.That( m.TryMatchText( textAfter ), "Should be followed by: " + textAfter );
 }