@helloao/tools 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/generation/api.d.ts +203 -0
- package/generation/api.js +153 -0
- package/generation/api.spec.d.ts +2 -0
- package/generation/api.spec.js +463 -0
- package/generation/audio.d.ts +20 -0
- package/generation/audio.js +60 -0
- package/generation/audio.spec.d.ts +2 -0
- package/generation/audio.spec.js +36 -0
- package/generation/book-order.d.ts +15 -0
- package/generation/book-order.js +494 -0
- package/generation/book-order.spec.d.ts +2 -0
- package/generation/book-order.spec.js +8 -0
- package/generation/common-types.d.ts +327 -0
- package/generation/common-types.js +2 -0
- package/generation/dataset.d.ts +34 -0
- package/generation/dataset.js +106 -0
- package/generation/index.d.ts +7 -0
- package/generation/index.js +38 -0
- package/index.d.ts +5 -0
- package/index.js +32 -0
- package/package.json +27 -0
- package/parser/codex-parser.d.ts +97 -0
- package/parser/codex-parser.js +160 -0
- package/parser/codex-parser.spec.d.ts +2 -0
- package/parser/codex-parser.spec.js +645 -0
- package/parser/index.d.ts +7 -0
- package/parser/index.js +35 -0
- package/parser/iterators.d.ts +89 -0
- package/parser/iterators.js +222 -0
- package/parser/iterators.spec.d.ts +2 -0
- package/parser/iterators.spec.js +174 -0
- package/parser/types.d.ts +144 -0
- package/parser/types.js +2 -0
- package/parser/usfm-parser.d.ts +135 -0
- package/parser/usfm-parser.js +840 -0
- package/parser/usfm-parser.spec.d.ts +2 -0
- package/parser/usfm-parser.spec.js +1593 -0
- package/parser/usx-parser.d.ts +33 -0
- package/parser/usx-parser.js +425 -0
- package/parser/usx-parser.spec.d.ts +2 -0
- package/parser/usx-parser.spec.js +1260 -0
- package/typings/types.d.ts +14 -0
- package/utils.d.ts +29 -0
- package/utils.js +73 -0
- package/utils.spec.d.ts +2 -0
- package/utils.spec.js +42 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { ParseTree } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Defines a class that can tokenize a stream of characters into tokens.
|
|
4
|
+
*/
|
|
5
|
+
export declare class UsfmTokenizer {
|
|
6
|
+
private _input;
|
|
7
|
+
private _index;
|
|
8
|
+
private _start;
|
|
9
|
+
private get _tokenLength();
|
|
10
|
+
/**
|
|
11
|
+
* Converts the given input into a list of tokens.
|
|
12
|
+
* @param input The input that should be tokenized.
|
|
13
|
+
*/
|
|
14
|
+
tokenize(input: string): SimpleToken[];
|
|
15
|
+
private _parseTokens;
|
|
16
|
+
private _parseToken;
|
|
17
|
+
}
|
|
18
|
+
export interface UsfmParseOptions {
|
|
19
|
+
paragraphs: Set<string>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Defines a USFM Parser.
|
|
23
|
+
*/
|
|
24
|
+
export declare class UsfmParser {
|
|
25
|
+
private _poem;
|
|
26
|
+
private _wordsOfJesus;
|
|
27
|
+
tokenize(input: string): Token[];
|
|
28
|
+
parse(input: string): ParseTree;
|
|
29
|
+
renderMarkdown(tree: ParseTree): string;
|
|
30
|
+
private _hasAttribute;
|
|
31
|
+
private _text;
|
|
32
|
+
private _throwError;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Determines if the given character is a digit.
|
|
36
|
+
* @param char The character.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isDigit(char: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Determines if the given character is considered whitespace.
|
|
41
|
+
* @param char The character.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isWhitespace(char: string): boolean;
|
|
44
|
+
export declare function t(loc: SourceLocation, kind: T): SimpleToken;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a new source location.
|
|
47
|
+
* @param start The start of the location.
|
|
48
|
+
* @param end The end of the location.
|
|
49
|
+
*/
|
|
50
|
+
export declare function loc(start: number, end: number): SourceLocation;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a new marker token.
|
|
53
|
+
* @param loc The location for the token.
|
|
54
|
+
* @param command The command that the token contains.
|
|
55
|
+
* @param number The number that the marker contains.
|
|
56
|
+
* @param type The type of the marker.
|
|
57
|
+
*/
|
|
58
|
+
export declare function marker(loc: SourceLocation, command: string, number?: number | null, type?: MarkerToken['type']): MarkerToken;
|
|
59
|
+
/**
|
|
60
|
+
* Creates a new word token.
|
|
61
|
+
* @param loc The location for the token.
|
|
62
|
+
* @param word The word contained by the token.
|
|
63
|
+
*/
|
|
64
|
+
export declare function word(loc: SourceLocation, word: string): WordToken;
|
|
65
|
+
export declare function whitespace(loc: SourceLocation, whitespace: string): WhitespaceToken;
|
|
66
|
+
export type T = Token['kind'];
|
|
67
|
+
/**
|
|
68
|
+
* Defines a simple token.
|
|
69
|
+
*/
|
|
70
|
+
export interface SimpleToken {
|
|
71
|
+
kind: T;
|
|
72
|
+
loc: SourceLocation;
|
|
73
|
+
}
|
|
74
|
+
export type Token = MarkerToken | WordToken | WhitespaceToken;
|
|
75
|
+
/**
|
|
76
|
+
* Defines an interface for a USFM marker node.
|
|
77
|
+
* That is, the syntax for a marker.
|
|
78
|
+
*/
|
|
79
|
+
export interface MarkerToken {
|
|
80
|
+
kind: 'marker';
|
|
81
|
+
/**
|
|
82
|
+
* The command that the marker represents.
|
|
83
|
+
* This is generally the name of the marker (like "p" or "v" for paragraph and verse markers)
|
|
84
|
+
*/
|
|
85
|
+
command: string;
|
|
86
|
+
/**
|
|
87
|
+
* The number that the marker contains.
|
|
88
|
+
* Null if no number was specified.
|
|
89
|
+
*/
|
|
90
|
+
number: number | null;
|
|
91
|
+
/**
|
|
92
|
+
* Whether the marker represents a start or an end.
|
|
93
|
+
*/
|
|
94
|
+
type: 'start' | 'end';
|
|
95
|
+
/**
|
|
96
|
+
* The location of the node.
|
|
97
|
+
*/
|
|
98
|
+
loc: SourceLocation;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Defines an interface for a Whitespace node.
|
|
102
|
+
*/
|
|
103
|
+
export interface WhitespaceToken {
|
|
104
|
+
kind: 'whitespace';
|
|
105
|
+
/**
|
|
106
|
+
* The whitespace contained by the node.
|
|
107
|
+
*/
|
|
108
|
+
whitespace: string;
|
|
109
|
+
/**
|
|
110
|
+
* The location of the node.
|
|
111
|
+
*/
|
|
112
|
+
loc: SourceLocation;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Defines an interface for a word token.
|
|
116
|
+
*/
|
|
117
|
+
export interface WordToken {
|
|
118
|
+
kind: 'word';
|
|
119
|
+
/**
|
|
120
|
+
* The word contained by the token.
|
|
121
|
+
*/
|
|
122
|
+
word: string;
|
|
123
|
+
/**
|
|
124
|
+
* The location of the word.
|
|
125
|
+
*/
|
|
126
|
+
loc: SourceLocation;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The source location of the node.
|
|
130
|
+
*/
|
|
131
|
+
export interface SourceLocation {
|
|
132
|
+
start: number;
|
|
133
|
+
end: number;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=usfm-parser.d.ts.map
|