tiger_lib

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

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

  • Arg is the counterpart to CodeArg. Where CodeArg represents an actual argument given in a codechain string, the Arg represents what kind of argument is expected by a promote or function.
  • Args is the list of arguments expected by a given promote or function. The actual arguments from a Code can be checked against this. The special value Args::Unknown means that all arguments are accepted.
  • CodeArg represents a single argument of a Code.
  • 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.

Staticsยง

Functionsยง

  • 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_promote ๐Ÿ”’
  • 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 a datafunction chain, which is the stuff between [ ] in localization.