Commit 75538a9
Correctly parse tags related to each line (#96)
My major goal with this pull request was to support retrieving the
correct tags per line, and I've succeeded with that. Unfortunately, I
also broke several existing tests in the process and haven't been able
to get them working yet. I don’t think it’s very nice of me to leave
your project in a worse state than I found it, so I’m providing you with
as much documentation as possible about where I suspect the problems
lie. I hope we can work together to integrate my changes into your main
branch.
# Changelog
- choice class: Tags are stored as `snap_tag*` held by the `runner_impl`
instead of `const char*`.
- runner interface: Added virtual `num_global_tags()` and
`get_global_tag()` methods.
- runner interface: Added `line_type` for `std::string` or `FString`
depending on compile settings.
- runner interface: Simplified `getline()` method to return `line_type`.
- basic_stream: Reimplemented `entries_since_marker()` as
`find_first_of()` and `find_last_of()` methods.
- basic_stream: Removed `saved_ends_with()` method in favor of an
`offset` parameter to the `ends_with()` method.
- basic_stream: Use `size_t` instead of `int` for offsets into the data.
- basic_stream: Protect against buffer underflow in the `discard()`
method.
- basic_stream: Added `npos` constexpr for invalid positions in the
buffer.
- runner_impl: Added `add_tag()` and `clear_tags()` methods to manage
tag info.
- runner_impl: `advance_line()` clears line and choice tags while
keeping the global ones.
- runner_impl: `line_step()` reads steps from the execution buffer until
the next new line.
- runner_impl: `line_step()` copies global tags to the first line.
- runner_impl: `line_step()` continues stepping execution until it's
satisfied it doesn't affect the current line.
- runner_impl: Added `set_debug_enabled()` to optionally write command
info to a debug stream as the instance steps through the execution
buffer.
- runner_impl: `step()` writes debug info to the debug stream, if
available.
- runner_impl: Streamlined `getline()` implementation to work with
either `std::string` or `FString`.
- runner_impl: Streamlined `getall()` implementation to call `getline()`
multiple times, reducing the need to test this method separately.
- runner_impl: Simplified `detect_change()` to check for extending past
the newline only.
- command: Added `std::ostream` operator for streaming `Command` and
`CommandFlag` enum values as strings.
- snapshot_impl: Added `text()` method to retrieve stored string
directly.
- snapshot_impl: Store pointers to tags start and end instead of text
pointers.
- keep track of global tags and current knot/stitch tags
- knot tags are tags in the current knot/stitch before the first line of ink code
- tags from parent knots are not stored!
- function to fetch current knot/stitch hash to detect knot/stitch changes
- UE: new event: EnterKnot(GlobalTags, KnotTags)
# Unit test changes
- Replaced many `REQUIRE()` calls with `CHECK()` to ensure test
execution isn’t halted immediately.
- Tags.cpp: Added unit tests for adding and removing tags to a runner.
- Tags.cpp: Made loaded story global to ensure that `WHEN()` and
`THEN()` tests can be run in sequence correctly.
- NoEarlyTags.cpp: Added checks for specific tags after each line.
- NewLines.cpp: Cleaned up tests.
- TagsStory.ink: Expanded tests for tags in different places.
- LinesStory.ink: Added a condensed test case for ignoring functions
when applying glue.
---------
Co-authored-by: Julian Benda <Julian.m.benda@gmail.com>1 parent c7d32d6 commit 75538a9
File tree
46 files changed
+2725
-1343
lines changed- .github/workflows
- Documentation/unreal
- inkcpp_cl
- inkcpp_compiler
- inkcpp_c
- include
- tests
- inkcpp_python
- src
- tests
- inkcpp_test
- ink
- inkcpp
- include
- unreal
- inkcpp/Source
- inkcpp_editor/Private
- inkcpp
- Private
- Public
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
46 files changed
+2725
-1343
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
10 | 33 | | |
11 | 34 | | |
12 | 35 | | |
| |||
25 | 48 | | |
26 | 49 | | |
27 | 50 | | |
28 | | - | |
29 | 51 | | |
30 | 52 | | |
31 | 53 | | |
| |||
58 | 80 | | |
59 | 81 | | |
60 | 82 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | 83 | | |
65 | 84 | | |
66 | 85 | | |
| |||
77 | 96 | | |
78 | 97 | | |
79 | 98 | | |
80 | | - | |
81 | 99 | | |
82 | 100 | | |
83 | 101 | | |
84 | | - | |
85 | | - | |
86 | 102 | | |
87 | 103 | | |
88 | 104 | | |
89 | | - | |
90 | 105 | | |
91 | 106 | | |
92 | 107 | | |
93 | 108 | | |
94 | 109 | | |
95 | 110 | | |
96 | | - | |
97 | | - | |
98 | 111 | | |
99 | 112 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| 290 | + | |
290 | 291 | | |
291 | | - | |
| 292 | + | |
292 | 293 | | |
293 | | - | |
| 294 | + | |
294 | 295 | | |
295 | | - | |
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | | - | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
81 | | - | |
82 | | - | |
| 83 | + | |
| 84 | + | |
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
87 | 114 | | |
88 | 115 | | |
89 | 116 | | |
| |||
154 | 181 | | |
155 | 182 | | |
156 | 183 | | |
157 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
158 | 201 | | |
159 | 202 | | |
160 | 203 | | |
| |||
287 | 330 | | |
288 | 331 | | |
289 | 332 | | |
290 | | - | |
291 | 333 | | |
292 | 334 | | |
293 | 335 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
16 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
17 | 39 | | |
18 | 40 | | |
19 | | - | |
20 | | - | |
| 41 | + | |
21 | 42 | | |
22 | 43 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
31 | 50 | | |
32 | | - | |
33 | | - | |
34 | | - | |
| 51 | + | |
35 | 52 | | |
36 | | - | |
| 53 | + | |
37 | 54 | | |
| 55 | + | |
38 | 56 | | |
39 | | - | |
40 | | - | |
| 57 | + | |
41 | 58 | | |
42 | 59 | | |
43 | | - | |
44 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
45 | 63 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 64 | + | |
51 | 65 | | |
52 | 66 | | |
53 | | - | |
54 | | - | |
| 67 | + | |
| 68 | + | |
0 commit comments