Skip to content

Commit

Permalink
Respect $, when joining, and set $, when cardinal starts
Browse files Browse the repository at this point in the history
Signed-off-by: Ted Reed <ted.reed@gmail.com>
  • Loading branch information
joeri authored and treed committed Aug 2, 2009
1 parent dd12a49 commit 550139a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cardinal.pir
Expand Up @@ -49,6 +49,10 @@ object.
cardinalmeta = get_hll_global ['CardinalObject'], '!CARDINALMETA'
compilerclass = cardinalmeta.'new_class'('cardinal::Compiler', 'parent'=>'PCT::HLLCompiler')

$P2 = new 'CardinalString'
$P2 = ""
set_hll_global '$,', $P2

compiler = compilerclass.'new'()
compiler.'language'('cardinal')
$P0 = get_hll_namespace ['cardinal';'Grammar']
Expand Down
9 changes: 8 additions & 1 deletion src/classes/Array.pir
Expand Up @@ -610,13 +610,20 @@ Returns a string comprised of all of the list, separated by the string SEPARATOR

.sub 'join' :method
.param string sep :optional
.param int sep_given :opt_flag
.local string res
.local string tmp
.local int len
.local int i

res = ""

if sep_given goto skip_setting_sep

$P0 = get_hll_global '$,'
sep = $P0

skip_setting_sep:
len = elements self
if len == 0 goto done

Expand Down

0 comments on commit 550139a

Please sign in to comment.