Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gmod/bed

Package Overview
Dependencies
Maintainers
6
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gmod/bed - npm Package Compare versions

Comparing version 2.0.6 to 2.0.7

dist/as/autoSqlSchemas.d.ts

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## [2.0.7](https://github.com/GMOD/bed-js/compare/v2.0.6...v2.0.7) (2022-03-07)
- Add esm module export to package.json
## [2.0.6](https://github.com/GMOD/bed-js/compare/v2.0.5...v2.0.6) (2021-08-21)

@@ -2,0 +8,0 @@

36

dist/as/autoSqlSchemas.js
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
exports.mafSummary = exports.mafFrames = exports.defaultBedSchema = exports.bigPsl = exports.bigNarrowPeak = exports.bigMaf = exports.bigLink = exports.bigInteract = exports.bigGenePred = exports.bigChain = void 0;
var bigChain = "table bigChain\n\"bigChain pairwise alignment\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name or ID of item, ideally both human readable and unique\"\n uint score; \"Score (0-1000)\"\n char[1] strand; \"+ or - for strand\"\n uint tSize; \"size of target sequence\"\n string qName; \"name of query sequence\"\n uint qSize; \"size of query sequence\"\n uint qStart; \"start of alignment on query sequence\"\n uint qEnd; \"end of alignment on query sequence\"\n uint chainScore; \"score from chain\"\n )";
exports.bigChain = bigChain;
var bigGenePred = "table bigGenePred\n\"bigGenePred gene models\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name or ID of item, ideally both human readable and unique\"\n uint score; \"Score (0-1000)\"\n char[1] strand; \"+ or - for strand\"\n uint thickStart; \"Start of where display should be thick (start codon)\"\n uint thickEnd; \"End of where display should be thick (stop codon)\"\n uint reserved; \"RGB value (use R,G,B string in input file)\"\n int blockCount; \"Number of blocks\"\n int[blockCount] blockSizes; \"Comma separated list of block sizes\"\n int[blockCount] chromStarts; \"Start positions relative to chromStart\"\n string name2; \"Alternative/human readable name\"\n string cdsStartStat; \"Status of CDS start annotation (none, unknown, incomplete, or complete)\"\n string cdsEndStat; \"Status of CDS end annotation (none, unknown, incomplete, or complete)\"\n int[blockCount] exonFrames; \"Exon frame {0,1,2}, or -1 if no frame for exon\"\n string type; \"Transcript type\"\n string geneName; \"Primary identifier for gene\"\n string geneName2; \"Alternative/human readable gene name\"\n string geneType; \"Gene type\"\n )";
exports.bigGenePred = bigGenePred;
var bigInteract = "table interact\n\"interaction between two regions\"\n (\n string chrom; \"Chromosome (or contig, scaffold, etc.). For interchromosomal, use 2 records\"\n uint chromStart; \"Start position of lower region. For interchromosomal, set to chromStart of this region\"\n uint chromEnd; \"End position of upper region. For interchromosomal, set to chromEnd of this region\"\n string name; \"Name of item, for display. Usually 'sourceName/targetName/exp' or empty\"\n uint score; \"Score (0-1000)\"\n double value; \"Strength of interaction or other data value. Typically basis for score\"\n string exp; \"Experiment name (metadata for filtering). Use . if not applicable\"\n string color; \"Item color. Specified as r,g,b or hexadecimal #RRGGBB or html color name, as in //www.w3.org/TR/css3-color/#html4. Use 0 and spectrum setting to shade by score\"\n string sourceChrom; \"Chromosome of source region (directional) or lower region. For non-directional interchromosomal, chrom of this region.\"\n uint sourceStart; \"Start position in chromosome of source/lower/this region\"\n uint sourceEnd; \"End position in chromosome of source/lower/this region\"\n string sourceName; \"Identifier of source/lower/this region\"\n string sourceStrand; \"Orientation of source/lower/this region: + or -. Use . if not applicable\"\n string targetChrom; \"Chromosome of target region (directional) or upper region. For non-directional interchromosomal, chrom of other region\"\n uint targetStart; \"Start position in chromosome of target/upper/this region\"\n uint targetEnd; \"End position in chromosome of target/upper/this region\"\n string targetName; \"Identifier of target/upper/this region\"\n string targetStrand; \"Orientation of target/upper/this region: + or -. Use . if not applicable\"\n\n )";
exports.bigInteract = bigInteract;
var bigLink = "table bigLink\n\"bigLink pairwise alignment\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name or ID of item, ideally both human readable and unique\"\n uint qStart; \"start of alignment on query sequence\"\n )";
exports.bigLink = bigLink;
var bigMaf = "table bedMaf\n\"Bed3 with MAF block\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n lstring mafBlock; \"MAF block\"\n )";
exports.bigMaf = bigMaf;
var bigNarrowPeak = "table bigNarrowPeak\n\"BED6+4 Peaks of signal enrichment based on pooled, normalized (interpreted) data.\"\n(\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name;\t \"Name given to a region (preferably unique). Use . if no name is assigned\"\n uint score; \"Indicates how dark the peak will be displayed in the browser (0-1000) \"\n char[1] strand; \"+ or - or . for unknown\"\n float signalValue; \"Measurement of average enrichment for the region\"\n float pValue; \"Statistical significance of signal value (-log10). Set to -1 if not used.\"\n float qValue; \"Statistical significance with multiple-test correction applied (FDR -log10). Set to -1 if not used.\"\n int peak; \"Point-source called for this peak; 0-based offset from chromStart. Set to -1 if no point-source called.\"\n)";
exports.bigNarrowPeak = bigNarrowPeak;
var bigPsl = "table bigPsl\n\"bigPsl pairwise alignment\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name or ID of item, ideally both human readable and unique\"\n uint score; \"Score (0-1000)\"\n char[1] strand; \"+ or - indicates whether the query aligns to the + or - strand on the reference\"\n uint thickStart; \"Start of where display should be thick (start codon)\"\n uint thickEnd; \"End of where display should be thick (stop codon)\"\n uint reserved; \"RGB value (use R,G,B string in input file)\"\n int blockCount; \"Number of blocks\"\n int[blockCount] blockSizes; \"Comma separated list of block sizes\"\n int[blockCount] chromStarts; \"Start positions relative to chromStart\"\n\n uint oChromStart;\"Start position in other chromosome\"\n uint oChromEnd; \"End position in other chromosome\"\n char[1] oStrand; \"+ or -, - means that psl was reversed into BED-compatible coordinates\"\n uint oChromSize; \"Size of other chromosome.\"\n int[blockCount] oChromStarts; \"Start positions relative to oChromStart or from oChromStart+oChromSize depending on strand\"\n\n lstring oSequence; \"Sequence on other chrom (or empty)\"\n string oCDS; \"CDS in NCBI format\"\n\n uint chromSize;\"Size of target chromosome\"\n\n uint match; \"Number of bases matched.\"\n uint misMatch; \" Number of bases that don't match \"\n uint repMatch; \" Number of bases that match but are part of repeats \"\n uint nCount; \" Number of 'N' bases \"\n uint seqType; \"0=empty, 1=nucleotide, 2=amino_acid\"\n )";
exports.bigPsl = bigPsl;
var defaultBedSchema = "table defaultBedSchema\n\"BED12\"\n (\n string chrom; \"The name of the chromosome (e.g. chr3, chrY, chr2_random) or scaffold (e.g. scaffold10671).\"\n uint chromStart; \"The starting position of the feature in the chromosome or scaffold. The first base in a chromosome is numbered 0.\"\n uint chromEnd; \"The ending position of the feature in the chromosome or scaffold. The chromEnd base is not included in the display of the feature. For example, the first 100 bases of a chromosome are defined as chromStart=0, chromEnd=100, and span the bases numbered 0-99.\"\n string name; \"Defines the name of the BED line.\"\n float score; \"Feature score, doesn't care about the 0-1000 limit as in bed\"\n char strand; \"Defines the strand. Either '.' (=no strand) or '+' or '-'\"\n uint thickStart; \"The starting position at which the feature is drawn thickly (for example, the start codon in gene displays). When there is no thick part, thickStart and thickEnd are usually set to the chromStart position.\"\n uint thickEnd; \"The ending position at which the feature is drawn thickly (for example the stop codon in gene displays).\"\n string itemRgb; \"An RGB value of the form R,G,B (e.g. 255,0,0). \"\n uint blockCount; \" The number of blocks (exons) in the BED line.\"\n uint[blockCount] blockSizes; \" A comma-separated list of the block sizes. The number of items in this list should correspond to blockCount.\"\n uint[blockCount] blockStarts; \"A comma-separated list of block starts. All of the blockStart positions should be calculated relative to chromStart. The number of items in this list should correspond to blockCount.\"\n )";
exports.defaultBedSchema = defaultBedSchema;
var mafFrames = "table mafFrames\n\"codon frame assignment for MAF components\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start range in chromosome\"\n uint chromEnd; \"End range in chromosome\"\n string src; \"Name of sequence source in MAF\"\n ubyte frame; \"frame (0,1,2) for first base(+) or last bast(-)\"\n char[1] strand; \"+ or -\"\n string name; \"Name of gene used to define frame\"\n int prevFramePos; \"target position of the previous base (in transcription direction) that continues this frame, or -1 if none, or frame not contiguous\"\n int nextFramePos; \"target position of the next base (in transcription direction) that continues this frame, or -1 if none, or frame not contiguous\"\n ubyte isExonStart; \"does this start the CDS portion of an exon?\"\n ubyte isExonEnd; \"does this end the CDS portion of an exon?\"\n )";
exports.mafFrames = mafFrames;
var mafSummary = "table mafSummary\n\"Positions and scores for alignment blocks\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string src; \"Sequence name or database of alignment\"\n float score; \"Floating point score.\"\n char[1] leftStatus; \"Gap/break annotation for preceding block\"\n char[1] rightStatus; \"Gap/break annotation for following block\"\n )";
exports.mafSummary = mafSummary;
exports.bigChain = "table bigChain\n\"bigChain pairwise alignment\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name or ID of item, ideally both human readable and unique\"\n uint score; \"Score (0-1000)\"\n char[1] strand; \"+ or - for strand\"\n uint tSize; \"size of target sequence\"\n string qName; \"name of query sequence\"\n uint qSize; \"size of query sequence\"\n uint qStart; \"start of alignment on query sequence\"\n uint qEnd; \"end of alignment on query sequence\"\n uint chainScore; \"score from chain\"\n )";
exports.bigGenePred = "table bigGenePred\n\"bigGenePred gene models\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name or ID of item, ideally both human readable and unique\"\n uint score; \"Score (0-1000)\"\n char[1] strand; \"+ or - for strand\"\n uint thickStart; \"Start of where display should be thick (start codon)\"\n uint thickEnd; \"End of where display should be thick (stop codon)\"\n uint reserved; \"RGB value (use R,G,B string in input file)\"\n int blockCount; \"Number of blocks\"\n int[blockCount] blockSizes; \"Comma separated list of block sizes\"\n int[blockCount] chromStarts; \"Start positions relative to chromStart\"\n string name2; \"Alternative/human readable name\"\n string cdsStartStat; \"Status of CDS start annotation (none, unknown, incomplete, or complete)\"\n string cdsEndStat; \"Status of CDS end annotation (none, unknown, incomplete, or complete)\"\n int[blockCount] exonFrames; \"Exon frame {0,1,2}, or -1 if no frame for exon\"\n string type; \"Transcript type\"\n string geneName; \"Primary identifier for gene\"\n string geneName2; \"Alternative/human readable gene name\"\n string geneType; \"Gene type\"\n )";
exports.bigInteract = "table interact\n\"interaction between two regions\"\n (\n string chrom; \"Chromosome (or contig, scaffold, etc.). For interchromosomal, use 2 records\"\n uint chromStart; \"Start position of lower region. For interchromosomal, set to chromStart of this region\"\n uint chromEnd; \"End position of upper region. For interchromosomal, set to chromEnd of this region\"\n string name; \"Name of item, for display. Usually 'sourceName/targetName/exp' or empty\"\n uint score; \"Score (0-1000)\"\n double value; \"Strength of interaction or other data value. Typically basis for score\"\n string exp; \"Experiment name (metadata for filtering). Use . if not applicable\"\n string color; \"Item color. Specified as r,g,b or hexadecimal #RRGGBB or html color name, as in //www.w3.org/TR/css3-color/#html4. Use 0 and spectrum setting to shade by score\"\n string sourceChrom; \"Chromosome of source region (directional) or lower region. For non-directional interchromosomal, chrom of this region.\"\n uint sourceStart; \"Start position in chromosome of source/lower/this region\"\n uint sourceEnd; \"End position in chromosome of source/lower/this region\"\n string sourceName; \"Identifier of source/lower/this region\"\n string sourceStrand; \"Orientation of source/lower/this region: + or -. Use . if not applicable\"\n string targetChrom; \"Chromosome of target region (directional) or upper region. For non-directional interchromosomal, chrom of other region\"\n uint targetStart; \"Start position in chromosome of target/upper/this region\"\n uint targetEnd; \"End position in chromosome of target/upper/this region\"\n string targetName; \"Identifier of target/upper/this region\"\n string targetStrand; \"Orientation of target/upper/this region: + or -. Use . if not applicable\"\n\n )";
exports.bigLink = "table bigLink\n\"bigLink pairwise alignment\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name or ID of item, ideally both human readable and unique\"\n uint qStart; \"start of alignment on query sequence\"\n )";
exports.bigMaf = "table bedMaf\n\"Bed3 with MAF block\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n lstring mafBlock; \"MAF block\"\n )";
exports.bigNarrowPeak = "table bigNarrowPeak\n\"BED6+4 Peaks of signal enrichment based on pooled, normalized (interpreted) data.\"\n(\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name;\t \"Name given to a region (preferably unique). Use . if no name is assigned\"\n uint score; \"Indicates how dark the peak will be displayed in the browser (0-1000) \"\n char[1] strand; \"+ or - or . for unknown\"\n float signalValue; \"Measurement of average enrichment for the region\"\n float pValue; \"Statistical significance of signal value (-log10). Set to -1 if not used.\"\n float qValue; \"Statistical significance with multiple-test correction applied (FDR -log10). Set to -1 if not used.\"\n int peak; \"Point-source called for this peak; 0-based offset from chromStart. Set to -1 if no point-source called.\"\n)";
exports.bigPsl = "table bigPsl\n\"bigPsl pairwise alignment\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name or ID of item, ideally both human readable and unique\"\n uint score; \"Score (0-1000)\"\n char[1] strand; \"+ or - indicates whether the query aligns to the + or - strand on the reference\"\n uint thickStart; \"Start of where display should be thick (start codon)\"\n uint thickEnd; \"End of where display should be thick (stop codon)\"\n uint reserved; \"RGB value (use R,G,B string in input file)\"\n int blockCount; \"Number of blocks\"\n int[blockCount] blockSizes; \"Comma separated list of block sizes\"\n int[blockCount] chromStarts; \"Start positions relative to chromStart\"\n\n uint oChromStart;\"Start position in other chromosome\"\n uint oChromEnd; \"End position in other chromosome\"\n char[1] oStrand; \"+ or -, - means that psl was reversed into BED-compatible coordinates\"\n uint oChromSize; \"Size of other chromosome.\"\n int[blockCount] oChromStarts; \"Start positions relative to oChromStart or from oChromStart+oChromSize depending on strand\"\n\n lstring oSequence; \"Sequence on other chrom (or empty)\"\n string oCDS; \"CDS in NCBI format\"\n\n uint chromSize;\"Size of target chromosome\"\n\n uint match; \"Number of bases matched.\"\n uint misMatch; \" Number of bases that don't match \"\n uint repMatch; \" Number of bases that match but are part of repeats \"\n uint nCount; \" Number of 'N' bases \"\n uint seqType; \"0=empty, 1=nucleotide, 2=amino_acid\"\n )";
exports.defaultBedSchema = "table defaultBedSchema\n\"BED12\"\n (\n string chrom; \"The name of the chromosome (e.g. chr3, chrY, chr2_random) or scaffold (e.g. scaffold10671).\"\n uint chromStart; \"The starting position of the feature in the chromosome or scaffold. The first base in a chromosome is numbered 0.\"\n uint chromEnd; \"The ending position of the feature in the chromosome or scaffold. The chromEnd base is not included in the display of the feature. For example, the first 100 bases of a chromosome are defined as chromStart=0, chromEnd=100, and span the bases numbered 0-99.\"\n string name; \"Defines the name of the BED line.\"\n float score; \"Feature score, doesn't care about the 0-1000 limit as in bed\"\n char strand; \"Defines the strand. Either '.' (=no strand) or '+' or '-'\"\n uint thickStart; \"The starting position at which the feature is drawn thickly (for example, the start codon in gene displays). When there is no thick part, thickStart and thickEnd are usually set to the chromStart position.\"\n uint thickEnd; \"The ending position at which the feature is drawn thickly (for example the stop codon in gene displays).\"\n string itemRgb; \"An RGB value of the form R,G,B (e.g. 255,0,0). \"\n uint blockCount; \" The number of blocks (exons) in the BED line.\"\n uint[blockCount] blockSizes; \" A comma-separated list of the block sizes. The number of items in this list should correspond to blockCount.\"\n uint[blockCount] blockStarts; \"A comma-separated list of block starts. All of the blockStart positions should be calculated relative to chromStart. The number of items in this list should correspond to blockCount.\"\n )";
exports.mafFrames = "table mafFrames\n\"codon frame assignment for MAF components\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start range in chromosome\"\n uint chromEnd; \"End range in chromosome\"\n string src; \"Name of sequence source in MAF\"\n ubyte frame; \"frame (0,1,2) for first base(+) or last bast(-)\"\n char[1] strand; \"+ or -\"\n string name; \"Name of gene used to define frame\"\n int prevFramePos; \"target position of the previous base (in transcription direction) that continues this frame, or -1 if none, or frame not contiguous\"\n int nextFramePos; \"target position of the next base (in transcription direction) that continues this frame, or -1 if none, or frame not contiguous\"\n ubyte isExonStart; \"does this start the CDS portion of an exon?\"\n ubyte isExonEnd; \"does this end the CDS portion of an exon?\"\n )";
exports.mafSummary = "table mafSummary\n\"Positions and scores for alignment blocks\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string src; \"Sequence name or database of alignment\"\n float score; \"Floating point score.\"\n char[1] leftStatus; \"Gap/break annotation for preceding block\"\n char[1] rightStatus; \"Gap/break annotation for following block\"\n )";
//# sourceMappingURL=autoSqlSchemas.js.map

