(Arne Babenhauserheide)
2014-07-14: note parens and strings. note parens and strings.
diff --git a/docs/srfi.org b/docs/srfi.org --- a/docs/srfi.org +++ b/docs/srfi.org @@ -236,7 +236,7 @@ The syntax shown here is the minimal syn - =_= to survive HTML ** More detailed: Wisp syntax rules - + *** Unindented line *A line without indentation is a function call*, just as if it would start with a bracket. @@ -252,7 +252,6 @@ The syntax shown here is the minimal syn display ; (display string-append "Hello " "World!" ; (string-append "Hello " "World!")) #+END_SRC - *** Closing line *A line which is not more indented than previous line(s) closes the brackets of all previous lines which have higher or equal indentation*. You should only reduce the indentation to indentation levels which were already used by parent lines, else the behaviour is undefined. @@ -263,7 +262,6 @@ The syntax shown here is the minimal syn display "Hello Again!" ; (display "Hello Again!") #+END_SRC - *** Prefixed line *To add any of ' , ` #' #, #` or #@, to the first bracket on a line, just prefix the line with that symbol* followed by at least one space. Implementations are free to add more prefix symbols. @@ -273,7 +271,6 @@ The syntax shown here is the minimal syn #+END_SRC - *** Continuing line *A line whose first non-whitespace characters is a dot followed by a space (". ") does not open a new bracket: it is treated as simple continuation of the first less indented previous line*. In the first line this means that this line does not start with a bracket and does not end with a bracket, just as if you had directly written it in lisp without the leading ". ". @@ -284,7 +281,6 @@ The syntax shown here is the minimal syn #+END_SRC - *** Empty indentation level *A line which contains only whitespace and a colon (":") defines an indentation level at the indentation of the colon*. It opens a bracket which gets closed by the next less-indented line. If you need to use a colon by itself. you can escape it as "\:". @@ -296,7 +292,6 @@ The syntax shown here is the minimal syn #+END_SRC - *** Inline Colon *A colon sourrounded by whitespace (" : ") starts a bracket which gets closed at the end of the line*. @@ -317,14 +312,33 @@ If the colon starts a line, it starts a ___ string-append "Hello " who "!" ; (string-append "Hello " who "!"))) #+END_SRC +*** Parens and Strings +*Linebreaks inside parentheses and strings are not considered linebreaks* for parsing indentation. To use parentheses at the beginning of a line without getting double parens, prefix the line with a period. + +#+BEGIN_SRC wisp +define : stringy s + string-append s "can be varied as follows: +" + string-capitalize s + string-reverse s + . (string-capitalize + (string-reverse s)) + . " +" + +#+END_SRC ** Clarifications - Code-blocks end after 2 empty lines followed by a newline. Indented non-empty lines after 2 empty lines should be treated as error. A line is empty if it only contains whitespace. -- square brackets and curly braces should be treated the same way as parentheses: They stop the indentation processing until they are closed. +- Inside parentheses wisp parsing is disabled. Consequently linebreaks inside parentheses are not considered linebreaks for wisp-parsing. For the parser everything which happens inside parentheses is considered as a black box. -- a colon (:) at the beginning of a line adds an extra open parentheses that gets closed at end-of-line (rule 4.2.7) *and* defines an indentation level. +- Square brackets and curly braces should be treated the same way as parentheses: They stop the indentation processing until they are closed. + +- Likewise linebreaks inside strings are not considered linebreaks for wisp-parsing. + +- A colon (:) at the beginning of a line adds an extra open parentheses that gets closed at end-of-line (rule 4.2.7) *and* defines an indentation level. * Syntax justification