siml

package
v1.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 32 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClassName

func ClassName(class proto.Class) string

The short name of a class (SPEC.md §8.2), which keys its entries in names.json: warrior.

func ClassNamed

func ClassNamed(short string) (proto.Class, bool)

The class whose short name is short (SPEC.md §8.2); false for none and for ClassUnknown.

func ConstSeconds

func ConstSeconds(val string) (float64, bool)

ConstSeconds is a const value's number as the sim reads it, a duration in seconds; false when the sim reads it as a string.

func Format

func Format(path string, src []byte, names *Names, open Opener) ([]byte, error)

Re-prints src, the text of the file at path, in canonical form, its names read and written with names, and the files its use lines name read through open; with a nil open, it reads the file alone. The error is Diagnostics when the file has an error.

func Identifier

func Identifier(s string) string

The identifier a game name reads as (SPEC.md §7.6): ASCII letters lowercased and digits kept, ' and ’ dropped, and every run of other characters one _, with none at either end. "Hunter's Mark" is hunters_mark.

func IsTalentSpell

func IsTalentSpell(id int32) bool

Whether id is a talent's own spell, the one a talent kind reads.

func LLMText

func LLMText() (string, error)

The text of the wowsims-siml skill.

func LoadBuild

func LoadBuild(s, b *proto.IndividualSimSettings)

Loads the settings of a preset build b over s, a spec's defaults, as the site applies a build (applyBuild in ui/features/settings/model/apply_build.ts). Each message b holds replaces s's own, except an Auto rotation, which keeps s's, and a build with no item swap set turns item swap off. An encounter brings the tanks and the target dummies with it, and the healing model when b sets one. When b sets the spec's options it also sets the distance and whether the player stands in front of the target, and the race, professions and timings it does not leave at 0.

func Normalize

func Normalize(m googleProto.Message, names *Names, spec proto.Spec) googleProto.Message

A copy of m normalised as SPEC.md §12.4 compares a proto with the parse of its print: uuid and api_version cleared, the items of an EquipmentSpec or ItemSwap padded to 17, every array an enum indexes padded to its enum's length, an absent one too, spec_rotation_json rewritten as the canonical JSON of the spec's Rotation it holds (an empty string, or one that does not read as the Rotation, as {}, which is what its print reads back as), and the rank cleared of each ActionID whose spell id and tag a name of the spec's class names, since the name reads back with the rank of its entry. The spec is spec, or for SpecUnknown the one IndividualSimSettings sets. It panics if the protos break a rule of SPEC.md §8, as Print does.

func ParseRequest

func ParseRequest(req *proto.SimlParseRequest, names *Names) (result *proto.SimlParseResult)

Reads req.Text as the file at req.Path, with names. Text over the size a file may have is refused.

func Print

func Print(kind Kind, spec proto.Spec, s *proto.IndividualSimSettings, categories []string, names *Names) []byte

Prints s as a file of kind. The spec is spec, or with SpecUnknown the one whose message the player holds. categories are the site's category letters whose sections a full file writes; with nil, it writes every section that holds something. A section file writes its own section. Spells, auras, items, enchants and suffixes are written by their names in names, and as raw JSON where it has none (SPEC.md §7.4). It panics if the protos break a rule of SPEC.md §8, as Specs does.

func PrintRequest

func PrintRequest(req *proto.SimlPrintRequest, names *Names) (result *proto.SimlPrintResult)

Prints req.Settings as a file of req.Section, with names. A print that does not read back as a file of that kind gives no text, and the diagnostics of the read.

func ReadSource

func ReadSource(path string) ([]byte, error)

Reads the file at path, which a use line or a command names: a regular file of at most 16 MB. A FIFO or a device is refused unread, since reading one can block forever or never end.

func RepositoryRoot

func RepositoryRoot(file string) (string, bool)

The repository root above a file: the first folder up that holds sim/siml/names.json.

func Reserved

func Reserved(word string) bool

Whether the generator must not write word as a name: a keyword, head or unit word (SPEC.md §4 note 6).

func SamePath

func SamePath(a, b string) bool

Whether two paths name one file, whichever separator each is written with, without case on Windows.

func SettingsOf

The settings a loader's message stands for: an APLRotation as the rotation, an EquipmentSpec as the equipment.

