@tricoteuses/arbre-de-la-loi
Version:
Generate ASTs from the French bills & laws; manipulate & export them to Markdown, etc.
54 lines (53 loc) • 2 kB
JavaScript
/// AST of a bill and other legislative-related documents
//
export var DivisionType;
(function (DivisionType) {
DivisionType["Article"] = "article";
DivisionType["Book"] = "book";
DivisionType["Chapter"] = "chapter";
DivisionType["Part"] = "part";
DivisionType["Section"] = "section";
DivisionType["Subsection"] = "subsection";
DivisionType["Subtitle"] = "subtitle";
DivisionType["Title"] = "title";
DivisionType["Tome"] = "tome";
})(DivisionType || (DivisionType = {}));
export const divisionTypes = new Set(Object.values(DivisionType));
export var DocumentType;
(function (DocumentType) {
DocumentType["Bill"] = "bill";
DocumentType["BillStatementOfReasons"] = "bill_statement_of_reasons";
})(DocumentType || (DocumentType = {}));
export const documentTypes = new Set(Object.values(DocumentType));
export var UnstructuredType;
(function (UnstructuredType) {
UnstructuredType["Annex"] = "annex";
UnstructuredType["DivisionStatementOfReasons"] = "division_statement_of_reasons";
UnstructuredType["Unknown"] = "unknown";
})(UnstructuredType || (UnstructuredType = {}));
export const unstructuredTypes = new Set(Object.values(UnstructuredType));
export const DocumentNodeType = {
...DivisionType,
...DocumentType,
...UnstructuredType,
};
export const documentNodeTypes = new Set(Object.values(DocumentNodeType));
export const documentNodeWithHeadlinesTypes = new Set([
DocumentNodeType.Annex,
// DocumentNodeType.Article,
DocumentNodeType.Bill,
DocumentNodeType.Book,
DocumentNodeType.Chapter,
// DocumentNodeType.DivisionStatementOfReasons,
DocumentNodeType.Part,
DocumentNodeType.Section,
// DocumentNodeType.BillStatementOfReasons,
DocumentNodeType.Subsection,
DocumentNodeType.Subtitle,
DocumentNodeType.Title,
DocumentNodeType.Tome,
// DocumentNodeType.Unknown,
]);
export function assertNeverDocumentNode(node) {
throw new Error("Unexpected document node: " + node);
}