diff --git a/extra/morse/morse-docs.factor b/extra/morse/morse-docs.factor index 60befeb2af..c11ba23db7 100644 --- a/extra/morse/morse-docs.factor +++ b/extra/morse/morse-docs.factor @@ -1,6 +1,7 @@ ! Copyright (C) 2007 Alex Chapman ! See http://factorcode.org/license.txt for BSD license. -USING: help.markup help.syntax morse ; +USING: help.markup help.syntax ; +IN: morse HELP: ch>morse { $values @@ -11,3 +12,14 @@ HELP: morse>ch { $values { "str" "A string of dots and dashes that represents a single character in morse code" } { "ch" "The translated character" } } { $description "If the given string represents a morse code character, then return that character, otherwise return f" } ; + +HELP: >morse +{ $values + { "str" "A string of ASCII characters which can be translated into morse code" } { "str" "A string in morse code" } } +{ $description "Translates ASCII text into morse code, represented by a series of dots, dashes, and slashes." } +{ $see-also morse> ch>morse } ; + +HELP: morse> +{ $values { "str" "A string of morse code, in which the character '.' represents dots, '-' dashes, ' ' spaces between letters, and ' / ' spaces between words." } { "str" "The ASCII translation of the given string" } } +{ $description "Translates morse code into ASCII text" } +{ $see-also >morse morse>ch } ; diff --git a/extra/morse/morse.factor b/extra/morse/morse.factor index fdb4bf7c4e..e88e2f6c83 100644 --- a/extra/morse/morse.factor +++ b/extra/morse/morse.factor @@ -88,7 +88,7 @@ PRIVATE> : dot ( -- ch ) CHAR: . ; : dash ( -- ch ) CHAR: - ; : char-gap ( -- ch ) CHAR: \s ; -: word-gap ( -- ch ) " / " ; +: word-gap ( -- ch ) CHAR: / ; : =parser ( obj -- parser ) [ = ] curry satisfy ; @@ -103,7 +103,7 @@ LAZY: 'char-gap' ( -- parser ) char-gap =parser ; LAZY: 'word-gap' ( -- parser ) - word-gap token ; + word-gap =parser ; LAZY: 'morse-char' ( -- parser ) 'dot' 'dash' <|> <+> ;