Explainer.st
changeset 2955 d52a51930921
parent 2954 0943337cfb73
child 2986 cb591c4fc915
--- a/Explainer.st	Wed Oct 24 12:31:46 2012 +0200
+++ b/Explainer.st	Wed Oct 24 15:08:00 2012 +0200
@@ -56,7 +56,7 @@
     |expl literalValue findInnerMost elementIndex|
 
     literalValue := node value.
-    expl := literalValue class name "allBold" , '-constant.'.
+    expl := literalValue class name "allBold" , '-constant'.
 
     (literalValue isInteger) ifTrue:[
         (literalValue ~= 0 and:[literalValue ~= 1]) ifTrue:[
@@ -99,13 +99,20 @@
         findInnerMost value:node token.
     ].
 
-    (literalValue isArray or:[ literalValue isByteArray ]) ifTrue:[
+    (literalValue isArray or:[ literalValue isByteArray or:[ literalValue isString ]]) ifTrue:[
         literalValue size == 0 ifTrue:[
             ^ 'empty ' , expl
         ].
         elementIndex notNil ifTrue:[
             ^ expl , (' (size=%1; element=%2)' bindWith:literalValue size with:elementIndex)
         ].
+        literalValue isString ifTrue:[
+            elementIndex := intervalIfKnown start - node token start.
+
+            (elementIndex between:1 and:literalValue size) ifTrue:[
+                ^ expl , (' (size=%1; position=%2)' bindWith:literalValue size with:elementIndex)
+            ]
+        ].
         ^ expl , (' (size=%1)' bindWith:literalValue size)
     ].
 
@@ -1448,9 +1455,9 @@
 !Explainer class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Explainer.st,v 1.112 2012-10-24 10:31:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Explainer.st,v 1.113 2012-10-24 13:08:00 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libcomp/Explainer.st,v 1.112 2012-10-24 10:31:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Explainer.st,v 1.113 2012-10-24 13:08:00 cg Exp $'
 ! !