From 08439ee27125539e66cac4a6f2ddf6488878a601 Mon Sep 17 00:00:00 2001 From: JJ Date: Thu, 16 May 2024 20:27:10 -0700 Subject: docs: update highlighting --- docs/book/SYNTAX.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'docs/book/SYNTAX.html') diff --git a/docs/book/SYNTAX.html b/docs/book/SYNTAX.html index 4860718..6783b5e 100644 --- a/docs/book/SYNTAX.html +++ b/docs/book/SYNTAX.html @@ -176,7 +176,7 @@

Syntax: A Casual and Formal Look

Call Syntax

There is little difference between a function, macro, and operator call. There are only a few forms such calls can take, too, though notably more than most other languages (due to, among other things, uniform function call syntax): hence this section.

-
# The standard, unambiguous call.
+
# The standard, unambiguous call.
 routine(1, 2, 3, 4)
 # The method call syntax equivalent.
 1.routine(2, 3, 4)
@@ -191,7 +191,7 @@ routine
 routine 1, 2, 3, 4
 

Binary operators have some special rules.

-
# Valid call syntaxes for binary operators. What can constitute a binary
+
# Valid call syntaxes for binary operators. What can constitute a binary
 # operator is constrained for parsing's sake. Whitespace is optional.
 1 + 2
 1+2
@@ -199,12 +199,12 @@ routine 1, 2, 3, 4
 +(1, 2)
 

As do unary operators.

-
# The standard call for unary operators. Postfix.
+
# The standard call for unary operators. Postfix.
 1?
 ?(1)
 

Method call syntax has a number of advantages: notably that it can be chained: acting as a natural pipe operator. Redundant parenthesis can also be omitted.

-
# The following statements are equivalent:
+
# The following statements are equivalent:
 foo.bar.baz
 foo().bar().baz()
 baz(bar(foo))
@@ -252,7 +252,7 @@ of this then ...
 of that then ...
 

A line beginning with a scope token is treated as attached to the previous expression.

-
# Technically allowed. Please don't do this.
+
# Technically allowed. Please don't do this.
 let foo
 = ...
 
@@ -271,7 +271,7 @@ then ...
 of that then ...
 

This can lead to some ugly possibilities for formatting that are best avoided.

-
# Much preferred.
+
# Much preferred.
 
 let foo =
   ...
@@ -298,7 +298,7 @@ of that then ...
 

First, a word on the distinction between expressions and statements. Expressions return a value. Statements do not. That is all.

There are some syntactic constructs unambiguously recognizable as statements: all declarations, modules, and use statements. There are no syntactic constructs unambiguously recognizable as expressions. As calls returning void are treated as statements, and expressions that return a type could possibly return void, there is no explicit distinction between expressions and statements made in the parser: or anywhere before type-checking.

Expressions can go almost anywhere. Our indentation rules above allow for it.

-
# Some different formulations of valid expressions.
+
# Some different formulations of valid expressions.
 
 if cond then
   this
@@ -320,7 +320,7 @@ let foo =
   else
     that
 
-
# Some different formulations of *invalid* expressions.
+
# Some different formulations of *invalid* expressions.
 # These primarily break the rule that everything following a scope token
 # (ex. `=`, `do`, `then`) not at the end of the line must be self-contained.
 
-- 
cgit v1.2.3-70-g09d2