Skip to main content

Module datatype

Module datatype 

Source
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ยง

CaseInsensitiveStr
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.
CodeChain
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
CodeArg represents a single argument of a Code.
Datatype
All the object types used in [...] code in localization and gui files.
LookupResult ๐Ÿ”’
Result from looking up a name in the promotes or functions tables.

Functionsยง

datatype_and_scope_map ๐Ÿ”’
datatype_from_scopes ๐Ÿ”’
Return the datatype that best matches scopes, or Datatype::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 only Scopes values that are narrowed down to a single scope type can be matched.
lookup_alternative ๐Ÿ”’
Find an alternative datafunction to suggest when lookup_name has 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, or None 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 calling validate_datatypes recursively.
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.