func TokenModifiers

func TokenModifiers() []string

func TokenTypes

func TokenTypes() []string

func UnderSpecs

func UnderSpecs(path string) bool

Whether the file lies under ui/specs of the repository it sits in, where warnings are errors and raw refs are reported (SPEC.md §7.3, §13).

Types

type AplEdit

type AplEdit struct {
	Op     string          `json:"op"`               // set, insert, move, wrap, inline, extract, defInsert, defDelete, defSet or defRename.
	Path   []any           `json:"path"`             // JSON names and list indices; insert's, move's and wrap's name the list.
	Value  json.RawMessage `json:"value,omitempty"`  // set's new value, where none removes the property or element; insert's element; wrap's condition.
	Index  int             `json:"index,omitempty"`  // Where insert puts its element.
	From   int             `json:"from,omitempty"`   // The element move takes; the first row wrap puts in a block.
	To     int             `json:"to,omitempty"`     // The index the moved element ends at; the last row wrap puts in a block.
	Call   string          `json:"call,omitempty"`   // set's def call, written as SIML in place of the value: fits(multi_shot).
	Name   string          `json:"name,omitempty"`   // The def that extract, defInsert, defDelete, defSet and defRename write.
	Params []string        `json:"params,omitempty"` // defInsert's and defSet's parameters.
	Text   string          `json:"text,omitempty"`   // defInsert's and defSet's value, as SIML; defRename's new name.
}

An edit the rotation panel asks for, addressed by the JSON path, within the rotation, of what it changes. A path ["whens", id, …] leads into the when block id of Structure: "condition" and the path in it, "hide", or the block itself, which set to none takes apart.

type BlockRow

type BlockRow struct {
	Path      []any `json:"path"`
	Inherited int   `json:"inherited"`
	Own       bool  `json:"own"`
}

A row of a when block: how many conjuncts at the start of its condition its blocks join to it, and whether its condition holds conjuncts of its own after them.

type CatalogConsumable

type CatalogConsumable struct {
	ID    int32
	Name  string
	Type  proto.ConsumableType
	OnUse bool
}

type CatalogEnchant

type CatalogEnchant struct {
	EffectID    int32
	Name        string
	Type        proto.ItemType
	EnchantType proto.EnchantType
	ExtraTypes  []proto.ItemType // Further item types the row goes on, as an armor kit's.
	SpellID     int32
	ItemID      int32
}

type CatalogItem

type CatalogItem struct {
	ID         int32
	Name       string
	Icon       string
	Type       proto.ItemType
	RangedType proto.RangedWeaponType
	HandType   proto.HandType
	WeaponType proto.WeaponType
	Quality    proto.ItemQuality
	Ilvl       int32
	Phase      int32
	SetName    string
	Effects    []string // The buff names of its item effects.
	OnUse      bool     // Whether it has a use, which item.<name> casts.
}

type CatalogSuffix

type CatalogSuffix struct {
	ID    int32
	Name  string
	Stats []float64 // Indexed by Stat.
}

type Completion

type Completion struct {
	Label, Detail, Documentation string
	Kind                         CompletionKind
	InsertText                   string
	Replace                      Range
	SortText, FilterText         string
	Retrigger                    bool // Completion opens again once it is inserted: after `cast `, `aura(`, `target.`.
}

type CompletionKind

type CompletionKind int

What a completion offers, numbered as the protocol's CompletionItemKind.

const (
	CompletionMethod        CompletionKind = 2
	CompletionFunction      CompletionKind = 3
	CompletionField         CompletionKind = 5
	CompletionVariable      CompletionKind = 6
	CompletionClass         CompletionKind = 7
	CompletionModule        CompletionKind = 9
	CompletionProperty      CompletionKind = 10
	CompletionValue         CompletionKind = 12
	CompletionKeyword       CompletionKind = 14
	CompletionFile          CompletionKind = 17
	CompletionReference     CompletionKind = 18
	CompletionEnumMember    CompletionKind = 20
	CompletionConstant      CompletionKind = 21
	CompletionTypeParameter CompletionKind = 25
)

type DatabaseCatalog

type DatabaseCatalog struct {
	// contains filtered or unexported fields
}

The catalog read from the database files.

