Updated highlighting

This commit is contained in:
2026-05-14 01:19:11 +02:00
parent 05eab4145c
commit e7d5d9a77b
10 changed files with 37 additions and 37 deletions
+5 -5
View File
@@ -10,7 +10,7 @@ Control flow in Mist provides a bridge between C-style procedural logic and Rust
The `if` statement evaluates a boolean expression. It supports multiple `else if` branches and an optional `else` block.
```cpp
```mist
if (score > 50) {
println!("Pass");
} else if (score == 50) {
@@ -24,7 +24,7 @@ if (score > 50) {
The `match` statement provides exhaustive pattern matching. Currently, every match arm requires a block `{}` following the `=>` operator.
```cpp
```mist
match (task_state) {
TaskState::Pending => {
println!("Queued");
@@ -46,7 +46,7 @@ Mist supports both functional iteration and traditional low-level loop control.
For manual iteration control, Mist supports the standard three-part `for` loop: initialization, condition, and post-iteration statement.
```cpp
```mist
for (var mut i = 0; i < 10; i = i + 1;) {
println!("Index: {}", i);
}
@@ -56,7 +56,7 @@ for (var mut i = 0; i < 10; i = i + 1;) {
The `for-in` loop iterates over collections or iterators using Mist's pattern matching system.
```cpp
```mist
for (var item in collection) {
process(item);
}
@@ -71,7 +71,7 @@ for ((i32 x, i32 y) in coordinates) {
The `while` loop continues execution as long as the parenthesized expression evaluates to `true`.
```cpp
```mist
while (active) {
wait_for_event();
}
+4 -4
View File
@@ -10,7 +10,7 @@ Expressions in Mist are the fundamental units that evaluate to a value. The synt
Primary expressions are the starting point of any logic chain. These include literal values, paths to static members, or grouped expressions in tuples.
```java
```mist
// Literals and paths
var x = 42;
var y = Math::PI;
@@ -24,7 +24,7 @@ var coordinates = (10, 20, 30);
Postfix expressions allow you to build on a primary value. This includes calling functions, accessing fields, indexing arrays, or initializing structs.
```java
```mist
// Field access and method/function calls
var len = list.length();
@@ -44,7 +44,7 @@ println!("Value: {}", first); // Macro call via '!'
Prefixes modify the primary expression that follows them. Mist uses these for logical negation, dereferencing, and creating references.
```java
```mist
var mut value = 10;
var ref = &value; // Reference
@@ -58,7 +58,7 @@ var is_false = !true; // Logical NOT
Binary operations are applied as postfixes to an expression, following a `bin_op ~ expr` pattern. This supports all standard arithmetic, comparison, and logical operators.
```java
```mist
var sum = 10 + 20;
var is_equal = (x == y);
var complex = (a + b) * (c / d);
+5 -5
View File
@@ -10,7 +10,7 @@ In Mist, variables follow the language-wide `type name` convention. For local sc
Variables are declared using the `var` keyword for automatic type inference. Like Rust, variables are immutable by default.
```java
```mist
var message = "Hello Mist"; // Inferred as str*
var count = 42; // Inferred as i32
```
@@ -19,7 +19,7 @@ var count = 42; // Inferred as i32
To allow a variable to be reassigned, use the `mut` modifier after the `var` keyword or the explicit type.
```rust
```mist
var mut score = 0;
score = 100;
@@ -31,7 +31,7 @@ price = 14.99;
While `var` handles inference, you can explicitly define the type before the identifier. This is often used for clarity in complex logic or when the specific numeric width (e.g., `u8` vs `i32`) matters.
```rust
```mist
u64 large_id = 1000234;
bool is_active = true;
```
@@ -40,7 +40,7 @@ bool is_active = true;
Because variable declarations are patterns, you can destructure tuples or structures directly. This keeps data extraction clean and avoids manual indexing.
```rust
```mist
// Destructuring a tuple into local variables
(i32, i32) (x, y) = get_coordinates();
@@ -52,7 +52,7 @@ Because variable declarations are patterns, you can destructure tuples or struct
Constants are immutable values that are evaluated at compile time. They require an explicit type and follow the `const` keyword.
```rust
```mist
const i32 MAX_RETRIES = 5;
const str* VERSION = "1.0.4";
```