string.formatter_parser() returns, which is an iterator
returning successive 4-tuples, the sequence being equivalent to
the original string.
| Modifier and Type | Class and Description |
|---|---|
| public static class | |
| pack-priv static class | MarkupIterator.FieldNumbering
Class used locally to assign indexes to the automatically-numbered arguments (see String Formatting section of the Python Standard Library). |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | bytes
True if originally given a |
| private int | index
How far along that string we are. |
| private final String | markup
The UTF-16 string from which elements are being returned. |
| private final MarkupIterator. | numbering
A counter used to auto-number fields when not explicitly numbered in the format. |
| public static final PyType | TYPE
The Python type |
| Access | Constructor and Description |
|---|---|
| private | MarkupIterator(String
to parse markup, boolean if originally bytes-like bytes, MarkupIterator.for automatically numbered arguments numberingConstructor used at top-level to enumerate a format. |
| public | |
| public | MarkupIterator(String
to parse markup, boolean if originally bytes-like bytes)Constructor used at top-level to enumerate a format that may be for a bytes-like object. |
| public | MarkupIterator(MarkupIterator
within which this is nested enclosingIterator, String the substring this is to parse subMarkup)Variant constructor used when formats are nested. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv final Object | |
| pack-priv final Object | Returns: PyTuple chunk or nullReturn the next "chunk" of the format (or return |
| public PyType | |
| private int | |
| public final boolean | Returns: true if originally given a PyStringIf originally given a PyString, string elements in the returned tuples must be PyString not PyUnicode. |
| public MarkupIterator. | |
| private void | parseField(MarkupIterator.
destination chunk result,specifying a replacement field, possibly with
nesting fieldMarkup)Parse a "replacement field" consisting of a name, conversion and format specification. |
| private String | |
| private Object |
| bytes | back to summary |
|---|---|
| private final boolean bytes True if originally given a | |
| index | back to summary |
|---|---|
| private int index How far along that string we are. | |
| markup | back to summary |
|---|---|
| private final String markup The UTF-16 string from which elements are being returned. | |
| numbering | back to summary |
|---|---|
| private final MarkupIterator. A counter used to auto-number fields when not explicitly numbered in the format. | |
| TYPE | back to summary |
|---|---|
| public static final PyType TYPE The Python type | |
| MarkupIterator | back to summary |
|---|---|
| private MarkupIterator(String markup, boolean bytes, MarkupIterator. Constructor used at top-level to enumerate a format.
| |
| MarkupIterator | back to summary |
|---|---|
| public MarkupIterator(String markup) Constructor used at top-level to enumerate a format.
| |
| MarkupIterator | back to summary |
|---|---|
| public MarkupIterator(String markup, boolean bytes) Constructor used at top-level to enumerate a format that may be for a bytes-like object.
| |
| MarkupIterator | back to summary |
|---|---|
| public MarkupIterator(MarkupIterator enclosingIterator, String subMarkup) Variant constructor used when formats are nested.
| |
| __iter__ | back to summary |
|---|---|
| pack-priv final Object __iter__() | |
| __next__ | back to summary |
|---|---|
| pack-priv final Object __next__() Return the next "chunk" of the format (or return
| |
| getType | back to summary |
|---|---|
| public PyType getType() Implements org. Doc from org. The Python | |
| indexOfFirst | back to summary |
|---|---|
| private int indexOfFirst(String s, int start, char c1, char c2) Find the first of two characters, or return -1. | |
| isBytes | back to summary |
|---|---|
| public final boolean isBytes() If originally given a PyString, string elements in the returned tuples must be PyString not PyUnicode.
| |
| nextChunk | back to summary |
|---|---|
| public MarkupIterator. Return the next
| |
| parseField | back to summary |
|---|---|
| private void parseField(MarkupIterator. Parse a "replacement field" consisting of a name, conversion and format specification. According to the Python Standard Library documentation, a replacement field has the structure:
replacement_field ::= "{" [field_name] ["!" conversion] [":" format_spec] "}"
field_name ::= arg_name ("." attribute_name | "[" element_index "]")*
arg_name ::= [identifier | integer]
attribute_name ::= identifier
element_index ::= integer | index_string
except at this point, we have already discarded the outer braces.
| |
| unescapeBraces | back to summary |
|---|---|
| private String unescapeBraces(String substring) | |
| wrap | back to summary |
|---|---|
| private Object wrap(String value, String defaultValue) Convenience method for populating the return tuple, returning a
object for tuple | |
| Modifier and Type | Field and Description |
|---|---|
| public String | conversion
Conversion to be applied, e.g. |
| public String | fieldName
The field name or number (as a string) for accessing the value. |
| public String | formatSpec
The format specifier such as |
| public boolean | formatSpecNeedsExpanding
Signals the |
| public String | literalText
The text leading up to the next format field. |
| Access | Constructor and Description |
|---|---|
| public |
| conversion | back to summary |
|---|---|
| public String conversion Conversion to be applied, e.g. | |
| fieldName | back to summary |
|---|---|
| public String fieldName The field name or number (as a string) for accessing the value. | |
| formatSpec | back to summary |
|---|---|
| public String formatSpec The format specifier such as | |
| formatSpecNeedsExpanding | back to summary |
|---|---|
| public boolean formatSpecNeedsExpanding Signals the | |
| literalText | back to summary |
|---|---|
| public String literalText The text leading up to the next format field. | |
| Chunk | back to summary |
|---|---|
| public Chunk() | |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv String | Returns: index as stringGenerate a numeric argument index automatically, or raise an error if already started numbering manually. |
| pack-priv void | useManualFieldNumbering()
Remember we are numbering manually, and raise an error if already started numbering automatically. |
| automaticFieldNumber | back to summary |
|---|---|
| private int automaticFieldNumber | |
| manualFieldNumberSpecified | back to summary |
|---|---|
| private boolean manualFieldNumberSpecified | |
| FieldNumbering | back to summary |
|---|---|
| pack-priv FieldNumbering() | |
| nextAutomaticFieldNumber | back to summary |
|---|---|
| pack-priv String nextAutomaticFieldNumber() Generate a numeric argument index automatically, or raise an error if already started numbering manually.
| |
| useManualFieldNumbering | back to summary |
|---|---|
| pack-priv void useManualFieldNumbering() Remember we are numbering manually, and raise an error if already started numbering automatically. | |