You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: md/documents/comparators.md
+15-37Lines changed: 15 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,16 +75,16 @@ Or:
75
75
"hello" in "hello world"
76
76
```
77
77
78
-
An expression cannot be used on its own, as it is not considered as an operator and thus not a valid statement. It is always accompanied by operators that take an expression as an argument. A classic example of this is the `cmp` operator:
78
+
An expression cannot be used on its own, as it is not considered as an operator and thus not a valid statement. It is always accompanied by operators that take an expression as an argument. A classic example of this is the `if` operator:
79
79
80
80
```xt
81
-
cmp 5 == 5 "out \"true\""
81
+
if (5 == 5) "prt 'true'"
82
82
```
83
83
84
-
Any operator that uses an expression creates a branch, with `true` being the first branch and `false` is the second. For example, the `cmp` operator creates a branch based on whether or not the expression is true:
84
+
Any operator that uses an expression creates a branch, with `true` being the first branch and the second acts as an `else`. For example, the `if` operator creates a branch based on whether or not the expression is true:
85
85
86
86
```xt
87
-
cmp 5 == 10 "out \"same\"" "out \"different\""
87
+
if (5 == 10) "prt 'same'" "prt 'different'"
88
88
```
89
89
90
90
## Documentation
@@ -105,7 +105,7 @@ Checks if the two variables or values are equal to each other.
105
105
Example:
106
106
107
107
```xt
108
-
cmp 5 == 5 "out \"true\""
108
+
if (5 == 5) "prt 'true'"
109
109
```
110
110
111
111
---
@@ -126,7 +126,7 @@ Checks if the two variables or values are different from each other.
126
126
Example:
127
127
128
128
```xt
129
-
cmp 5 != 10 "out \"true\""
129
+
if (5 != 10) "prt 'true'"
130
130
```
131
131
132
132
---
@@ -147,7 +147,7 @@ Checks if the source is less than the target.
147
147
Example:
148
148
149
149
```xt
150
-
cmp 5 < 10 "out \"true\""
150
+
if (5 < 10) "prt 'true'"
151
151
```
152
152
153
153
---
@@ -168,7 +168,7 @@ Checks if the source is less than or equal to the target.
168
168
Example:
169
169
170
170
```xt
171
-
cmp 5 <= 10 "out \"true\""
171
+
if (5 <= 10) "prt 'true'"
172
172
```
173
173
174
174
---
@@ -189,7 +189,7 @@ Checks if the source is greater than the target.
189
189
Example:
190
190
191
191
```xt
192
-
cmp 10 > 5 "out \"true\""
192
+
if (10 > 5) "prt 'true'"
193
193
```
194
194
195
195
---
@@ -210,7 +210,7 @@ Checks if the source is greater than or equal to the target.
210
210
Example:
211
211
212
212
```xt
213
-
cmp 10 >= 5 "out \"true\""
213
+
if (10 >= 5) "prt 'true'"
214
214
```
215
215
216
216
---
@@ -231,15 +231,15 @@ Checks if the source is in the target.
231
231
Example:
232
232
233
233
```xt
234
-
cmp "ello" in "Hello, world!" "out \"true\""
234
+
if ("ello" in "Hello, world!") "prt 'true'"
235
235
```
236
236
237
237
---
238
238
239
239
### Not In
240
240
241
241
```xt
242
-
<source> xin <target>
242
+
<source> not in <target>
243
243
```
244
244
245
245
Checks if the source is not in the target.
@@ -252,7 +252,7 @@ Checks if the source is not in the target.
252
252
Example:
253
253
254
254
```xt
255
-
cmp "bye" xin "Hello, world!" "out \"true\""
255
+
if ("bye" not in "Hello, world!") "prt 'true'"
256
256
```
257
257
258
258
---
@@ -273,33 +273,11 @@ Checks if the source is a type of the target.
273
273
Example:
274
274
275
275
```xt
276
-
cmp 5 is "int" "out \"true\""
276
+
if (5 is "int") "prt 'true'"
277
277
```
278
278
279
279
---
280
280
281
-
### From
282
-
283
-
```xt
284
-
<source> from <target>
285
-
```
286
-
287
-
Checks if the source is an instance of the target.
288
-
289
-
| Parameter | Type | Description |
290
-
| :-: | :-: | :-: |
291
-
| Source | Any | The variable or value that is being compared against |
292
-
| Target | Any | The variable or value being compared to |
Copy file name to clipboardExpand all lines: md/documents/configurations.md
+8-37Lines changed: 8 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,34 +29,19 @@
29
29
30
30
-[Main](#main)
31
31
32
-
### Q
33
-
34
-
-[Quiet](#quiet)
35
-
36
32
## About
37
33
38
34
The configuration file defines what the project would do on execution. It is always placed in the `.xtconfig` file and should be written as if it is within a `*.json` file. If one is not found in the project, the default configuration is used internally instead:
39
35
40
-
```xtconfig
36
+
```xconfig
41
37
{
42
-
"main": "main.xt",
43
-
"quiet": false
38
+
"main": "main.xpp"
44
39
}
45
40
```
46
41
47
-
If an essential field is missing, it is replaced with a default value internally instead:
48
-
49
-
```xtconfig
50
-
{
51
-
"main": "main.xt"
52
-
}
53
-
```
54
-
55
-
> Because the `quiet` field is missing, its default value, `false`, is used instead.
56
-
57
42
The configuration file can also contain non-essential information, such as the author, version, or description of your project:
58
43
59
-
```xtconfig
44
+
```xconfig
60
45
{
61
46
"author": "my-name",
62
47
"contributors": [
@@ -69,11 +54,13 @@ The configuration file can also contain non-essential information, such as the a
69
54
}
70
55
```
71
56
57
+
> This is part of the official .xconfig specification. In fact, `xpp --show <module>` will use this spec.
58
+
72
59
## Documentation
73
60
74
61
### Main
75
62
76
-
```xtconfig
63
+
```xconfig
77
64
{
78
65
"main": <path>
79
66
}
@@ -83,26 +70,10 @@ Defines the path of the main entry file.
83
70
84
71
| Parameter | Type | Default | Description |
85
72
| :-: | :-: | :-: | :-: |
86
-
| Path | String\<JSON> | "main.xt" | Main entry file path relative to the current working directory |
87
-
88
-
---
89
-
90
-
### Quiet
91
-
92
-
```xtconfig
93
-
{
94
-
"quiet": <option>
95
-
}
96
-
```
97
-
98
-
Throws errors silently.
99
-
100
-
| Parameter | Type | Default | Description |
101
-
| :-: | :-: | :-: | :-: |
102
-
| Option | Boolean\<JSON> | false | Whether or not to throw error silently |
73
+
| Path | String\<JSON> | "main.xpp" | Entrypoint relative to the current package (or cwd if it's a file) |
0 commit comments