Skip to content

Commit

Permalink
Merge the x3 branch back into main
Browse files Browse the repository at this point in the history
Merge pull request #4 from iiPythonx/x3
  • Loading branch information
iiPythonx authored Apr 10, 2023
2 parents e0902e3 + dc4c430 commit 73e0633
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 194 deletions.
4 changes: 2 additions & 2 deletions md/documents/comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ A comment always starts with two colons `::` and can be placed at the end of any

```xt
:: This is a comment
out 5 :: This is a comment
prt 5 :: This is an inline comment
```

---

Last Updated: February 6th, 2022 by Dm123321_31mD
Last Updated: April 9th, 2023 by iiPython

[↑ Go To Top](#x--documents--comments)
52 changes: 15 additions & 37 deletions md/documents/comparators.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ Or:
"hello" in "hello world"
```

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:
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:

```xt
cmp 5 == 5 "out \"true\""
if (5 == 5) "prt 'true'"
```

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:
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:

```xt
cmp 5 == 10 "out \"same\"" "out \"different\""
if (5 == 10) "prt 'same'" "prt 'different'"
```

## Documentation
Expand All @@ -105,7 +105,7 @@ Checks if the two variables or values are equal to each other.
Example:

```xt
cmp 5 == 5 "out \"true\""
if (5 == 5) "prt 'true'"
```

---
Expand All @@ -126,7 +126,7 @@ Checks if the two variables or values are different from each other.
Example:

```xt
cmp 5 != 10 "out \"true\""
if (5 != 10) "prt 'true'"
```

---
Expand All @@ -147,7 +147,7 @@ Checks if the source is less than the target.
Example:

```xt
cmp 5 < 10 "out \"true\""
if (5 < 10) "prt 'true'"
```

---
Expand All @@ -168,7 +168,7 @@ Checks if the source is less than or equal to the target.
Example:

```xt
cmp 5 <= 10 "out \"true\""
if (5 <= 10) "prt 'true'"
```

---
Expand All @@ -189,7 +189,7 @@ Checks if the source is greater than the target.
Example:

```xt
cmp 10 > 5 "out \"true\""
if (10 > 5) "prt 'true'"
```

---
Expand All @@ -210,7 +210,7 @@ Checks if the source is greater than or equal to the target.
Example:

```xt
cmp 10 >= 5 "out \"true\""
if (10 >= 5) "prt 'true'"
```

---
Expand All @@ -231,15 +231,15 @@ Checks if the source is in the target.
Example:

```xt
cmp "ello" in "Hello, world!" "out \"true\""
if ("ello" in "Hello, world!") "prt 'true'"
```

---

### Not In

```xt
<source> xin <target>
<source> not in <target>
```

Checks if the source is not in the target.
Expand All @@ -252,7 +252,7 @@ Checks if the source is not in the target.
Example:

```xt
cmp "bye" xin "Hello, world!" "out \"true\""
if ("bye" not in "Hello, world!") "prt 'true'"
```

---
Expand All @@ -273,33 +273,11 @@ Checks if the source is a type of the target.
Example:

```xt
cmp 5 is "int" "out \"true\""
if (5 is "int") "prt 'true'"
```

---

### From

```xt
<source> from <target>
```

Checks if the source is an instance of the target.

| Parameter | Type | Description |
| :-: | :-: | :-: |
| Source | Any | The variable or value that is being compared against |
| Target | Any | The variable or value being compared to |

Example:

```xt
evl "setvar('int', int)"
cmp 5 from int "out \"true\""
```

---

Last Updated: February 6th, 2022 by Dm123321_31mD
Last Updated: April 9th, 2023 by iiPython

[↑ Go To Top](#x--documents--comparators)
45 changes: 8 additions & 37 deletions md/documents/configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,19 @@

- [Main](#main)

### Q

- [Quiet](#quiet)

## About

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:

```xtconfig
```xconfig
{
"main": "main.xt",
"quiet": false
"main": "main.xpp"
}
```

If an essential field is missing, it is replaced with a default value internally instead:

```xtconfig
{
"main": "main.xt"
}
```

> Because the `quiet` field is missing, its default value, `false`, is used instead.
The configuration file can also contain non-essential information, such as the author, version, or description of your project:

```xtconfig
```xconfig
{
"author": "my-name",
"contributors": [
Expand All @@ -69,11 +54,13 @@ The configuration file can also contain non-essential information, such as the a
}
```

> This is part of the official .xconfig specification. In fact, `xpp --show <module>` will use this spec.
## Documentation

### Main

```xtconfig
```xconfig
{
"main": <path>
}
Expand All @@ -83,26 +70,10 @@ Defines the path of the main entry file.

| Parameter | Type | Default | Description |
| :-: | :-: | :-: | :-: |
| Path | String\<JSON> | "main.xt" | Main entry file path relative to the current working directory |

---

### Quiet

```xtconfig
{
"quiet": <option>
}
```

Throws errors silently.

| Parameter | Type | Default | Description |
| :-: | :-: | :-: | :-: |
| Option | Boolean\<JSON> | false | Whether or not to throw error silently |
| Path | String\<JSON> | "main.xpp" | Entrypoint relative to the current package (or cwd if it's a file) |

---

Last Updated: February 6th, 2022 by Dm123321_31mD
Last Updated: April 9th, 2023 by iiPython

[↑ Go To Top](#x--documents--configurations)
Loading

0 comments on commit 73e0633

Please sign in to comment.