func CatalogAt

func CatalogAt(root string) *DatabaseCatalog

The catalog of the repository at root, read again whenever a database file changes on disk.

func ReadCatalog

func ReadCatalog(root string) *DatabaseCatalog

Reads the database files of the repository at root. A file that is missing or does not read is left out.

func (*DatabaseCatalog) Consumables

func (c *DatabaseCatalog) Consumables() []CatalogConsumable

func (*DatabaseCatalog) EnchantRows

func (c *DatabaseCatalog) EnchantRows(effectID int32) []CatalogEnchant

func (*DatabaseCatalog) Item

func (c *DatabaseCatalog) Item(id int32) (CatalogItem, bool)

func (*DatabaseCatalog) ItemIcons

func (c *DatabaseCatalog) ItemIcons() map[int32][2]string

Item names and icons by id, [name, icon]: a gear item's own, else its item icon's.

func (*DatabaseCatalog) ItemName

func (c *DatabaseCatalog) ItemName(id int32) (string, bool)

func (*DatabaseCatalog) Items

func (c *DatabaseCatalog) Items() []CatalogItem

func (*DatabaseCatalog) SpellIcons

func (c *DatabaseCatalog) SpellIcons() map[int32][2]string

Spell names and icons by id, [name, icon], from the database's spell icons.

func (*DatabaseCatalog) SpellName

func (c *DatabaseCatalog) SpellName(spellID int32) (string, bool)

func (*DatabaseCatalog) Suffix

func (c *DatabaseCatalog) Suffix(id int32) (CatalogSuffix, bool)

func (*DatabaseCatalog) Suffixes

func (c *DatabaseCatalog) Suffixes(itemID int32) []int32

type DefCall

type DefCall struct {
	Path []any    `json:"path"`
	Name string   `json:"name"`
	Args []string `json:"args"`
}

A def call: the rotation path of the value it reads as, or ["whens", id, "condition", …] in a block's condition.

type DefInfo

type DefInfo struct {
	Name   string   `json:"name"`
	Params []string `json:"params"`
	Value  string   `json:"value"` // As format writes it, on one line and without the comments in it.
	Used   bool     `json:"used"`
	Range  Range    `json:"-"`
}

type Diagnostic

type Diagnostic struct {
	Path       string // The file it is in.
	Start, End Position
	Severity   Severity
	Code       string // A code of SPEC.md §13 such as unknown-name, a lint code, or unregistered-name.
	Message    string
	Related    *RelatedLocation // For an error of a used file reported at the use line: where it is in that file.
}

func (Diagnostic) String

func (d Diagnostic) String() string

"path:line:col code message", without the path when there is none.

type Diagnostics

type Diagnostics []Diagnostic

A file's diagnostics in the order SPEC.md §13 fixes. As an error, one "path:line:col code message" per line.

func (Diagnostics) Error

func (d Diagnostics) Error() string

type Doc

type Doc struct {
	// contains filtered or unexported fields
}

A file's text, read. Its spans and the paths of its names lead into the loader's message (SPEC.md §1): the APLRotation of an x.apl.siml, the EquipmentSpec of an x.gear.siml, and the IndividualSimSettings of any other file.

func Analyze

func Analyze(path string, src []byte, names *Names, open Opener) *Doc

Reads src as the file at path, as Parse does; the result holds the diagnostics, and an error only when the schema itself does not read.

func (*Doc) Complete

func (d *Doc) Complete(at Position, c *DatabaseCatalog) []Completion

What may go at a position: keywords, kinds, names, fields and values, each with the text it replaces.

func (*Doc) Definition

func (d *Doc) Definition(at Position) []Location

What the occurrence at a position names, where it is declared; or the file a use path there names, at its start.

func (*Doc) Diagnostics

func (d *Doc) Diagnostics() Diagnostics

The errors and warnings, in the order SPEC.md §13 fixes.

func (*Doc) EditorDiagnostics

func (d *Doc) EditorDiagnostics(c *DatabaseCatalog) Diagnostics

The parser's diagnostics and the checks, as the editor shows them: under ui/specs the parser's warnings are errors.

func (*Doc) File

func (d *Doc) File() (*File, error)

What Parse gives for the text.

func (*Doc) Folds

