Skip to content

Commit b32f28a

Browse files
committed
Update docs
1 parent 7b5f72b commit b32f28a

5 files changed

+14
-45
lines changed

docs/Getting-Started.md

-2
Original file line numberDiff line numberDiff line change
@@ -174,5 +174,3 @@ Here is another example with a few function signatures:
174174
new(func(string) int),
175175
)
176176
```
177-
178-
* Next: [Operator Overloading](Operator-Overloading.md)

docs/Internals.md

-2
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,3 @@ fib(42)
7676
Will be replaced with the result of `fib`(42)` on the compile step.
7777

7878
[ConstExpr Example](https://pkg.go.dev/github.com/antonmedv/expr?tab=doc#ConstExpr)
79-
80-
* Next: [Tips](Tips.md)

docs/Language-Definition.md

+14-37
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@
4242
<tr>
4343
<td>Map</td>
4444
<td>
45-
<code>{a: 1, b: 2, c: 3}</code>
45+
<code>&#123;a: 1, b: 2, c: 3&#125;</code>
4646
</td>
4747
</tr>
4848
<tr>
49-
<td>Nil</t
50-
d>
49+
<td>Nil</td>
5150
<td>
5251
<code>nil</code>
5352
</td>
@@ -116,11 +115,11 @@ d>
116115

117116
Examples:
118117

119-
```c++
118+
```expr
120119
user.Age in 18..45 and user.Name not in ["admin", "root"]
121120
```
122121

123-
```c++
122+
```expr
124123
foo matches "^[A-Z].*"
125124
```
126125

@@ -143,7 +142,7 @@ The `?.` operator can be used to access a field of a struct or an item of a map
143142
without checking if the struct or the map is `nil`. If the struct or the map is
144143
`nil`, the result of the expression is `nil`.
145144

146-
```c++
145+
```expr
147146
author?.User?.Name
148147
```
149148

@@ -152,7 +151,7 @@ author?.User?.Name
152151
The `??` operator can be used to return the left-hand side if it is not `nil`,
153152
otherwise the right-hand side is returned.
154153

155-
```c++
154+
```expr
156155
author?.User?.Name ?? "Anonymous"
157156
```
158157

@@ -162,7 +161,7 @@ The slice operator `[:]` can be used to access a slice of an array.
162161

163162
For example, variable `array` is `[1, 2, 3, 4, 5]`:
164163

165-
```c++
164+
```expr
166165
array[1:4] == [2, 3, 4]
167166
array[1:-1] == [2, 3, 4]
168167
array[:3] == [1, 2, 3]
@@ -173,34 +172,12 @@ array[:] == array
173172

174173
## Built-in Functions
175174

176-
<table>
177-
<tr>
178-
<td>
179-
<a href="#allarray-predicate">all()</a><br>
180-
<a href="#anyarray-predicate">any()</a><br>
181-
<a href="#onearray-predicate">one()</a><br>
182-
<a href="#nonearray-predicate">none()</a><br>
183-
</td>
184-
<td>
185-
<a href="#maparray-predicate">map()</a><br>
186-
<a href="#filterarray-predicate">filter()</a><br>
187-
<a href="#countarray-predicate">count()</a><br>
188-
</td>
189-
<td>
190-
<a href="#lenv">len()</a><br>
191-
<a href="#absv">abs()</a><br>
192-
<a href="#intv">int()</a><br>
193-
<a href="#floatv">float()</a><br>
194-
</td>
195-
</tr>
196-
</table>
197-
198175
### all(array, predicate)
199176

200177
Returns **true** if all elements satisfies the [predicate](#predicate).
201178
If the array is empty, returns **true**.
202179

203-
```c++
180+
```expr
204181
all(Tweets, {.Size < 280})
205182
```
206183

@@ -214,7 +191,7 @@ If the array is empty, returns **false**.
214191
Returns **true** if _exactly one_ element satisfies the [predicate](#predicate).
215192
If the array is empty, returns **false**.
216193

217-
```c++
194+
```expr
218195
one(Participants, {.Winner})
219196
```
220197

@@ -237,7 +214,7 @@ Returns new array by filtering elements of the array by [predicate](#predicate).
237214
Returns the number of elements what satisfies the [predicate](#predicate).
238215
Equivalent to:
239216

240-
```c++
217+
```expr
241218
len(filter(array, predicate))
242219
```
243220

@@ -253,7 +230,7 @@ Returns the absolute value of a number.
253230

254231
Returns the integer value of a number or a string.
255232

256-
```c++
233+
```expr
257234
int("123") == 123
258235
```
259236

@@ -266,19 +243,19 @@ Returns the float value of a number or a string.
266243
The predicate is an expression that accepts a single argument. To access
267244
the argument use the `#` symbol.
268245

269-
```c++
246+
```expr
270247
map(0..9, {# / 2})
271248
```
272249

273250
If items of the array is a struct or a map, it is possible to access fields with
274251
omitted `#` symbol (`#.Value` becomes `.Value`).
275252

276-
```c++
253+
```expr
277254
filter(Tweets, {len(.Value) > 280})
278255
```
279256

280257
Braces `{` `}` can be omitted:
281258

282-
```c++
259+
```expr
283260
filter(Tweets, len(.Value) > 280)
284261
```

docs/Operator-Overloading.md

-2
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,3 @@ func (Env) Sub(a, b time.Time) time.Duration { return a.Sub(b) }
5050
**Expr** uses functions from `Env` for operator overloading. If types of
5151
operands match types of a function, the operator will be replaced with a
5252
function call.
53-
54-
* Next: [Visitor and Patch](Visitor-and-Patch.md)

docs/Visitor-and-Patch.md

-2
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,3 @@ func (p *stringerPatcher) Visit(node *ast.Node) {
142142

143143
}
144144
```
145-
146-
* Next: [Internals](Internals.md)

0 commit comments

Comments
 (0)