@@ -7,1795 +7,1510 @@ /*

"use strict";
function peg$subclass(child, parent) {
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor();
}
function peg$SyntaxError(message, expected, found, location) {
this.message = message;
this.expected = expected;
this.found = found;
this.location = location;
this.name = "SyntaxError";
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, peg$SyntaxError);
}
this.message = message;
this.expected = expected;
this.found = found;
this.location = location;
this.name = "SyntaxError";
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, peg$SyntaxError);
}
}
peg$subclass(peg$SyntaxError, Error);
peg$SyntaxError.buildMessage = function (expected, found) {
var DESCRIBE_EXPECTATION_FNS = {
literal: function literal(expectation) {
return "\"" + literalEscape(expectation.text) + "\"";
},
"class": function _class(expectation) {
var escapedParts = "",
i;
for (i = 0; i < expectation.parts.length; i++) {
escapedParts += expectation.parts[i] instanceof Array ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) : classEscape(expectation.parts[i]);
}
return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
},
any: function any(expectation) {
return "any character";
},
end: function end(expectation) {
return "end of input";
},
other: function other(expectation) {
return expectation.description;
var DESCRIBE_EXPECTATION_FNS = {
literal: function (expectation) {
return "\"" + literalEscape(expectation.text) + "\"";
},
"class": function (expectation) {
var escapedParts = "", i;
for (i = 0; i < expectation.parts.length; i++) {
escapedParts += expectation.parts[i] instanceof Array
? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
: classEscape(expectation.parts[i]);
}
return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
},
any: function (expectation) {
return "any character";
},
end: function (expectation) {
return "end of input";
},
other: function (expectation) {
return expectation.description;
}
};
function hex(ch) {
return ch.charCodeAt(0).toString(16).toUpperCase();
}
};
function hex(ch) {
return ch.charCodeAt(0).toString(16).toUpperCase();
}
function literalEscape(s) {
return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) {
return '\\x0' + hex(ch);
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) {
return '\\x' + hex(ch);
});
}
function classEscape(s) {
return s.replace(/\\/g, '\\\\').replace(/\]/g, '\\]').replace(/\^/g, '\\^').replace(/-/g, '\\-').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) {
return '\\x0' + hex(ch);
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) {
return '\\x' + hex(ch);
});
}
function describeExpectation(expectation) {
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
}
function describeExpected(expected) {
var descriptions = new Array(expected.length),
i,
j;
for (i = 0; i < expected.length; i++) {
descriptions[i] = describeExpectation(expected[i]);
function literalEscape(s) {
return s
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.replace(/\0/g, '\\0')
.replace(/\t/g, '\\t')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/[\x00-\x0F]/g, function (ch) { return '\\x0' + hex(ch); })
.replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return '\\x' + hex(ch); });
}
descriptions.sort();
if (descriptions.length > 0) {
for (i = 1, j = 1; i < descriptions.length; i++) {
if (descriptions[i - 1] !== descriptions[i]) {
descriptions[j] = descriptions[i];
j++;
function classEscape(s) {
return s
.replace(/\\/g, '\\\\')
.replace(/\]/g, '\\]')
.replace(/\^/g, '\\^')
.replace(/-/g, '\\-')
.replace(/\0/g, '\\0')
.replace(/\t/g, '\\t')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/[\x00-\x0F]/g, function (ch) { return '\\x0' + hex(ch); })
.replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return '\\x' + hex(ch); });
}
function describeExpectation(expectation) {
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
}
function describeExpected(expected) {
var descriptions = new Array(expected.length), i, j;
for (i = 0; i < expected.length; i++) {
descriptions[i] = describeExpectation(expected[i]);
}
}
descriptions.length = j;
descriptions.sort();
if (descriptions.length > 0) {
for (i = 1, j = 1; i < descriptions.length; i++) {
if (descriptions[i - 1] !== descriptions[i]) {
descriptions[j] = descriptions[i];
j++;
}
}
descriptions.length = j;
}
switch (descriptions.length) {
case 1:
return descriptions[0];
case 2:
return descriptions[0] + " or " + descriptions[1];
default:
return descriptions.slice(0, -1).join(", ")
+ ", or "
+ descriptions[descriptions.length - 1];
}
}
switch (descriptions.length) {
case 1:
return descriptions[0];
case 2:
return descriptions[0] + " or " + descriptions[1];
default:
return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1];
function describeFound(found) {
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
}
}
function describeFound(found) {
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
}
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
};
function peg$parse(input, options) {
options = options !== void 0 ? options : {};
var peg$FAILED = {},
peg$startRuleFunctions = {
declaration: peg$parsedeclaration
},
peg$startRuleFunction = peg$parsedeclaration,
peg$c0 = "(",
peg$c1 = peg$literalExpectation("(", false),
peg$c2 = ")",
peg$c3 = peg$literalExpectation(")", false),
peg$c4 = function peg$c4(type, name, comment, fields) {
return {
type: type,
name: name,
comment: comment,
fields: fields
};
},
peg$c5 = "simple",
peg$c6 = peg$literalExpectation("simple", false),
peg$c7 = "object",
peg$c8 = peg$literalExpectation("object", false),
peg$c9 = "table",
peg$c10 = peg$literalExpectation("table", false),
peg$c11 = "auto",
peg$c12 = peg$literalExpectation("auto", false),
peg$c13 = "primary",
peg$c14 = peg$literalExpectation("primary", false),
peg$c15 = "index",
peg$c16 = peg$literalExpectation("index", false),
peg$c17 = "unique",
peg$c18 = peg$literalExpectation("unique", false),
peg$c19 = function peg$c19(f1, w) {
return w;
},
peg$c20 = function peg$c20(f1, fds) {
if (f1.name) {
fds.unshift(f1);
options = options !== void 0 ? options : {};
var peg$FAILED = {}, peg$startRuleFunctions = { declaration: peg$parsedeclaration }, peg$startRuleFunction = peg$parsedeclaration, peg$c0 = "(", peg$c1 = peg$literalExpectation("(", false), peg$c2 = ")", peg$c3 = peg$literalExpectation(")", false), peg$c4 = function (type, name, comment, fields) { return { type: type, name: name, comment: comment, fields: fields }; }, peg$c5 = "simple", peg$c6 = peg$literalExpectation("simple", false), peg$c7 = "object", peg$c8 = peg$literalExpectation("object", false), peg$c9 = "table", peg$c10 = peg$literalExpectation("table", false), peg$c11 = "auto", peg$c12 = peg$literalExpectation("auto", false), peg$c13 = "primary", peg$c14 = peg$literalExpectation("primary", false), peg$c15 = "index", peg$c16 = peg$literalExpectation("index", false), peg$c17 = "unique", peg$c18 = peg$literalExpectation("unique", false), peg$c19 = function (f1, w) { return w; }, peg$c20 = function (f1, fds) {
if (f1.name) {
fds.unshift(f1);
}
return fds;
}, peg$c21 = "#", peg$c22 = peg$literalExpectation("#", false), peg$c23 = ";", peg$c24 = peg$literalExpectation(";", false), peg$c25 = function (type, name, comment) { return { type: type, name: name, comment: comment }; }, peg$c26 = "[", peg$c27 = peg$literalExpectation("[", false), peg$c28 = "]", peg$c29 = peg$literalExpectation("]", false), peg$c30 = function (type, size, name, comment) { return { type: type, size: size, name: name, comment: comment }; }, peg$c31 = function (type, vals, name, comment) { return { type: type, vals: vals, name: name, comment: comment }; }, peg$c32 = ",", peg$c33 = peg$literalExpectation(",", false), peg$c34 = function (f1, fds) {
fds.unshift(f1);
return fds;
}, peg$c35 = "int", peg$c36 = peg$literalExpectation("int", false), peg$c37 = "uint", peg$c38 = peg$literalExpectation("uint", false), peg$c39 = "short", peg$c40 = peg$literalExpectation("short", false), peg$c41 = "ushort", peg$c42 = peg$literalExpectation("ushort", false), peg$c43 = "byte", peg$c44 = peg$literalExpectation("byte", false), peg$c45 = "ubyte", peg$c46 = peg$literalExpectation("ubyte", false), peg$c47 = "float", peg$c48 = peg$literalExpectation("float", false), peg$c49 = "char", peg$c50 = peg$literalExpectation("char", false), peg$c51 = "string", peg$c52 = peg$literalExpectation("string", false), peg$c53 = "lstring", peg$c54 = peg$literalExpectation("lstring", false), peg$c55 = "enum", peg$c56 = peg$literalExpectation("enum", false), peg$c57 = "double", peg$c58 = peg$literalExpectation("double", false), peg$c59 = "bigint", peg$c60 = peg$literalExpectation("bigint", false), peg$c61 = "set", peg$c62 = peg$literalExpectation("set", false), peg$c63 = function (t, n) { return t + ' ' + n; }, peg$c64 = /^[a-zA-Z_]/, peg$c65 = peg$classExpectation([["a", "z"], ["A", "Z"], "_"], false, false), peg$c66 = /^[a-zA-Z0-9_]/, peg$c67 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_"], false, false), peg$c68 = function (t) { return text(); }, peg$c69 = "\"", peg$c70 = peg$literalExpectation("\"", false), peg$c71 = /^[^"]/, peg$c72 = peg$classExpectation(["\""], true, false), peg$c73 = function (t) { return t.join(''); }, peg$c74 = /^[^\n\r]/, peg$c75 = peg$classExpectation(["\n", "\r"], true, false), peg$c76 = function (t) { return t.join('').replace(/^"/, '').replace(/"$/, ''); }, peg$c77 = peg$otherExpectation("integer"), peg$c78 = /^[0-9]/, peg$c79 = peg$classExpectation([["0", "9"]], false, false), peg$c80 = function () { return parseInt(text(), 10); }, peg$c81 = peg$otherExpectation("whitespace"), peg$c82 = /^[ \t\n\r]/, peg$c83 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false), peg$currPos = 0, peg$savedPos = 0, peg$posDetailsCache = [{ line: 1, column: 1 }], peg$maxFailPos = 0, peg$maxFailExpected = [], peg$silentFails = 0, peg$result;
if ("startRule" in options) {
if (!(options.startRule in peg$startRuleFunctions)) {
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
}
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
}
return fds;
},
peg$c21 = "#",
peg$c22 = peg$literalExpectation("#", false),
peg$c23 = ";",
peg$c24 = peg$literalExpectation(";", false),
peg$c25 = function peg$c25(type, name, comment) {
return {
type: type,
name: name,
comment: comment
};
},
peg$c26 = "[",
peg$c27 = peg$literalExpectation("[", false),
peg$c28 = "]",
peg$c29 = peg$literalExpectation("]", false),
peg$c30 = function peg$c30(type, size, name, comment) {
return {
type: type,
size: size,
name: name,
comment: comment
};
},
peg$c31 = function peg$c31(type, vals, name, comment) {
return {
type: type,
vals: vals,
name: name,
comment: comment
};
},
peg$c32 = ",",
peg$c33 = peg$literalExpectation(",", false),
peg$c34 = function peg$c34(f1, fds) {
fds.unshift(f1);
return fds;
},
peg$c35 = "int",
peg$c36 = peg$literalExpectation("int", false),
peg$c37 = "uint",
peg$c38 = peg$literalExpectation("uint", false),
peg$c39 = "short",
peg$c40 = peg$literalExpectation("short", false),
peg$c41 = "ushort",
peg$c42 = peg$literalExpectation("ushort", false),
peg$c43 = "byte",
peg$c44 = peg$literalExpectation("byte", false),
peg$c45 = "ubyte",
peg$c46 = peg$literalExpectation("ubyte", false),
peg$c47 = "float",
peg$c48 = peg$literalExpectation("float", false),
peg$c49 = "char",
peg$c50 = peg$literalExpectation("char", false),
peg$c51 = "string",
peg$c52 = peg$literalExpectation("string", false),
peg$c53 = "lstring",
peg$c54 = peg$literalExpectation("lstring", false),
peg$c55 = "enum",
peg$c56 = peg$literalExpectation("enum", false),
peg$c57 = "double",
peg$c58 = peg$literalExpectation("double", false),
peg$c59 = "bigint",
peg$c60 = peg$literalExpectation("bigint", false),
peg$c61 = "set",
peg$c62 = peg$literalExpectation("set", false),
peg$c63 = function peg$c63(t, n) {
return t + ' ' + n;
},
peg$c64 = /^[a-zA-Z_]/,
peg$c65 = peg$classExpectation([["a", "z"], ["A", "Z"], "_"], false, false),
peg$c66 = /^[a-zA-Z0-9_]/,
peg$c67 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_"], false, false),
peg$c68 = function peg$c68(t) {
return text();
},
peg$c69 = "\"",
peg$c70 = peg$literalExpectation("\"", false),
peg$c71 = /^[^"]/,
peg$c72 = peg$classExpectation(["\""], true, false),
peg$c73 = function peg$c73(t) {
return t.join('');
},
peg$c74 = /^[^\n\r]/,
peg$c75 = peg$classExpectation(["\n", "\r"], true, false),
peg$c76 = function peg$c76(t) {
return t.join('').replace(/^"/, '').replace(/"$/, '');
},
peg$c77 = peg$otherExpectation("integer"),
peg$c78 = /^[0-9]/,
peg$c79 = peg$classExpectation([["0", "9"]], false, false),
peg$c80 = function peg$c80() {
return parseInt(text(), 10);
},
peg$c81 = peg$otherExpectation("whitespace"),
peg$c82 = /^[ \t\n\r]/,
peg$c83 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false),
peg$currPos = 0,
peg$savedPos = 0,
peg$posDetailsCache = [{
line: 1,
column: 1
}],
peg$maxFailPos = 0,
peg$maxFailExpected = [],
peg$silentFails = 0,
peg$result;
if ("startRule" in options) {
if (!(options.startRule in peg$startRuleFunctions)) {
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
function text() {
return input.substring(peg$savedPos, peg$currPos);
}
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
}
function text() {
return input.substring(peg$savedPos, peg$currPos);
}
function location() {
return peg$computeLocation(peg$savedPos, peg$currPos);
}
function expected(description, location) {
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos);
throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location);
}
function error(message, location) {
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos);
throw peg$buildSimpleError(message, location);
}
function peg$literalExpectation(text, ignoreCase) {
return {
type: "literal",
text: text,
ignoreCase: ignoreCase
};
}
function peg$classExpectation(parts, inverted, ignoreCase) {
return {
type: "class",
parts: parts,
inverted: inverted,
ignoreCase: ignoreCase
};
}
function peg$anyExpectation() {
return {
type: "any"
};
}
function peg$endExpectation() {
return {
type: "end"
};
}
function peg$otherExpectation(description) {
return {
type: "other",
description: description
};
}
function peg$computePosDetails(pos) {
var details = peg$posDetailsCache[pos],
p;
if (details) {
return details;
} else {
p = pos - 1;
while (!peg$posDetailsCache[p]) {
p--;
}
details = peg$posDetailsCache[p];
details = {
line: details.line,
column: details.column
};
while (p < pos) {
if (input.charCodeAt(p) === 10) {
details.line++;
details.column = 1;
} else {
details.column++;
function location() {
return peg$computeLocation(peg$savedPos, peg$currPos);
}
function expected(description, location) {
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos);
throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location);
}
function error(message, location) {
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos);
throw peg$buildSimpleError(message, location);
}
function peg$literalExpectation(text, ignoreCase) {
return { type: "literal", text: text, ignoreCase: ignoreCase };
}
function peg$classExpectation(parts, inverted, ignoreCase) {
return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
}
function peg$anyExpectation() {
return { type: "any" };
}
function peg$endExpectation() {
return { type: "end" };
}
function peg$otherExpectation(description) {
return { type: "other", description: description };
}
function peg$computePosDetails(pos) {
var details = peg$posDetailsCache[pos], p;
if (details) {
return details;
}
p++;
}
peg$posDetailsCache[pos] = details;
return details;
else {
p = pos - 1;
while (!peg$posDetailsCache[p]) {
p--;
}
details = peg$posDetailsCache[p];
details = {
line: details.line,
column: details.column
};
while (p < pos) {
if (input.charCodeAt(p) === 10) {
details.line++;
details.column = 1;
}
else {
details.column++;
}
p++;
}
peg$posDetailsCache[pos] = details;
return details;
}
}
}
function peg$computeLocation(startPos, endPos) {
var startPosDetails = peg$computePosDetails(startPos),
endPosDetails = peg$computePosDetails(endPos);
return {
start: {
offset: startPos,
line: startPosDetails.line,
column: startPosDetails.column
},
end: {
offset: endPos,
line: endPosDetails.line,
column: endPosDetails.column
}
};
}
function peg$fail(expected) {
if (peg$currPos < peg$maxFailPos) {
return;
function peg$computeLocation(startPos, endPos) {
var startPosDetails = peg$computePosDetails(startPos), endPosDetails = peg$computePosDetails(endPos);
return {
start: {
offset: startPos,
line: startPosDetails.line,
column: startPosDetails.column
},
end: {
offset: endPos,
line: endPosDetails.line,
column: endPosDetails.column
}
};
}
if (peg$currPos > peg$maxFailPos) {
peg$maxFailPos = peg$currPos;
peg$maxFailExpected = [];
function peg$fail(expected) {
if (peg$currPos < peg$maxFailPos) {
return;
}
if (peg$currPos > peg$maxFailPos) {
peg$maxFailPos = peg$currPos;
peg$maxFailExpected = [];
}
peg$maxFailExpected.push(expected);
}
peg$maxFailExpected.push(expected);
}
function peg$buildSimpleError(message, location) {
return new peg$SyntaxError(message, null, null, location);
}
function peg$buildStructuredError(expected, found, location) {
return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);
}
function peg$parsedeclaration() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parsedeclareType();
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parsedeclareName();
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parsecomment();
if (s6 !== peg$FAILED) {
s7 = peg$parse_();
if (s7 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s8 = peg$c0;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c1);
}
}
if (s8 !== peg$FAILED) {
s9 = peg$parse_();
if (s9 !== peg$FAILED) {
s10 = peg$parsefieldList();
if (s10 !== peg$FAILED) {
s11 = peg$parse_();
if (s11 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s12 = peg$c2;
peg$currPos++;
} else {
s12 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c3);
function peg$buildSimpleError(message, location) {
return new peg$SyntaxError(message, null, null, location);
}
function peg$buildStructuredError(expected, found, location) {
return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);
}
function peg$parsedeclaration() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parsedeclareType();
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parsedeclareName();
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parsecomment();
if (s6 !== peg$FAILED) {
s7 = peg$parse_();
if (s7 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s8 = peg$c0;
peg$currPos++;
}
else {
s8 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c1);
}
}
if (s8 !== peg$FAILED) {
s9 = peg$parse_();
if (s9 !== peg$FAILED) {
s10 = peg$parsefieldList();
if (s10 !== peg$FAILED) {
s11 = peg$parse_();
if (s11 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s12 = peg$c2;
peg$currPos++;
}
else {
s12 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c3);
}
}
if (s12 !== peg$FAILED) {
s13 = peg$parse_();
if (s13 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c4(s2, s4, s6, s10);
s0 = s1;
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
}
if (s12 !== peg$FAILED) {
s13 = peg$parse_();
if (s13 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c4(s2, s4, s6, s10);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
return s0;
}
return s0;
}
function peg$parsedeclareType() {
var s0;
if (input.substr(peg$currPos, 6) === peg$c5) {
s0 = peg$c5;
peg$currPos += 6;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c6);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c7) {
s0 = peg$c7;
peg$currPos += 6;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c8);
function peg$parsedeclareType() {
var s0;
if (input.substr(peg$currPos, 6) === peg$c5) {
s0 = peg$c5;
peg$currPos += 6;
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c9) {
s0 = peg$c9;
peg$currPos += 5;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c10);
}
}
}
}
return s0;
}
function peg$parsedeclareName() {
var s0, s1, s2, s3;
s0 = peg$parsename();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsename();
if (s1 !== peg$FAILED) {
s2 = peg$parseindexType();
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsename();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c11) {
s2 = peg$c11;
peg$currPos += 4;
} else {
s2 = peg$FAILED;
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c12);
peg$fail(peg$c6);
}
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsename();
if (s1 !== peg$FAILED) {
s2 = peg$parseindexType();
if (s2 !== peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c11) {
s3 = peg$c11;
peg$currPos += 4;
} else {
s3 = peg$FAILED;
if (input.substr(peg$currPos, 6) === peg$c7) {
s0 = peg$c7;
peg$currPos += 6;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c12);
peg$fail(peg$c8);
}
}
if (s3 !== peg$FAILED) {
s1 = [s1, s2, s3];
s0 = s1;
} else {
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c9) {
s0 = peg$c9;
peg$currPos += 5;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c10);
}
}
}
}
return s0;
}
function peg$parsedeclareName() {
var s0, s1, s2, s3;
s0 = peg$parsename();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsename();
if (s1 !== peg$FAILED) {
s2 = peg$parseindexType();
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsename();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c11) {
s2 = peg$c11;
peg$currPos += 4;
}
else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c12);
}
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsename();
if (s1 !== peg$FAILED) {
s2 = peg$parseindexType();
if (s2 !== peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c11) {
s3 = peg$c11;
peg$currPos += 4;
}
else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c12);
}
}
if (s3 !== peg$FAILED) {
s1 = [s1, s2, s3];
s0 = s1;
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
}
}
}
return s0;
}
return s0;
}
function peg$parseindexType() {
var s0;
if (input.substr(peg$currPos, 7) === peg$c13) {
s0 = peg$c13;
peg$currPos += 7;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c14);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c15) {
s0 = peg$c15;
peg$currPos += 5;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
function peg$parseindexType() {
var s0;
if (input.substr(peg$currPos, 7) === peg$c13) {
s0 = peg$c13;
peg$currPos += 7;
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c17) {
s0 = peg$c17;
peg$currPos += 6;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c14);
}
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c15) {
s0 = peg$c15;
peg$currPos += 5;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c17) {
s0 = peg$c17;
peg$currPos += 6;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
}
}
return s0;
}
return s0;
}
function peg$parsecomment() {
var s0;
s0 = peg$parsenonQuotedString();
if (s0 === peg$FAILED) {
s0 = peg$parse_();
function peg$parsecomment() {
var s0;
s0 = peg$parsenonQuotedString();
if (s0 === peg$FAILED) {
s0 = peg$parse_();
}
return s0;
}
return s0;
}
function peg$parsefieldList() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$parsefield();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$currPos;
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parsefield();
if (s6 !== peg$FAILED) {
peg$savedPos = s4;
s5 = peg$c19(s1, s6);
s4 = s5;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$currPos;
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parsefield();
if (s6 !== peg$FAILED) {
peg$savedPos = s4;
s5 = peg$c19(s1, s6);
s4 = s5;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
function peg$parsefieldList() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$parsefield();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$currPos;
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parsefield();
if (s6 !== peg$FAILED) {
peg$savedPos = s4;
s5 = peg$c19(s1, s6);
s4 = s5;
}
else {
peg$currPos = s4;
s4 = peg$FAILED;
}
}
else {
peg$currPos = s4;
s4 = peg$FAILED;
}
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$currPos;
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parsefield();
if (s6 !== peg$FAILED) {
peg$savedPos = s4;
s5 = peg$c19(s1, s6);
s4 = s5;
}
else {
peg$currPos = s4;
s4 = peg$FAILED;
}
}
else {
peg$currPos = s4;
s4 = peg$FAILED;
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c20(s1, s3);
s0 = s1;
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c20(s1, s3);
s0 = s1;
} else {
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
return s0;
}
return s0;
}
function peg$parsecommentStart() {
var s0;
if (input.charCodeAt(peg$currPos) === 35) {
s0 = peg$c21;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c22);
}
}
return s0;
}
function peg$parseinternalComment() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parsecommentStart();
if (s2 !== peg$FAILED) {
s3 = peg$parsenonQuotedString();
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
s1 = [s1, s2, s3, s4];
s0 = s1;
} else {
peg$currPos = s0;
function peg$parsecommentStart() {
var s0;
if (input.charCodeAt(peg$currPos) === 35) {
s0 = peg$c21;
peg$currPos++;
}
else {
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c22);
}
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
return s0;
}
return s0;
}
function peg$parsefield() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;
s0 = peg$currPos;
s1 = peg$parsefieldType();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parsename();
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 59) {
s5 = peg$c23;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c24);
}
function peg$parseinternalComment() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parsecommentStart();
if (s2 !== peg$FAILED) {
s3 = peg$parsenonQuotedString();
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
s1 = [s1, s2, s3, s4];
s0 = s1;
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse_();
if (s6 !== peg$FAILED) {
s7 = peg$parsecomment();
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c25(s1, s3, s7);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
return s0;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsefieldType();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 91) {
s3 = peg$c26;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c27);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
s5 = peg$parsefieldSize();
if (s5 !== peg$FAILED) {
s6 = peg$parse_();
if (s6 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 93) {
s7 = peg$c28;
peg$currPos++;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c29);
}
}
if (s7 !== peg$FAILED) {
s8 = peg$parse_();
if (s8 !== peg$FAILED) {
s9 = peg$parsename();
if (s9 !== peg$FAILED) {
s10 = peg$parse_();
if (s10 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 59) {
s11 = peg$c23;
function peg$parsefield() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;
s0 = peg$currPos;
s1 = peg$parsefieldType();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parsename();
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 59) {
s5 = peg$c23;
peg$currPos++;
} else {
s11 = peg$FAILED;
}
else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c24);
peg$fail(peg$c24);
}
}
if (s11 !== peg$FAILED) {
s12 = peg$parse_();
if (s12 !== peg$FAILED) {
s13 = peg$parsecomment();
if (s13 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c30(s1, s5, s9, s13);
s0 = s1;
} else {
}
if (s5 !== peg$FAILED) {
s6 = peg$parse_();
if (s6 !== peg$FAILED) {
s7 = peg$parsecomment();
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c25(s1, s3, s7);
s0 = s1;
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsefieldType();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s3 = peg$c0;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c1);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
s5 = peg$parsefieldValues();
if (s5 !== peg$FAILED) {
s6 = peg$parse_();
if (s6 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s7 = peg$c2;
peg$currPos++;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c3);
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsefieldType();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 91) {
s3 = peg$c26;
peg$currPos++;
}
if (s7 !== peg$FAILED) {
s8 = peg$parse_();
if (s8 !== peg$FAILED) {
s9 = peg$parsename();
if (s9 !== peg$FAILED) {
s10 = peg$parse_();
if (s10 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 59) {
s11 = peg$c23;
peg$currPos++;
} else {
s11 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c24);
}
else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c27);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
s5 = peg$parsefieldSize();
if (s5 !== peg$FAILED) {
s6 = peg$parse_();
if (s6 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 93) {
s7 = peg$c28;
peg$currPos++;
}
else {
s7 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c29);
}
}
if (s7 !== peg$FAILED) {
s8 = peg$parse_();
if (s8 !== peg$FAILED) {
s9 = peg$parsename();
if (s9 !== peg$FAILED) {
s10 = peg$parse_();
if (s10 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 59) {
s11 = peg$c23;
peg$currPos++;
}
else {
s11 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c24);
}
}
if (s11 !== peg$FAILED) {
s12 = peg$parse_();
if (s12 !== peg$FAILED) {
s13 = peg$parsecomment();
if (s13 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c30(s1, s5, s9, s13);
s0 = s1;
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
if (s11 !== peg$FAILED) {
s12 = peg$parse_();
if (s12 !== peg$FAILED) {
s13 = peg$parsecomment();
if (s13 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c31(s1, s5, s9, s13);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsefieldType();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s3 = peg$c0;
peg$currPos++;
}
else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c1);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
s5 = peg$parsefieldValues();
if (s5 !== peg$FAILED) {
s6 = peg$parse_();
if (s6 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s7 = peg$c2;
peg$currPos++;
}
else {
s7 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c3);
}
}
if (s7 !== peg$FAILED) {
s8 = peg$parse_();
if (s8 !== peg$FAILED) {
s9 = peg$parsename();
if (s9 !== peg$FAILED) {
s10 = peg$parse_();
if (s10 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 59) {
s11 = peg$c23;
peg$currPos++;
}
else {
s11 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c24);
}
}
if (s11 !== peg$FAILED) {
s12 = peg$parse_();
if (s12 !== peg$FAILED) {
s13 = peg$parsecomment();
if (s13 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c31(s1, s5, s9, s13);
s0 = s1;
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
} else {
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
if (s0 === peg$FAILED) {
s0 = peg$parseinternalComment();
}
}
}
return s0;
}
function peg$parsefieldValues() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$parsename();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 44) {
s4 = peg$c32;
peg$currPos++;
}
else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c33);
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parsename();
if (s6 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c19(s1, s6);
s3 = s4;
}
else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 44) {
s4 = peg$c32;
peg$currPos++;
}
else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c33);
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parsename();
if (s6 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c19(s1, s6);
s3 = s4;
}
else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c34(s1, s2);
s0 = s1;
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$parseinternalComment();
}
}
return s0;
}
return s0;
}
function peg$parsefieldValues() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$parsename();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 44) {
s4 = peg$c32;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c33);
function peg$parsefieldType() {
var s0, s1, s2, s3;
if (input.substr(peg$currPos, 3) === peg$c35) {
s0 = peg$c35;
peg$currPos += 3;
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parsename();
if (s6 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c19(s1, s6);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 44) {
s4 = peg$c32;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c33);
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parsename();
if (s6 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c19(s1, s6);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c36);
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c34(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsefieldType() {
var s0, s1, s2, s3;
if (input.substr(peg$currPos, 3) === peg$c35) {
s0 = peg$c35;
peg$currPos += 3;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c36);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c37) {
s0 = peg$c37;
peg$currPos += 4;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c38);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c39) {
s0 = peg$c39;
peg$currPos += 5;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c40);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c41) {
s0 = peg$c41;
peg$currPos += 6;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c42);
if (input.substr(peg$currPos, 4) === peg$c37) {
s0 = peg$c37;
peg$currPos += 4;
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c43) {
s0 = peg$c43;
peg$currPos += 4;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c44);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c45) {
s0 = peg$c45;
peg$currPos += 5;
} else {
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c46);
peg$fail(peg$c38);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c47) {
s0 = peg$c47;
peg$currPos += 5;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c48);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c39) {
s0 = peg$c39;
peg$currPos += 5;
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c49) {
s0 = peg$c49;
peg$currPos += 4;
} else {
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c50);
peg$fail(peg$c40);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c51) {
s0 = peg$c51;
peg$currPos += 6;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c52);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c41) {
s0 = peg$c41;
peg$currPos += 6;
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 7) === peg$c53) {
s0 = peg$c53;
peg$currPos += 7;
} else {
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c54);
peg$fail(peg$c42);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c55) {
s0 = peg$c55;
peg$currPos += 4;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c56);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c43) {
s0 = peg$c43;
peg$currPos += 4;
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c57) {
s0 = peg$c57;
peg$currPos += 6;
} else {
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c58);
peg$fail(peg$c44);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c59) {
s0 = peg$c59;
peg$currPos += 6;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c60);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c45) {
s0 = peg$c45;
peg$currPos += 5;
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 3) === peg$c61) {
s0 = peg$c61;
peg$currPos += 3;
} else {
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c62);
peg$fail(peg$c46);
}
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsedeclareType();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parsedeclareName();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c63(s1, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c47) {
s0 = peg$c47;
peg$currPos += 5;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c48);
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c49) {
s0 = peg$c49;
peg$currPos += 4;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c50);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c51) {
s0 = peg$c51;
peg$currPos += 6;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c52);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 7) === peg$c53) {
s0 = peg$c53;
peg$currPos += 7;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c54);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c55) {
s0 = peg$c55;
peg$currPos += 4;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c56);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c57) {
s0 = peg$c57;
peg$currPos += 6;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c58);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c59) {
s0 = peg$c59;
peg$currPos += 6;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c60);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 3) === peg$c61) {
s0 = peg$c61;
peg$currPos += 3;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c62);
}
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsedeclareType();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parsedeclareName();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c63(s1, s3);
s0 = s1;
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return s0;
}
return s0;
}
function peg$parsefieldSize() {
var s0;
s0 = peg$parsenumber();
if (s0 === peg$FAILED) {
s0 = peg$parsename();
function peg$parsefieldSize() {
var s0;
s0 = peg$parsenumber();
if (s0 === peg$FAILED) {
s0 = peg$parsename();
}
return s0;
}
return s0;
}
function peg$parsename() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$currPos;
if (peg$c64.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c65);
}
}
if (s2 !== peg$FAILED) {
s3 = [];
if (peg$c66.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c67);
function peg$parsename() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$currPos;
if (peg$c64.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
}
}
while (s4 !== peg$FAILED) {
s3.push(s4);
if (peg$c66.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c67);
}
else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c65);
}
}
}
if (s3 !== peg$FAILED) {
s2 = [s2, s3];
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c68(s1);
}
s0 = s1;
return s0;
}
function peg$parsequotedString() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 34) {
s1 = peg$c69;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c70);
}
}
if (s1 !== peg$FAILED) {
s2 = [];
if (peg$c71.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c72);
if (s2 !== peg$FAILED) {
s3 = [];
if (peg$c66.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
}
else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c67);
}
}
while (s4 !== peg$FAILED) {
s3.push(s4);
if (peg$c66.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
}
else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c67);
}
}
}
if (s3 !== peg$FAILED) {
s2 = [s2, s3];
s1 = s2;
}
else {
peg$currPos = s1;
s1 = peg$FAILED;
}
}
}
while (s3 !== peg$FAILED) {
s2.push(s3);
if (peg$c71.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c72);
}
else {
peg$currPos = s1;
s1 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c68(s1);
}
s0 = s1;
return s0;
}
function peg$parsequotedString() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 34) {
s3 = peg$c69;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c70);
}
s1 = peg$c69;
peg$currPos++;
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c73(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c70);
}
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsenonQuotedString() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
if (peg$c74.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c75);
}
}
while (s2 !== peg$FAILED) {
s1.push(s2);
if (peg$c74.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c75);
if (s1 !== peg$FAILED) {
s2 = [];
if (peg$c71.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
}
else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c72);
}
}
while (s3 !== peg$FAILED) {
s2.push(s3);
if (peg$c71.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
}
else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c72);
}
}
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 34) {
s3 = peg$c69;
peg$currPos++;
}
else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c70);
}
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c73(s2);
s0 = s1;
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c76(s1);
}
s0 = s1;
return s0;
}
function peg$parsenumber() {
var s0, s1, s2, s3;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = [];
if (peg$c78.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c79);
function peg$parsenonQuotedString() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
if (peg$c74.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
}
}
if (s3 !== peg$FAILED) {
while (s3 !== peg$FAILED) {
s2.push(s3);
if (peg$c78.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c79);
peg$fail(peg$c75);
}
}
}
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c80();
while (s2 !== peg$FAILED) {
s1.push(s2);
if (peg$c74.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
}
else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c75);
}
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c76(s1);
}
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
return s0;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c77);
}
function peg$parsenumber() {
var s0, s1, s2, s3;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = [];
if (peg$c78.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
}
else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c79);
}
}
if (s3 !== peg$FAILED) {
while (s3 !== peg$FAILED) {
s2.push(s3);
if (peg$c78.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
}
else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c79);
}
}
}
}
else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c80();
s0 = s1;
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c77);
}
}
return s0;
}
return s0;
}
function peg$parse_() {
var s0, s1;
peg$silentFails++;
s0 = [];
if (peg$c82.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c83);
}
}
while (s1 !== peg$FAILED) {
s0.push(s1);
if (peg$c82.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c83);
function peg$parse_() {
var s0, s1;
peg$silentFails++;
s0 = [];
if (peg$c82.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
}
}
else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c83);
}
}
while (s1 !== peg$FAILED) {
s0.push(s1);
if (peg$c82.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
}
else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c83);
}
}
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c81);
}
}
return s0;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c81);
}
peg$result = peg$startRuleFunction();
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
return peg$result;
}
return s0;
}
peg$result = peg$startRuleFunction();
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
return peg$result;
} else {
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
peg$fail(peg$endExpectation());
else {
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
peg$fail(peg$endExpectation());
}
throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
}
throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
}
}
module.exports = {
SyntaxError: peg$SyntaxError,
parse: peg$parse
};
SyntaxError: peg$SyntaxError,
parse: peg$parse
};
//# sourceMappingURL=autoSql.js.map
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
Object.defineProperty(exports, "__esModule", {
value: true
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
exports.default = void 0;
var _autoSql = require("./autoSql");
var types = _interopRequireWildcard(require("./as/autoSqlSchemas"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
var _default = Object.fromEntries(Object.entries(types).map(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
key = _ref2[0],
val = _ref2[1];
return [key, (0, _autoSql.parse)(val.trim())];
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var autoSql_1 = require("./autoSql");
var types = __importStar(require("./as/autoSqlSchemas"));
exports.default = Object.fromEntries(Object.entries(types).map(function (_a) {
var key = _a[0], val = _a[1];
return [key, (0, autoSql_1.parse)(val.trim())];
}));
exports.default = _default;
//# sourceMappingURL=defaultTypes.js.map
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _parser = _interopRequireDefault(require("./parser"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = _parser.default;
exports.default = _default;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var parser_1 = __importDefault(require("./parser"));
exports.default = parser_1.default;
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _autoSql = _interopRequireDefault(require("./autoSql"));
var _defaultTypes = _interopRequireDefault(require("./defaultTypes"));
var _util = require("./util");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var strandMap = {
".": 0,
"-": -1,
"+": 1
}; // heuristic that a BED file is BED12 like...the number in col 10 is blockCount-like
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var autoSql_1 = __importDefault(require("./autoSql"));
var defaultTypes_1 = __importDefault(require("./defaultTypes"));
var util_1 = require("./util");
var strandMap = { '.': 0, '-': -1, '+': 1 };
// heuristic that a BED file is BED12 like...the number in col 10 is blockCount-like
function isBed12Like(fields) {
var _fields$;
return fields.length >= 12 && !Number.isNaN(parseInt(fields[9], 10)) && ((_fields$ = fields[10]) === null || _fields$ === void 0 ? void 0 : _fields$.split(",").filter(function (f) {
return !!f;
}).length) === parseInt(fields[9], 10);
var _a;
return (fields.length >= 12 &&
!Number.isNaN(parseInt(fields[9], 10)) &&
((_a = fields[10]) === null || _a === void 0 ? void 0 : _a.split(',').filter(function (f) { return !!f; }).length) === parseInt(fields[9], 10));
}
var BED = /*#__PURE__*/function () {
function BED() {
var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_classCallCheck(this, BED);
if (args.autoSql) {
this.autoSql = (0, _util.detectTypes)(_autoSql.default.parse(args.autoSql));
} else if (args.type) {
if (!_defaultTypes.default[args.type]) {
throw new Error("Type not found");
}
this.autoSql = (0, _util.detectTypes)(_defaultTypes.default[args.type]);
} else {
this.autoSql = (0, _util.detectTypes)(_defaultTypes.default.defaultBedSchema);
this.attemptDefaultBed = true;
var BED = /** @class */ (function () {
function BED(args) {
if (args === void 0) { args = {}; }
if (args.autoSql) {
this.autoSql = (0, util_1.detectTypes)(autoSql_1.default.parse(args.autoSql));
}
else if (args.type) {
if (!defaultTypes_1.default[args.type]) {
throw new Error('Type not found');
}
this.autoSql = (0, util_1.detectTypes)(defaultTypes_1.default[args.type]);
}
else {
this.autoSql = (0, util_1.detectTypes)(defaultTypes_1.default.defaultBedSchema);
this.attemptDefaultBed = true;
}
}
}
/*
* parses a line of text as a BED line with the loaded autoSql schema
*
* @param line - a BED line as tab delimited text or array
* @param opts - supply opts.uniqueId
* @return a object representing a feature
*/
_createClass(BED, [{
key: "parseLine",
value: function parseLine(line) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var autoSql = this.autoSql;
var uniqueId = opts.uniqueId;
var fields = line;
if (!Array.isArray(line)) {
if (line.startsWith("track") || line.startsWith("browser")) {
throw new Error("track and browser line parsing is not supported, please filter:\n".concat(line));
/*
* parses a line of text as a BED line with the loaded autoSql schema
*
* @param line - a BED line as tab delimited text or array
* @param opts - supply opts.uniqueId
* @return a object representing a feature
*/
BED.prototype.parseLine = function (line, opts) {
if (opts === void 0) { opts = {}; }
var autoSql = this.autoSql;
var uniqueId = opts.uniqueId;
var fields = line;
if (!Array.isArray(line)) {
if (line.startsWith('track') || line.startsWith('browser')) {
throw new Error("track and browser line parsing is not supported, please filter:\n".concat(line));
}
fields = line.split('\t');
}
fields = line.split("\t");
}
var feature = {};
if (!this.attemptDefaultBed || this.attemptDefaultBed && isBed12Like(fields)) {
for (var i = 0; i < autoSql.fields.length; i++) {
var autoField = autoSql.fields[i];
var columnVal = fields[i];
var isNumeric = autoField.isNumeric,
isArray = autoField.isArray,
arrayIsNumeric = autoField.arrayIsNumeric,
name = autoField.name;
if (columnVal === null || columnVal === undefined) {
break;
}
if (columnVal !== ".") {
if (isNumeric) {
var num = Number(columnVal);
columnVal = Number.isNaN(num) ? columnVal : num;
} else if (isArray) {
columnVal = columnVal.split(",");
if (columnVal[columnVal.length - 1] === "") {
columnVal.pop();
}
if (arrayIsNumeric) {
columnVal = columnVal.map(function (str) {
return Number(str);
});
}
var feature = {};
if (!this.attemptDefaultBed ||
(this.attemptDefaultBed && isBed12Like(fields))) {
for (var i = 0; i < autoSql.fields.length; i++) {
var autoField = autoSql.fields[i];
var columnVal = fields[i];
var isNumeric = autoField.isNumeric, isArray = autoField.isArray, arrayIsNumeric = autoField.arrayIsNumeric, name_1 = autoField.name;
if (columnVal === null || columnVal === undefined) {
break;
}
if (columnVal !== '.') {
if (isNumeric) {
var num = Number(columnVal);
columnVal = Number.isNaN(num) ? columnVal : num;
}
else if (isArray) {
columnVal = columnVal.split(',');
if (columnVal[columnVal.length - 1] === '') {
columnVal.pop();
}
if (arrayIsNumeric) {
columnVal = columnVal.map(function (str) { return Number(str); });
}
}
feature[name_1] = columnVal;
}
}
feature[name] = columnVal;
}
}
} else {
var fieldNames = ["chrom", "chromStart", "chromEnd", "name"];
feature = Object.fromEntries(fields.map(function (f, i) {
return [fieldNames[i] || "field" + i, f];
}));
feature.chromStart = +feature.chromStart;
feature.chromEnd = +feature.chromEnd;
if (!Number.isNaN(Number.parseFloat(feature.field4))) {
feature.score = +feature.field4;
delete feature.field4;
else {
var fieldNames_1 = ['chrom', 'chromStart', 'chromEnd', 'name'];
feature = Object.fromEntries(fields.map(function (f, i) { return [fieldNames_1[i] || 'field' + i, f]; }));
feature.chromStart = +feature.chromStart;
feature.chromEnd = +feature.chromEnd;
if (!Number.isNaN(Number.parseFloat(feature.field4))) {
feature.score = +feature.field4;
delete feature.field4;
}
if (feature.field5 === '+' || feature.field5 === '-') {
feature.strand = feature.field5;
delete feature.field5;
}
}
if (feature.field5 === "+" || feature.field5 === "-") {
feature.strand = feature.field5;
delete feature.field5;
if (uniqueId) {
feature.uniqueId = uniqueId;
}
}
if (uniqueId) {
feature.uniqueId = uniqueId;
}
feature.strand = strandMap[feature.strand] || 0;
feature.chrom = decodeURIComponent(feature.chrom);
return feature;
}
}]);
return BED;
}();
exports.default = BED;
feature.strand = strandMap[feature.strand] || 0;
feature.chrom = decodeURIComponent(feature.chrom);
return feature;
};
return BED;
}());
exports.default = BED;
//# sourceMappingURL=parser.js.map
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.detectTypes = detectTypes;
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.detectTypes = void 0;
/*

@@ -24,23 +25,19 @@ * adds some type annotations to the autoSql schema

function detectTypes(autoSql) {
var numericTypes = ['uint', 'int', 'float', 'long'];
var fields = autoSql.fields.map(function (autoField) {
var type = {};
if (!autoField.size && numericTypes.includes(autoField.type)) {
type.isNumeric = true;
}
if (autoField.size && autoField.type !== 'char') {
type.isArray = true;
}
if (autoField.size && numericTypes.includes(autoField.type)) {
type.arrayIsNumeric = true;
}
return _objectSpread(_objectSpread({}, autoField), type);
});
return _objectSpread(_objectSpread({}, autoSql), {}, {
fields: fields
});
}
var numericTypes = ['uint', 'int', 'float', 'long'];
var fields = autoSql.fields.map(function (autoField) {
var type = {};
if (!autoField.size && numericTypes.includes(autoField.type)) {
type.isNumeric = true;
}
if (autoField.size && autoField.type !== 'char') {
type.isArray = true;
}
if (autoField.size && numericTypes.includes(autoField.type)) {
type.arrayIsNumeric = true;
}
return __assign(__assign({}, autoField), type);
});
return __assign(__assign({}, autoSql), { fields: fields });
}
exports.detectTypes = detectTypes;
//# sourceMappingURL=util.js.map
{
"name": "@gmod/bed",
"version": "2.0.6",
"version": "2.0.7",
"description": "A BED file format parser with autoSql support",
"main": "dist/index.js",
"module": "esm/index.js",
"repository": "github:GMOD/bed-js",

@@ -18,3 +19,4 @@ "author": {

"files": [
"dist"
"dist",
"esm"
],

@@ -25,8 +27,11 @@ "engines": {

"scripts": {
"lint": "eslint --report-unused-disable-directives --max-warnings 0 --ext .js,.ts src test",
"test": "jest",
"coverage": "npm test -- --coverage",
"clean": "rimraf dist",
"clean": "rimraf dist esm",
"generate": "pegjs -o src/autoSql.js autoSql.pegjs",
"prebuild": "npm run clean",
"build": "npm run generate && babel src --out-dir dist",
"build:esm": "tsc --target es2018 --outDir esm",
"build:es5": "tsc --target es5 --outDir dist",
"build": "npm run generate && npm run build:esm && npm run build:es5",
"preversion": "npm test && npm run build",

@@ -37,12 +42,16 @@ "version": "standard-changelog && git add CHANGELOG.md",

"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.4.0",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.3.1",
"babel-jest": "^27.0.6",
"jest": "^26.0.1",
"@types/jest": "^27.0.3",
"@typescript-eslint/eslint-plugin": "^5.7.0",
"@typescript-eslint/parser": "^5.7.0",
"eslint": "^7.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.4.5",
"pegjs": "^0.10.0",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"standard-changelog": "^2.0.24"
"standard-changelog": "^2.0.24",
"ts-jest": "^27.1.2",
"typescript": "^4.5.4"
},

@@ -58,9 +67,3 @@ "keywords": [

"access": "public"
},
"jest": {
"testEnvironment": "node",
"transform": {
"\\.js$": "babel-jest"
}
}
}
# bed-js
[![Build Status](https://travis-ci.com/GMOD/bed-js.svg?branch=master)](https://travis-ci.com/GMOD/bed-js)
[![Coverage Status](https://img.shields.io/codecov/c/github/GMOD/bed-js/master.svg?style=flat-square)](https://codecov.io/gh/GMOD/bed-js/branch/master)
[![Build Status](https://img.shields.io/github/workflow/status/GMOD/bed-js/Push/master?logo=github&style=flat-query)](https://github.com/GMOD/bed-js/actions?query=branch%3Amaster+workflow%3APush+)

@@ -15,5 +15,5 @@ Performs parsing of BED files including autoSql

```js
var parser = new BED();
var text = fs.readFileSync("file.txt", "utf8");
var results = text.split("\n").map((line) => parser.parseLine(line));
var parser = new BED()
var text = fs.readFileSync('file.txt', 'utf8')
var results = text.split('\n').map(line => parser.parseLine(line))
```

@@ -65,5 +65,5 @@

```js
const p = new BED();
const p = new BED()
p.parseLine("chr1\t0\t100");
p.parseLine('chr1\t0\t100')
// outputs { chrom: 'chr1', chromStart: 0, chromEnd: 100, strand: 0 }

@@ -70,0 +70,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc