# N.O.N. (NEXT Object Notation) v2.1 - Wishart Core Draft

## Purpose
N.O.N. v2.1 is a human-readable, indentation-based data notation designed for authored content, runtime configuration, and engine-oriented data structures.

## Core Contract
- Indentation defines nesting.
- Keys use `key: value` syntax.
- Lists use `-` items or inline arrays (`[a, b, c]`).
- Meta keys use `@` prefix.
- Strict mode enforces deterministic formatting and rejects ambiguous input.

## Design Goals
1. Human readability over punctuation density.
2. Deterministic parser behavior for toolchains.
3. Native support for game/data literals.
4. Canonical JSON bridge for interoperability.

## v2.1 Syntax Rules

### 1) Indentation
- Canonical indent: 4 spaces.
- Tabs are invalid in strict mode.
- Mixed indentation is invalid in strict mode.

### 2) Keys
- Key grammar: `@?[A-Za-z0-9_.-]+`
- Example:
  - `name: Royal Guard`
  - `@entity: npc_guard_01`

### 3) Primitives
- String (quoted or unquoted)
- Integer: `-15`, `42`
- Float: `3.14`
- Bool: `true` / `false`
- Null: `null` or `~`

### 4) Engine Literals
- Color: `#RRGGBB`
- Vector2: `(x, y)`
- Vector3: `(x, y, z)`
- Reference: `&id_name`

### 5) Lists
Inline:
```non
tags: [melee, slash, metal]
```

Block:
```non
inventory:
    - item: &sword_iron
      qty: 1
    - item: &potion_health
      qty: 2
```

## Parsing Semantics
- Scalar parse order:
  1. bool
  2. null
  3. int
  4. float
  5. color
  6. vector
  7. reference
  8. string
- Comment lines begin with `#` as first non-space char.
- A key with no inline value (`key:`) starts a nested block if the next content line is more indented.

## Canonical JSON Bridge
- References map to `{ "$ref": "id" }`
- Vectors map to `{ x, y }` or `{ x, y, z }`
- `@` keys map to `_meta`

Example:
```json
{
  "_meta": { "entity": "npc_guard_01" },
  "name": "Royal Guard",
  "position": { "x": 120, "y": 0, "z": 45 },
  "target": { "$ref": "enemy_01" }
}
```

## Strict vs Lenient
- Strict mode: fatal on tabs, mixed indentation, malformed key lines.
- Lenient mode: attempts parse recovery for non-critical formatting drift.

## Minimal Conformance Test Matrix
1. Basic object parse.
2. Nested object parse with 4-space indentation.
3. Dash list parse.
4. Inline list parse.
5. Vector parsing.
6. Color parsing.
7. Reference parsing.
8. Meta mapping to `_meta`.
9. Strict mode tab rejection.
10. Strict mode malformed key rejection.

## Status
- Version: 2.1 Draft
- Engine posture: Integration-ready for internal projects.
