Method: OneApm::Support::OkJson#lex
- Defined in:
- lib/one_apm/support/okjson.rb
#lex(s) ⇒ Object
Scans s and returns a list of json tokens, excluding white space (as defined in RFC 4627).
175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/one_apm/support/okjson.rb', line 175 def lex(s) ts = [] while s.length > 0 typ, lexeme, val = tok(s) if typ == nil raise Error, "invalid character at #{s[0,10].inspect}" end if typ != :space ts << [typ, lexeme, val] end s = s[lexeme.length..-1] end ts end |