func (d *Doc) Folds() []Fold

Each section, each statement that runs over several lines, the block of use lines and each run of comment lines.

func (*Doc) Hover

func (d *Doc) Hover(at Position, c *DatabaseCatalog) (Hover, bool)

What the word at a position is: a name and what it means, a kind, field, unit, section or spec, or a variable, group, sequence or placeholder with its declaration.

func (*Doc) Kind

func (d *Doc) Kind() Kind
func (d *Doc) Links() []Link

The files the use lines name that exist.

func (*Doc) Offset

func (d *Doc) Offset(p Position) int

The byte offset of Text at p, kept within p's line.

func (*Doc) Path

func (d *Doc) Path() string

func (*Doc) PathAt

func (d *Doc) PathAt(p Position) []any

The rotation path the text at p writes: the path of the shortest span around it, the deeper one of two the same length. Empty outside the rotation's spans.

func (*Doc) Position

func (d *Doc) Position(offset int) Position

The position of a byte offset of Text.

func (*Doc) PrepareRename

func (d *Doc) PrepareRename(at Position) (Range, string, error)

The occurrence a rename starts from, with its name, or why there is none.

func (*Doc) QuickFixes

func (d *Doc) QuickFixes(r Range) []Fix

The code actions at a range: a word the parser does not know changed to a candidate its diagnostic names, and the rewrites of conditions that change the proto, which are only made when asked (SPEC.md §16.2).

func (*Doc) References

func (d *Doc) References(at Position, includeDeclaration bool) []Location

Every occurrence of what the occurrence at a position names, in this file, the file that declares it and, for a group, a def or a variable, the files near that one that name it through a use line.

func (*Doc) Refs

func (d *Doc) Refs() []NameRef

The names the text writes, in file order, with the ones no namespace holds (Known false). A name a used file's def writes is at the call in this file that reads the def. Each one's Path is within the loader's message, and nil for a name outside it.

func (*Doc) Rename

func (d *Doc) Rename(at Position, newName string) ([]FileEdits, error)

The edits that rename what the occurrence at a position names, in every file that names it, the files in the order they are first found; or why it cannot be. Nothing and no error when nothing there renames.

func (*Doc) RotationJSON

func (d *Doc) RotationJSON() json.RawMessage

The rotation's JSON, in the form of SPEC.md §5.4; nil when the text has an error or holds no rotation.

func (*Doc) SpanFor

func (d *Doc) SpanFor(path []any) (Range, bool)

The text of the innermost node a rotation path leads into: the path's own span, else the deepest span that holds it. The path is within the rotation, in a file of any kind.

func (*Doc) Spans

func (d *Doc) Spans() []PathSpan

The text of each JSON path into the loader's message that the text writes: each row, var line and group header, each value, action, unit, spell and field value within them, each entry's values and slot row, and the talents line. A path can have more than one span; they come in the order typing reads the nodes.

func (*Doc) Splice

func (d *Doc) Splice(edits []AplEdit) ([]TextEdit, error)

The edits that apply edits, in order, to the rotation the text writes: only the statements they change are printed again, and every other line of the text is kept. The error says why not: the file is no x.apl.siml, the text has an error or uses another file, a path leads through an index or a field that does not exist, or the edited rotation has an error.

func (*Doc) Structure

func (d *Doc) Structure() *Structure

The structure of an x.apl.siml's rotation; nil when the text has an error, uses another file, or is no x.apl.siml.

func (*Doc) Symbols

func (d *Doc) Symbols() []Symbol

The sections, with their variables, sequences, defs and when blocks, and the file's variables and defs before the first header, for the outline.

func (*Doc) Text

func (d *Doc) Text() string

The text as read: a byte order mark at its start dropped, and ill-formed UTF-8 replaced (SPEC.md §2).

func (*Doc) Tokens

func (d *Doc) Tokens() []Token

The words the schema and the table give a meaning, in file order: each on one line, none empty, none overlapping.

type EnchantName

type EnchantName struct {
	EffectID int32
	Slots    []proto.ItemSlot // In ItemSlot order.
}

An enchant entry: an effect id, and the slots of the item types its rows fit.

type File

