pynie / Objects / stringobject.pir

.sub '' :anon :init :load
    $P0 = subclass 'String', [ 'str' ]

    $P1 = get_global [ 'type' ], 'wrap_class'
    $P1('str', $P0)
    
    $P2 = get_class 'String'
    $P1 = getinterp
    $P1.'hll_map'($P2, $P0)
.end


.namespace [ 'str' ]


=item str([object])

Return a string containing a nicely printable representation of an object.
For strings, this returns the string itself. The difference with
repr(object) is that str(object) does not always attempt to return
a string that is acceptable to eval(); its goal is to return a
printable string. If no argument is given, returns the empty string, ''.

=cut

.sub '__init__' :method
    .param pmc obj :optional
    .param int has_obj :opt_flag
    
    unless has_obj goto done
    $S0 = obj
    self = $S0
  done:
.end

.sub '__repr__' :method
    .local string result
    result = "'"
    
    # XXX escaping
    $S0 = self
    result .= $S0
    
    result .= "'"
    .return (result)
.end

.sub 'split' :method
    .param pmc sep          :optional :named('sep')
    .param int has_sep      :opt_flag
    .param int maxsplit     :optional :named('maxsplit')
    .param int has_maxsplit :opt_flag

    unless has_sep goto not_yet
    if has_maxsplit goto not_yet

    $S0 = sep
    $S1 = self
    $P0 = split $S0, $S1
    # convert from ResizableStringArray to Pynie list
    .tailcall 'listmaker'($P0 :flat)

not_yet:
    $P0 = new 'Exception'
    $P0 = 'NotImplementedError'         # XXX
    raise ($P0)
.end

.sub 'join' :method
    .param pmc seq
    $S0 = self
    $S1 = join $S0, seq
    .return ($S1)
.end

.namespace []
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.