summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hash.c10
-rw-r--r--tests/009/json.expected92
-rw-r--r--txr.133
3 files changed, 78 insertions, 57 deletions
diff --git a/hash.c b/hash.c
index c5330daf..b0d76175 100644
--- a/hash.c
+++ b/hash.c
@@ -419,10 +419,16 @@ static void hash_print_op(val hash, val out, val pretty, struct strm_ctx *ctx)
put_char(chr('('), out);
- if (h->hash_fun == equal_hash) {
- obj_print_impl(equal_based_k, out, pretty, ctx);
+ if (opt_compat && opt_compat <= 188) {
+ if (h->hash_fun == equal_hash)
+ obj_print_impl(equal_based_k, out, pretty, ctx);
+ need_space = 1;
+ } else {
+ if (h->hash_fun == eql_hash)
+ obj_print_impl(eql_based_k, out, pretty, ctx);
need_space = 1;
}
+
if (h->flags != hash_weak_none) {
if (need_space)
put_char(chr(' '), out);
diff --git a/tests/009/json.expected b/tests/009/json.expected
index 4e80c58f..8bc4ab9a 100644
--- a/tests/009/json.expected
+++ b/tests/009/json.expected
@@ -1,54 +1,50 @@
-AST: #H((:equal-based) ("web-app" #H((:equal-based) ("servlet-mapping" #H((:equal-based) ("cofaxTools" "/tools/*") ("cofaxCDS" "/") ("cofaxAdmin" "/admin/*")
- ("cofaxEmail" "/cofaxutil/aemail/*") ("fileServlet" "/static/*")))
- ("servlet" #(#H((:equal-based) ("servlet-class" "org.cofax.cds.CDSServlet") ("init-param" #H((:equal-based) ("defaultFileTemplate" "articleTemplate.htm")
- ("configGlossary:installationAt" "Philadelphia, PA") ("templateOverridePath" "")
- ("dataStoreLogLevel" "debug") ("searchEngineListTemplate" "forSearchEnginesList.htm")
- ("dataStoreClass" "org.cofax.SqlDataStore") ("configGlossary:poweredBy" "Cofax")
- ("jspFileTemplate" "articleTemplate.jsp") ("cacheTemplatesTrack" 100.0)
- ("cacheTemplatesStore" 50.0) ("templateProcessorClass" "org.cofax.WysiwygTemplate")
- ("dataStoreUser" "sa") ("redirectionClass" "org.cofax.SqlRedirection")
- ("dataStoreConnUsageLimit" 100.0) ("dataStoreMaxConns" 100.0)
- ("jspListTemplate" "listTemplate.jsp") ("useJSP" :false) ("configGlossary:poweredByIcon" "/images/cofax.gif")
- ("templateLoaderClass" "org.cofax.FilesTemplateLoader") ("cacheTemplatesRefresh" 15.0)
- ("cachePagesDirtyRead" 10.0) ("searchEngineRobotsDb" "WEB-INF/robots.db")
- ("cachePagesStore" 100.0) ("dataStoreTestQuery" "SET NOCOUNT ON;select test='test';")
- ("configGlossary:adminEmail" "ksm@pobox.com") ("configGlossary:staticPath" "/content/static")
- ("dataStoreInitConns" 10.0) ("cachePagesTrack" 200.0) ("dataStorePassword" "dataStoreTestQuery")
- ("defaultListTemplate" "listTemplate.htm") ("dataStoreLogFile" "/usr/local/tomcat/logs/datastore.log")
- ("maxUrlLength" 500.0) ("dataStoreDriver" "com.microsoft.jdbc.sqlserver.SQLServerDriver")
- ("dataStoreName" "cofax") ("cachePackageTagsRefresh" 60.0) ("templatePath" "templates")
- ("dataStoreUrl" "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon")
- ("useDataStore" :true) ("cachePackageTagsTrack" 200.0) ("searchEngineFileTemplate" "forSearchEngines.htm")
- ("cachePackageTagsStore" 200.0) ("cachePagesRefresh" 10.0)))
- ("servlet-name" "cofaxCDS")) #H((:equal-based) ("servlet-class" "org.cofax.cds.EmailServlet")
- ("init-param" #H((:equal-based) ("mailHost" "mail1") ("mailHostOverride" "mail2")))
- ("servlet-name" "cofaxEmail"))
- #H((:equal-based) ("servlet-class" "org.cofax.cds.AdminServlet")
- ("servlet-name" "cofaxAdmin")) #H((:equal-based) ("servlet-class" "org.cofax.cds.FileServlet")
- ("servlet-name" "fileServlet"))
- #H((:equal-based) ("servlet-class" "org.cofax.cms.CofaxToolsServlet")
- ("init-param" #H((:equal-based) ("lookInContext" 1.0) ("removePageCache" "/content/admin/remove?cache=pages&id=")
- ("logMaxSize" "") ("dataLogMaxSize" "") ("removeTemplateCache" "/content/admin/remove?cache=templates&id=")
- ("dataLog" 1.0) ("logLocation" "/usr/local/tomcat/logs/CofaxTools.log")
- ("log" 1.0) ("adminGroupID" 4.0) ("templatePath" "toolstemplates/")
- ("betaServer" :true) ("dataLogLocation" "/usr/local/tomcat/logs/dataLog.log")
- ("fileTransferFolder" "/usr/local/tomcat/webapps/content/fileTransferFolder")))
- ("servlet-name" "cofaxTools")))) ("taglib" #H((:equal-based) ("taglib-uri" "cofax.tld") ("taglib-location" "/WEB-INF/tlds/cofax.tld"))))))
+AST: #H(() ("web-app" #H(() ("servlet-mapping" #H(() ("cofaxTools" "/tools/*") ("cofaxCDS" "/") ("cofaxAdmin" "/admin/*")
+ ("cofaxEmail" "/cofaxutil/aemail/*") ("fileServlet" "/static/*")))
+ ("servlet" #(#H(() ("servlet-class" "org.cofax.cds.CDSServlet") ("init-param" #H(() ("defaultFileTemplate" "articleTemplate.htm") ("configGlossary:installationAt" "Philadelphia, PA")
+ ("templateOverridePath" "") ("dataStoreLogLevel" "debug") ("searchEngineListTemplate" "forSearchEnginesList.htm")
+ ("dataStoreClass" "org.cofax.SqlDataStore") ("configGlossary:poweredBy" "Cofax")
+ ("jspFileTemplate" "articleTemplate.jsp") ("cacheTemplatesTrack" 100.0)
+ ("cacheTemplatesStore" 50.0) ("templateProcessorClass" "org.cofax.WysiwygTemplate")
+ ("dataStoreUser" "sa") ("redirectionClass" "org.cofax.SqlRedirection")
+ ("dataStoreConnUsageLimit" 100.0) ("dataStoreMaxConns" 100.0)
+ ("jspListTemplate" "listTemplate.jsp") ("useJSP" :false) ("configGlossary:poweredByIcon" "/images/cofax.gif")
+ ("templateLoaderClass" "org.cofax.FilesTemplateLoader") ("cacheTemplatesRefresh" 15.0)
+ ("cachePagesDirtyRead" 10.0) ("searchEngineRobotsDb" "WEB-INF/robots.db")
+ ("cachePagesStore" 100.0) ("dataStoreTestQuery" "SET NOCOUNT ON;select test='test';")
+ ("configGlossary:adminEmail" "ksm@pobox.com") ("configGlossary:staticPath" "/content/static")
+ ("dataStoreInitConns" 10.0) ("cachePagesTrack" 200.0) ("dataStorePassword" "dataStoreTestQuery")
+ ("defaultListTemplate" "listTemplate.htm") ("dataStoreLogFile" "/usr/local/tomcat/logs/datastore.log")
+ ("maxUrlLength" 500.0) ("dataStoreDriver" "com.microsoft.jdbc.sqlserver.SQLServerDriver")
+ ("dataStoreName" "cofax") ("cachePackageTagsRefresh" 60.0) ("templatePath" "templates")
+ ("dataStoreUrl" "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon")
+ ("useDataStore" :true) ("cachePackageTagsTrack" 200.0) ("searchEngineFileTemplate" "forSearchEngines.htm")
+ ("cachePackageTagsStore" 200.0) ("cachePagesRefresh" 10.0)))
+ ("servlet-name" "cofaxCDS")) #H(() ("servlet-class" "org.cofax.cds.EmailServlet") ("init-param" #H(() ("mailHost" "mail1") ("mailHostOverride" "mail2")))
+ ("servlet-name" "cofaxEmail"))
+ #H(() ("servlet-class" "org.cofax.cds.AdminServlet") ("servlet-name" "cofaxAdmin"))
+ #H(() ("servlet-class" "org.cofax.cds.FileServlet") ("servlet-name" "fileServlet"))
+ #H(() ("servlet-class" "org.cofax.cms.CofaxToolsServlet") ("init-param" #H(() ("lookInContext" 1.0) ("removePageCache" "/content/admin/remove?cache=pages&id=")
+ ("logMaxSize" "") ("dataLogMaxSize" "") ("removeTemplateCache" "/content/admin/remove?cache=templates&id=")
+ ("dataLog" 1.0) ("logLocation" "/usr/local/tomcat/logs/CofaxTools.log")
+ ("log" 1.0) ("adminGroupID" 4.0) ("templatePath" "toolstemplates/")
+ ("betaServer" :true) ("dataLogLocation" "/usr/local/tomcat/logs/dataLog.log")
+ ("fileTransferFolder" "/usr/local/tomcat/webapps/content/fileTransferFolder")))
+ ("servlet-name" "cofaxTools")))) ("taglib" #H(() ("taglib-uri" "cofax.tld") ("taglib-location" "/WEB-INF/tlds/cofax.tld"))))))
Unmatched junk: ""
-AST: #("JSON Test Pattern pass1" #H((:equal-based) ("object with 1 member" #("array with 1 element")))
- #H((:equal-based)) #() -42.0 :true :false :null #H((:equal-based) ("" 2.3456789012e76) ("digit" "0123456789") ("\\/\\\\\"쫾몾ꮘﳞ볚\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?" "A key can be any string")
- ("null" :null) ("one" 1.0) ("E" 1.23456789e34) ("special" "`1~!@#$%^&*()_+-={':[,]}|;.</>?")
- ("e" 1.23456789e-13) ("comment" "// /* <!-- --") ("# -- --> */" " ")
- ("real" -9876.54321) ("backslash" "\\\\") ("array" #()) ("url" "http://www.JSON.org/")
- ("zero" 0.0) ("false" :false) ("space" " ") ("slash" "/ & \\/")
- ("address" "50 St. James Street") ("compact" #(1.0 2.0 3.0 4.0 5.0 6.0 7.0))
- ("object" #H((:equal-based))) ("quote" "\"") ("jsontext" "{\"object with 1 member\":[\"array with 1 element\"]}")
- ("true" :true) ("integer" 1234567890.0) ("ALPHA" "ABCDEFGHIJKLMNOPQRSTUVWYZ")
- ("quotes" "&#34; \" %22 0x22 034 &#x22;") ("hex" "ģ䕧覫췯ꯍ")
- ("0123456789" "digit") ("controls" "\b\f\n\r\t") ("alpha" "abcdefghijklmnopqrstuvwyz")
- (" s p a c e d " #(1.0 2.0 3.0 4.0 5.0 6.0 7.0)))
+AST: #("JSON Test Pattern pass1" #H(() ("object with 1 member" #("array with 1 element")))
+ #H(()) #() -42.0 :true :false :null #H(() ("" 2.3456789012e76) ("digit" "0123456789") ("\\/\\\\\"쫾몾ꮘﳞ볚\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?" "A key can be any string")
+ ("null" :null) ("one" 1.0) ("E" 1.23456789e34) ("special" "`1~!@#$%^&*()_+-={':[,]}|;.</>?")
+ ("e" 1.23456789e-13) ("comment" "// /* <!-- --") ("# -- --> */" " ")
+ ("real" -9876.54321) ("backslash" "\\\\") ("array" #()) ("url" "http://www.JSON.org/")
+ ("zero" 0.0) ("false" :false) ("space" " ") ("slash" "/ & \\/")
+ ("address" "50 St. James Street") ("compact" #(1.0 2.0 3.0 4.0 5.0 6.0 7.0))
+ ("object" #H(())) ("quote" "\"") ("jsontext" "{\"object with 1 member\":[\"array with 1 element\"]}")
+ ("true" :true) ("integer" 1234567890.0) ("ALPHA" "ABCDEFGHIJKLMNOPQRSTUVWYZ")
+ ("quotes" "&#34; \" %22 0x22 034 &#x22;") ("hex" "ģ䕧覫췯ꯍ")
+ ("0123456789" "digit") ("controls" "\b\f\n\r\t") ("alpha" "abcdefghijklmnopqrstuvwyz")
+ (" s p a c e d " #(1.0 2.0 3.0 4.0 5.0 6.0 7.0)))
0.5 98.6 99.44 1066.0 10.0 1.0 0.1 1.0 2.0 2.0 "rosebud")
Unmatched junk: ""
diff --git a/txr.1 b/txr.1
index eefbb678..f948f155 100644
--- a/txr.1
+++ b/txr.1
@@ -11288,13 +11288,13 @@ Hash table literals have two parts: the list of hash construction
arguments and the key-value pairs. For instance:
.cblk
- #H((:equal-based) (a 1) (b 2))
+ #H((:eql-based) (a 1) (b 2))
.cble
where
-.code (:equal-based)
+.code (:eql-based)
indicates that this hash table's keys are treated using
-.code equal
+.code eql
equality, and
.code "(a 1)"
and
@@ -11306,7 +11306,7 @@ hash:
.cblk
;; not supported: splicing across the entire syntax
- (let ((hash-syntax '((:equal-based) (a 1) (b 2))))
+ (let ((hash-syntax '((:eql-based) (a 1) (b 2))))
^#H(,*hash-syntax))
.cble
@@ -11314,7 +11314,7 @@ This is correct:
.cblk
;; fine: splicing hash arguments and contents separately
- (let ((hash-args '(:equal-based))
+ (let ((hash-args '(:eql-based))
(hash-contents '((a 1) (b 2))))
^#H(,hash-args ,*hash-contents))
.cble
@@ -11840,7 +11840,7 @@ are not supported.
.TP* "Note:"
Circular notation can span hash table literals. The syntax
-.code "#1=#H(() (#1# #1#))"
+.code "#1=#H((:eql-based) (#1# #1#))"
denotes an
.codn eql -based
hash table which contains one entry, in which that
@@ -11848,7 +11848,7 @@ same table itself is both the key and value. This kind of
circularity is not supported for
.codn equal -based
hash tables. The analogous syntax
-.code "#1=#H((:equal-based) (#1# #1#))"
+.code "#1=#H(() (#1# #1#))"
produces a hash table in an inconsistent state.
.TP* "Dialect note:"
@@ -62690,6 +62690,25 @@ of these version values, the described behaviors are provided if
is given an argument which is equal or lower. For instance
.code "-C 103"
selects the behaviors described below for version 105, but not those for 102.
+.IP 188
+Until \*(TX 188,
+.codn equal -based
+hash tables printed using the notation
+.code "#H((:equal-based ...) ...)"
+whereas
+.codn eql -based
+hash tables simply omitted the
+.code :equal-based
+keyword. Changes were introduced in \*(TX 187 which gave rise to a read/print
+inconsistency with printing behavior. In \*(TX 189, further changes were
+introduced to fix this inconsistency:
+.codn equal -based
+hash tables print without any keyword indicating equality, and
+.codn eql -based
+hash tables print as
+.codn "#H((:eql-based) ...)" .
+If 188 or compatibility is selected, hash tables are printed
+in the old way.
.IP 187
Until \*(TX 187, hash tables constructed by the
.code hash