Commits

Taku Miyakawa committed a807b6e

Renames SHOW.builder to SHOW_BUILDER.new

  • Participants
  • Parent commits 17f0cb5

Comments (0)

Files changed (7)

src/main/kink/REPL.kn

 
 :Env_proto = module('CORE').child(
     'show' { > :Env ()
-        use('SHOW')
-        SHOW.builder('env')
+        use('SHOW_BUILDER')
+        SHOW_BUILDER.new('env')
         .add('#repl' '(repl)'.show)
         .add('hash')
         .build(Env)

src/main/kink/SHOW.kn

-#!/usr/bin/env kink
-# vim: et sw=4 sts=4
-
-# Copyright (c) 2013 Miyakawa Taku
-# 
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-# 
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-# 
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-# Make a new builder.
-:builder = { (:Tag)
-    Builder_proto.child('Tag' Tag 'Pairs' [])
-}
-
-:Builder_proto = value(
-    'Tag' 'unknown'
-    'Pairs' []
-    'add' { > :Builder (:Label :Value)
-        :_proc = :Value.exists?.then {
-            { Value.str }
-        } {
-            { (:Target) Target.var(Label).call.show }
-        }
-        Builder.Pairs.push([Label $_proc])
-        Builder
-    }
-    'build' { > :Builder (:Target)
-        :Fragments = ['<']
-        Fragments.push(Builder.Tag)
-        Fragments.append(
-            Builder.Pairs.concat_map { ([:Label :_proc])
-                [':' Label '=' _proc(Target)]
-            }
-        )
-        Fragments.push('>')
-        Fragments.join
-    }
-)

src/main/kink/SHOW_BUILDER.kn

+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+# Make a new builder.
+:new = { (:Tag)
+    Builder_proto.child('Tag' Tag 'Pairs' [])
+}
+
+:Builder_proto = value(
+    'Tag' 'unknown'
+    'Pairs' []
+    'add' { > :Builder (:Label :Value)
+        :_proc = :Value.exists?.then {
+            { Value.str }
+        } {
+            { (:Target) Target.var(Label).call.show }
+        }
+        Builder.Pairs.push([Label $_proc])
+        Builder
+    }
+    'build' { > :Builder (:Target)
+        :Fragments = ['<']
+        Fragments.push(Builder.Tag)
+        Fragments.append(
+            Builder.Pairs.concat_map { ([:Label :_proc])
+                [':' Label '=' _proc(Target)]
+            }
+        )
+        Fragments.push('>')
+        Fragments.join
+    }
+)

src/main/kink/TEST.kn

     }
 
     'show' { > :Self ()
-        use('SHOW')
-        SHOW.builder('test_group').add('full_ids').add('full_descriptions').build(Self)
+        use('SHOW_BUILDER')
+        SHOW_BUILDER.new('test_group').add('full_ids').add('full_descriptions').build(Self)
     }
 )
 
     }
 
     'show' { > :Self ()
-        use('SHOW')
-        SHOW.builder('test').add('full_ids').add('full_descriptions').build(Self)
+        use('SHOW_BUILDER')
+        SHOW_BUILDER.new('test').add('full_ids').add('full_descriptions').build(Self)
     }
 
     'test??' { true }

src/main/kink/THREAD_LOCAL_STORAGE.kn

 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 # THE SOFTWARE.
 
-use('SHOW')
+use('SHOW_BUILDER')
 use('META.meta')
 use('JAVA.null')
 use('SCOPE_GUARD.guarding')
 
     ### .show => /str
     'show' { > :Self ()
-        SHOW.builder('thread_local_storage')
+        SHOW_BUILDER.new('thread_local_storage')
         .add('hash')
         .build(Self)
     }

src/test/kink/SHOW_BUILDER_test.kn

+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('SHOW_BUILDER')
+use('TEST.test')
+
+# Tests SHOW_BUILDER.new
+test {
+    :Tweet = value(
+        'id' { 12345 }
+        'text' { 'Hacking now!' }
+    )
+    :Show = SHOW_BUILDER.new('tweet')
+    .add('id')
+    .add('text')
+    .add('state' '(deleted)')
+    .build(Tweet)
+    Show.check("<tweet:id=12345:text='Hacking now!':state=(deleted)>")
+}

src/test/kink/SHOW_test.kn

-#!/usr/bin/env kink
-# vim: et sw=4 sts=4
-
-# Copyright (c) 2013 Miyakawa Taku
-# 
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-# 
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-# 
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-use('SHOW')
-use('TEST.test')
-
-# Tests SHOW.builder
-test {
-    :Tweet = value(
-        'id' { 12345 }
-        'text' { 'Hacking now!' }
-    )
-    :Show = SHOW.builder('tweet')
-    .add('id')
-    .add('text')
-    .add('state' '(deleted)')
-    .build(Tweet)
-    Show.check("<tweet:id=12345:text='Hacking now!':state=(deleted)>")
-}