diff --git a/README.md b/README.md index 6eb35cd..ecf09fa 100644 --- a/README.md +++ b/README.md @@ -222,8 +222,8 @@ If set, clac will search for `$HOME/.config/clac/words`. ### How to define words -Words are defined as aliases, with one alias on each line. Empty -lines and lines starting with `#` are ignored. Here are some examples: +Words are defined as aliases, with one alias on each line. +Empty lines are ignored. Here are some examples: ```shell pi 3.14159265358979323846 @@ -251,6 +251,22 @@ $ clac "42 dup * pi *" 5541.76944093239 ``` +### Comments + +Any lines that begin with `#` are considered comments and +are ignored. There are no inline comments, and any `#` +characters that are not the first character of a line are +interpreted literally. To define `#` as a word, wrap it in +double quotes in the definition: + +```shell +# This is a comment. +"#" count +``` + +The first line is ignored, and the second line assigns `#` +to the operation `count`. + ### How to list defined words If you type `words` and hit enter, clac will list the defined words. diff --git a/clac.1 b/clac.1 index ad6a412..732dc4e 100644 --- a/clac.1 +++ b/clac.1 @@ -251,6 +251,26 @@ User defined words can be used as if they were built-in commands: .Dl $ clac Qq "42 dup * pi *" .Dl Sy 5541.76944093239 . +.Ss Comments +. +Any lines that begin with +.Sy # +are considered comments and are ignored. There are no inline comments, +and any +.Sy # +characters that are not the first character of a line are interpreted +literally. To define +.Sy # +as a word, wrap it in double quotes in the definition: +.Pp +.Dl # This is a comment. +.Dl \(dq#\(dq count +.Pp +The first line is ignored, and the second line assigns +.Sy # +to the operation +.Sy count. +. .Ss How to list defined words . If you type `words` and hit enter, clac will list the defined words.