type File struct {
	Path       string
	Kind       Kind
	Spec       proto.Spec                   // SpecUnknown when the file names no spec.
	Settings   *proto.IndividualSimSettings // What the file and the files it uses set (SPEC.md §5.1).
	Categories []string                     // The import categories the file holds, in the site's order (SPEC.md §5.1).
	Names      []NameRef                    // The names the file itself writes, in file order.
	Uses       []string                     // The paths its use lines name, read against its own path, in file order.
	RawRefs    Diagnostics                  // raw-ref at each raw token that holds an id a name could write, which no file under ui/specs holds (SPEC.md §7.3).
	Warnings   Diagnostics
}

A parsed file. One with an error holds no settings, categories or warnings, and still lists the names and raw refs that read.

func Parse

func Parse(path string, src []byte, names *Names, open Opener) (*File, error)

Parses src, the text of the file at path, whose names mean what names says (SPEC.md §7). The error is Diagnostics when the file has an error, which then holds its warnings too, and the file holds what read. open reads the files that use lines name, at paths read against path; with no open, a use line is use-refused.

func ReadFile

func ReadFile(path string) (*File, error)

Reads and parses the file at path with the committed name table, reading the files its use lines name from the file system. A build without the with_db tag holds no table, and reads only a file that writes no name.

func (*File) Equipment

func (f *File) Equipment() *proto.EquipmentSpec

The 17 items of an x.gear.siml, or of a full file that holds gear:.

func (*File) Message

func (f *File) Message() googleProto.Message

What the file loads as (SPEC.md §1): an x.apl.siml its rotation, an x.gear.siml its equipment, any other file its settings.

func (*File) Rotation

func (f *File) Rotation() *proto.APLRotation

The rotation of an x.apl.siml, or of a full file that holds one.

type FileEdits

type FileEdits struct {
	Path  string
	Edits []TextEdit
}

A file's edits.

type FileStamp

type FileStamp struct {
	Size int64
	Time time.Time
}

A file's size and modification time, which say it changed since a read. A missing file's size is -1.

func StampOf

func StampOf(path string) FileStamp

type Finding

type Finding struct {
	Path     []any  `json:"path"`     // JSON names and list indices.
	Severity string `json:"severity"` // error, warning or info.
	Code     string `json:"code"`
	Message  string `json:"message"`
}

A finding of Lint, at the JSON path within the rotation of what it is about.

func Lint

func Lint(r *proto.APLRotation) []Finding

The findings on r, in the order the checks find them.

type Fix

type Fix struct {
	Title      string
	Kind       string // quickfix, or refactor.rewrite for a rewrite no diagnostic asks for.
	Diagnostic Diagnostic
	Edits      []TextEdit
	Preferred  bool
}

type Fold

type Fold struct {
	StartLine, EndLine int
	Kind               string
}

A folding range: its first and last lines, 1-based, and what it folds (region, imports, comment or "").

type Hover

type Hover struct {
	Markdown string
	Range    Range
	SpellID  int32 // >0: the server appends the game files row for this spell
}

type Kind

type Kind struct {
	Section string // The section an x.<section>.siml holds, such as apl or gear; "" for a full setup, x.siml.
}

Which sections a file holds, from its double extension (SPEC.md §1).

func KindOf

func KindOf(path string) (Kind, error)

The kind of the file at path. A path that does not end in .siml, or whose double extension names no section, is an error.

func (Kind) Message

func (k Kind) Message() googleProto.Message

The loader's message for a file of kind (SPEC.md §1), empty: an APLRotation, an EquipmentSpec or IndividualSimSettings.

type Link struct {
	Range Range
	Path  string
}

A use line's file, resolved.

type Location

type Location struct {
	Path  string
	Range Range
}

A place in a file.

type NameRef

type NameRef struct {
	Name       string
	Namespace  Namespace
	Start, End Position
	ID         int32    // The spell id, item id, enchant effect id or random suffix id it means.
	Row        *SlotRow // The slot row it is written on, if any.
	Path       []any    // The JSON path, within the loader's message (SPEC.md §1), of the field it fills; nil outside it.
	Known      bool     // Whether its namespace holds it; Doc.Refs gives the names it does not hold too.
}

A name a file writes, and what it means there (SPEC.md §7).

type NamedEntry

