@graphty/graph-io 0.3.40 → 0.3.42
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/README.md +2 -0
- package/dist/chunks/{children-CL3Cy0ez.js → children-CA4coBi0.js} +36 -27
- package/dist/chunks/children-CA4coBi0.js.map +1 -0
- package/dist/chunks/{choose-CS3fvGT1.js → choose-DvpbdRuz.js} +2 -2
- package/dist/chunks/{choose-CS3fvGT1.js.map → choose-DvpbdRuz.js.map} +1 -1
- package/dist/chunks/{constants-DqKZT6cH.js → constants-fT3E8JYY.js} +2 -2
- package/dist/chunks/{constants-DqKZT6cH.js.map → constants-fT3E8JYY.js.map} +1 -1
- package/dist/chunks/{escape-BJRLd3vJ.js → escape-B62ZGM_a.js} +2 -2
- package/dist/chunks/{escape-BJRLd3vJ.js.map → escape-B62ZGM_a.js.map} +1 -1
- package/dist/chunks/{export-B-aVCwyG.js → export-rKLeGQMo.js} +404 -243
- package/dist/chunks/export-rKLeGQMo.js.map +1 -0
- package/dist/chunks/{exporter-6ocL_9x_.js → exporter-8hLNemFk.js} +4 -4
- package/dist/chunks/{exporter-6ocL_9x_.js.map → exporter-8hLNemFk.js.map} +1 -1
- package/dist/chunks/{exporter-BVXnV9-9.js → exporter-BWwEuOPT.js} +29 -17
- package/dist/chunks/exporter-BWwEuOPT.js.map +1 -0
- package/dist/chunks/{exporter-Bcp-l4Bo.js → exporter-CpRyHZ3H.js} +574 -475
- package/dist/chunks/exporter-CpRyHZ3H.js.map +1 -0
- package/dist/chunks/{exporter-SFYkDzD0.js → exporter-yLxKBvLE.js} +23 -20
- package/dist/chunks/{exporter-SFYkDzD0.js.map → exporter-yLxKBvLE.js.map} +1 -1
- package/dist/chunks/{importer-DcKB97kW.js → importer-BbNb7eNg.js} +111 -71
- package/dist/chunks/importer-BbNb7eNg.js.map +1 -0
- package/dist/chunks/{importer-D_srHyj6.js → importer-C98dpSH4.js} +5 -5
- package/dist/chunks/{importer-D_srHyj6.js.map → importer-C98dpSH4.js.map} +1 -1
- package/dist/chunks/{importer-BJlGAOht.js → importer-D794XUTe.js} +3 -3
- package/dist/chunks/{importer-BJlGAOht.js.map → importer-D794XUTe.js.map} +1 -1
- package/dist/chunks/{importer-AjwOJrn2.js → importer-Dz7tI8Sa.js} +202 -181
- package/dist/chunks/importer-Dz7tI8Sa.js.map +1 -0
- package/dist/chunks/{importer-DEp_fYjf.js → importer-Ht7LNg8L.js} +92 -64
- package/dist/chunks/importer-Ht7LNg8L.js.map +1 -0
- package/dist/chunks/{importer-CPqnIY8m.js → importer-WrGRZb0N.js} +42 -29
- package/dist/chunks/importer-WrGRZb0N.js.map +1 -0
- package/dist/chunks/{importer-BpuS3J8C.js → importer-xZ-3suY1.js} +74 -61
- package/dist/chunks/importer-xZ-3suY1.js.map +1 -0
- package/dist/chunks/{json-elements-DpO6AXIc.js → json-elements-DKSqpNW1.js} +3 -3
- package/dist/chunks/{json-elements-DpO6AXIc.js.map → json-elements-DKSqpNW1.js.map} +1 -1
- package/dist/chunks/{ontology-export-50L9DOV4.js → ontology-export-CtRXjg_i.js} +2 -2
- package/dist/chunks/{ontology-export-50L9DOV4.js.map → ontology-export-CtRXjg_i.js.map} +1 -1
- package/dist/chunks/{records-r3SFHz11.js → records-Cu4bxYOm.js} +69 -36
- package/dist/chunks/records-Cu4bxYOm.js.map +1 -0
- package/dist/chunks/{text-Bjfa1xYL.js → text-DHOJXnED.js} +20 -11
- package/dist/chunks/text-DHOJXnED.js.map +1 -0
- package/dist/csv.js +323 -241
- package/dist/csv.js.map +1 -1
- package/dist/cx.js +1 -1
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +1 -1
- package/dist/gexf.js +195 -97
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +170 -149
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +27 -27
- package/dist/graphml.js +2 -2
- package/dist/json.js +1 -1
- package/dist/neo4j.js +103 -65
- package/dist/neo4j.js.map +1 -1
- package/dist/obo.js +1 -1
- package/dist/pajek.js +1 -1
- package/dist/src/children.d.ts.map +1 -1
- package/dist/src/children.js +50 -27
- package/dist/src/children.js.map +1 -1
- package/dist/src/common/attributes.d.ts.map +1 -1
- package/dist/src/common/attributes.js +86 -42
- package/dist/src/common/attributes.js.map +1 -1
- package/dist/src/common/input.d.ts.map +1 -1
- package/dist/src/common/input.js +358 -184
- package/dist/src/common/input.js.map +1 -1
- package/dist/src/common/lists.js +30 -15
- package/dist/src/common/lists.js.map +1 -1
- package/dist/src/common/text.d.ts +7 -0
- package/dist/src/common/text.d.ts.map +1 -1
- package/dist/src/common/text.js +15 -7
- package/dist/src/common/text.js.map +1 -1
- package/dist/src/common/zip.d.ts.map +1 -1
- package/dist/src/common/zip.js +36 -19
- package/dist/src/common/zip.js.map +1 -1
- package/dist/src/formats/csv/exporter.d.ts.map +1 -1
- package/dist/src/formats/csv/exporter.js +288 -146
- package/dist/src/formats/csv/exporter.js.map +1 -1
- package/dist/src/formats/csv/importer.d.ts.map +1 -1
- package/dist/src/formats/csv/importer.js +129 -80
- package/dist/src/formats/csv/importer.js.map +1 -1
- package/dist/src/formats/csv/records.d.ts.map +1 -1
- package/dist/src/formats/csv/records.js +78 -36
- package/dist/src/formats/csv/records.js.map +1 -1
- package/dist/src/formats/cys/tables.d.ts.map +1 -1
- package/dist/src/formats/cys/tables.js +11 -8
- package/dist/src/formats/cys/tables.js.map +1 -1
- package/dist/src/formats/dot/tokenizer.d.ts +39 -0
- package/dist/src/formats/dot/tokenizer.d.ts.map +1 -1
- package/dist/src/formats/dot/tokenizer.js +112 -66
- package/dist/src/formats/dot/tokenizer.js.map +1 -1
- package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
- package/dist/src/formats/gexf/exporter.js +65 -37
- package/dist/src/formats/gexf/exporter.js.map +1 -1
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +138 -50
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gml/exporter.d.ts.map +1 -1
- package/dist/src/formats/gml/exporter.js +51 -35
- package/dist/src/formats/gml/exporter.js.map +1 -1
- package/dist/src/formats/gml/importer.d.ts.map +1 -1
- package/dist/src/formats/gml/importer.js +103 -58
- package/dist/src/formats/gml/importer.js.map +1 -1
- package/dist/src/formats/gml/syntax.d.ts.map +1 -1
- package/dist/src/formats/gml/syntax.js +17 -8
- package/dist/src/formats/gml/syntax.js.map +1 -1
- package/dist/src/formats/graphml/exporter.d.ts.map +1 -1
- package/dist/src/formats/graphml/exporter.js +34 -24
- package/dist/src/formats/graphml/exporter.js.map +1 -1
- package/dist/src/formats/graphml/importer.d.ts.map +1 -1
- package/dist/src/formats/graphml/importer.js +17 -13
- package/dist/src/formats/graphml/importer.js.map +1 -1
- package/dist/src/formats/graphml/tree.js +23 -14
- package/dist/src/formats/graphml/tree.js.map +1 -1
- package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
- package/dist/src/formats/graphml/yfiles.js +22 -10
- package/dist/src/formats/graphml/yfiles.js.map +1 -1
- package/dist/src/formats/json/dialect.d.ts.map +1 -1
- package/dist/src/formats/json/dialect.js +54 -20
- package/dist/src/formats/json/dialect.js.map +1 -1
- package/dist/src/formats/json/exporter.d.ts.map +1 -1
- package/dist/src/formats/json/exporter.js +38 -21
- package/dist/src/formats/json/exporter.js.map +1 -1
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +536 -343
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/json/obographs.js +29 -17
- package/dist/src/formats/json/obographs.js.map +1 -1
- package/dist/src/formats/neo4j/exporter.d.ts.map +1 -1
- package/dist/src/formats/neo4j/exporter.js +73 -43
- package/dist/src/formats/neo4j/exporter.js.map +1 -1
- package/dist/src/formats/neo4j/header.d.ts.map +1 -1
- package/dist/src/formats/neo4j/header.js +37 -16
- package/dist/src/formats/neo4j/header.js.map +1 -1
- package/dist/src/formats/neo4j/importer.d.ts.map +1 -1
- package/dist/src/formats/neo4j/importer.js +21 -11
- package/dist/src/formats/neo4j/importer.js.map +1 -1
- package/dist/src/formats/obo/exporter.d.ts.map +1 -1
- package/dist/src/formats/obo/exporter.js +18 -7
- package/dist/src/formats/obo/exporter.js.map +1 -1
- package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
- package/dist/src/formats/pajek/exporter.js +142 -73
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/pajek/importer.d.ts.map +1 -1
- package/dist/src/formats/pajek/importer.js +26 -15
- package/dist/src/formats/pajek/importer.js.map +1 -1
- package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
- package/dist/src/formats/pajek/syntax.js +85 -58
- package/dist/src/formats/pajek/syntax.js.map +1 -1
- package/dist/src/formats/xgmml/emit.d.ts +7 -0
- package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
- package/dist/src/formats/xgmml/emit.js +79 -40
- package/dist/src/formats/xgmml/emit.js.map +1 -1
- package/dist/src/formats/xgmml/exporter.d.ts.map +1 -1
- package/dist/src/formats/xgmml/exporter.js +38 -12
- package/dist/src/formats/xgmml/exporter.js.map +1 -1
- package/dist/src/formats/xgmml/importer.d.ts.map +1 -1
- package/dist/src/formats/xgmml/importer.js +38 -18
- package/dist/src/formats/xgmml/importer.js.map +1 -1
- package/dist/src/sniff.js +109 -57
- package/dist/src/sniff.js.map +1 -1
- package/dist/xgmml.js +2 -2
- package/package.json +2 -2
- package/src/children.ts +54 -27
- package/src/common/attributes.ts +118 -49
- package/src/common/input.ts +439 -197
- package/src/common/lists.ts +29 -15
- package/src/common/text.ts +24 -15
- package/src/common/zip.ts +47 -18
- package/src/formats/csv/exporter.ts +377 -175
- package/src/formats/csv/importer.ts +155 -84
- package/src/formats/csv/records.ts +90 -35
- package/src/formats/cys/tables.ts +11 -10
- package/src/formats/dot/tokenizer.ts +118 -68
- package/src/formats/gexf/exporter.ts +67 -36
- package/src/formats/gexf/importer.ts +173 -63
- package/src/formats/gml/exporter.ts +78 -82
- package/src/formats/gml/importer.ts +119 -68
- package/src/formats/gml/syntax.ts +18 -8
- package/src/formats/graphml/exporter.ts +44 -24
- package/src/formats/graphml/importer.ts +18 -11
- package/src/formats/graphml/tree.ts +22 -12
- package/src/formats/graphml/yfiles.ts +23 -10
- package/src/formats/json/dialect.ts +61 -22
- package/src/formats/json/exporter.ts +40 -21
- package/src/formats/json/importer.ts +701 -385
- package/src/formats/json/obographs.ts +35 -15
- package/src/formats/neo4j/exporter.ts +79 -41
- package/src/formats/neo4j/header.ts +50 -16
- package/src/formats/neo4j/importer.ts +21 -10
- package/src/formats/obo/exporter.ts +34 -17
- package/src/formats/pajek/exporter.ts +180 -117
- package/src/formats/pajek/importer.ts +27 -15
- package/src/formats/pajek/syntax.ts +99 -58
- package/src/formats/xgmml/emit.ts +88 -40
- package/src/formats/xgmml/exporter.ts +40 -12
- package/src/formats/xgmml/importer.ts +45 -23
- package/src/sniff.ts +115 -59
- package/dist/chunks/children-CL3Cy0ez.js.map +0 -1
- package/dist/chunks/export-B-aVCwyG.js.map +0 -1
- package/dist/chunks/exporter-BVXnV9-9.js.map +0 -1
- package/dist/chunks/exporter-Bcp-l4Bo.js.map +0 -1
- package/dist/chunks/importer-AjwOJrn2.js.map +0 -1
- package/dist/chunks/importer-BpuS3J8C.js.map +0 -1
- package/dist/chunks/importer-CPqnIY8m.js.map +0 -1
- package/dist/chunks/importer-DEp_fYjf.js.map +0 -1
- package/dist/chunks/importer-DcKB97kW.js.map +0 -1
- package/dist/chunks/records-r3SFHz11.js.map +0 -1
- package/dist/chunks/text-Bjfa1xYL.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { GraphFormatError, INVALID_INDEX } from "@graphty/graph-format";
|
|
2
|
-
import { c as childrenCsr } from "./children-
|
|
3
|
-
import { L as LOSS, r as resolveExportOptions, a as checkCapabilities, c as capabilities, bD as countMixedEdges, e as explicitWeights, p as pairFolding, b as plural, aE as sanitizeIds, aa as formatF32, ab as formatF64, a9 as idText, $ as agree, aF as formatDecimal, aG as formatInteger, aH as canonicalId, M as MIXED_DIRECTION_CODE, D as DIRECTION_FORCED_CODE, d as DIRECTION_REFUSED_CODE, S as SINK_OPTION_CODE, I as ID_MERGED_CODE, O as OPTION_IGNORED_CODE, C as COLUMN_RENAMED_CODE, R as ROLE_TAKEN_CODE, o as DUPLICATE_ATTRIBUTE_CODE, P as PRECISION_CODE, ae as AMBIGUOUS_GRAPH_NAME_CODE, af as GRAPH_NOT_FOUND_CODE, l as MULTIPLE_GRAPHS_CODE, v as ENCODING_CONFLICT_CODE, w as UNKNOWN_ENCODING_CODE, x as ENCODING_FALLBACK_CODE, y as INVALID_ENCODING_CODE, z as INVALID_UTF8_CODE, E as EMPTY_INPUT_CODE, ak as SYNTAX_CODE, F as ELEMENT_ISSUE, G as INPUT_ISSUE, al as resolveImportOptions, a8 as ImportReportBuilder, an as reportUnusedOptions, bB as readText, ao as reportSinkOptions, am as throwIfAborted, ap as graphChosen, ar as IdCoercer, aq as DirectionResolver, aK as parseWeightText, bE as canonicalEncoding, a1 as declareResolved } from "./export-
|
|
4
|
-
import { c as quoteDotId, d as isWritableDotText } from "./escape-
|
|
5
|
-
import { i as inferTextDtype, W as WIDENING_UNSUPPORTED_CODE, p as parseTextCell, T as TextCellWriter } from "./text-
|
|
2
|
+
import { c as childrenCsr } from "./children-CA4coBi0.js";
|
|
3
|
+
import { L as LOSS, r as resolveExportOptions, a as checkCapabilities, c as capabilities, bD as countMixedEdges, e as explicitWeights, p as pairFolding, b as plural, aE as sanitizeIds, aa as formatF32, ab as formatF64, a9 as idText, $ as agree, aF as formatDecimal, aG as formatInteger, aH as canonicalId, M as MIXED_DIRECTION_CODE, D as DIRECTION_FORCED_CODE, d as DIRECTION_REFUSED_CODE, S as SINK_OPTION_CODE, I as ID_MERGED_CODE, O as OPTION_IGNORED_CODE, C as COLUMN_RENAMED_CODE, R as ROLE_TAKEN_CODE, o as DUPLICATE_ATTRIBUTE_CODE, P as PRECISION_CODE, ae as AMBIGUOUS_GRAPH_NAME_CODE, af as GRAPH_NOT_FOUND_CODE, l as MULTIPLE_GRAPHS_CODE, v as ENCODING_CONFLICT_CODE, w as UNKNOWN_ENCODING_CODE, x as ENCODING_FALLBACK_CODE, y as INVALID_ENCODING_CODE, z as INVALID_UTF8_CODE, E as EMPTY_INPUT_CODE, ak as SYNTAX_CODE, F as ELEMENT_ISSUE, G as INPUT_ISSUE, al as resolveImportOptions, a8 as ImportReportBuilder, an as reportUnusedOptions, bB as readText, ao as reportSinkOptions, am as throwIfAborted, ap as graphChosen, ar as IdCoercer, aq as DirectionResolver, aK as parseWeightText, bE as canonicalEncoding, a1 as declareResolved } from "./export-rKLeGQMo.js";
|
|
4
|
+
import { c as quoteDotId, d as isWritableDotText } from "./escape-B62ZGM_a.js";
|
|
5
|
+
import { i as inferTextDtype, W as WIDENING_UNSUPPORTED_CODE, p as parseTextCell, T as TextCellWriter } from "./text-DHOJXnED.js";
|
|
6
6
|
import { j as joinText, e as encodeChunks, i as indentUnit } from "./writer-DxjgHwSe.js";
|
|
7
|
-
import { i as importChosenGraph } from "./choose-
|
|
7
|
+
import { i as importChosenGraph } from "./choose-DvpbdRuz.js";
|
|
8
8
|
const DOT_FORMAT = "dot";
|
|
9
9
|
const DOT_ORIGIN = Object.freeze({ format: DOT_FORMAT });
|
|
10
10
|
const CLUSTER_COLUMN = "graphty.cluster";
|
|
@@ -890,6 +890,9 @@ function isIdentifierPart(c) {
|
|
|
890
890
|
function isDigit(c) {
|
|
891
891
|
return c >= 48 && c <= 57;
|
|
892
892
|
}
|
|
893
|
+
function isBlank(c) {
|
|
894
|
+
return c === 32 || c === 9 || c === 11 || c === 12 || c === BOM_CODE;
|
|
895
|
+
}
|
|
893
896
|
class DotTokenizer {
|
|
894
897
|
/**
|
|
895
898
|
* Create a lexer over a whole document.
|
|
@@ -1037,37 +1040,64 @@ class DotTokenizer {
|
|
|
1037
1040
|
this.pos = i + 1;
|
|
1038
1041
|
return { kind: "id", text: out, quoted: true, html: false, line };
|
|
1039
1042
|
}
|
|
1040
|
-
if (c === 92) {
|
|
1041
|
-
|
|
1042
|
-
if (
|
|
1043
|
-
out +=
|
|
1044
|
-
i += 2;
|
|
1045
|
-
segment = i;
|
|
1046
|
-
continue;
|
|
1047
|
-
}
|
|
1048
|
-
if (d === 92) {
|
|
1049
|
-
i += 2;
|
|
1050
|
-
continue;
|
|
1051
|
-
}
|
|
1052
|
-
if (d === 10 || d === 13) {
|
|
1053
|
-
out += text.slice(segment, i);
|
|
1054
|
-
i += d === 13 && text.charCodeAt(i + 2) === 10 ? 3 : 2;
|
|
1055
|
-
this.line++;
|
|
1056
|
-
segment = i;
|
|
1057
|
-
continue;
|
|
1058
|
-
}
|
|
1059
|
-
i++;
|
|
1060
|
-
continue;
|
|
1061
|
-
}
|
|
1062
|
-
if (c === 10 || c === 13) {
|
|
1063
|
-
if (c === 13 && text.charCodeAt(i + 1) === 10) {
|
|
1064
|
-
i++;
|
|
1043
|
+
if (c === 92 && this.isQuotedSplice(i)) {
|
|
1044
|
+
out += text.slice(segment, i);
|
|
1045
|
+
if (text.codePointAt(i + 1) === 34) {
|
|
1046
|
+
out += '"';
|
|
1065
1047
|
}
|
|
1066
|
-
this.
|
|
1048
|
+
i = this.quotedSpliceEnd(i);
|
|
1049
|
+
segment = i;
|
|
1050
|
+
} else {
|
|
1051
|
+
i = this.quotedStep(i, c);
|
|
1067
1052
|
}
|
|
1068
|
-
i++;
|
|
1069
1053
|
}
|
|
1070
1054
|
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Whether the backslash at `i` inside a quoted string starts a sequence that changes the decoded
|
|
1057
|
+
* text: `\"` (an escaped quote) or a backslash before a line break (a line continuation).
|
|
1058
|
+
* @param i - the offset of the backslash
|
|
1059
|
+
* @returns true for an escaped quote or a line continuation
|
|
1060
|
+
*/
|
|
1061
|
+
isQuotedSplice(i) {
|
|
1062
|
+
const d = this.text.codePointAt(i + 1);
|
|
1063
|
+
return d === 34 || d === 10 || d === 13;
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* The offset just past an escaped quote or a line continuation, counting the line a
|
|
1067
|
+
* continuation ends.
|
|
1068
|
+
* @param i - the offset of the backslash
|
|
1069
|
+
* @returns the offset after the sequence
|
|
1070
|
+
*/
|
|
1071
|
+
quotedSpliceEnd(i) {
|
|
1072
|
+
const { text } = this;
|
|
1073
|
+
const d = text.charCodeAt(i + 1);
|
|
1074
|
+
if (d === 34) {
|
|
1075
|
+
return i + 2;
|
|
1076
|
+
}
|
|
1077
|
+
this.line++;
|
|
1078
|
+
return d === 13 && text.codePointAt(i + 2) === 10 ? i + 3 : i + 2;
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Step over one unit of a quoted string kept as written: a backslash pair (consumed as one unit,
|
|
1082
|
+
* as Graphviz's scanner does, so the second backslash never escapes a closing quote: "x\\" is
|
|
1083
|
+
* the text x\\), a lone backslash, a raw line break (counted) or any other character.
|
|
1084
|
+
* @param i - the offset of the unit
|
|
1085
|
+
* @param c - the code unit at `i`
|
|
1086
|
+
* @returns the offset after the unit
|
|
1087
|
+
*/
|
|
1088
|
+
quotedStep(i, c) {
|
|
1089
|
+
const { text } = this;
|
|
1090
|
+
if (c === 92) {
|
|
1091
|
+
return text.codePointAt(i + 1) === 92 ? i + 2 : i + 1;
|
|
1092
|
+
}
|
|
1093
|
+
if (c === 10) {
|
|
1094
|
+
this.line++;
|
|
1095
|
+
} else if (c === 13) {
|
|
1096
|
+
this.line++;
|
|
1097
|
+
return text.codePointAt(i + 1) === 10 ? i + 2 : i + 1;
|
|
1098
|
+
}
|
|
1099
|
+
return i + 1;
|
|
1100
|
+
}
|
|
1071
1101
|
/**
|
|
1072
1102
|
* Lex an HTML string starting at the opening angle bracket: the text up to the matching
|
|
1073
1103
|
* closing bracket, brackets balanced, kept verbatim including the outer pair.
|
|
@@ -1099,49 +1129,59 @@ class DotTokenizer {
|
|
|
1099
1129
|
*/
|
|
1100
1130
|
skipTrivia() {
|
|
1101
1131
|
const { text } = this;
|
|
1102
|
-
|
|
1103
|
-
if (this.pos >= text.length) {
|
|
1104
|
-
return;
|
|
1105
|
-
}
|
|
1132
|
+
while (this.pos < text.length) {
|
|
1106
1133
|
const c = text.charCodeAt(this.pos);
|
|
1107
|
-
if (c
|
|
1108
|
-
this.line++;
|
|
1134
|
+
if (isBlank(c)) {
|
|
1109
1135
|
this.pos++;
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
}
|
|
1113
|
-
if (c === 13) {
|
|
1114
|
-
this.line++;
|
|
1115
|
-
this.pos += text.charCodeAt(this.pos + 1) === 10 ? 2 : 1;
|
|
1116
|
-
this.skipPreprocessorLine();
|
|
1117
|
-
continue;
|
|
1118
|
-
}
|
|
1119
|
-
if (c === 32 || c === 9 || c === 11 || c === 12) {
|
|
1120
|
-
this.pos++;
|
|
1121
|
-
continue;
|
|
1122
|
-
}
|
|
1123
|
-
if (c === BOM_CODE) {
|
|
1124
|
-
this.pos++;
|
|
1125
|
-
continue;
|
|
1126
|
-
}
|
|
1127
|
-
if (c === 47) {
|
|
1128
|
-
const d = text.charCodeAt(this.pos + 1);
|
|
1129
|
-
if (d === 47) {
|
|
1130
|
-
this.skipToLineEnd();
|
|
1131
|
-
continue;
|
|
1132
|
-
}
|
|
1133
|
-
if (d === 42) {
|
|
1134
|
-
this.skipBlockComment();
|
|
1135
|
-
continue;
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
if (c === 35 && this.pos === 0) {
|
|
1139
|
-
this.skipToLineEnd();
|
|
1140
|
-
continue;
|
|
1136
|
+
} else if (!this.skipBreakOrComment(c)) {
|
|
1137
|
+
return;
|
|
1141
1138
|
}
|
|
1142
|
-
return;
|
|
1143
1139
|
}
|
|
1144
1140
|
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Skip one line break, comment or leading `#` line at the current position.
|
|
1143
|
+
* @param c - the code unit at the current position
|
|
1144
|
+
* @returns false when the current position starts a token
|
|
1145
|
+
*/
|
|
1146
|
+
skipBreakOrComment(c) {
|
|
1147
|
+
if (c === 10 || c === 13) {
|
|
1148
|
+
this.skipLineBreak(c);
|
|
1149
|
+
return true;
|
|
1150
|
+
}
|
|
1151
|
+
if (c === 47) {
|
|
1152
|
+
return this.skipComment();
|
|
1153
|
+
}
|
|
1154
|
+
if (c === 35 && this.pos === 0) {
|
|
1155
|
+
this.skipToLineEnd();
|
|
1156
|
+
return true;
|
|
1157
|
+
}
|
|
1158
|
+
return false;
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Consume the line break at the current position (CR LF as one) and a `#` line after it.
|
|
1162
|
+
* @param c - the code unit at the current position, LF or CR
|
|
1163
|
+
*/
|
|
1164
|
+
skipLineBreak(c) {
|
|
1165
|
+
this.line++;
|
|
1166
|
+
this.pos += c === 13 && this.text.codePointAt(this.pos + 1) === 10 ? 2 : 1;
|
|
1167
|
+
this.skipPreprocessorLine();
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Skip a `//` or block comment starting at the current `/`.
|
|
1171
|
+
* @returns false when the `/` starts no comment
|
|
1172
|
+
*/
|
|
1173
|
+
skipComment() {
|
|
1174
|
+
const d = this.text.codePointAt(this.pos + 1);
|
|
1175
|
+
if (d === 47) {
|
|
1176
|
+
this.skipToLineEnd();
|
|
1177
|
+
return true;
|
|
1178
|
+
}
|
|
1179
|
+
if (d === 42) {
|
|
1180
|
+
this.skipBlockComment();
|
|
1181
|
+
return true;
|
|
1182
|
+
}
|
|
1183
|
+
return false;
|
|
1184
|
+
}
|
|
1145
1185
|
/**
|
|
1146
1186
|
* Discard a `#` line when one starts at the current position (the start of a line).
|
|
1147
1187
|
*/
|
|
@@ -2681,4 +2721,4 @@ export {
|
|
|
2681
2721
|
dotImporter as b,
|
|
2682
2722
|
dotExporter as d
|
|
2683
2723
|
};
|
|
2684
|
-
//# sourceMappingURL=importer-
|
|
2724
|
+
//# sourceMappingURL=importer-BbNb7eNg.js.map
|