core

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 80 Imported by: 0

README

Core

This package contains most the code for the Inox Runtime, the type checking logic is in the symbolic/ package.

Code organization

The code evaluation tests are the same for the bytecode interpreter and the tree walk evaluation, they are located in eval_test.go.

Module Preparation

Module preparation is implemented in module_preparation.go, it consists of several steps:

  • Parsing
  • Pre-initialization
  • Context Creation
  • Global State Creation
  • Database Openings
  • Retrieval of Project Secrets
  • Static Checks
  • Symbolic Evaluation (typechecking)

Note that module preparation is not used by module imports.

Parsing

Recursive parsing of the module and its imports.

Pre-initialization

The pre-initialization is the checking and creation of the module's manifest.

  1. the pre-init block is statically checked (if present).
  2. the manifest's object literal is statically checked.
  3. pre-evaluate the env section of the manifest.
  4. pre-evaluate the preinit-files section of the manifest.
  5. read & parse the preinit-files using the provided .PreinitFilesystem.
  6. evaluate & define the global constants (const ....).
  7. evaluate the preinit block.
  8. evaluate the manifest's object literal.
  9. create the manifest.
Context Creation

A context containing all the core pattern types (int, str, ...) is created. The most relevant inputs are:

  • the permissions listed in the manifest
  • the limits listed in the manifest
  • the host definition data specified in the manifest
  • the parent context (host definition data and limits are inherited)
Global State Creation

implementation

The global state of the module is created and is initialized with the default globals (variables, functions & namespaces).

Database Openings

Databases described in the manifest or created if necessary and opened.

Retrieval of Project Secrets

If a project has been passed its secrets are retrieved and the global project-secrets is added to the state.

Static Checks

During this phase the code is analyzed in order to find the following issues:

  • misplaced statements
  • undeclared variables or patterns
  • duplicate declarations

(and a few others)

Symbolic Evaluation

The symbolic evaluation of a module is a "virtual" evaluation, it performs checks similar to those of a type checker. Throughout the Inox documentation you may encounter the terms "type checker"/ "type checking", they correspond to the symbolic evaluation phase.

Transactions

Simplified State Diagram

stateDiagram-v2
    [*] --> Running
    DoingRollback: Doing Rollback
    DoingCommit: Doing Commit


    Running --> DoingRollback: context is cancelled
    Running --> DoingRollback: timeout
    Running --> DoingRollback: rollback
    Running --> DoingCommit: commit
    DoingRollback --> Finished
    DoingCommit --> Finished

Documentation

Index

Constants

View Source
const (
	True  = Bool(true)
	False = Bool(false)
)
View Source
const (
	CTX_DONE_MICROTASK_CALLS_TIMEOUT = 5 * time.Millisecond
	DEFAULT_IWD                      = Path("/")
)
View Source
const (
	FUNCTION_FRAME_PREFIX = "(fn) "

	//starts at 1 for compatibility with the Debug Adapter Protocol
	INITIAL_BREAKPOINT_ID = 1

	SECONDARY_EVENT_CHAN_CAP = 1000
)
View Source
const (
	IncomingMessageReceivedEventType = iota + 1
	LThreadSpawnedEventType
)
View Source
const (
	STREAM_ITERATION_WAIT_TIMEOUT = 5 * time.Millisecond
	DEFAULT_MIN_STREAM_CHUNK_SIZE = 2
	DEFAULT_MAX_STREAM_CHUNK_SIZE = 10
)
View Source
const (
	S_PATH_EXPR_PATH_LIMITATION                         = "path should not contain the substring '..'"
	S_PATH_SLICE_VALUE_LIMITATION                       = "path slices should have a string or path value"
	S_PATH_INTERP_RESULT_LIMITATION                     = "result of a path interpolation should not contain any of the following substrings: '..', '\\', '*', '?'"
	S_URL_PATH_INTERP_RESULT_LIMITATION                 = "result of a URL path interpolation should not contain any of the following substrings: '..', '\\', '*', '?', '#'"
	S_QUERY_PARAM_VALUE_LIMITATION                      = "value of query parameter should not contain '&' nor '#'"
	S_URL_EXPR_PATH_START_LIMITATION                    = "path should not start with ':'"
	S_URL_EXPR_PATH_LIMITATION                          = "path should not contain any of the following substrings '..', '#', '?"
	S_URL_EXPR_UNEXPECTED_HOST_IN_PARSED_URL_AFTER_EVAL = "unexpected host in parsed URL after evaluation"
	S_INVALID_URL_ENCODED_STRING                        = "invalid URL encoded string"
	S_INVALID_URL_ENCODED_PATH                          = "invalid URL encoded path"
)
View Source
const (
	HARD_MINIMUM_LAST_EVENT_AGE              = 25 * time.Millisecond
	MAX_MINIMUM_LAST_EVENT_AGE               = 10 * time.Second
	IDLE_EVENT_SOURCE_HANDLING_TICK_INTERVAL = 25 * time.Millisecond
)
View Source
const (
	MINIMAL_STATE_ID             = 1
	INITIAL_MODULE_HEAP_CAPACITY = 1000

	MINIMUM_MOD_PRIORITY   = ModulePriority(10)
	READ_TX_PRIORITY       = ModulePriority(50)
	READ_WRITE_TX_PRIORITY = ModulePriority(150)
)
View Source
const (
	MAX_JOB_IDLE_DURATION        = 10 * time.Millisecond
	JOB_SCHEDULING_TICK_INTERVAL = 50 * time.Microsecond
)
View Source
const (
	THREADS_SIMULTANEOUS_INSTANCES_LIMIT_NAME = "threads/simul-instances"
	EXECUTION_TOTAL_LIMIT_NAME                = "execution/total-time"

	// Note:
	// This limit represents a pseudo CPU time because it's not possible to accurately detect when
	// the goroutine executing a module is waiting for IO.
	//
	// Implementation note:
	// CPU time token depletion should not be paused during lockings that are both shorts & often successful on the first try
	// because it would introduce overhead. Pausing the depletion involves an atomic write.
	EXECUTION_CPU_TIME_LIMIT_NAME = "execution/cpu-time"

	MAX_LIMIT_VALUE = math.MaxInt64 / TOKEN_BUCKET_CAPACITY_SCALE

	//Token count should be scaled by this value when calling .Take() for a frequency limit.
	//This is not related to the internal scaling of token buckets.
	FREQ_LIMIT_SCALE = 1000
)
View Source
const (
	FrequencyLimit = LimitKind(iota)
	ByteRateLimit
	TotalLimit
)
View Source
const (
	SOURCE_LOG_FIELD_NAME        = "src"
	QUOTED_SOURCE_LOG_FIELD_NAME = `"src"`
)
View Source
const (

	//section names
	MANIFEST_KIND_SECTION_NAME             = "kind"
	MANIFEST_ENV_SECTION_NAME              = "env"
	MANIFEST_PARAMS_SECTION_NAME           = "parameters"
	MANIFEST_PERMS_SECTION_NAME            = "permissions"
	MANIFEST_LIMITS_SECTION_NAME           = "limits"
	MANIFEST_HOST_DEFINITIONS_SECTION_NAME = "host-definitions"
	MANIFEST_PREINIT_FILES_SECTION_NAME    = "preinit-files"
	MANIFEST_INVOCATION_SECTION_NAME       = "invocation"

	//preinit-files section
	MANIFEST_PREINIT_FILE__PATTERN_PROP_NAME = "pattern"
	MANIFEST_PREINIT_FILE__PATH_PROP_NAME    = "path"

	//databases section
	MANIFEST_DATABASES_SECTION_NAME = "databases"

	//database description in databases section
	MANIFEST_DATABASE__RESOURCE_PROP_NAME               = "resource"
	MANIFEST_DATABASE__RESOLUTION_DATA_PROP_NAME        = "resolution-data"
	MANIFEST_DATABASE__EXPECTED_SCHEMA_UPDATE_PROP_NAME = "expected-schema-update"
	MANIFEST_DATABASE__ASSERT_SCHEMA_UPDATE_PROP_NAME   = "assert-schema"

	//invocation section
	MANIFEST_INVOCATION__ON_ADDED_ELEM_PROP_NAME = "on-added-element"
	MANIFEST_INVOCATION__ASYNC_PROP_NAME         = "async"

	//permissions section
	INVALID_COMMANDS_PREFIX = "invalid manifest, use: commands: "
	ERR                     = INVALID_COMMANDS_PREFIX + "a command (or subcommand) name should be followed by object literals with the next subcommands as keys (or empty)"

	//parameters
	MANIFEST_PARAM__PATTERN_PROPNAME                  = "pattern"
	MANIFEST_PARAM__DESCRIPTION_PROPNAME              = "description"
	MANIFEST_POSITIONAL_PARAM__REST_PROPNAME          = "rest"
	MANIFEST_NON_POSITIONAL_PARAM__NAME_PROPNAME      = "name"
	MANIFEST_NON_POSITIONAL_PARAM__DEFAULT_PROPNAME   = "default"
	MANIFEST_NON_POSITIONAL_PARAM__CHAR_NAME_PROPNAME = "char-name"

	// --------------------------------
	INITIAL_WORKING_DIR_VARNAME        = "IWD"
	INITIAL_WORKING_DIR_PREFIX_VARNAME = "IWD_PREFIX"
)
View Source
const (
	MEM_HOSTNAME    = "localproc"
	LOCAL_PROC_HOST = "mem://localproc"
)
View Source
const (
	URL_METADATA_KEY  = "_url_"
	MIME_METADATA_KEY = "_mime_"
)
View Source
const (
	INCLUDED_FILE_PATH_SHOULD_NOT_CONTAIN_X = "included file path should not contain '..'"
	MOD_ARGS_VARNAME                        = "mod-args"
	MAX_PREINIT_FILE_SIZE                   = int32(100_000)
	DEFAULT_MAX_READ_FILE_SIZE              = int32(100_000_000)

	MOD_IMPORT_FETCH_TIMEOUT = 5 * time.Second
)
View Source
const (
	INOX_MIMETYPE          = "application/inox"
	DEFAULT_FETCH_TIMEOUT  = 10 * time.Second
	DEFAULT_IMPORT_TIMEOUT = 10 * time.Second

	DEFAULT_MAX_MOD_GRAPH_PATH_LEN = 5

	IMPORT_CONFIG__ALLOW_PROPNAME      = "allow"
	IMPORT_CONFIG__ARGUMENTS_PROPNAME  = "arguments"
	IMPORT_CONFIG__VALIDATION_PROPNAME = "validation"
)
View Source
const (
	MOD_PREP_LOG_SRC = "mod-prep"
	LDB_MAIN_HOST    = Host("ldb://main")
)
View Source
const (
	MAX_UNION_PATTERN_FLATTENING_DEPTH      = 5
	OBJECT_CONSTRAINTS_VERIFICATION_TIMEOUT = 10 * time.Millisecond

	//Default max element count if the number of elements is not exact.
	DEFAULT_LIST_PATTERN_MAX_ELEM_COUNT = math.MaxInt32
)
View Source
const (
	LINE_COUNT_UNIT               = "ln"
	RUNE_COUNT_UNIT               = "rn"
	BYTE_COUNT_UNIT               = "B"
	SIMPLE_RATE_PER_SECOND_SUFFIX = "x/s"
)
View Source
const (
	DEFAULT_MAX_RAND_LEN   = 10
	DEFAULT_MAX_OCCURRENCE = 20
)
View Source
const (
	BYTE_STREAM_BUFF_GROWTH_FACTOR          = 2
	BYTE_STREAM_MINIMUM_MICRO_WAIT_DURATION = 100 * time.Microsecond

	NOT_STARTED_CONFLUENCE_STREAM = 0
	STARTED_CONFLUENCE_STREAM     = 1
	STOPPED_CONFLUENCE_STREAM     = 2
)
View Source
const (
	ANY_HTTPS_HOST_PATTERN = HostPattern("https://**")
	NO_SCHEME_SCHEME_NAME  = Scheme("noscheme")
	NO_SCHEME_SCHEME       = string(NO_SCHEME_SCHEME_NAME + "://")

	LDB_SCHEME = Scheme(inoxconsts.LDB_SCHEME_NAME)
	ODB_SCHEME = Scheme(inoxconsts.ODB_SCHEME_NAME)

	// PATH_MAX on linux
	MAX_TESTED_PATH_BYTE_LENGTH = 4095
	MAX_TESTED_URL_BYTE_LENGTH  = 8000

	//TODO: change value
	MAX_TESTED_HOST_PATTERN_BYTE_LENGTH = 100

	PREFIX_PATH_PATTERN_SUFFIX = "/..."
	ROOT_PREFIX_PATH_PATTERN   = PathPattern("/...")
)
View Source
const (
	INOX_MODULE_RES_KIND         = "inox/module"
	INOX_INCLUDED_CHUNK_RES_KIND = "inox/included-chunk"

	CHUNK_IMPORT_MOD_REL = ResourceRelationKind("inox/import-module")
	CHUNK_INCLUDE_REL    = ResourceRelationKind("inox/include-chunk")
)
View Source
const (
	MAXIMUM_RISK_SCORE      = RiskScore(10_000)
	MEDIUM_RISK_SCORE_LEVEL = 300
	HIGH_RISK_SCORE_LEVEL   = 500
	UNKNOWN_PERM_RISK_SCORE = RiskScore(30)

	HOST_PATTERN_RISK_MULTIPLIER = RiskScore(4)
	HOST_RISK_MULTIPLIER         = RiskScore(3)
	URL_PATTERN_RISK_MULTIPLIER  = RiskScore(2)
	URL_RISK_MULTIPLIER          = RiskScore(1)

	UNKNOW_FILE_SENSITIVITY_MULTIPLIER         = 2
	UNKNOW_FILE_PATTERN_SENSITIVITY_MUTLIPLIER = 3

	HTTP_READ_PERM_RISK_SCORE    = 10
	HTTP_WRITE_PERM_RISK_SCORE   = 20
	HTTP_PROVIDE_PERM_RISK_SCORE = 20

	WS_READ_PERM_RISK_SCORE    = 10
	WS_WRITE_PERM_RISK_SCORE   = 20
	WS_PROVIDE_PERM_RISK_SCORE = 20

	FS_READ_PERM_RISK_SCORE  = 10
	FS_WRITE_PERM_RISK_SCORE = 20

	LTHREAD_PERM_RISK_SCORE = 2 //the creation of lthread is not risky, it's the number of goroutines that can be an issue

	CMD_PERM_RISK_SCORE = 30
)

The following risk score constants are intended to be a starting point, they may be adjusted based on additional research and feedback.

View Source
const (
	CHECK_ERR_PREFIX  = "check: "
	MAX_NAME_BYTE_LEN = 64
)
View Source
const (
	MODULE_IMPORTS_NOT_ALLOWED_IN_INCLUDED_CHUNK = "modules imports are not allowed in included chunks"

	//global constant declarations
	VAR_CONST_NOT_DECLARED_IF_YOU_MEANT_TO_DECLARE_CONSTANTS_GLOBAL_CONST_DECLS_ONLY_SUPPORTED_AT_THE_START_OF_THE_MODULE = "" /* 170-byte string literal not displayed */

	//manifest
	NO_SPREAD_IN_MANIFEST            = "objects & lists in the manifest cannot contain spread elements"
	ELEMENTS_NOT_ALLOWED_IN_MANIFEST = "elements (valus without a key) are not allowed in the manifest object"

	//kind section
	KIND_SECTION_SHOULD_BE_A_STRING_LITERAL             = "the '" + MANIFEST_KIND_SECTION_NAME + "' section of the manifest should have a string value (string literal)"
	INVALID_KIND_SECTION_EMBEDDED_MOD_KINDS_NOT_ALLOWED = "invalid '" + MANIFEST_KIND_SECTION_NAME + "' section: embedded module kinds are not allowed"

	//permissions section
	PERMS_SECTION_SHOULD_BE_AN_OBJECT     = "the '" + MANIFEST_PERMS_SECTION_NAME + "' section of the manifest should be an object"
	ELEMENTS_NOT_ALLOWED_IN_PERMS_SECTION = "elements are not allowed in the 'permissions' section"

	//limits section
	LIMITS_SECTION_SHOULD_BE_AN_OBJECT = "the '" + MANIFEST_LIMITS_SECTION_NAME + "' section of the manifest should be an object"

	//env section
	ENV_SECTION_SHOULD_BE_AN_OBJECT_PATTERN                = "the '" + MANIFEST_ENV_SECTION_NAME + "' section of the manifest should be an object pattern literal"
	ENV_SECTION_NOT_AVAILABLE_IN_EMBEDDED_MODULE_MANIFESTS = "the '" + MANIFEST_ENV_SECTION_NAME + "' section is not available in embedded module manifests"

	//params section
	PARAMS_SECTION_SHOULD_BE_AN_OBJECT                        = "the '" + MANIFEST_PARAMS_SECTION_NAME + "' section of the manifest should be an object literal"
	PARAMS_SECTION_NOT_AVAILABLE_IN_EMBEDDED_MODULE_MANIFESTS = "the '" + MANIFEST_PARAMS_SECTION_NAME + "' section is not available in embedded module manifests"

	FORBIDDEN_NODE_TYPE_IN_INCLUDABLE_CHUNK_IMPORTED_BY_PREINIT = "forbidden node type in includable chunk imported by preinit"

	//permissions
	NO_PERM_DESCRIBED_BY_THIS_TYPE_OF_VALUE         = "there is no permission described by this type of value"
	NO_PERM_DESCRIBED_BY_STRINGS                    = "there is no permission described by strings"
	MAYBE_YOU_MEANT_TO_WRITE_A_PATH_LITERAL         = "maybe you meant to write a path literal such as /dir/ or /data.json (always unquoted)"
	MAYBE_YOU_MEANT_TO_WRITE_A_PATH_PATTERN_LITERAL = "maybe you meant to write a path pattern literal such as %/... or %/*.json (always unquoted)"
	MAYBE_YOU_MEANT_TO_WRITE_A_URL_LITERAL          = "maybe you meant to write a url literal such as https://example.com/ (always unquoted)"
	MAYBE_YOU_MEANT_TO_WRITE_A_URL_PATTERN_LITERAL  = "maybe you meant to write a url pattern literal such as %https://example.com/... (always unquoted)"

	//preinit-files section
	PREINIT_FILES_SECTION_SHOULD_BE_AN_OBJECT                        = "the '" + MANIFEST_PREINIT_FILES_SECTION_NAME + "' section of the manifest should be an object literal"
	PREINIT_FILES__FILE_CONFIG_SHOULD_BE_AN_OBJECT                   = "the description of each file in the '" + MANIFEST_PREINIT_FILES_SECTION_NAME + "' section of the manifest should be an object literal"
	PREINIT_FILES__FILE_CONFIG_PATH_SHOULD_BE_ABS_PATH               = "the ." + MANIFEST_PREINIT_FILE__PATH_PROP_NAME + " of each file in the '" + MANIFEST_PREINIT_FILES_SECTION_NAME + "' section (manifest) should be an absolute path"
	PREINIT_FILES_SECTION_NOT_AVAILABLE_IN_EMBEDDED_MODULE_MANIFESTS = "the '" + MANIFEST_PREINIT_FILES_SECTION_NAME + "' section is not available in embedded module manifests"

	//databases section
	DATABASES_SECTION_SHOULD_BE_AN_OBJECT_OR_ABS_PATH            = "the '" + MANIFEST_DATABASES_SECTION_NAME + "' section of the manifest should be an object literal or an absolute path literal"
	DATABASES__DB_CONFIG_SHOULD_BE_AN_OBJECT                     = "the description of each database in the '" + MANIFEST_DATABASES_SECTION_NAME + "' section of the manifest should be an object literal"
	DATABASES__DB_RESOURCE_SHOULD_BE_HOST_OR_URL                 = "the ." + MANIFEST_DATABASE__RESOURCE_PROP_NAME + " property of database descriptions in the '" + MANIFEST_DATABASES_SECTION_NAME + "' section (manifest) should be a Host or a URL"
	DATABASES__DB_EXPECTED_SCHEMA_UPDATE_SHOULD_BE_BOOL_LIT      = "the ." + MANIFEST_DATABASE__EXPECTED_SCHEMA_UPDATE_PROP_NAME + " property of database descriptions in the '" + MANIFEST_DATABASES_SECTION_NAME + "' section (manifest) should be a boolean literal (the property is optional)"
	DATABASES__DB_ASSERT_SCHEMA_SHOULD_BE_PATT_IDENT_OR_OBJ_PATT = "the ." + MANIFEST_DATABASE__ASSERT_SCHEMA_UPDATE_PROP_NAME + " property of database descriptions in the '" + MANIFEST_DATABASES_SECTION_NAME + "' section (manifest) should be a pattern identifier or an object pattern literal (the property is optional)"
	DATABASES_SECTION_NOT_AVAILABLE_IN_EMBEDDED_MODULE_MANIFESTS = "the '" + MANIFEST_DATABASES_SECTION_NAME + "' section is not available in embedded module manifests"
	DATABASES__DB_RESOLUTION_DATA_ONLY_NIL_AND_PATHS_SUPPORTED   = "nil and paths are the only supported values for ." + MANIFEST_DATABASE__RESOLUTION_DATA_PROP_NAME + " in a database description"

	//invocation section
	INVOCATION_SECTION_SHOULD_BE_AN_OBJECT                        = "the '" + MANIFEST_INVOCATION_SECTION_NAME + "' section of the manifest should be an object literal"
	INVOCATION_SECTION_NOT_AVAILABLE_IN_EMBEDDED_MODULE_MANIFESTS = "the '" + MANIFEST_INVOCATION_SECTION_NAME + "' section is not available in embedded module manifests"
	ONLY_URL_LITS_ARE_SUPPORTED_FOR_NOW                           = "only URL literals are supported for now"
	A_BOOL_LIT_IS_EXPECTED                                        = "a boolean literal is expected"
	SCHEME_NOT_DB_SCHEME_OR_IS_NOT_SUPPORTED                      = "this scheme is not a database scheme or is not supported"
	THE_DATABASES_SECTION_SHOULD_BE_PRESENT                       = "the databases section should be present because the auto invocation of the module depends on one or more database(s)"

	HOST_DEFS_SECTION_SHOULD_BE_A_DICT = "the '" + MANIFEST_HOST_DEFINITIONS_SECTION_NAME + "' section of the manifest should be a dictionary with host keys"
	HOST_SCHEME_NOT_SUPPORTED          = "the host's scheme is not supported"

	//included chunk
	AN_INCLUDED_CHUNK_SHOULD_ONLY_CONTAIN_DEFINITIONS = "an included chunk should only contain definitions (functions, patterns, ...)"

	INVALID_RATE     = "invalid rate"
	INVALID_QUANTITY = "invalid quantity"

	//spawn expression
	INVALID_SPAWN_EXPR_EXPR_SHOULD_BE_ONE_OF                             = "invalid spawn expression: the expression should be a simple function call or an embedded module (that can be global)"
	INVALID_SPAWN_GLOBALS_SHOULD_BE                                      = "" /* 154-byte string literal not displayed */
	INVALID_SPAWN_ONLY_OBJECT_LITERALS_WITH_NO_SPREAD_ELEMENTS_SUPPORTED = "" /* 129-byte string literal not displayed */

	INVALID_ASSIGNMENT_ANONYMOUS_VAR_CANNOT_BE_ASSIGNED                         = "invalid assignment: anonymous variable '$' cannot be assigned"
	INVALID_ASSIGNMENT_EQUAL_ONLY_SUPPORTED_ASSIGNMENT_OPERATOR_FOR_SLICE_EXPRS = "invalid assignment: '=' is the only supported assignment operators for slice expressions"

	INVALID_FN_DECL_SHOULD_BE_TOP_LEVEL_STMT                       = "invalid function declaration: a function declaration should be a top level statement in a module (embedded or not)"
	INVALID_BREAK_OR_CONTINUE_STMT_SHOULD_BE_IN_A_FOR_OR_WALK_STMT = "invalid break/continue statement: should be in a for or walk statement"
	INVALID_PRUNE_STMT_SHOULD_BE_IN_WALK_STMT                      = "invalid prune statement: should be in a walk statement"
	SELF_ACCESSIBILITY_EXPLANATION                                 = "'self' is only accessible within " +
		"extension methods, struct methods, metaproperty initialization blocks, and lifetime jobs"
	CANNOT_CHECK_OBJECT_PROP_WITHOUT_PARENT       = "checking an ObjectProperty node requires the parent ObjectLiteral node"
	CANNOT_CHECK_OBJECT_METAPROP_WITHOUT_PARENT   = "checking an ObjectMetaProperty node requires the parent ObjectLiteral node"
	OBJ_REC_LIT_CANNOT_HAVE_METAPROP_KEYS         = "" /* 144-byte string literal not displayed */
	CANNOT_CHECK_MANIFEST_WITHOUT_PARENT          = "checking a Manifest node requires the parent node"
	CANNOT_CHECK_STRUCT_METHOD_DEF_WITHOUT_PARENT = "checking the definition of a struct method requires the parent node"

	//object literal
	ELEMENTS_NOT_ALLOWED_IF_EMPTY_PROP_NAME = "elements are not allowed if the empty property name is present"
	EMPTY_PROP_NAME_NOT_ALLOWED_IF_ELEMENTS = "the empty property name is not allowed if there are elements (values without a key)"

	//object pattern literals
	UNEXPECTED_OTHER_PROPS_EXPR_OTHERPROPS_NO_IS_PRESENT = "unexpected otherprops expression: no other properties are allowed since otherprops(no) is present"

	MISPLACED_SENDVAL_EXPR                 = "" /* 128-byte string literal not displayed */
	MISPLACED_RECEPTION_HANDLER_EXPRESSION = "misplaced reception handler expression is misplaced, it should be an element (no key) of an object literal"

	INVALID_MAPPING_ENTRY_KEY_ONLY_SIMPL_LITS_AND_PATT_IDENTS      = "invalid mapping entry key: only simple value literals and pattern identifiers are supported"
	ONLY_GLOBALS_ARE_ACCESSIBLE_FROM_RIGHT_SIDE_OF_MAPPING_ENTRIES = "only globals are accessible from the right side of mapping entries"

	MISPLACED_RUNTIME_TYPECHECK_EXPRESSION                         = "" /* 136-byte string literal not displayed */
	MISPLACED_COMPUTE_EXPR_SHOULD_BE_IN_DYNAMIC_MAPPING_EXPR_ENTRY = "misplaced compute expression: compute expressions are only allowed on the right side of a dynamic Mapping entry"
	MISPLACE_YIELD_STATEMENT_ONLY_ALLOWED_IN_EMBEDDED_MODULES      = "misplaced yield statement: yield statements are only allowed in embedded modules"
	MISPLACED_INCLUSION_IMPORT_STATEMENT_TOP_LEVEL_STMT            = "misplaced inclusion import statement: it should be located at the module's top level or a the top level of the preinit block"
	MISPLACED_MOD_IMPORT_STATEMENT_TOP_LEVEL_STMT                  = "misplaced module import statement: it should be located at the top level"
	MISPLACED_PATTERN_DEF_STATEMENT_TOP_LEVEL_STMT                 = "misplaced pattern definition statement: it should be located at the top level"
	MISPLACED_PATTERN_NS_DEF_STATEMENT_TOP_LEVEL_STMT              = "misplaced pattern namespace definition statement: it should be located at the top level"
	MISPLACED_HOST_ALIAS_DEF_STATEMENT_TOP_LEVEL_STMT              = "misplaced host alias definition statement: it should be located at the top level"
	MISPLACED_READONLY_PATTERN_EXPRESSION                          = "misplaced readonly pattern expression: they are only allowed as the type of function parameters"
	MISPLACED_EXTEND_STATEMENT_TOP_LEVEL_STMT                      = "misplaced extend statement: it should be located at the top level"
	MISPLACED_STRUCT_DEF_TOP_LEVEL_STMT                            = "misplaced struct definition: it should be located at the top level"

	INVALID_MEM_HOST_ONLY_VALID_VALUE                                 = "invalid mem:// host, only valid value is " + MEM_HOSTNAME
	LOWER_BOUND_OF_INT_RANGE_LIT_SHOULD_BE_SMALLER_THAN_UPPER_BOUND   = "the lower bound of an integer range literal should be smaller than the upper bound"
	LOWER_BOUND_OF_FLOAT_RANGE_LIT_SHOULD_BE_SMALLER_THAN_UPPER_BOUND = "the lower bound of a float range literal should be smaller than the upper bound"

	//lifetime job
	MISSING_LIFETIMEJOB_SUBJECT_PATTERN_NOT_AN_IMPLICIT_OBJ_PROP = "missing subject pattern of lifetime job: subject can only be ommitted for lifetime jobs that are implicit object properties"

	//visibility
	INVALID_VISIB_INIT_BLOCK_SHOULD_CONT_OBJ   = "invalid visibility initialization block: block should only contain an object literal"
	INVALID_VISIB_DESC_SHOULDNT_HAVE_METAPROPS = "invalid visibility initialization description: object should not have metaproperties"
	INVALID_VISIB_DESC_SHOULDNT_HAVE_ELEMENTS  = "invalid visibility initialization description: object should not have elements (values without a key)"
	VAL_SHOULD_BE_KEYLIST_LIT                  = "value should be a key list literal"
	VAL_SHOULD_BE_DICT_LIT                     = "value should be a dictionary literal"
	INVALID_VISIBILITY_DESC_KEY                = "invalid key for visibility description"

	OPTIONAL_DYN_MEMB_EXPR_NOT_SUPPORTED_YET = "optional dynamic member expression are not supported yet"

	VARS_NOT_ALLOWED_IN_PATTERN_AND_EXTENSION_OBJECT_PROPERTIES = "variables are not allowed in the extended pattern and " +
		"in the extension object's properties"

	VARS_CANNOT_BE_USED_IN_STRUCT_FIELD_DEFS = "variables cannot be used in struct field definitions"

	//struct types
	MISPLACED_STRUCT_TYPE_NAME                  = "misplaced struct type name, note that struct types are not patterns and are not allowed inside patterns"
	STRUCT_TYPES_NOT_ALLOWED_AS_PARAMETER_TYPES = "struct types are not allowed as parameter types, pointer types are allowed though"
	STRUCT_TYPES_NOT_ALLOWED_AS_RETURN_TYPES    = "struct types are not allowed as return types, pointer types are allowed though"

	//pointer types
	A_STRUCT_TYPE_IS_EXPECTED_AFTER_THE_STAR = "a struct type is expected after '*'"
	MISPLACED_POINTER_TYPE                   = "misplaced pointer type, note that pointer types are not patterns and are not allowed inside patterns"

	//test suites & cases
	TEST_CASES_NOT_ALLOWED_IF_SUBSUITES_ARE_PRESENT     = "test cases are not allowed if sub suites are presents"
	TEST_CASE_STMTS_NOT_ALLOWED_OUTSIDE_OF_TEST_SUITES  = "test case statements are not allowed outside of test suites"
	TEST_SUITE_STMTS_NOT_ALLOWED_INSIDE_TEST_CASE_STMTS = "test suite statements are not allowed in test case statements"

	//new expressions
	A_STRUCT_TYPE_NAME_IS_EXPECTED = "a struct type name is expected"
)
View Source
const (
	MIN_LAZY_STR_CONCATENATION_SIZE                 = 200 //this constant can change in the future, it's a starting point.
	MAX_SMALL_STRING_SIZE_IN_LAZY_STR_CONCATENATION = 30  //this constant can change in the future, it's a starting point.
)
View Source
const (
	//maximum length of strings tested against regex patterns, sequence string patterns and parser patterns.
	DEFAULT_MAX_TESTED_STRING_BYTE_LENGTH = 10_000_000

	UNSIGNED_DECIMAL_FLOAT_REGEX = "[0-9]+(?:\\.?[0-9]*)(?:[Ee][-+]?[0-9]*)?"
	UNSIGNED_ZERO_FLOAT_REGEX    = "0+(?:\\.?0*)?(?:[Ee][-+]?[0-9]*)?"

	INFINITE_STRING_PATTERN_NESTING_DEPTH = 50
)
View Source
const (
	GLOBAL_SCOPE symbolScope = iota + 1
	LOCAL_SCOPE
)
View Source
const (
	DEFAULT_EDGE_TO_CHILD_TEXT         = "parent of"
	DEFAULT_EDGE_TO_WATCHED_CHILD_TEXT = "watching"
)
View Source
const (
	TEST__MAX_FS_STORAGE_HINT = ByteCount(10_000_000)
	TEST_FULL_NAME_PART_SEP   = "::"
)
View Source
const (
	ONE_HOUR        = Duration(time.Hour)
	ONE_MINUTE      = Duration(time.Minute)
	ONE_SECOND      = Duration(time.Second)
	ONE_MILLISECOND = Duration(time.Millisecond)
	MAX_DURATION    = Duration(1<<63 - 1)
)
View Source
const (
	TOKEN_BUCKET_MANAGEMENT_TICK_INTERVAL = time.Millisecond
	TOKEN_BUCKET_CAPACITY_SCALE           = int64(time.Second / TOKEN_BUCKET_MANAGEMENT_TICK_INTERVAL)

	MAX_WAIT_CHAN_COUNT = 1000
)
View Source
const (
	DEFAULT_TRANSACTION_TIMEOUT = Duration(20 * time.Second)
	TX_TIMEOUT_OPTION_NAME      = "timeout"
)
View Source
const (
	MAX_SUBSEQUENT_WAIT_WRITE_TX_COUNT = 100
	WAIT_FOR_READ_TXS_TIMEOUT          = 2 * time.Second
)
View Source
const (
	INT_ADDRESS_LESS_TYPE_ID uintptr = iota + 1
	FLOAT_ADDRESS_LESS_TYPE_ID
	BOOL_ADDRESS_LESS_TYPE_ID
	STR_ADDRESS_LESS_TYPE_ID
	URL_ADDRESS_LESS_TYPE_ID
	HOST_ADDRESS_LESS_TYPE_ID
)
View Source
const (
	LIST_SHRINK_DIVIDER        = 2
	MIN_SHRINKABLE_LIST_LENGTH = 10 * LIST_SHRINK_DIVIDER
)
View Source
const (
	VM_STACK_SIZE = 200
	MAX_FRAMES    = 20
)
View Source
const (
	JSON_UNTYPED_VALUE_SUFFIX   = "__value"
	MAX_JSON_REPR_WRITING_DEPTH = 20
	JS_MIN_SAFE_INTEGER         = -9007199254740991
	JS_MAX_SAFE_INTEGER         = 9007199254740991

	SERIALIZED_INT_RANGE_START_KEY     = "start"
	SERIALIZED_INT_RANGE_START_END_KEY = "end"

	SERIALIZED_FLOAT_RANGE_START_KEY          = "start"
	SERIALIZED_FLOAT_RANGE_START_EXCL_END_KEY = "exclusiveEnd"
	SERIALIZED_FLOAT_RANGE_START_END_KEY      = "end"

	SERIALIZED_INT_RANGE_PATTERN_RANGE_KEY = "range"
	SERIALIZED_INT_RANGE_PATTERN_MULT_OF   = "multipleOf"

	SERIALIZED_FLOAT_RANGE_PATTERN_RANGE_KEY = "range"
	SERIALIZED_FLOAT_RANGE_PATTERN_MULT_OF   = "multipleOf"

	SERIALIZED_INT_RANGE_STRING_PATTERN_RANGE_KEY = "range"

	SERIALIZED_FLOAT_RANGE_STRING_PATTERN_RANGE_KEY = "range"

	SERIALIZED_SECRET_PATTERN_VAL_PATTERN_KEY     = "valuePattern"
	SERIALIZED_SECRET_PATTERN_VAL_PEM_ENCODED_KEY = "isPemEncoded"

	SERIALIZED_EVENT_PATTERN_VAL_PATTERN_KEY = "value"

	SERIALIZED_OBJECT_PATTERN_INEXACT_KEY           = "inexact"
	SERIALIZED_OBJECT_PATTERN_ENTRIES_KEY           = "entries"
	SERIALIZED_OBJECT_PATTERN_ENTRY_PATTERN_KEY     = "pattern"
	SERIALIZED_OBJECT_PATTERN_ENTRY_IS_OPTIONAL_KEY = "isOptional"
	SERIALIZED_OBJECT_PATTERN_ENTRY_REQ_KEYS_KEY    = "requiredKeys"
	SERIALIZED_OBJECT_PATTERN_ENTRY_REQ_PATTERN_KEY = "requiredPattern"

	SERIALIZED_RECORD_PATTERN_INEXACT_KEY           = "inexact"
	SERIALIZED_RECORD_PATTERN_ENTRIES_KEY           = "entries"
	SERIALIZED_RECORD_PATTERN_ENTRY_PATTERN_KEY     = "pattern"
	SERIALIZED_RECORD_PATTERN_ENTRY_IS_OPTIONAL_KEY = "isOptional"

	SERIALIZED_LIST_PATTERN_ELEMENTS_KEY  = "elements"
	SERIALIZED_LIST_PATTERN_ELEMENT_KEY   = "element"
	SERIALIZED_LIST_PATTERN_MIN_COUNT_KEY = "minCount"
	SERIALIZED_LIST_PATTERN_MAX_COUNT_KEY = "maxCount"

	SERIALIZED_TUPLE_PATTERN_ELEMENTS_KEY = "elements"
	SERIALIZED_TUPLE_PATTERN_ELEMENT_KEY  = "element"
)
View Source
const ASSERTION_BUFF_WRITER_SIZE = 100
View Source
const (
	CONSTRAINTS_KEY = "_constraints_"
)
View Source
const (
	DATE_FORMAT_PATTERN_NAMESPACE = "date-format"
)
View Source
const (
	DEFAULT_MAX_HISTORY_LEN = 5
)
View Source
const (
	DEFAULT_MICROTASK_ARRAY_SIZE = 4
)
View Source
const DEFAULT_XML_ATTR_VALUE = String("")
View Source
const (
	FIRST_VALID_CALLBACK_HANDLE = 1
)
View Source
const (
	LAST_RESERVED_COLOR_ID = 10_000 // not definitive

)
View Source
const (
	MAX_CLONING_DEPTH = 10
)
View Source
const (
	MAX_COMPARISON_DEPTH = 200
)
View Source
const MAX_UNWRAPPING_DEPTH = 5
View Source
const (
	MAX_VALUE_PRINT_DEPTH = 10
)
View Source
const Nil = NilT(0)
View Source
const (
	ROUTINE_POST_YIELD_PAUSE = time.Microsecond
)
View Source
const (
	SMART_LOCK_HOLD_TIMEOUT = 100 * time.Millisecond
)
View Source
const SYNC_CHAN_SIZE = 100
View Source
const (
	VISIBILITY_KEY = "_visibility_"
)

Variables

View Source
var (
	ErrAttemptToMutateReadonlyByteSlice            = errors.New("attempt to write a readonly byte slice")
	ErrAttemptToCreateMutableSpecificTypeByteSlice = errors.New("attempt to create a mutable byte slice with specific content type")
)
View Source
var (
	ErrNotClonable                = errors.New("not clonable")
	ErrMaximumCloningDepthReached = errors.New("maximum cloning depth reached, there is probably a cycle")
)
View Source
var (
	BOOL_COMPTIME_TYPE = &BuiltinType{
		name:     patternnames.BOOL,
		symbolic: symbolic.BUILTIN_COMPTIME_TYPES[patternnames.BOOL],
		goType:   BOOL_TYPE,
	}
	INT_COMPTIME_TYPE = &BuiltinType{
		name:     patternnames.INT,
		symbolic: symbolic.BUILTIN_COMPTIME_TYPES[patternnames.INT],
		goType:   INT_TYPE,
	}
	FLOAT_COMPTIME_TYPE = &BuiltinType{
		name:     patternnames.FLOAT,
		symbolic: symbolic.BUILTIN_COMPTIME_TYPES[patternnames.FLOAT],
		goType:   FLOAT64_TYPE,
	}
	STRING_COMPTIME_TYPE = &BuiltinType{
		name:     patternnames.STRING,
		symbolic: symbolic.BUILTIN_COMPTIME_TYPES[patternnames.STRING],
		goType:   STRING_TYPE,
	}
)
View Source
var (
	NewDefaultGlobalState NewDefaultGlobalStateFn //default state factory
	NewDefaultContext     NewDefaultContextFn     //default context factory

	ErrNoFilesystemProvided = errors.New("no filesystem provided")
)
View Source
var (
	ErrBothCtxFilesystemArgsProvided            = errors.New("invalid arguments: both .CreateFilesystem & .Filesystem provided")
	ErrBothParentCtxArgsProvided                = errors.New("invalid arguments: both .ParentContext & .ParentStdLibContext provided")
	ErrInitialWorkingDirProvidedWithoutFS       = errors.New("invalid arguments: .InitialWorkingDirectory is provided but no filesystem is provided")
	ErrImpossibleToDeterminateInitialWorkingDir = errors.New("impossible to determinate initial working directory")

	ErrNonExistingNamedPattern                 = errors.New("non existing named pattern")
	ErrNotUniqueAliasDefinition                = errors.New("cannot register a host alias more than once")
	ErrNotUniquePatternDefinition              = errors.New("cannot register a pattern more than once")
	ErrNotUniquePatternNamespaceDefinition     = errors.New("cannot register a pattern namespace more than once")
	ErrNotUniqueHostDefinitionDefinition       = errors.New("cannot set host definition data more than once")
	ErrNotUniqueProtocolClient                 = errors.New("client already defined")
	ErrCannotProvideLimitTokensForChildContext = errors.New("limit tokens cannot be set in new context's config if it is a child")
	ErrNoAssociatedState                       = errors.New("context has no associated state")
	ErrAlreadyAssociatedState                  = errors.New("context already has an associated state")
	ErrNotSharableNorClonableUserDataValue     = errors.New("attempt to set a user data entry with a value that is not sharable nor clonable")
	ErrDoubleUserDataDefinition                = errors.New("cannot define a user data entry more than once")
	ErrTypeExtensionAlreadyRegistered          = errors.New("type extension is already registered")

	ErrLimitNotPresentInContext   = errors.New("limit not present in context")
	ErrOnDoneMicrotasksNotAllowed = errors.New("'on done' microtasks are not allowed")
)
View Source
var (
	ErrDiscardedChunk = errors.New("chunk is discarded")

	CHUNK_PROPNAMES = []string{"data"}
)
View Source
var (
	ErrOwnerStateAlreadySet                            = errors.New("owner state already set")
	ErrOwnerStateNotSet                                = errors.New("owner state not set")
	ErrNameCollisionWithInitialDatabasePropertyName    = errors.New("name collision with initial database property name")
	ErrTopLevelEntityNamesShouldBeValidInoxIdentifiers = errors.New("top-level entity names should be valid Inox identifiers (e.g., users, client-names)")
	ErrTopLevelEntitiesAlreadyLoaded                   = errors.New("top-level entities already loaded")
	ErrDatabaseSchemaOnlyUpdatableByOwnerState         = errors.New("database schema can only be updated by owner state")
	ErrNoDatabaseSchemaUpdateExpected                  = errors.New("no database schema update is expected")
	ErrCurrentSchemaNotEqualToExpectedSchema           = errors.New("current schema not equal to expected schema")
	ErrNewSchemaNotEqualToExpectedSchema               = errors.New("new schema not equal to expected schema")
	ErrDatabaseSchemaAlreadyUpdatedOrNotAllowed        = errors.New("database schema already updated or no longer allowed")
	ErrInvalidAccessSchemaNotUpdatedYet                = errors.New("access to database is not allowed because schema is not updated yet")
	ErrSchemaCannotBeUpdatedInDevMode                  = errors.New("schema cannot be updated in dev mode")
	ErrInvalidDatabaseDirpath                          = errors.New("invalid database dir path")
	ErrDatabaseAlreadyOpen                             = errors.New("database is already open")
	ErrDatabaseClosed                                  = errors.New("database is closed")
	ErrCannotResolveDatabase                           = errors.New("cannot resolve database")
	ErrCannotFindDatabaseHost                          = errors.New("cannot find corresponding host of database")
	ErrInvalidDatabaseHost                             = errors.New("host of database is invalid")
	ErrInvalidDBValuePropRetrieval                     = errors.New("invalid property retrieval: value should be serializablr and should not be that a method or dynamic value")

	DATABASE_PROPNAMES = []string{"update_schema", "close", "schema"}

	ElementKeyEncoding = base32.StdEncoding.WithPadding(base32.NoPadding)
)
View Source
var (
	ANYVAL_PATTERN = &TypePattern{
		Type:          VALUE_TYPE,
		Name:          "any",
		SymbolicValue: symbolic.ANY,
	}
	SERIALIZABLE_PATTERN = &TypePattern{
		Type:          SERIALIZABLE_TYPE,
		Name:          "serializable",
		SymbolicValue: symbolic.ANY_SERIALIZABLE,
	}

	NEVER_PATTERN = &TypePattern{
		Type:          reflect.TypeOf(struct{ __never int }{}),
		Name:          patternnames.NEVER,
		SymbolicValue: symbolic.NEVER,
	}

	//TODO: improve (using a type pattern can create issues)
	VAL_PATTERN = &TypePattern{
		Type:          VALUE_TYPE,
		Name:          __VAL_PATTERN_NAME,
		SymbolicValue: symbolic.NEVER,
		CallImpl: func(typePattern *TypePattern, values []Serializable) (Pattern, error) {
			if len(values) != 1 {
				return nil, commonfmt.FmtErrNArgumentsExpected("1")
			}

			return NewExactValuePattern(values[0]), nil
		},
		SymbolicCallImpl: func(ctx *symbolic.Context, values []symbolic.Value) (symbolic.Pattern, error) {
			var recordPattern *symbolic.RecordPattern

			if len(values) != 1 {
				return nil, commonfmt.FmtErrNArgumentsExpected("1")
			}

			symbolic.NewExactValuePattern(values[0].(symbolic.Serializable))

			return recordPattern, nil
		},
	}

	NIL_PATTERN = &TypePattern{
		Type:          NIL_TYPE,
		Name:          patternnames.NIL,
		SymbolicValue: symbolic.Nil,
	}

	STR_PATTERN_PATTERN = &TypePattern{
		Name:          patternnames.STRING_PATTERN,
		SymbolicValue: symbolic.NEVER,
		CallImpl: func(typePattern *TypePattern, values []Serializable) (Pattern, error) {
			if len(values) != 1 {
				return nil, commonfmt.FmtErrNArgumentsExpected("1")
			}

			pattern, ok := values[0].(Pattern)
			if !ok {
				return nil, fmt.Errorf("invalid argument")
			}

			stringPattern, ok := pattern.StringPattern()

			if !ok {
				return nil, fmt.Errorf("invalid argument")
			}

			return stringPattern, nil
		},
		SymbolicCallImpl: func(ctx *symbolic.Context, values []symbolic.Value) (symbolic.Pattern, error) {
			if len(values) != 1 {
				return nil, commonfmt.FmtErrNArgumentsExpected("1")
			}

			pattern, ok := values[0].(symbolic.Pattern)
			if !ok {
				return nil, errors.New(symbolic.FmtInvalidArg(0, values[0], symbolic.ANY_PATTERN))
			}

			stringPattern, ok := pattern.StringPattern()
			if !ok {
				return nil, commonfmt.FmtErrInvalidArgumentAtPos(0, symbolic.Stringify(pattern)+" given but a pattern having an associated string pattern is expected")
			}

			return stringPattern, nil
		},
	}

	IDENT_PATTERN = &TypePattern{
		Type:          IDENTIFIER_TYPE,
		Name:          patternnames.IDENT,
		SymbolicValue: symbolic.ANY_IDENTIFIER,
	}
	PROPNAME_PATTERN = &TypePattern{
		Type:          PROPNAME_TYPE,
		Name:          patternnames.PROPNAME,
		SymbolicValue: symbolic.ANY_PROPNAME,
	}
	LONG_VALUEPATH_PATTERN = &TypePattern{
		Type:          LONG_VALUE_PATH_TYPE,
		Name:          patternnames.LONG_VALUE_PATH,
		SymbolicValue: symbolic.ANY_LONG_VALUE_PATH,
	}
	VALUEPATH_PATTERN = &TypePattern{
		Type:          VALUE_PATH_INTERFACE__TYPE,
		Name:          patternnames.VALUE_PATH,
		SymbolicValue: symbolic.ANY_VALUE_PATH,
	}
	RUNE_PATTERN = &TypePattern{
		Type:          RUNE_TYPE,
		Name:          patternnames.RUNE,
		SymbolicValue: symbolic.ANY_RUNE,
	}
	BYTE_PATTERN = &TypePattern{
		Type:          BYTE_TYPE,
		Name:          patternnames.BYTE,
		SymbolicValue: symbolic.ANY_BYTE,
	}
	ANY_PATH_STRING_PATTERN = NewStringPathPattern("")

	PATH_PATTERN = &TypePattern{
		Type:          PATH_TYPE,
		Name:          patternnames.PATH,
		SymbolicValue: symbolic.ANY_PATH,
		stringPattern: func() (StringPattern, bool) {
			return ANY_PATH_STRING_PATTERN, true
		},
		symbolicStringPattern: func() (symbolic.StringPattern, bool) {

			return symbolic.ANY_STR_PATTERN, true
		},
	}
	STRING_PATTERN = &TypePattern{
		Type:          STRING_TYPE,
		Name:          patternnames.STRING,
		SymbolicValue: symbolic.ANY_STRING,
	}
	STR_PATTERN = &TypePattern{
		Type:          STR_LIKE_INTERFACE_TYPE,
		Name:          patternnames.STR,
		SymbolicValue: symbolic.ANY_STR_LIKE,
	}
	URL_PATTERN = &TypePattern{
		Type:          URL_TYPE,
		Name:          patternnames.URL,
		SymbolicValue: symbolic.ANY_URL,
	}
	SCHEME_PATTERN = &TypePattern{
		Type:          SCHEME_TYPE,
		Name:          patternnames.SCHEME,
		SymbolicValue: symbolic.ANY_SCHEME,
	}
	HOST_PATTERN = &TypePattern{
		Type:          HOST_TYPE,
		Name:          patternnames.HOST,
		SymbolicValue: symbolic.ANY_HOST,
	}
	EMAIL_ADDR_PATTERN = &TypePattern{
		Type:          EMAIL_ADDR_TYPE,
		Name:          patternnames.EMAILADDR,
		SymbolicValue: symbolic.ANY_EMAIL_ADDR,
	}
	EMPTY_INEXACT_OBJECT_PATTERN = NewInexactObjectPattern(nil)
	OBJECT_PATTERN               = &TypePattern{
		Type:          OBJECT_TYPE,
		Name:          patternnames.OBJECT,
		SymbolicValue: symbolic.NewAnyObject(),
	}
	EMPTY_INEXACT_RECORD_PATTERN = NewInexactRecordPattern(nil)

	RECORD_PATTERN = &TypePattern{
		Type: RECORD_TYPE,
		Name: patternnames.RECORD,
		CallImpl: func(typePattern *TypePattern, values []Serializable) (Pattern, error) {
			var recordPattern *RecordPattern

			for _, val := range values {
				switch v := val.(type) {
				case *ObjectPattern:
					if recordPattern != nil {
						return nil, commonfmt.FmtErrArgumentProvidedAtLeastTwice("pattern")
					}

					recordPatternEntries := make([]RecordPatternEntry, len(v.entries))
					for i, entry := range v.entries {
						if entry.Dependencies.Pattern != nil || len(entry.Dependencies.RequiredKeys) > 0 {
							return nil, fmt.Errorf("input object pattern should not have dependency relations")
						}
						recordPatternEntries[i] = RecordPatternEntry{
							Name:       entry.Name,
							Pattern:    entry.Pattern,
							IsOptional: entry.IsOptional,
						}
					}

					recordPattern = &RecordPattern{
						entries:            recordPatternEntries,
						inexact:            v.inexact,
						optionalEntryCount: v.optionalEntryCount,
					}
				case *RecordPattern:
					if recordPattern != nil {
						return nil, commonfmt.FmtErrArgumentProvidedAtLeastTwice("pattern")
					}

					recordPattern = v
				default:
					return nil, FmtErrInvalidArgument(v)
				}
			}

			return recordPattern, nil
		},
		SymbolicCallImpl: func(ctx *symbolic.Context, values []symbolic.Value) (symbolic.Pattern, error) {
			var recordPattern *symbolic.RecordPattern

			for _, val := range values {
				switch v := val.(type) {
				case *symbolic.ObjectPattern:
					if recordPattern != nil {
						return nil, commonfmt.FmtErrArgumentProvidedAtLeastTwice("pattern")
					}

					recordPattern = v.ToRecordPattern()
				case *symbolic.RecordPattern:
					if recordPattern != nil {
						return nil, commonfmt.FmtErrArgumentProvidedAtLeastTwice("pattern")
					}

					recordPattern = v
				default:
					return nil, errors.New(symbolic.FmtInvalidArg(0, v, symbolic.NewAnyObjectPattern()))
				}
			}

			return recordPattern, nil
		},
		SymbolicValue: symbolic.NewAnyrecord(),
	}

	ANY_ELEM_LIST_PATTERN = NewListPatternOf(SERIALIZABLE_PATTERN)

	LIST_PATTERN = &TypePattern{
		Type:          LIST_PTR_TYPE,
		Name:          patternnames.LIST,
		SymbolicValue: symbolic.NewListOf(symbolic.ANY_SERIALIZABLE),
	}

	ANY_ELEM_TUPLE_PATTERN = NewTuplePatternOf(SERIALIZABLE_PATTERN)

	TUPLE_PATTERN = &TypePattern{
		Type: TUPLE_TYPE,
		Name: patternnames.TUPLE,
		CallImpl: func(typePattern *TypePattern, values []Serializable) (Pattern, error) {
			var elemPattern Pattern

			for _, val := range values {
				switch v := val.(type) {
				case Pattern:
					if elemPattern != nil {
						return nil, commonfmt.FmtErrArgumentProvidedAtLeastTwice("pattern")
					}
					elemPattern = v
				default:
					return nil, FmtErrInvalidArgument(v)
				}
			}

			return NewTuplePatternOf(elemPattern), nil
		},
		SymbolicCallImpl: func(ctx *symbolic.Context, values []symbolic.Value) (symbolic.Pattern, error) {
			var elemPattern symbolic.Pattern

			for _, val := range values {
				switch v := val.(type) {
				case symbolic.Pattern:
					if elemPattern != nil {
						return nil, commonfmt.FmtErrArgumentProvidedAtLeastTwice("pattern")
					}
					elemPattern = v
				default:
					return nil, errors.New(symbolic.FmtInvalidArg(0, v, symbolic.ANY_TUPLE))
				}
			}

			return symbolic.NewTuplePatternOf(elemPattern), nil
		},
		SymbolicValue: symbolic.ANY_TUPLE,
	}
	ORDERED_PAIR_PATTERN = &TypePattern{
		Type:          ORDERED_PAIR_TYPE,
		Name:          patternnames.ORDERED_PAIR,
		SymbolicValue: symbolic.ANY_ORDERED_PAIR,
	}
	DICTIONARY_PATTERN = &TypePattern{
		Type:          DICT_TYPE,
		Name:          patternnames.DICT,
		SymbolicValue: symbolic.ANY_DICT,
	}
	RUNESLICE_PATTERN = &TypePattern{
		Type:          RUNE_SLICE_TYPE,
		Name:          patternnames.RUNES,
		SymbolicValue: symbolic.ANY_RUNE_SLICE,
	}
	BYTESLICE_PATTERN = &TypePattern{
		Type:          BYTE_SLICE_TYPE,
		Name:          patternnames.BYTES,
		SymbolicValue: symbolic.ANY_BYTE_SLICE,
	}
	KEYLIST_PATTERN = &TypePattern{
		Type:          KEYLIST_TYPE,
		Name:          patternnames.KEYLIST,
		SymbolicValue: symbolic.ANY_KEYLIST,
	}
	BOOL_PATTERN = &TypePattern{
		Type:          BOOL_TYPE,
		Name:          patternnames.BOOL,
		RandomImpl:    RandBool,
		SymbolicValue: symbolic.ANY_BOOL,
	}
	INT_PATTERN = &TypePattern{
		Type:          INT_TYPE,
		Name:          patternnames.INT,
		RandomImpl:    RandInt,
		SymbolicValue: symbolic.ANY_INT,
		CallImpl: func(typePattern *TypePattern, values []Serializable) (Pattern, error) {
			intRangeProvided := false
			var intRange IntRange

			for _, val := range values {
				switch v := val.(type) {
				case IntRange:
					if intRangeProvided {
						return nil, commonfmt.FmtErrArgumentProvidedAtLeastTwice("range")
					}
					intRange = v
					intRangeProvided = true

					if intRange.unknownStart {
						return nil, fmt.Errorf("provided int range should not have an unknown start")
					}
				default:
					return nil, FmtErrInvalidArgument(v)
				}
			}

			if !intRangeProvided {
				return nil, commonfmt.FmtMissingArgument("range")
			}

			return &IntRangePattern{
				intRange: intRange,
			}, nil
		},
		SymbolicCallImpl: func(ctx *symbolic.Context, values []symbolic.Value) (symbolic.Pattern, error) {
			if len(values) == 0 {
				return nil, errors.New("missing argument")
			}
			intRange, ok := values[0].(*symbolic.IntRange)

			if !ok {
				return nil, errors.New("argument should be an integer range")
			}
			return symbolic.NewIntRangePattern(intRange), nil
		},

		stringPattern: func() (StringPattern, bool) {
			return NewIntRangeStringPattern(math.MinInt64, math.MaxInt64, nil), true
		},
		symbolicStringPattern: func() (symbolic.StringPattern, bool) {

			return symbolic.ANY_STR_PATTERN, true
		},
	}
	FLOAT_PATTERN = &TypePattern{
		Type:          FLOAT64_TYPE,
		Name:          patternnames.FLOAT,
		SymbolicValue: symbolic.ANY_FLOAT,
		RandomImpl:    RandFloat,
		CallImpl: func(typePattern *TypePattern, values []Serializable) (Pattern, error) {
			floatRangeProvided := false
			var floatRange FloatRange

			for _, val := range values {
				switch v := val.(type) {
				case FloatRange:
					if floatRangeProvided {
						return nil, commonfmt.FmtErrArgumentProvidedAtLeastTwice("range")
					}
					floatRange = v
					floatRangeProvided = true

					if floatRange.unknownStart {
						return nil, fmt.Errorf("provided float range should not have an unknown start")
					}
				default:
					return nil, FmtErrInvalidArgument(v)
				}
			}

			if !floatRangeProvided {
				return nil, commonfmt.FmtMissingArgument("range")
			}

			return &FloatRangePattern{
				floatRange: floatRange,
			}, nil
		},
		SymbolicCallImpl: func(ctx *symbolic.Context, values []symbolic.Value) (symbolic.Pattern, error) {
			if len(values) == 0 {
				return nil, errors.New("missing argument")
			}
			floatRange, ok := values[0].(*symbolic.FloatRange)

			if !ok {
				return nil, errors.New("argument should be a float range")
			}
			return symbolic.NewFloatRangePattern(floatRange), nil
		},

		stringPattern: func() (StringPattern, bool) {
			return NewFloatRangeStringPattern(-math.MaxFloat64, math.MaxFloat64, nil), true
		},
		symbolicStringPattern: func() (symbolic.StringPattern, bool) {

			return symbolic.ANY_STR_PATTERN, true
		},
	}

	PORT_PATTERN = &TypePattern{
		Type:          PORT_TYPE,
		Name:          patternnames.PORT,
		SymbolicValue: symbolic.ANY_PORT,
	}

	BYTECOUNT_PATTERN = &TypePattern{
		Type:          BYTECOUNT_TYPE,
		Name:          patternnames.BYTE_COUNT,
		SymbolicValue: symbolic.ANY_BYTECOUNT,
	}

	LINECOUNT_PATTERN = &TypePattern{
		Type:          LINECOUNT_TYPE,
		Name:          patternnames.LINE_COUNT,
		SymbolicValue: symbolic.ANY_LINECOUNT,
	}

	RUNECOUNT_PATTERN = &TypePattern{
		Type:          RUNECOUNT_TYPE,
		Name:          patternnames.RUNE_COUNT,
		SymbolicValue: symbolic.ANY_RUNECOUNT,
	}

	BYTERATE_PATTERN = &TypePattern{
		Type:          BYTERATE_TYPE,
		Name:          patternnames.BYTE_RATE,
		SymbolicValue: symbolic.ANY_BYTERATE,
	}

	FREQUENCY_PATTERN = &TypePattern{
		Type:          FREQUENCY_TYPE,
		Name:          patternnames.FREQUENCY,
		SymbolicValue: symbolic.ANY_FREQUENCY,
	}

	DURATION_PATTERN = &TypePattern{
		Type:          DURATION_TYPE,
		Name:          patternnames.DURATION,
		SymbolicValue: symbolic.ANY_DURATION,
	}

	ASTNODE_PATTERN = &TypePattern{
		Type:          NODE_TYPE,
		Name:          patternnames.INOX_NODE,
		SymbolicValue: symbolic.ANY_AST_NODE,
	}
	MOD_PATTERN = &TypePattern{
		Type:          MODULE_TYPE,
		Name:          patternnames.INOX_MODULE,
		SymbolicValue: symbolic.ANY_MODULE,
	}
	HOSTPATTERN_PATTERN = &TypePattern{
		Type:          HOST_PATT_TYPE,
		Name:          patternnames.HOST_PATTERN,
		SymbolicValue: &symbolic.HostPattern{},
	}
	PATHPATTERN_PATTERN = &TypePattern{
		Type:          PATH_PATT_TYPE,
		Name:          patternnames.PATH_PATTERN,
		SymbolicValue: &symbolic.PathPattern{},
	}
	URLPATTERN_PATTERN = &TypePattern{
		Type:          URL_PATT_TYPE,
		Name:          patternnames.URL_PATTERN,
		SymbolicValue: &symbolic.URLPattern{},
	}
	OPTION_PATTERN = &TypePattern{
		Type:          OPTION_TYPE,
		Name:          patternnames.OPT,
		SymbolicValue: symbolic.ANY_OPTION,
	}
	FILE_MODE_PATTERN = &TypePattern{
		Type:          FILE_MODE_TYPE,
		Name:          patternnames.FILEMODE,
		SymbolicValue: &symbolic.FileMode{},
	}

	YEAR_PATTERN = &TypePattern{
		Type:          YEAR_TYPE,
		Name:          patternnames.YEAR,
		SymbolicValue: symbolic.ANY_YEAR,
	}

	DATE_PATTERN = &TypePattern{
		Type:          DATE_TYPE,
		Name:          patternnames.DATE,
		SymbolicValue: symbolic.ANY_DATE,
	}

	DATETIME_PATTERN = &TypePattern{
		Type:          DATETIME_TYPE,
		Name:          patternnames.DATETIME,
		SymbolicValue: symbolic.ANY_DATETIME,
	}

	PATTERN_PATTERN = &TypePattern{
		Type:          PATTERN_INTERFACE_TYPE,
		Name:          patternnames.PATTERN,
		SymbolicValue: symbolic.ANY_PATTERN,
	}
	READABLE_PATTERN = &TypePattern{
		Type:          READABLE_INTERFACE_TYPE,
		Name:          patternnames.READABLE,
		SymbolicValue: symbolic.ANY_READABLE,
	}
	READER_PATTERN = &TypePattern{
		Type:          READER_INTERFACE_TYPE,
		Name:          patternnames.READER,
		SymbolicValue: symbolic.ANY_READER,
	}
	ITERABLE_PATTERN = &TypePattern{
		Type:          ITERABLE_INTERFACE_TYPE,
		Name:          patternnames.ITERABLE,
		SymbolicValue: symbolic.ANY_ITERABLE,
	}
	SERIALIZABLE_ITERABLE_PATTERN = &TypePattern{
		Type:          SERIALIZABLE_ITERABLE_INTERFACE_TYPE,
		Name:          patternnames.SERIALIZABLE_ITERABLE,
		SymbolicValue: symbolic.ANY_SERIALIZABLE_ITERABLE,
	}
	INDEXABLE_PATTERN = &TypePattern{
		Type:          INDEXABLE_INTERFACE_TYPE,
		Name:          patternnames.INDEXABLE,
		SymbolicValue: symbolic.ANY_INDEXABLE,
	}
	VALUE_RECEIVER_PATTERN = &TypePattern{
		Type:          VALUE_RECEIVER_INTERFACE_TYPE,
		Name:          patternnames.VALUE_RECEIVER,
		SymbolicValue: symbolic.ANY_MSG_RECEIVER,
	}

	EVENT_PATTERN = &TypePattern{
		Type: EVENT_TYPE,
		Name: patternnames.EVENT,
		CallImpl: func(typePattern *TypePattern, args []Serializable) (Pattern, error) {
			var valuePattern Pattern

			for _, arg := range args {
				switch a := arg.(type) {
				case Pattern:
					if valuePattern != nil {
						return nil, commonfmt.FmtErrArgumentProvidedAtLeastTwice("value pattern")
					}
					valuePattern = a
				default:
					if valuePattern != nil {
						return nil, commonfmt.FmtErrArgumentProvidedAtLeastTwice("value pattern")
					}
					valuePattern = &ExactValuePattern{value: a}
				}
			}
			return NewEventPattern(valuePattern), nil
		},
		SymbolicCallImpl: func(ctx *symbolic.Context, args []symbolic.Value) (symbolic.Pattern, error) {
			var valuePattern symbolic.Pattern

			for _, arg := range args {
				switch a := arg.(type) {
				case symbolic.Pattern:
					if valuePattern != nil {
						return nil, commonfmt.FmtErrArgumentProvidedAtLeastTwice("value pattern")
					}
					valuePattern = a
				default:
					if valuePattern != nil {
						return nil, commonfmt.FmtErrArgumentProvidedAtLeastTwice("value pattern")
					}
					p, err := symbolic.NewExactValuePattern(a.(symbolic.Serializable))
					if err != nil {
						return nil, fmt.Errorf("argument should be immutable")
					}

					valuePattern = p
				}
			}

			patt, err := symbolic.NewEventPattern(valuePattern)
			if err != nil {
				ctx.AddSymbolicGoFunctionError(err.Error())
				return symbolic.NewEventPattern(symbolic.ANY_PATTERN)
			}
			return patt, nil
		},
		SymbolicValue: utils.Must(symbolic.NewEvent(symbolic.ANY)),
	}
	MUTATION_PATTERN = &TypePattern{
		Type:          MUTATION_TYPE,
		Name:          patternnames.MUTATION,
		SymbolicValue: symbolic.ANY_MUTATION,
		CallImpl: func(typePattern *TypePattern, args []Serializable) (Pattern, error) {
			switch len(args) {
			case 2:
			case 1:
			default:
				return nil, commonfmt.FmtErrNArgumentsExpected("1 or 2")
			}

			var kind MutationKind

			switch a := args[0].(type) {
			case Identifier:
				k, ok := mutationKindFromString(string(a))
				if !ok {
					return nil, FmtErrInvalidArgumentAtPos(a, 0)
				}
				kind = k
			default:
				return nil, FmtErrInvalidArgumentAtPos(a, 0)
			}

			var data0Pattern Pattern = ANYVAL_PATTERN

			if len(args) > 1 {
				patt, ok := args[1].(Pattern)
				if !ok {
					patt = &ExactValuePattern{value: args[1]}
				}
				data0Pattern = patt
			}

			return NewMutationPattern(kind, data0Pattern), nil
		},
		SymbolicCallImpl: func(ctx *symbolic.Context, args []symbolic.Value) (symbolic.Pattern, error) {
			switch len(args) {
			case 2:
			case 1:
			default:
				return nil, commonfmt.FmtErrNArgumentsExpected("1 or 2")
			}

			switch a := args[0].(type) {
			case *symbolic.Identifier:
				k, ok := mutationKindFromString(a.Name())
				if !ok {
					return nil, fmt.Errorf("unknown mutation kind '%s'", k)
				}
			default:
				return nil, fmt.Errorf("mutation kind expected at position 0 but is a(n) '%s'", symbolic.Stringify(a))
			}

			var data0Pattern symbolic.Pattern = symbolic.ANY_PATTERN //TODO: use symbolic any value

			if len(args) > 1 {
				patt, ok := args[1].(symbolic.Pattern)
				if !ok {
					p, err := symbolic.NewExactValuePattern(args[1].(symbolic.Serializable))
					if err != nil {
						return nil, fmt.Errorf("second argument should be immutable")
					}
					patt = p
				}
				data0Pattern = patt
			}

			return symbolic.NewMutationPattern(&symbolic.Int{}, data0Pattern), nil
		},
	}
	MSG_PATTERN = &TypePattern{
		Type:          MSG_TYPE,
		Name:          patternnames.MSG,
		SymbolicValue: symbolic.ANY_MSG,
	}
	ERROR_PATTERN = &TypePattern{
		Type:          ERROR_TYPE,
		Name:          patternnames.ERROR,
		SymbolicValue: symbolic.ANY_ERR,
	}
	SOURCE_POS_PATTERN = NewInexactRecordPattern([]RecordPatternEntry{
		{Name: "source", Pattern: STR_PATTERN},
		{Name: "line", Pattern: INT_PATTERN},
		{Name: "column", Pattern: INT_PATTERN},
		{Name: "start", Pattern: INT_PATTERN},
		{Name: "end", Pattern: INT_PATTERN},
	})
	INT_RANGE_PATTERN = &TypePattern{
		Type:          INT_RANGE_TYPE,
		Name:          patternnames.INT_RANGE,
		SymbolicValue: symbolic.ANY_INT_RANGE,
	}
	FLOAT_RANGE_PATTERN = &TypePattern{
		Type:          FLOAT_RANGE_TYPE,
		Name:          patternnames.FLOAT_RANGE,
		SymbolicValue: symbolic.ANY_FLOAT_RANGE,
	}
	RUNE_RANGE_PATTERN = &TypePattern{
		Type:          RUNE_RANGE_TYPE,
		Name:          patternnames.RUNE_RANGE,
		SymbolicValue: symbolic.ANY_RUNE_RANGE,
	}
	INT_RANGE_PATTERN_PATTERN = &TypePattern{
		Type:          INT_RANGE_PATTERN_TYPE,
		Name:          patternnames.INT_RANGE_PATTERN,
		SymbolicValue: symbolic.ANY_INT_RANGE_PATTERN,
	}
	FLOAT_RANGE_PATTERN_PATTERN = &TypePattern{
		Type:          FLOAT_RANGE_PATTERN_TYPE,
		Name:          patternnames.FLOAT_RANGE_PATTERN,
		SymbolicValue: symbolic.ANY_FLOAT_RANGE_PATTERN,
	}
	INT_RANGE_STRING_PATTERN_PATTERN = &TypePattern{
		Type:          INT_RANGE_STRING_PATTERN_TYPE,
		Name:          patternnames.INT_RANGE_STRING_PATTERN,
		SymbolicValue: symbolic.ANY_INT_RANGE_STRING_PATTERN,
	}
	FLOAT_RANGE_STRING_PATTERN_PATTERN = &TypePattern{
		Type:          FLOAT_RANGE_STRING_PATTERN_TYPE,
		Name:          patternnames.FLOAT_RANGE_STRING_PATTERN,
		SymbolicValue: symbolic.ANY_FLOAT_RANGE_STRING_PATTERN,
	}
	SECRET_PATTERN_PATTERN = &TypePattern{
		Type:          SECRET_PATTERN_TYPE,
		Name:          patternnames.SECRET_PATTERN,
		SymbolicValue: symbolic.ANY_SECRET_PATTERN,
	}
	VALUE_HISTORY_PATTERN = &TypePattern{
		Type:          VALUE_HISTORY_TYPE,
		Name:          patternnames.VALUE_HISTORY,
		SymbolicValue: symbolic.ANY_VALUE_HISTORY,
	}
	SYSGRAPH_PATTERN = &TypePattern{
		Type:          SYSGRAPH_TYPE,
		Name:          patternnames.SYSGRAPH,
		SymbolicValue: symbolic.ANY_SYSTEM_GRAPH,
	}
	SYSGRAPH_NODE_PATTERN = &TypePattern{
		Type:          SYSGRAPH_NODE_TYPE,
		Name:          patternnames.SYSGRAPH_NODE,
		SymbolicValue: symbolic.ANY_SYSTEM_GRAPH_NODE,
	}
	SECRET_PATTERN = &TypePattern{
		Type: SECRET_TYPE,
		Name: patternnames.SECRET,
		CallImpl: func(typePattern *TypePattern, values []Serializable) (Pattern, error) {
			var stringPattern StringPattern

			if len(values) == 0 {
				return nil, commonfmt.FmtMissingArgument("pattern")
			}

			for _, val := range values {
				switch v := val.(type) {
				case StringPattern:
					if stringPattern != nil {
						return nil, commonfmt.FmtErrArgumentProvidedAtLeastTwice("pattern")
					}

					stringPattern = v
				default:
					return nil, FmtErrInvalidArgument(v)
				}
			}

			return &SecretPattern{
				stringPattern: stringPattern,
			}, nil
		},
		SymbolicCallImpl: func(ctx *symbolic.Context, values []symbolic.Value) (symbolic.Pattern, error) {
			var stringPattern symbolic.StringPattern

			if len(values) == 0 {
				return nil, commonfmt.FmtMissingArgument("pattern")
			}

			for _, val := range values {
				switch v := val.(type) {
				case symbolic.StringPattern:
					if stringPattern != nil {
						return nil, commonfmt.FmtErrArgumentProvidedAtLeastTwice("pattern")
					}

					stringPattern = v
				default:
					return nil, errors.New(symbolic.FmtInvalidArg(0, v, symbolic.ANY_STR_PATTERN))
				}
			}

			return symbolic.NewSecretPattern(stringPattern), nil
		},
		SymbolicValue: symbolic.ANY_SECRET,
	}
	SECRET_STRING_PATTERN     = NewSecretPattern(NewRegexPattern(".*"), false)
	SECRET_PEM_STRING_PATTERN = NewSecretPattern(NewPEMRegexPattern(".*"), true)
	REGEX_PATTERN_PATTERN     = &TypePattern{
		Type:          REGEX_PATTERN_TYPE,
		Name:          patternnames.REGEX_PATTERN,
		SymbolicValue: symbolic.ANY_REGEX_PATTERN,
	}
	EVENT_PATTERN_PATTERN = &TypePattern{
		Type:          EVENT_PATTERN_TYPE,
		Name:          patternnames.EVENT_PATTERN,
		SymbolicValue: symbolic.ANY_EVENT_PATTERN,
	}
	MUTATION_PATTERN_PATTERN = &TypePattern{
		Type:          MUTATION_PATTERN_TYPE,
		Name:          patternnames.MUTATION_PATTERN,
		SymbolicValue: symbolic.ANY_MUTATION_PATTERN,
	}

	ULID_PATTERN = &TypePattern{
		Type:          ULID_TYPE,
		Name:          patternnames.ULID,
		RandomImpl:    RandULID,
		SymbolicValue: symbolic.ANY_ULID,
		stringPattern: func() (StringPattern, bool) {
			return ULID_STRING_PATTERN, true
		},
	}

	UUIDv4_PATTERN = &TypePattern{
		Type:          UUIDv4_TYPE,
		Name:          patternnames.UUIDv4,
		RandomImpl:    RandUUIDv4,
		SymbolicValue: symbolic.ANY_UUIDv4,
		stringPattern: func() (StringPattern, bool) {
			return UUIDv4_STRING_PATTERN, true
		},
	}

	ULID_STRING_PATTERN        = NewParserBasePattern(&ulidParser{})
	UUIDv4_STRING_PATTERN      = NewParserBasePattern(&uuidv4Parser{})
	NAMED_SEGMENT_PATH_PATTERN = &TypePattern{
		Type:          NAMED_SEGMENT_PATH_PATTERN_TYPE,
		Name:          patternnames.NAMED_SEGMENT_PATH_PATTERN,
		SymbolicValue: symbolic.ANY_NAMED_SEGMENT_PATH_PATTERN,
	}
	TYPE_PATTERN_PATTERN = &TypePattern{
		Type:          TYPE_PATTERN_TYPE,
		Name:          patternnames.TYPE_PATTERN,
		SymbolicValue: symbolic.ANY_TYPE_PATTERN,
	}
	EXACT_VALUE_PATTERN_PATTERN = &TypePattern{
		Type:          EXACT_VALUE_PATTERN_TYPE,
		Name:          patternnames.EXACT_VALUE_PATTERN,
		SymbolicValue: symbolic.ANY_EXACT_VALUE_PATTERN,
	}
	EXACT_STRING_PATTERN_PATTERN = &TypePattern{
		Type:          EXACT_STRING_PATTERN_TYPE,
		Name:          patternnames.EXACT_STRING_PATTERN,
		SymbolicValue: symbolic.ANY_EXACT_STR_PATTERN,
	}
	OBJECT_PATTERN_PATTERN = &TypePattern{
		Type:          OBJECT_PATTERN_TYPE,
		Name:          patternnames.OBJECT_PATTERN,
		SymbolicValue: symbolic.ANY_OBJECT_PATTERN,
	}
	LIST_PATTERN_PATTERN = &TypePattern{
		Type:          LIST_PATTERN_TYPE,
		Name:          patternnames.LIST_PATTERN,
		SymbolicValue: symbolic.ANY_LIST_PATTERN,
	}
	RECORD_PATTERN_PATTERN = &TypePattern{
		Type:          RECORD_PATTERN_TYPE,
		Name:          patternnames.RECORD_PATTERN,
		SymbolicValue: symbolic.ANY_RECORD_PATTERN,
	}
	TUPLE_PATTERN_PATTERN = &TypePattern{
		Type:          TUPLE_PATTERN_TYPE,
		Name:          patternnames.TUPLE_PATTERN,
		SymbolicValue: symbolic.ANY_TUPLE_PATTERN,
	}

	DEFAULT_NAMED_PATTERNS = map[string]Pattern{
		NEVER_PATTERN.Name:          NEVER_PATTERN,
		NIL_PATTERN.Name:            NIL_PATTERN,
		IDENT_PATTERN.Name:          IDENT_PATTERN,
		PROPNAME_PATTERN.Name:       PROPNAME_PATTERN,
		LONG_VALUEPATH_PATTERN.Name: LONG_VALUEPATH_PATTERN,
		VALUEPATH_PATTERN.Name:      VALUEPATH_PATTERN,
		RUNE_PATTERN.Name:           RUNE_PATTERN,
		RUNE_PATTERN.Name:           RUNE_PATTERN,
		BYTE_PATTERN.Name:           BYTE_PATTERN,
		STRING_PATTERN.Name:         STRING_PATTERN,
		STR_PATTERN.Name:            STR_PATTERN,
		PATH_PATTERN.Name:           PATH_PATTERN,
		URL_PATTERN.Name:            URL_PATTERN,
		SCHEME_PATTERN.Name:         SCHEME_PATTERN,
		HOST_PATTERN.Name:           HOST_PATTERN,
		EMAIL_ADDR_PATTERN.Name:     EMAIL_ADDR_PATTERN,
		SECRET_PATTERN.Name:         SECRET_PATTERN,
		patternnames.SECRET_STRING:  SECRET_STRING_PATTERN,
		OBJECT_PATTERN.Name:         OBJECT_PATTERN,
		RECORD_PATTERN.Name:         RECORD_PATTERN,
		TUPLE_PATTERN.Name:          TUPLE_PATTERN,
		ORDERED_PAIR_PATTERN.Name:   ORDERED_PAIR_PATTERN,
		LIST_PATTERN.Name:           LIST_PATTERN,
		DICTIONARY_PATTERN.Name:     DICTIONARY_PATTERN,
		RUNESLICE_PATTERN.Name:      RUNESLICE_PATTERN,
		BYTESLICE_PATTERN.Name:      BYTESLICE_PATTERN,
		KEYLIST_PATTERN.Name:        KEYLIST_PATTERN,
		BOOL_PATTERN.Name:           BOOL_PATTERN,
		INT_PATTERN.Name:            INT_PATTERN,
		LINECOUNT_PATTERN.Name:      LINECOUNT_PATTERN,
		RUNECOUNT_PATTERN.Name:      RUNECOUNT_PATTERN,
		BYTECOUNT_PATTERN.Name:      BYTECOUNT_PATTERN,
		FLOAT_PATTERN.Name:          FLOAT_PATTERN,
		FILE_MODE_PATTERN.Name:      FILE_MODE_PATTERN,

		FREQUENCY_PATTERN.Name: FREQUENCY_PATTERN,
		BYTERATE_PATTERN.Name:  BYTERATE_PATTERN,

		DURATION_PATTERN.Name: DURATION_PATTERN,
		YEAR_PATTERN.Name:     YEAR_PATTERN,
		DATE_PATTERN.Name:     DATE_PATTERN,
		DATETIME_PATTERN.Name: DATETIME_PATTERN,

		PATTERN_PATTERN.Name:               PATTERN_PATTERN,
		READABLE_PATTERN.Name:              READABLE_PATTERN,
		READER_PATTERN.Name:                READER_PATTERN,
		ITERABLE_PATTERN.Name:              ITERABLE_PATTERN,
		SERIALIZABLE_ITERABLE_PATTERN.Name: SERIALIZABLE_ITERABLE_PATTERN,
		INDEXABLE_PATTERN.Name:             INDEXABLE_PATTERN,
		VALUE_RECEIVER_PATTERN.Name:        VALUE_RECEIVER_PATTERN,
		HOSTPATTERN_PATTERN.Name:           HOSTPATTERN_PATTERN,
		PATHPATTERN_PATTERN.Name:           PATHPATTERN_PATTERN,
		URLPATTERN_PATTERN.Name:            URLPATTERN_PATTERN,
		OPTION_PATTERN.Name:                OPTION_PATTERN,
		patternnames.DIR_ENTRY: NewInexactObjectPattern([]ObjectPatternEntry{
			{Name: "abs-path", Pattern: PATH_PATTERN},
			{Name: "is-dir", Pattern: BOOL_PATTERN},
			{Name: "size", Pattern: INT_PATTERN},
			{Name: "mode", Pattern: FILE_MODE_PATTERN},
			{Name: "mod-time", Pattern: DATETIME_PATTERN},
			{Name: "name", Pattern: STR_PATTERN},
		}),
		EVENT_PATTERN.Name:         EVENT_PATTERN,
		MUTATION_PATTERN.Name:      MUTATION_PATTERN,
		MSG_PATTERN.Name:           MSG_PATTERN,
		ERROR_PATTERN.Name:         ERROR_PATTERN,
		INT_RANGE_PATTERN.Name:     INT_RANGE_PATTERN,
		FLOAT_RANGE_PATTERN.Name:   FLOAT_RANGE_PATTERN,
		VALUE_HISTORY_PATTERN.Name: VALUE_HISTORY_PATTERN,
		SYSGRAPH_PATTERN.Name:      SYSGRAPH_PATTERN,
		VAL_PATTERN.Name:           VAL_PATTERN,
		ULID_PATTERN.Name:          ULID_PATTERN,
		UUIDv4_PATTERN.Name:        UUIDv4_PATTERN,

		TYPE_PATTERN_PATTERN.Name:               TYPE_PATTERN_PATTERN,
		OBJECT_PATTERN_PATTERN.Name:             OBJECT_PATTERN_PATTERN,
		LIST_PATTERN_PATTERN.Name:               LIST_PATTERN_PATTERN,
		RECORD_PATTERN_PATTERN.Name:             RECORD_PATTERN_PATTERN,
		TUPLE_PATTERN_PATTERN.Name:              TUPLE_PATTERN_PATTERN,
		NAMED_SEGMENT_PATH_PATTERN.Name:         NAMED_SEGMENT_PATH_PATTERN,
		EXACT_VALUE_PATTERN_PATTERN.Name:        EXACT_VALUE_PATTERN_PATTERN,
		EXACT_STRING_PATTERN_PATTERN.Name:       EXACT_STRING_PATTERN_PATTERN,
		INT_RANGE_PATTERN_PATTERN.Name:          INT_RANGE_PATTERN_PATTERN,
		FLOAT_RANGE_PATTERN_PATTERN.Name:        FLOAT_RANGE_PATTERN_PATTERN,
		INT_RANGE_STRING_PATTERN_PATTERN.Name:   INT_RANGE_STRING_PATTERN_PATTERN,
		FLOAT_RANGE_STRING_PATTERN_PATTERN.Name: FLOAT_RANGE_STRING_PATTERN_PATTERN,
		SECRET_PATTERN_PATTERN.Name:             SECRET_PATTERN_PATTERN,
		REGEX_PATTERN_PATTERN.Name:              REGEX_PATTERN_PATTERN,
		EVENT_PATTERN_PATTERN.Name:              EVENT_PATTERN_PATTERN,
		MUTATION_PATTERN_PATTERN.Name:           MUTATION_PATTERN_PATTERN,
	}

	DEFAULT_PATTERN_NAMESPACES = map[string]*PatternNamespace{
		patternnames.INOX_NS: {
			Patterns: map[string]Pattern{
				"node":            ASTNODE_PATTERN,
				"module":          MOD_PATTERN,
				"source_position": SOURCE_POS_PATTERN,
			},
		},
		patternnames.DATE_FORMAT_NS: {
			Patterns: map[string]Pattern{
				"rfc822":    NewDateFormat(time.RFC822, "rfc822"),
				"date-only": NewDateFormat(time.DateOnly, "date-only"),
				"time-only": NewDateFormat(time.TimeOnly, "time-only"),
			},
		},
		patternnames.SYSGRAPH_NS: {
			Patterns: map[string]Pattern{
				"node": SYSGRAPH_NODE_PATTERN,
			},
		},
	}

	//TODO: complete
	NOT_ACCESSIBLE_PATTERNS = map[string]Pattern{
		"any":          ANYVAL_PATTERN,
		"serializable": SERIALIZABLE_PATTERN,
	}
)
View Source
var (
	ErrCannotCreateDynamicMemberFromSharedValue                 = errors.New("cannot create dynamic member from shared value")
	ErrCannotCreateDynamicMemberMissingProperty                 = errors.New("cannot create dynamic member: property is missing")
	ErrCannotCreateDynamicMapInvocationValueInDynValNotIterable = errors.New("cannot create dynamic map invocation: value in passed dynamic value is not iterable")
	ErrCannotCreateIfCondNotBoolean                             = errors.New("cannot create dynamic if: condition value is not a boolean")
	ErrDynCallNonFunctionCalee                                  = errors.New("callee in dynamic call value is not a function")
	ErrUnknownDynamicOp                                         = errors.New("unknown dynamic operation")
)
View Source
var (
	ErrEffectAlreadyApplied = errors.New("effect is already applied")
	ErrIrreversible         = errors.New("effect is irreversible")
)
View Source
var (
	EMPTY_INTERFACE_TYPE = reflect.TypeOf((*interface{})(nil)).Elem()
	CTX_PTR_TYPE         = reflect.TypeOf((*Context)(nil))

	VALUE_TYPE        = reflect.TypeOf((*Value)(nil)).Elem()
	SERIALIZABLE_TYPE = reflect.TypeOf((*Serializable)(nil)).Elem()

	ERROR_INTERFACE_TYPE                 = reflect.TypeOf((*error)(nil)).Elem()
	READABLE_INTERFACE_TYPE              = reflect.TypeOf((*Readable)(nil)).Elem()
	RESOURCE_NAME_INTERFACE_TYPE         = reflect.TypeOf((*ResourceName)(nil)).Elem()
	PATTERN_INTERFACE_TYPE               = reflect.TypeOf((*Pattern)(nil)).Elem()
	ITERABLE_INTERFACE_TYPE              = reflect.TypeOf((*Iterable)(nil)).Elem()
	SERIALIZABLE_ITERABLE_INTERFACE_TYPE = reflect.TypeOf((*SerializableIterable)(nil)).Elem()
	INDEXABLE_INTERFACE_TYPE             = reflect.TypeOf((*Indexable)(nil)).Elem()
	VALUE_RECEIVER_INTERFACE_TYPE        = reflect.TypeOf((*MessageReceiver)(nil)).Elem()
	EVENT_SOURCE_INTERFACE_TYPE          = reflect.TypeOf((*EventSource)(nil)).Elem()

	NIL_TYPE                   = reflect.TypeOf(Nil)
	BYTE_SLICE_TYPE            = reflect.TypeOf((*ByteSlice)(nil))
	RUNE_SLICE_TYPE            = reflect.TypeOf((*RuneSlice)(nil))
	FILE_INFO_TYPE             = reflect.TypeOf(FileInfo{})
	RUNE_TYPE                  = reflect.TypeOf(Rune('a'))
	BYTE_TYPE                  = reflect.TypeOf(Byte('a'))
	REGULAR_STR_TYPE           = reflect.TypeOf("")
	STRING_TYPE                = reflect.TypeOf(String(""))
	STR_LIKE_INTERFACE_TYPE    = reflect.TypeOf((*StringLike)(nil)).Elem()
	CHECKED_STR_TYPE           = reflect.TypeOf(CheckedString{})
	BOOL_TYPE                  = reflect.TypeOf(Bool(true))
	INT_TYPE                   = reflect.TypeOf(Int(1))
	PORT_TYPE                  = reflect.TypeOf(Port{})
	BYTERATE_TYPE              = reflect.TypeOf(ByteRate(1))
	FREQUENCY_TYPE             = reflect.TypeOf(Frequency(1))
	LINECOUNT_TYPE             = reflect.TypeOf(LineCount(1))
	RUNECOUNT_TYPE             = reflect.TypeOf(RuneCount(1))
	BYTECOUNT_TYPE             = reflect.TypeOf(ByteCount(1))
	DURATION_TYPE              = reflect.TypeOf(Duration(1))
	FLOAT64_TYPE               = reflect.TypeOf(Float(0))
	OBJECT_TYPE                = reflect.TypeOf((*Object)(nil))
	RECORD_TYPE                = reflect.TypeOf((*Record)(nil))
	TUPLE_TYPE                 = reflect.TypeOf((*Tuple)(nil))
	LIST_PTR_TYPE              = reflect.TypeOf((*List)(nil))
	DICT_TYPE                  = reflect.TypeOf((*Dictionary)(nil))
	KEYLIST_TYPE               = reflect.TypeOf(KeyList{})
	NODE_TYPE                  = reflect.TypeOf(AstNode{})
	MODULE_TYPE                = reflect.TypeOf((*Module)(nil))
	OPTION_TYPE                = reflect.TypeOf(Option{})
	IDENTIFIER_TYPE            = reflect.TypeOf(Identifier("a"))
	PROPNAME_TYPE              = reflect.TypeOf(PropertyName("a"))
	LONG_VALUE_PATH_TYPE       = reflect.TypeOf((*LongValuePath)(nil))
	VALUE_PATH_INTERFACE__TYPE = reflect.TypeOf((*ValuePath)(nil)).Elem()
	PATH_TYPE                  = reflect.TypeOf(Path("/"))
	PATH_PATT_TYPE             = reflect.TypeOf(PathPattern("/"))
	URL_TYPE                   = reflect.TypeOf(URL(""))
	SCHEME_TYPE                = reflect.TypeOf(Scheme(""))
	HOST_TYPE                  = reflect.TypeOf(Host(""))
	HOST_PATT_TYPE             = reflect.TypeOf(HostPattern(""))
	EMAIL_ADDR_TYPE            = reflect.TypeOf(EmailAddress(""))
	URL_PATT_TYPE              = reflect.TypeOf(URLPattern(""))
	FILE_MODE_TYPE             = reflect.TypeOf(FileMode(0))

	YEAR_TYPE     = reflect.TypeOf(Year{})
	DATE_TYPE     = reflect.TypeOf(Date{})
	DATETIME_TYPE = reflect.TypeOf(DateTime{})

	EVENT_TYPE                      = reflect.TypeOf((*Event)(nil))
	MUTATION_TYPE                   = reflect.TypeOf(Mutation{})
	MSG_TYPE                        = reflect.TypeOf(Message{})
	ERROR_TYPE                      = reflect.TypeOf(Error{})
	INT_RANGE_TYPE                  = reflect.TypeOf(IntRange{})
	FLOAT_RANGE_TYPE                = reflect.TypeOf(FloatRange{})
	RUNE_RANGE_TYPE                 = reflect.TypeOf(RuneRange{})
	VALUE_HISTORY_TYPE              = reflect.TypeOf((*ValueHistory)(nil))
	SYSGRAPH_TYPE                   = reflect.TypeOf((*SystemGraph)(nil))
	SYSGRAPH_NODE_TYPE              = reflect.TypeOf((*SystemGraphNode)(nil))
	SYSGRAPH_EDGE_TYPE              = reflect.TypeOf(SystemGraphEdge{})
	SECRET_TYPE                     = reflect.TypeOf((*Secret)(nil))
	READER_INTERFACE_TYPE           = reflect.TypeOf((*Reader)(nil))
	OBJECT_PATTERN_TYPE             = reflect.TypeOf((*ObjectPattern)(nil))
	LIST_PATTERN_TYPE               = reflect.TypeOf((*ListPattern)(nil))
	RECORD_PATTERN_TYPE             = reflect.TypeOf((*RecordPattern)(nil))
	TUPLE_PATTERN_TYPE              = reflect.TypeOf((*TuplePattern)(nil))
	ULID_TYPE                       = reflect.TypeOf(ULID{})
	UUIDv4_TYPE                     = reflect.TypeOf(UUIDv4{})
	ORDERED_PAIR_TYPE               = reflect.TypeOf((*OrderedPair)(nil))
	NAMED_SEGMENT_PATH_PATTERN_TYPE = reflect.TypeOf((*NamedSegmentPathPattern)(nil))
	TYPE_PATTERN_TYPE               = reflect.TypeOf((*TypePattern)(nil))
	EXACT_VALUE_PATTERN_TYPE        = reflect.TypeOf((*ExactValuePattern)(nil))
	EXACT_STRING_PATTERN_TYPE       = reflect.TypeOf((*ExactStringPattern)(nil))
	INT_RANGE_PATTERN_TYPE          = reflect.TypeOf(&IntRangePattern{})
	FLOAT_RANGE_PATTERN_TYPE        = reflect.TypeOf(&FloatRangePattern{})
	INT_RANGE_STRING_PATTERN_TYPE   = reflect.TypeOf(&IntRangeStringPattern{})
	FLOAT_RANGE_STRING_PATTERN_TYPE = reflect.TypeOf(&FloatRangeStringPattern{})
	SECRET_PATTERN_TYPE             = reflect.TypeOf(&SecretPattern{})
	REGEX_PATTERN_TYPE              = reflect.TypeOf(&RegexPattern{})
	EVENT_PATTERN_TYPE              = reflect.TypeOf((*EventPattern)(nil))
	MUTATION_PATTERN_TYPE           = reflect.TypeOf((*MutationPattern)(nil))
)
View Source
var (
	ErrStackOverflow            = errors.New("stack overflow")
	ErrIndexOutOfRange          = errors.New("index out of range")
	ErrInsertionIndexOutOfRange = errors.New("insertion index out of range")
	ErrNegativeLowerIndex       = errors.New("negative lower index")
	ErrUnreachable              = errors.New("unreachable")

	ErrCannotSetValOfIndexKeyProp = errors.New("cannot set value of index key property")
	ErrCannotPopFromEmptyList     = errors.New("cannot pop from an empty list")
	ErrCannotDequeueFromEmptyList = errors.New("cannot dequeue from an empty list")

	//integer
	ErrIntOverflow          = errors.New("integer overflow")
	ErrIntUnderflow         = errors.New("integer underflow")
	ErrNegationWithOverflow = errors.New("integer negation with overflow")
	ErrIntDivisionByZero    = errors.New("integer division by zero")

	//floating point
	ErrFloatOverflow      = errors.New("float overflow")
	ErrFloatUnderflow     = errors.New("float underflow")
	ErrNaNinfinityOperand = errors.New("NaN or (+|-)infinity operand in floating point operation")
	ErrNaNinfinityResult  = errors.New("result of floating point operation is NaN or (+|-)infinity")

	//quantty
	ErrNegQuantityNotSupported = errors.New("negative quantities are not supported")

	ErrCannotEvaluateCompiledFunctionInTreeWalkEval = errors.New("cannot evaluate compiled function in a tree walk evaluation")
	ErrInvalidQuantity                              = errors.New("invalid quantity")
	ErrQuantityLooLarge                             = errors.New("quantity is too large")

	ErrDirPathShouldEndInSlash     = errors.New("directory's path should end with '/'")
	ErrFilePathShouldNotEndInSlash = errors.New("regular file's path should not end with '/'")

	ErrModifyImmutable           = errors.New("cannot modify an immutable value")
	ErrCannotSetProp             = errors.New("cannot set property")
	ErrCannotLockUnsharableValue = errors.New("cannot lock unsharable value")
	ErrAttemptToSetCaptureGlobal = errors.New("attempt to set a captured global")

	ErrNotImplemented    = errors.New("not implemented and won't be implemented in the near future")
	ErrNotImplementedYet = errors.New("not implemented yet")
	ErrInvalidDirPath    = errors.New("invalid dir path")
	ErrInvalidNonDirPath = errors.New("invalid non-dir path")
	ErrURLAlreadySet     = errors.New("url already set")

	ErrLThreadIsDone = errors.New("lthread is done")

	ErrSelfNotDefined = errors.New("self not defined")

	ErrNotEnoughCliArgs                 = errors.New("not enough CLI arguments")
	ErrMissinggRuntimeTypecheckSymbData = errors.New("impossible to perform runtime typecheck because symbolic data is missing")
	ErrPrecisionLoss                    = errors.New("precision loss")

	ErrValueInExactPatternValueShouldBeImmutable = errors.New("the value in an exact value pattern should be immutable")

	ErrValueHasNoProperties = errors.New("value has no properties")

	ErrNotInDebugMode       = errors.New("not in debug mode")
	ErrStepNonPausedProgram = errors.New("impossible to step in the execution of a non-paused program")
)
View Source
var (
	ErrNonUniqueEventSourceFactoryRegistration = errors.New("non unique event source factory registration")
	ErrHandlerAlreadyAdded                     = errors.New("handler already added to event source")
	ErrFileWatchingNotSupported                = errors.New("file watching is not supported")
)
View Source
var (
	ErrSnapshotEntryPathMustBeAbsolute = errors.New("snapshot file path must be absolute")
	ErrSnapshotEntryNotAFile           = errors.New("filesystem entry is not a file")
	ErrAlreadyBeingSnapshoted          = errors.New("the filesystem is already being snapshoted")
)
View Source
var (
	ErrContextInUse           = errors.New("cannot create a new global state with a context that already has an associated state")
	ErrOutAndLoggerAlreadySet = errors.New(".Out & .Logger are already definitely set")

	GLOBAL_STATE_PROPNAMES = []string{"module"}
)
View Source
var (
	ErrInvalidOrUnsupportedJsonSchema       = errors.New("invalid or unsupported JSON Schema")
	ErrRecursiveJSONSchemaNotSupported      = errors.New("recursive JSON schema are not supported")
	ErrJSONSchemaMixingIntFloatNotSupported = errors.New("JSON schemas mixing integers and floats are not supported")

	JSON_SCHEMA_TYPE_TO_PATTERN = map[string]Pattern{
		"string":  STR_PATTERN,
		"number":  FLOAT_PATTERN,
		"integer": INT_PATTERN,
		"object":  OBJECT_PATTERN,
		"array":   LIST_PATTERN,
		"boolean": BOOL_PATTERN,
		"null":    NIL_PATTERN,
	}
)
View Source
var (
	ErrTokenDepletionAlreadyPaused = errors.New("token depletion already paused")
	ErrTokenDepletionNotPaused     = errors.New("token depletion is not paused")
	ErrStateIdNotSet               = errors.New("state id not set")
)
View Source
var (
	ErrNonUniqueLoadFreeEntityFnRegistration          = errors.New("non unique loading function registration")
	ErrNonUniqueGetSymbolicInitialFactoryRegistration = errors.New("non unique symbolic initial value factory registration")
	ErrNoLoadFreeEntityFnRegistered                   = errors.New("no loading function registered for given type")
	ErrLoadingRequireTransaction                      = errors.New("loading a value requires a transaction")
	ErrTransactionsNotSupportedYet                    = errors.New("transactions not supported yet")
	ErrFailedToLoadNonExistingValue                   = errors.New("failed to load non-existing value")

	ErrInvalidInitialValue = errors.New("invalid initial value")
)
View Source
var (
	ErrValueNotShared        = errors.New("value is not shared")
	ErrLockReEntry           = errors.New("lock re-entry")
	ErrHeldLockWithoutHolder = errors.New("held lock without holder")
)
View Source
var (
	ROUTINE_PROPNAMES       = []string{"wait_result", "cancel", "steps"}
	ROUTINE_GROUP_PROPNAMES = []string{"wait_results", "cancel_all"}
	EXECUTED_STEP_PROPNAMES = []string{"result", "end_time"}
)
View Source
var (
	ErrValueNoURL            = errors.New("value has not an URL")
	ErrValueNoId             = errors.New("value has not an identifier")
	ErrValueDoesNotAcceptURL = errors.New("value does not accept URL")
)
View Source
var (
	SOURCE_POS_RECORD_PROPNAMES = []string{"source", "line", "column", "start", "end"}

	MODULE_KIND_NAMES = [...]string{
		UnspecifiedModuleKind: "unspecified",
		SpecModule:            "spec",
		UserLThreadModule:     "userlthread",
		TestSuiteModule:       "testsuite",
		TestCaseModule:        "testcase",
		LifetimeJobModule:     "lifetimejob",
		ApplicationModule:     "application",
	}

	ErrFileToIncludeDoesNotExist       = errors.New("file to include does not exist")
	ErrFileToIncludeIsAFolder          = errors.New("file to include is a folder")
	ErrMissingManifest                 = errors.New("missing manifest")
	ErrParsingErrorInManifestOrPreinit = errors.New("parsing error in manifest or preinit")
	ErrInvalidModuleKind               = errors.New("invalid module kind")
)
View Source
var (
	ErrZeroOrNegAlignment         = errors.New("zero or negative alignment")
	ErrZeroOrNegAllocationSize    = errors.New("zero or negative allocation size")
	ErrInvalidInitialHeapCapacity = errors.New("invalid initial heap capacity")
)
View Source
var (
	ErrInvalidModuleSourceURL                          = errors.New("invalid module source URL")
	ErrAbsoluteModuleSourcePathUsedInURLImportedModule = errors.New("absolute module source path used in module imported from URL")
	ErrImportCycleDetected                             = errors.New("import cycle detected")
	ErrMaxModuleImportDepthExceeded                    = fmt.Errorf(
		"the module import depth has exceeded the maximum (%d)", DEFAULT_MAX_MOD_GRAPH_PATH_LEN)

	IMPORT_CONFIG_SECTION_NAMES = []string{
		IMPORT_CONFIG__ALLOW_PROPNAME, IMPORT_CONFIG__ARGUMENTS_PROPNAME, IMPORT_CONFIG__VALIDATION_PROPNAME,
	}
)
View Source
var (
	ErrDatabaseOpenFunctionNotFound = errors.New("function to open database not found")
	ErrNonMatchingCachedModulePath  = errors.New("the cached module's path is not the same as the absolute version of the provided path")
)
View Source
var (
	MUTATION_KIND_NAMES = [...]string{
		UnspecifiedMutation:   "unspecified-mutation",
		AddProp:               "add-prop",
		UpdateProp:            "update-prop",
		AddEntry:              "add-entry",
		UpdateEntry:           "update-entry",
		InsertElemAtIndex:     "insert-elem-at-index",
		SetElemAtIndex:        "set-elem-at-index",
		SetSliceAtRange:       "set-slice-at-range",
		InsertSequenceAtIndex: "insert-seq-at-index",
		RemovePosition:        "remove-pos",
		RemovePositionRange:   "remove-pos-range",
		SpecificMutation:      "specific-mutation",
	}

	ErrCannotApplyIncompleteMutation = errors.New("cannot apply an incomplete mutation")
	ErrNotSupportedSpecificMutation  = errors.New("not supported specific mutation")
	ErrInvalidMutationPrefixSymbol   = errors.New("invalid mutation prefix symbol")
)
View Source
var (
	ErrUnknownStartIntRange   = errors.New("integer range has unknown start")
	ErrUnknownStartFloatRange = errors.New("float range has unknown start")
)
View Source
var (
	ErrJsonNotMatchingSchema         = errors.New("JSON is not matching schema")
	ErrTriedToParseJSONRepr          = errors.New("tried to parse json representation but failed")
	ErrNotMatchingSchemaIntFound     = errors.New("integer was found but it does not match the schema")
	ErrNotMatchingSchemaFloatFound   = errors.New("float was found but it does not match the schema")
	ErrJSONImpossibleToDetermineType = errors.New("impossible to determine type")
	ErrNonSupportedMetaProperty      = errors.New("non-supported meta property")
	ErrInvalidRuneRepresentation     = errors.New("invalid rune representation")
)
View Source
var (
	ErrPatternNotCallable            = errors.New("pattern is not callable")
	ErrNoDefaultValue                = errors.New("no default value")
	ErrTooDeepUnionPatternFlattening = errors.New("union pattern flattening is too deep")
	ErrInconsistentObjectPattern     = errors.New("inconsistent object pattern")
)
View Source
var (
	ErrFullPool              = errors.New("pool is full")
	ErrInvalidPoolConfig     = errors.New("provided pool configuration is invalid")
	ErrNotOwnedPoolItem      = errors.New("passed pool item is not owned by current pool")
	ErrDoublePoolItemRelease = errors.New("pool item is already released")
)
View Source
var (
	ANSI_RESET_SEQUENCE             = []byte(termenv.CSI + termenv.ResetSeq + "m")
	ANSI_RESET_SEQUENCE_STRING      = string(ANSI_RESET_SEQUENCE)
	DEFAULT_DARKMODE_DISCRETE_COLOR = pprint.DEFAULT_DARKMODE_PRINT_COLORS.DiscreteColor
	DEFAULT_LIGHMODE_DISCRETE_COLOR = pprint.DEFAULT_LIGHTMODE_PRINT_COLORS.DiscreteColor

	COMMA                               = []byte{','}
	LF_CR                               = []byte{'\n', '\r'}
	DASH_DASH                           = []byte{'-', '-'}
	SHARP_OPENING_PAREN                 = []byte{'#', '('}
	COLON_SPACE                         = []byte{':', ' '}
	COMMA_SPACE                         = []byte{',', ' '}
	CLOSING_BRACKET_CLOSING_PAREN       = []byte{']', ')'}
	CLOSING_CURLY_BRACKET_CLOSING_PAREN = []byte{'}', ')'}
	THREE_DOTS                          = []byte{'.', '.', '.'}
	DOT_OPENING_CURLY_BRACKET           = []byte{'.', '{'}
	DOT_DOT                             = []byte{'.', '.'}
	SLASH_SECOND_BYTES                  = []byte{'/', 's'}
)
View Source
var (
	ErrUnknownStartQtyRange = errors.New("quantity range has unknown start")
	ErrNegFrequency         = errors.New("negative frequency")
	ErrInfFrequency         = errors.New("infinite frequency")
	ErrNegByteRate          = errors.New("negative byte rate")

	ErrQuantityOverflow  = errors.New("quantity overflow")
	ErrQuantityUnderflow = errors.New("quantity underflow")
)
View Source
var (
	MAX_INT64  = big.NewInt(math.MaxInt64)
	MAX_UINT64 = big.NewInt(0)

	CryptoRandSource  = &RandomnessSource{source: cryptoRandomnessSource{}}
	DefaultRandSource = CryptoRandSource
)
View Source
var (
	ErrEndOfStream            = errors.New("end of stream")
	ErrStreamElemWaitTimeout  = errors.New("stream element wait timeout")
	ErrStreamChunkWaitTimeout = errors.New("stream chunk wait timeout")
	ErrTempDriedUpSource      = errors.New("temporarily dried up source")
	ErrDefDriedUpSource       = errors.New("definitively dried up source")

	WRAPPED_WATCHER_STREAM_CHUNK_DATA_TYPE = &ListPattern{generalElementPattern: ANYVAL_PATTERN}
	ELEMENTS_STREAM_CHUNK_DATA_TYPE        = &ListPattern{generalElementPattern: ANYVAL_PATTERN}
	BYTESTREAM_CHUNK_DATA_TYPE             = BYTESLICE_PATTERN
)
View Source
var (
	ErrMutableMessageData = errors.New("impossible to create a Message with mutable data")

	MSG_PROPNAMES = []string{"data"}
)
View Source
var (
	ErrNotRenderable                  = errors.New("value is not renderable")
	ErrInvalidRenderingConfig         = errors.New("invalid rendering configuration")
	ErrNotRenderableUseCustomRenderer = fmt.Errorf("%w: use a custom renderer", ErrNotRenderable)

	LIST_OPENING_TAG = []byte{'<', 'u', 'l', '>'}
	LIST_CLOSING_TAG = []byte{'<', '/', 'u', 'l', '>'}

	DIV_OPENING_TAG = []byte{'<', 'd', 'i', 'v', '>'}
	DIV_CLOSING_TAG = []byte{'<', '/', 'd', 'i', 'v', '>'}

	TIME_OPENING_TAG = []byte{'<', 't', 'i', 'm', 'e', '>'}
	TIME_CLOSING_TAG = []byte{'<', '/', 't', 'i', 'm', 'e', '>'}

	S_TRUE  = []byte{'t', 'r', 'u', 'e'}
	S_FALSE = []byte{'f', 'a', 'l', 's', 'e'}
)
View Source
var (
	ErrNotResourceName                     = errors.New("not a resource name")
	ErrCannotReleaseUnregisteredResource   = errors.New("cannot release unregistered resource")
	ErrFailedToAcquireResurce              = errors.New("failed to acquire resource")
	ErrResourceHasHardcodedUrlMetaProperty = errors.New("resource has hardcoded _url_ metaproperty")
	ErrInvalidResourceContent              = errors.New("invalid resource's content")
	ErrContentTypeParserNotFound           = errors.New("parser not found for content type")

	ErrEmptyPath            = errors.New("empty path")
	ErrPathWithInvalidStart = errors.New("path with invalid start")
	ErrTestedPathTooLarge   = errors.New("tested path is too large")

	ErrEmptyURL                  = errors.New("empty URL")
	ErrInvalidURL                = errors.New("invalid URL")
	ErrUnexpectedSpaceInURL      = errors.New("unexpected space in URL")
	ErrMissingHostHostNameInHost = errors.New("missing hostname in host")
	ErrMissingURLHostName        = errors.New("missing hostname in URL")
	ErrMissingURLSpecificFeature = errors.New("missing URL-specific feature in URL (path, query or fragment)")
	ErrTestedURLTooLarge         = errors.New("tested URL is too large")

	ErrInvalidURLPattern = errors.New("invalid URL pattern")

	ErrTestedHostPatternTooLarge = errors.New("tested host pattern is too large")

	ErrEmptyHost   = errors.New("empty host")
	ErrInvalidHost = errors.New("invalid host")

	ErrEmptyScheme             = errors.New("empty scheme")
	ErrSchemeWithInvalidStart  = errors.New("scheme with invalid start")
	ErrUnexpectedCharsInScheme = errors.New("unexpected char(s) in scheme")

	ErrInvalidEmailAdddres = errors.New("invalid email address per RFC 5322")
)
View Source
var (
	RING_BUFFER_PROPNAMES = []string{"write", "read", "full"}

	ErrEmptyRingBuffer              = errors.New("ring buffer is empty")
	ErrFullRingBuffer               = errors.New("ring buffer is full")
	ErrRingBufferTooMuchDataToWrite = errors.New("too much data to write to ring buffer")
)
View Source
var (
	HTTP_PERM_TYPE    = reflect.TypeOf(HttpPermission{})
	WS_PERM_TYPE      = reflect.TypeOf(WebsocketPermission{})
	FS_PERM_TYPE      = reflect.TypeOf(FilesystemPermission{})
	ROUTINE_PERM_TYPE = reflect.TypeOf(LThreadPermission{})
	CMD_PERM_TYPE     = reflect.TypeOf(CommandPermission{})

	DEFAULT_PERM_RISK_SCORES = map[reflect.Type][]BasePermissionRiskScore{
		HTTP_PERM_TYPE: {
			{HTTP_PERM_TYPE, permkind.Read, HTTP_READ_PERM_RISK_SCORE},
			{HTTP_PERM_TYPE, permkind.Write, HTTP_WRITE_PERM_RISK_SCORE},
			{HTTP_PERM_TYPE, permkind.Provide, HTTP_WRITE_PERM_RISK_SCORE},
		},

		WS_PERM_TYPE: {
			{WS_PERM_TYPE, permkind.Read, WS_READ_PERM_RISK_SCORE},
			{WS_PERM_TYPE, permkind.Write, WS_WRITE_PERM_RISK_SCORE},
			{WS_PERM_TYPE, permkind.Provide, WS_WRITE_PERM_RISK_SCORE},
		},

		FS_PERM_TYPE: {
			{FS_PERM_TYPE, permkind.Read, FS_READ_PERM_RISK_SCORE},
			{FS_PERM_TYPE, permkind.Write, FS_WRITE_PERM_RISK_SCORE},
		},

		ROUTINE_PERM_TYPE: {
			{ROUTINE_PERM_TYPE, permkind.Create, LTHREAD_PERM_RISK_SCORE},
		},

		CMD_PERM_TYPE: {
			{CMD_PERM_TYPE, permkind.Use, CMD_PERM_RISK_SCORE},
		},
	}

	//TODO: move constants to an embedded file.
	//TODO: handle case where the a virtual system is used.
	FILE_SENSITIVITY_MULTIPLIERS = []struct {
		PathPattern
		Multiplier int
	}{
		{"/home/*/.*", 3},
		{"/home/*/.*/**/*", 3},
		{"/etc/**/*", 3},
		{"/usr/**/*", 4},
		{"/bin/**/*", 4},
		{"/sbin/**/*", 4},
		{"/*", 4},
	}
)
View Source
var (
	ErrValueNotSharableNorClonable = errors.New("value is not sharable nor clonable")
	ErrValueIsNotShared            = errors.New("value is not shared")
)
View Source
var (
	ErrFailedToSnapshot           = errors.New("failed to snapshot value")
	ErrAttemptToMutateFrozenValue = errors.New("attempt to mutate a frozen value")
)
View Source
var (
	ErrUnsupportedNestedValue   = errors.New("unsupported nested value")
	ErrUnsupportedOrder         = errors.New("unsupported order")
	ErrNotSortableByNestedValue = errors.New("not sortable by nested value")
	ErrInvalidOrderIdentifier   = errors.New("invalid order identifier")
)
View Source
var (
	STATIC_CHECK_DATA_PROP_NAMES = []string{"errors"}
	ErrForbiddenNodeinPreinit    = errors.New("forbidden node type in preinit block")
)
View Source
var (
	STRING_LIKE_PSEUDOPROPS = []string{"replace", "trim_space", "has_prefix", "has_suffix"}
	RUNE_SLICE_PROPNAMES    = []string{"insert", "remove_position", "remove_position_range"}
)
View Source
var (
	ErrStrGroupMatchingOnlySupportedForPatternWithRegex = errors.New("group matching is only supported by string patterns with a regex for now")
	ErrCannotParse                                      = errors.New("cannot parse")
	ErrInvalidInputString                               = errors.New("invalid input string")
	ErrTestedStringTooLarge                             = errors.New("tested string is too large")
	ErrFailedToConvertValueToMatchingString             = errors.New("failed to convert value to matching string")
	ErrIntNotInPatternRange                             = errors.New("integer is not in the pattern's range")
	ErrFloatNotInPatternRange                           = errors.New("float is not in the pattern's range")
	ErrFailedStringPatternResolution                    = errors.New("failed to resolve string pattern")

	MAX_CHAR_COUNT_MAXIMUM_FLOAT_64 = max(
		len(strconv.FormatFloat(math.MaxFloat64, 'f', -1, 64)),
		len(strconv.FormatFloat(math.MaxFloat64, 'e', -1, 64)),
	)
)
View Source
var (
	ErrPublisherNotUniquelyIdentifiable  = errors.New("publisher not uniquely identifiable")
	ErrSubscriberNotUniquelyIdentifiable = errors.New("subscriber not uniquely identifiable")
)
View Source
var (
	ErrValueAlreadyInSysGraph = errors.New("value already in a system graph")
	ErrValueNotInSysGraph     = errors.New("value is not part of system graph")
	ErrValueNotPointer        = errors.New("value is not a pointer")

	SYSTEM_GRAPH_PROPNAMES       = []string{"nodes", "events"}
	SYSTEM_GRAPH_EVENT_PROPNAMES = []string{"text", "value0_id"}
	SYSTEM_GRAP_EDGE_PROPNAMES   = []string{"to", "text"}
	SYSTEM_GRAPH_NODE_PROPNAMES  = []string{"name", "type_name", "value_id", "edges"}
)
View Source
var (
	TEST_CASE_RESULT_DARK_MODE_PRETTY_PRINT_CONFIG = &PrettyPrintConfig{
		PrettyPrintConfig: pprint.PrettyPrintConfig{
			MaxDepth:                    7,
			Colorize:                    true,
			Colors:                      &pprint.DEFAULT_DARKMODE_PRINT_COLORS,
			Compact:                     false,
			Indent:                      []byte{' ', ' '},
			PrintDecodedTopLevelStrings: true,
		},
	}
	TEST_CASE_RESULT_LIGTH_MODE_PRETTY_PRINT_CONFIG = &PrettyPrintConfig{
		PrettyPrintConfig: pprint.PrettyPrintConfig{
			MaxDepth:                    7,
			Colorize:                    true,
			Colors:                      &pprint.DEFAULT_LIGHTMODE_PRINT_COLORS,
			Compact:                     false,
			Indent:                      []byte{' ', ' '},
			PrintDecodedTopLevelStrings: true,
		},
	}
)
View Source
var (
	PROCESS_BEGIN_TIME = time.Now().UTC()

	ErrNegDuration = errors.New("negative duration")
	ErrInvalidYear = errors.New("invalid year")
	ErrInvalidDate = errors.New("invalid date")
)
View Source
var (
	ErrTransactionAlreadyStarted               = errors.New("transaction has already started")
	ErrTransactionShouldBeStartedBySameContext = errors.New("a transaction should be started by the same context that created it")
	ErrCannotAddIrreversibleEffect             = errors.New("cannot add irreversible effect to transaction")
	ErrCtxAlreadyHasTransaction                = errors.New("context already has a transaction")
	ErrFinishedTransaction                     = errors.New("transaction is finished")
	ErrFinishingTransaction                    = errors.New("transaction is finishing")
	ErrAlreadySetTransactionEndCallback        = errors.New("transaction end callback is already set")
	ErrRunningTransactionExpected              = errors.New("running transaction expected")
	ErrEffectsNotAllowedInReadonlyTransaction  = errors.New("effects are not allowed in a readonly transaction")
)
View Source
var (
	ErrTooManyWriteTxsWaited  = errors.New("transaction has waited for too many write transactions to finish")
	ErrWaitReadonlyTxsTimeout = errors.New("waiting for readonly txs timed out")
)
View Source
var (
	ErrEmptyPropertyName             = errors.New("empty property name")
	ErrUnexpectedCharsInPropertyName = errors.New("unexpected char(s) in property name")
	ErrEmptyLongValuePath            = errors.New("empty long value-path")
	ErrSingleSegmentLongValuePath    = errors.New("single-segment value-path")
)
View Source
var (
	ErrArgsProvidedToModule    = errors.New("cannot provide arguments when running module")
	ErrInvalidProvidedArgCount = errors.New("number of provided arguments is invalid")
)
View Source
var (
	PERIODIC_WATCHER_GOROUTINE_TICK_INTERVAL = 100 * time.Microsecond

	ErrManagedWatchersNotSupported           = errors.New("managed watchers are not supported")
	ErrWatchTimeout                          = errors.New("watch timeout")
	ErrStoppedWatcher                        = errors.New("stopped watcher")
	ErrIntermediateDepthWatchingNotSupported = errors.New("intermediate (and deeper) watching is not supported by the watchable")
	ErrDeepWatchingNotSupported              = errors.New("deep watching is not supported by the watchable")
)
View Source
var (
	ErrStoppedWritableStream  = errors.New("writable stream is stopped")
	ErrInvalidStreamElement   = errors.New("invalid stream element")
	ErrInvalidStreamChunkData = errors.New("invalid stream chunk data")
)
View Source
var (
	ErrMaximumJSONReprWritingDepthReached  = errors.New("maximum JSON representation writing depth reached")
	ErrPatternDoesNotMatchValueToSerialize = errors.New("pattern does not match value to serialize")
	ErrPatternRequiredToSerialize          = errors.New("pattern required to serialize")

	ALL_VISIBLE_REPR_CONFIG = &ReprConfig{AllVisible: true}
)
View Source
var (
	ErrUnsupportedYamlNodeType = errors.New("unsupported YAML node type")
	UnknownYamlNodeType        = errors.New("unknown YAML node type")
)
View Source
var (
	DEFAULT_LOG_LEVELS = NewLogLevels(LogLevelsInitialization{DefaultLevel: zerolog.InfoLevel})
)
View Source
var (
	EMPTY_MODULE_ARGS_PATTERN = NewModuleParamsPattern(nil, nil)
)
View Source
var (
	ERR_PROPNAMES = []string{"text", "data"}
)
View Source
var (
	ErrCannotAddNonSharableToSharedContainer = errors.New("cannot add a non sharable element to a shared container")
)
View Source
var (
	ErrCannotReadWithNoCopy = errors.New("cannot read with no copy")
)
View Source
var (
	ErrCollectionElemNotFound = errors.New("collection element not found")
)
View Source
var (
	ErrConstraintViolation = errors.New("constraint violation")
)
View Source
var (
	ErrDebuggerAlreadyAttached = errors.New("debugger already attached")
)
View Source
var (
	ErrDestroyedTokenBucket = errors.New("token bucket is destroyed")
)
View Source
var (
	ErrFileSizeExceedSpecifiedLimit = errors.New("file's size exceeds the specified limit")
)
View Source
var (
	ErrImpossibleToVerifyPermissionForUrlHolderMutation = errors.New("impossible to verify permission for mutation of URL holder")
)
View Source
var (
	ErrInvalidFormattingArgument = errors.New("invalid formatting argument")
)
View Source
var (
	ErrInvalidMigrationPseudoPath = errors.New("invalid migration pseudo path")
)
View Source
var (
	ErrLifetimeJobMetaValueShouldBeImmutable = errors.New("meta value of lifetime job should be immutable")
)
View Source
var (
	ErrMutablePublicationData = errors.New("impossible to create a publication with mutable data")
)
View Source
var ErrNoRepresentation = errors.New("no representation")
View Source
var (
	ErrNonUniqueDbOpenFnRegistration = errors.New("non unique open DB function registration")
)
View Source
var (
	ErrNotComparable = errors.New("not comparable")
)
View Source
var (
	ErrNotVisible = errors.New("not visible by context")
)
View Source
var (
	ErrReprOfMutableValueCanChange = errors.New("the representation of a mutable value can change")
)
View Source
var (
	ErrSecretIsNotPEMEncoded = errors.New("secret is not PEM encoded")
)
View Source
var (
	ErrmaxUnwrappingDepthReached = errors.New("maximum unwrapping depth reached")
)
View Source
var (
	FS_TREE_DATA_ITEM_PROPNAMES = []string{"path", "path_rel_to_parent"}
)
View Source
var IMPLICITLY_REMOVED_ROUTINE_PERMS = []Permission{
	LThreadPermission{permkind.Create},
}
View Source
var (
	OPTIONAL_PARAM_TYPE = reflect.TypeOf((*optionalParam)(nil)).Elem()
)
View Source
var OpcodeConstantIndexes = [...][]bool{}/* 150 elements not displayed */

OpcodeConstantIndexes stores for each opcode what arguments are indexes (positions) of constants.

View Source
var OpcodeNames = [...]string{}/* 150 elements not displayed */

OpcodeNames contains the string representation of each opcode. TODO: improve names

View Source
var OpcodeOperands = [...][]int{}/* 149 elements not displayed */

OpcodeOperands contains the number of operands of each opcode.

View Source
var (
	SELF_SENSITIVE_DATA_NAMES = map[string]struct {
		patterns []Pattern
	}{
		"password": {
			// contains filtered or unexported fields
		},
		"passwordHash": {
			// contains filtered or unexported fields
		},
		"email": {
			// contains filtered or unexported fields
		},
		"emailAddress": {
			// contains filtered or unexported fields
		},
		"address": {
			// contains filtered or unexported fields
		},
		"age":    {},
		"gender": {},

		"X-Api-Key": {},
	}
)
View Source
var (
	SYMBOLIC_DATA_PROP_NAMES = []string{"errors"}
)
View Source
var (
	VALUE_HISTORY_PROPNAMES = []string{"value_at", "forget_last", "last-value", "selected-datetime", "value-at-selection"}
)

Functions

func AddModuleTreeToResourceGraph

func AddModuleTreeToResourceGraph(m *Module, g *ResourceGraph, ctx *Context, ignoreBadImports bool) error

func AddValidPathPrefix

func AddValidPathPrefix(s string) (string, error)

AddValidPathPrefix adds the ./ prefix if necessary, AddValidPathPrefix does NOT check that its argument is a valid path.

func AppendTrailingSlashIfNotPresent

func AppendTrailingSlashIfNotPresent[S ~string](s S) S

func AreDefaultMaxRequestHandlerLimitsSet

func AreDefaultMaxRequestHandlerLimitsSet() bool

func AreDefaultRequestHandlingLimitsSet

func AreDefaultRequestHandlingLimitsSet() bool

func AreDefaultScriptLimitsSet

func AreDefaultScriptLimitsSet() bool

func ChildLoggerForSource

func ChildLoggerForSource(logger zerolog.Logger, src string) zerolog.Logger

func CombineParsingErrorValues

func CombineParsingErrorValues(errs []Error, positions []parse.SourcePositionRange) error

CombineParsingErrorValues combines errors into a single error with a multiline message.

func ComputeProgramRiskScore

func ComputeProgramRiskScore(mod *Module, manifest *Manifest) (totalScore RiskScore, requiredPerms []Permission)

ComputeProgramRiskScore computes the risk score for a prepared program. First the risk score for each permission is computed, then scores of permissions of the same type are summed and finally the remaining scores are multiplied together. The current logic is intended to be a starting point, it may be adjusted based on additional research and feedback.

func DeallocAll

func DeallocAll(h *ModuleHeap)

DeallocAll de-allocates the heap content, the heap is no longer usable.

func DoIO

func DoIO[T any](ctx *Context, fn func() T) T

func DoIO2

func DoIO2[T any](ctx *Context, fn func() (T, error)) (T, error)

func FileStat

func FileStat(f billy.File, fls billy.Basic) (os.FileInfo, error)

FileStat tries to directly use the given file to get file information, if it fails and fls is not nil then fls.Stat(f) is used.

func FindGroupMatchesForRegex

func FindGroupMatchesForRegex(ctx *Context, regexp *regexp.Regexp, s string, config GroupMatchesFindConfig) (groups [][]string, err error)

func FmtErrInvalidArgument

func FmtErrInvalidArgument(v Value) error

func FmtErrInvalidArgumentAtPos

func FmtErrInvalidArgumentAtPos(v Value, pos int) error

func FmtPropOfArgXShouldBeOfTypeY

func FmtPropOfArgXShouldBeOfTypeY(propName string, argName string, typename string, value Value) error

func FmtUnexpectedElementAtIndexOfArgShowVal

func FmtUnexpectedElementAtIndexOfArgShowVal(element Value, keyIndex int, argName string) error

func FmtUnexpectedElementInPropIterableShowVal

func FmtUnexpectedElementInPropIterableShowVal(element Value, propertyName string) error

func FmtUnexpectedValueAtKeyofArgShowVal

func FmtUnexpectedValueAtKeyofArgShowVal(val Value, key string, argName string) error

func ForEachValueInIterable

func ForEachValueInIterable(ctx *Context, iterable Iterable, fn func(Value) error) error

func FormatErrPropertyDoesNotExist

func FormatErrPropertyDoesNotExist(name string, v Value) error

func FormatIndexableShouldHaveLen

func FormatIndexableShouldHaveLen(length int) string

func FormatInstructions

func FormatInstructions(ctx *Context, b []byte, posOffset int, leftPadding string, constants []Value) []string

FormatInstructions returns string representation of bytecode instructions.

func FormatRuntimeTypeCheckFailed

func FormatRuntimeTypeCheckFailed(pattern Pattern, ctx *Context) error

func GetColorizedChunk

func GetColorizedChunk(chunk *parse.Chunk, code []rune, lightMode bool, fgColorSequence []byte) string

func GetConcreteGoFuncFromSymbolic

func GetConcreteGoFuncFromSymbolic(fn *symbolic.GoFunction) (reflect.Value, bool)

func GetFullColorSequence

func GetFullColorSequence(color termenv.Color, bg bool) []byte

func GetJSONRepresentation

func GetJSONRepresentation(v Serializable, ctx *Context, pattern Pattern) string

func GetJSONRepresentationWithConfig

func GetJSONRepresentationWithConfig(v Serializable, ctx *Context, config JSONSerializationConfig) (string, error)

func GetPathPatternSensitivityMultiplier

func GetPathPatternSensitivityMultiplier(patt PathPattern) int

func GetPathSensitivityMultiplier

func GetPathSensitivityMultiplier(pth Path) int

func GetStringifiedSymbolicValue

func GetStringifiedSymbolicValue(ctx *Context, v Value, wide bool) (string, error)

func GetWalkEntries

func GetWalkEntries(fls afs.Filesystem, walkedDirPath Path) (entries [][]fs.DirEntry, paths [][]string)

GetWalkEntries walks a directory and returns all encountered entries and their paths in two 2D arrays. There is one slice for each directory, the first element (fs.DirEntry or path) of each slice is the directory. The others elements are the non-dir files inside the directory. For example if the walked directory only has a singike file inside it the result will be: entries: [ [<dir entry>, <file entry>] ] paths: [ [<dir path>, <file path> ] ]

func HasIntegralRepresentation

func HasIntegralRepresentation(q Quantity) bool

func HeapAddressUintptr

func HeapAddressUintptr(addr HeapAddress) uintptr

func InspectPrint

func InspectPrint[T any](w *bufio.Writer, v T)

func IsAtomSensitive

func IsAtomSensitive(v Value) bool

func IsIndexKey

func IsIndexKey(key string) bool

func IsSensitiveProperty

func IsSensitiveProperty(ctx *Context, name string, value Value) bool

func IsSharable

func IsSharable(v Value, originState *GlobalState) (bool, string)

IsSharable returns true if the given value can be shared between goroutines, a value is considered sharable if it is immutable or it implements PotentiallySharable and .IsSharable() returns true.

func IsSharableOrClonable

func IsSharableOrClonable(v Value, originState *GlobalState) (bool, string)

func IsShared

func IsShared(v Value) bool

func IsSimpleInoxVal

func IsSimpleInoxVal(v Value) bool

func IsSimpleInoxValOrOption

func IsSimpleInoxValOrOption(v Value) bool

func IsStaticallyCheckDBFunctionRegistered

func IsStaticallyCheckDBFunctionRegistered(scheme Scheme) bool

func IsSymbolicEquivalentOfGoFunctionRegistered

func IsSymbolicEquivalentOfGoFunctionRegistered(fn any) bool

func IterateAll

func IterateAll(ctx *Context, it Iterator) [][2]Value

func MakeInstruction

func MakeInstruction(opcode Opcode, operands ...int) []byte

MakeInstruction returns a bytecode for an opcode and the operands.

func MapInstructions

func MapInstructions(b []byte, constants []Value, callbackFn InstructionCallbackFn) ([]byte, error)

MapInstructions iterates instructions and calls callbackFn for each instruction.

func MinMaxOf

func MinMaxOf(ctx *Context, first Value, others ...Value) (Value, Value)

func MustGetJSONRepresentationWithConfig

func MustGetJSONRepresentationWithConfig(v Serializable, ctx *Context, config JSONSerializationConfig) string

func NewCompiler

func NewCompiler(
	mod *Module,
	globals map[string]Value,
	symbolicData *symbolic.Data,
	staticCheckData *StaticCheckData,
	ctx *Context,
	trace io.Writer,
) *compiler

func NewStoppedWatcher

func NewStoppedWatcher(config WatcherConfiguration) stoppedWatcher

func NoPatternOrAny

func NoPatternOrAny(p Pattern) bool

func ParseFileChunk

func ParseFileChunk(absoluteSourcePath string, fls afs.Filesystem) (*parse.ParsedChunkSource, error)

func ParseLocalIncludedFiles

func ParseLocalIncludedFiles(mod *Module, ctx *Context, fls afs.Filesystem, recoverFromNonExistingIncludedFiles bool) (unrecoverableError error)

func ParseOrValidateResourceContent

func ParseOrValidateResourceContent(ctx *Context, resourceContent []byte, ctype Mimetype, doParse, validateRaw bool) (res Value, contentType Mimetype, err error)

func PrepareExtractionModeIncludableChunkfile

func PrepareExtractionModeIncludableChunkfile(args IncludableChunkfilePreparationArgs) (state *GlobalState, _ *Module, _ *IncludedChunk, finalErr error)

PrepareExtractionModeIncludableChunkfile parses & checks an includable-chunk file located in the filesystem and initializes its state.

func PrepareLocalModule

func PrepareLocalModule(args ModulePreparationArgs) (state *GlobalState, mod *Module, manif *Manifest, finalErr error)

PrepareLocalModule parses & checks a module located in the filesystem and initializes its state.

func PrettyPrint

func PrettyPrint(v Value, w io.Writer, config *PrettyPrintConfig, depth, parentIndentCount int) (err error)

func PrettyPrintList

func PrettyPrintList(list underlyingList, w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func PrintColorizedChunk

func PrintColorizedChunk(w io.Writer, chunk *parse.Chunk, code []rune, lightMode bool, fgColorSequence []byte)

func PrintType

func PrintType[T any](w *bufio.Writer, v T)

func Publish

func Publish(ctx *Context, publisher Value, data Value) error

func ReadFileInFS

func ReadFileInFS(fls billy.Basic, name string, maxSize int32) ([]byte, error)

ReadFileInFS reads up to maxSize bytes from a file in the given filesystem. if maxSize is <=0 the max size is set to 100MB.

func ReadOperands

func ReadOperands(numOperands []int, instruction []byte) (operands []int, offset int)

ReadOperands reads the operands of an instruction in bytecode.

func RegisterAddressLessType

func RegisterAddressLessType(typ reflect.Type)

RegisterAddressLessType registers an Inox value type in order to enable the computation of transient ids on its instances. Only address-less types such as types of kind reflect.Int, reflect.UInt should be registered.

func RegisterDefaultPattern

func RegisterDefaultPattern(s string, m Pattern)

func RegisterDefaultPatternNamespace

func RegisterDefaultPatternNamespace(s string, ns *PatternNamespace)

func RegisterEventSourceFactory

func RegisterEventSourceFactory(scheme Scheme, factory EventSourceFactory)

RegisterEventSourceFactory registers an event source factory for a given scheme (e.g. file).

func RegisterLimit

func RegisterLimit(name string, kind LimitKind, minimumLimit int64)

func RegisterLoadFreeEntityFn

func RegisterLoadFreeEntityFn(patternType reflect.Type, fn LoadSelfManagedEntityFn)

func RegisterOpenDbFn

func RegisterOpenDbFn(scheme Scheme, fn OpenDBFn)

func RegisterParser

func RegisterParser(mime Mimetype, p StatelessParser)

func RegisterPatternDeserializer

func RegisterPatternDeserializer(patternTypePattern *TypePattern, deserializer PatternDeserializer)

func RegisterPermissionTypesInGob

func RegisterPermissionTypesInGob()

func RegisterRenderer

func RegisterRenderer(t reflect.Type, fn RenderingFn)

RegisterRenderer register a custom rendering function for a given type, this function should ONLY be called during the initialization phase (calls to init()) since it is not protected by a lock

func RegisterSimpleValueTypesInGob

func RegisterSimpleValueTypesInGob()

func RegisterStaticallyCheckDbResolutionDataFn

func RegisterStaticallyCheckDbResolutionDataFn(scheme Scheme, fn StaticallyCheckDbResolutionDataFn)

func RegisterStaticallyCheckHostDefinitionFn

func RegisterStaticallyCheckHostDefinitionFn(scheme Scheme, fn StaticallyCheckHostDefinitionFn)

func RegisterSymbolicGoFunction

func RegisterSymbolicGoFunction(fn any, symbolicFn any)

RegisterSymbolicGoFunction registers the symbolic equivalent of fn, fn should not be a method or a closure. example: RegisterSymbolicGoFunction(func(ctx *Context){ }, func(ctx *symbolic.Context)) This function also registers information about the concrete Go function.

func RegisterSymbolicGoFunctions

func RegisterSymbolicGoFunctions(entries []any)

[<fn1>, <symbolic fn1>, <fn2>, <symbolic fn2>, ...]., See RegisterSymbolicGoFunction.

func Render

func Render(ctx *Context, w io.Writer, renderable Renderable, config RenderingInput) (int, error)

Renders renders the renderable with a custom renderer if registered, otherwise it calls renderable.Render.

func Same

func Same(a, b Value) bool

func SamePointer

func SamePointer(a, b interface{}) bool

func SendVal

func SendVal(ctx *Context, value Value, r MessageReceiver, sender Value) error

func SetDefaultMaxRequestHandlerLimits

func SetDefaultMaxRequestHandlerLimits(limits []Limit)

func SetDefaultRequestHandlingLimits

func SetDefaultRequestHandlingLimits(limits []Limit)

func SetDefaultScriptLimits

func SetDefaultScriptLimits(limits []Limit)

func SetInitialWorkingDir

func SetInitialWorkingDir(getWd func() (string, error))

func SetNewDefaultContext

func SetNewDefaultContext(fn NewDefaultContextFn)

func SetNewDefaultGlobalStateFn

func SetNewDefaultGlobalStateFn(fn NewDefaultGlobalStateFn)

func Share

func Share[T PotentiallySharable](v T, originState *GlobalState) T

func Sleep

func Sleep(ctx *Context, d Duration)

func Stringify

func Stringify(v Value, ctx *Context) string

Stringify calls PrettyPrint on the passed value

func StringifyWithConfig

func StringifyWithConfig(v Value, config *PrettyPrintConfig) string

Stringify calls PrettyPrint on the passed value

func Subscribe

func Subscribe(ctx *Context, subscriber Subscriber, publisher Value, filter Pattern) error

func ToJSONVal

func ToJSONVal(ctx *Context, v Serializable) interface{}

func ToSerializableValueMap

func ToSerializableValueMap(valMap map[string]Value) map[string]Serializable

func ToSymbolicValue

func ToSymbolicValue(ctx *Context, v Value, wide bool) (symbolic.Value, error)

func Traverse

func Traverse(v Value, fn traverseVisitFn, config TraversalConfiguration) (terror error)

Traverse traverses a graph of values starting from v. Only objects, records, dictionaries, lists, tuples and treedata are considered source nodes, the other ones are sinks (leaves). A list of encountered source nodes is used to prevent cycling.

func UnsetDefaultMaxRequestHandlerLimits

func UnsetDefaultMaxRequestHandlerLimits()

func UnsetDefaultRequestHandlingLimits

func UnsetDefaultRequestHandlingLimits()

func UnsetDefaultScriptLimits

func UnsetDefaultScriptLimits()

func UnsetNewDefaultContext

func UnsetNewDefaultContext()

func UnsetNewDefaultGlobalStateFn

func UnsetNewDefaultGlobalStateFn()

func WalkDir

func WalkDir(fls afs.Filesystem, walkedDirPath Path, fn func(path Path, d fs.DirEntry, err error) error)

func WalkDirLow

func WalkDirLow(fls afs.Filesystem, root string, fn fs.WalkDirFunc) error

/adapted from stdlib path/filepath/path.go

func WithSecondaryContextIfPossible

func WithSecondaryContextIfPossible[T any](ctx *Context, arg T) T

func WithoutSecondaryContextIfPossible

func WithoutSecondaryContextIfPossible[T any](arg T) T

func WriteConcatenatedRepresentations

func WriteConcatenatedRepresentations(ctx *Context, values ...Serializable) ([]byte, [6]int32, error)

func WriteSingleJSONRepresentation

func WriteSingleJSONRepresentation(ctx *Context, v Serializable) ([]byte, [6]int32, error)

func WriteUntypedValueJSON

func WriteUntypedValueJSON(typeName string, fn func(w *jsoniter.Stream) error, w *jsoniter.Stream) error

Types

type API

type API interface {
	Version() string
	Schema() *ObjectPattern
	Data() *Object
}

type AddressableContent

type AddressableContent interface {
	ChecksumSHA256() [32]byte
	Reader() io.Reader
}

type ApiIL

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

func WrapAPI

func WrapAPI(inner API) *ApiIL

func (*ApiIL) Equal

func (api *ApiIL) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ApiIL) GetGoMethod

func (api *ApiIL) GetGoMethod(name string) (*GoFunction, bool)

func (*ApiIL) IsMutable

func (*ApiIL) IsMutable() bool

func (*ApiIL) PrettyPrint

func (api *ApiIL) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*ApiIL) Prop

func (api *ApiIL) Prop(ctx *Context, name string) Value

func (*ApiIL) PropertyNames

func (api *ApiIL) PropertyNames(ctx *Context) []string

func (*ApiIL) SetProp

func (*ApiIL) SetProp(ctx *Context, name string, value Value) error

func (*ApiIL) ToSymbolicValue

func (api *ApiIL) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type Array

type Array []Value

func NewArray

func NewArray(ctx *Context, elements ...Value) *Array

func NewArrayFrom

func NewArrayFrom(elements ...Value) *Array

func (*Array) At

func (a *Array) At(ctx *Context, i int) Value

func (*Array) Clone

func (a *Array) Clone(originState *GlobalState, sharableValues *[]PotentiallySharable, clones map[uintptr]Clonable, depth int) (Value, error)

func (*Array) Equal

func (a *Array) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Array) IsMutable

func (*Array) IsMutable() bool

func (*Array) Iterator

func (a *Array) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*Array) Len

func (a *Array) Len() int

func (*Array) PrettyPrint

func (a *Array) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*Array) ToSymbolicValue

func (*Array) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type ArrayIterator

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

func (*ArrayIterator) Equal

func (it *ArrayIterator) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (ArrayIterator) HasNext

func (it ArrayIterator) HasNext(*Context) bool

func (*ArrayIterator) IsMutable

func (it *ArrayIterator) IsMutable() bool

func (*ArrayIterator) Key

func (it *ArrayIterator) Key(ctx *Context) Value

func (*ArrayIterator) Next

func (it *ArrayIterator) Next(ctx *Context) bool

func (*ArrayIterator) PrettyPrint

func (it *ArrayIterator) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*ArrayIterator) ToSymbolicValue

func (it *ArrayIterator) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*ArrayIterator) Value

func (it *ArrayIterator) Value(*Context) Value

type ArrayPool

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

ArrayPool is a pool providing slices of fixed length, the returned slices ("arrays") should not be modified (expect setting elements).

func NewArrayPool

func NewArrayPool[T any](
	byteSize int,
	arrayLen int,

	releaseElem func(*T),
) (*ArrayPool[T], error)

func (*ArrayPool[T]) AvailableArrayCount

func (p *ArrayPool[T]) AvailableArrayCount() int

func (*ArrayPool[T]) GetArray

func (p *ArrayPool[T]) GetArray() ([]T, error)

GetArray returns a slice that should not be modified (expect setting elements).

func (*ArrayPool[T]) InUseArrayCount

func (p *ArrayPool[T]) InUseArrayCount() int

func (*ArrayPool[T]) IsEmpty

func (p *ArrayPool[T]) IsEmpty() bool

func (*ArrayPool[T]) IsFull

func (p *ArrayPool[T]) IsFull() bool

func (*ArrayPool[T]) ReleaseArray

func (p *ArrayPool[T]) ReleaseArray(s []T) error

func (*ArrayPool[T]) TotalArrayCount

func (p *ArrayPool[T]) TotalArrayCount() int

type AssertionData

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

AssertionData is the data recorded about an assertion.

type AssertionError

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

An AssertionError is raised when an assertion statement fails (false condition).

func (AssertionError) Error

func (err AssertionError) Error() string

func (AssertionError) IsTestAssertion

func (err AssertionError) IsTestAssertion() bool

func (AssertionError) PrettyPrint

func (err AssertionError) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig)

func (AssertionError) PrettySPrint

func (err AssertionError) PrettySPrint(config *PrettyPrintConfig) string

func (*AssertionError) ShallowCopy

func (err *AssertionError) ShallowCopy() *AssertionError

type AstNode

type AstNode struct {
	Node parse.Node
	// contains filtered or unexported fields
}

An AstNode is an immutable Value wrapping an AST node.

func (AstNode) Chunk

func (n AstNode) Chunk() *parse.ParsedChunkSource

Chunk returns the parsed chunk the node is part of.

func (AstNode) Equal

func (n AstNode) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (AstNode) IsMutable

func (n AstNode) IsMutable() bool

func (AstNode) IsRecursivelyRenderable

func (node AstNode) IsRecursivelyRenderable(ctx *Context, input RenderingInput) bool

func (AstNode) PrettyPrint

func (n AstNode) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (AstNode) Prop

func (n AstNode) Prop(ctx *Context, name string) Value

func (AstNode) PropertyNames

func (AstNode) PropertyNames(ctx *Context) []string

func (AstNode) Render

func (node AstNode) Render(ctx *Context, w io.Writer, config RenderingInput) (n int, finalErr error)

func (AstNode) SetProp

func (AstNode) SetProp(ctx *Context, name string, value Value) error

func (AstNode) ToSymbolicValue

func (n AstNode) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (AstNode) WriteJSONRepresentation

func (n AstNode) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type AutoInvocationConfig

type AutoInvocationConfig struct {
	OnAddedElement URL //can be not set
	Async          bool
}

type BasePermissionRiskScore

type BasePermissionRiskScore struct {
	Type  reflect.Type
	Kind  PermissionKind
	Score RiskScore
}

type BitSetIterator

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

func (*BitSetIterator) Equal

func (it *BitSetIterator) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (BitSetIterator) HasNext

func (it BitSetIterator) HasNext(*Context) bool

func (*BitSetIterator) IsMutable

func (it *BitSetIterator) IsMutable() bool

func (*BitSetIterator) Key

func (it *BitSetIterator) Key(ctx *Context) Value

func (*BitSetIterator) Next

func (it *BitSetIterator) Next(ctx *Context) bool

func (*BitSetIterator) PrettyPrint

func (it *BitSetIterator) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*BitSetIterator) ToSymbolicValue

func (it *BitSetIterator) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*BitSetIterator) Value

func (it *BitSetIterator) Value(*Context) Value

type Bool

type Bool bool

Bool implements Value.

func All

func All(ctx *Context, iterable Iterable, condition Value) Bool

All is the value of the 'all' global.

func None

func None(ctx *Context, iterable Iterable, condition Value) Bool

None is the value of the 'none' global.

func Some

func Some(ctx *Context, iterable Iterable, condition Value) Bool

Some is the value of the 'some' global.

func (Bool) Equal

func (boolean Bool) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Bool) IsMutable

func (boolean Bool) IsMutable() bool

func (Bool) IsRecursivelyRenderable

func (b Bool) IsRecursivelyRenderable(ctx *Context, input RenderingInput) bool

func (Bool) PrettyPrint

func (boolean Bool) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Bool) Render

func (b Bool) Render(ctx *Context, w io.Writer, config RenderingInput) (int, error)

func (Bool) ToSymbolicValue

func (b Bool) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Bool) WriteJSONRepresentation

func (b Bool) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type BoolList

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

BoolList implements underlyingList

func (*BoolList) At

func (list *BoolList) At(ctx *Context, i int) Value

func (*BoolList) BoolAt

func (list *BoolList) BoolAt(i int) bool

func (*BoolList) Clone

func (list *BoolList) Clone(originState *GlobalState, sharableValues *[]PotentiallySharable, clones map[uintptr]Clonable, depth int) (Serializable, error)

func (*BoolList) ConstraintId

func (list *BoolList) ConstraintId() ConstraintId

func (*BoolList) ContainsSimple

func (list *BoolList) ContainsSimple(ctx *Context, v Serializable) bool

func (*BoolList) Equal

func (list *BoolList) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*BoolList) IsMutable

func (list *BoolList) IsMutable() bool

func (*BoolList) Iterator

func (list *BoolList) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*BoolList) Len

func (list *BoolList) Len() int

func (*BoolList) PrettyPrint

func (list *BoolList) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*BoolList) SetSlice

func (list *BoolList) SetSlice(ctx *Context, start, end int, seq Sequence)

func (*BoolList) ToSymbolicValue

func (l *BoolList) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*BoolList) WriteJSONRepresentation

func (list *BoolList) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type BooleanCoercible

type BooleanCoercible interface {
	CoerceToBool() bool
}

type BoundChildContextOptions

type BoundChildContextOptions struct {
	Filesystem afs.Filesystem
}

type BreakpointInfo

type BreakpointInfo struct {
	NodeSpan    parse.NodeSpan //zero if the breakpoint is not set
	Chunk       *parse.ParsedChunkSource
	Id          int32 //unique for a given debugger
	StartLine   int32
	StartColumn int32
}

func GetBreakpointsFromLines

func GetBreakpointsFromLines(lines []int, chunk *parse.ParsedChunkSource, nextBreakpointId *int32) ([]BreakpointInfo, error)

func (BreakpointInfo) Verified

func (i BreakpointInfo) Verified() bool

type BuiltinType

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

func (*BuiltinType) GoType

func (t *BuiltinType) GoType() reflect.Type

func (*BuiltinType) Symbolic

func (t *BuiltinType) Symbolic() symbolic.CompileTimeType

type Byte

type Byte byte

Byte implements Value.

func (Byte) Compare

func (b Byte) Compare(other Value) (result int, comparable bool)

func (Byte) Equal

func (b Byte) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Byte) Int64

func (b Byte) Int64() int64

func (Byte) IsMutable

func (b Byte) IsMutable() bool

func (Byte) IsSigned

func (b Byte) IsSigned() bool

func (Byte) PrettyPrint

func (b Byte) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Byte) ToSymbolicValue

func (b Byte) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Byte) WriteJSONRepresentation

func (b Byte) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type ByteCount

type ByteCount int64

ByteCount implements Value.

func (ByteCount) AsFloat64

func (c ByteCount) AsFloat64() (float64, bool)

func (ByteCount) AsInt64

func (c ByteCount) AsInt64() (int64, bool)

func (ByteCount) Compare

func (c ByteCount) Compare(other Value) (result int, comparable bool)

func (ByteCount) Equal

func (count ByteCount) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (ByteCount) Int64

func (c ByteCount) Int64() int64

func (ByteCount) IsMutable

func (count ByteCount) IsMutable() bool

func (ByteCount) IsSigned

func (c ByteCount) IsSigned() bool

func (ByteCount) IsZeroQuantity

func (c ByteCount) IsZeroQuantity() bool

func (ByteCount) PrettyPrint

func (count ByteCount) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (ByteCount) ToSymbolicValue

func (c ByteCount) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (ByteCount) Write

func (count ByteCount) Write(w io.Writer, _3digitGroupCount int) (int, error)

func (ByteCount) WriteJSONRepresentation

func (count ByteCount) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type ByteRate

type ByteRate int64

A ByteRate represents a number of bytes per second, it implements Value.

func (ByteRate) Compare

func (r ByteRate) Compare(other Value) (result int, comparable bool)

func (ByteRate) Equal

func (rate ByteRate) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (ByteRate) IsMutable

func (rate ByteRate) IsMutable() bool

func (ByteRate) IsZeroRate

func (r ByteRate) IsZeroRate() bool

func (ByteRate) PrettyPrint

func (rate ByteRate) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (ByteRate) QuantityPerSecond

func (r ByteRate) QuantityPerSecond() Value

func (ByteRate) ToSymbolicValue

func (r ByteRate) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (ByteRate) Validate

func (r ByteRate) Validate() error

func (ByteRate) WriteJSONRepresentation

func (rate ByteRate) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type ByteSlice

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

ByteSlice implements Value, its mutability is set at creation.

func NewByteSlice

func NewByteSlice(bytes []byte, mutable bool, contentType Mimetype) *ByteSlice

func NewImmutableByteSlice

func NewImmutableByteSlice(bytes []byte, contentType Mimetype) *ByteSlice

func NewMutableByteSlice

func NewMutableByteSlice(bytes []byte, contentType Mimetype) *ByteSlice

func (*ByteSlice) At

func (slice *ByteSlice) At(ctx *Context, i int) Value

func (*ByteSlice) Clone

func (slice *ByteSlice) Clone(originState *GlobalState, sharableValues *[]PotentiallySharable, clones map[uintptr]Clonable, depth int) (Serializable, error)

func (*ByteSlice) ContentType

func (slice *ByteSlice) ContentType() Mimetype

ContentType returns the content type specified at creation. If no content type was specified mimeconsts.APP_OCTET_STREAM_CTYPE is returned instead.

func (*ByteSlice) Equal

func (slice *ByteSlice) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ByteSlice) GetOrBuildBytes

func (slice *ByteSlice) GetOrBuildBytes() *ByteSlice

func (*ByteSlice) IsMutable

func (slice *ByteSlice) IsMutable() bool

func (*ByteSlice) Iterator

func (s *ByteSlice) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*ByteSlice) Len

func (slice *ByteSlice) Len() int

func (*ByteSlice) Mutable

func (slice *ByteSlice) Mutable() bool

func (*ByteSlice) OnMutation

func (*ByteSlice) PrettyPrint

func (slice *ByteSlice) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*ByteSlice) Reader

func (slice *ByteSlice) Reader() *Reader

func (*ByteSlice) RemoveMutationCallback

func (s *ByteSlice) RemoveMutationCallback(ctx *Context, handle CallbackHandle)

func (*ByteSlice) RemoveMutationCallbackMicrotasks

func (s *ByteSlice) RemoveMutationCallbackMicrotasks(ctx *Context)

func (*ByteSlice) SetSlice

func (slice *ByteSlice) SetSlice(ctx *Context, start, end int, seq Sequence)

func (*ByteSlice) ToSymbolicValue

func (s *ByteSlice) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*ByteSlice) UnderlyingBytes

func (slice *ByteSlice) UnderlyingBytes() []byte

func (*ByteSlice) UnsafeBytesAsString

func (slice *ByteSlice) UnsafeBytesAsString() string

func (*ByteSlice) Watcher

func (s *ByteSlice) Watcher(ctx *Context, config WatcherConfiguration) Watcher

func (*ByteSlice) WriteJSONRepresentation

func (slice *ByteSlice) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type Bytecode

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

A Bytecode contains the constants and a reference to a *CompiledFunction. The bytecode instructions are in the *CompiledFunction.

func Compile

func Compile(input CompilationInput) (*Bytecode, error)

Compile compiles a module to bytecode.

func (*Bytecode) Constants

func (b *Bytecode) Constants() []Value

Constants returns the constants used during bytecode interpretation, the slice should not be modified.

func (*Bytecode) Equal

func (b *Bytecode) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Bytecode) Format

func (b *Bytecode) Format(ctx *Context, leftPadding string) string

Fomat returnsa a human readable representations of the bytecode.

func (*Bytecode) FormatConstants

func (b *Bytecode) FormatConstants(ctx *Context, leftPadding string) (output []string)

FormatConstants returns a human readable representation of compiled constants.

func (*Bytecode) FormatInstructions

func (b *Bytecode) FormatInstructions(ctx *Context, leftPadding string) []string

func (*Bytecode) IsMutable

func (b *Bytecode) IsMutable() bool

func (*Bytecode) PrettyPrint

func (b *Bytecode) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*Bytecode) ToSymbolicValue

func (b *Bytecode) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*Bytecode) WriteJSONRepresentation

func (b *Bytecode) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type BytecodeEvaluationConfig

type BytecodeEvaluationConfig struct {
	Tracer               io.Writer
	ShowCompilationTrace bool
	OptimizeBytecode     bool
	CompilationContext   *Context
}

type BytesConcatenation

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

BytesConcatenation is a lazy concatenation of values that can form a byte slice, BytesConcatenation implements BytesLike.

func NewBytesConcatenation

func NewBytesConcatenation(bytesLikes ...BytesLike) *BytesConcatenation

func (*BytesConcatenation) At

func (c *BytesConcatenation) At(ctx *Context, i int) Value

func (*BytesConcatenation) Clone

func (c *BytesConcatenation) Clone(originState *GlobalState, sharableValues *[]PotentiallySharable, clones map[uintptr]Clonable, depth int) (Serializable, error)

func (*BytesConcatenation) Equal

func (c *BytesConcatenation) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*BytesConcatenation) GetOrBuildBytes

func (c *BytesConcatenation) GetOrBuildBytes() *ByteSlice

func (*BytesConcatenation) IsMutable

func (c *BytesConcatenation) IsMutable() bool

func (*BytesConcatenation) Iterator

func (c *BytesConcatenation) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*BytesConcatenation) Len

func (c *BytesConcatenation) Len() int

func (*BytesConcatenation) Mutable

func (c *BytesConcatenation) Mutable() bool

func (*BytesConcatenation) PrettyPrint

func (c *BytesConcatenation) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*BytesConcatenation) SetSlice

func (c *BytesConcatenation) SetSlice(ctx *Context, start, end int, seq Sequence)

func (*BytesConcatenation) ToSymbolicValue

func (c *BytesConcatenation) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*BytesConcatenation) WriteJSONRepresentation

func (c *BytesConcatenation) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type BytesLike

type BytesLike interface {
	MutableSequence
	Iterable
	GetOrBuildBytes() *ByteSlice
	Mutable() bool
}

A BytesLike represents an abstract byte slice, it should behave exactly like a regular ByteSlice and have the same pseudo properties.

func ConcatBytesLikes

func ConcatBytesLikes(bytesLikes ...BytesLike) (BytesLike, error)

type CallbackHandle

type CallbackHandle int

see FIRST_VALID_CALLBACK_HANDLE

func (CallbackHandle) Valid

func (h CallbackHandle) Valid() bool

type Change

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

A Change is an immutable Value that stores the data about a modification (Mutation) and some metadata such as the moment in time where the mutation happpened.

func NewChange

func NewChange(mutation Mutation, datetime DateTime) Change

func (Change) DateTime

func (c Change) DateTime() DateTime

type CheckedString

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

func NewCheckedString

func NewCheckedString(slices []Value, node *parse.StringTemplateLiteral, ctx *Context) (CheckedString, error)

NewCheckedString creates a CheckedString in a secure way.

func (CheckedString) Equal

func (str CheckedString) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (CheckedString) IsMutable

func (str CheckedString) IsMutable() bool

func (CheckedString) PrettyPrint

func (str CheckedString) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (CheckedString) Prop

func (str CheckedString) Prop(ctx *Context, name string) Value

func (CheckedString) PropertyNames

func (str CheckedString) PropertyNames(ctx *Context) []string

func (CheckedString) SetProp

func (CheckedString) SetProp(ctx *Context, name string, value Value) error

func (CheckedString) String

func (str CheckedString) String() string

func (CheckedString) ToSymbolicValue

func (s CheckedString) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (CheckedString) UnderlyingString

func (str CheckedString) UnderlyingString() string

func (CheckedString) WriteJSONRepresentation

func (str CheckedString) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type Clonable

type Clonable interface {
	Value

	//Clone clones the value, properties and elements are cloned by calling CheckSharedOrClone if both originState and sharableValues are nil.
	//ShareOrClone otherwise.
	Clone(originState *GlobalState, sharableValues *[]PotentiallySharable, clones map[uintptr]Clonable, depth int) (Value, error)
}

Clonable is implemented by Values that can be at least shallow cloned.

type ClonableSerializable

type ClonableSerializable interface {
	Serializable

	//Clone clones the value, properties and elements are cloned by calling CheckSharedOrClone if both originState and sharableValues are nil.
	//ShareOrClone otherwise.
	Clone(originState *GlobalState, sharableValues *[]PotentiallySharable, clones map[uintptr]Clonable, depth int) (Serializable, error)
}

ClonableSerializable is implemented by Serializables that can be at least shallow cloned.

type Collection

type Collection interface {
	Container

	//GetElementByKey should retrieve the element with the associated key.
	//ErrCollectionElemNotFound should be returned in the case of an error.
	//Implementation-specific errors are allowed.
	GetElementByKey(ctx *Context, key ElementKey) (Serializable, error)
}

type Color

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

A Color represents a color in a given encoding.

func ColorFromAnsi256Color

func ColorFromAnsi256Color(c termenv.ANSI256Color) Color

func ColorFromAnsiColor

func ColorFromAnsiColor(c termenv.ANSIColor) Color

func ColorFromRGB24

func ColorFromRGB24(r, g, b byte) Color

func ColorFromTermenvColor

func ColorFromTermenvColor(c termenv.Color, defaultColor ...Color) Color

func (Color) Equal

func (c Color) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Color) GetAnsiEscapeSequence

func (c Color) GetAnsiEscapeSequence(background bool) []byte

func (Color) IsDarkBackgroundColor

func (c Color) IsDarkBackgroundColor() bool

func (Color) IsMutable

func (Color) IsMutable() bool

func (Color) PrettyPrint

func (c Color) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Color) ToSymbolicValue

func (c Color) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Color) ToTermColor

func (c Color) ToTermColor() termenv.Color

func (Color) WriteJSONRepresentation

func (c Color) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type ColorizationInfo

type ColorizationInfo struct {
	Span          parse.NodeSpan
	ColorSequence []byte
}

func GetNodeColorizations

func GetNodeColorizations(chunk *parse.Chunk, lightMode bool) []ColorizationInfo

type CommandPermission

type CommandPermission struct {
	CommandName         WrappedString //string or Path or PathPattern
	SubcommandNameChain []string      //can be empty
}

func (CommandPermission) Includes

func (perm CommandPermission) Includes(otherPerm Permission) bool

func (CommandPermission) InternalPermTypename

func (perm CommandPermission) InternalPermTypename() permkind.InternalPermissionTypename

func (CommandPermission) Kind

func (perm CommandPermission) Kind() PermissionKind

func (CommandPermission) String

func (perm CommandPermission) String() string

type Comparable

type Comparable interface {
	Value
	//Compare should return (0, false) if the values are not comparable. Otherwise it sould return true and one of the following:
	// (-1) a < b
	// (0) a == b
	// (1) a > b
	// The Equal method of the implementations should be consistent with Compare.
	Compare(b Value) (result int, comparable bool)
}

type CompilationInput

type CompilationInput struct {
	Mod                                      *Module
	Globals                                  map[string]Value
	SymbolicData                             *symbolic.Data
	StaticCheckData                          *StaticCheckData
	TraceWriter                              io.Writer
	Context                                  *Context
	IsTestingEnabled, IsImportTestingEnabled bool
}

type CompileError

type CompileError struct {
	Module  *Module
	Node    parse.Node
	Err     error
	Message string
}

func (*CompileError) Error

func (e *CompileError) Error() string

type CompileTimeType

type CompileTimeType interface {
	Symbolic() symbolic.CompileTimeType
	GoType() reflect.Type
}

type CompiledFunction

type CompiledFunction struct {
	ParamCount   int
	IsVariadic   bool
	LocalCount   int // includes parameters
	Instructions []byte
	SourceMap    map[int]instructionSourcePosition
	Bytecode     *Bytecode //bytecode containing the function

	SourceNodeSpan parse.NodeSpan
	IncludedChunk  *parse.ParsedChunkSource //set if the function is defined in an included chunk
}

A CompiledFunction contains the bytecode instructions of a module or a compiled Inox function. The compilation of a module produces a *CompiledFunction that is the "main" function.

func (*CompiledFunction) GetSourcePositionRange

func (fn *CompiledFunction) GetSourcePositionRange(ip int) parse.SourcePositionRange

GetSourcePositionRange returns the position in source code of the instruction at the ip address, several subsequent instructions can have the same position.

type ComplexPropertyConstraint

type ComplexPropertyConstraint struct {
	NotCallablePatternMixin
	Properties []string
	Expr       parse.Node
}

type ConfluenceStream

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

A ConfluenceStream is a ReadableStream that results from the merger of 2 or more streams. ConfluenceStream was developped to combine the output & error output streams of the inox REPL but the current implementation is somewhat incorrect. TODO: change the way the data is read, one possibility is to make the streams PUSH their data in a buffer.

func NewConfluenceStream

func NewConfluenceStream(ctx *Context, streams []ReadableStream) (*ConfluenceStream, error)

func (*ConfluenceStream) ChunkDataType

func (s *ConfluenceStream) ChunkDataType() Pattern

func (*ConfluenceStream) Equal

func (s *ConfluenceStream) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ConfluenceStream) IsMainlyChunked

func (s *ConfluenceStream) IsMainlyChunked() bool

func (*ConfluenceStream) IsMutable

func (*ConfluenceStream) IsMutable() bool

func (*ConfluenceStream) IsStopped

func (s *ConfluenceStream) IsStopped() bool

func (*ConfluenceStream) PrettyPrint

func (s *ConfluenceStream) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*ConfluenceStream) Stop

func (s *ConfluenceStream) Stop()

func (*ConfluenceStream) Stream

func (*ConfluenceStream) ToSymbolicValue

func (s *ConfluenceStream) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*ConfluenceStream) WaitNext

func (s *ConfluenceStream) WaitNext(ctx *Context, filter Pattern, timeout time.Duration) (Value, error)

func (*ConfluenceStream) WaitNextChunk

func (s *ConfluenceStream) WaitNextChunk(ctx *Context, filter Pattern, sizeRange IntRange, timeout time.Duration) (*DataChunk, error)

type ConstraintId

type ConstraintId uint64

A ConstraintId represents an id that is used to retrieve the constraints on a Value.

func (ConstraintId) HasConstraint

func (id ConstraintId) HasConstraint() bool

type Container

type Container interface {
	Serializable
	Iterable

	//Contains should return true:
	// - if the value has a URL AND there is an element such as Same(element, value) is true.
	// - if the value has not a URL AND there is an element equal to value.
	Contains(ctx *Context, value Serializable) bool

	IsEmpty(ctx *Context) bool
}

The Container interface should be implemented by data structures able to tell if they contain a specific value. Implementations can contain an infinite number of values.

type Context

type Context struct {
	context.Context
	// contains filtered or unexported fields
}

A Context is analogous to contexts provided by the context package from Golang's stdlib: when the context is cancelled all descendant contexts are cancelled as well. All *GlobalState instances have a context. An Inox Context have several roles: - It stores named patterns, pattern namespaces, host aliases and other module's data. - It is called by the runtime and native functions to check permissions and enforce limits. - It has a reference to the current transaction. - During graceful teardown it calls functions registered with OnGracefulTearDown. - After cancellation it executes microtasks registered with OnDone.

func NewContexWithEmptyState

func NewContexWithEmptyState(config ContextConfig, out io.Writer) *Context

NewContexWithEmptyState creates a context & an empty state, out is used as the state's output (or io.Discard if nil), OutputFieldsInitialized is set to true.

func NewContext

func NewContext(config ContextConfig) *Context

NewContext creates a new context, if a parent context is provided the embedded context.Context will be context.WithCancel(parentContext), otherwise it will be context.WithCancel(context.Background()).

func (*Context) AddHostAlias

func (ctx *Context) AddHostAlias(alias string, host Host)

AddHostAlias associates a Host with the passed alias name, if the alias is already defined the function will panic.

func (*Context) AddHostDefinition

func (ctx *Context) AddHostDefinition(h Host, data ResourceName)

AddHostDefinition adds a host definition, redefining a host causes the function to panic with ErrNotUniqueHostDefinitionDefinition.

func (*Context) AddNamedPattern

func (ctx *Context) AddNamedPattern(name string, pattern Pattern)

AddNamedPattern associates a Pattern with the passed pattern name, if the pattern is already defined the function will panic.

func (*Context) AddPatternNamespace

func (ctx *Context) AddPatternNamespace(name string, namespace *PatternNamespace)

AddPatternNamespace associates a *PatternNamespace with the passed pattern name, if the pattern is already defined the function will panic.

func (*Context) AddTypeExtension

func (ctx *Context) AddTypeExtension(extension *TypeExtension)

func (*Context) BoundChild

func (ctx *Context) BoundChild() *Context

BoundChild creates a child of the context that also inherits callbacks, named patterns, host aliases and protocol clients.

func (*Context) BoundChildWithOptions

func (ctx *Context) BoundChildWithOptions(opts BoundChildContextOptions) *Context

func (*Context) CancelGracefully

func (ctx *Context) CancelGracefully()

CancelGracefully calls the graceful teardown tasks one by one synchronously, then the context is truly cancelled. TODO: add cancellation cause

func (*Context) CancelIfShortLived

func (ctx *Context) CancelIfShortLived()

func (*Context) CancelUngracefully

func (ctx *Context) CancelUngracefully()

CancelUngracefully directly cancels the go context, CancelGracefully should always be called instead.

func (*Context) CheckHasPermission

func (ctx *Context) CheckHasPermission(perm Permission) error

CheckHasPermission checks if the passed permission is present in the Context, if the permission is not present a NotAllowedError is returned.

func (*Context) DefinitelyStopCPUTimeDepletion

func (ctx *Context) DefinitelyStopCPUTimeDepletion() error

func (*Context) DefinitelyStopTokenDepletion

func (ctx *Context) DefinitelyStopTokenDepletion(limitName string) error

func (*Context) DoIO

func (ctx *Context) DoIO(fn func() error) error

func (*Context) DropPermissions

func (ctx *Context) DropPermissions(droppedPermissions []Permission)

DropPermissions removes all passed permissions from the context.

func (*Context) ForEachHostAlias

func (ctx *Context) ForEachHostAlias(fn func(name string, value Host) error) error

func (*Context) ForEachNamedPattern

func (ctx *Context) ForEachNamedPattern(fn func(name string, pattern Pattern) error) error

func (*Context) ForEachPatternNamespace

func (ctx *Context) ForEachPatternNamespace(fn func(name string, namespace *PatternNamespace) error) error

func (*Context) GetAllHostDefinitions

func (ctx *Context) GetAllHostDefinitions() map[Host]Value

func (*Context) GetByteRate

func (ctx *Context) GetByteRate(name string) (ByteRate, error)

GetByteRate returns the value (rate) of a byte rate limit.

func (*Context) GetClosestState

func (ctx *Context) GetClosestState() *GlobalState

func (*Context) GetFileSystem

func (ctx *Context) GetFileSystem() afs.Filesystem

func (*Context) GetForbiddenPermissions

func (ctx *Context) GetForbiddenPermissions() []Permission

func (*Context) GetGrantedPermissions

func (ctx *Context) GetGrantedPermissions() []Permission

func (*Context) GetHostAliases

func (ctx *Context) GetHostAliases() map[string]Host

func (*Context) GetHostByDefinition

func (ctx *Context) GetHostByDefinition(r ResourceName) (Host, bool)

func (*Context) GetHostDefinition

func (ctx *Context) GetHostDefinition(h Host) Value

func (*Context) GetNamedPatterns

func (ctx *Context) GetNamedPatterns() map[string]Pattern

func (*Context) GetPatternNamespaces

func (ctx *Context) GetPatternNamespaces() map[string]*PatternNamespace

func (*Context) GetProtolClient

func (ctx *Context) GetProtolClient(u URL) (ProtocolClient, error)

func (*Context) GetState

func (ctx *Context) GetState() (*GlobalState, bool)

GetState returns the state associated with the context, the boolean is false if the state is not set. To get the closest state GetClosestState() should be used.

func (*Context) GetTempDir

func (ctx *Context) GetTempDir() Path

func (*Context) GetTotal

func (ctx *Context) GetTotal(name string) (int64, error)

GetTotal returns the value of a limit of kind total.

func (*Context) GetTx

func (ctx *Context) GetTx() *Transaction

func (*Context) GetTypeExtension

func (ctx *Context) GetTypeExtension(id string) *TypeExtension

func (*Context) GetWaitConfirmPrompt

func (ctx *Context) GetWaitConfirmPrompt() WaitConfirmPrompt

func (*Context) GiveBack

func (ctx *Context) GiveBack(limitName string, count int64) error

GiveBack gives backs an amount of tokens from the bucket associated with a limit. The token count is scaled so the passed count is not the given back amount.

func (*Context) GracefulTearDownStatus

func (ctx *Context) GracefulTearDownStatus() GracefulTeardownStatus

func (*Context) HasAPermissionWithKindAndType

func (ctx *Context) HasAPermissionWithKindAndType(kind permkind.PermissionKind, typename permkind.InternalPermissionTypename) bool

THIS FUNCTION SHOULD NEVER BE USED apart from the symbolic package

func (*Context) HasCurrentTx

func (ctx *Context) HasCurrentTx() bool

func (*Context) HasPermission

func (ctx *Context) HasPermission(perm Permission) bool

HasPermission checks if the passed permission is present in the Context. The passed permission is first checked against forbidden permissions: if it is included in one of them, false is returned.

func (*Context) HasPermissionUntyped

func (ctx *Context) HasPermissionUntyped(perm any) bool

THIS FUNCTION SHOULD NEVER BE USED apart from the symbolic package

func (*Context) InefficientlyWaitUntilTearedDown

func (ctx *Context) InefficientlyWaitUntilTearedDown(timeout time.Duration) bool

func (*Context) InitialWorkingDirectory

func (ctx *Context) InitialWorkingDirectory() Path

func (*Context) IsDone

func (ctx *Context) IsDone() bool

func (*Context) IsDoneSlowCheck

func (ctx *Context) IsDoneSlowCheck() bool

func (*Context) IsLongLived

func (ctx *Context) IsLongLived() bool

func (*Context) IsTearedDown

func (ctx *Context) IsTearedDown() bool

IsTearedDown returns true if the context is done and the 'done' microtasks have been called.

func (*Context) IsValueVisible

func (ctx *Context) IsValueVisible(v Value) bool

func (*Context) Limits

func (ctx *Context) Limits() []Limit

func (*Context) Logger

func (ctx *Context) Logger() *zerolog.Logger

func (*Context) New

func (ctx *Context) New() *Context

New creates a new context with the same permissions, limits, host data, patterns, aliases & protocol clients, if the context has no parent the token counts are copied, the new context does not "share" data with the older context.

func (*Context) NewChildLoggerForInternalSource

func (ctx *Context) NewChildLoggerForInternalSource(src string) zerolog.Logger

func (*Context) Now

func (ctx *Context) Now() DateTime

func (*Context) OnDone

func (ctx *Context) OnDone(microtask ContextDoneMicrotaskFn)

func (*Context) OnGracefulTearDown

func (ctx *Context) OnGracefulTearDown(task GracefulTearDownTaskFn)

func (*Context) PauseCPUTimeDepletion

func (ctx *Context) PauseCPUTimeDepletion() error

func (*Context) PauseCPUTimeDepletionIfNotPaused

func (ctx *Context) PauseCPUTimeDepletionIfNotPaused() error

func (*Context) PauseTokenDepletion

func (ctx *Context) PauseTokenDepletion(limitName string) error

func (*Context) PromoteToLongLived

func (ctx *Context) PromoteToLongLived()

func (*Context) PutUserData

func (ctx *Context) PutUserData(path Path, value Value)

PutUserData associates $value with the passed name, if the entry is already defined the function will panic. $value must be sharable or clonable.

func (*Context) ResolveHostAlias

func (ctx *Context) ResolveHostAlias(alias string) Host

ResolveHostAlias returns the Host associated with the passed alias name, if the alias does not exist nil is returned.

func (*Context) ResolveNamedPattern

func (ctx *Context) ResolveNamedPattern(name string) Pattern

ResolveNamedPattern returns the pattern associated with the passed name, if the pattern does not exist nil is returned.

func (*Context) ResolvePatternNamespace

func (ctx *Context) ResolvePatternNamespace(name string) *PatternNamespace

ResolvePatternNamespace returns the pattern namespace associated with the passed name, if the namespace does not exist nil is returned.

func (*Context) ResolveUserData

func (ctx *Context) ResolveUserData(path Path) Value

ResolveUserData returns the user data associated with the passed identifier, if the data does not exist nil is returned.

func (*Context) ResumeCPUTimeDepletion

func (ctx *Context) ResumeCPUTimeDepletion() error

func (*Context) ResumeDepletion

func (ctx *Context) ResumeDepletion(limitName string) error

func (*Context) SetClosestState

func (ctx *Context) SetClosestState(state *GlobalState)

func (*Context) SetProtocolClientForHost

func (ctx *Context) SetProtocolClientForHost(h Host, client ProtocolClient) error

func (*Context) SetProtocolClientForURL

func (ctx *Context) SetProtocolClientForURL(u URL, client ProtocolClient) error

func (*Context) SetWaitConfirmPrompt

func (ctx *Context) SetWaitConfirmPrompt(fn WaitConfirmPrompt)

func (*Context) Sleep

func (ctx *Context) Sleep(duration time.Duration)

func (*Context) Take

func (ctx *Context) Take(limitName string, count int64) error

Take takes an amount of tokens from the bucket associated with a limit. The token count is scaled so the passed count is not the took amount.

func (*Context) ToSymbolicValue

func (ctx *Context) ToSymbolicValue() (*symbolic.Context, error)

func (*Context) Update

func (ctx *Context) Update(fn func(ctxData LockedContextData) error) error

Update locks the context (Lock) and calls fn. fn is allowed to modify the context data.

type ContextConfig

type ContextConfig struct {
	Kind                    ContextKind
	Permissions             []Permission
	ForbiddenPermissions    []Permission
	DoNotCheckDatabasePerms bool

	//if (cpu time limit is not present) AND (parent context has it) then the limit is inherited.
	//The depletion of total limits' tokens for the created context starts when the associated state is set.
	Limits []Limit

	HostDefinitions     map[Host]Value
	TypeExtensions      []*TypeExtension
	OwnedDatabases      []DatabaseConfig
	ParentContext       *Context
	ParentStdLibContext context.Context //should not be set if ParentContext is set
	LimitTokens         map[string]int64

	Filesystem       afs.Filesystem
	CreateFilesystem func(ctx *Context) (afs.Filesystem, error)
	// if false the context's filesystem is the result of WithSecondaryContextIfPossible(ContextConfig.Filesystem),
	// else the context's filesystem is ContextConfig.Filesystem.
	DoNotSetFilesystemContext bool
	InitialWorkingDirectory   Path //if not set defaults to '/'

	// if false a goroutine is created to tear down the context after it is done.
	// if true IsDone() will always return false until CancelGracefully is called.
	DoNotSpawnDoneGoroutine bool

	WaitConfirmPrompt WaitConfirmPrompt
}

func (ContextConfig) Check

func (c ContextConfig) Check() (firstErr error, ok bool)

If .ParentContext is set Check verifies that: - the parent have at least the permissions required by the child - the parent have less restrictive limits than the child - no host definition of the parent is overriden

type ContextDoneMicrotaskFn

type ContextDoneMicrotaskFn func(timeoutCtx context.Context, teardownStatus GracefulTeardownStatus) error

A ContextDoneMicrotaskFn should run for a short time (less than 1ms), the calling context should not be access because it is locked.

type ContextKind

type ContextKind int
const (
	DefaultContext ContextKind = iota
	TestingContext
)

type CurrentTest

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

func (*CurrentTest) Equal

func (t *CurrentTest) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*CurrentTest) GetGoMethod

func (t *CurrentTest) GetGoMethod(name string) (*GoFunction, bool)

func (*CurrentTest) IsMutable

func (*CurrentTest) IsMutable() bool

func (*CurrentTest) PrettyPrint

func (t *CurrentTest) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*CurrentTest) Prop

func (t *CurrentTest) Prop(ctx *Context, name string) Value

func (*CurrentTest) PropertyNames

func (*CurrentTest) PropertyNames(ctx *Context) []string

func (*CurrentTest) SetProp

func (*CurrentTest) SetProp(ctx *Context, name string, value Value) error

func (*CurrentTest) ToSymbolicValue

func (t *CurrentTest) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type CustomPermissionTypeHandler

type CustomPermissionTypeHandler func(kind PermissionKind, name string, value Value) (perms []Permission, handled bool, err error)

type DNSPermission

type DNSPermission struct {
	Kind_  PermissionKind
	Domain WrappedString //Host | HostPattern
}

func (DNSPermission) Includes

func (perm DNSPermission) Includes(otherPerm Permission) bool

func (DNSPermission) InternalPermTypename

func (perm DNSPermission) InternalPermTypename() permkind.InternalPermissionTypename

func (DNSPermission) Kind

func (perm DNSPermission) Kind() PermissionKind

func (DNSPermission) String

func (perm DNSPermission) String() string

type DataChunk

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

A DataChunk represents a chunk of any kind of data, DataChunk implements Value.

func (*DataChunk) Data

func (c *DataChunk) Data(ctx *Context) (Value, error)

func (*DataChunk) Discard

func (c *DataChunk) Discard(ctx *Context) error

func (*DataChunk) ElemCount

func (c *DataChunk) ElemCount() int

func (*DataChunk) Equal

func (c *DataChunk) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*DataChunk) GetGoMethod

func (*DataChunk) GetGoMethod(name string) (*GoFunction, bool)

func (*DataChunk) IsMutable

func (*DataChunk) IsMutable() bool

func (*DataChunk) MergeWith

func (c *DataChunk) MergeWith(ctx *Context, other *DataChunk) error

func (*DataChunk) PrettyPrint

func (c *DataChunk) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*DataChunk) Prop

func (c *DataChunk) Prop(ctx *Context, name string) Value

func (*DataChunk) PropertyNames

func (*DataChunk) PropertyNames(ctx *Context) []string

func (*DataChunk) SetProp

func (*DataChunk) SetProp(ctx *Context, name string, value Value) error

func (*DataChunk) ToSymbolicValue

func (c *DataChunk) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type DataStore

type DataStore interface {
	BaseURL() URL
	GetSerialized(ctx *Context, key Path) (string, bool)
	Has(ctx *Context, key Path) bool
	SetSerialized(ctx *Context, key Path, serialized string)
	InsertSerialized(ctx *Context, key Path, serialized string)
}

type Database

type Database interface {
	Resource() SchemeHolder

	Schema() *ObjectPattern

	//UpdateSchema updates the schema and validates the content of the database,
	//this method should return ErrTopLevelEntitiesAlreadyLoaded if it is called after .TopLevelEntities.
	//The caller should always pass a schema whose ALL entry patterns have a loading function.
	UpdateSchema(ctx *Context, schema *ObjectPattern, migrationHandlers MigrationOpHandlers)

	LoadTopLevelEntities(ctx *Context) (map[string]Serializable, error)

	Close(ctx *Context) error
}

Database is a high-level interface for a database that stores Inox values. DatabaseIL wraps Database.

type DatabaseConfig

type DatabaseConfig struct {
	Name                 string       //declared name, this is NOT the basename.
	Resource             SchemeHolder //URL or Host
	ResolutionData       Value        //ResourceName or Nil
	ExpectedSchemaUpdate bool
	ExpectedSchema       *ObjectPattern //can be nil, not related to .ExpectedSchemaUpdate
	Owned                bool

	Provided *DatabaseIL //optional (can be provided by another module instance)
}

A DatabaseConfig represent the configuration of a database accessed by a module. The configurations of databases owned by a module are defined in the databases section of the manifest. When a module B needs a database owned (defined) by another module A, a DatabaseConfig with a set .Provided field is added to the manifest of B.

func (DatabaseConfig) IsPermissionForThisDB

func (c DatabaseConfig) IsPermissionForThisDB(perm DatabasePermission) bool

type DatabaseConfigs

type DatabaseConfigs []DatabaseConfig

type DatabaseIL

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

DatabaseIL (D.atabase I.nox L.and) is an Inox Value that wraps a Database, it exposes a 'update_schema' Inox property and has an Inox property for each top level entity in the database.

func WrapDatabase

func WrapDatabase(ctx *Context, args DatabaseWrappingArgs) (*DatabaseIL, error)

WrapDatabase wraps a Database in a *DatabaseIL. In dev mode if the current schema does not match ExpectedSchema a DatbaseIL is returned alongside the error.

func (*DatabaseIL) AddOwnerStateTeardownCallback

func (db *DatabaseIL) AddOwnerStateTeardownCallback()

func (*DatabaseIL) Close

func (db *DatabaseIL) Close(ctx *Context) error

func (*DatabaseIL) Equal

func (db *DatabaseIL) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*DatabaseIL) GetGoMethod

func (db *DatabaseIL) GetGoMethod(name string) (*GoFunction, bool)

func (*DatabaseIL) GetOrLoad

func (db *DatabaseIL) GetOrLoad(ctx *Context, path Path) (Serializable, error)

GetOrLoad retrieves an entity or value stored inside the database.

func (*DatabaseIL) IsMutable

func (*DatabaseIL) IsMutable() bool

func (*DatabaseIL) IsPermissionForThisDB

func (db *DatabaseIL) IsPermissionForThisDB(perm DatabasePermission) bool

func (*DatabaseIL) PrettyPrint

func (db *DatabaseIL) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*DatabaseIL) Prop

func (db *DatabaseIL) Prop(ctx *Context, name string) Value

func (*DatabaseIL) PropertyNames

func (db *DatabaseIL) PropertyNames(ctx *Context) []string

func (*DatabaseIL) Resource

func (db *DatabaseIL) Resource() SchemeHolder

func (*DatabaseIL) SetOwnerStateOnceAndLoadIfNecessary

func (db *DatabaseIL) SetOwnerStateOnceAndLoadIfNecessary(ctx *Context, state *GlobalState) error

func (*DatabaseIL) SetProp

func (*DatabaseIL) SetProp(ctx *Context, name string, value Value) error

func (*DatabaseIL) ToSymbolicValue

func (db *DatabaseIL) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*DatabaseIL) TopLevelEntitiesLoaded

func (db *DatabaseIL) TopLevelEntitiesLoaded() bool

func (*DatabaseIL) UpdateSchema

func (db *DatabaseIL) UpdateSchema(ctx *Context, nextSchema *ObjectPattern, migrations ...*Object)

type DatabasePermission

type DatabasePermission struct {
	Kind_  PermissionKind
	Entity WrappedString
}

func (DatabasePermission) Includes

func (perm DatabasePermission) Includes(otherPerm Permission) bool

func (DatabasePermission) InternalPermTypename

func (perm DatabasePermission) InternalPermTypename() permkind.InternalPermissionTypename

func (DatabasePermission) Kind

func (perm DatabasePermission) Kind() PermissionKind

func (DatabasePermission) String

func (perm DatabasePermission) String() string

type DatabaseWrappingArgs

type DatabaseWrappingArgs struct {
	Name       string
	Inner      Database
	OwnerState *GlobalState //if nil the owner state should be set later by calling SetOwnerStateOnceAndLoadIfNecessary

	//If true the database is not loaded until the schema has been updated.
	//This field is unrelated to ExpectedSchema.
	ExpectedSchemaUpdate bool

	//If not nil the current schema is compared to the expected schema.
	//The comparison is performed after any schema update.
	//This field is unrelated to ExpectedSchemaUpdate.
	ExpectedSchema *ObjectPattern

	//Force the loading top level entities if there is not expected schema update.
	//This parameter has lower priority than DevMode.
	ForceLoadBeforeOwnerStateSet bool

	//In dev mode top level entities are never loaded, and a mismatch between
	//the current schema and the expected schema causes the expected schema to be used.
	DevMode bool
}

type Date

type Date time.Time

Date implements Value.

func (Date) Compare

func (d Date) Compare(other Value) (result int, comparable bool)

func (Date) Equal

func (d Date) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Date) IsMutable

func (d Date) IsMutable() bool

func (Date) PrettyPrint

func (d Date) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Date) ToSymbolicValue

func (d Date) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Date) Validate

func (d Date) Validate() error

func (Date) WriteJSONRepresentation

func (d Date) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type DateFormat

type DateFormat struct {
	*ParserBasedPseudoPattern

	NamespaceMemberPatternReprMixin
	// contains filtered or unexported fields
}

func NewDateFormat

func NewDateFormat(layout, namespaceMemberName string) *DateFormat

func (*DateFormat) Format

func (f *DateFormat) Format(ctx *Context, v Value, w io.Writer) (int, error)

func (*DateFormat) ToSymbolicValue

func (f *DateFormat) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (DateFormat) WriteJSONRepresentation

func (patt DateFormat) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type DateTime

type DateTime time.Time

See stdlib's time.Time, DateTime implements Value.

func (DateTime) Add

func (left DateTime) Add(right Value) (Value, error)

func (DateTime) AsGoTime

func (t DateTime) AsGoTime() time.Time

func (DateTime) Compare

func (dt DateTime) Compare(other Value) (result int, comparable bool)

func (DateTime) Equal

func (d DateTime) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (DateTime) IsMutable

func (d DateTime) IsMutable() bool

func (DateTime) IsRecursivelyRenderable

func (d DateTime) IsRecursivelyRenderable(ctx *Context, input RenderingInput) bool

func (DateTime) PrettyPrint

func (d DateTime) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (DateTime) Render

func (d DateTime) Render(ctx *Context, w io.Writer, config RenderingInput) (int, error)

func (DateTime) Sub

func (left DateTime) Sub(right Value) (Value, error)

func (DateTime) ToSymbolicValue

func (d DateTime) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (DateTime) WriteJSONRepresentation

func (d DateTime) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type DbOpenConfiguration

type DbOpenConfiguration struct {
	Resource       SchemeHolder
	ResolutionData Value
	FullAccess     bool
	Project        Project
}

type DebugCommandCloseDebugger

type DebugCommandCloseDebugger struct {
	CancelExecution bool
	Done            func()
}

type DebugCommandContinue

type DebugCommandContinue struct {
	ThreadId         StateId
	ResumeAllThreads bool
}

type DebugCommandGetScopes

type DebugCommandGetScopes struct {
	Get      func(globalScope map[string]Value, localScope map[string]Value)
	ThreadId StateId
}

type DebugCommandGetStackTrace

type DebugCommandGetStackTrace struct {
	Get      func(trace []StackFrameInfo)
	ThreadId StateId
}

type DebugCommandInformAboutSecondaryEvent

type DebugCommandInformAboutSecondaryEvent struct {
	Event SecondaryDebugEvent
}

type DebugCommandNextStep

type DebugCommandNextStep struct {
	ThreadId         StateId
	ResumeAllThreads bool
}

type DebugCommandPause

type DebugCommandPause struct {
	ThreadId StateId
}

func (DebugCommandPause) GetThreadId

func (c DebugCommandPause) GetThreadId() StateId

type DebugCommandSetBreakpoints

type DebugCommandSetBreakpoints struct {
	//nodes where we want to set a breakpoint, this can be set independently from .BreakPointsByLine
	BreakpointsAtNode map[parse.Node]struct{}

	//lines where we want to set a breakpoint, this can be set independently from .BreakpointsAtNode.
	//GetBreakpointsSetByLine is invoked with the resulting breakpoints, some of them can be disabled.
	BreakPointsByLine []int

	Chunk *parse.ParsedChunkSource

	GetBreakpointsSetByLine func(breakpoints []BreakpointInfo)
}

type DebugCommandSetExceptionBreakpoints

type DebugCommandSetExceptionBreakpoints struct {
	Disable                  bool
	GetExceptionBreakpointId func(int32)
}

type DebugCommandStepIn

type DebugCommandStepIn struct {
	ThreadId         StateId
	ResumeAllThreads bool
}

type DebugCommandStepOut

type DebugCommandStepOut struct {
	ThreadId         StateId
	ResumeAllThreads bool
}

type Debugger

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

A Debugger enables the debugging of a running Inox program by handling debug commands sent to its control channel (ControlChan()). Events should be continuously read from StoppedChan() and SecondaryEventsChan() by the user of Debugger.

Commands are handled in a separate goroutine that is created by the AttachAndStart method.

func NewDebugger

func NewDebugger(args DebuggerArgs) *Debugger

func (*Debugger) AttachAndStart

func (d *Debugger) AttachAndStart(state evaluationState)

AttachAndStart attaches the debugger to state & starts the debugging goroutine.

func (*Debugger) Closed

func (d *Debugger) Closed() bool

ControlChan returns a channel to which debug commands should be sent.

func (*Debugger) ControlChan

func (d *Debugger) ControlChan() chan any

ControlChan returns a channel to which debug commands should be sent.

func (*Debugger) ExceptionBreakpointsId

func (d *Debugger) ExceptionBreakpointsId() (_ int32, enabled bool)

func (*Debugger) NewChild

func (d *Debugger) NewChild() *Debugger

func (*Debugger) SecondaryEventsChan

func (d *Debugger) SecondaryEventsChan() chan SecondaryDebugEvent

SecondaryEventsChan returns a channel that sends secondary events received by the debugger.

func (*Debugger) StoppedChan

func (d *Debugger) StoppedChan() chan ProgramStoppedEvent

StoppedChan returns a channel that sends an item each time the program stops.

func (*Debugger) ThreadIfOfStackFrame

func (d *Debugger) ThreadIfOfStackFrame(stackFrameId int32) (StateId, bool)

func (*Debugger) Threads

func (d *Debugger) Threads() (threads []ThreadInfo)

type DebuggerArgs

type DebuggerArgs struct {
	Logger             zerolog.Logger //ok if not set
	InitialBreakpoints []BreakpointInfo

	//if not set exception breakpoints are not enabled,
	// this argument is ignored if parent is set
	ExceptionBreakpointId int32

	//cancelling this context will cause the debugger to close.
	//the debugger uses this context's filesystem.
	Context *Context
	// contains filtered or unexported fields
}

type DefaultContextConfig

type DefaultContextConfig struct {
	Permissions             []Permission
	ForbiddenPermissions    []Permission
	DoNotCheckDatabasePerms bool //used for the configuration of the created context.

	Limits              []Limit
	HostDefinitions     map[Host]Value
	OwnedDatabases      []DatabaseConfig
	ParentContext       *Context        //optional
	ParentStdLibContext context.Context //optional, should not be set if ParentContext is set

	//if nil the parent context's filesystem is used.
	Filesystem              afs.Filesystem
	InitialWorkingDirectory Path //optional, should be passed without modification to NewContext.
}

DefaultContextConfig is the configured passed to the default context factory.

type DefaultGlobalStateConfig

type DefaultGlobalStateConfig struct {
	//if set MODULE_DIRPATH_GLOBAL_NAME & MODULE_FILEPATH_GLOBAL_NAME should be defined.
	AbsoluteModulePath string

	//if set APP_LISTENING_ADDR
	ApplicationListeningAddr Host

	EnvPattern          *ObjectPattern
	PreinitFiles        PreinitFiles
	AllowMissingEnvVars bool

	Out io.Writer

	LogOut io.Writer //ignore if .Logger is set
	Logger zerolog.Logger

	LogLevels *LogLevels
}

DefaultGlobalStateConfig is the configured passed to the default state factory.

type DefaultValuePattern

type DefaultValuePattern interface {
	Pattern
	DefaultValue(ctx *Context) (Value, error)
}

DefaultValuePattern is implemented by patterns that in most cases can provide a default value that matches them. ErrNoDefaultValue should be returned if it's not possible. If the default value is mutable a new instance of the default value should be returned each time (no reuse).

type Dictionary

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

A Dictionnary maps representable values (keys) to any values, Dictionar implements Value.

func NewDictionary

func NewDictionary(entries ValMap) *Dictionary

func NewDictionaryFromKeyValueLists

func NewDictionaryFromKeyValueLists(keys []Serializable, values []Serializable, ctx *Context) *Dictionary

func (*Dictionary) Clone

func (dict *Dictionary) Clone(originState *GlobalState, sharableValues *[]PotentiallySharable, clones map[uintptr]Clonable, depth int) (Serializable, error)

func (*Dictionary) Equal

func (dict *Dictionary) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Dictionary) ForEachEntry

func (d *Dictionary) ForEachEntry(ctx *Context, fn func(keyRepr string, key Serializable, v Serializable) error) error

func (*Dictionary) IsMutable

func (dict *Dictionary) IsMutable() bool

func (*Dictionary) OnMutation

func (*Dictionary) PrettyPrint

func (dict *Dictionary) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*Dictionary) Prop

func (d *Dictionary) Prop(ctx *Context, name string) Value

func (*Dictionary) PropertyNames

func (*Dictionary) PropertyNames(ctx *Context) []string

func (*Dictionary) RemoveMutationCallback

func (d *Dictionary) RemoveMutationCallback(ctx *Context, handle CallbackHandle)

func (*Dictionary) RemoveMutationCallbackMicrotasks

func (d *Dictionary) RemoveMutationCallbackMicrotasks(ctx *Context)

func (*Dictionary) SetProp

func (*Dictionary) SetProp(ctx *Context, name string, value Value) error

func (*Dictionary) SetValue

func (d *Dictionary) SetValue(ctx *Context, key, value Serializable)

func (*Dictionary) ToSymbolicValue

func (dict *Dictionary) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*Dictionary) Value

func (d *Dictionary) Value(ctx *Context, key Serializable) (Value, Bool)

func (*Dictionary) Watcher

func (d *Dictionary) Watcher(ctx *Context, config WatcherConfiguration) Watcher

func (*Dictionary) WriteJSONRepresentation

func (d *Dictionary) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type DifferencePattern

type DifferencePattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

A DifferencePattern represents a pattern that matches the same values as a 'base' pattern except all values matched by a 'removed' pattern.

func NewDifferencePattern

func NewDifferencePattern(base, removed Pattern) *DifferencePattern

func (*DifferencePattern) Equal

func (pattern *DifferencePattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*DifferencePattern) IsMutable

func (pattern *DifferencePattern) IsMutable() bool

func (*DifferencePattern) Iterator

func (patt *DifferencePattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*DifferencePattern) PrettyPrint

func (pattern *DifferencePattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*DifferencePattern) Random

func (patt *DifferencePattern) Random(ctx *Context, options ...Option) Value

func (*DifferencePattern) StringPattern

func (patt *DifferencePattern) StringPattern() (StringPattern, bool)

func (*DifferencePattern) Test

func (patt *DifferencePattern) Test(ctx *Context, v Value) bool

func (*DifferencePattern) ToSymbolicValue

func (p *DifferencePattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*DifferencePattern) WriteJSONRepresentation

func (pattern *DifferencePattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type DirWalker

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

DirWalker is a Walker, it iterates over a list of known entries.

func NewDirWalker

func NewDirWalker(fls afs.Filesystem, walkedDirPath Path) *DirWalker

NewDirWalker walks a directory and creates a DirWalker with the entries.

func (*DirWalker) Equal

func (w *DirWalker) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*DirWalker) HasNext

func (it *DirWalker) HasNext(ctx *Context) bool

func (*DirWalker) IsMutable

func (w *DirWalker) IsMutable() bool

func (*DirWalker) Key

func (it *DirWalker) Key(*Context) Value

func (*DirWalker) Next

func (it *DirWalker) Next(ctx *Context) bool

func (*DirWalker) NodeMeta

func (it *DirWalker) NodeMeta(*Context) WalkableNodeMeta

func (*DirWalker) PrettyPrint

func (it *DirWalker) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*DirWalker) Prune

func (it *DirWalker) Prune(ctx *Context)

func (*DirWalker) ToSymbolicValue

func (it *DirWalker) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*DirWalker) Value

func (it *DirWalker) Value(*Context) Value

type DoneChan

type DoneChan <-chan struct{}

func (DoneChan) IsDone

func (c DoneChan) IsDone() bool

func (DoneChan) IsNotDone

func (c DoneChan) IsNotDone() bool

type Duration

type Duration time.Duration

See stdlib's time.Duration, Duration implements Value.

func (Duration) Add

func (left Duration) Add(right Value) (Value, error)

func (Duration) Compare

func (d Duration) Compare(other Value) (result int, comparable bool)

func (Duration) Equal

func (d Duration) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Duration) IsMutable

func (d Duration) IsMutable() bool

func (Duration) PrettyPrint

func (d Duration) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Duration) Sub

func (left Duration) Sub(right Value) (Value, error)

func (Duration) ToSymbolicValue

func (d Duration) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Duration) Validate

func (d Duration) Validate() error

func (Duration) WriteJSONRepresentation

func (d Duration) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type DynamicStringPatternElement

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

func (DynamicStringPatternElement) Call

func (patt DynamicStringPatternElement) Call(values []Serializable) (Pattern, error)

func (DynamicStringPatternElement) CompiledRegex

func (patt DynamicStringPatternElement) CompiledRegex() *regexp.Regexp

func (DynamicStringPatternElement) EffectiveLengthRange

func (patt DynamicStringPatternElement) EffectiveLengthRange() IntRange

func (DynamicStringPatternElement) Equal

func (patt DynamicStringPatternElement) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (DynamicStringPatternElement) FindMatches

func (patt DynamicStringPatternElement) FindMatches(ctx *Context, val Serializable, config MatchesFindConfig) (groups []Serializable, err error)

func (DynamicStringPatternElement) HasRegex

func (patt DynamicStringPatternElement) HasRegex() bool

func (DynamicStringPatternElement) IsMutable

func (patt DynamicStringPatternElement) IsMutable() bool

func (*DynamicStringPatternElement) IsResolved

func (patt *DynamicStringPatternElement) IsResolved() bool

func (DynamicStringPatternElement) Iterator

func (DynamicStringPatternElement) LengthRange

func (patt DynamicStringPatternElement) LengthRange() IntRange

func (DynamicStringPatternElement) MatchGroups

func (patt DynamicStringPatternElement) MatchGroups(ctx *Context, v Serializable) (map[string]Serializable, bool, error)

func (*DynamicStringPatternElement) Parse

func (*DynamicStringPatternElement) PatternNestingDepth

func (patt *DynamicStringPatternElement) PatternNestingDepth(parentDepth int) int

func (*DynamicStringPatternElement) PrettyPrint

func (patt *DynamicStringPatternElement) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (DynamicStringPatternElement) Random

func (patt DynamicStringPatternElement) Random(ctx *Context, options ...Option) Value

func (DynamicStringPatternElement) Regex

func (patt DynamicStringPatternElement) Regex() string

func (DynamicStringPatternElement) Resolve

func (*DynamicStringPatternElement) StringPattern

func (patt *DynamicStringPatternElement) StringPattern() (StringPattern, bool)

func (DynamicStringPatternElement) Test

func (patt DynamicStringPatternElement) Test(ctx *Context, v Value) bool

func (*DynamicStringPatternElement) ToSymbolicValue

func (p *DynamicStringPatternElement) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (DynamicStringPatternElement) WriteJSONRepresentation

func (patt DynamicStringPatternElement) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type DynamicValue

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

A DynamicValue resolves to a Value by performing an operation on another value (getting a property, ...), DynamicValue implements Value

func NewDynamicCall

func NewDynamicCall(ctx *Context, callee Value, args ...Value) *DynamicValue

TODO: restrict callee to functions without side effects

func NewDynamicIf

func NewDynamicIf(ctx *Context, condition *DynamicValue, consequent Value, alternate Value) *DynamicValue

func NewDynamicMapInvocation

func NewDynamicMapInvocation(ctx *Context, iterable Iterable, mapper Value) (*DynamicValue, error)

func NewDynamicMemberValue

func NewDynamicMemberValue(ctx *Context, object Value, memberName string) (*DynamicValue, error)

func (*DynamicValue) Equal

func (c *DynamicValue) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*DynamicValue) IsFrozen

func (d *DynamicValue) IsFrozen() bool

func (*DynamicValue) IsMutable

func (c *DynamicValue) IsMutable() bool

func (*DynamicValue) Iterator

func (dyn *DynamicValue) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*DynamicValue) OnMutation

func (*DynamicValue) PrettyPrint

func (d *DynamicValue) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*DynamicValue) Prop

func (dyn *DynamicValue) Prop(ctx *Context, name string) Value

func (*DynamicValue) PropertyNames

func (dyn *DynamicValue) PropertyNames(ctx *Context) []string

func (*DynamicValue) RemoveMutationCallback

func (dyn *DynamicValue) RemoveMutationCallback(ctx *Context, handle CallbackHandle)

func (*DynamicValue) RemoveMutationCallbackMicrotasks

func (dyn *DynamicValue) RemoveMutationCallbackMicrotasks(ctx *Context)

func (*DynamicValue) Resolve

func (dyn *DynamicValue) Resolve(ctx *Context) Value

func (*DynamicValue) SetProp

func (dyn *DynamicValue) SetProp(ctx *Context, name string, value Value) error

func (*DynamicValue) TakeInMemorySnapshot

func (d *DynamicValue) TakeInMemorySnapshot(ctx *Context) (*Snapshot, error)

func (*DynamicValue) ToSymbolicValue

func (d *DynamicValue) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*DynamicValue) Unfreeze

func (d *DynamicValue) Unfreeze(ctx *Context) error

func (*DynamicValue) Watcher

func (dyn *DynamicValue) Watcher(ctx *Context, config WatcherConfiguration) Watcher

Watcher creates a watcher that watches deeply by default, the watcher only watches mutations.

func (*DynamicValue) WriteJSONRepresentation

func (v *DynamicValue) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type Effect

type Effect interface {
	Resources() []ResourceName
	PermissionKind() PermissionKind
	Reversability(*Context) Reversability
	IsApplied() bool
	IsApplying() bool
	Apply(*Context) error
	Reverse(*Context) error
}

type ElementKey

type ElementKey string

An element key is a string with the following specifications: - at most 100 characters - not empty - can only contain identifier chars (parse.IsIdentChar)

func ElementKeyFrom

func ElementKeyFrom(key string) (ElementKey, error)

func MustElementKeyFrom

func MustElementKeyFrom(key string) ElementKey

type ElementsStream

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

An ElementsStream represents a stream of known elements, ElementsStream implements Value.

func NewElementsStream

func NewElementsStream(elements []Value, filter Pattern) *ElementsStream

func (*ElementsStream) ChunkDataType

func (s *ElementsStream) ChunkDataType() Pattern

func (*ElementsStream) Equal

func (s *ElementsStream) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ElementsStream) IsMainlyChunked

func (s *ElementsStream) IsMainlyChunked() bool

func (*ElementsStream) IsMutable

func (*ElementsStream) IsMutable() bool

func (*ElementsStream) IsStopped

func (s *ElementsStream) IsStopped() bool

func (*ElementsStream) PrettyPrint

func (s *ElementsStream) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*ElementsStream) Stop

func (s *ElementsStream) Stop()

func (*ElementsStream) Stream

func (*ElementsStream) ToSymbolicValue

func (s *ElementsStream) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*ElementsStream) WaitNext

func (s *ElementsStream) WaitNext(ctx *Context, filter Pattern, timeout time.Duration) (Value, error)

func (*ElementsStream) WaitNextChunk

func (s *ElementsStream) WaitNextChunk(ctx *Context, filter Pattern, sizeRange IntRange, timeout time.Duration) (*DataChunk, error)

type EmailAddress

type EmailAddress string

func NormalizeEmailAddress

func NormalizeEmailAddress(s string) (EmailAddress, error)

NormalizeEmailAddress checks and normalize the provided address.

func (EmailAddress) Equal

func (addr EmailAddress) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (EmailAddress) IsMutable

func (addr EmailAddress) IsMutable() bool

func (EmailAddress) PrettyPrint

func (addr EmailAddress) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (EmailAddress) Prop

func (addr EmailAddress) Prop(ctx *Context, name string) Value

func (EmailAddress) PropertyNames

func (addr EmailAddress) PropertyNames(ctx *Context) []string

func (EmailAddress) SetProp

func (EmailAddress) SetProp(ctx *Context, name string, value Value) error

func (EmailAddress) ToSymbolicValue

func (addr EmailAddress) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (EmailAddress) UnderlyingString

func (addr EmailAddress) UnderlyingString() string

func (EmailAddress) WriteJSONRepresentation

func (addr EmailAddress) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type EntrySnapshotMetadata

type EntrySnapshotMetadata struct {
	AbsolutePath     Path
	Size             ByteCount
	CreationTime     DateTime
	ModificationTime DateTime
	Mode             FileMode
	ChildNames       []string
	ChecksumSHA256   [32]byte //zero if directory
}

EntrySnapshotMetadata is the metadata about a single entry in a filesystem snapshot.

func (EntrySnapshotMetadata) IsDir

func (m EntrySnapshotMetadata) IsDir() bool

func (EntrySnapshotMetadata) IsRegularFile

func (m EntrySnapshotMetadata) IsRegularFile() bool

type EnvVarPermission

type EnvVarPermission struct {
	Kind_ PermissionKind
	Name  string //"*" means any
}

func (EnvVarPermission) Includes

func (perm EnvVarPermission) Includes(otherPerm Permission) bool

func (EnvVarPermission) InternalPermTypename

func (perm EnvVarPermission) InternalPermTypename() permkind.InternalPermissionTypename

func (EnvVarPermission) Kind

func (perm EnvVarPermission) Kind() PermissionKind

func (EnvVarPermission) String

func (perm EnvVarPermission) String() string

type Error

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

An Error represents an error with some immutable data, Error implements Value.

func NewError

func NewError(err error, data Serializable) Error

func (Error) Data

func (e Error) Data() Value

func (Error) Equal

func (err Error) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Error) Error

func (e Error) Error() string

func (Error) IsMutable

func (err Error) IsMutable() bool

func (Error) PrettyPrint

func (err Error) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Error) Prop

func (e Error) Prop(ctx *Context, name string) Value

func (Error) PropertyNames

func (Error) PropertyNames(ctx *Context) []string

func (Error) SetProp

func (Error) SetProp(ctx *Context, name string, value Value) error

func (Error) Text

func (e Error) Text() string

func (Error) ToSymbolicValue

func (e Error) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Error) WriteJSONRepresentation

func (v Error) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type Event

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

An Event represents a generic event, Event implements Value.

func NewEvent

func NewEvent(srcValue any, value Value, time DateTime, affectedResources ...ResourceName) *Event

func (*Event) Age

func (e *Event) Age() time.Duration

Age returns the ellapsed time since the event happened.

func (*Event) AgeWithCurrentTime

func (e *Event) AgeWithCurrentTime(now time.Time) time.Duration

AgeWithCurrentTime returns the ellapsed time since the event happened but using $now as the current time.

func (*Event) Equal

func (e *Event) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Event) IsMutable

func (e *Event) IsMutable() bool

func (*Event) PrettyPrint

func (e *Event) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*Event) Prop

func (e *Event) Prop(ctx *Context, name string) Value

func (*Event) PropertyNames

func (e *Event) PropertyNames(ctx *Context) []string

func (*Event) SetProp

func (e *Event) SetProp(ctx *Context, name string, value Value) error

func (*Event) SourceValue

func (e *Event) SourceValue() any

SourceValue() returns the Golang value that was used to create the event, it can be nil.

func (*Event) ToSymbolicValue

func (e *Event) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*Event) Value

func (e *Event) Value() Value

type EventHandler

type EventHandler func(event *Event)

type EventPattern

type EventPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

func NewEventPattern

func NewEventPattern(valuePattern Pattern) *EventPattern

func (*EventPattern) Equal

func (patt *EventPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*EventPattern) IsMutable

func (patt *EventPattern) IsMutable() bool

func (*EventPattern) Iterator

func (patt *EventPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*EventPattern) PrettyPrint

func (patt *EventPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*EventPattern) Random

func (patt *EventPattern) Random(ctx *Context, options ...Option) Value

func (*EventPattern) StringPattern

func (patt *EventPattern) StringPattern() (StringPattern, bool)

func (*EventPattern) Test

func (patt *EventPattern) Test(ctx *Context, v Value) bool

func (*EventPattern) ToSymbolicValue

func (p *EventPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*EventPattern) WriteJSONRepresentation

func (patt *EventPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type EventSource

type EventSource interface {
	GoValue
	Iterable
	OnEvent(microtask EventHandler) error
	Close()
	IsClosed() bool
}

TODO: rework An EventSource is a source of events created by a scheme-specific (e.g. file) factory. Implementations should embed EventSourceBase.

func NewEventSource

func NewEventSource(ctx *Context, resourceNameOrPattern Value) (EventSource, error)

NewEventSource creates an EventSource by calling the factory registered for the scheme of $resourceNameOrPattern. For example for a path or path pattern the event source factory of the 'file' scheme is called.

type EventSourceBase

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

EventSourceBase provides handler registration for regular events and 'idle' handler registration. EventSource implementations should embed EventSourceBase and sould retrieve handlers by calling GetHandlers.

func (*EventSourceBase) GetHandlers

func (evs *EventSourceBase) GetHandlers() []EventHandler

GetHandlers returns current event listeners (handlers), they are safe to call without recovering.

func (*EventSourceBase) OnEvent

func (evs *EventSourceBase) OnEvent(handler EventHandler) error

OnEvent registers an handler for regular (non-idle) events. The execution of $handler should take less than a few milliseconds.

func (*EventSourceBase) OnIDLE

func (evs *EventSourceBase) OnIDLE(handler IdleEventSourceHandler)

OnIDLE registers the provided handler to be called when the age of the last non-ignored event is >= .MinimumLastEventAge.

func (*EventSourceBase) RemoveAllHandlers

func (evs *EventSourceBase) RemoveAllHandlers()

type EventSourceFactory

type EventSourceFactory func(ctx *Context, resourceNameOrPattern Value) (EventSource, error)

func GetEventSourceFactory

func GetEventSourceFactory(scheme Scheme) (EventSourceFactory, bool)

GetEventSourceFactory returns the event source factory function for $scheme or (nil, false) if no factory is registered for $scheme.

type EventSourceIterator

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

func (*EventSourceIterator) Equal

func (it *EventSourceIterator) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*EventSourceIterator) GetGoMethod

func (it *EventSourceIterator) GetGoMethod(name string) (*GoFunction, bool)

func (*EventSourceIterator) HasNext

func (it *EventSourceIterator) HasNext(*Context) bool

func (*EventSourceIterator) IsMutable

func (it *EventSourceIterator) IsMutable() bool

func (*EventSourceIterator) Key

func (it *EventSourceIterator) Key(ctx *Context) Value

func (*EventSourceIterator) Next

func (it *EventSourceIterator) Next(ctx *Context) bool

func (*EventSourceIterator) PrettyPrint

func (it *EventSourceIterator) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*EventSourceIterator) Prop

func (it *EventSourceIterator) Prop(ctx *Context, name string) Value

func (*EventSourceIterator) PropertyNames

func (it *EventSourceIterator) PropertyNames(ctx *Context) []string

func (*EventSourceIterator) SetProp

func (*EventSourceIterator) SetProp(ctx *Context, name string, value Value) error

func (*EventSourceIterator) ToSymbolicValue

func (it *EventSourceIterator) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*EventSourceIterator) Value

func (it *EventSourceIterator) Value(*Context) Value

type ExactStringPattern

type ExactStringPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

ExactStringPattern matches values equal to .value: .value.Equal(...) returns true.

func NewExactStringPattern

func NewExactStringPattern(value String) *ExactStringPattern

func (*ExactStringPattern) CompiledRegex

func (patt *ExactStringPattern) CompiledRegex() *regexp.Regexp

func (*ExactStringPattern) EffectiveLengthRange

func (pattern *ExactStringPattern) EffectiveLengthRange() IntRange

func (*ExactStringPattern) Equal

func (pattern *ExactStringPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ExactStringPattern) FindMatches

func (pattern *ExactStringPattern) FindMatches(ctx *Context, val Serializable, config MatchesFindConfig) (matches []Serializable, err error)

func (*ExactStringPattern) HasRegex

func (pattern *ExactStringPattern) HasRegex() bool

func (*ExactStringPattern) IsMutable

func (pattern *ExactStringPattern) IsMutable() bool

func (*ExactStringPattern) IsResolved

func (patt *ExactStringPattern) IsResolved() bool

func (ExactStringPattern) Iterator

func (patt ExactStringPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*ExactStringPattern) LengthRange

func (pattern *ExactStringPattern) LengthRange() IntRange

func (*ExactStringPattern) Parse

func (patt *ExactStringPattern) Parse(ctx *Context, s string) (Serializable, error)

func (*ExactStringPattern) PatternNestingDepth

func (patt *ExactStringPattern) PatternNestingDepth(parentDepth int) int

func (ExactStringPattern) PrettyPrint

func (pattern ExactStringPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (ExactStringPattern) Random

func (pattern ExactStringPattern) Random(ctx *Context, options ...Option) Value

func (*ExactStringPattern) Regex

func (pattern *ExactStringPattern) Regex() string

func (*ExactStringPattern) Resolve

func (patt *ExactStringPattern) Resolve() (StringPattern, error)

func (*ExactStringPattern) StringPattern

func (patt *ExactStringPattern) StringPattern() (StringPattern, bool)

func (*ExactStringPattern) Test

func (pattern *ExactStringPattern) Test(ctx *Context, v Value) bool

func (*ExactStringPattern) ToSymbolicValue

func (p *ExactStringPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (ExactStringPattern) WriteJSONRepresentation

func (pattern ExactStringPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type ExactValuePattern

type ExactValuePattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

ExactValuePattern matches values equal to .value: .value.Equal(...) returns true.

func NewExactValuePattern

func NewExactValuePattern(value Serializable) *ExactValuePattern

func (*ExactValuePattern) Equal

func (pattern *ExactValuePattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ExactValuePattern) IsMutable

func (pattern *ExactValuePattern) IsMutable() bool

func (ExactValuePattern) Iterator

func (patt ExactValuePattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (ExactValuePattern) PrettyPrint

func (pattern ExactValuePattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (ExactValuePattern) Random

func (pattern ExactValuePattern) Random(ctx *Context, options ...Option) Value

func (*ExactValuePattern) StringPattern

func (patt *ExactValuePattern) StringPattern() (StringPattern, bool)

func (*ExactValuePattern) Test

func (pattern *ExactValuePattern) Test(ctx *Context, v Value) bool

func (*ExactValuePattern) ToSymbolicValue

func (p *ExactValuePattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*ExactValuePattern) Value

func (pattern *ExactValuePattern) Value() Serializable

func (ExactValuePattern) WriteJSONRepresentation

func (pattern ExactValuePattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type ExecutedStep

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

func (*ExecutedStep) Equal

func (s *ExecutedStep) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ExecutedStep) GetGoMethod

func (s *ExecutedStep) GetGoMethod(name string) (*GoFunction, bool)

func (ExecutedStep) IsMutable

func (e ExecutedStep) IsMutable() bool

func (*ExecutedStep) PrettyPrint

func (s *ExecutedStep) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*ExecutedStep) Prop

func (s *ExecutedStep) Prop(ctx *Context, name string) Value

func (*ExecutedStep) PropertyNames

func (*ExecutedStep) PropertyNames(ctx *Context) []string

func (*ExecutedStep) SetProp

func (*ExecutedStep) SetProp(ctx *Context, name string, value Value) error

func (*ExecutedStep) ToSymbolicValue

func (s *ExecutedStep) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type ExtendedFileInfo

type ExtendedFileInfo interface {
	fs.FileInfo

	//the boolean result should be false if the creation time is not available.
	CreationTime() (time.Time, bool)
}

type FailedToOpenDatabase

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

func NewFailedToOpenDatabase

func NewFailedToOpenDatabase(resource SchemeHolder) *FailedToOpenDatabase

func (*FailedToOpenDatabase) Close

func (db *FailedToOpenDatabase) Close(ctx *Context) error

func (*FailedToOpenDatabase) LoadTopLevelEntities

func (db *FailedToOpenDatabase) LoadTopLevelEntities(_ *Context) (map[string]Serializable, error)

func (*FailedToOpenDatabase) Resource

func (db *FailedToOpenDatabase) Resource() SchemeHolder

func (*FailedToOpenDatabase) Schema

func (db *FailedToOpenDatabase) Schema() *ObjectPattern

func (*FailedToOpenDatabase) UpdateSchema

func (db *FailedToOpenDatabase) UpdateSchema(ctx *Context, schema *ObjectPattern, handlers MigrationOpHandlers)

type FieldRetrievalType

type FieldRetrievalType int
const (
	GetBoolField FieldRetrievalType = iota
	GetIntField
	GetFloatField
	GetStringField
	GetStructPointerField
)

type FileInfo

type FileInfo struct {
	BaseName_     string
	AbsPath_      Path
	Size_         ByteCount
	Mode_         FileMode
	ModTime_      DateTime
	CreationTime_ DateTime

	HasCreationTime bool
}

A FileInfo is a Value that implements fs.FileInfo and ExtendedFileInfo.

func (FileInfo) CreationTime

func (fi FileInfo) CreationTime() (time.Time, bool)

func (FileInfo) Equal

func (i FileInfo) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (FileInfo) GetGoMethod

func (i FileInfo) GetGoMethod(name string) (*GoFunction, bool)

func (FileInfo) IsDir

func (fi FileInfo) IsDir() bool

func (FileInfo) IsMutable

func (i FileInfo) IsMutable() bool

func (FileInfo) ModTime

func (fi FileInfo) ModTime() time.Time

func (FileInfo) Mode

func (fi FileInfo) Mode() fs.FileMode

func (FileInfo) Name

func (fi FileInfo) Name() string

func (FileInfo) PrettyPrint

func (i FileInfo) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (FileInfo) Prop

func (i FileInfo) Prop(ctx *Context, name string) Value

func (FileInfo) PropertyNames

func (FileInfo) PropertyNames(ctx *Context) []string

func (FileInfo) SetProp

func (FileInfo) SetProp(ctx *Context, name string, value Value) error

func (FileInfo) Size

func (fi FileInfo) Size() int64

func (FileInfo) Sys

func (fi FileInfo) Sys() any

func (FileInfo) ToSymbolicValue

func (i FileInfo) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (FileInfo) WriteJSONRepresentation

func (i FileInfo) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type FileMode

type FileMode fs.FileMode

FileMode implements Value.

func FileModeFrom

func FileModeFrom(ctx *Context, firstArg Value) FileMode

func (FileMode) Equal

func (m FileMode) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (FileMode) Executable

func (m FileMode) Executable() bool

func (FileMode) FileMode

func (m FileMode) FileMode() fs.FileMode

func (FileMode) IsMutable

func (m FileMode) IsMutable() bool

func (FileMode) PrettyPrint

func (m FileMode) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (FileMode) ToSymbolicValue

func (m FileMode) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (FileMode) WriteJSONRepresentation

func (m FileMode) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type FilesystemPermission

type FilesystemPermission struct {
	Kind_  PermissionKind
	Entity WrappedString //Path, PathPattern ...
}

func CreateFsReadPerm

func CreateFsReadPerm(entity WrappedString) FilesystemPermission

func (FilesystemPermission) Includes

func (perm FilesystemPermission) Includes(otherPerm Permission) bool

func (FilesystemPermission) InternalPermTypename

func (perm FilesystemPermission) InternalPermTypename() permkind.InternalPermissionTypename

func (FilesystemPermission) Kind

func (FilesystemPermission) String

func (perm FilesystemPermission) String() string

type FilesystemSnapshot

type FilesystemSnapshot interface {
	//Metadata returns the metadata of an entry inside the snapshot.
	//If the given path is not absolute ErrSnapshotEntryPathMustBeAbsolute should be returned.
	//If the file does not exist os.ErrNotExist should be returned.
	Metadata(path string) (EntrySnapshotMetadata, error)

	RootDirEntries() []string //names of root directory's entries

	ForEachEntry(func(m EntrySnapshotMetadata) error) error

	//Content returns an AddressableContent value that should be able to retrieve the content of a file inside the snapshot.
	//If the given path is not absolute ErrSnapshotFilePathMustBeAbsolute should be returned.
	//If the file does not exist os.ErrNotExist should be returned.
	//If the entry at the path is not a file ErrSnapshotEntryNotAFile should be returned.
	Content(path string) (AddressableContent, error)

	//IsStoredLocally should return true if all of the data & metadata is stored in memory and/or on disk.
	IsStoredLocally() bool

	//NewAdaptedFilesystem creates a filesystem from the snapshot,
	//it should be adapted to the FilesystemSnapshot implementation.
	NewAdaptedFilesystem(maxTotalStorageSizeHint ByteCount) (SnapshotableFilesystem, error)

	WriteTo(fls afs.Filesystem, params SnapshotWriteToFilesystem) error
}

A FilesystemSnapshot represents an immutable snapshot of a filesystem, the data & metadata can be stored anywhere (memory, disk, object storage).

type FilesystemSnapshotConfig

type FilesystemSnapshotConfig struct {
	GetContent       func(ChecksumSHA256 [32]byte) AddressableContent
	InclusionFilters []PathPattern
	ExclusionFilters []PathPattern
}

func (FilesystemSnapshotConfig) IsFileIncluded

func (c FilesystemSnapshotConfig) IsFileIncluded(path Path) bool

type FilesystemSnapshotIL

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

FilesystemSnapshotIL wraps a FilesystemSnapshot and implements Value.

func WrapFsSnapshot

func WrapFsSnapshot(snapshot FilesystemSnapshot) *FilesystemSnapshotIL

func (*FilesystemSnapshotIL) Equal

func (s *FilesystemSnapshotIL) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*FilesystemSnapshotIL) IsMutable

func (*FilesystemSnapshotIL) IsMutable() bool

func (*FilesystemSnapshotIL) PrettyPrint

func (s *FilesystemSnapshotIL) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*FilesystemSnapshotIL) ToSymbolicValue

func (s *FilesystemSnapshotIL) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*FilesystemSnapshotIL) Underlying

func (s *FilesystemSnapshotIL) Underlying() FilesystemSnapshot

func (*FilesystemSnapshotIL) WriteJSONRepresentation

func (s *FilesystemSnapshotIL) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type Float

type Float float64

Float implements Value.

func (Float) Compare

func (f Float) Compare(other Value) (result int, comparable bool)

func (Float) Equal

func (f Float) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Float) IsMutable

func (f Float) IsMutable() bool

func (Float) PrettyPrint

func (f Float) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Float) ToSymbolicValue

func (f Float) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Float) WriteJSONRepresentation

func (f Float) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type FloatList

type FloatList = NumberList[Float]

type FloatRange

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

A FloatRange represents a float64 range, FloatRange implements Value. Inox's float range literals (e.g. `1.0..2.0`) evaluate to a FloatRange.

func NewFloatRange

func NewFloatRange(start, end float64, inclusiveEnd bool) FloatRange

func NewIncludedEndFloatRange

func NewIncludedEndFloatRange(start, end float64) FloatRange

func NewUnknownStartFloatRange

func NewUnknownStartFloatRange(end float64, inclusiveEnd bool) FloatRange

func (FloatRange) Contains

func (r FloatRange) Contains(ctx *Context, v Serializable) bool

func (FloatRange) Equal

func (r FloatRange) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (FloatRange) HasKnownStart

func (r FloatRange) HasKnownStart() bool

func (FloatRange) Includes

func (r FloatRange) Includes(ctx *Context, n Float) bool

func (FloatRange) InclusiveEnd

func (r FloatRange) InclusiveEnd() float64

func (FloatRange) IsEmpty

func (r FloatRange) IsEmpty(ctx *Context) bool

func (FloatRange) IsMutable

func (r FloatRange) IsMutable() bool

func (FloatRange) Iterator

func (r FloatRange) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (FloatRange) KnownStart

func (r FloatRange) KnownStart() float64

func (FloatRange) PrettyPrint

func (r FloatRange) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (FloatRange) Random

func (r FloatRange) Random(ctx *Context) Value

func (FloatRange) ToSymbolicValue

func (r FloatRange) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (FloatRange) WriteJSONRepresentation

func (r FloatRange) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type FloatRangeIterator

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

func (FloatRangeIterator) Equal

func (it FloatRangeIterator) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*FloatRangeIterator) HasNext

func (it *FloatRangeIterator) HasNext(*Context) bool

func (FloatRangeIterator) IsMutable

func (it FloatRangeIterator) IsMutable() bool

func (*FloatRangeIterator) Key

func (it *FloatRangeIterator) Key(ctx *Context) Value

func (*FloatRangeIterator) Next

func (it *FloatRangeIterator) Next(ctx *Context) bool

func (FloatRangeIterator) PrettyPrint

func (it FloatRangeIterator) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (FloatRangeIterator) ToSymbolicValue

func (it FloatRangeIterator) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*FloatRangeIterator) Value

func (it *FloatRangeIterator) Value(*Context) Value

type FloatRangePattern

type FloatRangePattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

An FloatRangePattern represents a pattern matching floats in a given range.

func NewFloatRangePattern

func NewFloatRangePattern(floatRange FloatRange, multipleOf float64) *FloatRangePattern

multipleOf is ignored if not greater than zero

func NewSingleElementFloatRangePattern

func NewSingleElementFloatRangePattern(n float64) *FloatRangePattern

func (*FloatRangePattern) Equal

func (patt *FloatRangePattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*FloatRangePattern) IsMutable

func (patt *FloatRangePattern) IsMutable() bool

func (*FloatRangePattern) Iterator

func (patt *FloatRangePattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*FloatRangePattern) PrettyPrint

func (patt *FloatRangePattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*FloatRangePattern) Random

func (patt *FloatRangePattern) Random(ctx *Context, options ...Option) Value

func (*FloatRangePattern) Range

func (patt *FloatRangePattern) Range() FloatRange

func (*FloatRangePattern) StringPattern

func (patt *FloatRangePattern) StringPattern() (StringPattern, bool)

func (*FloatRangePattern) Test

func (patt *FloatRangePattern) Test(ctx *Context, v Value) bool

func (*FloatRangePattern) ToSymbolicValue

func (p *FloatRangePattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (FloatRangePattern) WriteJSONRepresentation

func (p FloatRangePattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type FloatRangeStringPattern

type FloatRangeStringPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

An FloatRangeStringPattern matches a string (or substring) representing a decimal floating point number in a given range. As of now only the following ranges are supported:

  • [-math.MaxFloat64, math.MaxFloat64]
  • [-math.MaxFloat64, 0]
  • [0, math.MaxFloat64]

TODO: make sure all the methods are consistent.

func NewFloatRangeStringPattern

func NewFloatRangeStringPattern(lower, upperIncluded float64, node parse.Node) *FloatRangeStringPattern

func (*FloatRangeStringPattern) CompiledRegex

func (patt *FloatRangeStringPattern) CompiledRegex() *regexp.Regexp

func (*FloatRangeStringPattern) EffectiveLengthRange

func (patt *FloatRangeStringPattern) EffectiveLengthRange() IntRange

func (*FloatRangeStringPattern) Equal

func (patt *FloatRangeStringPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*FloatRangeStringPattern) FindMatches

func (patt *FloatRangeStringPattern) FindMatches(ctx *Context, val Serializable, config MatchesFindConfig) (groups []Serializable, err error)

func (*FloatRangeStringPattern) HasRegex

func (patt *FloatRangeStringPattern) HasRegex() bool

func (*FloatRangeStringPattern) IsMutable

func (patt *FloatRangeStringPattern) IsMutable() bool

func (*FloatRangeStringPattern) IsResolved

func (patt *FloatRangeStringPattern) IsResolved() bool

func (*FloatRangeStringPattern) Iterator

func (patt *FloatRangeStringPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*FloatRangeStringPattern) LengthRange

func (patt *FloatRangeStringPattern) LengthRange() IntRange

func (*FloatRangeStringPattern) Parse

func (patt *FloatRangeStringPattern) Parse(ctx *Context, s string) (Serializable, error)

func (*FloatRangeStringPattern) PatternNestingDepth

func (patt *FloatRangeStringPattern) PatternNestingDepth(parentDepth int) int

func (*FloatRangeStringPattern) PrettyPrint

func (patt *FloatRangeStringPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*FloatRangeStringPattern) Random

func (pattern *FloatRangeStringPattern) Random(ctx *Context, options ...Option) Value

func (*FloatRangeStringPattern) Regex

func (patt *FloatRangeStringPattern) Regex() string

func (*FloatRangeStringPattern) Resolve

func (patt *FloatRangeStringPattern) Resolve() (StringPattern, error)

func (*FloatRangeStringPattern) StringFrom

func (patt *FloatRangeStringPattern) StringFrom(ctx *Context, v Value) (string, error)

func (*FloatRangeStringPattern) StringPattern

func (patt *FloatRangeStringPattern) StringPattern() (StringPattern, bool)

func (*FloatRangeStringPattern) Test

func (patt *FloatRangeStringPattern) Test(ctx *Context, v Value) bool

func (*FloatRangeStringPattern) ToSymbolicValue

func (p *FloatRangeStringPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*FloatRangeStringPattern) WriteJSONRepresentation

func (patt *FloatRangeStringPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type Format

type Format interface {
	Pattern
	Format(ctx *Context, arg Value, w io.Writer) (int, error)
}

A Format represents a string or binary format.

type FreeEntityLoadingParams

type FreeEntityLoadingParams struct {
	Key          Path
	Storage      DataStore
	Pattern      Pattern
	InitialValue Serializable
	AllowMissing bool //if true the loading function is allowed to return an empty/default value matching the pattern
	Migration    *FreeEntityMigrationArgs
}

func (FreeEntityLoadingParams) IsDeletion

func (a FreeEntityLoadingParams) IsDeletion(ctx *Context) bool

type FreeEntityMigrationArgs

type FreeEntityMigrationArgs struct {
	NextPattern       Pattern //can be nil
	MigrationHandlers MigrationOpHandlers
}

type Frequency

type Frequency float64

A Frequency represents a number of actions per second, it implements Value.

func (Frequency) Compare

func (f Frequency) Compare(other Value) (result int, comparable bool)

func (Frequency) Equal

func (f Frequency) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Frequency) IsMutable

func (f Frequency) IsMutable() bool

func (Frequency) IsZeroRate

func (f Frequency) IsZeroRate() bool

func (Frequency) PrettyPrint

func (f Frequency) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Frequency) QuantityPerSecond

func (f Frequency) QuantityPerSecond() Value

func (Frequency) ToSymbolicValue

func (f Frequency) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Frequency) Validate

func (f Frequency) Validate() error

func (Frequency) WriteJSONRepresentation

func (f Frequency) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type FunctionPattern

type FunctionPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

A FunctionPattern represents a pattern that matches that either matches any function or functions with certain parameters and return types. Inox's function pattern literals (e.g. fn() int) evaluate to a function pattern.

func (*FunctionPattern) Equal

func (pattern *FunctionPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*FunctionPattern) IsMutable

func (pattern *FunctionPattern) IsMutable() bool

func (*FunctionPattern) Iterator

func (patt *FunctionPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*FunctionPattern) PrettyPrint

func (pattern *FunctionPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*FunctionPattern) Random

func (patt *FunctionPattern) Random(ctx *Context, options ...Option) Value

func (*FunctionPattern) StringPattern

func (patt *FunctionPattern) StringPattern() (StringPattern, bool)

func (*FunctionPattern) Test

func (patt *FunctionPattern) Test(ctx *Context, v Value) bool

func (*FunctionPattern) ToSymbolicValue

func (p *FunctionPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*FunctionPattern) WriteJSONRepresentation

func (patt *FunctionPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type FunctionStaticData

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

type GenericWatcher

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

func NewGenericWatcher

func NewGenericWatcher(config WatcherConfiguration) *GenericWatcher

func (*GenericWatcher) Config

func (*GenericWatcher) Equal

func (w *GenericWatcher) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*GenericWatcher) InformAboutAsync

func (w *GenericWatcher) InformAboutAsync(ctx *Context, v Value)

InformAboutAsync adds a value to the channel of interesting values.

func (*GenericWatcher) IsMutable

func (w *GenericWatcher) IsMutable() bool

func (*GenericWatcher) IsStopped

func (w *GenericWatcher) IsStopped() bool

func (*GenericWatcher) PrettyPrint

func (watcher *GenericWatcher) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*GenericWatcher) Stop

func (w *GenericWatcher) Stop()

func (*GenericWatcher) Stream

func (*GenericWatcher) ToSymbolicValue

func (w *GenericWatcher) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*GenericWatcher) WaitNext

func (w *GenericWatcher) WaitNext(ctx *Context, additionalFilter Pattern, timeout time.Duration) (Value, error)

type GlobalConstness

type GlobalConstness = int
const (
	GlobalVar GlobalConstness = iota
	GlobalConst
)

type GlobalState

type GlobalState struct {
	Module *Module //nil in some cases (e.g. shell, mapping entry's state), TODO: check for usage

	Out                     io.Writer      //io.Discard by default
	Logger                  zerolog.Logger //zerolog.Nop() by default
	LogLevels               *LogLevels     //DEFAULT_LOG_LEVELS by default
	OutputFieldsInitialized atomic.Bool    //should be set to true by the state's creator, even if the default values are kept.

	Ctx         *Context
	Manifest    *Manifest
	Project     Project                //can be nil
	Bytecode    *Bytecode              //can be nil
	Globals     GlobalVariables        //global variables
	LThread     *LThread               //not nil if running in a dedicated LThread
	Databases   map[string]*DatabaseIL //the map should never change
	Heap        *ModuleHeap
	SystemGraph *SystemGraph

	MainState *GlobalState //never nil except for parents of main states,this field should be set by user of GlobalState.

	GetBaseGlobalsForImportedModule      func(ctx *Context, manifest *Manifest) (GlobalVariables, error) // ok if nil
	GetBasePatternsForImportedModule     func() (map[string]Pattern, map[string]*PatternNamespace)       // return nil maps by default
	SymbolicBaseGlobalsForImportedModule map[string]symbolic.Value                                       // ok if nil, should not be modified

	Debugger     atomic.Value //nil or (nillable) *Debugger
	TestingState TestingState

	PrenitStaticCheckErrors   []*StaticCheckError
	MainPreinitError          error
	FirstDatabaseOpeningError error
	StaticCheckData           *StaticCheckData
	SymbolicData              *SymbolicData
	// contains filtered or unexported fields
}

A GlobalState represents the global state of a module (or the shell loop), most exported fields should be set once. Patterns, host aliases and host definition data are stored in the context.

func NewGlobalState

func NewGlobalState(ctx *Context, constants ...map[string]Value) *GlobalState

NewGlobalState creates a state with the provided context and constants. The OutputFieldsInitialized field is not initialized and should be set by the caller.

func (*GlobalState) ComputePriority

func (g *GlobalState) ComputePriority() ModulePriority

func (*GlobalState) Equal

func (s *GlobalState) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*GlobalState) GetGoMethod

func (g *GlobalState) GetGoMethod(name string) (*GoFunction, bool)

func (*GlobalState) InitSystemGraph

func (g *GlobalState) InitSystemGraph()

func (*GlobalState) IsMain

func (g *GlobalState) IsMain() bool

IsMain returns true if g.MainState == g.

func (*GlobalState) IsMutable

func (*GlobalState) IsMutable() bool

func (*GlobalState) PrettyPrint

func (s *GlobalState) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*GlobalState) Prop

func (g *GlobalState) Prop(ctx *Context, name string) Value

func (*GlobalState) PropertyNames

func (*GlobalState) PropertyNames(ctx *Context) []string

func (*GlobalState) ProposeSystemGraph

func (g *GlobalState) ProposeSystemGraph(v SystemGraphNodeValue, optionalName string)

func (*GlobalState) SetDescendantState

func (g *GlobalState) SetDescendantState(src ResourceName, state *GlobalState)

func (*GlobalState) SetProp

func (*GlobalState) SetProp(ctx *Context, name string, value Value) error

func (*GlobalState) ToSymbolicValue

func (s *GlobalState) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type GlobalVarPermission

type GlobalVarPermission struct {
	Kind_ PermissionKind
	Name  string //"*" means any
}

func (GlobalVarPermission) Includes

func (perm GlobalVarPermission) Includes(otherPerm Permission) bool

func (GlobalVarPermission) InternalPermTypename

func (perm GlobalVarPermission) InternalPermTypename() permkind.InternalPermissionTypename

func (GlobalVarPermission) Kind

func (perm GlobalVarPermission) Kind() PermissionKind

func (GlobalVarPermission) String

func (perm GlobalVarPermission) String() string

type GlobalVariables

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

A GlobalVariables represents the global scope of a module. Global variables captured by shared Inox functions are temporarily added during calls.

func GlobalVariablesFromMap

func GlobalVariablesFromMap(m map[string]Value, startConstants []string) GlobalVariables

func (*GlobalVariables) CheckedGet

func (g *GlobalVariables) CheckedGet(name string) (Value, bool)

func (*GlobalVariables) Constants

func (g *GlobalVariables) Constants() map[string]Value

func (*GlobalVariables) Entries

func (g *GlobalVariables) Entries() map[string]Value

func (*GlobalVariables) Foreach

func (g *GlobalVariables) Foreach(fn func(name string, v Value, isStartConstant bool) error) error

func (*GlobalVariables) Get

func (g *GlobalVariables) Get(name string) Value

func (*GlobalVariables) Has

func (g *GlobalVariables) Has(name string) bool

func (*GlobalVariables) PopCapturedGlobals

func (g *GlobalVariables) PopCapturedGlobals()

func (*GlobalVariables) PushCapturedGlobals

func (g *GlobalVariables) PushCapturedGlobals(captured []capturedGlobal)

func (*GlobalVariables) Set

func (g *GlobalVariables) Set(name string, value Value)

Set sets the value for a global variable (not constant)

func (*GlobalVariables) SetCheck

func (g *GlobalVariables) SetCheck(name string, value Value, allow func(defined bool) error) error

SetChecked sets the value for a global variable (not constant), it called

type GoFunction

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

A GoFunction represents a native (Go) function.

func WrapGoClosure

func WrapGoClosure(goFn any) *GoFunction

func WrapGoFunction

func WrapGoFunction(goFn any) *GoFunction

func WrapGoMethod

func WrapGoMethod(goFn any) *GoFunction

func (*GoFunction) Call

func (goFunc *GoFunction) Call(args []any, globalState, extState *GlobalState, isExt, must bool) (Value, error)

Call calls the underlying native function using reflection, the global state .goCallArgPrepBuf and .goCallArgsBuf buffers are used. The reflect package makes 2 small allocations during the call.

func (*GoFunction) Equal

func (goFunc *GoFunction) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*GoFunction) GetGoMethod

func (*GoFunction) GetGoMethod(name string) (*GoFunction, bool)

func (*GoFunction) GoFunc

func (fn *GoFunction) GoFunc() any

func (*GoFunction) IsMutable

func (goFunc *GoFunction) IsMutable() bool

func (*GoFunction) IsSharable

func (fn *GoFunction) IsSharable(originState *GlobalState) (bool, string)

func (*GoFunction) IsShared

func (fn *GoFunction) IsShared() bool

func (*GoFunction) Kind

func (fn *GoFunction) Kind() GoFunctionKind

func (*GoFunction) PrettyPrint

func (v *GoFunction) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*GoFunction) Prop

func (fn *GoFunction) Prop(ctx *Context, name string) Value

func (*GoFunction) PropertyNames

func (*GoFunction) PropertyNames(ctx *Context) []string

func (*GoFunction) SetProp

func (*GoFunction) SetProp(ctx *Context, name string, value Value) error

func (*GoFunction) Share

func (fn *GoFunction) Share(originState *GlobalState)

func (*GoFunction) SmartLock

func (fn *GoFunction) SmartLock(state *GlobalState)

func (*GoFunction) SmartUnlock

func (fn *GoFunction) SmartUnlock(state *GlobalState)

func (*GoFunction) ToSymbolicValue

func (f *GoFunction) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type GoFunctionKind

type GoFunctionKind int
const (
	GoFunc GoFunctionKind = iota
	GoMethod
	GoClosure
)

type GoValue

type GoValue interface {
	Value
	IProps
	GetGoMethod(name string) (*GoFunction, bool)
}

A GoValue represents a user defined Value or a core Value that is not deeply integrated with the evaluation logic.

type GracefulTearDownTaskFn

type GracefulTearDownTaskFn func(ctx *Context) error

A GracefulTearDownTaskFn should ideally run for a relative short time (less than 500ms), the passed context is the context the microtask was registered to.

type GracefulTeardownStatus

type GracefulTeardownStatus int32
const (
	NeverStartedGracefulTeardown GracefulTeardownStatus = iota
	GracefullyTearingDown
	GracefullyTearedDown
	GracefullyTearedDownWithErrors       //errors during teardown
	GracefullyTearedDownWithCancellation //context cancellation before the end of the teardown
)

type GroupMatchesFindConfig

type GroupMatchesFindConfig struct {
	Kind GroupMatchesFindConfigKind
}

type GroupMatchesFindConfigKind

type GroupMatchesFindConfigKind int
const (
	FindFirstGroupMatches GroupMatchesFindConfigKind = iota
	FindAllGroupMatches
)

type GroupPattern

type GroupPattern interface {
	Pattern
	MatchGroups(*Context, Serializable) (groups map[string]Serializable, ok bool, err error)
	FindGroupMatches(*Context, Serializable, GroupMatchesFindConfig) (groups []*Object, err error)
}

GroupPattern is implemented by patterns that are able to decompose matched values into groups. A canonical implementation example would be RegexPattern.

type HeapAddress

type HeapAddress *byte

func Alloc

func Alloc[T any](h *ModuleHeap, size int, alignment int) HeapAddress

Alloc allocates $size bytes and returns the starting position of the allocated memory segment.

func HeapAddressFromUintptr

func HeapAddressFromUintptr(ptr uintptr) HeapAddress

type Host

type Host string

A Host is composed of the following parts: [<scheme>] '://' <hostname> [':' <port>].

func (Host) Equal

func (host Host) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Host) ExplicitPort

func (host Host) ExplicitPort() int

func (Host) HasHttpScheme

func (host Host) HasHttpScheme() bool

HasHttpScheme returns true if the scheme is "http" or "https".

func (Host) HasScheme

func (patt Host) HasScheme() bool

func (Host) HostWithoutPort

func (host Host) HostWithoutPort() Host

func (Host) IsMutable

func (host Host) IsMutable() bool

func (Host) Name

func (host Host) Name() string

func (Host) PrettyPrint

func (host Host) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Host) Prop

func (host Host) Prop(ctx *Context, name string) Value

func (Host) PropertyNames

func (host Host) PropertyNames(ctx *Context) []string

func (Host) ResourceName

func (host Host) ResourceName() string

func (Host) Scheme

func (host Host) Scheme() Scheme

Scheme returns the scheme of the host (e.g. 'http') or $NO_SCHEME_SCHEME_NAME if the host has no scheme.

func (Host) SetProp

func (Host) SetProp(ctx *Context, name string, value Value) error

func (Host) ToSymbolicValue

func (h Host) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Host) URLWithPath

func (host Host) URLWithPath(absPath Path) URL

func (Host) UnderlyingString

func (host Host) UnderlyingString() string

func (Host) Validate

func (host Host) Validate() error

func (Host) WithoutScheme

func (host Host) WithoutScheme() string

WithoutScheme returns the part of the host after '://'.

func (Host) WriteJSONRepresentation

func (host Host) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type HostPattern

type HostPattern string

func (HostPattern) Call

func (HostPattern) Call(values []Serializable) (Pattern, error)

func (HostPattern) Equal

func (patt HostPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (HostPattern) HasScheme

func (patt HostPattern) HasScheme() bool

func (HostPattern) Includes

func (patt HostPattern) Includes(ctx *Context, v Value) bool

func (HostPattern) IsMutable

func (patt HostPattern) IsMutable() bool

func (HostPattern) Iterator

func (patt HostPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (HostPattern) PrettyPrint

func (patt HostPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (HostPattern) Prop

func (patt HostPattern) Prop(ctx *Context, name string) Value

func (HostPattern) PropertyNames

func (patt HostPattern) PropertyNames(ctx *Context) []string

func (HostPattern) Random

func (pattern HostPattern) Random(ctx *Context, options ...Option) Value

func (HostPattern) Scheme

func (patt HostPattern) Scheme() Scheme

Scheme returns the scheme of the host pattern (e.g. 'http') or $NO_SCHEME_SCHEME_NAME if the pattern has no scheme.

func (HostPattern) SetProp

func (HostPattern) SetProp(ctx *Context, name string, value Value) error

func (HostPattern) StringPattern

func (HostPattern) StringPattern() (StringPattern, bool)

func (HostPattern) Test

func (patt HostPattern) Test(ctx *Context, v Value) bool

func (HostPattern) ToSymbolicValue

func (p HostPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (HostPattern) UnderlyingString

func (patt HostPattern) UnderlyingString() string

func (HostPattern) WithoutScheme

func (host HostPattern) WithoutScheme() string

WithoutScheme returns the part of the pattern after '://'.

func (HostPattern) WriteJSONRepresentation

func (patt HostPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type HttpPermission

type HttpPermission struct {
	Kind_     PermissionKind
	Entity    WrappedString //URL, URLPattern, HTTPHost, HTTPHostPattern ....
	AnyEntity bool
}

func CreateHttpReadPerm

func CreateHttpReadPerm(entity WrappedString) HttpPermission

func (HttpPermission) Includes

func (perm HttpPermission) Includes(otherPerm Permission) bool

func (HttpPermission) InternalPermTypename

func (perm HttpPermission) InternalPermTypename() permkind.InternalPermissionTypename

func (HttpPermission) Kind

func (perm HttpPermission) Kind() PermissionKind

func (HttpPermission) String

func (perm HttpPermission) String() string

type IProps

type IProps interface {
	Prop(ctx *Context, name string) Value
	PropertyNames(*Context) []string
	SetProp(ctx *Context, name string, value Value) error
}

type IPropsPattern

type IPropsPattern interface {
	Value
	//ValuePropPattern should return the pattern of the property (name).
	ValuePropPattern(name string) (propPattern Pattern, isOptional bool, ok bool)

	//ValuePropertyNames should return the list of all property names (optional or not) of values matching the pattern.
	ValuePropertyNames() []string
}

type IPseudoAdd

type IPseudoAdd interface {
	Value
	Add(right Value) (Value, error)
}

type IPseudoSub

type IPseudoSub interface {
	Value
	Sub(right Value) (Value, error)
}

type IWithSecondaryContext

type IWithSecondaryContext interface {
	//context should not be nil
	WithSecondaryContext(*Context) any

	WithoutSecondaryContext() any
}

type Identifier

type Identifier string

func (Identifier) Equal

func (i Identifier) Equal(ctx *Context, otherIdent Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Identifier) IsMutable

func (i Identifier) IsMutable() bool

func (Identifier) PrettyPrint

func (i Identifier) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Identifier) ToSymbolicValue

func (i Identifier) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Identifier) UnderlyingString

func (i Identifier) UnderlyingString() string

func (Identifier) WriteJSONRepresentation

func (i Identifier) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type IdleEventSourceHandler

type IdleEventSourceHandler struct {
	//Should be >= HARD_MINIMUM_LAST_EVENT_AGE and <= MAX_MINIMUM_LAST_EVENT_AGE
	MinimumLastEventAge time.Duration

	//If nil defaults to a function always returning false.
	IsIgnoredEvent func(*Event) Bool

	//If false the handler is called after the next IDLE phase.
	DontWaitForFirstEvent bool

	//Microtask to execute, the execution should take less than a millisecond.
	Microtask func()
	// contains filtered or unexported fields
}

type Image

type Image interface {
	FilesystemSnapshot() FilesystemSnapshot
}

An image represents a project image.

type ImportConfig

type ImportConfig struct {
	Src                ResourceName
	ValidationString   String  //hash of the imported module
	ArgObj             *Object //arguments for the evaluation of the imported module
	GrantedPermListing *Object
	ParentState        *GlobalState  //the state of the module doing the import
	Insecure           bool          //if true certificate verification is ignored when making HTTP requests
	Timeout            time.Duration //total timeout for combined fetching + evaluation of the imported module
}

type InMemoryModuleParsingConfig

type InMemoryModuleParsingConfig struct {
	Name    string
	Context *Context //this context is used to check permissions
}

type InMemorySnapshotable

type InMemorySnapshotable interface {
	Watchable
	Serializable
	TakeInMemorySnapshot(ctx *Context) (*Snapshot, error)
	IsFrozen() bool
	Unfreeze(ctx *Context) error
}

implementations of InMemorySnapshotable are Watchables that can take an in-memory snapshot of themselves in a few milliseconds or less. the values in snapshots should be FROZEN and should NOT be connected to other live objects, they should be be able to be mutated again after being unfreezed.

type IncludableChunkfilePreparationArgs

type IncludableChunkfilePreparationArgs struct {
	Fpath string //path of the file in the .ParsingCompilationContext's filesystem.

	ParsingContext *Context
	StdlibCtx      context.Context //used as core.DefaultContextConfig.ParentStdLibContext

	Out    io.Writer //defaults to os.Stdout
	LogOut io.Writer //defaults to Out

	//used to create the context
	IncludedChunkContextFileSystem afs.Filesystem
}

type IncludedChunk

type IncludedChunk struct {
	*parse.ParsedChunkSource
	IncludedChunkForest   []*IncludedChunk
	OriginalErrors        []*parse.ParsingError
	ParsingErrors         []Error
	ParsingErrorPositions []parse.SourcePositionRange
}

An IncludedChunk represents an Inox chunk that is included in another chunk, it does not hold any state and should NOT be modified.

func ParseLocalSecondaryChunk

func ParseLocalSecondaryChunk(config LocalSecondaryChunkParsingConfig) (*IncludedChunk, error)

type InclusionMigrationOp

type InclusionMigrationOp struct {
	Value    Pattern
	Optional bool
	MigrationMixin
}

func (InclusionMigrationOp) ToSymbolicValue

func (op InclusionMigrationOp) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) symbolic.MigrationOp

type IncomingMessageReceivedEvent

type IncomingMessageReceivedEvent struct {
	MessageType string `json:"messageType"` // examples: http/request, websocket/message
	Url         string `json:"url,omitempty"`
}

func (IncomingMessageReceivedEvent) SecondaryDebugEventType

func (e IncomingMessageReceivedEvent) SecondaryDebugEventType() SecondaryDebugEventType

type Indexable

type Indexable interface {
	Iterable

	// At should panic if the index is out of bounds.
	At(ctx *Context, i int) Value

	Len() int
}

type InoxFunction

type InoxFunction struct {
	Node  parse.Node
	Chunk *parse.ParsedChunkSource
	// contains filtered or unexported fields
}

An InoxFunction is a Value that represents a function declared inside Inox code. Inox functions that are declared inside modules executed by the bytecode interpreter stores their bytecode and some other information.

func (*InoxFunction) Call

func (fn *InoxFunction) Call(globalState *GlobalState, self Value, args []Value, disabledArgSharing []bool) (Value, error)

Call executes the function with the provided global state, `self` value and arguments. If the function is compiled the bytecode interpreter is used.

func (*InoxFunction) Equal

func (fn *InoxFunction) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*InoxFunction) FuncExpr

func (fn *InoxFunction) FuncExpr() *parse.FunctionExpression

func (*InoxFunction) IsMutable

func (fn *InoxFunction) IsMutable() bool

func (*InoxFunction) IsSharable

func (fn *InoxFunction) IsSharable(originState *GlobalState) (bool, string)

func (*InoxFunction) IsShared

func (fn *InoxFunction) IsShared() bool

func (*InoxFunction) OnMutation

func (*InoxFunction) PrettyPrint

func (g *InoxFunction) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*InoxFunction) RemoveMutationCallback

func (f *InoxFunction) RemoveMutationCallback(ctx *Context, handle CallbackHandle)

func (*InoxFunction) RemoveMutationCallbackMicrotasks

func (f *InoxFunction) RemoveMutationCallbackMicrotasks(ctx *Context)

func (*InoxFunction) Share

func (fn *InoxFunction) Share(originState *GlobalState)

func (*InoxFunction) SmartLock

func (fn *InoxFunction) SmartLock(state *GlobalState)

func (*InoxFunction) SmartUnlock

func (fn *InoxFunction) SmartUnlock(state *GlobalState)

func (*InoxFunction) ToSymbolicValue

func (fn *InoxFunction) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*InoxFunction) Watcher

func (f *InoxFunction) Watcher(ctx *Context, config WatcherConfiguration) Watcher

func (*InoxFunction) WriteJSONRepresentation

func (f *InoxFunction) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type InstructionCallbackFn

type InstructionCallbackFn = func(instr []byte, op Opcode, operands []int, constantIndexOperandIndex []int, constants []Value, i int) ([]byte, error)

type Int

type Int int64

Int implements Value.

func (Int) Compare

func (i Int) Compare(other Value) (result int, comparable bool)

func (Int) Equal

func (i Int) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Int) Int64

func (i Int) Int64() int64

func (Int) IsMutable

func (i Int) IsMutable() bool

func (Int) IsRecursivelyRenderable

func (n Int) IsRecursivelyRenderable(ctx *Context, input RenderingInput) bool

func (Int) IsSigned

func (i Int) IsSigned() bool

func (Int) PrettyPrint

func (i Int) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Int) Render

func (n Int) Render(ctx *Context, w io.Writer, config RenderingInput) (int, error)

func (Int) ToSymbolicValue

func (i Int) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Int) WriteJSONRepresentation

func (i Int) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type IntList

type IntList = NumberList[Int]

type IntRange

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

An IntRange represents an int64 range, IntRange implements Value. Inox's integer range literals (e.g. `1..2`) evaluate to an IntRange.

func NewIntRange

func NewIntRange(start, inclusiveEnd int64) IntRange

func NewUnknownStartIntRange

func NewUnknownStartIntRange(end int64) IntRange

func (IntRange) At

func (r IntRange) At(ctx *Context, i int) Value

func (IntRange) Contains

func (r IntRange) Contains(ctx *Context, v Serializable) bool

func (IntRange) Equal

func (r IntRange) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (IntRange) HasKnownStart

func (r IntRange) HasKnownStart() bool

func (IntRange) Includes

func (r IntRange) Includes(ctx *Context, i Int) bool

func (IntRange) InclusiveEnd

func (r IntRange) InclusiveEnd() int64

func (IntRange) IsEmpty

func (r IntRange) IsEmpty(ctx *Context) bool

func (IntRange) IsMutable

func (r IntRange) IsMutable() bool

func (IntRange) Iterator

func (r IntRange) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (IntRange) KnownStart

func (r IntRange) KnownStart() int64

func (IntRange) Len

func (r IntRange) Len() int

Len returns the number of integers in the range if the start (lower bound) is known. Len panics otherwise.

func (IntRange) PrettyPrint

func (r IntRange) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (IntRange) Random

func (r IntRange) Random(ctx *Context) Value

func (IntRange) ToSymbolicValue

func (r IntRange) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (IntRange) WriteJSONRepresentation

func (r IntRange) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type IntRangeIterator

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

func (IntRangeIterator) Equal

func (it IntRangeIterator) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*IntRangeIterator) HasNext

func (it *IntRangeIterator) HasNext(*Context) bool

func (IntRangeIterator) IsMutable

func (it IntRangeIterator) IsMutable() bool

func (*IntRangeIterator) Key

func (it *IntRangeIterator) Key(ctx *Context) Value

func (*IntRangeIterator) Next

func (it *IntRangeIterator) Next(ctx *Context) bool

func (IntRangeIterator) PrettyPrint

func (it IntRangeIterator) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (IntRangeIterator) ToSymbolicValue

func (it IntRangeIterator) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*IntRangeIterator) Value

func (it *IntRangeIterator) Value(*Context) Value

type IntRangePattern

type IntRangePattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

An IntRangePattern represents a pattern matching integers in a given range.

func NewIncludedEndIntRangePattern

func NewIncludedEndIntRangePattern(start, end int64, multipleOf int64) *IntRangePattern

multipleOf is ignored if not greater than zero

func NewIntRangePattern

func NewIntRangePattern(intRange IntRange, multipleOf int64) *IntRangePattern

$multipleOf is ignored if not greater than zero.

func NewIntRangePatternFloatMultiple

func NewIntRangePatternFloatMultiple(intRange IntRange, multipleOf Float) *IntRangePattern

$multipleOf is ignored if not greater than zero.

func NewSingleElementIntRangePattern

func NewSingleElementIntRangePattern(n int64) *IntRangePattern

func (*IntRangePattern) Equal

func (patt *IntRangePattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*IntRangePattern) HasMultipleOfConstraint

func (patt *IntRangePattern) HasMultipleOfConstraint() bool

func (*IntRangePattern) Includes

func (patt *IntRangePattern) Includes(ctx *Context, n Int) bool

func (*IntRangePattern) IsMutable

func (patt *IntRangePattern) IsMutable() bool

func (*IntRangePattern) Iterator

func (patt *IntRangePattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*IntRangePattern) PrettyPrint

func (patt *IntRangePattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*IntRangePattern) Random

func (patt *IntRangePattern) Random(ctx *Context, options ...Option) Value

func (*IntRangePattern) Range

func (patt *IntRangePattern) Range() IntRange

func (*IntRangePattern) StringPattern

func (patt *IntRangePattern) StringPattern() (StringPattern, bool)

func (*IntRangePattern) Test

func (patt *IntRangePattern) Test(ctx *Context, v Value) bool

func (*IntRangePattern) ToSymbolicValue

func (p *IntRangePattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (IntRangePattern) WriteJSONRepresentation

func (p IntRangePattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type IntRangeStringPattern

type IntRangeStringPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

An IntRangeStringPattern matches a string (or substring) representing a decimal integer number in a given range. Example: for the range (-99,99) the found match substrings in the following strings are surrounded by parentheses. positive: (12) (12)- a12 123 12_ 12a a12

negative: (-12) (-12)- -(-12) a(-12) -123 -12_ -12a

func NewIntRangeStringPattern

func NewIntRangeStringPattern(lower, upperIncluded int64, node parse.Node) *IntRangeStringPattern

func (*IntRangeStringPattern) CompiledRegex

func (patt *IntRangeStringPattern) CompiledRegex() *regexp.Regexp

func (*IntRangeStringPattern) EffectiveLengthRange

func (patt *IntRangeStringPattern) EffectiveLengthRange() IntRange

func (*IntRangeStringPattern) Equal

func (patt *IntRangeStringPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*IntRangeStringPattern) FindMatches

func (patt *IntRangeStringPattern) FindMatches(ctx *Context, val Serializable, config MatchesFindConfig) (groups []Serializable, err error)

func (*IntRangeStringPattern) HasRegex

func (patt *IntRangeStringPattern) HasRegex() bool

func (*IntRangeStringPattern) IsMutable

func (patt *IntRangeStringPattern) IsMutable() bool

func (*IntRangeStringPattern) IsResolved

func (patt *IntRangeStringPattern) IsResolved() bool

func (*IntRangeStringPattern) Iterator

func (patt *IntRangeStringPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*IntRangeStringPattern) LengthRange

func (patt *IntRangeStringPattern) LengthRange() IntRange

func (*IntRangeStringPattern) Parse

func (patt *IntRangeStringPattern) Parse(ctx *Context, s string) (Serializable, error)

func (*IntRangeStringPattern) PatternNestingDepth

func (patt *IntRangeStringPattern) PatternNestingDepth(parentDepth int) int

func (*IntRangeStringPattern) PrettyPrint

func (patt *IntRangeStringPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*IntRangeStringPattern) Random

func (pattern *IntRangeStringPattern) Random(ctx *Context, options ...Option) Value

func (*IntRangeStringPattern) Regex

func (patt *IntRangeStringPattern) Regex() string

func (*IntRangeStringPattern) Resolve

func (patt *IntRangeStringPattern) Resolve() (StringPattern, error)

func (*IntRangeStringPattern) StringFrom

func (patt *IntRangeStringPattern) StringFrom(ctx *Context, v Value) (string, error)

func (*IntRangeStringPattern) StringPattern

func (patt *IntRangeStringPattern) StringPattern() (StringPattern, bool)

func (*IntRangeStringPattern) Test

func (patt *IntRangeStringPattern) Test(ctx *Context, v Value) bool

func (*IntRangeStringPattern) ToSymbolicValue

func (p *IntRangeStringPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*IntRangeStringPattern) WriteJSONRepresentation

func (patt *IntRangeStringPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type Integral

type Integral interface {
	Value
	Int64() int64
	IsSigned() bool
}

Integral should be implemented by values representing an integer (int, byte, quantities, ...). Implementations should be immutable.

type InternalPublicationId

type InternalPublicationId int64

type IntersectionPattern

type IntersectionPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

func NewIntersectionPattern

func NewIntersectionPattern(cases []Pattern, node parse.Node) *IntersectionPattern

func (*IntersectionPattern) Equal

func (patt *IntersectionPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*IntersectionPattern) IsMutable

func (patt *IntersectionPattern) IsMutable() bool

func (*IntersectionPattern) Iterator

func (patt *IntersectionPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*IntersectionPattern) PrettyPrint

func (patt *IntersectionPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*IntersectionPattern) Random

func (patt *IntersectionPattern) Random(ctx *Context, options ...Option) Value

func (*IntersectionPattern) StringPattern

func (patt *IntersectionPattern) StringPattern() (StringPattern, bool)

func (*IntersectionPattern) Test

func (patt *IntersectionPattern) Test(ctx *Context, v Value) bool

func (*IntersectionPattern) ToSymbolicValue

func (p *IntersectionPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (IntersectionPattern) WriteJSONRepresentation

func (patt IntersectionPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type IpropsIterator

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

func (*IpropsIterator) Equal

func (it *IpropsIterator) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*IpropsIterator) HasNext

func (it *IpropsIterator) HasNext(*Context) bool

func (*IpropsIterator) IsMutable

func (it *IpropsIterator) IsMutable() bool

func (*IpropsIterator) Key

func (it *IpropsIterator) Key(*Context) Value

func (*IpropsIterator) Next

func (it *IpropsIterator) Next(ctx *Context) bool

func (*IpropsIterator) PrettyPrint

func (it *IpropsIterator) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*IpropsIterator) ToSymbolicValue

func (it *IpropsIterator) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*IpropsIterator) Value

func (it *IpropsIterator) Value(*Context) Value

type Iterable

type Iterable interface {
	Value

	//Iterator should return a new iterator that is not affected by mutations of the iterable.
	//TODO: Update the implementations that currently do not meet this requirement (e.g. *Object).
	Iterator(*Context, IteratorConfiguration) Iterator
}

An Iterable is a Value that provides an iterator. Patterns' implementations can either return an empty iterator or an iterator that loops over values matching the pattern.

type IterationChange

type IterationChange int
const (
	NoIterationChange IterationChange = iota
	BreakIteration
	ContinueIteration
	PruneWalk
)

func (IterationChange) String

func (change IterationChange) String() string

type Iterator

type Iterator interface {
	Value
	HasNext(*Context) bool
	Next(*Context) bool
	Key(*Context) Value
	Value(*Context) Value
}

func NewEventSourceIterator

func NewEventSourceIterator(source EventSource, config IteratorConfiguration) Iterator

func NewIpropsIterator

func NewIpropsIterator(ctx *Context, keys []string, values []Value, config IteratorConfiguration) Iterator

NewIpropsIterator creates an IpropsIterator, the provided keys slice and values slice should not be modified.

type IteratorConfiguration

type IteratorConfiguration struct {
	KeyFilter     Pattern
	ValueFilter   Pattern
	KeysNeverRead bool //indicates that the Iterator.Key method will not be called.
}

func (IteratorConfiguration) CreateIterator

func (config IteratorConfiguration) CreateIterator(base Iterator) Iterator

CreateIterator wraps an iterator in a filtering iterator if necessary

type JSONSerializationConfig

type JSONSerializationConfig struct {
	*ReprConfig
	Pattern  Pattern //nillable
	Location string  //location of the current value being serialized
}

type KeyFilteredIterator

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

func (*KeyFilteredIterator) Equal

func (it *KeyFilteredIterator) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*KeyFilteredIterator) HasNext

func (it *KeyFilteredIterator) HasNext(ctx *Context) bool

func (*KeyFilteredIterator) IsMutable

func (it *KeyFilteredIterator) IsMutable() bool

func (*KeyFilteredIterator) Key

func (it *KeyFilteredIterator) Key(ctx *Context) Value

func (*KeyFilteredIterator) Next

func (it *KeyFilteredIterator) Next(ctx *Context) bool

func (*KeyFilteredIterator) PrettyPrint

func (it *KeyFilteredIterator) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*KeyFilteredIterator) ToSymbolicValue

func (it *KeyFilteredIterator) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*KeyFilteredIterator) Value

func (it *KeyFilteredIterator) Value(ctx *Context) Value

type KeyList

type KeyList []string

func (KeyList) At

func (l KeyList) At(ctx *Context, i int) Value

func (KeyList) Equal

func (list KeyList) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (KeyList) IsMutable

func (list KeyList) IsMutable() bool

func (KeyList) Iterator

func (l KeyList) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (KeyList) Len

func (l KeyList) Len() int

func (KeyList) PrettyPrint

func (list KeyList) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (KeyList) ToSymbolicValue

func (l KeyList) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (KeyList) WriteJSONRepresentation

func (list KeyList) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type KeyValueFilteredIterator

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

func (*KeyValueFilteredIterator) Equal

func (it *KeyValueFilteredIterator) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*KeyValueFilteredIterator) HasNext

func (it *KeyValueFilteredIterator) HasNext(ctx *Context) bool

func (*KeyValueFilteredIterator) IsMutable

func (it *KeyValueFilteredIterator) IsMutable() bool

func (*KeyValueFilteredIterator) Key

func (it *KeyValueFilteredIterator) Key(ctx *Context) Value

func (*KeyValueFilteredIterator) Next

func (it *KeyValueFilteredIterator) Next(ctx *Context) bool

func (*KeyValueFilteredIterator) PrettyPrint

func (it *KeyValueFilteredIterator) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*KeyValueFilteredIterator) ToSymbolicValue

func (it *KeyValueFilteredIterator) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*KeyValueFilteredIterator) Value

func (it *KeyValueFilteredIterator) Value(ctx *Context) Value

type LThread

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

A LThread is similar to a goroutine in Golang, it represents the execution of a single module and can be cancelled at any time. It pauses at each yield statement.

func ImportModule

func ImportModule(config ImportConfig) (*LThread, error)

ImportModule imports a module and returned a spawned lthread running the module.

func SpawnLThread

func SpawnLThread(args LthreadSpawnArgs) (*LThread, error)

SpawnLThread spawns a new lthread, if .LthreadCtx is nil a minimal context is created for the lthread. The provided globals that are not thread safe are wrapped in a SharedValue.

func SpawnLthreadWithState

func SpawnLthreadWithState(args LthreadWithStateSpawnArgs) (*LThread, error)

func (*LThread) Cancel

func (lthread *LThread) Cancel(*Context)

Cancel stops the execution of the lthread.

func (*LThread) Equal

func (r *LThread) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*LThread) GetGoMethod

func (r *LThread) GetGoMethod(name string) (*GoFunction, bool)

func (*LThread) IsDone

func (lthread *LThread) IsDone() bool

Cancel stops the execution of the lthread.

func (*LThread) IsMutable

func (r *LThread) IsMutable() bool

func (*LThread) IsPaused

func (lthread *LThread) IsPaused() bool

func (*LThread) PrettyPrint

func (r *LThread) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*LThread) Prop

func (r *LThread) Prop(ctx *Context, name string) Value

func (*LThread) PropertyNames

func (*LThread) PropertyNames(ctx *Context) []string

func (*LThread) ResumeAsync

func (lthread *LThread) ResumeAsync() error

func (*LThread) SetProp

func (*LThread) SetProp(ctx *Context, name string, value Value) error

func (*LThread) ToSymbolicValue

func (r *LThread) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*LThread) WaitResult

func (lthread *LThread) WaitResult(ctx *Context) (Value, error)

WaitResult waits for the end of the execution and returns the value returned by

type LThreadGroup

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

A LThreadGroup is a group of lthreads, it simplifies the interaction with the lthreads.

func NewLThreadGroup

func NewLThreadGroup(ctx *Context) *LThreadGroup

func (*LThreadGroup) Add

func (group *LThreadGroup) Add(newRt *LThread)

func (*LThreadGroup) CancelAll

func (group *LThreadGroup) CancelAll(*Context)

CancelAll stops the execution of all threads in the group.

func (*LThreadGroup) Equal

func (g *LThreadGroup) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*LThreadGroup) GetGoMethod

func (g *LThreadGroup) GetGoMethod(name string) (*GoFunction, bool)

func (*LThreadGroup) IsMutable

func (g *LThreadGroup) IsMutable() bool

func (*LThreadGroup) PrettyPrint

func (g *LThreadGroup) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*LThreadGroup) Prop

func (g *LThreadGroup) Prop(ctx *Context, name string) Value

func (*LThreadGroup) PropertyNames

func (*LThreadGroup) PropertyNames(ctx *Context) []string

func (*LThreadGroup) SetProp

func (*LThreadGroup) SetProp(ctx *Context, name string, value Value) error

func (*LThreadGroup) ToSymbolicValue

func (g *LThreadGroup) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*LThreadGroup) WaitAllResults

func (group *LThreadGroup) WaitAllResults(ctx *Context) (*Array, error)

WaitAllResults waits for the results of all threads in the group and returns a list of results.

type LThreadPermission

type LThreadPermission struct {
	Kind_ PermissionKind
}

func (LThreadPermission) Includes

func (perm LThreadPermission) Includes(otherPerm Permission) bool

func (LThreadPermission) InternalPermTypename

func (perm LThreadPermission) InternalPermTypename() permkind.InternalPermissionTypename

func (LThreadPermission) Kind

func (perm LThreadPermission) Kind() PermissionKind

func (LThreadPermission) String

func (perm LThreadPermission) String() string

type LThreadSpawnedEvent

type LThreadSpawnedEvent struct {
	StateId StateId `json:"threadId,omitempty"`
}

func (LThreadSpawnedEvent) SecondaryDebugEventType

func (e LThreadSpawnedEvent) SecondaryDebugEventType() SecondaryDebugEventType

type LengthCheckingStringPattern

type LengthCheckingStringPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

LengthCheckingStringPattern matches any StringLikes with a length in a given range.

func NewLengthCheckingStringPattern

func NewLengthCheckingStringPattern(minLength, maxLength int64) *LengthCheckingStringPattern

func (*LengthCheckingStringPattern) CompiledRegex

func (patt *LengthCheckingStringPattern) CompiledRegex() *regexp.Regexp

func (*LengthCheckingStringPattern) EffectiveLengthRange

func (patt *LengthCheckingStringPattern) EffectiveLengthRange() IntRange

func (*LengthCheckingStringPattern) Equal

func (patt *LengthCheckingStringPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*LengthCheckingStringPattern) FindMatches

func (patt *LengthCheckingStringPattern) FindMatches(ctx *Context, val Serializable, config MatchesFindConfig) (groups []Serializable, err error)

func (*LengthCheckingStringPattern) HasRegex

func (pattern *LengthCheckingStringPattern) HasRegex() bool

func (*LengthCheckingStringPattern) IsMutable

func (patt *LengthCheckingStringPattern) IsMutable() bool

func (*LengthCheckingStringPattern) IsResolved

func (pattern *LengthCheckingStringPattern) IsResolved() bool

func (LengthCheckingStringPattern) Iterator

func (*LengthCheckingStringPattern) LengthRange

func (patt *LengthCheckingStringPattern) LengthRange() IntRange

func (*LengthCheckingStringPattern) MatchGroups

func (patt *LengthCheckingStringPattern) MatchGroups(ctx *Context, v Serializable) (map[string]Serializable, bool, error)

func (*LengthCheckingStringPattern) Parse

func (*LengthCheckingStringPattern) PatternNestingDepth

func (patt *LengthCheckingStringPattern) PatternNestingDepth(parentDepth int) int

func (*LengthCheckingStringPattern) PrettyPrint

func (patt *LengthCheckingStringPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (LengthCheckingStringPattern) Random

func (patt LengthCheckingStringPattern) Random(ctx *Context, options ...Option) Value

func (*LengthCheckingStringPattern) Regex

func (pattern *LengthCheckingStringPattern) Regex() string

func (*LengthCheckingStringPattern) Resolve

func (patt *LengthCheckingStringPattern) Resolve() (StringPattern, error)

func (*LengthCheckingStringPattern) StringPattern

func (patt *LengthCheckingStringPattern) StringPattern() (StringPattern, bool)

func (*LengthCheckingStringPattern) Test

func (pattern *LengthCheckingStringPattern) Test(ctx *Context, v Value) bool

func (*LengthCheckingStringPattern) ToSymbolicValue

func (p *LengthCheckingStringPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (LengthCheckingStringPattern) WriteJSONRepresentation

func (patt LengthCheckingStringPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type LifetimeJob

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

A LifetimeJob represents a job associated with a value that runs while the value exists, this struct does not hold any state, see LifetimeJobInstance. LifetimeJob implements Value.

func NewLifetimeJob

func NewLifetimeJob(meta Value, subjectPattern Pattern, mod *Module, bytecode *Bytecode, parentState *GlobalState) (*LifetimeJob, error)

func (*LifetimeJob) Equal

func (j *LifetimeJob) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*LifetimeJob) GetGoMethod

func (j *LifetimeJob) GetGoMethod(name string) (*GoFunction, bool)

func (*LifetimeJob) Instantiate

func (j *LifetimeJob) Instantiate(ctx *Context, self Value) (*LifetimeJobInstance, error)

Instantiate creates a instance of the job with a paused goroutine.

func (*LifetimeJob) IsMutable

func (*LifetimeJob) IsMutable() bool

func (*LifetimeJob) PrettyPrint

func (j *LifetimeJob) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*LifetimeJob) Prop

func (j *LifetimeJob) Prop(ctx *Context, name string) Value

func (*LifetimeJob) PropertyNames

func (*LifetimeJob) PropertyNames(ctx *Context) []string

func (*LifetimeJob) SetProp

func (*LifetimeJob) SetProp(ctx *Context, name string, value Value) error

func (*LifetimeJob) ToSymbolicValue

func (j *LifetimeJob) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*LifetimeJob) WriteJSONRepresentation

func (j *LifetimeJob) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type LifetimeJobInstance

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

type Limit

type Limit struct {
	Name  string
	Kind  LimitKind
	Value int64

	DecrementFn TokenDepletionFn //optional. Called on each tick of the associated bucket's timer.
}

A Limit represents a limit for a running piece of code, for example: the maximum rate of http requests. A Context stores one token bucket for each provided limit. A Limit does not hold any state.

func GetDefaultMaxRequestHandlerLimits

func GetDefaultMaxRequestHandlerLimits() []Limit

func GetDefaultRequestHandlingLimits

func GetDefaultRequestHandlingLimits() []Limit

func GetDefaultScriptLimits

func GetDefaultScriptLimits() []Limit

func GetLimit

func GetLimit(ctx *Context, limitName string, limitValue Serializable) (_ Limit, resultErr error)

func MustMakeNotAutoDepletingCountLimit

func MustMakeNotAutoDepletingCountLimit(limitName string, value int64) Limit

func (Limit) LessOrAsRestrictiveAs

func (l Limit) LessOrAsRestrictiveAs(other Limit) bool

func (Limit) MoreRestrictiveThan

func (l Limit) MoreRestrictiveThan(other Limit) bool

type LimitKind

type LimitKind int

type LineCount

type LineCount int64

LineCount implements Value.

func (LineCount) AsFloat64

func (c LineCount) AsFloat64() (float64, bool)

func (LineCount) AsInt64

func (c LineCount) AsInt64() (int64, bool)

func (LineCount) Compare

func (c LineCount) Compare(other Value) (result int, comparable bool)

func (LineCount) Equal

func (count LineCount) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (LineCount) Int64

func (c LineCount) Int64() int64

func (LineCount) IsMutable

func (count LineCount) IsMutable() bool

func (LineCount) IsSigned

func (c LineCount) IsSigned() bool

func (LineCount) IsZeroQuantity

func (c LineCount) IsZeroQuantity() bool

func (LineCount) PrettyPrint

func (count LineCount) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (LineCount) ToSymbolicValue

func (c LineCount) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (LineCount) WriteJSONRepresentation

func (count LineCount) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type List

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

A List represents a sequence of elements, List implements Value. The elements are stored in an underlyingList that is suited for the number and kind of elements, for example if the elements are all integers the underlying list will (ideally) be an *IntList.

func Filter

func Filter(ctx *Context, iterable Iterable, condition Value) *List

Filter is the value of the 'filter' global.

func GetAtMost

func GetAtMost(ctx *Context, maxCount Int, iterable SerializableIterable) *List

GetAtMost is the value of the 'get_at_most' global.

func MapIterable

func MapIterable(ctx *Context, iterable Iterable, mapper Value) *List

MapIterable is the value of the 'map' global.

func NewWrappedBoolList

func NewWrappedBoolList(elements ...Bool) *List

func NewWrappedFloatList

func NewWrappedFloatList(elements ...Float) *List

func NewWrappedFloatListFrom

func NewWrappedFloatListFrom(elements []Float) *List

func NewWrappedIntList

func NewWrappedIntList(elements ...Int) *List

func NewWrappedIntListFrom

func NewWrappedIntListFrom(elements []Int) *List

func NewWrappedStringList

func NewWrappedStringList(elements ...StringLike) *List

func NewWrappedStringListFrom

func NewWrappedStringListFrom(elements []StringLike) *List

func NewWrappedValueList

func NewWrappedValueList(elements ...Serializable) *List

func NewWrappedValueListFrom

func NewWrappedValueListFrom(elements []Serializable) *List

func WrapUnderlyingList

func WrapUnderlyingList(l underlyingList) *List

func (*List) Clone

func (list *List) Clone(originState *GlobalState, sharableValues *[]PotentiallySharable, clones map[uintptr]Clonable, depth int) (Serializable, error)

func (*List) Contains

func (l *List) Contains(ctx *Context, value Serializable) bool

func (*List) Dequeue

func (l *List) Dequeue(ctx *Context) Serializable

func (*List) Equal

func (list *List) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*List) GetOrBuildElements

func (list *List) GetOrBuildElements(ctx *Context) []Serializable

the caller can modify the result.

func (*List) IsEmpty

func (l *List) IsEmpty(ctx *Context) bool

func (*List) IsMutable

func (list *List) IsMutable() bool

func (*List) IsRecursivelyRenderable

func (list *List) IsRecursivelyRenderable(ctx *Context, input RenderingInput) bool

func (*List) Iterator

func (list *List) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*List) Migrate

func (list *List) Migrate(ctx *Context, key Path, migration *FreeEntityMigrationArgs) (Value, error)

func (*List) OnMutation

func (l *List) OnMutation(ctx *Context, microtask MutationCallbackMicrotask, config MutationWatchingConfiguration) (CallbackHandle, error)

func (*List) Pop

func (l *List) Pop(ctx *Context) Serializable

func (*List) PrettyPrint

func (list *List) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*List) Prop

func (l *List) Prop(ctx *Context, name string) Value

func (*List) PropertyNames

func (*List) PropertyNames(ctx *Context) []string

func (*List) RemoveMutationCallback

func (l *List) RemoveMutationCallback(ctx *Context, handle CallbackHandle)

func (*List) RemoveMutationCallbackMicrotasks

func (l *List) RemoveMutationCallbackMicrotasks(ctx *Context)

func (*List) Render

func (list *List) Render(ctx *Context, w io.Writer, config RenderingInput) (int, error)

func (*List) SetProp

func (*List) SetProp(ctx *Context, name string, value Value) error

func (*List) SetSlice

func (l *List) SetSlice(ctx *Context, start, end int, seq Sequence)

func (*List) SortBy

func (l *List) SortBy(ctx *Context, path ValuePath, orderIdent Identifier)

func (*List) Sorted

func (l *List) Sorted(ctx *Context, orderIdent Identifier) *List

func (*List) ToSymbolicValue

func (l *List) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*List) Watcher

func (list *List) Watcher(ctx *Context, config WatcherConfiguration) Watcher

func (*List) WriteJSONRepresentation

func (list *List) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type ListPattern

type ListPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

A ListPattern represents a pattern matching Inox lists (e.g. [1, 2]), ListPattern implements Value.

func NewListPattern

func NewListPattern(elementPatterns []Pattern) *ListPattern

func NewListPatternOf

func NewListPatternOf(generalElementPattern Pattern) *ListPattern

func NewListPatternVariadic

func NewListPatternVariadic(elementPatterns ...Pattern) *ListPattern

func (*ListPattern) DefaultValue

func (patt *ListPattern) DefaultValue(ctx *Context) (Value, error)

func (*ListPattern) ElementPatternAt

func (patt *ListPattern) ElementPatternAt(i int) (Pattern, bool)

func (*ListPattern) Equal

func (patt *ListPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ListPattern) ExactElementCount

func (patt *ListPattern) ExactElementCount() (int, bool)

func (*ListPattern) GetMigrationOperations

func (patt *ListPattern) GetMigrationOperations(ctx *Context, next Pattern, pseudoPath string) (migrations []MigrationOp, _ error)

func (*ListPattern) IsMutable

func (patt *ListPattern) IsMutable() bool

func (ListPattern) Iterator

func (patt ListPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*ListPattern) MaxElementCount

func (patt *ListPattern) MaxElementCount() int

MaxElementCount returns the maximum number of elements if it is defined. The function panics otherwise. The maximum is not defined for most patterns with an exact number of elements.

func (*ListPattern) MinElementCount

func (patt *ListPattern) MinElementCount() int

MinElementCount returns the minimum number of elements if it is defined. The function panics otherwise. The minimum is not defined for list patterns with an exact number of elements.

func (ListPattern) PrettyPrint

func (patt ListPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (ListPattern) Random

func (patt ListPattern) Random(ctx *Context, options ...Option) Value

func (*ListPattern) StringPattern

func (patt *ListPattern) StringPattern() (StringPattern, bool)

func (ListPattern) Test

func (patt ListPattern) Test(ctx *Context, v Value) bool

func (*ListPattern) ToSymbolicValue

func (p *ListPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*ListPattern) WithElement

func (patt *ListPattern) WithElement(element Pattern) *ListPattern

WithMinMaxElements return a new version of the pattern that expects at least one occurrence of element.

func (*ListPattern) WithMinElements

func (patt *ListPattern) WithMinElements(minCount int) *ListPattern

WithMinMaxElements return a new version of the pattern with the given minimum count constraints.

func (*ListPattern) WithMinMaxElements

func (patt *ListPattern) WithMinMaxElements(minCount, maxCount int) *ListPattern

WithMinMaxElements return a new version of the pattern with the given minimum & maximum element count constraints.

func (ListPattern) WriteJSONRepresentation

func (patt ListPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type LiteTransactionIsolator

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

func (*LiteTransactionIsolator) WaitForOtherReadWriteTxToTerminate

func (isolator *LiteTransactionIsolator) WaitForOtherReadWriteTxToTerminate(ctx *Context, requireRunningTx bool) (currentTx *Transaction, _ error)

WaitForOtherReadWriteTxToTerminate waits for the currently tracked read-write transaction to terminate if the context's transaction is read-write. The function does not wait if no read-write transaction is tracked, or if the context's transaction is readonly. When the currently tracked read-write transaction terminates, a random transaction among all waiting transactions resumes. In other words the first transaction to start waiting is not necessarily the one to resume first. TODO: AVOID STARVATION.

type LoadSelfManagedEntityFn

type LoadSelfManagedEntityFn func(ctx *Context, args FreeEntityLoadingParams) (UrlHolder, error)

LoadSelfManagedEntityFn should load a self-managed entity and should call the corresponding migration handlers. In the case of a deletion (nil, nil) should be returned. If the entity changes due to a migration this function should call LoadSelfManagedEntityFn with the new value passed in .InitialValue.

type LocalSecondaryChunkParsingConfig

type LocalSecondaryChunkParsingConfig struct {
	ChunkFilepath                       string
	Module                              *Module
	Context                             *Context
	ImportPosition                      parse.SourcePositionRange
	RecoverFromNonExistingIncludedFiles bool
}

type LocatedEvalError

type LocatedEvalError struct {
	Message  string
	Location parse.SourcePositionStack
	// contains filtered or unexported fields
}

func (LocatedEvalError) LocationStack

func (err LocatedEvalError) LocationStack() parse.SourcePositionStack

func (LocatedEvalError) MessageWithoutLocation

func (err LocatedEvalError) MessageWithoutLocation() string

func (LocatedEvalError) Unwrap

func (e LocatedEvalError) Unwrap() error

type LockedContextData

type LockedContextData struct {
	NamedPatterns     map[string]Pattern
	PatternNamespaces map[string]*PatternNamespace
	HostAliases       map[string]Host
}

type LogLevels

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

func NewLogLevels

func NewLogLevels(init LogLevelsInitialization) *LogLevels

func (*LogLevels) AreInternalDebugLogsEnabled

func (l *LogLevels) AreInternalDebugLogsEnabled() bool

func (*LogLevels) LevelFor

func (l *LogLevels) LevelFor(resourceName ResourceName) zerolog.Level

type LogLevelsInitialization

type LogLevelsInitialization struct {
	DefaultLevel            zerolog.Level
	ByPath                  map[Path]zerolog.Level //nil is accepted
	EnableInternalDebugLogs bool                   //ignored if DefaultLevel != debug
}

type LongValuePath

type LongValuePath []ValuePathSegment

A LongValuePath represents a path (>= 2 segments) to a value in a structure, LongValuePath implements Value.

func NewLongValuePath

func NewLongValuePath(segments []ValuePathSegment) *LongValuePath

func (*LongValuePath) Equal

func (p *LongValuePath) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*LongValuePath) GetFrom

func (p *LongValuePath) GetFrom(ctx *Context, v Value) Value

func (*LongValuePath) IsMutable

func (p *LongValuePath) IsMutable() bool

func (*LongValuePath) PrettyPrint

func (p *LongValuePath) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*LongValuePath) ToSymbolicValue

func (p *LongValuePath) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*LongValuePath) Validate

func (p *LongValuePath) Validate() error

func (*LongValuePath) WriteJSONRepresentation

func (p *LongValuePath) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type LoopKind

type LoopKind int
const (
	ForLoop LoopKind = iota
	WalkLoop
)

type LthreadSpawnArgs

type LthreadSpawnArgs struct {
	SpawnerState *GlobalState
	Globals      GlobalVariables
	NewGlobals   []string //listed globals are not shared nor cloned.

	Module     *Module
	Manifest   *Manifest
	LthreadCtx *Context

	Logger zerolog.Logger //defaults to spawner's logger

	IsTestingEnabled bool
	TestFilters      TestFilters
	TestItem         TestItem
	TestedProgram    *Module

	//AbsScriptDir string
	Bytecode    *Bytecode
	UseBytecode bool
	StartPaused bool
	Self        Value
	Timeout     time.Duration

	// Even if true a token is taken for the threads/simul-instances limit
	IgnoreCreateLThreadPermCheck bool
	PauseAfterYield              bool
}

type LthreadWithStateSpawnArgs

type LthreadWithStateSpawnArgs struct {
	Timeout         time.Duration
	SpawnerState    *GlobalState
	State           *GlobalState
	UseBytecode     bool
	PauseAfterYield bool
	StartPaused     bool

	Self Value
}

type Manifest

type Manifest struct {

	//note: permissions required for reading the preinit files are in .PreinitFiles.
	RequiredPermissions []Permission
	Limits              []Limit

	HostDefinitions map[Host]Value
	EnvPattern      *ObjectPattern
	Parameters      ModuleParameters
	PreinitFiles    PreinitFiles
	Databases       DatabaseConfigs
	AutoInvocation  *AutoInvocationConfig //can be nil

	InitialWorkingDirectory Path
	// contains filtered or unexported fields
}

A Manifest contains most of the user-defined metadata about a Module.

func NewEmptyManifest

func NewEmptyManifest() *Manifest

func (*Manifest) ArePermsGranted

func (m *Manifest) ArePermsGranted(grantedPerms []Permission, forbiddenPermissions []Permission) (b bool, missingPermissions []Permission)

func (*Manifest) OwnedDatabases

func (m *Manifest) OwnedDatabases() []DatabaseConfig

func (*Manifest) RequiresPermission

func (m *Manifest) RequiresPermission(perm Permission) bool

func (*Manifest) Usage

func (m *Manifest) Usage(ctx *Context) string

type Mapping

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

func NewMapping

func NewMapping(expr *parse.MappingExpression, state *GlobalState) (*Mapping, error)

func (*Mapping) Compute

func (m *Mapping) Compute(ctx *Context, key Serializable) Value

func (*Mapping) Equal

func (m *Mapping) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Mapping) GetGoMethod

func (m *Mapping) GetGoMethod(name string) (*GoFunction, bool)

func (*Mapping) IsMutable

func (m *Mapping) IsMutable() bool

func (*Mapping) IsSharable

func (m *Mapping) IsSharable(originState *GlobalState) (bool, string)

func (*Mapping) IsShared

func (m *Mapping) IsShared() bool

func (*Mapping) PrettyPrint

func (m *Mapping) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*Mapping) Prop

func (m *Mapping) Prop(ctx *Context, name string) Value

func (*Mapping) PropertyNames

func (*Mapping) PropertyNames(ctx *Context) []string

func (*Mapping) SetProp

func (*Mapping) SetProp(ctx *Context, name string, value Value) error

func (*Mapping) Share

func (m *Mapping) Share(originState *GlobalState)

func (*Mapping) SmartLock

func (*Mapping) SmartLock(state *GlobalState)

func (*Mapping) SmartUnlock

func (*Mapping) SmartUnlock(state *GlobalState)

func (*Mapping) ToSymbolicValue

func (m *Mapping) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*Mapping) WriteJSONRepresentation

func (m *Mapping) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type MappingStaticData

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

type MatchesFindConfig

type MatchesFindConfig struct {
	Kind MatchesFindConfigKind
}

type MatchesFindConfigKind

type MatchesFindConfigKind int
const (
	FindFirstMatch MatchesFindConfigKind = iota
	FindAllMatches
)

type Message

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

A Message is an immutable package around an immutable piece of data sent by a sender to a MessageReceiver, Message implements Value.

func NewMessage

func NewMessage(data Value, sender Value) Message

func (Message) Data

func (m Message) Data() Value

func (Message) Equal

func (msg Message) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Message) IsMutable

func (Message) IsMutable() bool

func (Message) PrettyPrint

func (m Message) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Message) Prop

func (m Message) Prop(ctx *Context, name string) Value

func (Message) PropertyNames

func (Message) PropertyNames(ctx *Context) []string

func (Message) SetProp

func (Message) SetProp(ctx *Context, name string, value Value) error

func (Message) ToSymbolicValue

func (m Message) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type MessageReceiver

type MessageReceiver interface {
	SystemGraphNodeValue
	ReceiveMessage(ctx *Context, msg Message) error
}

type MigrationAwarePattern

type MigrationAwarePattern interface {
	Pattern
	GetMigrationOperations(ctx *Context, next Pattern, pseudoPath string) ([]MigrationOp, error)
}

TODO: improve name

type MigrationCapable

type MigrationCapable interface {
	Serializable

	//Migrate recursively perfoms a migration, it calls the passed handlers,
	//if a migration operation is a deletion of the MigrationCapable nil should be returned.
	//This method should be called before any change to the MigrationCapable.
	Migrate(ctx *Context, key Path, migration *FreeEntityMigrationArgs) (Value, error)
}

type MigrationMixin

type MigrationMixin struct {
	PseudoPath string
}

func (MigrationMixin) GetPseudoPath

func (m MigrationMixin) GetPseudoPath() string

type MigrationOp

type MigrationOp interface {
	GetPseudoPath() string
	ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) symbolic.MigrationOp
}

func GetMigrationOperations

func GetMigrationOperations(ctx *Context, current, next Pattern, pseudoPath string) ([]MigrationOp, error)

func GetTopLevelEntitiesMigrationOperations

func GetTopLevelEntitiesMigrationOperations(ctx *Context, current, next *ObjectPattern) ([]MigrationOp, error)

type MigrationOpHandler

type MigrationOpHandler struct {
	//ignored if InitialValue is set
	Function     *InoxFunction
	InitialValue Serializable
}

func (MigrationOpHandler) GetResult

func (h MigrationOpHandler) GetResult(ctx *Context, state *GlobalState) Value

type MigrationOpHandlers

type MigrationOpHandlers struct {
	Deletions       map[PathPattern]*MigrationOpHandler //handler can be nil
	Inclusions      map[PathPattern]*MigrationOpHandler
	Replacements    map[PathPattern]*MigrationOpHandler
	Initializations map[PathPattern]*MigrationOpHandler
}

func (MigrationOpHandlers) FilterByPrefix

func (handlers MigrationOpHandlers) FilterByPrefix(path Path) MigrationOpHandlers

func (MigrationOpHandlers) FilterTopLevel

func (handlers MigrationOpHandlers) FilterTopLevel() MigrationOpHandlers

type MigrationOpKind

type MigrationOpKind int
const (
	RemovalMigrationOperation MigrationOpKind = iota + 1
	ReplacementMigrationOperation
	InclusionMigrationOperation
	InitializationMigrationOperation
)

type Mimetype

type Mimetype string

A Mimetype represents a MIME type, it can include parameters. Mimetype implements Value.

func GetMimeTypeFromExtension

func GetMimeTypeFromExtension(extensionWithDot string) (Mimetype, bool)

func MimeTypeFrom

func MimeTypeFrom(s string) (Mimetype, error)

MimeTypeFrom checks that s is a valid mime type and returns a normalized Mimetype.

func (Mimetype) Equal

func (mt Mimetype) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Mimetype) IsMutable

func (mt Mimetype) IsMutable() bool

func (Mimetype) PrettyPrint

func (mt Mimetype) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Mimetype) ToSymbolicValue

func (t Mimetype) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Mimetype) UnderlyingString

func (mt Mimetype) UnderlyingString() string

func (Mimetype) WithoutParams

func (mt Mimetype) WithoutParams() Mimetype

func (Mimetype) WriteJSONRepresentation

func (mt Mimetype) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type Module

type Module struct {
	ModuleKind

	MainChunk *parse.ParsedChunkSource

	IncludedChunkForest        []*IncludedChunk
	FlattenedIncludedChunkList []*IncludedChunk
	InclusionStatementMap      map[*parse.InclusionImportStatement]*IncludedChunk
	IncludedChunkMap           map[string]*IncludedChunk

	DirectlyImportedModules            map[string]*Module
	DirectlyImportedModulesByStatement map[*parse.ImportStatement]*Module

	ManifestTemplate *parse.Manifest

	ParsingErrors         []Error
	ParsingErrorPositions []parse.SourcePositionRange
	OriginalErrors        []*parse.ParsingError //len(.OriginalErrors) <= len(.ParsingErrors)
	// contains filtered or unexported fields
}

A Module represents an Inox module, it does not hold any state and should NOT be modified. Module implements Value.

func ParseInMemoryModule

func ParseInMemoryModule(codeString String, config InMemoryModuleParsingConfig) (*Module, error)

func ParseLocalModule

func ParseLocalModule(fpath string, config ModuleParsingConfig) (*Module, error)

func ParseModuleFromSource

func ParseModuleFromSource(src parse.ChunkSource, resource ResourceName, config ModuleParsingConfig) (*Module, error)

func (*Module) AbsoluteSource

func (mod *Module) AbsoluteSource() (ResourceName, bool)

AbsoluteSource returns the absolute resource name (URL or absolute path) of the module. If the module is embedded or has an in-memory source then (nil, false) is returned.

func (*Module) Equal

func (m *Module) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Module) GetGoMethod

func (*Module) GetGoMethod(name string) (*GoFunction, bool)

func (*Module) HasURLSource

func (mod *Module) HasURLSource() bool

func (*Module) ImportStatements

func (mod *Module) ImportStatements() (imports []*parse.ImportStatement)

ImportStatements returns the top-level import statements.

func (*Module) IsMutable

func (*Module) IsMutable() bool

func (*Module) Name

func (mod *Module) Name() string

func (*Module) ParameterNames

func (mod *Module) ParameterNames() (names []string)

func (*Module) ParsingErrorTuple

func (m *Module) ParsingErrorTuple() *Tuple

func (*Module) PreInit

func (m *Module) PreInit(preinitArgs PreinitArgs) (_ *Manifest, usedRunningState *TreeWalkState, _ []*StaticCheckError, preinitErr error)

PreInit performs the pre-initialization of the module: 1) the pre-init block is statically checked (if present). 2) the manifest's object literal is statically checked. 3) if .RunningState is not nil go to 10) 4) else (.RunningState is nil) a temporary context & state are created. 5) pre-evaluate the env section of the manifest. 6) pre-evaluate the preinit-files section of the manifest. 7) read & parse the preinit-files using the provided .PreinitFilesystem. 8) evaluate & define the global constants (const ....). 9) evaluate the preinit block. 10) evaluate the manifest's object literal. 11) create the manifest.

If an error occurs at any step, the function returns.

func (*Module) PrettyPrint

func (m *Module) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*Module) Prop

func (m *Module) Prop(ctx *Context, name string) Value

func (*Module) PropertyNames

func (*Module) PropertyNames(ctx *Context) []string

func (*Module) SetProp

func (*Module) SetProp(ctx *Context, name string, value Value) error

func (*Module) ToSymbolic

func (mod *Module) ToSymbolic() *symbolic.Module

func (*Module) ToSymbolicValue

func (m *Module) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type ModuleArgs

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

ModuleArgs contains the arguments passed to a module, ModuleArgs implements Value.

func NewEmptyModuleArgs

func NewEmptyModuleArgs() *ModuleArgs

func NewModuleArgs

func NewModuleArgs(fields map[string]Value) *ModuleArgs

func (*ModuleArgs) Clone

func (s *ModuleArgs) Clone(originState *GlobalState, sharableValues *[]PotentiallySharable, clones map[uintptr]Clonable, depth int) (Value, error)

func (*ModuleArgs) Equal

func (s *ModuleArgs) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ModuleArgs) ForEachField

func (s *ModuleArgs) ForEachField(fn func(fieldName string, fieldValue Value) error) error

func (*ModuleArgs) IsMutable

func (s *ModuleArgs) IsMutable() bool

func (*ModuleArgs) PrettyPrint

func (s *ModuleArgs) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*ModuleArgs) Prop

func (s *ModuleArgs) Prop(ctx *Context, name string) Value

func (*ModuleArgs) PropertyNames

func (s *ModuleArgs) PropertyNames(*Context) []string

func (*ModuleArgs) SetProp

func (s *ModuleArgs) SetProp(ctx *Context, name string, value Value) error

func (*ModuleArgs) ToSymbolicValue

func (args *ModuleArgs) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*ModuleArgs) ValueMap

func (s *ModuleArgs) ValueMap() map[string]Value

type ModuleComptimeTypes

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

type ModuleHeap

type ModuleHeap struct {
	Alloc      func(size int, alignment int) HeapAddress
	DeallocAll func()
}

func NewArenaHeap

func NewArenaHeap(initialCapacity int) *ModuleHeap

type ModuleKind

type ModuleKind int
const (
	UnspecifiedModuleKind ModuleKind = iota
	SpecModule                       //.spec.ix file
	ApplicationModule

	UserLThreadModule
	TestSuiteModule
	TestCaseModule
	LifetimeJobModule
)

func ParseModuleKind

func ParseModuleKind(s string) (ModuleKind, error)

func (ModuleKind) IsEmbedded

func (k ModuleKind) IsEmbedded() bool

func (ModuleKind) IsTestModule

func (k ModuleKind) IsTestModule() bool

func (ModuleKind) String

func (k ModuleKind) String() string

type ModuleParameter

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

func (ModuleParameter) CliArgNames

func (p ModuleParameter) CliArgNames() string

func (ModuleParameter) DefaultValue

func (p ModuleParameter) DefaultValue(ctx *Context) (Value, bool)

func (ModuleParameter) GetArgumentFromCliArg

func (p ModuleParameter) GetArgumentFromCliArg(ctx *Context, s string) (v Serializable, handled bool, err error)

func (ModuleParameter) GetRestArgumentFromCliArgs

func (p ModuleParameter) GetRestArgumentFromCliArgs(ctx *Context, args []string) (v Value, err error)

func (ModuleParameter) Name

func (p ModuleParameter) Name() string

func (ModuleParameter) Pattern

func (p ModuleParameter) Pattern() Pattern

func (ModuleParameter) RequiredOnCLI

func (p ModuleParameter) RequiredOnCLI(ctx *Context) bool

func (ModuleParameter) StringifiedPattern

func (p ModuleParameter) StringifiedPattern() string

func (ModuleParameter) StringifiedPatternNoPercent

func (p ModuleParameter) StringifiedPatternNoPercent() string

type ModuleParameters

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

func (*ModuleParameters) GetArgumentsFromCliArgs

func (p *ModuleParameters) GetArgumentsFromCliArgs(ctx *Context, cliArgs []string) (*ModuleArgs, error)

func (*ModuleParameters) GetArgumentsFromObject

func (p *ModuleParameters) GetArgumentsFromObject(ctx *Context, argObj *Object) (*ModuleArgs, error)

func (*ModuleParameters) GetArgumentsFromStruct

func (p *ModuleParameters) GetArgumentsFromStruct(ctx *Context, argStruct *ModuleArgs) (*ModuleArgs, error)

func (*ModuleParameters) GetSymbolicArguments

func (p *ModuleParameters) GetSymbolicArguments(ctx *Context) *symbolic.ModuleArgs

func (ModuleParameters) NoParameters

func (p ModuleParameters) NoParameters() bool

func (*ModuleParameters) NonPositionalParameters

func (p *ModuleParameters) NonPositionalParameters() []ModuleParameter

func (*ModuleParameters) PositionalParameters

func (p *ModuleParameters) PositionalParameters() []ModuleParameter

type ModuleParamsPattern

type ModuleParamsPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

A ModuleParamsPattern is pattern for ModuleArgs values.

func NewModuleParamsPattern

func NewModuleParamsPattern(
	keys []string,
	types []Pattern,
) *ModuleParamsPattern

func (*ModuleParamsPattern) Equal

func (p *ModuleParamsPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ModuleParamsPattern) IsMutable

func (*ModuleParamsPattern) IsMutable() bool

func (*ModuleParamsPattern) Iterator

func (patt *ModuleParamsPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*ModuleParamsPattern) PrettyPrint

func (p *ModuleParamsPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*ModuleParamsPattern) Random

func (patt *ModuleParamsPattern) Random(ctx *Context, options ...Option) Value

func (*ModuleParamsPattern) StringPattern

func (*ModuleParamsPattern) StringPattern() (StringPattern, bool)

func (*ModuleParamsPattern) Test

func (p *ModuleParamsPattern) Test(ctx *Context, v Value) bool

func (*ModuleParamsPattern) ToSymbolicValue

func (s *ModuleParamsPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*ModuleParamsPattern) WriteJSONRepresentation

func (p *ModuleParamsPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type ModuleParsingConfig

type ModuleParsingConfig struct {
	Context *Context //this context is used for checking permissions + getting the filesystem

	RecoverFromNonExistingIncludedFiles bool
	IgnoreBadlyConfiguredModuleImports  bool
	InsecureModImports                  bool
	// contains filtered or unexported fields
}

type ModulePreparationArgs

type ModulePreparationArgs struct {
	//path of the script in the .ParsingCompilationContext's filesystem.
	Fpath string

	//if not nil the module is not parsed and this value is used.
	CachedModule *Module

	// enable data extraction mode, this mode allows some errors.
	// this mode is intended to be used by the LSP server.
	DataExtractionMode bool

	AllowMissingEnvVars     bool
	FullAccessToDatabases   bool
	ForceExpectSchemaUpdate bool

	EnableTesting bool
	TestFilters   TestFilters

	// If set this function is called just before the context creation,
	// the preparation is aborted if an error is returned.
	// The returned limits are used instead of the manifest limits.
	BeforeContextCreation func(*Manifest) ([]Limit, error)

	CliArgs []string
	Args    *ModuleArgs
	// if set the result of the function is used instead of .Args
	GetArguments func(*Manifest) (*ModuleArgs, error)

	ParsingCompilationContext *Context //always necessary even if .CachedModule is set
	ParentContext             *Context
	ParentContextRequired     bool
	UseParentStateAsMainState bool

	//should not be set if ParentContext is set
	StdlibCtx context.Context

	//Limits that are not in this list nor in the prepared module's manifest will be initialized
	//with the minimum value.
	DefaultLimits []Limit

	//should not be set if ParentContext is set
	AdditionalPermissions []Permission

	//should only be set if the module is a main module
	Project Project

	//defaults to os.Stdout
	Out io.Writer

	//defaults to Out, ignored if .Logger is set
	LogOut    io.Writer
	Logger    zerolog.Logger
	LogLevels *LogLevels

	//used during the preinit
	PreinitFilesystem afs.Filesystem

	//Used to create the context.
	//If nil the parent context's filesystem is used.
	ScriptContextFileSystem afs.Filesystem

	AdditionalGlobalsTestOnly map[string]Value
}

type ModulePriority

type ModulePriority uint32

type ModuleRetrievalError

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

func (ModuleRetrievalError) Error

func (err ModuleRetrievalError) Error() string

type MutableLengthSequence

type MutableLengthSequence interface {
	MutableSequence
	// contains filtered or unexported methods
}

type MutableSequence

type MutableSequence interface {
	Sequence

	SetSlice(ctx *Context, start, end int, v Sequence)
	// contains filtered or unexported methods
}

A MutableSequence is a mutable sequence of Inox values, the number of elements cannot be necessarily changed.

type Mutation

type Mutation struct {
	Kind                    MutationKind
	Complete                bool                    // true if the Mutation contains all the data necessary to be applied
	SpecificMutationVersion SpecificMutationVersion // set only if specific mutation
	SpecificMutationKind    SpecificMutationKind    // set only if specific mutation
	Tx                      *Transaction

	Data               []byte
	DataElementLengths [6]int32
	Path               Path // can be empty
	Depth              WatchingDepth
}

A Mutation stores the data (or part of the data) about the modification of a value, it is immutable and implements Value.

func NewAddEntryMutation

func NewAddEntryMutation(ctx *Context, key, value Serializable, depth WatchingDepth, path Path) Mutation

func NewAddPropMutation

func NewAddPropMutation(ctx *Context, name string, value Serializable, depth WatchingDepth, path Path) Mutation

func NewInsertElemAtIndexMutation

func NewInsertElemAtIndexMutation(ctx *Context, index int, elem Serializable, depth WatchingDepth, path Path) Mutation

func NewInsertSequenceAtIndexMutation

func NewInsertSequenceAtIndexMutation(ctx *Context, index int, seq Sequence, depth WatchingDepth, path Path) Mutation

func NewRemovePositionMutation

func NewRemovePositionMutation(ctx *Context, index int, depth WatchingDepth, path Path) Mutation

func NewRemovePositionRangeMutation

func NewRemovePositionRangeMutation(ctx *Context, intRange IntRange, depth WatchingDepth, path Path) Mutation

func NewSetElemAtIndexMutation

func NewSetElemAtIndexMutation(ctx *Context, index int, elem Serializable, depth WatchingDepth, path Path) Mutation

func NewSetSliceAtRangeMutation

func NewSetSliceAtRangeMutation(ctx *Context, intRange IntRange, slice Serializable, depth WatchingDepth, path Path) Mutation

func NewSpecificIncompleteNoDataMutation

func NewSpecificIncompleteNoDataMutation(meta SpecificMutationMetadata) Mutation

func NewSpecificMutation

func NewSpecificMutation(ctx *Context, meta SpecificMutationMetadata, values ...Serializable) Mutation

func NewUnspecifiedMutation

func NewUnspecifiedMutation(depth WatchingDepth, path Path) Mutation

func NewUpdateEntryMutation

func NewUpdateEntryMutation(ctx *Context, key, newValue Serializable, depth WatchingDepth, path Path) Mutation

func NewUpdatePropMutation

func NewUpdatePropMutation(ctx *Context, name string, newValue Serializable, depth WatchingDepth, path Path) Mutation

func (Mutation) AffectedIndex

func (m Mutation) AffectedIndex(ctx *Context) Int

func (Mutation) AffectedProperty

func (m Mutation) AffectedProperty(ctx *Context) string

func (Mutation) AffectedRange

func (m Mutation) AffectedRange(ctx *Context) IntRange

func (Mutation) ApplyTo

func (m Mutation) ApplyTo(ctx *Context, v Value) error

func (Mutation) DataElem

func (m Mutation) DataElem(ctx *Context, index int) Value

func (Mutation) Element

func (m Mutation) Element(ctx *Context) Value

func (Mutation) Equal

func (m Mutation) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Mutation) IsMutable

func (m Mutation) IsMutable() bool

func (Mutation) PrettyPrint

func (m Mutation) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Mutation) PropValue

func (m Mutation) PropValue(ctx *Context) Value

func (Mutation) Relocalized

func (m Mutation) Relocalized(parent Path) Mutation

func (Mutation) Sequence

func (m Mutation) Sequence(ctx *Context) Sequence

func (Mutation) ToSymbolicValue

func (m Mutation) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type MutationCallbackMicrotask

type MutationCallbackMicrotask func(
	ctx *Context,
	mutation Mutation,
) (registerAgain bool)

type MutationCallbacks

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

MutationCallbacks is used by watchables that implement OnMutation.

func NewMutationCallbacks

func NewMutationCallbacks() *MutationCallbacks

func (*MutationCallbacks) AddMicrotask

func (*MutationCallbacks) CallMicrotasks

func (c *MutationCallbacks) CallMicrotasks(ctx *Context, m Mutation)

CallMicrotasks calls the registered tasks that have a configured depth greater or equal to the depth at which the mutation happened (depth argument).

func (*MutationCallbacks) Functions

func (c *MutationCallbacks) Functions() []mutationCallback

func (*MutationCallbacks) RemoveMicrotask

func (c *MutationCallbacks) RemoveMicrotask(handle CallbackHandle)

func (*MutationCallbacks) RemoveMicrotasks

func (c *MutationCallbacks) RemoveMicrotasks()

type MutationKind

type MutationKind int
const (
	UnspecifiedMutation MutationKind = iota + 1
	AddProp
	UpdateProp
	AddEntry
	UpdateEntry
	InsertElemAtIndex
	SetElemAtIndex
	SetSliceAtRange
	InsertSequenceAtIndex
	RemovePosition
	RemovePositionRange
	SpecificMutation
)

func (MutationKind) String

func (k MutationKind) String() string

type MutationPattern

type MutationPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

func NewMutationPattern

func NewMutationPattern(kind MutationKind, data0Pattern Pattern) *MutationPattern

func (*MutationPattern) Equal

func (patt *MutationPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*MutationPattern) IsMutable

func (patt *MutationPattern) IsMutable() bool

func (*MutationPattern) Iterator

func (patt *MutationPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*MutationPattern) PrettyPrint

func (patt *MutationPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*MutationPattern) Random

func (patt *MutationPattern) Random(ctx *Context, options ...Option) Value

func (*MutationPattern) StringPattern

func (patt *MutationPattern) StringPattern() (StringPattern, bool)

func (*MutationPattern) Test

func (patt *MutationPattern) Test(ctx *Context, v Value) bool

func (*MutationPattern) ToSymbolicValue

func (p *MutationPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*MutationPattern) WriteJSONRepresentation

func (patt *MutationPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type MutationWatchingConfiguration

type MutationWatchingConfiguration struct {
	Depth WatchingDepth
}

type NamedSegmentPathPattern

type NamedSegmentPathPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

A NamedSegmentPathPattern is a path pattern with named sections, NamedSegmentPathPattern implements GroupPattern.

func (*NamedSegmentPathPattern) Equal

func (patt *NamedSegmentPathPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*NamedSegmentPathPattern) FindGroupMatches

func (patt *NamedSegmentPathPattern) FindGroupMatches(*Context, Serializable, GroupMatchesFindConfig) (groups []*Object, err error)

func (*NamedSegmentPathPattern) IsMutable

func (patt *NamedSegmentPathPattern) IsMutable() bool

func (*NamedSegmentPathPattern) Iterator

func (patt *NamedSegmentPathPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*NamedSegmentPathPattern) MatchGroups

func (patt *NamedSegmentPathPattern) MatchGroups(ctx *Context, v Serializable) (map[string]Serializable, bool, error)

func (*NamedSegmentPathPattern) PrettyPrint

func (patt *NamedSegmentPathPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*NamedSegmentPathPattern) Prop

func (patt *NamedSegmentPathPattern) Prop(ctx *Context, name string) Value

func (*NamedSegmentPathPattern) PropertyNames

func (patt *NamedSegmentPathPattern) PropertyNames(ctx *Context) []string

func (*NamedSegmentPathPattern) Random

func (pattern *NamedSegmentPathPattern) Random(ctx *Context, options ...Option) Value

func (*NamedSegmentPathPattern) SetProp

func (*NamedSegmentPathPattern) SetProp(ctx *Context, name string, value Value) error

func (*NamedSegmentPathPattern) StringPattern

func (patt *NamedSegmentPathPattern) StringPattern() (StringPattern, bool)

func (*NamedSegmentPathPattern) Test

func (patt *NamedSegmentPathPattern) Test(ctx *Context, v Value) bool

func (NamedSegmentPathPattern) ToSymbolicValue

func (p NamedSegmentPathPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*NamedSegmentPathPattern) WriteJSONRepresentation

func (patt *NamedSegmentPathPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type Namespace

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

func NewMutableEntriesNamespace

func NewMutableEntriesNamespace(name string, entries map[string]Value) *Namespace

NewMutableEntriesNamespace creates a namespace that allows the entry values to be modified. Adding, removing or assigning an entry is not allowed.

func NewNamespace

func NewNamespace(name string, entries map[string]Value) *Namespace

func (*Namespace) Equal

func (ns *Namespace) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Namespace) IsMutable

func (ns *Namespace) IsMutable() bool

func (*Namespace) PrettyPrint

func (ns *Namespace) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*Namespace) Prop

func (ns *Namespace) Prop(ctx *Context, name string) Value

func (*Namespace) PropertyNames

func (ns *Namespace) PropertyNames(ctx *Context) []string

func (*Namespace) SetProp

func (*Namespace) SetProp(ctx *Context, name string, value Value) error

func (*Namespace) ToSymbolicValue

func (ns *Namespace) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type NamespaceMemberPatternReprMixin

type NamespaceMemberPatternReprMixin struct {
	NamespaceName string
	MemberName    string
}

func (NamespaceMemberPatternReprMixin) WriteJSONRepresentation

func (m NamespaceMemberPatternReprMixin) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

func (NamespaceMemberPatternReprMixin) WriteRepresentation

func (m NamespaceMemberPatternReprMixin) WriteRepresentation(ctx *Context, w io.Writer, config *ReprConfig, depth int) error

type NewDefaultContextFn

type NewDefaultContextFn func(config DefaultContextConfig) (*Context, error)

type NewDefaultGlobalStateFn

type NewDefaultGlobalStateFn func(ctx *Context, conf DefaultGlobalStateConfig) (*GlobalState, error)

type NilT

type NilT int

NilT implements Value.

func (NilT) Equal

func (Nil NilT) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (NilT) IsMutable

func (Nil NilT) IsMutable() bool

func (NilT) PrettyPrint

func (Nil NilT) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (NilT) String

func (n NilT) String() string

func (NilT) ToSymbolicValue

func (n NilT) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (NilT) WriteJSONRepresentation

func (Nil NilT) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type NillableInitializationMigrationOp

type NillableInitializationMigrationOp struct {
	Value Pattern
	MigrationMixin
}

func (NillableInitializationMigrationOp) ToSymbolicValue

func (op NillableInitializationMigrationOp) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) symbolic.MigrationOp

type NotAllowedError

type NotAllowedError struct {
	Permission Permission
	Message    string
}

func NewNotAllowedError

func NewNotAllowedError(perm Permission) *NotAllowedError

func (NotAllowedError) Error

func (err NotAllowedError) Error() string

func (NotAllowedError) Is

func (err NotAllowedError) Is(target error) bool

type NotCallablePatternMixin

type NotCallablePatternMixin struct {
}

func (NotCallablePatternMixin) Call

type NotRenderableMixin

type NotRenderableMixin struct {
}

func (NotRenderableMixin) IsRecursivelyRenderable

func (m NotRenderableMixin) IsRecursivelyRenderable(ctx *Context, input RenderingInput) bool

func (NotRenderableMixin) Render

func (m NotRenderableMixin) Render(ctx *Context, w io.Writer, config RenderingInput) (int, error)

type NumberList

type NumberList[T interface {
	constraints.Integer | constraints.Float
	Serializable
}] struct {
	// contains filtered or unexported fields
}

NumberList implements underlyingList

func (*NumberList[T]) At

func (list *NumberList[T]) At(ctx *Context, i int) Value

func (*NumberList[T]) Clone

func (list *NumberList[T]) Clone(originState *GlobalState, sharableValues *[]PotentiallySharable, clones map[uintptr]Clonable, depth int) (Serializable, error)

func (*NumberList[T]) ConstraintId

func (list *NumberList[T]) ConstraintId() ConstraintId

func (*NumberList[T]) ContainsSimple

func (list *NumberList[T]) ContainsSimple(ctx *Context, v Serializable) bool

func (*NumberList[T]) Equal

func (list *NumberList[T]) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*NumberList[T]) IsMutable

func (list *NumberList[T]) IsMutable() bool

func (*NumberList[T]) Iterator

func (list *NumberList[T]) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*NumberList[T]) Len

func (list *NumberList[T]) Len() int

func (*NumberList[T]) PrettyPrint

func (list *NumberList[T]) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*NumberList[T]) SetSlice

func (list *NumberList[T]) SetSlice(ctx *Context, start, end int, seq Sequence)

func (*NumberList[N]) ToSymbolicValue

func (l *NumberList[N]) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*NumberList[T]) WriteJSONRepresentation

func (list *NumberList[T]) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type NumberListIterator

type NumberListIterator[T interface {
	constraints.Integer | constraints.Float
	Serializable
}] struct {
	// contains filtered or unexported fields
}

func (*NumberListIterator[T]) Equal

func (it *NumberListIterator[T]) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (NumberListIterator[T]) HasNext

func (it NumberListIterator[T]) HasNext(*Context) bool

func (*NumberListIterator[T]) IsMutable

func (it *NumberListIterator[T]) IsMutable() bool

func (*NumberListIterator[T]) Key

func (it *NumberListIterator[T]) Key(ctx *Context) Value

func (*NumberListIterator[T]) Next

func (it *NumberListIterator[T]) Next(ctx *Context) bool

func (*NumberListIterator[T]) PrettyPrint

func (it *NumberListIterator[T]) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*NumberListIterator[T]) ToSymbolicValue

func (it *NumberListIterator[T]) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*NumberListIterator[T]) Value

func (it *NumberListIterator[T]) Value(*Context) Value

type Object

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

Object implements Value.

func CreateDirEntry

func CreateDirEntry(path, walkedDirPath string, addDotSlashPrefix bool, d fs.DirEntry) *Object

func EvaluatePermissionListingObjectNode

func EvaluatePermissionListingObjectNode(n *parse.ObjectLiteral, config PreinitArgs) (*Object, error)

EvaluatePermissionListingObjectNode evaluates the object literal listing permissions in a permission drop statement.

func NewObject

func NewObject() *Object

NewObject creates an empty object.

func NewObjectFromMap

func NewObjectFromMap(valMap ValMap, ctx *Context) *Object

helper function to create an object, lifetime jobs are initialized.

func NewObjectFromMapNoInit

func NewObjectFromMapNoInit(valMap ValMap) *Object

helper function to create an object, lifetime jobs are not initialized.

func ParseObjectJSONrepresentation

func ParseObjectJSONrepresentation(ctx *Context, it *jsoniter.Iterator, pattern *ObjectPattern, try bool) (_ *Object, finalErr error)

func (*Object) AddSystemGraphEvent

func (obj *Object) AddSystemGraphEvent(ctx *Context, text string)

func (*Object) Contains

func (obj *Object) Contains(ctx *Context, value Serializable) bool

func (*Object) EntryMap

func (obj *Object) EntryMap(ctx *Context) map[string]Serializable

func (*Object) Equal

func (obj *Object) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Object) ForEachElement

func (obj *Object) ForEachElement(ctx *Context, fn func(index int, v Serializable) error) error

ForEachElement iterates over the elements in the empty "" property, if the property's value is not a list the function does nothing.

func (*Object) ForEachEntry

func (obj *Object) ForEachEntry(fn func(k string, v Serializable) error) error

func (*Object) HasProp

func (obj *Object) HasProp(ctx *Context, name string) bool

func (*Object) HasPropValue

func (obj *Object) HasPropValue(ctx *Context, value Value) bool

func (*Object) IsEmpty

func (obj *Object) IsEmpty(ctx *Context) bool

func (*Object) IsMutable

func (obj *Object) IsMutable() bool

func (*Object) IsRecursivelyRenderable

func (obj *Object) IsRecursivelyRenderable(ctx *Context, input RenderingInput) bool

func (*Object) IsSharable

func (obj *Object) IsSharable(originState *GlobalState) (bool, string)

func (*Object) IsShared

func (obj *Object) IsShared() bool

func (*Object) Iterator

func (obj *Object) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*Object) Keys

func (obj *Object) Keys(ctx *Context) []string

func (*Object) LifetimeJobs

func (obj *Object) LifetimeJobs() *ValueLifetimeJobs

LifetimeJobs returns the lifetime jobs bound to the object, the returned pointer can be nil.

func (*Object) Migrate

func (o *Object) Migrate(ctx *Context, key Path, migration *FreeEntityMigrationArgs) (Value, error)

func (*Object) OnMutation

func (obj *Object) OnMutation(ctx *Context, microtask MutationCallbackMicrotask, config MutationWatchingConfiguration) (CallbackHandle, error)

func (*Object) PrettyPrint

func (obj *Object) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*Object) Prop

func (obj *Object) Prop(ctx *Context, name string) Value

func (*Object) PropNotStored

func (obj *Object) PropNotStored(ctx *Context, name string) Value

func (*Object) PropertyNames

func (obj *Object) PropertyNames(ctx *Context) []string

func (*Object) ProposeSystemGraph

func (obj *Object) ProposeSystemGraph(ctx *Context, g *SystemGraph, proposedName string, optionalParent SystemGraphNodeValue)

func (*Object) ReceiveMessage

func (obj *Object) ReceiveMessage(ctx *Context, msg Message) error

func (*Object) RemoveMutationCallback

func (obj *Object) RemoveMutationCallback(ctx *Context, handle CallbackHandle)

func (*Object) RemoveMutationCallbackMicrotasks

func (obj *Object) RemoveMutationCallbackMicrotasks(ctx *Context)

func (*Object) Render

func (obj *Object) Render(ctx *Context, w io.Writer, config RenderingInput) (int, error)

func (*Object) SetProp

func (obj *Object) SetProp(ctx *Context, name string, value Value) error

func (*Object) SetURLOnce

func (obj *Object) SetURLOnce(ctx *Context, u URL) error

func (*Object) Share

func (obj *Object) Share(originState *GlobalState)

func (*Object) SmartLock

func (obj *Object) SmartLock(state *GlobalState)

func (*Object) SmartUnlock

func (obj *Object) SmartUnlock(state *GlobalState)

func (*Object) SystemGraph

func (obj *Object) SystemGraph() *SystemGraph

func (*Object) ToSymbolicValue

func (obj *Object) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*Object) URL

func (obj *Object) URL() (URL, bool)

func (*Object) ValueEntryMap

func (obj *Object) ValueEntryMap(ctx *Context) map[string]Value

func (*Object) Watcher

func (obj *Object) Watcher(ctx *Context, config WatcherConfiguration) Watcher

func (*Object) WriteJSONRepresentation

func (obj *Object) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type ObjectPattern

type ObjectPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

An ObjectPattern represents a pattern matching Inox objects (e.g. {a: 1}), ObjectPattern implements Value.

func NewExactObjectPattern

func NewExactObjectPattern(entries []ObjectPatternEntry) *ObjectPattern

func NewInexactObjectPattern

func NewInexactObjectPattern(entries []ObjectPatternEntry) *ObjectPattern

func NewObjectPattern

func NewObjectPattern(inexact bool, entries []ObjectPatternEntry) *ObjectPattern

func (*ObjectPattern) CompleteEntry

func (patt *ObjectPattern) CompleteEntry(name string) (ObjectPatternEntry, bool)

func (*ObjectPattern) Entry

func (patt *ObjectPattern) Entry(name string) (pattern Pattern, optional bool, yes bool)

func (*ObjectPattern) EntryCount

func (patt *ObjectPattern) EntryCount() int

func (*ObjectPattern) Equal

func (patt *ObjectPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ObjectPattern) ForEachEntry

func (patt *ObjectPattern) ForEachEntry(fn func(entry ObjectPatternEntry) error) error

func (*ObjectPattern) GetMigrationOperations

func (patt *ObjectPattern) GetMigrationOperations(ctx *Context, next Pattern, pseudoPath string) (migrations []MigrationOp, _ error)

func (*ObjectPattern) HasRequiredOrOptionalEntry

func (patt *ObjectPattern) HasRequiredOrOptionalEntry(name string) bool

func (*ObjectPattern) IsMutable

func (patt *ObjectPattern) IsMutable() bool

func (ObjectPattern) Iterator

func (patt ObjectPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (ObjectPattern) PrettyPrint

func (patt ObjectPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*ObjectPattern) Random

func (patt *ObjectPattern) Random(ctx *Context, options ...Option) Value

func (*ObjectPattern) StringPattern

func (patt *ObjectPattern) StringPattern() (StringPattern, bool)

func (*ObjectPattern) Test

func (patt *ObjectPattern) Test(ctx *Context, v Value) bool

func (*ObjectPattern) ToSymbolicValue

func (p *ObjectPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*ObjectPattern) ValuePropPattern

func (patt *ObjectPattern) ValuePropPattern(name string) (propPattern Pattern, isOptional bool, ok bool)

func (*ObjectPattern) ValuePropertyNames

func (patt *ObjectPattern) ValuePropertyNames() []string

func (*ObjectPattern) WithConstraints

func (patt *ObjectPattern) WithConstraints(constraints []*ComplexPropertyConstraint) *ObjectPattern

func (ObjectPattern) WriteJSONRepresentation

func (patt ObjectPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type ObjectPatternEntriesHelper

type ObjectPatternEntriesHelper []ObjectPatternEntry

func (ObjectPatternEntriesHelper) CompleteEntry

func (h ObjectPatternEntriesHelper) CompleteEntry(name string) (ObjectPatternEntry, bool)

func (ObjectPatternEntriesHelper) Entry

func (h ObjectPatternEntriesHelper) Entry(name string) (pattern Pattern, optional bool, yes bool)

func (ObjectPatternEntriesHelper) HasRequiredOrOptionalEntry

func (h ObjectPatternEntriesHelper) HasRequiredOrOptionalEntry(name string) bool

type ObjectPatternEntry

type ObjectPatternEntry struct {
	Name       string
	Pattern    Pattern
	IsOptional bool

	//an entry is considered to have dependencies if .RequiredKeys > 0 or .Pattern is not nil.
	Dependencies PropertyDependencies
}

func (ObjectPatternEntry) Equal

func (e ObjectPatternEntry) Equal(ctx *Context, other ObjectPatternEntry, alreadyCompared map[uintptr]uintptr, depth int) bool

type Opcode

type Opcode = byte

Opcode represents a single byte operation code.

const (
	OpPushConstant Opcode = iota
	OpPop
	OpCopyTop
	OpSwap
	OpMoveThirdTop //move third element at the top of the stack & shift the two others
	OpPushTrue
	OpPushFalse
	OpEqual
	OpNotEqual
	OpIs
	OpIsNot
	OpMinus
	OpBooleanNot
	OpMatch
	OpGroupMatch
	OpIn
	OpSubstrOf
	OpKeyOf
	OpUrlOf
	OpDoSetDifference
	OpNilCoalesce
	OpJumpIfFalse
	OpAndJump // Logical AND jump
	OpOrJump  // Logical OR jump
	OpJump
	OpPopJumpIfTestDisabled
	OpPushNil
	OpCreateList
	OpCreateKeyList
	OpCreateTuple
	OpCreateObject
	OpCreateRecord
	OpCreateDict
	OpCreateMapping
	OpCreateTreedata
	OpCreateTreedataHiearchyEntry
	OpCreateOrderedPair
	OpCreateStruct
	OpSpreadObject
	OpExtractProps
	OpSpreadList
	OpSpreadTuple
	OpAppend
	OpCreateListPattern
	OpCreateTuplePattern
	OpCreateObjectPattern
	OpCreateRecordPattern
	OpCreateOptionPattern
	OpCreateUnionPattern
	OpCreateStringUnionPattern
	OpCreateRepeatedPatternElement
	OpCreateSequenceStringPattern
	OpCreatePatternNamespace
	OpCreateOptionalPattern
	OpToPattern
	OpToBool
	OpCreateString
	OpCreateOption
	OpCreatePath
	OpCreatePathPattern
	OpCreateURL
	OpCreateHost
	OpCreateRuneRange
	OpCreateIntRange
	OpCreateFloatRange
	OpCreateUpperBoundRange
	OpCreateTestSuite
	OpCreateTestCase
	OpAddTestSuiteResult
	OpAddTestCaseResult //add test case result if in test suite
	OpCreateLifetimeJob
	OpCreateReceptionHandler
	OpCreateXMLelem
	OpCreateAddTypeExtension
	OpAllocStruct
	OpSendValue
	OpSpreadObjectPattern
	OpSpreadRecordPattern
	BindCapturedLocals
	OpCall
	OpReturn
	OpCallFromXMLFactory
	OpYield
	OpCallPattern
	OpDropPerms
	OpSpawnLThread
	OpImport
	OpGetGlobal
	OpSetGlobal
	OpGetLocal
	OpSetLocal
	OpGetSelf
	OpSetSelf
	OpResolveHost
	OpAddHostAlias
	OpResolvePattern
	OpAddPattern
	OpResolvePatternNamespace
	OpAddPatternNamespace
	OpPatternNamespaceMemb
	OpSetMember
	OpSetIndex
	OpSetSlice
	OpSetBoolField
	OpSetIntField
	OpSetFloatField
	OpSetStructPtrField
	OpIterInit
	OpIterNext
	OpIterNextChunk
	OpIterKey
	OpIterValue
	OpIterPrune
	OpWalkerInit
	OpIntBin
	OpFloatBin
	OpNumBin
	OpPseudoArith
	OpLess
	OpLessEqual
	OpGreater
	OpGreaterEqual
	OptStrQueryParamVal
	OpStrConcat
	OpConcatStrLikes
	OpConcatBytesLikes
	OpConcatTuples
	OpRange
	OpMemb
	OpGetBoolField
	OpGetIntField
	OpGetFloatField
	OpGetStructPtrField
	OpObjPropNotStored
	OpExtensionMethod
	OpOptionalMemb
	OpComputedMemb
	OpDynMemb
	OpAt
	OpSafeAt
	OpSlice
	OpLoadDBVal
	OpAssert
	OpBlockLock
	OpBlockUnlock
	OpRuntimeTypecheck
	OpPushIncludedChunk
	OpPopIncludedChunk
	OpNoOp
	OpSuspendVM
)

opcodes

type OpenDBFn

type OpenDBFn func(ctx *Context, config DbOpenConfiguration) (Database, error)

func GetOpenDbFn

func GetOpenDbFn(scheme Scheme) (OpenDBFn, bool)

type Option

type Option struct {
	Name  string
	Value Value
}

An Option represents an option with a name and value, Option implements value. Inox's flag literals (e.g. `--verbose`) and option expressions (e.g. `--val=100`) evaluate to an Option.

func (Option) Clone

func (opt Option) Clone(originState *GlobalState, sharableValues *[]PotentiallySharable, clones map[uintptr]Clonable, depth int) (Serializable, error)

func (Option) Equal

func (opt Option) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Option) IsMutable

func (opt Option) IsMutable() bool

func (Option) PrettyPrint

func (opt Option) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Option) String

func (opt Option) String() string

func (Option) ToSymbolicValue

func (o Option) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Option) WriteJSONRepresentation

func (opt Option) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type OptionPattern

type OptionPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

func (*OptionPattern) Equal

func (patt *OptionPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*OptionPattern) IsMutable

func (patt *OptionPattern) IsMutable() bool

func (OptionPattern) Iterator

func (patt OptionPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (OptionPattern) PrettyPrint

func (patt OptionPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (OptionPattern) Random

func (patt OptionPattern) Random(ctx *Context, options ...Option) Value

func (*OptionPattern) StringPattern

func (patt *OptionPattern) StringPattern() (StringPattern, bool)

func (OptionPattern) Test

func (patt OptionPattern) Test(ctx *Context, v Value) bool

func (*OptionPattern) ToSymbolicValue

func (p *OptionPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (OptionPattern) WriteJSONRepresentation

func (patt OptionPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type OptionalParam

type OptionalParam[T Value] struct {
	Value T
}

optional parameter in symbolic Go function parameters

func ToOptionalParam

func ToOptionalParam[T Value](v T) *OptionalParam[T]

func ToValueOptionalParam

func ToValueOptionalParam(v Value) *OptionalParam[Value]

type OptionalPattern

type OptionalPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

An OptionalPattern represents a pattern that matches the nil value in additional to the same values as an underlying pattern. Optional pattern expressions (e.g. `%int?`) evaluate to an optional pattern.

func NewOptionalPattern

func NewOptionalPattern(ctx *Context, pattern Pattern) (*OptionalPattern, error)

func (*OptionalPattern) Equal

func (pattern *OptionalPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*OptionalPattern) IsMutable

func (pattern *OptionalPattern) IsMutable() bool

func (*OptionalPattern) Iterator

func (patt *OptionalPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*OptionalPattern) PrettyPrint

func (pattern *OptionalPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*OptionalPattern) Random

func (patt *OptionalPattern) Random(ctx *Context, options ...Option) Value

func (*OptionalPattern) StringPattern

func (patt *OptionalPattern) StringPattern() (StringPattern, bool)

func (*OptionalPattern) Test

func (patt *OptionalPattern) Test(ctx *Context, v Value) bool

func (*OptionalPattern) ToSymbolicValue

func (p *OptionalPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*OptionalPattern) WriteJSONRepresentation

func (pattern *OptionalPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type Order

type Order = symbolic.Order

type OrderedPair

type OrderedPair [2]Serializable

OrderedPair is an immutable ordered pair, OrderedPair implements Value.

func NewOrderedPair

func NewOrderedPair(first, second Serializable) *OrderedPair

func (*OrderedPair) At

func (p *OrderedPair) At(ctx *Context, i int) Value

func (*OrderedPair) Equal

func (p *OrderedPair) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*OrderedPair) GetOrBuildElements

func (p *OrderedPair) GetOrBuildElements(ctx *Context) []Serializable

func (*OrderedPair) IsMutable

func (tuple *OrderedPair) IsMutable() bool

func (*OrderedPair) Iterator

func (p *OrderedPair) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*OrderedPair) Len

func (p *OrderedPair) Len() int

func (OrderedPair) PrettyPrint

func (p OrderedPair) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*OrderedPair) ToSymbolicValue

func (p *OrderedPair) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*OrderedPair) WriteJSONRepresentation

func (p *OrderedPair) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type ParserBasedPseudoPattern

type ParserBasedPseudoPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

func NewParserBasePattern

func NewParserBasePattern(parser StatelessParser) *ParserBasedPseudoPattern

func (*ParserBasedPseudoPattern) CompiledRegex

func (patt *ParserBasedPseudoPattern) CompiledRegex() *regexp.Regexp

func (*ParserBasedPseudoPattern) EffectiveLengthRange

func (patt *ParserBasedPseudoPattern) EffectiveLengthRange() IntRange

func (*ParserBasedPseudoPattern) Equal

func (patt *ParserBasedPseudoPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ParserBasedPseudoPattern) FindMatches

func (patt *ParserBasedPseudoPattern) FindMatches(ctx *Context, val Serializable, config MatchesFindConfig) (groups []Serializable, err error)

func (*ParserBasedPseudoPattern) HasRegex

func (pattern *ParserBasedPseudoPattern) HasRegex() bool

func (*ParserBasedPseudoPattern) IsMutable

func (patt *ParserBasedPseudoPattern) IsMutable() bool

func (*ParserBasedPseudoPattern) IsResolved

func (patt *ParserBasedPseudoPattern) IsResolved() bool

func (*ParserBasedPseudoPattern) Iterator

func (patt *ParserBasedPseudoPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*ParserBasedPseudoPattern) LengthRange

func (patt *ParserBasedPseudoPattern) LengthRange() IntRange

func (*ParserBasedPseudoPattern) Parse

func (patt *ParserBasedPseudoPattern) Parse(ctx *Context, s string) (Serializable, error)

func (*ParserBasedPseudoPattern) PatternNestingDepth

func (patt *ParserBasedPseudoPattern) PatternNestingDepth(parentDepth int) int

func (*ParserBasedPseudoPattern) PrettyPrint

func (patt *ParserBasedPseudoPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*ParserBasedPseudoPattern) Random

func (pattern *ParserBasedPseudoPattern) Random(ctx *Context, options ...Option) Value

func (*ParserBasedPseudoPattern) Regex

func (pattern *ParserBasedPseudoPattern) Regex() string

func (*ParserBasedPseudoPattern) Resolve

func (patt *ParserBasedPseudoPattern) Resolve() (StringPattern, error)

func (*ParserBasedPseudoPattern) StringPattern

func (patt *ParserBasedPseudoPattern) StringPattern() (StringPattern, bool)

func (*ParserBasedPseudoPattern) Test

func (patt *ParserBasedPseudoPattern) Test(ctx *Context, v Value) bool

func (*ParserBasedPseudoPattern) ToSymbolicValue

func (p *ParserBasedPseudoPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (ParserBasedPseudoPattern) WriteJSONRepresentation

func (patt ParserBasedPseudoPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type Path

type Path string

func CreateTempdir

func CreateTempdir(nameSecondPrefix string, fls afs.Filesystem) Path

CreateTempdir creates a directory with permissions o700 in /tmp.

func DirPathFrom

func DirPathFrom(pth string) Path

func NonDirPathFrom

func NonDirPathFrom(pth string) Path

func ParsePathLiteral

func ParsePathLiteral(s string) (Path, bool)

func PathFrom

func PathFrom(pth string) Path

func (Path) Basename

func (pth Path) Basename() String

func (Path) CanBeDirOfEntry

func (pth Path) CanBeDirOfEntry(absPath Path) bool

IsDirOfEntry returns true if $absPath is the path of a potentiel entry in $pth. The function panics if $pth is not a dirpath or if one of the two paths is not absolute.

func (Path) DirPath

func (pth Path) DirPath() Path

Path of parent directory.

func (Path) Equal

func (pth Path) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Path) Extension

func (pth Path) Extension() string

func (Path) IsAbsolute

func (pth Path) IsAbsolute() bool

func (Path) IsDirPath

func (pth Path) IsDirPath() bool

func (Path) IsMutable

func (pth Path) IsMutable() bool

func (Path) IsRelative

func (pth Path) IsRelative() bool

func (Path) Join

func (pth Path) Join(relativePath Path, fls afs.Filesystem) Path

Join joins the current path to a relative path: /a , ./b -> /a/b /a , ./b/ -> /a/b/ /a , /b -> error /a , /b/ -> error

func (Path) JoinAbsolute

func (pth Path) JoinAbsolute(absPath Path, fls afs.Filesystem) Path

JoinAbsolute joins the current path to an absolute path: /a , /b -> /a/b /a , /b/ -> /a/b/ /a , ./b -> error /a , ./b/ -> error

func (Path) JoinEntry

func (pth Path) JoinEntry(name string) Path

JoinEntry joins the current dir path to an entry name.

func (Path) PrettyPrint

func (pth Path) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Path) Prop

func (pth Path) Prop(ctx *Context, name string) Value

func (Path) PropertyNames

func (pth Path) PropertyNames(ctx *Context) []string

func (Path) RelativeEquiv

func (pth Path) RelativeEquiv() Path

func (Path) ResourceName

func (pth Path) ResourceName() string

func (Path) SetProp

func (Path) SetProp(ctx *Context, name string, value Value) error

func (Path) ToAbs

func (pth Path) ToAbs(fls afs.Filesystem) (Path, error)

func (Path) ToGlobbingPattern

func (pth Path) ToGlobbingPattern() PathPattern

func (Path) ToPrefixPattern

func (pth Path) ToPrefixPattern() PathPattern

ToPrefixPattern makes a prefix pattern by appending "..." to the path, if the path is not a directory the function panics.

func (Path) ToSymbolicValue

func (p Path) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Path) UnderlyingString

func (pth Path) UnderlyingString() string

func (Path) Validate

func (pth Path) Validate() error

func (Path) Walker

func (p Path) Walker(ctx *Context) (Walker, error)

func (Path) WriteJSONRepresentation

func (pth Path) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type PathPattern

type PathPattern string

func (PathPattern) Call

func (PathPattern) Call(values []Serializable) (Pattern, error)

func (PathPattern) Equal

func (patt PathPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (PathPattern) Includes

func (patt PathPattern) Includes(ctx *Context, v Value) bool

func (PathPattern) IsAbsolute

func (patt PathPattern) IsAbsolute() bool

func (PathPattern) IsDirGlobbingPattern

func (patt PathPattern) IsDirGlobbingPattern() bool

func (PathPattern) IsGlobbingPattern

func (patt PathPattern) IsGlobbingPattern() bool

func (PathPattern) IsMutable

func (patt PathPattern) IsMutable() bool

func (PathPattern) IsPrefixPattern

func (patt PathPattern) IsPrefixPattern() bool

func (PathPattern) Iterator

func (patt PathPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (PathPattern) Prefix

func (patt PathPattern) Prefix() string

func (PathPattern) PrettyPrint

func (patt PathPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (PathPattern) Prop

func (patt PathPattern) Prop(ctx *Context, name string) Value

func (PathPattern) PropertyNames

func (patt PathPattern) PropertyNames(ctx *Context) []string

func (PathPattern) Random

func (pattern PathPattern) Random(ctx *Context, options ...Option) Value

func (PathPattern) SetProp

func (PathPattern) SetProp(ctx *Context, name string, value Value) error

func (PathPattern) StringPattern

func (patt PathPattern) StringPattern() (StringPattern, bool)

func (PathPattern) Test

func (patt PathPattern) Test(ctx *Context, v Value) bool

func (PathPattern) ToAbs

func (patt PathPattern) ToAbs(fls afs.Filesystem) PathPattern

func (PathPattern) ToGlobbingPattern

func (patt PathPattern) ToGlobbingPattern() PathPattern

func (PathPattern) ToSymbolicValue

func (p PathPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (PathPattern) UnderlyingString

func (patt PathPattern) UnderlyingString() string

func (PathPattern) WriteJSONRepresentation

func (patt PathPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type PathStringPattern

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

A PathStringPattern represents a string pattern for paths.

func NewStringPathPattern

func NewStringPathPattern(pathPattern PathPattern) *PathStringPattern

NewRegexPattern creates a StringPathPattern from the given string, if path pattern is empty the pattern matches any path.

func (*PathStringPattern) Call

func (patt *PathStringPattern) Call(values []Serializable) (Pattern, error)

func (*PathStringPattern) CompiledRegex

func (patt *PathStringPattern) CompiledRegex() *regexp.Regexp

func (*PathStringPattern) EffectiveLengthRange

func (patt *PathStringPattern) EffectiveLengthRange() IntRange

func (*PathStringPattern) Equal

func (patt *PathStringPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*PathStringPattern) FindMatches

func (patt *PathStringPattern) FindMatches(ctx *Context, val Serializable, config MatchesFindConfig) (groups []Serializable, err error)

func (*PathStringPattern) HasRegex

func (pattern *PathStringPattern) HasRegex() bool

func (*PathStringPattern) IsMutable

func (patt *PathStringPattern) IsMutable() bool

func (*PathStringPattern) IsResolved

func (patt *PathStringPattern) IsResolved() bool

func (*PathStringPattern) Iterator

func (patt *PathStringPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*PathStringPattern) LengthRange

func (patt *PathStringPattern) LengthRange() IntRange

func (*PathStringPattern) MatchGroups

func (patt *PathStringPattern) MatchGroups(ctx *Context, v Serializable) (map[string]Serializable, bool, error)

func (*PathStringPattern) Parse

func (patt *PathStringPattern) Parse(ctx *Context, s string) (Serializable, error)

func (*PathStringPattern) PatternNestingDepth

func (patt *PathStringPattern) PatternNestingDepth(parentDepth int) int

func (*PathStringPattern) PrettyPrint

func (patt *PathStringPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*PathStringPattern) Random

func (pattern *PathStringPattern) Random(ctx *Context, options ...Option) Value

func (*PathStringPattern) Regex

func (pattern *PathStringPattern) Regex() string

func (*PathStringPattern) Resolve

func (patt *PathStringPattern) Resolve() (StringPattern, error)

func (*PathStringPattern) StringPattern

func (patt *PathStringPattern) StringPattern() (StringPattern, bool)

func (*PathStringPattern) Test

func (pattern *PathStringPattern) Test(ctx *Context, v Value) bool

func (*PathStringPattern) ToSymbolicValue

func (p *PathStringPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*PathStringPattern) WriteJSONRepresentation

func (patt *PathStringPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type Pattern

type Pattern interface {
	Serializable
	Iterable

	//Test returns true if the argument matches the pattern.
	Test(*Context, Value) bool

	Random(ctx *Context, options ...Option) Value

	Call(values []Serializable) (Pattern, error)

	StringPattern() (StringPattern, bool)
}

The Pattern interface is implemented by Inox patterns (e.g. *ObjectPattern, *ListPattern, URLPattern, ....). A pattern should always be immutable.

func ConvertJsonSchemaToPattern

func ConvertJsonSchemaToPattern(schemaBytes string) (Pattern, error)

ConvertJsonSchemaToPattern converts a JSON schema definition to an Inox pattern, all schemas are not supported and the resulting pattern might be stricter.

func GetConstraint

func GetConstraint(constraintId ConstraintId) (Pattern, bool)

func NewMostAdaptedExactPattern

func NewMostAdaptedExactPattern(value Serializable) Pattern

NewMostAdaptedExactPattern returns an *ExactStringPattern if value implements StringLike, otherwise an *ExactValuePattern is returned.

type PatternDeserializer

type PatternDeserializer = func(ctx *Context, it *jsoniter.Iterator, pattern Pattern, try bool) (Pattern, error)

type PatternIterator

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

func NewEmptyPatternIterator

func NewEmptyPatternIterator() *PatternIterator

func (*PatternIterator) Equal

func (it *PatternIterator) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*PatternIterator) HasNext

func (it *PatternIterator) HasNext(ctx *Context) bool

func (*PatternIterator) IsMutable

func (it *PatternIterator) IsMutable() bool

func (*PatternIterator) Key

func (it *PatternIterator) Key(ctx *Context) Value

func (*PatternIterator) Next

func (it *PatternIterator) Next(ctx *Context) bool

func (*PatternIterator) PrettyPrint

func (it *PatternIterator) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (PatternIterator) ToSymbolicValue

func (it PatternIterator) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*PatternIterator) Value

func (it *PatternIterator) Value(ctx *Context) Value

type PatternNamespace

type PatternNamespace struct {
	Patterns map[string]Pattern
}

A PatternNamespace represents a group of related Inox patterns, PatternNamespace implements Value.

func CreatePatternNamespace

func CreatePatternNamespace(ctx *Context, init Value) (*PatternNamespace, error)

func (*PatternNamespace) Equal

func (ns *PatternNamespace) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*PatternNamespace) IsMutable

func (ns *PatternNamespace) IsMutable() bool

func (*PatternNamespace) PrettyPrint

func (ns *PatternNamespace) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*PatternNamespace) ToSymbolicValue

func (ns *PatternNamespace) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type PeriodicWatcher

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

A PeriodicWatcher is Watcher that periodically checks if it has a value.

func NewPeriodicWatcher

func NewPeriodicWatcher(config WatcherConfiguration, period time.Duration) *PeriodicWatcher

func (*PeriodicWatcher) Config

func (*PeriodicWatcher) Equal

func (w *PeriodicWatcher) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*PeriodicWatcher) InformAboutAsync

func (w *PeriodicWatcher) InformAboutAsync(ctx *Context, v Value)

InformAboutAsync sets the next value the watcher will "see", on a tick the watcher only sees the last value set.

func (*PeriodicWatcher) IsMutable

func (w *PeriodicWatcher) IsMutable() bool

func (*PeriodicWatcher) IsStopped

func (w *PeriodicWatcher) IsStopped() bool

func (*PeriodicWatcher) PrettyPrint

func (watcher *PeriodicWatcher) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*PeriodicWatcher) Stop

func (w *PeriodicWatcher) Stop()

func (*PeriodicWatcher) Stream

func (*PeriodicWatcher) ToSymbolicValue

func (w *PeriodicWatcher) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*PeriodicWatcher) WaitNext

func (w *PeriodicWatcher) WaitNext(ctx *Context, additionalFilter Pattern, timeout time.Duration) (Value, error)

type Permission

type Permission interface {
	Kind() PermissionKind
	InternalPermTypename() permkind.InternalPermissionTypename
	Includes(Permission) bool
	String() string
}

A Permission carries a kind and can include narrower permissions, for example (read http://**) includes (read https://example.com).

func GetDefaultGlobalVarPermissions

func GetDefaultGlobalVarPermissions() (perms []Permission)

func RemovePerms

func RemovePerms(grantedPerms, removedPerms []Permission) (remainingPerms []Permission)

type PermissionKind

type PermissionKind = permkind.PermissionKind

type PointerType

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

func (*PointerType) GetValueAllocParams

func (t *PointerType) GetValueAllocParams() (size int, alignment int)

func (*PointerType) GoType

func (t *PointerType) GoType() reflect.Type

func (*PointerType) New

func (t *PointerType) New(heap *ModuleHeap) HeapAddress

New allocates the memory needed for the value and returns a pointer to it.

func (*PointerType) StructFieldRetrieval

func (t *PointerType) StructFieldRetrieval(name string) fieldRetrievalInfo

func (*PointerType) Symbolic

func (t *PointerType) Symbolic() symbolic.CompileTimeType

func (*PointerType) ValueSize

func (t *PointerType) ValueSize() uintptr

func (*PointerType) ValueType

func (t *PointerType) ValueType() CompileTimeType

type Port

type Port struct {
	Number uint16
	Scheme Scheme //set to NO_SCHEME_SCHEME_NAME if no scheme is specified.
}

Port implements Value. Inox's port literals (e.g. `:80`, `:80/http`) evaluate to a Port.

func (Port) Compare

func (p Port) Compare(other Value) (result int, comparable bool)

func (Port) Equal

func (port Port) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Port) IsMutable

func (port Port) IsMutable() bool

func (Port) PrettyPrint

func (port Port) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Port) ToSymbolicValue

func (port Port) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Port) WriteJSONRepresentation

func (port Port) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type PotentiallySharable

type PotentiallySharable interface {
	Value
	IsSharable(originState *GlobalState) (bool, string)

	Share(originState *GlobalState)

	IsShared() bool

	//(No-op allowed) If possible SmartLock() should lock the PotentiallySharable.
	//This function is primarily called by Inox interpreters when evaluating synchronized() blocks.
	//TODO: add symbolic evaluation checks to warn the developer if a no-op SmartLock is used inside
	//a synchronized block.
	SmartLock(*GlobalState)

	//If SmartLock() is not a no-op, SmartUnlock should unlock the PotentiallySharable.
	SmartUnlock(*GlobalState)
}

type PreinitArgs

type PreinitArgs struct {
	GlobalConsts     *parse.GlobalConstantDeclarations //only used if no running state
	PreinitStatement *parse.PreinitStatement           //only used if no running state

	RunningState *TreeWalkState //optional
	ParentState  *GlobalState   //optional
	Filesystem   afs.Filesystem

	//if RunningState is nil .PreinitFilesystem is used to create the temporary context.
	PreinitFilesystem afs.Filesystem

	DefaultLimits         []Limit
	AddDefaultPermissions bool
	HandleCustomType      CustomPermissionTypeHandler //optional
	IgnoreUnknownSections bool
	IgnoreConstDeclErrors bool

	//used if .RunningState is nil
	AdditionalGlobals map[string]Value

	Project Project //optional
}

type PreinitFile

type PreinitFile struct {
	Name               string //declared name, this is NOT the basename.
	Path               Path   //absolute
	Pattern            Pattern
	RequiredPermission FilesystemPermission
	Content            []byte
	Parsed             Serializable
	ReadParseError     error
}

type PreinitFiles

type PreinitFiles []*PreinitFile

type PrettyPrintColors

type PrettyPrintColors struct {
	ControlKeyword, OtherKeyword, PatternLiteral, StringLiteral, PathLiteral, IdentifierLiteral,
	NumberLiteral, Constant, PatternIdentifier, CssTypeSelector, CssOtherSelector, InvalidNode, Index []byte
}

type PrettyPrintConfig

type PrettyPrintConfig struct {
	pprint.PrettyPrintConfig
	Context *Context
}

func (*PrettyPrintConfig) WithContext

func (config *PrettyPrintConfig) WithContext(ctx *Context) *PrettyPrintConfig

type ProgramStopReason

type ProgramStopReason int
const (
	PauseStop ProgramStopReason = 1 + iota
	NextStepStop
	StepInStop
	StepOutStop
	BreakpointStop
	ExceptionBreakpointStop
)

type ProgramStoppedEvent

type ProgramStoppedEvent struct {
	ThreadId       StateId
	Reason         ProgramStopReason
	Breakpoint     *BreakpointInfo
	ExceptionError error
}

type Project

type Project interface {
	Id() ProjectID

	BaseImage() (Image, error)

	ListSecrets(ctx *Context) ([]ProjectSecretInfo, error)

	GetSecrets(ctx *Context) ([]ProjectSecret, error)

	//CanProvideS3Credentials should return true if the project can provide S3 credentials for
	//the given S3 provider AT THE MOMENT OF THE CALL. If the error is not nil the boolean result
	//should be false.
	CanProvideS3Credentials(s3Provider string) (bool, error)

	// GetS3CredentialsForBucket creates the bucket bucketName if necessary & returns credentials to access it,
	// the returned credentials should not work for other buckets.
	GetS3CredentialsForBucket(ctx *Context, bucketName string, provider string) (accessKey, secretKey string, s3Endpoint Host, _ error)

	Configuration() ProjectConfiguration

	//DevDatabasesDirOnOsFs returns the directory where the project's databases are stored.
	DevDatabasesDirOnOsFs() string
}

type ProjectConfiguration

type ProjectConfiguration interface {
	AreExposedWebServersAllowed() bool
}

type ProjectID

type ProjectID string

func RandomProjectID

func RandomProjectID(projectName string) ProjectID

type ProjectSecret

type ProjectSecret struct {
	Name          SecretName
	LastModifDate time.Time
	Value         *Secret
}

type ProjectSecretInfo

type ProjectSecretInfo struct {
	Name          SecretName `json:"name"`
	LastModifDate time.Time  `json:"lastModificationDate"`
}

type PropertyDependencies

type PropertyDependencies struct {
	RequiredKeys []string
	Pattern      Pattern //object or record pattern
}

type PropertyName

type PropertyName string

Property name literals (e.g. `.age`) evaluate to a PropertyName. PropertyName implements Value and ValuePath.

func (PropertyName) Equal

func (n PropertyName) Equal(ctx *Context, otherName Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (PropertyName) GetFrom

func (n PropertyName) GetFrom(ctx *Context, v Value) Value

func (PropertyName) IsMutable

func (n PropertyName) IsMutable() bool

func (PropertyName) PrettyPrint

func (n PropertyName) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (PropertyName) SegmentGetFrom

func (n PropertyName) SegmentGetFrom(ctx *Context, v Value) Value

func (PropertyName) ToSymbolicValue

func (p PropertyName) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (PropertyName) UnderlyingString

func (n PropertyName) UnderlyingString() string

func (PropertyName) Validate

func (n PropertyName) Validate() error

func (PropertyName) WriteJSONRepresentation

func (p PropertyName) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type ProtocolClient

type ProtocolClient interface {
	Value
	Schemes() []Scheme
}

A ProtocolClient represents a client for one or more protocols such as HTTP, HTTPS.

type Publication

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

A Publication is an package around an immutable piece of data sent by a publisher to its subscribers, Publication implements Value.

func (*Publication) Data

func (p *Publication) Data() Value

func (*Publication) Equal

func (p *Publication) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Publication) IsMutable

func (Publication) IsMutable() bool

func (*Publication) PrettyPrint

func (p *Publication) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*Publication) PublicationDate

func (p *Publication) PublicationDate() DateTime

func (*Publication) Publisher

func (p *Publication) Publisher() Value

func (*Publication) ToSymbolicValue

func (p *Publication) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type PublicationCallbackConfiguration

type PublicationCallbackConfiguration struct {
}

type PublicationCallbackMicrotask

type PublicationCallbackMicrotask func(ctx *Context, pub *Publication)

type Quantity

type Quantity interface {
	Value

	// Int64() should return (value, true) if the internal representation of the quantity is an integer (int64, int32, ...),
	// (0, false) otherwise. If $hasIntegralRepr is true the implementation should aso implement Integral.
	AsInt64() (v int64, hasIntegralRepr bool)

	// Int64() should return (value, true) if the internal representation of the quantity is a float (float64, float32, ...),
	// (0, false) otherwise.
	AsFloat64() (v float64, hasFloatRepr bool)

	IsZeroQuantity() bool
}

type QuantityRange

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

QuantityRange implements Value.

func (QuantityRange) Contains

func (r QuantityRange) Contains(ctx *Context, v Serializable) bool

func (QuantityRange) Equal

func (r QuantityRange) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (QuantityRange) InclusiveEnd

func (r QuantityRange) InclusiveEnd() Serializable

func (QuantityRange) IsEmpty

func (r QuantityRange) IsEmpty(ctx *Context) bool

func (QuantityRange) IsMutable

func (r QuantityRange) IsMutable() bool

func (QuantityRange) Iterator

func (r QuantityRange) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (QuantityRange) KnownStart

func (r QuantityRange) KnownStart() Serializable

func (QuantityRange) PrettyPrint

func (r QuantityRange) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (QuantityRange) ToSymbolicValue

func (r QuantityRange) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (QuantityRange) WriteJSONRepresentation

func (r QuantityRange) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type QuantityRangeIterator

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

func (QuantityRangeIterator) Equal

func (it QuantityRangeIterator) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*QuantityRangeIterator) HasNext

func (it *QuantityRangeIterator) HasNext(*Context) bool

func (QuantityRangeIterator) IsMutable

func (it QuantityRangeIterator) IsMutable() bool

func (*QuantityRangeIterator) Key

func (it *QuantityRangeIterator) Key(ctx *Context) Value

func (*QuantityRangeIterator) Next

func (it *QuantityRangeIterator) Next(ctx *Context) bool

func (QuantityRangeIterator) PrettyPrint

func (it QuantityRangeIterator) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (QuantityRangeIterator) ToSymbolicValue

func (it QuantityRangeIterator) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*QuantityRangeIterator) Value

func (it *QuantityRangeIterator) Value(*Context) Value

type RandomnessSource

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

func GetRandomnessSource

func GetRandomnessSource(default_ *RandomnessSource, options ...Option) *RandomnessSource

func (*RandomnessSource) Equal

func (r *RandomnessSource) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*RandomnessSource) Int64

func (r *RandomnessSource) Int64() int64

func (*RandomnessSource) IsMutable

func (r *RandomnessSource) IsMutable() bool

func (*RandomnessSource) PrettyPrint

func (r *RandomnessSource) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*RandomnessSource) RandBit

func (r *RandomnessSource) RandBit() bool

func (*RandomnessSource) RandInt64Range

func (r *RandomnessSource) RandInt64Range(start, end int64) int64

RandInt64Range returns a random int64 in the interval [start, end].

func (*RandomnessSource) RandUint64Range

func (r *RandomnessSource) RandUint64Range(start, end uint64) uint64

RandUint64Range returns a random uint64 in the interval [start, end].

func (*RandomnessSource) Read

func (s *RandomnessSource) Read(bytes []byte) (int, error)

func (*RandomnessSource) ReadNBytesAsBase64Unpadded

func (s *RandomnessSource) ReadNBytesAsBase64Unpadded(n int) string

func (*RandomnessSource) ReadNBytesAsHex

func (s *RandomnessSource) ReadNBytesAsHex(n int) string

func (*RandomnessSource) ToSymbolicValue

func (r *RandomnessSource) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*RandomnessSource) Uint64

func (r *RandomnessSource) Uint64() uint64

type Rate

type Rate interface {
	Value
	QuantityPerSecond() Value
	IsZeroRate() bool
}

type RawTcpPermission

type RawTcpPermission struct {
	Kind_  PermissionKind
	Domain WrappedString //Host | HostPattern
}

func (RawTcpPermission) Includes

func (perm RawTcpPermission) Includes(otherPerm Permission) bool

func (RawTcpPermission) InternalPermTypename

func (perm RawTcpPermission) InternalPermTypename() permkind.InternalPermissionTypename

func (RawTcpPermission) Kind

func (perm RawTcpPermission) Kind() PermissionKind

func (RawTcpPermission) String

func (perm RawTcpPermission) String() string

type Readable

type Readable interface {
	Value
	Reader() *Reader
}

A Readable is a Value we can read bytes from thanks to a Reader.

type ReadableByteStream

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

A ReadableByteStream represents a stream of bytes, ElementsStream implements Value.

func NewByteStream

func NewByteStream(
	readSourceBytes func(s *ReadableByteStream, p []byte) (int, error),
	readSourceByte func(s *ReadableByteStream) (byte, error),
	rechargedSourceSignal chan struct{},
	filter Pattern,
) *ReadableByteStream

func (*ReadableByteStream) ChunkDataType

func (s *ReadableByteStream) ChunkDataType() Pattern

func (*ReadableByteStream) Equal

func (s *ReadableByteStream) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ReadableByteStream) IsMainlyChunked

func (s *ReadableByteStream) IsMainlyChunked() bool

func (*ReadableByteStream) IsMutable

func (*ReadableByteStream) IsMutable() bool

func (*ReadableByteStream) IsStopped

func (s *ReadableByteStream) IsStopped() bool

func (*ReadableByteStream) PrettyPrint

func (s *ReadableByteStream) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*ReadableByteStream) Stop

func (s *ReadableByteStream) Stop()

func (*ReadableByteStream) Stream

func (*ReadableByteStream) ToSymbolicValue

func (s *ReadableByteStream) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*ReadableByteStream) WaitNext

func (s *ReadableByteStream) WaitNext(ctx *Context, filter Pattern, timeout time.Duration) (Value, error)

func (*ReadableByteStream) WaitNextChunk

func (s *ReadableByteStream) WaitNextChunk(ctx *Context, filter Pattern, sizeRange IntRange, timeout time.Duration) (*DataChunk, error)

type ReadableStream

type ReadableStream interface {
	StreamSource

	// WaitNext should be called by a single goroutine, filter can be nil.
	// WaitNext should return the EndOfStream error only after the last element has been returned
	WaitNext(ctx *Context, filter Pattern, timeout time.Duration) (Value, error)

	// WaitNextChunk should be called by a single goroutine, filter can be nil.
	// If there is a non-nil error that is not EndOfStream the chunk should be nil
	WaitNextChunk(ctx *Context, filter Pattern, sizeRange IntRange, timeout time.Duration) (*DataChunk, error)

	Stop()

	IsStopped() bool

	IsMainlyChunked() bool

	ChunkDataType() Pattern
}

func ToReadableStream

func ToReadableStream(ctx *Context, v Value, optionalFilter Pattern) ReadableStream

type ReadableStreamConfiguration

type ReadableStreamConfiguration struct {
	Filter Pattern
}

type Reader

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

A Reader is a Value wrapping an io.Reader. TODO: close wrapped. when closing Reader

func WrapReader

func WrapReader(wrapped io.Reader, lock *sync.Mutex) *Reader

func (*Reader) AlreadyHasAllData

func (reader *Reader) AlreadyHasAllData() bool

func (*Reader) Equal

func (reader *Reader) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Reader) GetBytesDataToNotModify

func (reader *Reader) GetBytesDataToNotModify() []byte

GetBytesDataToNotModify returns all the bytes if they are already available. If the bytes are not available the function panics, the returned slice should not be modified.

func (*Reader) GetGoMethod

func (reader *Reader) GetGoMethod(name string) (*GoFunction, bool)

func (*Reader) IsMutable

func (*Reader) IsMutable() bool

func (*Reader) PrettyPrint

func (reader *Reader) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*Reader) Prop

func (reader *Reader) Prop(ctx *Context, name string) Value

func (Reader) PropertyNames

func (Reader) PropertyNames(ctx *Context) []string

func (*Reader) Read

func (r *Reader) Read(p []byte) (n int, err error)

func (*Reader) ReadAll

func (r *Reader) ReadAll() (*ByteSlice, error)

func (*Reader) ReadAllBytes

func (r *Reader) ReadAllBytes() ([]byte, error)

func (*Reader) ReadCtx

func (r *Reader) ReadCtx(ctx *Context, p *ByteSlice) (*ByteSlice, error)

func (*Reader) Reader

func (reader *Reader) Reader() *Reader

func (*Reader) SetProp

func (*Reader) SetProp(ctx *Context, name string, value Value) error

func (*Reader) ToSymbolicValue

func (r *Reader) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type Record

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

Record is the immutable counterpart of an Object, Record implements Value.

func NewEmptyRecord

func NewEmptyRecord() *Record

func NewRecordFromKeyValLists

func NewRecordFromKeyValLists(keys []string, values []Serializable) *Record

func NewRecordFromMap

func NewRecordFromMap(entryMap ValMap) *Record

func (*Record) Contains

func (rec *Record) Contains(ctx *Context, value Serializable) bool

func (*Record) EntryMap

func (rec *Record) EntryMap() map[string]Serializable

func (*Record) Equal

func (rec *Record) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Record) ForEachElement

func (rec *Record) ForEachElement(ctx *Context, fn func(index int, v Serializable) error) error

ForEachElement iterates over the elements in the empty "" property, if the property's value is not a tuple the function does nothing.

func (*Record) ForEachEntry

func (rec *Record) ForEachEntry(fn func(k string, v Value) error) error

func (*Record) HasProp

func (rec *Record) HasProp(ctx *Context, name string) bool

func (*Record) IsEmpty

func (rec *Record) IsEmpty(ctx *Context) bool

func (Record) IsMutable

func (rec Record) IsMutable() bool

func (*Record) Iterator

func (rec *Record) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*Record) Keys

func (rec *Record) Keys() []string

func (*Record) Migrate

func (o *Record) Migrate(ctx *Context, key Path, migration *FreeEntityMigrationArgs) (Value, error)

func (Record) PrettyPrint

func (rec Record) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*Record) Prop

func (rec *Record) Prop(ctx *Context, name string) Value

func (Record) PropertyNames

func (rec Record) PropertyNames(ctx *Context) []string

func (Record) SetProp

func (rec Record) SetProp(ctx *Context, name string, value Value) error

func (*Record) ToSymbolicValue

func (rec *Record) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*Record) ValueEntryMap

func (rec *Record) ValueEntryMap() map[string]Value

func (*Record) WriteJSONRepresentation

func (rec *Record) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type RecordPattern

type RecordPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

A RecordPattern represents a pattern matching Inox records (e.g. #{a: 1}), RecordPattern implements Value.

func NewExactRecordPattern

func NewExactRecordPattern(entries []RecordPatternEntry) *RecordPattern

func NewInexactRecordPattern

func NewInexactRecordPattern(entries []RecordPatternEntry) *RecordPattern

func NewRecordPattern

func NewRecordPattern(inexact bool, entries []RecordPatternEntry) *RecordPattern

func (*RecordPattern) CompleteEntry

func (patt *RecordPattern) CompleteEntry(name string) (RecordPatternEntry, bool)

func (*RecordPattern) Entry

func (patt *RecordPattern) Entry(name string) (pattern Pattern, optional bool, yes bool)

func (*RecordPattern) Equal

func (patt *RecordPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*RecordPattern) ForEachEntry

func (patt *RecordPattern) ForEachEntry(fn func(entry RecordPatternEntry) error) error

func (*RecordPattern) GetMigrationOperations

func (patt *RecordPattern) GetMigrationOperations(ctx *Context, next Pattern, pseudoPath string) (migrations []MigrationOp, _ error)

func (*RecordPattern) HasRequiredOrOptionalEntry

func (patt *RecordPattern) HasRequiredOrOptionalEntry(name string) bool

func (*RecordPattern) IsMutable

func (patt *RecordPattern) IsMutable() bool

func (*RecordPattern) Iterator

func (patt *RecordPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*RecordPattern) PrettyPrint

func (patt *RecordPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*RecordPattern) Random

func (patt *RecordPattern) Random(ctx *Context, options ...Option) Value

func (*RecordPattern) StringPattern

func (patt *RecordPattern) StringPattern() (StringPattern, bool)

func (*RecordPattern) Test

func (patt *RecordPattern) Test(ctx *Context, v Value) bool

func (*RecordPattern) ToSymbolicValue

func (p *RecordPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*RecordPattern) ValuePropPattern

func (patt *RecordPattern) ValuePropPattern(name string) (propPattern Pattern, isOptional bool, ok bool)

func (*RecordPattern) ValuePropertyNames

func (patt *RecordPattern) ValuePropertyNames() []string

func (RecordPattern) WriteJSONRepresentation

func (patt RecordPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type RecordPatternEntry

type RecordPatternEntry struct {
	Name       string
	Pattern    Pattern
	IsOptional bool
}

func (RecordPatternEntry) Equal

func (e RecordPatternEntry) Equal(ctx *Context, other RecordPatternEntry, alreadyCompared map[uintptr]uintptr, depth int) bool

type RegexPattern

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

RegexPattern matches any StringLike that matches .regexp

func NewRegexPattern

func NewRegexPattern(s string) *RegexPattern

NewRegexPattern creates a RegexPattern from the given string, the unicode flag is enabled.

func NewRegexPatternFromPERLCompiled

func NewRegexPatternFromPERLCompiled(regexp *regexp.Regexp) *RegexPattern

NewRegexPatternFromPERLCompiled creates a RegexPattern from the given regexp.

func (*RegexPattern) Call

func (patt *RegexPattern) Call(values []Serializable) (Pattern, error)

func (*RegexPattern) CompiledRegex

func (patt *RegexPattern) CompiledRegex() *regexp.Regexp

func (*RegexPattern) EffectiveLengthRange

func (patt *RegexPattern) EffectiveLengthRange() IntRange

func (*RegexPattern) Equal

func (patt *RegexPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*RegexPattern) FindMatches

func (patt *RegexPattern) FindMatches(ctx *Context, val Serializable, config MatchesFindConfig) (groups []Serializable, err error)

func (*RegexPattern) HasRegex

func (pattern *RegexPattern) HasRegex() bool

func (*RegexPattern) IsMutable

func (patt *RegexPattern) IsMutable() bool

func (*RegexPattern) IsResolved

func (patt *RegexPattern) IsResolved() bool

func (RegexPattern) Iterator

func (patt RegexPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*RegexPattern) LengthRange

func (patt *RegexPattern) LengthRange() IntRange

func (*RegexPattern) MatchGroups

func (patt *RegexPattern) MatchGroups(ctx *Context, v Serializable) (map[string]Serializable, bool, error)

func (*RegexPattern) Parse

func (patt *RegexPattern) Parse(ctx *Context, s string) (Serializable, error)

func (*RegexPattern) PatternNestingDepth

func (patt *RegexPattern) PatternNestingDepth(parentDepth int) int

func (*RegexPattern) PrettyPrint

func (patt *RegexPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (RegexPattern) Random

func (pattern RegexPattern) Random(ctx *Context, options ...Option) Value

func (*RegexPattern) Regex

func (pattern *RegexPattern) Regex() string

func (*RegexPattern) Resolve

func (patt *RegexPattern) Resolve() (StringPattern, error)

func (*RegexPattern) StringPattern

func (patt *RegexPattern) StringPattern() (StringPattern, bool)

func (*RegexPattern) Test

func (pattern *RegexPattern) Test(ctx *Context, v Value) bool

func (*RegexPattern) ToSymbolicValue

func (p *RegexPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*RegexPattern) WithLengthRange

func (patt *RegexPattern) WithLengthRange(lenRange IntRange) *RegexPattern

func (RegexPattern) WriteJSONRepresentation

func (patt RegexPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type RelativeTimeInstant64

type RelativeTimeInstant64 int64

RelativeTimeInstant64 is a number of milliseconds since PROCESS_BEGIN_TIME.

func GetRelativeTimeInstant64

func GetRelativeTimeInstant64() RelativeTimeInstant64

GetRelativeTimeInstant64 returns the current RelativeTimeInstant64 (number of milliseconds since PROCESS_BEGIN_TIME).

func (RelativeTimeInstant64) Time

func (i RelativeTimeInstant64) Time() time.Time

Time returns an UTC-located time.

type RemovalMigrationOp

type RemovalMigrationOp struct {
	Value Pattern
	MigrationMixin
}

func (RemovalMigrationOp) ToSymbolicValue

func (op RemovalMigrationOp) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) symbolic.MigrationOp

type Renderable

type Renderable interface {
	Value
	IsRecursivelyRenderable(ctx *Context, config RenderingInput) bool
	Render(ctx *Context, w io.Writer, config RenderingInput) (int, error)
}

A renderable is a Value that can be rendered to at least one MIME type.

type RenderingFn

type RenderingFn func(ctx *Context, w io.Writer, renderable Renderable, config RenderingInput) (int, error)

type RenderingInput

type RenderingInput struct {
	Mime               Mimetype
	OptionalUserConfig Value
}

type RepeatedPatternElement

type RepeatedPatternElement struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

func (*RepeatedPatternElement) CompiledRegex

func (patt *RepeatedPatternElement) CompiledRegex() *regexp.Regexp

func (*RepeatedPatternElement) EffectiveLengthRange

func (patt *RepeatedPatternElement) EffectiveLengthRange() IntRange

func (*RepeatedPatternElement) Equal

func (patt *RepeatedPatternElement) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*RepeatedPatternElement) FindMatches

func (patt *RepeatedPatternElement) FindMatches(ctx *Context, val Serializable, config MatchesFindConfig) (groups []Serializable, err error)

func (*RepeatedPatternElement) HasRegex

func (patt *RepeatedPatternElement) HasRegex() bool

func (*RepeatedPatternElement) IsMutable

func (patt *RepeatedPatternElement) IsMutable() bool

func (*RepeatedPatternElement) IsResolved

func (patt *RepeatedPatternElement) IsResolved() bool

func (*RepeatedPatternElement) Iterator

func (patt *RepeatedPatternElement) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*RepeatedPatternElement) LengthRange

func (patt *RepeatedPatternElement) LengthRange() IntRange

func (*RepeatedPatternElement) MatchGroups

func (patt *RepeatedPatternElement) MatchGroups(ctx *Context, v Serializable) (map[string]Serializable, bool, error)

func (*RepeatedPatternElement) MinMaxCounts

func (patt *RepeatedPatternElement) MinMaxCounts(maxRandOcurrence int) (int, int)

func (*RepeatedPatternElement) Parse

func (patt *RepeatedPatternElement) Parse(ctx *Context, s string) (Serializable, error)

func (*RepeatedPatternElement) PatternNestingDepth

func (patt *RepeatedPatternElement) PatternNestingDepth(parentDepth int) int

func (*RepeatedPatternElement) PrettyPrint

func (patt *RepeatedPatternElement) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*RepeatedPatternElement) Random

func (patt *RepeatedPatternElement) Random(ctx *Context, options ...Option) Value

func (*RepeatedPatternElement) Regex

func (patt *RepeatedPatternElement) Regex() string

func (*RepeatedPatternElement) Resolve

func (patt *RepeatedPatternElement) Resolve() (StringPattern, error)

func (*RepeatedPatternElement) StringPattern

func (patt *RepeatedPatternElement) StringPattern() (StringPattern, bool)

func (*RepeatedPatternElement) Test

func (patt *RepeatedPatternElement) Test(ctx *Context, v Value) bool

func (*RepeatedPatternElement) ToSymbolicValue

func (p *RepeatedPatternElement) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*RepeatedPatternElement) WriteJSONRepresentation

func (patt *RepeatedPatternElement) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type ReplacementMigrationOp

type ReplacementMigrationOp struct {
	Current, Next Pattern
	MigrationMixin
}

func (ReplacementMigrationOp) ToSymbolicValue

func (op ReplacementMigrationOp) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) symbolic.MigrationOp

type ReprConfig

type ReprConfig struct {
	AllVisible bool
}

func (*ReprConfig) IsPropertyVisible

func (r *ReprConfig) IsPropertyVisible(name string, v Value, info *ValueVisibility, ctx *Context) bool

func (*ReprConfig) IsValueVisible

func (r *ReprConfig) IsValueVisible(v Value) bool

type ResourceGraph

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

func NewResourceGraph

func NewResourceGraph() *ResourceGraph

func (*ResourceGraph) AddEdge

func (g *ResourceGraph) AddEdge(from, to ResourceName, rel ResourceRelationKind)

func (*ResourceGraph) AddResource

func (g *ResourceGraph) AddResource(r ResourceName, kind string)

func (*ResourceGraph) GetEdge

func (*ResourceGraph) GetNode

func (g *ResourceGraph) GetNode(r ResourceName) (*ResourceNode, bool)

func (*ResourceGraph) Roots

func (g *ResourceGraph) Roots() (roots []*ResourceNode)

type ResourceName

type ResourceName interface {
	WrappedString
	Serializable
	ResourceName() string
}

A resource name is a string value that designates a resource, examples: URL, Path & Host are resource names. The meaning of resource is broad and should not be confused with HTTP Resources.

func ResourceNameFrom

func ResourceNameFrom(s string) ResourceName

type ResourceNode

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

func (ResourceNode) Kind

func (r ResourceNode) Kind() string

type ResourceRelationKind

type ResourceRelationKind string

type Reversability

type Reversability int
const (
	Irreversible Reversability = iota
	SomewhatReversible
	Reversible
)

type RingBuffer

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

func NewRingBuffer

func NewRingBuffer(ctx *Context, size ByteCount) *RingBuffer

func (*RingBuffer) Capacity

func (r *RingBuffer) Capacity() int

func (*RingBuffer) Equal

func (r *RingBuffer) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*RingBuffer) Free

func (r *RingBuffer) Free() ByteCount

func (*RingBuffer) GetGoMethod

func (r *RingBuffer) GetGoMethod(name string) (*GoFunction, bool)

func (*RingBuffer) IsEmpty

func (r *RingBuffer) IsEmpty() bool

func (*RingBuffer) IsFull

func (r *RingBuffer) IsFull() bool

func (*RingBuffer) IsMutable

func (*RingBuffer) IsMutable() bool

func (*RingBuffer) IsSharable

func (r *RingBuffer) IsSharable(originState *GlobalState) (bool, string)

func (*RingBuffer) IsShared

func (r *RingBuffer) IsShared() bool

func (*RingBuffer) PrettyPrint

func (r *RingBuffer) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*RingBuffer) Prop

func (r *RingBuffer) Prop(ctx *Context, propName string) Value

func (*RingBuffer) PropertyNames

func (r *RingBuffer) PropertyNames(ctx *Context) []string

func (*RingBuffer) Read

func (r *RingBuffer) Read(p []byte) (n int, err error)

func (*RingBuffer) ReadByte

func (r *RingBuffer) ReadByte() (b byte, err error)

func (*RingBuffer) ReadableBytesCopy

func (r *RingBuffer) ReadableBytesCopy() []byte

func (*RingBuffer) ReadableCount

func (r *RingBuffer) ReadableCount(ctx *Context) ByteCount

func (*RingBuffer) Reset

func (r *RingBuffer) Reset()

func (*RingBuffer) SetProp

func (*RingBuffer) SetProp(ctx *Context, name string, value Value) error

func (*RingBuffer) Share

func (r *RingBuffer) Share(originState *GlobalState)

func (*RingBuffer) SmartLock

func (r *RingBuffer) SmartLock(state *GlobalState)

func (*RingBuffer) SmartUnlock

func (r *RingBuffer) SmartUnlock(state *GlobalState)

func (*RingBuffer) Stream

func (*RingBuffer) ToSymbolicValue

func (r *RingBuffer) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*RingBuffer) WritableStream

func (r *RingBuffer) WritableStream(ctx *Context, config *WritableStreamConfiguration) WritableStream

func (*RingBuffer) Write

func (r *RingBuffer) Write(p []byte) (n int, err error)

func (*RingBuffer) WriteString

func (r *RingBuffer) WriteString(s string) (n int, err error)

func (*RingBuffer) Writer

func (r *RingBuffer) Writer() *Writer

type RiskScore

type RiskScore int

func ComputePermissionRiskScore

func ComputePermissionRiskScore(perm Permission) RiskScore

func (RiskScore) ValueAndLevel

func (s RiskScore) ValueAndLevel() string

type Rune

type Rune rune

func (Rune) Compare

func (r Rune) Compare(other Value) (result int, comparable bool)

func (Rune) Equal

func (r Rune) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Rune) IsMutable

func (r Rune) IsMutable() bool

func (Rune) PrettyPrint

func (r Rune) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Rune) Prop

func (r Rune) Prop(ctx *Context, name string) Value

func (Rune) PropertyNames

func (r Rune) PropertyNames(ctx *Context) []string

func (Rune) SetProp

func (Rune) SetProp(ctx *Context, name string, value Value) error

func (Rune) ToSymbolicValue

func (r Rune) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Rune) WriteJSONRepresentation

func (r Rune) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type RuneCount

type RuneCount int64

RuneCount implements Value.

func (RuneCount) AsFloat64

func (c RuneCount) AsFloat64() (float64, bool)

func (RuneCount) AsInt64

func (c RuneCount) AsInt64() (int64, bool)

func (RuneCount) Compare

func (c RuneCount) Compare(other Value) (result int, comparable bool)

func (RuneCount) Equal

func (count RuneCount) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (RuneCount) Int64

func (c RuneCount) Int64() int64

func (RuneCount) IsMutable

func (count RuneCount) IsMutable() bool

func (RuneCount) IsSigned

func (c RuneCount) IsSigned() bool

func (RuneCount) IsZeroQuantity

func (c RuneCount) IsZeroQuantity() bool

func (RuneCount) PrettyPrint

func (count RuneCount) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (RuneCount) ToSymbolicValue

func (c RuneCount) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (RuneCount) WriteJSONRepresentation

func (count RuneCount) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type RuneRange

type RuneRange struct {
	Start rune
	End   rune
}

TODO: implement Iterable

func (RuneRange) At

func (r RuneRange) At(ctx *Context, i int) Value

func (RuneRange) Contains

func (r RuneRange) Contains(ctx *Context, v Serializable) bool

func (RuneRange) Equal

func (r RuneRange) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (RuneRange) Includes

func (r RuneRange) Includes(ctx *Context, i Rune) bool

func (RuneRange) IsEmpty

func (r RuneRange) IsEmpty(ctx *Context) bool

func (RuneRange) IsMutable

func (r RuneRange) IsMutable() bool

func (RuneRange) Iterator

func (r RuneRange) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (RuneRange) Len

func (r RuneRange) Len() int

func (RuneRange) PrettyPrint

func (r RuneRange) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (RuneRange) Random

func (r RuneRange) Random(ctx *Context) interface{}

func (RuneRange) RandomRune

func (r RuneRange) RandomRune() rune

func (RuneRange) ToSymbolicValue

func (r RuneRange) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (RuneRange) WriteJSONRepresentation

func (r RuneRange) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type RuneRangeIterator

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

func (RuneRangeIterator) Equal

func (it RuneRangeIterator) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*RuneRangeIterator) HasNext

func (it *RuneRangeIterator) HasNext(*Context) bool

func (RuneRangeIterator) IsMutable

func (it RuneRangeIterator) IsMutable() bool

func (*RuneRangeIterator) Key

func (it *RuneRangeIterator) Key(ctx *Context) Value

func (*RuneRangeIterator) Next

func (it *RuneRangeIterator) Next(ctx *Context) bool

func (RuneRangeIterator) PrettyPrint

func (it RuneRangeIterator) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (RuneRangeIterator) ToSymbolicValue

func (it RuneRangeIterator) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*RuneRangeIterator) Value

func (it *RuneRangeIterator) Value(*Context) Value

type RuneRangeStringPattern

type RuneRangeStringPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

func NewRuneRangeStringPattern

func NewRuneRangeStringPattern(lower, upper rune, node parse.Node) *RuneRangeStringPattern

func (*RuneRangeStringPattern) CompiledRegex

func (patt *RuneRangeStringPattern) CompiledRegex() *regexp.Regexp

func (*RuneRangeStringPattern) EffectiveLengthRange

func (patt *RuneRangeStringPattern) EffectiveLengthRange() IntRange

func (*RuneRangeStringPattern) Equal

func (patt *RuneRangeStringPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*RuneRangeStringPattern) FindMatches

func (patt *RuneRangeStringPattern) FindMatches(ctx *Context, val Serializable, config MatchesFindConfig) (groups []Serializable, err error)

func (*RuneRangeStringPattern) HasRegex

func (patt *RuneRangeStringPattern) HasRegex() bool

func (*RuneRangeStringPattern) IsMutable

func (patt *RuneRangeStringPattern) IsMutable() bool

func (*RuneRangeStringPattern) IsResolved

func (patt *RuneRangeStringPattern) IsResolved() bool

func (RuneRangeStringPattern) Iterator

func (patt RuneRangeStringPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*RuneRangeStringPattern) LengthRange

func (patt *RuneRangeStringPattern) LengthRange() IntRange

func (*RuneRangeStringPattern) Parse

func (patt *RuneRangeStringPattern) Parse(ctx *Context, s string) (Serializable, error)

func (*RuneRangeStringPattern) PatternNestingDepth

func (patt *RuneRangeStringPattern) PatternNestingDepth(parentDepth int) int

func (*RuneRangeStringPattern) PrettyPrint

func (patt *RuneRangeStringPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*RuneRangeStringPattern) Random

func (patt *RuneRangeStringPattern) Random(ctx *Context, options ...Option) Value

func (*RuneRangeStringPattern) Regex

func (patt *RuneRangeStringPattern) Regex() string

func (*RuneRangeStringPattern) Resolve

func (patt *RuneRangeStringPattern) Resolve() (StringPattern, error)

func (*RuneRangeStringPattern) StringPattern

func (patt *RuneRangeStringPattern) StringPattern() (StringPattern, bool)

func (*RuneRangeStringPattern) Test

func (patt *RuneRangeStringPattern) Test(ctx *Context, v Value) bool

func (*RuneRangeStringPattern) ToSymbolicValue

func (p *RuneRangeStringPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (RuneRangeStringPattern) WriteJSONRepresentation

func (patt RuneRangeStringPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type RuneSlice

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

func NewRuneSlice

func NewRuneSlice(runes []rune) *RuneSlice

func (*RuneSlice) At

func (slice *RuneSlice) At(ctx *Context, i int) Value

func (*RuneSlice) Clone

func (slice *RuneSlice) Clone(originState *GlobalState, sharableValues *[]PotentiallySharable, clones map[uintptr]Clonable, depth int) (Serializable, error)

func (*RuneSlice) ElementsDoNotModify

func (slice *RuneSlice) ElementsDoNotModify() []rune

func (*RuneSlice) Equal

func (slice *RuneSlice) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*RuneSlice) Insert

func (s *RuneSlice) Insert(ctx *Context, v Value, i Int)

func (*RuneSlice) IsFrozen

func (r *RuneSlice) IsFrozen() bool

func (*RuneSlice) IsMutable

func (slice *RuneSlice) IsMutable() bool

func (*RuneSlice) IsRecursivelyRenderable

func (s *RuneSlice) IsRecursivelyRenderable(ctx *Context, input RenderingInput) bool

func (*RuneSlice) Iterator

func (s *RuneSlice) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*RuneSlice) Len

func (slice *RuneSlice) Len() int

func (*RuneSlice) OnMutation

func (*RuneSlice) PrettyPrint

func (slice *RuneSlice) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*RuneSlice) Prop

func (s *RuneSlice) Prop(ctx *Context, name string) Value

func (*RuneSlice) PropertyNames

func (s *RuneSlice) PropertyNames(ctx *Context) []string

func (*RuneSlice) RemoveMutationCallback

func (s *RuneSlice) RemoveMutationCallback(ctx *Context, handle CallbackHandle)

func (*RuneSlice) RemoveMutationCallbackMicrotasks

func (s *RuneSlice) RemoveMutationCallbackMicrotasks(ctx *Context)

func (*RuneSlice) Render

func (s *RuneSlice) Render(ctx *Context, w io.Writer, config RenderingInput) (int, error)

func (*RuneSlice) SetProp

func (*RuneSlice) SetProp(ctx *Context, name string, value Value) error

func (*RuneSlice) SetSlice

func (slice *RuneSlice) SetSlice(ctx *Context, start, end int, seq Sequence)

func (*RuneSlice) TakeInMemorySnapshot

func (r *RuneSlice) TakeInMemorySnapshot(ctx *Context) (*Snapshot, error)

func (*RuneSlice) ToSymbolicValue

func (s *RuneSlice) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*RuneSlice) Unfreeze

func (r *RuneSlice) Unfreeze(ctx *Context) error

func (*RuneSlice) Watcher

func (s *RuneSlice) Watcher(ctx *Context, config WatcherConfiguration) Watcher

func (*RuneSlice) WriteJSONRepresentation

func (slice *RuneSlice) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type ScaledTokenCount

type ScaledTokenCount int64

Token count scaled by TOKEN_BUCKET_CAPACITY_SCALE.

func (ScaledTokenCount) RealCount

func (c ScaledTokenCount) RealCount() int64

type Scheme

type Scheme string

A Scheme represents an URL scheme, example: 'https'.

func (Scheme) Equal

func (scheme Scheme) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Scheme) IsDatabaseScheme

func (s Scheme) IsDatabaseScheme() bool

func (Scheme) IsMutable

func (scheme Scheme) IsMutable() bool

func (Scheme) PrettyPrint

func (scheme Scheme) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Scheme) ToSymbolicValue

func (s Scheme) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Scheme) UnderlyingString

func (s Scheme) UnderlyingString() string

func (Scheme) Validate

func (s Scheme) Validate() error

func (Scheme) WriteJSONRepresentation

func (scheme Scheme) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type SchemeHolder

type SchemeHolder interface {
	ResourceName
	Scheme() Scheme
}

type SecondaryDebugEvent

type SecondaryDebugEvent interface {
	SecondaryDebugEventType() SecondaryDebugEventType
}

type SecondaryDebugEventType

type SecondaryDebugEventType int

func (SecondaryDebugEventType) String

func (t SecondaryDebugEventType) String() string

type Secret

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

A Secret represents a string such as a password, an API-Key or a PEM encoded key; a secret always return false when it is compared for equality.

func (*Secret) AssertIsPattern

func (s *Secret) AssertIsPattern(secret *SecretPattern)

func (*Secret) DecodedPEM

func (s *Secret) DecodedPEM() (*pem.Block, error)

func (*Secret) Equal

func (s *Secret) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Secret) Format

func (s *Secret) Format(f fmt.State, verb rune)

func (*Secret) IsMutable

func (*Secret) IsMutable() bool

func (*Secret) PrettyPrint

func (s *Secret) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*Secret) String

func (s *Secret) String() string

func (*Secret) StringValue

func (s *Secret) StringValue() StringLike

func (*Secret) ToSymbolicValue

func (s *Secret) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*Secret) WriteJSONRepresentation

func (m *Secret) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

func (*Secret) WriteRepresentation

func (m *Secret) WriteRepresentation(ctx *Context, w io.Writer, config *ReprConfig, depth int) error

type SecretName

type SecretName string

func SecretNameFrom

func SecretNameFrom(name string) (SecretName, error)

type SecretPattern

type SecretPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

func NewSecretPattern

func NewSecretPattern(stringPattern StringPattern, pem bool) *SecretPattern

func (*SecretPattern) Equal

func (s *SecretPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*SecretPattern) IsMutable

func (*SecretPattern) IsMutable() bool

func (*SecretPattern) Iterator

func (patt *SecretPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*SecretPattern) NewSecret

func (pattern *SecretPattern) NewSecret(ctx *Context, s string) (*Secret, error)

func (*SecretPattern) PrettyPrint

func (s *SecretPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*SecretPattern) Random

func (pattern *SecretPattern) Random(ctx *Context, options ...Option) Value

func (*SecretPattern) StringPattern

func (pattern *SecretPattern) StringPattern() (StringPattern, bool)

func (*SecretPattern) Test

func (p *SecretPattern) Test(ctx *Context, v Value) bool

Test returns true if the pattern of the secret is p, the content of the secret is not verified.

func (*SecretPattern) ToSymbolicValue

func (p *SecretPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*SecretPattern) WriteJSONRepresentation

func (patt *SecretPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type Sequence

type Sequence interface {
	Indexable
	// contains filtered or unexported methods
}

A Sequence is a sequence of Inox values, it is not necessarily mutable.

type SequenceStringPattern

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

SequenceStringPattern represents a string pattern with sub elements. Sequence string patterns with lazy elements are mutable while they are not fully resolved.

func NewSequenceStringPattern

func NewSequenceStringPattern(
	node *parse.ComplexStringPatternPiece,
	nodeChunk *parse.Chunk,
	subpatterns []StringPattern,
	groupNames KeyList,
) (*SequenceStringPattern, error)

func (*SequenceStringPattern) Call

func (patt *SequenceStringPattern) Call(values []Serializable) (Pattern, error)

func (*SequenceStringPattern) CompiledRegex

func (patt *SequenceStringPattern) CompiledRegex() *regexp.Regexp

func (*SequenceStringPattern) EffectiveLengthRange

func (patt *SequenceStringPattern) EffectiveLengthRange() IntRange

func (*SequenceStringPattern) Equal

func (patt *SequenceStringPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*SequenceStringPattern) FindGroupMatches

func (patt *SequenceStringPattern) FindGroupMatches(ctx *Context, v Serializable, config GroupMatchesFindConfig) (groups []*Object, err error)

func (*SequenceStringPattern) FindMatches

func (patt *SequenceStringPattern) FindMatches(ctx *Context, val Serializable, config MatchesFindConfig) (groups []Serializable, err error)

func (*SequenceStringPattern) HasRegex

func (patt *SequenceStringPattern) HasRegex() bool

func (*SequenceStringPattern) IsMutable

func (patt *SequenceStringPattern) IsMutable() bool

func (*SequenceStringPattern) IsResolved

func (patt *SequenceStringPattern) IsResolved() bool

func (SequenceStringPattern) Iterator

func (patt SequenceStringPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*SequenceStringPattern) LengthRange

func (patt *SequenceStringPattern) LengthRange() IntRange

func (*SequenceStringPattern) MatchGroups

func (patt *SequenceStringPattern) MatchGroups(ctx *Context, v Serializable) (map[string]Serializable, bool, error)

func (*SequenceStringPattern) Parse

func (patt *SequenceStringPattern) Parse(ctx *Context, s string) (Serializable, error)

func (*SequenceStringPattern) PatternNestingDepth

func (patt *SequenceStringPattern) PatternNestingDepth(parentDepth int) int

func (*SequenceStringPattern) PrettyPrint

func (patt *SequenceStringPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (SequenceStringPattern) Random

func (patt SequenceStringPattern) Random(ctx *Context, options ...Option) Value

func (*SequenceStringPattern) Regex

func (patt *SequenceStringPattern) Regex() string

func (*SequenceStringPattern) Resolve

func (patt *SequenceStringPattern) Resolve() (StringPattern, error)

func (*SequenceStringPattern) StringPattern

func (patt *SequenceStringPattern) StringPattern() (StringPattern, bool)

func (*SequenceStringPattern) Test

func (patt *SequenceStringPattern) Test(ctx *Context, v Value) bool

func (*SequenceStringPattern) ToSymbolicValue

func (p *SequenceStringPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (SequenceStringPattern) WriteJSONRepresentation

func (patt SequenceStringPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type Serializable

type Serializable interface {
	Value

	//JSON representation
	WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error
}

Serializable is the interface implemented by all values serializable to JSON.

func ConvertJSONValToInoxVal

func ConvertJSONValToInoxVal(v any, immutable bool) Serializable

func ConvertYamlNodeToInoxVal

func ConvertYamlNodeToInoxVal(ctx *Context, n yaml.Node, immutable bool) Serializable

ConvertYamlNodeToInoxVal converts a YAML AST Node into an Inox value. Records and tuples are returned insted of objects and lists when immutable is true. ConvertYamlNodeToInoxVal has the following limitations: - uint64 values greater than math.MaxInt64 cannot be converted: the function will panic.

func ConvertYamlParsedFileToInoxVal

func ConvertYamlParsedFileToInoxVal(ctx *Context, f *yaml.File, immutable bool) Serializable

ConvertYamlParsedFileToInoxVal converts the list of documents in f to a list (or tuple) of Inox values. A tuple is returned when immutable is true.

func EvalSimpleValueLiteral

func EvalSimpleValueLiteral(n parse.SimpleValueLiteral, global *GlobalState) (Serializable, error)

EvalSimpleValueLiteral evalutes a SimpleValueLiteral node (except IdentifierLiteral because it is ambiguous)

func FindMatchesForRegex

func FindMatchesForRegex(ctx *Context, regexp *regexp.Regexp, s string, config MatchesFindConfig) (matches []Serializable, err error)

func FindMatchesForStringPattern

func FindMatchesForStringPattern(ctx *Context, patt StringPattern, val Serializable, config MatchesFindConfig) (matches []Serializable, err error)

func GetOrLoadValueAtURL

func GetOrLoadValueAtURL(ctx *Context, u URL, state *GlobalState) (Serializable, error)

func ParseJSONRepresentation

func ParseJSONRepresentation(ctx *Context, s string, pattern Pattern) (Serializable, error)

func ParseNextJSONRepresentation

func ParseNextJSONRepresentation(ctx *Context, it *jsoniter.Iterator, pattern Pattern, try bool) (res Serializable, finalErr error)

func RepresentationBasedClone

func RepresentationBasedClone(ctx *Context, val Serializable) (Serializable, error)

RepresentationBasedClone clones a Serializable by marshalling it to JSON and then unmarshalling it.

func ToSerializableAsserted

func ToSerializableAsserted(v any) Serializable

func ToSerializableSlice

func ToSerializableSlice(values []Value) []Serializable

type SerializableIterable

type SerializableIterable interface {
	Iterable
	Serializable
}

type SmartLock

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

A SmartLock is a lock that ignores locking operations until the value it protects is shared. It is not intended to be held for long durations and it should not be used to isolate transactions. The context of the current holder state (module) may be cancelled by other modules calling the Lock method.

func (*SmartLock) AssertValueShared

func (lock *SmartLock) AssertValueShared()

func (*SmartLock) IsHeld

func (lock *SmartLock) IsHeld() bool

IsHeld tells whether the lock is held, regardless of the state of the holder (cancelled or not).

func (*SmartLock) IsValueShared

func (lock *SmartLock) IsValueShared() bool

func (*SmartLock) Lock

func (lock *SmartLock) Lock(state *GlobalState, embedder PotentiallySharable, ignoreLockedValues ...bool)

func (*SmartLock) Share

func (lock *SmartLock) Share(originState *GlobalState, fn func())

func (*SmartLock) Unlock

func (lock *SmartLock) Unlock(state *GlobalState, embedder PotentiallySharable, ignoreLockedValues ...bool)

type Snapshot

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

Snapshot holds either the serialized representation of a Value or a in-memory FROZEN value.

func TakeSnapshot

func TakeSnapshot(ctx *Context, v Serializable, mustBeSerialized bool) (*Snapshot, error)

func (*Snapshot) Date

func (s *Snapshot) Date() DateTime

func (*Snapshot) InstantiateValue

func (s *Snapshot) InstantiateValue(ctx *Context) (Serializable, error)

func (*Snapshot) WithChangeApplied

func (s *Snapshot) WithChangeApplied(ctx *Context, c Change) (*Snapshot, error)

type SnapshotWriteToFilesystem

type SnapshotWriteToFilesystem struct {
	Overwrite bool
}

type SnapshotableFilesystem

type SnapshotableFilesystem interface {
	afs.Filesystem

	//TakeFilesystemSnapshot takes a snapshot of the filesystem using the provided configuration.
	//Implementations should use config.IsFileIncluded to determine if a file or dir should be included in the snapshot;
	//Ancestor hieararchy of included files should always be included.
	//Implementations should use config.GetContent to reduce memory or disk usage.
	TakeFilesystemSnapshot(config FilesystemSnapshotConfig) (FilesystemSnapshot, error)
}

type SortableByNestedValue

type SortableByNestedValue interface {
	SortByNestedValue(ctx *Context, path ValuePath, order Order) error
}

type SpecificMutationAcceptor

type SpecificMutationAcceptor interface {
	Value
	// ApplySpecificMutation should apply the mutation to the Value, ErrNotSupportedSpecificMutation should be returned
	// if it's not possible.
	ApplySpecificMutation(ctx *Context, m Mutation) error
}

type SpecificMutationKind

type SpecificMutationKind int8
const (
	// This mutation adds a single node + an optional edge
	SG_AddNode SpecificMutationKind = iota + 1

	// This mutation adds a single edge
	SG_AddEdge

	// This mutation adds a single event
	SG_AddEvent
)

type SpecificMutationMetadata

type SpecificMutationMetadata struct {
	Version SpecificMutationVersion
	Kind    SpecificMutationKind //Depends on the value on which the mutation is applied.
	Depth   WatchingDepth
	Path    Path
}

type SpecificMutationVersion

type SpecificMutationVersion int8

type StackFrameInfo

type StackFrameInfo struct {
	Name string

	//can be nil, current *Chunk | *FunctionExpression or statement (current statement if we are stopped at a breakpoint exception)
	Node parse.Node

	Chunk       *parse.ParsedChunkSource
	Id          int32 //set if debugging, unique for a given debugger tree (~ session)
	StartLine   int32
	StartColumn int32

	StatementStartLine   int32
	StatementStartColumn int32
}

type StatDirEntry

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

func NewStatDirEntry

func NewStatDirEntry(info fs.FileInfo) *StatDirEntry

func (*StatDirEntry) Info

func (d *StatDirEntry) Info() (fs.FileInfo, error)

func (*StatDirEntry) IsDir

func (d *StatDirEntry) IsDir() bool

func (*StatDirEntry) Name

func (d *StatDirEntry) Name() string

func (*StatDirEntry) Type

func (d *StatDirEntry) Type() fs.FileMode

type StateId

type StateId int64

type StatelessParser

type StatelessParser interface {
	Validate(ctx *Context, s string) bool

	// Parse parses a string in the data format supported by the parser and returns the resulting value.
	// Mutable returned values should never be stored to be returned later.
	Parse(ctx *Context, s string) (Serializable, error)
}

A StatelessParser represents a parser for a data format such as JSON or YAML. Implementations are allowed to use caching internally.

func GetParser

func GetParser(mime Mimetype) (StatelessParser, bool)

type StaticCheckData

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

A StaticCheckData is the immutable data produced by statically checking a module.

func StaticCheck

func StaticCheck(input StaticCheckInput) (*StaticCheckData, error)

StaticCheck performs various checks on an AST, like checking duplicate declarations and keys or checking that statements like return, break and continue are not misplaced. No type checks are performed.

func (*StaticCheckData) Equal

func (d *StaticCheckData) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*StaticCheckData) ErrorTuple

func (d *StaticCheckData) ErrorTuple() *Tuple

func (*StaticCheckData) Errors

func (d *StaticCheckData) Errors() []*StaticCheckError

Errors returns all errors in the code after a static check, the result should not be modified.

func (*StaticCheckData) GetFnData

func (data *StaticCheckData) GetFnData(fnExpr *parse.FunctionExpression) *FunctionStaticData

func (*StaticCheckData) GetGoMethod

func (d *StaticCheckData) GetGoMethod(name string) (*GoFunction, bool)

func (*StaticCheckData) GetMappingData

func (data *StaticCheckData) GetMappingData(expr *parse.MappingExpression) *MappingStaticData

func (*StaticCheckData) IsMutable

func (*StaticCheckData) IsMutable() bool

func (*StaticCheckData) PrettyPrint

func (d *StaticCheckData) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*StaticCheckData) Prop

func (d *StaticCheckData) Prop(ctx *Context, name string) Value

func (*StaticCheckData) PropertyNames

func (*StaticCheckData) PropertyNames(ctx *Context) []string

func (*StaticCheckData) SetProp

func (*StaticCheckData) SetProp(ctx *Context, name string, value Value) error

func (*StaticCheckData) ToSymbolicValue

func (d *StaticCheckData) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*StaticCheckData) WarningTuple

func (d *StaticCheckData) WarningTuple() *Tuple

func (*StaticCheckData) Warnings

func (d *StaticCheckData) Warnings() []*StaticCheckWarning

Warnings returns all warnings in the code after a static check, the result should not be modified.

type StaticCheckError

type StaticCheckError struct {
	Message        string
	LocatedMessage string
	Location       parse.SourcePositionStack
}

func NewStaticCheckError

func NewStaticCheckError(s string, location parse.SourcePositionStack) *StaticCheckError

func (StaticCheckError) Err

func (err StaticCheckError) Err() Error

func (StaticCheckError) Error

func (err StaticCheckError) Error() string

func (StaticCheckError) LocationStack

func (err StaticCheckError) LocationStack() parse.SourcePositionStack

func (StaticCheckError) MessageWithoutLocation

func (err StaticCheckError) MessageWithoutLocation() string

type StaticCheckInput

type StaticCheckInput struct {
	State                  *GlobalState //mainly used when checking imported modules
	Node                   parse.Node
	Module                 *Module
	Chunk                  *parse.ParsedChunkSource
	ParentChecker          *checker
	Globals                GlobalVariables
	AdditionalGlobalConsts []string
	ShellLocalVars         map[string]Value
	Patterns               map[string]Pattern
	PatternNamespaces      map[string]*PatternNamespace
}

type StaticCheckWarning

type StaticCheckWarning struct {
	Message        string
	LocatedMessage string
	Location       parse.SourcePositionStack
}

func NewStaticCheckWarning

func NewStaticCheckWarning(s string, location parse.SourcePositionStack) *StaticCheckWarning

func (StaticCheckWarning) LocationStack

func (err StaticCheckWarning) LocationStack() parse.SourcePositionStack

func (StaticCheckWarning) MessageWithoutLocation

func (err StaticCheckWarning) MessageWithoutLocation() string

type StaticallyCheckDbResolutionDataFn

type StaticallyCheckDbResolutionDataFn func(node parse.Node, optProject Project) (errorMsg string)

func GetStaticallyCheckDbResolutionDataFn

func GetStaticallyCheckDbResolutionDataFn(scheme Scheme) (StaticallyCheckDbResolutionDataFn, bool)

type StaticallyCheckHostDefinitionFn

type StaticallyCheckHostDefinitionFn func(optionalProject Project, node parse.Node) (errorMsg string)

type StrListIterator

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

func (*StrListIterator) Equal

func (it *StrListIterator) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (StrListIterator) HasNext

func (it StrListIterator) HasNext(*Context) bool

func (*StrListIterator) IsMutable

func (it *StrListIterator) IsMutable() bool

func (*StrListIterator) Key

func (it *StrListIterator) Key(ctx *Context) Value

func (*StrListIterator) Next

func (it *StrListIterator) Next(ctx *Context) bool

func (*StrListIterator) PrettyPrint

func (it *StrListIterator) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*StrListIterator) ToSymbolicValue

func (it *StrListIterator) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*StrListIterator) Value

func (it *StrListIterator) Value(*Context) Value

type StreamSink

type StreamSink interface {
	Value

	WritableStream(ctx *Context, optionalConfig *WritableStreamConfiguration) WritableStream
}

type StreamSource

type StreamSource interface {
	Value

	Stream(ctx *Context, optionalConfig *ReadableStreamConfiguration) ReadableStream
}

type String

type String string

Inox string type, String implements Value.

func NewStringFromSlices

func NewStringFromSlices(slices []Value, node *parse.StringTemplateLiteral, ctx *Context) (String, error)

func ToJSON

func ToJSON(ctx *Context, v Serializable, pattern *OptionalParam[Pattern]) String

func ToJSONWithConfig

func ToJSONWithConfig(ctx *Context, v Serializable, config JSONSerializationConfig) String

func ToPrettyJSON

func ToPrettyJSON(ctx *Context, v Serializable, pattern *OptionalParam[Pattern]) String

func (String) At

func (s String) At(ctx *Context, i int) Value

func (String) ByteLen

func (s String) ByteLen() int

func (String) ByteLike

func (s String) ByteLike() []byte

func (String) Compare

func (s String) Compare(other Value) (result int, comparable bool)

func (String) Equal

func (s String) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (String) GetOrBuildString

func (s String) GetOrBuildString() string

func (String) HasPrefix

func (s String) HasPrefix(ctx *Context, prefix StringLike) Bool

func (String) HasSuffix

func (s String) HasSuffix(ctx *Context, prefix StringLike) Bool

func (String) IsMutable

func (s String) IsMutable() bool

func (String) IsRecursivelyRenderable

func (s String) IsRecursivelyRenderable(ctx *Context, input RenderingInput) bool

func (String) Iterator

func (s String) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (String) Len

func (s String) Len() int

func (String) PrettyPrint

func (s String) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (String) Prop

func (s String) Prop(ctx *Context, name string) Value

func (String) PropertyNames

func (s String) PropertyNames(ctx *Context) []string

func (String) Reader

func (s String) Reader() *Reader

func (String) Render

func (s String) Render(ctx *Context, w io.Writer, config RenderingInput) (int, error)

func (String) Replace

func (s String) Replace(ctx *Context, old, new StringLike) StringLike

func (String) RuneCount

func (s String) RuneCount() int

func (String) SetProp

func (String) SetProp(ctx *Context, name string, value Value) error

func (String) ToSymbolicValue

func (s String) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (String) TrimSpace

func (s String) TrimSpace(ctx *Context) StringLike

func (String) UnderlyingString

func (s String) UnderlyingString() string

func (String) WriteJSONRepresentation

func (s String) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type StringConcatenation

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

StringConcatenation is a lazy concatenation of string-like values that can form a string, it implements StringLike and is therefore immutable from the POV of Inox code. StringConcatenation can be considered truly immutable once the concatenation has been performed. This can be forced by calling the GetOrBuildString method.

func NewStringConcatenation

func NewStringConcatenation(elements ...StringLike) *StringConcatenation

func (*StringConcatenation) At

func (c *StringConcatenation) At(ctx *Context, i int) Value

func (*StringConcatenation) ByteLen

func (c *StringConcatenation) ByteLen() int

func (*StringConcatenation) Equal

func (c *StringConcatenation) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*StringConcatenation) GetOrBuildString

func (c *StringConcatenation) GetOrBuildString() string

func (*StringConcatenation) HasPrefix

func (c *StringConcatenation) HasPrefix(ctx *Context, prefix StringLike) Bool

func (*StringConcatenation) HasSuffix

func (c *StringConcatenation) HasSuffix(ctx *Context, prefix StringLike) Bool

func (*StringConcatenation) IsMutable

func (c *StringConcatenation) IsMutable() bool

func (*StringConcatenation) Iterator

func (c *StringConcatenation) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*StringConcatenation) Len

func (c *StringConcatenation) Len() int

func (*StringConcatenation) PrettyPrint

func (c *StringConcatenation) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*StringConcatenation) Prop

func (c *StringConcatenation) Prop(ctx *Context, name string) Value

func (*StringConcatenation) PropertyNames

func (c *StringConcatenation) PropertyNames(ctx *Context) []string

func (*StringConcatenation) Reader

func (c *StringConcatenation) Reader() *Reader

func (*StringConcatenation) Replace

func (c *StringConcatenation) Replace(ctx *Context, old, new StringLike) StringLike

func (*StringConcatenation) RuneCount

func (c *StringConcatenation) RuneCount() int

func (*StringConcatenation) SetProp

func (*StringConcatenation) SetProp(ctx *Context, name string, value Value) error

func (*StringConcatenation) ToSymbolicValue

func (c *StringConcatenation) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*StringConcatenation) TrimSpace

func (c *StringConcatenation) TrimSpace(ctx *Context) StringLike

func (*StringConcatenation) WriteJSONRepresentation

func (c *StringConcatenation) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type StringFormat

type StringFormat interface {
	Format
	StringPattern
}

type StringLike

type StringLike interface {
	Serializable
	Sequence
	IProps
	GetOrBuildString() string
	ByteLen() int
	RuneCount() int

	Replace(ctx *Context, old, new StringLike) StringLike
	TrimSpace(ctx *Context) StringLike
	HasPrefix(ctx *Context, prefix StringLike) Bool
	HasSuffix(ctx *Context, prefix StringLike) Bool
}

A StringLike represents an abstract immutable string, it should behave exactly like a regular Str and have the same pseudo properties. A StringLike should never perform internal mutation if IsMutable or GetOrBuildString is called.

func ConcatStringLikes

func ConcatStringLikes(stringLikes ...StringLike) (StringLike, error)

type StringList

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

StringList implements underlyingList

func (*StringList) At

func (list *StringList) At(ctx *Context, i int) Value

func (*StringList) Clone

func (list *StringList) Clone(originState *GlobalState, sharableValues *[]PotentiallySharable, clones map[uintptr]Clonable, depth int) (Serializable, error)

func (*StringList) ConstraintId

func (list *StringList) ConstraintId() ConstraintId

func (*StringList) ContainsSimple

func (list *StringList) ContainsSimple(ctx *Context, v Serializable) bool

func (*StringList) Equal

func (list *StringList) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*StringList) IsMutable

func (list *StringList) IsMutable() bool

func (*StringList) Iterator

func (list *StringList) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*StringList) Len

func (list *StringList) Len() int

func (*StringList) PrettyPrint

func (list *StringList) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*StringList) SetSlice

func (list *StringList) SetSlice(ctx *Context, start, end int, seq Sequence)

func (*StringList) ToSymbolicValue

func (l *StringList) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*StringList) WriteJSONRepresentation

func (list *StringList) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type StringPattern

type StringPattern interface {
	Pattern

	//IsResolved should return true if the pattern is lazy or contains lazy sub patterns.
	IsResolved() bool

	//Resolve should replace lazy patterns with resolved patterns.
	//Patterns that are already resolved should return themselves and patterns containing
	//sub patterns should mutate themselves.
	Resolve() (StringPattern, error)

	PatternNestingDepth(parentDepth int) int

	Regex() string
	CompiledRegex() *regexp.Regexp
	HasRegex() bool

	LengthRange() IntRange
	EffectiveLengthRange() IntRange //length range effectively used to match strings

	FindMatches(*Context, Serializable, MatchesFindConfig) (groups []Serializable, err error)
	Parse(*Context, string) (Serializable, error)
	// contains filtered or unexported methods
}

func NewPEMRegexPattern

func NewPEMRegexPattern(typeRegex string) StringPattern

type StrongTransactionIsolator

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

func (*StrongTransactionIsolator) WaitForOtherTxsToTerminate

func (isolator *StrongTransactionIsolator) WaitForOtherTxsToTerminate(ctx *Context, requireRunningTx bool) (currentTx *Transaction, _ error)

WaitForOtherTxsToTerminate waits for specific transactions tracked by the isolator to terminate, it returns $ctx's transaction (can be nil). If $ctx has no transaction the call will only wait if there is a read-write transaction. Readonly transactions do not have to wait if only readonly transactions are tracked by the isolator. Read-write transactions have to wait for all readonly transactions, or the currently tracked read-write transaction, to terminate. ErrWaitReadonlyTxsTimeout is returned if too much time is spent waiting for readonly transaction to terminate. TODO: add similar error for waiting too long for the current read-write tx to terminate. When the currently tracked read-write transaction terminates, a random transaction among all waiting transactions resumes. In other words the first transaction to start waiting is not necessarily the one to resume first. TODO: AVOID STARVATION. ErrRunningTransactionExpected is returned if requireRunningTx is true and $ctx has no tx.

type Struct

type Struct byte //converting *Struct to a Value interface does not require allocations.

func (*Struct) Equal

func (ptr *Struct) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Struct) IsMutable

func (Struct) IsMutable() bool

func (Struct) PrettyPrint

func (Struct) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Struct) ToSymbolicValue

func (Struct) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type StructType

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

func (*StructType) FieldCount

func (t *StructType) FieldCount() int

func (*StructType) FieldRetrievalInfo

func (t *StructType) FieldRetrievalInfo(name string) fieldRetrievalInfo

func (*StructType) GoType

func (t *StructType) GoType() reflect.Type

func (*StructType) Symbolic

func (t *StructType) Symbolic() symbolic.CompileTimeType

type Subscriber

type Subscriber interface {
	Value
	ReceivePublication(ctx *Context, pub *Publication)
}

type Subscription

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

A Subscription holds metadata about the subscription of a Subscriber to a Publisher.

func (*Subscription) Equal

func (s *Subscription) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Subscription) IsMutable

func (*Subscription) IsMutable() bool

func (*Subscription) PrettyPrint

func (s *Subscription) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*Subscription) ToSymbolicValue

func (s *Subscription) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type Subscriptions

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

func (*Subscriptions) ReceivePublications

func (s *Subscriptions) ReceivePublications(ctx *Context, pub *Publication)

type SymbolicData

type SymbolicData struct {
	*symbolic.Data
	// contains filtered or unexported fields
}

func (*SymbolicData) Equal

func (d *SymbolicData) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*SymbolicData) ErrorTuple

func (d *SymbolicData) ErrorTuple() *Tuple

func (*SymbolicData) GetGoMethod

func (d *SymbolicData) GetGoMethod(name string) (*GoFunction, bool)

func (*SymbolicData) IsMutable

func (*SymbolicData) IsMutable() bool

func (*SymbolicData) PrettyPrint

func (d *SymbolicData) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*SymbolicData) Prop

func (d *SymbolicData) Prop(ctx *Context, name string) Value

func (*SymbolicData) PropertyNames

func (*SymbolicData) PropertyNames(ctx *Context) []string

func (*SymbolicData) SetProp

func (*SymbolicData) SetProp(ctx *Context, name string, value Value) error

func (*SymbolicData) ToSymbolicValue

func (d *SymbolicData) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type SynchronousMessageHandler

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

func NewSynchronousMessageHandler

func NewSynchronousMessageHandler(ctx *Context, fn *InoxFunction, pattern Pattern) *SynchronousMessageHandler

func (*SynchronousMessageHandler) Equal

func (h *SynchronousMessageHandler) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*SynchronousMessageHandler) IsMutable

func (*SynchronousMessageHandler) IsMutable() bool

func (*SynchronousMessageHandler) OnMutation

func (*SynchronousMessageHandler) Pattern

func (h *SynchronousMessageHandler) Pattern() Pattern

func (*SynchronousMessageHandler) PrettyPrint

func (h *SynchronousMessageHandler) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*SynchronousMessageHandler) Prop

func (h *SynchronousMessageHandler) Prop(ctx *Context, name string) Value

func (*SynchronousMessageHandler) PropertyNames

func (*SynchronousMessageHandler) PropertyNames(ctx *Context) []string

func (*SynchronousMessageHandler) RemoveMutationCallback

func (h *SynchronousMessageHandler) RemoveMutationCallback(ctx *Context, handle CallbackHandle)

func (*SynchronousMessageHandler) RemoveMutationCallbackMicrotasks

func (h *SynchronousMessageHandler) RemoveMutationCallbackMicrotasks(ctx *Context)

func (*SynchronousMessageHandler) SetProp

func (*SynchronousMessageHandler) SetProp(ctx *Context, name string, value Value) error

func (*SynchronousMessageHandler) ToSymbolicValue

func (h *SynchronousMessageHandler) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*SynchronousMessageHandler) Watcher

func (*SynchronousMessageHandler) WriteJSONRepresentation

func (h *SynchronousMessageHandler) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type SynchronousMessageHandlers

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

func NewSynchronousMessageHandlers

func NewSynchronousMessageHandlers(handlers ...*SynchronousMessageHandler) *SynchronousMessageHandlers

func (*SynchronousMessageHandlers) CallHandlers

func (handlers *SynchronousMessageHandlers) CallHandlers(ctx *Context, msg Message, self Value) error

type SystemGraph

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

A SystemGraph represents relations & events between values.

func NewSystemGraph

func NewSystemGraph() *SystemGraph

func (*SystemGraph) AddChildNode

func (g *SystemGraph) AddChildNode(ctx *Context, parent SystemGraphNodeValue, value SystemGraphNodeValue, name string, additionalEdgeKinds ...SystemGraphEdgeKind)

AddChildNode is like AddNode but it also adds an edge of kind EdgeChild from the parent value's node to the newly created node

func (*SystemGraph) AddEvent

func (g *SystemGraph) AddEvent(ctx *Context, text string, v SystemGraphNodeValue)

func (*SystemGraph) AddNode

func (g *SystemGraph) AddNode(ctx *Context, value SystemGraphNodeValue, name string)

func (*SystemGraph) AddWatchedNode

func (g *SystemGraph) AddWatchedNode(ctx *Context, watchingVal SystemGraphNodeValue, watchedValue SystemGraphNodeValue, name string)

AddWatcheddNode is like AddChildNode but the kind of the newly created edge is EdgeWatched

func (*SystemGraph) ApplySpecificMutation

func (g *SystemGraph) ApplySpecificMutation(ctx *Context, m Mutation) error

func (*SystemGraph) Equal

func (g *SystemGraph) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*SystemGraph) IsFrozen

func (g *SystemGraph) IsFrozen() bool

func (*SystemGraph) IsMutable

func (*SystemGraph) IsMutable() bool

func (*SystemGraph) IsSharable

func (g *SystemGraph) IsSharable(originState *GlobalState) (bool, string)

func (*SystemGraph) IsShared

func (g *SystemGraph) IsShared() bool

func (*SystemGraph) OnMutation

func (*SystemGraph) PrettyPrint

func (g *SystemGraph) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*SystemGraph) Prop

func (g *SystemGraph) Prop(ctx *Context, name string) Value

func (*SystemGraph) PropertyNames

func (*SystemGraph) PropertyNames(ctx *Context) []string

func (*SystemGraph) Ptr

func (*SystemGraph) RemoveMutationCallback

func (g *SystemGraph) RemoveMutationCallback(ctx *Context, handle CallbackHandle)

func (*SystemGraph) RemoveMutationCallbackMicrotasks

func (g *SystemGraph) RemoveMutationCallbackMicrotasks(ctx *Context)

func (*SystemGraph) SetProp

func (*SystemGraph) SetProp(ctx *Context, name string, value Value) error

func (*SystemGraph) Share

func (g *SystemGraph) Share(originState *GlobalState)

func (*SystemGraph) SmartLock

func (g *SystemGraph) SmartLock(state *GlobalState)

func (*SystemGraph) SmartUnlock

func (g *SystemGraph) SmartUnlock(state *GlobalState)

func (*SystemGraph) TakeInMemorySnapshot

func (g *SystemGraph) TakeInMemorySnapshot(ctx *Context) (*Snapshot, error)

func (*SystemGraph) ToSymbolicValue

func (g *SystemGraph) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*SystemGraph) Unfreeze

func (g *SystemGraph) Unfreeze(ctx *Context) error

func (*SystemGraph) Watcher

func (*SystemGraph) Watcher(ctx *Context, config WatcherConfiguration) Watcher

func (*SystemGraph) WriteJSONRepresentation

func (g *SystemGraph) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type SystemGraphAccessPermission

type SystemGraphAccessPermission struct {
	Kind_ PermissionKind
}

func (SystemGraphAccessPermission) Includes

func (perm SystemGraphAccessPermission) Includes(otherPerm Permission) bool

func (SystemGraphAccessPermission) InternalPermTypename

func (SystemGraphAccessPermission) Kind

func (SystemGraphAccessPermission) String

func (perm SystemGraphAccessPermission) String() string

type SystemGraphEdge

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

func (SystemGraphEdge) Equal

func (e SystemGraphEdge) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (SystemGraphEdge) IsMutable

func (SystemGraphEdge) IsMutable() bool

func (SystemGraphEdge) IsSharable

func (e SystemGraphEdge) IsSharable(originState *GlobalState) (bool, string)

func (SystemGraphEdge) PrettyPrint

func (e SystemGraphEdge) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (SystemGraphEdge) Prop

func (e SystemGraphEdge) Prop(ctx *Context, name string) Value

func (SystemGraphEdge) PropertyNames

func (SystemGraphEdge) PropertyNames(ctx *Context) []string

func (SystemGraphEdge) SetProp

func (SystemGraphEdge) SetProp(ctx *Context, name string, value Value) error

func (SystemGraphEdge) ToSymbolicValue

func (e SystemGraphEdge) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (SystemGraphEdge) WriteJSONRepresentation

func (e SystemGraphEdge) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type SystemGraphEdgeKind

type SystemGraphEdgeKind uint8
const (
	EdgeChild SystemGraphEdgeKind = iota + 1
	EdgeWatched
)

func (SystemGraphEdgeKind) DefaultText

func (k SystemGraphEdgeKind) DefaultText() string

type SystemGraphEvent

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

A SystemGraphEvent is an immutable value representing an event in an node or between two nodes.

func (SystemGraphEvent) Equal

func (e SystemGraphEvent) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (SystemGraphEvent) IsMutable

func (SystemGraphEvent) IsMutable() bool

func (SystemGraphEvent) PrettyPrint

func (e SystemGraphEvent) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (SystemGraphEvent) Prop

func (e SystemGraphEvent) Prop(ctx *Context, name string) Value

func (SystemGraphEvent) PropertyNames

func (SystemGraphEvent) PropertyNames(ctx *Context) []string

func (SystemGraphEvent) SetProp

func (SystemGraphEvent) SetProp(ctx *Context, name string, value Value) error

func (SystemGraphEvent) ToSymbolicValue

func (e SystemGraphEvent) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (SystemGraphEvent) WriteJSONRepresentation

func (e SystemGraphEvent) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type SystemGraphNode

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

func (*SystemGraphNode) Equal

func (g *SystemGraphNode) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*SystemGraphNode) IsMutable

func (*SystemGraphNode) IsMutable() bool

func (*SystemGraphNode) IsSharable

func (n *SystemGraphNode) IsSharable(originState *GlobalState) (bool, string)

func (*SystemGraphNode) IsShared

func (n *SystemGraphNode) IsShared() bool

func (*SystemGraphNode) PrettyPrint

func (n *SystemGraphNode) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*SystemGraphNode) Prop

func (n *SystemGraphNode) Prop(ctx *Context, name string) Value

func (*SystemGraphNode) PropertyNames

func (*SystemGraphNode) PropertyNames(ctx *Context) []string

func (*SystemGraphNode) SetProp

func (*SystemGraphNode) SetProp(ctx *Context, name string, value Value) error

func (*SystemGraphNode) Share

func (n *SystemGraphNode) Share(originState *GlobalState)

func (*SystemGraphNode) SmartLock

func (n *SystemGraphNode) SmartLock(state *GlobalState)

func (*SystemGraphNode) SmartUnlock

func (n *SystemGraphNode) SmartUnlock()

func (*SystemGraphNode) ToSymbolicValue

func (n *SystemGraphNode) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type SystemGraphNodeValue

type SystemGraphNodeValue interface {
	Watchable
	ProposeSystemGraph(ctx *Context, g *SystemGraph, propoposedName string, optionalParent SystemGraphNodeValue)
	SystemGraph() *SystemGraph
	AddSystemGraphEvent(ctx *Context, text string)
}

type SystemGraphNodes

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

func (*SystemGraphNodes) Equal

func (n *SystemGraphNodes) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*SystemGraphNodes) IsMutable

func (*SystemGraphNodes) IsMutable() bool

func (*SystemGraphNodes) IsSharable

func (n *SystemGraphNodes) IsSharable(originState *GlobalState) (bool, string)

func (*SystemGraphNodes) IsShared

func (n *SystemGraphNodes) IsShared() bool

func (*SystemGraphNodes) Iterator

func (n *SystemGraphNodes) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*SystemGraphNodes) PrettyPrint

func (n *SystemGraphNodes) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*SystemGraphNodes) Share

func (n *SystemGraphNodes) Share(originState *GlobalState)

func (*SystemGraphNodes) SmartLock

func (n *SystemGraphNodes) SmartLock(state *GlobalState)

func (*SystemGraphNodes) SmartUnlock

func (n *SystemGraphNodes) SmartUnlock(state *GlobalState)

func (*SystemGraphNodes) ToSymbolicValue

func (n *SystemGraphNodes) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type SystemGraphPointer

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

func (*SystemGraphPointer) AddEvent

func (p *SystemGraphPointer) AddEvent(ctx *Context, text string, v SystemGraphNodeValue)

func (*SystemGraphPointer) Graph

func (p *SystemGraphPointer) Graph() *SystemGraph

func (*SystemGraphPointer) Set

type TestCase

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

A TestCase represents a test case, TestCase implements Value.

func NewTestCase

func NewTestCase(input TestCaseCreationInput) (*TestCase, error)

func (*TestCase) Equal

func (c *TestCase) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*TestCase) FilesystemSnapshot

func (c *TestCase) FilesystemSnapshot() (FilesystemSnapshot, bool)

func (*TestCase) GetGoMethod

func (s *TestCase) GetGoMethod(name string) (*GoFunction, bool)

func (*TestCase) IsMutable

func (c *TestCase) IsMutable() bool

func (*TestCase) ItemName

func (c *TestCase) ItemName() (string, bool)

func (*TestCase) ParentChunk

func (c *TestCase) ParentChunk() *parse.ParsedChunkSource

Module returns the chunk that contains the test.

func (*TestCase) ParentModule

func (c *TestCase) ParentModule() *Module

Module returns the module that contains the test.

func (*TestCase) PrettyPrint

func (c *TestCase) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*TestCase) Prop

func (s *TestCase) Prop(ctx *Context, name string) Value

func (*TestCase) PropertyNames

func (*TestCase) PropertyNames(ctx *Context) []string

func (*TestCase) Run

func (c *TestCase) Run(ctx *Context, options ...Option) (*LThread, error)

func (*TestCase) SetProp

func (*TestCase) SetProp(ctx *Context, name string, value Value) error

func (*TestCase) Statement

func (c *TestCase) Statement() parse.Node

func (*TestCase) ToSymbolicValue

func (c *TestCase) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type TestCaseCreationInput

type TestCaseCreationInput struct {
	Meta Value
	Node *parse.TestCaseExpression

	ModChunk    *parse.Chunk
	ParentState *GlobalState
	ParentChunk *parse.ParsedChunkSource

	//optional
	PositionStack     parse.SourcePositionStack
	FormattedLocation string
}

type TestCaseResult

type TestCaseResult struct {
	Success                bool   `json:"success"`
	DarkModePrettyMessage  string //colorized
	LightModePrettyMessage string //colorized
	Message                string
	// contains filtered or unexported fields
}

func NewTestCaseResult

func NewTestCaseResult(ctx *Context, executionResult Value, executionError error, testCase *TestCase) (*TestCaseResult, error)

func (*TestCaseResult) Equal

func (r *TestCaseResult) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*TestCaseResult) IsMutable

func (c *TestCaseResult) IsMutable() bool

func (*TestCaseResult) PrettyPrint

func (r *TestCaseResult) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*TestCaseResult) ToSymbolicValue

func (r *TestCaseResult) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type TestFilter

type TestFilter struct {
	//never nil
	NameRegex string

	//if path ends with '/...' all tests found in subdirectories are also enabled.
	//this field is ignored if it is empty.
	AbsolutePath string

	//span of the test suite or test case statement, this field is ignored if it is equal to the zero value
	//or AbsolutePath is empty.
	NodeSpan parse.NodeSpan
}

A TestFilter filter tests by checking several values.

func (TestFilter) IsTestEnabled

func (f TestFilter) IsTestEnabled(absoluteFilePath string, item TestItem, parentState *GlobalState) (enabled bool, reason string)

func (TestFilter) String

func (f TestFilter) String() string

type TestFilters

type TestFilters struct {
	PositiveTestFilters []TestFilter
	NegativeTestFilters []TestFilter
}

func (TestFilters) IsTestEnabled

func (filters TestFilters) IsTestEnabled(item TestItem, parentState *GlobalState) (enabled bool, reason string)

type TestItem

type TestItem interface {
	ItemName() (string, bool)
	ParentChunk() *parse.ParsedChunkSource
	ParentModule() *Module
	Statement() parse.Node
	FilesystemSnapshot() (FilesystemSnapshot, bool)
}

A TestItem is a TestSuite or a TestCase.

type TestSuite

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

A TestSuite represents a test suite, TestSuite implements Value.

func NewTestSuite

func NewTestSuite(input TestSuiteCreationInput) (*TestSuite, error)

func (*TestSuite) Equal

func (s *TestSuite) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*TestSuite) FilesystemSnapshot

func (s *TestSuite) FilesystemSnapshot() (FilesystemSnapshot, bool)

func (*TestSuite) GetGoMethod

func (s *TestSuite) GetGoMethod(name string) (*GoFunction, bool)

func (*TestSuite) IsMutable

func (s *TestSuite) IsMutable() bool

func (*TestSuite) ItemName

func (s *TestSuite) ItemName() (string, bool)

func (*TestSuite) ParentChunk

func (s *TestSuite) ParentChunk() *parse.ParsedChunkSource

Module returns the chunk that contains the test.

func (*TestSuite) ParentModule

func (s *TestSuite) ParentModule() *Module

Module returns the module that contains the test.

func (*TestSuite) PrettyPrint

func (s *TestSuite) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*TestSuite) Prop

func (s *TestSuite) Prop(ctx *Context, name string) Value

func (*TestSuite) PropertyNames

func (*TestSuite) PropertyNames(ctx *Context) []string

func (*TestSuite) Run

func (s *TestSuite) Run(ctx *Context, options ...Option) (*LThread, error)

func (*TestSuite) SetProp

func (*TestSuite) SetProp(ctx *Context, name string, value Value) error

func (*TestSuite) Statement

func (s *TestSuite) Statement() parse.Node

func (*TestSuite) ToSymbolicValue

func (s *TestSuite) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type TestSuiteCreationInput

type TestSuiteCreationInput struct {
	Meta             Value
	Node             *parse.TestSuiteExpression
	EmbeddedModChunk *parse.Chunk
	ParentChunk      *parse.ParsedChunkSource
	ParentState      *GlobalState
}

type TestSuiteResult

type TestSuiteResult struct {
	Success bool

	DarkModePrettyMessage  string //colorized
	LightModePrettyMessage string //colorized
	Message                string
	// contains filtered or unexported fields
}

func NewTestSuiteResult

func NewTestSuiteResult(ctx *Context, testCaseResults []*TestCaseResult, subSuiteResults []*TestSuiteResult, testSuite *TestSuite) (*TestSuiteResult, error)

func (*TestSuiteResult) MostAdaptedMessage

func (r *TestSuiteResult) MostAdaptedMessage(colorized bool, darkBackground bool) string

type TestValueStorage

type TestValueStorage struct {
	BaseURL_ URL
	Data     map[Path]string
}

func (*TestValueStorage) BaseURL

func (s *TestValueStorage) BaseURL() URL

func (*TestValueStorage) GetSerialized

func (s *TestValueStorage) GetSerialized(ctx *Context, key Path) (string, bool)

func (*TestValueStorage) Has

func (s *TestValueStorage) Has(ctx *Context, key Path) bool

func (*TestValueStorage) InsertSerialized

func (s *TestValueStorage) InsertSerialized(ctx *Context, key Path, serialized string)

func (*TestValueStorage) SetSerialized

func (s *TestValueStorage) SetSerialized(ctx *Context, key Path, serialized string)

type TestedProgram

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

func (*TestedProgram) Cancel

func (p *TestedProgram) Cancel(*Context)

func (*TestedProgram) Equal

func (p *TestedProgram) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*TestedProgram) GetGoMethod

func (p *TestedProgram) GetGoMethod(name string) (*GoFunction, bool)

func (*TestedProgram) IsMutable

func (*TestedProgram) IsMutable() bool

func (*TestedProgram) PrettyPrint

func (p *TestedProgram) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*TestedProgram) Prop

func (p *TestedProgram) Prop(ctx *Context, name string) Value

func (*TestedProgram) PropertyNames

func (*TestedProgram) PropertyNames(ctx *Context) []string

func (*TestedProgram) SetProp

func (*TestedProgram) SetProp(ctx *Context, name string, value Value) error

func (*TestedProgram) ToSymbolicValue

func (p *TestedProgram) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type TestingState

type TestingState struct {
	IsTestingEnabled       bool //if true the test suites encountered during executions are run
	IsImportTestingEnabled bool //if true the test suites in imported modules and included chunks are run
	Filters                TestFilters
	ResultsLock            sync.Mutex
	CaseResults            []*TestCaseResult
	SuiteResults           []*TestSuiteResult
	Item                   TestItem //can be nil
	ItemFullName           string   //can be empty
	TestedProgram          *Module  //can be nil
}

type ThreadInfo

type ThreadInfo struct {
	Name string
	Id   StateId
}

type ToStringConversionCapableStringPattern

type ToStringConversionCapableStringPattern interface {
	StringPattern
	StringFrom(ctx *Context, v Value) (string, error)
}

type Token

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

A Token is an immutable Value wrapping a token.

func (Token) Equal

func (t Token) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Token) IsMutable

func (t Token) IsMutable() bool

func (Token) PrettyPrint

func (t Token) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Token) Prop

func (t Token) Prop(ctx *Context, name string) Value

func (Token) PropertyNames

func (Token) PropertyNames(ctx *Context) []string

func (Token) SetProp

func (Token) SetProp(ctx *Context, name string, value Value) error

func (Token) ToSymbolicValue

func (t Token) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type TokenDepletionFn

type TokenDepletionFn func(lastDecrementTime time.Time, beingDepletedStateCount int32) int64

type Transaction

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

A Transaction is analogous to a database transaction but behaves a little bit differently. A Transaction can be started, commited and rolled back. Effects (reversible or not) such as FS changes are added to it. Actual database transactions or data containers can also register a callback with the OnEnd method, in order to execute logic when the transaction commits or rolls back.

func StartNewReadonlyTransaction

func StartNewReadonlyTransaction(ctx *Context, options ...Option) *Transaction

StartNewReadonlyTransaction creates a new readonly transaction and starts it immediately.

func StartNewTransaction

func StartNewTransaction(ctx *Context, options ...Option) *Transaction

StartNewTransaction creates a new transaction and starts it immediately.

func (*Transaction) AddEffect

func (tx *Transaction) AddEffect(ctx *Context, effect Effect) error

func (*Transaction) Commit

func (tx *Transaction) Commit(ctx *Context) error

func (*Transaction) Equal

func (tx *Transaction) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Transaction) Finished

func (tx *Transaction) Finished() DoneChan

Finished returns an unbuffered channel that closes when tx is finished.

func (*Transaction) GetGoMethod

func (tx *Transaction) GetGoMethod(name string) (*GoFunction, bool)

func (*Transaction) ID

func (tx *Transaction) ID() ULID

func (*Transaction) IsFinished

func (tx *Transaction) IsFinished() bool

func (*Transaction) IsFinishing

func (tx *Transaction) IsFinishing() bool

func (*Transaction) IsMutable

func (tx *Transaction) IsMutable() bool

func (*Transaction) IsReadonly

func (tx *Transaction) IsReadonly() bool

func (*Transaction) OnEnd

func (tx *Transaction) OnEnd(k any, fn TransactionEndCallbackFn) error

OnEnd associates with k the callback function fn that will be called on the end of the transacion (success or failure), IMPORTANT NOTE: fn may be called in a goroutine different from the one that registered it. If a function is already associated with k the error ErrAlreadySetTransactionEndCallback is returned

func (*Transaction) PrettyPrint

func (tx *Transaction) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*Transaction) Prop

func (tx *Transaction) Prop(ctx *Context, name string) Value

func (*Transaction) PropertyNames

func (tx *Transaction) PropertyNames(ctx *Context) []string

func (*Transaction) Rollback

func (tx *Transaction) Rollback(ctx *Context) error

func (*Transaction) SetProp

func (*Transaction) SetProp(ctx *Context, name string, value Value) error

func (*Transaction) Start

func (tx *Transaction) Start(ctx *Context) error

Start attaches tx to the passed context and creates a goroutine that will roll it back on timeout or context cancellation. The passed context must be the same context that created the transaction. ErrFinishedTransaction will be returned if Start is called on a finished transaction.

func (*Transaction) ToSymbolicValue

func (tx *Transaction) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type TransactionEndCallbackFn

type TransactionEndCallbackFn func(tx *Transaction, success bool)

type TransientID

type TransientID [2]uintptr

A TransientID of an Inox value is an address-based identifier, it should not be used to identify the value once the value is no longer accessible (GCed). TransientIDs are only obtainable by calling TransientIdOf on Inox values.

func TransientIdOf

func TransientIdOf(v Value) (result TransientID, hastFastId bool)

type TraversalConfiguration

type TraversalConfiguration struct {
	MaxDepth int
}

type TreeWalkCall

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

type TreeWalkState

type TreeWalkState struct {
	Global          *GlobalState
	LocalScopeStack []map[string]Value //TODO: reduce memory usage by using a struct { small *memds.Map8[string,Value]; grown map[string]Value } ?
	// contains filtered or unexported fields
}

A TreeWalkState stores all the state necessary to perform a tree walking evaluation.

func NewTreeWalkState

func NewTreeWalkState(ctx *Context, constants ...map[string]Value) *TreeWalkState

NewTreeWalkState creates a TreeWalkState and a GlobalState it will use.

func NewTreeWalkStateWithGlobal

func NewTreeWalkStateWithGlobal(global *GlobalState) *TreeWalkState

NewTreeWalkState creates a TreeWalkState that will use $global as its global state.

func (*TreeWalkState) AttachDebugger

func (state *TreeWalkState) AttachDebugger(debugger *Debugger)

func (*TreeWalkState) CurrentLocalScope

func (state *TreeWalkState) CurrentLocalScope() map[string]Value

func (*TreeWalkState) DetachDebugger

func (state *TreeWalkState) DetachDebugger()

func (*TreeWalkState) Get

func (state *TreeWalkState) Get(name string) (Value, bool)

func (*TreeWalkState) GetGlobalState

func (state *TreeWalkState) GetGlobalState() *GlobalState

func (*TreeWalkState) HasGlobal

func (state *TreeWalkState) HasGlobal(name string) bool

func (*TreeWalkState) PopScope

func (state *TreeWalkState) PopScope()

func (*TreeWalkState) PushScope

func (state *TreeWalkState) PushScope()

func (*TreeWalkState) Reset

func (state *TreeWalkState) Reset(global *GlobalState)

Reset recycles the state by resetting its fields. Since references to the state may exist somewhere Reset() should only be used for very simple programs, at least for now. Calling Reset() with a *GlobalState is almost equivalent as creating a new state with NewTreeWalkStateWithGlobal. It is recommended to call Reset(nil) if the caller is able to know when the previous module has finished executing: this will remove references to the old state and to some values.

func (*TreeWalkState) SetGlobal

func (state *TreeWalkState) SetGlobal(name string, value Value, constness GlobalConstness) (ok bool)

type Treedata

type Treedata struct {
	Root            Serializable
	HiearchyEntries []TreedataHiearchyEntry
}

Treedata is used to represent any hiearchical data, Treedata implements Value and is immutable.

func GetDirTreeData

func GetDirTreeData(fls afs.Filesystem, walkedDirPath Path) *Treedata

func (*Treedata) Equal

func (u *Treedata) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Treedata) IsMutable

func (u *Treedata) IsMutable() bool

func (*Treedata) PrettyPrint

func (u *Treedata) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*Treedata) ToSymbolicValue

func (u *Treedata) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*Treedata) WalkEntriesDF

func (d *Treedata) WalkEntriesDF(fn func(e TreedataHiearchyEntry, index int, ancestorChain *[]TreedataHiearchyEntry) error) error

func (*Treedata) Walker

func (d *Treedata) Walker(*Context) (Walker, error)

func (*Treedata) WriteJSONRepresentation

func (u *Treedata) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type TreedataHiearchyEntry

type TreedataHiearchyEntry struct {
	Value    Serializable
	Children []TreedataHiearchyEntry
}

TreedataHiearchyEntry represents a hiearchical entry in a Treedata, TreedataHiearchyEntry implements Value but is never accessible by Inox code.

func (TreedataHiearchyEntry) Equal

func (e TreedataHiearchyEntry) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (TreedataHiearchyEntry) IsMutable

func (e TreedataHiearchyEntry) IsMutable() bool

func (TreedataHiearchyEntry) PrettyPrint

func (e TreedataHiearchyEntry) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (TreedataHiearchyEntry) ToSymbolicValue

func (e TreedataHiearchyEntry) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*TreedataHiearchyEntry) WriteJSONRepresentation

func (u *TreedataHiearchyEntry) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type TreedataWalker

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

func (*TreedataWalker) Equal

func (w *TreedataWalker) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*TreedataWalker) HasNext

func (it *TreedataWalker) HasNext(ctx *Context) bool

func (*TreedataWalker) IsMutable

func (w *TreedataWalker) IsMutable() bool

func (*TreedataWalker) Key

func (it *TreedataWalker) Key(*Context) Value

func (*TreedataWalker) Next

func (it *TreedataWalker) Next(ctx *Context) bool

func (*TreedataWalker) NodeMeta

func (it *TreedataWalker) NodeMeta(*Context) WalkableNodeMeta

func (*TreedataWalker) PrettyPrint

func (it *TreedataWalker) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*TreedataWalker) Prune

func (it *TreedataWalker) Prune(ctx *Context)

func (*TreedataWalker) ToSymbolicValue

func (it *TreedataWalker) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*TreedataWalker) Value

func (it *TreedataWalker) Value(*Context) Value

type Tuple

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

Tuple is the immutable equivalent of a List, Tuple implements Value.

func ConcatTuples

func ConcatTuples(tuples ...*Tuple) *Tuple

func NewTuple

func NewTuple(elements []Serializable) *Tuple

func NewTupleVariadic

func NewTupleVariadic(elements ...Serializable) *Tuple

func (*Tuple) At

func (tuple *Tuple) At(ctx *Context, i int) Value

func (*Tuple) Concat

func (tuple *Tuple) Concat(other *Tuple) *Tuple

func (*Tuple) Contains

func (t *Tuple) Contains(ctx *Context, value Serializable) bool

func (*Tuple) Equal

func (tuple *Tuple) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Tuple) GetOrBuildElements

func (tuple *Tuple) GetOrBuildElements(ctx *Context) []Serializable

the caller can modify the result

func (*Tuple) IsEmpty

func (t *Tuple) IsEmpty(ctx *Context) bool

func (*Tuple) IsMutable

func (tuple *Tuple) IsMutable() bool

func (Tuple) Iterator

func (tuple Tuple) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*Tuple) Len

func (tuple *Tuple) Len() int

func (*Tuple) Migrate

func (tuple *Tuple) Migrate(ctx *Context, key Path, migration *FreeEntityMigrationArgs) (Value, error)

func (Tuple) PrettyPrint

func (tuple Tuple) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Tuple) ToSymbolicValue

func (t Tuple) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*Tuple) WriteJSONRepresentation

func (tuple *Tuple) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type TupleIterator

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

func (*TupleIterator) Equal

func (it *TupleIterator) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (TupleIterator) HasNext

func (it TupleIterator) HasNext(*Context) bool

func (*TupleIterator) IsMutable

func (it *TupleIterator) IsMutable() bool

func (*TupleIterator) Key

func (it *TupleIterator) Key(ctx *Context) Value

func (*TupleIterator) Next

func (it *TupleIterator) Next(ctx *Context) bool

func (*TupleIterator) PrettyPrint

func (it *TupleIterator) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*TupleIterator) ToSymbolicValue

func (it *TupleIterator) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*TupleIterator) Value

func (it *TupleIterator) Value(*Context) Value

type TuplePattern

type TuplePattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

A TuplePattern represents a pattern matching Inox tuples (e.g. #[1, 2]), ListPattern TuplePattern Value.

func NewTuplePattern

func NewTuplePattern(elementPatterns []Pattern) *TuplePattern

func NewTuplePatternOf

func NewTuplePatternOf(generalElementPattern Pattern) *TuplePattern

func (*TuplePattern) DefaultValue

func (patt *TuplePattern) DefaultValue(ctx *Context) (Value, error)

func (*TuplePattern) ElementPatternAt

func (patt *TuplePattern) ElementPatternAt(i int) (Pattern, bool)

func (*TuplePattern) Equal

func (patt *TuplePattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*TuplePattern) ExactElementCount

func (patt *TuplePattern) ExactElementCount() (int, bool)

func (*TuplePattern) IsMutable

func (patt *TuplePattern) IsMutable() bool

func (TuplePattern) Iterator

func (patt TuplePattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (TuplePattern) PrettyPrint

func (patt TuplePattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (TuplePattern) Random

func (patt TuplePattern) Random(ctx *Context, options ...Option) Value

func (*TuplePattern) StringPattern

func (patt *TuplePattern) StringPattern() (StringPattern, bool)

func (*TuplePattern) Test

func (patt *TuplePattern) Test(ctx *Context, v Value) bool

func (*TuplePattern) ToSymbolicValue

func (p *TuplePattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (TuplePattern) WriteJSONRepresentation

func (patt TuplePattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type Type

type Type struct {
	reflect.Type
}

func (Type) Equal

func (t Type) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Type) IsMutable

func (t Type) IsMutable() bool

func (Type) PrettyPrint

func (t Type) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Type) ToSymbolicValue

func (t Type) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type TypeExtension

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

A type extension represents a set of methods & computed properties for values matching a given pattern.

func (TypeExtension) Id

func (e TypeExtension) Id() string

type TypePattern

type TypePattern struct {
	Type          reflect.Type
	Name          string
	SymbolicValue symbolic.Value
	RandomImpl    func(options ...Option) Value

	CallImpl         func(pattern *TypePattern, values []Serializable) (Pattern, error)
	SymbolicCallImpl func(ctx *symbolic.Context, values []symbolic.Value) (symbolic.Pattern, error)
	// contains filtered or unexported fields
}

A TypePattern matches values implementing .Type (if .Type is an interface) or having their type equal to .Type. TypePattern implements Value.

func (*TypePattern) Call

func (patt *TypePattern) Call(values []Serializable) (Pattern, error)

func (*TypePattern) Equal

func (pattern *TypePattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*TypePattern) IsMutable

func (pattern *TypePattern) IsMutable() bool

func (TypePattern) Iterator

func (patt TypePattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (TypePattern) PrettyPrint

func (pattern TypePattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (TypePattern) Random

func (pattern TypePattern) Random(ctx *Context, options ...Option) Value

func (*TypePattern) StringPattern

func (patt *TypePattern) StringPattern() (StringPattern, bool)

func (*TypePattern) Test

func (pattern *TypePattern) Test(ctx *Context, v Value) bool

func (*TypePattern) ToSymbolicVal

func (p *TypePattern) ToSymbolicVal() symbolic.Pattern

func (*TypePattern) ToSymbolicValue

func (p *TypePattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (TypePattern) WriteJSONRepresentation

func (pattern TypePattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type ULID

type ULID ulid.ULID

ULID implements Value.

var (
	MIN_ULID, MAX_ULID ULID
)

func NewULID

func NewULID() ULID

NewULID generates in a cryptographically secure way an ULID with a monotonically increasing entropy.

func ParseULID

func ParseULID(s string) (ULID, error)

func (ULID) After

func (id ULID) After(other ULID) bool

func (ULID) Before

func (id ULID) Before(other ULID) bool

func (ULID) Compare

func (id ULID) Compare(other Value) (result int, comparable bool)

func (ULID) Equal

func (id ULID) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (ULID) GoTime

func (id ULID) GoTime() time.Time

func (ULID) IsMutable

func (ULID) IsMutable() bool

func (ULID) PrettyPrint

func (id ULID) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (ULID) String

func (id ULID) String() string

func (ULID) Time

func (id ULID) Time() DateTime

func (ULID) ToSymbolicValue

func (id ULID) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (ULID) WriteJSONRepresentation

func (id ULID) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type URL

type URL string

URL represents a non-relative URL, it implements Value.

func UrlOf

func UrlOf(ctx *Context, v Value) (URL, error)

func (URL) AppendAbsolutePath

func (u URL) AppendAbsolutePath(absPath Path) URL

AppendAbsolutePath joins anabsolute path with the URL's path if it has a directory path. If the input path is not absolute or if the URL's path is not a directory path the function panics.

func (URL) AppendRelativePath

func (u URL) AppendRelativePath(relPath Path) URL

AppendRelativePath joins a relative path starting with './' with the URL's path if it has a directory path. If the input path is not relative or if the URL's path is not a directory path the function panics.

func (URL) DirURL

func (u URL) DirURL() (URL, bool)

DirURL returns the URL of the parent directory, if the current path is / then ("", false) is returned.

func (URL) Equal

func (u URL) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (URL) GetLastPathSegment

func (u URL) GetLastPathSegment() string

func (URL) HasQueryOrFragment

func (u URL) HasQueryOrFragment() bool

func (URL) Host

func (u URL) Host() Host

func (URL) IsDir

func (u URL) IsDir() bool

IsDir returns whether the url has a trailing slash and has no query nor fragment.

func (URL) IsDirOf

func (u URL) IsDirOf(other URL) (bool, error)

IsDirOf returns whether the url is a URL dir for $other, adjacent '/' characters are treated as a single '/' character. Example: https://example.com/a/ is a URL dir for https://example.com/a/b Example: https://example.com/a/ is a URL dir for https://example.com/a/b/ The function panics if the url is not a directory URL or if any of the two urls has a fragment or query.

func (URL) IsMutable

func (u URL) IsMutable() bool

func (URL) Path

func (u URL) Path() Path

func (URL) PrettyPrint

func (u URL) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (URL) Prop

func (u URL) Prop(ctx *Context, name string) Value

func (URL) PropertyNames

func (u URL) PropertyNames(ctx *Context) []string

func (URL) RawQuery

func (u URL) RawQuery() String

func (URL) ResourceName

func (u URL) ResourceName() string

func (URL) Scheme

func (u URL) Scheme() Scheme

func (URL) SetProp

func (URL) SetProp(ctx *Context, name string, value Value) error

func (URL) ToDirURL

func (u URL) ToDirURL() URL

func (URL) ToSymbolicValue

func (u URL) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (URL) TruncatedBeforeQuery

func (u URL) TruncatedBeforeQuery() URL

TruncatedBeforeQuery returns a URL with everything after (and including) '?' removed. If the resulting URL has no URL specific feature a '/' is added at the end.

func (URL) UnderlyingString

func (u URL) UnderlyingString() string

func (URL) Validate

func (u URL) Validate() error

func (URL) WithScheme

func (u URL) WithScheme(scheme Scheme) URL

func (URL) WithoutQueryNorFragment

func (u URL) WithoutQueryNorFragment() URL

WithoutQueryNorFragment returns a URL with everything after (and including) '?' and '#' removed. If the resulting URL has no URL specific feature a '/' is added at the end.

func (URL) WriteJSONRepresentation

func (u URL) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type URLPattern

type URLPattern string

func (URLPattern) Call

func (URLPattern) Call(values []Serializable) (Pattern, error)

func (URLPattern) Equal

func (patt URLPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (URLPattern) Host

func (patt URLPattern) Host() Host

func (URLPattern) Includes

func (patt URLPattern) Includes(ctx *Context, v Value) bool

func (URLPattern) IncludesURL

func (patt URLPattern) IncludesURL(ctx *Context, u URL) bool

func (URLPattern) IsMutable

func (patt URLPattern) IsMutable() bool

func (URLPattern) IsPrefixPattern

func (patt URLPattern) IsPrefixPattern() bool

func (URLPattern) Iterator

func (patt URLPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (URLPattern) Prefix

func (patt URLPattern) Prefix() string

func (URLPattern) PrettyPrint

func (patt URLPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (URLPattern) Prop

func (patt URLPattern) Prop(ctx *Context, name string) Value

func (URLPattern) PropertyNames

func (patt URLPattern) PropertyNames(ctx *Context) []string

func (URLPattern) PseudoPath

func (patt URLPattern) PseudoPath() (string, bool)

func (URLPattern) Random

func (pattern URLPattern) Random(ctx *Context, options ...Option) Value

func (URLPattern) Scheme

func (patt URLPattern) Scheme() Scheme

func (URLPattern) SetProp

func (URLPattern) SetProp(ctx *Context, name string, value Value) error

func (URLPattern) StringPattern

func (URLPattern) StringPattern() (StringPattern, bool)

func (URLPattern) Test

func (patt URLPattern) Test(ctx *Context, v Value) bool

func (URLPattern) ToSymbolicValue

func (p URLPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (URLPattern) UnderlyingString

func (patt URLPattern) UnderlyingString() string

func (URLPattern) WriteJSONRepresentation

func (patt URLPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type UUIDv4

type UUIDv4 uuid.UUID

UUIDv4 implements Value.

func NewUUIDv4

func NewUUIDv4() UUIDv4

func ParseUUIDv4

func ParseUUIDv4(s string) (UUIDv4, error)

func (UUIDv4) Equal

func (id UUIDv4) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (UUIDv4) IsMutable

func (UUIDv4) IsMutable() bool

func (UUIDv4) PrettyPrint

func (id UUIDv4) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (UUIDv4) ToSymbolicValue

func (id UUIDv4) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (UUIDv4) WriteJSONRepresentation

func (id UUIDv4) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type UnionPattern

type UnionPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

func NewDisjointUnionPattern

func NewDisjointUnionPattern(cases []Pattern, node parse.Node) *UnionPattern

func NewUnionPattern

func NewUnionPattern(cases []Pattern, node parse.Node) *UnionPattern

func (*UnionPattern) Cases

func (patt *UnionPattern) Cases() []Pattern

the result should not be modified.

func (*UnionPattern) Equal

func (patt *UnionPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*UnionPattern) IsMutable

func (patt *UnionPattern) IsMutable() bool

func (UnionPattern) Iterator

func (patt UnionPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*UnionPattern) PrettyPrint

func (patt *UnionPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*UnionPattern) Random

func (patt *UnionPattern) Random(ctx *Context, options ...Option) Value

func (*UnionPattern) StringPattern

func (patt *UnionPattern) StringPattern() (StringPattern, bool)

func (*UnionPattern) Test

func (patt *UnionPattern) Test(ctx *Context, v Value) bool

func (*UnionPattern) ToSymbolicValue

func (p *UnionPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (UnionPattern) WriteJSONRepresentation

func (patt UnionPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type UnionStringPattern

type UnionStringPattern struct {
	NotCallablePatternMixin
	// contains filtered or unexported fields
}

func NewUnionStringPattern

func NewUnionStringPattern(node parse.Node, cases []StringPattern) (*UnionStringPattern, error)

func (*UnionStringPattern) CompiledRegex

func (patt *UnionStringPattern) CompiledRegex() *regexp.Regexp

func (*UnionStringPattern) EffectiveLengthRange

func (patt *UnionStringPattern) EffectiveLengthRange() IntRange

func (*UnionStringPattern) Equal

func (patt *UnionStringPattern) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*UnionStringPattern) FindMatches

func (patt *UnionStringPattern) FindMatches(ctx *Context, val Serializable, config MatchesFindConfig) (groups []Serializable, err error)

func (*UnionStringPattern) HasRegex

func (patt *UnionStringPattern) HasRegex() bool

func (*UnionStringPattern) IsMutable

func (patt *UnionStringPattern) IsMutable() bool

func (*UnionStringPattern) IsResolved

func (patt *UnionStringPattern) IsResolved() bool

func (UnionStringPattern) Iterator

func (patt UnionStringPattern) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*UnionStringPattern) LengthRange

func (patt *UnionStringPattern) LengthRange() IntRange

func (*UnionStringPattern) MatchGroups

func (patt *UnionStringPattern) MatchGroups(ctx *Context, v Serializable) (map[string]Serializable, bool, error)

func (*UnionStringPattern) Parse

func (patt *UnionStringPattern) Parse(ctx *Context, s string) (Serializable, error)

func (*UnionStringPattern) PatternNestingDepth

func (patt *UnionStringPattern) PatternNestingDepth(parentDepth int) int

func (*UnionStringPattern) PrettyPrint

func (patt *UnionStringPattern) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (UnionStringPattern) Random

func (patt UnionStringPattern) Random(ctx *Context, options ...Option) Value

func (*UnionStringPattern) Regex

func (patt *UnionStringPattern) Regex() string

func (*UnionStringPattern) Resolve

func (patt *UnionStringPattern) Resolve() (StringPattern, error)

func (*UnionStringPattern) StringPattern

func (patt *UnionStringPattern) StringPattern() (StringPattern, bool)

func (*UnionStringPattern) Test

func (patt *UnionStringPattern) Test(ctx *Context, v Value) bool

func (*UnionStringPattern) ToSymbolicValue

func (p *UnionStringPattern) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (UnionStringPattern) WriteJSONRepresentation

func (patt UnionStringPattern) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type UrlHolder

type UrlHolder interface {
	Serializable
	SetURLOnce(ctx *Context, u URL) error
	URL() (URL, bool)
}

func LoadFreeEntity

func LoadFreeEntity(ctx *Context, args FreeEntityLoadingParams) (UrlHolder, error)

See documentation of LoadFreeEntityFn.

type VM

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

VM is a virtual machine that executes bytecode.

func NewVM

func NewVM(config VMConfig) (*VM, error)

NewVM creates a virtual machine that will execute the fn function, if fn is nil the main function of bytecode will be executed. state is used to retrieve and set global variables.

func (*VM) Abort

func (v *VM) Abort()

Abort aborts the execution.

func (*VM) IsStackEmpty

func (v *VM) IsStackEmpty() bool

func (*VM) Run

func (v *VM) Run() (result Value, err error)

Run starts the execution.

type VMConfig

type VMConfig struct {
	Bytecode *Bytecode //bytecode of the module or bytecode of the function called in isolation.
	State    *GlobalState
	Self     Value

	//isolated call
	Fn                 *InoxFunction
	FnArgs             []Value
	DisabledArgSharing []bool
}

type ValMap

type ValMap map[string]Serializable

type Value

type Value interface {
	// IsMutable should return true if the value is definitively mutable and false if it is definitively immutable.
	IsMutable() bool

	Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

	//human readable representation
	PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

	//ToSymbolicValue should return a symbolic value that represents the value.
	ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)
}

Value is the interface implemented by all values accessible to Inox code. A value should either be definitively mutable or definitively immutable.

func CheckSharedOrClone

func CheckSharedOrClone(v Value, clones map[uintptr]Clonable, depth int) (Value, error)

ShareOrCloneDepth performs the following logic: - if v is immutable then return it. - else if v implements PotentiallySharable

  • if not shared return ErrValueIsNotShared
  • else return it

- else if v is clonable then clone it. - else return ErrValueNotSharableNorClonable

func ConvertReturnValue

func ConvertReturnValue(rval reflect.Value) Value

ConvertReturnValue converts to Value a reflect.Value returned by calling a Go funtion using reflection.

func EvalBytecode

func EvalBytecode(bytecode *Bytecode, state *GlobalState, self Value) (Value, error)

func EvalVM

func EvalVM(mod *Module, state *GlobalState, config BytecodeEvaluationConfig) (Value, error)

EvalVM compiles the passed module (in module source) and evaluates the bytecode with the passed global state.

func Fmt

func Fmt(ctx *Context, format Format, arg Value) (Value, error)

func GetGoMethodOrPanic

func GetGoMethodOrPanic(name string, v GoValue) Value

func ImportWaitModule

func ImportWaitModule(config ImportConfig) (Value, error)

ImportWaitModule imports a module and waits for its lthread to return its result. ImportWaitModule also adds the test suite results to the parent state.

func IterateAllValuesOnly

func IterateAllValuesOnly(ctx *Context, it Iterator) []Value

func MaxOf

func MaxOf(ctx *Context, first Value, others ...Value) Value

func MinOf

func MinOf(ctx *Context, first Value, others ...Value) Value

func NewHost

func NewHost(hostnamePort Value, scheme string) (Value, error)

func NewPath

func NewPath(slices []Value, isStaticPathSliceList []bool) (Value, error)

NewPath creates a Path in a secure way.

func NewPathPattern

func NewPathPattern(slices []Value, isStaticPathSliceList []bool) (Value, error)

NewPathPattern creates a PathPattern in a secure way.

func NewURL

func NewURL(host Value, pathSlices []Value, isStaticPathSliceList []bool, queryParamNames []Value, queryValues []Value) (Value, error)

createPath creates an URL in a secure way.

func RandBool

func RandBool(options ...Option) Value

func RandFloat

func RandFloat(options ...Option) Value

func RandInt

func RandInt(options ...Option) Value

func RandULID

func RandULID(options ...Option) Value

func RandUUIDv4

func RandUUIDv4(options ...Option) Value

func ShareOrClone

func ShareOrClone(v Value, originState *GlobalState) (Value, error)

func ShareOrCloneDepth

func ShareOrCloneDepth(v Value, originState *GlobalState, sharableValues *[]PotentiallySharable, clones map[uintptr]Clonable, depth int) (Value, error)

ShareOrCloneDepth performs the following logic: - if v is immutable then return it. - else if v implements PotentiallySharable then call its .Share() method if necessary. - else if v is clonable then clone it. - else return ErrValueNotSharableNorClonable

func SumOptions

func SumOptions(ctx *Context, config *Object, options ...Option) (Value, error)

func ToValueAsserted

func ToValueAsserted(v any) Value

func ToValueList

func ToValueList[T Value](arg []T) []Value

func TreeWalkCallFunc

func TreeWalkCallFunc(call TreeWalkCall) (Value, error)

TreeWalkCallFunc calls calleeNode, whatever its kind (Inox function or Go function). If must is true and the second result of a Go function is a non-nil error, TreeWalkCallFunc will panic.

func TreeWalkEval

func TreeWalkEval(node parse.Node, state *TreeWalkState) (result Value, err error)

TreeWalkEval evaluates a node, panics are always recovered so this function should not panic.

func Unwrap

func Unwrap(ctx *Context, v Value) Value

Unwrap unwraps a *DynamicValue's value and calls itself on the resulting value.

func ValOf

func ValOf(v interface{}) Value

ValOf any reflect.Value that wraps a Inox value. Wraps its argument in a reflect.Value if it is not a Inox value.

type ValueFilteredIterator

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

func (*ValueFilteredIterator) Equal

func (it *ValueFilteredIterator) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ValueFilteredIterator) HasNext

func (it *ValueFilteredIterator) HasNext(ctx *Context) bool

func (*ValueFilteredIterator) IsMutable

func (it *ValueFilteredIterator) IsMutable() bool

func (*ValueFilteredIterator) Key

func (it *ValueFilteredIterator) Key(ctx *Context) Value

func (*ValueFilteredIterator) Next

func (it *ValueFilteredIterator) Next(ctx *Context) bool

func (*ValueFilteredIterator) PrettyPrint

func (it *ValueFilteredIterator) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*ValueFilteredIterator) ToSymbolicValue

func (it *ValueFilteredIterator) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*ValueFilteredIterator) Value

func (it *ValueFilteredIterator) Value(ctx *Context) Value

type ValueHistory

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

ValueHistory stores the history about a single value, it implements Value.

func NewValueHistory

func NewValueHistory(ctx *Context, v InMemorySnapshotable, config *Object) *ValueHistory

func (*ValueHistory) AddChange

func (h *ValueHistory) AddChange(ctx *Context, c Change)

func (*ValueHistory) Equal

func (h *ValueHistory) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ValueHistory) ForgetChangesBeforeDate

func (h *ValueHistory) ForgetChangesBeforeDate(ctx *Context, d DateTime)

func (*ValueHistory) ForgetLast

func (h *ValueHistory) ForgetLast(ctx *Context)

func (*ValueHistory) GetGoMethod

func (h *ValueHistory) GetGoMethod(name string) (*GoFunction, bool)

func (*ValueHistory) IsMutable

func (*ValueHistory) IsMutable() bool

func (*ValueHistory) IsRecursivelyRenderable

func (h *ValueHistory) IsRecursivelyRenderable(ctx *Context, input RenderingInput) bool

func (*ValueHistory) IsSharable

func (h *ValueHistory) IsSharable(originState *GlobalState) (bool, string)

func (*ValueHistory) IsShared

func (h *ValueHistory) IsShared() bool

func (*ValueHistory) LastValue

func (h *ValueHistory) LastValue(ctx *Context) Value

func (*ValueHistory) PrettyPrint

func (h *ValueHistory) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*ValueHistory) Prop

func (h *ValueHistory) Prop(ctx *Context, name string) Value

func (*ValueHistory) PropertyNames

func (*ValueHistory) PropertyNames(ctx *Context) []string

func (*ValueHistory) Render

func (h *ValueHistory) Render(ctx *Context, w io.Writer, config RenderingInput) (int, error)

func (*ValueHistory) RenderCurrentToHTMLFn

func (h *ValueHistory) RenderCurrentToHTMLFn() *InoxFunction

func (*ValueHistory) SelectDate

func (h *ValueHistory) SelectDate(ctx *Context, d DateTime)

func (*ValueHistory) SetProp

func (h *ValueHistory) SetProp(ctx *Context, name string, value Value) error

func (*ValueHistory) Share

func (h *ValueHistory) Share(originState *GlobalState)

func (*ValueHistory) SmartLock

func (h *ValueHistory) SmartLock(state *GlobalState)

func (*ValueHistory) SmartUnlock

func (h *ValueHistory) SmartUnlock(state *GlobalState)

func (*ValueHistory) ToSymbolicValue

func (h *ValueHistory) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*ValueHistory) ValueAt

func (h *ValueHistory) ValueAt(ctx *Context, d DateTime) Value

func (*ValueHistory) ValueAtSelection

func (h *ValueHistory) ValueAtSelection(ctx *Context) Value

type ValueLifetimeJobs

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

func NewValueLifetimeJobs

func NewValueLifetimeJobs(ctx *Context, self Value, jobs []*LifetimeJob) *ValueLifetimeJobs

func (*ValueLifetimeJobs) Count

func (jobs *ValueLifetimeJobs) Count() int

Count returns the number of jobs at initialization.

func (*ValueLifetimeJobs) Instances

func (jobs *ValueLifetimeJobs) Instances() []*LifetimeJobInstance

func (*ValueLifetimeJobs) InstantiateJobs

func (jobs *ValueLifetimeJobs) InstantiateJobs(ctx *Context) error

type ValueList

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

ValueList implements underlyingList

func (*ValueList) At

func (list *ValueList) At(ctx *Context, i int) Value

func (*ValueList) Clone

func (list *ValueList) Clone(originState *GlobalState, sharableValues *[]PotentiallySharable, clones map[uintptr]Clonable, depth int) (Serializable, error)

func (*ValueList) ConstraintId

func (list *ValueList) ConstraintId() ConstraintId

func (*ValueList) ContainsSimple

func (list *ValueList) ContainsSimple(ctx *Context, v Serializable) bool

func (*ValueList) Equal

func (list *ValueList) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ValueList) IsMutable

func (list *ValueList) IsMutable() bool

func (*ValueList) Iterator

func (list *ValueList) Iterator(ctx *Context, config IteratorConfiguration) Iterator

func (*ValueList) Len

func (list *ValueList) Len() int

func (*ValueList) PrettyPrint

func (list *ValueList) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*ValueList) SetSlice

func (list *ValueList) SetSlice(ctx *Context, start, end int, seq Sequence)

func (*ValueList) SortByNestedValue

func (l *ValueList) SortByNestedValue(ctx *Context, path ValuePath, order Order) error

func (*ValueList) ToSymbolicValue

func (l *ValueList) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*ValueList) WriteJSONRepresentation

func (list *ValueList) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

type ValueListIterator

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

func (*ValueListIterator) Equal

func (it *ValueListIterator) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (ValueListIterator) HasNext

func (it ValueListIterator) HasNext(*Context) bool

func (*ValueListIterator) IsMutable

func (it *ValueListIterator) IsMutable() bool

func (*ValueListIterator) Key

func (it *ValueListIterator) Key(ctx *Context) Value

func (*ValueListIterator) Next

func (it *ValueListIterator) Next(ctx *Context) bool

func (*ValueListIterator) PrettyPrint

func (it *ValueListIterator) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*ValueListIterator) ToSymbolicValue

func (it *ValueListIterator) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*ValueListIterator) Value

func (it *ValueListIterator) Value(*Context) Value

type ValuePath

type ValuePath interface {
	Serializable
	GetFrom(ctx *Context, v Value) Value
}

A ValuePath represents a path to a value in a structure.

type ValuePathSegment

type ValuePathSegment interface {
	Serializable
	SegmentGetFrom(ctx *Context, v Value) Value
}

A ValuePathSegment represents a segment of path to a value in a structure.

type ValueVisibility

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

A ValueVisibility specifies what parts of an Inox value are 'visible' during serialization.

func GetVisibility

func GetVisibility(id VisibilityId) (*ValueVisibility, bool)

type ValueVisibilityPermission

type ValueVisibilityPermission struct {
	Pattern Pattern
}

func (ValueVisibilityPermission) Includes

func (perm ValueVisibilityPermission) Includes(otherPerm Permission) bool

func (ValueVisibilityPermission) InternalPermTypename

func (ValueVisibilityPermission) Kind

func (ValueVisibilityPermission) String

func (perm ValueVisibilityPermission) String() string

type ValueWatchers

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

func NewValueWatchers

func NewValueWatchers() *ValueWatchers

func (*ValueWatchers) Add

func (l *ValueWatchers) Add(watcher Watcher)

func (*ValueWatchers) InformAboutAsync

func (l *ValueWatchers) InformAboutAsync(ctx *Context, v Value, depth WatchingDepth, relocalize bool)

func (*ValueWatchers) StopAll

func (l *ValueWatchers) StopAll()

type VisibilityId

type VisibilityId uint64

func (VisibilityId) HasVisibility

func (v VisibilityId) HasVisibility() bool

type WaitConfirmPrompt

type WaitConfirmPrompt func(msg string, accepted []string) (bool, error)

type Walkable

type Walkable interface {

	//Walker should return a new walker that, when possible, should be not affected by mutations of the walked value.
	Walker(*Context) (Walker, error)
}

A Walkable is value that can be walked using a walker.

type WalkableNodeMeta

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

func NewWalkableNodeMeta

func NewWalkableNodeMeta(ancestors []Value, parentEdge Value) WalkableNodeMeta

type Walker

type Walker interface {
	Iterator
	Prune(*Context)
	NodeMeta(*Context) WalkableNodeMeta
}

type Watchable

type Watchable interface {
	Value

	// Watcher creates a watcher managed by the watched value, callers should only call the .WaitNext & .Stop methods,
	// if watching depth is unspecified the watched value is free to use any depth as long as it is consistent with .OnMutation.
	Watcher(*Context, WatcherConfiguration) Watcher

	//OnMutation registers a microtask to be called on mutations, the mutations should be same as the one returned by the watcher.
	OnMutation(ctx *Context, microtask MutationCallbackMicrotask, config MutationWatchingConfiguration) (handle CallbackHandle, err error)

	RemoveMutationCallback(ctx *Context, handle CallbackHandle)

	RemoveMutationCallbackMicrotasks(ctx *Context)
}

A Watchable value is a value that can be watched thanks to a Watcher.

type WatchableSubscriber

type WatchableSubscriber interface {
	Subscriber
	Watchable
	OnPublication(ctx *Context, microtask PublicationCallbackMicrotask, config PublicationCallbackConfiguration) CallbackHandle
}

type Watcher

type Watcher interface {
	Value
	StreamSource

	// WaitNext should be called by a single goroutine, filter can be nil
	WaitNext(ctx *Context, filter Pattern, timeout time.Duration) (Value, error)
	Stop()
	IsStopped() bool
	Config() WatcherConfiguration

	// InformAboutAsync is called by the watched value, InformAboutAsync should be thread safe and should inform
	// asynchronously the user of the watcher about the new value during the current/next call to WaitNext.
	InformAboutAsync(ctx *Context, v Value)
}

func WatchReceivedMessages

func WatchReceivedMessages(ctx *Context, v Watchable) Watcher

type WatcherConfiguration

type WatcherConfiguration struct {
	Filter Pattern
	Depth  WatchingDepth
	Path   Path
}

type WatchingDepth

type WatchingDepth int
const (
	UnspecifiedWatchingDepth WatchingDepth = iota
	ShallowWatching
	IntermediateDepthWatching
	DeepWatching
)

func (WatchingDepth) IsSpecified

func (d WatchingDepth) IsSpecified() bool

func (WatchingDepth) MinusOne

func (d WatchingDepth) MinusOne() (WatchingDepth, bool)

func (WatchingDepth) MustMinusOne

func (d WatchingDepth) MustMinusOne() WatchingDepth

func (WatchingDepth) Plus

func (d WatchingDepth) Plus(n uint) (WatchingDepth, bool)

type WebsocketPermission

type WebsocketPermission struct {
	Kind_    PermissionKind
	Endpoint ResourceName //ignored for some permission kinds
}

func (WebsocketPermission) Includes

func (perm WebsocketPermission) Includes(otherPerm Permission) bool

func (WebsocketPermission) InternalPermTypename

func (perm WebsocketPermission) InternalPermTypename() permkind.InternalPermissionTypename

func (WebsocketPermission) Kind

func (perm WebsocketPermission) Kind() PermissionKind

func (WebsocketPermission) String

func (perm WebsocketPermission) String() string

type WrappedBytes

type WrappedBytes interface {
	Readable
	//the returned bytes should NOT be modified
	UnderlyingBytes() []byte
}

A WrappedBytes represents a value that wraps a byte slice ( []byte ).

type WrappedString

type WrappedString interface {
	Serializable

	//UnderlyingString() should instantly retrieves the wrapped string
	UnderlyingString() string
}

A StringLike represents a value that wraps a Go string.

type Writable

type Writable interface {
	Value
	Writer() *Writer
}

A Writable is a Value we can write bytes to thanks to a Writer.

type WritableByteStream

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

A WritableByteStream represents a stream of bytes, ElementsStream implements Value.

func NewWritableByteStream

func NewWritableByteStream(
	writeByteToSink func(s *WritableByteStream, b byte) error,
	writeChunkToSink func(s *WritableByteStream, p []byte) error,
) *WritableByteStream

func (*WritableByteStream) Equal

func (s *WritableByteStream) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*WritableByteStream) IsMutable

func (*WritableByteStream) IsMutable() bool

func (*WritableByteStream) IsStopped

func (s *WritableByteStream) IsStopped() bool

func (*WritableByteStream) PrettyPrint

func (s *WritableByteStream) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*WritableByteStream) Stop

func (s *WritableByteStream) Stop()

func (*WritableByteStream) ToSymbolicValue

func (s *WritableByteStream) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*WritableByteStream) WritableStream

func (s *WritableByteStream) WritableStream(ctx *Context, config *WritableStreamConfiguration) WritableStream

func (*WritableByteStream) Write

func (s *WritableByteStream) Write(ctx *Context, v Value) error

func (*WritableByteStream) WriteBytes

func (s *WritableByteStream) WriteBytes(ctx *Context, p []byte) error

func (*WritableByteStream) WriteChunk

func (s *WritableByteStream) WriteChunk(ctx *Context, chunk *DataChunk) error

type WritableStream

type WritableStream interface {
	StreamSink

	// Write should be called by a single goroutine
	Write(ctx *Context, value Value) error

	// WriteChunk should be called by a single goroutine
	WriteChunk(ctx *Context, chunk *DataChunk) error

	Stop()

	IsStopped() bool
}

type WritableStreamConfiguration

type WritableStreamConfiguration struct{}

type Writer

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

A Writer is a Value wrapping an io.Writer.

func WrapWriter

func WrapWriter(w io.Writer, buffered bool, lock *sync.Mutex) *Writer

func (*Writer) Equal

func (w *Writer) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Writer) Flush

func (w *Writer) Flush(ctx *Context) error

func (*Writer) GetGoMethod

func (w *Writer) GetGoMethod(name string) (*GoFunction, bool)

func (*Writer) IsMutable

func (*Writer) IsMutable() bool

func (*Writer) PrettyPrint

func (writer *Writer) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*Writer) Prop

func (w *Writer) Prop(ctx *Context, name string) Value

func (Writer) PropertyNames

func (Writer) PropertyNames(ctx *Context) []string

func (*Writer) SetProp

func (*Writer) SetProp(ctx *Context, name string, value Value) error

func (*Writer) ToSymbolicValue

func (writer *Writer) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*Writer) TotalWritten

func (w *Writer) TotalWritten() Int

func (*Writer) Write

func (w *Writer) Write(p []byte) (n int, err error)

func (*Writer) WriteString

func (w *Writer) WriteString(s string) (n int, err error)

func (*Writer) WriteStrings

func (w *Writer) WriteStrings(s ...string) (n int, err error)

func (*Writer) Writer

func (w *Writer) Writer() *Writer

type XMLAttribute

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

func NewXMLAttribute

func NewXMLAttribute(name string, value Value) XMLAttribute

func (XMLAttribute) Name

func (a XMLAttribute) Name() string

func (XMLAttribute) Value

func (a XMLAttribute) Value() Value

type XMLElement

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

A XMLElement represents the result of the evaluation of an XMLElement node in Inox code.

func NewRawTextXmlElement

func NewRawTextXmlElement(name string, attributes []XMLAttribute, rawContent string) *XMLElement

func NewXmlElement

func NewXmlElement(name string, attributes []XMLAttribute, children []Value) *XMLElement

func (*XMLElement) Attributes

func (e *XMLElement) Attributes() []XMLAttribute

result should not be modified.

func (*XMLElement) Children

func (e *XMLElement) Children() []Value

result should not be modified.

func (*XMLElement) Equal

func (e *XMLElement) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*XMLElement) IsMutable

func (*XMLElement) IsMutable() bool

func (*XMLElement) Name

func (e *XMLElement) Name() string

func (*XMLElement) PrettyPrint

func (s *XMLElement) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (*XMLElement) RawContent

func (e *XMLElement) RawContent() string

func (*XMLElement) ToSymbolicValue

func (p *XMLElement) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type Year

type Year time.Time

Year implements Value.

func (Year) Compare

func (y Year) Compare(other Value) (result int, comparable bool)

func (Year) Equal

func (y Year) Equal(ctx *Context, other Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (Year) IsMutable

func (d Year) IsMutable() bool

func (Year) PrettyPrint

func (y Year) PrettyPrint(w *bufio.Writer, config *PrettyPrintConfig, depth int, parentIndentCount int)

func (Year) ToSymbolicValue

func (y Year) ToSymbolicValue(ctx *Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (Year) Validate

func (y Year) Validate() error

func (Year) WriteJSONRepresentation

func (y Year) WriteJSONRepresentation(ctx *Context, w *jsoniter.Stream, config JSONSerializationConfig, depth int) error

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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