type NamedEntry struct {
	Name   string
	Entry  SpellName
	Shared bool // A shared entry: a spell or aura that gear, consumables or encounters add (SPEC.md §7.1).
}

A name of a spell-like namespace and its entry.

type Names

type Names struct {
	Classes  map[proto.Class]SpellNames
	Shared   SpellNames // Looked up after a class's own entries, and for a file with no spec line.
	Items    map[string]int32
	Enchants map[string]EnchantName
	Suffixes map[string]int32
	// The specs that know an item's effect only as an internal cooldown trigger, which only the ICD kinds find, by
	// the item's name.
	ICDOnlyItems map[string][]string
	// contains filtered or unexported fields
}

A name table. Lookups index it on first use, so the maps must not change after the first lookup.

func DefaultNames

func DefaultNames() (*Names, error)

The committed table, names.json, which a build holds only with the with_db tag.

func ParseNames

func ParseNames(data []byte) (*Names, error)

Reads a name table in the form of SPEC.md §7.4, and refuses one that breaks a rule of what a loader checks. The JSON is read with keys exactly, numbers by value, so 1.0 is the whole number 1, and null as absent.

func (*Names) Enchant

func (t *Names) Enchant(name string) (int32, bool)

The effect id an enchant name means.

func (*Names) EnchantName

func (t *Names) EnchantName(effectID int32, slot proto.ItemSlot) (string, bool)

The name an enchant effect prints with on an item in slot: of the effect's names whose slots hold slot, the one with the most slots and the first in byte order of those, else the effect's first name in byte order. An effect a one-hand and a two-hand weapon row share thus prints with the one-hand row's name (main and off hand), which fits a two-hander too, where the two-hand row's (main hand) fits no one-hander.

func (*Names) Encode

func (t *Names) Encode() []byte

The table in the form of SPEC.md §7.4: every object's keys in byte order, one entry to a line, and empty namespaces and classes left out.

func (*Names) Holding

func (t *Names) Holding(class proto.Class, name string) []Namespace

The namespaces in which name means something for a file of class, in the order of AllNamespaces.

func (*Names) Item

func (t *Names) Item(name string) (int32, bool)

func (*Names) ItemName

func (t *Names) ItemName(id int32) (string, bool)

func (*Names) Registered

func (t *Names) Registered(class proto.Class, spec string, ns Namespace) []NamedEntry

The names of a spell-like namespace a file of class reads (the class's own, then the shared ones it does not hide), each in byte order, that a build of spec registers; with no spec, those any build registers.

func (*Names) Spell

func (t *Names) Spell(class proto.Class, ns Namespace, name string) (*proto.ActionID, bool)

The spell-like entry name means in ns for a file of class: the class's own entry, else the shared one. A file with no spec line passes ClassUnknown and reads the shared entries only.

func (*Names) SpellName

func (t *Names) SpellName(class proto.Class, ns Namespace, id *proto.ActionID) (string, bool)

The name of a spell-like ActionID in ns for a file of class, by its spell id and tag whatever its rank: the class's own name, else the shared one. An ActionID that holds an item or other id has none.

func (*Names) Suffix

func (t *Names) Suffix(name string) (int32, bool)

func (*Names) SuffixName

func (t *Names) SuffixName(id int32) (string, bool)

func (*Names) Visible

func (t *Names) Visible(class proto.Class, ns Namespace) []string

Every name of ns that a file of class reads, in byte order: the class's own and the shared ones for a spell-like namespace.

type NamesFile

type NamesFile struct {
	Path string
	// contains filtered or unexported fields
}

The name table at Path, read again when the file changes on disk.

func (*NamesFile) Get

func (n *NamesFile) Get() (*Names, error)

type Namespace

type Namespace string

Where a name is looked up. The position decides the namespace (SPEC.md §7.2). The five spell-like namespaces are per class, and items, enchants and suffixes are one namespace each for every file.

const (
	NamespaceSpell       Namespace = "spell"        // What the player casts.
	NamespaceAura        Namespace = "aura"         // Auras on the player.
	NamespaceTargetAura  Namespace = "target_aura"  // Auras on a target.
	NamespaceTargetSpell Namespace = "target_spell" // What a target casts, which boss_spell reads.
	NamespacePetAura     Namespace = "pet_aura"     // Auras on a pet.
	NamespaceItem        Namespace = "item"
	NamespaceEnchant     Namespace = "enchant"
	NamespaceSuffix      Namespace = "suffix"
)

func AllNamespaces

func AllNamespaces() []Namespace

Every namespace, in the order SPEC.md §7.1 lists them, which is the order Holding reports them in.

func (Namespace) SpellLike

func (ns Namespace) SpellLike() bool

Whether names in ns are spells and auras, looked up per class.

type Opener

type Opener func(path string) ([]byte, error)

Reads a file that a use line names, at a path resolved against the using file.

type PathSpan

type PathSpan struct {
	Path  []any // JSON names (string) and list indices (int).
	Range Range
}

A JSON path into what a file loads, and the text that writes it.

type Position

type Position struct{ Line, Col int }

A place in a file. Line and Col count from 1, and Col counts UTF-16 code units, as editors do.

type Range

type Range struct{ Start, End Position }

A stretch of a file's text. Its positions count lines and columns from 1, columns in UTF-16 code units, as a Diagnostic's do.

type RelatedLocation

type RelatedLocation struct {
	Path  string
	Range Range
}

A place in another file that a diagnostic is about.

type Reread

type Reread[T any] struct {
	// contains filtered or unexported fields
}

A value read from files, read again when one of them changes on disk. Callers of one Reread wait for its read; those of another do not.

func (*Reread[T]) Get

func (r *Reread[T]) Get(paths []string, read func() (T, error)) (T, error)

The value read from paths, by read when one of them changed since the last read.

type Severity

type Severity int

Whether a diagnostic stops a file from loading: a file with an error yields no proto, and one with only warnings does. Information is the editor's: a rotation lint that points something out (Lint's info).

