Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(command): expose Command#lexer #143

Merged
merged 2 commits into from
Jan 26, 2021
Merged
Changes from all commits
Commits
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
7 changes: 3 additions & 4 deletions src/lib/structures/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ export abstract class Command<T = Args> extends AliasPiece {
* @since 1.0.0
* @private
*/
// eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
#lexer = new Lexure.Lexer();
protected lexer = new Lexure.Lexer();

/**
* @since 1.0.0
Expand All @@ -50,7 +49,7 @@ export abstract class Command<T = Args> extends AliasPiece {
this.detailedDescription = options.detailedDescription ?? '';
this.preconditions = new PreconditionContainerArray(options.preconditions);
this.strategy = new FlagUnorderedStrategy(options.strategyOptions);
this.#lexer.setQuotes(
this.lexer.setQuotes(
options.quotes ?? [
['"', '"'], // Double quotes
['“', '”'], // Fancy quotes (on iOS)
Expand All @@ -65,7 +64,7 @@ export abstract class Command<T = Args> extends AliasPiece {
* @param parameters The raw parameters as a single string.
*/
public preParse(message: Message, parameters: string): Awaited<T> {
const parser = new Lexure.Parser(this.#lexer.setInput(parameters).lex()).setUnorderedStrategy(this.strategy);
const parser = new Lexure.Parser(this.lexer.setInput(parameters).lex()).setUnorderedStrategy(this.strategy);
const args = new Lexure.Args(parser.parse());
return new Args(message, this as any, args) as any;
}
Expand Down