Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a2fe2c0
feat: start work on named arguments in tags
Strokkur424 Sep 17, 2025
5314452
feat: modify token parser to parse named arguments
Strokkur424 Sep 18, 2025
0d783d7
chore: introduce new TokenType to uniquely distinguish value-less tog…
Strokkur424 Sep 18, 2025
22cb404
feat: (WIP) abstracting away TagProvider into QueuedTagProvider and N…
Strokkur424 Sep 18, 2025
a53e84b
fix: (WIP) parser should now theoretically be able to distinguish nam…
Strokkur424 Sep 19, 2025
3d7d3e9
feat: flesh out parsing logic further and fix a bunch of issues
Strokkur424 Sep 19, 2025
300e7fd
feat: add test for basic named argument parsing
Strokkur424 Sep 19, 2025
828f0b0
feat: start adding more tests
Strokkur424 Sep 19, 2025
b5d3c0b
fix: <red > tag with space being recognized as valid tag
Strokkur424 Sep 19, 2025
79647a0
feat: add a bunch more tests
Strokkur424 Sep 19, 2025
09265f7
chore: fix all compile time issues
Strokkur424 Sep 19, 2025
82e4e62
feat: add test
Strokkur424 Sep 19, 2025
a788770
chore: cleanup diff and rename to sequential
Strokkur424 Sep 19, 2025
a624524
chore: add a bunch more tests
Strokkur424 Sep 20, 2025
b412b8e
feat: add inverted flag arguments
Strokkur424 Sep 20, 2025
03e6342
feat: split the claiming resolvers into named and sequenced resolvers
Strokkur424 Sep 20, 2025
5901dee
feat: add missing context newException method and try to parse tag wi…
Strokkur424 Sep 20, 2025
bf049e4
feat: add isFlagPresent
Strokkur424 Sep 20, 2025
5ccbb63
fix: invalid tag in test
Strokkur424 Sep 20, 2025
951e763
feat: add named argument support to token emitter
Strokkur424 Sep 23, 2025
703ca92
feat: add flag support to token emitter
Strokkur424 Sep 23, 2025
2a1d129
chore: remove unused import
Strokkur424 Sep 23, 2025
9c7bc98
chore: default implement TagResolver methods with null
Strokkur424 Sep 23, 2025
49afd1f
chore: remove instanceof check in SequentialTagResolver in order to n…
Strokkur424 Sep 23, 2025
d2acca5
chore: add missing (at)since annotations
Strokkur424 Sep 23, 2025
4008b17
chore: spelling mistakes
Strokkur424 Sep 24, 2025
3b6a721
Merge branch 'main/5' into feat/named-arguments
Strokkur424 Nov 5, 2025
b1881d7
chore: fix some main/5 rebase issues
Strokkur424 Nov 5, 2025
2a70bdf
Merge branch 'main/5' into feat/named-arguments
Strokkur424 Nov 5, 2025
67af697
refactor: combine named and sequential tag arguments
Strokkur424 Nov 5, 2025
c7b608d
fix: remaining tests
Strokkur424 Nov 6, 2025
c341b7e
refactor: minor second pass token parser changes and added banchmark …
Strokkur424 Nov 6, 2025
ac6bffe
chore: spotless apply
Strokkur424 Nov 6, 2025
9c4bd6f
chore: fix checkstyle violations and do a minor diff cleanup
Strokkur424 Nov 6, 2025
2a40dcf
feat: add tests for combined arguments and for sequenced args with a …
Strokkur424 Nov 6, 2025
9b35d55
chore: final cleanup
Strokkur424 Nov 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add named argument support to token emitter
  • Loading branch information
Strokkur424 committed Sep 24, 2025
commit 951e7637f3c1f56e7176c2ad6c72a2872069b47e
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,18 @@ void completeTag() {
return this;
}

@Override
public @NotNull TokenEmitter namedArgument(final @NotNull String name, final @NotNull String arg) {
if (!this.tagState.isTag) {
throw new IllegalStateException("Not within a tag!");
}
this.consumer.append(' ');
this.consumer.append(name);
this.consumer.append(TokenParser.NAME_VALUE_SEPARATOR);
this.escapeTagContent(arg, null);
return this;
}

@Override
public @NotNull TokenEmitter argument(final @NotNull String arg, final @NotNull QuotingOverride quotingPreference) {
if (!this.tagState.isTag) {
Expand All @@ -209,12 +221,30 @@ void completeTag() {
return this;
}

@Override
public @NotNull TokenEmitter namedArgument(final @NotNull String name, final @NotNull String arg, final @NotNull QuotingOverride quotingPreference) {
if (!this.tagState.isTag) {
throw new IllegalStateException("Not within a tag!");
}
this.consumer.append(' ');
this.consumer.append(name);
this.consumer.append(TokenParser.NAME_VALUE_SEPARATOR);
this.escapeTagContent(arg, requireNonNull(quotingPreference, "quotingPreference"));
return this;
}

@Override
public @NotNull TokenEmitter argument(final @NotNull Component arg) {
final String serialized = MiniMessageSerializer.serialize(arg, this.resolver, this.strict);
return this.argument(serialized, QuotingOverride.QUOTED); // always quote tokens
}

@Override
public @NotNull TokenEmitter namedArgument(final @NotNull String name, final @NotNull Component arg) {
final String serialized = MiniMessageSerializer.serialize(arg, this.resolver, this.strict);
return this.namedArgument(name, serialized, QuotingOverride.QUOTED); // always quote tokens
}

@Override
public @NotNull Collector text(final @NotNull String text) {
this.completeTag();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ public interface TokenEmitter {
*/
@NotNull TokenEmitter argument(final @NotNull String arg);

/**
* Add a single named argument to the current tag.
*
* <p>Must be called after {@link #tag(String)}, but before any call to {@link #text(String)}.</p>
*
* @param name name of the argument
* @param arg argument value
* @return this emitter
* @since 4.25.0
*/
@NotNull TokenEmitter namedArgument(final @NotNull String name, final @NotNull String arg);

/**
* Add a single argument to the current tag.
*
Expand All @@ -91,6 +103,19 @@ public interface TokenEmitter {
*/
@NotNull TokenEmitter argument(final @NotNull String arg, final @NotNull QuotingOverride quotingPreference);

/**
* Add a single named argument to the current tag.
*
* <p>Must be called after {@link #tag(String)}, but before any call to {@link #text(String)}.</p>
*
* @param name name of the argument
* @param arg argument value
* @param quotingPreference an argument-specific quoting instruction
* @return this emitter
* @since 4.25.0
*/
@NotNull TokenEmitter namedArgument(final @NotNull String name, final @NotNull String arg, final @NotNull QuotingOverride quotingPreference);

/**
* Add a single argument to the current tag.
*
Expand All @@ -102,6 +127,18 @@ public interface TokenEmitter {
*/
@NotNull TokenEmitter argument(final @NotNull Component arg);

/**
* Add a single named argument to the current tag.
*
* <p>Must be called after {@link #tag(String)}, but before any call to {@link #text(String)}.</p>
*
* @param name name of the argument
* @param arg argument value, serialized as a nested MiniMessage string
* @return this emitter
* @since 4.25.0
*/
@NotNull TokenEmitter namedArgument(final @NotNull String name, final @NotNull Component arg);

/**
* Emit literal text.
*
Expand Down