const (
	Error Severity = iota
	Warning
	Information
)

func (Severity) String

func (s Severity) String() string

type SlotRow

type SlotRow struct {
	Slot proto.ItemSlot
	Item int32
}

A slot row: its slot, and the item its suffix and enchant are on.

type SpecInfo

type SpecInfo struct {
	Field        protoreflect.FieldDescriptor   // The oneof field the spec line names: hunter, dps_warrior.
	Spec         proto.Spec                     // Spec + the message name.
	Class        proto.Class                    // The class whose short name ends the message name in snake case.
	Options      protoreflect.MessageDescriptor // The type of the spec message's options field, which settings: flattens.
	ClassOptions protoreflect.FieldDescriptor   // The options' class_options field, flattened after the rest; nil when there is none.
	Rotation     protoreflect.MessageDescriptor // The spec message's nested Rotation, which simple: writes as spec_rotation_json.
}

One field of Player's spec oneof, and what the spec line and the settings: and simple: sections read through it (SPEC.md §8.4).

func SpecNamed

func SpecNamed(field string) (SpecInfo, bool)

The spec whose spec line writes field, such as hunter or dps_warrior.

func SpecOf

func SpecOf(spec proto.Spec) (SpecInfo, bool)

What the spec line of spec reads; false for SpecUnknown.

func Specs

func Specs() []SpecInfo

Every spec, in the oneof's declaration order. It panics if the protos break a rule of SPEC.md §8.4, which TestSpecs catches before any build ships.

type SpellName

type SpellName struct {
	SpellID, Tag, Rank int32
	RegisteredBy       []string // The specs that register it, by Player spec field name in byte order; empty when no build does.
	ICDOnlyBy          []string // The specs of RegisteredBy that know the aura only as an internal cooldown trigger, which only the ICD kinds find.
	TalentOnlyBy       []string // The specs of RegisteredBy that know the spell only as a talent, which only the talent kinds find.
	Uncastable         bool     // A spell no build lets a rotation cast (the sim's APL flag), as an inner spell.
}

A spell-like entry: the spell id, tag and rank of an ActionID. A file means the spell id and tag; the rank is what the sim registers, which the site shows (SPEC.md §7.3).

type SpellNames

type SpellNames map[Namespace]map[string]SpellName

The spell-like entries of a class, or the shared ones, by namespace and then name.

type Structure

type Structure struct {
	Whens []WhenBlock `json:"whens"`
	Rows  []BlockRow  `json:"rows"`
	Calls []DefCall   `json:"calls"`
	Defs  []DefInfo   `json:"defs"`
}

