resolv-conf 2.0.0 → 3.0.4

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/lib/defaults.d.ts CHANGED
@@ -181,7 +181,7 @@ export type KnownResolvOptions = {
181
181
  export type ResolvOptions = KnownResolvOptions & Record<string, any>;
182
182
  export type ResolvError = {
183
183
  text: string;
184
- location: import('peggy').LocationRange;
184
+ location: import("peggy").LocationRange;
185
185
  };
186
186
  export type GatheredLines = {
187
187
  /**
package/lib/defaults.js CHANGED
@@ -1,4 +1,4 @@
1
- import os from 'os';
1
+ import os from 'node:os';
2
2
 
3
3
  /**
4
4
  * Address/Mask combinations.
package/lib/index.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * @param {string} [fileName]
9
9
  * @returns {ResolvResults}
10
10
  */
11
- export function parse(text: string, fileName?: string | undefined): ResolvResults;
11
+ export function parse(text: string, fileName?: string): ResolvResults;
12
12
  /**
13
13
  * Parse the contents of a file like resolv.conf.
14
14
  *
@@ -16,5 +16,5 @@ export function parse(text: string, fileName?: string | undefined): ResolvResult
16
16
  * and parse.
17
17
  * @returns {Promise<ResolvResults>} The parsed contents of the file.
18
18
  */
19
- export function parseFile(fileName?: string | undefined): Promise<ResolvResults>;
20
- export type ResolvResults = import('./defaults.js').ResolvResults;
19
+ export function parseFile(fileName?: string): Promise<ResolvResults>;
20
+ export type ResolvResults = import("./defaults.js").ResolvResults;
package/lib/index.js CHANGED
@@ -19,7 +19,6 @@ export function parse(text, fileName = '/etc/resolv.conf') {
19
19
  });
20
20
  } catch (er) {
21
21
  if (er instanceof SyntaxError) {
22
- // @ts-expect-error See https://github.com/peggyjs/peggy/issues/477
23
22
  er.message = er.format([{
24
23
  source: fileName,
25
24
  text,
@@ -1,11 +1,11 @@
1
1
  declare const peg$allowedStartRules: string[];
2
- declare function peg$SyntaxError(message: any, expected: any, found: any, location: any): Error;
3
- declare class peg$SyntaxError {
2
+ declare class peg$SyntaxError extends SyntaxError {
3
+ static buildMessage(expected: any, found: any): string;
4
4
  constructor(message: any, expected: any, found: any, location: any);
5
+ expected: any;
6
+ found: any;
7
+ location: any;
5
8
  format(sources: any): string;
6
9
  }
7
- declare namespace peg$SyntaxError {
8
- function buildMessage(expected: any, found: any): string;
9
- }
10
10
  declare function peg$parse(input: any, options: any): any;
11
11
  export { peg$allowedStartRules as StartRules, peg$SyntaxError as SyntaxError, peg$parse as parse };
package/lib/resolv.peg.js CHANGED
@@ -1,4 +1,4 @@
1
- // @generated by Peggy 4.0.2.
1
+ // @generated by Peggy 5.0.6.
2
2
  //
3
3
  // https://peggyjs.org/
4
4
 
@@ -8,312 +8,300 @@
8
8
  import net from 'net'
9
9
  import {resolv, gather, maybeNum} from './defaults.js'
10
10
 
11
- function peg$subclass(child, parent) {
12
- function C() { this.constructor = child; }
13
- C.prototype = parent.prototype;
14
- child.prototype = new C();
15
- }
16
-
17
- function peg$SyntaxError(message, expected, found, location) {
18
- var self = Error.call(this, message);
19
- // istanbul ignore next Check is a necessary evil to support older environments
20
- if (Object.setPrototypeOf) {
21
- Object.setPrototypeOf(self, peg$SyntaxError.prototype);
22
- }
23
- self.expected = expected;
24
- self.found = found;
25
- self.location = location;
26
- self.name = "SyntaxError";
27
- return self;
28
- }
11
+ class peg$SyntaxError extends SyntaxError {
12
+ constructor(message, expected, found, location) {
13
+ super(message);
14
+ this.expected = expected;
15
+ this.found = found;
16
+ this.location = location;
17
+ this.name = "SyntaxError";
18
+ }
29
19
 
30
- peg$subclass(peg$SyntaxError, Error);
20
+ format(sources) {
21
+ let str = "Error: " + this.message;
22
+ if (this.location) {
23
+ let src = null;
24
+ const st = sources.find(s => s.source === this.location.source);
25
+ if (st) {
26
+ src = st.text.split(/\r\n|\n|\r/g);
27
+ }
28
+ const s = this.location.start;
29
+ const offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
30
+ ? this.location.source.offset(s)
31
+ : s;
32
+ const loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
33
+ if (src) {
34
+ const e = this.location.end;
35
+ const filler = "".padEnd(offset_s.line.toString().length, " ");
36
+ const line = src[s.line - 1];
37
+ const last = s.line === e.line ? e.column : line.length + 1;
38
+ const hatLen = (last - s.column) || 1;
39
+ str += "\n --> " + loc + "\n"
40
+ + filler + " |\n"
41
+ + offset_s.line + " | " + line + "\n"
42
+ + filler + " | " + "".padEnd(s.column - 1, " ")
43
+ + "".padEnd(hatLen, "^");
44
+ } else {
45
+ str += "\n at " + loc;
46
+ }
47
+ }
48
+ return str;
49
+ }
31
50
 
32
- function peg$padEnd(str, targetLength, padString) {
33
- padString = padString || " ";
34
- if (str.length > targetLength) { return str; }
35
- targetLength -= str.length;
36
- padString += padString.repeat(targetLength);
37
- return str + padString.slice(0, targetLength);
38
- }
51
+ static buildMessage(expected, found) {
52
+ function hex(ch) {
53
+ return ch.codePointAt(0).toString(16).toUpperCase();
54
+ }
39
55
 
40
- peg$SyntaxError.prototype.format = function(sources) {
41
- var str = "Error: " + this.message;
42
- if (this.location) {
43
- var src = null;
44
- var k;
45
- for (k = 0; k < sources.length; k++) {
46
- if (sources[k].source === this.location.source) {
47
- src = sources[k].text.split(/\r\n|\n|\r/g);
48
- break;
49
- }
50
- }
51
- var s = this.location.start;
52
- var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
53
- ? this.location.source.offset(s)
54
- : s;
55
- var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
56
- if (src) {
57
- var e = this.location.end;
58
- var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
59
- var line = src[s.line - 1];
60
- var last = s.line === e.line ? e.column : line.length + 1;
61
- var hatLen = (last - s.column) || 1;
62
- str += "\n --> " + loc + "\n"
63
- + filler + " |\n"
64
- + offset_s.line + " | " + line + "\n"
65
- + filler + " | " + peg$padEnd("", s.column - 1, ' ')
66
- + peg$padEnd("", hatLen, "^");
67
- } else {
68
- str += "\n at " + loc;
69
- }
70
- }
71
- return str;
72
- };
56
+ const nonPrintable = Object.prototype.hasOwnProperty.call(RegExp.prototype, "unicode")
57
+ ? new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]", "gu")
58
+ : null;
59
+ function unicodeEscape(s) {
60
+ if (nonPrintable) {
61
+ return s.replace(nonPrintable, ch => "\\u{" + hex(ch) + "}");
62
+ }
63
+ return s;
64
+ }
65
+
66
+ function literalEscape(s) {
67
+ return unicodeEscape(s
68
+ .replace(/\\/g, "\\\\")
69
+ .replace(/"/g, "\\\"")
70
+ .replace(/\0/g, "\\0")
71
+ .replace(/\t/g, "\\t")
72
+ .replace(/\n/g, "\\n")
73
+ .replace(/\r/g, "\\r")
74
+ .replace(/[\x00-\x0F]/g, ch => "\\x0" + hex(ch))
75
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
76
+ }
77
+
78
+ function classEscape(s) {
79
+ return unicodeEscape(s
80
+ .replace(/\\/g, "\\\\")
81
+ .replace(/\]/g, "\\]")
82
+ .replace(/\^/g, "\\^")
83
+ .replace(/-/g, "\\-")
84
+ .replace(/\0/g, "\\0")
85
+ .replace(/\t/g, "\\t")
86
+ .replace(/\n/g, "\\n")
87
+ .replace(/\r/g, "\\r")
88
+ .replace(/[\x00-\x0F]/g, ch => "\\x0" + hex(ch))
89
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
90
+ }
91
+
92
+ const DESCRIBE_EXPECTATION_FNS = {
93
+ literal(expectation) {
94
+ return "\"" + literalEscape(expectation.text) + "\"";
95
+ },
73
96
 
74
- peg$SyntaxError.buildMessage = function(expected, found) {
75
- var DESCRIBE_EXPECTATION_FNS = {
76
- literal: function(expectation) {
77
- return "\"" + literalEscape(expectation.text) + "\"";
78
- },
97
+ class(expectation) {
98
+ const escapedParts = expectation.parts.map(
99
+ part => (Array.isArray(part)
100
+ ? classEscape(part[0]) + "-" + classEscape(part[1])
101
+ : classEscape(part))
102
+ );
79
103
 
80
- class: function(expectation) {
81
- var escapedParts = expectation.parts.map(function(part) {
82
- return Array.isArray(part)
83
- ? classEscape(part[0]) + "-" + classEscape(part[1])
84
- : classEscape(part);
85
- });
104
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]" + (expectation.unicode ? "u" : "");
105
+ },
86
106
 
87
- return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
88
- },
107
+ any() {
108
+ return "any character";
109
+ },
89
110
 
90
- any: function() {
91
- return "any character";
92
- },
111
+ end() {
112
+ return "end of input";
113
+ },
93
114
 
94
- end: function() {
95
- return "end of input";
96
- },
115
+ other(expectation) {
116
+ return expectation.description;
117
+ },
118
+ };
97
119
 
98
- other: function(expectation) {
99
- return expectation.description;
120
+ function describeExpectation(expectation) {
121
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
100
122
  }
101
- };
102
-
103
- function hex(ch) {
104
- return ch.charCodeAt(0).toString(16).toUpperCase();
105
- }
106
-
107
- function literalEscape(s) {
108
- return s
109
- .replace(/\\/g, "\\\\")
110
- .replace(/"/g, "\\\"")
111
- .replace(/\0/g, "\\0")
112
- .replace(/\t/g, "\\t")
113
- .replace(/\n/g, "\\n")
114
- .replace(/\r/g, "\\r")
115
- .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
116
- .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
117
- }
118
123
 
119
- function classEscape(s) {
120
- return s
121
- .replace(/\\/g, "\\\\")
122
- .replace(/\]/g, "\\]")
123
- .replace(/\^/g, "\\^")
124
- .replace(/-/g, "\\-")
125
- .replace(/\0/g, "\\0")
126
- .replace(/\t/g, "\\t")
127
- .replace(/\n/g, "\\n")
128
- .replace(/\r/g, "\\r")
129
- .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
130
- .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
131
- }
124
+ function describeExpected(expected) {
125
+ const descriptions = expected.map(describeExpectation);
126
+ descriptions.sort();
132
127
 
133
- function describeExpectation(expectation) {
134
- return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
135
- }
128
+ if (descriptions.length > 0) {
129
+ let j = 1;
130
+ for (let i = 1; i < descriptions.length; i++) {
131
+ if (descriptions[i - 1] !== descriptions[i]) {
132
+ descriptions[j] = descriptions[i];
133
+ j++;
134
+ }
135
+ }
136
+ descriptions.length = j;
137
+ }
136
138
 
137
- function describeExpected(expected) {
138
- var descriptions = expected.map(describeExpectation);
139
- var i, j;
139
+ switch (descriptions.length) {
140
+ case 1:
141
+ return descriptions[0];
140
142
 
141
- descriptions.sort();
143
+ case 2:
144
+ return descriptions[0] + " or " + descriptions[1];
142
145
 
143
- if (descriptions.length > 0) {
144
- for (i = 1, j = 1; i < descriptions.length; i++) {
145
- if (descriptions[i - 1] !== descriptions[i]) {
146
- descriptions[j] = descriptions[i];
147
- j++;
148
- }
146
+ default:
147
+ return descriptions.slice(0, -1).join(", ")
148
+ + ", or "
149
+ + descriptions[descriptions.length - 1];
149
150
  }
150
- descriptions.length = j;
151
151
  }
152
152
 
153
- switch (descriptions.length) {
154
- case 1:
155
- return descriptions[0];
156
-
157
- case 2:
158
- return descriptions[0] + " or " + descriptions[1];
159
-
160
- default:
161
- return descriptions.slice(0, -1).join(", ")
162
- + ", or "
163
- + descriptions[descriptions.length - 1];
153
+ function describeFound(found) {
154
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
164
155
  }
165
- }
166
156
 
167
- function describeFound(found) {
168
- return found ? "\"" + literalEscape(found) + "\"" : "end of input";
157
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
169
158
  }
170
-
171
- return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
172
- };
159
+ }
173
160
 
174
161
  function peg$parse(input, options) {
175
162
  options = options !== undefined ? options : {};
176
163
 
177
- var peg$FAILED = {};
178
- var peg$source = options.grammarSource;
179
-
180
- var peg$startRuleFunctions = { lines: peg$parselines };
181
- var peg$startRuleFunction = peg$parselines;
182
-
183
- var peg$c0 = "nameserver";
184
- var peg$c1 = "search";
185
- var peg$c2 = "domain";
186
- var peg$c3 = "options";
187
- var peg$c4 = ":";
188
- var peg$c5 = "sortlist";
189
- var peg$c6 = "/";
190
- var peg$c7 = "port";
191
- var peg$c8 = "timeout";
192
- var peg$c9 = "search_order";
193
- var peg$c10 = "lookup";
194
- var peg$c11 = "file";
195
- var peg$c12 = "yp";
196
- var peg$c13 = "bind";
197
- var peg$c14 = "family";
198
- var peg$c15 = "inet";
199
- var peg$c16 = "::";
200
- var peg$c17 = ".";
201
- var peg$c18 = "\r\n";
202
-
203
- var peg$r0 = /^[;#]/;
204
- var peg$r1 = /^[^\r\n]/;
205
- var peg$r2 = /^[0-9]/;
206
- var peg$r3 = /^[46]/;
207
- var peg$r4 = /^[^#;\r\n]/;
208
- var peg$r5 = /^[0-9a-fA-F:.]/;
209
- var peg$r6 = /^[0-9a-f:]/i;
210
- var peg$r7 = /^[0-9a-f]/i;
211
- var peg$r8 = /^[A-Z0-9_\-]/i;
212
- var peg$r9 = /^[^ :#;,\t\r\n]/;
213
- var peg$r10 = /^[ \t]/;
214
- var peg$r11 = /^[\n\r]/;
215
-
216
- var peg$e0 = peg$otherExpectation("comment");
217
- var peg$e1 = peg$classExpectation([";", "#"], false, false);
218
- var peg$e2 = peg$classExpectation(["\r", "\n"], true, false);
219
- var peg$e3 = peg$literalExpectation("nameserver", false);
220
- var peg$e4 = peg$literalExpectation("search", false);
221
- var peg$e5 = peg$literalExpectation("domain", false);
222
- var peg$e6 = peg$literalExpectation("options", false);
223
- var peg$e7 = peg$literalExpectation(":", false);
224
- var peg$e8 = peg$literalExpectation("sortlist", false);
225
- var peg$e9 = peg$literalExpectation("/", false);
226
- var peg$e10 = peg$literalExpectation("port", false);
227
- var peg$e11 = peg$literalExpectation("timeout", false);
228
- var peg$e12 = peg$classExpectation([["0", "9"]], false, false);
229
- var peg$e13 = peg$literalExpectation("search_order", false);
230
- var peg$e14 = peg$literalExpectation("lookup", false);
231
- var peg$e15 = peg$literalExpectation("file", false);
232
- var peg$e16 = peg$literalExpectation("yp", false);
233
- var peg$e17 = peg$literalExpectation("bind", false);
234
- var peg$e18 = peg$literalExpectation("family", false);
235
- var peg$e19 = peg$literalExpectation("inet", false);
236
- var peg$e20 = peg$classExpectation(["4", "6"], false, false);
237
- var peg$e21 = peg$classExpectation(["#", ";", "\r", "\n"], true, false);
238
- var peg$e22 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"], ":", "."], false, false);
239
- var peg$e23 = peg$literalExpectation("::", false);
240
- var peg$e24 = peg$literalExpectation(".", false);
241
- var peg$e25 = peg$classExpectation([["0", "9"], ["a", "f"], ":"], false, true);
242
- var peg$e26 = peg$classExpectation([["0", "9"], ["a", "f"]], false, true);
243
- var peg$e27 = peg$classExpectation([["A", "Z"], ["0", "9"], "_", "-"], false, true);
244
- var peg$e28 = peg$classExpectation([" ", ":", "#", ";", ",", "\t", "\r", "\n"], true, false);
245
- var peg$e29 = peg$anyExpectation();
246
- var peg$e30 = peg$otherExpectation("optional whitespace");
247
- var peg$e31 = peg$classExpectation([" ", "\t"], false, false);
248
- var peg$e32 = peg$otherExpectation("whitespace");
249
- var peg$e33 = peg$otherExpectation("EOL");
250
- var peg$e34 = peg$literalExpectation("\r\n", false);
251
- var peg$e35 = peg$classExpectation(["\n", "\r"], false, false);
252
-
253
- var peg$f0 = function(lines) {
254
- return resolv(gather(lines), ports);
255
- };
256
- var peg$f1 = function() { return undefined; };
257
- var peg$f2 = function(nameserver) { return { nameserver } };
258
- var peg$f3 = function(search) {
259
- return { search };
164
+ const peg$FAILED = {};
165
+ const peg$source = options.grammarSource;
166
+
167
+ const peg$startRuleFunctions = {
168
+ lines: peg$parselines,
260
169
  };
261
- var peg$f4 = function(search) { return { search } };
262
- var peg$f5 = function(options) { return { options } };
263
- var peg$f6 = function(n, v) { return [n.replace('-', '_'), maybeNum(v)] };
264
- var peg$f7 = function(sortlist) { return { sortlist } };
265
- var peg$f8 = function(address, mask) { return { address, mask } };
266
- var peg$f9 = function(port) {
170
+ let peg$startRuleFunction = peg$parselines;
171
+
172
+ const peg$c0 = "nameserver";
173
+ const peg$c1 = "search";
174
+ const peg$c2 = "domain";
175
+ const peg$c3 = "options";
176
+ const peg$c4 = ":";
177
+ const peg$c5 = "sortlist";
178
+ const peg$c6 = "/";
179
+ const peg$c7 = "port";
180
+ const peg$c8 = "timeout";
181
+ const peg$c9 = "search_order";
182
+ const peg$c10 = "lookup";
183
+ const peg$c11 = "file";
184
+ const peg$c12 = "yp";
185
+ const peg$c13 = "bind";
186
+ const peg$c14 = "family";
187
+ const peg$c15 = "inet";
188
+ const peg$c16 = "::";
189
+ const peg$c17 = ".";
190
+ const peg$c18 = "\r\n";
191
+
192
+ const peg$r0 = /^[;#]/;
193
+ const peg$r1 = /^[^\r\n]/;
194
+ const peg$r2 = /^[0-9]/;
195
+ const peg$r3 = /^[46]/;
196
+ const peg$r4 = /^[^#;\r\n]/;
197
+ const peg$r5 = /^[0-9a-fA-F:.]/;
198
+ const peg$r6 = /^[0-9a-f:]/i;
199
+ const peg$r7 = /^[0-9a-f]/i;
200
+ const peg$r8 = /^[A-Z0-9_\-]/i;
201
+ const peg$r9 = /^[^ :#;,\t\r\n]/;
202
+ const peg$r10 = /^[ \t]/;
203
+ const peg$r11 = /^[\n\r]/;
204
+
205
+ const peg$e0 = peg$otherExpectation("comment");
206
+ const peg$e1 = peg$classExpectation([";", "#"], false, false, false);
207
+ const peg$e2 = peg$classExpectation(["\r", "\n"], true, false, false);
208
+ const peg$e3 = peg$literalExpectation("nameserver", false);
209
+ const peg$e4 = peg$literalExpectation("search", false);
210
+ const peg$e5 = peg$literalExpectation("domain", false);
211
+ const peg$e6 = peg$literalExpectation("options", false);
212
+ const peg$e7 = peg$literalExpectation(":", false);
213
+ const peg$e8 = peg$literalExpectation("sortlist", false);
214
+ const peg$e9 = peg$literalExpectation("/", false);
215
+ const peg$e10 = peg$literalExpectation("port", false);
216
+ const peg$e11 = peg$literalExpectation("timeout", false);
217
+ const peg$e12 = peg$classExpectation([["0", "9"]], false, false, false);
218
+ const peg$e13 = peg$literalExpectation("search_order", false);
219
+ const peg$e14 = peg$literalExpectation("lookup", false);
220
+ const peg$e15 = peg$literalExpectation("file", false);
221
+ const peg$e16 = peg$literalExpectation("yp", false);
222
+ const peg$e17 = peg$literalExpectation("bind", false);
223
+ const peg$e18 = peg$literalExpectation("family", false);
224
+ const peg$e19 = peg$literalExpectation("inet", false);
225
+ const peg$e20 = peg$classExpectation(["4", "6"], false, false, false);
226
+ const peg$e21 = peg$classExpectation(["#", ";", "\r", "\n"], true, false, false);
227
+ const peg$e22 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"], ":", "."], false, false, false);
228
+ const peg$e23 = peg$literalExpectation("::", false);
229
+ const peg$e24 = peg$literalExpectation(".", false);
230
+ const peg$e25 = peg$classExpectation([["0", "9"], ["a", "f"], ":"], false, true, false);
231
+ const peg$e26 = peg$classExpectation([["0", "9"], ["a", "f"]], false, true, false);
232
+ const peg$e27 = peg$classExpectation([["A", "Z"], ["0", "9"], "_", "-"], false, true, false);
233
+ const peg$e28 = peg$classExpectation([" ", ":", "#", ";", ",", "\t", "\r", "\n"], true, false, false);
234
+ const peg$e29 = peg$anyExpectation();
235
+ const peg$e30 = peg$classExpectation([" ", "\t"], false, false, false);
236
+ const peg$e31 = peg$otherExpectation("whitespace");
237
+ const peg$e32 = peg$otherExpectation("EOL");
238
+ const peg$e33 = peg$literalExpectation("\r\n", false);
239
+ const peg$e34 = peg$classExpectation(["\n", "\r"], false, false, false);
240
+
241
+ function peg$f0(lines) {
242
+ return resolv(gather(lines), ports);
243
+ }
244
+ function peg$f1() { return undefined; }
245
+ function peg$f2(nameserver) { return { nameserver } }
246
+ function peg$f3(search) {
247
+ return { search };
248
+ }
249
+ function peg$f4(search) { return { search } }
250
+ function peg$f5(options) { return { options } }
251
+ function peg$f6(n, v) { return [n.replace('-', '_'), maybeNum(v)] }
252
+ function peg$f7(sortlist) { return { sortlist } }
253
+ function peg$f8(address, mask) { return { address, mask } }
254
+ function peg$f9(port) {
267
255
  ports[''] = port;
268
- };
269
- var peg$f10 = function(n) {
256
+ }
257
+ function peg$f10(n) {
270
258
  return { timeout: parseInt(n, 10) }
271
- };
272
- var peg$f11 = function(n) {
259
+ }
260
+ function peg$f11(n) {
273
261
  return { search_order: parseInt(n, 10) }
274
- };
275
- var peg$f12 = function(lookup) {
262
+ }
263
+ function peg$f12(lookup) {
276
264
  return { lookup }
277
- };
278
- var peg$f13 = function(family) {
265
+ }
266
+ function peg$f13(family) {
279
267
  return { family }
280
- };
281
- var peg$f14 = function(name, val) { return {
282
- errors: {text: text(), location: location()}}
283
- };
284
- var peg$f15 = function(addr) { return net.isIP(addr) };
285
- var peg$f16 = function(v6, v4) { return net.isIPv6(`${v6}::${v4}`) };
286
- var peg$f17 = function(v6, v4) {
287
- const v6addr = `${v6}::${v4}`
288
- ports[v6addr] = ports[v4];
289
- delete ports[v4];
290
- return v6addr;
291
- };
292
- var peg$f18 = function(addr, port) {
293
- ports[addr] = port;
294
- return addr;
295
- };
296
- var peg$f19 = function(addr) { return net.isIPv6(addr) };
297
- var peg$f20 = function(addr, port) {
298
- ports[addr] = port;
299
- return addr
300
- };
301
- var peg$f21 = function(n) { return (parseInt(n, 10) < 256) };
302
- var peg$f22 = function(n) {
303
- const num = parseInt(n, 10)
304
- if (num > 65535) {
305
- error('Invalid port number');
306
268
  }
307
- return num;
308
- };
309
- var peg$currPos = options.peg$currPos | 0;
310
- var peg$savedPos = peg$currPos;
311
- var peg$posDetailsCache = [{ line: 1, column: 1 }];
312
- var peg$maxFailPos = peg$currPos;
313
- var peg$maxFailExpected = options.peg$maxFailExpected || [];
314
- var peg$silentFails = options.peg$silentFails | 0;
269
+ function peg$f14(name, val) { return {
270
+ errors: {text: text(), location: location()}}
271
+ }
272
+ function peg$f15(addr) { return net.isIP(addr) }
273
+ function peg$f16(v6, v4) { return net.isIPv6(`${v6}::${v4}`) }
274
+ function peg$f17(v6, v4) {
275
+ const v6addr = `${v6}::${v4}`
276
+ ports[v6addr] = ports[v4];
277
+ delete ports[v4];
278
+ return v6addr;
279
+ }
280
+ function peg$f18(addr, port) {
281
+ ports[addr] = port;
282
+ return addr;
283
+ }
284
+ function peg$f19(addr) { return net.isIPv6(addr) }
285
+ function peg$f20(addr, port) {
286
+ ports[addr] = port;
287
+ return addr
288
+ }
289
+ function peg$f21(n) { return (parseInt(n, 10) < 256) }
290
+ function peg$f22(n) {
291
+ const num = parseInt(n, 10)
292
+ if (num > 65535) {
293
+ error('Invalid port number');
294
+ }
295
+ return num;
296
+ }
297
+ let peg$currPos = options.peg$currPos | 0;
298
+ let peg$savedPos = peg$currPos;
299
+ const peg$posDetailsCache = [{ line: 1, column: 1 }];
300
+ let peg$maxFailPos = peg$currPos;
301
+ let peg$maxFailExpected = options.peg$maxFailExpected || [];
302
+ let peg$silentFails = options.peg$silentFails | 0;
315
303
 
316
- var peg$result;
304
+ let peg$result;
317
305
 
318
306
  if (options.startRule) {
319
307
  if (!(options.startRule in peg$startRuleFunctions)) {
@@ -335,7 +323,7 @@ function peg$parse(input, options) {
335
323
  return {
336
324
  source: peg$source,
337
325
  start: peg$savedPos,
338
- end: peg$currPos
326
+ end: peg$currPos,
339
327
  };
340
328
  }
341
329
 
@@ -363,12 +351,20 @@ function peg$parse(input, options) {
363
351
  throw peg$buildSimpleError(message, location);
364
352
  }
365
353
 
354
+ function peg$getUnicode(pos = peg$currPos) {
355
+ const cp = input.codePointAt(pos);
356
+ if (cp === undefined) {
357
+ return "";
358
+ }
359
+ return String.fromCodePoint(cp);
360
+ }
361
+
366
362
  function peg$literalExpectation(text, ignoreCase) {
367
- return { type: "literal", text: text, ignoreCase: ignoreCase };
363
+ return { type: "literal", text, ignoreCase };
368
364
  }
369
365
 
370
- function peg$classExpectation(parts, inverted, ignoreCase) {
371
- return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
366
+ function peg$classExpectation(parts, inverted, ignoreCase, unicode) {
367
+ return { type: "class", parts, inverted, ignoreCase, unicode };
372
368
  }
373
369
 
374
370
  function peg$anyExpectation() {
@@ -380,12 +376,12 @@ function peg$parse(input, options) {
380
376
  }
381
377
 
382
378
  function peg$otherExpectation(description) {
383
- return { type: "other", description: description };
379
+ return { type: "other", description };
384
380
  }
385
381
 
386
382
  function peg$computePosDetails(pos) {
387
- var details = peg$posDetailsCache[pos];
388
- var p;
383
+ let details = peg$posDetailsCache[pos];
384
+ let p;
389
385
 
390
386
  if (details) {
391
387
  return details;
@@ -400,7 +396,7 @@ function peg$parse(input, options) {
400
396
  details = peg$posDetailsCache[p];
401
397
  details = {
402
398
  line: details.line,
403
- column: details.column
399
+ column: details.column,
404
400
  };
405
401
 
406
402
  while (p < pos) {
@@ -421,21 +417,21 @@ function peg$parse(input, options) {
421
417
  }
422
418
 
423
419
  function peg$computeLocation(startPos, endPos, offset) {
424
- var startPosDetails = peg$computePosDetails(startPos);
425
- var endPosDetails = peg$computePosDetails(endPos);
420
+ const startPosDetails = peg$computePosDetails(startPos);
421
+ const endPosDetails = peg$computePosDetails(endPos);
426
422
 
427
- var res = {
423
+ const res = {
428
424
  source: peg$source,
429
425
  start: {
430
426
  offset: startPos,
431
427
  line: startPosDetails.line,
432
- column: startPosDetails.column
428
+ column: startPosDetails.column,
433
429
  },
434
430
  end: {
435
431
  offset: endPos,
436
432
  line: endPosDetails.line,
437
- column: endPosDetails.column
438
- }
433
+ column: endPosDetails.column,
434
+ },
439
435
  };
440
436
  if (offset && peg$source && (typeof peg$source.offset === "function")) {
441
437
  res.start = peg$source.offset(res.start);
@@ -469,7 +465,7 @@ function peg$parse(input, options) {
469
465
  }
470
466
 
471
467
  function peg$parselines() {
472
- var s0, s1, s2, s3;
468
+ let s0, s1, s2, s3;
473
469
 
474
470
  s0 = peg$currPos;
475
471
  s1 = [];
@@ -496,7 +492,7 @@ function peg$parse(input, options) {
496
492
  }
497
493
 
498
494
  function peg$parselineComment() {
499
- var s0, s1, s2, s3, s4;
495
+ let s0, s1, s2, s3, s4;
500
496
 
501
497
  s0 = peg$currPos;
502
498
  s1 = peg$parses();
@@ -515,7 +511,7 @@ function peg$parse(input, options) {
515
511
  }
516
512
 
517
513
  function peg$parseline() {
518
- var s0, s1, s2, s3;
514
+ let s0, s1, s2, s3;
519
515
 
520
516
  s0 = peg$currPos;
521
517
  s1 = peg$parsenameserver();
@@ -773,7 +769,7 @@ function peg$parse(input, options) {
773
769
  }
774
770
 
775
771
  function peg$parsecomment() {
776
- var s0, s1, s2, s3;
772
+ let s0, s1, s2, s3;
777
773
 
778
774
  peg$silentFails++;
779
775
  s0 = peg$currPos;
@@ -819,7 +815,7 @@ function peg$parse(input, options) {
819
815
  }
820
816
 
821
817
  function peg$parsenameserver() {
822
- var s0, s1, s2, s3;
818
+ let s0, s1, s2, s3;
823
819
 
824
820
  s0 = peg$currPos;
825
821
  if (input.substr(peg$currPos, 10) === peg$c0) {
@@ -853,7 +849,7 @@ function peg$parse(input, options) {
853
849
  }
854
850
 
855
851
  function peg$parsesearch() {
856
- var s0, s1, s2, s3, s4, s5, s6;
852
+ let s0, s1, s2, s3, s4, s5, s6;
857
853
 
858
854
  s0 = peg$currPos;
859
855
  if (input.substr(peg$currPos, 6) === peg$c1) {
@@ -911,7 +907,7 @@ function peg$parse(input, options) {
911
907
  }
912
908
 
913
909
  function peg$parsedomain() {
914
- var s0, s1, s2, s3;
910
+ let s0, s1, s2, s3;
915
911
 
916
912
  s0 = peg$currPos;
917
913
  if (input.substr(peg$currPos, 6) === peg$c2) {
@@ -945,7 +941,7 @@ function peg$parse(input, options) {
945
941
  }
946
942
 
947
943
  function peg$parseoptions() {
948
- var s0, s1, s2, s3, s4, s5;
944
+ let s0, s1, s2, s3, s4, s5;
949
945
 
950
946
  s0 = peg$currPos;
951
947
  if (input.substr(peg$currPos, 7) === peg$c3) {
@@ -1008,7 +1004,7 @@ function peg$parse(input, options) {
1008
1004
  }
1009
1005
 
1010
1006
  function peg$parseoption() {
1011
- var s0, s1, s2, s3, s4, s5, s6;
1007
+ let s0, s1, s2, s3, s4, s5, s6;
1012
1008
 
1013
1009
  s0 = peg$currPos;
1014
1010
  s1 = peg$parsename();
@@ -1049,7 +1045,7 @@ function peg$parse(input, options) {
1049
1045
  }
1050
1046
 
1051
1047
  function peg$parsesortlist() {
1052
- var s0, s1, s2, s3, s4, s5;
1048
+ let s0, s1, s2, s3, s4, s5;
1053
1049
 
1054
1050
  s0 = peg$currPos;
1055
1051
  if (input.substr(peg$currPos, 8) === peg$c5) {
@@ -1112,7 +1108,7 @@ function peg$parse(input, options) {
1112
1108
  }
1113
1109
 
1114
1110
  function peg$parseipNetmask() {
1115
- var s0, s1, s2, s3, s4, s5, s6;
1111
+ let s0, s1, s2, s3, s4, s5, s6;
1116
1112
 
1117
1113
  s0 = peg$currPos;
1118
1114
  s1 = peg$parseip();
@@ -1153,7 +1149,7 @@ function peg$parse(input, options) {
1153
1149
  }
1154
1150
 
1155
1151
  function peg$parseport() {
1156
- var s0, s1, s2, s3;
1152
+ let s0, s1, s2, s3;
1157
1153
 
1158
1154
  s0 = peg$currPos;
1159
1155
  if (input.substr(peg$currPos, 4) === peg$c7) {
@@ -1187,7 +1183,7 @@ function peg$parse(input, options) {
1187
1183
  }
1188
1184
 
1189
1185
  function peg$parsetimeout() {
1190
- var s0, s1, s2, s3, s4, s5;
1186
+ let s0, s1, s2, s3, s4, s5;
1191
1187
 
1192
1188
  s0 = peg$currPos;
1193
1189
  if (input.substr(peg$currPos, 7) === peg$c8) {
@@ -1248,7 +1244,7 @@ function peg$parse(input, options) {
1248
1244
  }
1249
1245
 
1250
1246
  function peg$parsesearch_order() {
1251
- var s0, s1, s2, s3, s4, s5;
1247
+ let s0, s1, s2, s3, s4, s5;
1252
1248
 
1253
1249
  s0 = peg$currPos;
1254
1250
  if (input.substr(peg$currPos, 12) === peg$c9) {
@@ -1309,7 +1305,7 @@ function peg$parse(input, options) {
1309
1305
  }
1310
1306
 
1311
1307
  function peg$parselookup() {
1312
- var s0, s1, s2, s3, s4, s5, s6;
1308
+ let s0, s1, s2, s3, s4, s5, s6;
1313
1309
 
1314
1310
  s0 = peg$currPos;
1315
1311
  if (input.substr(peg$currPos, 6) === peg$c10) {
@@ -1367,7 +1363,7 @@ function peg$parse(input, options) {
1367
1363
  }
1368
1364
 
1369
1365
  function peg$parselookupApproach() {
1370
- var s0;
1366
+ let s0;
1371
1367
 
1372
1368
  if (input.substr(peg$currPos, 4) === peg$c11) {
1373
1369
  s0 = peg$c11;
@@ -1399,7 +1395,7 @@ function peg$parse(input, options) {
1399
1395
  }
1400
1396
 
1401
1397
  function peg$parsefamily() {
1402
- var s0, s1, s2, s3, s4, s5, s6;
1398
+ let s0, s1, s2, s3, s4, s5, s6;
1403
1399
 
1404
1400
  s0 = peg$currPos;
1405
1401
  if (input.substr(peg$currPos, 6) === peg$c14) {
@@ -1461,7 +1457,7 @@ function peg$parse(input, options) {
1461
1457
  }
1462
1458
 
1463
1459
  function peg$parseaddressFamily() {
1464
- var s0, s1, s2, s3;
1460
+ let s0, s1, s2, s3;
1465
1461
 
1466
1462
  s0 = peg$currPos;
1467
1463
  s1 = peg$currPos;
@@ -1501,7 +1497,7 @@ function peg$parse(input, options) {
1501
1497
  }
1502
1498
 
1503
1499
  function peg$parseunknown() {
1504
- var s0, s1, s2, s3, s4, s5;
1500
+ let s0, s1, s2, s3, s4, s5;
1505
1501
 
1506
1502
  s0 = peg$currPos;
1507
1503
  s1 = peg$parsename();
@@ -1538,7 +1534,7 @@ function peg$parse(input, options) {
1538
1534
  }
1539
1535
 
1540
1536
  function peg$parseip() {
1541
- var s0, s1, s2, s3;
1537
+ let s0, s1, s2, s3;
1542
1538
 
1543
1539
  s0 = peg$currPos;
1544
1540
  s1 = peg$currPos;
@@ -1592,7 +1588,7 @@ function peg$parse(input, options) {
1592
1588
  }
1593
1589
 
1594
1590
  function peg$parseipWithPort() {
1595
- var s0;
1591
+ let s0;
1596
1592
 
1597
1593
  s0 = peg$parseipv4withPort();
1598
1594
  if (s0 === peg$FAILED) {
@@ -1603,7 +1599,7 @@ function peg$parse(input, options) {
1603
1599
  }
1604
1600
 
1605
1601
  function peg$parseipv6withPort() {
1606
- var s0, s1, s2, s3, s4;
1602
+ let s0, s1, s2, s3, s4;
1607
1603
 
1608
1604
  s0 = peg$currPos;
1609
1605
  s1 = peg$parseipv6();
@@ -1678,7 +1674,7 @@ function peg$parse(input, options) {
1678
1674
  }
1679
1675
 
1680
1676
  function peg$parseipv6wColon() {
1681
- var s0, s1, s2, s3;
1677
+ let s0, s1, s2, s3;
1682
1678
 
1683
1679
  s0 = peg$currPos;
1684
1680
  s1 = peg$currPos;
@@ -1732,7 +1728,7 @@ function peg$parse(input, options) {
1732
1728
  }
1733
1729
 
1734
1730
  function peg$parseipv6() {
1735
- var s0, s1, s2;
1731
+ let s0, s1, s2;
1736
1732
 
1737
1733
  s0 = peg$currPos;
1738
1734
  s1 = [];
@@ -1747,7 +1743,7 @@ function peg$parse(input, options) {
1747
1743
  }
1748
1744
 
1749
1745
  function peg$parseipv6char() {
1750
- var s0, s1, s2, s3;
1746
+ let s0, s1, s2, s3;
1751
1747
 
1752
1748
  s0 = input.charAt(peg$currPos);
1753
1749
  if (peg$r7.test(s0)) {
@@ -1799,7 +1795,7 @@ function peg$parse(input, options) {
1799
1795
  }
1800
1796
 
1801
1797
  function peg$parseipv4withPort() {
1802
- var s0, s1, s2, s3, s4;
1798
+ let s0, s1, s2, s3, s4;
1803
1799
 
1804
1800
  s0 = peg$currPos;
1805
1801
  s1 = peg$parseipv4();
@@ -1838,7 +1834,7 @@ function peg$parse(input, options) {
1838
1834
  }
1839
1835
 
1840
1836
  function peg$parseipv4() {
1841
- var s0, s1, s2, s3, s4, s5;
1837
+ let s0, s1, s2, s3, s4, s5;
1842
1838
 
1843
1839
  s0 = peg$currPos;
1844
1840
  s1 = peg$currPos;
@@ -1893,7 +1889,7 @@ function peg$parse(input, options) {
1893
1889
  }
1894
1890
 
1895
1891
  function peg$parsebyte() {
1896
- var s0, s1, s2, s3;
1892
+ let s0, s1, s2, s3;
1897
1893
 
1898
1894
  s0 = peg$currPos;
1899
1895
  s1 = peg$currPos;
@@ -1947,7 +1943,7 @@ function peg$parse(input, options) {
1947
1943
  }
1948
1944
 
1949
1945
  function peg$parseportNum() {
1950
- var s0, s1, s2, s3;
1946
+ let s0, s1, s2, s3;
1951
1947
 
1952
1948
  s0 = peg$currPos;
1953
1949
  s1 = peg$currPos;
@@ -1988,7 +1984,7 @@ function peg$parse(input, options) {
1988
1984
  }
1989
1985
 
1990
1986
  function peg$parsename() {
1991
- var s0, s1, s2;
1987
+ let s0, s1, s2;
1992
1988
 
1993
1989
  s0 = peg$currPos;
1994
1990
  s1 = [];
@@ -2023,7 +2019,7 @@ function peg$parse(input, options) {
2023
2019
  }
2024
2020
 
2025
2021
  function peg$parsesearchDomain() {
2026
- var s0, s1, s2;
2022
+ let s0, s1, s2;
2027
2023
 
2028
2024
  s0 = peg$currPos;
2029
2025
  s1 = [];
@@ -2058,7 +2054,7 @@ function peg$parse(input, options) {
2058
2054
  }
2059
2055
 
2060
2056
  function peg$parselineEnd() {
2061
- var s0, s1, s2, s3, s4;
2057
+ let s0, s1, s2, s3, s4;
2062
2058
 
2063
2059
  s0 = peg$currPos;
2064
2060
  s1 = peg$parses();
@@ -2097,7 +2093,7 @@ function peg$parse(input, options) {
2097
2093
  }
2098
2094
 
2099
2095
  function peg$parses() {
2100
- var s0, s1;
2096
+ let s0, s1;
2101
2097
 
2102
2098
  peg$silentFails++;
2103
2099
  s0 = [];
@@ -2106,7 +2102,7 @@ function peg$parse(input, options) {
2106
2102
  peg$currPos++;
2107
2103
  } else {
2108
2104
  s1 = peg$FAILED;
2109
- if (peg$silentFails === 0) { peg$fail(peg$e31); }
2105
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
2110
2106
  }
2111
2107
  while (s1 !== peg$FAILED) {
2112
2108
  s0.push(s1);
@@ -2115,18 +2111,16 @@ function peg$parse(input, options) {
2115
2111
  peg$currPos++;
2116
2112
  } else {
2117
2113
  s1 = peg$FAILED;
2118
- if (peg$silentFails === 0) { peg$fail(peg$e31); }
2114
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
2119
2115
  }
2120
2116
  }
2121
2117
  peg$silentFails--;
2122
- s1 = peg$FAILED;
2123
- if (peg$silentFails === 0) { peg$fail(peg$e30); }
2124
2118
 
2125
2119
  return s0;
2126
2120
  }
2127
2121
 
2128
2122
  function peg$parseS() {
2129
- var s0, s1;
2123
+ let s0, s1;
2130
2124
 
2131
2125
  peg$silentFails++;
2132
2126
  s0 = [];
@@ -2135,7 +2129,7 @@ function peg$parse(input, options) {
2135
2129
  peg$currPos++;
2136
2130
  } else {
2137
2131
  s1 = peg$FAILED;
2138
- if (peg$silentFails === 0) { peg$fail(peg$e31); }
2132
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
2139
2133
  }
2140
2134
  if (s1 !== peg$FAILED) {
2141
2135
  while (s1 !== peg$FAILED) {
@@ -2145,7 +2139,7 @@ function peg$parse(input, options) {
2145
2139
  peg$currPos++;
2146
2140
  } else {
2147
2141
  s1 = peg$FAILED;
2148
- if (peg$silentFails === 0) { peg$fail(peg$e31); }
2142
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
2149
2143
  }
2150
2144
  }
2151
2145
  } else {
@@ -2154,14 +2148,14 @@ function peg$parse(input, options) {
2154
2148
  peg$silentFails--;
2155
2149
  if (s0 === peg$FAILED) {
2156
2150
  s1 = peg$FAILED;
2157
- if (peg$silentFails === 0) { peg$fail(peg$e32); }
2151
+ if (peg$silentFails === 0) { peg$fail(peg$e31); }
2158
2152
  }
2159
2153
 
2160
2154
  return s0;
2161
2155
  }
2162
2156
 
2163
2157
  function peg$parseeol() {
2164
- var s0, s1;
2158
+ let s0, s1;
2165
2159
 
2166
2160
  peg$silentFails++;
2167
2161
  if (input.substr(peg$currPos, 2) === peg$c18) {
@@ -2169,7 +2163,7 @@ function peg$parse(input, options) {
2169
2163
  peg$currPos += 2;
2170
2164
  } else {
2171
2165
  s0 = peg$FAILED;
2172
- if (peg$silentFails === 0) { peg$fail(peg$e34); }
2166
+ if (peg$silentFails === 0) { peg$fail(peg$e33); }
2173
2167
  }
2174
2168
  if (s0 === peg$FAILED) {
2175
2169
  s0 = input.charAt(peg$currPos);
@@ -2177,13 +2171,13 @@ function peg$parse(input, options) {
2177
2171
  peg$currPos++;
2178
2172
  } else {
2179
2173
  s0 = peg$FAILED;
2180
- if (peg$silentFails === 0) { peg$fail(peg$e35); }
2174
+ if (peg$silentFails === 0) { peg$fail(peg$e34); }
2181
2175
  }
2182
2176
  }
2183
2177
  peg$silentFails--;
2184
2178
  if (s0 === peg$FAILED) {
2185
2179
  s1 = peg$FAILED;
2186
- if (peg$silentFails === 0) { peg$fail(peg$e33); }
2180
+ if (peg$silentFails === 0) { peg$fail(peg$e32); }
2187
2181
  }
2188
2182
 
2189
2183
  return s0;
@@ -2196,30 +2190,36 @@ function peg$parse(input, options) {
2196
2190
 
2197
2191
  peg$result = peg$startRuleFunction();
2198
2192
 
2199
- if (options.peg$library) {
2200
- return /** @type {any} */ ({
2201
- peg$result,
2202
- peg$currPos,
2203
- peg$FAILED,
2204
- peg$maxFailExpected,
2205
- peg$maxFailPos
2206
- });
2207
- }
2208
- if (peg$result !== peg$FAILED && peg$currPos === input.length) {
2209
- return peg$result;
2210
- } else {
2193
+ const peg$success = (peg$result !== peg$FAILED && peg$currPos === input.length);
2194
+ function peg$throw() {
2211
2195
  if (peg$result !== peg$FAILED && peg$currPos < input.length) {
2212
2196
  peg$fail(peg$endExpectation());
2213
2197
  }
2214
2198
 
2215
2199
  throw peg$buildStructuredError(
2216
2200
  peg$maxFailExpected,
2217
- peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
2201
+ peg$maxFailPos < input.length ? peg$getUnicode(peg$maxFailPos) : null,
2218
2202
  peg$maxFailPos < input.length
2219
2203
  ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
2220
2204
  : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
2221
2205
  );
2222
2206
  }
2207
+ if (options.peg$library) {
2208
+ return /** @type {any} */ ({
2209
+ peg$result,
2210
+ peg$currPos,
2211
+ peg$FAILED,
2212
+ peg$maxFailExpected,
2213
+ peg$maxFailPos,
2214
+ peg$success,
2215
+ peg$throw: peg$success ? undefined : peg$throw,
2216
+ });
2217
+ }
2218
+ if (peg$success) {
2219
+ return peg$result;
2220
+ } else {
2221
+ peg$throw();
2222
+ }
2223
2223
  }
2224
2224
 
2225
2225
  const peg$allowedStartRules = [
package/package.json CHANGED
@@ -1,14 +1,9 @@
1
1
  {
2
2
  "name": "resolv-conf",
3
- "version": "2.0.0",
3
+ "version": "3.0.4",
4
4
  "description": "Parse resolv.conf files",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",
7
- "scripts": {
8
- "test": "c8 ava",
9
- "lint": "eslint .",
10
- "build": "peggy --format es -o lib/resolv.peg.js lib/resolv.pegjs && tsc"
11
- },
12
7
  "keywords": [
13
8
  "resolv",
14
9
  "resolv.conf",
@@ -26,21 +21,7 @@
26
21
  "bugs": "https://github.com/hildjj/resolv-conf/issues",
27
22
  "author": "Joe Hildebrand <joe-github@cursive.net>",
28
23
  "license": "MIT",
29
- "devDependencies": {
30
- "@cto.af/eslint-config": "^4.0.2",
31
- "@peggyjs/coverage": "1.1.0",
32
- "@types/node": "20.12.10",
33
- "ava": "^6.1.3",
34
- "c8": "^9.1.0",
35
- "eslint": "^8.57.0",
36
- "eslint-plugin-jsdoc": "^48.2.3",
37
- "eslint-plugin-node": "^11.1.0",
38
- "peggy": "^4.0.2",
39
- "pegjs-backtrace": "^0.2.1",
40
- "typescript": "^5.4.5"
41
- },
42
- "packageManager": "pnpm@9.1.0",
43
24
  "engines": {
44
- "node": ">=18"
25
+ "node": ">=20"
45
26
  }
46
27
  }