Skip to content

Commit

Permalink
Finished with the dynamic parser
Browse files Browse the repository at this point in the history
  • Loading branch information
alberti42 committed Aug 16, 2024
1 parent 84523bc commit f9e3303
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
5 changes: 4 additions & 1 deletion src/generateParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ let oldOptions: ParserOptions;

export function generateParser(options: ParserOptions): Parser {

// if the parser existed already and the user provided the same options, we simply reuse the already generated parser
if(parser && areParserOptionsEqual(options,oldOptions)) {
// If the parser existed already and the user provided the same options,
// we simply reuse the already generated parser
return parser;
}

/* GENERATE A NEW PARSER */

oldOptions = copyParserOptions(options);

const close_rules_list: string[] = [];
Expand Down
13 changes: 5 additions & 8 deletions tests/unit/FlashcardReviewSequencer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ class TestContext {
text: string,
fakeFilePath?: string,
): TestContext {

let cardSequencer: IDeckTreeIterator = new DeckTreeIterator(iteratorOrder, null);
let noteEaseList = new NoteEaseList(settings);
let cardScheduleCalculator: CardScheduleCalculator = new CardScheduleCalculator(
Expand Down Expand Up @@ -759,7 +758,6 @@ describe("updateCurrentQuestionText", () => {

describe("Checking update to file", () => {
describe("Single line card type; Settings - schedule on following line", () => {

test("Question has schedule on following line before/after update", async () => {
let text: string = `
#flashcards Q1::A1
Expand Down Expand Up @@ -804,7 +802,7 @@ describe("updateCurrentQuestionText", () => {
);
});
});

describe("Single line card type; Settings - schedule on same line", () => {
let settings: SRSettings = { ...DEFAULT_SETTINGS };
settings.cardCommentOnSameLine = true;
Expand Down Expand Up @@ -991,13 +989,13 @@ ${updatedQuestionText}`;
);
});


// DISABLED TEST. IT SEEMS UNNECESSARY TO TRIM THE END OF LINES
/*test("Question starts line after tag (single space after tag before newline); New card", async () => {
test("Question starts line after tag (single space after tag before newline); New card", async () => {
let originalQuestionStr: string = `#flashcards${space}
Q2
?
A2 helloooooo`;
A2`;
let fileText: string = `
${originalQuestionStr}
Expand All @@ -1022,12 +1020,11 @@ ${updatedQuestionText}`;
expectedUpdatedStr,
DEFAULT_SETTINGS,
);
});
});*/
});*/
});
});
});


describe("getDeckStats", () => {
describe("Single level deck with some new and due cards", () => {
test("Initial stats", async () => {
Expand Down

0 comments on commit f9e3303

Please sign in to comment.