Skip to content

Commit

Permalink
feat(command): expose Command#lexer (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranet authored Jan 26, 2021
1 parent cfeef64 commit 4ec1b4d
Showing 1 changed file with 3 additions and 4 deletions.
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

0 comments on commit 4ec1b4d

Please sign in to comment.