# lawref.term_sugar

*module*

Independent reference lowering for the ``term`` sugar (SPEC [§86.1](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/12-part-xii-events-actions-temporal-model.ru.md#861-именованный-срок-с-особыми-случаями-term)).

This is intentionally a small handwritten parser.  It does not import, invoke,
or otherwise reuse ``lawc``: the point of the module is to give the byte-level
differential gate a genuinely independent implementation of DECISION-0101.
Only the closed [§86.1](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/12-part-xii-events-actions-temporal-model.ru.md#861-именованный-срок-с-особыми-случаями-term) surface is accepted; unsupported syntax fails loudly.

## lawref.term_sugar.Call

*class* · *dataclass*

```python
class Call
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L31-L34)

### lawref.term_sugar.Call.args

*attribute* · *instance attribute*

```python
args: tuple[object, ...]
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L34-L34)

### lawref.term_sugar.Call.name

*attribute* · *instance attribute*

```python
name: str
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L33-L33)

## lawref.term_sugar.Case

*class* · *dataclass*

```python
class Case
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L51-L56)

### lawref.term_sugar.Case.duration

*attribute* · *instance attribute*

```python
duration: object
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L55-L55)

### lawref.term_sugar.Case.labels

*attribute* · *instance attribute*

```python
labels: tuple[Label, ...]
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L56-L56)

### lawref.term_sugar.Case.name

*attribute* · *instance attribute*

```python
name: str
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L53-L53)

### lawref.term_sugar.Case.when

*attribute* · *instance attribute*

```python
when: tuple[Call, ...]
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L54-L54)

## lawref.term_sugar.Cursor

*class*

```python
class Cursor
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L112-L144)

### lawref.term_sugar.Cursor.at

*attribute* · *instance attribute*

```python
at = at
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L115-L115)

### lawref.term_sugar.Cursor.end

*attribute* · *instance attribute*

```python
end = len(tokens) if end is None else end
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L116-L116)

### lawref.term_sugar.Cursor.tokens

*attribute* · *instance attribute*

```python
tokens = tokens
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L114-L114)

### lawref.term_sugar.Cursor.ident

*method*

```python
def ident() -> str
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L134-L138)

### lawref.term_sugar.Cursor.optional

*method*

```python
def optional(value: str) -> bool
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L140-L144)

### lawref.term_sugar.Cursor.peek

*method*

```python
def peek(value: str | None = None) -> Token | bool
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L118-L122)

### lawref.term_sugar.Cursor.take

*method*

```python
def take(value: str | None = None) -> Token
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L124-L132)

## lawref.term_sugar.Label

*class* · *dataclass*

```python
class Label
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L43-L48)

### lawref.term_sugar.Label.forms

*attribute* · *class attribute* · *instance attribute*

```python
forms: tuple[tuple[str, str], ...] = ()
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L48-L48)

### lawref.term_sugar.Label.language

*attribute* · *instance attribute*

```python
language: str
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L45-L45)

### lawref.term_sugar.Label.status

*attribute* · *instance attribute*

```python
status: str
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L46-L46)

### lawref.term_sugar.Label.text

*attribute* · *instance attribute*

```python
text: str
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L47-L47)

## lawref.term_sugar.Quantity

*class* · *dataclass*

```python
class Quantity
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L37-L40)

### lawref.term_sugar.Quantity.unit

*attribute* · *instance attribute*

```python
unit: str
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L40-L40)

### lawref.term_sugar.Quantity.value

*attribute* · *instance attribute*

```python
value: str
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L39-L39)

## lawref.term_sugar.TermDecl

*class* · *dataclass*

```python
class TermDecl
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L59-L70)

### lawref.term_sugar.TermDecl.anchors

*attribute* · *instance attribute*

```python
anchors: tuple[str, ...]
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L69-L69)

### lawref.term_sugar.TermDecl.binders

*attribute* · *instance attribute*

```python
binders: tuple[tuple[str, str], ...]
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L62-L62)

### lawref.term_sugar.TermDecl.cases

*attribute* · *instance attribute*

```python
cases: tuple[Case, ...]
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L68-L68)

### lawref.term_sugar.TermDecl.default

*attribute* · *instance attribute*

```python
default: object
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L66-L66)

### lawref.term_sugar.TermDecl.default_labels

*attribute* · *instance attribute*

```python
default_labels: tuple[Label, ...]
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L67-L67)

### lawref.term_sugar.TermDecl.due

*attribute* · *instance attribute*

```python
due: Call
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L64-L64)

### lawref.term_sugar.TermDecl.effective

*attribute* · *instance attribute*

```python
effective: dict | None
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L65-L65)

### lawref.term_sugar.TermDecl.from_

*attribute* · *instance attribute*

```python
from_: tuple[Call, ...]
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L63-L63)

### lawref.term_sugar.TermDecl.name

*attribute* · *instance attribute*

```python
name: str
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L61-L61)

### lawref.term_sugar.TermDecl.public

*attribute* · *instance attribute*

```python
public: bool
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L70-L70)

## lawref.term_sugar.TermSyntaxError

*class*

```python
class TermSyntaxError(ValueError)
```

Bases: `ValueError`

The source is not in the deliberately narrow [§86.1](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/12-part-xii-events-actions-temporal-model.ru.md#861-именованный-срок-с-особыми-случаями-term) subset.

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L19-L20)

## lawref.term_sugar.Token

*class* · *dataclass*

```python
class Token
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L23-L28)

### lawref.term_sugar.Token.kind

*attribute* · *instance attribute*

```python
kind: str
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L25-L25)

### lawref.term_sugar.Token.offset

*attribute* · *instance attribute*

```python
offset: int
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L28-L28)

### lawref.term_sugar.Token.text

*attribute* · *instance attribute*

```python
text: str
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L26-L26)

### lawref.term_sugar.Token.value

*attribute* · *instance attribute*

```python
value: str
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L27-L27)

## lawref.term_sugar.lower_terms

*function*

```python
def lower_terms(source: str) -> list[dict]
```

Parse and lower all top-level [§86.1](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/12-part-xii-events-actions-temporal-model.ru.md#861-именованный-срок-с-особыми-случаями-term) term declarations in ``source``.

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/term_sugar.py#L493-L511)
