Expand description
Validator for the [ ... ]
code blocks in localization and gui files.
The main entry points are the validate_datatypes
function and the Datatype
enum.
Structsยง
- Most codes are just a name followed by another dot or by the end of the code chain. Some have comma-separated arguments between parentheses. Those arguments can be single-quoted strings or other code chains.
- A
CodeChain
represents the full string between[
and]
in gui and localization (except for the trailing format). It consists of a series of codes separated by dots.
Enumsยง
CodeArg
represents a single argument of aCode
.- All the object types used in
[...]
code in localization and gui files. - Lookup
Result ๐Result from looking up a name in the promotes or functions tables.
Staticsยง
- STR_
DATATYPE_ ๐MAP
Functionsยง
- datatype_
from_ ๐scopes Return the datatype that best matchesscopes
, orDatatype::Unknown
if there is no match. Nearly every scope type has a matching datatype, but there are far more datatypes than scope types. Note that onlyScopes
values that are narrowed down to a single scope type can be matched. - lookup_
alternative ๐Find an alternative datafunction to suggest whenlookup_name
has not been found. This is a fairly expensive lookup. Currently it only looks for different-case variants. - lookup_
function ๐ - lookup_
promote ๐ - scope_
from_ ๐datatype Return the scope type that best matchesdtype
, orNone
if there is no match. Nearly every scope type has a matching datatype, but there are far more datatypes than scope types. - validate_
argument ๐Internal function for validating an argument to a datatype code. If the argument is iself a code chain, this will end up callingvalidate_datatypes
recursively. - validate_
custom ๐Internal function for validating a reference to a custom localization. - Validate a datafunction chain, which is the stuff between [ ] in localization.