@zsnout/ithkuil
Version:
A set of tools which can generate and parse romanized Ithkuil text and which can generate Ithkuil script from text and JSON data.
22 lines (21 loc) • 621 B
JavaScript
import { parsingAdjunct } from "../lex/adjunct/parsing.js";
/**
* Builds a parsing adjunct.
*
* @param word The word to be built.
* @returns Either a parsed `ParsingAdjunct` indicating a success, or
* `undefined` indicating a tokenization failure. Throws if the adjunct was
* successfully tokenized but had another error in it.
*/
export function buildParsingAdjunct(word) {
const match = parsingAdjunct.exec(word);
if (!match) {
return;
}
return {
"a'": "monosyllabic",
"e'": "ultimate",
"o'": "penultimate",
"u'": "antepenultimate",
}[match[0]];
}