Skip to content

Anchor parsing ignores ANCHOR_END, making it behave the same as a starting ANCHOR tag. #2778

@hotdogc1017

Description

@hotdogc1017

Problem

Hello,

First, thank you for this excellent project! I've found a potential bug or a mismatch between the documentation and the implementation of the file inclusion anchor feature.

The documentation states that an anchor is a "pair of matching lines" that must begin with ANCHOR: name and end with ANCHOR_END: name. This implies that the ANCHOR_END tag is required to correctly close a named block.

However, in my testing, the parsing logic does not seem to distinguish between ANCHOR: name and ANCHOR_END: name. Using a second starting anchor tag (/* ANCHOR: all /) seems to close the block in the same way an end tag (/ ANCHOR_END: all */) does.

Steps

  1. According to the documentation, this is the expected structure, and it works correctly:
/* ANCHOR: all */
struct Paddle {
    hello: f32,
}
/* ANCHOR_END: all */
  1. However, the following example, which incorrectly uses a starting ANCHOR tag at the end, produces the exact same output:
/* ANCHOR: all */
struct Paddle {
    hello: f32,
}
/* ANCHOR: all */

Possible Solution(s)

This could be either a bug in the parsing logic or an area where the documentation could be updated to clarify this behavior.

Thank you for your time and consideration!

Notes

No response

Version


Metadata

Metadata

Assignees

No one assigned

    Labels

    A-link-preprocessorArea: Link preprocessor, #{{include}}, etc.C-bugCategory: A bug, incorrect or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions