Skip to content

Commit

Permalink
Revert "extract parsing of commands and stems"
Browse files Browse the repository at this point in the history
This reverts commit ddfd180.
  • Loading branch information
joswig committed Feb 13, 2025
1 parent ddfd180 commit 23dd0a5
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions src/utilities/codemirror/cdlDictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,32 +65,12 @@ export function parseCdlDictionary(contents: string, id?: string, path?: string)
version,
};

const { enums, fswCommands } = parseArgumentsAndStems(lineIterator);

return {
enumMap: Object.fromEntries(enums.map(e => [e.name, e])),
enums,
fswCommandMap: Object.fromEntries(fswCommands.map(cmd => [cmd.stem, cmd])),
fswCommands,
header,
hwCommandMap: {},
hwCommands: [],
id: id ?? '',
path: path ?? '',
};
}

function parseArgumentsAndStems(lineIterator: ArrayIterator<string>): {
enums: Enum[];
fswCommands: FswCommand[];
} {
// parse globals and stems
// assumes all global arguments are defined prior to stems

const enums: Enum[] = [];

const globalArguments: FswCommandArgumentMap = {};
const fswCommands: FswCommand[] = [];

// parse globals and stems
// assumes all global arguments are defined prior to stems
for (const line of lineIterator) {
if (line.match(START_LOOKUP_ARG)) {
const lookupLines: string[] = [line];
Expand Down Expand Up @@ -129,9 +109,17 @@ function parseArgumentsAndStems(lineIterator: ArrayIterator<string>): {
}
}
}

return {
enumMap: Object.fromEntries(enums.map(e => [e.name, e])),
enums,
fswCommandMap: Object.fromEntries(fswCommands.map(cmd => [cmd.stem, cmd])),
fswCommands,
header,
hwCommandMap: {},
hwCommands: [],
id: id ?? '',
path: path ?? '',
};
}

Expand Down

0 comments on commit 23dd0a5

Please sign in to comment.