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ยง
- Case
Insensitive Str - Code
- 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.
- Code
Chain - A
CodeChainrepresents 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ยง
- Arg
Argis the counterpart toCodeArg. WhereCodeArgrepresents an actual argument given in a codechain string, theArgrepresents what kind of argument is expected by a promote or function.- Args
Argsis the list of arguments expected by a given promote or function. The actual arguments from aCodecan be checked against this. The special valueArgs::Unknownmeans that all arguments are accepted.- Ck3Datatype
- CodeArg
CodeArgrepresents a single argument of aCode.- Datatype
- All the object types used in
[...]code in localization and gui files. - Imperator
Datatype - Lookup
Result ๐ - Result from looking up a name in the promotes or functions tables.
- Vic3
Datatype
Staticsยง
- STR_
DATATYPE_ ๐MAP
Functionsยง
- datatype_
and_ ๐scope_ map - datatype_
from_ ๐scopes - Return the datatype that best matches
scopes, orDatatype::Unknownif there is no match. Nearly every scope type has a matching datatype, but there are far more datatypes than scope types. Note that onlyScopesvalues that are narrowed down to a single scope type can be matched. - lookup_
alternative ๐ - Find an alternative datafunction to suggest when
lookup_namehas not been found. This is a fairly expensive lookup. Currently it only looks for different-case variants. - lookup_
function ๐ - lookup_
global_ ๐function - lookup_
global_ ๐promote - lookup_
promote ๐ - lookup_
promote_ ๐or_ function - scope_
from_ datatype - Return the scope type that best matches
dtype, orNoneif 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 calling
validate_datatypesrecursively. - validate_
custom ๐ - Internal function for validating a reference to a custom localization.
- validate_
datatypes - Validate a datafunction chain, which is the stuff between [ ] in localization.