A per-token update for a single lexer-context field (a "fragment" such as Line or Column).
Tracking.materialize applies one Tracking instance to each case field of the context for which a given Tracking[FieldType] resolves at the lexer call, threading the result through a functional copy; fields with none are left untouched by the hook (they only change in rule bodies).
Lookup is ordinary given resolution at the lexer call: a given in lexical scope there wins, otherwise the one in the field type's companion is used. So a given Tracking[Int] in scope tracks every Int field of that lexer's context, and a local given Tracking[Column] replaces Column's own for that lexer only.
This is how tracking composes without inheritance: define a distinct field type (e.g. an opaque type) and a given Tracking[YourType] in its companion, then use it as a context field. A distinct type also keeps the update to the fields meant for it, where a given for a common type like Int would reach every field of that type.
Type parameters
- Field
-
the fragment field type
Attributes
- Companion
- object
- Source
- Tracking.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
