6670 key := key asSymbolIfInterned. |
6670 key := key asSymbolIfInterned. |
6671 (#(cr tab nl return lf ff null) includesIdentical:key) ifTrue:[ |
6671 (#(cr tab nl return lf ff null) includesIdentical:key) ifTrue:[ |
6672 aStream nextPut:(Character perform:key). |
6672 aStream nextPut:(Character perform:key). |
6673 ]. |
6673 ]. |
6674 ] ifFalse:[ |
6674 ] ifFalse:[ |
6675 (next isDigit and:[ignoreNumericEscapes not]) ifTrue:[ |
6675 argArrayOrDictionary isNil ifTrue:[ |
6676 v := argArrayOrDictionary at:(next digitValue) ifAbsent:'' |
6676 aStream nextPut:escapeCharacter. |
6677 ] ifFalse:[ |
6677 aStream nextPut:next. |
6678 next == $( ifTrue:[ |
6678 ] ifFalse:[ |
6679 idx2 := self indexOf:$) startingAt:idx+2. |
6679 (next isDigit and:[ignoreNumericEscapes not]) ifTrue:[ |
6680 key := self copyFrom:idx+2 to:idx2-1. |
6680 v := argArrayOrDictionary at:(next digitValue) ifAbsent:'' |
6681 idx := idx2 - 1. |
6681 ] ifFalse:[ |
6682 |
6682 next == $( ifTrue:[ |
6683 (key isNumeric |
6683 idx2 := self indexOf:$) startingAt:idx+2. |
6684 and:[(numericKey := Integer readFrom:key onError:nil) notNil |
6684 key := self copyFrom:idx+2 to:idx2-1. |
6685 and:[(argArrayOrDictionary includesKey:numericKey)]]) ifTrue:[ |
6685 idx := idx2 - 1. |
6686 v := argArrayOrDictionary at:numericKey ifAbsent:'' |
6686 |
6687 ] ifFalse:[ |
6687 (key isNumeric |
6688 argArrayOrDictionary isBlock ifTrue:[ |
6688 and:[(numericKey := Integer readFrom:key onError:nil) notNil |
6689 v := argArrayOrDictionary value:key |
6689 and:[(argArrayOrDictionary includesKey:numericKey)]]) ifTrue:[ |
6690 ] ifFalse:[ |
6690 v := argArrayOrDictionary at:numericKey ifAbsent:'' |
6691 (argArrayOrDictionary includesKey:key) ifTrue:[ |
6691 ] ifFalse:[ |
6692 v := argArrayOrDictionary at:key |
6692 argArrayOrDictionary isBlock ifTrue:[ |
6693 ] ifFalse:[ |
6693 v := argArrayOrDictionary value:key |
6694 key := key asSymbolIfInternedOrSelf. |
6694 ] ifFalse:[ |
6695 (argArrayOrDictionary includesKey:key) ifTrue:[ |
6695 (argArrayOrDictionary includesKey:key) ifTrue:[ |
6696 v := argArrayOrDictionary at:key |
6696 v := argArrayOrDictionary at:key |
6697 ] ifFalse:[ |
6697 ] ifFalse:[ |
6698 (key size == 1 and:[ argArrayOrDictionary includesKey:(key at:1)]) ifTrue:[ |
6698 key := key asSymbolIfInternedOrSelf. |
6699 v := argArrayOrDictionary at:(key at:1) |
6699 (argArrayOrDictionary includesKey:key) ifTrue:[ |
|
6700 v := argArrayOrDictionary at:key |
6700 ] ifFalse:[ |
6701 ] ifFalse:[ |
6701 v := '' |
6702 (key size == 1 and:[ argArrayOrDictionary includesKey:(key at:1)]) ifTrue:[ |
6702 ] |
6703 v := argArrayOrDictionary at:(key at:1) |
|
6704 ] ifFalse:[ |
|
6705 v := '' |
|
6706 ] |
|
6707 ]. |
6703 ]. |
6708 ]. |
6704 ]. |
6709 ]. |
6705 ]. |
6710 ]. |
|
6711 ] ifFalse:[ |
|
6712 (next isLetter and:[argArrayOrDictionary isSequenceable not "is a Dictionary"]) ifTrue:[ |
|
6713 "so next is a non-numeric single character." |
|
6714 v := argArrayOrDictionary |
|
6715 at:next |
|
6716 ifAbsent:[ |
|
6717 "try symbol or string instead of character" |
|
6718 argArrayOrDictionary |
|
6719 at:next asString asSymbolIfInternedOrSelf |
|
6720 ifAbsent:[String with:escapeCharacter with:next]. |
|
6721 ]. |
|
6722 ] ifFalse:[ |
|
6723 v := String with:$% with:next. |
|
6724 ]. |
|
6725 ] |
|
6726 ]. |
|
6727 "/ v notNil ifTrue:[ |
|
6728 v isBlock ifTrue:[ |
|
6729 v := v value |
6706 ]. |
6730 ]. |
6707 ] ifFalse:[ |
6731 |
6708 (next isLetter and:[argArrayOrDictionary isSequenceable not "is a Dictionary"]) ifTrue:[ |
6732 v printOn:aStream. |
6709 "so next is a non-numeric single character." |
6733 "/ ]. |
6710 v := argArrayOrDictionary |
6734 ] |
6711 at:next |
6735 ]. |
6712 ifAbsent:[ |
|
6713 "try symbol or string instead of character" |
|
6714 argArrayOrDictionary |
|
6715 at:next asString asSymbolIfInternedOrSelf |
|
6716 ifAbsent:[String with:escapeCharacter with:next]. |
|
6717 ]. |
|
6718 ] ifFalse:[ |
|
6719 v := String with:$% with:next. |
|
6720 ]. |
|
6721 ] |
|
6722 ]. |
|
6723 "/ v notNil ifTrue:[ |
|
6724 v isBlock ifTrue:[ |
|
6725 v := v value |
|
6726 ]. |
|
6727 |
|
6728 v printOn:aStream. |
|
6729 "/ ]. |
|
6730 ] |
|
6731 ]. |
6736 ]. |
6732 start := idx + 2 |
6737 start := idx + 2 |
6733 ]. |
6738 ]. |
6734 |
6739 |
6735 " |
6740 " |
6776 'it is $(time) $(date)' expandPlaceholders:$$ with:dict on:s. |
6786 'it is $(time) $(date)' expandPlaceholders:$$ with:dict on:s. |
6777 ]. |
6787 ]. |
6778 " |
6788 " |
6779 |
6789 |
6780 "Created: / 14-06-2018 / 11:44:08 / Claus Gittinger" |
6790 "Created: / 14-06-2018 / 11:44:08 / Claus Gittinger" |
6781 "Modified: / 14-07-2018 / 09:55:30 / Claus Gittinger" |
6791 "Modified (comment): / 07-09-2018 / 12:41:56 / Claus Gittinger" |
6782 ! |
6792 ! |
6783 |
6793 |
6784 expandPlaceholders:escapeCharacter with:argArrayOrDictionary on:aStream |
6794 expandPlaceholders:escapeCharacter with:argArrayOrDictionary on:aStream |
6785 "this is the generic version of the old %-escaping method, allowing for an arbitrary |
6795 "this is the generic version of the old %-escaping method, allowing for an arbitrary |
6786 escape character to be used (typically $$ or $% are effectively used). |
6796 escape character to be used (typically $$ or $% are effectively used). |