What the rotation panel shows of an x.apl.siml beyond the rotation's JSON: the when blocks its rows are in, the def calls its values are written as, and its defs (SPEC.md §6.9, §6.10).

type Symbol

type Symbol struct {
	Name, Detail     string
	Kind             SymbolKind
	Range, Selection Range
	Children         []Symbol
}

type SymbolKind

type SymbolKind int

What a symbol is, numbered as the protocol's SymbolKind.

const (
	SymbolModule    SymbolKind = 2
	SymbolNamespace SymbolKind = 3
	SymbolFunction  SymbolKind = 12
	SymbolVariable  SymbolKind = 13
	SymbolBoolean   SymbolKind = 17
	SymbolEvent     SymbolKind = 24
)

type TextEdit

type TextEdit struct {
	Range   Range
	NewText string
}

Text that takes the place of a range of a file's text.

type Token

type Token struct {
	Range     Range
	Type      string
	Modifiers []string
}

type WhenBlock

type WhenBlock struct {
	ID        int               `json:"id"`
	List      []any             `json:"list"`   // The rotation path of the list its rows are in.
	Parent    int               `json:"parent"` // The block it is in, -1 for none.
	First     int               `json:"first"`  // The index of its first row in the list.
	Last      int               `json:"last"`   // The index of its last row, nested blocks' included; First-1 when it has none.
	Hide      bool              `json:"hide,omitempty"`
	Condition json.RawMessage   `json:"condition"`
	Conjuncts []json.RawMessage `json:"conjuncts"` // What it joins to the condition of each row in it, in order.
	Range     Range             `json:"-"`
}

A when block. Its id is its place among the file's when lines, which a ["whens", id, …] edit names.

type Words

type Words struct {
	Keywords, Heads, Units, UnitPrefixes, Sections []string
	DurationUnits                                  []string // The units a duration literal takes (SPEC.md §2).
}

The words of SIML that the editor's grammar colours (SPEC.md §2-§4): the keywords, the accessor heads, the unit words, the prefixes of the indexed units (target1, player2), and every section name, in the schema's order.

func GrammarWords

func GrammarWords() (Words, error)

Directories

Path Synopsis
cmd
simlnames command
Generates the SIML name table (sim/siml/SPEC.md §7.4) from what the sim registers and the database, keeping every name the committed table holds, and reports what it added on standard error.
Generates the SIML name table (sim/siml/SPEC.md §7.4) from what the sim registers and the database, keeping every name the committed table holds, and reports what it added on standard error.
Package gen writes the SIML name table, sim/siml/names.json (SPEC.md §7.4): it asks the sim what every spec registers, adds a name for each spell, aura, item, enchant and random suffix the table does not name yet, and keeps every name the table already holds.
Package gen writes the SIML name table, sim/siml/names.json (SPEC.md §7.4): it asks the sim what every spec registers, adds a name for each spell, aura, item, enchant and random suffix the table does not name yet, and keeps every name the table already holds.
lsp
Package lsp is the SIML language server: diagnostics, completion, hover, navigation, rename, outline, folding, semantic tokens, formatting and code actions for every *.siml file, and the requests the rotation panel of the VS Code extension makes (siml/rotation, siml/pathAt, siml/registered, siml/splice, siml/database, siml/patterns, siml/insertPattern, siml/sim).
Package lsp is the SIML language server: diagnostics, completion, hover, navigation, rename, outline, folding, semantic tokens, formatting and code actions for every *.siml file, and the requests the rotation panel of the VS Code extension makes (siml/rotation, siml/pathAt, siml/registered, siml/splice, siml/database, siml/patterns, siml/insertPattern, siml/sim).
jsonrpc
Package jsonrpc is JSON-RPC 2.0 over a stream, framed as the language server protocol frames it: a Content-Length header, a blank line and the body.
Package jsonrpc is JSON-RPC 2.0 over a stream, framed as the language server protocol frames it: a Content-Length header, a blank line and the body.
launch command
Starts the SIML language server, `wowsimcli siml lsp`, for an editor, from the repository root, through tools/lsplaunch.
Starts the SIML language server, `wowsimcli siml lsp`, for an editor, from the repository root, through tools/lsplaunch.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL