├── .babelrc ├── .codecov.yml ├── .eslintrc.js ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ └── bug_report.md ├── pull_request_template.md └── workflows │ ├── checks.yml │ ├── npm-manual-publish.yml │ └── npm-publish.yml ├── .gitignore ├── .npmignore ├── .prettierrc.json ├── AUTHORS.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── docs ├── compiler-differences.md └── working-with-typescript-and-webpack.md ├── ink.d.mts ├── ink.d.ts ├── jest.config.javascript.js ├── jest.config.js ├── media └── inkjs.png ├── package-lock.json ├── package.json ├── renovate.json ├── rollup.config.js ├── script └── inkjs-compiler.ts ├── src ├── compiler │ ├── Compiler.ts │ ├── CompilerOptions.ts │ ├── DebugSourceRange.ts │ ├── FileHandler │ │ ├── DefaultFileHandler.ts │ │ ├── JsonFileHandler.ts │ │ └── PosixFileHandler.ts │ ├── IFileHandler.ts │ ├── Parser │ │ ├── CharacterRange.ts │ │ ├── CharacterSet.ts │ │ ├── CommentEliminator.ts │ │ ├── CustomFlags.ts │ │ ├── ErrorType.ts │ │ ├── FlowDecl.ts │ │ ├── InfixOperator.ts │ │ ├── InkParser.ts │ │ ├── ParsedHierarchy │ │ │ ├── Argument.ts │ │ │ ├── AuthorWarning.ts │ │ │ ├── Choice.ts │ │ │ ├── Conditional │ │ │ │ ├── Conditional.ts │ │ │ │ └── ConditionalSingleBranch.ts │ │ │ ├── ContentList.ts │ │ │ ├── Declaration │ │ │ │ ├── ConstantDeclaration.ts │ │ │ │ └── ExternalDeclaration.ts │ │ │ ├── Divert │ │ │ │ ├── Divert.ts │ │ │ │ └── DivertTarget.ts │ │ │ ├── Expression │ │ │ │ ├── BinaryExpression.ts │ │ │ │ ├── Expression.ts │ │ │ │ ├── IncDecExpression.ts │ │ │ │ ├── MultipleConditionExpression.ts │ │ │ │ ├── NumberExpression.ts │ │ │ │ ├── StringExpression.ts │ │ │ │ └── UnaryExpression.ts │ │ │ ├── FindQueryFunc.ts │ │ │ ├── Flow │ │ │ │ ├── ClosestFlowBase.ts │ │ │ │ ├── FlowBase.ts │ │ │ │ └── FlowLevel.ts │ │ │ ├── FunctionCall.ts │ │ │ ├── Gather │ │ │ │ ├── Gather.ts │ │ │ │ └── GatherPointToResolve.ts │ │ │ ├── Glue.ts │ │ │ ├── IWeavePoint.ts │ │ │ ├── Identifier.ts │ │ │ ├── IncludedFile.ts │ │ │ ├── Knot.ts │ │ │ ├── List │ │ │ │ ├── List.ts │ │ │ │ ├── ListDefinition.ts │ │ │ │ └── ListElementDefinition.ts │ │ │ ├── Object.ts │ │ │ ├── Path.ts │ │ │ ├── ReturnType.ts │ │ │ ├── Sequence │ │ │ │ ├── Sequence.ts │ │ │ │ ├── SequenceDivertToResolve.ts │ │ │ │ └── SequenceType.ts │ │ │ ├── Stitch.ts │ │ │ ├── Story.ts │ │ │ ├── SymbolType.ts │ │ │ ├── Tag.ts │ │ │ ├── Text.ts │ │ │ ├── TunnelOnwards.ts │ │ │ ├── Variable │ │ │ │ ├── VariableAssignment.ts │ │ │ │ └── VariableReference.ts │ │ │ ├── Weave.ts │ │ │ └── Wrap.ts │ │ ├── StatementLevel.ts │ │ └── StringParser │ │ │ ├── StringParser.ts │ │ │ ├── StringParserElement.ts │ │ │ └── StringParserState.ts │ └── Stats.ts ├── engine │ ├── CallStack.ts │ ├── Choice.ts │ ├── ChoicePoint.ts │ ├── Container.ts │ ├── ControlCommand.ts │ ├── Debug.ts │ ├── DebugMetadata.ts │ ├── Divert.ts │ ├── Error.ts │ ├── Flow.ts │ ├── Glue.ts │ ├── INamedContent.ts │ ├── InkList.ts │ ├── JsonSerialisation.ts │ ├── ListDefinition.ts │ ├── ListDefinitionsOrigin.ts │ ├── NativeFunctionCall.ts │ ├── NullException.ts │ ├── Object.ts │ ├── PRNG.ts │ ├── Path.ts │ ├── Pointer.ts │ ├── PushPop.ts │ ├── SearchResult.ts │ ├── SimpleJson.ts │ ├── StatePatch.ts │ ├── StopWatch.ts │ ├── Story.ts │ ├── StoryException.ts │ ├── StoryState.ts │ ├── StringBuilder.ts │ ├── Tag.ts │ ├── TryGetResult.ts │ ├── TypeAssertion.ts │ ├── Value.ts │ ├── VariableAssignment.ts │ ├── VariableReference.ts │ ├── VariablesState.ts │ ├── Void.ts │ └── runtime.ts ├── ink.ts └── tests │ ├── README.MD │ ├── compile.js │ ├── inkfiles │ ├── compiled │ │ ├── bindings │ │ │ ├── external_binding.ink.json │ │ │ ├── game_ink_back_and_forth.ink.json │ │ │ ├── lookup_safe_or_not.ink.json │ │ │ ├── lookup_safe_or_not_with_post_glue.ink.json │ │ │ └── variable_observer.ink.json │ │ ├── booleans │ │ │ ├── false_plus_false.ink.json │ │ │ ├── list_hasnt.ink.json │ │ │ ├── not_one.ink.json │ │ │ ├── not_true.ink.json │ │ │ ├── three_greater_than_one.ink.json │ │ │ ├── true.ink.json │ │ │ ├── true_equals_one.ink.json │ │ │ ├── true_plus_one.ink.json │ │ │ ├── true_plus_true.ink.json │ │ │ └── two_plus_true.ink.json │ │ ├── builtins │ │ │ ├── floor_ceiling_and_casts.ink.json │ │ │ ├── read_count_across_callstack.ink.json │ │ │ ├── read_count_across_threads.ink.json │ │ │ ├── read_count_dot_separated_path.ink.json │ │ │ ├── read_count_variable_target.ink.json │ │ │ ├── turns.ink.json │ │ │ ├── turns_since.ink.json │ │ │ ├── turns_since_nested.ink.json │ │ │ ├── turns_since_with_variable_target.ink.json │ │ │ ├── visit_count_bug_due_to_nested_containers.ink.json │ │ │ └── visit_counts_when_choosing.ink.json │ │ ├── callstack │ │ │ ├── call_stack_evaluation.ink.json │ │ │ ├── callstack_evaluation.ink.json │ │ │ └── clean_callstack_reset_on_path_choice.ink.json │ │ ├── choices │ │ │ ├── blank_choice.ink.json │ │ │ ├── choice_count.ink.json │ │ │ ├── choice_diverts_to_done.ink.json │ │ │ ├── choice_thread_forking.ink.json │ │ │ ├── choice_with_brackets_only.ink.json │ │ │ ├── conditional_choices.ink.json │ │ │ ├── default_choices.ink.json │ │ │ ├── default_simple_gather.ink.json │ │ │ ├── empty_choice.ink.json │ │ │ ├── fallback_choice_on_thread.ink.json │ │ │ ├── gather_choice_same_line.ink.json │ │ │ ├── has_read_on_choice.ink.json │ │ │ ├── logic_in_choices.ink.json │ │ │ ├── nested_choice.ink.json │ │ │ ├── non_text_in_choice_inner_content.ink.json │ │ │ ├── once_only_choices_can_link_back_to_self.ink.json │ │ │ ├── once_only_choices_with_own_content.ink.json │ │ │ ├── should_not_gather_due_to_choice.ink.json │ │ │ ├── state_rollback_over_default_choice.ink.json │ │ │ ├── sticky_choices_stay_sticky.ink.json │ │ │ ├── tags_in_choice.ink.json │ │ │ ├── various_blank_choice_warning.ink.json │ │ │ └── various_default_choices.ink.json │ │ ├── conditions │ │ │ ├── all_switch_branches_fail_is_clean.ink.json │ │ │ ├── conditionals.ink.json │ │ │ ├── else_branches.ink.json │ │ │ ├── empty_multiline_conditional_branch.ink.json │ │ │ └── trivial_condition.ink.json │ │ ├── diverts │ │ │ ├── basic_tunnel.ink.json │ │ │ ├── compare_divert_targets.ink.json │ │ │ ├── compiler │ │ │ │ └── divert_to_weave_points.ink.json │ │ │ ├── complex_tunnels.ink.json │ │ │ ├── divert_in_conditional.ink.json │ │ │ ├── divert_targets_with_parameters.ink.json │ │ │ ├── divert_to_weave_points.ink.json │ │ │ ├── done_stops_thread.ink.json │ │ │ ├── path_to_self.ink.json │ │ │ ├── same_line_divert_is_inline.ink.json │ │ │ ├── tunnel_onwards_after_tunnel.ink.json │ │ │ ├── tunnel_onwards_divert_after_with_arg.ink.json │ │ │ ├── tunnel_onwards_divert_override.ink.json │ │ │ ├── tunnel_onwards_to_variable_divert_target.ink.json │ │ │ ├── tunnel_onwards_with_param_default_choice.ink.json │ │ │ └── tunnel_vs_thread_behaviour.ink.json │ │ ├── evaluation │ │ │ ├── arithmetic.ink.json │ │ │ ├── basic_string_literals.ink.json │ │ │ ├── evaluating_function_variable_state_bug.ink.json │ │ │ ├── evaluating_ink_functions_from_game.ink.json │ │ │ ├── evaluating_ink_functions_from_game_2.ink.json │ │ │ ├── evaluation_stack_leaks.ink.json │ │ │ ├── factorial_by_reference.ink.json │ │ │ ├── factorial_recursive.ink.json │ │ │ ├── increment.ink.json │ │ │ └── literal_unary.ink.json │ │ ├── extra │ │ │ ├── arithmetic_2.ink.json │ │ │ └── list_comparison.ink.json │ │ ├── functions │ │ │ └── compiler │ │ │ │ ├── argument_shouldnt_conflict_with_gather_elsewhere.ink.json │ │ │ │ └── using_function_and_increment_together.ink.json │ │ ├── glue │ │ │ ├── implicit_inline_glue.ink.json │ │ │ ├── implicit_inline_glue_b.ink.json │ │ │ ├── implicit_inline_glue_c.ink.json │ │ │ ├── left_right_glue_matching.ink.json │ │ │ └── simple_glue.ink.json │ │ ├── inkjs │ │ │ └── tests.ink.json │ │ ├── knots │ │ │ ├── compiler │ │ │ │ └── knot_termination_skips_global_objects.ink.json │ │ │ ├── knot_do_not_gather.ink.json │ │ │ ├── knot_stitch_gather_counts.ink.json │ │ │ ├── knot_thread_interaction.ink.json │ │ │ └── knot_thread_interaction_2.ink.json │ │ ├── lists │ │ │ ├── contains_empty_list_always_false.ink.json │ │ │ ├── empty_list_origin.ink.json │ │ │ ├── empty_list_origin_after_assignment.ink.json │ │ │ ├── list_basic_operations.ink.json │ │ │ ├── list_mixed_items.ink.json │ │ │ ├── list_random.ink.json │ │ │ ├── list_range.ink.json │ │ │ ├── list_save_load.ink.json │ │ │ └── more_list_operations.ink.json │ │ ├── logic │ │ │ ├── logic_lines_with_newlines.ink.json │ │ │ ├── multiline_logic_with_glue.ink.json │ │ │ ├── nested_pass_by_reference.ink.json │ │ │ └── print_num.ink.json │ │ ├── misc │ │ │ ├── author_warnings_inside_content_list_bug.ink.json │ │ │ ├── compiler │ │ │ │ ├── end_of_content_without_end.ink.json │ │ │ │ ├── loose_ends.ink.json │ │ │ │ └── return_text_warning.ink.json │ │ │ ├── empty.ink.json │ │ │ ├── end.ink.json │ │ │ ├── end2.ink.json │ │ │ ├── end_of_content.ink.json │ │ │ ├── end_of_content_hello_world.ink.json │ │ │ ├── end_of_content_with_end.ink.json │ │ │ ├── end_of_content_without_end.ink.json │ │ │ ├── escape_character.ink.json │ │ │ ├── hello_world.ink.json │ │ │ ├── identifiers_can_start_with_number.ink.json │ │ │ ├── include.ink.json │ │ │ ├── nested_include.ink.json │ │ │ ├── quote_character_significance.ink.json │ │ │ └── whitespace.ink.json │ │ ├── multiflow │ │ │ ├── multi_flow_basics.ink.json │ │ │ └── multi_flow_save_load_threads.ink.json │ │ ├── newlines │ │ │ ├── newline_at_start_of_multiline_conditional.ink.json │ │ │ ├── newline_consistency_1.ink.json │ │ │ ├── newline_consistency_2.ink.json │ │ │ ├── newline_consistency_3.ink.json │ │ │ ├── newlines_trimming_with_func_external_fallback.ink.json │ │ │ └── newlines_with_string_eval.ink.json │ │ ├── sequences │ │ │ ├── all_sequence_types.ink.json │ │ │ ├── blanks_in_inline_sequences.ink.json │ │ │ ├── empty_sequence_content.ink.json │ │ │ ├── gather_read_count_with_initial_sequence.ink.json │ │ │ ├── leading_newline_multiline_sequence.ink.json │ │ │ └── shuffle_stack_muddying.ink.json │ │ ├── strings │ │ │ ├── string_constants.ink.json │ │ │ ├── string_contains.ink.json │ │ │ ├── string_type_coercion.ink.json │ │ │ └── strings_in_choices.ink.json │ │ ├── tags │ │ │ ├── tags.ink.json │ │ │ ├── tags_dynamic_content.ink.json │ │ │ └── tags_in_seq.ink.json │ │ ├── threads │ │ │ ├── multi_thread.ink.json │ │ │ ├── thread_done.ink.json │ │ │ ├── thread_in_logic.ink.json │ │ │ └── top_flow_terminator_should_not_kill_thread_choices.ink.json │ │ ├── variables │ │ │ ├── const.ink.json │ │ │ ├── multiple_constant_references.ink.json │ │ │ ├── set_non_existant_variable.ink.json │ │ │ ├── set_non_existent_variable.ink.json │ │ │ ├── temp_global_conflict.ink.json │ │ │ ├── temp_not_found.ink.json │ │ │ ├── temp_usage_in_options.ink.json │ │ │ ├── temporaries_at_global_scope.ink.json │ │ │ ├── variable_declaration_in_conditional.ink.json │ │ │ ├── variable_divert_target.ink.json │ │ │ ├── variable_get_set_api.ink.json │ │ │ ├── variable_pointer_ref_from_knot.ink.json │ │ │ ├── variable_swap_recurse.ink.json │ │ │ ├── variable_tunnel.ink.json │ │ │ ├── warn_variable_not_found_1.ink.json │ │ │ └── warn_variable_not_found_2.ink.json │ │ └── weaves │ │ │ ├── conditional_choice_in_weave.ink.json │ │ │ ├── conditional_choice_in_weave_2.ink.json │ │ │ ├── unbalanced_weave_indentation.ink.json │ │ │ ├── weave_gathers.ink.json │ │ │ ├── weave_options.ink.json │ │ │ └── weave_within_sequence.ink.json │ └── original │ │ ├── bindings │ │ ├── external_binding.ink │ │ ├── game_ink_back_and_forth.ink │ │ ├── lookup_safe_or_not.ink │ │ ├── lookup_safe_or_not_with_post_glue.ink │ │ └── variable_observer.ink │ │ ├── booleans │ │ ├── false_plus_false.ink │ │ ├── list_hasnt.ink │ │ ├── not_one.ink │ │ ├── not_true.ink │ │ ├── three_greater_than_one.ink │ │ ├── true.ink │ │ ├── true_equals_one.ink │ │ ├── true_plus_one.ink │ │ ├── true_plus_true.ink │ │ └── two_plus_true.ink │ │ ├── builtins │ │ ├── floor_ceiling_and_casts.ink │ │ ├── read_count_across_callstack.ink │ │ ├── read_count_across_threads.ink │ │ ├── read_count_dot_separated_path.ink │ │ ├── read_count_variable_target.ink │ │ ├── turns.ink │ │ ├── turns_since.ink │ │ ├── turns_since_nested.ink │ │ ├── turns_since_with_variable_target.ink │ │ ├── visit_count_bug_due_to_nested_containers.ink │ │ └── visit_counts_when_choosing.ink │ │ ├── callstack │ │ ├── callstack_evaluation.ink │ │ └── clean_callstack_reset_on_path_choice.ink │ │ ├── choices │ │ ├── blank_choice.ink │ │ ├── choice_count.ink │ │ ├── choice_diverts_to_done.ink │ │ ├── choice_thread_forking.ink │ │ ├── choice_with_brackets_only.ink │ │ ├── conditional_choices.ink │ │ ├── default_choices.ink │ │ ├── default_simple_gather.ink │ │ ├── dynamic_tags_in_choice.ink │ │ ├── empty_choice.ink │ │ ├── fallback_choice_on_thread.ink │ │ ├── gather_choice_same_line.ink │ │ ├── has_read_on_choice.ink │ │ ├── logic_in_choices.ink │ │ ├── nested_choice.ink │ │ ├── nested_choice_error.ink │ │ ├── newline_after_choice.ink │ │ ├── non_text_in_choice_inner_content.ink │ │ ├── once_only_choices_can_link_back_to_self.ink │ │ ├── once_only_choices_with_own_content.ink │ │ ├── should_not_gather_due_to_choice.ink │ │ ├── state_rollback_over_default_choice.ink │ │ ├── sticky_choices_stay_sticky.ink │ │ ├── tags_in_choice.ink │ │ ├── various_blank_choice_warning.ink │ │ └── various_default_choices.ink │ │ ├── conditions │ │ ├── all_switch_branches_fail_is_clean.ink │ │ ├── conditionals.ink │ │ ├── else_branches.ink │ │ ├── empty_multiline_conditional_branch.ink │ │ └── trivial_condition.ink │ │ ├── diverts │ │ ├── basic_tunnel.ink │ │ ├── compare_divert_targets.ink │ │ ├── compiler │ │ │ ├── disallow_empty_diverts.ink │ │ │ ├── divert_not_found_error.ink │ │ │ └── divert_to_weave_points.ink │ │ ├── complex_tunnels.ink │ │ ├── divert_in_conditional.ink │ │ ├── divert_targets_with_parameters.ink │ │ ├── divert_to_weave_points.ink │ │ ├── done_stops_thread.ink │ │ ├── path_to_self.ink │ │ ├── same_line_divert_is_inline.ink │ │ ├── tunnel_onwards_after_tunnel.ink │ │ ├── tunnel_onwards_divert_after_with_arg.ink │ │ ├── tunnel_onwards_divert_override.ink │ │ ├── tunnel_onwards_to_variable_divert_target.ink │ │ ├── tunnel_onwards_with_param_default_choice.ink │ │ └── tunnel_vs_thread_behaviour.ink │ │ ├── evaluation │ │ ├── arithmetic.ink │ │ ├── basic_string_literals.ink │ │ ├── evaluating_function_variable_state_bug.ink │ │ ├── evaluating_ink_functions_from_game.ink │ │ ├── evaluating_ink_functions_from_game_2.ink │ │ ├── evaluation_stack_leaks.ink │ │ ├── factorial_by_reference.ink │ │ ├── factorial_recursive.ink │ │ ├── increment.ink │ │ └── literal_unary.ink │ │ ├── extra │ │ ├── arithmetic_2.ink │ │ └── list_comparison.ink │ │ ├── functions │ │ └── compiler │ │ │ ├── argument_name_collisions.ink │ │ │ ├── argument_shouldnt_conflict_with_gather_elsewhere.ink │ │ │ ├── function_call_restrictions.ink │ │ │ ├── function_purity_checks.ink │ │ │ ├── using_function_and_increment_together.ink │ │ │ └── wrong_variable_divert_target_reference.ink │ │ ├── glue │ │ ├── implicit_inline_glue.ink │ │ ├── implicit_inline_glue_b.ink │ │ ├── implicit_inline_glue_c.ink │ │ ├── left_right_glue_matching.ink │ │ └── simple_glue.ink │ │ ├── inkjs │ │ └── tests.ink │ │ ├── knots │ │ ├── compiler │ │ │ └── knot_termination_skips_global_objects.ink │ │ ├── knot_do_not_gather.ink │ │ ├── knot_stitch_gather_counts.ink │ │ ├── knot_thread_interaction.ink │ │ ├── knot_thread_interaction_2.ink │ │ └── stitch_naming_collision.ink │ │ ├── lists │ │ ├── contains_empty_list_always_false.ink │ │ ├── empty_list_origin.ink │ │ ├── empty_list_origin_after_assignment.ink │ │ ├── list_basic_operations.ink │ │ ├── list_mixed_items.ink │ │ ├── list_random.ink │ │ ├── list_range.ink │ │ ├── list_save_load.ink │ │ └── more_list_operations.ink │ │ ├── logic │ │ ├── logic_lines_with_newlines.ink │ │ ├── multiline_logic_with_glue.ink │ │ ├── nested_pass_by_reference.ink │ │ └── print_num.ink │ │ ├── misc │ │ ├── author_warnings_inside_content_list_bug.ink │ │ ├── compiler │ │ │ ├── empty_thread_error.ink │ │ │ ├── end_of_content_function.ink │ │ │ ├── end_of_content_return_statement.ink │ │ │ ├── end_of_content_without_end.ink │ │ │ ├── loose_ends.ink │ │ │ └── return_text_warning.ink │ │ ├── empty.ink │ │ ├── end.ink │ │ ├── end2.ink │ │ ├── end_of_content_hello_world.ink │ │ ├── end_of_content_with_end.ink │ │ ├── end_of_content_without_end.ink │ │ ├── escape_character.ink │ │ ├── hello_world.ink │ │ ├── identifiers_can_start_with_number.ink │ │ ├── include.ink │ │ ├── includes │ │ │ ├── included_file.ink │ │ │ ├── included_file_2.ink │ │ │ ├── included_file_3.ink │ │ │ └── included_file_4.ink │ │ ├── nested_include.ink │ │ ├── quote_character_significance.ink │ │ └── whitespace.ink │ │ ├── multiflow │ │ ├── multi_flow_basics.ink │ │ └── multi_flow_save_load_threads.ink │ │ ├── newlines │ │ ├── newline_at_start_of_multiline_conditional.ink │ │ ├── newline_consistency_1.ink │ │ ├── newline_consistency_2.ink │ │ ├── newline_consistency_3.ink │ │ ├── newlines_trimming_with_func_external_fallback.ink │ │ └── newlines_with_string_eval.ink │ │ ├── sequences │ │ ├── all_sequence_types.ink │ │ ├── blanks_in_inline_sequences.ink │ │ ├── empty_sequence_content.ink │ │ ├── gather_read_count_with_initial_sequence.ink │ │ ├── leading_newline_multiline_sequence.ink │ │ └── shuffle_stack_muddying.ink │ │ ├── strings │ │ ├── string_constants.ink │ │ ├── string_contains.ink │ │ ├── string_type_coercion.ink │ │ └── strings_in_choices.ink │ │ ├── tags │ │ ├── tags.ink │ │ ├── tags_dynamic_content.ink │ │ └── tags_in_seq.ink │ │ ├── threads │ │ ├── multi_thread.ink │ │ ├── thread_done.ink │ │ ├── thread_in_logic.ink │ │ └── top_flow_terminator_should_not_kill_thread_choices.ink │ │ ├── variables │ │ ├── compiler │ │ │ ├── const_redefinition.ink │ │ │ ├── require_variable_targets_typed.ink │ │ │ ├── temp_not_allowed_cross_stitch.ink │ │ │ ├── variable_naming_collision_with_arg.ink │ │ │ └── variable_naming_collision_with_flow.ink │ │ ├── const.ink │ │ ├── multiple_constant_references.ink │ │ ├── set_non_existent_variable.ink │ │ ├── temp_global_conflict.ink │ │ ├── temp_not_found.ink │ │ ├── temp_usage_in_options.ink │ │ ├── temporaries_at_global_scope.ink │ │ ├── variable_declaration_in_conditional.ink │ │ ├── variable_divert_target.ink │ │ ├── variable_get_set_api.ink │ │ ├── variable_name_colision_with_flow.ink │ │ ├── variable_name_collision_with_arg.ink │ │ ├── variable_pointer_ref_from_knot.ink │ │ ├── variable_swap_recurse.ink │ │ ├── variable_tunnel.ink │ │ ├── warn_variable_not_found_1.ink │ │ └── warn_variable_not_found_2.ink │ │ └── weaves │ │ ├── conditional_choice_in_weave.ink │ │ ├── conditional_choice_in_weave_2.ink │ │ ├── unbalanced_weave_indentation.ink │ │ ├── weave_gathers.ink │ │ ├── weave_options.ink │ │ ├── weave_point_naming_collision.ink │ │ └── weave_within_sequence.ink │ └── specs │ ├── common.ts │ ├── ink │ ├── Bindings.spec.ts │ ├── Booleans.spec.ts │ ├── Builtins.spec.ts │ ├── CallStack.spec.ts │ ├── Choices.spec.ts │ ├── Conditions.spec.ts │ ├── Diverts.spec.ts │ ├── Evaluation.spec.ts │ ├── Extra.spec.ts │ ├── Functions.spec.ts │ ├── Glue.spec.ts │ ├── Knots.spec.ts │ ├── Lists.spec.ts │ ├── Logic.spec.ts │ ├── Misc.spec.ts │ ├── Multiflow.spec.ts │ ├── Newlines.spec.ts │ ├── Parser.spec.ts │ ├── Sequences.spec.ts │ ├── Strings.spec.ts │ ├── Tags.spec.ts │ ├── Threads.spec.ts │ ├── Variables.spec.ts │ └── Weaves.spec.ts │ ├── inkjs │ ├── compiler │ │ ├── Core.spec.ts │ │ └── Stats.spec.ts │ ├── engine │ │ ├── Choices.spec.ts │ │ ├── Content.spec.ts │ │ ├── Flows.spec.ts │ │ ├── Integration.spec.ts │ │ ├── Lists.spec.ts │ │ ├── Logic.spec.ts │ │ ├── SimpleLists.spec.ts │ │ └── Tags.spec.ts │ └── utils │ │ ├── SimpleJson.spec.ts │ │ ├── TryGetResult.spec.ts │ │ └── TypeAssertion.spec.ts │ └── setupTests.ts ├── templates ├── browser_serverless │ ├── index.html │ ├── ink.js │ ├── ink.js.map │ ├── main.js │ ├── story.js │ └── style.css ├── browser_with_server │ ├── index.html │ ├── ink.js │ ├── ink.js.map │ ├── main.js │ ├── story.json │ └── style.css ├── nodejs │ ├── index.js │ └── intercept.ink.json ├── typescript_player │ ├── package.json │ ├── src │ │ ├── index.ts │ │ └── story.json │ └── tsconfig.json └── typescript_with_compiler │ ├── package.json │ ├── src │ └── index.ts │ └── tsconfig.json └── tsconfig.json /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"] 3 | } 4 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | ignore: 3 | - templates/* 4 | - tests/* 5 | - dist/* -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | --- 5 | 6 | ## Describe the bug 7 | 8 | 9 | ## To Reproduce 10 | 11 | 12 | ## Expected behavior 13 | 14 | 15 | ## Ink files 16 | 17 | 18 | ## Environment 19 | - OS: 20 | - Node.js version: 21 | - Web browser version: 22 | - _inklecate_ version: 23 | - _inkjs_ version: 24 | 25 | ## Additional context 26 | 27 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Checklist 2 | 3 | 7 | 8 | - [ ] The new code additions passed the tests (`npm test`). 9 | - [ ] The linter ran and found no issues (`npm run-script lint`). 10 | 14 | 15 | ## Description 16 | 17 | 18 | -------------------------------------------------------------------------------- /.github/workflows/checks.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: [pull_request, workflow_dispatch] 4 | 5 | jobs: 6 | test: 7 | name: CI tasks 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@v4 12 | - name: Install node 13 | uses: actions/setup-node@v4 14 | with: 15 | node-version: 20 16 | - name: Install dependencies 17 | run: npm install 18 | - name: Install codecov 19 | run: npm install codecov 20 | - name: Build 21 | run: npm run build 22 | - name: tests 23 | run: npm run test 24 | - name: Lint 25 | run: npm run lint -------------------------------------------------------------------------------- /.github/workflows/npm-manual-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages 3 | 4 | name: Publish to npm (manual) 5 | 6 | on: [workflow_dispatch] 7 | 8 | jobs: 9 | test: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v4 13 | - uses: actions/setup-node@v4 14 | with: 15 | node-version: 20 16 | - run: npm install 17 | - run: npm run lint 18 | - run: npm run build 19 | - run: npm run test 20 | 21 | publish-npm: 22 | needs: test 23 | runs-on: ubuntu-latest 24 | steps: 25 | - name: Checkout 26 | uses: actions/checkout@v4 27 | - name: Install node 28 | uses: actions/setup-node@v4 29 | with: 30 | node-version: "20.x" 31 | registry-url: "https://registry.npmjs.org" 32 | - name: Install dependencies 33 | run: npm install 34 | - name: Build 35 | run: npm run build 36 | - name: Publish to npm 37 | run: npm publish 38 | env: 39 | NODE_AUTH_TOKEN: ${{secrets.npm_token}} 40 | -------------------------------------------------------------------------------- /.github/workflows/npm-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages 3 | 4 | name: Publish to npm 5 | 6 | on: 7 | release: 8 | types: [created] 9 | 10 | jobs: 11 | test: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v4 15 | - uses: actions/setup-node@v4 16 | with: 17 | node-version: 20 18 | - run: npm install 19 | - run: npm run lint 20 | - run: npm run build 21 | - run: npm run test 22 | 23 | publish-npm: 24 | needs: test 25 | runs-on: ubuntu-latest 26 | steps: 27 | - name: Checkout 28 | uses: actions/checkout@v4 29 | - name: Install node 30 | uses: actions/setup-node@v4 31 | with: 32 | node-version: "20.x" 33 | registry-url: "https://registry.npmjs.org" 34 | - name: Install dependencies 35 | run: npm install 36 | - name: Build 37 | run: npm run build 38 | - name: Publish to npm 39 | run: npm publish 40 | env: 41 | NODE_AUTH_TOKEN: ${{secrets.npm_token}} 42 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | tests/ 2 | templates/ 3 | coverage/ 4 | media/ 5 | 6 | .github 7 | .rpt2_cache 8 | .vscode 9 | 10 | .babelrc 11 | .gitattributes 12 | .istanbul.yml 13 | .travis.yml 14 | .codecov.yml 15 | 16 | jasmine.config.json 17 | jest.config* 18 | renovate.json 19 | rollup.config.js 20 | tsconfig.json 21 | tslint.json 22 | 23 | 24 | src -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5" 3 | } -------------------------------------------------------------------------------- /AUTHORS.md: -------------------------------------------------------------------------------- 1 | This is the list of inkjs' main contributors. 2 | 3 | inkle Ltd. (@inkle): original source code 4 | Yannick Lohse (@y-lohse): project creator, runtime port 5 | Frédéric Maquin (@ephread): runtime port 6 | furkle (@furkle): compiler port 7 | Julien Zamor (@smwhr): compiler port 8 | 9 | To see the full list of contributors, see the revision history in 10 | source control. Alternatively, the complete list of contributors 11 | can be found at https://github.com/y-lohse/inkjs/graphs/contributors 12 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 inkle Ltd. 4 | Copyright (c) 2017 inkjs contributors (see AUTHORS) 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /ink.d.mts: -------------------------------------------------------------------------------- 1 | export { Story, InkList } from "./engine/Story"; 2 | export { Compiler, CompilerOptions } from "./compiler/Compiler"; 3 | export { PosixFileHandler } from "./compiler/FileHandler/PosixFileHandler"; 4 | export { JsonFileHandler } from "./compiler/FileHandler/JsonFileHandler"; 5 | -------------------------------------------------------------------------------- /ink.d.ts: -------------------------------------------------------------------------------- 1 | export { Story, InkList } from "./engine/Story"; 2 | export { Compiler, CompilerOptions } from "./compiler/Compiler"; 3 | export { PosixFileHandler } from "./compiler/FileHandler/PosixFileHandler"; 4 | export { JsonFileHandler } from "./compiler/FileHandler/JsonFileHandler"; 5 | -------------------------------------------------------------------------------- /jest.config.javascript.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | testEnvironment: "node", 3 | testMatch: [ 4 | "**/tests/**/*.(spec|test).js" 5 | ], 6 | testPathIgnorePatterns: [ 7 | "/src/" 8 | ], 9 | setupFilesAfterEnv: [ 10 | "/tests/specs/setupTests.js" 11 | ], 12 | }; 13 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | collectCoverage: true, 3 | collectCoverageFrom: [ 4 | "src/engine/**/*.ts", 5 | ], 6 | coverageDirectory: "coverage", 7 | coverageReporters: [ 8 | "json", 9 | "text-summary", 10 | "html" 11 | ], 12 | testEnvironment: "node", 13 | testMatch: [ 14 | "**/tests/**/*.(spec|test).ts" 15 | ], 16 | testPathIgnorePatterns: [ 17 | "/tests/" 18 | ], 19 | transform: { 20 | "^.+\\.ts$": "ts-jest" 21 | }, 22 | setupFilesAfterEnv: [ 23 | "/src/tests/specs/setupTests.ts" 24 | ], 25 | }; 26 | -------------------------------------------------------------------------------- /media/inkjs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/y-lohse/inkjs/a1259bddd5155bd5896d6b21dcb87a2a6bedfe2e/media/inkjs.png -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "schedule": [ 3 | "before 3am on the first day of the month" 4 | ], 5 | "extends": [ 6 | "config:base" 7 | ], 8 | "devDependencies": { 9 | "automerge": true 10 | } 11 | } -------------------------------------------------------------------------------- /src/compiler/CompilerOptions.ts: -------------------------------------------------------------------------------- 1 | import { ErrorHandler } from "../engine/Error"; 2 | import { IFileHandler } from "./IFileHandler"; 3 | 4 | export class CompilerOptions { 5 | constructor( 6 | public readonly sourceFilename: string | null = null, 7 | public readonly pluginNames: string[] = [], 8 | public readonly countAllVisits: boolean = false, 9 | public readonly errorHandler: ErrorHandler | null = null, 10 | public readonly fileHandler: IFileHandler | null = null 11 | ) {} 12 | } 13 | -------------------------------------------------------------------------------- /src/compiler/DebugSourceRange.ts: -------------------------------------------------------------------------------- 1 | import { DebugMetadata } from "../engine/DebugMetadata"; 2 | 3 | export class DebugSourceRange { 4 | constructor( 5 | public readonly length: number, 6 | public readonly debugMetadata: DebugMetadata | null, 7 | public text: string 8 | ) {} 9 | } 10 | -------------------------------------------------------------------------------- /src/compiler/FileHandler/DefaultFileHandler.ts: -------------------------------------------------------------------------------- 1 | import { IFileHandler } from "../IFileHandler"; 2 | 3 | // This class replaces upstream's DefaultFileHandler. It doesn't perform any 4 | // resolution and warns the user about providing a proper file handler when 5 | // INCLUDE statements are parsed. Since the JavaScript parser can be executed in 6 | // different environments, we let the user decide which FileHandler is best for 7 | // their use-case. See PosixFileHandler and JsonFileHandler. 8 | export class DefaultFileHandler implements IFileHandler { 9 | constructor(public readonly rootPath?: string) {} 10 | 11 | readonly ResolveInkFilename = (): string => { 12 | throw Error( 13 | "Can't resolve filename because no FileHandler was provided when instantiating the parser / compiler." 14 | ); 15 | }; 16 | 17 | readonly LoadInkFileContents = (): string => { 18 | throw Error( 19 | "Can't load ink content because no FileHandler was provided when instantiating the parser / compiler." 20 | ); 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /src/compiler/FileHandler/JsonFileHandler.ts: -------------------------------------------------------------------------------- 1 | import { IFileHandler } from "../IFileHandler"; 2 | 3 | export class JsonFileHandler implements IFileHandler { 4 | constructor(public readonly fileHierarchy: Record) {} 5 | 6 | readonly ResolveInkFilename = (filename: string): string => { 7 | if (Object.keys(this.fileHierarchy).includes(filename)) return filename; 8 | throw new Error( 9 | `Cannot locate ${filename}. Are you trying a relative import ? This is not yet implemented.` 10 | ); 11 | }; 12 | 13 | readonly LoadInkFileContents = (filename: string): string => { 14 | if (Object.keys(this.fileHierarchy).includes(filename)) { 15 | return this.fileHierarchy[filename]; 16 | } else { 17 | throw new Error(`Cannot open ${filename}.`); 18 | } 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /src/compiler/FileHandler/PosixFileHandler.ts: -------------------------------------------------------------------------------- 1 | import { IFileHandler } from "../IFileHandler"; 2 | import * as path from "path"; 3 | import * as fs from "fs"; 4 | 5 | // This class replaces upstream's DefaultFileHandler. 6 | export class PosixFileHandler implements IFileHandler { 7 | constructor(public readonly rootPath: string = "") {} 8 | 9 | readonly ResolveInkFilename = (filename: string): string => { 10 | return path.resolve(process.cwd(), this.rootPath, filename); 11 | }; 12 | 13 | readonly LoadInkFileContents = (filename: string): string => { 14 | return fs.readFileSync(filename, "utf-8"); 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /src/compiler/IFileHandler.ts: -------------------------------------------------------------------------------- 1 | export interface IFileHandler { 2 | readonly ResolveInkFilename: (filename: string) => string; 3 | readonly LoadInkFileContents: (filename: string) => string; 4 | } 5 | 6 | // Looking for DefaultFileHandler? POSIXFileHandler replaces it in inkjs. 7 | -------------------------------------------------------------------------------- /src/compiler/Parser/CharacterSet.ts: -------------------------------------------------------------------------------- 1 | export class CharacterSet { 2 | public static readonly FromRange = ( 3 | start: string, 4 | end: string 5 | ): CharacterSet => new CharacterSet().AddRange(start, end); 6 | 7 | public set: Set = new Set(); 8 | 9 | constructor(arg?: string | string[] | CharacterSet) { 10 | if (arg) { 11 | this.AddCharacters(arg); 12 | } 13 | } 14 | 15 | public readonly Add = (arg: string) => this.set.add(arg); 16 | 17 | public readonly AddRange = (start: string, end: string): CharacterSet => { 18 | for (let c = start.charCodeAt(0); c <= end.charCodeAt(0); ++c) { 19 | this.Add(String.fromCharCode(c)); 20 | } 21 | 22 | return this; 23 | }; 24 | 25 | public readonly AddCharacters = ( 26 | chars: string | string[] | CharacterSet 27 | ): CharacterSet => { 28 | if (typeof chars === "string" || Array.isArray(chars)) { 29 | for (const c of chars) { 30 | this.Add(c); 31 | } 32 | } else { 33 | for (const c of chars.set) { 34 | this.Add(c); 35 | } 36 | } 37 | 38 | return this; 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /src/compiler/Parser/CustomFlags.ts: -------------------------------------------------------------------------------- 1 | export enum CustomFlags { 2 | ParsingString = 0x1, 3 | TagActive = 0x2, 4 | } 5 | -------------------------------------------------------------------------------- /src/compiler/Parser/ErrorType.ts: -------------------------------------------------------------------------------- 1 | // TODO: Unifify with Engine. 2 | 3 | export enum ErrorType { 4 | Author, 5 | Warning, 6 | Error, 7 | } 8 | -------------------------------------------------------------------------------- /src/compiler/Parser/FlowDecl.ts: -------------------------------------------------------------------------------- 1 | import { Argument } from "./ParsedHierarchy/Argument"; 2 | import { Identifier } from "./ParsedHierarchy/Identifier"; 3 | 4 | export class FlowDecl { 5 | constructor( 6 | public readonly name: Identifier, 7 | public readonly args: Argument[], 8 | public readonly isFunction: boolean 9 | ) {} 10 | } 11 | -------------------------------------------------------------------------------- /src/compiler/Parser/InfixOperator.ts: -------------------------------------------------------------------------------- 1 | export class InfixOperator { 2 | constructor( 3 | public readonly type: string, 4 | public readonly precedence: number, 5 | public readonly requireWhitespace: boolean 6 | ) {} 7 | 8 | public readonly toString = (): string => this.type; 9 | } 10 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/Argument.ts: -------------------------------------------------------------------------------- 1 | import { Identifier } from "./Identifier"; 2 | 3 | export class Argument { 4 | constructor( 5 | public identifier: Identifier | null = null, 6 | public isByReference: boolean | null = null, 7 | public isDivertTarget: boolean | null = null 8 | ) {} 9 | 10 | get typeName(): string { 11 | return "Argument"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/AuthorWarning.ts: -------------------------------------------------------------------------------- 1 | import { ParsedObject } from "./Object"; 2 | 3 | export class AuthorWarning extends ParsedObject { 4 | constructor(public readonly warningMessage: string) { 5 | super(); 6 | } 7 | 8 | get typeName(): string { 9 | return "AuthorWarning"; 10 | } 11 | 12 | public readonly GenerateRuntimeObject = (): null => { 13 | this.Warning(this.warningMessage); 14 | return null; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/Declaration/ExternalDeclaration.ts: -------------------------------------------------------------------------------- 1 | import { INamedContent } from "../../../../engine/INamedContent"; 2 | import { ParsedObject } from "../Object"; 3 | import { InkObject as RuntimeObject } from "../../../../engine/Object"; 4 | import { Identifier } from "../Identifier"; 5 | 6 | export class ExternalDeclaration extends ParsedObject implements INamedContent { 7 | public get name(): string | null { 8 | return this.identifier?.name || null; 9 | } 10 | 11 | constructor( 12 | public readonly identifier: Identifier, 13 | public readonly argumentNames: string[] 14 | ) { 15 | super(); 16 | } 17 | 18 | get typeName(): string { 19 | return "EXTERNAL"; 20 | } 21 | 22 | public readonly GenerateRuntimeObject = (): RuntimeObject | null => { 23 | this.story.AddExternal(this); 24 | 25 | // No runtime code exists for an external, only metadata 26 | return null; 27 | }; 28 | 29 | public toString(): string { 30 | return `EXTERNAL ${this.identifier?.name}`; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/Expression/MultipleConditionExpression.ts: -------------------------------------------------------------------------------- 1 | import { Container as RuntimeContainer } from "../../../../engine/Container"; 2 | import { Expression } from "./Expression"; 3 | import { NativeFunctionCall } from "../../../../engine/NativeFunctionCall"; 4 | 5 | export class MultipleConditionExpression extends Expression { 6 | get subExpressions(): Expression[] { 7 | return this.content as Expression[]; 8 | } 9 | 10 | constructor(conditionExpressions: Expression[]) { 11 | super(); 12 | 13 | this.AddContent(conditionExpressions); 14 | } 15 | 16 | get typeName(): string { 17 | return "MultipleConditionExpression"; 18 | } 19 | 20 | public readonly GenerateIntoContainer = ( 21 | container: RuntimeContainer 22 | ): void => { 23 | // A && B && C && D 24 | // => (((A B &&) C &&) D &&) etc 25 | let isFirst: boolean = true; 26 | for (const conditionExpr of this.subExpressions) { 27 | conditionExpr.GenerateIntoContainer(container); 28 | 29 | if (!isFirst) { 30 | container.AddContent(NativeFunctionCall.CallWithName("&&")); 31 | } 32 | 33 | isFirst = false; 34 | } 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/FindQueryFunc.ts: -------------------------------------------------------------------------------- 1 | import { ParsedObject } from "./Object"; 2 | 3 | export type FindQueryFunc = (obj: T) => boolean; 4 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/Flow/ClosestFlowBase.ts: -------------------------------------------------------------------------------- 1 | // import { FlowBase } from './FlowBase'; 2 | 3 | export function ClosestFlowBase(obj: any): any | null { 4 | let ancestor = obj.parent; 5 | while (ancestor) { 6 | if (ancestor.hasOwnProperty("iamFlowbase") && ancestor.iamFlowbase()) { 7 | return ancestor as any; 8 | } 9 | 10 | ancestor = ancestor.parent; 11 | } 12 | 13 | return null; 14 | } 15 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/Flow/FlowLevel.ts: -------------------------------------------------------------------------------- 1 | export enum FlowLevel { 2 | Story, // 0 3 | Knot, // 1 4 | Stitch, // 2 5 | // not actually a FlowBase, but used for diverts 6 | WeavePoint, // 3 7 | } 8 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/Gather/GatherPointToResolve.ts: -------------------------------------------------------------------------------- 1 | import { Divert as RuntimeDivert } from "../../../../engine/Divert"; 2 | import { InkObject as RuntimeObject } from "../../../../engine/Object"; 3 | 4 | export class GatherPointToResolve { 5 | constructor( 6 | public divert: RuntimeDivert, 7 | public targetRuntimeObj: RuntimeObject 8 | ) {} 9 | } 10 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/Glue.ts: -------------------------------------------------------------------------------- 1 | import { Glue as RuntimeGlue } from "../../../engine/Glue"; 2 | import { Wrap } from "./Wrap"; 3 | 4 | export class Glue extends Wrap { 5 | constructor(glue: RuntimeGlue) { 6 | super(glue); 7 | } 8 | 9 | get typeName(): string { 10 | return "Glue"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/IWeavePoint.ts: -------------------------------------------------------------------------------- 1 | import { Container as RuntimeContainer } from "../../../engine/Container"; 2 | import { Identifier } from "./Identifier"; 3 | import { ParsedObject } from "./Object"; 4 | 5 | export interface IWeavePoint extends ParsedObject { 6 | readonly content: ParsedObject[]; 7 | readonly indentationDepth: number; 8 | readonly name: string | null; 9 | readonly identifier?: Identifier; 10 | readonly runtimeContainer: RuntimeContainer | null; 11 | } 12 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/Identifier.ts: -------------------------------------------------------------------------------- 1 | import { DebugMetadata } from "../../../engine/DebugMetadata"; 2 | 3 | export class Identifier { 4 | public name: string; 5 | public debugMetadata: DebugMetadata | null = null; 6 | 7 | constructor(name: string) { 8 | this.name = name; 9 | } 10 | 11 | get typeName(): string { 12 | return "Identifier"; 13 | } 14 | 15 | public static Done(): Identifier { 16 | return new Identifier("DONE"); 17 | } 18 | 19 | public readonly toString = (): string => this.name || "undefined identifer"; 20 | } 21 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/IncludedFile.ts: -------------------------------------------------------------------------------- 1 | import { ParsedObject } from "./Object"; 2 | import { InkObject as RuntimeObject } from "../../../engine/Object"; 3 | import { Story } from "./Story"; 4 | 5 | export class IncludedFile extends ParsedObject { 6 | constructor(public readonly includedStory: Story | null) { 7 | super(); 8 | } 9 | 10 | public readonly GenerateRuntimeObject = (): RuntimeObject | null => { 11 | // Left to the main story to process 12 | return null; 13 | }; 14 | 15 | get typeName(): string { 16 | return "IncludedFile"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/Sequence/SequenceDivertToResolve.ts: -------------------------------------------------------------------------------- 1 | import { Divert as RuntimeDivert } from "../../../../engine/Divert"; 2 | import { InkObject as RuntimeObject } from "../../../../engine/Object"; 3 | 4 | export class SequenceDivertToResolve { 5 | constructor( 6 | public divert: RuntimeDivert, 7 | public targetContent: RuntimeObject 8 | ) {} 9 | } 10 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/Sequence/SequenceType.ts: -------------------------------------------------------------------------------- 1 | export enum SequenceType { 2 | Stopping = 1, // default 3 | Cycle = 2, 4 | Shuffle = 4, 5 | Once = 8, 6 | } 7 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/Stitch.ts: -------------------------------------------------------------------------------- 1 | import { Argument } from "./Argument"; 2 | import { FlowBase } from "./Flow/FlowBase"; 3 | import { FlowLevel } from "./Flow/FlowLevel"; 4 | import { Identifier } from "./Identifier"; 5 | import { ParsedObject } from "./Object"; 6 | 7 | export class Stitch extends FlowBase { 8 | get flowLevel(): FlowLevel { 9 | return FlowLevel.Stitch; 10 | } 11 | 12 | constructor( 13 | name: Identifier, 14 | topLevelObjects: ParsedObject[], 15 | args: Argument[], 16 | isFunction: boolean 17 | ) { 18 | super(name, topLevelObjects, args, isFunction); 19 | } 20 | 21 | get typeName(): string { 22 | return "Stitch"; 23 | } 24 | 25 | // Fixes TS issue with not being able to access the prototype via `super` in functions 26 | // attached to the class as properties. 27 | private baseToString = this.toString; 28 | 29 | public toString = (): string => { 30 | return `${ 31 | this.parent !== null ? this.parent + " > " : "" 32 | }${this.baseToString()}`; 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/SymbolType.ts: -------------------------------------------------------------------------------- 1 | export enum SymbolType { 2 | Knot = 0, 3 | List = 1, 4 | ListItem = 2, 5 | Var = 3, 6 | SubFlowAndWeave = 4, 7 | Arg = 5, 8 | Temp = 6, 9 | } 10 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/Tag.ts: -------------------------------------------------------------------------------- 1 | import { ParsedObject } from "./Object"; 2 | import { ControlCommand } from "../../../engine/ControlCommand"; 3 | import { InkObject as RuntimeObject } from "../../../engine/Object"; 4 | 5 | export class Tag extends ParsedObject { 6 | public isStart: boolean; 7 | public inChoice: boolean; 8 | 9 | constructor(isStart: boolean, inChoice: boolean = false) { 10 | super(); 11 | this.isStart = isStart; 12 | this.inChoice = inChoice; 13 | } 14 | get typeName(): string { 15 | return "Tag"; 16 | } 17 | public readonly GenerateRuntimeObject = (): RuntimeObject => { 18 | if (this.isStart) { 19 | return ControlCommand.BeginTag(); 20 | } else { 21 | return ControlCommand.EndTag(); 22 | } 23 | }; 24 | 25 | public readonly toString = () => { 26 | if (this.isStart) { 27 | return "#StartTag"; 28 | } else { 29 | return "#EndTag"; 30 | } 31 | }; 32 | } 33 | 34 | import { Tag as RuntimeTag } from "../../../engine/Tag"; 35 | import { Wrap } from "./Wrap"; 36 | export class LegacyTag extends Wrap { 37 | constructor(tag: RuntimeTag) { 38 | super(tag); 39 | } 40 | get typeName(): string { 41 | return "Tag"; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/Text.ts: -------------------------------------------------------------------------------- 1 | import { ParsedObject } from "./Object"; 2 | import { InkObject as RuntimeObject } from "../../../engine/Object"; 3 | import { StringValue } from "../../../engine/Value"; 4 | 5 | export class Text extends ParsedObject { 6 | constructor(public text: string) { 7 | super(); 8 | } 9 | get typeName(): string { 10 | return "Text"; 11 | } 12 | 13 | public readonly GenerateRuntimeObject = (): RuntimeObject => 14 | new StringValue(this.text); 15 | 16 | public readonly toString = (): string => this.text; 17 | } 18 | -------------------------------------------------------------------------------- /src/compiler/Parser/ParsedHierarchy/Wrap.ts: -------------------------------------------------------------------------------- 1 | import { ParsedObject } from "./Object"; 2 | import { InkObject as RuntimeObject } from "../../../engine/Object"; 3 | 4 | export class Wrap extends ParsedObject { 5 | constructor(private _objToWrap: T) { 6 | super(); 7 | } 8 | 9 | public readonly GenerateRuntimeObject = (): RuntimeObject => this._objToWrap; 10 | } 11 | -------------------------------------------------------------------------------- /src/compiler/Parser/StatementLevel.ts: -------------------------------------------------------------------------------- 1 | export enum StatementLevel { 2 | InnerBlock, 3 | Stitch, 4 | Knot, 5 | Top, 6 | } 7 | -------------------------------------------------------------------------------- /src/engine/Choice.ts: -------------------------------------------------------------------------------- 1 | import { Path } from "./Path"; 2 | import { CallStack } from "./CallStack"; 3 | import { throwNullException } from "./NullException"; 4 | import { InkObject } from "./Object"; 5 | 6 | export class Choice extends InkObject { 7 | public text: string = ""; 8 | public index: number = 0; 9 | public threadAtGeneration: CallStack.Thread | null = null; 10 | public sourcePath: string = ""; 11 | public targetPath: Path | null = null; 12 | public isInvisibleDefault: boolean = false; 13 | public tags: string[] | null = null; 14 | public originalThreadIndex: number = 0; 15 | 16 | get pathStringOnChoice(): string { 17 | if (this.targetPath === null) 18 | return throwNullException("Choice.targetPath"); 19 | return this.targetPath.toString(); 20 | } 21 | set pathStringOnChoice(value: string) { 22 | this.targetPath = new Path(value); 23 | } 24 | 25 | public Clone() { 26 | let copy = new Choice(); 27 | copy.text = this.text; 28 | copy.sourcePath = this.sourcePath; 29 | copy.index = this.index; 30 | copy.targetPath = this.targetPath; 31 | copy.originalThreadIndex = this.originalThreadIndex; 32 | copy.isInvisibleDefault = this.isInvisibleDefault; 33 | if (this.threadAtGeneration !== null) 34 | copy.threadAtGeneration = this.threadAtGeneration.Copy(); 35 | 36 | return copy; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/engine/Debug.ts: -------------------------------------------------------------------------------- 1 | export namespace Debug { 2 | export function AssertType( 3 | variable: any, 4 | type: new () => T, 5 | message: string 6 | ): void | never { 7 | Assert(variable instanceof type, message); 8 | } 9 | 10 | export function Assert(condition: boolean, message?: string): void | never { 11 | if (!condition) { 12 | if (typeof message !== "undefined") { 13 | console.warn(message); 14 | } 15 | 16 | if (console.trace) { 17 | console.trace(); 18 | } 19 | 20 | throw new Error(""); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/engine/Error.ts: -------------------------------------------------------------------------------- 1 | // TODO: Unify with Compiler. 2 | 3 | export type ErrorHandler = (message: string, type: ErrorType) => void; 4 | 5 | export enum ErrorType { 6 | Author, 7 | Warning, 8 | Error, 9 | } 10 | -------------------------------------------------------------------------------- /src/engine/Glue.ts: -------------------------------------------------------------------------------- 1 | import { InkObject } from "./Object"; 2 | 3 | export class Glue extends InkObject { 4 | public toString() { 5 | return "Glue"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/engine/INamedContent.ts: -------------------------------------------------------------------------------- 1 | export interface INamedContent { 2 | name: string | null; 3 | hasValidName?: boolean; 4 | } 5 | -------------------------------------------------------------------------------- /src/engine/NullException.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * In the original C# code, a SystemException would be thrown when passing 3 | * null to methods expected a valid instance. Javascript has no such 4 | * concept, but TypeScript will not allow `null` to be passed to methods 5 | * explicitely requiring a valid type. 6 | * 7 | * Whenever TypeScript complain about the possibility of a `null` value, 8 | * check the offending value and it it's null, throw this exception using 9 | * `throwNullException(name: string)`. 10 | */ 11 | export class NullException extends Error {} 12 | 13 | /** 14 | * Throw a NullException. 15 | * 16 | * @param name a short description of the offending value (often its name within the code). 17 | */ 18 | export function throwNullException(name: string): never { 19 | throw new NullException(`${name} is null or undefined`); 20 | } 21 | -------------------------------------------------------------------------------- /src/engine/PRNG.ts: -------------------------------------------------------------------------------- 1 | // Taken from https://gist.github.com/blixt/f17b47c62508be59987b 2 | // Ink uses a seedable PRNG of which there is none in native javascript. 3 | export class PRNG { 4 | private seed: number; 5 | 6 | constructor(seed: number) { 7 | this.seed = seed % 2147483647; 8 | if (this.seed <= 0) this.seed += 2147483646; 9 | } 10 | public next(): number { 11 | return (this.seed = (this.seed * 48271) % 2147483647); 12 | } 13 | public nextFloat(): number { 14 | return (this.next() - 1) / 2147483646; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/engine/PushPop.ts: -------------------------------------------------------------------------------- 1 | export enum PushPopType { 2 | Tunnel = 0, 3 | Function = 1, 4 | FunctionEvaluationFromGame = 2, 5 | } 6 | -------------------------------------------------------------------------------- /src/engine/SearchResult.ts: -------------------------------------------------------------------------------- 1 | import { InkObject } from "./Object"; 2 | import { Container } from "./Container"; 3 | 4 | export class SearchResult { 5 | public obj: InkObject | null = null; 6 | public approximate: boolean = false; 7 | 8 | get correctObj() { 9 | return this.approximate ? null : this.obj; 10 | } 11 | 12 | get container() { 13 | return this.obj instanceof Container ? this.obj : null; 14 | } 15 | 16 | public copy() { 17 | let searchResult = new SearchResult(); 18 | searchResult.obj = this.obj; 19 | searchResult.approximate = this.approximate; 20 | 21 | return searchResult; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/engine/StopWatch.ts: -------------------------------------------------------------------------------- 1 | // This is simple replacement of the Stopwatch class from the .NET Framework. 2 | // The original class can count time with much more accuracy than the Javascript version. 3 | // It might be worth considering using `window.performance` in the browser 4 | // or `process.hrtime()` in node. 5 | export class Stopwatch { 6 | private startTime: number | undefined; 7 | 8 | constructor() { 9 | this.startTime = undefined; 10 | } 11 | 12 | get ElapsedMilliseconds(): number { 13 | if (typeof this.startTime === "undefined") { 14 | return 0; 15 | } 16 | return new Date().getTime() - this.startTime; 17 | } 18 | 19 | public Start() { 20 | this.startTime = new Date().getTime(); 21 | } 22 | public Stop() { 23 | this.startTime = undefined; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/engine/StoryException.ts: -------------------------------------------------------------------------------- 1 | export class StoryException extends Error { 2 | public useEndLineNumber: boolean; 3 | public message: string; 4 | public name: string; 5 | 6 | constructor(message: string) { 7 | super(message); 8 | this.useEndLineNumber = false; 9 | this.message = message; 10 | this.name = "StoryException"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/engine/StringBuilder.ts: -------------------------------------------------------------------------------- 1 | export class StringBuilder { 2 | private string: string; 3 | 4 | constructor(str?: string) { 5 | str = typeof str !== "undefined" ? str.toString() : ""; 6 | this.string = str; 7 | } 8 | get Length(): number { 9 | return this.string.length; 10 | } 11 | public Append(str: string | null) { 12 | if (str !== null) { 13 | this.string += str; 14 | } 15 | } 16 | public AppendLine(str?: string) { 17 | if (typeof str !== "undefined") this.Append(str); 18 | this.string += "\n"; 19 | } 20 | public AppendFormat(format: string, ...args: any[]) { 21 | // taken from http://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format 22 | this.string += format.replace(/{(\d+)}/g, (match: string, num: number) => 23 | typeof args[num] != "undefined" ? args[num] : match 24 | ); 25 | } 26 | public toString(): string { 27 | return this.string; 28 | } 29 | 30 | public Clear() { 31 | this.string = ""; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/engine/Tag.ts: -------------------------------------------------------------------------------- 1 | import { InkObject } from "./Object"; 2 | 3 | // New version of tags is dynamic - it constructs the tags 4 | // at runtime based on BeginTag and EndTag control commands. 5 | // Plain text that's in the output stream is turned into tags 6 | // when you do story.currentTags. 7 | // The only place this is used is when flattening tags down 8 | // to string in advance, during dynamic string generation if 9 | // there's a tag embedded in it. See how ControlCommand.EndString 10 | // is implemented in Story.cs for more details + comment 11 | export class Tag extends InkObject { 12 | public readonly text: string; 13 | 14 | constructor(tagText: string) { 15 | super(); 16 | this.text = tagText.toString() || ""; 17 | } 18 | 19 | public toString(): string { 20 | return "# " + this.text; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/engine/VariableAssignment.ts: -------------------------------------------------------------------------------- 1 | import { InkObject } from "./Object"; 2 | 3 | export class VariableAssignment extends InkObject { 4 | public readonly variableName: string | null; 5 | public readonly isNewDeclaration: boolean; 6 | public isGlobal: boolean; 7 | 8 | constructor(variableName: string | null, isNewDeclaration: boolean) { 9 | super(); 10 | this.variableName = variableName || null; 11 | this.isNewDeclaration = !!isNewDeclaration; 12 | this.isGlobal = false; 13 | } 14 | 15 | public toString(): string { 16 | return "VarAssign to " + this.variableName; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/engine/VariableReference.ts: -------------------------------------------------------------------------------- 1 | import { InkObject } from "./Object"; 2 | import { Path } from "./Path"; 3 | 4 | export class VariableReference extends InkObject { 5 | public name: string | null; 6 | public pathForCount: Path | null = null; 7 | 8 | get containerForCount() { 9 | if (this.pathForCount === null) return null; 10 | return this.ResolvePath(this.pathForCount).container; 11 | } 12 | get pathStringForCount() { 13 | if (this.pathForCount === null) return null; 14 | 15 | return this.CompactPathString(this.pathForCount); 16 | } 17 | set pathStringForCount(value: string | null) { 18 | if (value === null) this.pathForCount = null; 19 | else this.pathForCount = new Path(value); 20 | } 21 | 22 | constructor(name: string | null = null) { 23 | super(); 24 | this.name = name; 25 | } 26 | 27 | public toString() { 28 | if (this.name != null) { 29 | return "var(" + this.name + ")"; 30 | } else { 31 | let pathStr = this.pathStringForCount; 32 | return "read_count(" + pathStr + ")"; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/engine/Void.ts: -------------------------------------------------------------------------------- 1 | import { InkObject } from "./Object"; 2 | 3 | export class Void extends InkObject { 4 | public toString() { 5 | return "Void"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/engine/runtime.ts: -------------------------------------------------------------------------------- 1 | export { Story } from "./Story"; 2 | export { StoryState } from "./StoryState"; 3 | export { Choice } from "./Choice"; 4 | export { Tag } from "./Tag"; 5 | export { VariablesState } from "./VariablesState"; 6 | export { InkList } from "./InkList"; 7 | -------------------------------------------------------------------------------- /src/ink.ts: -------------------------------------------------------------------------------- 1 | export { Story, InkList } from "./engine/Story"; 2 | export { Compiler, CompilerOptions } from "./compiler/Compiler"; 3 | export { PosixFileHandler } from "./compiler/FileHandler/PosixFileHandler"; 4 | export { JsonFileHandler } from "./compiler/FileHandler/JsonFileHandler"; 5 | -------------------------------------------------------------------------------- /src/tests/README.MD: -------------------------------------------------------------------------------- 1 | # Working on inkjs tests 2 | 3 | The test suite can be run with the command `npm run test`. If you plan to work on tests, you can run `npm run -- --watch` which will re-run the tests every time a file is changed. You can use it in conjunction with `npm run watch` if you're working on the ink source files at the same time. 4 | 5 | The tests are run against an ink story that is almost like a serie of unit tests. The [inkfiles folder](https://github.com/y-lohse/inkjs/blob/master/tests/inkfiles/) contains the ink story as well as the compiled version. 6 | 7 | Actual test files can be found in the [`tests/specs` folder](https://github.com/y-lohse/inkjs/blob/master/tests/specs/) and they are written using [jest](https://jestjs.io/). You can generate a coverage report by running `npm run -- --coverage`, and you can forward other jest options in the same way. 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/bindings/external_binding.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev","str","^hello world","/str",{"x()":"message","exArgs":1},"pop","/ev","\n","ev",5.0,3,{"x()":"multiply","exArgs":2},"out","/ev","\n","ev",3,"str","^knock ","/str",{"x()":"times","exArgs":2},"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/bindings/game_ink_back_and_forth.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["done",{"#n":"g-0"}],null],"done",{"topExternal":[{"temp=":"x"},"^In top external","\n","ev",{"VAR?":"x"},{"x()":"gameInc","exArgs":1},"/ev","~ret","\n",null],"inkInc":[{"temp=":"x"},"ev",{"VAR?":"x"},1,"+","/ev","~ret",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/bindings/lookup_safe_or_not.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^One","\n","ev",{"x()":"myAction"},"pop","/ev","\n","^Two","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/bindings/lookup_safe_or_not_with_post_glue.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^One","\n","ev",{"x()":"myAction"},"pop","/ev","\n","<>","^ Two","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/bindings/variable_observer.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^Hello world!","\n","ev",15,"/ev",{"VAR=":"testVar","re":true},"ev",100,"/ev",{"VAR=":"testVar2","re":true},"^Hello world 2!","\n",["ev",{"^->":"0.12.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":"0.c-0","flg":18},{"s":["^choice",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":"0.12.s"},[{"#n":"$r2"}],"\n","ev",25,"/ev",{"VAR=":"testVar","re":true},"ev",200,"/ev",{"VAR=":"testVar2","re":true},"end",{"->":"0.g-0"},{"#f":5}],"g-0":["done",null]}],"done",{"global decl":["ev",5,{"VAR=":"testVar"},10,{"VAR=":"testVar2"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/booleans/false_plus_false.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",false,false,"+","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/booleans/list_hasnt.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"list"},{"list":{"list.c":3}},"!?","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev",{"list":{"list.b":2,"list.d":4}},{"VAR=":"list"},"/ev","end",null]}],"listDefs":{"list":{"a":1,"b":2,"c":3,"d":4,"e":5}}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/booleans/not_one.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",false,"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/booleans/not_true.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",false,"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/booleans/three_greater_than_one.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",3,1,">","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/booleans/true.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",true,"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/booleans/true_equals_one.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",true,1,"==","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/booleans/true_plus_one.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",true,1,"+","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/booleans/true_plus_true.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",true,true,"+","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/booleans/two_plus_true.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",2,true,"+","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/builtins/floor_ceiling_and_casts.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",1.2,"FLOOR","out","/ev","\n","ev",1.2,"INT","out","/ev","\n","ev",1.2,"CEILING","out","/ev","\n","ev",1.2,"CEILING",3,"/","out","/ev","\n","ev",1.2,"CEILING","INT",3,"/","out","/ev","\n","ev",1,"FLOOR","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/builtins/read_count_across_callstack.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"first"},["done",{"#n":"g-0"}],null],"done",{"first":["^1) Seen first ","ev",{"CNT?":".^"},"out","/ev","^ times.","\n",{"->t->":"second"},"^2) Seen first ","ev",{"CNT?":".^"},"out","/ev","^ times.","\n","done",{"#f":1}],"second":["^In second.","\n","ev","void","/ev","->->",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/builtins/read_count_across_threads.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"top"},["done",{"#n":"g-0"}],null],"done",{"top":["ev",{"CNT?":".^"},"out","/ev","\n","thread",{"->":"aside"},"ev",{"CNT?":".^"},"out","/ev","\n","done",{"#f":1}],"aside":[[["ev",{"^->":"aside.0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str",false,"/ev",{"*":".^.^.c-0","flg":19},{"s":["^DONE",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"aside.0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.g-0"},{"#f":5}],"g-0":["done",null]}],null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/builtins/read_count_dot_separated_path.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->t->":"hi"},{"->t->":"hi"},{"->t->":"hi"},"ev",{"CNT?":"hi.stitch_to_count"},"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"hi":[{"->":"hi.stitch_to_count"},{"stitch_to_count":["^hi","\n","ev","void","/ev","->->",{"#f":1}]}]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/builtins/read_count_variable_target.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^Count start: ","ev",{"VAR?":"x"},"readc","out","/ev","^ ","ev",{"^->":"knot"},"readc","out","/ev","^ ","ev",{"CNT?":"knot"},"out","/ev","\n","ev",1,"/ev",{"->t->":"x","var":true},"ev",2,"/ev",{"->t->":"x","var":true},"ev",3,"/ev",{"->t->":"x","var":true},"^Count end: ","ev",{"VAR?":"x"},"readc","out","/ev","^ ","ev",{"^->":"knot"},"readc","out","/ev","^ ","ev",{"CNT?":"knot"},"out","/ev","\n","end",["done",{"#f":5,"#n":"g-0"}],null],"done",{"knot":[{"temp=":"a"},"ev",{"VAR?":"a"},"out","/ev","\n","ev","void","/ev","->->",{"#f":3}],"global decl":["ev",{"^->":"knot"},{"VAR=":"x"},"/ev","end",null],"#f":1}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/builtins/turns.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"0.top.c-0"},["ev","str","^choice","/str","/ev",{"*":".^.c-0","flg":4},{"c-0":["\n","ev","turn","out","/ev","\n",{"->":".^.^"},{"->":"0.g-0"},null],"#n":"top"}],{"g-0":["done",null]}],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/builtins/turns_since.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"^->":"test"},"turns","out","/ev","\n","ev",{"f()":"test"},"pop","/ev","\n","ev",{"^->":"test"},"turns","out","/ev","\n","ev","str","^choice 1","/str","/ev",{"*":"0.c-0","flg":20},{"c-0":["\n",{"->":"0.g-0"},{"#f":5}],"g-0":["ev",{"^->":"test"},"turns","out","/ev","\n","ev","str","^choice 2","/str","/ev",{"*":".^.c-1","flg":20},{"c-1":["\n",{"->":"0.g-1"},{"#f":5}]}],"g-1":["ev",{"^->":"test"},"turns","out","/ev","\n",["done",{"#n":"g-2"}],null]}],"done",{"test":["ev","void","/ev","~ret",{"#f":2}]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/builtins/turns_since_nested.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"empty_world"},["done",{"#n":"g-0"}],null],"done",{"empty_world":[["ev",{"^->":"empty_world.0.c-0"},"turns","out","/ev","^ = -1","\n",["ev",{"^->":"empty_world.0.7.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^stuff",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"empty_world.0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.7.s"},[{"#n":"$r2"}],"\n","ev",{"^->":"empty_world.0.c-0"},"turns","out","/ev","^ = 0","\n",[["ev",{"^->":"empty_world.0.c-0.14.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^more stuff",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"empty_world.0.c-0.14.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],"\n","ev",{"^->":"empty_world.0.c-0"},"turns","out","/ev","^ = 1","\n","done",{"#f":5}]}],{"#f":7}]}],null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/builtins/turns_since_with_variable_target.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"start"},["done",{"#f":5,"#n":"g-0"}],null],"done",{"start":[["ev",{"^->":"start"},{"f()":"beats"},"out","/ev","\n","ev",{"^->":"start"},{"f()":"beats"},"out","/ev","\n","ev","str","^Choice","/str","/ev",{"*":".^.c-0","flg":20},{"c-0":["^ ",{"->":"start.next"},"\n",{"#f":5}]}],{"next":["ev",{"^->":"start"},{"f()":"beats"},"out","/ev","\n","end",{"#f":1}],"#f":3}],"beats":[{"temp=":"x"},"ev",{"VAR?":"x"},"turns","/ev","~ret","\n",{"#f":1}],"#f":1}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/builtins/visit_count_bug_due_to_nested_containers.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["ev",{"CNT?":".^"},"out","/ev","\n",["ev",{"^->":"0.gather.5.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^choice",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.gather.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.5.s"},[{"#n":"$r2"}],"\n",{"->":"0.g-0"},{"#f":5}],"#f":5,"#n":"gather"}],{"g-0":["ev",{"CNT?":"0.gather"},"out","/ev","\n",["done",{"#n":"g-1"}],null]}],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/builtins/visit_counts_when_choosing.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["done",{"#f":5,"#n":"g-0"}],null],"done",{"TestKnot":[["^this is a test","\n","ev","str","^Next","/str","/ev",{"*":".^.c-0","flg":4},{"c-0":["^ ",{"->":"TestKnot2"},"\n",{"#f":5}]}],{"#f":1}],"TestKnot2":["^this is the end","\n","end",{"#f":1}],"#f":1}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/callstack/call_stack_evaluation.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"f()":"six"},{"f()":"two"},"+","out","/ev","\n","end",["done",{"#n":"g-0"}],null],"done",{"six":["ev",{"f()":"four"},{"f()":"two"},"+","/ev","~ret","\n",null],"four":["ev",{"f()":"two"},{"f()":"two"},"+","/ev","~ret","\n",null],"two":["ev",2,"/ev","~ret",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/callstack/callstack_evaluation.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"f()":"six"},{"f()":"two"},"+","out","/ev","\n","end",["done",{"#n":"g-0"}],null],"done",{"six":["ev",{"f()":"four"},{"f()":"two"},"+","/ev","~ret","\n",null],"four":["ev",{"f()":"two"},{"f()":"two"},"+","/ev","~ret","\n",null],"two":["ev",2,"/ev","~ret",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/callstack/clean_callstack_reset_on_path_choice.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"f()":"RunAThing"},"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"RunAThing":["^The first line.","\n","^The second line.","\n",null],"SomewhereElse":["ev","str","^somewhere else","/str","out","/ev","\n","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/blank_choice.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"*":"0.c-0","flg":16},{"c-0":["^ blank","\n",{"->":"0.g-0"},{"#f":5}],"g-0":["done",null]}],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/choice_count.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["thread",{"->":"choices"},"ev","choiceCnt","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"end":["end",null],"choices":[[["ev",{"^->":"choices.0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^one ",{"->":"$r","var":true},null]}],["ev",{"^->":"choices.0.1.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-1","flg":18},{"s":["^two ",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"choices.0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],{"->":"end"},"\n",{"#f":5}],"c-1":["ev",{"^->":"choices.0.c-1.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.1.s"},[{"#n":"$r2"}],{"->":"end"},"\n",{"#f":5}]}],null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/choice_diverts_to_done.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["ev",{"^->":"0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":"0.c-0","flg":18},{"s":["^choice ",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":"0.0.s"},[{"#n":"$r2"}],"done","\n",{"->":"0.g-0"},{"#f":5}],"g-0":["done",null]}],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/choice_thread_forking.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",1,"/ev",{"->t->":"generate_choice"},["done",{"#n":"g-0"}],null],"done",{"generate_choice":[{"temp=":"x"},"ev",true,"/ev",[{"->":".^.b","c":true},{"b":["\n",["ev",{"^->":"generate_choice.4.b.1.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":2},{"s":["^A choice",{"->":"$r","var":true},null]}],{"->":".^.^.^.5"},{"c-0":["ev",{"^->":"generate_choice.4.b.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.1.s"},[{"#n":"$r2"}],"\n","^Vaue of local var is: ","ev",{"VAR?":"x"},"out","/ev","\n","end",null]}]}],"nop","\n","ev","void","/ev","->->",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/choice_with_brackets_only.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev","str","^Option","/str","/ev",{"*":"0.c-0","flg":20},{"c-0":["\n","^Text","\n",{"->":"0.g-0"},{"#f":5}],"g-0":["done",null]}],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/default_choices.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["ev","str","^Choice 1","/str","/ev",{"*":".^.c-0","flg":20},"ev","str","^Choice 2","/str","/ev",{"*":".^.c-1","flg":20},["ev",{"^->":"0.start.12.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str",false,"/ev",{"*":".^.^.c-2","flg":19},{"s":["^Impossible choice",{"->":"$r","var":true},null]}],{"*":".^.c-3","flg":24},{"c-0":["\n",{"->":"0.g-0"},{"#f":5}],"c-1":["\n",{"->":"0.g-0"},{"#f":5}],"c-2":["ev",{"^->":"0.start.c-2.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.12.s"},[{"#n":"$r2"}],"\n",{"->":"0.g-0"},{"#f":5}],"c-3":[{"->":"default"},"\n",{"->":"0.g-0"},{"#f":5}],"#n":"start"}],{"g-0":["^After choice","\n",{"->":"0.start"},["done",{"#n":"g-1"}],null]}],"done",{"default":["^This is default.","\n","done",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/default_simple_gather.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"*":"0.c-0","flg":24},{"c-0":["\n",{"->":"0.g-0"},{"#f":5}],"g-0":["^x","\n","done",["done",{"#n":"g-1"}],null]}],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/empty_choice.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"*":"0.c-0","flg":24},{"c-0":["\n",{"->":"0.g-0"},{"#f":5}],"g-0":["done",null]}],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/fallback_choice_on_thread.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["thread",{"->":"knot"},["done",{"#n":"g-0"}],null],"done",{"knot":[["ev",1,"/ev",{"temp=":"x"},{"*":".^.c-0","flg":24},{"c-0":["\n","^Should be 1 not 0: ","ev",{"VAR?":"x"},"out","/ev","^.","\n","done",{"#f":5}]}],null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/gather_choice_same_line.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[[["ev",{"^->":"0.g-0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^hello",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.g-0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],"\n",{"->":"0.g-1"},{"#f":5}],"#n":"g-0"}],{"g-1":[["ev",{"^->":"0.g-1.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-1","flg":18},{"s":["^world",{"->":"$r","var":true},null]}],{"c-1":["ev",{"^->":"0.g-1.c-1.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],"\n",{"->":"0.g-2"},{"#f":5}]}],"g-2":["done",null]}],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/has_read_on_choice.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["ev",{"^->":"0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str",{"CNT?":"test"},"!","/ev",{"*":"0.c-0","flg":19},{"s":["^visible choice",{"->":"$r","var":true},null]}],["ev",{"^->":"0.1.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str",{"CNT?":"test"},"/ev",{"*":"0.c-1","flg":19},{"s":["^visible choice",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":"0.0.s"},[{"#n":"$r2"}],"\n",{"->":"0.g-0"},{"#f":5}],"c-1":["ev",{"^->":"0.c-1.$r2"},"/ev",{"temp=":"$r"},{"->":"0.1.s"},[{"#n":"$r2"}],"\n",{"->":"0.g-0"},{"#f":5}],"g-0":["done",null]}],"done",{"test":["end",{"#f":1}]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/logic_in_choices.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["ev",{"^->":"0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","str","^, your name is ","ev",{"f()":"name"},"out","/ev","^.'","/str","/ev",{"*":"0.c-0","flg":22},{"s":["^'Hello ","ev",{"f()":"name"},"out","/ev",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":"0.0.s"},[{"#n":"$r2"}],"^,' I said, knowing full well that his name was ","ev",{"f()":"name"},"out","/ev","^.","\n","done",{"->":"0.g-0"},{"#f":5}],"g-0":["done",null]}],"done",{"name":["^Joe","\n",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/nested_choice.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"main"},["done",{"#n":"g-0"}],null],"done",{"main":[["^Should you cross the river?","\n","ev","str","^Yes","/str","/ev",{"*":".^.c-0","flg":20},"ev","str","^No","/str","/ev",{"*":".^.c-1","flg":20},{"c-0":["\n",{"->":".^.^.g-0"},{"#f":5}],"c-1":["\n",["ev","str","^Fight back","/str","/ev",{"*":".^.c-0","flg":20},"ev","str","^Flee","/str","/ev",{"*":".^.c-1","flg":20},{"c-0":["\n",{"->":"main.0.g-0"},{"#f":5}],"c-1":["\n",{"->":"main.0.g-0"},{"#f":5}]}],{"#f":5}],"g-0":["end",null]}],null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/non_text_in_choice_inner_content.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"knot"},["done",{"#n":"g-0"}],null],"done",{"knot":[[["ev",{"^->":"knot.0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^option text",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"knot.0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],"^. ","ev",true,"/ev",[{"->":".^.b","c":true},{"b":["^ Conditional bit.",{"->":".^.^.^.11"},null]}],"nop","^ ",{"->":"next"},"\n","done",{"#f":5}]}],null],"next":["^Next.","\n","done",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/once_only_choices_can_link_back_to_self.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"opts"},["done",{"#n":"g-0"}],null],"done",{"opts":[["ev","str","^First choice","/str","/ev",{"*":".^.c-0","flg":20},"ev","str","^Second choice","/str",{"CNT?":".^.c-0"},"/ev",{"*":".^.c-1","flg":21},{"*":".^.c-2","flg":24},{"c-0":["^ ",{"->":"opts"},"\n",{"->":".^.^.end"},{"#f":5}],"c-1":["^ ",{"->":"opts"},"\n",{"->":".^.^.end"},{"#f":5}],"c-2":[{"->":".^.^.end"},"\n",{"->":".^.^.end"},{"#f":5}],"end":["end",null]}],null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/should_not_gather_due_to_choice.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["ev",{"^->":"0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":"0.c-0","flg":18},{"s":["^opt",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":"0.0.s"},[{"#n":"$r2"}],"\n",[["^text","\n",["ev",{"^->":"0.c-0.7.g-0.2.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str",false,"/ev",{"*":".^.^.c-0","flg":19},{"s":["^impossible",{"->":"$r","var":true},null]}],{"*":".^.c-1","flg":24},{"c-0":["ev",{"^->":"0.c-0.7.g-0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.2.s"},[{"#n":"$r2"}],"\n",{"->":"0.g-0"},{"#f":5}],"c-1":["end","\n",{"->":"0.g-0"},{"#f":5}],"#n":"g-0"}],null],{"#f":5}],"g-0":["^gather","\n",["done",{"#n":"g-1"}],null]}],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/state_rollback_over_default_choice.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["thread",{"->":"make_default_choice"},"^Text.","\n",["done",{"#n":"g-0"}],null],"done",{"make_default_choice":[[{"*":".^.c-0","flg":24},{"c-0":["\n","ev",5,"out","/ev","\n","end",{"#f":5}]}],null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/sticky_choices_stay_sticky.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"test"},["done",{"#n":"g-0"}],null],"done",{"test":[["^First line.","\n","^Second line.","\n",["ev",{"^->":"test.0.4.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":2},{"s":["^Choice 1",{"->":"$r","var":true},null]}],["ev",{"^->":"test.0.5.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-1","flg":2},{"s":["^Choice 2",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"test.0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.4.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.g-0"},null],"c-1":["ev",{"^->":"test.0.c-1.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.5.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.g-0"},null],"g-0":[{"->":"test"},null]}],null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/tags_in_choice.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":21,"root":[[["ev",{"^->":"0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","str","^two ","#","^two","/#","/str","/ev",{"*":"0.c-0","flg":6},{"s":["^one ","#","^one ","/#",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":"0.0.s"},[{"#n":"$r2"}],"^ three ","#","^three ","/#","end","\n",{"->":"0.g-0"},{"#f":5}],"g-0":["done",{"#f":5}]}],"done",{"#f":1}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/various_blank_choice_warning.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"*":"0.c-0","flg":16},{"c-0":["^ blank","\n",{"->":"0.g-0"},{"#f":5}],"g-0":["done",null]}],"done",null],"listDefs":{}} 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/choices/various_default_choices.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"*":"0.c-0","flg":24},{"c-0":[{"->":"0.hello"},"\n","^Unreachable","\n",{"->":"0.hello"},{"#f":5}],"hello":["^1","\n",{"*":".^.c-1","flg":24},{"c-1":["\n",[["^2","\n",{"->":"0.g-0"},{"#n":"g-0"}],null],{"#f":5}]}],"g-0":["^3","\n","end",["done",{"#n":"g-1"}],null]}],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/conditions/all_switch_branches_fail_is_clean.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",1,"/ev",["du","ev",2,"==","/ev",{"->":".^.b","c":true},{"b":["pop","\n","^x","\n",{"->":"0.6"},null]}],["du","ev",3,"==","/ev",{"->":".^.b","c":true},{"b":["pop","\n","^y","\n",{"->":"0.6"},null]}],"pop","nop","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/conditions/conditionals.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",false,"/ev",[{"->":".^.b","c":true},{"b":["^not true",{"->":"0.5"},null]}],[{"->":".^.b"},{"b":["^true",{"->":"0.5"},null]}],"nop","\n",["ev",4,5,">","/ev",{"->":".^.b","c":true},{"b":["\n","^not true","\n",{"->":"0.9"},null]}],["ev",5,4,">","/ev",{"->":".^.b","c":true},{"b":["\n","^true","\n",{"->":"0.9"},null]}],"nop","\n","ev",2,2,"*",3,">","/ev",[{"->":".^.b","c":true},{"b":["\n","^true","\n",{"->":"0.20"},null]}],[{"->":".^.b"},{"b":["\n","^not true","\n",{"->":"0.20"},null]}],"nop","\n",["ev",1,3,">","/ev",{"->":".^.b","c":true},{"b":["\n","^not true","\n",{"->":"0.24"},null]}],[{"->":".^.b"},{"b":["\n","ev",2,2,"+",4,"==","/ev",[{"->":".^.b","c":true},{"b":["\n","^true","\n",{"->":"0.23.b.10"},null]}],[{"->":".^.b"},{"b":["\n","^not true","\n",{"->":"0.23.b.10"},null]}],"nop","\n",{"->":"0.24"},null]}],"nop","\n","ev",2,3,"*","/ev",["du","ev",1,7,"+","==","/ev",{"->":".^.b","c":true},{"b":["pop","\n","^not true","\n",{"->":"0.36"},null]}],["du","ev",9,"==","/ev",{"->":".^.b","c":true},{"b":["pop","\n","^not true","\n",{"->":"0.36"},null]}],["du","ev",1,1,"+",1,"+",3,"+","==","/ev",{"->":".^.b","c":true},{"b":["pop","\n","^true","\n",{"->":"0.36"},null]}],["du","ev",9,3,"-","==","/ev",{"->":".^.b","c":true},{"b":["pop","\n","^also true but not printed","\n",{"->":"0.36"},null]}],"pop","nop","\n","ev",true,"/ev",[{"->":".^.b","c":true},{"b":["\n","^great","\n","^right?","\n",{"->":"0.42"},null]}],"nop","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/conditions/else_branches.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["ev",{"VAR?":"x"},1,"==","/ev",{"->":".^.b","c":true},{"b":["\n","^one","\n",{"->":"0.3"},null]}],["ev",{"VAR?":"x"},2,"==","/ev",{"->":".^.b","c":true},{"b":["\n","^two","\n",{"->":"0.3"},null]}],[{"->":".^.b"},{"b":["\n","^other","\n",{"->":"0.3"},null]}],"nop","\n",["ev",{"VAR?":"x"},1,"==","/ev",{"->":".^.b","c":true},{"b":["\n","^one","\n",{"->":"0.8"},null]}],["ev",{"VAR?":"x"},2,"==","/ev",{"->":".^.b","c":true},{"b":["\n","^two","\n",{"->":"0.8"},null]}],[{"->":".^.b"},{"b":["\n","^other","\n",{"->":"0.8"},null]}],"nop","\n","ev",{"VAR?":"x"},4,"==","/ev",[{"->":".^.b","c":true},{"b":["\n","^The main clause","\n",{"->":"0.17"},null]}],[{"->":".^.b"},{"b":["\n","^other","\n",{"->":"0.17"},null]}],"nop","\n","ev",{"VAR?":"x"},4,"==","/ev",[{"->":".^.b","c":true},{"b":["\n","^The main clause","\n",{"->":"0.26"},null]}],[{"->":".^.b"},{"b":["\n","^other","\n",{"->":"0.26"},null]}],"nop","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev",3,{"VAR=":"x"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/conditions/empty_multiline_conditional_branch.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",3,"/ev",["du","ev",3,"==","/ev",{"->":".^.b","c":true},{"b":["pop","\n",{"->":"0.6"},null]}],["du","ev",4,"==","/ev",{"->":".^.b","c":true},{"b":["pop","\n","^txt","\n",{"->":"0.6"},null]}],"pop","nop","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/conditions/trivial_condition.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["ev",false,"/ev",{"->":".^.b","c":true},{"b":["\n","^beep","\n",{"->":"0.1"},null]}],"nop","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/diverts/basic_tunnel.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->t->":"f"},"<>","^ world","\n",["done",{"#n":"g-0"}],null],"done",{"f":["^Hello","\n","ev","void","/ev","->->",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/diverts/compare_divert_targets.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"to_one"},{"VAR?":"to_two"},"==","/ev",[{"->":".^.b","c":true},{"b":["^same knot",{"->":"0.7"},null]}],[{"->":".^.b"},{"b":["^different knot",{"->":"0.7"},null]}],"nop","\n","ev",{"VAR?":"to_one"},{"VAR?":"to_one"},"==","/ev",[{"->":".^.b","c":true},{"b":["^same knot",{"->":"0.16"},null]}],[{"->":".^.b"},{"b":["^different knot",{"->":"0.16"},null]}],"nop","\n","ev",{"VAR?":"to_two"},{"VAR?":"to_two"},"==","/ev",[{"->":".^.b","c":true},{"b":["^same knot",{"->":"0.25"},null]}],[{"->":".^.b"},{"b":["^different knot",{"->":"0.25"},null]}],"nop","\n","ev",{"^->":"one"},{"^->":"two"},"==","/ev",[{"->":".^.b","c":true},{"b":["^same knot",{"->":"0.34"},null]}],[{"->":".^.b"},{"b":["^different knot",{"->":"0.34"},null]}],"nop","\n","ev",{"^->":"one"},{"VAR?":"to_one"},"==","/ev",[{"->":".^.b","c":true},{"b":["^same knot",{"->":"0.43"},null]}],[{"->":".^.b"},{"b":["^different knot",{"->":"0.43"},null]}],"nop","\n","ev",{"VAR?":"to_one"},{"^->":"one"},"==","/ev",[{"->":".^.b","c":true},{"b":["^same knot",{"->":"0.52"},null]}],[{"->":".^.b"},{"b":["^different knot",{"->":"0.52"},null]}],"nop","\n",["done",{"#n":"g-0"}],null],"done",{"one":["^One","\n","done",{"#f":3}],"two":["^Two","\n","done",{"#f":3}],"global decl":["ev",{"^->":"one"},{"VAR=":"to_one"},{"^->":"two"},{"VAR=":"to_two"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/diverts/compiler/divert_to_weave_points.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"knot.stitch.0.gather"},["done",{"#n":"g-0"}],null],"done",{"knot":[{"->":".^.stitch"},{"stitch":[[["^hello","\n",["ev",{"^->":"knot.stitch.0.g-0.2.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^test",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"knot.stitch.0.g-0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.2.s"},[{"#n":"$r2"}],"\n","^choice content","\n",{"->":".^.^.^.gather"},{"#f":5}],"#n":"g-0"}],{"gather":["^gather","\n",["ev","visit",1,"MIN","/ev","ev","du",0,"==","/ev",{"->":".^.s0","c":true},"ev","du",1,"==","/ev",{"->":".^.s1","c":true},"nop",{"s0":["pop","\n",{"->":".^.^.^.^.g-0.c-0"},{"->":".^.^.17"},null],"s1":["pop","\n","^second time round","\n",{"->":".^.^.17"},null],"#f":5}],"\n","end",null]}],null]}]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/diverts/complex_tunnels.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",1,"/ev",{"->t->":"one"},"ev",2,"/ev",{"->t->":"two"},"^three (3)","\n",["done",{"#n":"g-0"}],null],"done",{"one":[{"temp=":"num"},"^one (","ev",{"VAR?":"num"},"out","/ev","^)","\n","ev",1.5,"/ev",{"->t->":"oneAndAHalf"},"ev","void","/ev","->->",null],"oneAndAHalf":[{"temp=":"num"},"^one and a half (","ev",{"VAR?":"num"},"out","/ev","^)","\n","ev","void","/ev","->->",null],"two":[{"temp=":"num"},"^two (","ev",{"VAR?":"num"},"out","/ev","^)","\n","ev","void","/ev","->->",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/diverts/divert_in_conditional.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["done",{"#n":"g-0"}],null],"done",{"intro":[{"->":".^.top"},{"top":["ev",{"CNT?":".^.^.main"},"/ev",[{"->":".^.b","c":true},{"b":["^ ",{"->":"intro.done"},{"->":".^.^.^.4"},null]}],"nop","\n","end",null],"main":[{"->":".^.^.top"},{"#f":1}],"done":["end",null]}]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/diverts/divert_targets_with_parameters.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",5,"/ev",{"->":"x","var":true},["done",{"#n":"g-0"}],null],"done",{"place":[{"temp=":"a"},"ev",{"VAR?":"a"},"out","/ev","\n","done",{"#f":3}],"global decl":["ev",{"^->":"place"},{"VAR=":"x"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/diverts/divert_to_weave_points.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"knot.stitch.0.gather"},["done",{"#n":"g-0"}],null],"done",{"knot":[{"->":".^.stitch"},{"stitch":[[["^hello","\n",["ev",{"^->":"knot.stitch.0.g-0.2.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^test",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"knot.stitch.0.g-0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.2.s"},[{"#n":"$r2"}],"\n","^choice content","\n",{"->":".^.^.^.gather"},{"#f":5}],"#n":"g-0"}],{"gather":["^gather","\n",["ev","visit",1,"MIN","/ev","ev","du",0,"==","/ev",{"->":".^.s0","c":true},"ev","du",1,"==","/ev",{"->":".^.s1","c":true},"nop",{"s0":["pop","\n",{"->":".^.^.^.^.g-0.c-0"},{"->":".^.^.17"},null],"s1":["pop","\n","^second time round","\n",{"->":".^.^.17"},null],"#f":5}],"\n","end",null]}],null]}]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/diverts/done_stops_thread.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["done","^This content is inaccessible.","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/diverts/path_to_self.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[[{"->t->":"tunnel"},{"->":".^"},["done",{"#n":"g-0"}],{"#n":"dododo"}],null],"done",{"tunnel":[[["ev",{"^->":"tunnel.0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":2},{"s":["^A",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"tunnel.0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],"\n","ev","void","/ev","->->",null]}],null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/diverts/same_line_divert_is_inline.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"hurry_home"},["done",{"#n":"g-0"}],null],"done",{"hurry_home":["^We hurried home to Savile Row ",{"->":"as_fast_as_we_could"},"\n",null],"as_fast_as_we_could":["^as fast as we could.","\n","done",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/diverts/tunnel_onwards_after_tunnel.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->t->":"tunnel1"},"^The End.","\n","end",["done",{"#n":"g-0"}],null],"done",{"tunnel1":["^Hello...","\n",{"->t->":"tunnel2"},"ev","void","/ev","->->",null],"tunnel2":["^...world.","\n","ev","void","/ev","->->",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/diverts/tunnel_onwards_divert_after_with_arg.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->t->":"a"},["done",{"#n":"g-0"}],null],"done",{"a":["ev",5,3,"+",{"^->":"b"},"/ev","->->",null],"b":[{"temp=":"x"},"ev",{"VAR?":"x"},"out","/ev","\n","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/diverts/tunnel_onwards_divert_override.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->t->":"A"},"^We will never return to here!","\n",["done",{"#n":"g-0"}],null],"done",{"A":["^This is A","\n","ev",{"^->":"B"},"/ev","->->",null],"B":["^Now in B.","\n","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/diverts/tunnel_onwards_to_variable_divert_target.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":21,"root":[[{"->t->":"outer"},["done",{"#f":5,"#n":"g-0"}],null],"done",{"outer":["^This is outer","\n","ev",{"^->":"the_esc"},"/ev",{"->":"cut_to"},{"#f":1}],"cut_to":[{"temp=":"escape"},"ev",{"VAR?":"escape"},"/ev","->->",{"#f":1}],"the_esc":["^This is the_esc","\n","end",{"#f":3}],"#f":1}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/diverts/tunnel_onwards_with_param_default_choice.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->t->":"tunnel"},["done",{"#n":"g-0"}],null],"done",{"tunnel":[[{"*":".^.c-0","flg":24},{"c-0":["ev",8,{"^->":"elsewhere"},"/ev","->->","\n",{"#f":5}]}],null],"elsewhere":[{"temp=":"x"},"ev",{"VAR?":"x"},"out","/ev","\n","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/evaluation/arithmetic.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":21,"root":[["ev",2,3,"*",5,6,"*","+","out","/ev","\n","ev",8,3,"%","out","/ev","\n","ev",13,5,"%","out","/ev","\n","ev",7,3,"/","out","/ev","\n","ev",7,3.0,"/","out","/ev","\n","ev",10,2,"-","out","/ev","\n","ev",2,5,1,"-","*","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/evaluation/basic_string_literals.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"x"},"out","/ev","\n","^Hello ","ev","str","^world","/str","out","/ev","^ 2.","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev","str","^Hello world 1","/str",{"VAR=":"x"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/evaluation/evaluating_function_variable_state_bug.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^Start","\n",{"->t->":"tunnel"},"^End","\n","end",["done",{"#n":"g-0"}],null],"done",{"tunnel":["^In tunnel.","\n","ev","void","/ev","->->",null],"function_to_evaluate":["ev",1,{"f()":"zero_equals_"},"/ev",[{"->":".^.b","c":true},{"b":["\n","ev","str","^WRONG","/str","/ev","~ret",{"->":".^.^.^.6"},null]}],[{"->":".^.b"},{"b":["\n","ev","str","^RIGHT","/str","/ev","~ret",{"->":".^.^.^.6"},null]}],"nop","\n",null],"zero_equals_":[{"temp=":"k"},"ev",0,{"f()":"do_nothing"},"pop","/ev","\n","ev",0,{"VAR?":"k"},"==","/ev","~ret",null],"do_nothing":[{"temp=":"k"},"ev",0,"/ev","~ret",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/evaluation/evaluating_ink_functions_from_game.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^Top level content","\n",["ev",{"^->":"0.2.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":"0.c-0","flg":18},{"s":["^choice",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":"0.2.s"},[{"#n":"$r2"}],"\n",{"->":"0.g-0"},{"#f":5}],"g-0":["done",null]}],"done",{"somewhere":[{"->":".^.here"},{"here":["done",{"#f":3}]}],"test":["ev",{"^->":"somewhere.here"},"/ev","~ret",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/evaluation/evaluating_ink_functions_from_game_2.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^One","\n","^Two","\n","^Three","\n",["done",{"#n":"g-0"}],null],"done",{"func1":["^This is a function","\n","ev",5,"/ev","~ret",null],"func2":["^This is a function without a return value","\n","ev","void","/ev","~ret",null],"add":[{"temp=":"y"},{"temp=":"x"},"^x = ","ev",{"VAR?":"x"},"out","/ev","^, y = ","ev",{"VAR?":"y"},"out","/ev","\n","ev",{"VAR?":"x"},{"VAR?":"y"},"+","/ev","~ret",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/evaluation/evaluation_stack_leaks.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",false,"/ev",[{"->":".^.b","c":true},{"b":["\n",{"->":"0.5"},null]}],[{"->":".^.b"},{"b":["\n","^else","\n",{"->":"0.5"},null]}],"nop","\n","ev",6,"/ev",["du","ev",5,"==","/ev",{"->":".^.b","c":true},{"b":["pop","\n","^five","\n",{"->":"0.12"},null]}],[{"->":".^.b"},{"b":["pop","\n","^else","\n",{"->":"0.12"},null]}],"nop","\n",{"->t->":"onceTest"},{"->t->":"onceTest"},["done",{"#n":"g-0"}],null],"done",{"onceTest":[["ev","visit",1,"MIN","/ev","ev","du",0,"==","/ev",{"->":".^.s0","c":true},"ev","du",1,"==","/ev",{"->":".^.s1","c":true},"nop",{"s0":["pop","\n","^hi","\n",{"->":".^.^.17"},null],"s1":["pop",{"->":".^.^.17"},null],"#f":5}],"\n","ev","void","/ev","->->",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/evaluation/factorial_by_reference.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"^var":"result","ci":-1},5,{"f()":"factorialByRef"},"pop","/ev","\n","ev",{"VAR?":"result"},"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"factorialByRef":[{"temp=":"n"},{"temp=":"r"},"ev",{"VAR?":"r"},0,"==","/ev",[{"->":".^.b","c":true},{"b":["\n","ev",1,"/ev",{"temp=":"r","re":true},{"->":".^.^.^.8"},null]}],"nop","\n","ev",{"VAR?":"n"},1,">","/ev",[{"->":".^.b","c":true},{"b":["\n","ev",{"VAR?":"r"},{"VAR?":"n"},"*","/ev",{"temp=":"r","re":true},"ev",{"^var":"r","ci":-1},{"VAR?":"n"},1,"-",{"f()":".^.^.^"},"pop","/ev","\n",{"->":".^.^.^.16"},null]}],"nop","\n","ev","void","/ev","~ret",null],"global decl":["ev",0,{"VAR=":"result"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/evaluation/factorial_recursive.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",5,{"f()":"factorial"},"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"factorial":[{"temp=":"n"},"ev",{"VAR?":"n"},1,"==","/ev",[{"->":".^.b","c":true},{"b":["\n","ev",1,"/ev","~ret",{"->":".^.^.^.8"},null]}],[{"->":".^.b"},{"b":["\n","ev",{"VAR?":"n"},{"VAR?":"n"},1,"-",{"f()":".^.^.^"},"*","/ev","~ret","\n",{"->":".^.^.^.8"},null]}],"nop","\n",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/evaluation/increment.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"x"},1,"+",{"VAR=":"x","re":true},"/ev","ev",{"VAR?":"x"},"out","/ev","\n","ev",{"VAR?":"x"},1,"-",{"VAR=":"x","re":true},"/ev","ev",{"VAR?":"x"},"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev",5,{"VAR=":"x"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/evaluation/literal_unary.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"negativeLiteral"},"out","/ev","\n","ev",{"VAR?":"negativeLiteral2"},"out","/ev","\n","ev",{"VAR?":"negativeLiteral3"},"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev",-1,{"VAR=":"negativeLiteral"},false,{"VAR=":"negativeLiteral2"},true,{"VAR=":"negativeLiteral3"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/extra/arithmetic_2.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",7,3,"/","out","/ev","\n","ev",7,3.0,"/","out","/ev","\n","ev",7,3.0,"FLOAT","/","out","/ev","\n","ev",7.0,3,"/","out","/ev","\n","ev",7.0,3.0,"/","out","/ev","\n","ev",7.0,"FLOAT",3.0,"/","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/extra/list_comparison.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"start"},["done",{"#n":"g-0"}],null],"done",{"set_actor":[{"temp=":"x"},"ev",{"VAR?":"x"},"/ev",["du","ev",{"VAR?":"P"},"==","/ev",{"->":".^.b","c":true},{"b":["pop","\n","ev","str","^Philippe","/str","/ev",{"VAR=":"currentActor","re":true},{"->":".^.^.^.7"},null]}],["du","ev",{"VAR?":"A"},"==","/ev",{"->":".^.b","c":true},{"b":["pop","\n","ev","str","^Andre","/str","/ev",{"VAR=":"currentActor","re":true},{"->":".^.^.^.7"},null]}],[{"->":".^.b"},{"b":["pop","\n","ev","str","^Bobby","/str","/ev",{"VAR=":"currentActor","re":true},{"->":".^.^.^.7"},null]}],"nop","\n",{"#f":3}],"start":["ev",{"VAR?":"P"},{"f()":"s","var":true},"out","/ev","^ Hey, my name is ","ev",{"VAR?":"currentActor"},"out","/ev","^. What about yours?","\n","ev",{"VAR?":"A"},{"f()":"s","var":true},"out","/ev","^ I am ","ev",{"VAR?":"currentActor"},"out","/ev","^ and I need my rheumatism pills!","\n","ev",{"VAR?":"P"},{"f()":"s","var":true},"out","/ev","^ Would you like me, ","ev",{"VAR?":"currentActor"},"out","/ev","^, to get some more for you?","\n","end",null],"global decl":["ev","str","^Bobby","/str",{"VAR=":"currentActor"},{"list":{},"origins":["listOfActors"]},{"VAR=":"listOfActors"},{"^->":"set_actor"},{"VAR=":"s"},"/ev","end",null]}],"listDefs":{"listOfActors":{"P":1,"A":2,"S":3,"C":4}}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/functions/compiler/argument_shouldnt_conflict_with_gather_elsewhere.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["done",{"#n":"g-0"}],null],"done",{"knot":[[["done",{"#n":"x"}],null],null],"f":[{"temp=":"x"},"^Nothing","\n",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/functions/compiler/using_function_and_increment_together.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"x"},{"f()":"one"},"+",{"VAR=":"x","re":true},"/ev","\n",["done",{"#n":"g-0"}],null],"done",{"one":["ev",1,"/ev","~ret",null],"global decl":["ev",5,{"VAR=":"x"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/glue/implicit_inline_glue.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^I have ","ev",{"f()":"five"},"out","/ev","^ eggs.","\n",["done",{"#n":"g-0"}],null],"done",{"five":["ev",false,"/ev",[{"->":".^.b","c":true},{"b":["\n","^Don't print this","\n",{"->":"five.4"},null]}],"nop","\n","^five","\n",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/glue/implicit_inline_glue_b.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^A ","ev",{"f()":"f"},"/ev",[{"->":".^.b","c":true},{"b":["^B",{"->":"0.5"},null]}],"nop","\n","^X","\n",["done",{"#n":"g-0"}],null],"done",{"f":["ev",true,"/ev",[{"->":".^.b","c":true},{"b":["\n","ev",false,"/ev","~ret",{"->":"f.4"},null]}],"nop","\n",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/glue/implicit_inline_glue_c.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^A","\n","ev",{"f()":"f"},"/ev",[{"->":".^.b","c":true},{"b":["^X",{"->":"0.6"},null]}],"nop","\n","^C","\n",["done",{"#n":"g-0"}],null],"done",{"f":["ev",true,"/ev",[{"->":".^.b","c":true},{"b":["\n","ev",false,"/ev","~ret",{"->":"f.4"},null]}],"nop","\n",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/glue/left_right_glue_matching.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^A line.","\n","ev",{"f()":"f"},"/ev",[{"->":".^.b","c":true},{"b":["\n","^Another line.","\n",{"->":"0.6"},null]}],"nop","\n",["done",{"#n":"g-0"}],null],"done",{"f":["ev",false,"/ev",[{"->":".^.b","c":true},{"b":["^nothing",{"->":"f.4"},null]}],"nop","\n","ev",true,"/ev","~ret",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/glue/simple_glue.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^Some ","<>","\n","^content","<>","^ with glue.","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/knots/compiler/knot_termination_skips_global_objects.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["done",{"#n":"g-0"}],null],"done",{"stuff":["end",null],"global decl":["ev",1,{"VAR=":"X"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/knots/knot_do_not_gather.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"knot"},["done",{"#n":"g-0"}],null],"done",{"knot":[[{"->":".^.gather"},["^g","\n","done",{"#n":"gather"}],null],null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/knots/knot_stitch_gather_counts.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->t->":"gather_count_test"},"ev",0,"/ev",{"VAR=":"knotCount","re":true},{"->t->":"knot_count_test"},"ev",0,"/ev",{"VAR=":"knotCount","re":true},{"->t->":"knot_count_test"},{"->t->":"stitch_count_test"},["done",{"#n":"g-0"}],null],"done",{"gather_count_test":[[["ev",{"VAR?":"gatherCount"},1,"+",{"VAR=":"gatherCount","re":true},"/ev","ev",{"VAR?":"gatherCount"},"out","/ev","^ ","ev",{"CNT?":".^"},"out","/ev","\n","ev",{"VAR?":"gatherCount"},3,"<","/ev",[{"->":".^.b","c":true},{"b":[{"->":".^.^.^"},{"->":".^.^.^.22"},null]}],"nop","\n","ev","void","/ev","->->",{"#f":5,"#n":"loop"}],null],null],"knot_count_test":["ev",{"VAR?":"knotCount"},1,"+",{"VAR=":"knotCount","re":true},"/ev","ev",{"VAR?":"knotCount"},"out","/ev","^ ","ev",{"CNT?":".^"},"out","/ev","\n","ev",{"VAR?":"knotCount"},3,"<","/ev",[{"->":".^.b","c":true},{"b":[{"->":".^.^.^"},{"->":".^.^.^.22"},null]}],"nop","\n","ev","void","/ev","->->",{"#f":1}],"stitch_count_test":["ev",0,"/ev",{"VAR=":"stitchCount","re":true},{"->t->":".^.stitch"},"ev",0,"/ev",{"VAR=":"stitchCount","re":true},{"->t->":".^.stitch"},"ev","void","/ev","->->",{"stitch":["ev",{"VAR?":"stitchCount"},1,"+",{"VAR=":"stitchCount","re":true},"/ev","ev",{"VAR?":"stitchCount"},"out","/ev","^ ","ev",{"CNT?":".^"},"out","/ev","\n","ev",{"VAR?":"stitchCount"},3,"<","/ev",[{"->":".^.b","c":true},{"b":[{"->":".^.^.^"},{"->":".^.^.^.22"},null]}],"nop","\n","ev","void","/ev","->->",{"#f":1}]}],"global decl":["ev",0,{"VAR=":"knotCount"},0,{"VAR=":"stitchCount"},0,{"VAR=":"gatherCount"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/knots/knot_thread_interaction.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"knot"},["done",{"#n":"g-0"}],null],"done",{"knot":["thread",{"->":"threadB"},{"->t->":"tunnel"},"^THE END","\n","end",null],"tunnel":[[["^blah blah","\n",["ev",{"^->":"tunnel.0.g-0.2.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^wigwag",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"tunnel.0.g-0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.2.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.^.g-1"},{"#f":5}],"#n":"g-0"}],{"g-1":["ev","void","/ev","->->",null]}],null],"threadB":[[["ev",{"^->":"threadB.0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^option",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"threadB.0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.g-0"},{"#f":5}],"g-0":["^something","\n","done",null]}],null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/knots/knot_thread_interaction_2.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"knot"},["done",{"#n":"g-0"}],null],"done",{"knot":["thread",{"->":"threadA"},"^When should this get printed?","\n","done",null],"threadA":[{"->t->":"tunnel"},"^Finishing thread.","\n","done",null],"tunnel":[[["^I’m in a tunnel","\n",["ev",{"^->":"tunnel.0.g-0.2.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^I’m an option",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"tunnel.0.g-0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.2.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.^.g-1"},{"#f":5}],"#n":"g-0"}],{"g-1":["ev","void","/ev","->->",null]}],null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/lists/contains_empty_list_always_false.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":21,"root":[["ev",{"VAR?":"list"},{"list":{}},"?","out","/ev","\n","ev",{"list":{}},{"list":{}},"?","out","/ev","\n","ev",{"list":{}},{"VAR?":"list"},"?","out","/ev","\n",["done",{"#f":5,"#n":"g-0"}],null],"done",{"global decl":["ev",{"list":{"list.a":1}},{"VAR=":"list"},"/ev","end",null],"#f":1}],"listDefs":{"list":{"a":1,"b":2}}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/lists/empty_list_origin.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"list"},"LIST_ALL","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev",{"list":{},"origins":["list"]},{"VAR=":"list"},"/ev","end",null]}],"listDefs":{"list":{"a":1,"b":2}}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/lists/empty_list_origin_after_assignment.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"list":{}},"/ev",{"VAR=":"x","re":true},"ev",{"VAR?":"x"},"LIST_ALL","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev",{"list":{},"origins":["x"]},{"VAR=":"x"},"/ev","end",null]}],"listDefs":{"x":{"a":1,"b":2,"c":3}}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/lists/list_basic_operations.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"list"},"out","/ev","\n","ev",{"list":{"list.a":1,"list.c":3}},{"list":{"list.b":2,"list.e":5}},"+","out","/ev","\n","ev",{"list":{"list.a":1,"list.b":2,"list.c":3}},{"list":{"list.c":3,"list.b":2,"list.e":5}},"L^","out","/ev","\n","ev",{"VAR?":"list"},{"list":{"list.b":2,"list.d":4,"list.e":5}},"?","out","/ev","\n","ev",{"VAR?":"list"},{"list":{"list.d":4,"list.b":2}},"?","out","/ev","\n","ev",{"VAR?":"list"},{"list":{"list.c":3}},"!?","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev",{"list":{"list.b":2,"list.d":4}},{"VAR=":"list"},"/ev","end",null]}],"listDefs":{"list":{"a":1,"b":2,"c":3,"d":4,"e":5}}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/lists/list_mixed_items.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"list"},{"VAR?":"list2"},"+","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev",{"list":{"list.a":1,"list.c":3}},{"VAR=":"list"},{"list":{"list2.y":2}},{"VAR=":"list2"},"/ev","end",null]}],"listDefs":{"list":{"a":1,"b":2,"c":3,"d":4,"e":5},"list2":{"x":1,"y":2,"z":3}}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/lists/list_random.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"l"},"lrnd","out","/ev","\n","ev",{"VAR?":"l"},"lrnd","out","/ev","\n","ev",{"VAR?":"l"},"lrnd","out","/ev","\n","ev",{"VAR?":"l"},"lrnd","out","/ev","\n","ev",{"VAR?":"l"},"lrnd","out","/ev","\n","ev",{"VAR?":"l"},"lrnd","out","/ev","\n","ev",{"VAR?":"l"},"lrnd","out","/ev","\n","ev",{"VAR?":"l"},"lrnd","out","/ev","\n","ev",{"VAR?":"l"},"lrnd","out","/ev","\n","ev",{"VAR?":"l"},"lrnd","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev",{"list":{"l.B":2,"l.C":3,"l.D":4}},{"VAR=":"l"},"/ev","end",null]}],"listDefs":{"l":{"A":1,"B":2,"C":3,"D":4,"E":5}}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/lists/list_range.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":21,"root":[["ev",{"VAR?":"Food"},"LIST_ALL",{"VAR?":"Currency"},"LIST_ALL","+","/ev",{"VAR=":"all","re":true},"\n","ev",{"VAR?":"all"},"out","/ev","\n","ev",{"VAR?":"all"},2,3,"range","out","/ev","\n","ev",{"VAR?":"Numbers"},"LIST_ALL",{"VAR?":"Two"},{"VAR?":"Six"},"range","out","/ev","\n","ev",{"VAR?":"Numbers"},"LIST_ALL",2,{"VAR?":"Four"},"range","out","/ev","\n","ev",{"VAR?":"Numbers"},"LIST_ALL",{"VAR?":"Two"},5,"range","out","/ev","\n","ev",{"list":{"Food.Pizza":1,"Food.Pasta":2}},-1,100,"range","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev",{"list":{},"origins":["Food"]},{"VAR=":"Food"},{"list":{},"origins":["Currency"]},{"VAR=":"Currency"},{"list":{},"origins":["Numbers"]},{"VAR=":"Numbers"},{"list":{}},{"VAR=":"all"},"/ev","end",null]}],"listDefs":{"Food":{"Pizza":1,"Pasta":2,"Curry":3,"Paella":4},"Currency":{"Pound":1,"Euro":2,"Dollar":3},"Numbers":{"One":1,"Two":2,"Three":3,"Four":4,"Five":5,"Six":6,"Seven":7}}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/lists/list_save_load.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"l1"},{"VAR?":"l2"},"+","/ev",{"VAR=":"t","re":true},"ev",{"VAR?":"t"},"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"elsewhere":["ev",{"VAR?":"t"},{"VAR?":"z"},"+",{"VAR=":"t","re":true},"/ev","ev",{"VAR?":"t"},"out","/ev","\n","end",null],"global decl":["ev",{"list":{"l1.a":1,"l1.c":3}},{"VAR=":"l1"},{"list":{"l2.x":1}},{"VAR=":"l2"},{"list":{}},{"VAR=":"t"},"/ev","end",null]}],"listDefs":{"l1":{"a":1,"b":2,"c":3},"l2":{"x":1,"y":2,"z":3}}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/lists/more_list_operations.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"l"},"LIST_VALUE","out","/ev","\n","ev","^list",1,"listInt","out","/ev","\n","ev",{"list":{},"origins":["list"]},"/ev",{"temp=":"t"},"\n","ev",{"VAR?":"t"},{"VAR?":"n"},"+",{"VAR=":"t","re":true},"/ev","ev",{"VAR?":"t"},"out","/ev","\n","ev",{"VAR?":"t"},"LIST_ALL","/ev",{"VAR=":"t","re":true},"\n","ev",{"VAR?":"t"},{"VAR?":"n"},"-",{"VAR=":"t","re":true},"/ev","ev",{"VAR?":"t"},"out","/ev","\n","ev",{"VAR?":"t"},"LIST_INVERT","/ev",{"VAR=":"t","re":true},"\n","ev",{"VAR?":"t"},"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev",{"list":{},"origins":["list"]},{"VAR=":"list"},"/ev","end",null]}],"listDefs":{"list":{"l":1,"m":5,"n":6}}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/logic/logic_lines_with_newlines.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"f()":"func"},"pop","/ev","\n","^text 2","\n","ev",{"f()":"func"},"/ev",{"temp=":"tempVar"},"\n","^text 2","\n",["done",{"#n":"g-0"}],null],"done",{"func":["^text1","\n","ev",true,"/ev","~ret",null],"global decl":["ev","/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/logic/multiline_logic_with_glue.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",true,"/ev",[{"->":".^.b","c":true},{"b":["\n","^a","\n",{"->":"0.4"},null]}],"nop","^ ","<>","^ b","\n","ev",true,"/ev",[{"->":".^.b","c":true},{"b":["\n","^a","\n",{"->":"0.13"},null]}],"nop","^ ","<>","^ ","ev",true,"/ev",[{"->":".^.b","c":true},{"b":["\n","^b","\n",{"->":"0.21"},null]}],"nop","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/logic/nested_pass_by_reference.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"globalVal"},"out","/ev","\n","ev",{"^var":"globalVal","ci":-1},{"f()":"squaresquare"},"pop","/ev","\n","ev",{"VAR?":"globalVal"},"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"squaresquare":[{"temp=":"x"},"ev",{"^var":"x","ci":-1},{"f()":"square"},"out","/ev","^ ","ev",{"^var":"x","ci":-1},{"f()":"square"},"out","/ev","\n","ev","void","/ev","~ret",null],"square":[{"temp=":"x"},"ev",{"VAR?":"x"},{"VAR?":"x"},"*","/ev",{"temp=":"x","re":true},"ev","void","/ev","~ret",null],"global decl":["ev",5,{"VAR=":"globalVal"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/author_warnings_inside_content_list_bug.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["ev","visit",1,"MIN","/ev","ev","du",0,"==","/ev",{"->":".^.s0","c":true},"ev","du",1,"==","/ev",{"->":".^.s1","c":true},"nop",{"s0":["pop","\n","^a","\n",{"->":"0.0.17"},null],"s1":["pop",{"->":"0.0.17"},null],"#f":5}],"\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/compiler/end_of_content_without_end.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["done",{"#n":"g-0"}],null],"done",{"test":["^Content","\n",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/compiler/return_text_warning.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["done",{"#n":"g-0"}],null],"done",{"test":["^return something","\n",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/empty.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/end.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^hello","\n","end","^world","\n","end",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/end2.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"test"},["done",{"#n":"g-0"}],null],"done",{"test":["^hello","\n","end","^world","\n","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/end_of_content.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["done",{"#n":"g-0"}],null],"done",{"test":["^Content","\n","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/end_of_content_hello_world.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^Hello world","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/end_of_content_with_end.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["done",{"#n":"g-0"}],null],"done",{"test":["^Content","\n","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/end_of_content_without_end.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["done",{"#n":"g-0"}],null],"done",{"test":["^Content","\n",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/escape_character.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",true,"/ev",[{"->":".^.b","c":true},{"b":["^this is a '|' character",{"->":"0.5"},null]}],[{"->":".^.b"},{"b":["^this isn't",{"->":"0.5"},null]}],"nop","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/hello_world.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^Hello world","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/identifiers_can_start_with_number.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"2tests"},["done",{"#n":"g-0"}],null],"done",{"2tests":["ev",512,2,"*","/ev",{"temp=":"512x2"},"ev",{"VAR?":"512x2"},2,"+","/ev",{"temp=":"512x2p2"},"^512x2 = ","ev",{"VAR?":"512x2"},"out","/ev","\n","^512x2p2 = ","ev",{"VAR?":"512x2p2"},"out","/ev","\n","done",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/include.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^This is include 1.","\n","\n","^This is include 2.","\n","\n","^This is the main file.","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/nested_include.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^The value of a variable in test file 2 is ","ev",{"VAR?":"t2"},"out","/ev","^.","\n","\n","\n","^This is the main file","\n",{"->":"knot_in_2"},["done",{"#n":"g-0"}],null],"done",{"knot_in_2":["^The value when accessed from knot_in_2 is ","ev",{"VAR?":"t2"},"out","/ev","^.","\n","end",null],"global decl":["ev",5,{"VAR=":"t2"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/quote_character_significance.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^My name is \"","ev","str","^J","ev","str","^o","/str","out","/ev","^e","/str","out","/ev","^\"","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/misc/whitespace.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"firstKnot"},["done",{"#n":"g-0"}],null],"done",{"firstKnot":["^Hello!","\n",{"->":"anotherKnot"},null],"anotherKnot":["^World.","\n","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/multiflow/multi_flow_basics.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["done",{"#n":"g-0"}],null],"done",{"knot1":["^knot 1 line 1","\n","^knot 1 line 2","\n","end",null],"knot2":["^knot 2 line 1","\n","^knot 2 line 2","\n","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/multiflow/multi_flow_save_load_threads.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^Default line 1","\n","^Default line 2","\n",["done",{"#n":"g-0"}],null],"done",{"red":["^Hello I'm red","\n","ev","str","^red","/str","/ev","thread",{"->":"thread1"},"ev","str","^red","/str","/ev","thread",{"->":"thread2"},"done",null],"blue":["^Hello I'm blue","\n","ev","str","^blue","/str","/ev","thread",{"->":"thread1"},"ev","str","^blue","/str","/ev","thread",{"->":"thread2"},"done",null],"thread1":[{"temp=":"name"},[["ev",{"^->":"thread1.1.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":2},{"s":["^Thread 1 ","ev",{"VAR?":"name"},"out","/ev","^ choice",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"thread1.1.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],"\n","ev",{"VAR?":"name"},"/ev",{"->":"thread1Choice"},null]}],null],"thread2":[{"temp=":"name"},[["ev",{"^->":"thread2.1.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":2},{"s":["^Thread 2 ","ev",{"VAR?":"name"},"out","/ev","^ choice",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"thread2.1.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],"\n","ev",{"VAR?":"name"},"/ev",{"->":"thread2Choice"},null]}],null],"thread1Choice":[{"temp=":"name"},"^After thread 1 choice (","ev",{"VAR?":"name"},"out","/ev","^)","\n","end",null],"thread2Choice":[{"temp=":"name"},"^After thread 2 choice (","ev",{"VAR?":"name"},"out","/ev","^)","\n","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/newlines/newline_at_start_of_multiline_conditional.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"f()":"isTrue"},"/ev",[{"->":".^.b","c":true},{"b":["\n","^x","\n",{"->":"0.4"},null]}],"nop","\n",["done",{"#n":"g-0"}],null],"done",{"isTrue":["^X","\n","ev",true,"/ev","~ret",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/newlines/newline_consistency_1.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^hello ",{"->":"world"},"\n",["done",{"#n":"g-0"}],null],"done",{"world":["^world","\n","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/newlines/newline_consistency_2.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["ev",{"^->":"0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":"0.c-0","flg":18},{"s":["^hello ",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":"0.0.s"},[{"#n":"$r2"}],{"->":"world"},"\n",{"->":"0.g-0"},{"#f":5}],"g-0":["done",null]}],"done",{"world":["^world","\n","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/newlines/newline_consistency_3.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["ev",{"^->":"0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":"0.c-0","flg":18},{"s":["^hello",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":"0.0.s"},[{"#n":"$r2"}],"\n",{"->":"world"},{"->":"0.g-0"},{"#f":5}],"g-0":["done",null]}],"done",{"world":["^world","\n","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/newlines/newlines_trimming_with_func_external_fallback.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^Phrase 1","\n","ev",{"x()":"TRUE"},"/ev",[{"->":".^.b","c":true},{"b":["\n","^Phrase 2","\n",{"->":"0.6"},null]}],"nop","\n","end",["done",{"#n":"g-0"}],null],"done",{"TRUE":["ev",true,"/ev","~ret",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/newlines/newlines_with_string_eval.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^A","\n","ev",{"f()":"string"},"/ev",{"temp=":"someTemp"},"\n","^B","\n","^A","\n","ev",{"f()":"string"},"out","/ev","\n","^B","\n",["done",{"#n":"g-0"}],null],"done",{"string":["ev","str","ev",3,"out","/ev","/str","/ev","~ret",null],"global decl":["ev","/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/sequences/empty_sequence_content.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->t->":"thing"},{"->t->":"thing"},{"->t->":"thing"},{"->t->":"thing"},{"->t->":"thing"},"^Done.","\n",["done",{"#n":"g-0"}],null],"done",{"thing":[["ev","visit",4,"MIN","/ev","ev","du",0,"==","/ev",{"->":".^.s0","c":true},"ev","du",1,"==","/ev",{"->":".^.s1","c":true},"ev","du",2,"==","/ev",{"->":".^.s2","c":true},"ev","du",3,"==","/ev",{"->":".^.s3","c":true},"ev","du",4,"==","/ev",{"->":".^.s4","c":true},"nop",{"s0":["pop","\n","^Wait for it....","\n",{"->":".^.^.35"},null],"s1":["pop",{"->":".^.^.35"},null],"s2":["pop",{"->":".^.^.35"},null],"s3":["pop","\n","^Surprise!","\n",{"->":".^.^.35"},null],"s4":["pop",{"->":".^.^.35"},null],"#f":5}],"\n","ev","void","/ev","->->",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/sequences/gather_read_count_with_initial_sequence.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["ev",{"CNT?":".^.test"},"/ev",[{"->":".^.b","c":true},{"b":["^seen test",{"->":"0.opts.4"},null]}],"nop","\n",[["ev","visit",1,"MIN","/ev","ev","du",0,"==","/ev",{"->":".^.s0","c":true},"ev","du",1,"==","/ev",{"->":".^.s1","c":true},"nop",{"s0":["pop",{"->":"0.opts"},{"->":".^.^.17"},null],"s1":["pop",{"->":".^.^.17"},null],"#f":5}],"\n",["done",{"#n":"g-0"}],{"#f":5,"#n":"test"}],{"#n":"opts"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/sequences/leading_newline_multiline_sequence.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["ev","visit",1,"MIN","/ev","ev","du",0,"==","/ev",{"->":".^.s0","c":true},"ev","du",1,"==","/ev",{"->":".^.s1","c":true},"nop",{"s0":["pop","\n","^a line after an empty line","\n",{"->":"0.0.17"},null],"s1":["pop","\n","^blah","\n",{"->":"0.0.17"},null],"#f":5}],"\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/sequences/shuffle_stack_muddying.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev","str","^choice 1","/str",{"f()":"condFunc"},"/ev",{"*":"0.c-0","flg":21},"ev","str","^choice 2","/str",{"f()":"condFunc"},"/ev",{"*":"0.c-1","flg":21},"ev","str","^choice 3","/str",{"f()":"condFunc"},"/ev",{"*":"0.c-2","flg":21},"ev","str","^choice 4","/str",{"f()":"condFunc"},"/ev",{"*":"0.c-3","flg":21},{"c-0":["\n",{"->":"0.g-0"},{"#f":5}],"c-1":["\n",{"->":"0.g-0"},{"#f":5}],"c-2":["\n",{"->":"0.g-0"},{"#f":5}],"c-3":["\n",{"->":"0.g-0"},{"#f":5}],"g-0":["done",null]}],"done",{"condFunc":[["ev","visit",4,"seq","/ev","ev","du",0,"==","/ev",{"->":".^.s0","c":true},"ev","du",1,"==","/ev",{"->":".^.s1","c":true},"ev","du",2,"==","/ev",{"->":".^.s2","c":true},"ev","du",3,"==","/ev",{"->":".^.s3","c":true},"nop",{"s0":["pop","\n","ev",false,"/ev","~ret",{"->":".^.^.29"},null],"s1":["pop","\n","ev",true,"/ev","~ret",{"->":".^.^.29"},null],"s2":["pop","\n","ev",true,"/ev","~ret",{"->":".^.^.29"},null],"s3":["pop","\n","ev",false,"/ev","~ret",{"->":".^.^.29"},null],"#f":5}],"\n",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/strings/string_constants.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"x"},"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev","str","^hi","/str",{"VAR=":"x"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/strings/string_contains.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev","str","^hello world","/str","str","^o wo","/str","?","out","/ev","\n","ev","str","^hello world","/str","str","^something else","/str","?","out","/ev","\n","ev","str","^hello","/str","str","^","/str","?","out","/ev","\n","ev","str","^","/str","str","^","/str","?","out","/ev","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/strings/string_type_coercion.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev","str","^5","/str",5,"==","/ev",[{"->":".^.b","c":true},{"b":["^same",{"->":"0.9"},null]}],[{"->":".^.b"},{"b":["^different",{"->":"0.9"},null]}],"nop","\n","ev","str","^blah","/str",5,"==","/ev",[{"->":".^.b","c":true},{"b":["^same",{"->":"0.20"},null]}],[{"->":".^.b"},{"b":["^different",{"->":"0.20"},null]}],"nop","\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/strings/strings_in_choices.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["ev",{"^->":"0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","str","^\"test2 ","ev","str","^test3","/str","out","/ev","^\"","/str","/ev",{"*":"0.c-0","flg":22},{"s":["^ ","ev","str","^test1","/str","out","/ev","^ ",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":"0.0.s"},[{"#n":"$r2"}],"^ ","ev","str","^test4","/str","out","/ev","\n","done",{"->":"0.g-0"},{"#f":5}],"g-0":["done",null]}],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/tags/tags.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":21,"root":[["#","^author: Joe","/#","#","^title: My Great Story","/#","^This is the content","\n",["done",{"#f":5,"#n":"g-0"}],null],"done",{"knot":["#","^knot tag","/#","^Knot content","\n","#","^end of knot tag","/#","end",{"stitch":["#","^stitch tag","/#","^Stitch content","\n","#","^this tag is below some content so isn't included in the static tags for the stitch","/#","end",{"#f":1}],"#f":1}],"global decl":["ev",2,{"VAR=":"x"},"/ev","end",null],"#f":1}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/tags/tags_dynamic_content.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":21,"root":[["^tag ","#","^pic","ev",5,3,"+","out","/ev",["ev","visit",1,"MIN","/ev","ev","du",0,"==","/ev",{"->":".^.s0","c":true},"ev","du",1,"==","/ev",{"->":".^.s1","c":true},"nop",{"s0":["pop","^red",{"->":"0.9.17"},null],"s1":["pop","^blue",{"->":"0.9.17"},null],"#f":5}],"^.jpg","/#","\n",["done",{"#f":5,"#n":"g-0"}],null],"done",{"#f":1}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/tags/tags_in_seq.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":21,"root":[[{"->t->":"knot"},{"->t->":"knot"},["done",{"#f":5,"#n":"g-0"}],null],"done",{"knot":["^A ",["ev","visit",3,"MIN","/ev","ev","du",0,"==","/ev",{"->":".^.s0","c":true},"ev","du",1,"==","/ev",{"->":".^.s1","c":true},"ev","du",2,"==","/ev",{"->":".^.s2","c":true},"ev","du",3,"==","/ev",{"->":".^.s3","c":true},"nop",{"s0":["pop","^red ","#","^red",{"->":".^.^.29"},null],"s1":["pop","^white ","/#","#","^white",{"->":".^.^.29"},null],"s2":["pop","^blue ","/#","#","^blue",{"->":".^.^.29"},null],"s3":["pop","^green ","/#","#","^green",{"->":".^.^.29"},null],"#f":5}],"/#","^ sequence.","\n","ev","void","/ev","->->",{"#f":1}],"#f":1}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/threads/multi_thread.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"start"},["done",{"#n":"g-0"}],null],"done",{"start":[{"->t->":"tunnel"},"^The end","\n","end",null],"tunnel":["thread",{"->":"place1"},"thread",{"->":"place2"},"done",null],"place1":[["^This is place 1.","\n",["ev",{"^->":"place1.0.2.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^choice in place 1",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"place1.0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.2.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.g-0"},{"#f":5}],"g-0":["ev","void","/ev","->->",null]}],null],"place2":[["^This is place 2.","\n",["ev",{"^->":"place2.0.2.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^choice in place 2",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"place2.0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.2.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.g-0"},{"#f":5}],"g-0":["ev","void","/ev","->->",null]}],null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/threads/thread_done.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^This is a thread example","\n","thread",{"->":"example_thread"},"^The example is now complete.","\n",["done",{"#n":"g-0"}],null],"done",{"example_thread":["^Hello.","\n","done","^World.","\n","done",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/threads/thread_in_logic.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->t->":"once"},{"->t->":"once"},["done",{"#n":"g-0"}],null],"done",{"once":[["ev","visit",1,"MIN","/ev","ev","du",0,"==","/ev",{"->":".^.s0","c":true},"ev","du",1,"==","/ev",{"->":".^.s1","c":true},"nop",{"s0":["pop","thread",{"->":"content"},{"->":".^.^.17"},null],"s1":["pop",{"->":".^.^.17"},null],"#f":5}],"\n","ev","void","/ev","->->",null],"content":["^Content","\n","done",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/threads/top_flow_terminator_should_not_kill_thread_choices.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["thread",{"->":"move"},"^Limes","\n",["done",{"#n":"g-0"}],null],"done",{"move":[[["ev",{"^->":"move.0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^boop",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"move.0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],"\n","end",{"#f":5}]}],null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/variables/const.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"x"},"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev",5,{"VAR=":"x"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/variables/multiple_constant_references.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"varStr"},"str","^ConstantString","/str","==","/ev",[{"->":".^.b","c":true},{"b":["^success",{"->":"0.8"},null]}],"nop","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev","str","^ConstantString","/str",{"VAR=":"varStr"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/variables/set_non_existant_variable.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^Hello ","ev",{"VAR?":"x"},"out","/ev","^.","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev","str","^world","/str",{"VAR=":"x"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/variables/set_non_existent_variable.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^Hello ","ev",{"VAR?":"x"},"out","/ev","^.","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev","str","^world","/str",{"VAR=":"x"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/variables/temp_global_conflict.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"outer"},["done",{"#n":"g-0"}],null],"done",{"outer":["ev",0,"/ev",{"temp=":"x"},"ev",{"^var":"x","ci":-1},{"f()":"f"},"pop","/ev","\n","ev",{"VAR?":"x"},"out","/ev","\n","done",null],"f":[{"temp=":"x"},"ev",0,"/ev",{"temp=":"local"},"ev",{"VAR?":"x"},"/ev",{"temp=":"x","re":true},"ev",{"^var":"local","ci":-1},{"f()":"setTo3"},"out","/ev","\n",null],"setTo3":[{"temp=":"x"},"ev",3,"/ev",{"temp=":"x","re":true},null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/variables/temp_not_found.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"x"},"out","/ev","\n","ev",5,"/ev",{"temp=":"x"},"^hello","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev","/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/variables/temp_usage_in_options.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",1,"/ev",{"temp=":"one"},["ev",{"^->":"0.4.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":"0.c-0","flg":18},{"s":["^ ","ev",{"VAR?":"one"},"out","/ev",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":"0.4.s"},[{"#n":"$r2"}],"\n",{"->":"0.g-0"},{"#f":5}],"g-0":["^End of choice","\n",{"->":".^.c-1"},["ev",{"^->":"0.g-0.3.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","str","^is","/str","/ev",{"*":".^.^.c-1","flg":22},{"s":["^this ",{"->":"$r","var":true},null]}],{"c-1":["ev",{"^->":"0.g-0.c-1.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.3.s"},[{"#n":"$r2"}],"^ another","\n","done",{"->":"0.g-1"},{"#f":5}]}],"g-1":["done",null]}],"done",{"global decl":["ev","/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/variables/temporaries_at_global_scope.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",4,"/ev",{"temp=":"y"},"ev",{"VAR?":"x"},"out","/ev","ev",{"VAR?":"y"},"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev",5,{"VAR=":"x"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/variables/variable_declaration_in_conditional.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",true,"/ev",[{"->":".^.b","c":true},{"b":["\n","ev",5,"/ev",{"VAR=":"x","re":true},{"->":"0.4"},null]}],"nop","\n","ev",{"VAR?":"x"},"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev",0,{"VAR=":"x"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/variables/variable_divert_target.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"there"},["done",{"#n":"g-0"}],null],"done",{"there":[{"->":"x","var":true},null],"here":["^Here.","\n","done",{"#f":3}],"global decl":["ev",{"^->":"here"},{"VAR=":"x"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/variables/variable_get_set_api.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"VAR?":"x"},"out","/ev","\n","ev","str","^choice","/str","/ev",{"*":"0.c-0","flg":20},{"c-0":["\n",{"->":"0.g-0"},{"#f":5}],"g-0":["ev",{"VAR?":"x"},"out","/ev","\n","ev","str","^choice","/str","/ev",{"*":".^.c-1","flg":20},{"c-1":["\n",{"->":"0.g-1"},{"#f":5}]}],"g-1":["ev",{"VAR?":"x"},"out","/ev","\n","ev","str","^choice","/str","/ev",{"*":".^.c-2","flg":20},{"c-2":["\n",{"->":"0.g-2"},{"#f":5}]}],"g-2":["ev",{"VAR?":"x"},"out","/ev","\n","done",["done",{"#n":"g-3"}],null]}],"done",{"global decl":["ev",5,{"VAR=":"x"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/variables/variable_pointer_ref_from_knot.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->t->":"knot"},"end",["done",{"#n":"g-0"}],null],"done",{"knot":["ev",{"^var":"val","ci":-1},{"f()":"inc"},"pop","/ev","\n","ev",{"VAR?":"val"},"out","/ev","\n","ev","void","/ev","->->",null],"inc":[{"temp=":"x"},"ev",{"VAR?":"x"},1,"+","/ev",{"temp=":"x","re":true},null],"global decl":["ev",5,{"VAR=":"val"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/variables/variable_swap_recurse.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",1,1,{"f()":"f"},"pop","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"f":[{"temp=":"y"},{"temp=":"x"},"ev",{"VAR?":"x"},1,"==",{"VAR?":"y"},1,"==","&&","/ev",[{"->":".^.b","c":true},{"b":["\n","ev",2,"/ev",{"temp=":"x","re":true},"ev",{"VAR?":"y"},{"VAR?":"x"},{"f()":"f"},"pop","/ev","\n",{"->":"f.13"},null]}],[{"->":".^.b"},{"b":["\n","ev",{"VAR?":"x"},"out","/ev","^ ","ev",{"VAR?":"y"},"out","/ev","\n",{"->":"f.13"},null]}],"nop","\n","ev","void","/ev","~ret",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/variables/variable_tunnel.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["ev",{"^->":"tunnel"},"/ev",{"->":"one_then_tother"},["done",{"#n":"g-0"}],null],"done",{"one_then_tother":[{"temp=":"x"},{"->t->":"x","var":true},{"->":"end"},null],"tunnel":["^STUFF","\n","ev","void","/ev","->->",{"#f":3}],"end":["end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/variables/warn_variable_not_found_1.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^Hello world!","\n","ev",{"VAR?":"x"},"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev",0,{"VAR=":"x"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/variables/warn_variable_not_found_2.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[["^Hello world!","\n","ev",{"VAR?":"y"},"out","/ev","\n",["done",{"#n":"g-0"}],null],"done",{"global decl":["ev",0,{"VAR=":"y"},"/ev","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/weaves/conditional_choice_in_weave.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["^start","\n",["ev",true,"/ev",{"->":".^.b","c":true},{"b":["\n","ev","str","^go to a stitch","/str","/ev",{"*":".^.c-0","flg":20},{"->":"0.g-0.3"},{"c-0":["^ ",{"->":"a_stitch"},"\n",{"#f":5}]}]}],"nop","\n",["^gather should be seen","\n","done",["done",{"#n":"g-2"}],{"#n":"g-1"}],{"#n":"g-0"}],null],"done",{"a_stitch":["^result","\n","end",null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/weaves/conditional_choice_in_weave_2.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["^first gather","\n","ev","str","^option 1","/str","/ev",{"*":".^.c-0","flg":20},"ev","str","^option 2","/str","/ev",{"*":".^.c-1","flg":20},{"c-0":["\n",{"->":"0.g-1"},{"#f":5}],"c-1":["\n",{"->":"0.g-1"},{"#f":5}],"#n":"g-0"}],{"g-1":["^the main gather","\n","ev",false,"/ev",[{"->":".^.b","c":true},{"b":["\n",["ev",{"^->":"0.g-1.5.b.1.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^unreachable option ",{"->":"$r","var":true},null]}],{"->":"0.g-1.6"},{"c-0":["ev",{"^->":"0.g-1.5.b.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.1.s"},[{"#n":"$r2"}],"end","\n",{"#f":5}]}]}],"nop","\n",["^bottom gather","\n",["done",{"#n":"g-3"}],{"#n":"g-2"}],null]}],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/weaves/unbalanced_weave_indentation.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[[["ev",{"^->":"0.0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":"0.0.c-0","flg":18},{"s":["^First",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":"0.0.0.s"},[{"#n":"$r2"}],"\n",[["ev",{"^->":"0.0.c-0.7.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^Very indented",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.0.c-0.7.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],"\n",{"->":"0.0.g-0"},{"#f":5}]}],{"#f":5}],"g-0":["^End","\n","end",{"->":"0.g-0"},null]}],["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/weaves/weave_gathers.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[[["ev",{"^->":"0.g-0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^one",{"->":"$r","var":true},null]}],["ev",{"^->":"0.g-0.1.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-1","flg":18},{"s":["^four",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.g-0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],"\n",[["ev",{"^->":"0.g-0.c-0.7.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^two",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"0.g-0.c-0.7.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.g-0"},{"#f":5}],"g-0":["^three","\n",{"->":"0.g-1"},null]}],{"#f":5}],"c-1":["ev",{"^->":"0.g-0.c-1.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.1.s"},[{"#n":"$r2"}],"\n",[["^five","\n",{"->":"0.g-1"},{"#n":"g-0"}],null],{"#f":5}],"#n":"g-0"}],{"g-1":["^six","\n",["done",{"#n":"g-2"}],null]}],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/weaves/weave_options.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[{"->":"test"},["done",{"#n":"g-0"}],null],"done",{"test":[[["ev",{"^->":"test.0.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","str","^.","/str","/ev",{"*":".^.^.c-0","flg":22},{"s":["^Hello",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"test.0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],"^, world.","\n","end",{"#f":5}]}],null]}],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/compiled/weaves/weave_within_sequence.ink.json: -------------------------------------------------------------------------------- 1 | {"inkVersion":20,"root":[[["ev","visit",1,"seq","/ev","ev","du",0,"==","/ev",{"->":".^.s0","c":true},"nop",{"s0":["pop","\n",["ev",{"^->":"0.0.s0.2.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^choice",{"->":"$r","var":true},null]}],{"->":"0.0.11"},{"c-0":["ev",{"^->":"0.0.s0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.2.s"},[{"#n":"$r2"}],"\n","^nextline","\n","end",{"#f":5}]}],"#f":5}],"\n",["done",{"#n":"g-0"}],null],"done",null],"listDefs":{}} -------------------------------------------------------------------------------- /src/tests/inkfiles/original/bindings/external_binding.ink: -------------------------------------------------------------------------------- 1 | EXTERNAL message(x) 2 | EXTERNAL multiply(x,y) 3 | EXTERNAL times(i,str) 4 | ~ message("hello world") 5 | {multiply(5.0, 3)} 6 | {times(3, "knock ")} 7 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/bindings/game_ink_back_and_forth.ink: -------------------------------------------------------------------------------- 1 | EXTERNAL gameInc(x) 2 | == function topExternal(x) 3 | In top external 4 | ~ return gameInc(x) 5 | == function inkInc(x) 6 | ~ return x + 1 7 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/bindings/lookup_safe_or_not.ink: -------------------------------------------------------------------------------- 1 | EXTERNAL myAction() 2 | 3 | One 4 | ~ myAction() 5 | Two 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/bindings/lookup_safe_or_not_with_post_glue.ink: -------------------------------------------------------------------------------- 1 | EXTERNAL myAction() 2 | 3 | One 4 | ~ myAction() 5 | <> Two 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/bindings/variable_observer.ink: -------------------------------------------------------------------------------- 1 | VAR testVar = 5 2 | VAR testVar2 = 10 3 | Hello world! 4 | ~ testVar = 15 5 | ~ testVar2 = 100 6 | Hello world 2! 7 | * choice 8 | ~ testVar = 25 9 | ~ testVar2 = 200 10 | -> END 11 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/booleans/false_plus_false.ink: -------------------------------------------------------------------------------- 1 | {false + false} 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/booleans/list_hasnt.ink: -------------------------------------------------------------------------------- 1 | LIST list = a, (b), c, (d), e 2 | {list !? (c)} 3 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/booleans/not_one.ink: -------------------------------------------------------------------------------- 1 | {not 1} 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/booleans/not_true.ink: -------------------------------------------------------------------------------- 1 | {not true} 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/booleans/three_greater_than_one.ink: -------------------------------------------------------------------------------- 1 | {3 > 1} 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/booleans/true.ink: -------------------------------------------------------------------------------- 1 | {true} 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/booleans/true_equals_one.ink: -------------------------------------------------------------------------------- 1 | {true == 1} 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/booleans/true_plus_one.ink: -------------------------------------------------------------------------------- 1 | {true + 1} 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/booleans/true_plus_true.ink: -------------------------------------------------------------------------------- 1 | {true + true} 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/booleans/two_plus_true.ink: -------------------------------------------------------------------------------- 1 | {2 + true} 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/builtins/floor_ceiling_and_casts.ink: -------------------------------------------------------------------------------- 1 | {FLOOR(1.2)} 2 | {INT(1.2)} 3 | {CEILING(1.2)} 4 | {CEILING(1.2) / 3} 5 | {INT(CEILING(1.2)) / 3} 6 | {FLOOR(1)} 7 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/builtins/read_count_across_callstack.ink: -------------------------------------------------------------------------------- 1 | -> first 2 | == first == 3 | 1) Seen first {first} times. 4 | -> second -> 5 | 2) Seen first {first} times. 6 | -> DONE 7 | == second == 8 | In second. 9 | ->-> 10 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/builtins/read_count_across_threads.ink: -------------------------------------------------------------------------------- 1 | -> top 2 | = top 3 | {top} 4 | <- aside 5 | {top} 6 | -> DONE 7 | = aside 8 | * {false} DONE 9 | - -> DONE 10 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/builtins/read_count_dot_separated_path.ink: -------------------------------------------------------------------------------- 1 | -> hi -> 2 | -> hi -> 3 | -> hi -> 4 | { hi.stitch_to_count } 5 | == hi == 6 | = stitch_to_count 7 | hi 8 | ->-> 9 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/builtins/read_count_variable_target.ink: -------------------------------------------------------------------------------- 1 | VAR x = ->knot 2 | 3 | Count start: {READ_COUNT (x)} {READ_COUNT (-> knot)} {knot} 4 | 5 | -> x (1) -> 6 | -> x (2) -> 7 | -> x (3) -> 8 | 9 | Count end: {READ_COUNT (x)} {READ_COUNT (-> knot)} {knot} 10 | -> END 11 | 12 | == knot (a) == 13 | {a} 14 | ->-> 15 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/builtins/turns.ink: -------------------------------------------------------------------------------- 1 | -> c 2 | - (top) 3 | + (c) [choice] 4 | {TURNS ()} 5 | -> top 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/builtins/turns_since.ink: -------------------------------------------------------------------------------- 1 | { TURNS_SINCE(-> test) } 2 | ~ test() 3 | { TURNS_SINCE(-> test) } 4 | * [choice 1] 5 | - { TURNS_SINCE(-> test) } 6 | * [choice 2] 7 | - { TURNS_SINCE(-> test) } 8 | == function test == 9 | ~ return 10 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/builtins/turns_since_nested.ink: -------------------------------------------------------------------------------- 1 | -> empty_world 2 | === empty_world === 3 | {TURNS_SINCE(-> then)} = -1 4 | * (then) stuff 5 | {TURNS_SINCE(-> then)} = 0 6 | * * (next) more stuff 7 | {TURNS_SINCE(-> then)} = 1 8 | -> DONE 9 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/builtins/turns_since_with_variable_target.ink: -------------------------------------------------------------------------------- 1 | -> start 2 | === start === 3 | {beats(-> start)} 4 | {beats(-> start)} 5 | * [Choice] -> next 6 | = next 7 | {beats(-> start)} 8 | -> END 9 | === function beats(x) === 10 | ~ return TURNS_SINCE(x) 11 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/builtins/visit_count_bug_due_to_nested_containers.ink: -------------------------------------------------------------------------------- 1 | - (gather) {gather} 2 | * choice 3 | - {gather} 4 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/builtins/visit_counts_when_choosing.ink: -------------------------------------------------------------------------------- 1 | == TestKnot == 2 | this is a test 3 | + [Next] -> TestKnot2 4 | == TestKnot2 == 5 | this is the end 6 | -> END 7 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/callstack/callstack_evaluation.ink: -------------------------------------------------------------------------------- 1 | { six() + two() } 2 | -> END 3 | === function six 4 | ~ return four() + two() 5 | === function four 6 | ~ return two() + two() 7 | === function two 8 | ~ return 2 9 | 10 | // RESULT: "8\n" 11 | // Continue -------------------------------------------------------------------------------- /src/tests/inkfiles/original/callstack/clean_callstack_reset_on_path_choice.ink: -------------------------------------------------------------------------------- 1 | {RunAThing()} 2 | == function RunAThing == 3 | The first line. 4 | The second line. 5 | == SomewhereElse == 6 | {"somewhere else"} 7 | ->END 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/blank_choice.ink: -------------------------------------------------------------------------------- 1 | * [] blank 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/choice_count.ink: -------------------------------------------------------------------------------- 1 | <- choices 2 | { CHOICE_COUNT() } 3 | = end 4 | -> END 5 | = choices 6 | * one -> end 7 | * two -> end 8 | 9 | // RESULT: "2\n" 10 | // Continue -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/choice_diverts_to_done.ink: -------------------------------------------------------------------------------- 1 | * choice -> DONE 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/choice_thread_forking.ink: -------------------------------------------------------------------------------- 1 | -> generate_choice(1) -> 2 | == generate_choice(x) == 3 | {true: 4 | + A choice 5 | Vaue of local var is: {x} 6 | -> END 7 | } 8 | ->-> 9 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/choice_with_brackets_only.ink: -------------------------------------------------------------------------------- 1 | * [Option] 2 | Text 3 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/conditional_choices.ink: -------------------------------------------------------------------------------- 1 | * { true } { false } not displayed 2 | * { true } { true } 3 | { true and true } one 4 | * { false } not displayed 5 | * (name) { true } two 6 | * { true } 7 | { true } 8 | three 9 | * { true } 10 | four 11 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/default_choices.ink: -------------------------------------------------------------------------------- 1 | - (start) 2 | * [Choice 1] 3 | * [Choice 2] 4 | * {false} Impossible choice 5 | * -> default 6 | - After choice 7 | -> start 8 | == default == 9 | This is default. 10 | -> DONE 11 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/default_simple_gather.ink: -------------------------------------------------------------------------------- 1 | * -> 2 | - x 3 | -> DONE 4 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/dynamic_tags_in_choice.ink: -------------------------------------------------------------------------------- 1 | VAR var1 = "aaa" 2 | VAR var2 = "bbb" 3 | 4 | +[choice #tag {var1}{var2}] -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/empty_choice.ink: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/fallback_choice_on_thread.ink: -------------------------------------------------------------------------------- 1 | <- knot 2 | == knot 3 | ~ temp x = 1 4 | * -> 5 | Should be 1 not 0: {x}. 6 | -> DONE 7 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/gather_choice_same_line.ink: -------------------------------------------------------------------------------- 1 | - * hello 2 | - * world 3 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/has_read_on_choice.ink: -------------------------------------------------------------------------------- 1 | * { not test } visible choice 2 | * { test } visible choice 3 | == test == 4 | -> END 5 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/logic_in_choices.ink: -------------------------------------------------------------------------------- 1 | * 'Hello {name()}[, your name is {name()}.'],' I said, knowing full well that his name was {name()}. 2 | -> DONE 3 | == function name == 4 | Joe 5 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/nested_choice.ink: -------------------------------------------------------------------------------- 1 | -> main 2 | === main === 3 | Should you cross the river? 4 | 5 | * [Yes] 6 | * [No] 7 | ** [Fight back] 8 | ** [Flee] 9 | - -> END -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/nested_choice_error.ink: -------------------------------------------------------------------------------- 1 | { true: 2 | * choice 3 | } 4 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/newline_after_choice.ink: -------------------------------------------------------------------------------- 1 | * (say_something_interesting_about_bricklaying) 2 | I did have one interesting fact about bricklaying, if you don't mind me spending taking a fair bit of time to lay the groundwork for it. -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/non_text_in_choice_inner_content.ink: -------------------------------------------------------------------------------- 1 | -> knot 2 | == knot 3 | * option text[]. {true: Conditional bit.} -> next 4 | -> DONE 5 | == next 6 | Next. 7 | -> DONE 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/once_only_choices_can_link_back_to_self.ink: -------------------------------------------------------------------------------- 1 | -> opts 2 | = opts 3 | * (firstOpt) [First choice] -> opts 4 | * {firstOpt} [Second choice] -> opts 5 | * -> end 6 | - (end) 7 | -> END 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/once_only_choices_with_own_content.ink: -------------------------------------------------------------------------------- 1 | VAR times = 3 2 | -> home 3 | == home == 4 | ~ times = times - 1 5 | {times >= 0:-> eat} 6 | I've finished eating now. 7 | -> END 8 | == eat == 9 | This is the {first|second|third} time. 10 | * Eat ice-cream[] 11 | * Drink coke[] 12 | * Munch cookies[] 13 | - 14 | -> home 15 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/should_not_gather_due_to_choice.ink: -------------------------------------------------------------------------------- 1 | * opt 2 | - - text 3 | * * {false} impossible 4 | * * -> END 5 | - gather 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/state_rollback_over_default_choice.ink: -------------------------------------------------------------------------------- 1 | <- make_default_choice 2 | Text. 3 | 4 | === make_default_choice 5 | * -> 6 | {5} 7 | -> END 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/sticky_choices_stay_sticky.ink: -------------------------------------------------------------------------------- 1 | -> test 2 | == test == 3 | First line. 4 | Second line. 5 | + Choice 1 6 | + Choice 2 7 | - -> test 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/tags_in_choice.ink: -------------------------------------------------------------------------------- 1 | + one #one [two #two] three #three -> END -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/various_blank_choice_warning.ink: -------------------------------------------------------------------------------- 1 | * [] blank -------------------------------------------------------------------------------- /src/tests/inkfiles/original/choices/various_default_choices.ink: -------------------------------------------------------------------------------- 1 | * -> hello 2 | Unreachable 3 | - (hello) 1 4 | * -> 5 | - - 2 6 | - 3 7 | -> END 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/conditions/all_switch_branches_fail_is_clean.ink: -------------------------------------------------------------------------------- 1 | { 1: 2 | - 2: x 3 | - 3: y 4 | } 5 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/conditions/conditionals.ink: -------------------------------------------------------------------------------- 1 | {false:not true|true} 2 | { 3 | - 4 > 5: not true 4 | - 5 > 4: true 5 | } 6 | { 2*2 > 3: 7 | - true 8 | - not true 9 | } 10 | { 11 | - 1 > 3: not true 12 | - { 2+2 == 4: 13 | - true 14 | - not true 15 | } 16 | } 17 | { 2*3: 18 | - 1+7: not true 19 | - 9: not true 20 | - 1+1+1+3: true 21 | - 9-3: also true but not printed 22 | } 23 | { true: 24 | great 25 | right? 26 | } 27 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/conditions/else_branches.ink: -------------------------------------------------------------------------------- 1 | VAR x = 3 2 | { 3 | - x == 1: one 4 | - x == 2: two 5 | - else: other 6 | } 7 | { 8 | - x == 1: one 9 | - x == 2: two 10 | - other 11 | } 12 | { x == 4: 13 | - The main clause 14 | - else: other 15 | } 16 | { x == 4: 17 | The main clause 18 | - else: 19 | other 20 | } 21 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/conditions/empty_multiline_conditional_branch.ink: -------------------------------------------------------------------------------- 1 | { 3: 2 | - 3: 3 | - 4: 4 | txt 5 | } 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/conditions/trivial_condition.ink: -------------------------------------------------------------------------------- 1 | { 2 | - false: 3 | beep 4 | } 5 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/basic_tunnel.ink: -------------------------------------------------------------------------------- 1 | -> f -> 2 | <> world 3 | == f == 4 | Hello 5 | ->-> 6 | 7 | // RESULT: "Hello world\n" 8 | // Continue -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/compare_divert_targets.ink: -------------------------------------------------------------------------------- 1 | VAR to_one = -> one 2 | VAR to_two = -> two 3 | {to_one == to_two:same knot|different knot} 4 | {to_one == to_one:same knot|different knot} 5 | {to_two == to_two:same knot|different knot} 6 | { -> one == -> two:same knot|different knot} 7 | { -> one == to_one:same knot|different knot} 8 | { to_one == -> one:same knot|different knot} 9 | == one 10 | One 11 | -> DONE 12 | === two 13 | Two 14 | -> DONE 15 | 16 | // RESULT: 17 | // different knot\nsame knot\nsame knot\ndifferent knot\nsame knot\nsame knot\n 18 | // ContinueMaximally -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/compiler/disallow_empty_diverts.ink: -------------------------------------------------------------------------------- 1 | -> 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/compiler/divert_not_found_error.ink: -------------------------------------------------------------------------------- 1 | -> knot 2 | 3 | == knot == 4 | Knot. 5 | -> next 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/compiler/divert_to_weave_points.ink: -------------------------------------------------------------------------------- 1 | -> knot.stitch.gather 2 | 3 | == knot == 4 | = stitch 5 | - hello 6 | * (choice) test 7 | choice content 8 | - (gather) 9 | gather 10 | 11 | {stopping: 12 | - -> knot.stitch.choice 13 | - second time round 14 | } 15 | 16 | -> END 17 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/complex_tunnels.ink: -------------------------------------------------------------------------------- 1 | -> one (1) -> two (2) -> 2 | three (3) 3 | == one(num) == 4 | one ({num}) 5 | -> oneAndAHalf (1.5) -> 6 | ->-> 7 | == oneAndAHalf(num) == 8 | one and a half ({num}) 9 | ->-> 10 | == two (num) == 11 | two ({num}) 12 | ->-> 13 | 14 | // RESULT: 15 | // one (1)\none and a half (1.5)\ntwo (2)\nthree (3)\n 16 | // ContinueMaximally 17 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/divert_in_conditional.ink: -------------------------------------------------------------------------------- 1 | === intro 2 | = top 3 | { main: -> done } 4 | -> END 5 | = main 6 | -> top 7 | = done 8 | -> END 9 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/divert_targets_with_parameters.ink: -------------------------------------------------------------------------------- 1 | VAR x = ->place 2 | ->x (5) 3 | == place (a) == 4 | {a} 5 | -> DONE 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/divert_to_weave_points.ink: -------------------------------------------------------------------------------- 1 | -> knot.stitch.gather 2 | == knot == 3 | = stitch 4 | - hello 5 | * (choice) test 6 | choice content 7 | - (gather) 8 | gather 9 | {stopping: 10 | - -> knot.stitch.choice 11 | - second time round 12 | } 13 | -> END 14 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/done_stops_thread.ink: -------------------------------------------------------------------------------- 1 | -> DONE 2 | This content is inaccessible. 3 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/path_to_self.ink: -------------------------------------------------------------------------------- 1 | - (dododo) 2 | -> tunnel -> 3 | -> dododo 4 | == tunnel 5 | + A 6 | ->-> 7 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/same_line_divert_is_inline.ink: -------------------------------------------------------------------------------- 1 | -> hurry_home 2 | === hurry_home === 3 | We hurried home to Savile Row -> as_fast_as_we_could 4 | === as_fast_as_we_could === 5 | as fast as we could. 6 | -> DONE 7 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/tunnel_onwards_after_tunnel.ink: -------------------------------------------------------------------------------- 1 | -> tunnel1 -> 2 | The End. 3 | -> END 4 | == tunnel1 == 5 | Hello... 6 | -> tunnel2 ->-> 7 | == tunnel2 == 8 | ...world. 9 | ->-> 10 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/tunnel_onwards_divert_after_with_arg.ink: -------------------------------------------------------------------------------- 1 | -> a -> 2 | === a === 3 | ->-> b (5 + 3) 4 | === b (x) === 5 | {x} 6 | -> END 7 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/tunnel_onwards_divert_override.ink: -------------------------------------------------------------------------------- 1 | -> A -> 2 | We will never return to here! 3 | == A == 4 | This is A 5 | ->-> B 6 | == B == 7 | Now in B. 8 | -> END 9 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/tunnel_onwards_to_variable_divert_target.ink: -------------------------------------------------------------------------------- 1 | -> outer -> 2 | == outer 3 | This is outer 4 | -> cut_to(-> the_esc) 5 | === cut_to(-> escape) 6 | ->-> escape 7 | 8 | == the_esc 9 | This is the_esc 10 | -> END -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/tunnel_onwards_with_param_default_choice.ink: -------------------------------------------------------------------------------- 1 | -> tunnel -> 2 | == tunnel == 3 | * ->-> elsewhere (8) 4 | == elsewhere (x) == 5 | {x} 6 | -> END 7 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/diverts/tunnel_vs_thread_behaviour.ink: -------------------------------------------------------------------------------- 1 | -> knot_with_options -> 2 | Finished tunnel. 3 | Starting thread. 4 | <- thread_with_options 5 | * E 6 | - 7 | Done. 8 | == knot_with_options == 9 | * A 10 | * B 11 | - 12 | ->-> 13 | == thread_with_options == 14 | * C 15 | * D 16 | - -> DONE 17 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/evaluation/arithmetic.ink: -------------------------------------------------------------------------------- 1 | { 2 * 3 + 5 * 6 } 2 | {8 mod 3} 3 | {13 % 5} 4 | { 7 / 3 } 5 | { 7 / 3.0 } 6 | { 10 - 2 } 7 | { 2 * (5-1) } 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/evaluation/basic_string_literals.ink: -------------------------------------------------------------------------------- 1 | VAR x = "Hello world 1" 2 | {x} 3 | Hello {"world"} 2. 4 | 5 | // RESULT: "Hello world 1\nHello world 2.\n 6 | // ContinueMaximally -------------------------------------------------------------------------------- /src/tests/inkfiles/original/evaluation/evaluating_function_variable_state_bug.ink: -------------------------------------------------------------------------------- 1 | Start 2 | -> tunnel -> 3 | End 4 | -> END 5 | == tunnel == 6 | In tunnel. 7 | ->-> 8 | === function function_to_evaluate() === 9 | { zero_equals_(1): 10 | ~ return "WRONG" 11 | - else: 12 | ~ return "RIGHT" 13 | } 14 | === function zero_equals_(k) === 15 | ~ do_nothing(0) 16 | ~ return (0 == k) 17 | === function do_nothing(k) 18 | ~ return 0 19 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/evaluation/evaluating_ink_functions_from_game.ink: -------------------------------------------------------------------------------- 1 | Top level content 2 | * choice 3 | == somewhere == 4 | = here 5 | -> DONE 6 | == function test == 7 | ~ return -> somewhere.here 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/evaluation/evaluating_ink_functions_from_game_2.ink: -------------------------------------------------------------------------------- 1 | One 2 | Two 3 | Three 4 | == function func1 == 5 | This is a function 6 | ~ return 5 7 | == function func2 == 8 | This is a function without a return value 9 | ~ return 10 | == function add(x,y) == 11 | x = {x}, y = {y} 12 | ~ return x + y 13 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/evaluation/evaluation_stack_leaks.ink: -------------------------------------------------------------------------------- 1 | {false: 2 | 3 | - else: 4 | else 5 | } 6 | {6: 7 | - 5: five 8 | - else: else 9 | } 10 | -> onceTest -> 11 | -> onceTest -> 12 | == onceTest == 13 | {once: 14 | - hi 15 | } 16 | ->-> 17 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/evaluation/factorial_by_reference.ink: -------------------------------------------------------------------------------- 1 | VAR result = 0 2 | ~ factorialByRef(result, 5) 3 | { result } 4 | == function factorialByRef(ref r, n) == 5 | { r == 0: 6 | ~ r = 1 7 | } 8 | { n > 1: 9 | ~ r = r * n 10 | ~ factorialByRef(r, n-1) 11 | } 12 | ~ return 13 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/evaluation/factorial_recursive.ink: -------------------------------------------------------------------------------- 1 | { factorial(5) } 2 | == function factorial(n) == 3 | { n == 1: 4 | ~ return 1 5 | - else: 6 | ~ return (n * factorial(n-1)) 7 | } 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/evaluation/increment.ink: -------------------------------------------------------------------------------- 1 | VAR x = 5 2 | ~ x++ 3 | {x} 4 | ~ x-- 5 | {x} 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/evaluation/literal_unary.ink: -------------------------------------------------------------------------------- 1 | VAR negativeLiteral = -1 2 | VAR negativeLiteral2 = not not false 3 | VAR negativeLiteral3 = !(0) 4 | {negativeLiteral} 5 | {negativeLiteral2} 6 | {negativeLiteral3} 7 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/extra/arithmetic_2.ink: -------------------------------------------------------------------------------- 1 | { 7 / 3 } 2 | { 7 / 3.0 } 3 | { 7 / FLOAT(3.0) } 4 | 5 | { 7.0 / 3 } 6 | { 7.0 / 3.0 } 7 | { FLOAT(7.0) / 3.0 } 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/extra/list_comparison.ink: -------------------------------------------------------------------------------- 1 | VAR currentActor = "Bobby" 2 | 3 | LIST listOfActors = P, A, S, C 4 | VAR s = -> set_actor 5 | -> start 6 | 7 | ===function set_actor(x) 8 | { x: 9 | - P: ~ currentActor = "Philippe" 10 | - A: ~ currentActor = "Andre" 11 | - else: ~ currentActor = "Bobby" 12 | } 13 | 14 | === start === 15 | {s(P)} Hey, my name is {currentActor}. What about yours? 16 | {s(A)} I am {currentActor} and I need my rheumatism pills! 17 | {s(P)} Would you like me, {currentActor}, to get some more for you? 18 | -> END 19 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/functions/compiler/argument_name_collisions.ink: -------------------------------------------------------------------------------- 1 | VAR global_var = 5 2 | 3 | ~ pass_divert(-> knot_name) 4 | {variable_param_test(10)} 5 | 6 | === function aTarget() === 7 | ~ return true 8 | 9 | === function pass_divert(aTarget) === 10 | Should be a divert target, but is a read count:- {aTarget} 11 | 12 | === function variable_param_test(global_var) === 13 | ~ return global_var 14 | 15 | === knot_name === 16 | -> END 17 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/functions/compiler/argument_shouldnt_conflict_with_gather_elsewhere.ink: -------------------------------------------------------------------------------- 1 | == knot == 2 | - (x) -> DONE 3 | 4 | == function f(x) == 5 | Nothing 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/functions/compiler/function_call_restrictions.ink: -------------------------------------------------------------------------------- 1 | // Allowed to do this 2 | ~ myFunc() 3 | 4 | // Not allowed to to this 5 | ~ aKnot() 6 | 7 | // Not allowed to do this 8 | -> myFunc 9 | 10 | == function myFunc == 11 | This is a function. 12 | ~ return 13 | 14 | == aKnot == 15 | This is a normal knot. 16 | -> END 17 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/functions/compiler/function_purity_checks.ink: -------------------------------------------------------------------------------- 1 | -> test 2 | 3 | == test == 4 | ~ myFunc() 5 | = function myBadInnerFunc 6 | Not allowed! 7 | ~ return 8 | 9 | == function myFunc == 10 | Hello world 11 | * a choice 12 | * another choice 13 | - 14 | -> myFunc 15 | = testStitch 16 | This is a stitch 17 | ~ return 18 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/functions/compiler/using_function_and_increment_together.ink: -------------------------------------------------------------------------------- 1 | VAR x = 5 2 | ~ x += one() 3 | 4 | === function one() 5 | ~ return 1 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/functions/compiler/wrong_variable_divert_target_reference.ink: -------------------------------------------------------------------------------- 1 | -> go_to_broken(-> SOMEWHERE) 2 | 3 | == go_to_broken(-> b) 4 | -> go_to(-> b) // INSTEAD OF: -> go_to(b) 5 | 6 | == go_to(-> a) 7 | -> a 8 | 9 | == SOMEWHERE == 10 | Should be able to get here! 11 | -> DONE 12 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/glue/implicit_inline_glue.ink: -------------------------------------------------------------------------------- 1 | I have {five()} eggs. 2 | == function five == 3 | {false: 4 | Don't print this 5 | } 6 | five 7 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/glue/implicit_inline_glue_b.ink: -------------------------------------------------------------------------------- 1 | A {f():B} 2 | X 3 | === function f() === 4 | {true: 5 | ~ return false 6 | } 7 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/glue/implicit_inline_glue_c.ink: -------------------------------------------------------------------------------- 1 | A 2 | {f():X} 3 | C 4 | === function f() 5 | { true: 6 | ~ return false 7 | } 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/glue/left_right_glue_matching.ink: -------------------------------------------------------------------------------- 1 | A line. 2 | { f(): 3 | Another line. 4 | } 5 | == function f == 6 | {false:nothing} 7 | ~ return true 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/glue/simple_glue.ink: -------------------------------------------------------------------------------- 1 | Some <> 2 | content<> with glue. 3 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/knots/compiler/knot_termination_skips_global_objects.ink: -------------------------------------------------------------------------------- 1 | === stuff === 2 | -> END 3 | 4 | VAR X = 1 5 | CONST Y = 2 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/knots/knot_do_not_gather.ink: -------------------------------------------------------------------------------- 1 | -> knot 2 | === knot 3 | -> knot.gather 4 | - (gather) g 5 | -> DONE 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/knots/knot_stitch_gather_counts.ink: -------------------------------------------------------------------------------- 1 | VAR knotCount = 0 2 | VAR stitchCount = 0 3 | -> gather_count_test -> 4 | ~ knotCount = 0 5 | -> knot_count_test -> 6 | ~ knotCount = 0 7 | -> knot_count_test -> 8 | -> stitch_count_test -> 9 | == gather_count_test == 10 | VAR gatherCount = 0 11 | - (loop) 12 | ~ gatherCount++ 13 | {gatherCount} {loop} 14 | {gatherCount<3:->loop} 15 | ->-> 16 | == knot_count_test == 17 | ~ knotCount++ 18 | {knotCount} {knot_count_test} 19 | {knotCount<3:->knot_count_test} 20 | ->-> 21 | == stitch_count_test == 22 | ~ stitchCount = 0 23 | -> stitch -> 24 | ~ stitchCount = 0 25 | -> stitch -> 26 | ->-> 27 | = stitch 28 | ~ stitchCount++ 29 | {stitchCount} {stitch} 30 | {stitchCount<3:->stitch} 31 | ->-> 32 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/knots/knot_thread_interaction.ink: -------------------------------------------------------------------------------- 1 | -> knot 2 | === knot 3 | <- threadB 4 | -> tunnel -> 5 | THE END 6 | -> END 7 | === tunnel 8 | - blah blah 9 | * wigwag 10 | - ->-> 11 | === threadB 12 | * option 13 | - something 14 | -> DONE 15 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/knots/knot_thread_interaction_2.ink: -------------------------------------------------------------------------------- 1 | -> knot 2 | === knot 3 | <- threadA 4 | When should this get printed? 5 | -> DONE 6 | === threadA 7 | -> tunnel -> 8 | Finishing thread. 9 | -> DONE 10 | === tunnel 11 | - I’m in a tunnel 12 | * I’m an option 13 | - ->-> 14 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/knots/stitch_naming_collision.ink: -------------------------------------------------------------------------------- 1 | VAR stitch = 0 2 | 3 | == knot == 4 | = stitch 5 | ->DONE 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/lists/contains_empty_list_always_false.ink: -------------------------------------------------------------------------------- 1 | LIST list = (a), b 2 | {list ? ()} 3 | {() ? ()} 4 | {() ? list} -------------------------------------------------------------------------------- /src/tests/inkfiles/original/lists/empty_list_origin.ink: -------------------------------------------------------------------------------- 1 | LIST list = a, b 2 | {LIST_ALL(list)} 3 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/lists/empty_list_origin_after_assignment.ink: -------------------------------------------------------------------------------- 1 | LIST x = a, b, c 2 | ~ x = () 3 | {LIST_ALL(x)} 4 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/lists/list_basic_operations.ink: -------------------------------------------------------------------------------- 1 | LIST list = a, (b), c, (d), e 2 | {list} 3 | {(a, c) + (b, e)} 4 | {(a, b, c) ^ (c, b, e)} 5 | {list ? (b, d, e)} 6 | {list ? (d, b)} 7 | {list !? (c)} 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/lists/list_mixed_items.ink: -------------------------------------------------------------------------------- 1 | LIST list = (a), b, (c), d, e 2 | LIST list2 = x, (y), z 3 | {list + list2} 4 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/lists/list_random.ink: -------------------------------------------------------------------------------- 1 | LIST l = A, (B), (C), (D), E 2 | {LIST_RANDOM(l)} 3 | {LIST_RANDOM (l)} 4 | {LIST_RANDOM (l)} 5 | {LIST_RANDOM (l)} 6 | {LIST_RANDOM (l)} 7 | {LIST_RANDOM (l)} 8 | {LIST_RANDOM (l)} 9 | {LIST_RANDOM (l)} 10 | {LIST_RANDOM (l)} 11 | {LIST_RANDOM (l)} 12 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/lists/list_range.ink: -------------------------------------------------------------------------------- 1 | LIST Food = Pizza, Pasta, Curry, Paella 2 | LIST Currency = Pound, Euro, Dollar 3 | LIST Numbers = One, Two, Three, Four, Five, Six, Seven 4 | VAR all = () 5 | ~ all = LIST_ALL(Food) + LIST_ALL(Currency) 6 | {all} 7 | {LIST_RANGE(all, 2, 3)} 8 | {LIST_RANGE(LIST_ALL(Numbers), Two, Six)} 9 | {LIST_RANGE(LIST_ALL(Numbers), Currency, Three)} 10 | {LIST_RANGE(LIST_ALL(Numbers), 2, Four)} // mix int and list 11 | {LIST_RANGE(LIST_ALL(Numbers), Two, 5)} // mix list and int 12 | {LIST_RANGE((Pizza, Pasta), -1, 100)} // allow out of range 13 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/lists/list_save_load.ink: -------------------------------------------------------------------------------- 1 | LIST l1 = (a), b, (c) 2 | LIST l2 = (x), y, z 3 | VAR t = () 4 | ~ t = l1 + l2 5 | {t} 6 | == elsewhere == 7 | ~ t += z 8 | {t} 9 | -> END 10 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/lists/more_list_operations.ink: -------------------------------------------------------------------------------- 1 | LIST list = l, m = 5, n 2 | {LIST_VALUE(l)} 3 | {list(1)} 4 | ~ temp t = list() 5 | ~ t += n 6 | {t} 7 | ~ t = LIST_ALL(t) 8 | ~ t -= n 9 | {t} 10 | ~ t = LIST_INVERT(t) 11 | {t} 12 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/logic/logic_lines_with_newlines.ink: -------------------------------------------------------------------------------- 1 | ~ func () 2 | text 2 3 | ~ temp tempVar = func () 4 | text 2 5 | == function func () 6 | text1 7 | ~ return true 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/logic/multiline_logic_with_glue.ink: -------------------------------------------------------------------------------- 1 | {true: 2 | a 3 | } <> b 4 | {true: 5 | a 6 | } <> { true: 7 | b 8 | } 9 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/logic/nested_pass_by_reference.ink: -------------------------------------------------------------------------------- 1 | VAR globalVal = 5 2 | {globalVal} 3 | ~ squaresquare(globalVal) 4 | {globalVal} 5 | == function squaresquare(ref x) == 6 | {square(x)} {square(x)} 7 | ~ return 8 | == function square(ref x) == 9 | ~ x = x * x 10 | ~ return 11 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/author_warnings_inside_content_list_bug.ink: -------------------------------------------------------------------------------- 1 | { once: 2 | - a 3 | TODO: b 4 | } 5 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/compiler/empty_thread_error.ink: -------------------------------------------------------------------------------- 1 | <- 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/compiler/end_of_content_function.ink: -------------------------------------------------------------------------------- 1 | == function test == 2 | -> END -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/compiler/end_of_content_return_statement.ink: -------------------------------------------------------------------------------- 1 | == test == 2 | ~return 3 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/compiler/end_of_content_without_end.ink: -------------------------------------------------------------------------------- 1 | == test == 2 | Content 3 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/compiler/loose_ends.ink: -------------------------------------------------------------------------------- 1 | No loose ends in main content. 2 | 3 | == knot1 == 4 | * loose end choice 5 | * loose end 6 | on second line of choice 7 | 8 | == knot2 == 9 | * A 10 | * B 11 | TODO: Fix loose ends but don't warn 12 | 13 | == knot3 == 14 | Loose end when there's no weave 15 | 16 | == knot4 == 17 | {true: 18 | {false: 19 | Ignore loose end when there's a divert 20 | in a conditional. 21 | -> knot4 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/compiler/return_text_warning.ink: -------------------------------------------------------------------------------- 1 | == test == 2 | return something 3 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/empty.ink: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/y-lohse/inkjs/a1259bddd5155bd5896d6b21dcb87a2a6bedfe2e/src/tests/inkfiles/original/misc/empty.ink -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/end.ink: -------------------------------------------------------------------------------- 1 | hello 2 | -> END 3 | world 4 | -> END 5 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/end2.ink: -------------------------------------------------------------------------------- 1 | -> test 2 | == test == 3 | hello 4 | -> END 5 | world 6 | -> END 7 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/end_of_content_hello_world.ink: -------------------------------------------------------------------------------- 1 | Hello world -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/end_of_content_with_end.ink: -------------------------------------------------------------------------------- 1 | == test == 2 | Content 3 | -> END 4 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/end_of_content_without_end.ink: -------------------------------------------------------------------------------- 1 | == test == 2 | Content 3 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/escape_character.ink: -------------------------------------------------------------------------------- 1 | {true:this is a '\|' character|this isn't} 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/hello_world.ink: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/identifiers_can_start_with_number.ink: -------------------------------------------------------------------------------- 1 | -> 2tests 2 | == 2tests == 3 | ~ temp 512x2 = 512 * 2 4 | ~ temp 512x2p2 = 512x2 + 2 5 | 512x2 = {512x2} 6 | 512x2p2 = {512x2p2} 7 | -> DONE 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/include.ink: -------------------------------------------------------------------------------- 1 | INCLUDE includes/included_file.ink 2 | INCLUDE includes/included_file_2.ink 3 | This is the main file. -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/includes/included_file.ink: -------------------------------------------------------------------------------- 1 | This is include 1. 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/includes/included_file_2.ink: -------------------------------------------------------------------------------- 1 | This is include 2. 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/includes/included_file_3.ink: -------------------------------------------------------------------------------- 1 | INCLUDE includes/included_file_4.ink 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/includes/included_file_4.ink: -------------------------------------------------------------------------------- 1 | VAR t2 = 5 2 | 3 | The value of a variable in test file 2 is { t2 }. 4 | 5 | == knot_in_2 == 6 | The value when accessed from knot_in_2 is { t2 }. 7 | -> END 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/nested_include.ink: -------------------------------------------------------------------------------- 1 | INCLUDE includes/included_file_3.ink 2 | This is the main file 3 | -> knot_in_2 4 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/quote_character_significance.ink: -------------------------------------------------------------------------------- 1 | My name is "{"J{"o"}e"}" 2 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/misc/whitespace.ink: -------------------------------------------------------------------------------- 1 | -> firstKnot 2 | === firstKnot 3 | Hello! 4 | -> anotherKnot 5 | === anotherKnot 6 | World. 7 | -> END 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/multiflow/multi_flow_basics.ink: -------------------------------------------------------------------------------- 1 | === knot1 2 | knot 1 line 1 3 | knot 1 line 2 4 | -> END 5 | 6 | === knot2 7 | knot 2 line 1 8 | knot 2 line 2 9 | -> END 10 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/multiflow/multi_flow_save_load_threads.ink: -------------------------------------------------------------------------------- 1 | Default line 1 2 | Default line 2 3 | 4 | == red == 5 | Hello I'm red 6 | <- thread1("red") 7 | <- thread2("red") 8 | -> DONE 9 | 10 | == blue == 11 | Hello I'm blue 12 | <- thread1("blue") 13 | <- thread2("blue") 14 | -> DONE 15 | 16 | == thread1(name) == 17 | + Thread 1 {name} choice 18 | -> thread1Choice(name) 19 | 20 | == thread2(name) == 21 | + Thread 2 {name} choice 22 | -> thread2Choice(name) 23 | 24 | == thread1Choice(name) == 25 | After thread 1 choice ({name}) 26 | -> END 27 | 28 | == thread2Choice(name) == 29 | After thread 2 choice ({name}) 30 | -> END 31 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/newlines/newline_at_start_of_multiline_conditional.ink: -------------------------------------------------------------------------------- 1 | {isTrue(): 2 | x 3 | } 4 | === function isTrue() 5 | X 6 | ~ return true 7 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/newlines/newline_consistency_1.ink: -------------------------------------------------------------------------------- 1 | hello -> world 2 | == world 3 | world 4 | -> END 5 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/newlines/newline_consistency_2.ink: -------------------------------------------------------------------------------- 1 | * hello -> world 2 | == world 3 | world 4 | -> END 5 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/newlines/newline_consistency_3.ink: -------------------------------------------------------------------------------- 1 | * hello 2 | -> world 3 | == world 4 | world 5 | -> END 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/newlines/newlines_trimming_with_func_external_fallback.ink: -------------------------------------------------------------------------------- 1 | EXTERNAL TRUE () 2 | Phrase 1 3 | { TRUE (): 4 | Phrase 2 5 | } 6 | -> END 7 | === function TRUE () 8 | ~ return true 9 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/newlines/newlines_with_string_eval.ink: -------------------------------------------------------------------------------- 1 | A 2 | ~temp someTemp = string() 3 | B 4 | A 5 | {string()} 6 | B 7 | === function string() 8 | ~ return "{3}" 9 | } 10 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/sequences/all_sequence_types.ink: -------------------------------------------------------------------------------- 1 | ~ SEED_RANDOM(1) 2 | 3 | Once: {f_once()} {f_once()} {f_once()} {f_once()} 4 | Stopping: {f_stopping()} {f_stopping()} {f_stopping()} {f_stopping()} 5 | Default: {f_default()} {f_default()} {f_default()} {f_default()} 6 | Cycle: {f_cycle()} {f_cycle()} {f_cycle()} {f_cycle()} 7 | Shuffle: {f_shuffle()} {f_shuffle()} {f_shuffle()} {f_shuffle()} 8 | Shuffle stopping: {f_shuffle_stopping()} {f_shuffle_stopping()} {f_shuffle_stopping()} {f_shuffle_stopping()} 9 | Shuffle once: {f_shuffle_once()} {f_shuffle_once()} {f_shuffle_once()} {f_shuffle_once()} 10 | 11 | == function f_once == 12 | {once: 13 | - one 14 | - two 15 | } 16 | 17 | == function f_stopping == 18 | {stopping: 19 | - one 20 | - two 21 | } 22 | 23 | == function f_default == 24 | {one|two} 25 | 26 | == function f_cycle == 27 | {cycle: 28 | - one 29 | - two 30 | } 31 | 32 | == function f_shuffle == 33 | {shuffle: 34 | - one 35 | - two 36 | } 37 | 38 | == function f_shuffle_stopping == 39 | {stopping shuffle: 40 | - one 41 | - two 42 | - final 43 | } 44 | 45 | == function f_shuffle_once == 46 | {shuffle once: 47 | - one 48 | - two 49 | } 50 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/sequences/blanks_in_inline_sequences.ink: -------------------------------------------------------------------------------- 1 | 1. -> seq1 -> 2 | 2. -> seq1 -> 3 | 3. -> seq1 -> 4 | 4. -> seq1 -> 5 | \--- 6 | 1. -> seq2 -> 7 | 2. -> seq2 -> 8 | 3. -> seq2 -> 9 | \--- 10 | 1. -> seq3 -> 11 | 2. -> seq3 -> 12 | 3. -> seq3 -> 13 | \--- 14 | 1. -> seq4 -> 15 | 2. -> seq4 -> 16 | 3. -> seq4 -> 17 | == seq1 == 18 | {a||b} 19 | ->-> 20 | == seq2 == 21 | {|a} 22 | ->-> 23 | == seq3 == 24 | {a|} 25 | ->-> 26 | == seq4 == 27 | {|} 28 | ->-> 29 | 30 | // RESULT: 31 | // 1. a 32 | // 2. 33 | // 3. b 34 | // 4. b 35 | // --- 36 | // 1. 37 | // 2. a 38 | // 3. a 39 | // --- 40 | // 1. a 41 | // 2. 42 | // 3. 43 | // --- 44 | // 1. 45 | // 2. 46 | // 3. 47 | // ContinueMaximally 48 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/sequences/empty_sequence_content.ink: -------------------------------------------------------------------------------- 1 | -> thing -> 2 | -> thing -> 3 | -> thing -> 4 | -> thing -> 5 | -> thing -> 6 | Done. 7 | == thing == 8 | {once: 9 | - Wait for it.... 10 | - 11 | - 12 | - Surprise! 13 | } 14 | ->-> 15 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/sequences/gather_read_count_with_initial_sequence.ink: -------------------------------------------------------------------------------- 1 | - (opts) 2 | {test:seen test} 3 | - (test) 4 | { -> opts |} 5 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/sequences/leading_newline_multiline_sequence.ink: -------------------------------------------------------------------------------- 1 | {stopping: 2 | - a line after an empty line 3 | - blah 4 | } 5 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/sequences/shuffle_stack_muddying.ink: -------------------------------------------------------------------------------- 1 | * {condFunc()} [choice 1] 2 | * {condFunc()} [choice 2] 3 | * {condFunc()} [choice 3] 4 | * {condFunc()} [choice 4] 5 | === function condFunc() === 6 | {shuffle: 7 | - ~ return false 8 | - ~ return true 9 | - ~ return true 10 | - ~ return false 11 | } 12 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/strings/string_constants.ink: -------------------------------------------------------------------------------- 1 | {x} 2 | VAR x = kX 3 | CONST kX = "hi" 4 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/strings/string_contains.ink: -------------------------------------------------------------------------------- 1 | {"hello world" ? "o wo"} 2 | {"hello world" ? "something else"} 3 | {"hello" ? ""} 4 | {"" ? ""} 5 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/strings/string_type_coercion.ink: -------------------------------------------------------------------------------- 1 | {"5" == 5:same|different} 2 | {"blah" == 5:same|different} 3 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/strings/strings_in_choices.ink: -------------------------------------------------------------------------------- 1 | * \ {"test1"} ["test2 {"test3"}"] {"test4"} 2 | -> DONE 3 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/tags/tags.ink: -------------------------------------------------------------------------------- 1 | VAR x = 2 2 | # author: Joe 3 | # title: My Great Story 4 | This is the content 5 | == knot == 6 | # knot tag 7 | Knot content 8 | # end of knot tag 9 | -> END 10 | = stitch 11 | # stitch tag 12 | Stitch content 13 | # this tag is below some content so isn't included in the static tags for the stitch 14 | -> END 15 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/tags/tags_dynamic_content.ink: -------------------------------------------------------------------------------- 1 | tag # pic{5+3}{red|blue}.jpg -------------------------------------------------------------------------------- /src/tests/inkfiles/original/tags/tags_in_seq.ink: -------------------------------------------------------------------------------- 1 | -> knot -> knot -> 2 | == knot 3 | A {red #red|white #white|blue #blue|green #green} sequence. 4 | ->-> -------------------------------------------------------------------------------- /src/tests/inkfiles/original/threads/multi_thread.ink: -------------------------------------------------------------------------------- 1 | -> start 2 | == start == 3 | -> tunnel -> 4 | The end 5 | -> END 6 | == tunnel == 7 | <- place1 8 | <- place2 9 | -> DONE 10 | == place1 == 11 | This is place 1. 12 | * choice in place 1 13 | - ->-> 14 | == place2 == 15 | This is place 2. 16 | * choice in place 2 17 | - ->-> 18 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/threads/thread_done.ink: -------------------------------------------------------------------------------- 1 | This is a thread example 2 | <- example_thread 3 | The example is now complete. 4 | == example_thread == 5 | Hello. 6 | -> DONE 7 | World. 8 | -> DONE 9 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/threads/thread_in_logic.ink: -------------------------------------------------------------------------------- 1 | -> once -> 2 | -> once -> 3 | == once == 4 | {<- content|} 5 | ->-> 6 | == content == 7 | Content 8 | -> DONE 9 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/threads/top_flow_terminator_should_not_kill_thread_choices.ink: -------------------------------------------------------------------------------- 1 | <- move 2 | Limes 3 | === move 4 | * boop 5 | -> END 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/compiler/const_redefinition.ink: -------------------------------------------------------------------------------- 1 | CONST pi = 3.1415 2 | CONST pi = 3.1415 3 | 4 | CONST x = "Hello" 5 | CONST x = "World" 6 | 7 | CONST y = 3 8 | CONST y = 3.0 9 | 10 | CONST z = -> somewhere 11 | CONST z = -> elsewhere 12 | 13 | == somewhere == 14 | -> DONE 15 | 16 | == elsewhere == 17 | -> DONE 18 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/compiler/require_variable_targets_typed.ink: -------------------------------------------------------------------------------- 1 | -> test(-> elsewhere) 2 | 3 | == test(varTarget) == 4 | -> varTarget -> 5 | -> DONE 6 | 7 | == elsewhere == 8 | ->-> 9 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/compiler/temp_not_allowed_cross_stitch.ink: -------------------------------------------------------------------------------- 1 | -> knot.stitch 2 | 3 | == knot (y) == 4 | ~temp x = 5 5 | -> END 6 | 7 | = stitch 8 | {x} {y} 9 | -> END 10 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/compiler/variable_naming_collision_with_arg.ink: -------------------------------------------------------------------------------- 1 | === function knot (a) 2 | ~temp a = 1 3 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/compiler/variable_naming_collision_with_flow.ink: -------------------------------------------------------------------------------- 1 | LIST someList = A, B 2 | 3 | ~temp heldItems = (A) 4 | {LIST_COUNT (heldItems)} 5 | 6 | === function heldItems () 7 | ~ return (A) 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/const.ink: -------------------------------------------------------------------------------- 1 | VAR x = c 2 | CONST c = 5 3 | {x} 4 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/multiple_constant_references.ink: -------------------------------------------------------------------------------- 1 | CONST CONST_STR = "ConstantString" 2 | VAR varStr = CONST_STR 3 | {varStr == CONST_STR:success} 4 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/set_non_existent_variable.ink: -------------------------------------------------------------------------------- 1 | VAR x = "world" 2 | Hello {x}. 3 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/temp_global_conflict.ink: -------------------------------------------------------------------------------- 1 | -> outer 2 | === outer 3 | ~ temp x = 0 4 | ~ f(x) 5 | {x} 6 | -> DONE 7 | === function f(ref x) 8 | ~temp local = 0 9 | ~x=x 10 | {setTo3(local)} 11 | === function setTo3(ref x) 12 | ~x = 3 13 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/temp_not_found.ink: -------------------------------------------------------------------------------- 1 | {x} 2 | ~temp x = 5 3 | hello 4 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/temp_usage_in_options.ink: -------------------------------------------------------------------------------- 1 | ~ temp one = 1 2 | * \ {one} 3 | - End of choice 4 | -> another 5 | * (another) this [is] another 6 | -> DONE 7 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/temporaries_at_global_scope.ink: -------------------------------------------------------------------------------- 1 | VAR x = 5 2 | ~ temp y = 4 3 | {x}{y} 4 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/variable_declaration_in_conditional.ink: -------------------------------------------------------------------------------- 1 | VAR x = 0 2 | {true: 3 | - ~ x = 5 4 | } 5 | {x} 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/variable_divert_target.ink: -------------------------------------------------------------------------------- 1 | VAR x = -> here 2 | -> there 3 | == there == 4 | -> x 5 | == here == 6 | Here. 7 | -> DONE 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/variable_get_set_api.ink: -------------------------------------------------------------------------------- 1 | VAR x = 5 2 | {x} 3 | * [choice] 4 | - 5 | {x} 6 | * [choice] 7 | - 8 | {x} 9 | * [choice] 10 | - 11 | {x} 12 | -> DONE 13 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/variable_name_colision_with_flow.ink: -------------------------------------------------------------------------------- 1 | LIST someList = A, B 2 | 3 | ~temp heldItems = (A) 4 | {LIST_COUNT (heldItems)} 5 | 6 | === function heldItems () 7 | ~ return (A) 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/variable_name_collision_with_arg.ink: -------------------------------------------------------------------------------- 1 | === function knot (a) 2 | ~temp a = 1" 3 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/variable_pointer_ref_from_knot.ink: -------------------------------------------------------------------------------- 1 | VAR val = 5 2 | -> knot -> 3 | -> END 4 | == knot == 5 | ~ inc(val) 6 | {val} 7 | ->-> 8 | == function inc(ref x) == 9 | ~ x = x + 1 10 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/variable_swap_recurse.ink: -------------------------------------------------------------------------------- 1 | ~ f(1, 1) 2 | == function f(x, y) == 3 | { x == 1 and y == 1: 4 | ~ x = 2 5 | ~ f(y, x) 6 | - else: 7 | {x} {y} 8 | } 9 | ~ return 10 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/variable_tunnel.ink: -------------------------------------------------------------------------------- 1 | -> one_then_tother(-> tunnel) 2 | === one_then_tother(-> x) === 3 | -> x -> end 4 | === tunnel === 5 | STUFF 6 | ->-> 7 | === end === 8 | -> END -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/warn_variable_not_found_1.ink: -------------------------------------------------------------------------------- 1 | VAR x = 0 2 | Hello world! 3 | {x} 4 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/variables/warn_variable_not_found_2.ink: -------------------------------------------------------------------------------- 1 | VAR y = 0 2 | Hello world! 3 | {y} 4 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/weaves/conditional_choice_in_weave.ink: -------------------------------------------------------------------------------- 1 | - start 2 | { 3 | - true: * [go to a stitch] -> a_stitch 4 | } 5 | - gather should be seen 6 | -> DONE 7 | 8 | = a_stitch 9 | result 10 | -> END 11 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/weaves/conditional_choice_in_weave_2.ink: -------------------------------------------------------------------------------- 1 | - first gather 2 | * [option 1] 3 | * [option 2] 4 | - the main gather 5 | {false: 6 | * unreachable option -> END 7 | } 8 | - bottom gather 9 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/weaves/unbalanced_weave_indentation.ink: -------------------------------------------------------------------------------- 1 | * * * First 2 | * * * * Very indented 3 | - - End 4 | -> END 5 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/weaves/weave_gathers.ink: -------------------------------------------------------------------------------- 1 | - 2 | * one 3 | * * two 4 | - - three 5 | * four 6 | - - five 7 | - six 8 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/weaves/weave_options.ink: -------------------------------------------------------------------------------- 1 | -> test 2 | === test 3 | * Hello[.], world. 4 | -> END -------------------------------------------------------------------------------- /src/tests/inkfiles/original/weaves/weave_point_naming_collision.ink: -------------------------------------------------------------------------------- 1 | -(opts) 2 | opts1 3 | -(opts) 4 | opts1 5 | -> END 6 | -------------------------------------------------------------------------------- /src/tests/inkfiles/original/weaves/weave_within_sequence.ink: -------------------------------------------------------------------------------- 1 | { shuffle: 2 | - * choice 3 | nextline 4 | -> END 5 | } 6 | -------------------------------------------------------------------------------- /src/tests/specs/ink/CallStack.spec.ts: -------------------------------------------------------------------------------- 1 | import * as testsUtils from "../common"; 2 | 3 | describe("Callstack", () => { 4 | let context: testsUtils.TestContext; 5 | 6 | function compileStory( 7 | name: string, 8 | countAllVisits: boolean = false, 9 | testingErrors: boolean = false 10 | ) { 11 | context = testsUtils.makeDefaultTestContext( 12 | name, 13 | "callstack", 14 | countAllVisits, 15 | testingErrors 16 | ); 17 | } 18 | 19 | afterEach(() => { 20 | context = new testsUtils.TestContext(); 21 | }); 22 | 23 | // TestCallStackEvaluation 24 | it("tests call stack evaluation", () => { 25 | compileStory("callstack_evaluation"); 26 | expect(context.story.Continue()).toBe("8\n"); 27 | }); 28 | 29 | // TestCleanCallstackResetOnPathChoice 30 | it("tests clean callstack reset on path choice", () => { 31 | compileStory("clean_callstack_reset_on_path_choice"); 32 | 33 | expect(context.story.Continue()).toBe("The first line.\n"); 34 | 35 | context.story.ChoosePathString("SomewhereElse"); 36 | 37 | expect(context.story.ContinueMaximally()).toBe("somewhere else\n"); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /src/tests/specs/ink/Extra.spec.ts: -------------------------------------------------------------------------------- 1 | import * as testsUtils from "../common"; 2 | 3 | describe("Extra", () => { 4 | let context: testsUtils.TestContext; 5 | 6 | function compileStory( 7 | name: string, 8 | countAllVisits: boolean = false, 9 | testingErrors: boolean = false 10 | ) { 11 | context = testsUtils.makeDefaultTestContext( 12 | name, 13 | "extra", 14 | countAllVisits, 15 | testingErrors 16 | ); 17 | } 18 | 19 | afterEach(() => { 20 | context = new testsUtils.TestContext(); 21 | }); 22 | 23 | it("tests arithmetic", () => { 24 | compileStory("arithmetic_2"); 25 | 26 | expect(context.story.ContinueMaximally()).toBe( 27 | "2\n2.3333333333333335\n2.3333333333333335\n2.3333333333333335\n2.3333333333333335\n2.3333333333333335\n" 28 | ); 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /src/tests/specs/inkjs/compiler/Stats.spec.ts: -------------------------------------------------------------------------------- 1 | import { Stats } from "../../../../compiler/Stats"; 2 | import { Compiler } from "../../../../ink"; 3 | 4 | function getStats(inkSource: string): Stats { 5 | const compiler = new Compiler(inkSource); 6 | compiler.Compile(); 7 | const stats = compiler.GenerateStats(); 8 | expect(stats).not.toBeNull(); 9 | return stats!; 10 | } 11 | 12 | describe("Stat Generation", () => { 13 | it("basic word count", () => { 14 | const stats = getStats("this is an ink story."); 15 | expect(stats.words).toBe(5); 16 | }); 17 | it("word count doesn't include divert or variable names", () => { 18 | const stats = getStats( 19 | "VAR MyVariable = 3\n->start\n=== start\nthis is an ink story.\n->END" 20 | ); 21 | expect(stats.words).toBe(5); 22 | }); 23 | it("count functions, knots, and stitches", () => { 24 | const stats = getStats( 25 | "->start\n=== function myFunc()\n~ return 0\n=== start\n= stitch\nHello world!" 26 | ); 27 | expect(stats.functions).toBe(1); 28 | expect(stats.knots).toBe(2); 29 | expect(stats.stitches).toBe(1); 30 | }); 31 | it("count diverts", () => { 32 | const stats = getStats("->go\n- (go)\n->next\n-(next)"); 33 | expect(stats.diverts).toBe(2); 34 | }); 35 | it("end counts as a divert", () => { 36 | const stats = getStats("->go\n- (go)\n->next\n-(next)\n->END"); 37 | expect(stats.diverts).toBe(3); 38 | }); 39 | it("count gathers", () => { 40 | const stats = getStats("->go\n- (go)\n->next\n-(next)"); 41 | expect(stats.gathers).toBe(2); 42 | }); 43 | }); 44 | -------------------------------------------------------------------------------- /src/tests/specs/inkjs/engine/Flows.spec.ts: -------------------------------------------------------------------------------- 1 | import * as testsUtils from "../../common"; 2 | 3 | describe("Flow control", () => { 4 | let context: testsUtils.TestContext; 5 | 6 | beforeEach(() => { 7 | context = testsUtils.makeDefaultTestContext("tests", "inkjs", true); 8 | context.story.allowExternalFunctionFallbacks = true; 9 | }); 10 | 11 | it("should go through a tunnel", () => { 12 | context.story.ChoosePathString("flow_control.tunnel_call"); 13 | expect(context.story.Continue()).toEqual("tunnel end\n"); 14 | expect(context.story.canContinue).toBe(false); 15 | }); 16 | 17 | it("should follow threads", () => { 18 | context.story.ChoosePathString("flow_control.thread"); 19 | expect(context.story.Continue()).toEqual("thread start\n"); 20 | expect(context.story.Continue()).toEqual("threaded text\n"); 21 | expect(context.story.Continue()).toEqual("thread end\n"); 22 | 23 | expect(context.story.canContinue).toBe(false); 24 | expect(context.story.currentChoices.length).toEqual(2); 25 | expect(context.story.currentChoices[0].text).toEqual( 26 | "first threaded choice" 27 | ); 28 | expect(context.story.currentChoices[1].text).toEqual( 29 | "second threaded choice" 30 | ); 31 | 32 | context.story.ChooseChoiceIndex(0); 33 | expect(context.story.Continue()).toEqual("first threaded choice\n"); 34 | expect(context.story.canContinue).toBe(false); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /src/tests/specs/setupTests.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | 3 | declare global { 4 | namespace jest { 5 | // eslint-disable-next-line @typescript-eslint/no-unused-vars 6 | interface Matchers { 7 | toContainStringContaining(expected: string): CustomMatcherResult; 8 | } 9 | } 10 | } 11 | 12 | expect.extend({ 13 | toContainStringContaining( 14 | received: Array, 15 | expected: string 16 | ): jest.CustomMatcherResult { 17 | let match = received.find((element) => { 18 | if (element.includes(expected)) { 19 | return true; 20 | } 21 | }); 22 | 23 | if (match !== undefined) { 24 | return { 25 | pass: true, 26 | message: () => `The array contains a string matching '${expected}'.`, 27 | }; 28 | } else { 29 | return { 30 | pass: false, 31 | message: () => 32 | `The array doesn't contain a string element matching '${expected}'. Values: ${JSON.stringify( 33 | received, 34 | null, 35 | "\t" 36 | )}`, 37 | }; 38 | } 39 | }, 40 | }); 41 | -------------------------------------------------------------------------------- /templates/browser_serverless/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | The Intercept 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |

The Intercept

18 |
19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /templates/browser_serverless/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: sans-serif; 3 | font-weight: lighter; 4 | } 5 | 6 | h1 { 7 | text-align: center; 8 | font-weight: lighter; 9 | } 10 | 11 | .container { 12 | display: block; 13 | max-width: 600px; 14 | margin: 0 auto; 15 | padding: 20px; 16 | } 17 | 18 | p, a { 19 | color: gray; 20 | line-height: 1.7em; 21 | font-size: 13pt; 22 | } 23 | 24 | p { 25 | opacity: 0.0; 26 | } 27 | 28 | @media screen and (prefers-reduced-motion: no-preference) { 29 | p { 30 | transition: opacity 1.0s; 31 | } 32 | } 33 | 34 | p.show { 35 | opacity: 1.0; 36 | } 37 | 38 | p.choice { 39 | text-align: center; 40 | } 41 | 42 | a:hover { 43 | color: black; 44 | } -------------------------------------------------------------------------------- /templates/browser_with_server/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | The Intercept 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |

The Intercept

18 |
19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /templates/browser_with_server/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: sans-serif; 3 | font-weight: lighter; 4 | } 5 | 6 | h1 { 7 | text-align: center; 8 | font-weight: lighter; 9 | } 10 | 11 | .container { 12 | display: block; 13 | max-width: 600px; 14 | margin: 0 auto; 15 | padding: 20px; 16 | } 17 | 18 | p, a { 19 | color: gray; 20 | line-height: 1.7em; 21 | font-size: 13pt; 22 | } 23 | 24 | p { 25 | opacity: 0.0; 26 | } 27 | 28 | @media screen and (prefers-reduced-motion: no-preference) { 29 | p { 30 | transition: opacity 1.0s; 31 | } 32 | } 33 | 34 | p.show { 35 | opacity: 1.0; 36 | } 37 | 38 | p.choice { 39 | text-align: center; 40 | } 41 | 42 | a:hover { 43 | color: black; 44 | } -------------------------------------------------------------------------------- /templates/nodejs/index.js: -------------------------------------------------------------------------------- 1 | var Story = require('inkjs').Story; 2 | var fs = require('fs'); 3 | var readline = require('readline'); 4 | 5 | //load the ink file 6 | var inkFile = fs.readFileSync('./intercept.ink.json', 'UTF-8').replace(/^\uFEFF/, ''); 7 | 8 | //create a new story 9 | var myStory = new Story(inkFile); 10 | 11 | //start reading and writting to the console 12 | var rl = readline.createInterface({ 13 | input: process.stdin, 14 | output: process.stdout 15 | }); 16 | 17 | continueToNextChoice(); 18 | 19 | function continueToNextChoice(){ 20 | //check we haven't reached the end of the story 21 | if (!myStory.canContinue && myStory.currentChoices.length === 0) end(); 22 | 23 | //write the story to the console until we find a choice 24 | while (myStory.canContinue){ 25 | console.log(myStory.Continue()); 26 | } 27 | 28 | //check if there are choices 29 | if (myStory.currentChoices.length > 0){ 30 | for (var i = 0; i < myStory.currentChoices.length; ++i) { 31 | var choice = myStory.currentChoices[i]; 32 | console.log((i + 1) + ". " + choice.text); 33 | } 34 | 35 | //prompt the user for a choice 36 | rl.question('> ', (answer) => { 37 | //continue with that choice 38 | myStory.ChooseChoiceIndex(parseInt(answer) - 1); 39 | continueToNextChoice(); 40 | }); 41 | } 42 | else{ 43 | //if there are no choices, we reached the end of the story 44 | end(); 45 | } 46 | } 47 | 48 | function end(){ 49 | console.log('THE END'); 50 | rl.close(); 51 | } -------------------------------------------------------------------------------- /templates/typescript_player/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ts-inkjs-player", 3 | "type": "module", 4 | "version": "1.0.0", 5 | "description": "", 6 | "main": "index.js", 7 | "scripts": { 8 | "start": "tsc --resolveJsonModule -p . && tsx src/index.ts" 9 | }, 10 | "keywords": [], 11 | "author": "Sebastian Hanlon", 12 | "license": "ISC", 13 | "devDependencies": { 14 | "@types/node": "^20.14.2", 15 | "tsx": "^4.15.2", 16 | "typescript": "^5.4.5" 17 | }, 18 | "dependencies": { 19 | "inkjs": "*" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /templates/typescript_player/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Story } from 'inkjs/types'; 2 | import intercept from "./story.json"; 3 | 4 | let story:Story = new Story(intercept); 5 | 6 | let text = story.Continue() 7 | 8 | let choices = story.currentChoices 9 | 10 | console.log(text) 11 | for (let c of choices){ 12 | console.log(` * ${c.text}`) 13 | } -------------------------------------------------------------------------------- /templates/typescript_player/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["ES2022"], 4 | "skipLibCheck": true, 5 | "module": "NodeNext", 6 | "target": "ESNext", 7 | "moduleResolution": "Node16", 8 | "allowSyntheticDefaultImports": true, 9 | "esModuleInterop": true, 10 | "types": ["node"], 11 | "outDir": "dist", 12 | "declaration": true, 13 | "resolveJsonModule": true, 14 | 15 | /* Linting */ 16 | "strict": true 17 | }, 18 | "include": ["src"] 19 | } 20 | -------------------------------------------------------------------------------- /templates/typescript_with_compiler/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ts-inkjs-with-compiler", 3 | "type": "module", 4 | "version": "1.0.0", 5 | "description": "", 6 | "main": "index.js", 7 | "scripts": { 8 | "start": "tsc --resolveJsonModule -p . && tsx src/index.ts" 9 | }, 10 | "keywords": [], 11 | "author": "Sebastian Hanlon", 12 | "license": "ISC", 13 | "devDependencies": { 14 | "@types/node": "^20.14.2", 15 | "tsx": "^4.15.2", 16 | "typescript": "^5.4.5" 17 | }, 18 | "dependencies": { 19 | "inkjs": "*" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /templates/typescript_with_compiler/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Story, Compiler } from 'inkjs/compiler/Compiler'; 2 | import { Choice } from 'inkjs/engine/Choice'; 3 | 4 | const inkStory = ` 5 | Once upon a time... 6 | 7 | * There were two choices. 8 | * There were four lines of content. 9 | 10 | - They lived happily ever after. 11 | -> END 12 | ` 13 | 14 | let compiler = new Compiler(inkStory); 15 | 16 | let story: Story = compiler.Compile() 17 | 18 | let text = story.Continue() 19 | let choices: Choice[] = story.currentChoices 20 | 21 | console.log(text) 22 | for (let c of choices){ 23 | console.log(` * ${c.text}`) 24 | } 25 | -------------------------------------------------------------------------------- /templates/typescript_with_compiler/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["ES2022"], 4 | "skipLibCheck": true, 5 | "module": "NodeNext", 6 | "target": "ESNext", 7 | "moduleResolution": "Node16", 8 | "allowSyntheticDefaultImports": true, 9 | "esModuleInterop": true, 10 | "types": ["node"], 11 | "outDir": "dist", 12 | "declaration": true, 13 | "resolveJsonModule": true, 14 | 15 | /* Linting */ 16 | "strict": true 17 | }, 18 | "include": ["src"] 19 | } 20 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "outDir": ".", 6 | "rootDir": "src/", 7 | "strict": true, 8 | "sourceMap": true, 9 | "declaration": true, 10 | "lib": ["ES2017"] 11 | }, 12 | "include": ["src/"], 13 | "exclude": ["node_modules", "**/__tests__/*"] 14 | } 15 | --------------------------------------------------------------------------------