Skip to content

Commit f23f909

Browse files
committed
Cleanup
1 parent 2267836 commit f23f909

File tree

2 files changed

+16
-25
lines changed

2 files changed

+16
-25
lines changed

docs-language/syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ if (condition) [
115115
### Expressions
116116

117117
- Expression grammar supports binary operations (`+`, `-`, `*`, `/`, `^`), comparisons (`==`, `!=`, `>`, `<`, `>=`, `<=`), logical operators (`&&`, `||`, `!`), function calls, method calls, list literals, and attribute access.
118-
- Method chaining uses dots: `color.to.oklch().values()`.
118+
- Method chaining uses dots: `color.to.oklch().to_string()`.
119119

120120
## Operator Precedence (High to Low)
121121

docs-language/types.md

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ sidebar_label: Types
66

77
# Types and Symbols
88

9-
Every TokenScript variable declaration specifies a type using `Type` or `Type.SubType` notation. The interpreter enforces type correctness during assignment and method calls by instantiating corresponding `Symbol` classes (`src/interpreter/symbols.ts`). This chapter documents each built-in type.
9+
Every TokenScript variable declaration specifies a type using `Type` or `Type.SubType` notation. The interpreter enforces type correctness during assignment and method calls by instantiating corresponding `Symbol` classes.
1010

1111
## Declarations & Defaults
1212

1313
- `variable name: Type;` initializes `name` with the type’s `empty()` value, if no initializer is provided.
14-
- Subtypes (`Type.SubType`) are primarily used for colors. For other types, the interpreter treats `Type` and `Type.Something` equivalently unless extension managers add meaning.
14+
- Subtypes (`Type.SubType`) are primarily used for colors.
1515
- Reassignments must respect the declared type; the interpreter throws an `InterpreterError` on mismatch.
1616

1717
## Primitive Types
@@ -27,8 +27,6 @@ Every TokenScript variable declaration specifies a type using `Type` or `Type.Su
2727
|-------------|------------------------------------|------------------------------------------------------------------------------------------------------------------------|
2828
| `to_string` | `Number.to_string(radix?: Number)` | Returns the numeric value as a string. Radix (2–36) is optional; base 16 rounds halves downward for color conversions. |
2929

30-
- Attributes: `value` (read-only `Number`).
31-
3230
### String
3331

3432
- Represents UTF-8 strings.
@@ -68,13 +66,10 @@ Every TokenScript variable declaration specifies a type using `Type` or `Type.Su
6866
| `to_number` | `NumberWithUnit.to_number()` | Returns the unitless numeric value. |
6967
| | | |
7068

71-
- Attributes: `value` (`Number`).
72-
- Arithmetic operators respect units; the `UnitManager` converts compatible units or throws descriptive errors (e.g., mixing `px` and `deg`).
73-
7469
## List
7570

7671
- Heterogeneous ordered collection.
77-
- Declared with `List`. Subtype hints (e.g., `List.String`) are allowed syntactically but not enforced at runtime.
72+
- Declared with `List`.
7873
- Created via comma-separated literals or dynamic operations.
7974
- Methods:
8075

@@ -94,22 +89,20 @@ Every TokenScript variable declaration specifies a type using `Type` or `Type.Su
9489

9590
## Dictionary
9691

97-
- Map of string keys to symbol values.
92+
- Ordered Map of string keys to symbol values.
9893
- Declared with `Dictionary`.
9994
- Methods:
10095

101-
| Method | Signature | Description |
102-
|-----------------------------|--------------------------------------|-------------------------------------------|
103-
| `get` | `Dictionary.get(key: String)` | Returns the stored value or `null`. |
104-
| `set` | `Dictionary.set(key: String, value)` | Assigns a key and returns the dictionary. |
105-
| `delete` | `Dictionary.delete(key: String)` | Removes a key if present. |
106-
| `keys` | `Dictionary.keys()` | Returns keys as `List`. |
107-
| `values` | `Dictionary.values()` | Returns values as `List`. |
108-
| `key_exists` / `key_exists` | `Dictionary.keyexists(key: String)` | Returns `Boolean` flag. |
109-
| `length` | `Dictionary.length()` | Number of entries. |
110-
| `clear` | `Dictionary.clear()` | Removes all entries. |
111-
112-
- Attribute access retrieves entries directly (`dictionary.someKey`), mirroring `get`.
96+
| Method | Signature | Description |
97+
|--------------|--------------------------------------|-------------------------------------------|
98+
| `get` | `Dictionary.get(key: String)` | Returns the stored value or `null`. |
99+
| `set` | `Dictionary.set(key: String, value)` | Assigns a key and returns the dictionary. |
100+
| `delete` | `Dictionary.delete(key: String)` | Removes a key if present. |
101+
| `keys` | `Dictionary.keys()` | Returns keys as `List`. |
102+
| `values` | `Dictionary.values()` | Returns values as `List`. |
103+
| `key_exists` | `Dictionary.key_exists(key: String)` | Returns `Boolean` flag. |
104+
| `length` | `Dictionary.length()` | Number of entries. |
105+
| `clear` | `Dictionary.clear()` | Removes all entries. |
113106

114107
## Color
115108

@@ -133,13 +126,11 @@ Every TokenScript variable declaration specifies a type using `Type` or `Type.Su
133126

134127
## References
135128

136-
- Reference literals (`{token.name}`) resolve to values from the interpreter’s reference map or the shared map used by `TokenSetResolver`.
129+
- Reference literals (`{token.name}`) resolve to values from the interpreter’s reference map.
137130
- References do not introduce a distinct type; they evaluate to whichever symbol is stored for the token.
138131

139132
## Type Equality & Coercion
140133

141134
- Equality comparisons require operands of the same type (with special cases for `Null` and hex colors).
142135
- `Number` and `NumberWithUnit` interoperate in math operations via `UnitManager` conversions.
143136
- Attempting to mix incompatible units, compare unlike types, or call undefined methods results in an `InterpreterError` with the originating token metadata.
144-
145-
Proceed to [Control Flow](control-flow.md) to learn how statements execute and how loops are guarded against infinite execution.

0 commit comments

Comments
 (0)