Lines Matching defs:pystr

81 ascii_escape_unicode(PyObject *pystr);
83 py_encode_basestring_ascii(PyObject* Py_UNUSED(self), PyObject *pystr);
85 scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr);
155 ascii_escape_unicode(PyObject *pystr)
157 /* Take a PyUnicode pystr and return a new ASCII-only escaped PyUnicode */
167 if (PyUnicode_READY(pystr) == -1)
170 input_chars = PyUnicode_GET_LENGTH(pystr);
171 input = PyUnicode_DATA(pystr);
172 kind = PyUnicode_KIND(pystr);
221 escape_unicode(PyObject *pystr)
223 /* Take a PyUnicode pystr and return a new escaped PyUnicode */
233 if (PyUnicode_READY(pystr) == -1)
236 maxchar = PyUnicode_MAX_CHAR_VALUE(pystr);
237 input_chars = PyUnicode_GET_LENGTH(pystr);
238 input = PyUnicode_DATA(pystr);
239 kind = PyUnicode_KIND(pystr);
381 scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict, Py_ssize_t *next_end_ptr)
383 /* Read the JSON string from PyUnicode pystr.
398 if (PyUnicode_READY(pystr) == -1)
405 len = PyUnicode_GET_LENGTH(pystr);
406 buf = PyUnicode_DATA(pystr);
407 kind = PyUnicode_KIND(pystr);
425 raise_errmsg("Invalid control character at", pystr, next);
435 PyObject *ret = PyUnicode_Substring(pystr, end, next);
444 raise_errmsg("Unterminated string starting at", pystr, begin);
450 if (_PyUnicodeWriter_WriteSubstring(&writer, pystr, end, next) < 0) {
460 raise_errmsg("Unterminated string starting at", pystr, begin);
479 raise_errmsg("Invalid \\escape", pystr, end - 2);
488 raise_errmsg("Invalid \\uXXXX escape", pystr, next - 1);
506 raise_errmsg("Invalid \\uXXXX escape", pystr, end - 5);
531 raise_errmsg("Invalid \\uXXXX escape", pystr, end - 5);
572 PyObject *pystr;
577 if (!PyArg_ParseTuple(args, "On|i:scanstring", &pystr, &end, &strict)) {
580 if (PyUnicode_Check(pystr)) {
581 rval = scanstring_unicode(pystr, end, strict, &next_end);
586 Py_TYPE(pystr)->tp_name);
599 py_encode_basestring_ascii(PyObject* Py_UNUSED(self), PyObject *pystr)
604 if (PyUnicode_Check(pystr)) {
605 rval = ascii_escape_unicode(pystr);
610 Py_TYPE(pystr)->tp_name);
624 py_encode_basestring(PyObject* Py_UNUSED(self), PyObject *pystr)
629 if (PyUnicode_Check(pystr)) {
630 rval = escape_unicode(pystr);
635 Py_TYPE(pystr)->tp_name);
678 _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr)
680 /* Read a JSON object from PyUnicode pystr.
696 if (PyUnicode_READY(pystr) == -1)
699 str = PyUnicode_DATA(pystr);
700 kind = PyUnicode_KIND(pystr);
701 end_idx = PyUnicode_GET_LENGTH(pystr) - 1;
720 raise_errmsg("Expecting property name enclosed in double quotes", pystr, idx);
723 key = scanstring_unicode(pystr, idx + 1, s->strict, &next_idx);
738 raise_errmsg("Expecting ':' delimiter", pystr, idx);
745 val = scan_once_unicode(s, pystr, idx, &next_idx);
776 raise_errmsg("Expecting ',' delimiter", pystr, idx);
809 _parse_array_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) {
810 /* Read a JSON array from PyUnicode pystr.
824 if (PyUnicode_READY(pystr) == -1)
831 str = PyUnicode_DATA(pystr);
832 kind = PyUnicode_KIND(pystr);
833 end_idx = PyUnicode_GET_LENGTH(pystr) - 1;
843 val = scan_once_unicode(s, pystr, idx, &next_idx);
860 raise_errmsg("Expecting ',' delimiter", pystr, idx);
872 raise_errmsg("Expecting value", pystr, end_idx);
910 _match_number_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t start, Py_ssize_t *next_idx_ptr) {
911 /* Read a JSON number from PyUnicode pystr.
929 if (PyUnicode_READY(pystr) == -1)
932 str = PyUnicode_DATA(pystr);
933 kind = PyUnicode_KIND(pystr);
934 end_idx = PyUnicode_GET_LENGTH(pystr) - 1;
1027 scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr)
1029 /* Read one JSON term (of any kind) from PyUnicode pystr.
1041 if (PyUnicode_READY(pystr) == -1)
1044 str = PyUnicode_DATA(pystr);
1045 kind = PyUnicode_KIND(pystr);
1046 length = PyUnicode_GET_LENGTH(pystr);
1060 return scanstring_unicode(pystr, idx + 1, s->strict, next_idx_ptr);
1066 res = _parse_object_unicode(s, pystr, idx + 1, next_idx_ptr);
1074 res = _parse_array_unicode(s, pystr, idx + 1, next_idx_ptr);
1135 return _match_number_unicode(s, pystr, idx, next_idx_ptr);
1142 PyObject *pystr;
1147 if (!PyArg_ParseTupleAndKeywords(args, kwds, "On:scan_once", kwlist, &pystr, &idx))
1150 if (PyUnicode_Check(pystr)) {
1151 rval = scan_once_unicode(self, pystr, idx, &next_idx);
1156 Py_TYPE(pystr)->tp_name);